summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/battle/animations.asm18
-rw-r--r--engine/battle/battle_transitions.asm4
-rwxr-xr-xengine/battle/core.asm56
-rw-r--r--engine/battle/effects.asm7
-rw-r--r--engine/battle/experience.asm14
-rw-r--r--engine/battle/ghost_marowak_anim.asm2
-rw-r--r--engine/battle/move_effects/heal.asm6
-rw-r--r--engine/battle/move_effects/reflect_light_screen.asm6
-rw-r--r--engine/battle/move_effects/transform.asm2
-rwxr-xr-xengine/battle/safari_zone.asm10
-rw-r--r--engine/battle/scale_sprites.asm10
-rw-r--r--engine/battle/trainer_ai.asm6
-rwxr-xr-xengine/events/card_key.asm3
-rwxr-xr-xengine/gfx/palettes.asm10
-rw-r--r--engine/gfx/sprite_oam.asm2
-rw-r--r--engine/items/inventory.asm6
-rwxr-xr-xengine/items/item_effects.asm4
-rwxr-xr-xengine/items/tms.asm2
-rwxr-xr-xengine/items/town_map.asm2
-rw-r--r--engine/joypad.asm8
-rw-r--r--engine/link/print_waiting_text.asm9
-rw-r--r--engine/math/bcd.asm4
-rwxr-xr-xengine/menus/pokedex.asm16
-rwxr-xr-xengine/minigame/surfing_pikachu.asm2
-rwxr-xr-xengine/movie/intro.asm2
-rwxr-xr-xengine/movie/title.asm10
-rwxr-xr-xengine/overworld/map_sprites.asm2
-rw-r--r--engine/overworld/specific_script_flags.asm2
-rwxr-xr-xengine/pikachu/pikachu_movement.asm2
-rwxr-xr-xengine/pikachu/pikachu_pic_animation.asm2
-rw-r--r--engine/pokemon/add_mon.asm8
-rwxr-xr-xengine/pokemon/evos_moves.asm35
-rwxr-xr-xengine/predefs.asm8
-rwxr-xr-xengine/printer/printer2.asm10
34 files changed, 130 insertions, 160 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 3b0fd4ec..4110e8b6 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -57,7 +57,7 @@ DrawFrameBlock:
inc hl
inc de
ld a, [hli]
- add a, $31 ; base tile ID for battle animations
+ add $31 ; base tile ID for battle animations
ld [de], a ; store tile ID
inc de
ld a, [hli]
@@ -91,7 +91,7 @@ DrawFrameBlock:
inc hl
inc de
ld a, [hli]
- add a, $31 ; base tile ID for battle animations
+ add $31 ; base tile ID for battle animations
ld [de], a ; store tile ID
inc de
; toggle horizontal and vertical flip
@@ -99,10 +99,10 @@ DrawFrameBlock:
and a
ld b, OAM_VFLIP | OAM_HFLIP
jr z, .storeFlags1
- cp a, OAM_HFLIP
+ cp OAM_HFLIP
ld b, OAM_VFLIP
jr z, .storeFlags1
- cp a, OAM_VFLIP
+ cp OAM_VFLIP
ld b, OAM_HFLIP
jr z, .storeFlags1
ld b, 0
@@ -160,7 +160,7 @@ DrawFrameBlock:
.afterDrawingTiles
ld a, [wFBMode]
cp FRAMEBLOCKMODE_02
- jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
+ jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer
ld a, [wSubAnimFrameDelay]
ld c, a
call DelayFrames
@@ -1327,7 +1327,7 @@ BattleAnimWriteOAMEntry:
; Y coordinate = e (increased by 8 each call, before the write to OAM)
; X coordinate = [wBaseCoordX]
; tile = d
-; attributes = variable (dependant on coords)
+; attributes = variable (depending on coords)
ld a, $1
ld [wdef5], a
ld a, e
@@ -1402,7 +1402,7 @@ AdjustOAMBlockYPos2:
ret
AnimationBlinkEnemyMon:
- ; Make the enemy mon's sprite blink on and off for a second or two
+; Make the enemy mon's sprite blink on and off for a second or two
ld hl, AnimationBlinkMon
jp CallWithTurnFlipped
@@ -1880,7 +1880,7 @@ _AnimationSlideMonOff:
jr nz, .slideLoop
ret
-; Since mon pic tile numbers go from top to bottom, left to right in order,
+; Since mon pic tile numbers go from top to bottom, left to right in order,
; adding the height of the mon pic in tiles to a tile number gives the tile
; number of the tile one column to the right (and thus subtracting the height
; gives the reverse). If the next tile would be past the edge of the pic, the 2
@@ -2246,7 +2246,7 @@ ClearMonPicFromTileMap:
ret
; puts the tile map destination address of a mon sprite in hl, given the row count in b
-; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out,
+; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out,
; in order to show only a portion of the mon sprite.
GetMonSpriteTileMapPointerFromRowCount:
push de
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index 82c3318c..6d3a4f9c 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -355,7 +355,7 @@ BattleTransition_FlashScreenPalettes:
; used for low level trainer dungeon battles
BattleTransition_Shrink:
- ld c, 9
+ ld c, SCREEN_HEIGHT / 2
.loop
push bc
xor a
@@ -389,7 +389,7 @@ BattleTransition_Shrink:
; used for high level trainer dungeon battles
BattleTransition_Split:
- ld c, 9
+ ld c, SCREEN_HEIGHT / 2
xor a
ldh [hAutoBGTransferEnabled], a
.loop
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index f66f509f..abb1c9b4 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -902,7 +902,7 @@ ReplaceFaintedEnemyMon:
ld hl, wEnemyHPBarColor
ld e, $30
call GetBattleHealthBarColor
- setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
+ ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
ldh [rOBP0], a
ldh [rOBP1], a
call UpdateGBCPal_OBP0
@@ -1765,7 +1765,7 @@ SendOutMon:
ld hl, wEnemyMonHP
ld a, [hli]
or [hl] ; is enemy mon HP zero?
- jp z, .skipDrawingEnemyHUDAndHPBar; if HP is zero, skip drawing the HUD and HP bar
+ jp z, .skipDrawingEnemyHUDAndHPBar ; if HP is zero, skip drawing the HUD and HP bar
call DrawEnemyHUDAndHPBar
.skipDrawingEnemyHUDAndHPBar
call DrawPlayerHUDAndHPBar
@@ -2096,16 +2096,17 @@ DisplayBattleMenu::
jp .handleBattleMenuInput
; the following happens for the old man tutorial and prof. oak pikachu battle
.doSimulatedMenuInput
+ ; Temporarily save the player name in wGrassRate,
+ ; which is supposed to get overwritten when entering a
+ ; map with wild Pokémon.
+ ; In Red/Blue, due to an oversight, the data may not get
+ ; overwritten (on Cinnabar and Route 21) and the infamous
+ ; Missingno. glitch can show up.
+ ; However, this has been fixed in Yellow.
ld hl, wPlayerName
ld de, wGrassRate
ld bc, NAME_LENGTH
- call CopyData ; temporarily save the player name in unused space,
- ; which is supposed to get overwritten when entering a
- ; map with wild Pokémon.
- ; In Red/Blue, due to an oversight, the data
- ; may not get overwritten (cinnabar) and the infamous
- ; Missingno. glitch can show up. However,
- ; this has been fixed in yellow
+ call CopyData
ld hl, .oldManName
ld a, [wBattleType]
dec a
@@ -2310,9 +2311,9 @@ BagWasSelected:
jr DisplayBagMenu
SimulatedInputBattleItemList:
- db 1 ; # of items
+ db 1 ; # items
db POKE_BALL, 1
- db $ff
+ db -1 ; end
DisplayPlayerBag:
; get the pointer to player's bag when in a normal battle
@@ -4258,7 +4259,7 @@ CheckForDisobedience:
call GetCurrentMove
.canUseMove
ld a, $1
- and a; clear Z flag
+ and a ; clear Z flag
ret
.cannotUseMove
xor a ; set Z flag
@@ -4642,7 +4643,7 @@ CalculateDamage:
ld b, 4
call Divide
-; Update wCurDamage.
+; Update wCurDamage.
; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
ld hl, wDamage
ld b, [hl]
@@ -4731,7 +4732,7 @@ JumpToOHKOMoveEffect:
INCLUDE "data/battle/unused_critical_hit_moves.asm"
; determines if attack is a critical hit
-; azure heights claims "the fastest pokémon (who are, not coincidentally,
+; Azure Heights claims "the fastest pokémon (who are, not coincidentally,
; among the most popular) tend to CH about 20 to 25% of the time."
CriticalHitTest:
xor a
@@ -5442,26 +5443,32 @@ AdjustDamageForMoveType:
.done
ret
+; function to tell how effective the type of an enemy attack is on the player's current pokemon
+; this doesn't take into account the effects that dual types can have
+; (e.g. 4x weakness / resistance, weaknesses and resistances canceling)
+; the result is stored in [wTypeEffectiveness]
+; ($05 is not very effective, $10 is neutral, $14 is super effective)
+; as far is can tell, this is only used once in some AI code to help decide which move to use
AIGetTypeEffectiveness:
ld a, [wEnemyMoveType]
- ld d, a ; d = type of enemy move
+ ld d, a ; d = type of enemy move
ld hl, wBattleMonType
- ld b, [hl] ; b = type 1 of player's pokemon
+ ld b, [hl] ; b = type 1 of player's pokemon
inc hl
- ld c, [hl] ; c = type 2 of player's pokemon
+ ld c, [hl] ; c = type 2 of player's pokemon
ld a, $10
- ld [wd11e], a ; initialize [wd11e] to neutral effectiveness
+ ld [wTypeEffectiveness], a ; initialize to neutral effectiveness
ld hl, TypeEffects
.loop
ld a, [hli]
cp $ff
ret z
- cp d ; match the type of the move
+ cp d ; match the type of the move
jr nz, .nextTypePair1
ld a, [hli]
- cp b ; match with type 1 of pokemon
+ cp b ; match with type 1 of pokemon
jr z, .done
- cp c ; or match with type 2 of pokemon
+ cp c ; or match with type 2 of pokemon
jr z, .done
jr .nextTypePair2
.nextTypePair1
@@ -5469,8 +5476,8 @@ AIGetTypeEffectiveness:
.nextTypePair2
inc hl
jr .loop
-
.done
+ ; 40% chance for Lorelei's Dewgong to ignore type effectiveness?
ld a, [wTrainerClass]
cp LORELEI
jr nz, .ok
@@ -5481,9 +5488,8 @@ AIGetTypeEffectiveness:
cp $66 ; 40 percent
ret c
.ok
-
ld a, [hl]
- ld [wd11e], a ; store damage multiplier
+ ld [wTypeEffectiveness], a ; store damage multiplier
ret
INCLUDE "data/types/type_matchups.asm"
@@ -6462,7 +6468,7 @@ SwapPlayerAndEnemyLevels:
; (for use when scrolling the player sprite and enemy's silhouettes on screen)
LoadPlayerBackPic:
ld a, [wBattleType]
- ld de, OldManPic
+ ld de, OldManPicBack
cp BATTLE_TYPE_OLD_MAN ; is it the old man tutorial?
jr z, .next
ld de, ProfOakPicBack
diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm
index c4e81816..7573ce8d 100644
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -231,7 +231,7 @@ FreezeBurnParalyzeEffect:
ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance
jr .next1
.asm_3f2c7
- cp a, PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those
+ cp PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those
ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance
jr c, .next1 ; branch ahead if this is a 10% chance effect..
ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance
@@ -247,7 +247,7 @@ FreezeBurnParalyzeEffect:
jr z, .burn1
cp FREEZE_SIDE_EFFECT
jr z, .freeze1
-; .paralyze
+; .paralyze1
ld a, 1 << PAR
ld [wEnemyMonStatus], a
call QuarterSpeedDueToParalysis ; quarter speed of affected mon
@@ -293,7 +293,7 @@ FreezeBurnParalyzeEffect:
ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance
jr .next2
.asm_3f341
- cp a, PARALYZE_SIDE_EFFECT1 + 1
+ cp PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a
jr c, .next2
ld b, $4d
@@ -309,6 +309,7 @@ FreezeBurnParalyzeEffect:
jr z, .burn2
cp FREEZE_SIDE_EFFECT
jr z, .freeze2
+; .paralyze2
ld a, 1 << PAR
ld [wBattleMonStatus], a
call QuarterSpeedDueToParalysis
diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm
index bab804bb..61fbdfa3 100644
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -43,7 +43,7 @@ GainExperience:
inc de
jr .nextBaseStat
.maxStatExp ; if the upper byte also overflowed, then we have hit the max stat exp
- dec a ; a is 0 from previous check
+ dec a ; ld a, $ff; a is 0 from previous check
ld [de], a
inc de
ld [de], a
@@ -234,15 +234,15 @@ GainExperience:
xor a ; battle mon
ld [wCalculateWhoseStats], a
ld hl, CalculateModifiedStats
- call Bankswitch15ToF
+ call CallBattleCore
ld hl, ApplyBurnAndParalysisPenaltiesToPlayer
- call Bankswitch15ToF
+ call CallBattleCore
ld hl, ApplyBadgeStatBoosts
- call Bankswitch15ToF
+ call CallBattleCore
ld hl, DrawPlayerHUDAndHPBar
- call Bankswitch15ToF
+ call CallBattleCore
ld hl, PrintEmptyString
- call Bankswitch15ToF
+ call CallBattleCore
call SaveScreenTilesToBuffer1
.printGrewLevelText
callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP
@@ -345,7 +345,7 @@ BoostExp:
ldh [hQuotient + 2], a
ret
-Bankswitch15ToF:
+CallBattleCore:
ld b, BANK(BattleCore)
jp Bankswitch
diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm
index 03059022..76d89ba9 100644
--- a/engine/battle/ghost_marowak_anim.asm
+++ b/engine/battle/ghost_marowak_anim.asm
@@ -77,7 +77,7 @@ CopyMonPicFromBGToSpriteVRAM:
ld [hli], a
ld a, d
ld [hli], a
- ld a, $14 ; use OBP1
+ ld a, OAM_OBP1 | 4
ld [hli], a
inc d
dec c
diff --git a/engine/battle/move_effects/heal.asm b/engine/battle/move_effects/heal.asm
index 80923a29..c3ffda65 100644
--- a/engine/battle/move_effects/heal.asm
+++ b/engine/battle/move_effects/heal.asm
@@ -86,7 +86,7 @@ HealEffect_:
ld [wHPBarNewHP], a
.playAnim
ld hl, PlayCurrentMoveAnimation
- call Bankswitch3DtoF
+ call EffectCallBattleCore
ldh a, [hWhoseTurn]
and a
hlcoord 10, 9
@@ -98,14 +98,14 @@ HealEffect_:
ld [wHPBarType], a
predef UpdateHPBar2
ld hl, DrawHUDsAndHPBars
- call Bankswitch3DtoF
+ call EffectCallBattleCore
ld hl, RegainedHealthText
jp PrintText
.failed
ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
- jp Bankswitch3DtoF
+ jp EffectCallBattleCore
StartedSleepingEffect:
text_far _StartedSleepingEffect
diff --git a/engine/battle/move_effects/reflect_light_screen.asm b/engine/battle/move_effects/reflect_light_screen.asm
index c05055fa..46c299e9 100644
--- a/engine/battle/move_effects/reflect_light_screen.asm
+++ b/engine/battle/move_effects/reflect_light_screen.asm
@@ -23,14 +23,14 @@ ReflectLightScreenEffect_:
.playAnim
push hl
ld hl, PlayCurrentMoveAnimation
- call Bankswitch3DtoF
+ call EffectCallBattleCore
pop hl
jp PrintText
.moveFailed
ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
- jp Bankswitch3DtoF
+ jp EffectCallBattleCore
LightScreenProtectedText:
text_far _LightScreenProtectedText
@@ -40,6 +40,6 @@ ReflectGainedArmorText:
text_far _ReflectGainedArmorText
text_end
-Bankswitch3DtoF:
+EffectCallBattleCore:
ld b, BANK(BattleCore)
jp Bankswitch
diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm
index d37bd94d..af47ae1b 100644
--- a/engine/battle/move_effects/transform.asm
+++ b/engine/battle/move_effects/transform.asm
@@ -134,7 +134,7 @@ TransformEffect_:
.failed
ld hl, PrintButItFailedText_
- jp Bankswitch3DtoF
+ jp EffectCallBattleCore
TransformedText:
text_far _TransformedText
diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm
index 9362cc3a..a61f402f 100755
--- a/engine/battle/safari_zone.asm
+++ b/engine/battle/safari_zone.asm
@@ -2,18 +2,18 @@ PrintSafariZoneBattleText:
ld hl, wSafariBaitFactor
ld a, [hl]
and a
- jr z, .asm_411e
+ jr z, .no_bait
dec [hl]
ld hl, SafariZoneEatingText
- jr .asm_4138
-.asm_411e
+ jr .done
+.no_bait
dec hl
ld a, [hl]
and a
ret z
dec [hl]
ld hl, SafariZoneAngryText
- jr nz, .asm_4138
+ jr nz, .done
push hl
ld a, [wEnemyMonSpecies]
ld [wd0b5], a
@@ -21,7 +21,7 @@ PrintSafariZoneBattleText:
ld a, [wMonHCatchRate]
ld [wEnemyMonActualCatchRate], a
pop hl
-.asm_4138
+.done
push hl
call LoadScreenTilesFromBuffer1
pop hl
diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm
index 794a65ab..38ebff21 100644
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -4,18 +4,18 @@
ScaleSpriteByTwo:
ld a, $0
call SwitchSRAMBankAndLatchClockData
- call ScaleSpriteByTwo_
+ call .ScaleSpriteByTwo
call PrepareRTCDataAndDisableSRAM
ret
-ScaleSpriteByTwo_:
+.ScaleSpriteByTwo:
ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
- call ScaleLastSpriteColumnByTwo ; last tile column is special case
- call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
+ call ScaleLastSpriteColumnByTwo ; last tile column is special case
+ call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
- call ScaleLastSpriteColumnByTwo ; last tile column is special case
+ call ScaleLastSpriteColumnByTwo ; last tile column is special case
ScaleFirstThreeSpriteColumnsByTwo:
ld b, $3 ; 3 tile columns
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 17e68e75..94e427a1 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -295,10 +295,10 @@ TrainerAI:
cp LINK_STATE_BATTLING
jr z, .done ; if in a link battle, we're done as well
ld a, [wEnemyBattleStatus1]
- and 1 << CHARGING_UP | 1 << THRASHING_ABOUT | 1 << STORING_ENERGY ; %10011
+ and 1 << CHARGING_UP | 1 << THRASHING_ABOUT | 1 << STORING_ENERGY
jr nz, .done ; don't follow trainer ai if opponent is in a locked state
ld a, [wEnemyBattleStatus2]
- and 1 << USING_RAGE ; %1000000
+ and 1 << USING_RAGE
jr nz, .done ; don't follow trainer ai if opponent is locked in rage
; note that this doesn't check for hyper beam recharge which can cause problems
ld a, [wTrainerClass] ; what trainer class is this?
@@ -311,7 +311,7 @@ TrainerAI:
add hl, bc
ld a, [wAICount]
and a
- jr z, .done; if no AI uses left, we're done here
+ jr z, .done ; if no AI uses left, we're done here
inc hl
inc a
jr nz, .getpointer
diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm
index de5f402e..10de5ed2 100755
--- a/engine/events/card_key.asm
+++ b/engine/events/card_key.asm
@@ -8,8 +8,7 @@ PrintCardKeyText:
ret z
cp b
jr nz, .silphCoMapListLoop
-; does not check for tile in front of player. This might be buggy
- ;predef GetTileAndCoordsInFrontOfPlayer
+; does not check for tile in front of player. This might be buggy.
ld a, [wTileInFrontOfPlayer]
cp $18
jr z, .cardKeyDoorInFrontOfPlayer
diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm
index c08992d3..b480c6d0 100755
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -19,7 +19,7 @@ _RunPaletteCommand:
push de
jp hl
-SetPal_Black:
+SetPal_BattleBlack:
ld hl, PalPacket_Black
ld de, BlkPacket_Battle
ret
@@ -30,7 +30,6 @@ SetPal_Battle:
ld de, wPalPacket
ld bc, $10
call CopyData
- ;ld a, [wPlayerBattleStatus3]
ld hl, wBattleMonSpecies
ld a, [hl]
and a
@@ -42,7 +41,6 @@ SetPal_Battle:
.asm_71ef9
call DeterminePaletteID
ld b, a
- ;ld a, [wEnemyBattleStatus3]
ld hl, wEnemyMonSpecies2
call DeterminePaletteID
ld c, a
@@ -118,7 +116,7 @@ SetPal_Slots:
ld de, BlkPacket_Slots
ret
-SetPal_Titlescreen:
+SetPal_TitleScreen:
ld hl, PalPacket_Titlescreen
ld de, BlkPacket_Titlescreen
ret
@@ -267,13 +265,13 @@ SendUnknownPalPacket_72064::
SetPalFunctions:
; entries correspond to SET_PAL_* constants
- dw SetPal_Black
+ dw SetPal_BattleBlack
dw SetPal_Battle
dw SetPal_TownMap
dw SetPal_StatusScreen
dw SetPal_Pokedex
dw SetPal_Slots
- dw SetPal_Titlescreen
+ dw SetPal_TitleScreen
dw SetPal_NidorinoIntro
dw SetPal_Generic
dw SetPal_Overworld
diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm
index b62d9d4b..136e3afb 100644
--- a/engine/gfx/sprite_oam.asm
+++ b/engine/gfx/sprite_oam.asm
@@ -219,7 +219,7 @@ _IsTilePassable::
ld l, a ; hl now points to passable tiles
.loop
ld a, [hli]
- cp a, $ff
+ cp $ff
jr z, .tileNotPassable
cp c
jr nz, .loop
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm
index c2e0b2b4..e28edc6c 100644
--- a/engine/items/inventory.asm
+++ b/engine/items/inventory.asm
@@ -34,9 +34,9 @@ AddItemToInventory_::
cp b ; does the current item in the table match the item being added?
jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
-.loop
+.addAnotherStackOfItem
ld a, [hl]
- cp a, $ff ; is it the end of the table?
+ cp $ff ; is it the end of the table?
jr nz, .notAtEndOfInventory
.addNewItem ; add an item not yet in the inventory
pop hl
@@ -74,7 +74,7 @@ AddItemToInventory_::
; if so, store 99 in the current slot and store the rest in a new slot
ld a, 99
ld [hli], a
- jp .loop
+ jp .addAnotherStackOfItem
.increaseItemQuantityFailed
pop hl
and a
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index d4c3ae18..00a575f1 100755
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -386,7 +386,7 @@ ItemUseBall:
ldh [hDivisor], a
ld b, 4
call Divide
-
+
; Determine Status2.
; no status ailment: Status2 = 0
; Burn/Paralysis/Poison: Status2 = 5
@@ -3092,7 +3092,7 @@ SendNewMonToBox:
ld a, [wcf91]
cp KADABRA
jr nz, .notKadabra
- ld a, $60 ; twistedspoon in gsc
+ ld a, TWISTEDSPOON_GSC
ld [wBoxMon1CatchRate], a
.notKadabra
ret
diff --git a/engine/items/tms.asm b/engine/items/tms.asm
index dcf2665d..40030675 100755
--- a/engine/items/tms.asm
+++ b/engine/items/tms.asm
@@ -11,7 +11,7 @@ CanLearnTM:
ld hl, TechnicalMachines
.findTMloop
ld a, [hli]
- cp $ff ; reached terminator?
+ cp -1 ; reached terminator?
jr z, .done
cp b
jr z, .TMfoundLoop
diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm
index c401d1c1..d385044a 100755
--- a/engine/items/town_map.asm
+++ b/engine/items/town_map.asm
@@ -152,7 +152,7 @@ LoadTownMap_Fly::
call LoadFontTilePatterns
ld de, BirdSprite
ld b, BANK(BirdSprite)
- ld c, $c
+ ld c, 12
ld hl, vSprites tile $04
call CopyVideoData
ld de, TownMapUpArrow
diff --git a/engine/joypad.asm b/engine/joypad.asm
index 06a15e4e..d50eea08 100644
--- a/engine/joypad.asm
+++ b/engine/joypad.asm
@@ -7,7 +7,6 @@ ReadJoypad_::
ret nz
ld a, 1 << 5 ; select direction keys
- ;ld c, 0
ldh [rJOYP], a
ldh a, [rJOYP]
@@ -19,9 +18,9 @@ ReadJoypad_::
ld a, 1 << 4 ; select button keys
ldh [rJOYP], a
- REPT 6
+REPT 6
ldh a, [rJOYP]
- ENDR
+ENDR
cpl
and %1111
or b
@@ -32,14 +31,13 @@ ReadJoypad_::
ldh [rJOYP], a
ret
-
_Joypad::
; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast
; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput
ldh a, [hJoyInput]
ld b, a
- and $4F
+ and A_BUTTON + B_BUTTON + SELECT + START + D_UP
cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset
jp z, TrySoftReset
diff --git a/engine/link/print_waiting_text.asm b/engine/link/print_waiting_text.asm
index 98a44970..a07967fd 100644
--- a/engine/link/print_waiting_text.asm
+++ b/engine/link/print_waiting_text.asm
@@ -3,12 +3,13 @@ PrintWaitingText::
lb bc, 1, 11
ld a, [wIsInBattle]
and a
- jr z, .asm_4b9a
+ jr z, .trade
+; battle
call TextBoxBorder
- jr .asm_4b9d
-.asm_4b9a
+ jr .border_done
+.trade
call CableClub_TextBoxBorder
-.asm_4b9d
+.border_done
hlcoord 4, 11
ld de, WaitingText
call PlaceString
diff --git a/engine/math/bcd.asm b/engine/math/bcd.asm
index 92bf6f17..5747a684 100644
--- a/engine/math/bcd.asm
+++ b/engine/math/bcd.asm
@@ -13,7 +13,7 @@ DivideBCD::
ldh [hDivideBCDBuffer+1], a
ldh [hDivideBCDBuffer+2], a
ld d, $1
-.mulBy10Loop
+.mulBy10Loop
; multiply the divisor by 10 until the leading digit is nonzero
; to set up the standard long division algorithm
ldh a, [hDivideBCDDivisor]
@@ -108,7 +108,7 @@ DivideBCD::
ldh a, [hDivideBCDBuffer+2]
ldh [hDivideBCDQuotient+2], a
pop de
- ld a, $6
+ ld a, $6
sub d
and a
ret z
diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm
index 874fe50f..315e4805 100755
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -205,9 +205,9 @@ HandlePokedexListMenu:
jr z, .checkIfRightPressed
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
- cp a, 7
+ cp 7
jp c, .loop ; can't if the list is shorter than 7
- sub a, 7
+ sub 7
ld b, a
ld a, [wListScrollOffset]
cp b
@@ -221,12 +221,12 @@ HandlePokedexListMenu:
jr z, .checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
- cp a, 7
+ cp 7
jp c, .loop ; can't if the list is shorter than 7
- sub a, 6
+ sub 6
ld b, a
ld a, [wListScrollOffset]
- add a, 7
+ add 7
ld [wListScrollOffset], a
cp b
jp c, .loop
@@ -240,7 +240,7 @@ HandlePokedexListMenu:
jr z, .buttonAPressed
.leftPressed
ld a, [wListScrollOffset]
- sub a, 7
+ sub 7
ld [wListScrollOffset], a
jp nc, .loop
xor a
@@ -324,7 +324,7 @@ DrawPokedexVerticalLine:
.loop
ld [hl], a
add hl, de
- xor a, 1 ; toggle between vertical line tile and box tile
+ xor 1 ; toggle between vertical line tile and box tile
dec c
jr nz, .loop
ret
@@ -459,7 +459,7 @@ ShowPokedexDataInternal:
.waitForButtonPress
call JoypadLowSensitivity
ldh a, [hJoy5]
- and a, A_BUTTON | B_BUTTON
+ and A_BUTTON | B_BUTTON
jr z, .waitForButtonPress
pop af
ldh [hTilesetType], a
diff --git a/engine/minigame/surfing_pikachu.asm b/engine/minigame/surfing_pikachu.asm
index 6d319867..641c4f62 100755
--- a/engine/minigame/surfing_pikachu.asm
+++ b/engine/minigame/surfing_pikachu.asm
@@ -1689,7 +1689,7 @@ SurfingMinigame_WriteTotal:
.Total:
db $2b,$2c,$25,$28,$2d ; Total
-
+
DidPlayerGetAHighScore:
ld hl, wSurfingMinigameHiScore + 1
ld a, [wSurfingMinigameTotalScore + 1]
diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm
index 9165113f..a9774ff9 100755
--- a/engine/movie/intro.asm
+++ b/engine/movie/intro.asm
@@ -83,7 +83,7 @@ PlayShootingStar:
ld b, SET_PAL_GAME_FREAK_INTRO
call RunPaletteCommand
farcall LoadCopyrightAndTextBoxTiles
- ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
+ ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
ldh [rBGP], a
call UpdateGBCPal_BGP
ld c, 180
diff --git a/engine/movie/title.asm b/engine/movie/title.asm
index 0b421d89..11852ae4 100755
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -254,7 +254,7 @@ CopyrightTextString:
TitleScreen_PlayPikachuPCM:
callfar PlayPikachuSoundClip
ret
-
+
DoTitleScreenFunction:
call .CheckTimer
ld a, [wTitleScreenScene]
@@ -268,7 +268,7 @@ DoTitleScreenFunction:
ld l, a
jp hl
-
+
.Jumptable:
dw .Nop
dw .BlinkHalf
@@ -282,13 +282,13 @@ DoTitleScreenFunction:
dw .BlinkWait
dw .BlinkOpen
dw .GoBackToStart
-
+
.GoBackToStart:
xor a
ld [wTitleScreenScene], a
.Nop
ret
-
+
.BlinkOpen:
ld e, 0
jr .LoadBlinkFrame
@@ -316,7 +316,7 @@ DoTitleScreenFunction:
ld hl, wTitleScreenScene
inc [hl]
ret
-
+
.CheckTimer:
ld hl, wTitleScreenTimer
ld a, [hl]
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index e31c0bd2..ba412ab2 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -304,7 +304,7 @@ GetSplitMapSpriteSetID:
ld hl, MapSpriteSets
add hl, de
ld a, [hl] ; a = spriteSetID
- cp a, $f0 ; does the map have 2 sprite sets?
+ cp $f0 ; does the map have 2 sprite sets?
ret c
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
diff --git a/engine/overworld/specific_script_flags.asm b/engine/overworld/specific_script_flags.asm
index d6f333ac..b59aa9d0 100644
--- a/engine/overworld/specific_script_flags.asm
+++ b/engine/overworld/specific_script_flags.asm
@@ -8,7 +8,7 @@ SetMapSpecificScriptFlagsOnMapReload::
ld a, [hli]
cp c
jr z, .in_list
- cp a, $ff
+ cp $ff
jr nz, .search_loop
ret
diff --git a/engine/pikachu/pikachu_movement.asm b/engine/pikachu/pikachu_movement.asm
index 6b912e61..91c16999 100755
--- a/engine/pikachu/pikachu_movement.asm
+++ b/engine/pikachu/pikachu_movement.asm
@@ -866,7 +866,7 @@ LoadPikachuShadowOAMData:
push bc
push de
push hl
-
+
ld bc, wOAMBuffer + 4 * 36
ld a, [wPikaSpriteY]
ld e, a
diff --git a/engine/pikachu/pikachu_pic_animation.asm b/engine/pikachu/pikachu_pic_animation.asm
index 33a3e504..755395ba 100755
--- a/engine/pikachu/pikachu_pic_animation.asm
+++ b/engine/pikachu/pikachu_pic_animation.asm
@@ -625,7 +625,7 @@ PikaPicAnimCommand_loadgfx:
ld a, [wPikaPicAnimCurGraphicID]
call LoadPikaPicAnimGFXHeader
ld a, c
- cp a, $ff
+ cp $ff
jr z, .compressed
call RequestPikaPicAnimGFX
jr .done
diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm
index d3d08e99..54d7b4de 100644
--- a/engine/pokemon/add_mon.asm
+++ b/engine/pokemon/add_mon.asm
@@ -172,10 +172,10 @@ _AddPartyMon::
ld [de], a
ld a, [wcf91]
cp KADABRA
- jr nz, .skipGivingTwistedSpoon
- ld a, $60 ; twistedspoon in gen 2
+ jr nz, .notKadabra
+ ld a, TWISTEDSPOON_GSC
ld [de], a
-.skipGivingTwistedSpoon
+.notKadabra
ld hl, wMonHMoves
ld a, [hli]
inc de
@@ -436,7 +436,7 @@ _MoveMon::
cp PARTY_TO_DAYCARE
ld de, wDayCareMonOT
jr z, .findOTsrc
- dec a
+ dec a
ld hl, wPartyMonOT
ld a, [wPartyCount]
jr nz, .addOToffset
diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm
index 4e48fe30..3df780c1 100755
--- a/engine/pokemon/evos_moves.asm
+++ b/engine/pokemon/evos_moves.asm
@@ -452,40 +452,7 @@ Func_3b0a2:
scf
ret
-Pointer_3b0ee:
- db NIDOKING
- db IVYSAUR
- db EXEGGUTOR
- db GENGAR
- db NIDOQUEEN
- db ARCANINE
- db GYARADOS
- db BLASTOISE
- db GOLEM
- db DRAGONITE
- db NINETALES
- db DRAGONAIR
- db KABUTOPS
- db OMASTAR
- db JIGGLYPUFF
- db FLAREON
- db JOLTEON
- db VAPOREON
- db BEEDRILL
- db BUTTERFREE
- db MACHAMP
- db CLOYSTER
- db CLEFABLE
- db ALAKAZAM
- db STARMIE
- db VENUSAUR
- db TENTACRUEL
- db CHARMELEON
- db WARTORTLE
- db CHARIZARD
- db VILEPLUME
- db VICTREEBEL
- db $ff
+INCLUDE "data/pokemon/unknown_list.asm"
Func_3b10f:
ld c, $0
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 73f69d03..a9877739 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -1,8 +1,8 @@
GetPredefPointer::
- ; Store the contents of the register
- ; pairs (hl, de, bc) at wPredefRegisters.
- ; Then put the bank and address of predef
- ; wPredefID in [wPredefBank] and hl.
+; Store the contents of the register
+; pairs (hl, de, bc) at wPredefRegisters.
+; Then put the bank and address of predef
+; wPredefID in [wPredefBank] and hl.
ld a, h
ld [wPredefRegisters], a
diff --git a/engine/printer/printer2.asm b/engine/printer/printer2.asm
index 180f044c..b257aff4 100755
--- a/engine/printer/printer2.asm
+++ b/engine/printer/printer2.asm
@@ -356,7 +356,7 @@ Func_ea6af:
ld hl, wPrinterSerialFrameDelay
inc [hl]
ld a, [hl]
- cp a, $6
+ cp $6
ret c
xor a
ld [hl], a
@@ -381,17 +381,17 @@ Func_ea6d2:
call Func_ea742
ret c
ld a, [wPrinterHandshake]
- cp a, $ff
+ cp $ff
jr nz, .asm_ea6e4
ld a, [wPrinterStatusFlags]
- cp a, $ff
+ cp $ff
jr z, .asm_ea6fb
.asm_ea6e4
ld a, [wPrinterHandshake]
- cp a, $81
+ cp $81
jr nz, .asm_ea6fb
ld a, [wPrinterStatusFlags]
- cp a, $0
+ cp $0
jr nz, .asm_ea6fb
ld hl, wPrinterConnectionOpen
set 1, [hl]