diff options
Diffstat (limited to 'engine')
311 files changed, 7717 insertions, 13386 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 218ecd375..29bc23b20 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -1,4 +1,4 @@ -AI_SwitchOrTryItem: ; 38000 +AI_SwitchOrTryItem: and a ld a, [wBattleMode] @@ -38,12 +38,11 @@ AI_SwitchOrTryItem: ; 38000 jp nz, SwitchSometimes ; fallthrough -DontSwitch: ; 38041 +DontSwitch: call AI_TryItem ret -; 38045 -SwitchOften: ; 38045 +SwitchOften: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -77,9 +76,8 @@ SwitchOften: ; 38045 ; In register 'a' is the number (1-6) of the mon to switch to ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 38083 -SwitchRarely: ; 38083 +SwitchRarely: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -112,9 +110,8 @@ SwitchRarely: ; 38083 inc a ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 380c1 -SwitchSometimes: ; 380c1 +SwitchSometimes: callfar CheckAbleToSwitch ld a, [wEnemySwitchMonParam] and $f0 @@ -147,17 +144,13 @@ SwitchSometimes: ; 380c1 inc a ld [wEnemySwitchMonIndex], a jp AI_TrySwitch -; 380ff - -CheckSubstatusCantRun: ; 380ff +CheckSubstatusCantRun: ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret -; 38105 - -AI_TryItem: ; 38105 +AI_TryItem: ; items are not allowed in the BattleTower ld a, [wInBattleTowerBattle] and a @@ -243,8 +236,7 @@ AI_TryItem: ; 38105 scf ret - -.IsHighestLevel: ; 38170 +.IsHighestLevel: ld a, [wOTPartyCount] ld d, a ld e, 0 @@ -274,10 +266,8 @@ AI_TryItem: ; 38105 .yes scf ret -; 38196 - -AI_Items: ; 39196 +AI_Items: dbw FULL_RESTORE, .FullRestore dbw MAX_POTION, .MaxPotion dbw HYPER_POTION, .HyperPotion @@ -292,16 +282,14 @@ AI_Items: ; 39196 dbw X_SPEED, .XSpeed dbw X_SPECIAL, .XSpecial db -1 ; end -; 381be -.FullHeal: ; 381be +.FullHeal: call .Status jp c, .DontUse call EnemyUsedFullHeal jp .Use -; 381ca -.Status: ; 381ca (e:41ca) +.Status: ld a, [wEnemyMonStatus] and a jp z, .DontUse @@ -332,9 +320,8 @@ AI_Items: ; 39196 and 1 << FRZ | SLP jp z, .DontUse jp .Use -; 38208 -.FullRestore: ; 38208 +.FullRestore: call .HealItem jp nc, .UseFullRestore ld a, [bc] @@ -346,15 +333,14 @@ AI_Items: ; 39196 .UseFullRestore: call EnemyUsedFullRestore jp .Use -; 38220 -.MaxPotion: ; 38220 +.MaxPotion: call .HealItem jp c, .DontUse call EnemyUsedMaxPotion jp .Use -.HealItem: ; 3822c (e:422c) +.HealItem: ld a, [bc] bit CONTEXT_USE_F, a jr nz, .CheckHalfOrQuarterHP @@ -370,7 +356,7 @@ AI_Items: ; 39196 jp c, .UseHealItem jp .DontUse -.CheckQuarterHP: ; 38254 (e:4254) +.CheckQuarterHP: callfar AICheckEnemyQuarterHP jp c, .DontUse call Random @@ -378,7 +364,7 @@ AI_Items: ; 39196 jp c, .DontUse jr .UseHealItem -.CheckHalfOrQuarterHP: ; 38267 (e:4267) +.CheckHalfOrQuarterHP: callfar AICheckEnemyHalfHP jp c, .DontUse callfar AICheckEnemyQuarterHP @@ -387,33 +373,29 @@ AI_Items: ; 39196 cp 20 percent - 1 jp nc, .DontUse -.UseHealItem: ; 38281 (e:4281) +.UseHealItem: jp .Use -; 38284 -.HyperPotion: ; 38284 +.HyperPotion: call .HealItem jp c, .DontUse ld b, 200 call EnemyUsedHyperPotion jp .Use -; 38292 (e:4292) -.SuperPotion: ; 38292 +.SuperPotion: call .HealItem jp c, .DontUse ld b, 50 call EnemyUsedSuperPotion jp .Use -; 382a0 -.Potion: ; 382a0 +.Potion: call .HealItem jp c, .DontUse ld b, 20 call EnemyUsedPotion jp .Use -; 382ae .asm_382ae ; This appears to be unused callfar AICheckEnemyMaxHP @@ -457,58 +439,50 @@ AI_Items: ; 39196 cp 39 percent + 1 jp c, .Use jp .DontUse -; 382f9 -.XAccuracy: ; 382f9 +.XAccuracy: call .XItem jp c, .DontUse call EnemyUsedXAccuracy jp .Use -; 38305 -.GuardSpec: ; 38305 +.GuardSpec: call .XItem jp c, .DontUse call EnemyUsedGuardSpec jp .Use -; 38311 -.DireHit: ; 38311 +.DireHit: call .XItem jp c, .DontUse call EnemyUsedDireHit jp .Use -; 3831d (e:431d) -.XAttack: ; 3831d +.XAttack: call .XItem jp c, .DontUse call EnemyUsedXAttack jp .Use -; 38329 -.XDefend: ; 38329 +.XDefend: call .XItem jp c, .DontUse call EnemyUsedXDefend jp .Use -; 38335 -.XSpeed: ; 38335 +.XSpeed: call .XItem jp c, .DontUse call EnemyUsedXSpeed jp .Use -; 38341 -.XSpecial: ; 38341 +.XSpecial: call .XItem jp c, .DontUse call EnemyUsedXSpecial jp .Use -; 3834d -.XItem: ; 3834d (e:434d) +.XItem: ld a, [wEnemyTurnsTaken] and a jr nz, .notfirstturnout @@ -542,8 +516,7 @@ AI_Items: ; 39196 and a ret - -AIUpdateHUD: ; 38387 +AIUpdateHUD: call UpdateEnemyMonInParty farcall UpdateEnemyHUD ld a, $1 @@ -552,29 +525,26 @@ AIUpdateHUD: ; 38387 dec [hl] scf ret -; 3839a -AIUsedItemSound: ; 3839a +AIUsedItemSound: push de ld de, SFX_FULL_HEAL call PlaySFX pop de ret -; 383a3 - -EnemyUsedFullHeal: ; 383a3 (e:43a3) +EnemyUsedFullHeal: call AIUsedItemSound call AI_HealStatus ld a, FULL_HEAL jp PrintText_UsedItemOn_AND_AIUpdateHUD -EnemyUsedMaxPotion: ; 383ae (e:43ae) +EnemyUsedMaxPotion: ld a, MAX_POTION ld [wCurEnemyItem], a jr FullRestoreContinue -EnemyUsedFullRestore: ; 383b5 (e:43b5) +EnemyUsedFullRestore: call AI_HealStatus ld a, FULL_RESTORE ld [wCurEnemyItem], a @@ -583,7 +553,7 @@ EnemyUsedFullRestore: ; 383b5 (e:43b5) xor a ld [wEnemyConfuseCount], a -FullRestoreContinue: ; 383c6 +FullRestoreContinue: ld de, wCurHPAnimOldHP ld hl, wEnemyMonHP + 1 ld a, [hld] @@ -603,23 +573,22 @@ FullRestoreContinue: ; 383c6 ld [wCurHPAnimMaxHP + 1], a ld [wEnemyMonHP], a jr EnemyPotionFinish -; 383e8 (e:43e8) -EnemyUsedPotion: ; 383e8 +EnemyUsedPotion: ld a, POTION ld b, 20 jr EnemyPotionContinue -EnemyUsedSuperPotion: ; 383ee +EnemyUsedSuperPotion: ld a, SUPER_POTION ld b, 50 jr EnemyPotionContinue -EnemyUsedHyperPotion: ; 383f4 (e:43f4) +EnemyUsedHyperPotion: ld a, HYPER_POTION ld b, 200 -EnemyPotionContinue: ; 383f8 +EnemyPotionContinue: ld [wCurEnemyItem], a ld hl, wEnemyMonHP + 1 ld a, [hl] @@ -658,7 +627,7 @@ EnemyPotionContinue: ; 383f8 ld [hl], a ld [wCurHPAnimNewHP + 1], a -EnemyPotionFinish: ; 38436 +EnemyPotionFinish: call PrintText_UsedItemOn hlcoord 2, 2 xor a @@ -667,8 +636,7 @@ EnemyPotionFinish: ; 38436 predef AnimateHPBar jp AIUpdateHUD - -AI_TrySwitch: ; 3844b +AI_TrySwitch: ; Determine whether the AI can switch based on how many Pokemon are still alive. ; If it can switch, it will. ld a, [wOTPartyCount] @@ -695,9 +663,8 @@ AI_TrySwitch: ; 3844b jp nc, AI_Switch and a ret -; 3846c -AI_Switch: ; 3846c +AI_Switch: ld a, $1 ld [wEnemyIsSwitching], a ld [wEnemyGoesFirst], a @@ -739,21 +706,18 @@ AI_Switch: ; 3846c ret nz scf ret -; 384d0 -TextJump_EnemyWithdrew: ; 384d0 +TextJump_EnemyWithdrew: text_jump Text_EnemyWithdrew db "@" -; 384d5 Function384d5: ; This appears to be unused call AIUsedItemSound call AI_HealStatus ld a, FULL_HEAL_RED ; X_SPEED jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 384e0 -AI_HealStatus: ; 384e0 +AI_HealStatus: ld a, [wCurOTMon] ld hl, wOTPartyMon1Status ld bc, PARTYMON_STRUCT_LENGTH @@ -768,31 +732,27 @@ AI_HealStatus: ; 384e0 ld hl, wEnemySubStatus5 res SUBSTATUS_TOXIC, [hl] ret -; 384f7 -EnemyUsedXAccuracy: ; 384f7 +EnemyUsedXAccuracy: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_X_ACCURACY, [hl] ld a, X_ACCURACY jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 38504 -EnemyUsedGuardSpec: ; 38504 +EnemyUsedGuardSpec: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_MIST, [hl] ld a, GUARD_SPEC jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 38511 -EnemyUsedDireHit: ; 38511 +EnemyUsedDireHit: call AIUsedItemSound ld hl, wEnemySubStatus4 set SUBSTATUS_FOCUS_ENERGY, [hl] ld a, DIRE_HIT jp PrintText_UsedItemOn_AND_AIUpdateHUD -; 3851e Function3851e: ; This appears to be unused ld [hDivisor], a @@ -818,31 +778,26 @@ Function3851e: ; This appears to be unused ld a, e sub c ret -; 38541 -EnemyUsedXAttack: ; 38541 +EnemyUsedXAttack: ld b, ATTACK ld a, X_ATTACK jr EnemyUsedXItem -; 38547 -EnemyUsedXDefend: ; 38547 +EnemyUsedXDefend: ld b, DEFENSE ld a, X_DEFEND jr EnemyUsedXItem -; 3854d -EnemyUsedXSpeed: ; 3854d +EnemyUsedXSpeed: ld b, SPEED ld a, X_SPEED jr EnemyUsedXItem -; 38553 -EnemyUsedXSpecial: ; 38553 +EnemyUsedXSpecial: ld b, SP_ATTACK ld a, X_SPECIAL - ; Parameter ; a = ITEM_CONSTANT ; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION) @@ -853,18 +808,15 @@ EnemyUsedXItem: pop bc farcall CheckIfStatCanBeRaised jp AIUpdateHUD -; 38568 - ; Parameter ; a = ITEM_CONSTANT -PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568 +PrintText_UsedItemOn_AND_AIUpdateHUD: ld [wCurEnemyItem], a call PrintText_UsedItemOn jp AIUpdateHUD -; 38571 -PrintText_UsedItemOn: ; 38571 +PrintText_UsedItemOn: ld a, [wCurEnemyItem] ld [wd265], a call GetItemName @@ -874,9 +826,7 @@ PrintText_UsedItemOn: ; 38571 call CopyBytes ld hl, TextJump_EnemyUsedOn jp PrintText -; 3858c -TextJump_EnemyUsedOn: ; 3858c +TextJump_EnemyUsedOn: text_jump Text_EnemyUsedOn db "@" -; 38591 diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index dd4357fe2..df0053141 100644 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -1,4 +1,4 @@ -AIChooseMove: ; 440ce +AIChooseMove: ; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better. ; Pick the move with the lowest score. @@ -15,7 +15,6 @@ AIChooseMove: ; 440ce farcall CheckEnemyLockedIn ret nz - ; The default score is 20. Unusable moves are given a score of 80. ld a, 20 ld hl, wBuffer1 @@ -61,7 +60,6 @@ AIChooseMove: ; 440ce ld [hl], 80 jr .CheckMovePP - ; Apply AI scoring layers depending on the trainer class. .ApplyLayers: ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS @@ -198,10 +196,8 @@ AIChooseMove: ; 440ce ld a, c ld [wCurEnemyMoveNum], a ret -; 441af - -AIScoringPointers: ; 441af +AIScoringPointers: ; entries correspond to AI_* constants dw AI_Basic dw AI_Setup @@ -219,4 +215,3 @@ AIScoringPointers: ; 441af dw AI_None dw AI_None dw AI_None -; 441cf diff --git a/engine/battle/ai/redundant.asm b/engine/battle/ai/redundant.asm index d09b4da73..d78fccb84 100644 --- a/engine/battle/ai/redundant.asm +++ b/engine/battle/ai/redundant.asm @@ -1,4 +1,4 @@ -AI_Redundant: ; 2c41a +AI_Redundant: ; Check if move effect c will fail because it's already been used. ; Return z if the move is a good choice. ; Return nz if the move is a bad choice. @@ -13,7 +13,7 @@ AI_Redundant: ; 2c41a ld l, a jp hl -.Moves: ; 2c42c +.Moves: dbw EFFECT_DREAM_EATER, .DreamEater dbw EFFECT_HEAL, .Heal dbw EFFECT_LIGHT_SCREEN, .LightScreen @@ -46,22 +46,22 @@ AI_Redundant: ; 2c41a dbw EFFECT_FUTURE_SIGHT, .FutureSight db -1 -.LightScreen: ; 2c487 +.LightScreen: ld a, [wEnemyScreens] bit SCREENS_LIGHT_SCREEN, a ret -.Mist: ; 2c48d +.Mist: ld a, [wEnemySubStatus4] bit SUBSTATUS_MIST, a ret -.FocusEnergy: ; 2c493 +.FocusEnergy: ld a, [wEnemySubStatus4] bit SUBSTATUS_FOCUS_ENERGY, a ret -.Confuse: ; 2c499 +.Confuse: ld a, [wPlayerSubStatus3] bit SUBSTATUS_CONFUSED, a ret nz @@ -69,49 +69,49 @@ AI_Redundant: ; 2c41a bit SCREENS_SAFEGUARD, a ret -.Transform: ; 2c4a5 +.Transform: ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a ret -.Reflect: ; 2c4ab +.Reflect: ld a, [wEnemyScreens] bit SCREENS_REFLECT, a ret -.Substitute: ; 2c4b1 +.Substitute: ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ret -.LeechSeed: ; 2c4b7 +.LeechSeed: ld a, [wPlayerSubStatus4] bit SUBSTATUS_LEECH_SEED, a ret -.Disable: ; 2c4bd +.Disable: ld a, [wPlayerDisableCount] and a ret -.Encore: ; 2c4c2 +.Encore: ld a, [wPlayerSubStatus5] bit SUBSTATUS_ENCORED, a ret .Snore: -.SleepTalk: ; 2c4c8 +.SleepTalk: ld a, [wEnemyMonStatus] and SLP jr z, .Redundant jr .NotRedundant -.MeanLook: ; 2c4d1 +.MeanLook: ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret -.Nightmare: ; 2c4d7 +.Nightmare: ld a, [wBattleMonStatus] and a jr z, .Redundant @@ -119,63 +119,63 @@ AI_Redundant: ; 2c41a bit SUBSTATUS_NIGHTMARE, a ret -.Spikes: ; 2c4e3 +.Spikes: ld a, [wPlayerScreens] bit SCREENS_SPIKES, a ret -.Foresight: ; 2c4e9 +.Foresight: ld a, [wPlayerSubStatus1] bit SUBSTATUS_IDENTIFIED, a ret -.PerishSong: ; 2c4ef +.PerishSong: ld a, [wPlayerSubStatus1] bit SUBSTATUS_PERISH, a ret -.Sandstorm: ; 2c4f5 +.Sandstorm: ld a, [wBattleWeather] cp WEATHER_SANDSTORM jr z, .Redundant jr .NotRedundant -.Attract: ; 2c4fe +.Attract: farcall CheckOppositeGender jr c, .Redundant ld a, [wPlayerSubStatus1] bit SUBSTATUS_IN_LOVE, a ret -.Safeguard: ; 2c50c +.Safeguard: ld a, [wEnemyScreens] bit SCREENS_SAFEGUARD, a ret -.RainDance: ; 2c512 +.RainDance: ld a, [wBattleWeather] cp WEATHER_RAIN jr z, .Redundant jr .NotRedundant -.SunnyDay: ; 2c51b +.SunnyDay: ld a, [wBattleWeather] cp WEATHER_SUN jr z, .Redundant jr .NotRedundant -.DreamEater: ; 2c524 +.DreamEater: ld a, [wBattleMonStatus] and SLP jr z, .Redundant jr .NotRedundant -.Swagger: ; 2c52d +.Swagger: ld a, [wPlayerSubStatus3] bit SUBSTATUS_CONFUSED, a ret -.FutureSight: ; 2c533 +.FutureSight: ld a, [wEnemyScreens] bit 5, a ret @@ -183,16 +183,16 @@ AI_Redundant: ; 2c41a .Heal: .MorningSun: .Synthesis: -.Moonlight: ; 2c539 +.Moonlight: farcall AICheckEnemyMaxHP jr nc, .NotRedundant .Teleport: -.Redundant: ; 2c541 +.Redundant: ld a, 1 and a ret -.NotRedundant: ; 2c545 +.NotRedundant: xor a ret diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 7af2db8ad..3cd0e56c4 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1,6 +1,6 @@ -AIScoring: ; 38591 +AIScoring: ; used only for BANK(AIScoring) -AI_Basic: ; 38591 +AI_Basic: ; Don't do anything redundant: ; -Using status-only moves if the player can't be statused ; -Using moves that fail if they've already been used @@ -61,13 +61,11 @@ AI_Basic: ; 38591 .discourage call AIDiscourageMove jr .checkmove -; 385db INCLUDE "data/battle/ai/status_only_effects.asm" - -AI_Setup: ; 385e0 +AI_Setup: ; Use stat-modifying moves on turn 1. ; 50% chance to greatly encourage stat-up moves during the first turn of enemy's Pokemon. @@ -140,11 +138,9 @@ AI_Setup: ; 385e0 inc [hl] inc [hl] jr .checkmove -; 38635 - -AI_Types: ; 38635 +AI_Types: ; Dismiss any move that the player is immune to. ; Encourage super-effective moves. ; Discourage not very effective moves unless @@ -232,11 +228,9 @@ AI_Types: ; 38635 .immune call AIDiscourageMove jr .checkmove -; 386a2 - -AI_Offensive: ; 386a2 +AI_Offensive: ; Greatly discourage non-damaging moves. ld hl, wBuffer1 - 1 @@ -261,11 +255,9 @@ AI_Offensive: ; 386a2 inc [hl] inc [hl] jr .checkmove -; 386be - -AI_Smart: ; 386be +AI_Smart: ; Context-specific scoring. ld hl, wBuffer1 @@ -395,10 +387,8 @@ AI_Smart: ; 386be dbw EFFECT_THUNDER, AI_Smart_Thunder dbw EFFECT_FLY, AI_Smart_Fly db -1 ; end -; 387e3 - -AI_Smart_Sleep: ; 387e3 +AI_Smart_Sleep: ; Greatly encourage sleep inducing moves if the enemy has either Dream Eater or Nightmare. ; 50% chance to greatly encourage sleep inducing moves otherwise. @@ -416,10 +406,8 @@ AI_Smart_Sleep: ; 387e3 dec [hl] dec [hl] ret -; 387f7 - -AI_Smart_LeechHit: ; 387f7 +AI_Smart_LeechHit: push hl ld a, 1 ld [hBattleTurn], a @@ -452,10 +440,8 @@ AI_Smart_LeechHit: ; 387f7 inc [hl] ret -; 3881d - -AI_Smart_LockOn: ; 3881d +AI_Smart_LockOn: ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .asm_38882 @@ -558,10 +544,8 @@ AI_Smart_LockOn: ; 3881d .asm_388a2 pop hl jp AIDiscourageMove -; 388a6 - -AI_Smart_Selfdestruct: ; 388a6 +AI_Smart_Selfdestruct: ; Selfdestruct, Explosion ; Unless this is the enemy's last Pokemon... @@ -596,10 +580,8 @@ AI_Smart_Selfdestruct: ; 388a6 inc [hl] inc [hl] ret -; 388ca - -AI_Smart_DreamEater: ; 388ca +AI_Smart_DreamEater: ; 90% chance to greatly encourage this move. ; The AI_Basic layer will make sure that ; Dream Eater is only used against sleeping targets. @@ -610,11 +592,8 @@ AI_Smart_DreamEater: ; 388ca dec [hl] dec [hl] ret -; 388d4 - - -AI_Smart_EvasionUp: ; 388d4 +AI_Smart_EvasionUp: ; Dismiss this move if enemy's evasion can't raise anymore. ld a, [wEnemyEvaLevel] cp $d @@ -698,7 +677,6 @@ AI_Smart_EvasionUp: ; 388d4 bit SUBSTATUS_ROLLOUT, a jr nz, .asm_388ef - .asm_38936 inc [hl] ret @@ -723,10 +701,8 @@ AI_Smart_EvasionUp: ; 388d4 dec [hl] ret -; 38947 - -AI_Smart_AlwaysHit: ; 38947 +AI_Smart_AlwaysHit: ; 80% chance to greatly encourage this move if either... ; ...enemy's accuracy level has been lowered three or more stages @@ -746,11 +722,8 @@ AI_Smart_AlwaysHit: ; 38947 dec [hl] dec [hl] ret -; 3895b - - -AI_Smart_MirrorMove: ; 3895b +AI_Smart_MirrorMove: ; If the player did not use any move last turn... ld a, [wLastPlayerCounterMove] and a @@ -790,11 +763,8 @@ AI_Smart_MirrorMove: ; 3895b dec [hl] ret -; 38985 - - -AI_Smart_AccuracyDown: ; 38985 +AI_Smart_AccuracyDown: ; If player's HP is full... call AICheckPlayerMaxHP jr nc, .asm_389a0 @@ -897,11 +867,8 @@ AI_Smart_AccuracyDown: ; 38985 dec [hl] ret -; 389f5 - - -AI_Smart_ResetStats: ; 389f5 +AI_Smart_ResetStats: ; 85% chance to encourage this move if any of enemy's stat levels is lower than -2. push hl ld hl, wEnemyAtkLevel @@ -940,10 +907,8 @@ AI_Smart_ResetStats: ; 389f5 pop hl inc [hl] ret -; 38a1e - -AI_Smart_Bide: ; 38a1e +AI_Smart_Bide: ; 90% chance to discourage this move unless enemy's HP is full. call AICheckEnemyMaxHP @@ -953,10 +918,8 @@ AI_Smart_Bide: ; 38a1e ret c inc [hl] ret -; 38a2a - -AI_Smart_ForceSwitch: ; 38a2a +AI_Smart_ForceSwitch: ; Whirlwind, Roar. ; Discourage this move if the player has not shown @@ -971,13 +934,11 @@ AI_Smart_ForceSwitch: ; 38a2a ret c inc [hl] ret -; 38a3a - AI_Smart_Heal: AI_Smart_MorningSun: AI_Smart_Synthesis: -AI_Smart_Moonlight: ; 38a3a +AI_Smart_Moonlight: ; 90% chance to greatly encourage this move if enemy's HP is below 25%. ; Discourage this move if enemy's HP is higher than 50%. ; Do nothing otherwise. @@ -996,22 +957,18 @@ AI_Smart_Moonlight: ; 38a3a dec [hl] dec [hl] ret -; 38a4e - AI_Smart_Toxic: -AI_Smart_LeechSeed: ; 38a4e +AI_Smart_LeechSeed: ; Discourage this move if player's HP is below 50%. call AICheckPlayerHalfHP ret c inc [hl] ret -; 38a54 - AI_Smart_LightScreen: -AI_Smart_Reflect: ; 38a54 +AI_Smart_Reflect: ; Over 90% chance to discourage this move unless enemy's HP is full. call AICheckEnemyMaxHP @@ -1021,10 +978,8 @@ AI_Smart_Reflect: ; 38a54 ret c inc [hl] ret -; 38a60 - -AI_Smart_Ohko: ; 38a60 +AI_Smart_Ohko: ; Dismiss this move if player's level is higher than enemy's level. ; Else, discourage this move is player's HP is below 50%. @@ -1037,10 +992,8 @@ AI_Smart_Ohko: ; 38a60 ret c inc [hl] ret -; 38a71 - -AI_Smart_TrapTarget: ; 38a71 +AI_Smart_TrapTarget: ; Bind, Wrap, Fire Spin, Clamp ; 50% chance to discourage this move if the player is already trapped. @@ -1055,7 +1008,7 @@ AI_Smart_TrapTarget: ; 38a71 jr nz, .asm_38a91 ld a, [wPlayerSubStatus1] - and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE + and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE jr nz, .asm_38a91 ; Else, 50% chance to greatly encourage this move if it's the player's Pokemon first turn. @@ -1078,11 +1031,9 @@ AI_Smart_TrapTarget: ; 38a71 dec [hl] dec [hl] ret -; 38a9c - AI_Smart_RazorWind: -AI_Smart_Unused2B: ; 38a9c +AI_Smart_Unused2B: ld a, [wEnemySubStatus1] bit SUBSTATUS_PERISH, a jr z, .asm_38aaa @@ -1133,11 +1084,8 @@ AI_Smart_Unused2B: ; 38a9c add 6 ld [hl], a ret -; 38adb - - -AI_Smart_Confuse: ; 38adb +AI_Smart_Confuse: ; 90% chance to discourage this move if player's HP is between 25% and 50%. call AICheckPlayerHalfHP ret c @@ -1152,11 +1100,8 @@ AI_Smart_Confuse: ; 38adb ret c inc [hl] ret -; 38aed - - -AI_Smart_SpDefenseUp2: ; 38aed +AI_Smart_SpDefenseUp2: ; Discourage this move if enemy's HP is lower than 50%. call AICheckEnemyHalfHP jr nc, .asm_38b10 @@ -1188,10 +1133,8 @@ AI_Smart_SpDefenseUp2: ; 38aed .asm_38b10 inc [hl] ret -; 38b12 - -AI_Smart_Fly: ; 38b12 +AI_Smart_Fly: ; Fly, Dig ; Greatly encourage this move if the player is @@ -1208,21 +1151,16 @@ AI_Smart_Fly: ; 38b12 dec [hl] dec [hl] ret -; 38b20 - -AI_Smart_SuperFang: ; 38b20 +AI_Smart_SuperFang: ; Discourage this move if player's HP is below 25%. call AICheckPlayerQuarterHP ret c inc [hl] ret -; 38b26 - - -AI_Smart_Paralyze: ; 38b26 +AI_Smart_Paralyze: ; 50% chance to discourage this move if player's HP is below 25%. call AICheckPlayerQuarterHP jr nc, .asm_38b3a @@ -1244,10 +1182,8 @@ AI_Smart_Paralyze: ; 38b26 ret c inc [hl] ret -; 38b40 - -AI_Smart_SpeedDownHit: ; 38b40 +AI_Smart_SpeedDownHit: ; Icy Wind ; Almost 90% chance to greatly encourage this move if the following conditions all meet: @@ -1271,19 +1207,15 @@ AI_Smart_SpeedDownHit: ; 38b40 dec [hl] dec [hl] ret -; 38b5c - -AI_Smart_Substitute: ; 38b5c +AI_Smart_Substitute: ; Dismiss this move if enemy's HP is below 50%. call AICheckEnemyHalfHP ret c jp AIDiscourageMove -; 38b63 - -AI_Smart_HyperBeam: ; 38b63 +AI_Smart_HyperBeam: call AICheckEnemyHalfHP jr c, .asm_38b72 @@ -1305,10 +1237,8 @@ AI_Smart_HyperBeam: ; 38b63 ret c inc [hl] ret -; 38b7f - -AI_Smart_Rage: ; 38b7f +AI_Smart_Rage: ld a, [wEnemySubStatus4] bit SUBSTATUS_RAGE, a jr z, .asm_38b9b @@ -1345,10 +1275,8 @@ AI_Smart_Rage: ; 38b7f .asm_38ba6 inc [hl] ret -; 38ba8 - -AI_Smart_Mimic: ; 38ba8 +AI_Smart_Mimic: ld a, [wLastPlayerCounterMove] and a jr z, .asm_38be9 @@ -1396,10 +1324,8 @@ AI_Smart_Mimic: ; 38ba8 .asm_38bef inc [hl] ret -; 38bf1 - -AI_Smart_Counter: ; 38bf1 +AI_Smart_Counter: push hl ld hl, wPlayerUsedMoves ld c, 4 @@ -1448,7 +1374,6 @@ AI_Smart_Counter: ; 38bf1 cp SPECIAL jr nc, .asm_38c38 - .asm_38c30 call Random cp 39 percent + 1 @@ -1462,10 +1387,8 @@ AI_Smart_Counter: ; 38bf1 .asm_38c39 inc [hl] ret -; 38c3b - -AI_Smart_Encore: ; 38c3b +AI_Smart_Encore: call AICompareSpeed jr nc, .asm_38c81 @@ -1518,8 +1441,7 @@ AI_Smart_Encore: ; 38c3b INCLUDE "data/battle/ai/encore_moves.asm" - -AI_Smart_PainSplit: ; 38ca4 +AI_Smart_PainSplit: ; Discourage this move if [enemy's current HP * 2 > player's current HP]. push hl @@ -1538,11 +1460,9 @@ AI_Smart_PainSplit: ; 38ca4 ret nc inc [hl] ret -; 38cba - AI_Smart_Snore: -AI_Smart_SleepTalk: ; 38cba +AI_Smart_SleepTalk: ; Greatly encourage this move if enemy is fast asleep. ; Greatly discourage this move otherwise. @@ -1561,24 +1481,20 @@ AI_Smart_SleepTalk: ; 38cba inc [hl] inc [hl] ret -; 38ccb - -AI_Smart_DefrostOpponent: ; 38ccb +AI_Smart_DefrostOpponent: ; Greatly encourage this move if enemy is frozen. ; No move has EFFECT_DEFROST_OPPONENT, so this layer is unused. ld a, [wEnemyMonStatus] - and $20 + and 1 << FRZ ret z dec [hl] dec [hl] dec [hl] ret -; 38cd5 - -AI_Smart_Spite: ; 38cd5 +AI_Smart_Spite: ld a, [wLastPlayerCounterMove] and a jr nz, .asm_38ce7 @@ -1633,27 +1549,21 @@ AI_Smart_Spite: ; 38cd5 dec [hl] dec [hl] ret -; 38d16 - -Function_0x38d16; 38d16 +Function_0x38d16: jp AIDiscourageMove -; 38d19 - AI_Smart_DestinyBond: AI_Smart_Reversal: -AI_Smart_SkullBash: ; 38d19 +AI_Smart_SkullBash: ; Discourage this move if enemy's HP is above 25%. call AICheckEnemyQuarterHP ret nc inc [hl] ret -; 38d1f - -AI_Smart_HealBell: ; 38d1f +AI_Smart_HealBell: ; Dismiss this move if none of the opponent's Pokemon is statused. ; Encourage this move if the enemy is statused. ; 50% chance to greatly encourage this move if the enemy is fast asleep or frozen. @@ -1709,10 +1619,8 @@ AI_Smart_HealBell: ; 38d1f ret nz jp AIDiscourageMove -; 38d5a - -AI_Smart_PriorityHit: ; 38d5a +AI_Smart_PriorityHit: call AICompareSpeed ret c @@ -1742,20 +1650,16 @@ AI_Smart_PriorityHit: ; 38d5a dec [hl] dec [hl] ret -; 38d93 - -AI_Smart_Thief: ; 38d93 +AI_Smart_Thief: ; Don't use Thief unless it's the only move available. ld a, [hl] add $1e ld [hl], a ret -; 38d98 - -AI_Smart_Conversion2: ; 38d98 +AI_Smart_Conversion2: ld a, [wLastPlayerMove] and a jr nz, .asm_38dc9 @@ -1793,10 +1697,8 @@ AI_Smart_Conversion2: ; 38d98 ret c inc [hl] ret -; 38dd1 - -AI_Smart_Disable: ; 38dd1 +AI_Smart_Disable: call AICompareSpeed jr nc, .asm_38df3 @@ -1826,10 +1728,8 @@ AI_Smart_Disable: ; 38dd1 ret c inc [hl] ret -; 38dfb - -AI_Smart_MeanLook: ; 38dfb +AI_Smart_MeanLook: call AICheckEnemyHalfHP jr nc, .asm_38e24 @@ -1847,7 +1747,7 @@ AI_Smart_MeanLook: ; 38dfb ; 80% chance to greatly encourage this move if the player is either ; in love, identified, stuck in Rollout, or has a Nightmare. ld a, [wPlayerSubStatus1] - and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE + and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE jr nz, .asm_38e26 ; Otherwise, discourage this move unless the player only has not very effective moves against the enemy. @@ -1869,10 +1769,8 @@ AI_Smart_MeanLook: ; 38dfb dec [hl] dec [hl] ret -; 38e2e - -AICheckLastPlayerMon: ; 38e2e +AICheckLastPlayerMon: ld a, [wPartyCount] ld b, a ld c, 0 @@ -1896,10 +1794,8 @@ AICheckLastPlayerMon: ; 38e2e jr nz, .loop ret -; 38e4a - -AI_Smart_Nightmare: ; 38e4a +AI_Smart_Nightmare: ; 50% chance to encourage this move. ; The AI_Basic layer will make sure that ; Dream Eater is only used against sleeping targets. @@ -1908,10 +1804,8 @@ AI_Smart_Nightmare: ; 38e4a ret c dec [hl] ret -; 38e50 - -AI_Smart_FlameWheel: ; 38e50 +AI_Smart_FlameWheel: ; Use this move if the enemy is frozen. ld a, [wEnemyMonStatus] @@ -1921,10 +1815,8 @@ rept 5 dec [hl] endr ret -; 38e5c - -AI_Smart_Curse: ; 38e5c +AI_Smart_Curse: ld a, [wEnemyMonType1] cp GHOST jr z, .ghostcurse @@ -1981,14 +1873,12 @@ AI_Smart_Curse: ; 38e5c jr .asm_38eb7 - .asm_38eb0 push hl call AICheckLastPlayerMon pop hl jr z, .asm_38ecb - .asm_38eb7 call AICheckEnemyQuarterHP jp nc, .asm_38e90 @@ -2010,10 +1900,8 @@ AI_Smart_Curse: ; 38e5c dec [hl] dec [hl] ret -; 38ed2 - -AI_Smart_Protect: ; 38ed2 +AI_Smart_Protect: ld a, [wEnemyProtectCount] and a jr nz, .asm_38f13 @@ -2063,10 +1951,8 @@ AI_Smart_Protect: ; 38ed2 inc [hl] inc [hl] ret -; 38f1d - -AI_Smart_Foresight: ; 38f1d +AI_Smart_Foresight: ld a, [wEnemyAccLevel] cp $5 jr c, .asm_38f41 @@ -2094,10 +1980,8 @@ AI_Smart_Foresight: ; 38f1d dec [hl] dec [hl] ret -; 38f4a - -AI_Smart_PerishSong: ; 38f4a +AI_Smart_PerishSong: push hl callfar FindAliveEnemyMons pop hl @@ -2132,11 +2016,8 @@ AI_Smart_PerishSong: ; 38f4a add 5 ld [hl], a ret -; 38f7a - - -AI_Smart_Sandstorm: ; 38f7a +AI_Smart_Sandstorm: ; Greatly discourage this move if the player is immune to Sandstorm damage. ld a, [wBattleMonType1] push hl @@ -2177,10 +2058,8 @@ AI_Smart_Sandstorm: ; 38f7a db GROUND db STEEL db -1 ; end -; 38fac - -AI_Smart_Endure: ; 38fac +AI_Smart_Endure: ld a, [wEnemyProtectCount] and a jr nz, .asm_38fd8 @@ -2221,10 +2100,8 @@ AI_Smart_Endure: ; 38fac .asm_38fd9 inc [hl] ret -; 38fdb - -AI_Smart_FuryCutter: ; 38fdb +AI_Smart_FuryCutter: ; Encourage this move based on Fury Cutter's count. ld a, [wEnemyFuryCutterCount] @@ -2246,10 +2123,8 @@ AI_Smart_FuryCutter: ; 38fdb .end ; fallthrough -; 38fef - -AI_Smart_Rollout: ; 38fef +AI_Smart_Rollout: ; Rollout, Fury Cutter ; 80% chance to discourage this move if the enemy is in love, confused, or paralyzed. @@ -2290,11 +2165,9 @@ AI_Smart_Rollout: ; 38fef ret c inc [hl] ret -; 39026 - AI_Smart_Swagger: -AI_Smart_Attract: ; 39026 +AI_Smart_Attract: ; 80% chance to encourage this move during the first turn of player's Pokemon. ; 80% chance to discourage this move otherwise. @@ -2313,10 +2186,8 @@ AI_Smart_Attract: ; 39026 ret nc dec [hl] ret -; 3903a - -AI_Smart_Safeguard: ; 3903a +AI_Smart_Safeguard: ; 80% chance to discourage this move if player's HP is below 50%. call AICheckPlayerHalfHP @@ -2325,12 +2196,9 @@ AI_Smart_Safeguard: ; 3903a ret c inc [hl] ret -; 39044 - AI_Smart_Magnitude: -AI_Smart_Earthquake: ; 39044 - +AI_Smart_Earthquake: ; Greatly encourage this move if the player is underground and the enemy is faster. ld a, [wLastPlayerCounterMove] cp DIG @@ -2358,10 +2226,8 @@ AI_Smart_Earthquake: ; 39044 dec [hl] ret -; 39062 - -AI_Smart_BatonPass: ; 39062 +AI_Smart_BatonPass: ; Discourage this move if the player hasn't shown super-effective moves against the enemy. ; Consider player's type(s) if its moves are unknown. @@ -2373,10 +2239,8 @@ AI_Smart_BatonPass: ; 39062 ret c inc [hl] ret -; 39072 - -AI_Smart_Pursuit: ; 39072 +AI_Smart_Pursuit: ; 50% chance to greatly encourage this move if player's HP is below 25%. ; 80% chance to discourage this move otherwise. @@ -2393,10 +2257,8 @@ AI_Smart_Pursuit: ; 39072 dec [hl] dec [hl] ret -; 39084 - -AI_Smart_RapidSpin: ; 39084 +AI_Smart_RapidSpin: ; 80% chance to greatly encourage this move if the enemy is ; trapped (Bind effect), seeded, or scattered with spikes. @@ -2419,10 +2281,8 @@ AI_Smart_RapidSpin: ; 39084 dec [hl] dec [hl] ret -; 3909e - -AI_Smart_HiddenPower: ; 3909e +AI_Smart_HiddenPower: push hl ld a, 1 ld [hBattleTurn], a @@ -2459,11 +2319,8 @@ AI_Smart_HiddenPower: ; 3909e .bad inc [hl] ret -; 390cb - - -AI_Smart_RainDance: ; 390cb +AI_Smart_RainDance: ; Greatly discourage this move if it would favour the player type-wise. ; Particularly, if the player is a Water-type. ld a, [wBattleMonType1] @@ -2481,13 +2338,10 @@ AI_Smart_RainDance: ; 390cb push hl ld hl, RainDanceMoves jr AI_Smart_WeatherMove -; 390e7 INCLUDE "data/battle/ai/rain_dance_moves.asm" - -AI_Smart_SunnyDay: ; 390f3 - +AI_Smart_SunnyDay: ; Greatly discourage this move if it would favour the player type-wise. ; Particularly, if the player is a Fire-type. ld a, [wBattleMonType1] @@ -2506,10 +2360,8 @@ AI_Smart_SunnyDay: ; 390f3 ld hl, SunnyDayMoves ; fallthrough -; 3910d - -AI_Smart_WeatherMove: ; 3910d +AI_Smart_WeatherMove: ; Rain Dance, Sunny Day ; Greatly discourage this move if the enemy doesn't have @@ -2528,16 +2380,14 @@ AI_Smart_WeatherMove: ; 3910d dec [hl] ret -; 3911e -AIBadWeatherType: ; 3911e +AIBadWeatherType: inc [hl] inc [hl] inc [hl] ret -; 39122 -AIGoodWeatherType: ; 39122 +AIGoodWeatherType: ; Rain Dance, Sunny Day ; Greatly encourage this move if it would disfavour the player type-wise and player's HP is above 50%... @@ -2559,13 +2409,10 @@ AIGoodWeatherType: ; 39122 dec [hl] dec [hl] ret -; 39134 - INCLUDE "data/battle/ai/sunny_day_moves.asm" - -AI_Smart_BellyDrum: ; 3913d +AI_Smart_BellyDrum: ; Dismiss this move if enemy's attack is higher than +2 or if enemy's HP is below 50%. ; Else, discourage this move if enemy's HP is not full. @@ -2586,10 +2433,8 @@ AI_Smart_BellyDrum: ; 3913d add $5 ld [hl], a ret -; 39152 - -AI_Smart_PsychUp: ; 39152 +AI_Smart_PsychUp: push hl ld hl, wEnemyAtkLevel ld b, $8 @@ -2645,10 +2490,8 @@ AI_Smart_PsychUp: ; 39152 inc [hl] inc [hl] ret -; 3918b - -AI_Smart_MirrorCoat: ; 3918b +AI_Smart_MirrorCoat: push hl ld hl, wPlayerUsedMoves ld c, $4 @@ -2697,7 +2540,6 @@ AI_Smart_MirrorCoat: ; 3918b cp SPECIAL jr c, .asm_391d2 - .asm_391ca call Random cp 100 @@ -2710,12 +2552,9 @@ AI_Smart_MirrorCoat: ; 3918b .asm_391d3 inc [hl] ret -; 391d5 - AI_Smart_Twister: -AI_Smart_Gust: ; 391d5 - +AI_Smart_Gust: ; Greatly encourage this move if the player is flying and the enemy is faster. ld a, [wLastPlayerCounterMove] cp FLY @@ -2742,10 +2581,8 @@ AI_Smart_Gust: ; 391d5 ret c dec [hl] ret -; 391f3 - -AI_Smart_FutureSight: ; 391f3 +AI_Smart_FutureSight: ; Greatly encourage this move if the player is ; flying or underground, and slower than the enemy. @@ -2759,10 +2596,8 @@ AI_Smart_FutureSight: ; 391f3 dec [hl] dec [hl] ret -; 39200 - -AI_Smart_Stomp: ; 39200 +AI_Smart_Stomp: ; 80% chance to encourage this move if the player has used Minimize. ld a, [wPlayerMinimized] @@ -2774,10 +2609,8 @@ AI_Smart_Stomp: ; 39200 dec [hl] ret -; 3920b - -AI_Smart_Solarbeam: ; 3920b +AI_Smart_Solarbeam: ; 80% chance to encourage this move when it's sunny. ; 90% chance to discourage this move when it's raining. @@ -2803,10 +2636,8 @@ AI_Smart_Solarbeam: ; 3920b dec [hl] dec [hl] ret -; 39225 - -AI_Smart_Thunder: ; 39225 +AI_Smart_Thunder: ; 90% chance to discourage this move when it's sunny. ld a, [wBattleWeather] @@ -2819,10 +2650,8 @@ AI_Smart_Thunder: ; 39225 inc [hl] ret -; 39233 - -AICompareSpeed: ; 39233 +AICompareSpeed: ; Return carry if enemy is faster than player. push bc @@ -2836,30 +2665,24 @@ AICompareSpeed: ; 39233 sbc b pop bc ret -; 39246 - -AICheckPlayerMaxHP: ; 39246 +AICheckPlayerMaxHP: push hl push de push bc ld de, wBattleMonHP ld hl, wBattleMonMaxHP jr AICheckMaxHP -; 39251 - -AICheckEnemyMaxHP: ; 39251 +AICheckEnemyMaxHP: push hl push de push bc ld de, wEnemyMonHP ld hl, wEnemyMonMaxHP ; fallthrough -; 3925a - -AICheckMaxHP: ; 3925a +AICheckMaxHP: ; Return carry if hp at de matches max hp at hl. ld a, [de] @@ -2884,10 +2707,8 @@ AICheckMaxHP: ; 3925a pop hl and a ret -; 3926e - -AICheckPlayerHalfHP: ; 3926e +AICheckPlayerHalfHP: push hl ld hl, wBattleMonHP ld b, [hl] @@ -2903,10 +2724,8 @@ AICheckPlayerHalfHP: ; 3926e sbc b pop hl ret -; 39281 - -AICheckEnemyHalfHP: ; 39281 +AICheckEnemyHalfHP: push hl push de push bc @@ -2926,10 +2745,8 @@ AICheckEnemyHalfHP: ; 39281 pop de pop hl ret -; 39298 - -AICheckEnemyQuarterHP: ; 39298 +AICheckEnemyQuarterHP: push hl push de push bc @@ -2951,10 +2768,8 @@ AICheckEnemyQuarterHP: ; 39298 pop de pop hl ret -; 392b3 - -AICheckPlayerQuarterHP: ; 392b3 +AICheckPlayerQuarterHP: push hl ld hl, wBattleMonHP ld b, [hl] @@ -2972,10 +2787,8 @@ AICheckPlayerQuarterHP: ; 392b3 sbc b pop hl ret -; 392ca - -AIHasMoveEffect: ; 392ca +AIHasMoveEffect: ; Return carry if the enemy has move b. push hl @@ -3005,10 +2818,8 @@ AIHasMoveEffect: ; 392ca pop hl scf ret -; 392e6 - -AIHasMoveInArray: ; 392e6 +AIHasMoveInArray: ; Return carry if the enemy has a move in array hl. push hl @@ -3040,13 +2851,10 @@ AIHasMoveInArray: ; 392e6 pop de pop hl ret -; 39301 - INCLUDE "data/battle/ai/useful_moves.asm" - -AI_Opportunist: ; 39315 +AI_Opportunist: ; Discourage stall moves when the enemy's HP is low. ; Do nothing if enemy's HP is above 50%. @@ -3096,8 +2904,7 @@ AI_Opportunist: ; 39315 INCLUDE "data/battle/ai/stall_moves.asm" - -AI_Aggressive: ; 39369 +AI_Aggressive: ; Use whatever does the most damage. ; Discourage all damaging moves but the one that does the most damage. @@ -3204,8 +3011,7 @@ AI_Aggressive: ; 39369 INCLUDE "data/battle/ai/reckless_moves.asm" - -AIDamageCalc: ; 393e7 +AIDamageCalc: ld a, 1 ld [hBattleTurn], a ld a, [wEnemyMoveStruct + MOVE_EFFECT] @@ -3224,8 +3030,7 @@ AIDamageCalc: ; 393e7 INCLUDE "data/battle/ai/constant_damage_effects.asm" - -AI_Cautious: ; 39418 +AI_Cautious: ; 90% chance to discourage moves with residual effects after the first turn. ld a, [wEnemyTurnsTaken] @@ -3267,8 +3072,7 @@ AI_Cautious: ; 39418 INCLUDE "data/battle/ai/residual_moves.asm" - -AI_Status: ; 39453 +AI_Status: ; Dismiss status moves that don't affect the player. ld hl, wBuffer1 - 1 @@ -3328,11 +3132,9 @@ AI_Status: ; 39453 .immune call AIDiscourageMove jr .checkmove -; 394a9 - -AI_Risky: ; 394a9 +AI_Risky: ; Use any move that will KO the target. ; Risky moves will often be an exception (see below). @@ -3401,21 +3203,16 @@ endr INCLUDE "data/battle/ai/risky_effects.asm" - -AI_None: ; 39502 +AI_None: ret -; 39503 - -AIDiscourageMove: ; 39503 +AIDiscourageMove: ld a, [hl] add 10 ld [hl], a ret -; 39508 - -AIGetEnemyMove: ; 39508 +AIGetEnemyMove: ; Load attributes of move a into ram push hl @@ -3434,18 +3231,13 @@ AIGetEnemyMove: ; 39508 pop de pop hl ret -; 39521 - -AI_80_20: ; 39521 +AI_80_20: call Random cp 20 percent - 1 ret -; 39527 - -AI_50_50: ; 39527 +AI_50_50: call Random cp 50 percent + 1 ret -; 3952d diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index d397c8d32..b9bd2ea60 100644 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -1,4 +1,4 @@ -CheckPlayerMoveTypeMatchups: ; 3484e +CheckPlayerMoveTypeMatchups: ; Check how well the moves you've already used ; fare against the enemy's Pokemon. Used to ; score a potential switch. @@ -95,10 +95,8 @@ CheckPlayerMoveTypeMatchups: ; 3484e pop de pop hl ret -; 348de - -.CheckEnemyMoveMatchups: ; 348de +.CheckEnemyMoveMatchups: ld de, wEnemyMonMoves ld b, NUM_MOVES + 1 ld c, 0 @@ -163,21 +161,19 @@ CheckPlayerMoveTypeMatchups: ; 3484e .doubledown call .DecreaseScore -.DecreaseScore: ; 34931 +.DecreaseScore: ld a, [wEnemyAISwitchScore] dec a ld [wEnemyAISwitchScore], a ret -; 34939 -.IncreaseScore: ; 34939 +.IncreaseScore: ld a, [wEnemyAISwitchScore] inc a ld [wEnemyAISwitchScore], a ret -; 34941 -CheckAbleToSwitch: ; 34941 +CheckAbleToSwitch: xor a ld [wEnemySwitchMonParam], a call FindAliveEnemyMons @@ -292,10 +288,8 @@ CheckAbleToSwitch: ; 34941 add $10 ld [wEnemySwitchMonParam], a ret -; 349f4 - -FindAliveEnemyMons: ; 349f4 +FindAliveEnemyMons: ld a, [wOTPartyCount] cp 2 jr c, .only_one @@ -344,10 +338,8 @@ FindAliveEnemyMons: ; 349f4 .more_than_one and a ret -; 34a2a - -FindEnemyMonsImmuneToLastCounterMove: ; 34a2a +FindEnemyMonsImmuneToLastCounterMove: ld hl, wOTPartyMon1 ld a, [wOTPartyCount] ld b, a @@ -412,10 +404,8 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc d srl c jr .loop -; 34a85 - -FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 +FindAliveEnemyMonsWithASuperEffectiveMove: push bc ld a, [wOTPartyCount] ld e, a @@ -445,8 +435,9 @@ FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 and c ld c, a -FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 + ; fallthrough +FindEnemyMonsWithASuperEffectiveMove: ld a, -1 ld [wEnemyAISwitchScore], a ld hl, wOTPartyMon1Moves @@ -551,10 +542,8 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 ld [wEnemyAISwitchScore], a pop bc ret -; 34b20 - -FindEnemyMonsThatResistPlayer: ; 34b20 +FindEnemyMonsThatResistPlayer: push bc ld hl, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) @@ -613,10 +602,8 @@ FindEnemyMonsThatResistPlayer: ; 34b20 and c ld c, a ret -; 34b77 - -FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77 +FindEnemyMonsWithAtLeastQuarterMaxHP: push bc ld de, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) @@ -669,4 +656,3 @@ FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77 and c ld c, a ret -; 34bb1 diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index 5c453d0ff..fd9c783ce 100644 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -1,4 +1,4 @@ -_AnimateHPBar: ; d627 +_AnimateHPBar: call .IsMaximumMoreThan48Pixels jr c, .MoreThan48Pixels call .ComputePixels @@ -38,9 +38,8 @@ _AnimateHPBar: ; d627 pop af jr nc, .LongAnimLoop ret -; d65f -.IsMaximumMoreThan48Pixels: ; d65f +.IsMaximumMoreThan48Pixels: ld a, [wCurHPAnimMaxHP + 1] and a jr nz, .player @@ -53,9 +52,8 @@ _AnimateHPBar: ; d627 .player scf ret -; d670 -.ComputePixels: ; d670 +.ComputePixels: push hl ld hl, wCurHPAnimMaxHP ld a, [hli] @@ -127,9 +125,8 @@ _AnimateHPBar: ; d627 ld a, e ld [wCurHPAnimDeltaHP + 1], a ret -; d6e2 -ShortAnim_UpdateVariables: ; d6e2 +ShortAnim_UpdateVariables: ld hl, wCurHPBarPixels ld a, [wNewHPBarPixels] cp [hl] @@ -144,9 +141,8 @@ ShortAnim_UpdateVariables: ; d6e2 call ShortHPBar_CalcPixelFrame and a ret -; d6f5 -LongAnim_UpdateVariables: ; d6f5 +LongAnim_UpdateVariables: .loop ld hl, wCurHPAnimOldHP ld a, [hli] @@ -199,9 +195,8 @@ LongAnim_UpdateVariables: ; d6f5 ld [hl], a and a ret -; d730 -ShortHPBarAnim_UpdateTiles: ; d730 +ShortHPBarAnim_UpdateTiles: call HPBarAnim_UpdateHPRemaining ld d, HP_BAR_LENGTH ld a, [wWhichHPBar] @@ -215,9 +210,8 @@ ShortHPBarAnim_UpdateTiles: ; d730 pop de call HPBarAnim_PaletteUpdate ret -; d749 -LongHPBarAnim_UpdateTiles: ; d749 +LongHPBarAnim_UpdateTiles: call HPBarAnim_UpdateHPRemaining ld a, [wCurHPAnimOldHP] ld c, a @@ -238,9 +232,8 @@ LongHPBarAnim_UpdateTiles: ; d749 pop de call HPBarAnim_PaletteUpdate ret -; d771 -HPBarAnim_RedrawHPBar: ; d771 +HPBarAnim_RedrawHPBar: ld a, [wWhichHPBar] cp $2 jr nz, .skip @@ -253,9 +246,8 @@ HPBarAnim_RedrawHPBar: ; d771 .skip call DrawBattleHPBar ret -; d784 -HPBarAnim_UpdateHPRemaining: ; d784 +HPBarAnim_UpdateHPRemaining: ld a, [wWhichHPBar] and a ret z @@ -283,9 +275,8 @@ HPBarAnim_UpdateHPRemaining: ; d784 call PrintNum pop hl ret -; d7b4 -HPBarAnim_PaletteUpdate: ; d7b4 +HPBarAnim_PaletteUpdate: ld a, [hCGB] and a ret z @@ -295,9 +286,8 @@ HPBarAnim_PaletteUpdate: ; d7b4 ld c, a farcall ApplyHPBarPals ret -; d7c9 -HPBarAnim_BGMapUpdate: ; d7c9 +HPBarAnim_BGMapUpdate: ld a, [hCGB] and a jr nz, .cgb @@ -369,9 +359,8 @@ HPBarAnim_BGMapUpdate: ; d7c9 ld [hBGMapThird], a call DelayFrame ret -; d839 -ShortHPBar_CalcPixelFrame: ; d839 +ShortHPBar_CalcPixelFrame: ld a, [wCurHPAnimMaxHP] ld c, a ld b, 0 @@ -433,4 +422,3 @@ ShortHPBar_CalcPixelFrame: ; d839 ld a, [wCurHPAnimMaxHP] ld [wCurHPAnimOldHP], a ret -; d88c diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 42dd440ea..8747f46a6 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -6,7 +6,9 @@ BATTLETRANSITION_NO_CAVE_STRONGER EQU $18 BATTLETRANSITION_FINISH EQU $20 BATTLETRANSITION_END EQU $80 -DoBattleTransition: ; 8c20f +BATTLETRANSITION_SQUARE EQUS "\"8\"" ; $fe + +DoBattleTransition: call .InitGFX ld a, [rBGP] ld [wBGP], a @@ -58,9 +60,8 @@ DoBattleTransition: ; 8c20f ld [hVBlank], a call DelayFrame ret -; 8c26d -.InitGFX: ; 8c26d +.InitGFX: ld a, [wLinkMode] cp LINK_MOBILE jr z, .mobile @@ -87,20 +88,18 @@ DoBattleTransition: ; 8c20f ld [hl], a call WipeLYOverrides ret -; 8c2a0 -.NonMobile_LoadPokeballTiles: ; 8c2a0 +.NonMobile_LoadPokeballTiles: call LoadTrainerBattlePokeballTiles hlbgcoord 0, 0 call ConvertTrainerBattlePokeballTilesTo2bpp ret -; 8c2aa LoadTrainerBattlePokeballTiles: ; Load the tiles used in the Pokeball Graphic that fills the screen ; at the start of every Trainer battle. ld de, TrainerBattlePokeballTiles - ld hl, vTiles1 tile $7e + ld hl, vTiles0 tile BATTLETRANSITION_SQUARE ld b, BANK(TrainerBattlePokeballTiles) ld c, 2 call Request2bpp @@ -111,7 +110,7 @@ LoadTrainerBattlePokeballTiles: ld [rVBK], a ld de, TrainerBattlePokeballTiles - ld hl, vTiles4 tile $7e + ld hl, vTiles3 tile BATTLETRANSITION_SQUARE ld b, BANK(TrainerBattlePokeballTiles) ld c, 2 call Request2bpp @@ -119,9 +118,8 @@ LoadTrainerBattlePokeballTiles: pop af ld [rVBK], a ret -; 8c2cf -ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf +ConvertTrainerBattlePokeballTilesTo2bpp: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -146,17 +144,14 @@ ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf pop af ld [rSVBK], a ret -; 8c2f4 -TrainerBattlePokeballTiles: ; 8c2f4 +TrainerBattlePokeballTiles: INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp" - -BattleTransitionJumptable: ; 8c314 +BattleTransitionJumptable: jumptable .Jumptable, wJumptableIndex -; 8c323 -.Jumptable ; 8c323 (23:4323) +.Jumptable dw StartTrainerBattle_DetermineWhichAnimation ; 00 ; BATTLETRANSITION_CAVE @@ -213,7 +208,7 @@ BattleTransitionJumptable: ; 8c314 TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER -StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365) +StartTrainerBattle_DetermineWhichAnimation: ; The screen flashes a different number of times depending on the level of ; your lead Pokemon relative to the opponent's. ; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever @@ -240,41 +235,39 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365) ld a, [hl] ld [wJumptableIndex], a ret -; 8c38f (23:438f) -.StartingPoints: ; 8c38f +.StartingPoints: ; entries correspond to TRANS_* constants db BATTLETRANSITION_CAVE db BATTLETRANSITION_CAVE_STRONGER db BATTLETRANSITION_NO_CAVE db BATTLETRANSITION_NO_CAVE_STRONGER -; 8c393 -StartTrainerBattle_Finish: ; 8c393 (23:4393) +StartTrainerBattle_Finish: call ClearSprites ld a, BATTLETRANSITION_END ld [wJumptableIndex], a ret -StartTrainerBattle_NextScene: ; 8c39c (23:439c) +StartTrainerBattle_NextScene: ld hl, wJumptableIndex inc [hl] ret -StartTrainerBattle_SetUpBGMap: ; 8c3a1 (23:43a1) +StartTrainerBattle_SetUpBGMap: call StartTrainerBattle_NextScene xor a ld [wcf64], a ld [hBGMapMode], a ret -StartTrainerBattle_Flash: ; 8c3ab (23:43ab) +StartTrainerBattle_Flash: call .DoFlashAnimation ret nc call StartTrainerBattle_NextScene ret -.DoFlashAnimation: ; 8c3b3 (23:43b3) +.DoFlashAnimation: ld a, [wTimeOfDayPalset] cp %11111111 ; dark cave jr z, .done @@ -299,9 +292,8 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab) ld [wcf64], a scf ret -; 8c3db (23:43db) -.pals ; 8c3db +.pals db %11111001 ; 3321 db %11111110 ; 3332 db %11111111 ; 3333 @@ -315,9 +307,8 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab) db %10010000 ; 2100 db %11100100 ; 3210 db %00000001 ; 0001 -; 8c3e8 -StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) +StartTrainerBattle_SetUpForWavyOutro: farcall Function5602 ld a, BANK(wLYOverrides) ld [rSVBK], a @@ -335,7 +326,7 @@ StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) ld [wcf65], a ret -StartTrainerBattle_SineWave: ; 8c408 (23:4408) +StartTrainerBattle_SineWave: ld a, [wcf64] cp $60 jr nc, .end @@ -347,7 +338,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) ld [wJumptableIndex], a ret -.DoSineWave: ; 8c419 (23:4419) +.DoSineWave: ld hl, wcf65 ld a, [hl] inc [hl] @@ -375,7 +366,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) jr nz, .loop ret -StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) +StartTrainerBattle_SetUpForSpinOutro: farcall Function5602 ld a, BANK(wLYOverrides) ld [rSVBK], a @@ -384,7 +375,7 @@ StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) ld [wcf64], a ret -StartTrainerBattle_SpinToBlack: ; 8c44f (23:444f) +StartTrainerBattle_SpinToBlack: xor a ld [hBGMapMode], a ld a, [wcf64] @@ -418,7 +409,6 @@ endr ld a, BATTLETRANSITION_FINISH ld [wJumptableIndex], a ret -; 8c490 (23:4490) ; quadrants const_def @@ -431,7 +421,7 @@ endr RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT -.spintable ; 8c490 +.spintable spintable_entry: MACRO db \1 dw .wedge\2 @@ -458,9 +448,8 @@ ENDM spintable_entry LOWER_LEFT, 2, 0, 14 spintable_entry LOWER_LEFT, 1, 1, 11 db -1 -; 8c4f5 -.load ; 8c4f5 (23:44f5) +.load ld a, [hli] ld e, a ld a, [hli] @@ -512,16 +501,14 @@ ENDM dec c jr nz, .loop2 jr .loop -; 8c538 (23:4538) .wedge1 db 2, 3, 5, 4, 9, -1 .wedge2 db 1, 1, 2, 2, 4, 2, 4, 2, 3, -1 .wedge3 db 2, 1, 3, 1, 4, 1, 4, 1, 4, 1, 3, 1, 2, 1, 1, 1, 1, -1 .wedge4 db 4, 1, 4, 0, 3, 1, 3, 0, 2, 1, 2, 0, 1, -1 .wedge5 db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, -1 -; 8c578 -StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) +StartTrainerBattle_SetUpForRandomScatterOutro: farcall Function5602 ld a, BANK(wLYOverrides) ld [rSVBK], a @@ -532,7 +519,7 @@ StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) ld [hBGMapMode], a ret -StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f) +StartTrainerBattle_SpeckleToBlack: ld hl, wcf64 ld a, [hl] and a @@ -559,7 +546,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f) ld [wJumptableIndex], a ret -.BlackOutRandomTile: ; 8c5b8 (23:45b8) +.BlackOutRandomTile: .y_loop call Random cp SCREEN_HEIGHT @@ -590,7 +577,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f) ld [hl], $ff ret -StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) +StartTrainerBattle_LoadPokeBallGraphics: ld a, [wOtherTrainerClass] and a jp z, .nextscene ; don't need to be here if wild @@ -631,7 +618,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) jr z, .done sla a jr nc, .no_load - ld [hl], $fe + ld [hl], BATTLETRANSITION_SQUARE .no_load inc hl jr .loop4 @@ -690,11 +677,11 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) call DelayFrame call BattleStart_CopyTilemapAtOnce -.nextscene ; 8c673 (23:4673) +.nextscene call StartTrainerBattle_NextScene ret -.copypals ; 8c677 (23:4677) +.copypals ld de, wBGPals1 palette PAL_BG_TEXT call .copy ld de, wBGPals2 palette PAL_BG_TEXT @@ -707,21 +694,18 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) call .copy ld de, wOBPals2 palette PAL_OW_ROCK -.copy ; 8c698 (23:4698) +.copy push hl ld bc, 1 palettes call CopyBytes pop hl ret -; 8c6a1 (23:46a1) -.daypals ; 8c6a1 +.daypals INCLUDE "gfx/overworld/trainer_battle_day.pal" -; 8c6a9 -.nightpals ; 8c6a9 +.nightpals INCLUDE "gfx/overworld/trainer_battle_nite.pal" -; 8c6b1 .loadpokeballgfx ld a, [wOtherTrainerClass] @@ -746,7 +730,7 @@ PokeBallTransition: db %00001111, %11110000 db %00000011, %11000000 -WipeLYOverrides: ; 8c6d8 +WipeLYOverrides: ld a, [rSVBK] push af ld a, BANK(wLYOverrides) @@ -760,9 +744,8 @@ WipeLYOverrides: ; 8c6d8 pop af ld [rSVBK], a ret -; 8c6ef -.wipe ; 8c6ef +.wipe xor a ld c, SCREEN_HEIGHT_PX .loop @@ -770,14 +753,11 @@ WipeLYOverrides: ; 8c6d8 dec c jr nz, .loop ret -; 8c6f7 - -StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) +StartTrainerBattle_DrawSineWave: calc_sine_wave -; 8c768 -StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768) +StartTrainerBattle_ZoomToBlack: farcall Function5602 ld de, .boxes @@ -806,9 +786,8 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768) ld a, BATTLETRANSITION_FINISH ld [wJumptableIndex], a ret -; 8c792 (23:4792) -.boxes ; 8c792 +.boxes zoombox: MACRO ; width, height, start y, start x db \1, \2 @@ -824,9 +803,8 @@ ENDM zoombox 18, 16, 1, 1 zoombox 20, 18, 0, 0 db -1 -; 8c7b7 -.Copy: ; 8c7b7 (23:47b7) +.Copy: ld a, $ff .row push bc @@ -842,7 +820,6 @@ ENDM dec b jr nz, .row ret -; 8c7c9 (23:47c9) Unreferenced_Function8c7c9: ld a, $1 diff --git a/engine/battle/battlestart_copytilemapatonce.asm b/engine/battle/battlestart_copytilemapatonce.asm index 2952e833b..9d4d48d3a 100644 --- a/engine/battle/battlestart_copytilemapatonce.asm +++ b/engine/battle/battlestart_copytilemapatonce.asm @@ -1,3 +1,3 @@ -BattleStart_CopyTilemapAtOnce: ; 8cf4f +BattleStart_CopyTilemapAtOnce: call CGBOnly_CopyTilemapAtOnce ret diff --git a/engine/battle/check_battle_scene.asm b/engine/battle/check_battle_scene.asm index 577c36e33..13d0c665e 100644 --- a/engine/battle/check_battle_scene.asm +++ b/engine/battle/check_battle_scene.asm @@ -1,4 +1,4 @@ -CheckBattleScene: ; 4ea44 +CheckBattleScene: ; Return carry if battle scene is turned off. ld a, BANK(wLinkMode) diff --git a/engine/battle/consume_held_item.asm b/engine/battle/consume_held_item.asm index d727a44e0..fe63d40a8 100644 --- a/engine/battle/consume_held_item.asm +++ b/engine/battle/consume_held_item.asm @@ -1,4 +1,4 @@ -ConsumeHeldItem: ; 27192 +ConsumeHeldItem: push hl push de push bc diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 3055f4e90..d1bd41b84 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1,6 +1,6 @@ ; Core components of the battle engine. -BattleCore: -DoBattle: ; 3c000 + +DoBattle: xor a ld [wBattleParticipantsNotFainted], a ld [wBattleParticipantsIncludingFainted], a @@ -114,9 +114,8 @@ DoBattle: ; 3c000 .tutorial_debug jp BattleMenu -; 3c0e5 -WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 +WildFled_EnemyFled_LinkBattleCanceled: call Call_LoadTempTileMapToTileMap ld a, [wBattleResult] and BATTLERESULT_BITMASK @@ -156,9 +155,8 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 ld a, 1 ld [wBattleEnded], a ret -; 3c12f -BattleTurn: ; 3c12f +BattleTurn: .loop call Stubbed_Function3c1bf call CheckContestBattleOver @@ -229,7 +227,6 @@ BattleTurn: ; 3c12f .quit ret -; 3c1bf Stubbed_Function3c1bf: ret @@ -248,9 +245,8 @@ Stubbed_Function3c1bf: .finish call CloseSRAM ret -; 3c1d6 -HandleBetweenTurnEffects: ; 3c1d6 +HandleBetweenTurnEffects: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .CheckEnemyFirst @@ -297,9 +293,8 @@ HandleBetweenTurnEffects: ; 3c1d6 call UpdateBattleMonInParty call LoadTileMapToTempTileMap jp HandleEncore -; 3c23c -CheckFaint_PlayerThenEnemy: ; 3c23c +CheckFaint_PlayerThenEnemy: call HasPlayerFainted jr nz, .PlayerNotFainted call HandlePlayerMonFaint @@ -322,9 +317,8 @@ CheckFaint_PlayerThenEnemy: ; 3c23c .BattleIsOver: scf ret -; 3c25c -CheckFaint_EnemyThenPlayer: ; 3c25c +CheckFaint_EnemyThenPlayer: call HasEnemyFainted jr nz, .EnemyNotFainted call HandleEnemyMonFaint @@ -347,9 +341,8 @@ CheckFaint_EnemyThenPlayer: ; 3c25c .BattleIsOver: scf ret -; 3c27c -HandleBerserkGene: ; 3c27c +HandleBerserkGene: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .reverse @@ -424,9 +417,8 @@ HandleBerserkGene: ; 3c27c call SwitchTurnCore ld hl, BecameConfusedText jp StdBattleTextBox -; 3c300 -EnemyTriesToFlee: ; 3c300 +EnemyTriesToFlee: ld a, [wLinkMode] and a jr z, .not_linked @@ -442,9 +434,8 @@ EnemyTriesToFlee: ; 3c300 call WildFled_EnemyFled_LinkBattleCanceled scf ret -; 3c314 -DetermineMoveOrder: ; 3c314 +DetermineMoveOrder: ld a, [wLinkMode] and a jr z, .use_move @@ -560,14 +551,12 @@ DetermineMoveOrder: ; 3c314 .player_first scf ret -; 3c3f3 -.enemy_first ; 3c3f3 +.enemy_first and a ret -; 3c3f5 -CheckContestBattleOver: ; 3c3f5 +CheckContestBattleOver: ld a, [wBattleType] cp BATTLETYPE_CONTEST jr nz, .contest_not_over @@ -584,9 +573,8 @@ CheckContestBattleOver: ; 3c3f5 .contest_not_over and a ret -; 3c410 -CheckPlayerLockedIn: ; 3c410 +CheckPlayerLockedIn: ld a, [wPlayerSubStatus4] and 1 << SUBSTATUS_RECHARGE jp nz, .quit @@ -610,9 +598,8 @@ CheckPlayerLockedIn: ; 3c410 .quit scf ret -; 3c434 -ParsePlayerAction: ; 3c434 +ParsePlayerAction: call CheckPlayerLockedIn jp c, .locked_in ld hl, wPlayerSubStatus5 @@ -706,9 +693,8 @@ ParsePlayerAction: ; 3c434 res SUBSTATUS_RAGE, [hl] xor a ret -; 3c4df -HandleEncore: ; 3c4df +HandleEncore: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 @@ -764,9 +750,8 @@ HandleEncore: ; 3c4df call SetPlayerTurn ld hl, BattleText_TargetsEncoreEnded jp StdBattleTextBox -; 3c543 -TryEnemyFlee: ; 3c543 +TryEnemyFlee: ld a, [wBattleMode] dec a jr nz, .Stay @@ -819,11 +804,10 @@ TryEnemyFlee: ; 3c543 .Flee: scf ret -; 3c59a INCLUDE "data/wild/flee_mons.asm" -CompareMovePriority: ; 3c5b4 +CompareMovePriority: ; Compare the priority of the player and enemy's moves. ; Return carry if the player goes first, or z if they match. @@ -836,9 +820,8 @@ CompareMovePriority: ; 3c5b4 pop bc cp b ret -; 3c5c5 -GetMovePriority: ; 3c5c5 +GetMovePriority: ; Return the priority (0-3) of move a. ld b, a @@ -864,11 +847,10 @@ GetMovePriority: ; 3c5c5 .done ld a, [hl] ret -; 3c5df INCLUDE "data/moves/effects_priorities.asm" -GetMoveEffect: ; 3c5ec +GetMoveEffect: ld a, b dec a ld hl, Moves + MOVE_EFFECT @@ -878,9 +860,8 @@ GetMoveEffect: ; 3c5ec call GetFarByte ld b, a ret -; 3c5fe -Battle_EnemyFirst: ; 3c5fe +Battle_EnemyFirst: call LoadTileMapToTempTileMap call TryEnemyFlee jp c, WildFled_EnemyFled_LinkBattleCanceled @@ -922,9 +903,8 @@ Battle_EnemyFirst: ; 3c5fe xor a ld [wBattlePlayerAction], a ret -; 3c664 -Battle_PlayerFirst: ; 3c664 +Battle_PlayerFirst: xor a ld [wEnemyGoesFirst], a call SetEnemyTurn @@ -972,23 +952,20 @@ Battle_PlayerFirst: ; 3c664 xor a ld [wBattlePlayerAction], a ret -; 3c6cf -PlayerTurn_EndOpponentProtectEndureDestinyBond: ; 3c6cf +PlayerTurn_EndOpponentProtectEndureDestinyBond: call SetPlayerTurn call EndUserDestinyBond callfar DoPlayerTurn jp EndOpponentProtectEndureDestinyBond -; 3c6de -EnemyTurn_EndOpponentProtectEndureDestinyBond: ; 3c6de +EnemyTurn_EndOpponentProtectEndureDestinyBond: call SetEnemyTurn call EndUserDestinyBond callfar DoEnemyTurn jp EndOpponentProtectEndureDestinyBond -; 3c6ed -EndOpponentProtectEndureDestinyBond: ; 3c6ed +EndOpponentProtectEndureDestinyBond: ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVarAddr res SUBSTATUS_PROTECT, [hl] @@ -997,33 +974,30 @@ EndOpponentProtectEndureDestinyBond: ; 3c6ed call GetBattleVarAddr res SUBSTATUS_DESTINY_BOND, [hl] ret -; 3c6fe -EndUserDestinyBond: ; 3c6fe +EndUserDestinyBond: ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr res SUBSTATUS_DESTINY_BOND, [hl] ret -; 3c706 -HasUserFainted: ; 3c706 +HasUserFainted: ld a, [hBattleTurn] and a jr z, HasPlayerFainted -HasEnemyFainted: ; 3c70b +HasEnemyFainted: ld hl, wEnemyMonHP jr CheckIfHPIsZero -HasPlayerFainted: ; 3c710 +HasPlayerFainted: ld hl, wBattleMonHP -CheckIfHPIsZero: ; 3c713 +CheckIfHPIsZero: ld a, [hli] or [hl] ret -; 3c716 -ResidualDamage: ; 3c716 +ResidualDamage: ; Return z if the user fainted before ; or as a result of residual damage. ; For Sandstorm damage, see HandleWeather. @@ -1158,9 +1132,8 @@ ResidualDamage: ; 3c716 call DelayFrames xor a ret -; 3c801 -HandlePerishSong: ; 3c801 +HandlePerishSong: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst @@ -1227,9 +1200,8 @@ HandlePerishSong: ; 3c801 ld [hli], a ld [hl], a ret -; 3c874 -HandleWrap: ; 3c874 +HandleWrap: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst @@ -1292,16 +1264,14 @@ HandleWrap: ; 3c874 .print_text jp StdBattleTextBox -; 3c8e4 -SwitchTurnCore: ; 3c8e4 +SwitchTurnCore: ld a, [hBattleTurn] xor 1 ld [hBattleTurn], a ret -; 3c8eb -HandleLeftovers: ; 3c8eb +HandleLeftovers: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst @@ -1349,9 +1319,8 @@ HandleLeftovers: ; 3c8eb call RestoreHP ld hl, BattleText_TargetRecoveredWithItem jp StdBattleTextBox -; 3c93c -HandleMysteryberry: ; 3c93c +HandleMysteryberry: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst @@ -1488,9 +1457,8 @@ HandleMysteryberry: ; 3c93c call SwitchTurnCore ld hl, BattleText_UserRecoveredPPUsing jp StdBattleTextBox -; 3ca26 -HandleFutureSight: ; 3ca26 +HandleFutureSight: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .enemy_first @@ -1547,9 +1515,8 @@ HandleFutureSight: ; 3ca26 call UpdateBattleMonInParty jp UpdateEnemyMonInParty -; 3ca8f -HandleDefrost: ; 3ca8f +HandleDefrost: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .enemy_first @@ -1607,9 +1574,8 @@ HandleDefrost: ; 3ca8f call SetPlayerTurn ld hl, DefrostedOpponentText jp StdBattleTextBox -; 3cafb -HandleSafeguard: ; 3cafb +HandleSafeguard: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player1 @@ -1646,7 +1612,7 @@ HandleSafeguard: ; 3cafb ld hl, BattleText_SafeguardFaded jp StdBattleTextBox -HandleScreens: ; 3cb36 +HandleScreens: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .Both @@ -1681,15 +1647,13 @@ HandleScreens: ; 3cb36 .Copy: ld hl, wStringBuffer1 jp CopyName2 -; 3cb75 .Your: db "Your@" .Enemy: db "Enemy@" -; 3cb80 -.LightScreenTick: ; 3cb80 +.LightScreenTick: ld a, [de] dec a ld [de], a @@ -1702,9 +1666,8 @@ HandleScreens: ; 3cb36 pop de pop hl ret -; 3cb91 -.ReflectTick: ; 3cb91 +.ReflectTick: inc de ld a, [de] dec a @@ -1713,9 +1676,8 @@ HandleScreens: ; 3cb36 res SCREENS_REFLECT, [hl] ld hl, BattleText_MonsReflectFaded jp StdBattleTextBox -; 3cb9e -HandleWeather: ; 3cb9e +HandleWeather: ld a, [wBattleWeather] cp WEATHER_NONE ret z @@ -1804,7 +1766,6 @@ HandleWeather: ; 3cb9e ld h, [hl] ld l, a jp StdBattleTextBox -; 3cc2d .WeatherMessages: ; entries correspond to WEATHER_* constants @@ -1817,20 +1778,17 @@ HandleWeather: ; 3cb9e dw BattleText_TheRainStopped dw BattleText_TheSunlightFaded dw BattleText_TheSandstormSubsided -; 3cc39 -SubtractHPFromTarget: ; 3cc39 +SubtractHPFromTarget: call SubtractHP jp UpdateHPBar -; 3cc3f -SubtractHPFromUser: ; 3cc3f +SubtractHPFromUser: ; Subtract HP from mon call SubtractHP jp UpdateHPBarBattleHuds -; 3cc45 -SubtractHP: ; 3cc45 +SubtractHP: ld hl, wBattleMonHP ld a, [hBattleTurn] and a @@ -1860,9 +1818,8 @@ SubtractHP: ; 3cc45 ld [wBuffer5], a ld [wBuffer6], a ret -; 3cc76 -GetSixteenthMaxHP: ; 3cc76 +GetSixteenthMaxHP: call GetQuarterMaxHP ; quarter result srl c @@ -1874,9 +1831,8 @@ GetSixteenthMaxHP: ; 3cc76 inc c .ok ret -; 3cc83 -GetEighthMaxHP: ; 3cc83 +GetEighthMaxHP: ; output: bc call GetQuarterMaxHP ; assumes nothing can have 1024 or more hp @@ -1889,9 +1845,8 @@ GetEighthMaxHP: ; 3cc83 inc c .end ret -; 3cc8e -GetQuarterMaxHP: ; 3cc8e +GetQuarterMaxHP: ; output: bc call GetMaxHP @@ -1909,9 +1864,8 @@ GetQuarterMaxHP: ; 3cc8e inc c .end ret -; 3cc9f -GetHalfMaxHP: ; 3cc9f +GetHalfMaxHP: ; output: bc call GetMaxHP @@ -1926,9 +1880,8 @@ GetHalfMaxHP: ; 3cc9f inc c .end ret -; 3ccac -GetMaxHP: ; 3ccac +GetMaxHP: ; output: bc, wBuffer1-2 ld hl, wBattleMonMaxHP @@ -1945,9 +1898,8 @@ GetMaxHP: ; 3ccac ld [wBuffer1], a ld c, a ret -; 3ccc2 -Unreferenced_GetHalfHP: ; 3ccc2 +Unreferenced_GetHalfHP: ld hl, wBattleMonHP ld a, [hBattleTurn] and a @@ -1965,9 +1917,8 @@ Unreferenced_GetHalfHP: ; 3ccc2 ld a, [hl] ld [wBuffer1], a ret -; 3ccde -CheckUserHasEnoughHP: ; 3ccde +CheckUserHasEnoughHP: ld hl, wBattleMonHP + 1 ld a, [hBattleTurn] and a @@ -1980,9 +1931,8 @@ CheckUserHasEnoughHP: ; 3ccde ld a, b sbc [hl] ret -; 3ccef -RestoreHP ; 3ccef +RestoreHP ld hl, wEnemyMonMaxHP ld a, [hBattleTurn] and a @@ -2025,14 +1975,12 @@ RestoreHP ; 3ccef call SwitchTurnCore call UpdateHPBarBattleHuds jp SwitchTurnCore -; 3cd36 -UpdateHPBarBattleHuds: ; 3cd36 +UpdateHPBarBattleHuds: call UpdateHPBar jp UpdateBattleHuds -; 3cd3c -UpdateHPBar: ; 3cd3c +UpdateHPBar: hlcoord 10, 9 ld a, [hBattleTurn] and a @@ -2046,9 +1994,8 @@ UpdateHPBar: ; 3cd3c predef AnimateHPBar pop bc ret -; 3cd55 -HandleEnemyMonFaint: ; 3cd55 +HandleEnemyMonFaint: call FaintEnemyPokemon ld hl, wBattleMonHP ld a, [hli] @@ -2115,9 +2062,8 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wBattlePlayerAction], a ret -; 3cdca -DoubleSwitch: ; 3cdca +DoubleSwitch: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 @@ -2145,9 +2091,8 @@ DoubleSwitch: ; 3cdca xor a ld [wBattlePlayerAction], a ret -; 3ce01 -UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 +UpdateBattleStateAndExperienceAfterEnemyFaint: call UpdateBattleMonInParty ld a, [wBattleMode] dec a @@ -2236,9 +2181,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 pop af ld [wBattleParticipantsNotFainted], a ret -; 3ceaa -IsAnyMonHoldingExpShare: ; 3ceaa +IsAnyMonHoldingExpShare: ld a, [wPartyCount] ld b, a ld hl, wPartyMon1 @@ -2292,15 +2236,13 @@ IsAnyMonHoldingExpShare: ; 3ceaa ld a, e and a ret -; 3ceec -StopDangerSound: ; 3ceec +StopDangerSound: xor a ld [wLowHealthAlarm], a ret -; 3cef1 -FaintYourPokemon: ; 3cef1 +FaintYourPokemon: call StopDangerSound call WaitSFX ld a, $f0 @@ -2313,9 +2255,8 @@ FaintYourPokemon: ; 3cef1 call ClearBox ld hl, BattleText_MonFainted jp StdBattleTextBox -; 3cf14 -FaintEnemyPokemon: ; 3cf14 +FaintEnemyPokemon: call WaitSFX ld de, SFX_KINESIS call PlaySFX @@ -2327,9 +2268,8 @@ FaintEnemyPokemon: ; 3cf14 call ClearBox ld hl, BattleText_EnemyMonFainted jp StdBattleTextBox -; 3cf35 -CheckEnemyTrainerDefeated: ; 3cf35 +CheckEnemyTrainerDefeated: ld a, [wOTPartyCount] ld b, a xor a @@ -2347,9 +2287,8 @@ CheckEnemyTrainerDefeated: ; 3cf35 and a ret -; 3cf4a -HandleEnemySwitch: ; 3cf4a +HandleEnemySwitch: ld hl, wEnemyHPPal ld e, HP_BAR_LENGTH_PX call UpdateHPPal @@ -2374,9 +2313,8 @@ HandleEnemySwitch: ; 3cf4a jr nz, EnemyPartyMonEntrance inc a ret -; 3cf78 -EnemyPartyMonEntrance: ; 3cf78 +EnemyPartyMonEntrance: push af xor a ld [wEnemySwitchMonIndex], a @@ -2400,9 +2338,8 @@ EnemyPartyMonEntrance: ; 3cf78 ld [wBattlePlayerAction], a inc a ret -; 3cfa4 -WinTrainerBattle: ; 3cfa4 +WinTrainerBattle: ; Player won the battle call StopDangerSound ld a, $1 @@ -2524,27 +2461,24 @@ WinTrainerBattle: ; 3cfa4 .KeepItAll: ld hl, GotMoneyForWinningText jp StdBattleTextBox -; 3d081 -.AddMoneyToMom: ; 3d081 +.AddMoneyToMom: push bc ld hl, wBattleReward + 2 ld de, wMomsMoney + 2 call AddBattleMoneyToAccount pop bc ret -; 3d08d -.AddMoneyToWallet: ; 3d08d +.AddMoneyToWallet: push bc ld hl, wBattleReward + 2 ld de, wMoney + 2 call AddBattleMoneyToAccount pop bc ret -; 3d099 -.DoubleReward: ; 3d099 +.DoubleReward: ld hl, wBattleReward + 2 sla [hl] dec hl @@ -2557,16 +2491,14 @@ WinTrainerBattle: ; 3cfa4 ld [hli], a ld [hl], a ret -; 3d0ab -.SentToMomTexts: ; 3d0ab +.SentToMomTexts: ; entries correspond to MOM_SAVING_* constants dw SentSomeToMomText dw SentHalfToMomText dw SentAllToMomText -; 3d0b1 -.CheckMaxedOutMomMoney: ; 3d0b1 +.CheckMaxedOutMomMoney: ld hl, wMomsMoney + 2 ld a, [hld] cp LOW(MAX_MONEY) @@ -2575,9 +2507,8 @@ WinTrainerBattle: ; 3cfa4 ld a, [hl] sbc HIGH(MAX_MONEY >> 8) ret -; 3d0be -AddBattleMoneyToAccount: ; 3d0be +AddBattleMoneyToAccount: ld c, 3 and a push de @@ -2610,9 +2541,8 @@ AddBattleMoneyToAccount: ; 3d0be inc hl ld [hl], LOW(MAX_MONEY) ret -; 3d0ea -PlayVictoryMusic: ; 3d0ea +PlayVictoryMusic: push de ld de, MUSIC_NONE call PlayMusic @@ -2646,13 +2576,12 @@ PlayVictoryMusic: ; 3d0ea .lost pop de ret -; 3d123 -IsKantoGymLeader: ; 0x3d123 +IsKantoGymLeader: ld hl, KantoGymLeaders jr IsGymLeaderCommon -IsGymLeader: ; 0x3d128 +IsGymLeader: ld hl, GymLeaders IsGymLeaderCommon: push de @@ -2661,11 +2590,10 @@ IsGymLeaderCommon: call IsInArray pop de ret -; 0x3d137 INCLUDE "data/trainers/leaders.asm" -HandlePlayerMonFaint: ; 3d14e +HandlePlayerMonFaint: call FaintYourPokemon ld hl, wEnemyMonHP ld a, [hli] @@ -2713,9 +2641,8 @@ HandlePlayerMonFaint: ; 3d14e call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled jp DoubleSwitch -; 3d1aa -PlayerMonFaintHappinessMod: ; 3d1aa +PlayerMonFaintHappinessMod: ld a, [wCurBattleMon] ld c, a ld hl, wBattleParticipantsNotFainted @@ -2752,9 +2679,8 @@ PlayerMonFaintHappinessMod: ; 3d1aa and a ret z ret ; ?????????? -; 3d1f8 -AskUseNextPokemon: ; 3d1f8 +AskUseNextPokemon: call EmptyBattleTextBox call LoadTileMapToTempTileMap ; We don't need to be here if we're in a Trainer battle, @@ -2781,9 +2707,8 @@ AskUseNextPokemon: ; 3d1f8 ld hl, wPartyMon1Speed ld de, wEnemyMonSpeed jp TryToRunAwayFromBattle -; 3d227 -ForcePlayerMonChoice: ; 3d227 +ForcePlayerMonChoice: call EmptyBattleTextBox call LoadStandardMenuHeader call SetUpBattlePartyMenu_NoLoop @@ -2845,9 +2770,8 @@ ForcePlayerMonChoice: ; 3d227 and a ld c, a ret -; 3d2b3 -PlayerPartyMonEntrance: ; 3d2b3 +PlayerPartyMonEntrance: ld a, [wCurBattleMon] ld [wLastPlayerMon], a ld a, [wCurPartyMon] @@ -2863,9 +2787,8 @@ PlayerPartyMonEntrance: ; 3d2b3 call LoadTileMapToTempTileMap call SetPlayerTurn jp SpikesDamage -; 3d2e0 -CheckMobileBattleError: ; 3d2e0 +CheckMobileBattleError: ld a, [wLinkMode] cp LINK_MOBILE jr nz, .not_mobile ; It's not a mobile battle @@ -2881,15 +2804,13 @@ CheckMobileBattleError: ; 3d2e0 .not_mobile xor a ret -; 3d2f1 -IsMobileBattle: ; 3d2f1 +IsMobileBattle: ld a, [wLinkMode] cp LINK_MOBILE ret -; 3d2f7 -SetUpBattlePartyMenu_NoLoop: ; 3d2f7 +SetUpBattlePartyMenu_NoLoop: call ClearBGPalettes SetUpBattlePartyMenu: ; switch to fullscreen menu? farcall LoadPartyMenuGFX @@ -2897,18 +2818,16 @@ SetUpBattlePartyMenu: ; switch to fullscreen menu? farcall InitPartyMenuBGPal7 farcall InitPartyMenuGFX ret -; 3d313 -JumpToPartyMenuAndPrintText: ; 3d313 +JumpToPartyMenuAndPrintText: farcall WritePartyMenuTilemap farcall PrintPartyMenuText call WaitBGMap call SetPalettes call DelayFrame ret -; 3d329 -SelectBattleMon: ; 3d329 +SelectBattleMon: call IsMobileBattle jr z, .mobile farcall PartyMenuSelect @@ -2917,9 +2836,8 @@ SelectBattleMon: ; 3d329 .mobile farcall Mobile_PartyMenuSelect ret -; 3d33c -PickPartyMonInBattle: ; 3d33c +PickPartyMonInBattle: .loop ld a, PARTYMENUACTION_SWITCH ; Which PKMN? ld [wPartyMenuActionText], a @@ -2930,9 +2848,8 @@ PickPartyMonInBattle: ; 3d33c jr z, .loop xor a ret -; 3d34f -SwitchMonAlreadyOut: ; 3d34f +SwitchMonAlreadyOut: ld hl, wCurBattleMon ld a, [wCurPartyMon] cp [hl] @@ -2946,9 +2863,8 @@ SwitchMonAlreadyOut: ; 3d34f .notout xor a ret -; 3d362 -ForcePickPartyMonInBattle: ; 3d362 +ForcePickPartyMonInBattle: ; Can't back out. .pick @@ -2961,9 +2877,8 @@ ForcePickPartyMonInBattle: ; 3d362 call PlaySFX call WaitSFX jr .pick -; 3d375 -PickSwitchMonInBattle: ; 3d375 +PickSwitchMonInBattle: .pick call PickPartyMonInBattle ret c @@ -2971,9 +2886,8 @@ PickSwitchMonInBattle: ; 3d375 jr c, .pick xor a ret -; 3d380 -ForcePickSwitchMonInBattle: ; 3d380 +ForcePickSwitchMonInBattle: ; Can't back out. .pick @@ -2985,9 +2899,8 @@ ForcePickSwitchMonInBattle: ; 3d380 xor a ret -; 3d38e -LostBattle: ; 3d38e +LostBattle: ld a, 1 ld [wBattleEnded], a @@ -3081,21 +2994,18 @@ LostBattle: ; 3d38e farcall Mobile_PrintOpponentBattleMessage scf ret -; 3d432 -EnemyMonFaintedAnimation: ; 3d432 +EnemyMonFaintedAnimation: hlcoord 12, 5 decoord 12, 6 jp MonFaintedAnimation -; 3d43b -PlayerMonFaintedAnimation: ; 3d43b +PlayerMonFaintedAnimation: hlcoord 1, 10 decoord 1, 11 jp MonFaintedAnimation -; 3d444 -MonFaintedAnimation: ; 3d444 +MonFaintedAnimation: ld a, [wcfbe] push af set 6, a @@ -3144,13 +3054,11 @@ MonFaintedAnimation: ; 3d444 pop af ld [wcfbe], a ret -; 3d488 .Spaces: db " @" -; 3d490 -SlideBattlePicOut: ; 3d490 +SlideBattlePicOut: ld [hMapObjectIndexBuffer], a ld c, a .loop @@ -3172,9 +3080,8 @@ SlideBattlePicOut: ; 3d490 dec c jr nz, .loop ret -; 3d4ae -.DoFrame: ; 3d4ae +.DoFrame: ld a, [hMapObjectIndexBuffer] ld c, a cp $8 @@ -3194,9 +3101,8 @@ SlideBattlePicOut: ; 3d490 dec c jr nz, .back ret -; 3d4c3 -ForceEnemySwitch: ; 3d4c3 +ForceEnemySwitch: call ResetEnemyBattleVars ld a, [wEnemySwitchMonIndex] dec a @@ -3209,9 +3115,8 @@ ForceEnemySwitch: ; 3d4c3 call BreakAttraction call ResetBattleParticipants ret -; 3d4e1 -EnemySwitch: ; 3d4e1 +EnemySwitch: call CheckWhetherToAskSwitch jr nc, EnemySwitch_SetMode ; Shift Mode @@ -3238,9 +3143,8 @@ EnemySwitch: ; 3d4e1 ld [wEnemyIsSwitching], a call LoadTileMapToTempTileMap jp PlayerSwitch -; 3d517 -EnemySwitch_SetMode: ; 3d517 +EnemySwitch_SetMode: call ResetEnemyBattleVars call CheckWhetherSwitchmonIsPredetermined jr c, .skip @@ -3253,9 +3157,8 @@ EnemySwitch_SetMode: ; 3d517 call ClearEnemyMonBox call Function_BattleTextEnemySentOut jp Function_SetEnemyMonAndSendOutAnimation -; 3d533 -CheckWhetherSwitchmonIsPredetermined: ; 3d533 +CheckWhetherSwitchmonIsPredetermined: ; returns carry if: ??? ld a, [wLinkMode] and a @@ -3287,9 +3190,8 @@ CheckWhetherSwitchmonIsPredetermined: ; 3d533 .return_carry scf ret -; 3d557 -ResetEnemyBattleVars: ; 3d557 +ResetEnemyBattleVars: ; and draw empty TextBox xor a ld [wLastPlayerCounterMove], a @@ -3305,13 +3207,12 @@ ResetEnemyBattleVars: ; 3d557 call SlideBattlePicOut call EmptyBattleTextBox jp LoadStandardMenuHeader -; 3d57a -ResetBattleParticipants: ; 3d57a +ResetBattleParticipants: xor a ld [wBattleParticipantsNotFainted], a ld [wBattleParticipantsIncludingFainted], a -AddBattleParticipant: ; 3d581 +AddBattleParticipant: ld a, [wCurBattleMon] ld c, a ld hl, wBattleParticipantsNotFainted @@ -3321,9 +3222,8 @@ AddBattleParticipant: ; 3d581 pop bc ld hl, wBattleParticipantsIncludingFainted predef_jump SmallFarFlagAction -; 3d599 -FindMonInOTPartyToSwitchIntoBattle: ; 3d599 +FindMonInOTPartyToSwitchIntoBattle: ld b, -1 ld a, $1 ld [wBuffer1], a @@ -3358,9 +3258,8 @@ FindMonInOTPartyToSwitchIntoBattle: ; 3d599 ld hl, wBuffer2 set 0, [hl] jr .loop -; 3d5d7 -LookUpTheEffectivenessOfEveryMove: ; 3d5d7 +LookUpTheEffectivenessOfEveryMove: push bc ld hl, wOTPartyMon1Moves ld a, b @@ -3396,9 +3295,8 @@ LookUpTheEffectivenessOfEveryMove: ; 3d5d7 ret .done ret -; 3d618 -IsThePlayerMonTypesEffectiveAgainstOTMon: ; 3d618 +IsThePlayerMonTypesEffectiveAgainstOTMon: ; Calculates the effectiveness of the types of the PlayerMon ; against the OTMon push bc @@ -3445,9 +3343,8 @@ IsThePlayerMonTypesEffectiveAgainstOTMon: ; 3d618 .reset res 0, [hl] ret -; 3d672 -ScoreMonTypeMatchups: ; 3d672 +ScoreMonTypeMatchups: .loop1 ld hl, wBuffer1 sla [hl] @@ -3510,9 +3407,8 @@ ScoreMonTypeMatchups: ; 3d672 .quit ret -; 3d6ca -LoadEnemyMonToSwitchTo: ; 3d6ca +LoadEnemyMonToSwitchTo: ; 'b' contains the PartyNr of the mon the AI will switch to ld a, b ld [wCurPartyMon], a @@ -3549,9 +3445,8 @@ LoadEnemyMonToSwitchTo: ; 3d6ca ld a, [hl] ld [wEnemyHPAtTimeOfPlayerSwitch + 1], a ret -; 3d714 -CheckWhetherToAskSwitch: ; 3d714 +CheckWhetherToAskSwitch: ld a, [wBattleHasJustStarted] dec a jp z, .return_nc @@ -3579,9 +3474,8 @@ CheckWhetherToAskSwitch: ; 3d714 .return_nc and a ret -; 3d74b -OfferSwitch: ; 3d74b +OfferSwitch: ld a, [wCurPartyMon] push af callfar Battle_GetTrainerName @@ -3620,9 +3514,8 @@ OfferSwitch: ; 3d74b ld [wCurPartyMon], a scf ret -; 3d7a0 -ClearEnemyMonBox: ; 3d7a0 +ClearEnemyMonBox: xor a ld [hBGMapMode], a call ExitMenu @@ -3632,16 +3525,14 @@ ClearEnemyMonBox: ; 3d7a0 call ClearBox call WaitBGMap jp FinishBattleAnim -; 3d7b8 -Function_BattleTextEnemySentOut: ; 3d7b8 +Function_BattleTextEnemySentOut: callfar Battle_GetTrainerName ld hl, BattleText_EnemySentOut call StdBattleTextBox jp WaitBGMap -; 3d7c7 -Function_SetEnemyMonAndSendOutAnimation: ; 3d7c7 +Function_SetEnemyMonAndSendOutAnimation: ld a, [wTempEnemyMonSpecies] ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -3688,9 +3579,8 @@ Function_SetEnemyMonAndSendOutAnimation: ; 3d7c7 ld a, $1 ld [hBGMapMode], a ret -; 3d834 -NewEnemyMonStatus: ; 3d834 +NewEnemyMonStatus: xor a ld [wLastPlayerCounterMove], a ld [wLastEnemyCounterMove], a @@ -3712,9 +3602,8 @@ endr ld hl, wPlayerSubStatus5 res SUBSTATUS_CANT_RUN, [hl] ret -; 3d867 -ResetEnemyStatLevels: ; 3d867 +ResetEnemyStatLevels: ld a, BASE_STAT_LEVEL ld b, NUM_LEVEL_STATS ld hl, wEnemyStatLevels @@ -3723,27 +3612,25 @@ ResetEnemyStatLevels: ; 3d867 dec b jr nz, .loop ret -; 3d873 -CheckPlayerPartyForFitMon: ; 3d873 +CheckPlayerPartyForFitMon: ; Has the player any mon in his Party that can fight? ld a, [wPartyCount] ld e, a xor a ld hl, wPartyMon1HP - ld bc, wPartyMon2 - (wPartyMon1 + 1) + ld bc, PARTYMON_STRUCT_LENGTH - 1 .loop or [hl] - inc hl + inc hl ; + 1 or [hl] add hl, bc dec e jr nz, .loop ld d, a ret -; 3d887 -CheckIfCurPartyMonIsFitToFight: ; 3d887 +CheckIfCurPartyMonIsFitToFight: ld a, [wCurPartyMon] ld hl, wPartyMon1HP call GetPartyLocation @@ -3772,9 +3659,8 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887 .finish_fail xor a ret -; 3d8b3 -TryToRunAwayFromBattle: ; 3d8b3 +TryToRunAwayFromBattle: ; Run away from battle, with or without item ld a, [wBattleType] cp BATTLETYPE_DEBUG @@ -3961,9 +3847,8 @@ TryToRunAwayFromBattle: ; 3d8b3 call LoadTileMapToTempTileMap scf ret -; 3da0d -InitBattleMon: ; 3da0d +InitBattleMon: ld a, MON_SPECIES call GetPartyParamLocation ld de, wBattleMonSpecies @@ -4002,23 +3887,21 @@ InitBattleMon: ; 3da0d call ApplyStatusEffectOnPlayerStats call BadgeStatBoosts ret -; 3da74 -BattleCheckPlayerShininess: ; 3da74 +BattleCheckPlayerShininess: call GetPartyMonDVs jr BattleCheckShininess -BattleCheckEnemyShininess: ; 3da79 +BattleCheckEnemyShininess: call GetEnemyMonDVs -BattleCheckShininess: ; 3da7c +BattleCheckShininess: ld b, h ld c, l callfar CheckShininess ret -; 3da85 -GetPartyMonDVs: ; 3da85 +GetPartyMonDVs: ld hl, wBattleMonDVs ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a @@ -4026,9 +3909,8 @@ GetPartyMonDVs: ; 3da85 ld hl, wPartyMon1DVs ld a, [wCurBattleMon] jp GetPartyLocation -; 3da97 -GetEnemyMonDVs: ; 3da97 +GetEnemyMonDVs: ld hl, wEnemyMonDVs ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a @@ -4040,9 +3922,8 @@ GetEnemyMonDVs: ; 3da97 ld hl, wOTPartyMon1DVs ld a, [wCurOTMon] jp GetPartyLocation -; 3dab1 -ResetPlayerStatLevels: ; 3dab1 +ResetPlayerStatLevels: ld a, BASE_STAT_LEVEL ld b, NUM_LEVEL_STATS ld hl, wPlayerStatLevels @@ -4051,9 +3932,8 @@ ResetPlayerStatLevels: ; 3dab1 dec b jr nz, .loop ret -; 3dabd -InitEnemyMon: ; 3dabd +InitEnemyMon: ld a, [wCurPartyMon] ld hl, wOTPartyMon1Species call GetPartyLocation @@ -4104,9 +3984,8 @@ InitEnemyMon: ; 3dabd ld a, [wCurPartyMon] ld [wCurOTMon], a ret -; 3db32 -SwitchPlayerMon: ; 3db32 +SwitchPlayerMon: call ClearSprites ld a, [wCurBattleMon] ld [wLastPlayerMon], a @@ -4124,9 +4003,8 @@ SwitchPlayerMon: ; 3db32 ld a, [hli] or [hl] ret -; 3db5f -SendOutPlayerMon: ; 3db5f +SendOutPlayerMon: ld hl, wBattleMonDVs predef GetUnownLetter hlcoord 1, 5 @@ -4180,9 +4058,8 @@ SendOutPlayerMon: ; 3db5f ld a, $1 ld [hBGMapMode], a ret -; 3dbde -NewBattleMonStatus: ; 3dbde +NewBattleMonStatus: xor a ld [wLastPlayerCounterMove], a ld [wLastEnemyCounterMove], a @@ -4209,17 +4086,15 @@ endr ld hl, wEnemySubStatus5 res SUBSTATUS_CANT_RUN, [hl] ret -; 3dc18 -BreakAttraction: ; 3dc18 +BreakAttraction: ld hl, wPlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] ld hl, wEnemySubStatus1 res SUBSTATUS_IN_LOVE, [hl] ret -; 3dc23 -SpikesDamage: ; 3dc23 +SpikesDamage: ld hl, wPlayerScreens ld de, wBattleMonType ld bc, UpdatePlayerHUD @@ -4258,9 +4133,8 @@ SpikesDamage: ; 3dc23 .hl jp hl -; 3dc5b -PursuitSwitch: ; 3dc5b +PursuitSwitch: ld a, BATTLE_VARS_MOVE call GetBattleVar ld b, a @@ -4338,9 +4212,8 @@ PursuitSwitch: ; 3dc5b .done and a ret -; 3dce6 -RecallPlayerMon: ; 3dce6 +RecallPlayerMon: ld a, [hBattleTurn] push af xor a @@ -4351,9 +4224,8 @@ RecallPlayerMon: ; 3dce6 pop af ld [hBattleTurn], a ret -; 3dcf9 -HandleHealingItems: ; 3dcf9 +HandleHealingItems: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 @@ -4375,9 +4247,8 @@ HandleHealingItems: ; 3dcf9 call HandleHPHealingItem call UseHeldStatusHealingItem jp UseConfusionHealingItem -; 3dd2f -HandleHPHealingItem: ; 3dd2f +HandleHPHealingItem: callfar GetOpponentItem ld a, b cp HELD_BERRY @@ -4469,9 +4340,8 @@ UseOpponentItem: callfar ConsumeHeldItem ld hl, RecoveredUsingText jp StdBattleTextBox -; 3ddc8 -ItemRecoveryAnim: ; 3ddc8 +ItemRecoveryAnim: push hl push de push bc @@ -4488,9 +4358,8 @@ ItemRecoveryAnim: ; 3ddc8 pop de pop hl ret -; 3dde9 -UseHeldStatusHealingItem: ; 3dde9 +UseHeldStatusHealingItem: callfar GetOpponentItem ld hl, HeldStatusHealingEffects .loop @@ -4543,11 +4412,10 @@ UseHeldStatusHealingItem: ; 3dde9 ld a, $1 and a ret -; 3de44 INCLUDE "data/battle/held_heal_status.asm" -UseConfusionHealingItem: ; 3de51 +UseConfusionHealingItem: ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar bit SUBSTATUS_CONFUSED, a @@ -4587,9 +4455,8 @@ UseConfusionHealingItem: ; 3de51 ld [bc], a ld [hl], a ret -; 3de97 -HandleStatBoostingHeldItems: ; 3de97 +HandleStatBoostingHeldItems: ; The effects handled here are not used in-game. ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK @@ -4600,18 +4467,16 @@ HandleStatBoostingHeldItems: ; 3de97 .player_1 call .DoEnemy jp .DoPlayer -; 3dea9 -.DoPlayer: ; 3dea9 +.DoPlayer: call GetPartymonItem ld a, $0 jp .HandleItem -; 3deb1 -.DoEnemy: ; 3deb1 +.DoEnemy: call GetOTPartymonItem ld a, $1 -.HandleItem: ; 3deb6 +.HandleItem: ld [hBattleTurn], a ld d, h ld e, l @@ -4658,27 +4523,24 @@ HandleStatBoostingHeldItems: ; 3de97 pop bc pop de ret -; 3defc INCLUDE "data/battle/held_stat_up.asm" -GetPartymonItem: ; 3df12 +GetPartymonItem: ld hl, wPartyMon1Item ld a, [wCurBattleMon] call GetPartyLocation ld bc, wBattleMonItem ret -; 3df1f -GetOTPartymonItem: ; 3df1f +GetOTPartymonItem: ld hl, wOTPartyMon1Item ld a, [wCurOTMon] call GetPartyLocation ld bc, wEnemyMonItem ret -; 3df2c -UpdateBattleHUDs: ; 3df2c +UpdateBattleHUDs: push hl push de push bc @@ -4693,9 +4555,8 @@ UpdateBattleHUDs: ; 3df2c pop de pop hl ret -; 3df48 -UpdatePlayerHUD:: ; 3df48 +UpdatePlayerHUD:: push hl push de push bc @@ -4706,9 +4567,8 @@ UpdatePlayerHUD:: ; 3df48 pop de pop hl ret -; 3df58 -DrawPlayerHUD: ; 3df58 +DrawPlayerHUD: xor a ld [hBGMapMode], a @@ -4744,14 +4604,12 @@ DrawPlayerHUD: ; 3df58 call FillInExpBar pop de ret -; 3df98 -UpdatePlayerHPPal: ; 3df98 +UpdatePlayerHPPal: ld hl, wPlayerHPPal jp UpdateHPPal -; 3df9e -CheckDanger: ; 3df9e +CheckDanger: ld hl, wBattleMonHP ld a, [hli] or [hl] @@ -4774,9 +4632,8 @@ CheckDanger: ; 3df9e .done ret -; 3dfbf -PrintPlayerHUD: ; 3dfbf +PrintPlayerHUD: ld de, wBattleMonNick hlcoord 10, 7 call ret_3e138 @@ -4837,9 +4694,8 @@ PrintPlayerHUD: ; 3dfbf ld a, [wBattleMonLevel] ld [wTempMonLevel], a jp PrintLevel -; 3e036 -UpdateEnemyHUD:: ; 3e036 +UpdateEnemyHUD:: push hl push de push bc @@ -4849,9 +4705,8 @@ UpdateEnemyHUD:: ; 3e036 pop de pop hl ret -; 3e043 -DrawEnemyHUD: ; 3e043 +DrawEnemyHUD: xor a ld [hBGMapMode], a @@ -4982,28 +4837,24 @@ DrawEnemyHUD: ; 3e043 ld b, 0 call DrawBattleHPBar ret -; 3e127 -UpdateEnemyHPPal: ; 3e127 +UpdateEnemyHPPal: ld hl, wEnemyHPPal call UpdateHPPal ret -; 3e12e -UpdateHPPal: ; 3e12e +UpdateHPPal: ld b, [hl] call SetHPPal ld a, [hl] cp b ret z jp FinishBattleAnim -; 3e138 -ret_3e138: ; 3e138 +ret_3e138: ret -; 3e139 -BattleMenu: ; 3e139 +BattleMenu: xor a ld [hBGMapMode], a call LoadTempTileMapToTileMap @@ -5049,17 +4900,15 @@ BattleMenu: ; 3e139 cp $4 jp z, BattleMenu_Run jr .loop -; 3e192 -BattleMenu_Fight: ; 3e192 +BattleMenu_Fight: xor a ld [wNumFleeAttempts], a call Call_LoadTempTileMapToTileMap and a ret -; 3e19b -LoadBattleMenu2: ; 3e19b +LoadBattleMenu2: call IsMobileBattle jr z, .mobile @@ -5083,9 +4932,8 @@ LoadBattleMenu2: ; 3e19b .error scf ret -; 3e1c7 -BattleMenu_Pack: ; 3e1c7 +BattleMenu_Pack: ld a, [wLinkMode] and a jp nz, .ItemsCantBeUsed @@ -5135,15 +4983,13 @@ BattleMenu_Pack: ; 3e1c7 call FinishBattleAnim call LoadTileMapToTempTileMap jp BattleMenu -; 3e22b -.ItemsCantBeUsed: ; 3e22b +.ItemsCantBeUsed: ld hl, BattleText_ItemsCantBeUsedHere call StdBattleTextBox jp BattleMenu -; 3e234 -.UseItem: ; 3e234 +.UseItem: ld a, [wWildMon] and a jr nz, .run @@ -5186,9 +5032,8 @@ BattleMenu_Pack: ; 3e1c7 call SetPalettes scf ret -; 3e28d -BattleMenu_PKMN: ; 3e28d +BattleMenu_PKMN: call LoadStandardMenuHeader BattleMenuPKMN_ReturnFromStats: call ExitMenu @@ -5236,9 +5081,8 @@ BattleMenuPKMN_Loop: call GetMemSGBLayout call SetPalettes jp BattleMenu -; 3e2f5 -.GetMenu: ; 3e2f5 +.GetMenu: call IsMobileBattle jr z, .mobile farcall BattleMonMenu @@ -5247,9 +5091,8 @@ BattleMenuPKMN_Loop: .mobile farcall MobileBattleMonMenu ret -; 3e308 -Battle_StatsScreen: ; 3e308 +Battle_StatsScreen: call DisableLCD ld hl, vTiles2 tile $31 @@ -5285,9 +5128,8 @@ Battle_StatsScreen: ; 3e308 call EnableLCD ret -; 3e358 -TryPlayerSwitch: ; 3e358 +TryPlayerSwitch: ld a, [wCurBattleMon] ld d, a ld a, [wCurPartyMon] @@ -5326,7 +5168,7 @@ TryPlayerSwitch: ; 3e358 call SetPalettes ld a, [wCurPartyMon] ld [wCurBattleMon], a -PlayerSwitch: ; 3e3ad +PlayerSwitch: ld a, 1 ld [wPlayerIsSwitching], a ld a, [wLinkMode] @@ -5374,15 +5216,13 @@ PlayerSwitch: ; 3e3ad call BattleMonEntrance and a ret -; 3e3ff -EnemyMonEntrance: ; 3e3ff +EnemyMonEntrance: callfar AI_Switch call SetEnemyTurn jp SpikesDamage -; 3e40b -BattleMonEntrance: ; 3e40b +BattleMonEntrance: call WithdrawMonText ld c, 50 @@ -5417,9 +5257,8 @@ BattleMonEntrance: ; 3e40b ld a, $2 ld [wMenuCursorY], a ret -; 3e459 -PassedBattleMonEntrance: ; 3e459 +PassedBattleMonEntrance: ld c, 50 call DelayFrames @@ -5439,9 +5278,8 @@ PassedBattleMonEntrance: ; 3e459 call LoadTileMapToTempTileMap call SetPlayerTurn jp SpikesDamage -; 3e489 -BattleMenu_Run: ; 3e489 +BattleMenu_Run: call Call_LoadTempTileMapToTileMap ld a, $3 ld [wMenuCursorY], a @@ -5455,9 +5293,8 @@ BattleMenu_Run: ; 3e489 and a ret nz jp BattleMenu -; 3e4a8 -CheckAmuletCoin: ; 3e4a8 +CheckAmuletCoin: ld a, [wBattleMonItem] ld b, a callfar GetItemHeldEffect @@ -5467,9 +5304,8 @@ CheckAmuletCoin: ; 3e4a8 ld a, 1 ld [wAmuletCoin], a ret -; 3e4bc -MoveSelectionScreen: ; 3e4bc +MoveSelectionScreen: call IsMobileBattle jr nz, .not_mobile farcall MobileMoveSelectionScreen @@ -5671,11 +5507,9 @@ MoveSelectionScreen: ; 3e4bc call StdBattleTextBox call Call_LoadTempTileMapToTileMap jp MoveSelectionScreen -; 3e61c -.string_3e61c ; 3e61c +.string_3e61c db "@" -; 3e61d .pressed_up ld a, [wMenuCursorY] @@ -5685,9 +5519,8 @@ MoveSelectionScreen: ; 3e4bc inc a ld [wMenuCursorY], a jp .menu_loop -; 3e62e -.pressed_down ; 3e62e +.pressed_down ld a, [wMenuCursorY] ld b, a ld a, [wNumMoves] @@ -5698,9 +5531,8 @@ MoveSelectionScreen: ; 3e4bc ld a, $1 ld [wMenuCursorY], a jp .menu_loop -; 3e643 -.pressed_select ; 3e643 +.pressed_select ld a, [wMoveSwapBuffer] and a jr z, .start_swap @@ -5783,9 +5615,8 @@ MoveSelectionScreen: ; 3e4bc ld a, [wMenuCursorY] ld [wMoveSwapBuffer], a jp MoveSelectionScreen -; 3e6c8 -MoveInfoBox: ; 3e6c8 +MoveInfoBox: xor a ld [hBGMapMode], a @@ -5855,15 +5686,13 @@ MoveInfoBox: ; 3e6c8 .done ret -; 3e74f .Disabled: db "Disabled!@" .Type: db "TYPE/@" -; 3e75f -.PrintPP: ; 3e75f +.PrintPP: hlcoord 5, 11 ld a, [wLinkMode] ; What's the point of this check? cp LINK_MOBILE @@ -5883,9 +5712,8 @@ MoveInfoBox: ; 3e6c8 lb bc, 1, 2 call PrintNum ret -; 3e786 -CheckPlayerHasUsableMoves: ; 3e786 +CheckPlayerHasUsableMoves: ld a, STRUGGLE ld [wCurPlayerMove], a ld a, [wPlayerDisableCount] @@ -5931,9 +5759,8 @@ CheckPlayerHasUsableMoves: ; 3e786 call DelayFrames xor a ret -; 3e7c1 -ParseEnemyAction: ; 3e7c1 +ParseEnemyAction: ld a, [wEnemyIsSwitching] and a ret nz @@ -6081,9 +5908,8 @@ ParseEnemyAction: ; 3e7c1 .struggle ld a, STRUGGLE jr .finish -; 3e8c1 -ResetVarsForSubstatusRage: ; 3e8c1 +ResetVarsForSubstatusRage: xor a ld [wEnemyFuryCutterCount], a ld [wEnemyProtectCount], a @@ -6091,9 +5917,8 @@ ResetVarsForSubstatusRage: ; 3e8c1 ld hl, wEnemySubStatus4 res SUBSTATUS_RAGE, [hl] ret -; 3e8d1 -CheckEnemyLockedIn: ; 3e8d1 +CheckEnemyLockedIn: ld a, [wEnemySubStatus4] and 1 << SUBSTATUS_RECHARGE ret nz @@ -6106,14 +5931,12 @@ CheckEnemyLockedIn: ; 3e8d1 ld hl, wEnemySubStatus1 bit SUBSTATUS_ROLLOUT, [hl] ret -; 3e8e4 -LinkBattleSendReceiveAction: ; 3e8e4 +LinkBattleSendReceiveAction: farcall _LinkBattleSendReceiveAction ret -; 3e8eb -LoadEnemyMon: ; 3e8eb +LoadEnemyMon: ; Initialize enemy monster parameters ; To do this we pull the species from wTempEnemyMonSpecies @@ -6213,7 +6036,6 @@ LoadEnemyMon: ; 3e8eb jp .Happiness .InitDVs: - ; Trainer DVs ; All trainers have preset DVs, determined by class @@ -6582,9 +6404,8 @@ LoadEnemyMon: ; 3e8eb call CopyBytes ret -; 3eb38 -CheckSleepingTreeMon: ; 3eb38 +CheckSleepingTreeMon: ; Return carry if species is in the list ; for the current time of day @@ -6615,7 +6436,7 @@ CheckSleepingTreeMon: ; 3eb38 INCLUDE "data/wild/treemons_asleep.asm" -CheckUnownLetter: ; 3eb75 +CheckUnownLetter: ; Return carry if the Unown letter hasn't been unlocked yet ld a, [wUnlockedUnowns] @@ -6664,8 +6485,7 @@ CheckUnownLetter: ; 3eb75 INCLUDE "data/wild/unlocked_unowns.asm" - -Unreferenced_SwapBattlerLevels: ; 3ebc7 +Unreferenced_SwapBattlerLevels: push bc ld a, [wBattleMonLevel] ld b, a @@ -6675,9 +6495,8 @@ Unreferenced_SwapBattlerLevels: ; 3ebc7 ld [wEnemyMonLevel], a pop bc ret -; 3ebd8 -BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 +BattleWinSlideInEnemyTrainerFrontpic: xor a ld [wTempEnemyMonSpecies], a call FinishBattleAnim @@ -6717,9 +6536,8 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 pop bc dec hl jr .outer_loop -; 3ec1a -.CopyColumn: ; 3ec1a +.CopyColumn: push hl push de push bc @@ -6737,24 +6555,20 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 pop de pop hl ret -; 3ec2c -ApplyStatusEffectOnPlayerStats: ; 3ec2c +ApplyStatusEffectOnPlayerStats: ld a, 1 jr ApplyStatusEffectOnStats -; 3ec30 -ApplyStatusEffectOnEnemyStats: ; 3ec30 +ApplyStatusEffectOnEnemyStats: xor a -; 3ec31 -ApplyStatusEffectOnStats: ; 3ec31 +ApplyStatusEffectOnStats: ld [hBattleTurn], a call ApplyPrzEffectOnSpeed jp ApplyBrnEffectOnAttack -; 3ec39 -ApplyPrzEffectOnSpeed: ; 3ec39 +ApplyPrzEffectOnSpeed: ld a, [hBattleTurn] and a jr z, .enemy @@ -6798,9 +6612,8 @@ ApplyPrzEffectOnSpeed: ; 3ec39 .enemy_ok ld [hl], b ret -; 3ec76 -ApplyBrnEffectOnAttack: ; 3ec76 +ApplyBrnEffectOnAttack: ld a, [hBattleTurn] and a jr z, .enemy @@ -6840,9 +6653,8 @@ ApplyBrnEffectOnAttack: ; 3ec76 .enemy_ok ld [hl], b ret -; 3ecab -ApplyStatLevelMultiplierOnAllStats: ; 3ecab +ApplyStatLevelMultiplierOnAllStats: ; Apply StatLevelMultipliers on all 5 Stats ld c, 0 .stat_loop @@ -6852,9 +6664,8 @@ ApplyStatLevelMultiplierOnAllStats: ; 3ecab cp 5 jr nz, .stat_loop ret -; 3ecb7 -ApplyStatLevelMultiplier: ; 3ecb7 +ApplyStatLevelMultiplier: push bc push bc ld a, [wd265] @@ -6936,11 +6747,10 @@ ApplyStatLevelMultiplier: ; 3ecb7 .okay4 pop bc ret -; 3ed2b INCLUDE "data/battle/stat_multipliers_2.asm" -BadgeStatBoosts: ; 3ed45 +BadgeStatBoosts: ; Raise the stats of the battle mon in wBattleMon ; depending on which badges have been obtained. @@ -6997,9 +6807,8 @@ BadgeStatBoosts: ; 3ed45 srl a call c, BoostStat ret -; 3ed7c -BoostStat: ; 3ed7c +BoostStat: ; Raise stat at hl by 1/8. ld a, [hli] @@ -7029,17 +6838,14 @@ BoostStat: ; 3ed7c ld a, LOW(MAX_STAT_VALUE) ld [hld], a ret -; 3ed9f -_LoadBattleFontsHPBar: ; 3ed9f +_LoadBattleFontsHPBar: callfar LoadBattleFontsHPBar ret -; 3eda6 -_LoadHPBar: ; 3eda6 +_LoadHPBar: callfar LoadHPBar ret -; 3edad Unreferenced_LoadHPExpBarGFX: ld de, EnemyHPBarBorderGFX @@ -7054,16 +6860,14 @@ Unreferenced_LoadHPExpBarGFX: ld hl, vTiles2 tile $55 lb bc, BANK(ExpBarGFX), 8 jp Get2bpp -; 3edd1 -EmptyBattleTextBox: ; 3edd1 +EmptyBattleTextBox: ld hl, .empty jp BattleTextBox .empty db "@" -; 3edd8 -_BattleRandom:: ; 3edd8 +_BattleRandom:: ; If the normal RNG is used in a link battle it'll desync. ; To circumvent this a shared PRNG is used instead. @@ -7130,25 +6934,22 @@ _BattleRandom:: ; 3edd8 pop bc pop hl ret -; 3ee0f -Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f +Call_PlayBattleAnim_OnlyIfVisible: ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret nz -; 3ee17 -Call_PlayBattleAnim: ; 3ee17 +Call_PlayBattleAnim: ld a, e ld [wFXAnimID], a ld a, d ld [wFXAnimID + 1], a call WaitBGMap predef_jump PlayBattleAnim -; 3ee27 -FinishBattleAnim: ; 3ee27 +FinishBattleAnim: push af push bc push de @@ -7162,9 +6963,8 @@ FinishBattleAnim: ; 3ee27 pop bc pop af ret -; 3ee3b -GiveExperiencePoints: ; 3ee3b +GiveExperiencePoints: ; Give experience. ; Don't give experience if linked or in the Battle Tower. ld a, [wLinkMode] @@ -7192,7 +6992,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [wCurPartyMon] ld c, a ld b, CHECK_FLAG - ld d, $0 + ld d, FALSE predef SmallFarFlagAction ld a, c and a @@ -7206,7 +7006,7 @@ GiveExperiencePoints: ; 3ee3b ld e, l ld hl, wEnemyMonBaseStats - 1 push bc - ld c, $5 + ld c, NUM_EXP_STATS .loop1 inc hl ld a, [de] @@ -7486,13 +7286,13 @@ GiveExperiencePoints: ; 3ee3b ld [wMonType], a predef CopyMonToTempMon hlcoord 9, 0 - ld b, $a - ld c, $9 + ld b, 10 + ld c, 9 call TextBox hlcoord 11, 1 ld bc, 4 predef PrintTempMonStats - ld c, $1e + ld c, 30 call DelayFrames call WaitPressAorB_BlinkCursor call Call_LoadTempTileMapToTileMap @@ -7542,7 +7342,6 @@ GiveExperiencePoints: ; 3ee3b .done jp ResetBattleParticipants -; 3f0d4 .EvenlyDivideExpAmongParticipants: ; count number of battle participants @@ -7577,9 +7376,8 @@ GiveExperiencePoints: ; 3ee3b dec c jr nz, .count_loop2 ret -; 3f106 -BoostExp: ; 3f106 +BoostExp: ; Multiply experience by 1.5x push bc ; load experience value @@ -7598,9 +7396,8 @@ BoostExp: ; 3f106 ld [hProduct + 2], a pop bc ret -; 3f11b -Text_MonGainedExpPoint: ; 3f11b +Text_MonGainedExpPoint: text_jump Text_Gained start_asm ld hl, TextJump_StringBuffer2ExpPoints @@ -7610,19 +7407,16 @@ Text_MonGainedExpPoint: ; 3f11b ld hl, TextJump_ABoostedStringBuffer2ExpPoints ret -; 3f12c -TextJump_ABoostedStringBuffer2ExpPoints: ; 3f12c +TextJump_ABoostedStringBuffer2ExpPoints: text_jump Text_ABoostedStringBuffer2ExpPoints db "@" -; 3f131 -TextJump_StringBuffer2ExpPoints: ; 3f131 +TextJump_StringBuffer2ExpPoints: text_jump Text_StringBuffer2ExpPoints db "@" -; 3f136 -AnimateExpBar: ; 3f136 +AnimateExpBar: push bc ld hl, wCurPartyMon @@ -7808,7 +7602,7 @@ AnimateExpBar: ; 3f136 ld [hBGMapMode], a ret -SendOutMonText: ; 3f26d +SendOutMonText: ld a, [wLinkMode] and a jr z, .not_linked @@ -7868,40 +7662,34 @@ SendOutMonText: ; 3f26d ld hl, JumpText_YourFoesWeakGetmMon .skip_to_textbox jp BattleTextBox -; 3f2d1 -JumpText_GoMon: ; 3f2d1 +JumpText_GoMon: text_jump Text_GoMon start_asm jr Function_TextJump_BattleMonNick01 -; 3f2d6 -JumpText_DoItMon: ; 3f2d8 +JumpText_DoItMon: text_jump Text_DoItMon start_asm jr Function_TextJump_BattleMonNick01 -; 3f2dd -JumpText_GoForItMon: ; 3f2df +JumpText_GoForItMon: text_jump Text_GoForItMon start_asm jr Function_TextJump_BattleMonNick01 -; 3f2e4 -JumpText_YourFoesWeakGetmMon: ; 3f2e6 +JumpText_YourFoesWeakGetmMon: text_jump Text_YourFoesWeakGetmMon start_asm -Function_TextJump_BattleMonNick01: ; 3f2eb +Function_TextJump_BattleMonNick01: ld hl, TextJump_BattleMonNick01 ret -; 3f2ef -TextJump_BattleMonNick01: ; 3f2ef +TextJump_BattleMonNick01: text_jump Text_BattleMonNick01 db "@" -; 3f2f4 -WithdrawMonText: ; 3f2f4 +WithdrawMonText: ld hl, .WithdrawMonText jp BattleTextBox @@ -7955,33 +7743,27 @@ WithdrawMonText: ; 3f2f4 ld hl, TextJump_GoodComeBack ret -; 3f348 -TextJump_ThatsEnoughComeBack: ; 3f348 +TextJump_ThatsEnoughComeBack: text_jump Text_ThatsEnoughComeBack db "@" -; 3f34d -TextJump_OKComeBack: ; 3f34d +TextJump_OKComeBack: text_jump Text_OKComeBack db "@" -; 3f352 -TextJump_GoodComeBack: ; 3f352 +TextJump_GoodComeBack: text_jump Text_GoodComeBack db "@" -; 3f357 -Unreferenced_TextJump_ComeBack: ; 3f357 +Unreferenced_TextJump_ComeBack: ; this function doesn't seem to be used ld hl, TextJump_ComeBack ret -; 3f35b -TextJump_ComeBack: ; 3f35b +TextJump_ComeBack: text_jump Text_ComeBack db "@" -; 3f360 Unreferenced_HandleSafariAngerEatingStatus: ld hl, wSafariMonEating @@ -8013,18 +7795,16 @@ Unreferenced_HandleSafariAngerEatingStatus: call Call_LoadTempTileMapToTileMap pop hl jp StdBattleTextBox -; 3f390 -FillInExpBar: ; 3f390 +FillInExpBar: push hl call CalcExpBar pop hl ld de, 7 add hl, de jp PlaceExpBar -; 3f39c -CalcExpBar: ; 3f39c +CalcExpBar: ; Calculate the percent exp between this level and the next ; Level in b push de @@ -8123,9 +7903,8 @@ CalcExpBar: ; 3f39c sub b ld b, a ret -; 3f41c -PlaceExpBar: ; 3f41c +PlaceExpBar: ld c, $8 ; number of tiles .loop1 ld a, b @@ -8155,15 +7934,14 @@ PlaceExpBar: ; 3f41c .finish ret -; 3f43d -GetBattleMonBackpic: ; 3f43d +GetBattleMonBackpic: ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub jr nz, GetBattleMonBackpic_DoAnim ; substitute -DropPlayerSub: ; 3f447 +DropPlayerSub: ld a, [wPlayerMinimized] and a ld hl, BattleAnimCmd_MinimizeOpp @@ -8179,9 +7957,8 @@ DropPlayerSub: ; 3f447 pop af ld [wCurPartySpecies], a ret -; 3f46f -GetBattleMonBackpic_DoAnim: ; 3f46f +GetBattleMonBackpic_DoAnim: ld a, [hBattleTurn] push af xor a @@ -8191,15 +7968,14 @@ GetBattleMonBackpic_DoAnim: ; 3f46f pop af ld [hBattleTurn], a ret -; 3f47c -GetEnemyMonFrontpic: ; 3f47c +GetEnemyMonFrontpic: ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub jr nz, GetEnemyMonFrontpic_DoAnim -DropEnemySub: ; 3f486 +DropEnemySub: ld a, [wEnemyMinimized] and a ld hl, BattleAnimCmd_MinimizeOpp @@ -8218,9 +7994,8 @@ DropEnemySub: ; 3f486 pop af ld [wCurPartySpecies], a ret -; 3f4b4 -GetEnemyMonFrontpic_DoAnim: ; 3f4b4 +GetEnemyMonFrontpic_DoAnim: ld a, [hBattleTurn] push af call SetEnemyTurn @@ -8229,9 +8004,8 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4 pop af ld [hBattleTurn], a ret -; 3f4c1 -StartBattle: ; 3f4c1 +StartBattle: ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. @@ -8248,14 +8022,12 @@ StartBattle: ; 3f4c1 ld [wTimeOfDayPal], a scf ret -; 3f4d9 -Unreferenced_DoBattle: ; 3f4d9 +Unreferenced_DoBattle: call DoBattle ret -; 3f4dd -BattleIntro: ; 3f4dd +BattleIntro: farcall StubbedTrainerRankings_Battles ; mobile call LoadTrainerOrWildMonPic xor a @@ -8294,9 +8066,8 @@ BattleIntro: ; 3f4dd ld a, $1 ld [hBGMapMode], a ret -; 3f54e -LoadTrainerOrWildMonPic: ; 3f54e +LoadTrainerOrWildMonPic: ld a, [wOtherTrainerClass] and a jr nz, .Trainer @@ -8306,16 +8077,14 @@ LoadTrainerOrWildMonPic: ; 3f54e .Trainer: ld [wTempEnemyMonSpecies], a ret -; 3f55e -InitEnemy: ; 3f55e +InitEnemy: ld a, [wOtherTrainerClass] and a jp nz, InitEnemyTrainer ; trainer jp InitEnemyWildmon ; wild -; 3f568 -BackUpBGMap2: ; 3f568 +BackUpBGMap2: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -8337,9 +8106,8 @@ BackUpBGMap2: ; 3f568 pop af ld [rSVBK], a ret -; 3f594 -InitEnemyTrainer: ; 3f594 +InitEnemyTrainer: ld [wTrainerClass], a farcall StubbedTrainerRankings_TrainerBattles xor a @@ -8393,9 +8161,8 @@ InitEnemyTrainer: ; 3f594 jr .partyloop .done ret -; 3f607 -InitEnemyWildmon: ; 3f607 +InitEnemyWildmon: ld a, WILD_BATTLE ld [wBattleMode], a farcall StubbedTrainerRankings_WildBattles @@ -8428,9 +8195,8 @@ InitEnemyWildmon: ; 3f607 lb bc, 7, 7 predef PlaceGraphic ret -; 3f662 -Unreferenced_Function3f662: ; 3f662 +Unreferenced_Function3f662: ld hl, wEnemyMonMoves ld de, wListMoves_MoveIndicesBuffer ld b, NUM_MOVES @@ -8480,15 +8246,13 @@ Unreferenced_Function3f662: ; 3f662 dec b jr nz, .clear ret -; 3f69e -ExitBattle: ; 3f69e +ExitBattle: call .HandleEndOfBattle call CleanUpBattleRAM ret -; 3f6a5 -.HandleEndOfBattle: ; 3f6a5 +.HandleEndOfBattle: ld a, [wLinkMode] and a jr z, .not_linked @@ -8508,9 +8272,8 @@ ExitBattle: ; 3f69e predef EvolveAfterBattle farcall GivePokerusAndConvertBerries ret -; 3f6d0 -CleanUpBattleRAM: ; 3f6d0 +CleanUpBattleRAM: call BattleEnd_HandleRoamMons xor a ld [wLowHealthAlarm], a @@ -8541,9 +8304,8 @@ CleanUpBattleRAM: ; 3f6d0 jr nz, .loop call WaitSFX ret -; 3f71d -CheckPayDay: ; 3f71d +CheckPayDay: ld hl, wPayDayMoney ld a, [hli] or [hl] @@ -8577,9 +8339,8 @@ CheckPayDay: ; 3f71d call ClearTileMap call ClearBGPalettes ret -; 3f759 -ShowLinkBattleParticipantsAfterEnd: ; 3f759 +ShowLinkBattleParticipantsAfterEnd: farcall StubbedTrainerRankings_LinkBattles farcall BackupMobileEventIndex ld a, [wCurOTMon] @@ -8590,9 +8351,8 @@ ShowLinkBattleParticipantsAfterEnd: ; 3f759 call ClearTileMap farcall _ShowLinkBattleParticipants ret -; 3f77c -DisplayLinkBattleResult: ; 3f77c +DisplayLinkBattleResult: farcall CheckMobileBattleError jp c, .Mobile_InvalidBattle call IsMobileBattle2 @@ -8651,7 +8411,6 @@ DisplayLinkBattleResult: ; 3f77c call DelayFrames call ClearTileMap ret -; 3f7f7 .Win: db "YOU WIN@" @@ -8659,9 +8418,8 @@ DisplayLinkBattleResult: ; 3f77c db "YOU LOSE@" .Draw: db " DRAW@" -; 3f80f -.Mobile_InvalidBattle: ; 3f80f +.Mobile_InvalidBattle: hlcoord 6, 8 ld de, .Invalid call PlaceString @@ -8669,19 +8427,16 @@ DisplayLinkBattleResult: ; 3f77c call DelayFrames call ClearTileMap ret -; 3f821 .Invalid: db "INVALID BATTLE@" -; 3f830 -IsMobileBattle2: ; 3f830 +IsMobileBattle2: ld a, [wLinkMode] cp LINK_MOBILE ret -; 3f836 -_DisplayLinkRecord: ; 3f836 +_DisplayLinkRecord: ld a, BANK(sLinkBattleStats) call GetSRAMBank @@ -8700,9 +8455,8 @@ _DisplayLinkRecord: ; 3f836 call DelayFrames call WaitPressAorB_BlinkCursor ret -; 3f85f -ReadAndPrintLinkBattleRecord: ; 3f85f +ReadAndPrintLinkBattleRecord: call ClearTileMap call ClearSprites call .PrintBattleRecord @@ -8819,24 +8573,21 @@ ReadAndPrintLinkBattleRecord: ; 3f85f call PlaceString scf ret -; 3f938 .Scores: db " 0 0 0@" -; 3f947 -.Format: ; 3f947 - db " --- <LNBRK>" +.Format: + db " --- <LF>" db " - - -@" -.Record: ; 3f964 +.Record: db "<PLAYER>'s RECORD@" -.Result: ; 3f96e +.Result: db "RESULT WIN LOSE DRAW@" -.Total: ; 3f983 +.Total: db "TOTAL WIN LOSE DRAW@" -; 3f998 -BattleEnd_HandleRoamMons: ; 3f998 +BattleEnd_HandleRoamMons: ld a, [wBattleType] cp BATTLETYPE_ROAMING jr nz, .not_roaming @@ -8867,9 +8618,8 @@ BattleEnd_HandleRoamMons: ; 3f998 .update_roam_mons callfar UpdateRoamMons ret -; 3f9d1 -GetRoamMonMapGroup: ; 3f9d1 +GetRoamMonMapGroup: ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] @@ -8882,9 +8632,8 @@ GetRoamMonMapGroup: ; 3f9d1 ret z ld hl, wRoamMon3MapGroup ret -; 3f9e9 -GetRoamMonMapNumber: ; 3f9e9 +GetRoamMonMapNumber: ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] @@ -8897,9 +8646,8 @@ GetRoamMonMapNumber: ; 3f9e9 ret z ld hl, wRoamMon3MapNumber ret -; 3fa01 -GetRoamMonHP: ; 3fa01 +GetRoamMonHP: ; output: hl = wRoamMonHP ld a, [wTempEnemyMonSpecies] ld b, a @@ -8913,9 +8661,8 @@ GetRoamMonHP: ; 3fa01 ret z ld hl, wRoamMon3HP ret -; 3fa19 -GetRoamMonDVs: ; 3fa19 +GetRoamMonDVs: ; output: hl = wRoamMonDVs ld a, [wTempEnemyMonSpecies] ld b, a @@ -8929,9 +8676,8 @@ GetRoamMonDVs: ; 3fa19 ret z ld hl, wRoamMon3DVs ret -; 3fa31 -GetRoamMonSpecies: ; 3fa31 +GetRoamMonSpecies: ld a, [wTempEnemyMonSpecies] ld hl, wRoamMon1Species cp [hl] @@ -8941,9 +8687,8 @@ GetRoamMonSpecies: ; 3fa31 ret z ld hl, wRoamMon3Species ret -; 3fa42 -AddLastMobileBattleToLinkRecord: ; 3fa42 +AddLastMobileBattleToLinkRecord: ld hl, wOTPlayerID ld de, wStringBuffer1 ld bc, 2 @@ -8998,8 +8743,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 call .StoreResult call .FindOpponentAndAppendRecord ret -; 3faa0 -.StoreResult: ; 3faa0 +.StoreResult: ld a, [wBattleResult] and $f cp LOSE @@ -9018,9 +8762,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 dec hl inc [hl] ret -; 3fabe -.CheckOverflow: ; 3fabe +.CheckOverflow: dec hl ld a, [hl] inc hl @@ -9029,9 +8772,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 ld a, [hl] cp LOW(MAX_LINK_RECORD) ret -; 3fac8 -.FindOpponentAndAppendRecord: ; 3fac8 +.FindOpponentAndAppendRecord: ld b, 5 ld hl, sLinkBattleRecord + 17 ld de, wd002 @@ -9123,9 +8865,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 pop de call CopyBytes ret -; 3fb54 -.LoadPointer: ; 3fb54 +.LoadPointer: ld e, $0 ld a, [hld] ld c, a @@ -9150,9 +8891,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 ret nc inc e ret -; 3fb6c -InitBattleDisplay: ; 3fb6c +InitBattleDisplay: call .InitBackPic hlcoord 0, 12 ld b, 4 @@ -9195,9 +8935,8 @@ InitBattleDisplay: ; 3fb6c xor a ld [hSCX], a ret -; 3fbd6 -.BlankBGMap: ; 3fbd6 +.BlankBGMap: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -9216,15 +8955,13 @@ InitBattleDisplay: ; 3fb6c pop af ld [rSVBK], a ret -; 3fbf8 -.InitBackPic: ; 3fbf8 +.InitBackPic: call GetTrainerBackpic call CopyBackpic ret -; 3fbff -GetTrainerBackpic: ; 3fbff +GetTrainerBackpic: ; Load the player character's backpic (6x6) into VRAM starting from vTiles2 tile $31. ; Special exception for Dude. @@ -9256,9 +8993,8 @@ GetTrainerBackpic: ; 3fbff ld c, 7 * 7 predef DecompressGet2bpp ret -; 3fc30 -CopyBackpic: ; 3fc30 +CopyBackpic: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -9278,9 +9014,8 @@ CopyBackpic: ; 3fc30 lb bc, 6, 6 predef PlaceGraphic ret -; 3fc5b -.LoadTrainerBackpicAsOAM: ; 3fc5b +.LoadTrainerBackpicAsOAM: ld hl, wVirtualOAMSprite00 xor a ld [hMapObjectIndexBuffer], a @@ -9314,9 +9049,8 @@ CopyBackpic: ; 3fc30 dec b jr nz, .outer_loop ret -; 3fc8b -BattleStartMessage: ; 3fc8b +BattleStartMessage: ld a, [wBattleMode] dec a jr z, .wild @@ -9397,4 +9131,3 @@ BattleStartMessage: ; 3fc8b farcall Mobile_PrintOpponentBattleMessage ret -; 3fd26 diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index fad5b27a0..eb30af88b 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -1,4 +1,4 @@ -DoPlayerTurn: ; 34000 +DoPlayerTurn: call SetPlayerTurn ld a, [wBattlePlayerAction] @@ -7,10 +7,7 @@ DoPlayerTurn: ; 34000 jr DoTurn -; 3400a - - -DoEnemyTurn: ; 3400a +DoEnemyTurn: call SetEnemyTurn ld a, [wLinkMode] @@ -24,10 +21,8 @@ DoEnemyTurn: ; 3400a ret nc ; fallthrough -; 3401d - -DoTurn: ; 3401d +DoTurn: ; Read in and execute the user's move effects for this turn. xor a @@ -41,10 +36,8 @@ DoTurn: ; 3401d ret nz call UpdateMoveData -; 3402c - -DoMove: ; 3402c +DoMove: ; Get the user's move effect. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar @@ -64,7 +57,7 @@ DoMove: ; 3402c inc hl ld [de], a inc de - cp -1 + cp endmove_command jr nz, .GetMoveEffect ; Start at the first command. @@ -75,7 +68,6 @@ DoMove: ; 3402c ld [wBattleScriptBufferAddress + 1], a .ReadMoveEffectCommand: - ; ld a, [wBattleScriptBufferAddress++] ld a, [wBattleScriptBufferAddress] ld l, a @@ -115,11 +107,8 @@ DoMove: ; 3402c .DoMoveEffectCommand: jp hl -; 34084 - - CheckTurn: -BattleCommand_CheckTurn: ; 34084 +BattleCommand_CheckTurn: ; checkturn ; Repurposed as hardcoded turn handling. Useless as a command. @@ -145,9 +134,7 @@ BattleCommand_CheckTurn: ; 34084 and a jp nz, CheckEnemyTurn - CheckPlayerTurn: - ld hl, wPlayerSubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -160,7 +147,6 @@ CheckPlayerTurn: .no_recharge - ld hl, wBattleMonStatus ld a, [hl] and SLP @@ -206,7 +192,6 @@ CheckPlayerTurn: .not_asleep - ld hl, wBattleMonStatus bit FRZ, [hl] jr z, .not_frozen @@ -226,7 +211,6 @@ CheckPlayerTurn: .not_frozen - ld hl, wPlayerSubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -240,7 +224,6 @@ CheckPlayerTurn: .not_flinched - ld hl, wPlayerDisableCount ld a, [hl] and a @@ -258,7 +241,6 @@ CheckPlayerTurn: .not_disabled - ld a, [wPlayerSubStatus3] add a jr nc, .not_confused @@ -297,7 +279,6 @@ CheckPlayerTurn: .not_confused - ld a, [wPlayerSubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -321,7 +302,6 @@ CheckPlayerTurn: .not_infatuated - ; We can't disable a move that doesn't exist. ld a, [wDisabledMove] and a @@ -338,7 +318,6 @@ CheckPlayerTurn: .no_disabled_move - ld hl, wBattleMonStatus bit PAR, [hl] ret z @@ -353,10 +332,7 @@ CheckPlayerTurn: call CantMove jp EndTurn -; 341f0 - - -CantMove: ; 341f0 +CantMove: ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarAddr res SUBSTATUS_ROLLOUT, [hl] @@ -364,7 +340,7 @@ CantMove: ; 341f0 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr ld a, [hl] - and $ff ^ (1<<SUBSTATUS_BIDE + 1<<SUBSTATUS_RAMPAGE + 1<<SUBSTATUS_CHARGED) + and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED) ld [hl], a call ResetFuryCutterCount @@ -382,21 +358,12 @@ CantMove: ; 341f0 res SUBSTATUS_FLYING, [hl] jp AppearUserRaiseSub -; 34216 - - - -OpponentCantMove: ; 34216 +OpponentCantMove: call BattleCommand_SwitchTurn call CantMove jp BattleCommand_SwitchTurn -; 3421f - - - -CheckEnemyTurn: ; 3421f - +CheckEnemyTurn: ld hl, wEnemySubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -409,7 +376,6 @@ CheckEnemyTurn: ; 3421f .no_recharge - ld hl, wEnemyMonStatus ld a, [hl] and SLP @@ -453,7 +419,6 @@ CheckEnemyTurn: ; 3421f .not_asleep - ld hl, wEnemyMonStatus bit FRZ, [hl] jr z, .not_frozen @@ -472,7 +437,6 @@ CheckEnemyTurn: ; 3421f .not_frozen - ld hl, wEnemySubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -486,7 +450,6 @@ CheckEnemyTurn: ; 3421f .not_flinched - ld hl, wEnemyDisableCount ld a, [hl] and a @@ -505,7 +468,6 @@ CheckEnemyTurn: ; 3421f .not_disabled - ld a, [wEnemySubStatus3] add a ; bit SUBSTATUS_CONFUSED jr nc, .not_confused @@ -520,7 +482,6 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox jr .not_confused - .confused ld hl, IsConfusedText call StdBattleTextBox @@ -564,7 +525,6 @@ CheckEnemyTurn: ; 3421f .not_confused - ld a, [wEnemySubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -588,7 +548,6 @@ CheckEnemyTurn: ; 3421f .not_infatuated - ; We can't disable a move that doesn't exist. ld a, [wEnemyDisabledMove] and a @@ -606,7 +565,6 @@ CheckEnemyTurn: ; 3421f .no_disabled_move - ld hl, wEnemyMonStatus bit PAR, [hl] ret z @@ -621,19 +579,13 @@ CheckEnemyTurn: ; 3421f call CantMove ; fallthrough -; 34385 - -EndTurn: ; 34385 +EndTurn: ld a, $1 ld [wTurnEnded], a jp ResetDamage -; 3438d - - -MoveDisabled: ; 3438d - +MoveDisabled: ; Make sure any charged moves fail ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -647,11 +599,7 @@ MoveDisabled: ; 3438d ld hl, DisabledMoveText jp StdBattleTextBox -; 343a5 - - -HitConfusion: ; 343a5 - +HitConfusion: ld hl, HurtItselfText call StdBattleTextBox @@ -680,10 +628,7 @@ HitConfusion: ; 343a5 call DoPlayerDamage jp BattleCommand_RaiseSub -; 343db - - -BattleCommand_CheckObedience: ; 343db +BattleCommand_CheckObedience: ; checkobedience ; Enemy can't disobey @@ -725,7 +670,6 @@ BattleCommand_CheckObedience: ; 343db cp [hl] ret z - .obeylevel ; The maximum obedience level is constrained by owned badges: ld hl, wJohtoBadges @@ -753,7 +697,6 @@ BattleCommand_CheckObedience: ; 343db ; no badges ld a, 10 - .getlevel ; c = obedience level ; d = monster level @@ -772,14 +715,12 @@ BattleCommand_CheckObedience: ; 343db jr nc, .checklevel ld b, $ff - .checklevel ; If the monster's level is lower than the obedience level, it will obey. ld a, c cp d ret nc - ; Random number from 0 to obedience level + monster level .rand1 call BattleRandom @@ -797,7 +738,6 @@ BattleCommand_CheckObedience: ; 343db call IgnoreSleepOnly ret c - ; Another random number from 0 to obedience level + monster level .rand2 call BattleRandom @@ -808,7 +748,6 @@ BattleCommand_CheckObedience: ; 343db cp c jr c, .UseInstead - ; No hope of using a move now. ; b = number of levels the monster is above the obedience level @@ -831,7 +770,6 @@ BattleCommand_CheckObedience: ; 343db call HitConfusion jp .EndDisobedience - .Nap: call BattleRandom add a @@ -844,7 +782,6 @@ BattleCommand_CheckObedience: ; 343db ld hl, BeganToNapText jr .Print - .DoNothing: ; 4 random choices call BattleRandom @@ -868,9 +805,7 @@ BattleCommand_CheckObedience: ; 343db call StdBattleTextBox jp .EndDisobedience - .UseInstead: - ; Can't use another move if the monster only has one! ld a, [wBattleMonMoves + 1] and a @@ -881,7 +816,6 @@ BattleCommand_CheckObedience: ; 343db and a jr nz, .DoNothing - ld hl, wBattleMonPP ld de, wBattleMonMoves ld b, 0 @@ -902,7 +836,6 @@ BattleCommand_CheckObedience: ; 343db and a jr nz, .GetTotalPP - .CheckMovePP: ld hl, wBattleMonPP ld a, [wCurMoveNum] @@ -916,7 +849,6 @@ BattleCommand_CheckObedience: ; 343db cp b jr z, .DoNothing - ; Make sure we can actually use the move once we get there. ld a, 1 ld [wAlreadyDisobeyed], a @@ -929,7 +861,6 @@ BattleCommand_CheckObedience: ; 343db ld c, a push af - .RandomMove: call BattleRandom maskbits NUM_MOVES @@ -951,7 +882,6 @@ BattleCommand_CheckObedience: ; 343db and PP_MASK jr z, .RandomMove - ; Use it. ld a, [wCurMoveNum] ld c, a @@ -965,12 +895,10 @@ BattleCommand_CheckObedience: ; 343db call UpdateMoveData call DoMove - ; Restore original move choice. pop af ld [wCurMoveNum], a - .EndDisobedience: xor a ld [wLastPlayerMove], a @@ -984,11 +912,7 @@ BattleCommand_CheckObedience: ; 343db jp EndMoveEffect -; 3451f - - -IgnoreSleepOnly: ; 3451f - +IgnoreSleepOnly: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -1015,19 +939,12 @@ IgnoreSleepOnly: ; 3451f scf ret -; 34541 - - -BattleCommand_UsedMoveText: ; 34541 +BattleCommand_UsedMoveText: ; usedmovetext farcall DisplayUsedMoveText ret -; 34548 - - -CheckUserIsCharging: ; 34548 - +CheckUserIsCharging: ld a, [hBattleTurn] and a ld a, [wPlayerCharging] ; player @@ -1037,10 +954,7 @@ CheckUserIsCharging: ; 34548 and a ret -; 34555 - - -BattleCommand_DoTurn: ; 34555 +BattleCommand_DoTurn: call CheckUserIsCharging ret nz @@ -1165,9 +1079,7 @@ BattleCommand_DoTurn: ; 34555 ld b, 1 ret -; 34602 - -.continuousmoves ; 34602 +.continuousmoves db EFFECT_RAZOR_WIND db EFFECT_SKY_ATTACK db EFFECT_SKULL_BASH @@ -1177,9 +1089,8 @@ BattleCommand_DoTurn: ; 34555 db EFFECT_BIDE db EFFECT_RAMPAGE db -1 -; 3460b -CheckMimicUsed: ; 3460b +CheckMimicUsed: ld a, [hBattleTurn] and a ld a, [wCurMoveNum] @@ -1209,10 +1120,7 @@ CheckMimicUsed: ; 3460b and a ret -; 34631 - - -BattleCommand_Critical: ; 34631 +BattleCommand_Critical: ; critical ; Determine whether this attack's hit will be critical. @@ -1302,14 +1210,13 @@ BattleCommand_Critical: ; 34631 ld [wCriticalHit], a ret -INCLUDE "data/battle/critical_hits.asm" -; 346b2 +INCLUDE "data/moves/critical_hit_moves.asm" +INCLUDE "data/battle/critical_hit_chances.asm" INCLUDE "engine/battle/move_effects/triple_kick.asm" - -BattleCommand_Stab: ; 346d2 +BattleCommand_Stab: ; STAB = Same Type Attack Bonus ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -1493,16 +1400,13 @@ BattleCommand_Stab: ; 346d2 ld [wTypeModifier], a ret -; 347c8 - - -BattleCheckTypeMatchup: ; 347c8 +BattleCheckTypeMatchup: ld hl, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, CheckTypeMatchup ld hl, wBattleMonType1 -CheckTypeMatchup: ; 347d3 +CheckTypeMatchup: ; There is an incorrect assumption about this function made in the AI related code: when ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the ; offensive type in a will make this function do the right thing. Since a is overwritten, @@ -1575,10 +1479,7 @@ CheckTypeMatchup: ; 347d3 pop hl ret -; 34833 - - -BattleCommand_ResetTypeMatchup: ; 34833 +BattleCommand_ResetTypeMatchup: ; Reset the type matchup multiplier to 1.0, if the type matchup is not 0. ; If there is immunity in play, the move automatically misses. call BattleCheckTypeMatchup @@ -1597,15 +1498,11 @@ BattleCommand_ResetTypeMatchup: ; 34833 ld [wTypeMatchup], a ret -; 3484e - - INCLUDE "engine/battle/ai/switch.asm" INCLUDE "data/types/type_matchups.asm" - -BattleCommand_DamageVariation: ; 34cfd +BattleCommand_DamageVariation: ; damagevariation ; Modify the damage spread between 85% and 100%. @@ -1614,7 +1511,6 @@ BattleCommand_DamageVariation: ; 34cfd ; is not consistent. This makes the highest damage multipliers ; rarer than normal. - ; No point in reducing 1 or 0 damage. ld hl, wCurDamage ld a, [hli] @@ -1658,10 +1554,7 @@ BattleCommand_DamageVariation: ; 34cfd ld [hl], a ret -; 34d32 - - -BattleCommand_CheckHit: ; 34d32 +BattleCommand_CheckHit: ; checkhit call .DreamEater @@ -1729,7 +1622,6 @@ BattleCommand_CheckHit: ; 34d32 .Hit: ret - .Miss: ; Keep the damage value intact if we're using (Hi) Jump Kick. ld a, BATTLE_VARS_MOVE_EFFECT @@ -1743,7 +1635,6 @@ BattleCommand_CheckHit: ; 34d32 ld [wAttackMissed], a ret - .DreamEater: ; Return z if we're trying to eat the dream of ; a monster that isn't sleeping. @@ -1757,7 +1648,6 @@ BattleCommand_CheckHit: ; 34d32 and SLP ret - .Protect: ; Return nz if the opponent is protected. ld a, BATTLE_VARS_SUBSTATUS1_OPP @@ -1779,7 +1669,6 @@ BattleCommand_CheckHit: ; 34d32 and a ret - .LockOn: ; Return nz if we are locked-on and aren't trying to use Earthquake, ; Fissure or Magnitude on a monster that is flying. @@ -1809,7 +1698,6 @@ BattleCommand_CheckHit: ; 34d32 and a ret - .DrainSub: ; Return z if using an HP drain move on a substitute. call CheckSubstituteOpp @@ -1828,7 +1716,6 @@ BattleCommand_CheckHit: ; 34d32 and a ret - .FlyDigMoves: ; Check for moves that can hit underground/flying opponents. ; Return z if the current move can hit the opponent. @@ -1864,7 +1751,6 @@ BattleCommand_CheckHit: ; 34d32 cp MAGNITUDE ret - .ThunderRain: ; Return z if the current move always hits in rain, and it is raining. ld a, BATTLE_VARS_MOVE_EFFECT @@ -1876,16 +1762,13 @@ BattleCommand_CheckHit: ; 34d32 cp WEATHER_RAIN ret - .XAccuracy: ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_X_ACCURACY, a ret - .StatModifiers: - ld a, [hBattleTurn] and a @@ -1977,10 +1860,8 @@ BattleCommand_CheckHit: ; 34d32 ret INCLUDE "data/battle/accuracy_multipliers.asm" -; 34ecc - -BattleCommand_EffectChance: ; 34ecc +BattleCommand_EffectChance: ; effectchance xor a @@ -2007,10 +1888,7 @@ BattleCommand_EffectChance: ; 34ecc and a ret -; 34eee - - -BattleCommand_LowerSub: ; 34eee +BattleCommand_LowerSub: ; lowersub ld a, BATTLE_VARS_SUBSTATUS4 @@ -2078,19 +1956,13 @@ BattleCommand_LowerSub: ; 34eee ld [wSomeoneIsRampaging], a ret -; 34f57 - - -BattleCommand_MoveAnim: ; 34f57 +BattleCommand_MoveAnim: ; moveanim call BattleCommand_LowerSub call BattleCommand_MoveAnimNoSub jp BattleCommand_RaiseSub -; 34f60 - - -BattleCommand_MoveAnimNoSub: ; 34f60 +BattleCommand_MoveAnimNoSub: ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2154,10 +2026,7 @@ BattleCommand_MoveAnimNoSub: ; 34f60 ld [wNumHits], a jp PlayFXAnimID -; 34fd1 - - -BattleCommand_StatUpAnim: ; 34fd1 +BattleCommand_StatUpAnim: ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2165,10 +2034,7 @@ BattleCommand_StatUpAnim: ; 34fd1 xor a jr BattleCommand_StatUpDownAnim -; 34fdb - - -BattleCommand_StatDownAnim: ; 34fdb +BattleCommand_StatDownAnim: ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2180,10 +2046,8 @@ BattleCommand_StatDownAnim: ; 34fdb ld a, BATTLEANIM_WOBBLE ; fallthrough -; 34feb - -BattleCommand_StatUpDownAnim: ; 34feb +BattleCommand_StatUpDownAnim: ld [wNumHits], a xor a ld [wKickCounter], a @@ -2193,10 +2057,7 @@ BattleCommand_StatUpDownAnim: ; 34feb ld d, 0 jp PlayFXAnimID -; 34ffd - - -BattleCommand_SwitchTurn: ; 34ffd +BattleCommand_SwitchTurn: ; switchturn ld a, [hBattleTurn] @@ -2204,10 +2065,7 @@ BattleCommand_SwitchTurn: ; 34ffd ld [hBattleTurn], a ret -; 35004 - - -BattleCommand_RaiseSub: ; 35004 +BattleCommand_RaiseSub: ; raisesub ld a, BATTLE_VARS_SUBSTATUS4 @@ -2226,10 +2084,7 @@ BattleCommand_RaiseSub: ; 35004 ld a, SUBSTITUTE jp LoadAnim -; 35023 - - -BattleCommand_FailureText: ; 35023 +BattleCommand_FailureText: ; failuretext ; If the move missed or failed, load the appropriate ; text, and end the effects of multi-turn or multi- @@ -2271,10 +2126,7 @@ BattleCommand_FailureText: ; 35023 call AppearUserRaiseSub jp EndMoveEffect -; 3505e - - -BattleCommand_ApplyDamage: ; 3505e +BattleCommand_ApplyDamage: ; applydamage ld a, BATTLE_VARS_SUBSTATUS1_OPP @@ -2366,10 +2218,7 @@ BattleCommand_ApplyDamage: ; 3505e ld [de], a ret -; 350e4 - - -GetFailureResultText: ; 350e4 +GetFailureResultText: ld hl, DoesntAffectText ld de, DoesntAffectText ld a, [wTypeModifier] @@ -2427,7 +2276,7 @@ endr jp nz, DoEnemyDamage jp DoPlayerDamage -FailText_CheckOpponentProtect: ; 35157 +FailText_CheckOpponentProtect: ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_PROTECT, a @@ -2437,10 +2286,7 @@ FailText_CheckOpponentProtect: ; 35157 .not_protected jp StdBattleTextBox -; 35165 - - -BattleCommand_BideFailText: ; 35165 +BattleCommand_BideFailText: ld a, [wAttackMissed] and a ret z @@ -2450,10 +2296,7 @@ BattleCommand_BideFailText: ; 35165 jp z, PrintDoesntAffect jp PrintButItFailed -; 35175 - - -BattleCommand_CriticalText: ; 35175 +BattleCommand_CriticalText: ; criticaltext ; Prints the message for critical hits or one-hit KOs. @@ -2483,10 +2326,8 @@ BattleCommand_CriticalText: ; 35175 .texts dw CriticalHitText dw OneHitKOText -; 35197 - -BattleCommand_StartLoop: ; 35197 +BattleCommand_StartLoop: ; startloop ld hl, wPlayerRolloutCount @@ -2499,10 +2340,7 @@ BattleCommand_StartLoop: ; 35197 ld [hl], a ret -; 351a5 - - -BattleCommand_SuperEffectiveLoopText: ; 351a5 +BattleCommand_SuperEffectiveLoopText: ; supereffectivelooptext ld a, BATTLE_VARS_SUBSTATUS3 @@ -2511,10 +2349,8 @@ BattleCommand_SuperEffectiveLoopText: ; 351a5 ret nz ; fallthrough -; 351ad - -BattleCommand_SuperEffectiveText: ; 351ad +BattleCommand_SuperEffectiveText: ; supereffectivetext ld a, [wTypeModifier] @@ -2527,10 +2363,7 @@ BattleCommand_SuperEffectiveText: ; 351ad .print jp StdBattleTextBox -; 351c0 - - -BattleCommand_CheckDestinyBond: ; 351c0 +BattleCommand_CheckDestinyBond: ; checkdestinybond ; Faint the user if it fainted an opponent using Destiny Bond. @@ -2617,10 +2450,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 .finish jp EndMoveEffect -; 35250 - - -BattleCommand_BuildOpponentRage: ; 35250 +BattleCommand_BuildOpponentRage: ; buildopponentrage jp .start @@ -2651,10 +2481,7 @@ BattleCommand_BuildOpponentRage: ; 35250 call StdBattleTextBox jp BattleCommand_SwitchTurn -; 3527b - - -BattleCommand_RageDamage: ; 3527b +BattleCommand_RageDamage: ; ragedamage ld a, [wCurDamage] @@ -2682,10 +2509,7 @@ BattleCommand_RageDamage: ; 3527b ld [wCurDamage + 1], a ret -; 352a3 - - -EndMoveEffect: ; 352a3 +EndMoveEffect: ld a, [wBattleScriptBufferAddress] ld l, a ld a, [wBattleScriptBufferAddress + 1] @@ -2696,10 +2520,7 @@ EndMoveEffect: ; 352a3 ld [hl], a ret -; 352b1 - - -DittoMetalPowder: ; 352b1 +DittoMetalPowder: ld a, MON_SPECIES call BattlePartyAttr ld a, [hBattleTurn] @@ -2735,10 +2556,7 @@ DittoMetalPowder: ; 352b1 rr c ret -; 352dc - - -BattleCommand_DamageStats: ; 352dc +BattleCommand_DamageStats: ; damagestats ld a, [hBattleTurn] @@ -2746,10 +2564,8 @@ BattleCommand_DamageStats: ; 352dc jp nz, EnemyAttackDamage ; fallthrough -; 352e2 - -PlayerAttackDamage: ; 352e2 +PlayerAttackDamage: ; Return move power d, player level e, enemy defense c and player attack b. call ResetDamage @@ -2831,10 +2647,7 @@ PlayerAttackDamage: ; 352e2 and a ret -; 3534d - - -TruncateHL_BC: ; 3534d +TruncateHL_BC: .loop ; Truncate 16-bit values hl and bc to 8-bit values b and c respectively. ; b = hl, c = bc @@ -2879,10 +2692,7 @@ TruncateHL_BC: ; 3534d ld b, l ret -; 35378 - - -GetDamageStatsCritical: ; 35378 +GetDamageStatsCritical: ; Return carry if non-critical. ld a, [wCriticalHit] @@ -2891,10 +2701,8 @@ GetDamageStatsCritical: ; 35378 ret z ; fallthrough -; 3537e - -GetDamageStats: ; 3537e +GetDamageStats: ; Return the attacker's offensive stat and the defender's defensive ; stat based on whether the attacking type is physical or special. @@ -2934,10 +2742,7 @@ GetDamageStats: ; 3537e pop hl ret -; 353b5 - - -ThickClubBoost: ; 353b5 +ThickClubBoost: ; Return in hl the stat value at hl. ; If the attacking monster is Cubone or Marowak and @@ -2952,10 +2757,7 @@ ThickClubBoost: ; 353b5 pop bc ret -; 353c3 - - -LightBallBoost: ; 353c3 +LightBallBoost: ; Return in hl the stat value at hl. ; If the attacking monster is Pikachu and it's @@ -2970,10 +2772,7 @@ LightBallBoost: ; 353c3 pop bc ret -; 353d1 - - -SpeciesItemBoost: ; 353d1 +SpeciesItemBoost: ; Return in hl the stat value at hl. ; If the attacking monster is species b or c and @@ -3013,10 +2812,7 @@ SpeciesItemBoost: ; 353d1 rl h ret -; 353f6 - - -EnemyAttackDamage: ; 353f6 +EnemyAttackDamage: call ResetDamage ; No damage dealt with 0 power. @@ -3094,13 +2890,9 @@ EnemyAttackDamage: ; 353f6 and a ret -; 35461 - - INCLUDE "engine/battle/move_effects/beat_up.asm" - -BattleCommand_ClearMissDamage: ; 355d5 +BattleCommand_ClearMissDamage: ; clearmissdamage ld a, [wAttackMissed] and a @@ -3108,10 +2900,7 @@ BattleCommand_ClearMissDamage: ; 355d5 jp ResetDamage -; 355dd - - -HitSelfInConfusion: ; 355dd +HitSelfInConfusion: call ResetDamage ld a, [hBattleTurn] and a @@ -3147,10 +2936,7 @@ HitSelfInConfusion: ; 355dd ld e, a ret -; 35612 - - -BattleCommand_DamageCalc: ; 35612 +BattleCommand_DamageCalc: ; damagecalc ; Return a damage value for move power d, player level e, enemy defense c and player attack b. @@ -3273,12 +3059,11 @@ BattleCommand_DamageCalc: ; 35612 ld [hDivisor], a ld b, 4 call Divide -.DoneItem: +.DoneItem: ; Critical hits call .CriticalMultiplier - ; Update wCurDamage (capped at 997). ld hl, wCurDamage ld b, [hl] @@ -3343,7 +3128,6 @@ BattleCommand_DamageCalc: ; 35612 ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE) ld [hld], a - .dont_cap_3 ; Minimum neutral damage is 2 (bringing the cap to 999). inc hl @@ -3358,7 +3142,6 @@ BattleCommand_DamageCalc: ; 35612 and a ret - .CriticalMultiplier: ld a, [wCriticalHit] and a @@ -3382,13 +3165,9 @@ BattleCommand_DamageCalc: ; 35612 ret -; 35703 - - INCLUDE "data/types/type_boost_items.asm" - -BattleCommand_ConstantDamage: ; 35726 +BattleCommand_ConstantDamage: ; constantdamage ld hl, wBattleMonLevel @@ -3548,7 +3327,6 @@ BattleCommand_ConstantDamage: ; 35726 INCLUDE "data/moves/flail_reversal_power.asm" - INCLUDE "engine/battle/move_effects/counter.asm" INCLUDE "engine/battle/move_effects/encore.asm" @@ -3563,8 +3341,7 @@ INCLUDE "engine/battle/move_effects/lock_on.asm" INCLUDE "engine/battle/move_effects/sketch.asm" - -BattleCommand_DefrostOpponent: ; 35b16 +BattleCommand_DefrostOpponent: ; defrostopponent ; Thaw the opponent if frozen, and ; raise the user's Attack one stage. @@ -3590,9 +3367,6 @@ BattleCommand_DefrostOpponent: ; 35b16 ld [hl], a ret -; 35b33 - - INCLUDE "engine/battle/move_effects/sleep_talk.asm" INCLUDE "engine/battle/move_effects/destiny_bond.asm" @@ -3603,8 +3377,7 @@ INCLUDE "engine/battle/move_effects/false_swipe.asm" INCLUDE "engine/battle/move_effects/heal_bell.asm" - -FarPlayBattleAnimation: ; 35d00 +FarPlayBattleAnimation: ; play animation de ld a, BATTLE_VARS_SUBSTATUS3 @@ -3613,9 +3386,8 @@ FarPlayBattleAnimation: ; 35d00 ret nz ; fallthrough -; 35d08 -PlayFXAnimID: ; 35d08 +PlayFXAnimID: ld a, e ld [wFXAnimID], a ld a, d @@ -3626,10 +3398,7 @@ PlayFXAnimID: ; 35d08 callfar PlayBattleAnim ret -; 35d1c - - -DoEnemyDamage: ; 35d1c +DoEnemyDamage: ld hl, wCurDamage ld a, [hli] ld b, a @@ -3689,10 +3458,7 @@ DoEnemyDamage: ; 35d1c .did_no_damage jp RefreshBattleHuds -; 35d7e - - -DoPlayerDamage: ; 35d7e +DoPlayerDamage: ld hl, wCurDamage ld a, [hli] ld b, a @@ -3752,10 +3518,7 @@ DoPlayerDamage: ; 35d7e .did_no_damage jp RefreshBattleHuds -; 35de0 - - -DoSubstituteDamage: ; 35de0 +DoSubstituteDamage: ld hl, SubTookDamageText call StdBattleTextBox @@ -3812,11 +3575,7 @@ DoSubstituteDamage: ; 35de0 .done jp ResetDamage -; 35e40 - - -UpdateMoveData: ; 35e40 - +UpdateMoveData: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarAddr ld d, h @@ -3832,10 +3591,7 @@ UpdateMoveData: ; 35e40 call GetMoveName jp CopyName1 -; 35e5c - - -BattleCommand_SleepTarget: ; 35e5c +BattleCommand_SleepTarget: ; sleeptarget call GetOpponentItem @@ -3906,10 +3662,7 @@ BattleCommand_SleepTarget: ; 35e5c pop hl jp StdBattleTextBox -; 35ece - - -.CheckAIRandomFail: ; 35ece +.CheckAIRandomFail: ; Enemy turn ld a, [hBattleTurn] and a @@ -3937,10 +3690,7 @@ BattleCommand_SleepTarget: ; 35e5c xor a ret -; 35eee - - -BattleCommand_PoisonTarget: ; 35eee +BattleCommand_PoisonTarget: ; poisontarget call CheckSubstituteOpp @@ -3975,10 +3725,7 @@ BattleCommand_PoisonTarget: ; 35eee farcall UseHeldStatusHealingItem ret -; 35f2c - - -BattleCommand_Poison: ; 35f2c +BattleCommand_Poison: ; poison ld hl, DoesntAffectText @@ -4066,18 +3813,12 @@ BattleCommand_Poison: ; 35f2c pop hl jp StdBattleTextBox -; 35fc0 - - -.apply_poison ; 35fc0 +.apply_poison call AnimateCurrentMove call PoisonOpponent jp RefreshBattleHuds -; 35fc9 - - -.check_toxic ; 35fc9 +.check_toxic ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarAddr ld a, [hBattleTurn] @@ -4091,10 +3832,7 @@ BattleCommand_Poison: ; 35f2c cp EFFECT_TOXIC ret -; 35fe1 - - -CheckIfTargetIsPoisonType: ; 35fe1 +CheckIfTargetIsPoisonType: ld de, wEnemyMonType1 ld a, [hBattleTurn] and a @@ -4109,37 +3847,25 @@ CheckIfTargetIsPoisonType: ; 35fe1 cp POISON ret -; 35ff5 - - -PoisonOpponent: ; 35ff5 +PoisonOpponent: ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set PSN, [hl] jp UpdateOpponentInParty -; 35fff - - -BattleCommand_DrainTarget: ; 35fff +BattleCommand_DrainTarget: ; draintarget call SapHealth ld hl, SuckedHealthText jp StdBattleTextBox -; 36008 - - -BattleCommand_EatDream: ; 36008 +BattleCommand_EatDream: ; eatdream call SapHealth ld hl, DreamEatenText jp StdBattleTextBox -; 36011 - - -SapHealth: ; 36011 +SapHealth: ; Divide damage by 2, store it in hDividend ld hl, wCurDamage ld a, [hli] @@ -4232,10 +3958,7 @@ SapHealth: ; 36011 call RefreshBattleHuds jp UpdateBattleMonInParty -; 3608c - - -BattleCommand_BurnTarget: ; 3608c +BattleCommand_BurnTarget: ; burntarget xor a @@ -4276,10 +3999,7 @@ BattleCommand_BurnTarget: ; 3608c farcall UseHeldStatusHealingItem ret -; 360dd - - -Defrost: ; 360dd +Defrost: ld a, [hl] and 1 << FRZ ret z @@ -4304,10 +4024,7 @@ Defrost: ; 360dd ld hl, DefrostedOpponentText jp StdBattleTextBox -; 36102 - - -BattleCommand_FreezeTarget: ; 36102 +BattleCommand_FreezeTarget: ; freezetarget xor a @@ -4360,10 +4077,7 @@ BattleCommand_FreezeTarget: ; 36102 ld [hl], $1 ret -; 36165 - - -BattleCommand_ParalyzeTarget: ; 36165 +BattleCommand_ParalyzeTarget: ; paralyzetarget xor a @@ -4399,80 +4113,77 @@ BattleCommand_ParalyzeTarget: ; 36165 ld hl, UseHeldStatusHealingItem jp CallBattleCore -; 361ac - - -BattleCommand_AttackUp: ; 361ac +BattleCommand_AttackUp: ; attackup ld b, ATTACK jr BattleCommand_StatUp -BattleCommand_DefenseUp: ; 361b0 +BattleCommand_DefenseUp: ; defenseup ld b, DEFENSE jr BattleCommand_StatUp -BattleCommand_SpeedUp: ; 361b4 +BattleCommand_SpeedUp: ; speedup ld b, SPEED jr BattleCommand_StatUp -BattleCommand_SpecialAttackUp: ; 361b8 +BattleCommand_SpecialAttackUp: ; specialattackup ld b, SP_ATTACK jr BattleCommand_StatUp -BattleCommand_SpecialDefenseUp: ; 361bc +BattleCommand_SpecialDefenseUp: ; specialdefenseup ld b, SP_DEFENSE jr BattleCommand_StatUp -BattleCommand_AccuracyUp: ; 361c0 +BattleCommand_AccuracyUp: ; accuracyup ld b, ACCURACY jr BattleCommand_StatUp -BattleCommand_EvasionUp: ; 361c4 +BattleCommand_EvasionUp: ; evasionup ld b, EVASION jr BattleCommand_StatUp -BattleCommand_AttackUp2: ; 361c8 +BattleCommand_AttackUp2: ; attackup2 ld b, $10 | ATTACK jr BattleCommand_StatUp -BattleCommand_DefenseUp2: ; 361cc +BattleCommand_DefenseUp2: ; defenseup2 ld b, $10 | DEFENSE jr BattleCommand_StatUp -BattleCommand_SpeedUp2: ; 361d0 +BattleCommand_SpeedUp2: ; speedup2 ld b, $10 | SPEED jr BattleCommand_StatUp -BattleCommand_SpecialAttackUp2: ; 361d4 +BattleCommand_SpecialAttackUp2: ; specialattackup2 ld b, $10 | SP_ATTACK jr BattleCommand_StatUp -BattleCommand_SpecialDefenseUp2: ; 361d8 +BattleCommand_SpecialDefenseUp2: ; specialdefenseup2 ld b, $10 | SP_DEFENSE jr BattleCommand_StatUp -BattleCommand_AccuracyUp2: ; 361dc +BattleCommand_AccuracyUp2: ; accuracyup2 ld b, $10 | ACCURACY jr BattleCommand_StatUp -BattleCommand_EvasionUp2: ; 361e0 +BattleCommand_EvasionUp2: ; evasionup2 ld b, $10 | EVASION jr BattleCommand_StatUp -BattleCommand_StatUp: ; 361e4 +BattleCommand_StatUp: ; statup call CheckIfStatCanBeRaised ld a, [wFailedMessage] @@ -4480,10 +4191,7 @@ BattleCommand_StatUp: ; 361e4 ret nz jp StatUpAnimation -; 361ef - - -CheckIfStatCanBeRaised: ; 361ef +CheckIfStatCanBeRaised: ld a, b ld [wLoweredStat], a ld hl, wPlayerStatLevels @@ -4562,35 +4270,24 @@ CheckIfStatCanBeRaised: ; 361ef ld [wFailedMessage], a ret -; 3626e - - -.stats_already_max ; 3626e +.stats_already_max pop hl dec [hl] ; fallthrough -; 36270 - -.cant_raise_stat ; 36270 +.cant_raise_stat ld a, $2 ld [wFailedMessage], a ld a, $1 ld [wAttackMissed], a ret -; 3627b - - -.stat_raise_failed ; 3627b +.stat_raise_failed ld a, $1 ld [wFailedMessage], a ret -; 36281 - - -StatUpAnimation: ; 36281 +StatUpAnimation: ld bc, wPlayerMinimized ld hl, DropPlayerSub ld a, [hBattleTurn] @@ -4615,79 +4312,76 @@ StatUpAnimation: ; 36281 call WaitBGMap jp BattleCommand_MoveDelay -; 362ad - - -BattleCommand_AttackDown: ; 362ad +BattleCommand_AttackDown: ; attackdown ld a, ATTACK jr BattleCommand_StatDown -BattleCommand_DefenseDown: ; 362b1 +BattleCommand_DefenseDown: ; defensedown ld a, DEFENSE jr BattleCommand_StatDown -BattleCommand_SpeedDown: ; 362b5 +BattleCommand_SpeedDown: ; speeddown ld a, SPEED jr BattleCommand_StatDown -BattleCommand_SpecialAttackDown: ; 362b9 +BattleCommand_SpecialAttackDown: ; specialattackdown ld a, SP_ATTACK jr BattleCommand_StatDown -BattleCommand_SpecialDefenseDown: ; 362bd +BattleCommand_SpecialDefenseDown: ; specialdefensedown ld a, SP_DEFENSE jr BattleCommand_StatDown -BattleCommand_AccuracyDown: ; 362c1 +BattleCommand_AccuracyDown: ; accuracydown ld a, ACCURACY jr BattleCommand_StatDown -BattleCommand_EvasionDown: ; 362c5 +BattleCommand_EvasionDown: ; evasiondown ld a, EVASION jr BattleCommand_StatDown -BattleCommand_AttackDown2: ; 362c9 +BattleCommand_AttackDown2: ; attackdown2 ld a, $10 | ATTACK jr BattleCommand_StatDown -BattleCommand_DefenseDown2: ; 362cd +BattleCommand_DefenseDown2: ; defensedown2 ld a, $10 | DEFENSE jr BattleCommand_StatDown -BattleCommand_SpeedDown2: ; 362d1 +BattleCommand_SpeedDown2: ; speeddown2 ld a, $10 | SPEED jr BattleCommand_StatDown -BattleCommand_SpecialAttackDown2: ; 362d5 +BattleCommand_SpecialAttackDown2: ; specialattackdown2 ld a, $10 | SP_ATTACK jr BattleCommand_StatDown -BattleCommand_SpecialDefenseDown2: ; 362d9 +BattleCommand_SpecialDefenseDown2: ; specialdefensedown2 ld a, $10 | SP_DEFENSE jr BattleCommand_StatDown -BattleCommand_AccuracyDown2: ; 362dd +BattleCommand_AccuracyDown2: ; accuracydown2 ld a, $10 | ACCURACY jr BattleCommand_StatDown -BattleCommand_EvasionDown2: ; 362e1 +BattleCommand_EvasionDown2: ; evasiondown2 ld a, $10 | EVASION -BattleCommand_StatDown: ; 362e3 +BattleCommand_StatDown: ; statdown ld [wLoweredStat], a @@ -4810,10 +4504,7 @@ BattleCommand_StatDown: ; 362e3 ld [wAttackMissed], a ret -; 36391 - - -CheckMist: ; 36391 +CheckMist: ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_ATTACK_DOWN @@ -4838,10 +4529,7 @@ CheckMist: ; 36391 bit SUBSTATUS_MIST, a ret -; 363b8 - - -BattleCommand_StatUpMessage: ; 363b8 +BattleCommand_StatUpMessage: ld a, [wFailedMessage] and a ret nz @@ -4871,10 +4559,7 @@ BattleCommand_StatUpMessage: ; 363b8 text_jump UnknownText_0x1c0ce0 db "@" -; 363e9 - - -BattleCommand_StatDownMessage: ; 363e9 +BattleCommand_StatDownMessage: ld a, [wFailedMessage] and a ret nz @@ -4903,10 +4588,7 @@ BattleCommand_StatDownMessage: ; 363e9 text_jump UnknownText_0x1c0d06 db "@" -; 3641a - - -TryLowerStat: ; 3641a +TryLowerStat: ; Lower stat c from stat struct hl (buffer de). push bc @@ -4949,10 +4631,7 @@ TryLowerStat: ; 3641a and a ret -; 3644c - - -BattleCommand_StatUpFailText: ; 3644c +BattleCommand_StatUpFailText: ; statupfailtext ld a, [wFailedMessage] and a @@ -4970,10 +4649,7 @@ BattleCommand_StatUpFailText: ; 3644c ld hl, WontRiseAnymoreText jp StdBattleTextBox -; 3646a - - -BattleCommand_StatDownFailText: ; 3646a +BattleCommand_StatDownFailText: ; statdownfailtext ld a, [wFailedMessage] and a @@ -4994,10 +4670,7 @@ BattleCommand_StatDownFailText: ; 3646a ld hl, WontDropAnymoreText jp StdBattleTextBox -; 3648f - - -GetStatName: ; 3648f +GetStatName: ld hl, StatNames ld c, "@" .CheckName: @@ -5016,11 +4689,9 @@ GetStatName: ; 3648f INCLUDE "data/battle/stat_names.asm" - INCLUDE "data/battle/stat_multipliers.asm" - -BattleCommand_AllStatsUp: ; 36500 +BattleCommand_AllStatsUp: ; allstatsup ; Attack @@ -5047,18 +4718,13 @@ BattleCommand_AllStatsUp: ; 36500 call ResetMiss call BattleCommand_SpecialDefenseUp jp BattleCommand_StatUpMessage -; 3652d - -ResetMiss: ; 3652d +ResetMiss: xor a ld [wAttackMissed], a ret -; 36532 - - -LowerStat: ; 36532 +LowerStat: ld [wLoweredStat], a ld hl, wPlayerStatLevels @@ -5129,10 +4795,7 @@ LowerStat: ; 36532 ld [wFailedMessage], a ret -; 3658f - - -BattleCommand_TriStatusChance: ; 3658f +BattleCommand_TriStatusChance: ; tristatuschance call BattleCommand_EffectChance @@ -5152,20 +4815,15 @@ BattleCommand_TriStatusChance: ; 3658f dw BattleCommand_ParalyzeTarget ; paralyze dw BattleCommand_FreezeTarget ; freeze dw BattleCommand_BurnTarget ; burn -; 365a7 - -BattleCommand_Curl: ; 365a7 +BattleCommand_Curl: ; curl ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_CURLED, [hl] ret -; 365af - - -BattleCommand_RaiseSubNoAnim: ; 365af +BattleCommand_RaiseSubNoAnim: ld hl, GetBattleMonBackpic ld a, [hBattleTurn] and a @@ -5177,10 +4835,7 @@ BattleCommand_RaiseSubNoAnim: ; 365af call CallBattleCore jp WaitBGMap -; 365c3 - - -BattleCommand_LowerSubNoAnim: ; 365c3 +BattleCommand_LowerSubNoAnim: ld hl, DropPlayerSub ld a, [hBattleTurn] and a @@ -5192,10 +4847,7 @@ BattleCommand_LowerSubNoAnim: ; 365c3 call CallBattleCore jp WaitBGMap -; 365d7 - - -CalcPlayerStats: ; 365d7 +CalcPlayerStats: ld hl, wPlayerAtkLevel ld de, wPlayerStats ld bc, wBattleMonAttack @@ -5216,10 +4868,7 @@ CalcPlayerStats: ; 365d7 jp BattleCommand_SwitchTurn -; 365fd - - -CalcEnemyStats: ; 365fd +CalcEnemyStats: ld hl, wEnemyAtkLevel ld de, wEnemyStats ld bc, wEnemyMonAttack @@ -5237,10 +4886,7 @@ CalcEnemyStats: ; 365fd jp BattleCommand_SwitchTurn -; 3661d - - -CalcStats: ; 3661d +CalcStats: .loop push af ld a, [hli] @@ -5309,13 +4955,9 @@ CalcStats: ; 3661d ret -; 36671 - - INCLUDE "engine/battle/move_effects/bide.asm" - -BattleCommand_CheckRampage: ; 3671a +BattleCommand_CheckRampage: ; checkrampage ld de, wPlayerRolloutCount @@ -5352,10 +4994,7 @@ BattleCommand_CheckRampage: ; 3671a ld b, rampage_command jp SkipToBattleCommand -; 36751 - - -BattleCommand_Rampage: ; 36751 +BattleCommand_Rampage: ; rampage ; No rampage during Sleep Talk. @@ -5382,23 +5021,16 @@ BattleCommand_Rampage: ; 36751 ld [wSomeoneIsRampaging], a ret -; 36778 - - INCLUDE "engine/battle/move_effects/teleport.asm" - -SetBattleDraw: ; 36804 +SetBattleDraw: ld a, [wBattleResult] and BATTLERESULT_BITMASK or DRAW ld [wBattleResult], a ret -; 3680f - - -BattleCommand_ForceSwitch: ; 3680f +BattleCommand_ForceSwitch: ; forceswitch ld a, [wBattleType] @@ -5617,10 +5249,7 @@ BattleCommand_ForceSwitch: ; 3680f .do_text jp StdBattleTextBox -; 36994 - - -CheckPlayerHasMonToSwitchTo: ; 36994 +CheckPlayerHasMonToSwitchTo: ld a, [wPartyCount] ld d, a ld e, 0 @@ -5649,10 +5278,7 @@ CheckPlayerHasMonToSwitchTo: ; 36994 and a ret -; 369b6 - - -BattleCommand_EndLoop: ; 369b6 +BattleCommand_EndLoop: ; endloop ; Loop back to 'critical'. @@ -5786,10 +5412,7 @@ BattleCommand_EndLoop: ; 369b6 ld [wBattleScriptBufferAddress], a ret -; 36a82 - - -BattleCommand_FakeOut: ; 36a82 +BattleCommand_FakeOut: ld a, [wAttackMissed] and a ret nz @@ -5810,10 +5433,7 @@ BattleCommand_FakeOut: ; 36a82 ld [wAttackMissed], a ret -; 36aa0 - - -BattleCommand_FlinchTarget: ; 36aa0 +BattleCommand_FlinchTarget: call CheckSubstituteOpp ret nz @@ -5830,19 +5450,14 @@ BattleCommand_FlinchTarget: ; 36aa0 ret nz ; fallthrough -; 36ab5 - -FlinchTarget: ; 36ab5 +FlinchTarget: ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr set SUBSTATUS_FLINCHED, [hl] jp EndRechargeOpp -; 36abf - - -CheckOpponentWentFirst: ; 36abf +CheckOpponentWentFirst: ; Returns a=0, z if user went first ; Returns a=1, nz if opponent went first push bc @@ -5853,10 +5468,7 @@ CheckOpponentWentFirst: ; 36abf pop bc ret -; 36ac9 - - -BattleCommand_HeldFlinch: ; 36ac9 +BattleCommand_HeldFlinch: ; kingsrock ld a, [wAttackMissed] @@ -5884,10 +5496,7 @@ BattleCommand_HeldFlinch: ; 36ac9 set SUBSTATUS_FLINCHED, [hl] ret -; 36af3 - - -BattleCommand_OHKO: ; 36af3 +BattleCommand_OHKO: ; ohko call ResetDamage @@ -5933,10 +5542,7 @@ BattleCommand_OHKO: ; 36af3 ld [wAttackMissed], a ret -; 36b3a - - -BattleCommand_CheckCharge: ; 36b3a +BattleCommand_CheckCharge: ; checkcharge ld a, BATTLE_VARS_SUBSTATUS3 @@ -5949,10 +5555,7 @@ BattleCommand_CheckCharge: ; 36b3a ld b, charge_command jp SkipToBattleCommand -; 36b4d - - -BattleCommand_Charge: ; 36b4d +BattleCommand_Charge: ; charge call BattleCommand_ClearText @@ -6092,17 +5695,12 @@ BattleCommand_Charge: ; 36b4d ; 'dug a hole!' text_jump UnknownText_0x1c0d6c db "@" -; 36c2c - -BattleCommand3c: ; 36c2c +BattleCommand3c: ; unused ret -; 36c2d - - -BattleCommand_TrapTarget: ; 36c2d +BattleCommand_TrapTarget: ; traptarget ld a, [wAttackMissed] @@ -6157,15 +5755,12 @@ BattleCommand_TrapTarget: ; 36c2d dbw FIRE_SPIN, FireSpinTrapText ; 'was trapped!' dbw CLAMP, ClampedByText ; 'was CLAMPED by' dbw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!' -; 36c7e - INCLUDE "engine/battle/move_effects/mist.asm" INCLUDE "engine/battle/move_effects/focus_energy.asm" - -BattleCommand_Recoil: ; 36cb2 +BattleCommand_Recoil: ; recoil ld hl, wBattleMonMaxHP @@ -6229,10 +5824,7 @@ BattleCommand_Recoil: ; 36cb2 ld hl, RecoilText jp StdBattleTextBox -; 36d1d - - -BattleCommand_ConfuseTarget: ; 36d1d +BattleCommand_ConfuseTarget: ; confusetarget call GetOpponentItem @@ -6252,8 +5844,7 @@ BattleCommand_ConfuseTarget: ; 36d1d ret nz jr BattleCommand_FinishConfusingTarget - -BattleCommand_Confuse: ; 36d3b +BattleCommand_Confuse: ; confuse call GetOpponentItem @@ -6282,7 +5873,7 @@ BattleCommand_Confuse: ; 36d3b ld a, [wAttackMissed] and a jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit -BattleCommand_FinishConfusingTarget: ; 36d70 +BattleCommand_FinishConfusingTarget: ld bc, wEnemyConfuseCount ld a, [hBattleTurn] and a @@ -6325,9 +5916,7 @@ BattleCommand_FinishConfusingTarget: ; 36d70 ld hl, UseConfusionHealingItem jp CallBattleCore -; 36db6 - -BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit: ; 36db6 +BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit: ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_CONFUSE_HIT @@ -6338,10 +5927,7 @@ BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit: ; 36db6 ret z jp PrintDidntAffect2 -; 36dc7 - - -BattleCommand_Paralyze: ; 36dc7 +BattleCommand_Paralyze: ; paralyze ld a, BATTLE_VARS_STATUS_OPP @@ -6421,10 +6007,7 @@ BattleCommand_Paralyze: ; 36dc7 call AnimateFailedMove jp PrintDoesntAffect -; 36e5b - - -CheckMoveTypeMatchesTarget: ; 36e5b +CheckMoveTypeMatchesTarget: ; Compare move type to opponent type. ; Return z if matching the opponent type, ; unless the move is Normal (Tri Attack). @@ -6459,23 +6042,16 @@ CheckMoveTypeMatchesTarget: ; 36e5b pop hl ret -; 36e7c - - INCLUDE "engine/battle/move_effects/substitute.asm" - -BattleCommand_RechargeNextTurn: ; 36f0b +BattleCommand_RechargeNextTurn: ; rechargenextturn ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr set SUBSTATUS_RECHARGE, [hl] ret -; 36f13 - - -EndRechargeOpp: ; 36f13 +EndRechargeOpp: push hl ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVarAddr @@ -6483,13 +6059,9 @@ EndRechargeOpp: ; 36f13 pop hl ret -; 36f1d - - INCLUDE "engine/battle/move_effects/rage.asm" - -BattleCommand_DoubleFlyingDamage: ; 36f25 +BattleCommand_DoubleFlyingDamage: ; doubleflyingdamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar @@ -6497,10 +6069,7 @@ BattleCommand_DoubleFlyingDamage: ; 36f25 ret z jr DoubleDamage -; 36f2f - - -BattleCommand_DoubleUndergroundDamage: ; 36f2f +BattleCommand_DoubleUndergroundDamage: ; doubleundergrounddamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar @@ -6508,10 +6077,8 @@ BattleCommand_DoubleUndergroundDamage: ; 36f2f ret z ; fallthrough -; 36f37 - -DoubleDamage: ; 36f37 +DoubleDamage: ld hl, wCurDamage + 1 sla [hl] dec hl @@ -6524,9 +6091,6 @@ DoubleDamage: ; 36f37 .quit ret -; 36f46 - - INCLUDE "engine/battle/move_effects/mimic.asm" INCLUDE "engine/battle/move_effects/leech_seed.asm" @@ -6539,8 +6103,7 @@ INCLUDE "engine/battle/move_effects/pay_day.asm" INCLUDE "engine/battle/move_effects/conversion.asm" - -BattleCommand_ResetStats: ; 3710e +BattleCommand_ResetStats: ; resetstats ld a, 7 ; neutral @@ -6573,10 +6136,7 @@ BattleCommand_ResetStats: ; 3710e jr nz, .next ret -; 3713e - - -BattleCommand_Heal: ; 3713e +BattleCommand_Heal: ; heal ld de, wBattleMonHP @@ -6658,13 +6218,9 @@ BattleCommand_Heal: ; 3713e ld hl, HPIsFullText jp StdBattleTextBox -; 371cd - - INCLUDE "engine/battle/move_effects/transform.asm" - -BattleSideCopy: ; 372c6 +BattleSideCopy: ; Copy bc bytes from hl to de if it's the player's turn. ; Copy bc bytes from de to hl if it's the enemy's turn. ld a, [hBattleTurn] @@ -6679,17 +6235,11 @@ BattleSideCopy: ; 372c6 .copy jp CopyBytes -; 372d2 - - -BattleEffect_ButItFailed: ; 372d2 +BattleEffect_ButItFailed: call AnimateFailedMove jp PrintButItFailed -; 372d8 - - -ClearLastMove: ; 372d8 +ClearLastMove: ld a, BATTLE_VARS_LAST_COUNTER_MOVE call GetBattleVarAddr xor a @@ -6701,10 +6251,7 @@ ClearLastMove: ; 372d8 ld [hl], a ret -; 372e7 - - -ResetActorDisable: ; 372e7 +ResetActorDisable: ld a, [hBattleTurn] and a jr z, .player @@ -6720,10 +6267,7 @@ ResetActorDisable: ; 372e7 ld [wDisabledMove], a ret -; 372fc - - -BattleCommand_Screen: ; 372fc +BattleCommand_Screen: ; screen ld hl, wPlayerScreens @@ -6768,97 +6312,66 @@ BattleCommand_Screen: ; 372fc call AnimateFailedMove jp PrintButItFailed -; 3733d - - -PrintDoesntAffect: ; 3733d +PrintDoesntAffect: ; 'it doesn't affect' ld hl, DoesntAffectText jp StdBattleTextBox -; 37343 - - -PrintNothingHappened: ; 37343 +PrintNothingHappened: ; 'but nothing happened!' ld hl, NothingHappenedText jp StdBattleTextBox -; 37349 - - -TryPrintButItFailed: ; 37349 +TryPrintButItFailed: ld a, [wAlreadyFailed] and a ret nz ; fallthrough -; 3734e - -PrintButItFailed: ; 3734e +PrintButItFailed: ; 'but it failed!' ld hl, ButItFailedText jp StdBattleTextBox -; 37354 - - FailMove: call AnimateFailedMove ; fallthrough -; 37357 -FailMimic: ; 37357 +FailMimic: ld hl, ButItFailedText ; 'but it failed!' ld de, ItFailedText ; 'it failed!' jp FailText_CheckOpponentProtect -; 37360 - - -PrintDidntAffect: ; 37360 +PrintDidntAffect: ; 'it didn't affect' ld hl, DidntAffect1Text jp StdBattleTextBox -; 37366 - - -PrintDidntAffect2: ; 37366 +PrintDidntAffect2: call AnimateFailedMove ld hl, DidntAffect1Text ; 'it didn't affect' ld de, DidntAffect2Text ; 'it didn't affect' jp FailText_CheckOpponentProtect -; 37372 - - -PrintParalyze: ; 37372 +PrintParalyze: ; 'paralyzed! maybe it can't attack!' ld hl, ParalyzedText jp StdBattleTextBox -; 37378 - - -CheckSubstituteOpp: ; 37378 +CheckSubstituteOpp: ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret -; 37380 - - INCLUDE "engine/battle/move_effects/selfdestruct.asm" INCLUDE "engine/battle/move_effects/mirror_move.asm" INCLUDE "engine/battle/move_effects/metronome.asm" - -CheckUserMove: ; 37462 +CheckUserMove: ; Return z if the user has move a. ld b, a ld de, wBattleMonMoves @@ -6882,10 +6395,7 @@ CheckUserMove: ; 37462 and a ret -; 3747b - - -ResetTurn: ; 3747b +ResetTurn: ld hl, wPlayerCharging ld a, [hBattleTurn] and a @@ -6899,13 +6409,9 @@ ResetTurn: ; 3747b call DoMove jp EndMoveEffect -; 37492 - - INCLUDE "engine/battle/move_effects/thief.asm" - -BattleCommand_ArenaTrap: ; 37517 +BattleCommand_ArenaTrap: ; arenatrap ; Doesn't work on an absent opponent. @@ -6931,13 +6437,9 @@ BattleCommand_ArenaTrap: ; 37517 call AnimateFailedMove jp PrintButItFailed -; 37536 - - INCLUDE "engine/battle/move_effects/nightmare.asm" - -BattleCommand_Defrost: ; 37563 +BattleCommand_Defrost: ; defrost ; Thaw the user. @@ -6968,9 +6470,6 @@ BattleCommand_Defrost: ; 37563 ld hl, WasDefrostedText jp StdBattleTextBox -; 37588 - - INCLUDE "engine/battle/move_effects/curse.asm" INCLUDE "engine/battle/move_effects/protect.asm" @@ -6987,14 +6486,10 @@ INCLUDE "engine/battle/move_effects/sandstorm.asm" INCLUDE "engine/battle/move_effects/rollout.asm" - -BattleCommand5d: ; 37791 +BattleCommand5d: ; unused ret -; 37792 - - INCLUDE "engine/battle/move_effects/fury_cutter.asm" INCLUDE "engine/battle/move_effects/attract.asm" @@ -7007,8 +6502,7 @@ INCLUDE "engine/battle/move_effects/frustration.asm" INCLUDE "engine/battle/move_effects/safeguard.asm" - -SafeCheckSafeguard: ; 37962 +SafeCheckSafeguard: push hl ld hl, wEnemyScreens ld a, [hBattleTurn] @@ -7021,10 +6515,7 @@ SafeCheckSafeguard: ; 37962 pop hl ret -; 37972 - - -BattleCommand_CheckSafeguard: ; 37972 +BattleCommand_CheckSafeguard: ; checksafeguard ld hl, wEnemyScreens ld a, [hBattleTurn] @@ -7041,9 +6532,6 @@ BattleCommand_CheckSafeguard: ; 37972 call StdBattleTextBox jp EndMoveEffect -; 37991 - - INCLUDE "engine/battle/move_effects/magnitude.asm" INCLUDE "engine/battle/move_effects/baton_pass.asm" @@ -7052,28 +6540,22 @@ INCLUDE "engine/battle/move_effects/pursuit.asm" INCLUDE "engine/battle/move_effects/rapid_spin.asm" - -BattleCommand_HealMorn: ; 37b74 +BattleCommand_HealMorn: ; healmorn ld b, MORN_F jr BattleCommand_TimeBasedHealContinue -; 37b78 - -BattleCommand_HealDay: ; 37b78 +BattleCommand_HealDay: ; healday ld b, DAY_F jr BattleCommand_TimeBasedHealContinue -; 37b7c - -BattleCommand_HealNite: ; 37b7c +BattleCommand_HealNite: ; healnite ld b, NITE_F ; fallthrough -; 37b7e -BattleCommand_TimeBasedHealContinue: ; 37b7e +BattleCommand_TimeBasedHealContinue: ; Time- and weather-sensitive heal. ld hl, wBattleMonMaxHP @@ -7154,8 +6636,6 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e dw GetQuarterMaxHP dw GetHalfMaxHP dw GetMaxHP -; 37be8 - INCLUDE "engine/battle/move_effects/hidden_power.asm" @@ -7169,8 +6649,7 @@ INCLUDE "engine/battle/move_effects/psych_up.asm" INCLUDE "engine/battle/move_effects/mirror_coat.asm" - -BattleCommand_DoubleMinimizeDamage: ; 37ce6 +BattleCommand_DoubleMinimizeDamage: ; doubleminimizedamage ld hl, wEnemyMinimized @@ -7192,10 +6671,7 @@ BattleCommand_DoubleMinimizeDamage: ; 37ce6 ld [hl], a ret -; 37d02 - - -BattleCommand_SkipSunCharge: ; 37d02 +BattleCommand_SkipSunCharge: ; mimicsuncharge ld a, [wBattleWeather] cp WEATHER_SUN @@ -7203,25 +6679,18 @@ BattleCommand_SkipSunCharge: ; 37d02 ld b, charge_command jp SkipToBattleCommand -; 37d0d - - INCLUDE "engine/battle/move_effects/future_sight.asm" INCLUDE "engine/battle/move_effects/thunder.asm" - -CheckHiddenOpponent: ; 37daa +CheckHiddenOpponent: ; BUG: This routine should account for Lock-On and Mind Reader. ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret -; 37db2 - - -GetUserItem: ; 37db2 +GetUserItem: ; Return the effect of the user's item in bc, and its id at hl. ld hl, wBattleMonItem ld a, [hBattleTurn] @@ -7232,10 +6701,7 @@ GetUserItem: ; 37db2 ld b, [hl] jp GetItemHeldEffect -; 37dc1 - - -GetOpponentItem: ; 37dc1 +GetOpponentItem: ; Return the effect of the opponent's item in bc, and its id at hl. ld hl, wEnemyMonItem ld a, [hBattleTurn] @@ -7246,10 +6712,7 @@ GetOpponentItem: ; 37dc1 ld b, [hl] jp GetItemHeldEffect -; 37dd0 - - -GetItemHeldEffect: ; 37dd0 +GetItemHeldEffect: ; Return the effect of item b in bc. ld a, b and a @@ -7269,10 +6732,7 @@ GetItemHeldEffect: ; 37dd0 pop hl ret -; 37de9 - - -AnimateCurrentMoveEitherSide: ; 37de9 +AnimateCurrentMoveEitherSide: push hl push de push bc @@ -7288,10 +6748,7 @@ AnimateCurrentMoveEitherSide: ; 37de9 pop hl ret -; 37e01 - - -AnimateCurrentMove: ; 37e01 +AnimateCurrentMove: push hl push de push bc @@ -7307,10 +6764,7 @@ AnimateCurrentMove: ; 37e01 pop hl ret -; 37e19 - - -PlayDamageAnim: ; 37e19 +PlayDamageAnim: xor a ld [wFXAnimID + 1], a @@ -7332,10 +6786,7 @@ PlayDamageAnim: ; 37e19 jp PlayUserBattleAnim -; 37e36 - - -LoadMoveAnim: ; 37e36 +LoadMoveAnim: xor a ld [wNumHits], a ld [wFXAnimID + 1], a @@ -7346,17 +6797,13 @@ LoadMoveAnim: ; 37e36 ret z ; fallthrough -; 37e44 - -LoadAnim: ; 37e44 +LoadAnim: ld [wFXAnimID], a ; fallthrough -; 37e47 - -PlayUserBattleAnim: ; 37e47 +PlayUserBattleAnim: push hl push de push bc @@ -7366,10 +6813,7 @@ PlayUserBattleAnim: ; 37e47 pop hl ret -; 37e54 - - -PlayOpponentBattleAnim: ; 37e54 +PlayOpponentBattleAnim: ld a, e ld [wFXAnimID], a ld a, d @@ -7390,35 +6834,23 @@ PlayOpponentBattleAnim: ; 37e54 pop hl ret -; 37e73 - - -CallBattleCore: ; 37e73 - ld a, BANK(BattleCore) +CallBattleCore: + ld a, BANK("Battle Core") rst FarCall ret -; 37e77 - - -AnimateFailedMove: ; 37e77 +AnimateFailedMove: call BattleCommand_LowerSub call BattleCommand_MoveDelay jp BattleCommand_RaiseSub -; 37e80 - - -BattleCommand_MoveDelay: ; 37e80 +BattleCommand_MoveDelay: ; movedelay ; Wait 40 frames. ld c, 40 jp DelayFrames -; 37e85 - - -BattleCommand_ClearText: ; 37e85 +BattleCommand_ClearText: ; cleartext ; Used in multi-hit moves. @@ -7427,10 +6859,8 @@ BattleCommand_ClearText: ; 37e85 .text db "@" -; 37e8c - -SkipToBattleCommand: ; 37e8c +SkipToBattleCommand: ; Skip over commands until reaching command b. ld a, [wBattleScriptBufferAddress + 1] ld h, a @@ -7447,10 +6877,7 @@ SkipToBattleCommand: ; 37e8c ld [wBattleScriptBufferAddress], a ret -; 37ea1 - - -GetMoveAttr: ; 37ea1 +GetMoveAttr: ; Assuming hl = Moves + x, return attribute x of move a. push bc ld bc, MOVE_LENGTH @@ -7459,49 +6886,31 @@ GetMoveAttr: ; 37ea1 pop bc ret -; 37ead - - -GetMoveData: ; 37ead +GetMoveData: ; Copy move struct a to de. ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld a, Bank(Moves) + ld a, BANK(Moves) jp FarCopyBytes -; 37ebb - - -GetMoveByte: ; 37ebb +GetMoveByte: ld a, BANK(Moves) jp GetFarByte -; 37ec0 - - -DisappearUser: ; 37ec0 +DisappearUser: farcall _DisappearUser ret -; 37ec7 - - -AppearUserLowerSub: ; 37ec7 +AppearUserLowerSub: farcall _AppearUserLowerSub ret -; 37ece - - -AppearUserRaiseSub: ; 37ece +AppearUserRaiseSub: farcall _AppearUserRaiseSub ret -; 37ed5 - - -_CheckBattleScene: ; 37ed5 +_CheckBattleScene: ; Checks the options. Returns carry if battle animations are disabled. push hl push de @@ -7511,5 +6920,3 @@ _CheckBattleScene: ; 37ed5 pop de pop hl ret - -; 37ee2 diff --git a/engine/battle/hidden_power.asm b/engine/battle/hidden_power.asm index 9d9a8dc0e..537fe4354 100644 --- a/engine/battle/hidden_power.asm +++ b/engine/battle/hidden_power.asm @@ -1,4 +1,4 @@ -HiddenPowerDamage: ; fbced +HiddenPowerDamage: ; Override Hidden Power's type and power based on the user's DVs. ld hl, wBattleMonDVs @@ -8,7 +8,6 @@ HiddenPowerDamage: ; fbced ld hl, wEnemyMonDVs .got_dvs - ; Power: ; Take the top bit from each stat @@ -62,7 +61,6 @@ HiddenPowerDamage: ; fbced ld d, a - ; Type: ; Def & 3 @@ -108,4 +106,3 @@ HiddenPowerDamage: ; fbced pop af ld d, a ret -; fbd54 diff --git a/engine/battle/link_result.asm b/engine/battle/link_result.asm index 1dbc40aa9..0dd339fe4 100644 --- a/engine/battle/link_result.asm +++ b/engine/battle/link_result.asm @@ -1,4 +1,4 @@ -DetermineLinkBattleResult: ; 2b930 +DetermineLinkBattleResult: farcall UpdateEnemyMonInParty ld hl, wPartyMon1HP call .CountMonsRemaining @@ -58,7 +58,7 @@ DetermineLinkBattleResult: ; 2b930 ld [wBattleResult], a ret -.CountMonsRemaining: ; 2b995 +.CountMonsRemaining: ld c, 0 ld b, 3 ld de, PARTYMON_STRUCT_LENGTH - 1 @@ -74,7 +74,7 @@ DetermineLinkBattleResult: ; 2b930 jr nz, .loop ret -.CalcPercentHPRemaining: ; 2b9a6 +.CalcPercentHPRemaining: ld de, 0 ld c, $3 .loop2 @@ -117,7 +117,7 @@ DetermineLinkBattleResult: ; 2b930 jr nz, .loop2 ret -.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1 +.BothSides_CheckNumberMonsAtFullHealth: ld hl, wPartyMon1HP call .CheckFaintedOrFullHealth jr nz, .finish ; we have a pokemon that's neither fainted nor at full health @@ -136,7 +136,7 @@ DetermineLinkBattleResult: ; 2b930 and a ret -.CheckFaintedOrFullHealth: ; 2ba01 +.CheckFaintedOrFullHealth: ld d, 3 .loop3 ld a, [hli] diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index 705df3729..147430030 100644 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -1,4 +1,4 @@ -LoadBattleMenu: ; 24ef2 +LoadBattleMenu: ld hl, BattleMenuHeader call LoadMenuHeader ld a, [wBattleMenuCursorBuffer] @@ -8,21 +8,18 @@ LoadBattleMenu: ; 24ef2 ld [wBattleMenuCursorBuffer], a call ExitMenu ret -; 24f0b -SafariBattleMenu: ; 24f0b +SafariBattleMenu: ; untranslated ld hl, MenuHeader_0x24f4e call LoadMenuHeader jr Function24f19 -; 24f13 -ContestBattleMenu: ; 24f13 +ContestBattleMenu: ld hl, MenuHeader_0x24f89 call LoadMenuHeader -; 24f19 -Function24f19: ; 24f19 +Function24f19: ld a, [wBattleMenuCursorBuffer] ld [wMenuCursorBuffer], a call _2DMenu @@ -30,86 +27,74 @@ Function24f19: ; 24f19 ld [wBattleMenuCursorBuffer], a call ExitMenu ret -; 24f2c -BattleMenuHeader: ; 24f2c +BattleMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 8, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f34 db 1 ; default option -; 24f34 -MenuData_0x24f34: ; 0x24f34 +MenuData_0x24f34: db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 6 ; spacing dba Strings24f3d dbw BANK(MenuData_0x24f34), 0 -; 0x24f3d -Strings24f3d: ; 0x24f3d +Strings24f3d: db "FIGHT@" db "<PKMN>@" db "PACK@" db "RUN@" -; 24f4e -MenuHeader_0x24f4e: ; 24f4e +MenuHeader_0x24f4e: db MENU_BACKUP_TILES ; flags menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f56 db 1 ; default option -; 24f56 -MenuData_0x24f56: ; 24f56 +MenuData_0x24f56: db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 11 ; spacing dba Strings24f5f dba Function24f7c -; 24f5f -Strings24f5f: ; 24f5f +Strings24f5f: db "サファりボール× @" ; "SAFARI BALL× @" db "エサをなげる@" ; "THROW BAIT" db "いしをなげる@" ; "THROW ROCK" db "にげる@" ; "RUN" -; 24f7c -Function24f7c: ; 24f7c +Function24f7c: hlcoord 17, 13 ld de, wSafariBallsRemaining lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 24f89 -MenuHeader_0x24f89: ; 24f89 +MenuHeader_0x24f89: db MENU_BACKUP_TILES ; flags menu_coords 2, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f91 db 1 ; default option -; 24f91 -MenuData_0x24f91: ; 24f91 +MenuData_0x24f91: db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 12 ; spacing dba Strings24f9a dba Function24fb2 -; 24f9a -Strings24f9a: ; 24f9a +Strings24f9a: db "FIGHT@" db "<PKMN>", "@" db "PARKBALL× @" db "RUN@" -; 24fb2 -Function24fb2: ; 24fb2 +Function24fb2: hlcoord 13, 16 ld de, wParkBallsRemaining lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 24fbf diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 581f5381e..48062f643 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -1,4 +1,4 @@ -_DisappearUser: ; fbd54 +_DisappearUser: xor a ld [hBGMapMode], a ld a, [hBattleTurn] @@ -12,14 +12,14 @@ _DisappearUser: ; fbd54 call ClearBox jr FinishAppearDisappearUser -_AppearUserRaiseSub: ; fbd69 (3e:7d69) +_AppearUserRaiseSub: farcall BattleCommand_RaiseSubNoAnim jr AppearUser -_AppearUserLowerSub: ; fbd71 (3e:7d71) +_AppearUserLowerSub: farcall BattleCommand_LowerSubNoAnim -AppearUser: ; fbd77 (3e:7d77) +AppearUser: xor a ld [hBGMapMode], a ld a, [hBattleTurn] @@ -34,24 +34,22 @@ AppearUser: ; fbd77 (3e:7d77) .okay ld [hGraphicStartTile], a predef PlaceGraphic -FinishAppearDisappearUser: ; fbd91 (3e:7d91) +FinishAppearDisappearUser: ld a, $1 ld [hBGMapMode], a ret -GetEnemyFrontpicCoords: ; fbd96 (3e:7d96) +GetEnemyFrontpicCoords: hlcoord 12, 0 lb bc, 7, 7 ret -GetPlayerBackpicCoords: ; fbd9d (3e:7d9d) +GetPlayerBackpicCoords: hlcoord 2, 6 lb bc, 6, 6 ret - -DoWeatherModifiers: ; fbda4 - +DoWeatherModifiers: ld de, WeatherTypeModifiers ld a, [wBattleWeather] ld b, a @@ -76,7 +74,6 @@ DoWeatherModifiers: ; fbda4 inc de jr .CheckWeatherType - .done_weather_types ld de, WeatherMoveModifiers @@ -147,8 +144,7 @@ DoWeatherModifiers: ; fbda4 INCLUDE "data/battle/weather_modifiers.asm" - -DoBadgeTypeBoosts: ; fbe24 +DoBadgeTypeBoosts: ld a, [wLinkMode] and a ret nz diff --git a/engine/battle/move_effects/attract.asm b/engine/battle/move_effects/attract.asm index 026176694..bb7b4fce4 100644 --- a/engine/battle/move_effects/attract.asm +++ b/engine/battle/move_effects/attract.asm @@ -1,4 +1,4 @@ -BattleCommand_Attract: ; 377ce +BattleCommand_Attract: ; attract ld a, [wAttackMissed] and a @@ -21,10 +21,8 @@ BattleCommand_Attract: ; 377ce .failed jp FailMove -; 377f5 - -CheckOppositeGender: ; 377f5 +CheckOppositeGender: ld a, MON_SPECIES call BattlePartyAttr ld a, [hl] @@ -76,4 +74,3 @@ CheckOppositeGender: ; 377f5 .genderless_samegender scf ret -; 3784b diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm index 369565877..5d9f19838 100644 --- a/engine/battle/move_effects/baton_pass.asm +++ b/engine/battle/move_effects/baton_pass.asm @@ -1,11 +1,10 @@ -BattleCommand_BatonPass: ; 379c9 +BattleCommand_BatonPass: ; batonpass ld a, [hBattleTurn] and a jp nz, .Enemy - ; Need something to switch to call CheckAnyOtherAlivePartyMons jp z, FailedBatonPass @@ -45,9 +44,7 @@ BattleCommand_BatonPass: ; 379c9 call ResetBatonPassStatus ret - .Enemy: - ; Wildmons don't have anything to switch to ld a, [wBattleMode] dec a ; WILDMON @@ -81,10 +78,7 @@ BattleCommand_BatonPass: ; 379c9 jr ResetBatonPassStatus -; 37a67 - - -BatonPass_LinkPlayerSwitch: ; 37a67 +BatonPass_LinkPlayerSwitch: ld a, [wLinkMode] and a ret z @@ -101,10 +95,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 ld [wBattlePlayerAction], a ret -; 37a82 - - -BatonPass_LinkEnemySwitch: ; 37a82 +BatonPass_LinkEnemySwitch: ld a, [wLinkMode] and a ret z @@ -129,17 +120,11 @@ BatonPass_LinkEnemySwitch: ; 37a82 .switch jp CloseWindow -; 37aab - - -FailedBatonPass: ; 37aab +FailedBatonPass: call AnimateFailedMove jp PrintButItFailed -; 37ab1 - - -ResetBatonPassStatus: ; 37ab1 +ResetBatonPassStatus: ; Reset status changes that aren't passed by Baton Pass. ; Nightmare isn't passed. @@ -178,10 +163,7 @@ ResetBatonPassStatus: ; 37ab1 ld [wEnemyWrapCount], a ret -; 37ae9 - - -CheckAnyOtherAlivePartyMons: ; 37ae9 +CheckAnyOtherAlivePartyMons: ld hl, wPartyMon1HP ld a, [wPartyCount] ld d, a @@ -189,10 +171,7 @@ CheckAnyOtherAlivePartyMons: ; 37ae9 ld e, a jr CheckAnyOtherAliveMons -; 37af6 - - -CheckAnyOtherAliveEnemyMons: ; 37af6 +CheckAnyOtherAliveEnemyMons: ld hl, wOTPartyMon1HP ld a, [wOTPartyCount] ld d, a @@ -200,9 +179,8 @@ CheckAnyOtherAliveEnemyMons: ; 37af6 ld e, a ; fallthrough -; 37b01 -CheckAnyOtherAliveMons: ; 37b01 +CheckAnyOtherAliveMons: ; Check for nonzero HP starting from partymon ; HP at hl for d partymons, besides current mon e. @@ -237,5 +215,3 @@ CheckAnyOtherAliveMons: ; 37b01 ld a, b and a ret - -; 37b1d diff --git a/engine/battle/move_effects/beat_up.asm b/engine/battle/move_effects/beat_up.asm index 8ea308d90..673fc46c6 100644 --- a/engine/battle/move_effects/beat_up.asm +++ b/engine/battle/move_effects/beat_up.asm @@ -1,4 +1,4 @@ -BattleCommand_BeatUp: ; 35461 +BattleCommand_BeatUp: ; beatup call ResetDamage @@ -193,17 +193,11 @@ BattleCommand_BeatUp: ; 35461 ld d, a ret -; 355b0 - - -.beatup_fail ; 355b0 +.beatup_fail ld b, buildopponentrage_command jp SkipToBattleCommand -; 355b5 - - -BattleCommand_BeatUpFailText: ; 355b5 +BattleCommand_BeatUpFailText: ; beatupfailtext ld a, [wBeatUpHitAtLeastOnce] @@ -212,10 +206,7 @@ BattleCommand_BeatUpFailText: ; 355b5 jp PrintButItFailed -; 355bd - - -GetBeatupMonLocation: ; 355bd +GetBeatupMonLocation: push bc ld c, a ld b, 0 diff --git a/engine/battle/move_effects/belly_drum.asm b/engine/battle/move_effects/belly_drum.asm index bd300c9cd..27ef1a542 100644 --- a/engine/battle/move_effects/belly_drum.asm +++ b/engine/battle/move_effects/belly_drum.asm @@ -1,4 +1,4 @@ -BattleCommand_BellyDrum: ; 37c1a +BattleCommand_BellyDrum: ; bellydrum ; This command is buggy because it raises the user's attack ; before checking that it has enough HP to use the move. @@ -32,5 +32,3 @@ BattleCommand_BellyDrum: ; 37c1a .failed call AnimateFailedMove jp PrintButItFailed - -; 37c55 diff --git a/engine/battle/move_effects/bide.asm b/engine/battle/move_effects/bide.asm index d9958ca53..871e0e7a8 100644 --- a/engine/battle/move_effects/bide.asm +++ b/engine/battle/move_effects/bide.asm @@ -1,4 +1,4 @@ -BattleCommand_StoreEnergy: ; 36671 +BattleCommand_StoreEnergy: ; storeenergy ld a, BATTLE_VARS_SUBSTATUS3 @@ -69,10 +69,7 @@ BattleCommand_StoreEnergy: ; 36671 call StdBattleTextBox jp EndMoveEffect -; 366e5 - - -BattleCommand_UnleashEnergy: ; 366e5 +BattleCommand_UnleashEnergy: ; unleashenergy ld de, wPlayerDamageTaken @@ -101,5 +98,3 @@ BattleCommand_UnleashEnergy: ; 366e5 ld [wKickCounter], a call AnimateCurrentMove jp EndMoveEffect - -; 3671a diff --git a/engine/battle/move_effects/conversion.asm b/engine/battle/move_effects/conversion.asm index d66d23a5e..f9307056c 100644 --- a/engine/battle/move_effects/conversion.asm +++ b/engine/battle/move_effects/conversion.asm @@ -1,4 +1,4 @@ -BattleCommand_Conversion: ; 3707f +BattleCommand_Conversion: ; conversion ld hl, wBattleMonMoves @@ -94,5 +94,3 @@ BattleCommand_Conversion: ; 3707f call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox - -; 3710e diff --git a/engine/battle/move_effects/conversion2.asm b/engine/battle/move_effects/conversion2.asm index c0e390926..14a7e257a 100644 --- a/engine/battle/move_effects/conversion2.asm +++ b/engine/battle/move_effects/conversion2.asm @@ -1,4 +1,4 @@ -BattleCommand_Conversion2: ; 359e6 +BattleCommand_Conversion2: ; conversion2 ld a, [wAttackMissed] @@ -62,5 +62,3 @@ BattleCommand_Conversion2: ; 359e6 .failed jp FailMove - -; 35a53 diff --git a/engine/battle/move_effects/counter.asm b/engine/battle/move_effects/counter.asm index 9948ebcbd..031c399a6 100644 --- a/engine/battle/move_effects/counter.asm +++ b/engine/battle/move_effects/counter.asm @@ -1,4 +1,4 @@ -BattleCommand_Counter: ; 35813 +BattleCommand_Counter: ; counter ld a, 1 @@ -57,5 +57,3 @@ BattleCommand_Counter: ; 35813 xor a ld [wAttackMissed], a ret - -; 35864 diff --git a/engine/battle/move_effects/curse.asm b/engine/battle/move_effects/curse.asm index b11b9f3fb..4861e9a37 100644 --- a/engine/battle/move_effects/curse.asm +++ b/engine/battle/move_effects/curse.asm @@ -1,4 +1,4 @@ -BattleCommand_Curse: ; 37588 +BattleCommand_Curse: ; curse ld de, wBattleMonType1 @@ -21,7 +21,6 @@ BattleCommand_Curse: ; 37588 cp GHOST jr z, .ghost - ; If no stats can be increased, don't. ; Attack @@ -54,7 +53,6 @@ BattleCommand_Curse: ; 37588 call BattleCommand_DefenseUp jp BattleCommand_StatUpMessage - .ghost ; Cut HP in half and put a curse on the opponent. @@ -84,7 +82,6 @@ BattleCommand_Curse: ; 37588 call AnimateFailedMove jp PrintButItFailed - .cantraise ; Can't raise either stat. @@ -94,4 +91,3 @@ BattleCommand_Curse: ; 37588 call AnimateFailedMove ld hl, WontRiseAnymoreText jp StdBattleTextBox -; 37618 diff --git a/engine/battle/move_effects/destiny_bond.asm b/engine/battle/move_effects/destiny_bond.asm index 2dc125ddf..55809d98a 100644 --- a/engine/battle/move_effects/destiny_bond.asm +++ b/engine/battle/move_effects/destiny_bond.asm @@ -1,4 +1,4 @@ -BattleCommand_DestinyBond: ; 35bff +BattleCommand_DestinyBond: ; destinybond ld a, BATTLE_VARS_SUBSTATUS5 @@ -7,5 +7,3 @@ BattleCommand_DestinyBond: ; 35bff call AnimateCurrentMove ld hl, DestinyBondEffectText jp StdBattleTextBox - -; 35c0f diff --git a/engine/battle/move_effects/disable.asm b/engine/battle/move_effects/disable.asm index 5df785d24..44017e30d 100644 --- a/engine/battle/move_effects/disable.asm +++ b/engine/battle/move_effects/disable.asm @@ -1,4 +1,4 @@ -BattleCommand_Disable: ; 36fed +BattleCommand_Disable: ; disable ld a, [wAttackMissed] @@ -70,5 +70,3 @@ BattleCommand_Disable: ; 36fed .failed jp FailMove - -; 3705c diff --git a/engine/battle/move_effects/encore.asm b/engine/battle/move_effects/encore.asm index e6607fb11..f436fd970 100644 --- a/engine/battle/move_effects/encore.asm +++ b/engine/battle/move_effects/encore.asm @@ -1,4 +1,4 @@ -BattleCommand_Encore: ; 35864 +BattleCommand_Encore: ; encore ld hl, wEnemyMonMoves @@ -118,5 +118,3 @@ BattleCommand_Encore: ; 35864 .failed jp PrintDidntAffect2 - -; 35926 diff --git a/engine/battle/move_effects/endure.asm b/engine/battle/move_effects/endure.asm index ed4329ff5..f0555a737 100644 --- a/engine/battle/move_effects/endure.asm +++ b/engine/battle/move_effects/endure.asm @@ -1,4 +1,4 @@ -BattleCommand_Endure: ; 3766f +BattleCommand_Endure: ; endure ; Endure shares code with Protect. See protect.asm. @@ -14,4 +14,3 @@ BattleCommand_Endure: ; 3766f ld hl, BracedItselfText jp StdBattleTextBox -; 37683 diff --git a/engine/battle/move_effects/false_swipe.asm b/engine/battle/move_effects/false_swipe.asm index f00de91e7..4f4eb329c 100644 --- a/engine/battle/move_effects/false_swipe.asm +++ b/engine/battle/move_effects/false_swipe.asm @@ -1,4 +1,4 @@ -BattleCommand_FalseSwipe: ; 35c94 +BattleCommand_FalseSwipe: ; falseswipe ; Makes sure wCurDamage < MonHP @@ -46,5 +46,3 @@ BattleCommand_FalseSwipe: ; 35c94 .done and a ret - -; 35cc9 diff --git a/engine/battle/move_effects/focus_energy.asm b/engine/battle/move_effects/focus_energy.asm index 2a3726c53..ffdc7b136 100644 --- a/engine/battle/move_effects/focus_energy.asm +++ b/engine/battle/move_effects/focus_energy.asm @@ -1,4 +1,4 @@ -BattleCommand_FocusEnergy: ; 36c98 +BattleCommand_FocusEnergy: ; focusenergy ld a, BATTLE_VARS_SUBSTATUS4 @@ -13,5 +13,3 @@ BattleCommand_FocusEnergy: ; 36c98 .already_pumped call AnimateFailedMove jp PrintButItFailed - -; 36cb2 diff --git a/engine/battle/move_effects/foresight.asm b/engine/battle/move_effects/foresight.asm index 8c51bb220..4235e0878 100644 --- a/engine/battle/move_effects/foresight.asm +++ b/engine/battle/move_effects/foresight.asm @@ -1,4 +1,4 @@ -BattleCommand_Foresight: ; 376a0 +BattleCommand_Foresight: ; foresight ld a, [wAttackMissed] @@ -20,4 +20,3 @@ BattleCommand_Foresight: ; 376a0 .failed jp FailMove -; 376c2 diff --git a/engine/battle/move_effects/frustration.asm b/engine/battle/move_effects/frustration.asm index 3f8456ced..3d395b510 100644 --- a/engine/battle/move_effects/frustration.asm +++ b/engine/battle/move_effects/frustration.asm @@ -1,4 +1,4 @@ -BattleCommand_FrustrationPower: ; 3790e +BattleCommand_FrustrationPower: ; frustrationpower push bc @@ -25,5 +25,3 @@ BattleCommand_FrustrationPower: ; 3790e ld d, a pop bc ret - -; 37939 diff --git a/engine/battle/move_effects/fury_cutter.asm b/engine/battle/move_effects/fury_cutter.asm index 91679368f..6aa6b7838 100644 --- a/engine/battle/move_effects/fury_cutter.asm +++ b/engine/battle/move_effects/fury_cutter.asm @@ -1,4 +1,4 @@ -BattleCommand_FuryCutter: ; 37792 +BattleCommand_FuryCutter: ; furycutter ld hl, wPlayerFuryCutterCount @@ -38,11 +38,7 @@ BattleCommand_FuryCutter: ; 37792 ld [hl], a ret -; 377be - - -ResetFuryCutterCount: ; 377be - +ResetFuryCutterCount: push hl ld hl, wPlayerFuryCutterCount @@ -57,5 +53,3 @@ ResetFuryCutterCount: ; 377be pop hl ret - -; 377ce diff --git a/engine/battle/move_effects/future_sight.asm b/engine/battle/move_effects/future_sight.asm index fa2148ab7..c28841b35 100644 --- a/engine/battle/move_effects/future_sight.asm +++ b/engine/battle/move_effects/future_sight.asm @@ -1,4 +1,4 @@ -BattleCommand_CheckFutureSight: ; 37d0d +BattleCommand_CheckFutureSight: ; checkfuturesight ld hl, wPlayerFutureSightCount @@ -25,9 +25,7 @@ BattleCommand_CheckFutureSight: ; 37d0d ld b, futuresight_command jp SkipToBattleCommand -; 37d34 - -BattleCommand_FutureSight: ; 37d34 +BattleCommand_FutureSight: ; futuresight call CheckUserIsCharging @@ -81,5 +79,3 @@ BattleCommand_FutureSight: ; 37d34 call AnimateFailedMove call PrintButItFailed jp EndMoveEffect - -; 37d94 diff --git a/engine/battle/move_effects/heal_bell.asm b/engine/battle/move_effects/heal_bell.asm index c79362f9c..2570a53ba 100644 --- a/engine/battle/move_effects/heal_bell.asm +++ b/engine/battle/move_effects/heal_bell.asm @@ -1,4 +1,4 @@ -BattleCommand_HealBell: ; 35cc9 +BattleCommand_HealBell: ; healbell ld a, BATTLE_VARS_SUBSTATUS1 @@ -32,5 +32,3 @@ BattleCommand_HealBell: ; 35cc9 and a jp z, CalcPlayerStats jp CalcEnemyStats - -; 35d00 diff --git a/engine/battle/move_effects/hidden_power.asm b/engine/battle/move_effects/hidden_power.asm index f96becf97..3b40a6c31 100644 --- a/engine/battle/move_effects/hidden_power.asm +++ b/engine/battle/move_effects/hidden_power.asm @@ -1,4 +1,4 @@ -BattleCommand_HiddenPower: ; 37be8 +BattleCommand_HiddenPower: ; hiddenpower ld a, [wAttackMissed] @@ -6,5 +6,3 @@ BattleCommand_HiddenPower: ; 37be8 ret nz farcall HiddenPowerDamage ret - -; 37bf4 diff --git a/engine/battle/move_effects/leech_seed.asm b/engine/battle/move_effects/leech_seed.asm index 328a2c416..5602e7f62 100644 --- a/engine/battle/move_effects/leech_seed.asm +++ b/engine/battle/move_effects/leech_seed.asm @@ -1,4 +1,4 @@ -BattleCommand_LeechSeed: ; 36f9d +BattleCommand_LeechSeed: ; leechseed ld a, [wAttackMissed] and a @@ -38,5 +38,3 @@ BattleCommand_LeechSeed: ; 36f9d call AnimateFailedMove ld hl, EvadedText jp StdBattleTextBox - -; 36fe1 diff --git a/engine/battle/move_effects/lock_on.asm b/engine/battle/move_effects/lock_on.asm index 36d8db926..7dc4a013d 100644 --- a/engine/battle/move_effects/lock_on.asm +++ b/engine/battle/move_effects/lock_on.asm @@ -1,4 +1,4 @@ -BattleCommand_LockOn: ; 35a53 +BattleCommand_LockOn: ; lockon call CheckSubstituteOpp @@ -19,5 +19,3 @@ BattleCommand_LockOn: ; 35a53 .fail call AnimateFailedMove jp PrintDidntAffect - -; 35a74 diff --git a/engine/battle/move_effects/magnitude.asm b/engine/battle/move_effects/magnitude.asm index f56ec5c1b..4dcf919d7 100644 --- a/engine/battle/move_effects/magnitude.asm +++ b/engine/battle/move_effects/magnitude.asm @@ -1,4 +1,4 @@ -BattleCommand_GetMagnitude: ; 37991 +BattleCommand_GetMagnitude: ; getmagnitude push bc diff --git a/engine/battle/move_effects/metronome.asm b/engine/battle/move_effects/metronome.asm index 6835ab569..25197d7cd 100644 --- a/engine/battle/move_effects/metronome.asm +++ b/engine/battle/move_effects/metronome.asm @@ -1,4 +1,4 @@ -BattleCommand_Metronome: ; 37418 +BattleCommand_Metronome: ; metronome call ClearLastMove @@ -34,13 +34,10 @@ BattleCommand_Metronome: ; 37418 call CheckUserMove jr z, .GetMove - ld a, BATTLE_VARS_MOVE call GetBattleVarAddr ld [hl], b call UpdateMoveData jp ResetTurn -; 37454 - -INCLUDE "data/battle/metronome_exception_moves.asm" +INCLUDE "data/moves/metronome_exception_moves.asm" diff --git a/engine/battle/move_effects/mimic.asm b/engine/battle/move_effects/mimic.asm index 712b42df1..b1c6608fa 100644 --- a/engine/battle/move_effects/mimic.asm +++ b/engine/battle/move_effects/mimic.asm @@ -1,4 +1,4 @@ -BattleCommand_Mimic: ; 36f46 +BattleCommand_Mimic: ; mimic call ClearLastMove @@ -48,5 +48,3 @@ BattleCommand_Mimic: ; 36f46 .fail jp FailMimic - -; 36f9d diff --git a/engine/battle/move_effects/mirror_coat.asm b/engine/battle/move_effects/mirror_coat.asm index dcdd9c2f3..fb3a30d58 100644 --- a/engine/battle/move_effects/mirror_coat.asm +++ b/engine/battle/move_effects/mirror_coat.asm @@ -1,4 +1,4 @@ -BattleCommand_MirrorCoat: ; 37c95 +BattleCommand_MirrorCoat: ; mirrorcoat ld a, 1 @@ -58,5 +58,3 @@ BattleCommand_MirrorCoat: ; 37c95 xor a ld [wAttackMissed], a ret - -; 37ce6 diff --git a/engine/battle/move_effects/mirror_move.asm b/engine/battle/move_effects/mirror_move.asm index c4f208d77..089403839 100644 --- a/engine/battle/move_effects/mirror_move.asm +++ b/engine/battle/move_effects/mirror_move.asm @@ -1,4 +1,4 @@ -BattleCommand_MirrorMove: ; 373c9 +BattleCommand_MirrorMove: ; mirrormove call ClearLastMove @@ -49,4 +49,3 @@ BattleCommand_MirrorMove: ; 373c9 .done call BattleCommand_MoveDelay jp ResetTurn -; 37418 diff --git a/engine/battle/move_effects/mist.asm b/engine/battle/move_effects/mist.asm index 9ffd86c8e..199a30045 100644 --- a/engine/battle/move_effects/mist.asm +++ b/engine/battle/move_effects/mist.asm @@ -1,4 +1,4 @@ -BattleCommand_Mist: ; 36c7e +BattleCommand_Mist: ; mist ld a, BATTLE_VARS_SUBSTATUS4 @@ -13,5 +13,3 @@ BattleCommand_Mist: ; 36c7e .already_mist call AnimateFailedMove jp PrintButItFailed - -; 36c98 diff --git a/engine/battle/move_effects/nightmare.asm b/engine/battle/move_effects/nightmare.asm index 788e3de41..dd85c722d 100644 --- a/engine/battle/move_effects/nightmare.asm +++ b/engine/battle/move_effects/nightmare.asm @@ -1,4 +1,4 @@ -BattleCommand_Nightmare: ; 37536 +BattleCommand_Nightmare: ; nightmare ; Can't hit an absent opponent. @@ -35,4 +35,3 @@ BattleCommand_Nightmare: ; 37536 .failed call AnimateFailedMove jp PrintButItFailed -; 37563 diff --git a/engine/battle/move_effects/pain_split.asm b/engine/battle/move_effects/pain_split.asm index 2db3726c6..4e4380b23 100644 --- a/engine/battle/move_effects/pain_split.asm +++ b/engine/battle/move_effects/pain_split.asm @@ -1,4 +1,4 @@ -BattleCommand_PainSplit: ; 35926 +BattleCommand_PainSplit: ; painsplit ld a, [wAttackMissed] @@ -65,7 +65,7 @@ BattleCommand_PainSplit: ; 35926 inc de inc de -.EnemyShareHP: ; 359ac +.EnemyShareHP: ld c, [hl] dec hl ld a, [wCurDamage + 1] @@ -89,9 +89,5 @@ BattleCommand_PainSplit: ; 35926 ld [wBuffer6], a ret -; 359cd - .ButItFailed: jp PrintDidntAffect2 - -; 359d0 diff --git a/engine/battle/move_effects/pay_day.asm b/engine/battle/move_effects/pay_day.asm index a5d2fed0d..ba1dce884 100644 --- a/engine/battle/move_effects/pay_day.asm +++ b/engine/battle/move_effects/pay_day.asm @@ -1,4 +1,4 @@ -BattleCommand_PayDay: ; 3705c +BattleCommand_PayDay: ; payday xor a @@ -24,5 +24,3 @@ BattleCommand_PayDay: ; 3705c .done ld hl, CoinsScatteredText jp StdBattleTextBox - -; 3707f diff --git a/engine/battle/move_effects/perish_song.asm b/engine/battle/move_effects/perish_song.asm index 8c88c8739..4df52cc1c 100644 --- a/engine/battle/move_effects/perish_song.asm +++ b/engine/battle/move_effects/perish_song.asm @@ -1,7 +1,6 @@ -BattleCommand_PerishSong: ; 376c2 +BattleCommand_PerishSong: ; perishsong - ld hl, wPlayerSubStatus1 ld de, wEnemySubStatus1 bit SUBSTATUS_PERISH, [hl] @@ -37,4 +36,3 @@ BattleCommand_PerishSong: ; 376c2 .failed call AnimateFailedMove jp PrintButItFailed -; 376f8 diff --git a/engine/battle/move_effects/present.asm b/engine/battle/move_effects/present.asm index a2ef5bc64..f0949558f 100644 --- a/engine/battle/move_effects/present.asm +++ b/engine/battle/move_effects/present.asm @@ -1,4 +1,4 @@ -BattleCommand_Present: ; 37874 +BattleCommand_Present: ; present ld a, [wLinkMode] @@ -32,12 +32,12 @@ BattleCommand_Present: ; 37874 .next ld a, [hli] cp -1 - jr z, .heal_effect ; 378a4 $11 + jr z, .heal_effect cp b - jr nc, .got_power ; 378a7 $4 + jr nc, .got_power inc c inc hl - jr .next ; 378ab $f4 + jr .next .got_power ld a, c @@ -56,12 +56,12 @@ BattleCommand_Present: ; 37874 ld hl, AICheckPlayerMaxHP ld a, [hBattleTurn] and a - jr z, .got_hp_fn_pointer ; 378c9 $3 + jr z, .got_hp_fn_pointer ld hl, AICheckEnemyMaxHP .got_hp_fn_pointer ld a, BANK(AICheckPlayerMaxHP) rst FarCall - jr c, .already_fully_healed ; 378d1 $20 + jr c, .already_fully_healed ld hl, GetQuarterMaxHP call CallBattleCore @@ -73,12 +73,12 @@ BattleCommand_Present: ; 37874 call StdBattleTextBox call BattleCommand_SwitchTurn call UpdateOpponentInParty - jr .do_animation ; 378f1 $11 + jr .do_animation .already_fully_healed call BattleCommand_SwitchTurn call _CheckBattleScene - jr nc, .do_animation ; 378f9 $9 + jr nc, .do_animation call AnimateFailedMove ld hl, RefusedGiftText call StdBattleTextBox diff --git a/engine/battle/move_effects/protect.asm b/engine/battle/move_effects/protect.asm index 6c65e0ed1..9025d2f4b 100644 --- a/engine/battle/move_effects/protect.asm +++ b/engine/battle/move_effects/protect.asm @@ -1,4 +1,4 @@ -BattleCommand_Protect: ; 37618 +BattleCommand_Protect: ; protect call ProtectChance ret c @@ -11,11 +11,8 @@ BattleCommand_Protect: ; 37618 ld hl, ProtectedItselfText jp StdBattleTextBox -; 3762c - - -ProtectChance: ; 3762c +ProtectChance: ld de, wPlayerProtectCount ld a, [hBattleTurn] and a @@ -69,7 +66,6 @@ ProtectChance: ; 3762c and a ret - .failed xor a ld [de], a @@ -77,4 +73,3 @@ ProtectChance: ; 3762c call PrintButItFailed scf ret -; 3766f diff --git a/engine/battle/move_effects/psych_up.asm b/engine/battle/move_effects/psych_up.asm index c57fff9cd..02fdef5d2 100644 --- a/engine/battle/move_effects/psych_up.asm +++ b/engine/battle/move_effects/psych_up.asm @@ -1,4 +1,4 @@ -BattleCommand_PsychUp: ; 37c55 +BattleCommand_PsychUp: ; psychup ld hl, wEnemyStatLevels @@ -47,5 +47,3 @@ BattleCommand_PsychUp: ; 37c55 call AnimateCurrentMove ld hl, CopiedStatsText jp StdBattleTextBox - -; 37c95 diff --git a/engine/battle/move_effects/pursuit.asm b/engine/battle/move_effects/pursuit.asm index 969e08f73..18c358144 100644 --- a/engine/battle/move_effects/pursuit.asm +++ b/engine/battle/move_effects/pursuit.asm @@ -1,4 +1,4 @@ -BattleCommand_Pursuit: ; 37b1d +BattleCommand_Pursuit: ; pursuit ; Double damage if the opponent is switching. @@ -22,5 +22,3 @@ BattleCommand_Pursuit: ; 37b1d ld [hli], a ld [hl], a ret - -; 37b39 diff --git a/engine/battle/move_effects/rage.asm b/engine/battle/move_effects/rage.asm index ac01f8137..df206a6bf 100644 --- a/engine/battle/move_effects/rage.asm +++ b/engine/battle/move_effects/rage.asm @@ -1,8 +1,6 @@ -BattleCommand_Rage: ; 36f1d +BattleCommand_Rage: ; rage ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr set SUBSTATUS_RAGE, [hl] ret - -; 36f25 diff --git a/engine/battle/move_effects/rain_dance.asm b/engine/battle/move_effects/rain_dance.asm index 6c587d551..e9ef5d123 100644 --- a/engine/battle/move_effects/rain_dance.asm +++ b/engine/battle/move_effects/rain_dance.asm @@ -1,4 +1,4 @@ -BattleCommand_StartRain: ; 37bf4 +BattleCommand_StartRain: ; startrain ld a, WEATHER_RAIN ld [wBattleWeather], a @@ -7,5 +7,3 @@ BattleCommand_StartRain: ; 37bf4 call AnimateCurrentMove ld hl, DownpourText jp StdBattleTextBox - -; 37c07 diff --git a/engine/battle/move_effects/rapid_spin.asm b/engine/battle/move_effects/rapid_spin.asm index 84bcbad7f..0dc8b7de2 100644 --- a/engine/battle/move_effects/rapid_spin.asm +++ b/engine/battle/move_effects/rapid_spin.asm @@ -1,4 +1,4 @@ -BattleCommand_ClearHazards: ; 37b39 +BattleCommand_ClearHazards: ; clearhazards ld a, BATTLE_VARS_SUBSTATUS4 @@ -34,5 +34,3 @@ BattleCommand_ClearHazards: ; 37b39 ld [de], a ld hl, ReleasedByText jp StdBattleTextBox - -; 37b74 diff --git a/engine/battle/move_effects/return.asm b/engine/battle/move_effects/return.asm index e1d568e7c..d3071d23a 100644 --- a/engine/battle/move_effects/return.asm +++ b/engine/battle/move_effects/return.asm @@ -1,4 +1,4 @@ -BattleCommand_HappinessPower: ; 3784b +BattleCommand_HappinessPower: ; happinesspower push bc ld hl, wBattleMonHappiness @@ -23,5 +23,3 @@ BattleCommand_HappinessPower: ; 3784b ld d, a pop bc ret - -; 37874 diff --git a/engine/battle/move_effects/rollout.asm b/engine/battle/move_effects/rollout.asm index f6966c48a..de4bfcaa6 100644 --- a/engine/battle/move_effects/rollout.asm +++ b/engine/battle/move_effects/rollout.asm @@ -1,7 +1,6 @@ MAX_ROLLOUT_COUNT EQU 5 - -BattleCommand_CheckCurl: ; 37718 +BattleCommand_CheckCurl: ; checkcurl ld de, wPlayerRolloutCount @@ -22,10 +21,8 @@ BattleCommand_CheckCurl: ; 37718 xor a ld [de], a ret -; 37734 - -BattleCommand_RolloutPower: ; 37734 +BattleCommand_RolloutPower: ; rolloutpower ld a, BATTLE_VARS_STATUS @@ -96,4 +93,3 @@ BattleCommand_RolloutPower: ; 37734 .done_damage ret -; 37791 diff --git a/engine/battle/move_effects/safeguard.asm b/engine/battle/move_effects/safeguard.asm index 1dc233eab..a926bdccc 100644 --- a/engine/battle/move_effects/safeguard.asm +++ b/engine/battle/move_effects/safeguard.asm @@ -1,4 +1,4 @@ -BattleCommand_Safeguard: ; 37939 +BattleCommand_Safeguard: ; safeguard ld hl, wPlayerScreens @@ -21,5 +21,3 @@ BattleCommand_Safeguard: ; 37939 .failed call AnimateFailedMove jp PrintButItFailed - -; 37962 diff --git a/engine/battle/move_effects/sandstorm.asm b/engine/battle/move_effects/sandstorm.asm index 5aaa61deb..77d6e24b5 100644 --- a/engine/battle/move_effects/sandstorm.asm +++ b/engine/battle/move_effects/sandstorm.asm @@ -1,4 +1,4 @@ -BattleCommand_StartSandstorm: ; 376f8 +BattleCommand_StartSandstorm: ; startsandstorm ld a, [wBattleWeather] @@ -16,4 +16,3 @@ BattleCommand_StartSandstorm: ; 376f8 .failed call AnimateFailedMove jp PrintButItFailed -; 37718 diff --git a/engine/battle/move_effects/selfdestruct.asm b/engine/battle/move_effects/selfdestruct.asm index 6f6b0966f..d6eeac484 100644 --- a/engine/battle/move_effects/selfdestruct.asm +++ b/engine/battle/move_effects/selfdestruct.asm @@ -1,4 +1,4 @@ -BattleCommand_Selfdestruct: ; 37380 +BattleCommand_Selfdestruct: farcall StubbedTrainerRankings_Selfdestruct ld a, BATTLEANIM_PLAYER_DAMAGE ld [wNumHits], a @@ -27,5 +27,3 @@ BattleCommand_Selfdestruct: ; 37380 farcall DrawEnemyHUD call WaitBGMap jp RefreshBattleHuds - -; 373c9 diff --git a/engine/battle/move_effects/sketch.asm b/engine/battle/move_effects/sketch.asm index 93f7ff30c..4c15dbe02 100644 --- a/engine/battle/move_effects/sketch.asm +++ b/engine/battle/move_effects/sketch.asm @@ -1,4 +1,4 @@ -BattleCommand_Sketch: ; 35a74 +BattleCommand_Sketch: ; sketch call ClearLastMove @@ -115,5 +115,3 @@ BattleCommand_Sketch: ; 35a74 .fail call AnimateFailedMove jp PrintDidntAffect - -; 35b16 diff --git a/engine/battle/move_effects/sleep_talk.asm b/engine/battle/move_effects/sleep_talk.asm index 3f62d4e36..ae2d252b7 100644 --- a/engine/battle/move_effects/sleep_talk.asm +++ b/engine/battle/move_effects/sleep_talk.asm @@ -1,4 +1,4 @@ -BattleCommand_SleepTalk: ; 35b33 +BattleCommand_SleepTalk: ; sleeptalk call ClearLastMove @@ -141,5 +141,3 @@ BattleCommand_SleepTalk: ; 35b33 ret z cp EFFECT_BIDE ret - -; 35bff diff --git a/engine/battle/move_effects/snore.asm b/engine/battle/move_effects/snore.asm index 49fb1b210..e2432c59f 100644 --- a/engine/battle/move_effects/snore.asm +++ b/engine/battle/move_effects/snore.asm @@ -1,4 +1,4 @@ -BattleCommand_Snore: ; 359d0 +BattleCommand_Snore: ; snore ld a, BATTLE_VARS_STATUS call GetBattleVar @@ -9,5 +9,3 @@ BattleCommand_Snore: ; 359d0 ld [wAttackMissed], a call FailMove jp EndMoveEffect - -; 359e6 diff --git a/engine/battle/move_effects/spikes.asm b/engine/battle/move_effects/spikes.asm index 6cab0b96f..1eca7ae53 100644 --- a/engine/battle/move_effects/spikes.asm +++ b/engine/battle/move_effects/spikes.asm @@ -1,4 +1,4 @@ -BattleCommand_Spikes: ; 37683 +BattleCommand_Spikes: ; spikes ld hl, wEnemyScreens @@ -24,4 +24,3 @@ BattleCommand_Spikes: ; 37683 .failed jp FailMove -; 376a0 diff --git a/engine/battle/move_effects/spite.asm b/engine/battle/move_effects/spite.asm index 30a908ae7..8aba187a4 100644 --- a/engine/battle/move_effects/spite.asm +++ b/engine/battle/move_effects/spite.asm @@ -1,4 +1,4 @@ -BattleCommand_Spite: ; 35c0f +BattleCommand_Spite: ; spite ld a, [wAttackMissed] @@ -84,5 +84,3 @@ BattleCommand_Spite: ; 35c0f .failed jp PrintDidntAffect2 - -; 35c94 diff --git a/engine/battle/move_effects/splash.asm b/engine/battle/move_effects/splash.asm index 5b5e504b8..493ea8ca6 100644 --- a/engine/battle/move_effects/splash.asm +++ b/engine/battle/move_effects/splash.asm @@ -1,6 +1,4 @@ -BattleCommand_Splash: ; 36fe1 +BattleCommand_Splash: call AnimateCurrentMove farcall StubbedTrainerRankings_Splash jp PrintNothingHappened - -; 36fed diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index 1deaa848d..8f14bc315 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -1,4 +1,4 @@ -BattleCommand_Substitute: ; 36e7c +BattleCommand_Substitute: ; substitute call BattleCommand_MoveDelay @@ -86,5 +86,3 @@ BattleCommand_Substitute: ; 36e7c ld hl, TooWeakSubText .jp_stdbattletextbox jp StdBattleTextBox - -; 36f0b diff --git a/engine/battle/move_effects/sunny_day.asm b/engine/battle/move_effects/sunny_day.asm index ef8c37c5c..f5825930f 100644 --- a/engine/battle/move_effects/sunny_day.asm +++ b/engine/battle/move_effects/sunny_day.asm @@ -1,4 +1,4 @@ -BattleCommand_StartSun: ; 37c07 +BattleCommand_StartSun: ; startsun ld a, WEATHER_SUN ld [wBattleWeather], a @@ -7,5 +7,3 @@ BattleCommand_StartSun: ; 37c07 call AnimateCurrentMove ld hl, SunGotBrightText jp StdBattleTextBox - -; 37c1a diff --git a/engine/battle/move_effects/teleport.asm b/engine/battle/move_effects/teleport.asm index 1bd1eb725..1c67ef112 100644 --- a/engine/battle/move_effects/teleport.asm +++ b/engine/battle/move_effects/teleport.asm @@ -1,4 +1,4 @@ -BattleCommand_Teleport: ; 36778 +BattleCommand_Teleport: ; teleport ld a, [wBattleType] @@ -87,5 +87,3 @@ BattleCommand_Teleport: ; 36778 ld hl, FledFromBattleText jp StdBattleTextBox - -; 36804 diff --git a/engine/battle/move_effects/thief.asm b/engine/battle/move_effects/thief.asm index 5397c2bdf..64de1a4fe 100644 --- a/engine/battle/move_effects/thief.asm +++ b/engine/battle/move_effects/thief.asm @@ -1,4 +1,4 @@ -BattleCommand_Thief: ; 37492 +BattleCommand_Thief: ; thief ld a, [hBattleTurn] @@ -50,7 +50,6 @@ BattleCommand_Thief: ; 37492 ld [de], a jr .stole - .enemy ; The enemy can't already have an item. @@ -91,13 +90,11 @@ BattleCommand_Thief: ; 37492 ld [hl], a ld [de], a - .stole call GetItemName ld hl, StoleText jp StdBattleTextBox - .playeritem ld a, 1 call BattlePartyAttr @@ -113,4 +110,3 @@ BattleCommand_Thief: ; 37492 ld e, l ld hl, wEnemyMonItem ret -; 37517 diff --git a/engine/battle/move_effects/thunder.asm b/engine/battle/move_effects/thunder.asm index 3705e1a28..b2a643787 100644 --- a/engine/battle/move_effects/thunder.asm +++ b/engine/battle/move_effects/thunder.asm @@ -1,4 +1,4 @@ -BattleCommand_ThunderAccuracy: ; 37d94 +BattleCommand_ThunderAccuracy: ; thunderaccuracy ld a, BATTLE_VARS_MOVE_TYPE @@ -16,5 +16,3 @@ BattleCommand_ThunderAccuracy: ; 37d94 ; Redundant with CheckHit guranteeing hit ld [hl], 100 percent ret - -; 37daa diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 5ae7c1511..ef8071290 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -1,5 +1,5 @@ -BattleCommand_Transform: ; 371cd +BattleCommand_Transform: ; transform call ClearLastMove @@ -137,5 +137,3 @@ BattleCommand_Transform: ; 371cd call nz, LoadAnim ld hl, TransformedText jp StdBattleTextBox - -; 372c6 diff --git a/engine/battle/move_effects/triple_kick.asm b/engine/battle/move_effects/triple_kick.asm index cef56a1ae..e41044c9d 100644 --- a/engine/battle/move_effects/triple_kick.asm +++ b/engine/battle/move_effects/triple_kick.asm @@ -1,4 +1,4 @@ -BattleCommand_TripleKick: ; 346b2 +BattleCommand_TripleKick: ; triplekick ld a, [wKickCounter] @@ -26,14 +26,9 @@ BattleCommand_TripleKick: ; 346b2 ld [hl], a ret -; 346cd - - -BattleCommand_KickCounter: ; 346cd +BattleCommand_KickCounter: ; kickcounter ld hl, wKickCounter inc [hl] ret - -; 346d2 diff --git a/engine/battle/read_trainer_attributes.asm b/engine/battle/read_trainer_attributes.asm index 0b9507e0d..6db8f4204 100644 --- a/engine/battle/read_trainer_attributes.asm +++ b/engine/battle/read_trainer_attributes.asm @@ -1,4 +1,4 @@ -GetTrainerClassName: ; 3952d +GetTrainerClassName: ld hl, wRivalName ld a, c cp RIVAL1 @@ -19,7 +19,7 @@ GetTrainerClassName: ; 3952d pop de ret -GetOTName: ; 39550 +GetOTName: ld hl, wOTPlayerName ld a, [wLinkMode] and a @@ -44,7 +44,7 @@ GetOTName: ; 39550 pop de ret -GetTrainerAttributes: ; 3957b +GetTrainerAttributes: ld a, [wTrainerClass] ld c, a call GetOTName @@ -62,3 +62,5 @@ GetTrainerAttributes: ; 3957b ld a, [hl] ld [wEnemyTrainerBaseReward], a ret + +INCLUDE "data/trainers/attributes.asm" diff --git a/engine/battle/read_trainer_dvs.asm b/engine/battle/read_trainer_dvs.asm index c021e8e8c..d35c9ea61 100644 --- a/engine/battle/read_trainer_dvs.asm +++ b/engine/battle/read_trainer_dvs.asm @@ -1,4 +1,4 @@ -GetTrainerDVs: ; 270c4 +GetTrainerDVs: ; Return the DVs of wOtherTrainerClass in bc push hl @@ -17,4 +17,5 @@ GetTrainerDVs: ; 270c4 pop hl ret -; 270d6 + +INCLUDE "data/trainers/dvs.asm" diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 3227236c1..0a537b64e 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -1,4 +1,4 @@ -ReadTrainerParty: ; 39771 +ReadTrainerParty: ld a, [wInBattleTowerBattle] bit 0, a ret nz @@ -79,17 +79,15 @@ ReadTrainerParty: ; 39771 call TrainerType2 call CloseSRAM jr .done -; 397e3 -TrainerTypes: ; 397e3 +TrainerTypes: ; entries correspond to TRAINERTYPE_* constants dw TrainerType1 ; level, species dw TrainerType2 ; level, species, moves dw TrainerType3 ; level, species, item dw TrainerType4 ; level, species, item, moves -; 397eb -TrainerType1: ; 397eb +TrainerType1: ; normal (level, species) ld h, d ld l, e @@ -107,9 +105,8 @@ TrainerType1: ; 397eb predef TryAddMonToParty pop hl jr .loop -; 39806 -TrainerType2: ; 39806 +TrainerType2: ; moves ld h, d ld l, e @@ -184,9 +181,8 @@ TrainerType2: ; 39806 pop hl jr .loop -; 39871 -TrainerType3: ; 39871 +TrainerType3: ; item ld h, d ld l, e @@ -213,9 +209,8 @@ TrainerType3: ; 39871 ld a, [hli] ld [de], a jr .loop -; 3989d (e:589d) -TrainerType4: ; 3989d +TrainerType4: ; item + moves ld h, d ld l, e @@ -305,9 +300,8 @@ TrainerType4: ; 3989d pop hl jr .loop -; 3991b -ComputeTrainerReward: ; 3991b (e:591b) +ComputeTrainerReward: ld hl, hProduct xor a ld [hli], a @@ -327,8 +321,7 @@ ComputeTrainerReward: ; 3991b (e:591b) ld [hl], a ret - -Battle_GetTrainerName:: ; 39939 +Battle_GetTrainerName:: ld a, [wInBattleTowerBattle] bit 0, a ld hl, wOTPlayerName @@ -339,7 +332,7 @@ Battle_GetTrainerName:: ; 39939 ld a, [wOtherTrainerClass] ld c, a -GetTrainerName:: ; 3994c +GetTrainerName:: ld a, c cp CAL jr nz, .not_cal2 @@ -379,20 +372,20 @@ GetTrainerName:: ; 3994c jr nz, .skip jr .loop -CopyTrainerName: ; 39984 +CopyTrainerName: ld de, wStringBuffer1 push de ld bc, NAME_LENGTH call CopyBytes pop de ret -; 39990 -Function39990: ; 39990 +Function39990: ; This function is useless. ld de, wStringBuffer1 push de ld bc, NAME_LENGTH pop de ret -; 39999 + +INCLUDE "data/trainers/parties.asm" diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index 952239f94..0aff780c9 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -1,4 +1,4 @@ -_ReturnToBattle_UseBall: ; 2715c +_ReturnToBattle_UseBall: call ClearBGPalettes call ClearTileMap ld a, [wBattleType] diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index 667f18191..6b866c6d8 100644 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -1,4 +1,4 @@ -BattleIntroSlidingPics: ; 4e980 +BattleIntroSlidingPics: ld a, [rSVBK] push af ld a, BANK(wLYOverrides) @@ -12,9 +12,8 @@ BattleIntroSlidingPics: ; 4e980 pop af ld [rSVBK], a ret -; 4e998 -.subfunction1 ; 4e998 +.subfunction1 call .subfunction4 ld a, $90 ld [hSCX], a @@ -23,9 +22,8 @@ BattleIntroSlidingPics: ; 4e980 lb de, %11100100, %11100100 call DmgToCgbObjPals ret -; 4e9ab -.subfunction2 ; 4e9ab +.subfunction2 ld d, $90 ld e, $72 ld a, $48 @@ -57,9 +55,8 @@ BattleIntroSlidingPics: ; 4e980 dec a jr nz, .loop1 ret -; 4e9d6 -.subfunction3 ; 4e9d6 +.subfunction3 ld hl, wVirtualOAMSprite00XCoord ld c, $12 ; 18 ld de, SPRITEOAMSTRUCT_LENGTH @@ -70,17 +67,15 @@ BattleIntroSlidingPics: ; 4e980 dec c jr nz, .loop3 ret -; 4e9e5 -.subfunction4 ; 4e9e5 +.subfunction4 ld hl, wLYOverrides ld a, $90 ld bc, SCREEN_HEIGHT_PX call ByteFill ret -; 4e9f1 -.subfunction5 ; 4e9f1 +.subfunction5 ld hl, wLYOverrides ld a, d ld c, $3e ; 62 @@ -101,4 +96,3 @@ BattleIntroSlidingPics: ; 4e980 dec c jr nz, .loop6 ret -; 4ea0a diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 84cd1e858..f5fc4a6b0 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -1,4 +1,4 @@ -ShowLinkBattleParticipants: ; 2ee18 +ShowLinkBattleParticipants: ; If we're not in a communications room, ; we don't need to be here. ld a, [wLinkMode] @@ -12,11 +12,11 @@ ShowLinkBattleParticipants: ; 2ee18 call ClearSprites ret -FindFirstAliveMonAndStartBattle: ; 2ee2f +FindFirstAliveMonAndStartBattle: xor a ld [hMapAnims], a call DelayFrame - ld b, 6 + ld b, PARTY_LENGTH ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH - 1 @@ -46,7 +46,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f ld [hMapAnims], a ret -PlayBattleMusic: ; 2ee6c +PlayBattleMusic: push hl push de push bc @@ -148,7 +148,7 @@ PlayBattleMusic: ; 2ee6c pop hl ret -ClearBattleRAM: ; 2ef18 +ClearBattleRAM: xor a ld [wBattlePlayerAction], a ld [wBattleResult], a diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 0a18098ed..3930549b2 100644 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -1,4 +1,4 @@ -BattleStart_TrainerHuds: ; 2c000 +BattleStart_TrainerHuds: ld a, $e4 ld [rOBP0], a call LoadBallIconGFX @@ -7,16 +7,14 @@ BattleStart_TrainerHuds: ; 2c000 dec a ret z jp ShowOTTrainerMonsRemaining -; 2c012 -EnemySwitch_TrainerHud: ; 2c012 +EnemySwitch_TrainerHud: ld a, $e4 ld [rOBP0], a call LoadBallIconGFX jp ShowOTTrainerMonsRemaining -; 2c01c -ShowPlayerMonsRemaining: ; 2c01c +ShowPlayerMonsRemaining: call DrawPlayerPartyIconHUDBorder ld hl, wPartyMon1HP ld de, wPartyCount @@ -30,9 +28,8 @@ ShowPlayerMonsRemaining: ; 2c01c ld [wPlaceBallsDirection], a ld hl, wVirtualOAMSprite00 jp LoadTrainerHudOAM -; 2c03a -ShowOTTrainerMonsRemaining: ; 2c03a +ShowOTTrainerMonsRemaining: call DrawEnemyHUDBorder ld hl, wOTPartyMon1HP ld de, wOTPartyCount @@ -46,9 +43,8 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [wPlaceBallsDirection], a ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM -; 2c059 -StageBallTilesData: ; 2c059 +StageBallTilesData: ld a, [de] push af ld de, wBuffer1 @@ -69,9 +65,8 @@ StageBallTilesData: ; 2c059 dec a jr nz, .loop2 ret -; 2c075 -.GetHUDTile: ; 2c075 +.GetHUDTile: ld a, [hli] and a jr nz, .got_hp @@ -102,9 +97,8 @@ StageBallTilesData: ; 2c059 ld bc, PARTYMON_STRUCT_LENGTH + MON_HP - MON_STATUS add hl, bc ret -; 2c095 -DrawPlayerHUDBorder: ; 2c095 +DrawPlayerHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles ld bc, 4 @@ -118,9 +112,8 @@ DrawPlayerHUDBorder: ; 2c095 db $77 ; bottom right db $6f ; bottom left db $76 ; bottom side -; 2c0ad -DrawPlayerPartyIconHUDBorder: ; 2c0ad +DrawPlayerPartyIconHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles ld bc, 4 @@ -134,9 +127,8 @@ DrawPlayerPartyIconHUDBorder: ; 2c0ad db $5c ; bottom right db $6f ; bottom left db $76 ; bottom side -; 2c0c5 -DrawEnemyHUDBorder: ; 2c0c5 +DrawEnemyHUDBorder: ld hl, .tiles ld de, wTrainerHUDTiles ld bc, 4 @@ -160,9 +152,8 @@ DrawEnemyHUDBorder: ; 2c0c5 db $74 ; bottom left db $78 ; bottom right db $76 ; bottom side -; 2c0f1 -PlaceHUDBorderTiles: ; 2c0f1 +PlaceHUDBorderTiles: ld a, [wTrainerHUDTiles] ld [hl], a ld bc, SCREEN_WIDTH @@ -180,9 +171,8 @@ PlaceHUDBorderTiles: ; 2c0f1 ld a, [wEndFlypoint] ld [hl], a ret -; 2c10d -LinkBattle_TrainerHuds: ; 2c10d +LinkBattle_TrainerHuds: call LoadBallIconGFX ld hl, wPartyMon1HP ld de, wPartyCount @@ -205,9 +195,8 @@ LinkBattle_TrainerHuds: ; 2c10d ld [hl], 13 * 8 ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM -; 2c143 -LoadTrainerHudOAM: ; 2c143 +LoadTrainerHudOAM: ld de, wBuffer1 ld c, PARTY_LENGTH .loop @@ -228,21 +217,18 @@ LoadTrainerHudOAM: ; 2c143 dec c jr nz, .loop ret -; 2c165 -LoadBallIconGFX: ; 2c165 +LoadBallIconGFX: ld de, .gfx ld hl, vTiles0 tile $31 lb bc, BANK(LoadBallIconGFX), 4 call Get2bpp_2 ret -; 2c172 -.gfx ; 2c172 +.gfx INCBIN "gfx/battle/balls.2bpp" -; 2c1b2 -_ShowLinkBattleParticipants: ; 2c1b2 +_ShowLinkBattleParticipants: call ClearBGPalettes call LoadFontsExtra hlcoord 2, 3 @@ -266,4 +252,3 @@ _ShowLinkBattleParticipants: ; 2c1b2 ld a, $e4 ld [rOBP0], a ret -; 2c1ef diff --git a/engine/battle/unreferenced_getgen1trainerclassname.asm b/engine/battle/unreferenced_getgen1trainerclassname.asm index da8e98b61..045325234 100644 --- a/engine/battle/unreferenced_getgen1trainerclassname.asm +++ b/engine/battle/unreferenced_getgen1trainerclassname.asm @@ -1,4 +1,4 @@ -Unreferenced_GetGen1TrainerClassName: ; 50a28 +Unreferenced_GetGen1TrainerClassName: ld hl, Gen1TrainerClassNames ld a, [wTrainerClass] dec a diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index f2182f378..9307a1a1e 100644 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -1,11 +1,10 @@ -DisplayUsedMoveText: ; 105db0 +DisplayUsedMoveText: ; battle command 03 ld hl, UsedMoveText call BattleTextBox jp WaitBGMap -; 105db9 -UsedMoveText: ; 105db9 +UsedMoveText: ; this is a stream of text and asm from 105db9 to 105ef6 text_jump _ActorNameText start_asm @@ -58,18 +57,16 @@ UsedMoveText: ; 105db9 ret c ld hl, UsedMove1Text ret -; 105e04 -UsedMove1Text: ; 105e04 +UsedMove1Text: text_jump _UsedMove1Text start_asm jr UsedMoveText_CheckObedience -; 105e0b -UsedMove2Text: ; 105e0b +UsedMove2Text: text_jump _UsedMove2Text start_asm -UsedMoveText_CheckObedience: ; 105e10 +UsedMoveText_CheckObedience: ; check obedience ld a, [wAlreadyDisobeyed] and a @@ -77,7 +74,6 @@ UsedMoveText_CheckObedience: ; 105e10 ; print "instead," ld hl, .UsedInsteadText ret -; 105e1a .UsedInsteadText: text_jump _UsedInsteadText @@ -85,9 +81,8 @@ UsedMoveText_CheckObedience: ; 105e10 .GetMoveNameText: ld hl, MoveNameText ret -; 105e23 -MoveNameText: ; 105e23 +MoveNameText: text_jump _MoveNameText start_asm ; get start address @@ -111,40 +106,32 @@ MoveNameText: ; 105e23 ld h, [hl] ld l, a ret -; 105e39 -.endusedmovetexts ; 105e39 +.endusedmovetexts ; entries correspond to MoveGrammar sets dw EndUsedMove1Text dw EndUsedMove2Text dw EndUsedMove3Text dw EndUsedMove4Text dw EndUsedMove5Text -; 105e43 -EndUsedMove1Text: ; 105e43 +EndUsedMove1Text: text_jump _EndUsedMove1Text db "@" -; 105e48 -EndUsedMove2Text: ; 105e48 +EndUsedMove2Text: text_jump _EndUsedMove2Text db "@" -; 105e4d -EndUsedMove3Text: ; 105e4d +EndUsedMove3Text: text_jump _EndUsedMove3Text db "@" -; 105e52 -EndUsedMove4Text: ; 105e52 +EndUsedMove4Text: text_jump _EndUsedMove4Text db "@" -; 105e57 -EndUsedMove5Text: ; 105e57 +EndUsedMove5Text: text_jump _EndUsedMove5Text db "@" -; 105e5c - -GetMoveGrammar: ; 105e5c +GetMoveGrammar: ; store move grammar type in wd265 push bc @@ -178,12 +165,10 @@ GetMoveGrammar: ; 105e5c ; we're done pop bc ret -; 105e7a INCLUDE "data/moves/grammar.asm" - -UpdateUsedMoves: ; 105ed0 +UpdateUsedMoves: ; append move a to wPlayerUsedMoves unless it has already been used push bc @@ -237,4 +222,3 @@ UpdateUsedMoves: ; 105ed0 ; list updated pop bc ret -; 105ef6 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 1f4da606d..600168a9a 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1,7 +1,6 @@ ; Battle animation command interpreter. -PlayBattleAnim: ; cc0d6 - +PlayBattleAnim: ld a, [rSVBK] push af @@ -13,10 +12,8 @@ PlayBattleAnim: ; cc0d6 pop af ld [rSVBK], a ret -; cc0e4 - -_PlayBattleAnim: ; cc0e4 +_PlayBattleAnim: ld c, 6 .wait call BattleAnimDelayFrame @@ -52,10 +49,8 @@ _PlayBattleAnim: ; cc0e4 call BattleAnimDelayFrame call WaitSFX ret -; cc11c - -BattleAnimRunScript: ; cc11c +BattleAnimRunScript: ld a, [wFXAnimID + 1] and a jr nz, .hi_byte @@ -97,10 +92,8 @@ BattleAnimRunScript: ; cc11c .done call BattleAnim_RevertPals ret -; cc163 - -RunBattleAnimScript: ; cc163 +RunBattleAnimScript: call ClearBattleAnims .playframe @@ -140,10 +133,8 @@ RunBattleAnimScript: ; cc163 call BattleAnim_ClearCGB_OAMFlags ret -; cc1a1 - -BattleAnimClearHud: ; cc1a1 +BattleAnimClearHud: call BattleAnimDelayFrame call WaitTop call ClearActorHud @@ -154,10 +145,8 @@ BattleAnimClearHud: ; cc1a1 call BattleAnimDelayFrame call WaitTop ret -; cc1bb - -BattleAnimRestoreHuds: ; cc1bb +BattleAnimRestoreHuds: call BattleAnimDelayFrame call WaitTop @@ -180,10 +169,8 @@ BattleAnimRestoreHuds: ; cc1bb call BattleAnimDelayFrame call WaitTop ret -; cc1e2 - -BattleAnimRequestPals: ; cc1e2 +BattleAnimRequestPals: ld a, [hCGB] and a ret z @@ -200,9 +187,8 @@ BattleAnimRequestPals: ; cc1e2 cp b call nz, BattleAnim_SetOBPals ret -; cc1fb -BattleAnimDelayFrame: ; cc1fb +BattleAnimDelayFrame: ; Like DelayFrame but wastes battery life. ld a, 1 @@ -212,10 +198,8 @@ BattleAnimDelayFrame: ; cc1fb and a jr nz, .wait ret -; cc207 - -ClearActorHud: ; cc207 +ClearActorHud: ld a, [hBattleTurn] and a jr z, .player @@ -230,9 +214,8 @@ ClearActorHud: ; cc207 lb bc, 5, 11 call ClearBox ret -; cc220 -Unreferenced_Functioncc220: ; cc220 +Unreferenced_Functioncc220: xor a ld [hBGMapMode], a ld a, LOW(vBGMap0 tile $28) @@ -248,11 +231,8 @@ Unreferenced_Functioncc220: ; cc220 ld [hBGMapAddress + 1], a call BattleAnimDelayFrame ret -; cc23d - - -BattleAnim_ClearCGB_OAMFlags: ; cc23d +BattleAnim_ClearCGB_OAMFlags: ld a, [wBattleAnimFlags] bit 3, a jr z, .delete @@ -279,16 +259,14 @@ endr dec c jr nz, .loop2 ret -; cc25f -RunBattleAnimCommand: ; cc25f +RunBattleAnimCommand: call .CheckTimer ret nc call .RunScript ret -; cc267 -.CheckTimer: ; cc267 +.CheckTimer: ld a, [wBattleAnimDuration] and a jr z, .done @@ -301,13 +279,12 @@ RunBattleAnimCommand: ; cc25f .done scf ret -; cc275 -.RunScript: ; cc275 +.RunScript: .loop call GetBattleAnimByte - cp $ff + cp anim_ret_command jr nz, .not_done_with_anim ; Return from a subroutine. @@ -329,9 +306,8 @@ RunBattleAnimCommand: ; cc25f call .DoCommand jr .loop -; cc293 -.DoCommand: ; cc293 +.DoCommand: ; Execute battle animation command in [wBattleAnimByte]. ld a, [wBattleAnimByte] sub $d0 @@ -346,10 +322,8 @@ RunBattleAnimCommand: ; cc25f ld h, [hl] ld l, a jp hl -; cc2a4 - -BattleAnimCommands:: ; cc2a4 (33:42a4) +BattleAnimCommands:: ; entries correspond to macros/scripts/battle_anims.asm enumeration dw BattleAnimCmd_Obj dw BattleAnimCmd_1GFX @@ -400,14 +374,13 @@ BattleAnimCommands:: ; cc2a4 (33:42a4) dw BattleAnimCmd_Call dw BattleAnimCmd_Ret - BattleAnimCmd_EA: BattleAnimCmd_EB: BattleAnimCmd_EC: -BattleAnimCmd_ED: ; cc304 (33:4304) +BattleAnimCmd_ED: ret -BattleAnimCmd_Ret: ; cc305 (33:4305) +BattleAnimCmd_Ret: ld hl, wBattleAnimFlags res 1, [hl] ld hl, wBattleAnimParent @@ -420,7 +393,7 @@ BattleAnimCmd_Ret: ; cc305 (33:4305) ld [hl], d ret -BattleAnimCmd_Call: ; cc317 (33:4317) +BattleAnimCmd_Call: call GetBattleAnimByte ld e, a call GetBattleAnimByte @@ -443,7 +416,7 @@ BattleAnimCmd_Call: ; cc317 (33:4317) set 1, [hl] ret -BattleAnimCmd_Jump: ; cc339 (33:4339) +BattleAnimCmd_Jump: call GetBattleAnimByte ld e, a call GetBattleAnimByte @@ -454,7 +427,7 @@ BattleAnimCmd_Jump: ; cc339 (33:4339) ld [hl], d ret -BattleAnimCmd_Loop: ; cc348 (33:4348) +BattleAnimCmd_Loop: call GetBattleAnimByte ld hl, wBattleAnimFlags bit 2, [hl] @@ -495,7 +468,7 @@ BattleAnimCmd_Loop: ; cc348 (33:4348) ld [hl], e ret -BattleAnimCmd_JumpUntil: ; cc383 (33:4383) +BattleAnimCmd_JumpUntil: ld hl, wBattleAnimParam ld a, [hl] and a @@ -524,17 +497,17 @@ BattleAnimCmd_JumpUntil: ; cc383 (33:4383) ld [hl], e ret -BattleAnimCmd_SetVar: ; cc3a6 (33:43a6) +BattleAnimCmd_SetVar: call GetBattleAnimByte ld [wBattleAnimVar], a ret -BattleAnimCmd_IncVar: ; cc3ad (33:43ad) +BattleAnimCmd_IncVar: ld hl, wBattleAnimVar inc [hl] ret -BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2) +BattleAnimCmd_IfVarEqual: call GetBattleAnimByte ld hl, wBattleAnimVar cp [hl] @@ -562,7 +535,7 @@ BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2) ld [hl], d ret -BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6) +BattleAnimCmd_IfParamEqual: call GetBattleAnimByte ld hl, wBattleAnimParam cp [hl] @@ -590,7 +563,7 @@ BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6) ld [hl], d ret -BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa) +BattleAnimCmd_IfParamAnd: call GetBattleAnimByte ld e, a ld a, [wBattleAnimParam] @@ -619,7 +592,7 @@ BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa) ld [hl], d ret -BattleAnimCmd_Obj: ; cc41f (33:441f) +BattleAnimCmd_Obj: ; index, x, y, param call GetBattleAnimByte ld [wBattleAnimTemp0], a @@ -632,7 +605,7 @@ BattleAnimCmd_Obj: ; cc41f (33:441f) call QueueBattleAnimation ret -BattleAnimCmd_BGEffect: ; cc43b (33:443b) +BattleAnimCmd_BGEffect: call GetBattleAnimByte ld [wBattleAnimTemp0], a call GetBattleAnimByte @@ -644,22 +617,22 @@ BattleAnimCmd_BGEffect: ; cc43b (33:443b) call _QueueBGEffect ret -BattleAnimCmd_BGP: ; cc457 (33:4457) +BattleAnimCmd_BGP: call GetBattleAnimByte ld [wBGP], a ret -BattleAnimCmd_OBP0: ; cc45e (33:445e) +BattleAnimCmd_OBP0: call GetBattleAnimByte ld [wOBP0], a ret -BattleAnimCmd_OBP1: ; cc465 (33:4465) +BattleAnimCmd_OBP1: call GetBattleAnimByte ld [wOBP1], a ret -BattleAnimCmd_ResetObp0: ; cc46c (33:446c) +BattleAnimCmd_ResetObp0: ld a, [hSGB] and a ld a, $e0 @@ -669,7 +642,7 @@ BattleAnimCmd_ResetObp0: ; cc46c (33:446c) ld [wOBP0], a ret -BattleAnimCmd_ClearObjs: ; cc479 (33:4479) +BattleAnimCmd_ClearObjs: ld hl, wActiveAnimObjects ld a, $a0 .loop @@ -683,7 +656,7 @@ BattleAnimCmd_1GFX: BattleAnimCmd_2GFX: BattleAnimCmd_3GFX: BattleAnimCmd_4GFX: -BattleAnimCmd_5GFX: ; cc485 (33:4485) +BattleAnimCmd_5GFX: ld a, [wBattleAnimByte] and $f ld c, a @@ -718,7 +691,7 @@ endr jr nz, .loop ret -BattleAnimCmd_IncObj: ; cc4c0 (33:44c0) +BattleAnimCmd_IncObj: call GetBattleAnimByte ld e, 10 ld bc, wActiveAnimObjects @@ -743,7 +716,7 @@ BattleAnimCmd_IncObj: ; cc4c0 (33:44c0) inc [hl] ret -BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3) +BattleAnimCmd_IncBGEffect: call GetBattleAnimByte ld e, 5 ld bc, wActiveBGEffects @@ -768,7 +741,7 @@ BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3) inc [hl] ret -BattleAnimCmd_SetObj: ; cc506 (33:4506) +BattleAnimCmd_SetObj: call GetBattleAnimByte ld e, 10 ld bc, wActiveAnimObjects @@ -794,8 +767,7 @@ BattleAnimCmd_SetObj: ; cc506 (33:4506) ld [hl], a ret -BattleAnimCmd_EnemyFeetObj: ; cc52c (33:452c) - +BattleAnimCmd_EnemyFeetObj: ld hl, wBattleAnimTileDict .loop ld a, [hl] @@ -828,7 +800,7 @@ BattleAnimCmd_EnemyFeetObj: ; cc52c (33:452c) call .LoadFootprint ret -.LoadFootprint: ; cc561 (33:4561) +.LoadFootprint: push af push hl push de @@ -849,8 +821,7 @@ BattleAnimCmd_EnemyFeetObj: ; cc52c (33:452c) jr nz, .LoadFootprint ret -BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e) - +BattleAnimCmd_PlayerHeadObj: ld hl, wBattleAnimTileDict .loop ld a, [hl] @@ -883,7 +854,7 @@ BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e) call .LoadHead ret -.LoadHead: ; cc5b3 (33:45b3) +.LoadHead: push af push hl push de @@ -904,16 +875,16 @@ BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e) jr nz, .LoadHead ret -BattleAnimCmd_CheckPokeball: ; cc5d0 (33:45d0) +BattleAnimCmd_CheckPokeball: callfar GetPokeBallWobble ld a, c ld [wBattleAnimVar], a ret -BattleAnimCmd_E7: ; cc5db (33:45db) +BattleAnimCmd_E7: ret -BattleAnimCmd_Transform: ; cc5dc (33:45dc) +BattleAnimCmd_Transform: ld a, [rSVBK] push af ld a, BANK(wCurPartySpecies) @@ -948,8 +919,7 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld [rSVBK], a ret -BattleAnimCmd_UpdateActorPic: ; cc622 (33:4622) - +BattleAnimCmd_UpdateActorPic: ld de, vTiles0 tile $00 ld a, [hBattleTurn] and a @@ -968,8 +938,7 @@ BattleAnimCmd_UpdateActorPic: ; cc622 (33:4622) call Request2bpp ret -BattleAnimCmd_RaiseSub: ; cc640 (33:4640) - +BattleAnimCmd_RaiseSub: ld a, [rSVBK] push af ld a, 1 ; unnecessary bankswitch? @@ -977,7 +946,7 @@ BattleAnimCmd_RaiseSub: ; cc640 (33:4640) xor a ; sScratch call GetSRAMBank -GetSubstitutePic: ; cc64c +GetSubstitutePic: ; used only for BANK(GetSubstitutePic) ld hl, sScratch ld bc, (7 * 7) tiles @@ -1037,13 +1006,13 @@ GetSubstitutePic: ; cc64c ld [rSVBK], a ret -.CopyTile: ; cc6c6 (33:46c6) +.CopyTile: ld bc, 1 tiles ld a, BANK(MonsterSpriteGFX) call FarCopyBytes ret -BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) +BattleAnimCmd_MinimizeOpp: ld a, [rSVBK] push af ld a, 1 ; unnecessary bankswitch? @@ -1057,7 +1026,7 @@ BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf) ld [rSVBK], a ret -GetMinimizePic: ; cc6e7 (33:46e7) +GetMinimizePic: ld hl, sScratch ld bc, $31 tiles .loop @@ -1087,19 +1056,17 @@ GetMinimizePic: ; cc6e7 (33:46e7) lb bc, BANK(GetMinimizePic), 6 * 6 ret -CopyMinimizePic: ; cc719 (33:4719) +CopyMinimizePic: ld hl, MinimizePic ld bc, $10 ld a, BANK(MinimizePic) call FarCopyBytes ret -; cc725 (33:4725) -MinimizePic: ; cc725 +MinimizePic: INCBIN "gfx/battle/minimize.2bpp" -; cc735 -BattleAnimCmd_Minimize: ; cc735 (33:4735) +BattleAnimCmd_Minimize: ld a, [rSVBK] push af ld a, 1 ; unnecessary bankswitch? @@ -1114,7 +1081,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) ld [rSVBK], a ret -BattleAnimCmd_DropSub: ; cc750 (33:4750) +BattleAnimCmd_DropSub: ld a, [rSVBK] push af ld a, BANK(wCurPartySpecies) @@ -1139,7 +1106,7 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750) ld [rSVBK], a ret -BattleAnimCmd_BeatUp: ; cc776 (33:4776) +BattleAnimCmd_BeatUp: ld a, [rSVBK] push af ld a, BANK(wCurPartySpecies) @@ -1175,31 +1142,31 @@ BattleAnimCmd_BeatUp: ; cc776 (33:4776) ld [rSVBK], a ret -BattleAnimCmd_OAMOn: ; cc7bb (33:47bb) +BattleAnimCmd_OAMOn: xor a ld [hOAMUpdate], a ret -BattleAnimCmd_OAMOff: ; cc7bf (33:47bf) +BattleAnimCmd_OAMOff: ld a, $1 ld [hOAMUpdate], a ret -BattleAnimCmd_ClearSprites: ; cc7c4 (33:47c4) +BattleAnimCmd_ClearSprites: ld hl, wBattleAnimFlags set 3, [hl] ret -BattleAnimCmd_F5: ; cc7ca (33:47ca) +BattleAnimCmd_F5: ret -BattleAnimCmd_F6: ; cc7cb (33:47cb) +BattleAnimCmd_F6: ret -BattleAnimCmd_F7: ; cc7cc (33:47cc) +BattleAnimCmd_F7: ret -BattleAnimCmd_Sound: ; cc7cd (33:47cd) +BattleAnimCmd_Sound: call GetBattleAnimByte ld e, a srl a @@ -1222,13 +1189,11 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) callfar PlayStereoSFX ret -; cc7f8 (33:47f8) -.GetPanning: ; cc7f8 +.GetPanning: db $f0, $0f, $f0, $0f -; cc7fc -.GetCryTrack: ; cc7fc (33:47fc) +.GetCryTrack: ld a, [hBattleTurn] and a jr nz, .enemy @@ -1241,7 +1206,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) xor 1 ret -BattleAnimCmd_Cry: ; cc807 (33:4807) +BattleAnimCmd_Cry: call GetBattleAnimByte maskbits NUM_NOISE_CHANS ld e, a @@ -1315,18 +1280,15 @@ endr pop af ld [rSVBK], a ret -; cc871 (33:4871) -.CryData: ; cc871 +.CryData: ; +pitch, +length dw $0000, $00c0 dw $0000, $0040 dw $0000, $0000 dw $0000, $0000 -; cc881 - -PlayHitSound: ; cc881 +PlayHitSound: ld a, [wNumHits] cp $1 jr z, .okay @@ -1350,9 +1312,8 @@ PlayHitSound: ; cc881 .play call PlaySFX ret -; cc8a4 -BattleAnimAssignPals: ; cc8a4 +BattleAnimAssignPals: ld a, [hCGB] and a jr nz, .cgb @@ -1378,9 +1339,8 @@ BattleAnimAssignPals: ; cc8a4 lb de, %11100100, %11100100 call DmgToCgbObjPals ret -; cc8d3 -ClearBattleAnims: ; cc8d3 +ClearBattleAnims: ; Clear animation block ld hl, wLYOverrides ld bc, wBattleAnimEnd - wLYOverrides @@ -1403,9 +1363,8 @@ ClearBattleAnims: ; cc8d3 call BattleAnimAssignPals call BattleAnimDelayFrame ret -; cc8f6 -BattleAnim_RevertPals: ; cc8f6 +BattleAnim_RevertPals: call WaitTop ld a, %11100100 ld [wBGP], a @@ -1421,9 +1380,8 @@ BattleAnim_RevertPals: ; cc8f6 ld a, $1 ld [hBGMapMode], a ret -; cc91a -BattleAnim_SetBGPals: ; cc91a +BattleAnim_SetBGPals: ld [rBGP], a ld a, [hCGB] and a @@ -1449,9 +1407,8 @@ BattleAnim_SetBGPals: ; cc91a ld a, $1 ld [hCGBPalUpdate], a ret -; cc94b -BattleAnim_SetOBPals: ; cc94b +BattleAnim_SetOBPals: ld [rOBP0], a ld a, [hCGB] and a @@ -1471,9 +1428,8 @@ BattleAnim_SetOBPals: ; cc94b ld a, $1 ld [hCGBPalUpdate], a ret -; cc96e -BattleAnim_UpdateOAM_All: ; cc96e +BattleAnim_UpdateOAM_All: ld a, $0 ld [wBattleAnimOAMPointerLo], a ld hl, wActiveAnimObjects @@ -1510,4 +1466,3 @@ BattleAnim_UpdateOAM_All: ; cc96e .done ret -; cc9a1 diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index 3192774dd..e5e186ab7 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -8,7 +8,7 @@ ; BG effects for use in battle animations. -ExecuteBGEffects: ; c8000 (32:4000) +ExecuteBGEffects: ld hl, wActiveBGEffects ld e, 5 .loop @@ -29,7 +29,7 @@ ExecuteBGEffects: ; c8000 (32:4000) jr nz, .loop ret -QueueBGEffect: ; c801a (32:401a) +QueueBGEffect: ld hl, wActiveBGEffects ld e, 5 .loop @@ -58,13 +58,13 @@ QueueBGEffect: ; c801a (32:401a) ld [hl], a ret -EndBattleBGEffect: ; c8043 (32:4043) +EndBattleBGEffect: ld hl, BG_EFFECT_STRUCT_FUNCTION add hl, bc ld [hl], 0 ret -DoBattleBGEffectFunction: ; c804a (32:404a) +DoBattleBGEffectFunction: ld hl, BG_EFFECT_STRUCT_FUNCTION add hl, bc ld e, [hl] @@ -77,7 +77,7 @@ DoBattleBGEffectFunction: ; c804a (32:404a) ld l, a jp hl -BattleBGEffects: ; c805a (32:405a) +BattleBGEffects: ; entries correspond to ANIM_BG_* constants dw BattleBGEffect_End dw BattleBGEffect_FlashInverted @@ -134,12 +134,11 @@ BattleBGEffects: ; c805a (32:405a) dw BattleBGEffect_WobbleMon dw BattleBGEffect_35 - -BattleBGEffect_End: ; c80c6 (32:40c6) +BattleBGEffect_End: call EndBattleBGEffect ret -BatttleBGEffects_GetNamedJumptablePointer: ; c80ca (32:40ca) +BatttleBGEffects_GetNamedJumptablePointer: ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc ld l, [hl] @@ -151,7 +150,7 @@ BatttleBGEffects_GetNamedJumptablePointer: ; c80ca (32:40ca) ld l, a ret -BattleBGEffects_AnonJumptable: ; c80d7 (32:40d7) +BattleBGEffects_AnonJumptable: pop de ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc @@ -164,31 +163,29 @@ BattleBGEffects_AnonJumptable: ; c80d7 (32:40d7) ld l, a jp hl -BattleBGEffects_IncrementJumptable: ; c80e5 (32:40e5) +BattleBGEffects_IncrementJumptable: ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc inc [hl] ret -BattleBGEffect_FlashInverted: ; c80eb (32:40eb) +BattleBGEffect_FlashInverted: ld de, .inverted jp BattleBGEffect_FlashContinue .inverted db %11100100 ; 3210 db %00011011 ; 0123 -; c80f3 -BattleBGEffect_FlashWhite: ; c80f3 (32:40f3) +BattleBGEffect_FlashWhite: ld de, .white jp BattleBGEffect_FlashContinue .white db %11100100 ; 3210 db %00000000 ; 0000 -; c80fb -BattleBGEffect_FlashContinue: ; c80fb (32:40fb) +BattleBGEffect_FlashContinue: ; current timer, flash duration, number of flashes ld a, $1 ld [wBattleAnimTemp0], a @@ -226,7 +223,7 @@ BattleBGEffect_FlashContinue: ; c80fb (32:40fb) ld [wBGP], a ret -BattleBGEffect_WhiteHues: ; c812d (32:412d) +BattleBGEffect_WhiteHues: ld de, .Pals call BattleBGEffect_GetNthDMGPal jr c, .quit @@ -242,9 +239,8 @@ BattleBGEffect_WhiteHues: ; c812d (32:412d) db %11100000 db %11010000 db -1 -; c8141 -BattleBGEffect_BlackHues: ; c8141 (32:4141) +BattleBGEffect_BlackHues: ld de, .Pals call BattleBGEffect_GetNthDMGPal jr c, .quit @@ -260,9 +256,8 @@ BattleBGEffect_BlackHues: ; c8141 (32:4141) db %11110100 db %11111000 db -1 -; c8155 -BattleBGEffect_AlternateHues: ; c8155 (32:4155) +BattleBGEffect_AlternateHues: ld de, .Pals call BattleBGEffect_GetNthDMGPal jr c, .quit @@ -284,9 +279,8 @@ BattleBGEffect_AlternateHues: ; c8155 (32:4155) db %01000000 db %10010000 db -2 -; c8171 -BattleBGEffect_06: ; c8171 (32:4171) +BattleBGEffect_06: call BattleBGEffects_CheckSGB jr nz, .sgb ld de, .PalsCGB @@ -308,9 +302,8 @@ BattleBGEffect_06: ; c8171 (32:4171) db %11110000 db %11000000 db -2 -; c818b -BattleBGEffect_07: ; c818b (32:418b) +BattleBGEffect_07: call BattleBGEffects_CheckSGB jr nz, .sgb ld de, .PalsCGB @@ -332,9 +325,8 @@ BattleBGEffect_07: ; c818b (32:418b) db %11110000 db %11001100 db -2 -; c81a5 -BattleBGEffect_08: ; c81a5 (32:41a5) +BattleBGEffect_08: ld de, .Pals call BattleBGEffect_GetNthDMGPal ld [wBGP], a @@ -345,9 +337,8 @@ BattleBGEffect_08: ; c81a5 (32:41a5) db %01100011 db %10000111 db -2 -; c81b3 -BattleBGEffect_HideMon: ; c81b3 (32:41b3) +BattleBGEffect_HideMon: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -356,7 +347,6 @@ BattleBGEffect_HideMon: ; c81b3 (32:41b3) dw BattleBGEffects_IncrementJumptable dw .four - .zero call BattleBGEffects_IncrementJumptable push bc @@ -384,7 +374,7 @@ BattleBGEffect_HideMon: ; c81b3 (32:41b3) call EndBattleBGEffect ret -BattleBGEffect_ShowMon: ; c81ea (32:41ea) +BattleBGEffect_ShowMon: call BGEffect_CheckFlyDigStatus jr z, .not_flying call EndBattleBGEffect @@ -412,9 +402,8 @@ BattleBGEffect_ShowMon: ; c81ea (32:41ea) .EnemyData: db 3, $00, 3 db -1 -; c8214 -BattleBGEffect_FeetFollow: ; c8214 (32:4214) +BattleBGEffect_FeetFollow: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -424,7 +413,6 @@ BattleBGEffect_FeetFollow: ; c8214 (32:4214) dw BattleBGEffects_IncrementJumptable dw .five - .zero call BGEffect_CheckFlyDigStatus jr z, .not_flying_digging @@ -482,7 +470,7 @@ BattleBGEffect_FeetFollow: ; c8214 (32:4214) call EndBattleBGEffect ret -BattleBGEffect_HeadFollow: ; c8281 (32:4281) +BattleBGEffect_HeadFollow: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -492,7 +480,6 @@ BattleBGEffect_HeadFollow: ; c8281 (32:4281) dw BattleBGEffects_IncrementJumptable dw .five - .zero call BGEffect_CheckFlyDigStatus jr z, .not_flying_digging @@ -550,11 +537,11 @@ BattleBGEffect_HeadFollow: ; c8281 (32:4281) call EndBattleBGEffect ret -_QueueBattleAnimation: ; c82ee (32:42ee) +_QueueBattleAnimation: callfar QueueBattleAnimation ret -BattleBGEffect_27: ; c82f5 (32:42f5) +BattleBGEffect_27: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -563,7 +550,6 @@ BattleBGEffect_27: ; c82f5 (32:42f5) dw BattleBGEffects_IncrementJumptable dw .four - .zero call BattleBGEffects_IncrementJumptable call BGEffect_CheckBattleTurn @@ -655,7 +641,7 @@ BattleBGEffect_27: ; c82f5 (32:42f5) call EndBattleBGEffect ret -BattleBGEffect_EnterMon: ; c837b (32:437b) +BattleBGEffect_EnterMon: call BGEffect_CheckBattleTurn jr nz, .player_turn ld de, .EnemyData @@ -681,9 +667,8 @@ BattleBGEffect_EnterMon: ; c837b (32:437b) db 4, $00, 4 db 3, $00, 3 db -1 -; c83a8 -BattleBGEffect_ReturnMon: ; c83a8 (32:43a8) +BattleBGEffect_ReturnMon: call BGEffect_CheckBattleTurn jr nz, .player_turn ld de, .EnemyData @@ -717,9 +702,8 @@ BattleBGEffect_ReturnMon: ; c83a8 (32:43a8) db -2, $33, 5 db -3, $00, 0 db -1 -; c83ed -BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed) +BattleBGEffect_RunPicResizeScript: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -728,7 +712,6 @@ BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed) dw .restart dw .end - .zero ld hl, BG_EFFECT_STRUCT_03 add hl, bc @@ -918,16 +901,14 @@ ENDM db $00, $15, $2a db $03, $18, $2d db $06, $1b, $30 -; c8545 -BattleBGEffect_Surf: ; c8545 (32:4545) +BattleBGEffect_Surf: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable lb de, 2, 2 @@ -987,14 +968,13 @@ BattleBGEffect_Surf: ; c8545 (32:4545) jr c, .loop2 ret -BattleBGEffect_Whirlpool: ; c8599 (32:4599) +BattleBGEffect_Whirlpool: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1016,14 +996,14 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_30: ; c85c2 (32:45c2) +BattleBGEffect_30: call BattleBGEffects_ClearLYOverrides ld a, rSCY - $ff00 call BattleBGEffect_SetLCDStatCustoms1 call EndBattleBGEffect ret -BattleBGEffect_31: ; c85ce (32:45ce) +BattleBGEffect_31: ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] @@ -1057,18 +1037,17 @@ BattleBGEffect_31: ; c85ce (32:45ce) call EndBattleBGEffect ret -BattleBGEffect_32: ; c8603 (32:4603) +BattleBGEffect_32: call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_Psychic: ; c8607 (32:4607) +BattleBGEffect_Psychic: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1099,14 +1078,13 @@ BattleBGEffect_Psychic: ; c8607 (32:4607) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_Teleport: ; c863f (32:463f) +BattleBGEffect_Teleport: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1124,14 +1102,13 @@ BattleBGEffect_Teleport: ; c863f (32:463f) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_NightShade: ; c8662 (32:4662) +BattleBGEffect_NightShade: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1152,7 +1129,7 @@ BattleBGEffect_NightShade: ; c8662 (32:4662) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_DoubleTeam: ; c8689 (32:4689) +BattleBGEffect_DoubleTeam: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -1162,7 +1139,6 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) dw .four dw .five - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1247,14 +1223,13 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_AcidArmor: ; c8709 (32:4709) +BattleBGEffect_AcidArmor: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1310,14 +1285,13 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_Withdraw: ; c8761 (32:4761) +BattleBGEffect_Withdraw: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1359,7 +1333,7 @@ BattleBGEffect_Withdraw: ; c8761 (32:4761) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_Dig: ; c87a7 (32:47a7) +BattleBGEffect_Dig: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -1367,7 +1341,6 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7) dw .two dw .three - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1426,7 +1399,7 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_Tackle: ; c8805 (32:4805) +BattleBGEffect_Tackle: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -1434,7 +1407,6 @@ BattleBGEffect_Tackle: ; c8805 (32:4805) dw Tackle_BGEffect25_2d_two dw .three - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1461,7 +1433,7 @@ BattleBGEffect_Tackle: ; c8805 (32:4805) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_25: ; c8837 (32:4837) +BattleBGEffect_25: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -1469,7 +1441,6 @@ BattleBGEffect_25: ; c8837 (32:4837) dw Tackle_BGEffect25_2d_two dw .three - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1537,7 +1508,7 @@ Tackle_BGEffect25_2d_two: ld [hl], a ret -Functionc88a5: ; c88a5 (32:48a5) +Functionc88a5: push af ld a, [wFXAnimID + 1] ; FXAnimID + 1 or a @@ -1589,7 +1560,7 @@ Functionc88a5: ; c88a5 (32:48a5) jr nz, .loop ret -BattleBGEffect_2d: ; c88e7 (32:48e7) +BattleBGEffect_2d: call BattleBGEffects_AnonJumptable .anon_dw dw BGEffect2d_2f_zero @@ -1597,7 +1568,6 @@ BattleBGEffect_2d: ; c88e7 (32:48e7) dw Tackle_BGEffect25_2d_two dw .three - .three call BattleAnim_ResetLCDStatCustom ret @@ -1624,7 +1594,7 @@ BGEffect2d_2f_zero: ld [hl], a ret -BattleBGEffect_2f: ; c8919 (32:4919) +BattleBGEffect_2f: call BattleBGEffects_AnonJumptable .anon_dw dw BGEffect2d_2f_zero @@ -1638,14 +1608,13 @@ BattleBGEffect_2f: ; c8919 (32:4919) .two ret -BattleBGEffect_26: ; c892a (32:492a) +BattleBGEffect_26: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1677,14 +1646,13 @@ BattleBGEffect_26: ; c892a (32:492a) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_2c: ; c8964 (32:4964) +BattleBGEffect_2c: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1732,14 +1700,13 @@ BattleBGEffect_2c: ; c8964 (32:4964) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_28: ; c89b5 (32:49b5) +BattleBGEffect_28: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1775,14 +1742,13 @@ BattleBGEffect_28: ; c89b5 (32:49b5) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_BounceDown: ; c89ee (32:49ee) +BattleBGEffect_BounceDown: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1826,7 +1792,7 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_2a: ; c8a3a (32:4a3a) +BattleBGEffect_2a: call BattleBGEffects_AnonJumptable .anon_dw dw .zero @@ -1933,15 +1899,13 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) .data db $00, $40, $90, $e4 db -1 -; c8acc -BattleBGEffect_2b: ; c8acc (32:4acc) +BattleBGEffect_2b: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one - .zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides @@ -1972,7 +1936,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_1c: ; c8b00 (32:4b00) +BattleBGEffect_1c: ld a, [hCGB] and a jr nz, .cgb @@ -1982,7 +1946,6 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) dw .one dw .two - .zero call BattleBGEffects_IncrementJumptable ld a, $e4 @@ -2130,97 +2093,86 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) db $90, $f8 db $40, $fc db $90, $f8 -; c8be8 -BattleBGEffect_RapidFlash: ; c8be8 (32:4be8) +BattleBGEffect_RapidFlash: ld de, .FlashPals call BGEffect_RapidCyclePals ret .FlashPals: db $e4, $6c, $fe -; c8bf2 -BattleBGEffect_16: ; c8bf2 (32:4bf2) +BattleBGEffect_16: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $90, $40, $ff -; c8bfd -BattleBGEffect_17: ; c8bfd (32:4bfd) +BattleBGEffect_17: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $f8, $fc, $ff -; c8c08 -BattleBGEffect_18: ; c8c08 (32:4c08) +BattleBGEffect_18: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $90, $40, $90, $fe -; c8c14 -BattleBGEffect_19: ; c8c14 (32:4c14) +BattleBGEffect_19: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $f8, $fc, $f8, $fe -; c8c20 -BattleBGEffect_1a: ; c8c20 (32:4c20) +BattleBGEffect_1a: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $f8, $fc, $f8, $e4, $90, $40, $90, $fe -; c8c30 -BattleBGEffect_1b: ; c8c30 (32:4c30) +BattleBGEffect_1b: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $fc, $e4, $00, $fe -; c8c3c -BattleBGEffect_1d: ; c8c3c (32:4c3c) +BattleBGEffect_1d: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $e4, $90, $40, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $90, $e4, $ff -; c8c55 -BattleBGEffect_1e: ; c8c55 (32:4c55) +BattleBGEffect_1e: ld de, .Pals call BGEffect_RapidCyclePals ret .Pals: db $00, $40, $90, $e4, $ff -; c8c61 -BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) +BattleBGEffect_VibrateMon: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one - -.zero ; c8c68 (32:4c68) +.zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, rSCX - $ff00 @@ -2236,7 +2188,7 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) ld [hl], $20 ret -.one ; c8c85 (32:4c85) +.one ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] @@ -2258,15 +2210,14 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2) +BattleBGEffect_WobbleMon: call BattleBGEffects_AnonJumptable .anon_dw dw .zero dw .one dw .two - -.zero ; c8cab (32:4cab) +.zero call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, rSCX - $ff00 @@ -2280,7 +2231,7 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2) ld [hl], $0 ret -.one ; c8cc3 (32:4cc3) +.one ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] @@ -2296,11 +2247,11 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2) ld [hl], a ret -.two ; c8cdd (32:4cdd) +.two call BattleAnim_ResetLCDStatCustom ret -BattleBGEffect_2e: ; c8ce1 (32:4ce1) +BattleBGEffect_2e: call Functionc8d0b jr c, .xor_a bit 7, a @@ -2317,7 +2268,7 @@ BattleBGEffect_2e: ; c8ce1 (32:4ce1) ld [wAnimObject01YOffset], a ret -BattleBGEffect_1f: ; c8cf9 (32:4cf9) +BattleBGEffect_1f: call Functionc8d0b jr nc, .skip xor a @@ -2325,7 +2276,7 @@ BattleBGEffect_1f: ; c8cf9 (32:4cf9) ld [hSCX], a ret -BattleBGEffect_20: ; c8d02 (32:4d02) +BattleBGEffect_20: call Functionc8d0b jr nc, .skip xor a @@ -2333,7 +2284,7 @@ BattleBGEffect_20: ; c8d02 (32:4d02) ld [hSCY], a ret -Functionc8d0b: ; c8d0b (32:4d0b) +Functionc8d0b: ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc ld a, [hl] @@ -2371,7 +2322,7 @@ Functionc8d0b: ; c8d0b (32:4d0b) and a ret -BattleBGEffect_35: ; c8d3a (32:4d3a) +BattleBGEffect_35: ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] @@ -2392,7 +2343,7 @@ BattleBGEffect_35: ; c8d3a (32:4d3a) ld [hSCX], a ret -BattleBGEffect_GetNthDMGPal: ; c8d57 (32:4d57) +BattleBGEffect_GetNthDMGPal: ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc ld a, [hl] @@ -2415,7 +2366,7 @@ BattleBGEffect_GetNthDMGPal: ; c8d57 (32:4d57) call BattleBGEffect_GetFirstDMGPal ret -BGEffect_RapidCyclePals: ; c8d77 (32:4d77) +BGEffect_RapidCyclePals: ld a, [hCGB] and a jr nz, .cgb @@ -2430,8 +2381,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) dw .one_dmg dw .two_dmg - -.zero_dmg ; c8d8b (32:4d8b) +.zero_dmg call BattleBGEffects_IncrementJumptable ld a, $e4 call BattleBGEffects_SetLYOverrides @@ -2449,7 +2399,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) ld [hl], a ret -.one_dmg ; c8daa (32:4daa) +.one_dmg ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld a, [hl] @@ -2474,7 +2424,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) dec [hl] ret -.two_dmg ; c8dc9 (32:4dc9) +.two_dmg call BattleBGEffects_ResetVideoHRAM ld a, %11100100 ld [rBGP], a @@ -2488,15 +2438,14 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) pop de jp hl -.Jumptable_CGB: ; c8ddd (32:4ddd) +.Jumptable_CGB: dw .zero_cgb dw .one_cgb dw .two_cgb dw .three_cgb dw .four_cgb - -.zero_cgb ; c8de7 (32:4de7) +.zero_cgb call BGEffect_CheckBattleTurn jr nz, .player_turn_cgb call BattleBGEffects_IncrementJumptable @@ -2512,7 +2461,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) ld [hl], a ret -.one_cgb ; c8e02 (32:4e02) +.one_cgb ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld a, [hl] @@ -2537,13 +2486,13 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) dec [hl] ret -.two_cgb ; c8e21 (32:4e21) +.two_cgb ld a, $e4 call BGEffects_LoadBGPal0_OBPal1 call EndBattleBGEffect ret -.three_cgb ; c8e2a (32:4e2a) +.three_cgb ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld a, [hl] @@ -2568,13 +2517,13 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) dec [hl] ret -.four_cgb ; c8e49 (32:4e49) +.four_cgb ld a, $e4 call BGEffects_LoadBGPal1_OBPal0 call EndBattleBGEffect ret -BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52) +BGEffects_LoadBGPal0_OBPal1: ld h, a ld a, [rSVBK] push af @@ -2601,7 +2550,7 @@ BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52) ld [hCGBPalUpdate], a ret -BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f) +BGEffects_LoadBGPal1_OBPal0: ld h, a ld a, [rSVBK] push af @@ -2628,12 +2577,12 @@ BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f) ld [hCGBPalUpdate], a ret -BattleBGEffect_GetFirstDMGPal: ; c8eac (32:4eac) +BattleBGEffect_GetFirstDMGPal: ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] inc [hl] -BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2) +BattleBGEffect_GetNextDMGPal: ld l, a ld h, $0 add hl, de @@ -2654,9 +2603,9 @@ BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2) scf ret -BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca) +BattleBGEffects_ClearLYOverrides: xor a -BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb) +BattleBGEffects_SetLYOverrides: ld hl, wLYOverrides ; wListPointer ld e, $99 .loop1 @@ -2671,7 +2620,7 @@ BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb) jr nz, .loop2 ret -BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede) +BattleBGEffect_SetLCDStatCustoms1: ld [hLCDCPointer], a call BGEffect_CheckBattleTurn jr nz, .player_turn @@ -2687,7 +2636,7 @@ BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede) ld [hLYOverrideEnd], a ret -BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4) +BattleBGEffect_SetLCDStatCustoms2: ld [hLCDCPointer], a call BGEffect_CheckBattleTurn jr nz, .player_turn @@ -2703,7 +2652,7 @@ BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4) ld [hLYOverrideEnd], a ret -BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a) +BattleAnim_ResetLCDStatCustom: xor a ld [hLYOverrideStart], a ld [hLYOverrideEnd], a @@ -2713,7 +2662,7 @@ BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a) call EndBattleBGEffect ret -BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19) +BattleBGEffects_ResetVideoHRAM: xor a ld [hLCDCPointer], a ld a, %11100100 @@ -2725,7 +2674,7 @@ BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19) call BattleBGEffects_ClearLYOverrides ret -Functionc8f2e: ; c8f2e (32:4f2e) +Functionc8f2e: push bc xor a ld [wBattleAnimTemp0], a @@ -2760,7 +2709,7 @@ Functionc8f2e: ; c8f2e (32:4f2e) pop bc ret -InitSurfWaves: ; c8f69 (32:4f69) +InitSurfWaves: push bc xor a ld [wBattleAnimTemp0], a @@ -2788,7 +2737,7 @@ InitSurfWaves: ; c8f69 (32:4f69) pop bc ret -Functionc8f9a: ; c8f9a (32:4f9a) +Functionc8f9a: push bc ld [wBattleAnimTemp3], a ld a, e @@ -2847,7 +2796,7 @@ Functionc8f9a: ; c8f9a (32:4f9a) ld d, $0 ret -BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) +BattleBGEffect_WavyScreenFX: push bc ld a, [hLYOverrideStart] ld l, a @@ -2874,7 +2823,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) pop bc ret -BGEffect_FillLYOverridesBackup: ; c900b (32:500b) +BGEffect_FillLYOverridesBackup: push af ld h, HIGH(wLYOverridesBackup) ld a, [hLYOverrideStart] @@ -2889,7 +2838,7 @@ BGEffect_FillLYOverridesBackup: ; c900b (32:500b) jr nz, .loop ret -BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b) +BGEffect_DisplaceLYOverridesBackup: ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a push af ld e, a @@ -2915,7 +2864,7 @@ BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b) jr nz, .loop2 ret -BGEffect_CheckBattleTurn: ; c9038 (32:5038) +BGEffect_CheckBattleTurn: ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld a, [hBattleTurn] @@ -2923,7 +2872,7 @@ BGEffect_CheckBattleTurn: ; c9038 (32:5038) xor [hl] ret -BGEffect_CheckFlyDigStatus: ; c9042 (32:5042) +BGEffect_CheckFlyDigStatus: ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld a, [hBattleTurn] @@ -2939,21 +2888,19 @@ BGEffect_CheckFlyDigStatus: ; c9042 (32:5042) and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret -BattleBGEffects_CheckSGB: ; c9059 (32:5059) +BattleBGEffects_CheckSGB: ld a, [hSGB] and a ret -BattleBGEffects_Sine: ; c905d (32:505d) +BattleBGEffects_Sine: ld e, a callfar BattleAnim_Sine_e ld a, e ret -BattleBGEffects_Cosine: ; c9066 (32:5066) +BattleBGEffects_Cosine: ld e, a callfar BattleAnim_Cosine_e ld a, e ret - -; c906f (32:506f) diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm index 11578f7f0..0f3bb8488 100644 --- a/engine/battle_anims/core.asm +++ b/engine/battle_anims/core.asm @@ -1,4 +1,4 @@ -QueueBattleAnimation: ; cc9a1 (33:49a1) +QueueBattleAnimation: ld hl, wActiveAnimObjects ld e, 10 .loop @@ -20,15 +20,13 @@ QueueBattleAnimation: ; cc9a1 (33:49a1) call InitBattleAnimation ret -DeinitBattleAnimation: ; cc9bd +DeinitBattleAnimation: ld hl, BATTLEANIMSTRUCT_INDEX add hl, bc ld [hl], $0 ret -; cc9c4 - -InitBattleAnimation: ; cc9c4 (33:49c4) +InitBattleAnimation: ld a, [wBattleAnimTemp0] ld e, a ld d, 0 @@ -79,7 +77,7 @@ endr ld [hl], a ; 10 ret -BattleAnimOAMUpdate: ; cca09 +BattleAnimOAMUpdate: call InitBattleAnimBuffer call GetBattleAnimFrame cp -3 @@ -191,9 +189,7 @@ BattleAnimOAMUpdate: ; cca09 scf ret -; ccaaa - -InitBattleAnimBuffer: ; ccaaa +InitBattleAnimBuffer: ld hl, BATTLEANIMSTRUCT_01 add hl, bc ld a, [hl] @@ -276,9 +272,7 @@ InitBattleAnimBuffer: ; ccaaa ld [wBattleAnimTempXOffset], a ret -; ccb31 - -GetBattleAnimTileOffset: ; ccb31 (33:4b31) +GetBattleAnimTileOffset: push hl push bc ld hl, wBattleAnimTileDict @@ -301,14 +295,10 @@ GetBattleAnimTileOffset: ; ccb31 (33:4b31) pop hl ret -_ExecuteBGEffects: ; ccb48 +_ExecuteBGEffects: callfar ExecuteBGEffects ret -; ccb4f - -_QueueBGEffect: ; ccb4f (33:4b4f) +_QueueBGEffect: callfar QueueBGEffect ret - -; ccb56 (33:4b56) diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index e0eedec86..d631ca72f 100644 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -1,4 +1,4 @@ -DoBattleAnimFrame: ; ccfbe +DoBattleAnimFrame: ld hl, BATTLEANIMSTRUCT_FUNCTION add hl, bc ld e, [hl] @@ -10,7 +10,6 @@ DoBattleAnimFrame: ; ccfbe ld h, [hl] ld l, a jp hl -; ccfce .Jumptable: ; entries correspond to BATTLEANIMFUNC_* constants @@ -95,7 +94,7 @@ DoBattleAnimFrame: ; ccfbe dw BattleAnimFunction_4E ; 4e dw BattleAnimFunction_4F ; 4f -BattleAnimFunction_Null: ; cd06e (33:506e) +BattleAnimFunction_Null: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -105,13 +104,13 @@ BattleAnimFunction_Null: ; cd06e (33:506e) .zero ret -BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: ; cd079 (33:5079) +BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: call BattleAnimFunction_ThrowFromPlayerToEnemy ret c call DeinitBattleAnimation ret -BattleAnimFunction_ThrowFromPlayerToEnemy: ; cd081 (33:5081) +BattleAnimFunction_ThrowFromPlayerToEnemy: ; If x coord at $88 or beyond, abort. ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -143,7 +142,7 @@ BattleAnimFunction_ThrowFromPlayerToEnemy: ; cd081 (33:5081) scf ret -BattleAnimFunction_04: ; cd0a6 (33:50a6) +BattleAnimFunction_04: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -184,7 +183,7 @@ BattleAnimFunction_04: ; cd0a6 (33:50a6) ld [hl], a ret -BattleAnimFunction_03: ; cd0e3 (33:50e3) +BattleAnimFunction_03: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -230,7 +229,7 @@ BattleAnimFunction_03: ; cd0e3 (33:50e3) inc [hl] ret -BattleAnimFunction_01: ; cd12a (33:512a) +BattleAnimFunction_01: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -251,7 +250,7 @@ BattleAnimFunction_01: ; cd12a (33:512a) call Functionce70a ret -BattleAnimFunction_02: ; cd146 (33:5146) +BattleAnimFunction_02: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -267,7 +266,7 @@ BattleAnimFunction_02: ; cd146 (33:5146) call DeinitBattleAnimation ret -BattleAnimFunction_PokeBall: ; cd15c (33:515c) +BattleAnimFunction_PokeBall: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -384,7 +383,7 @@ BattleAnimFunction_PokeBall: ; cd15c (33:515c) call DeinitBattleAnimation ret -BattleAnimFunction_PokeBallBlocked: ; cd212 (33:5212) +BattleAnimFunction_PokeBallBlocked: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -424,7 +423,7 @@ BattleAnimFunction_PokeBallBlocked: ; cd212 (33:5212) call DeinitBattleAnimation ret -GetBallAnimPal: ; cd249 (33:5249) +GetBallAnimPal: ld hl, BallColors ld a, [rSVBK] push af @@ -449,11 +448,10 @@ GetBallAnimPal: ; cd249 (33:5249) add hl, bc ld [hl], a ret -; cd26c (33:526c) INCLUDE "data/battle_anims/ball_colors.asm" -BattleAnimFunction_10: ; cd284 (33:5284) +BattleAnimFunction_10: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -495,7 +493,7 @@ BattleAnimFunction_10: ; cd284 (33:5284) .four ret -BattleAnimFunction_07: ; cd2be (33:52be) +BattleAnimFunction_07: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -542,7 +540,7 @@ BattleAnimFunction_07: ; cd2be (33:52be) call DeinitBattleAnimation ret -BattleAnimFunction_08: ; cd306 (33:5306) +BattleAnimFunction_08: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -654,7 +652,7 @@ BattleAnimFunction_08: ; cd306 (33:5306) jr nz, .loop ret -BattleAnimFunction_09: ; cd3ae (33:53ae) +BattleAnimFunction_09: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -702,7 +700,7 @@ BattleAnimFunction_09: ; cd3ae (33:53ae) call DeinitBattleAnimation ret -BattleAnimFunction_0A: ; cd3f2 (33:53f2) +BattleAnimFunction_0A: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -798,7 +796,7 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2) .six ret -BattleAnimFunction_RazorLeaf: ; cd478 (33:5478) +BattleAnimFunction_RazorLeaf: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -945,7 +943,7 @@ BattleAnimFunction_RazorLeaf: ; cd478 (33:5478) call Functionce70a ret -Functioncd557: ; cd557 (33:5557) +Functioncd557: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -983,7 +981,7 @@ Functioncd557: ; cd557 (33:5557) ld de, -$100 ret -BattleAnimFunction_4E: ; cd58a (33:558a) +BattleAnimFunction_4E: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -1045,7 +1043,7 @@ BattleAnimFunction_4E: ; cd58a (33:558a) ld [hl], e ret -BattleAnimFunction_0C: ; cd5e9 (33:55e9) +BattleAnimFunction_0C: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -1129,7 +1127,7 @@ BattleAnimFunction_0C: ; cd5e9 (33:55e9) ld [hl], d ret -BattleAnimFunction_0D: ; cd66a (33:566a) +BattleAnimFunction_0D: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -1205,7 +1203,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a) call DeinitBattleAnimation ret -asm_cd6da: ; cd6da (33:56da) +asm_cd6da: inc a inc a ld [hl], a @@ -1214,13 +1212,13 @@ asm_cd6da: ; cd6da (33:56da) ld [hLYOverrideStart], a ret -BattleAnimFunction_0E: ; cd6e3 (33:56e3) +BattleAnimFunction_0E: call BattleAnim_AnonJumptable .anon_dw dw Functioncd6ea dw Functioncd6f7 -Functioncd6ea: ; cd6ea (33:56ea) +Functioncd6ea: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -1228,7 +1226,7 @@ Functioncd6ea: ; cd6ea (33:56ea) add [hl] ; offset call ReinitBattleAnimFrameset -Functioncd6f7: ; cd6f7 (33:56f7) +Functioncd6f7: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1251,7 +1249,7 @@ Functioncd6f7: ; cd6f7 (33:56f7) ld [hl], a ret -BattleAnimFunction_0F: ; cd71a (33:571a) +BattleAnimFunction_0F: call BattleAnim_AnonJumptable .anon_dw dw Functioncd725 @@ -1259,9 +1257,9 @@ BattleAnimFunction_0F: ; cd71a (33:571a) dw Functioncd763 dw Functioncd776 -Functioncd725: ; cd725 (33:5725) +Functioncd725: call BattleAnim_IncAnonJumptableIndex -Functioncd728: ; cd728 (33:5728) +Functioncd728: ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -1295,7 +1293,7 @@ Functioncd728: ; cd728 (33:5728) ld a, [hl] and $1 ld [hl], a -Functioncd763: ; cd763 (33:5763) +Functioncd763: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -1308,10 +1306,10 @@ Functioncd763: ; cd763 (33:5763) call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_29 call ReinitBattleAnimFrameset -Functioncd776: ; cd776 (33:5776) +Functioncd776: ret -BattleAnimFunction_11: ; cd777 (33:5777) +BattleAnimFunction_11: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -1343,13 +1341,13 @@ BattleAnimFunction_11: ; cd777 (33:5777) ld [hl], a ret -BattleAnimFunction_14: ; cd7a4 (33:57a4) +BattleAnimFunction_14: call BattleAnim_AnonJumptable .anon_dw dw Functioncd7ab dw Functioncd7d2 -Functioncd7ab: ; cd7ab (33:57ab) +Functioncd7ab: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -1371,7 +1369,7 @@ Functioncd7ab: ; cd7ab (33:57ab) ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld [hl], $1 -Functioncd7d2: ; cd7d2 (33:57d2) +Functioncd7d2: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -1411,7 +1409,7 @@ Functioncd7d2: ; cd7d2 (33:57d2) dec [hl] ret -BattleAnimFunction_15: ; cd80c (33:580c) +BattleAnimFunction_15: call BattleAnim_AnonJumptable .anon_dw dw Functioncd81f @@ -1419,18 +1417,18 @@ BattleAnimFunction_15: ; cd80c (33:580c) dw Functioncd81f dw Functioncd820 -Functioncd817: ; cd817 (33:5817) +Functioncd817: call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_35 call ReinitBattleAnimFrameset -Functioncd81f: ; cd81f (33:581f) +Functioncd81f: ret -Functioncd820: ; cd820 (33:5820) +Functioncd820: call DeinitBattleAnimation ret -BattleAnimFunction_16: ; cd824 (33:5824) +BattleAnimFunction_16: call BattleAnim_AnonJumptable .anon_dw dw Functioncd835 @@ -1441,7 +1439,7 @@ BattleAnimFunction_16: ; cd824 (33:5824) dw Functioncd88f dw Functioncd893 -Functioncd835: ; cd835 (33:5835) +Functioncd835: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -1468,7 +1466,7 @@ Functioncd835: ; cd835 (33:5835) ld a, [hl] and $7f ld [hl], a -Functioncd860: ; cd860 (33:5860) +Functioncd860: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -1499,17 +1497,17 @@ Functioncd860: ; cd860 (33:5860) ld a, [hl] and $1f ret nz -Functioncd88f: ; cd88f (33:588f) +Functioncd88f: call BattleAnim_IncAnonJumptableIndex ret -Functioncd893: ; cd893 (33:5893) +Functioncd893: ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX add hl, bc ld [hl], $1 ret -BattleAnimFunction_17: ; cd89a (33:589a) +BattleAnimFunction_17: call BattleAnim_AnonJumptable .anon_dw dw Functioncd8ab @@ -1520,7 +1518,7 @@ BattleAnimFunction_17: ; cd89a (33:589a) dw Functioncd8f5 dw Functioncd8f9 -Functioncd8ab: ; cd8ab (33:58ab) +Functioncd8ab: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -1542,7 +1540,7 @@ Functioncd8ab: ; cd8ab (33:58ab) and $7f ld [hl], a -Functioncd8cc: ; cd8cc (33:58cc) +Functioncd8cc: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -1570,30 +1568,30 @@ Functioncd8cc: ; cd8cc (33:58cc) and $1f ret nz -Functioncd8f5: ; cd8f5 (33:58f5) +Functioncd8f5: call BattleAnim_IncAnonJumptableIndex ret -Functioncd8f9: ; cd8f9 (33:58f9) +Functioncd8f9: ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX add hl, bc ld [hl], $1 ret -BattleAnimFunction_18: ; cd900 (33:5900) +BattleAnimFunction_18: call BattleAnim_AnonJumptable .anon_dw dw Functioncd907 dw Functioncd913 -Functioncd907: ; cd907 (33:5907) +Functioncd907: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $28 inc hl ld [hl], $0 -Functioncd913: ; cd913 (33:5913) +Functioncd913: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -1637,7 +1635,7 @@ Functioncd913: ; cd913 (33:5913) call DeinitBattleAnimation ret -BattleAnimFunction_19: ; cd954 (33:5954) +BattleAnimFunction_19: call BattleAnim_AnonJumptable .anon_dw dw Functioncd961 @@ -1646,16 +1644,16 @@ BattleAnimFunction_19: ; cd954 (33:5954) dw Functioncd96a dw Functioncd97b -Functioncd961: ; cd961 (33:5961) +Functioncd961: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld [hl], $0 -Functioncd96a: ; cd96a (33:596a) +Functioncd96a: call Functioncd99a ret -Functioncd96e: ; cd96e (33:596e) +Functioncd96e: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1664,7 +1662,7 @@ Functioncd96e: ; cd96e (33:596e) call BattleAnim_IncAnonJumptableIndex ret -Functioncd97b: ; cd97b (33:597b) +Functioncd97b: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1673,7 +1671,7 @@ Functioncd97b: ; cd97b (33:597b) call DeinitBattleAnimation ret -asm_cd988: ; cd988 (33:5988) +asm_cd988: call Functioncd99a ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -1686,7 +1684,7 @@ asm_cd988: ; cd988 (33:5988) dec [hl] ret -Functioncd99a: ; cd99a (33:599a) +Functioncd99a: call Functioncd9f4 ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -1746,7 +1744,7 @@ Functioncd99a: ; cd99a (33:599a) ld [hl], a ret -Functioncd9f4: ; cd9f4 (33:59f4) +Functioncd9f4: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld e, [hl] @@ -1756,12 +1754,10 @@ Functioncd9f4: ; cd9f4 (33:59f4) ld d, [hl] ret -; cda01 (33:5a01) -Unknown_cda01: ; cda01 +Unknown_cda01: db 8, 6, 5, 4, 5, 6, 8, 12, 16 -; cda0a -BattleAnimFunction_1C: ; cda0a (33:5a0a) +BattleAnimFunction_1C: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1790,14 +1786,14 @@ BattleAnimFunction_1C: ; cda0a (33:5a0a) jr nz, .asm_cda2c ret -BattleAnimFunction_1F: ; cda31 (33:5a31) +BattleAnimFunction_1F: call BattleAnim_AnonJumptable .anon_dw dw Functioncda4c dw Functioncda3a dw Functioncda4c -Functioncda3a: ; cda3a (33:5a3a) +Functioncda3a: ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc ld a, [hl] @@ -1807,24 +1803,24 @@ Functioncda3a: ; cda3a (33:5a3a) ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $8 -Functioncda4c: ; cda4c (33:5a4c) +Functioncda4c: ret -BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d) +BattleAnimFunction_LeechSeed: call BattleAnim_AnonJumptable .anon_dw dw .zero dw .one dw .two dw .three -.zero: ; cda58 (33:5a58) +.zero: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $40 ret -.one: ; cda62 (33:5a62) +.one: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -1840,7 +1836,7 @@ BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d) call BattleAnim_IncAnonJumptableIndex ret -.two: ; cda7a (33:5a7a) +.two: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -1853,10 +1849,10 @@ BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d) call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_58 call ReinitBattleAnimFrameset -.three: ; cda8c (33:5a8c) +.three: ret -Functioncda8d: ; cda8d (33:5a8d) +Functioncda8d: dec [hl] ld d, $20 call BattleAnim_Sine @@ -1904,21 +1900,21 @@ Functioncda8d: ; cda8d (33:5a8d) dec [hl] ret -BattleAnimFunction_3F: ; cdad6 (33:5ad6) +BattleAnimFunction_3F: call BattleAnim_AnonJumptable .anon_dw dw Functioncdadf dw Functioncdae9 dw Functioncdaf9 -Functioncdadf: ; cdadf (33:5adf) +Functioncdadf: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $40 ret -Functioncdae9: ; cdae9 (33:5ae9) +Functioncdae9: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -1929,10 +1925,10 @@ Functioncdae9: ; cdae9 (33:5ae9) .asm_cdaf6 call BattleAnim_IncAnonJumptableIndex -Functioncdaf9: ; cdaf9 (33:5af9) +Functioncdaf9: ret -BattleAnimFunction_1A: ; cdafa (33:5afa) +BattleAnimFunction_1A: call BattleAnimFunction_03 ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -1941,7 +1937,7 @@ BattleAnimFunction_1A: ; cdafa (33:5afa) ld [hl], a ret -BattleAnimFunction_1B: ; cdb06 (33:5b06) +BattleAnimFunction_1B: call BattleAnim_AnonJumptable .anon_dw dw Functioncdb13 @@ -1950,10 +1946,10 @@ BattleAnimFunction_1B: ; cdb06 (33:5b06) dw Functioncdb50 dw Functioncdb65 -Functioncdb13: ; cdb13 (33:5b13) +Functioncdb13: ret -Functioncdb14: ; cdb14 (33:5b14) +Functioncdb14: ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -1969,7 +1965,7 @@ Functioncdb14: ; cdb14 (33:5b14) ld [hl], a ret -Functioncdb28: ; cdb28 (33:5b28) +Functioncdb28: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1994,7 +1990,7 @@ Functioncdb28: ; cdb28 (33:5b28) dec [hl] ret -Functioncdb50: ; cdb50 (33:5b50) +Functioncdb50: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -2005,7 +2001,7 @@ Functioncdb50: ; cdb50 (33:5b50) ld hl, BATTLEANIMSTRUCT_DURATION add hl, bc ld [hl], $80 -Functioncdb65: ; cdb65 (33:5b65) +Functioncdb65: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2024,7 +2020,7 @@ Functioncdb65: ; cdb65 (33:5b65) ld [hl], a ret -BattleAnimFunction_1D: ; cdb80 (33:5b80) +BattleAnimFunction_1D: call BattleAnim_AnonJumptable .anon_dw dw Functioncdb9f @@ -2042,7 +2038,7 @@ BattleAnimFunction_1D: ; cdb80 (33:5b80) dw Functioncdc57 dw Functioncdc74 -Functioncdb9f: ; cdb9f (33:5b9f) +Functioncdb9f: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $28 @@ -2056,7 +2052,7 @@ Functioncdb9f: ; cdb9f (33:5b9f) ld [hl], a ret -Functioncdbb3: ; cdbb3 (33:5bb3) +Functioncdbb3: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2067,7 +2063,7 @@ Functioncdbb3: ; cdbb3 (33:5bb3) call Functioncdc75 ret -Functioncdbc1: ; cdbc1 (33:5bc1) +Functioncdbc1: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2078,7 +2074,7 @@ Functioncdbc1: ; cdbc1 (33:5bc1) call Functioncdc75 ret -Functioncdbcf: ; cdbcf (33:5bcf) +Functioncdbcf: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2097,7 +2093,7 @@ Functioncdbcf: ; cdbcf (33:5bcf) inc [hl] ret -Functioncdbeb: ; cdbeb (33:5beb) +Functioncdbeb: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -2110,7 +2106,7 @@ Functioncdbeb: ; cdbeb (33:5beb) ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX add hl, bc dec [hl] -asm_cdbfa: ; cdbfa (33:5bfa) +asm_cdbfa: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc inc [hl] @@ -2132,17 +2128,17 @@ asm_cdbfa: ; cdbfa (33:5bfa) ld [hl], e ret -Functioncdc1a: ; cdc1a (33:5c1a) +Functioncdc1a: call DeinitBattleAnimation ret -Functioncdc1e: ; cdc1e (33:5c1e) +Functioncdc1e: ld a, BATTLEANIMFRAMESET_4E call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex ret -Functioncdc27: ; cdc27 (33:5c27) +Functioncdc27: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2155,7 +2151,7 @@ Functioncdc27: ; cdc27 (33:5c27) ld [hl], a ret -Functioncdc39: ; cdc39 (33:5c39) +Functioncdc39: ld a, BATTLEANIMFRAMESET_50 call ReinitBattleAnimFrameset ld hl, BATTLEANIMSTRUCT_YOFFSET @@ -2164,7 +2160,7 @@ Functioncdc39: ; cdc39 (33:5c39) call BattleAnim_IncAnonJumptableIndex ret -Functioncdc48: ; cdc48 (33:5c48) +Functioncdc48: ld a, BATTLEANIMFRAMESET_4F call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex @@ -2173,7 +2169,7 @@ Functioncdc48: ; cdc48 (33:5c48) ld [hl], $40 ret -Functioncdc57: ; cdc57 (33:5c57) +Functioncdc57: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2192,10 +2188,10 @@ Functioncdc57: ; cdc57 (33:5c57) .asm_cdc71 call BattleAnim_IncAnonJumptableIndex -Functioncdc74: ; cdc74 (33:5c74) +Functioncdc74: ret -Functioncdc75: ; cdc75 (33:5c75) +Functioncdc75: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hli] @@ -2227,7 +2223,7 @@ Functioncdc75: ; cdc75 (33:5c75) call BattleAnim_IncAnonJumptableIndex ret -BattleAnimFunction_1E: ; cdca6 (33:5ca6) +BattleAnimFunction_1E: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -2249,13 +2245,13 @@ BattleAnimFunction_1E: ; cdca6 (33:5ca6) ld [hl], a ret -BattleAnimFunction_21: ; cdcc3 (33:5cc3) +BattleAnimFunction_21: call BattleAnim_AnonJumptable .anon_dw dw Functioncdcca dw Functioncdced -Functioncdcca: ; cdcca (33:5cca) +Functioncdcca: ld a, [hBattleTurn] and a jr z, .asm_cdcd9 @@ -2277,7 +2273,7 @@ Functioncdcca: ; cdcca (33:5cca) call ReinitBattleAnimFrameset ret -Functioncdced: ; cdced (33:5ced) +Functioncdced: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2291,7 +2287,7 @@ Functioncdced: ; cdced (33:5ced) call DeinitBattleAnimation ret -Functioncdcfe: ; cdcfe (33:5cfe) +Functioncdcfe: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -2324,13 +2320,13 @@ Functioncdcfe: ; cdcfe (33:5cfe) ld [hl], a ret -BattleAnimFunction_22: ; cdd2a (33:5d2a) +BattleAnimFunction_22: call BattleAnim_AnonJumptable .anon_dw dw Functioncdd31 dw Functioncdd4f -Functioncdd31: ; cdd31 (33:5d31) +Functioncdd31: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -2349,7 +2345,7 @@ Functioncdd31: ; cdd31 (33:5d31) call ReinitBattleAnimFrameset ret -Functioncdd4f: ; cdd4f (33:5d4f) +Functioncdd4f: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2392,13 +2388,13 @@ Functioncdd4f: ; cdd4f (33:5d4f) inc [hl] ret -BattleAnimFunction_23: ; cdd90 (33:5d90) +BattleAnimFunction_23: call BattleAnim_AnonJumptable .anon_dw dw Functioncdd97 dw Functioncddbc -Functioncdd97: ; cdd97 (33:5d97) +Functioncdd97: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -2420,7 +2416,7 @@ Functioncdd97: ; cdd97 (33:5d97) ld a, [hl] and $7f ld [hl], a -Functioncddbc: ; cddbc (33:5dbc) +Functioncddbc: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2461,14 +2457,14 @@ Functioncddbc: ; cddbc (33:5dbc) call ReinitBattleAnimFrameset ret -BattleAnimFunction_24: ; cddf9 (33:5df9) +BattleAnimFunction_24: call BattleAnim_AnonJumptable .anon_dw dw Functioncde02 dw Functioncde20 dw Functioncde21 -Functioncde02: ; cde02 (33:5e02) +Functioncde02: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -2485,19 +2481,17 @@ Functioncde02: ; cde02 (33:5e02) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a -Functioncde20: ; cde20 (33:5e20) +Functioncde20: ret -Functioncde21: ; cde21 (33:5e21) +Functioncde21: call DeinitBattleAnimation ret -; cde25 (33:5e25) -Unknown_cde25: ; cde25 +Unknown_cde25: db $ec, $f8, $00 -; cde28 -BattleAnimFunction_25: ; cde28 (33:5e28) +BattleAnimFunction_25: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2526,7 +2520,7 @@ BattleAnimFunction_25: ; cde28 (33:5e28) ld [hl], e ret -BattleAnimFunction_26: ; cde54 (33:5e54) +BattleAnimFunction_26: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2542,13 +2536,13 @@ BattleAnimFunction_26: ; cde54 (33:5e54) inc [hl] ret -BattleAnimFunction_27: ; cde6b (33:5e6b) +BattleAnimFunction_27: call BattleAnim_AnonJumptable .anon_dw dw Functioncde72 dw Functioncde88 -Functioncde72: ; cde72 (33:5e72) +Functioncde72: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -2561,16 +2555,16 @@ Functioncde72: ; cde72 (33:5e72) .asm_cde83 add BATTLEANIMFRAMESET_6A call ReinitBattleAnimFrameset -Functioncde88: ; cde88 (33:5e88) +Functioncde88: ret -BattleAnimFunction_28: ; cde89 (33:5e89) +BattleAnimFunction_28: call BattleAnim_AnonJumptable .anon_dw dw Functioncde90 dw Functioncdebf -Functioncde90: ; cde90 (33:5e90) +Functioncde90: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -2602,7 +2596,7 @@ Functioncde90: ; cde90 (33:5e90) call ReinitBattleAnimFrameset ret -Functioncdebf: ; cdebf (33:5ebf) +Functioncdebf: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2626,7 +2620,7 @@ Functioncdebf: ; cdebf (33:5ebf) ld [hl], a ret -BattleAnimFunction_SpiralDescent: ; cdedd (33:5edd) +BattleAnimFunction_SpiralDescent: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2667,7 +2661,7 @@ BattleAnimFunction_SpiralDescent: ; cdedd (33:5edd) call DeinitBattleAnimation ret -BattleAnimFunction_2D: ; cdf1b (33:5f1b) +BattleAnimFunction_2D: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2708,13 +2702,13 @@ BattleAnimFunction_2D: ; cdf1b (33:5f1b) call DeinitBattleAnimation ret -BattleAnimFunction_PoisonGas: ; cdf59 (33:5f59) +BattleAnimFunction_PoisonGas: call BattleAnim_AnonJumptable .anon_dw dw Functioncdf60 dw BattleAnimFunction_SpiralDescent -Functioncdf60: ; cdf60 (33:5f60) +Functioncdf60: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2744,7 +2738,7 @@ Functioncdf60: ; cdf60 (33:5f60) call BattleAnim_IncAnonJumptableIndex ret -BattleAnimFunction_34: ; cdf8c (33:5f8c) +BattleAnimFunction_34: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2786,7 +2780,7 @@ BattleAnimFunction_34: ; cdf8c (33:5f8c) call DeinitBattleAnimation ret -BattleAnimFunction_3C: ; cdfcb (33:5fcb) +BattleAnimFunction_3C: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2829,14 +2823,14 @@ BattleAnimFunction_3C: ; cdfcb (33:5fcb) call DeinitBattleAnimation ret -BattleAnimFunction_35: ; ce00b (33:600b) +BattleAnimFunction_35: call BattleAnim_AnonJumptable .anon_dw dw Functionce014 dw Functionce023 dw Functionce05f -Functionce014: ; ce014 (33:6014) +Functionce014: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -2844,7 +2838,7 @@ Functionce014: ; ce014 (33:6014) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $10 -Functionce023: ; ce023 (33:6023) +Functionce023: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2883,18 +2877,18 @@ Functionce023: ; ce023 (33:6023) srl [hl] ret -Functionce05f: ; ce05f (33:605f) +Functionce05f: call DeinitBattleAnimation ret -BattleAnimFunction_Horn: ; ce063 (33:6063) +BattleAnimFunction_Horn: call BattleAnim_AnonJumptable .anon_dw dw .zero dw .one dw .two dw Functionce09e -.zero: ; ce06e (33:606e) +.zero: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2909,7 +2903,7 @@ BattleAnimFunction_Horn: ; ce063 (33:6063) ld [hl], a ret -.one: ; ce083 (33:6083) +.one: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2919,7 +2913,7 @@ BattleAnimFunction_Horn: ; ce063 (33:6063) call Functionce70a ret -.two: ; ce091 (33:6091) +.two: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -2928,7 +2922,7 @@ BattleAnimFunction_Horn: ; ce063 (33:6063) call DeinitBattleAnimation ret -Functionce09e: ; ce09e (33:609e) +Functionce09e: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -2953,14 +2947,14 @@ Functionce09e: ; ce09e (33:609e) ld [hl], a ret -BattleAnimFunction_2C: ; ce0c5 (33:60c5) +BattleAnimFunction_2C: call BattleAnim_AnonJumptable .anon_dw dw Functionce0ce dw Functionce0f8 dw Functionce0dd -Functionce0ce: ; ce0ce (33:60ce) +Functionce0ce: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -2971,7 +2965,7 @@ Functionce0ce: ; ce0ce (33:60ce) ld [hl], a ret -Functionce0dd: ; ce0dd (33:60dd) +Functionce0dd: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -2988,7 +2982,7 @@ Functionce0dd: ; ce0dd (33:60dd) ld a, [hl] sub $4 ld [hl], a -Functionce0f8: ; ce0f8 (33:60f8) +Functionce0f8: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -3004,13 +2998,13 @@ Functionce0f8: ; ce0f8 (33:60f8) call Functionce70a ret -BattleAnimFunction_2E: ; ce10e (33:610e) +BattleAnimFunction_2E: call BattleAnim_AnonJumptable .anon_dw dw Functionce115 dw Functionce12a -Functionce115: ; ce115 (33:6115) +Functionce115: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3022,7 +3016,7 @@ Functionce115: ; ce115 (33:6115) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], a -Functionce12a: ; ce12a (33:612a) +Functionce12a: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hli] @@ -3055,7 +3049,7 @@ Functionce12a: ; ce12a (33:612a) srl [hl] ret -BattleAnimFunction_2F: ; ce15c (33:615c) +BattleAnimFunction_2F: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3114,7 +3108,7 @@ BattleAnimFunction_2F: ; ce15c (33:615c) call DeinitBattleAnimation ret -BattleAnimFunction_42: ; ce1b0 (33:61b0) +BattleAnimFunction_42: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3153,13 +3147,13 @@ BattleAnimFunction_42: ; ce1b0 (33:61b0) call DeinitBattleAnimation ret -BattleAnimFunction_30: ; ce1e7 (33:61e7) +BattleAnimFunction_30: call BattleAnim_AnonJumptable .anon_dw dw Functionce1ee dw Functionce1fb -Functionce1ee: ; ce1ee (33:61ee) +Functionce1ee: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc @@ -3167,7 +3161,7 @@ Functionce1ee: ; ce1ee (33:61ee) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], a -Functionce1fb: ; ce1fb (33:61fb) +Functionce1fb: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3193,13 +3187,13 @@ Functionce1fb: ; ce1fb (33:61fb) inc [hl] ret -BattleAnimFunction_31: ; ce226 (33:6226) +BattleAnimFunction_31: call BattleAnim_AnonJumptable .anon_dw dw Functionce22d dw Functionce254 -Functionce22d: ; ce22d (33:622d) +Functionce22d: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3220,10 +3214,10 @@ Functionce22d: ; ce22d (33:622d) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $f -Functionce254: ; ce254 (33:6254) +Functionce254: ret -BattleAnimFunction_32: ; ce255 (33:6255) +BattleAnimFunction_32: call BattleAnim_AnonJumptable .anon_dw dw Functionce260 @@ -3231,7 +3225,7 @@ BattleAnimFunction_32: ; ce255 (33:6255) dw Functionce278 dw Functionce289 -Functionce260: ; ce260 (33:6260) +Functionce260: call BattleAnim_IncAnonJumptableIndex ld a, [hBattleTurn] and a @@ -3247,11 +3241,11 @@ Functionce260: ; ce260 (33:6260) ld [hl], a ret -Functionce274: ; ce274 (33:6274) +Functionce274: call Functionce29f ret -Functionce278: ; ce278 (33:6278) +Functionce278: call Functionce29f ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -3262,7 +3256,7 @@ Functionce278: ; ce278 (33:6278) call Functionce70a ret -Functionce289: ; ce289 (33:6289) +Functionce289: call Functionce29f ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -3277,7 +3271,7 @@ Functionce289: ; ce289 (33:6289) call DeinitBattleAnimation ret -Functionce29f: ; ce29f (33:629f) +Functionce29f: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -3303,14 +3297,12 @@ Functionce29f: ; ce29f (33:629f) ld [wOBP0], a ret -; ce2c4 (33:62c4) -Unknown_ce2c4: ; ce2c4 +Unknown_ce2c4: db $ff, $aa, $55, $aa -Unknown_ce2c8: ; ce2c8 +Unknown_ce2c8: db $ff, $ff, $00, $00 -; ce2cc -BattleAnimFunction_33: ; ce2cc (33:62cc) +BattleAnimFunction_33: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3340,14 +3332,14 @@ BattleAnimFunction_33: ; ce2cc (33:62cc) dec [hl] ret -BattleAnimFunction_36: ; ce2fd (33:62fd) +BattleAnimFunction_36: call BattleAnim_AnonJumptable .anon_dw dw Functionce306 dw Functionce330 dw Functionce34c -Functionce306: ; ce306 (33:6306) +Functionce306: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3376,7 +3368,7 @@ Functionce306: ; ce306 (33:6306) ld [hl], e ret -Functionce330: ; ce330 (33:6330) +Functionce330: ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld a, [hl] @@ -3399,7 +3391,7 @@ Functionce330: ; ce330 (33:6330) ld [hl], a ret -Functionce34c: ; ce34c (33:634c) +Functionce34c: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -3413,13 +3405,13 @@ Functionce34c: ; ce34c (33:634c) call DeinitBattleAnimation ret -BattleAnimFunction_37: ; ce35f (33:635f) +BattleAnimFunction_37: call BattleAnim_AnonJumptable .anon_dw dw Functionce366 dw Functionce375 -Functionce366: ; ce366 (33:6366) +Functionce366: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3427,7 +3419,7 @@ Functionce366: ; ce366 (33:6366) and $7f add BATTLEANIMFRAMESET_81 call ReinitBattleAnimFrameset -Functionce375: ; ce375 (33:6375) +Functionce375: ld hl, BATTLEANIMSTRUCT_0B add hl, bc bit 7, [hl] @@ -3443,21 +3435,21 @@ Functionce375: ; ce375 (33:6375) dec [hl] ret -BattleAnimFunction_38: ; ce389 (33:6389) +BattleAnimFunction_38: call BattleAnim_AnonJumptable .anon_dw dw Functionce392 dw Functionce39c dw Functionce3ae -Functionce392: ; ce392 (33:6392) +Functionce392: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $c ret -Functionce39c: ; ce39c (33:639c) +Functionce39c: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3470,13 +3462,13 @@ Functionce39c: ; ce39c (33:639c) call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_20 call ReinitBattleAnimFrameset -Functionce3ae: ; ce3ae (33:63ae) +Functionce3ae: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc dec [hl] ret -BattleAnimFunction_39: ; ce3b4 (33:63b4) +BattleAnimFunction_39: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3496,7 +3488,7 @@ BattleAnimFunction_39: ; ce3b4 (33:63b4) ld [hl], a ret -BattleAnimFunction_3A: ; ce3d2 (33:63d2) +BattleAnimFunction_3A: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3526,13 +3518,13 @@ BattleAnimFunction_3A: ; ce3d2 (33:63d2) inc [hl] ret -BattleAnimFunction_3B: ; ce3ff (33:63ff) +BattleAnimFunction_3B: call BattleAnim_AnonJumptable .anon_dw dw Functionce406 dw Functionce412 -Functionce406: ; ce406 (33:6406) +Functionce406: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3542,11 +3534,11 @@ Functionce406: ; ce406 (33:6406) ld [hl], a ret -Functionce412: ; ce412 (33:6412) +Functionce412: call DeinitBattleAnimation ret -BattleAnimFunction_3D: ; ce416 (33:6416) +BattleAnimFunction_3D: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3570,14 +3562,14 @@ BattleAnimFunction_3D: ; ce416 (33:6416) inc [hl] ret -BattleAnimFunction_3E: ; ce43a (33:643a) +BattleAnimFunction_3E: call BattleAnim_AnonJumptable .anon_dw dw Functionce443 dw Functionce465 dw Functionce490 -Functionce443: ; ce443 (33:6443) +Functionce443: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3596,7 +3588,7 @@ Functionce443: ; ce443 (33:6443) and $f0 or $8 ld [hl], a -Functionce465: ; ce465 (33:6465) +Functionce465: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3625,7 +3617,7 @@ Functionce465: ; ce465 (33:6465) .asm_ce48b ld [hl], $10 call BattleAnim_IncAnonJumptableIndex -Functionce490: ; ce490 (33:6490) +Functionce490: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3635,20 +3627,20 @@ Functionce490: ; ce490 (33:6490) call DeinitBattleAnimation ret -BattleAnimFunction_40: ; ce49c (33:649c) +BattleAnimFunction_40: call BattleAnim_AnonJumptable .anon_dw dw Functionce4a3 dw Functionce4b0 -Functionce4a3: ; ce4a3 (33:64a3) +Functionce4a3: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, BATTLEANIMFRAMESET_24 add [hl] call ReinitBattleAnimFrameset -Functionce4b0: ; ce4b0 (33:64b0) +Functionce4b0: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3678,7 +3670,7 @@ Functionce4b0: ; ce4b0 (33:64b0) call DeinitBattleAnimation ret -BattleAnimFunction_41: ; ce4dc (33:64dc) +BattleAnimFunction_41: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3708,7 +3700,7 @@ BattleAnimFunction_41: ; ce4dc (33:64dc) srl [hl] ret -BattleAnimFunction_43: ; ce508 (33:6508) +BattleAnimFunction_43: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3738,7 +3730,7 @@ BattleAnimFunction_43: ; ce508 (33:6508) call DeinitBattleAnimation ret -BattleAnimFunction_44: ; ce532 (33:6532) +BattleAnimFunction_44: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld e, [hl] @@ -3767,14 +3759,14 @@ BattleAnimFunction_44: ; ce532 (33:6532) ld [hl], a ret -BattleAnimFunction_45: ; ce55b (33:655b) +BattleAnimFunction_45: call BattleAnim_AnonJumptable .anon_dw dw Functionce564 dw Functionce56e dw Functionce577 -Functionce564: ; ce564 (33:6564) +Functionce564: ld d, $18 ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3782,12 +3774,12 @@ Functionce564: ; ce564 (33:6564) inc [hl] jr asm_ce58f -Functionce56e: ; ce56e (33:656e) +Functionce56e: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $18 -Functionce577: ; ce577 (33:6577) +Functionce577: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -3805,17 +3797,17 @@ Functionce577: ; ce577 (33:6577) call DeinitBattleAnimation ret -asm_ce58f: ; ce58f (33:658f) +asm_ce58f: call Functionce6f1 ret -BattleAnimFunction_46: ; ce593 (33:6593) +BattleAnimFunction_46: call BattleAnim_AnonJumptable .anon_dw dw Functionce5b3 dw Functionce59a -Functionce59a: ; ce59a (33:659a) +Functionce59a: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -3833,10 +3825,10 @@ Functionce59a: ; ce59a (33:659a) .asm_ce5b0 call DeinitBattleAnimation -Functionce5b3: ; ce5b3 (33:65b3) +Functionce5b3: ret -BattleAnimFunction_47: ; ce5b4 (33:65b4) +BattleAnimFunction_47: ld d, $50 ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3863,7 +3855,7 @@ BattleAnimFunction_47: ; ce5b4 (33:65b4) ld [hl], a ret -BattleAnimFunction_48: ; ce5dc (33:65dc) +BattleAnimFunction_48: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3879,7 +3871,7 @@ BattleAnimFunction_48: ; ce5dc (33:65dc) call DeinitBattleAnimation ret -BattleAnimFunction_49: ; ce5ee (33:65ee) +BattleAnimFunction_49: call BattleAnim_AnonJumptable .anon_dw dw Functionce5f9 @@ -3887,7 +3879,7 @@ BattleAnimFunction_49: ; ce5ee (33:65ee) dw Functionce622 dw Functionce618 -Functionce5f9: ; ce5f9 (33:65f9) +Functionce5f9: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3897,7 +3889,7 @@ Functionce5f9: ; ce5f9 (33:65f9) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], $ec -Functionce60a: ; ce60a (33:660a) +Functionce60a: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3909,14 +3901,14 @@ Functionce60a: ; ce60a (33:660a) inc [hl] ret -Functionce618: ; ce618 (33:6618) +Functionce618: call DeinitBattleAnimation ret -asm_ce61c: ; ce61c (33:661c) +asm_ce61c: call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex -Functionce622: ; ce622 (33:6622) +Functionce622: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3928,7 +3920,7 @@ Functionce622: ; ce622 (33:6622) dec [hl] ret -BattleAnimFunction_4A: ; ce62f (33:662f) +BattleAnimFunction_4A: call BattleAnim_AnonJumptable .anon_dw dw Functionce63a @@ -3936,7 +3928,7 @@ BattleAnimFunction_4A: ; ce62f (33:662f) dw Functionce65c dw Functionce672 -Functionce63a: ; ce63a (33:663a) +Functionce63a: ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld a, [hl] @@ -3946,7 +3938,7 @@ Functionce63a: ; ce63a (33:663a) call BattleAnim_IncAnonJumptableIndex ret -Functionce648: ; ce648 (33:6648) +Functionce648: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3962,7 +3954,7 @@ Functionce648: ; ce648 (33:6648) inc [hl] ret -Functionce65c: ; ce65c (33:665c) +Functionce65c: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3979,7 +3971,7 @@ Functionce65c: ; ce65c (33:665c) ld [hl], a ret -Functionce672: ; ce672 (33:6672) +Functionce672: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3996,7 +3988,7 @@ Functionce672: ; ce672 (33:6672) ld [hl], a ret -BattleAnimFunction_4B: ; ce688 (33:6688) +BattleAnimFunction_4B: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld d, [hl] @@ -4027,7 +4019,7 @@ BattleAnimFunction_4B: ; ce688 (33:6688) ld [hl], e ret -BattleAnimFunction_4C: ; ce6b3 (33:66b3) +BattleAnimFunction_4C: ld d, $18 ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -4036,7 +4028,7 @@ BattleAnimFunction_4C: ; ce6b3 (33:66b3) call Functionce6f1 ret -BattleAnimFunction_4F: ; ce6bf (33:66bf) +BattleAnimFunction_4F: ld d, $18 ld hl, BATTLEANIMSTRUCT_10 add hl, bc @@ -4049,7 +4041,7 @@ BattleAnimFunction_4F: ; ce6bf (33:66bf) call Functionce6f1 ret -BattleAnimFunction_4D: ; ce6d2 (33:66d2) +BattleAnimFunction_4D: ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld a, [hl] @@ -4071,7 +4063,7 @@ BattleAnimFunction_4D: ; ce6d2 (33:66d2) call DeinitBattleAnimation ret -Functionce6f1: ; ce6f1 (33:66f1) +Functionce6f1: push af push de call BattleAnim_Sine @@ -4088,7 +4080,7 @@ Functionce6f1: ; ce6f1 (33:66f1) ld [hl], a ret -Functionce70a: ; ce70a (33:670a) +Functionce70a: and $f ld e, a ld hl, BATTLEANIMSTRUCT_XCOORD @@ -4104,7 +4096,7 @@ Functionce70a: ; ce70a (33:670a) jr nz, .asm_ce719 ret -BattleAnim_AnonJumptable: ; ce71e (33:671e) +BattleAnim_AnonJumptable: pop de ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX add hl, bc @@ -4117,49 +4109,45 @@ BattleAnim_AnonJumptable: ; ce71e (33:671e) ld l, a jp hl -BattleAnim_IncAnonJumptableIndex: ; ce72c (33:672c) +BattleAnim_IncAnonJumptableIndex: ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX add hl, bc inc [hl] ret -BattleAnim_Cosine: ; ce732 (33:6732) +BattleAnim_Cosine: ; a = d * cos(a * pi/32) add %010000 ; cos(x) = sin(x + pi/2) ; fallthrough -BattleAnim_Sine: ; ce734 (33:6734) +BattleAnim_Sine: ; a = d * sin(a * pi/32) calc_sine_wave BattleAnimSineWave -BattleAnim_Sine_e: ; ce765 (33:6765) +BattleAnim_Sine_e: ld a, e call BattleAnim_Sine ld e, a ret -BattleAnim_Cosine_e: ; ce76b (33:676b) +BattleAnim_Cosine_e: ld a, e call BattleAnim_Cosine ld e, a ret -; ce771 (33:6771) -BattleAnim_AbsSinePrecise: ; ce771 +BattleAnim_AbsSinePrecise: ld a, e call BattleAnim_Sine ld e, l ld d, h ret -; ce778 -BattleAnim_AbsCosinePrecise: ; ce778 +BattleAnim_AbsCosinePrecise: ld a, e call BattleAnim_Cosine ld e, l ld d, h ret -; ce77f -BattleAnimSineWave: ; ce77f +BattleAnimSineWave: sine_table 32 -; ce7bf diff --git a/engine/battle_anims/helpers.asm b/engine/battle_anims/helpers.asm index 0a00b65a4..63177b1b1 100644 --- a/engine/battle_anims/helpers.asm +++ b/engine/battle_anims/helpers.asm @@ -1,4 +1,4 @@ -ReinitBattleAnimFrameset: ; ce7bf (33:67bf) +ReinitBattleAnimFrameset: ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc ld [hl], a @@ -10,7 +10,7 @@ ReinitBattleAnimFrameset: ; ce7bf (33:67bf) ld [hl], -1 ret -GetBattleAnimFrame: ; ce7d1 +GetBattleAnimFrame: .loop ld hl, BATTLEANIMSTRUCT_DURATION add hl, bc @@ -72,9 +72,7 @@ GetBattleAnimFrame: ; ce7d1 ld [hl], a jr .loop -; ce823 - -.GetPointer: ; ce823 +.GetPointer: ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc ld e, [hl] @@ -93,9 +91,7 @@ GetBattleAnimFrame: ; ce7d1 add hl, de ret -; ce83c - -GetBattleAnimOAMPointer: ; ce83c +GetBattleAnimOAMPointer: ld l, a ld h, 0 ld de, BattleAnimOAMData @@ -104,9 +100,7 @@ GetBattleAnimOAMPointer: ; ce83c add hl, de ret -; ce846 - -LoadBattleAnimObj: ; ce846 (33:6846) +LoadBattleAnimObj: push hl ld l, a ld h, 0 @@ -126,5 +120,3 @@ LoadBattleAnimObj: ; ce846 (33:6846) call DecompressRequest2bpp pop bc ret - -; ce85e (33:685e) diff --git a/engine/battle_anims/pokeball_wobble.asm b/engine/battle_anims/pokeball_wobble.asm index d85240f08..21f963f7e 100644 --- a/engine/battle_anims/pokeball_wobble.asm +++ b/engine/battle_anims/pokeball_wobble.asm @@ -1,4 +1,4 @@ -GetPokeBallWobble: ; f971 (3:7971) +GetPokeBallWobble: ; Returns whether a Poke Ball will wobble in the catch animation. ; Whether a Pokemon is caught is determined beforehand. diff --git a/engine/events/basement_key.asm b/engine/events/basement_key.asm index 879c86a34..d30149fbe 100644 --- a/engine/events/basement_key.asm +++ b/engine/events/basement_key.asm @@ -1,4 +1,4 @@ -_BasementKey: ; 507b4 +_BasementKey: ; Are we even in the right map to use this? ld a, [wMapGroup] cp GROUP_GOLDENROD_UNDERGROUND @@ -26,9 +26,7 @@ _BasementKey: ; 507b4 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507e1 -.BasementKeyScript: ; 0x507e1 +.BasementKeyScript: closetext farjump BasementDoorScript -; 0x507e6 diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index d75015d5b..534e2c331 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -1,17 +1,15 @@ -BattleTowerRoomMenu: ; 1700b0 +BattleTowerRoomMenu: ; special call InitBattleTowerChallengeRAM farcall _BattleTowerRoomMenu ret -; 1700ba -Function1700ba: ; 1700ba +Function1700ba: call InitBattleTowerChallengeRAM farcall Function11811a ret -; 1700c4 -Function1700c4: ; 1700c4 +Function1700c4: ld a, [rSVBK] push af ld a, $3 @@ -51,16 +49,14 @@ Function1700c4: ; 1700c4 pop af ld [rSVBK], a ret -; 170114 -Function170114: ; 170114 +Function170114: call InitBattleTowerChallengeRAM call .Function170121 farcall Function11805f ret -; 170121 -.Function170121: ; 170121 +.Function170121: ld a, $5 call GetSRAMBank ld hl, $a948 @@ -70,9 +66,8 @@ Function170114: ; 170114 call CloseSRAM call Function170c8b ret -; 170139 -Function170139: ; 170139 +Function170139: ; Convert the 4-digit decimal number at 5:aa41 into binary ld a, $5 call GetSRAMBank @@ -167,9 +162,8 @@ Function170139: ; 170139 call CopyBytes call CloseSRAM ret -; 17020c -.DecToBin: ; 17020c +.DecToBin: ld a, [de] inc de and a @@ -180,29 +174,25 @@ Function170139: ; 170139 dec a jr nz, .digit_loop ret -; 170215 -BattleTowerBattle: ; 170215 +BattleTowerBattle: xor a ld [wBattleTowerBattleEnded], a call _BattleTowerBattle ret -; 17021d -DummySpecial_17021d: ; 17021d +DummySpecial_17021d: ret -; 17021e -InitBattleTowerChallengeRAM: ; 17021e +InitBattleTowerChallengeRAM: xor a ld [wBattleTowerBattleEnded], a ld [wNrOfBeatenBattleTowerTrainers], a ld [wcf65], a ld [wcf66], a ret -; 17022c -_BattleTowerBattle: ; 17022c +_BattleTowerBattle: .loop call .do_dw call DelayFrame @@ -210,9 +200,8 @@ _BattleTowerBattle: ; 17022c cp $1 jr nz, .loop ret -; 17023a -.do_dw ; 17023a +.do_dw ld a, [wBattleTowerBattleEnded] ld e, a ld d, 0 @@ -223,14 +212,12 @@ _BattleTowerBattle: ; 17022c ld h, [hl] ld l, a jp hl -; 170249 -.dw ; 170249 +.dw dw RunBattleTowerTrainer dw SkipBattleTowerTrainer -; 17024d -RunBattleTowerTrainer: ; 17024d +RunBattleTowerTrainer: ld a, [wOptions] push af ld hl, wOptions @@ -277,14 +264,13 @@ RunBattleTowerTrainer: ; 17024d ld [wBattleTowerBattleEnded], a ret - -ReadBTTrainerParty: ; 1702b7 +ReadBTTrainerParty: ; Initialise the BattleTower-Trainer and his mon call CopyBTTrainer_FromBT_OT_TowBT_OTTemp ; Check the nicknames for illegal characters, and replace bad nicknames ; with their species names. - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_1 @@ -294,44 +280,44 @@ ReadBTTrainerParty: ; 1702b7 call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_1 - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_2 - ld a, [wBT_OTTempMon2] ; [$c64e] + ld a, [wBT_OTTempMon2] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_2 - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_3 - ld a, [wBT_OTTempMon3] ; [$c689] + ld a, [wBT_OTTempMon3] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_3 ; Add the terminator character to each of these names ld a, "@" - ld [wBT_OTTempMon1NameEnd - 1], a ; $c64d - ld [wBT_OTTempMon2NameEnd - 1], a ; $c688 - ld [wBT_OTTempMon3NameEnd - 1], a ; $c68a + 57 = $c6c3 + ld [wBT_OTTempMon1NameEnd - 1], a + ld [wBT_OTTempMon2NameEnd - 1], a + ld [wBT_OTTempMon3NameEnd - 1], a ; Fix errors in the movesets call CheckBTMonMovesForErrors ; Repair the trainer name if needed, then copy it to wOTPlayerName @@ -343,7 +329,7 @@ ReadBTTrainerParty: ; 1702b7 jr .done_trainer_name .trainer_name_okay - ld hl, wBT_OTTempName ; 0xc608 + ld hl, wBT_OTTempName .done_trainer_name ld de, wOTPlayerName @@ -394,9 +380,8 @@ ReadBTTrainerParty: ; 1702b7 ld a, -1 ld [bc], a ret -; 170394 -ValidateBTParty: ; 170394 +ValidateBTParty: ; Check for and fix errors in party data ld hl, wBT_OTTempMon1Species ld d, BATTLETOWER_PARTY_LENGTH @@ -501,13 +486,11 @@ endr dec d jp nz, .pkmn_loop ret -; 170426 -BT_ChrisName: ; 170426 +BT_ChrisName: db "CHRIS@" -; 17042c -Function17042c: ; 17042c +Function17042c: ld hl, w3_d202TrainerData ld a, BATTLETOWER_STREAK_LENGTH .loop @@ -568,12 +551,10 @@ Function17042c: ; 17042c dec a jr nz, .loop ret -; 170470 INCLUDE "data/battle_tower/unknown_levels.asm" - -CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 +CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; copy the BattleTower-Trainer data that lies at 'wBT_OTTrainer' to 'wBT_OTTemp' ld a, [rSVBK] push af @@ -595,11 +576,10 @@ CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 ld hl, sNrOfBeatenBattleTowerTrainers inc [hl] call CloseSRAM -SkipBattleTowerTrainer: ; 1704c9 +SkipBattleTowerTrainer: ret -; 1704ca -Unreferenced_Function1704ca: ; 1704ca +Unreferenced_Function1704ca: ld a, [$be46] cp $7 jr c, .asm_1704d3 @@ -617,18 +597,16 @@ Unreferenced_Function1704ca: ; 1704ca .asm_1704e0 ret -; 1704e1 -Function1704e1: ; 1704e1 +Function1704e1: call SpeechTextBox call FadeToMenu call InitBattleTowerChallengeRAM call .JumptableLoop call CloseSubmenu ret -; 1704f1 -.JumptableLoop: ; 1704f1 +.JumptableLoop: call ClearBGPalettes call ClearSprites call ClearScreen @@ -643,9 +621,8 @@ Function1704e1: ; 1704e1 .done ret -; 170510 -.DoJumptable: ; 170510 +.DoJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -656,15 +633,13 @@ Function1704e1: ; 1704e1 ld h, [hl] ld l, a jp hl -; 17051f -.dw ; 17051f +.dw dw .Jumptable_0 dw .Jumptable_1 dw .Jumptable_2 -; 170525 -.Jumptable_0: ; 170525 +.Jumptable_0: ld a, $5 call GetSRAMBank @@ -695,12 +670,10 @@ Function1704e1: ; 1704e1 call .PlaceTextItems jr .NextJumptableFunction - .Jumptable_1: call SetPalettes call .NextJumptableFunction - .Jumptable_2: ld hl, hJoyPressed ld a, [hl] @@ -744,9 +717,8 @@ Function1704e1: ; 1704e1 ld hl, wJumptableIndex inc [hl] ret -; 1705b7 -.DrawBorder: ; 1705b7 +.DrawBorder: hlcoord 0, 4 ld a, "┌" ld [hli], a @@ -786,9 +758,8 @@ Function1704e1: ; 1704e1 dec c jr nz, .right_border_loop ret -; 1705f0 -.PlaceTextItems: ; 1705f0 +.PlaceTextItems: call .ClearBox call .PlaceUpDownArrows ld a, $50 @@ -855,9 +826,8 @@ Function1704e1: ; 1704e1 dec a jr nz, .loop1 ret -; 17064b -.ClearBox: ; 17064b +.ClearBox: hlcoord 1, 5 xor a ld b, 12 @@ -872,9 +842,8 @@ Function1704e1: ; 1704e1 dec b jr nz, .clearbox_row ret -; 17065d -.PlaceUpDownArrows: ; 17065d +.PlaceUpDownArrows: ld a, [wNrOfBeatenBattleTowerTrainers] and a jr z, .nope @@ -890,17 +859,14 @@ Function1704e1: ; 1704e1 ld a, "▼" ld [hl], a ret -; 170676 -.String_Mail: ; 170676 +.String_Mail: db "ルーム@" -; 17067a -.String_PastReaders: ; 17067a +.String_PastReaders: db "れきだいりーダーいちらん@" -; 170687 -BattleTowerAction: ; 170687 +BattleTowerAction: ld a, [wScriptVar] ld e, a ld d, 0 @@ -911,10 +877,8 @@ BattleTowerAction: ; 170687 ld h, [hl] ld l, a jp hl -; 170696 - -.dw ; 170696 (5c:4696) +.dw dw BattleTowerAction_CheckExplanationRead ; 0x00 dw BattleTowerAction_SetExplanationRead ; 0x01 dw BattleTowerAction_GetChallengeState ; 0x02 @@ -948,9 +912,8 @@ BattleTowerAction: ; 170687 dw BattleTower_RandomlyChooseReward ; 0x1e dw BattleTower_SaveOptions ; 0x1f - ; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) -ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a +ResetBattleTowerTrainersSRAM: ; BattleTowerAction $1a ld a, BANK(sBTTrainers) call GetSRAMBank @@ -966,7 +929,7 @@ ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a ret -BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b +BattleTower_GiveReward: ; BattleTowerAction $1b ld a, BANK(sBattleTowerReward) call GetSRAMBank @@ -995,7 +958,7 @@ BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b ld [wScriptVar], a ret -Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c +Function17071b: ; BattleTowerAction $1c ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, BATTLETOWER_WON_CHALLENGE @@ -1003,7 +966,7 @@ Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c call CloseSRAM ret -Function170729: ; 170729 (5c:4729) BattleTowerAction $1d +Function170729: ; BattleTowerAction $1d ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, BATTLETOWER_RECEIVED_REWARD @@ -1011,11 +974,11 @@ Function170729: ; 170729 (5c:4729) BattleTowerAction $1d call CloseSRAM ret -BattleTower_SaveOptions: ; 170737 (5c:4737) BattleTowerAction $1f +BattleTower_SaveOptions: ; BattleTowerAction $1f farcall SaveOptions ret -BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e +BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e ; Generate a random stat boosting item. .loop call Random @@ -1036,7 +999,7 @@ BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e call CloseSRAM ret -BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 +BattleTowerAction_CheckExplanationRead: ; BattleTowerAction $00 call BattleTower_CheckSaveFileExistsAndIsYours ld a, [wScriptVar] and a @@ -1050,7 +1013,7 @@ BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 call CloseSRAM ret -BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 +BattleTowerAction_GetChallengeState: ; BattleTowerAction $02 ld hl, sBattleTowerChallengeState ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank @@ -1059,7 +1022,7 @@ BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 call CloseSRAM ret -BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01 +BattleTowerAction_SetExplanationRead: ; BattleTowerAction $01 ld a, BANK(sBattleTowerSaveFileFlags) call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] @@ -1068,13 +1031,13 @@ BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01 call CloseSRAM ret -BattleTowerAction_SetByteToQuickSaveChallenge: ; 170799 (5c:4799) BattleTowerAction $03 +BattleTowerAction_SetByteToQuickSaveChallenge: ; BattleTowerAction $03 ld c, BATTLETOWER_SAVED_AND_LEFT jr asm_17079f -BattleTowerAction_SetByteToCancelChallenge: ; 17079d (5c:479d) BattleTowerAction $04 +BattleTowerAction_SetByteToCancelChallenge: ; BattleTowerAction $04 ld c, BATTLETOWER_NO_CHALLENGE -asm_17079f: ; 17079f (5c:479f) +asm_17079f: ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, c @@ -1082,7 +1045,7 @@ asm_17079f: ; 17079f (5c:479f) call CloseSRAM ret -Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 +Function1707ac: ; BattleTowerAction $05 ld a, $5 call GetSRAMBank ld a, [$aa8c] @@ -1123,7 +1086,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 ld a, $8 ld [wScriptVar], a -Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 +Function1707f4: ; BattleTowerAction $06 ld a, $5 call GetSRAMBank xor a @@ -1133,7 +1096,7 @@ Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 call CloseSRAM ret -Function170807: ; 170807 (5c:4807) BattleTowerAction $16 +Function170807: ; BattleTowerAction $16 call UpdateTime ld a, $5 call GetSRAMBank @@ -1144,7 +1107,7 @@ Function170807: ; 170807 (5c:4807) BattleTowerAction $16 call CloseSRAM ret -Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 +Function17081d: ; BattleTowerAction $17 xor a ld [wScriptVar], a ld a, $5 @@ -1187,7 +1150,7 @@ Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 call CloseSRAM ret -SaveBattleTowerLevelGroup: ; 170868 (5c:4868) BattleTowerAction $07 +SaveBattleTowerLevelGroup: ; BattleTowerAction $07 ld a, BANK(sBTChoiceOfLevelGroup) call GetSRAMBank ld a, [rSVBK] @@ -1201,7 +1164,7 @@ SaveBattleTowerLevelGroup: ; 170868 (5c:4868) BattleTowerAction $07 call CloseSRAM ret -LoadBattleTowerLevelGroup: ; 170881 (5c:4881) BattleTowerAction $08 ; Load level group choice +LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice ld a, BANK(sBTChoiceOfLevelGroup) call GetSRAMBank ld a, [rSVBK] @@ -1215,7 +1178,7 @@ LoadBattleTowerLevelGroup: ; 170881 (5c:4881) BattleTowerAction $08 ; Load level call CloseSRAM ret -BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 +BattleTower_CheckSaveFileExistsAndIsYours: ; BattleTowerAction $09 ld a, [wSaveFileExists] and a jr z, .nope @@ -1230,16 +1193,14 @@ BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 .nope ld [wScriptVar], a ret -; 1708b1 - -Function1708b1: ; 1708b1 (5c:48b1) BattleTowerAction $0a +Function1708b1: ; BattleTowerAction $0a xor a ld [wMusicFade], a call MaxVolume ret -CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do with GS Ball +CheckMobileEventIndex: ; BattleTowerAction $0b something to do with GS Ball ld a, BANK(sMobileEventIndex) call GetSRAMBank ld a, [sMobileEventIndex] @@ -1247,7 +1208,7 @@ CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do call CloseSRAM ret -Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c +Function1708c8: ; BattleTowerAction $0c call UpdateTime ld a, $5 call GetSRAMBank @@ -1266,7 +1227,7 @@ Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c call CloseSRAM ret -Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d +Function1708f0: ; BattleTowerAction $0d xor a ld [wScriptVar], a call UpdateTime @@ -1292,8 +1253,7 @@ Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d ld [wScriptVar], a ret - -Function170923: ; 170923 +Function170923: ld a, $5 call GetSRAMBank xor a @@ -1304,10 +1264,8 @@ Function170923: ; 170923 call ByteFill call CloseSRAM ret -; 17093c - -BattleTowerAction_EggTicket: ; 17093c (5c:493c) BattleTowerAction $0e +BattleTowerAction_EggTicket: ; BattleTowerAction $0e xor a ld [wScriptVar], a ld a, EGG_TICKET @@ -1373,12 +1331,11 @@ endr dec c jr nz, .loop ret -; 1709a4 (5c:49a4) -String_MysteryJP: ; 1709a4 +String_MysteryJP: db "なぞナゾ@@" ; MYSTERY -Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f +Function1709aa: ; BattleTowerAction $0f ld a, [rSVBK] push af ld a, BANK(w3_d090) @@ -1389,7 +1346,7 @@ Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f ld [rSVBK], a ret -Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 +Function1709bb: ; BattleTowerAction $10 xor a ld [wScriptVar], a ld a, $5 @@ -1415,29 +1372,26 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 ld [$a800], a call CloseSRAM ret -; 1709e7 (5c:49e7) -.jumptable: ; 1709e7 +.jumptable: dw .NoAction dw .NoAction dw .DoAction1 dw .DoAction1 dw .Action4 dw .Action5 -; 1709f3 -.DoAction1: ; 1709f3 +.DoAction1: ld a, $5 call GetSRAMBank ld a, $1 ld [$a800], a call CloseSRAM -.NoAction: ; 170a00 +.NoAction: ret -; 170a01 -.Action4: ; 170a01 +.Action4: ld a, $5 call GetSRAMBank ld hl, $b023 @@ -1454,9 +1408,8 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 ld a, $1 ld [wScriptVar], a ret -; 170a33 -.Action5: ; 170a33 +.Action5: ld a, $0 call GetSRAMBank ld hl, wRTC @@ -1516,15 +1469,14 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 .no_scene_2 ret -; 170a9c -Function170a9c: ; 170a9c (5c:4a9c) BattleTowerAction $11 +Function170a9c: ; BattleTowerAction $11 ld c, FALSE jr asm_170aa2 -Function170aa0: ; 170aa0 (5c:4aa0) BattleTowerAction $12 +Function170aa0: ; BattleTowerAction $12 ld c, TRUE -asm_170aa2: ; 170aa2 (5c:4aa2) +asm_170aa2: ld a, $5 call GetSRAMBank ld a, c @@ -1532,7 +1484,7 @@ asm_170aa2: ; 170aa2 (5c:4aa2) call CloseSRAM ret -Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 +Function170aaf: ; BattleTowerAction $13 ld a, $5 call GetSRAMBank ld a, [$aa8d] @@ -1540,7 +1492,7 @@ Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 call CloseSRAM ret -Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 +Function170abe: ; BattleTowerAction $14 call BattleTower_CheckSaveFileExistsAndIsYours ld a, [wScriptVar] and a @@ -1554,7 +1506,7 @@ Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 call CloseSRAM ret -Function170ad7: ; 170ad7 (5c:4ad7) BattleTowerAction $15 +Function170ad7: ; BattleTowerAction $15 ld a, BANK(sBattleTowerSaveFileFlags) call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] @@ -1563,7 +1515,7 @@ Function170ad7: ; 170ad7 (5c:4ad7) BattleTowerAction $15 call CloseSRAM ret -BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 +BattleTowerAction_LevelCheck: ; BattleTowerAction $18 ld a, $5 call GetSRAMBank ld a, [$b2fb] @@ -1583,7 +1535,7 @@ BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 ld [wScriptVar], a ret -BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 +BattleTowerAction_UbersCheck: ; BattleTowerAction $19 ld a, $5 call GetSRAMBank ld a, [$b2fb] @@ -1603,7 +1555,7 @@ BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 ld [wScriptVar], a ret -LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 +LoadOpponentTrainerAndPokemonWithOTSprite: farcall Function_LoadOpponentTrainerAndPokemons ld a, [rSVBK] push af @@ -1646,15 +1598,13 @@ LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 ld [hUsedSpriteTile], a farcall GetUsedSprite ret -; 170b90 INCLUDE "data/trainers/sprites.asm" -DummySpecial_170bd2: ; 170bd2 +DummySpecial_170bd2: ret -; 170bd3 -CheckForBattleTowerRules: ; 170bd3 +CheckForBattleTowerRules: farcall _CheckForBattleTowerRules jr c, .asm_170bde xor a ; FALSE @@ -1666,4 +1616,3 @@ CheckForBattleTowerRules: ; 170bd3 .asm_170be0 ld [wScriptVar], a ret -; 170be4 diff --git a/engine/events/battle_tower/get_trainer_class.asm b/engine/events/battle_tower/get_trainer_class.asm index 570104a2a..3b94b4d35 100644 --- a/engine/events/battle_tower/get_trainer_class.asm +++ b/engine/events/battle_tower/get_trainer_class.asm @@ -5,7 +5,7 @@ GetMobileOTTrainerClass: ; mobile function ld c, a ret -.GetMobileOTTrainerClass: ; 4e930 +.GetMobileOTTrainerClass: ld a, [hli] xor [hl] ld c, a diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index f3db16293..f9be02b28 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -1,4 +1,4 @@ -Function_LoadOpponentTrainerAndPokemons: ; 1f8000 +Function_LoadOpponentTrainerAndPokemons: ld a, [rSVBK] push af ld a, BANK(wBT_OTTrainer) @@ -91,8 +91,7 @@ endc ret - -Function_LoadRandomBattleTowerMon: ; 1f8081 +Function_LoadRandomBattleTowerMon: ld c, BATTLETOWER_PARTY_LENGTH .loop push bc @@ -105,7 +104,7 @@ Function_LoadRandomBattleTowerMon: ; 1f8081 ld a, [wBTChoiceOfLvlGroup] dec a ld hl, BattleTowerMons - ld bc, BattleTowerMons2 - BattleTowerMons1 + ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group call AddNTimes ld a, [hRandomAdd] @@ -207,7 +206,6 @@ Function_LoadRandomBattleTowerMon: ; 1f8081 ld [sBTMonPrevTrainer3], a call CloseSRAM ret -; 1f814e INCLUDE "data/battle_tower/classes.asm" diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index 7ed51315f..6a2990118 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -1,35 +1,31 @@ -CheckForMobileBattleRules: ; 8b1e1 +CheckForMobileBattleRules: ld de, .PointerTables call BattleTower_ExecuteJumptable ret z call BattleTower_PleaseReturnWhenReady scf ret -; 8b1ed -.PointerTables: ; 8b1ed +.PointerTables: db 2 dw .Functions dw .TextPointers -.Functions: ; 8b1f2 +.Functions: dw BattleTower_CheckPartyLengthIs3 dw BattleTower_CheckPartyHasThreeMonsThatAreNotEggs -; 8b1f6 -.TextPointers: ; 8b1f6 +.TextPointers: dw .ExcuseMeText dw JumpText_NeedAtLeastThreeMon dw JumpText_EggDoesNotQualify -; 8b1fc -.ExcuseMeText: ; 0x8b1fc +.ExcuseMeText: ; Excuse me! text_jump UnknownText_0x1c5937 db "@" -; 0x8b201 -_CheckForBattleTowerRules: ; 8b201 +_CheckForBattleTowerRules: ld hl, wStringBuffer2 ld [hl], "3" inc hl @@ -40,83 +36,71 @@ _CheckForBattleTowerRules: ; 8b201 call BattleTower_PleaseReturnWhenReady scf ret -; 8b215 -.PointerTables: ; 8b215 +.PointerTables: db 4 dw .Functions dw .TextPointers -.Functions: ; 8b21a +.Functions: dw Function_PartyCountEq3 dw Function_PartySpeciesAreUnique dw Function_PartyItemsAreUnique dw Function_HasPartyAnEgg -; 8b222 -.TextPointers: ; 8b222 +.TextPointers: dw JumpText_ExcuseMeYoureNotReady dw JumpText_OnlyThreeMonMayBeEntered dw JumpText_TheMonMustAllBeDifferentKinds dw JumpText_TheMonMustNotHoldTheSameItems dw JumpText_YouCantTakeAnEgg -; 8b22c -JumpText_ExcuseMeYoureNotReady: ; 0x8b22c +JumpText_ExcuseMeYoureNotReady: ; Excuse me. You're not ready. text_jump Text_ExcuseMeYoureNotReady db "@" -; 0x8b231 -BattleTower_PleaseReturnWhenReady: ; 8b231 +BattleTower_PleaseReturnWhenReady: ld hl, .PleaseReturnWhenReady call PrintText ret -; 8b238 -.PleaseReturnWhenReady: ; 0x8b238 +.PleaseReturnWhenReady: ; Please return when you're ready. text_jump UnknownText_0x1c5962 db "@" -; 0x8b23d -JumpText_NeedAtLeastThreeMon: ; 0x8b23d +JumpText_NeedAtLeastThreeMon: ; You need at least three #MON. text_jump UnknownText_0x1c5983 db "@" -; 0x8b242 -JumpText_EggDoesNotQualify: ; 0x8b242 +JumpText_EggDoesNotQualify: ; Sorry, an EGG doesn't qualify. text_jump UnknownText_0x1c59a3 db "@" -; 0x8b247 -JumpText_OnlyThreeMonMayBeEntered: ; 0x8b247 +JumpText_OnlyThreeMonMayBeEntered: ; Only three #MON may be entered. text_jump Text_OnlyThreeMonMayBeEntered db "@" -; 0x8b24c -JumpText_TheMonMustAllBeDifferentKinds: ; 0x8b24c +JumpText_TheMonMustAllBeDifferentKinds: ; The @ #MON must all be different kinds. text_jump Text_TheMonMustAllBeDifferentKinds db "@" -; 0x8b251 -JumpText_TheMonMustNotHoldTheSameItems: ; 0x8b251 +JumpText_TheMonMustNotHoldTheSameItems: ; The @ #MON must not hold the same items. text_jump Text_TheMonMustNotHoldTheSameItems db "@" -; 0x8b256 -JumpText_YouCantTakeAnEgg: ; 0x8b256 +JumpText_YouCantTakeAnEgg: ; You can't take an EGG! text_jump Text_YouCantTakeAnEgg db "@" -; 0x8b25b -BattleTower_ExecuteJumptable: ; 8b25b +BattleTower_ExecuteJumptable: ld bc, 0 .loop call .DoJumptableFunction @@ -126,9 +110,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, b and a ret -; 8b26c -.DoJumptableFunction: ; 8b26c +.DoJumptableFunction: push de push bc call .GetFunctionPointer @@ -137,16 +120,14 @@ BattleTower_ExecuteJumptable: ; 8b25b pop bc pop de ret -; 8b276 -.Next_CheckReachedEnd: ; 8b276 +.Next_CheckReachedEnd: inc c ld a, [de] cp c ret -; 8b27a -.GetFunctionPointer: ; 8b27a +.GetFunctionPointer: inc de ld a, [de] ld l, a @@ -154,9 +135,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, [de] ld h, a ret -; 8b281 -.GetTextPointers: ; 8b281 +.GetTextPointers: inc de inc de inc de @@ -166,16 +146,14 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, [de] ld h, a ret -; 8b28a -.LoadTextPointer: ; 8b28a +.LoadTextPointer: ld a, [hli] ld h, [hl] ld l, a ret -; 8b28e -.PrintFailureText: ; 8b28e +.PrintFailureText: push de push bc ld a, b @@ -186,18 +164,16 @@ BattleTower_ExecuteJumptable: ; 8b25b ld b, $1 pop de ret -; 8b29d -.PrintFirstText: ; 8b29d +.PrintFirstText: push de call .GetTextPointers call .LoadTextPointer call PrintText pop de ret -; 8b2a9 -.PrintNthText: ; 8b2a9 +.PrintNthText: push bc call .GetTextPointers inc hl @@ -209,15 +185,13 @@ BattleTower_ExecuteJumptable: ; 8b25b call PrintText pop bc ret -; 8b2bb -BattleTower_CheckPartyLengthIs3: ; 8b2bb +BattleTower_CheckPartyLengthIs3: ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret -; 8b2c1 -BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 +BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ld hl, wPartyCount ld a, [hli] ld b, $0 @@ -237,23 +211,20 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 ld a, b cp BATTLETOWER_PARTY_LENGTH ret -; 8b2da -Function_PartyCountEq3: ; 8b2da +Function_PartyCountEq3: ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret z scf ret -; 8b2e2 -Function_PartySpeciesAreUnique: ; 8b2e2 +Function_PartySpeciesAreUnique: ld hl, wPartyMon1Species call VerifyUniqueness ret -; 8b2e9 -VerifyUniqueness: ; 8b2e9 +VerifyUniqueness: ld de, wPartyCount ld a, [de] inc de @@ -296,18 +267,16 @@ VerifyUniqueness: ; 8b2e9 pop hl scf ret -; 8b31a -.nextmon ; 8b31a +.nextmon push bc ld bc, PARTYMON_STRUCT_LENGTH add hl, bc inc de pop bc ret -; 8b322 -.isegg ; 8b322 +.isegg push bc ld b, a ld a, [de] @@ -315,15 +284,13 @@ VerifyUniqueness: ; 8b2e9 ld a, b pop bc ret -; 8b32a -Function_PartyItemsAreUnique: ; 8b32a +Function_PartyItemsAreUnique: ld hl, wPartyMon1Item call VerifyUniqueness ret -; 8b331 -Function_HasPartyAnEgg: ; 8b331 +Function_HasPartyAnEgg: ld hl, wPartyCount ld a, [hli] ld c, a @@ -339,4 +306,3 @@ Function_HasPartyAnEgg: ; 8b331 .found scf ret -; 8b342 diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm index c4bcedf64..e2db148b7 100644 --- a/engine/events/battle_tower/trainer_text.asm +++ b/engine/events/battle_tower/trainer_text.asm @@ -1,4 +1,4 @@ -BattleTowerText:: ; 11c000 +BattleTowerText:: ; Print text c for trainer [wBT_OTTrainerClass] ; 1: Intro text ; 2: Player lost @@ -83,19 +83,17 @@ endc ld [rSVBK], a call PlaceHLTextAtBC ret -; 11c05d INCLUDE "mobile/fixed_words.asm" INCLUDE "data/trainers/genders.asm" - -BTMaleTrainerTexts: ; 11f332 +BTMaleTrainerTexts: dw .Greetings dw .PlayerLost dw .PlayerWon -.Greetings: ; 11f338 +.Greetings: dw BTGreetingM1 dw BTGreetingM2 dw BTGreetingM3 @@ -122,7 +120,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTGreetingM24 dw BTGreetingM25 -.PlayerLost: ; 11f36a +.PlayerLost: dw BTLossM1 dw BTLossM2 dw BTLossM3 @@ -149,7 +147,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTLossM24 dw BTLossM25 -.PlayerWon: ; 11f39c +.PlayerWon: dw BTWinM1 dw BTWinM2 dw BTWinM3 @@ -176,13 +174,12 @@ BTMaleTrainerTexts: ; 11f332 dw BTWinM24 dw BTWinM25 - BTFemaleTrainerTexts: dw .Greetings dw .PlayerLost dw .PlayerWon -.Greetings: ; 11f3d4 +.Greetings: dw BTGreetingF1 dw BTGreetingF2 dw BTGreetingF3 @@ -199,7 +196,7 @@ BTFemaleTrainerTexts: dw BTGreetingF14 dw BTGreetingF15 -.PlayerLost: ; 11f3f2 +.PlayerLost: dw BTLossF1 dw BTLossF2 dw BTLossF3 @@ -216,7 +213,7 @@ BTFemaleTrainerTexts: dw BTLossF14 dw BTLossF15 -.PlayerWon: ; 11f410 +.PlayerWon: dw BTWinF1 dw BTWinF2 dw BTWinF3 @@ -233,486 +230,482 @@ BTFemaleTrainerTexts: dw BTWinF14 dw BTWinF15 - -BTGreetingM1: ; 0x11f42e +BTGreetingM1: text_jump BattleTowerText_0x1ec000 db "@" -BTLossM1: ; 0x11f433 +BTLossM1: text_jump BattleTowerText_0x1ec03b db "@" -BTWinM1: ; 0x11f438 +BTWinM1: text_jump UnknownText_0x1ec060 db "@" -BTGreetingM2: ; 0x11f43d +BTGreetingM2: text_jump BattleTowerText_0x1ec080 db "@" -BTLossM2: ; 0x11f442 +BTLossM2: text_jump UnknownText_0x1ec0a3 db "@" -BTWinM2: ; 0x11f447 +BTWinM2: text_jump UnknownText_0x1ec0c4 db "@" -BTGreetingM3: ; 0x11f44c +BTGreetingM3: text_jump UnknownText_0x1ec0e1 db "@" -BTLossM3: ; 0x11f451 +BTLossM3: text_jump UnknownText_0x1ec108 db "@" -BTWinM3: ; 0x11f456 +BTWinM3: text_jump UnknownText_0x1ec12a db "@" -BTGreetingM4: ; 0x11f45b +BTGreetingM4: text_jump UnknownText_0x1ec14d db "@" -BTLossM4: ; 0x11f460 +BTLossM4: text_jump UnknownText_0x1ec16f db "@" -BTWinM4: ; 0x11f465 +BTWinM4: text_jump UnknownText_0x1ec190 db "@" -BTGreetingM5: ; 0x11f46a +BTGreetingM5: text_jump UnknownText_0x1ec1ae db "@" -BTLossM5: ; 0x11f46f +BTLossM5: text_jump UnknownText_0x1ec1d0 db "@" -BTWinM5: ; 0x11f474 +BTWinM5: text_jump UnknownText_0x1ec1f4 db "@" -BTGreetingM6: ; 0x11f479 +BTGreetingM6: text_jump UnknownText_0x1ec216 db "@" -BTLossM6: ; 0x11f47e +BTLossM6: text_jump UnknownText_0x1ec238 db "@" -BTWinM6: ; 0x11f483 +BTWinM6: text_jump UnknownText_0x1ec259 db "@" -BTGreetingM7: ; 0x11f488 +BTGreetingM7: text_jump UnknownText_0x1ec27b db "@" -BTLossM7: ; 0x11f48d +BTLossM7: text_jump UnknownText_0x1ec2a0 db "@" -BTWinM7: ; 0x11f492 +BTWinM7: text_jump UnknownText_0x1ec2c0 db "@" -BTGreetingM8: ; 0x11f497 +BTGreetingM8: text_jump UnknownText_0x1ec2d9 db "@" -BTLossM8: ; 0x11f49c +BTLossM8: text_jump UnknownText_0x1ec2fe db "@" -BTWinM8: ; 0x11f4a1 +BTWinM8: text_jump UnknownText_0x1ec320 db "@" -BTGreetingM9: ; 0x11f4a6 +BTGreetingM9: text_jump UnknownText_0x1ec33f db "@" -BTLossM9: ; 0x11f4ab +BTLossM9: text_jump UnknownText_0x1ec36c db "@" -BTWinM9: ; 0x11f4b0 +BTWinM9: text_jump UnknownText_0x1ec389 db "@" -BTGreetingM10: ; 0x11f4b5 +BTGreetingM10: text_jump UnknownText_0x1ec3ad db "@" -BTLossM10: ; 0x11f4ba +BTLossM10: text_jump UnknownText_0x1ec3c5 db "@" -BTWinM10: ; 0x11f4bf +BTWinM10: text_jump UnknownText_0x1ec3e5 db "@" -BTGreetingM11: ; 0x11f4c4 +BTGreetingM11: text_jump UnknownText_0x1ec402 db "@" -BTLossM11: ; 0x11f4c9 +BTLossM11: text_jump UnknownText_0x1ec411 db "@" -BTWinM11: ; 0x11f4ce +BTWinM11: text_jump UnknownText_0x1ec41f db "@" -BTGreetingM12: ; 0x11f4d3 +BTGreetingM12: text_jump UnknownText_0x1ec42e db "@" -BTLossM12: ; 0x11f4d8 +BTLossM12: text_jump UnknownText_0x1ec461 db "@" -BTWinM12: ; 0x11f4dd +BTWinM12: text_jump UnknownText_0x1ec4a0 db "@" -BTGreetingM13: ; 0x11f4e2 +BTGreetingM13: text_jump UnknownText_0x1ec4d6 db "@" -BTLossM13: ; 0x11f4e7 +BTLossM13: text_jump UnknownText_0x1ec4f5 db "@" -BTWinM13: ; 0x11f4ec +BTWinM13: text_jump UnknownText_0x1ec512 db "@" -BTGreetingM14: ; 0x11f4f1 +BTGreetingM14: text_jump UnknownText_0x1ec532 db "@" -BTLossM14: ; 0x11f4f6 +BTLossM14: text_jump UnknownText_0x1ec54b db "@" -BTWinM14: ; 0x11f4fb +BTWinM14: text_jump UnknownText_0x1ec565 db "@" -BTGreetingM15: ; 0x11f500 +BTGreetingM15: text_jump UnknownText_0x1ec580 db "@" -BTLossM15: ; 0x11f505 +BTLossM15: text_jump UnknownText_0x1ec59d db "@" -BTWinM15: ; 0x11f50a +BTWinM15: text_jump UnknownText_0x1ec5b5 db "@" -BTGreetingM16: ; 0x11f50f +BTGreetingM16: text_jump UnknownText_0x1ec5d3 db "@" -BTLossM16: ; 0x11f514 +BTLossM16: text_jump UnknownText_0x1ec5ee db "@" -BTWinM16: ; 0x11f519 +BTWinM16: text_jump UnknownText_0x1ec60d db "@" -BTGreetingM17: ; 0x11f51e +BTGreetingM17: text_jump UnknownText_0x1ec631 db "@" -BTLossM17: ; 0x11f523 +BTLossM17: text_jump UnknownText_0x1ec651 db "@" -BTWinM17: ; 0x11f528 +BTWinM17: text_jump UnknownText_0x1ec68f db "@" -BTGreetingM18: ; 0x11f52d +BTGreetingM18: text_jump UnknownText_0x1ec6b1 db "@" -BTLossM18: ; 0x11f532 +BTLossM18: text_jump UnknownText_0x1ec6d0 db "@" -BTWinM18: ; 0x11f537 +BTWinM18: text_jump UnknownText_0x1ec708 db "@" -BTGreetingM19: ; 0x11f53c +BTGreetingM19: text_jump UnknownText_0x1ec720 db "@" -BTLossM19: ; 0x11f541 +BTLossM19: text_jump UnknownText_0x1ec73e db "@" -BTWinM19: ; 0x11f546 +BTWinM19: text_jump UnknownText_0x1ec75b db "@" -BTGreetingM20: ; 0x11f54b +BTGreetingM20: text_jump UnknownText_0x1ec77f db "@" -BTLossM20: ; 0x11f550 +BTLossM20: text_jump UnknownText_0x1ec798 db "@" -BTWinM20: ; 0x11f555 +BTWinM20: text_jump UnknownText_0x1ec7bb db "@" -BTGreetingM21: ; 0x11f55a +BTGreetingM21: text_jump UnknownText_0x1ec7d8 db "@" -BTLossM21: ; 0x11f55f +BTLossM21: text_jump UnknownText_0x1ec818 db "@" -BTWinM21: ; 0x11f564 +BTWinM21: text_jump UnknownText_0x1ec837 db "@" -BTGreetingM22: ; 0x11f569 +BTGreetingM22: text_jump UnknownText_0x1ec858 db "@" -BTLossM22: ; 0x11f56e +BTLossM22: text_jump UnknownText_0x1ec876 db "@" -BTWinM22: ; 0x11f573 +BTWinM22: text_jump UnknownText_0x1ec898 db "@" -BTGreetingM23: ; 0x11f578 +BTGreetingM23: text_jump UnknownText_0x1ec8b1 db "@" -BTLossM23: ; 0x11f57d +BTLossM23: text_jump UnknownText_0x1ec8d5 db "@" -BTWinM23: ; 0x11f582 +BTWinM23: text_jump UnknownText_0x1ec8f0 db "@" -BTGreetingM24: ; 0x11f587 +BTGreetingM24: text_jump UnknownText_0x1ec911 db "@" -BTLossM24: ; 0x11f58c +BTLossM24: text_jump UnknownText_0x1ec928 db "@" -BTWinM24: ; 0x11f591 +BTWinM24: text_jump UnknownText_0x1ec949 db "@" -BTGreetingM25: ; 0x11f596 +BTGreetingM25: text_jump UnknownText_0x1ec969 db "@" -BTLossM25: ; 0x11f59b +BTLossM25: text_jump UnknownText_0x1ec986 db "@" -BTWinM25: ; 0x11f5a0 +BTWinM25: text_jump UnknownText_0x1ec99b db "@" - - - -BTGreetingF1: ; 0x11f5a5 +BTGreetingF1: text_jump UnknownText_0x1ec9bd db "@" -BTLossF1: ; 0x11f5aa +BTLossF1: text_jump UnknownText_0x1ec9d9 db "@" -BTWinF1: ; 0x11f5af +BTWinF1: text_jump UnknownText_0x1ec9f7 db "@" -BTGreetingF2: ; 0x11f5b4 +BTGreetingF2: text_jump UnknownText_0x1eca0a db "@" -BTLossF2: ; 0x11f5b9 +BTLossF2: text_jump UnknownText_0x1eca2a db "@" -BTWinF2: ; 0x11f5be +BTWinF2: text_jump UnknownText_0x1eca47 db "@" -BTGreetingF3: ; 0x11f5c3 +BTGreetingF3: text_jump UnknownText_0x1eca64 db "@" -BTLossF3: ; 0x11f5c8 +BTLossF3: text_jump UnknownText_0x1eca82 db "@" -BTWinF3: ; 0x11f5cd +BTWinF3: text_jump UnknownText_0x1eca9d db "@" -BTGreetingF4: ; 0x11f5d2 +BTGreetingF4: text_jump UnknownText_0x1ecabf db "@" -BTLossF4: ; 0x11f5d7 +BTLossF4: text_jump UnknownText_0x1ecade db "@" -BTWinF4: ; 0x11f5dc +BTWinF4: text_jump UnknownText_0x1ecafa db "@" -BTGreetingF5: ; 0x11f5e1 +BTGreetingF5: text_jump UnknownText_0x1ecb19 db "@" -BTLossF5: ; 0x11f5e6 +BTLossF5: text_jump UnknownText_0x1ecb37 db "@" -BTWinF5: ; 0x11f5eb +BTWinF5: text_jump UnknownText_0x1ecb55 db "@" -BTGreetingF6: ; 0x11f5f0 +BTGreetingF6: text_jump UnknownText_0x1ecb70 db "@" -BTLossF6: ; 0x11f5f5 +BTLossF6: text_jump UnknownText_0x1ecb92 db "@" -BTWinF6: ; 0x11f5fa +BTWinF6: text_jump UnknownText_0x1ecbb6 db "@" -BTGreetingF7: ; 0x11f5ff +BTGreetingF7: text_jump UnknownText_0x1ecbd9 db "@" -BTLossF7: ; 0x11f604 +BTLossF7: text_jump UnknownText_0x1ecbf3 db "@" -BTWinF7: ; 0x11f609 +BTWinF7: text_jump UnknownText_0x1ecc15 db "@" -BTGreetingF8: ; 0x11f60e +BTGreetingF8: text_jump UnknownText_0x1ecc39 db "@" -BTLossF8: ; 0x11f613 +BTLossF8: text_jump UnknownText_0x1ecc55 db "@" -BTWinF8: ; 0x11f618 +BTWinF8: text_jump UnknownText_0x1ecc75 db "@" -BTGreetingF9: ; 0x11f61d +BTGreetingF9: text_jump UnknownText_0x1ecc92 db "@" -BTLossF9: ; 0x11f622 +BTLossF9: text_jump UnknownText_0x1ecca7 db "@" -BTWinF9: ; 0x11f627 +BTWinF9: text_jump UnknownText_0x1eccc1 db "@" -BTGreetingF10: ; 0x11f62c +BTGreetingF10: text_jump UnknownText_0x1eccd7 db "@" -BTLossF10: ; 0x11f631 +BTLossF10: text_jump UnknownText_0x1eccef db "@" -BTWinF10: ; 0x11f636 +BTWinF10: text_jump UnknownText_0x1ecd0e db "@" -BTGreetingF11: ; 0x11f63b +BTGreetingF11: text_jump UnknownText_0x1ecd2b db "@" -BTLossF11: ; 0x11f640 +BTLossF11: text_jump UnknownText_0x1ecd4d db "@" -BTWinF11: ; 0x11f645 +BTWinF11: text_jump UnknownText_0x1ecd6b db "@" -BTGreetingF12: ; 0x11f64a +BTGreetingF12: text_jump UnknownText_0x1ecd8d db "@" -BTLossF12: ; 0x11f64f +BTLossF12: text_jump UnknownText_0x1ecdaf db "@" -BTWinF12: ; 0x11f654 +BTWinF12: text_jump UnknownText_0x1ecdcf db "@" -BTGreetingF13: ; 0x11f659 +BTGreetingF13: text_jump UnknownText_0x1ecded db "@" -BTLossF13: ; 0x11f65e +BTLossF13: text_jump UnknownText_0x1ece0d db "@" -BTWinF13: ; 0x11f663 +BTWinF13: text_jump UnknownText_0x1ece2a db "@" -BTGreetingF14: ; 0x11f668 +BTGreetingF14: text_jump UnknownText_0x1ece4b db "@" -BTLossF14: ; 0x11f66d +BTLossF14: text_jump UnknownText_0x1ece70 db "@" -BTWinF14: ; 0x11f672 +BTWinF14: text_jump UnknownText_0x1ece8a db "@" -BTGreetingF15: ; 0x11f677 +BTGreetingF15: text_jump UnknownText_0x1ecea8 db "@" -BTLossF15: ; 0x11f67c +BTLossF15: text_jump UnknownText_0x1ecec9 db "@" -BTWinF15: ; 0x11f681 +BTWinF15: text_jump UnknownText_0x1ecee8 db "@" diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 533ce43ef..c5260760a 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -1,4 +1,4 @@ -BuenasPassword: ; 8af6b +BuenasPassword: xor a ld [wWhichIndexSet], a ld hl, .MenuHeader @@ -26,25 +26,22 @@ BuenasPassword: ; 8af6b ld a, b ld [wScriptVar], a ret -; 8afa9 -.MenuHeader: ; 0x8afa9 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, 7 dw .MenuData db 1 ; default option -; 0x8afb1 db 0 -.MenuData: ; 0x8afb2 +.MenuData: db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags db 0 ; items dw .PasswordIndices dw .PlacePasswordChoices -; 0x8afb4 -.PasswordIndices: ; 8afb8 +.PasswordIndices: db NUM_PASSWORDS_PER_CATEGORY x = 0 rept NUM_PASSWORDS_PER_CATEGORY @@ -53,7 +50,7 @@ x = x + 1 endr db -1 -.PlacePasswordChoices: ; 8afbd +.PlacePasswordChoices: push de ld a, [wBuenasPassword] and $f0 @@ -65,9 +62,8 @@ endr pop hl call PlaceString ret -; 8afd4 -BuenaPrize: ; 8afd4 +BuenaPrize: xor a ld [wMenuScrollPosition], a ld a, $1 @@ -149,56 +145,47 @@ BuenaPrize: ; 8afd4 call JoyWaitAorB call PlayClickSFX ret -; 8b072 -.Text_AskWhichPrize: ; 0x8b072 +.Text_AskWhichPrize: ; Which prize would you like? text_jump UnknownText_0x1c589f db "@" -; 0x8b077 -.Text_IsThatRight: ; 0x8b077 +.Text_IsThatRight: ; ? Is that right? text_jump UnknownText_0x1c58bc db "@" -; 0x8b07c .Text_HereYouGo: ; Here you go! text_jump UnknownText_0x1c58d1 db "@" -; 0x8b081 -.Text_NotEnoughPoints: ; 0x8b081 +.Text_NotEnoughPoints: ; You don't have enough points. text_jump UnknownText_0x1c58e0 db "@" -; 0x8b086 -.Text_NoRoom: ; 0x8b086 +.Text_NoRoom: ; You have no room for it. text_jump UnknownText_0x1c58ff db "@" -; 0x8b08b -.Text_PleaseComeBackAgain: ; 0x8b08b +.Text_PleaseComeBackAgain: ; Oh. Please come back again! text_jump UnknownText_0x1c591a db "@" -; 0x8b090 -Buena_DisplayBlueCardBalance: ; 8b090 +Buena_DisplayBlueCardBalance: ld hl, BlueCardBalanceMenuHeader call LoadMenuHeader ret -; 8b097 -PrintBlueCardBalance: ; 8b097 +PrintBlueCardBalance: ld de, wBlueCardBalance call .DrawBox ret -; 8b09e -.DrawBox: ; 8b09e +.DrawBox: push de xor a ld [hBGMapMode], a @@ -221,29 +208,24 @@ PrintBlueCardBalance: ; 8b097 lb bc, 1, 2 call PrintNum ret -; 8b0ca .Points_string: db "Points@" -; 8b0d1 -BlueCardBalanceMenuHeader: ; 0x8b0d1 +BlueCardBalanceMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 11, 11, 13 -; 8b0d6 -Buena_PlacePrizeMenuBox: ; 8b0d6 +Buena_PlacePrizeMenuBox: ld hl, .MenuHeader call LoadMenuHeader ret -; 8b0dd -.MenuHeader ; 0x8b0dd +.MenuHeader db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 17, TEXTBOX_Y - 1 -; 8b0e2 -Buena_PrizeMenu: ; 8b0e2 +Buena_PrizeMenu: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuSelection] @@ -268,29 +250,26 @@ Buena_PrizeMenu: ; 8b0e2 .cancel xor a ret -; 8b113 -.MenuHeader: ; 0x8b113 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, 16, 9 dw .MenuData db 1 ; default option -; 0x8b11b db 0 -.MenuData: ; 0x8b11c +.MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 13 ; rows, columns db 1 ; spacing dba .indices dba .prizeitem dba .prizepoints -; 8b129 NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2) -.indices ; 8b129 +.indices db NUM_BUENA_PRIZES x = 1 rept NUM_BUENA_PRIZES @@ -298,9 +277,8 @@ rept NUM_BUENA_PRIZES x = x + 1 endr db -1 -; 8b134 -.prizeitem ; 8b134 +.prizeitem ld a, [wMenuSelection] call Buena_getprize ld a, [hl] @@ -310,9 +288,8 @@ endr pop hl call PlaceString ret -; 8b147 -.prizepoints ; 8b147 +.prizepoints ld a, [wMenuSelection] call Buena_getprize inc hl @@ -321,9 +298,8 @@ endr add c ld [de], a ret -; 8b154 -Buena_getprize: ; 8b154 +Buena_getprize: dec a ld hl, BuenaPrizeItems ld b, 0 @@ -331,6 +307,5 @@ Buena_getprize: ; 8b154 add hl, bc add hl, bc ret -; 8b15e INCLUDE "data/items/buena_prizes.asm" diff --git a/engine/events/buena_menu.asm b/engine/events/buena_menu.asm index d55a6c9fa..e498a3ab8 100644 --- a/engine/events/buena_menu.asm +++ b/engine/events/buena_menu.asm @@ -1,4 +1,4 @@ -AskRememberPassword: ; 4ae12 +AskRememberPassword: call .DoMenu ld a, $0 jr c, .okay @@ -8,7 +8,7 @@ AskRememberPassword: ; 4ae12 ld [wScriptVar], a ret -.DoMenu: ; 4ae1f +.DoMenu: lb bc, 14, 7 push bc ld hl, YesNoMenuHeader @@ -42,7 +42,7 @@ AskRememberPassword: ; 4ae12 scf ret -Buena_ExitMenu: ; 4ae5e +Buena_ExitMenu: ld a, [hOAMUpdate] push af call ExitMenu diff --git a/engine/events/bug_contest/caught_mon.asm b/engine/events/bug_contest/caught_mon.asm index 4bad01829..45212ae3e 100644 --- a/engine/events/bug_contest/caught_mon.asm +++ b/engine/events/bug_contest/caught_mon.asm @@ -1,4 +1,4 @@ -BugContest_SetCaughtContestMon: ; e6ce +BugContest_SetCaughtContestMon: ld a, [wContestMon] and a jr z, .firstcatch @@ -18,7 +18,7 @@ BugContest_SetCaughtContestMon: ; e6ce call PrintText ret -.generatestats ; e6fd +.generatestats ld a, [wTempEnemyMonSpecies] ld [wCurSpecies], a ld [wCurPartySpecies], a @@ -32,7 +32,7 @@ BugContest_SetCaughtContestMon: ; e6ce ld hl, wContestMon jp GeneratePartyMonStats -.caughttext ; 0xe71d +.caughttext ; Caught @ ! text_jump UnknownText_0x1c10c0 db "@" diff --git a/engine/events/bug_contest/contest.asm b/engine/events/bug_contest/contest.asm index c25da1658..4cf4f949a 100644 --- a/engine/events/bug_contest/contest.asm +++ b/engine/events/bug_contest/contest.asm @@ -1,4 +1,4 @@ -GiveParkBalls: ; 135db +GiveParkBalls: xor a ld [wContestMon], a ld a, 20 @@ -6,7 +6,7 @@ GiveParkBalls: ; 135db farcall StartBugContestTimer ret -BugCatchingContestBattleScript:: ; 0x135eb +BugCatchingContestBattleScript:: writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST randomwildmon startbattle @@ -15,29 +15,29 @@ BugCatchingContestBattleScript:: ; 0x135eb iffalse BugCatchingContestOutOfBallsScript end -BugCatchingContestOverScript:: ; 0x135f8 +BugCatchingContestOverScript:: playsound SFX_ELEVATOR_END opentext writetext BugCatchingContestText_BeeepTimesUp waitbutton jump BugCatchingContestReturnToGateScript -BugCatchingContestOutOfBallsScript: ; 0x13603 +BugCatchingContestOutOfBallsScript: playsound SFX_ELEVATOR_END opentext writetext BugCatchingContestText_ContestIsOver waitbutton -BugCatchingContestReturnToGateScript: ; 0x1360b +BugCatchingContestReturnToGateScript: closetext jumpstd bugcontestresultswarp -BugCatchingContestText_BeeepTimesUp: ; 0x1360f +BugCatchingContestText_BeeepTimesUp: ; ANNOUNCER: BEEEP! Time's up! text_jump UnknownText_0x1bd2ca db "@" -BugCatchingContestText_ContestIsOver: ; 0x13614 +BugCatchingContestText_ContestIsOver: ; ANNOUNCER: The Contest is over! text_jump UnknownText_0x1bd2e7 db "@" diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 3e3b16b21..9cf70a03e 100644 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -1,4 +1,4 @@ -SelectRandomBugContestContestants: ; 139a8 +SelectRandomBugContestContestants: ; Select five random people to participate in the current contest. ; First we have to make sure that any old data is cleared away. @@ -54,9 +54,8 @@ SelectRandomBugContestContestants: ; 139a8 dec c jr nz, .loop2 ret -; 139ed -CheckBugContestContestantFlag: ; 139ed +CheckBugContestContestantFlag: ; Checks the flag of the Bug Catching Contestant whose index is loaded in a. ; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, @@ -73,11 +72,10 @@ CheckBugContestContestantFlag: ; 139ed ld b, CHECK_FLAG call EventFlagAction ret -; 139fe INCLUDE "data/events/bug_contest_flags.asm" -ContestDropOffMons: ; 13a12 +ContestDropOffMons: ld hl, wPartyMon1HP ld a, [hli] or [hl] @@ -100,9 +98,8 @@ ContestDropOffMons: ; 13a12 ld a, $1 ld [wScriptVar], a ret -; 13a31 -ContestReturnMons: ; 13a31 +ContestReturnMons: ; Restore the species of the second mon. ld hl, wPartySpecies + 1 ld a, [wBugContestSecondPartySpecies] @@ -120,4 +117,3 @@ ContestReturnMons: ; 13a31 ld a, b ld [wPartyCount], a ret -; 13a47 diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 9f6eb50d0..94a5e9511 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -1,4 +1,4 @@ -DisplayCaughtContestMonStats: ; cc000 +DisplayCaughtContestMonStats: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -86,22 +86,22 @@ DisplayCaughtContestMonStats: ; cc000 .This: db " THIS <PKMN> @" -SwitchMonText: ; cc0c2 +SwitchMonText: ; Switch #MON? text_jump UnknownText_0x1c10cf db "@" -DisplayAlreadyCaughtText: ; cc0c7 +DisplayAlreadyCaughtText: call GetPokemonName ld hl, .AlreadyCaughtText jp PrintText -.AlreadyCaughtText: ; 0xcc0d0 +.AlreadyCaughtText: ; You already caught a @ . text_jump UnknownText_0x1c10dd db "@" DummyPredef2F: DummyPredef38: -DummyPredef39: ; cc0d5 +DummyPredef39: ret diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index a338e83ec..d8f9d7657 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -1,4 +1,4 @@ -_BugContestJudging: ; 1369d +_BugContestJudging: call ContestScore farcall StubbedTrainerRankings_BugContestScore call BugContest_JudgeContestants @@ -24,9 +24,8 @@ _BugContestJudging: ; 1369d ld hl, BugContest_FirstPlaceText call PrintText jp BugContest_GetPlayersResult -; 136eb -BugContest_FirstPlaceText: ; 0x136eb +BugContest_FirstPlaceText: text_jump ContestJudging_FirstPlaceText start_asm ld de, SFX_1ST_PLACE @@ -34,15 +33,13 @@ BugContest_FirstPlaceText: ; 0x136eb call WaitSFX ld hl, BugContest_FirstPlaceScoreText ret -; 136fd -BugContest_FirstPlaceScoreText: ; 0x136fd +BugContest_FirstPlaceScoreText: ; The winning score was @ points! text_jump ContestJudging_FirstPlaceScoreText db "@" -; 0x13702 -BugContest_SecondPlaceText: ; 0x13702 +BugContest_SecondPlaceText: ; Placing second was @ , who caught a @ !@ @ text_jump ContestJudging_SecondPlaceText start_asm @@ -51,15 +48,13 @@ BugContest_SecondPlaceText: ; 0x13702 call WaitSFX ld hl, BugContest_SecondPlaceScoreText ret -; 13714 -BugContest_SecondPlaceScoreText: ; 0x13714 +BugContest_SecondPlaceScoreText: ; The score was @ points! text_jump ContestJudging_SecondPlaceScoreText db "@" -; 0x13719 -BugContest_ThirdPlaceText: ; 0x13719 +BugContest_ThirdPlaceText: ; Placing third was @ , who caught a @ !@ @ text_jump ContestJudging_ThirdPlaceText start_asm @@ -68,15 +63,13 @@ BugContest_ThirdPlaceText: ; 0x13719 call WaitSFX ld hl, BugContest_ThirdPlaceScoreText ret -; 1372b -BugContest_ThirdPlaceScoreText: ; 0x1372b +BugContest_ThirdPlaceScoreText: ; The score was @ points! text_jump ContestJudging_ThirdPlaceScoreText db "@" -; 0x13730 -LoadContestantName: ; 13730 +LoadContestantName: ; If a = 1, get your name. dec a ; BUG_CONTEST_PLAYER jr z, .player @@ -131,14 +124,10 @@ LoadContestantName: ; 13730 ld de, wBugContestWinnerName ld bc, NAME_LENGTH jp CopyBytes -; 13783 - INCLUDE "data/events/bug_contest_winners.asm" -; 13807 - -BugContest_GetPlayersResult: ; 13807 +BugContest_GetPlayersResult: ld hl, wBugContestThirdPlaceWinnerID ld de, - BUG_CONTESTANT_SIZE ld b, 3 ; 3rd, 2nd, or 1st @@ -152,9 +141,8 @@ BugContest_GetPlayersResult: ; 13807 .done ret -; 13819 -BugContest_JudgeContestants: ; 13819 +BugContest_JudgeContestants: call ClearContestResults call ComputeAIContestantScores ld hl, wBugContestTempWinnerID @@ -168,9 +156,8 @@ BugContest_JudgeContestants: ; 13819 ld [hl], a call DetermineContestWinners ret -; 13833 -ClearContestResults: ; 13833 +ClearContestResults: ld hl, wBugContestResults ld b, wBugContestWinnersEnd - wBugContestResults xor a @@ -179,9 +166,8 @@ ClearContestResults: ; 13833 dec b jr nz, .loop ret -; 1383e -DetermineContestWinners: ; 1383e +DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestFirstPlaceScore ld c, 2 @@ -224,9 +210,8 @@ DetermineContestWinners: ; 1383e .done ret -; 138a0 -CopyTempContestant: ; 138a0 +CopyTempContestant: ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID rept BUG_CONTESTANT_SIZE + -1 @@ -238,9 +223,8 @@ endr inc de ld [hl], a ret -; 138b0 -ComputeAIContestantScores: ; 138b0 +ComputeAIContestantScores: ld e, 0 .loop push de @@ -298,9 +282,8 @@ ComputeAIContestantScores: ; 138b0 cp NUM_BUG_CONTESTANTS jr nz, .loop ret -; 13900 -ContestScore: ; 13900 +ContestScore: ; Determine the player's score in the Bug Catching Contest. xor a @@ -383,9 +366,8 @@ ContestScore: ; 13900 .done ret -; 1397f -.AddContestStat: ; 1397f +.AddContestStat: ld hl, hMultiplicand add [hl] ld [hl], a @@ -393,4 +375,3 @@ ContestScore: ; 13900 dec hl inc [hl] ret -; 13988 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index f4f36e402..eb013cfa2 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -1,4 +1,4 @@ -_CardKey: ; 50779 +_CardKey: ; Are we even in the right map to use this? ld a, [wMapGroup] cp GROUP_RADIO_TOWER_3F @@ -31,9 +31,7 @@ _CardKey: ; 50779 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507af -.CardKeyScript: ; 0x507af +.CardKeyScript: closetext farjump CardKeySlotScript -; 0x507b4 diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm index 6ae3b4a3b..898fb826f 100644 --- a/engine/events/catch_tutorial.asm +++ b/engine/events/catch_tutorial.asm @@ -1,4 +1,4 @@ -CatchTutorial:: ; 4e554 +CatchTutorial:: ld a, [wBattleType] dec a ld c, a @@ -11,12 +11,12 @@ CatchTutorial:: ; 4e554 ld l, a jp hl -.dw ; 4e564 (13:6564) +.dw dw .DudeTutorial dw .DudeTutorial dw .DudeTutorial -.DudeTutorial: ; 4e56a (13:656a) +.DudeTutorial: ; Back up your name to your Mom's name. ld hl, wPlayerName ld de, wMomsName @@ -52,7 +52,7 @@ CatchTutorial:: ; 4e554 call CopyBytes ret -.LoadDudeData: ; 4e5b7 (13:65b7) +.LoadDudeData: ld hl, wDudeNumItems ld [hl], 1 inc hl @@ -68,14 +68,14 @@ CatchTutorial:: ; 4e554 ld hl, wDudeNumBalls ld a, 1 ld [hli], a - ld a, POKE_BALL ; 5 + ld a, POKE_BALL ld [hli], a ld [hli], a ld [hl], -1 ret -.Dude: ; 4e5da +.Dude: db "DUDE@" -.AutoInput: ; 4e5df +.AutoInput: db NO_INPUT, $ff ; end diff --git a/engine/events/catch_tutorial_input.asm b/engine/events/catch_tutorial_input.asm index 9d2a03db2..cca2db2d5 100644 --- a/engine/events/catch_tutorial_input.asm +++ b/engine/events/catch_tutorial_input.asm @@ -1,35 +1,35 @@ -_DudeAutoInput_A:: ; 1de28a +_DudeAutoInput_A:: ld hl, DudeAutoInput_A jr _DudeAutoInput -_DudeAutoInput_RightA: ; 1de28f +_DudeAutoInput_RightA: ld hl, DudeAutoInput_RightA jr _DudeAutoInput -_DudeAutoInput_DownA: ; 1de294 +_DudeAutoInput_DownA: ld hl, DudeAutoInput_DownA jr _DudeAutoInput -_DudeAutoInput: ; 1de299 +_DudeAutoInput: ld a, BANK(DudeAutoInputs) call StartAutoInput ret -DudeAutoInputs: +DudeAutoInputs: ; used only for BANK(DudeAutoInputs) -DudeAutoInput_A: ; 1de29f +DudeAutoInput_A: db NO_INPUT, $50 db A_BUTTON, $00 db NO_INPUT, $ff ; end -DudeAutoInput_RightA: ; 1de2a5 +DudeAutoInput_RightA: db NO_INPUT, $08 db D_RIGHT, $00 db NO_INPUT, $08 db A_BUTTON, $00 db NO_INPUT, $ff ; end -DudeAutoInput_DownA: ; 1de2af +DudeAutoInput_DownA: db NO_INPUT, $fe db NO_INPUT, $fe db NO_INPUT, $fe diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index cb5d08d95..a34f3935a 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -1,6 +1,6 @@ SPECIALCELEBIEVENT_CELEBI EQU $84 -CelebiShrineEvent: ; 4989a +CelebiShrineEvent: call DelayFrame ld a, [wVramState] push af @@ -31,7 +31,7 @@ CelebiShrineEvent: ; 4989a call GetCelebiSpriteTile inc d push de - ld a, $90 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call CelebiEvent_CountDown @@ -41,7 +41,6 @@ CelebiShrineEvent: ; 4989a pop bc jr .loop - .done pop af ld [wVramState], a @@ -49,9 +48,7 @@ CelebiShrineEvent: ; 4989a call CelebiEvent_SetBattleType ret -; 498f9 - -.RestorePlayerSprite_DespawnLeaves: ; 498f9 +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -69,9 +66,7 @@ endr call ByteFill ret -; 49912 - -LoadCelebiGFX: ; 49912 +LoadCelebiGFX: farcall ClearSpriteAnims ld de, SpecialCelebiLeafGFX ld hl, vTiles1 @@ -85,9 +80,7 @@ LoadCelebiGFX: ; 49912 ld [wJumptableIndex], a ret -; 49935 - -CelebiEvent_CountDown: ; 49935 +CelebiEvent_CountDown: ld hl, wFrameCounter ld a, [hl] and a @@ -95,15 +88,12 @@ CelebiEvent_CountDown: ; 49935 dec [hl] ret - .done ld hl, wJumptableIndex set 7, [hl] ret -; 49944 - -CelebiEvent_SpawnLeaf: ; 49944 +CelebiEvent_SpawnLeaf: ; unused ld hl, wcf65 ld a, [hl] @@ -123,19 +113,16 @@ CelebiEvent_SpawnLeaf: ; 49944 ld [hl], $80 ret -; 49962 - -SpecialCelebiLeafGFX: ; 49962 +SpecialCelebiLeafGFX: INCBIN "gfx/overworld/cut_grass.2bpp" -SpecialCelebiGFX: ; 499a2 +SpecialCelebiGFX: INCBIN "gfx/overworld/celebi/1.2bpp" INCBIN "gfx/overworld/celebi/2.2bpp" INCBIN "gfx/overworld/celebi/3.2bpp" INCBIN "gfx/overworld/celebi/4.2bpp" - -UpdateCelebiPosition: ; 49aa2 (12:5aa2) +UpdateCelebiPosition: ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] @@ -229,8 +216,7 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) .done ret - -.FreezeCelebiPosition: ; 49b30 (12:5b30) +.FreezeCelebiPosition: pop af ld hl, SPRITEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -238,14 +224,12 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) call ReinitSpriteAnimFrame ret - -CelebiEvent_Cosine: ; 49b3b (12:5b3b) +CelebiEvent_Cosine: ; a = d * cos(a * pi/32) add %010000 ; cos(x) = sin(x + pi/2) calc_sine_wave -; 49bae -GetCelebiSpriteTile: ; 49bae +GetCelebiSpriteTile: push hl push bc push de @@ -267,22 +251,18 @@ GetCelebiSpriteTile: ; 49bae jr c, .done jr .restart - .Frame1: ld a, SPECIALCELEBIEVENT_CELEBI jr .load_tile - .Frame2: ld a, SPECIALCELEBIEVENT_CELEBI + 4 jr .load_tile - .Frame3: ld a, SPECIALCELEBIEVENT_CELEBI + 8 jr .load_tile - .Frame4: ld a, SPECIALCELEBIEVENT_CELEBI + 12 @@ -292,7 +272,6 @@ GetCelebiSpriteTile: ; 49bae ld [hl], a jr .done - .restart pop de ld d, $ff @@ -304,9 +283,7 @@ GetCelebiSpriteTile: ; 49bae pop hl ret -; 49bed - -.AddE: ; 49bed +.AddE: push af ld a, d add e @@ -314,16 +291,12 @@ GetCelebiSpriteTile: ; 49bae pop af ret -; 49bf3 - -CelebiEvent_SetBattleType: ; 49bf3 +CelebiEvent_SetBattleType: ld a, BATTLETYPE_CELEBI ld [wBattleType], a ret -; 49bf9 - -CheckCaughtCelebi: ; 49bf9 +CheckCaughtCelebi: ld a, [wBattleResult] bit BATTLERESULT_CAUGHT_CELEBI, a jr z, .false @@ -331,12 +304,9 @@ CheckCaughtCelebi: ; 49bf9 ld [wScriptVar], a jr .done - .false xor a ; FALSE ld [wScriptVar], a .done ret - -; 49c0c diff --git a/engine/events/checkforhiddenitems.asm b/engine/events/checkforhiddenitems.asm index 7396bd39a..2af9a1a1f 100644 --- a/engine/events/checkforhiddenitems.asm +++ b/engine/events/checkforhiddenitems.asm @@ -1,4 +1,4 @@ -CheckForHiddenItems: ; b8172 +CheckForHiddenItems: ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. call GetMapScriptsBank ld [wBuffer1], a @@ -75,11 +75,9 @@ CheckForHiddenItems: ; b8172 pop hl scf ret -; b81e2 -.GetFarByte: ; b81e2 +.GetFarByte: ld a, [wBuffer1] call GetFarByte inc hl ret -; b81ea diff --git a/engine/events/checksave.asm b/engine/events/checksave.asm index 2280f0e53..1e9d18e71 100644 --- a/engine/events/checksave.asm +++ b/engine/events/checksave.asm @@ -1,4 +1,4 @@ -CheckSave:: ; 4cffe +CheckSave:: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, [sCheckValue1] diff --git a/engine/events/checktime.asm b/engine/events/checktime.asm index 4c7d033ff..6e470e883 100644 --- a/engine/events/checktime.asm +++ b/engine/events/checktime.asm @@ -1,4 +1,4 @@ -CheckTime:: ; c000 +CheckTime:: ld a, [wTimeOfDay] ld hl, .TimeOfDayTable ld de, 2 @@ -11,7 +11,7 @@ CheckTime:: ; c000 ld c, a ret -.TimeOfDayTable: ; c012 +.TimeOfDayTable: db MORN_F, MORN db DAY_F, DAY db NITE_F, NITE diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 4b256da28..5904a476d 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -21,7 +21,7 @@ const DAYCARETEXT_OH_FINE const DAYCARETEXT_COME_AGAIN -DayCareMan: ; 166d6 +DayCareMan: ld hl, wDayCareMan bit DAYCAREMAN_HAS_MON_F, [hl] jr nz, .AskWithdrawMon @@ -58,9 +58,8 @@ DayCareMan: ; 166d6 ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret -; 1672a -DayCareLady: ; 1672a +DayCareLady: ld hl, wDayCareLady bit DAYCARELADY_HAS_MON_F, [hl] jr nz, .AskWithdrawMon @@ -98,9 +97,8 @@ DayCareLady: ; 1672a ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret -; 16781 -DayCareLadyIntroText: ; 16781 +DayCareLadyIntroText: bit DAYCARELADY_ACTIVE_F, [hl] jr nz, .okay set DAYCARELADY_ACTIVE_F, [hl] @@ -109,16 +107,14 @@ DayCareLadyIntroText: ; 16781 call PrintDayCareText call YesNoBox ret -; 1678f -DayCareManIntroText: ; 1678f +DayCareManIntroText: set DAYCAREMAN_ACTIVE_F, [hl] call PrintDayCareText call YesNoBox ret -; 16798 -DayCareAskDepositPokemon: ; 16798 +DayCareAskDepositPokemon: ld a, [wPartyCount] cp 2 jr c, .OnlyOneMon @@ -169,15 +165,13 @@ DayCareAskDepositPokemon: ; 16798 ld a, DAYCARETEXT_REMOVE_MAIL scf ret -; 167f1 -.DummyText: ; 0x167f1 +.DummyText: ; text_jump UnknownText_0x1bdaa7 db "@" -; 0x167f6 -DayCare_DepositPokemonText: ; 167f6 +DayCare_DepositPokemonText: ld a, DAYCARETEXT_DEPOSIT call PrintDayCareText ld a, [wCurPartySpecies] @@ -185,9 +179,8 @@ DayCare_DepositPokemonText: ; 167f6 ld a, DAYCARETEXT_COME_BACK_LATER call PrintDayCareText ret -; 16807 -DayCare_AskWithdrawBreedMon: ; 16807 +DayCare_AskWithdrawBreedMon: ld a, [wStringBuffer2 + 1] and a jr nz, .grew_at_least_one_level @@ -232,9 +225,8 @@ DayCare_AskWithdrawBreedMon: ; 16807 ld a, DAYCARETEXT_PARTY_FULL scf ret -; 16850 -DayCare_GetBackMonForMoney: ; 16850 +DayCare_GetBackMonForMoney: ld bc, wStringBuffer2 + 2 ld de, wMoney farcall TakeMoney @@ -245,9 +237,8 @@ DayCare_GetBackMonForMoney: ; 16850 ld a, DAYCARETEXT_GOT_BACK call PrintDayCareText ret -; 1686d -GetPriceToRetrieveBreedmon: ; 1686d +GetPriceToRetrieveBreedmon: ld a, b ld [wStringBuffer2], a ld a, d @@ -268,9 +259,8 @@ GetPriceToRetrieveBreedmon: ; 1686d ld a, l ld [wStringBuffer2 + 4], a ret -; 1689b -PrintDayCareText: ; 1689b +PrintDayCareText: ld e, a ld d, 0 ld hl, .TextTable @@ -281,9 +271,8 @@ PrintDayCareText: ; 1689b ld l, a call PrintText ret -; 168aa -.TextTable: ; 168aa +.TextTable: ; entries correspond to DAYCARETEXT_* constants dw .DayCareManIntro ; 00 dw .DayCareManOddEgg ; 01 @@ -305,129 +294,108 @@ PrintDayCareText: ; 1689b dw .NotEnoughMoney ; 11 dw .OhFineThen ; 12 dw .ComeAgain ; 13 -; 168d2 -.DayCareManIntro: ; 0x168d2 +.DayCareManIntro: ; I'm the DAY-CARE MAN. Want me to raise a #MON? text_jump UnknownText_0x1bdaa9 db "@" -; 0x168d7 -.DayCareManOddEgg: ; 0x168d7 +.DayCareManOddEgg: ; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON? text_jump UnknownText_0x1bdad8 db "@" -; 0x168dc -.DayCareLadyIntro: ; 0x168dc +.DayCareLadyIntro: ; I'm the DAY-CARE LADY. Should I raise a #MON for you? text_jump UnknownText_0x1bdb85 db "@" -; 0x168e1 -.DayCareLadyOddEgg: ; 0x168e1 +.DayCareLadyOddEgg: ; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you? text_jump UnknownText_0x1bdbbb db "@" -; 0x168e6 -.WhichOne: ; 0x168e6 +.WhichOne: ; What should I raise for you? text_jump UnknownText_0x1bdc79 db "@" -; 0x168eb -.JustOneMon: ; 0x168eb +.JustOneMon: ; Oh? But you have just one #MON. text_jump UnknownText_0x1bdc97 db "@" -; 0x168f0 -.CantAcceptEgg: ; 0x168f0 +.CantAcceptEgg: ; Sorry, but I can't accept an EGG. text_jump UnknownText_0x1bdcb8 db "@" -; 0x168f5 -.RemoveMail: ; 0x168f5 +.RemoveMail: ; Remove MAIL before you come see me. text_jump UnknownText_0x1bdcda db "@" -; 0x168fa -.LastHealthyMon: ; 0x168fa +.LastHealthyMon: ; If you give me that, what will you battle with? text_jump UnknownText_0x1bdcff db "@" -; 0x168ff -.OkayIllRaiseYourMon: ; 0x168ff +.OkayIllRaiseYourMon: ; OK. I'll raise your @ . text_jump UnknownText_0x1bdd30 db "@" -; 0x16904 -.ComeBackForItLater: ; 0x16904 +.ComeBackForItLater: ; Come back for it later. text_jump UnknownText_0x1bdd4b db "@" -; 0x16909 -.AreWeGeniusesOrWhat: ; 0x16909 +.AreWeGeniusesOrWhat: ; Are we geniuses or what? Want to see your @ ? text_jump UnknownText_0x1bdd64 db "@" -; 0x1690e -.AskRetrieveMon: ; 0x1690e +.AskRetrieveMon: ; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ . text_jump UnknownText_0x1bdd96 db "@" -; 0x16913 -.PerfectHeresYourMon: ; 0x16913 +.PerfectHeresYourMon: ; Perfect! Here's your #MON. text_jump UnknownText_0x1bde04 db "@" -; 0x16918 -.GotBackMon: ; 0x16918 +.GotBackMon: ; got back @ . text_jump UnknownText_0x1bde1f db "@" -; 0x1691d -.ImmediatelyWithdrawMon: ; 0x1691d +.ImmediatelyWithdrawMon: ; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100. text_jump UnknownText_0x1bde32 db "@" -; 0x16922 -.PartyFull: ; 0x16922 +.PartyFull: ; You have no room for it. text_jump UnknownText_0x1bdea2 db "@" -; 0x16927 -.NotEnoughMoney: ; 0x16927 +.NotEnoughMoney: ; You don't have enough money. text_jump UnknownText_0x1bdebc db "@" -; 0x1692c -.OhFineThen: ; 0x1692c +.OhFineThen: ; Oh, fine then. text_jump UnknownText_0x1bded9 db "@" -; 0x16931 -.ComeAgain: ; 0x16931 +.ComeAgain: ; Come again. text_jump UnknownText_0x1bdee9 db "@" -; 0x16936 -DayCareManOutside: ; 16936 +DayCareManOutside: ld hl, wDayCareMan bit DAYCAREMAN_HAS_EGG_F, [hl] jr nz, .AskGiveEgg @@ -435,13 +403,12 @@ DayCareManOutside: ; 16936 call PrintText ret -.NotYet: ; 0x16944 +.NotYet: ; Not yet… text_jump UnknownText_0x1bdef6 db "@" -; 0x16949 -.AskGiveEgg: ; 16949 +.AskGiveEgg: ld hl, .IntroText call PrintText call YesNoBox @@ -477,39 +444,33 @@ DayCareManOutside: ; 16936 ld a, TRUE ld [wScriptVar], a ret -; 16993 -.IntroText: ; 0x16993 +.IntroText: ; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it? text_jump UnknownText_0x1bdf00 db "@" -; 0x16998 -.GotEggText: ; 0x16998 +.GotEggText: ; received the EGG! text_jump UnknownText_0x1bdfa5 db "@" -; 0x1699d -.TakeGoodCareOfItText: ; 0x1699d +.TakeGoodCareOfItText: ; Take good care of it. text_jump UnknownText_0x1bdfba db "@" -; 0x169a2 -.IllKeepItThanksText: ; 0x169a2 +.IllKeepItThanksText: ; Well then, I'll keep it. Thanks! text_jump UnknownText_0x1bdfd1 db "@" -; 0x169a7 -.PartyFullText: ; 0x169a7 +.PartyFullText: ; You have no room in your party. Come back later. text_jump UnknownText_0x1bdff2 db "@" -; 0x169ac -DayCare_GiveEgg: ; 169ac +DayCare_GiveEgg: ld a, [wEggMonLevel] ld [wCurPartyLevel], a ld hl, wPartyCount @@ -580,18 +541,16 @@ DayCare_GiveEgg: ; 169ac .PartyFull: scf ret -; 16a31 -DayCare_GetCurrentPartyMember: ; 16a31 +DayCare_GetCurrentPartyMember: ld a, [wPartyCount] dec a call AddNTimes ld d, h ld e, l ret -; 16a3b -DayCare_InitBreeding: ; 16a3b +DayCare_InitBreeding: ld a, [wDayCareLady] bit DAYCARELADY_HAS_MON_F, a ret z @@ -612,9 +571,8 @@ DayCare_InitBreeding: ; 16a3b jr c, .loop ld [wStepsToEgg], a jp .UselessJump -; 16a66 -.UselessJump: ; 16a66 +.UselessJump: xor a ld hl, wEggMon ld bc, wEggMonEnd - wEggMon @@ -788,8 +746,6 @@ DayCare_InitBreeding: ; 16a3b ld a, [wCurPartyLevel] ld [wEggMonLevel], a ret -; 16be0 -.String_EGG: ; 16be0 +.String_EGG: db "EGG@" -; 16be4 diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 5d0482cc4..aa4755e4f 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -1,10 +1,9 @@ -_Diploma: ; 1dd702 +_Diploma: call PlaceDiplomaOnScreen call WaitPressAorB_BlinkCursor ret -; 1dd709 -PlaceDiplomaOnScreen: ; 1dd709 +PlaceDiplomaOnScreen: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -35,7 +34,6 @@ PlaceDiplomaOnScreen: ; 1dd709 call SetPalettes call DelayFrame ret -; 1dd760 .Player: db "PLAYER@" @@ -50,9 +48,8 @@ PlaceDiplomaOnScreen: ; 1dd709 next "new #DEX." next "Congratulations!" db "@" -; 1dd7ae -PrintDiplomaPage2: ; 1dd7ae +PrintDiplomaPage2: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f @@ -77,17 +74,15 @@ PrintDiplomaPage2: ; 1dd7ae lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 1dd7f0 .PlayTime: db "PLAY TIME@" .GameFreak: db "GAME FREAK@" -; 1dd805 -DiplomaGFX: ; 1dd805 +DiplomaGFX: INCBIN "gfx/diploma/diploma.2bpp.lz" -DiplomaPage1Tilemap: ; 1ddc4b +DiplomaPage1Tilemap: INCBIN "gfx/diploma/page1.tilemap" -DiplomaPage2Tilemap: ; 1dddb3 +DiplomaPage2Tilemap: INCBIN "gfx/diploma/page2.tilemap" diff --git a/engine/events/dratini.asm b/engine/events/dratini.asm index 1019e302e..2dd97eaee 100644 --- a/engine/events/dratini.asm +++ b/engine/events/dratini.asm @@ -1,4 +1,4 @@ -GiveDratini: ; 0x8b170 +GiveDratini: ; if wScriptVar is 0 or 1, change the moveset of the last Dratini in the party. ; 0: give it a special moveset with Extremespeed. ; 1: give it the normal moveset of a level 15 Dratini. @@ -84,7 +84,7 @@ GiveDratini: ; 0x8b170 db TWISTER db 0 -.GetNthPartyMon: ; 0x8b1ce +.GetNthPartyMon: ; inputs: ; hl must be set to 0 before calling this function. ; a must be set to the number of Pokémon in the party. @@ -109,4 +109,3 @@ GiveDratini: ; 0x8b170 .EmptyParty: scf ret -; 8b1e1 diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index bcad170d4..705b24992 100644 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -1,4 +1,4 @@ -Elevator:: ; 1342d +Elevator:: call .LoadPointer call .FindCurrentFloor jr c, .quit @@ -15,9 +15,8 @@ Elevator:: ; 1342d .quit scf ret -; 1344a -.LoadPointer: ; 1344a +.LoadPointer: ld a, b ld [wElevatorPointerBank], a ld a, e @@ -26,9 +25,8 @@ Elevator:: ; 1342d ld [wElevatorPointer + 1], a call .LoadFloors ret -; 1345a -.LoadFloors: ; 1345a +.LoadFloors: ld de, wCurElevator ld bc, 4 ld hl, wElevatorPointer @@ -49,9 +47,8 @@ Elevator:: ; 1342d cp -1 jr nz, .loop ret -; 1347d -.FindCurrentFloor: ; 1347d +.FindCurrentFloor: ld hl, wElevatorPointer ld a, [hli] ld h, [hl] @@ -98,9 +95,8 @@ Elevator:: ; 1342d .fail scf ret -; 134c0 -Elevator_GoToFloor: ; 134c0 +Elevator_GoToFloor: push af ld hl, wElevatorPointer ld a, [hli] @@ -116,9 +112,8 @@ Elevator_GoToFloor: ; 134c0 ld bc, 3 call FarCopyBytes ret -; 134dd -Elevator_AskWhichFloor: ; 134dd +Elevator_AskWhichFloor: call LoadStandardMenuHeader ld hl, Elevator_WhichFloorText call PrintText @@ -141,16 +136,13 @@ Elevator_AskWhichFloor: ; 134dd .cancel scf ret -; 1350d -Elevator_WhichFloorText: ; 0x1350d +Elevator_WhichFloorText: ; Which floor? text_jump UnknownText_0x1bd2bc db "@" -; 0x13512 - -Elevator_GetCurrentFloorText: ; 13512 +Elevator_GetCurrentFloorText: ld hl, wOptions ld a, [hl] push af @@ -167,14 +159,11 @@ Elevator_GetCurrentFloorText: ; 13512 pop af ld [wOptions], a ret -; 13537 -Elevator_CurrentFloorText: ; 13537 +Elevator_CurrentFloorText: db "Now on:@" -; 1353f - -Elevator_GetCurrentFloorString: ; 1353f +Elevator_GetCurrentFloorString: push hl ld a, [wElevatorOriginFloor] ld e, a @@ -185,16 +174,14 @@ Elevator_GetCurrentFloorString: ; 1353f pop de call GetFloorString ret -; 13550 -Elevator_MenuHeader: ; 0x13550 +Elevator_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 12, 1, 18, 9 dw Elevator_MenuData db 1 ; default option -; 0x13558 -Elevator_MenuData: ; 0x13558 +Elevator_MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 0 ; rows, columns db 1 ; horizontal spacing @@ -202,20 +189,18 @@ Elevator_MenuData: ; 0x13558 dba GetElevatorFloorStrings dba NULL dba NULL -; 13568 -GetElevatorFloorStrings: ; 13568 +GetElevatorFloorStrings: ld a, [wMenuSelection] -GetFloorString: ; 1356b +GetFloorString: push de call FloorToString ld d, h ld e, l pop hl jp PlaceString -; 13575 -FloorToString: ; 13575 +FloorToString: push de ld e, a ld d, 0 @@ -227,6 +212,5 @@ FloorToString: ; 13575 ld l, a pop de ret -; 13583 INCLUDE "data/events/elevator_floors.asm" diff --git a/engine/events/engine_flags.asm b/engine/events/engine_flags.asm index acda9ede7..6c2148f79 100644 --- a/engine/events/engine_flags.asm +++ b/engine/events/engine_flags.asm @@ -1,4 +1,4 @@ -EngineFlagAction:: ; 80430 +EngineFlagAction:: ; Do action b on engine flag de ; ; b = 0: reset flag @@ -7,7 +7,6 @@ EngineFlagAction:: ; 80430 ; ; Setting/resetting does not return a result. - ; 16-bit flag ids are considered invalid, but it's nice ; to know that the infrastructure is there. @@ -80,7 +79,5 @@ EngineFlagAction:: ; 80430 and c ld [de], a ret -; 80462 - INCLUDE "data/engine_flags.asm" diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 2fc30d25c..6adb80ba6 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,12 +1,15 @@ -PlayWhirlpoolSound: ; 8c7d4 +FIELDMOVE_GRASS EQU $80 +FIELDMOVE_TREE EQU $84 +FIELDMOVE_FLY EQU $84 + +PlayWhirlpoolSound: call WaitSFX ld de, SFX_SURF call PlaySFX call WaitSFX ret -; 8c7e1 -BlindingFlash: ; 8c7e1 +BlindingFlash: farcall FadeOutPalettes ld hl, wStatusFlags set STATUSFLAGS_FLASH_F, [hl] @@ -17,16 +20,15 @@ BlindingFlash: ; 8c7e1 farcall LoadOW_BGPal7 farcall FadeInPalettes ret -; 8c80a -ShakeHeadbuttTree: ; 8c80a +ShakeHeadbuttTree: farcall ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, HeadbuttTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing @@ -34,8 +36,8 @@ ShakeHeadbuttTree: ; 8c80a call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 - ld a, 36 * 4 + ld [hl], FIELDMOVE_TREE + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree @@ -50,7 +52,7 @@ ShakeHeadbuttTree: ; 8c80a and a jr z, .done dec [hl] - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call DelayFrame @@ -72,13 +74,11 @@ ShakeHeadbuttTree: ; 8c80a call Get1bpp call ReplaceKrisSprite ret -; 8c893 -HeadbuttTreeGFX: ; 8c893 +HeadbuttTreeGFX: INCBIN "gfx/overworld/headbutt_tree.2bpp" -; 8c913 -HideHeadbuttTree: ; 8c913 +HideHeadbuttTree: xor a ld [hBGMapMode], a ld a, [wPlayerDirection] @@ -103,21 +103,19 @@ HideHeadbuttTree: ; 8c913 xor a ld [hBGMapMode], a ret -; 8c938 -TreeRelativeLocationTable: ; 8c938 +TreeRelativeLocationTable: dwcoord 8, 8 + 2 ; RIGHT dwcoord 8, 8 - 2 ; LEFT dwcoord 8 - 2, 8 ; DOWN dwcoord 8 + 2, 8 ; UP -; 8c940 -OWCutAnimation: ; 8c940 +OWCutAnimation: ; Animation index in e ; 0: Split tree in half ; 1: Mow the lawn ld a, e - and $1 + and 1 ld [wJumptableIndex], a call .LoadCutGFX call WaitSFX @@ -127,7 +125,7 @@ OWCutAnimation: ; 8c940 ld a, [wJumptableIndex] bit 7, a jr nz, .finish - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call OWCutJumptable @@ -136,30 +134,26 @@ OWCutAnimation: ; 8c940 .finish ret -; 8c96d -.LoadCutGFX: ; 8c96d +.LoadCutGFX: callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX - ld hl, vTiles1 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, CutTreeGFX - ld hl, vTiles1 tile $4 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(CutTreeGFX), 4 call Request2bpp ret -; 8c98c -CutTreeGFX: ; c898c +CutTreeGFX: INCBIN "gfx/overworld/cut_tree.2bpp" -; c89cc -CutGrassGFX: ; 8c9cc +CutGrassGFX: INCBIN "gfx/overworld/cut_grass.2bpp" -; 8ca0c -OWCutJumptable: ; 8ca0c +OWCutJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -170,23 +164,20 @@ OWCutJumptable: ; 8ca0c ld h, [hl] ld l, a jp hl -; 8ca1b - -.dw ; 8ca1b (23:4a1b) +.dw dw Cut_SpawnAnimateTree dw Cut_SpawnAnimateLeaves dw Cut_StartWaiting dw Cut_WaitAnimSFX - -Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) +Cut_SpawnAnimateTree: call Cut_Headbutt_GetPixelFacing ld a, SPRITE_ANIM_INDEX_CUT_TREE ; cut tree call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_TREE ld a, 32 ld [wFrameCounter], a ; Cut_StartWaiting @@ -195,7 +186,7 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) inc [hl] ret -Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) +Cut_SpawnAnimateLeaves: call Cut_GetLeafSpawnCoords xor a call Cut_SpawnLeaf @@ -212,14 +203,14 @@ Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) inc [hl] ret -Cut_StartWaiting: ; 8ca5c (23:4a5c) +Cut_StartWaiting: ld a, $1 ld [hBGMapMode], a ; Cut_WaitAnimSFX ld hl, wJumptableIndex inc [hl] -Cut_WaitAnimSFX: ; 8ca64 (23:4a64) +Cut_WaitAnimSFX: ld hl, wFrameCounter ld a, [hl] and a @@ -232,14 +223,14 @@ Cut_WaitAnimSFX: ; 8ca64 (23:4a64) set 7, [hl] ret -Cut_SpawnLeaf: ; 8ca73 (23:4a73) +Cut_SpawnLeaf: push de push af ld a, SPRITE_ANIM_INDEX_LEAF ; leaf call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ld hl, SPRITEANIMSTRUCT_0E add hl, bc ld [hl], $4 @@ -250,7 +241,7 @@ Cut_SpawnLeaf: ; 8ca73 (23:4a73) pop de ret -Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) +Cut_GetLeafSpawnCoords: ld de, 0 ld a, [wMetatileStandingX] bit 0, a @@ -273,9 +264,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) inc hl ld d, [hl] ret -; 8cab3 (23:4ab3) -.Coords: ; 8cab3 +.Coords: dbpixel 11, 12 ; facing down, top left dbpixel 9, 12 ; facing down, top right dbpixel 11, 14 ; facing down, bottom left @@ -295,9 +285,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) dbpixel 13, 12 ; facing right, top right dbpixel 11, 10 ; facing right, bottom left dbpixel 13, 10 ; facing right, bottom right -; 8cad3 -Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) +Cut_Headbutt_GetPixelFacing: ld a, [wPlayerDirection] and %00001100 srl a @@ -309,17 +298,14 @@ Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) inc hl ld d, [hl] ret -; 8cae5 (23:4ae5) -.Coords: ; 8cae5 +.Coords: dbpixel 10, 13 dbpixel 10, 9 dbpixel 8, 11 dbpixel 12, 11 -; 8caed - -FlyFromAnim: ; 8caed +FlyFromAnim: call DelayFrame ld a, [wVramState] push af @@ -331,7 +317,7 @@ FlyFromAnim: ; 8caed call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM @@ -341,7 +327,7 @@ FlyFromAnim: ; 8caed ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -352,9 +338,8 @@ FlyFromAnim: ; 8caed pop af ld [wVramState], a ret -; 8cb33 -FlyToAnim: ; 8cb33 +FlyToAnim: call DelayFrame ld a, [wVramState] push af @@ -366,7 +351,7 @@ FlyToAnim: ; 8cb33 call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_TO @@ -379,7 +364,7 @@ FlyToAnim: ; 8cb33 ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -392,7 +377,7 @@ FlyToAnim: ; 8cb33 call .RestorePlayerSprite_DespawnLeaves ret -.RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82) +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -410,10 +395,10 @@ endr call ByteFill ret -FlyFunction_InitGFX: ; 8cb9b (23:4b9b) +FlyFunction_InitGFX: callfar ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld a, [wCurPartyMon] @@ -423,13 +408,13 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) add hl, de ld a, [hl] ld [wd265], a - ld e, $84 + ld e, FIELDMOVE_FLY farcall FlyFunction_GetMonIcon xor a ld [wJumptableIndex], a ret -FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) +FlyFunction_FrameTimer: call .SpawnLeaf ld hl, wFrameCounter ld a, [hl] @@ -449,7 +434,7 @@ FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) set 7, [hl] ret -.SpawnLeaf: ; 8cbe6 (23:4be6) +.SpawnLeaf: ld hl, wcf65 ld a, [hl] inc [hl] @@ -465,5 +450,5 @@ FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ret diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 09de8f2b7..a1df536bb 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -1,4 +1,4 @@ -Fish: ; 92402 +Fish: ; Using a fishing rod. ; Fish for monsters with rod e in encounter group d. ; Return monster e at level d. @@ -11,7 +11,7 @@ Fish: ; 92402 call GetFishGroupIndex ld hl, FishGroups -rept 7 +rept FISHGROUP_DATA_LENGTH add hl, de endr call .Fish @@ -20,10 +20,8 @@ endr pop bc pop af ret -; 9241a - -.Fish: ; 9241a +.Fish: ; Fish for monsters with rod b from encounter data in FishGroup at hl. ; Return monster e at level d. @@ -90,10 +88,8 @@ endr ld d, [hl] inc hl ret -; 9245b - -GetFishGroupIndex: ; 9245b +GetFishGroupIndex: ; Return the index of fishgroup d in de. push hl @@ -127,7 +123,5 @@ GetFishGroupIndex: ; 9245b jr nz, .done ld d, FISHGROUP_REMORAID_SWARM jr .done -; 92488 - INCLUDE "data/wild/fish.asm" diff --git a/engine/events/fishing_gfx.asm b/engine/events/fishing_gfx.asm index 3d3ab0ba0..159f0022d 100644 --- a/engine/events/fishing_gfx.asm +++ b/engine/events/fishing_gfx.asm @@ -1,4 +1,4 @@ -LoadFishingGFX: ; b84b3 +LoadFishingGFX: ld a, [rVBK] push af ld a, $1 @@ -17,15 +17,14 @@ LoadFishingGFX: ; b84b3 call .LoadGFX ld hl, vTiles0 tile $0a call .LoadGFX - ld hl, vTiles1 tile $7c + ld hl, vTiles0 tile $fc call .LoadGFX pop af ld [rVBK], a ret -; b84e3 -.LoadGFX: ; b84e3 +.LoadGFX: lb bc, BANK(FishingGFX), 2 push de call Get2bpp @@ -35,12 +34,9 @@ LoadFishingGFX: ; b84b3 ld d, h ld e, l ret -; b84f2 -FishingGFX: ; b84f2 +FishingGFX: INCBIN "gfx/overworld/chris_fish.2bpp" -; b8582 -KrisFishingGFX: ; b8582 +KrisFishingGFX: INCBIN "gfx/overworld/kris_fish.2bpp" -; b8612 diff --git a/engine/events/forced_movement.asm b/engine/events/forced_movement.asm index 2d03659ff..69f27bfe2 100644 --- a/engine/events/forced_movement.asm +++ b/engine/events/forced_movement.asm @@ -1,60 +1,51 @@ -Script_ForcedMovement:: ; 0x1253d +Script_ForcedMovement:: checkcode VAR_FACING ifequal DOWN, .down ifequal UP, .up ifequal LEFT, .left ifequal RIGHT, .right end -; 0x12550 -.up ; 0x12550 +.up applymovement PLAYER, .MovementData_up end -; 0x12555 -.down ; 0x12555 +.down applymovement PLAYER, .MovementData_down end -; 0x1255a -.right ; 0x1255a +.right applymovement PLAYER, .MovementData_right end -; 0x1255f -.left ; 0x1255f +.left applymovement PLAYER, .MovementData_left end -; 0x12564 -.MovementData_up: ; 0x12564 +.MovementData_up: step_dig 16 turn_in DOWN step_dig 16 turn_head DOWN step_end -; 0x1256b -.MovementData_down: ; 0x1256b +.MovementData_down: step_dig 16 turn_in UP step_dig 16 turn_head UP step_end -; 0x12572 -.MovementData_right: ; 0x12572 +.MovementData_right: step_dig 16 turn_in LEFT step_dig 16 turn_head LEFT step_end -; 0x12579 -.MovementData_left: ; 0x12579 +.MovementData_left: step_dig 16 turn_in RIGHT step_dig 16 turn_head RIGHT step_end -; 0x12580 diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index 47d7702b4..6d5ca6a1d 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -1,4 +1,4 @@ -FruitTreeScript:: ; 44000 +FruitTreeScript:: callasm GetCurTreeFruit opentext copybytetovar wCurFruit @@ -32,38 +32,33 @@ FruitTreeScript:: ; 44000 .end closetext end -; 44041 -GetCurTreeFruit: ; 44041 +GetCurTreeFruit: ld a, [wCurFruitTree] dec a call GetFruitTreeItem ld [wCurFruit], a ret -; 4404c -TryResetFruitTrees: ; 4404c +TryResetFruitTrees: ld hl, wDailyFlags bit DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] ret nz jp ResetFruitTrees -; 44055 -CheckFruitTree: ; 44055 +CheckFruitTree: ld b, 2 call GetFruitTreeFlag ld a, c ld [wScriptVar], a ret -; 4405f -PickedFruitTree: ; 4405f +PickedFruitTree: farcall StubbedTrainerRankings_FruitPicked ld b, 1 jp GetFruitTreeFlag -; 4406a -ResetFruitTrees: ; 4406a +ResetFruitTrees: xor a ld hl, wFruitTreeFlags ld [hli], a @@ -73,9 +68,8 @@ ResetFruitTrees: ; 4406a ld hl, wDailyFlags set DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] ret -; 44078 -GetFruitTreeFlag: ; 44078 +GetFruitTreeFlag: push hl push de ld a, [wCurFruitTree] @@ -87,9 +81,8 @@ GetFruitTreeFlag: ; 44078 pop de pop hl ret -; 4408a -GetFruitTreeItem: ; 4408a +GetFruitTreeItem: push hl push de ld e, a @@ -100,33 +93,25 @@ GetFruitTreeItem: ; 4408a pop de pop hl ret -; 44097 - INCLUDE "data/items/fruit_trees.asm" - -FruitBearingTreeText: ; 440b5 +FruitBearingTreeText: text_jump _FruitBearingTreeText db "@" -; 440ba -HeyItsFruitText: ; 440ba +HeyItsFruitText: text_jump _HeyItsFruitText db "@" -; 440bf -ObtainedFruitText: ; 440bf +ObtainedFruitText: text_jump _ObtainedFruitText db "@" -; 440c4 -FruitPackIsFullText: ; 440c4 +FruitPackIsFullText: text_jump _FruitPackIsFullText db "@" -; 440c9 -NothingHereText: ; 440c9 +NothingHereText: text_jump _NothingHereText db "@" -; 440ce diff --git a/engine/events/haircut.asm b/engine/events/haircut.asm index 0e4400235..d5b0afe8b 100644 --- a/engine/events/haircut.asm +++ b/engine/events/haircut.asm @@ -1,4 +1,4 @@ -BillsGrandfather: ; 73f7 +BillsGrandfather: farcall SelectMonFromParty jr c, .cancel ld a, [wCurPartySpecies] @@ -12,19 +12,19 @@ BillsGrandfather: ; 73f7 ld [wScriptVar], a ret -YoungerHaircutBrother: ; 7413 +YoungerHaircutBrother: ld hl, HappinessData_YoungerHaircutBrother jr HaircutOrGrooming -OlderHaircutBrother: ; 7418 +OlderHaircutBrother: ld hl, HappinessData_OlderHaircutBrother jr HaircutOrGrooming -DaisysGrooming: ; 741d +DaisysGrooming: ld hl, HappinessData_DaisysGrooming ; fallthrough -HaircutOrGrooming: ; 7420 +HaircutOrGrooming: push hl farcall SelectMonFromParty pop hl @@ -72,11 +72,11 @@ HaircutOrGrooming: ; 7420 INCLUDE "data/events/happiness_probabilities.asm" -CopyPokemonName_Buffer1_Buffer3: ; 746e +CopyPokemonName_Buffer1_Buffer3: ld hl, wStringBuffer1 ld de, wStringBuffer3 ld bc, MON_NAME_LENGTH jp CopyBytes -DummyPredef1: ; 747a +DummyPredef1: ret diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index b6b547aae..6cbc749d5 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -1,6 +1,6 @@ HALLOFFAME_COLON EQU $63 -HallOfFame:: ; 0x8640e +HallOfFame:: call HallOfFame_FadeOutMusic ld a, [wStatusFlags] push af @@ -33,9 +33,8 @@ HallOfFame:: ; 0x8640e ld b, a farcall Credits ret -; 0x86455 -RedCredits:: ; 86455 +RedCredits:: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -56,9 +55,8 @@ RedCredits:: ; 86455 ld b, a farcall Credits ret -; 8648e -HallOfFame_FadeOutMusic: ; 8648e +HallOfFame_FadeOutMusic: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -72,9 +70,8 @@ HallOfFame_FadeOutMusic: ; 8648e farcall InitDisplayForHallOfFame ld c, 100 jp DelayFrames -; 864b4 -HallOfFame_PlayMusicDE: ; 864b4 +HallOfFame_PlayMusicDE: push de ld de, MUSIC_NONE call PlayMusic @@ -82,9 +79,8 @@ HallOfFame_PlayMusicDE: ; 864b4 pop de call PlayMusic ret -; 864c3 -AnimateHallOfFame: ; 864c3 +AnimateHallOfFame: xor a ld [wJumptableIndex], a call LoadHOFTeam @@ -120,9 +116,8 @@ AnimateHallOfFame: ; 864c3 ld c, 8 call DelayFrames ret -; 8650c -.DisplayNewHallOfFamer: ; 8650c +.DisplayNewHallOfFamer: call DisplayHOFMon ld de, .String_NewHallOfFamer hlcoord 1, 2 @@ -135,14 +130,11 @@ AnimateHallOfFame: ; 864c3 call DelayFrames and a ret -; 8652c .String_NewHallOfFamer: db "New Hall of Famer!@" -; 8653f - -GetHallOfFameParty: ; 8653f +GetHallOfFameParty: ld hl, wHallOfFamePokemonList ld bc, wHallOfFamePokemonListEnd - wHallOfFamePokemonList + 1 xor a @@ -227,9 +219,8 @@ GetHallOfFameParty: ; 8653f ld a, -1 ld [de], a ret -; 865b5 -AnimateHOFMonEntrance: ; 865b5 +AnimateHOFMonEntrance: push hl call ClearBGPalettes farcall ResetDisplayBetweenHallOfFameMons @@ -281,7 +272,6 @@ AnimateHOFMonEntrance: ; 865b5 ld [hSCY], a call HOF_SlideFrontpic ret -; 86635 HOF_SlideBackpic: .backpicloop @@ -292,7 +282,6 @@ HOF_SlideBackpic: ld [hSCX], a call DelayFrame jr .backpicloop -; 86643 HOF_SlideFrontpic: .frontpicloop @@ -304,9 +293,8 @@ HOF_SlideFrontpic: ld [hSCX], a call DelayFrame jr .frontpicloop -; 86650 -_HallOfFamePC: ; 86650 +_HallOfFamePC: call LoadFontsBattleExtra xor a ld [wJumptableIndex], a @@ -415,9 +403,8 @@ _HallOfFamePC: ; 86650 .TimeFamer: db " -Time Famer@" -; 8671c -LoadHOFTeam: ; 8671c +LoadHOFTeam: ld a, [wJumptableIndex] cp NUM_HOF_TEAMS jr nc, .invalid @@ -442,9 +429,8 @@ LoadHOFTeam: ; 8671c .invalid scf ret -; 86748 -DisplayHOFMon: ; 86748 +DisplayHOFMon: xor a ld [hBGMapMode], a ld a, [hli] @@ -529,9 +515,8 @@ DisplayHOFMon: ; 86748 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ret -; 86810 -HOF_AnimatePlayerPic: ; 86810 +HOF_AnimatePlayerPic: call ClearBGPalettes ld hl, vTiles2 tile HALLOFFAME_COLON ld de, FontExtra + 13 tiles ; "<COLON>" @@ -614,9 +599,6 @@ HOF_AnimatePlayerPic: ; 86810 call WaitBGMap farcall ProfOaksPCRating ret -; 868ed .PlayTime: db "PLAY TIME@" -; 868f7 - diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 998e7e07a..41f9a4411 100644 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -1,4 +1,4 @@ -GetFirstPokemonHappiness: ; 718d +GetFirstPokemonHappiness: ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH ld de, wPartySpecies @@ -17,7 +17,7 @@ GetFirstPokemonHappiness: ; 718d call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 -CheckFirstMonIsEgg: ; 71ac +CheckFirstMonIsEgg: ld a, [wPartySpecies] ld [wd265], a cp EGG @@ -30,7 +30,7 @@ CheckFirstMonIsEgg: ; 71ac call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 -ChangeHappiness: ; 71c2 +ChangeHappiness: ; Perform happiness action c on wCurPartyMon ld a, [wCurPartyMon] @@ -102,11 +102,9 @@ ChangeHappiness: ; 71c2 ld [wBattleMonHappiness], a ret - INCLUDE "data/events/happiness_changes.asm" - -StepHappiness:: ; 725a +StepHappiness:: ; Raise the party's happiness by 1 point every other step cycle. ld hl, wHappinessStepCount @@ -141,8 +139,7 @@ StepHappiness:: ; 725a jr nz, .loop ret - -DayCareStep:: ; 7282 +DayCareStep:: ; Raise the experience of Day-Care Pokémon every step cycle. ld a, [wDayCareMan] diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 955449280..559886289 100644 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -7,7 +7,7 @@ const HEALMACHINESTATE_HOFPLAYSFX const HEALMACHINESTATE_FINISH -HealMachineAnim: ; 12324 +HealMachineAnim: ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. ld a, [wPartyCount] and a @@ -24,9 +24,8 @@ HealMachineAnim: ; 12324 ld a, [wBuffer2] call DmgToCgbObjPal1 ret -; 1233e -.DoJumptableFunctions: ; 1233e +.DoJumptableFunctions: xor a ld [wBuffer3], a .jumpable_loop @@ -53,14 +52,12 @@ HealMachineAnim: ; 12324 .finish ret -; 12365 -.Pointers: ; 12365 +.Pointers: ; entries correspond to HEALMACHINE_* constants dw .Pokecenter dw .ElmLab dw .HallOfFame -; 1236b healmachineanimseq: MACRO rept _NARG @@ -69,15 +66,14 @@ rept _NARG endr ENDM -.Pokecenter: ; 1236b +.Pokecenter: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH -.ElmLab: ; 1236f +.ElmLab: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH -.HallOfFame: ; 12373 +.HallOfFame: healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH -; 12377 -.Jumptable: ; 12377 +.Jumptable: ; entries correspond to HEALMACHINESTATE_* constants dw .LoadGFX dw .PC_LoadBallsOntoMachine @@ -85,29 +81,27 @@ ENDM dw .PlayHealMusic dw .HOF_PlaySFX dw .dummy_5 ; never encountered -; 12383 -.LoadGFX: ; 12383 +.LoadGFX: call .LoadPalettes ld de, .HealMachineGFX ld hl, vTiles0 tile $7c lb bc, BANK(.HealMachineGFX), 2 call Request2bpp ret -; 12393 -.PC_LoadBallsOntoMachine: ; 12393 +.PC_LoadBallsOntoMachine: ld hl, wVirtualOAMSprite32 ld de, .PC_ElmsLab_OAM call .PlaceHealingMachineTile call .PlaceHealingMachineTile jr .LoadBallsOntoMachine -.HOF_LoadBallsOntoMachine: ; 123a1 +.HOF_LoadBallsOntoMachine: ld hl, wVirtualOAMSprite32 ld de, .HOF_OAM -.LoadBallsOntoMachine: ; 123a7 +.LoadBallsOntoMachine: ld a, [wPartyCount] ld b, a .party_loop @@ -121,15 +115,13 @@ ENDM dec b jr nz, .party_loop ret -; 123bf -.PlayHealMusic: ; 123bf +.PlayHealMusic: ld de, MUSIC_HEAL call PlayMusic jp .FlashPalettes8Times -; 123c8 -.HOF_PlaySFX: ; 123c8 +.HOF_PlaySFX: ld de, SFX_GAME_FREAK_LOGO_GS call PlaySFX call .FlashPalettes8Times @@ -137,13 +129,11 @@ ENDM ld de, SFX_BOOT_PC call PlaySFX ret -; 123db -.dummy_5 ; 123db +.dummy_5 ret -; 123dc -.PC_ElmsLab_OAM: ; 123dc +.PC_ElmsLab_OAM: dsprite 4, 0, 4, 2, $7c, PAL_OW_TREE | OBP_NUM dsprite 4, 0, 4, 6, $7c, PAL_OW_TREE | OBP_NUM dsprite 4, 6, 4, 0, $7d, PAL_OW_TREE | OBP_NUM @@ -152,22 +142,19 @@ ENDM dsprite 5, 3, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP dsprite 6, 0, 4, 0, $7d, PAL_OW_TREE | OBP_NUM dsprite 6, 0, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP -; 123fc -.HealMachineGFX: ; 123fc +.HealMachineGFX: INCBIN "gfx/overworld/heal_machine.2bpp" -; 1241c -.HOF_OAM: ; 1241c +.HOF_OAM: dsprite 7, 4, 10, 1, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 4, 10, 6, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 3, 9, 5, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 3, 11, 2, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 1, 9, 1, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 1, 11, 5, $7d, PAL_OW_TREE | OBP_NUM -; 12434 -.LoadPalettes: ; 12434 +.LoadPalettes: call IsCGB jr nz, .cgb ld a, %11100000 @@ -183,13 +170,11 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ld a, $1 ld [hCGBPalUpdate], a ret -; 12451 -.palettes ; 12451 +.palettes INCLUDE "gfx/overworld/heal_machine.pal" -; 12459 -.FlashPalettes8Times: ; 12459 +.FlashPalettes8Times: ld c, 8 .palette_loop push bc @@ -200,9 +185,8 @@ INCLUDE "gfx/overworld/heal_machine.pal" dec c jr nz, .palette_loop ret -; 12469 -.FlashPalettes: ; 12469 +.FlashPalettes: call IsCGB jr nz, .go ld a, [rOBP1] @@ -250,9 +234,8 @@ INCLUDE "gfx/overworld/heal_machine.pal" ld a, $1 ld [hCGBPalUpdate], a ret -; 124a3 -.PlaceHealingMachineTile: ; 124a3 +.PlaceHealingMachineTile: push bc ld a, [wBuffer1] bcpixel 2, 4 @@ -277,4 +260,3 @@ INCLUDE "gfx/overworld/heal_machine.pal" ld [hli], a ; attributes pop bc ret -; 124c1 diff --git a/engine/events/itemfinder.asm b/engine/events/itemfinder.asm index 71aaa5b69..6a4d6edf3 100644 --- a/engine/events/itemfinder.asm +++ b/engine/events/itemfinder.asm @@ -1,4 +1,4 @@ -ItemFinder: ; 12580 +ItemFinder: farcall CheckForHiddenItems jr c, .found_something ld hl, .Script_FoundNothing @@ -12,9 +12,8 @@ ItemFinder: ; 12580 ld a, $1 ld [wItemEffectSucceeded], a ret -; 12599 -.ItemfinderSound: ; 12599 +.ItemfinderSound: ld c, 4 .sfx_loop push bc @@ -26,33 +25,28 @@ ItemFinder: ; 12580 dec c jr nz, .sfx_loop ret -; 125ad -.Script_FoundSomething: ; 0x125ad +.Script_FoundSomething: reloadmappart special UpdateTimePals callasm .ItemfinderSound writetext .Text_FoundSomething closetext end -; 0x125ba -.Script_FoundNothing: ; 0x125ba +.Script_FoundNothing: reloadmappart special UpdateTimePals writetext .Text_FoundNothing closetext end -; 0x125c3 -.Text_FoundSomething: ; 0x125c3 +.Text_FoundSomething: ; Yes! ITEMFINDER indicates there's an item nearby. text_jump UnknownText_0x1c0a77 db "@" -; 0x125c8 -.Text_FoundNothing: ; 0x125c8 +.Text_FoundNothing: ; Nope! ITEMFINDER isn't responding. text_jump UnknownText_0x1c0aa9 db "@" -; 0x125cd diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 8fe78f5b6..d4342b3e4 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -1,28 +1,24 @@ -Kurt_PrintTextWhichApricorn: ; 88000 +Kurt_PrintTextWhichApricorn: ld hl, .Text call PrintText ret -; 88007 -.Text: ; 0x88007 +.Text: ; Which APRICORN should I use? text_jump UnknownText_0x1bc06b db "@" -; 0x8800c -Kurt_PrintTextHowMany: ; 8800c +Kurt_PrintTextHowMany: ld hl, .Text call PrintText ret -; 88013 -.Text: ; 0x88013 +.Text: ; How many should I make? text_jump UnknownText_0x1bc089 db "@" -; 0x88018 -SelectApricornForKurt: ; 88018 +SelectApricornForKurt: call LoadStandardMenuHeader ld c, $1 xor a @@ -54,9 +50,8 @@ SelectApricornForKurt: ; 88018 .done call Call_ExitMenu ret -; 88055 -Kurt_SelectApricorn: ; 88055 +Kurt_SelectApricorn: farcall FindApricornsInBag jr c, .nope ld hl, .MenuHeader @@ -81,18 +76,16 @@ Kurt_SelectApricorn: ; 88055 .done ld c, a ret -; 88086 -.MenuHeader: ; 0x88086 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, 13, 10 dw .MenuData db 1 ; default option -; 0x8808e db 0 ; XXX -.MenuData: ; 0x8808f +.MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 7 db 1 @@ -101,15 +94,14 @@ Kurt_SelectApricorn: ; 88055 dba .Quantity dba NULL -.Name: ; 8809f +.Name: ld a, [wMenuSelection] and a ret z farcall PlaceMenuItemName ret -; 880ab -.Quantity: ; 880ab +.Quantity: ld a, [wMenuSelection] ld [wCurItem], a call Kurt_GetQuantityOfApricorn @@ -118,9 +110,8 @@ Kurt_SelectApricorn: ; 88055 ld [wMenuSelectionQuantity], a farcall PlaceMenuItemQuantity ret -; 880c2 -Kurt_SelectQuantity: ; 880c2 +Kurt_SelectQuantity: ld a, [wCurItem] ld [wMenuSelection], a call Kurt_GetQuantityOfApricorn @@ -155,16 +146,15 @@ Kurt_SelectQuantity: ; 880c2 .done call CloseWindow ret -; 8810d -.MenuHeader: ; 0x8810d +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 9, SCREEN_WIDTH - 1, 12 dw NULL db -1 ; default option db 0 -.PlaceApricornName: ; 88116 +.PlaceApricornName: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 add hl, de @@ -172,9 +162,8 @@ Kurt_SelectQuantity: ; 880c2 ld e, l farcall PlaceMenuItemName ret -; 88126 -PlaceApricornQuantity: ; 88126 +PlaceApricornQuantity: call MenuBoxCoord2Tile ld de, 2 * SCREEN_WIDTH + 10 add hl, de @@ -183,9 +172,8 @@ PlaceApricornQuantity: ; 88126 ld de, wItemQuantityChangeBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum -; 88139 -Kurt_GetQuantityOfApricorn: ; 88139 +Kurt_GetQuantityOfApricorn: push bc ld hl, wNumItems ld a, [wCurItem] @@ -216,9 +204,8 @@ Kurt_GetQuantityOfApricorn: ; 88139 and a pop bc ret -; 88161 -Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 +Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; Get the quantity of Apricorns of type [wCurItem] ; in the bag. Compatible with multiple stacks. @@ -352,9 +339,8 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 pop bc pop de ret -; 88201 -Kurt_GetAddressOfApricornQuantity: ; 88201 +Kurt_GetAddressOfApricornQuantity: push hl push bc ld hl, wNumItems @@ -368,9 +354,8 @@ Kurt_GetAddressOfApricornQuantity: ; 88201 pop bc pop hl ret -; 88211 -Kurt_GetRidOfItem: ; 88211 +Kurt_GetRidOfItem: push bc ld hl, wNumItems ld a, [wCurItemQuantity] @@ -409,4 +394,3 @@ Kurt_GetRidOfItem: ; 88211 ld [wItemQuantityChangeBuffer], a pop bc ret -; 88248 diff --git a/engine/events/kurt_selectquantity_interpretjoypad.asm b/engine/events/kurt_selectquantity_interpretjoypad.asm index 12a43e325..44b71a113 100644 --- a/engine/events/kurt_selectquantity_interpretjoypad.asm +++ b/engine/events/kurt_selectquantity_interpretjoypad.asm @@ -1,4 +1,4 @@ -Kurt_SelectQuantity_InterpretJoypad: ; 27a28 +Kurt_SelectQuantity_InterpretJoypad: call BuySellToss_InterpretJoypad ld b, a ret diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index f482ce9d6..c5d6d18e0 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -1,4 +1,4 @@ -CheckForLuckyNumberWinners: ; 4d87a +CheckForLuckyNumberWinners: xor a ld [wScriptVar], a ld [wFoundMatchingIDInParty], a @@ -118,7 +118,7 @@ CheckForLuckyNumberWinners: ; 4d87a .print jp PrintText -.CompareLuckyNumberToMonID: ; 4d939 +.CompareLuckyNumberToMonID: push bc push de push hl @@ -190,7 +190,7 @@ CheckForLuckyNumberWinners: ; 4d87a and a ret -.BoxBankAddresses: ; 4d99f +.BoxBankAddresses: dba sBox1 dba sBox2 dba sBox3 @@ -206,17 +206,17 @@ CheckForLuckyNumberWinners: ; 4d87a dba sBox13 dba sBox14 -.FoundPartymonText: ; 0x4d9c9 +.FoundPartymonText: ; Congratulations! We have a match with the ID number of @ in your party. text_jump UnknownText_0x1c1261 db "@" -.FoundBoxmonText: ; 0x4d9ce +.FoundBoxmonText: ; Congratulations! We have a match with the ID number of @ in your PC BOX. text_jump UnknownText_0x1c12ae db "@" -PrintTodaysLuckyNumber: ; 4d9d3 +PrintTodaysLuckyNumber: ld hl, wStringBuffer3 ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index f5180a8e5..7fe8adba7 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -1,4 +1,4 @@ -CheckMagikarpLength: ; fbb32 +CheckMagikarpLength: ; Returns 3 if you select a Magikarp that beats the previous record. ; Returns 2 if you select a Magikarp, but the current record is longer. ; Returns 1 if you press B in the Pokemon selection menu. @@ -70,27 +70,23 @@ CheckMagikarpLength: ; fbb32 xor a ; MAGIKARPLENGTH_NOT_MAGIKARP ld [wScriptVar], a ret -; fbba9 -.MeasureItText: ; 0xfbba9 +.MeasureItText: ; Let me measure that MAGIKARP. …Hm, it measures @ . text_jump UnknownText_0x1c1203 db "@" -; 0xfbbae -Magikarp_LoadFeetInchesChars: ; fbbae +Magikarp_LoadFeetInchesChars: ld hl, vTiles2 tile "′" ; $6e ld de, .feetinchchars lb bc, BANK(.feetinchchars), 2 call Request2bpp ret -; fbbbb -.feetinchchars ; fbbb +.feetinchchars INCBIN "gfx/font/feet_inches.2bpp" -; fbbdb -PrintMagikarpLength: ; fbbdb +PrintMagikarpLength: call Magikarp_LoadFeetInchesChars ld hl, wStringBuffer1 ld de, wMagikarpLength @@ -105,9 +101,8 @@ PrintMagikarpLength: ; fbbdb inc hl ld [hl], "@" ret -; fbbfc -CalcMagikarpLength: ; fbbfc +CalcMagikarpLength: ; Return Magikarp's length (in feet and inches) at wMagikarpLength (big endian). ; ; input: @@ -144,7 +139,6 @@ CalcMagikarpLength: ; fbbfc ; if b = 252-253: x = 65210, y = 5, z = 13 ; if b = 254: x = 65410, y = 2, z = 14 - ; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) ; id @@ -283,9 +277,8 @@ CalcMagikarpLength: ; fbbfc inc hl ld [hl], e ; in ret -; fbc9a -.BCLessThanDE: ; fbc9a +.BCLessThanDE: ; Intention: Return bc < de. ; Reality: Return b < d. ld a, b @@ -295,9 +288,8 @@ CalcMagikarpLength: ; fbbfc ld a, c cp e ret -; fbca1 -.BCMinusDE: ; fbca1 +.BCMinusDE: ; bc -= de ld a, c sub e @@ -306,13 +298,10 @@ CalcMagikarpLength: ; fbbfc sbc d ld b, a ret -; fbca8 INCLUDE "data/events/magikarp_lengths.asm" - - -MagikarpHouseSign: ; fbcd2 +MagikarpHouseSign: ld a, [wBestMagikarpLengthFeet] ld [wMagikarpLength], a ld a, [wBestMagikarpLengthInches] @@ -321,10 +310,8 @@ MagikarpHouseSign: ; fbcd2 ld hl, .CurrentRecordtext call PrintText ret -; fbce8 -.CurrentRecordtext: ; 0xfbce8 +.CurrentRecordtext: ; "CURRENT RECORD" text_jump UnknownText_0x1c123a db "@" -; 0xfbced diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 6f2aa2d1f..010983627 100644 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -1,4 +1,4 @@ -MagnetTrain: ; 8cc04 +MagnetTrain: ld a, [wScriptVar] and a jr nz, .ToGoldenrod @@ -81,9 +81,8 @@ MagnetTrain: ; 8cc04 pop af ld [rSVBK], a ret -; 8cc99 -MagnetTrain_UpdateLYOverrides: ; 8cc99 +MagnetTrain_UpdateLYOverrides: ld hl, wLYOverridesBackup ld c, $2f ld a, [wMagnetTrainOffset] @@ -111,9 +110,8 @@ MagnetTrain_UpdateLYOverrides: ; 8cc99 dec c jr nz, .loadloop ret -; 8ccc9 -MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 +MagntTrain_LoadGFX_PlayMusic: call ClearBGPalettes call ClearSprites call DisableLCD @@ -155,9 +153,8 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 ld de, MUSIC_MAGNET_TRAIN call PlayMusic2 ret -; 8cd27 -DrawMagnetTrain: ; 8cd27 +DrawMagnetTrain: hlbgcoord 0, 0 xor a .loop @@ -184,18 +181,16 @@ DrawMagnetTrain: ; 8cd27 ld c, 20 call .FillLine ret -; 8cd65 -.FillLine: ; 8cd65 +.FillLine: ld a, [de] inc de ld [hli], a dec c jr nz, .FillLine ret -; 8cd6c -.FillAlt: ; 8cd6c +.FillAlt: ld [hl], e inc hl ld [hl], d @@ -203,9 +198,8 @@ DrawMagnetTrain: ; 8cd27 dec b jr nz, .FillAlt ret -; 8cd74 -GetMagnetTrainBGTiles: ; 8cd74 +GetMagnetTrainBGTiles: push hl ld e, a ld d, 0 @@ -217,9 +211,8 @@ GetMagnetTrainBGTiles: ; 8cd74 ld d, [hl] pop hl ret -; 8cd82 -MagnetTrainBGTiles: ; 8cd82 +MagnetTrainBGTiles: ; Alternating tiles for each line of the Magnet Train tilemap. db $4c, $4d ; bush db $5c, $5d ; bush @@ -239,9 +232,8 @@ MagnetTrainBGTiles: ; 8cd82 db $5c, $5d ; bush db $4c, $4d ; bush db $5c, $5d ; bush -; 8cda6 -MagnetTrain_InitLYOverrides: ; 8cda6 +MagnetTrain_InitLYOverrides: ld hl, wLYOverrides ld bc, wLYOverridesEnd - wLYOverrides ld a, [wMagnetTrainInitPosition] @@ -253,9 +245,8 @@ MagnetTrain_InitLYOverrides: ; 8cda6 ld a, rSCX - $ff00 ld [hLCDCPointer], a ret -; 8cdc3 -SetMagnetTrainPals: ; 8cdc3 +SetMagnetTrainPals: ld a, $1 ld [rVBK], a @@ -286,9 +277,8 @@ SetMagnetTrainPals: ; 8cdc3 ld a, $0 ld [rVBK], a ret -; 8cdf7 -MagnetTrain_Jumptable: ; 8cdf7 +MagnetTrain_Jumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -299,9 +289,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld h, [hl] ld l, a jp hl -; 8ce06 -.Jumptable: ; 8ce06 +.Jumptable: dw .InitPlayerSpriteAnim dw .WaitScene dw .MoveTrain1 @@ -309,15 +298,13 @@ MagnetTrain_Jumptable: ; 8cdf7 dw .MoveTrain2 dw .WaitScene dw .TrainArrived -; 8ce14 -.Next: ; 8ce14 +.Next: ld hl, wJumptableIndex inc [hl] ret -; 8ce19 -.InitPlayerSpriteAnim: ; 8ce19 +.InitPlayerSpriteAnim: ld d, 10 * 8 + 5 ld a, [wMagnetTrainPlayerSpriteInitX] ld e, a @@ -343,9 +330,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, $80 ld [wMagnetTrainWaitCounter], a ret -; 8ce47 -.MoveTrain1: ; 8ce47 +.MoveTrain1: ld hl, wMagnetTrainHoldPosition ld a, [wMagnetTrainPosition] cp [hl] @@ -367,9 +353,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, $80 ld [wMagnetTrainWaitCounter], a ret -; 8ce6d -.WaitScene: ; 8ce6d +.WaitScene: ld hl, wMagnetTrainWaitCounter ld a, [hl] and a @@ -380,9 +365,8 @@ MagnetTrain_Jumptable: ; 8cdf7 .DoneWaiting: call .Next ret -; 8ce7a -.MoveTrain2: ; 8ce7a +.MoveTrain2: ld hl, wMagnetTrainFinalPosition ld a, [wMagnetTrainPosition] cp [hl] @@ -410,17 +394,15 @@ MagnetTrain_Jumptable: ; 8cdf7 .PrepareToFinishAnim: call .Next ret -; 8cea2 -.TrainArrived: ; 8cea2 +.TrainArrived: ld a, $80 ld [wJumptableIndex], a ld de, SFX_TRAIN_ARRIVED call PlaySFX ret -; 8ceae -MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae +MagnetTrain_Jumptable_FirstRunThrough: farcall PlaySpriteAnimations call MagnetTrain_Jumptable call MagnetTrain_UpdateLYOverrides @@ -455,7 +437,6 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae pop af ld [rSVBK], a ret -; 8ceff MagnetTrainTilemap1: db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f @@ -465,4 +446,3 @@ MagnetTrainTilemap3: db $24, $25, $26, $27, $07, $2f, $29, $28, $28, $28, $28, $28, $28, $29, $07, $2f, $2a, $2b, $2c, $2d MagnetTrainTilemap4: db $20, $1f, $2e, $1f, $17, $00, $2e, $1f, $1f, $1f, $1f, $1f, $1f, $2e, $17, $00, $1f, $2e, $1f, $0f -; 8cf4f diff --git a/engine/events/map_name_sign.asm b/engine/events/map_name_sign.asm index 385ddf802..859f30034 100644 --- a/engine/events/map_name_sign.asm +++ b/engine/events/map_name_sign.asm @@ -1,14 +1,13 @@ MAP_NAME_SIGN_START EQU $60 -ReturnFromMapSetupScript:: ; b8000 +ReturnFromMapSetupScript:: xor a ld [hBGMapMode], a farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes ret -; b800a ; should have just been a fallthrough -.inefficient_farcall ; b800a +.inefficient_farcall ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -57,9 +56,8 @@ ReturnFromMapSetupScript:: ; b8000 xor a ld [hLCDCPointer], a ret -; b8064 -.CheckMovingWithinLandmark: ; b8064 +.CheckMovingWithinLandmark: ld a, [wCurrentLandmark] ld c, a ld a, [wPreviousLandmark] @@ -67,9 +65,8 @@ ReturnFromMapSetupScript:: ; b8000 ret z cp SPECIAL_MAP ret -; b8070 -.CheckSpecialMap: ; b8070 +.CheckSpecialMap: ; These landmarks do not get pop-up signs. cp -1 ret z @@ -88,9 +85,8 @@ ReturnFromMapSetupScript:: ; b8000 ld a, 1 and a ret -; b8089 -.CheckNationalParkGate: ; b8089 +.CheckNationalParkGate: ld a, [wMapGroup] cp GROUP_ROUTE_35_NATIONAL_PARK_GATE ret nz @@ -99,10 +95,8 @@ ReturnFromMapSetupScript:: ; b8000 ret z cp MAP_ROUTE_36_NATIONAL_PARK_GATE ret -; b8098 - -PlaceMapNameSign:: ; b8098 (2e:4098) +PlaceMapNameSign:: ld hl, wLandmarkSignTimer ld a, [hl] and a @@ -130,26 +124,22 @@ PlaceMapNameSign:: ; b8098 (2e:4098) ld [hLCDCPointer], a ret - -LoadMapNameSignGFX: ; b80c6 +LoadMapNameSignGFX: ld de, MapEntryFrameGFX ld hl, vTiles2 tile MAP_NAME_SIGN_START lb bc, BANK(MapEntryFrameGFX), 14 call Get2bpp ret -; b80d3 -InitMapNameFrame: ; b80d3 +InitMapNameFrame: hlcoord 0, 0 ld b, 2 ld c, 18 call InitMapSignAttrMap call PlaceMapNameFrame ret -; b80e1 - -PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) +PlaceMapNameCenterAlign: ld a, [wCurrentLandmark] ld e, a farcall GetLandmarkName @@ -165,7 +155,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) call PlaceString ret -.GetNameLength: ; b8101 (2e:4101) +.GetNameLength: ld c, 0 push hl ld hl, wStringBuffer1 @@ -181,8 +171,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) pop hl ret - -InitMapSignAttrMap: ; b8115 +InitMapSignAttrMap: ld de, wAttrMap - wTileMap add hl, de inc b @@ -204,9 +193,8 @@ InitMapSignAttrMap: ; b8115 dec b jr nz, .loop ret -; b812f -PlaceMapNameFrame: ; b812f +PlaceMapNameFrame: hlcoord 0, 0 ; top left ld a, MAP_NAME_SIGN_START + 1 @@ -243,9 +231,8 @@ PlaceMapNameFrame: ; b812f ld a, MAP_NAME_SIGN_START + 10 ld [hl], a ret -; b815b -.FillMiddle: ; b815b +.FillMiddle: ld c, SCREEN_WIDTH - 2 ld a, MAP_NAME_SIGN_START + 13 .loop @@ -253,9 +240,8 @@ PlaceMapNameFrame: ; b812f dec c jr nz, .loop ret -; b8164 -.FillTopBottom: ; b8164 +.FillTopBottom: ld c, 5 jr .enterloop @@ -271,4 +257,3 @@ PlaceMapNameFrame: ; b812f dec c jr nz, .continueloop ret -; b8172 diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm index b79889f72..f88e72c45 100644 --- a/engine/events/misc_scripts.asm +++ b/engine/events/misc_scripts.asm @@ -1,4 +1,4 @@ -Script_AbortBugContest: ; 0x122c1 +Script_AbortBugContest: checkflag ENGINE_BUG_CONTEST_TIMER iffalse .finish setflag ENGINE_DAILY_BUG_CONTEST @@ -6,7 +6,7 @@ Script_AbortBugContest: ; 0x122c1 .finish end -FindItemInBallScript:: ; 0x122ce +FindItemInBallScript:: callasm .TryReceiveItem iffalse .no_room disappear LAST_TALKED @@ -17,9 +17,8 @@ FindItemInBallScript:: ; 0x122ce itemnotify closetext end -; 0x122e3 -.no_room ; 0x122e3 +.no_room opentext writetext .text_found waitbutton @@ -27,21 +26,18 @@ FindItemInBallScript:: ; 0x122ce waitbutton closetext end -; 0x122ee -.text_found ; 0x122ee +.text_found ; found @ ! text_jump UnknownText_0x1c0a1c db "@" -; 0x122f3 -.text_bag_full ; 0x122f3 +.text_bag_full ; But can't carry any more items. text_jump UnknownText_0x1c0a2c db "@" -; 0x122f8 -.TryReceiveItem: ; 122f8 +.TryReceiveItem: xor a ld [wScriptVar], a ld a, [wEngineBuffer1] @@ -59,4 +55,3 @@ FindItemInBallScript:: ; 0x122ce ld a, $1 ld [wScriptVar], a ret -; 12324 diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm index dd705b547..cb26ce12e 100644 --- a/engine/events/misc_scripts_2.asm +++ b/engine/events/misc_scripts_2.asm @@ -1,16 +1,16 @@ -RepelWoreOffScript:: ; 0x13619 +RepelWoreOffScript:: opentext writetext .text waitbutton closetext end -.text ; 0x13620 +.text ; REPEL's effect wore off. text_jump UnknownText_0x1bd308 db "@" -HiddenItemScript:: ; 0x13625 +HiddenItemScript:: opentext copybytetovar wEngineBuffer3 itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 @@ -22,26 +22,26 @@ HiddenItemScript:: ; 0x13625 itemnotify jump .finish -.bag_full ; 0x1363e +.bag_full buttonsound writetext .no_room_text waitbutton -.finish ; 13643 +.finish closetext end -.found_text ; 0x13645 +.found_text ; found @ ! text_jump UnknownText_0x1bd321 db "@" -.no_room_text ; 0x1364a +.no_room_text ; But has no space left… text_jump UnknownText_0x1bd331 db "@" -SetMemEvent: ; 1364f +SetMemEvent: ld hl, wEngineBuffer1 ld a, [hli] ld d, [hl] diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 1a00b723a..adaee701f 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -1,4 +1,4 @@ -BankOfMom: ; 16218 +BankOfMom: ld a, [hInMenu] push af ld a, $1 @@ -16,9 +16,8 @@ BankOfMom: ; 16218 pop af ld [hInMenu], a ret -; 16233 -.RunJumptable: ; 16233 +.RunJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -29,9 +28,8 @@ BankOfMom: ; 16218 ld h, [hl] ld l, a jp hl -; 16242 -.dw ; 16242 +.dw dw .CheckIfBankInitialized dw .InitializeBank @@ -42,9 +40,8 @@ BankOfMom: ; 16218 dw .StopOrStartSavingMoney dw .AskDST dw .JustDoWhatYouCan -; 16254 -.CheckIfBankInitialized: ; 16254 +.CheckIfBankInitialized: ld a, [wMomSavingMoney] bit MOM_ACTIVE_F, a jr nz, .savingmoneyalready @@ -59,9 +56,8 @@ BankOfMom: ; 16218 .done_0 ld [wJumptableIndex], a ret -; 1626a -.InitializeBank: ; 1626a +.InitializeBank: ld hl, UnknownText_0x16649 call PrintText call YesNoBox @@ -81,9 +77,8 @@ BankOfMom: ; 16218 ld a, $8 ld [wJumptableIndex], a ret -; 16290 -.IsThisAboutYourMoney: ; 16290 +.IsThisAboutYourMoney: ld hl, UnknownText_0x16658 call PrintText call YesNoBox @@ -98,9 +93,8 @@ BankOfMom: ; 16218 .done_2 ld [wJumptableIndex], a ret -; 162a8 -.AccessBankOfMom: ; 162a8 +.AccessBankOfMom: ld hl, UnknownText_0x1665d call PrintText call LoadStandardMenuHeader @@ -135,9 +129,8 @@ BankOfMom: ; 16218 .done_3 ld [wJumptableIndex], a ret -; 162e0 -.StoreMoney: ; 162e0 +.StoreMoney: ld hl, UnknownText_0x16662 call PrintText xor a @@ -202,9 +195,8 @@ BankOfMom: ; 16218 .done_4 ld [wJumptableIndex], a ret -; 16373 -.TakeMoney: ; 16373 +.TakeMoney: ld hl, UnknownText_0x16667 call PrintText xor a @@ -269,9 +261,8 @@ BankOfMom: ; 16218 .done_5 ld [wJumptableIndex], a ret -; 16406 -.StopOrStartSavingMoney: ; 16406 +.StopOrStartSavingMoney: ld hl, UnknownText_0x1666c call PrintText call YesNoBox @@ -290,19 +281,17 @@ BankOfMom: ; 16218 ld a, $7 ld [wJumptableIndex], a ret -; 1642d -.AskDST: ; 1642d +.AskDST: ld hl, UnknownText_0x16694 call PrintText -.JustDoWhatYouCan: ; 16433 +.JustDoWhatYouCan: ld hl, wJumptableIndex set 7, [hl] ret -; 16439 -DSTChecks: ; 16439 +DSTChecks: ; check the time; avoid changing DST if doing so would change the current day ld a, [wDST] bit 7, a @@ -364,9 +353,8 @@ DSTChecks: ; 16439 ld hl, .Text_SetClockForward call PlaceHLTextAtBC ret -; 164b9 -.SetClockForward: ; 164b9 +.SetClockForward: ld a, [wStartHour] add 1 sub 24 @@ -379,9 +367,8 @@ DSTChecks: ; 16439 adc 0 ld [wStartDay], a ret -; 164d1 -.SetClockBack: ; 164d1 +.SetClockBack: ld a, [wStartHour] sub 1 jr nc, .DontLoopHourBack @@ -395,59 +382,51 @@ DSTChecks: ; 16439 .DontLoopDayBack: ld [wStartDay], a ret -; 164ea -.ClearBox: ; 164ea +.ClearBox: hlcoord 1, 14 lb bc, 3, 18 call ClearBox ret -; 164f4 -.Text_AdjustClock: ; 0x164f4 +.Text_AdjustClock: ; Do you want to adjust your clock for Daylight Saving Time? text_jump UnknownText_0x1c6095 db "@" -; 0x164f9 -.Text_LostInstructionBooklet: ; 0x164f9 +.Text_LostInstructionBooklet: ; I lost the instruction booklet for the POKéGEAR. ; Come back again in a while. text_jump UnknownText_0x1c60d1 db "@" -; 0x164fe -.Text_SwitchToDST: ; 0x164fe +.Text_SwitchToDST: ; Do you want to switch to Daylight Saving Time? text_jump UnknownText_0x1c6000 db "@" -; 0x16503 -.Text_SetClockForward: ; 0x16503 +.Text_SetClockForward: ; I set the clock forward by one hour. text_jump UnknownText_0x1c6030 db "@" -; 0x16508 -.Text_IsDSTOver: ; 0x16508 +.Text_IsDSTOver: ; Is Daylight Saving Time over? text_jump UnknownText_0x1c6056 db "@" -; 0x1650d -.Text_SetClockBack: ; 0x1650d +.Text_SetClockBack: ; I put the clock back one hour. text_jump UnknownText_0x1c6075 db "@" -; 0x16512 -Mom_SetUpWithdrawMenu: ; 16512 +Mom_SetUpWithdrawMenu: ld de, Mon_WithdrawString jr Mom_ContinueMenuSetup -Mom_SetUpDepositMenu: ; 16517 +Mom_SetUpDepositMenu: ld de, Mom_DepositString -Mom_ContinueMenuSetup: ; 1651a +Mom_ContinueMenuSetup: push de xor a ld [hBGMapMode], a @@ -478,15 +457,13 @@ Mom_ContinueMenuSetup: ; 1651a call UpdateSprites call CGBOnly_CopyTilemapAtOnce ret -; 1656b -Mom_Wait10Frames: ; 1656b +Mom_Wait10Frames: ld c, 10 call DelayFrames ret -; 16571 -Mom_WithdrawDepositMenuJoypad: ; 16571 +Mom_WithdrawDepositMenuJoypad: .loop call JoyTextDelay ld hl, hJoyPressed @@ -590,9 +567,8 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 add hl, de pop de ret -; 16613 -.DigitQuantities: ; 16613 +.DigitQuantities: dt 100000 dt 10000 dt 1000 @@ -613,132 +589,109 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 dt 900 dt 90 dt 9 -; 16649 -UnknownText_0x16649: ; 0x16649 +UnknownText_0x16649: ; Wow, that's a cute #MON. Where did you get it? … So, you're leaving on an adventure… OK! I'll help too. But what can I do for you? I know! I'll save money for you. On a long journey, money's important. Do you want me to save your money? text_jump UnknownText_0x1bd77f db "@" -; 0x1664e -UnknownText_0x1664e: ; 0x1664e +UnknownText_0x1664e: ; OK, I'll take care of your money. text_jump UnknownText_0x1bd868 db "@" -; 0x16653 -UnknownText_0x16653: ; 0x16653 +UnknownText_0x16653: ; Be careful. #MON are your friends. You need to work as a team. Now, go on! text_jump UnknownText_0x1bd88e db "@" -; 0x16658 -UnknownText_0x16658: ; 0x16658 +UnknownText_0x16658: ; Hi! Welcome home! You're trying very hard, I see. I've kept your room tidy. Or is this about your money? text_jump UnknownText_0x1bd8da db "@" -; 0x1665d -UnknownText_0x1665d: ; 0x1665d +UnknownText_0x1665d: ; What do you want to do? text_jump UnknownText_0x1bd942 db "@" -; 0x16662 -UnknownText_0x16662: ; 0x16662 +UnknownText_0x16662: ; How much do you want to save? text_jump UnknownText_0x1bd95b db "@" -; 0x16667 -UnknownText_0x16667: ; 0x16667 +UnknownText_0x16667: ; How much do you want to take? text_jump UnknownText_0x1bd97a db "@" -; 0x1666c -UnknownText_0x1666c: ; 0x1666c +UnknownText_0x1666c: ; Do you want to save some money? text_jump UnknownText_0x1bd999 db "@" -; 0x16671 -UnknownText_0x16671: ; 0x16671 +UnknownText_0x16671: ; You haven't saved that much. text_jump UnknownText_0x1bd9ba db "@" -; 0x16676 -UnknownText_0x16676: ; 0x16676 +UnknownText_0x16676: ; You can't take that much. text_jump UnknownText_0x1bd9d7 db "@" -; 0x1667b -UnknownText_0x1667b: ; 0x1667b +UnknownText_0x1667b: ; You don't have that much. text_jump UnknownText_0x1bd9f1 db "@" -; 0x16680 -UnknownText_0x16680: ; 0x16680 +UnknownText_0x16680: ; You can't save that much. text_jump UnknownText_0x1bda0b db "@" -; 0x16685 -UnknownText_0x16685: ; 0x16685 +UnknownText_0x16685: ; OK, I'll save your money. Trust me! , stick with it! text_jump UnknownText_0x1bda25 db "@" -; 0x1668a -UnknownText_0x1668a: ; 0x1668a +UnknownText_0x1668a: ; Your money's safe here! Get going! text_jump UnknownText_0x1bda5b db "@" -; 0x1668f -UnknownText_0x1668f: ; 0x1668f +UnknownText_0x1668f: ; , don't give up! text_jump UnknownText_0x1bda7e db "@" -; 0x16694 -UnknownText_0x16694: ; 0x16694 +UnknownText_0x16694: ; Just do what you can. text_jump UnknownText_0x1bda90 db "@" -; 0x16699 -Mom_SavedString: ; 16699 +Mom_SavedString: db "SAVED@" -; 1669f -Mon_WithdrawString: ; 1669f +Mon_WithdrawString: db "WITHDRAW@" -; 166a8 -Mom_DepositString: ; 166a8 +Mom_DepositString: db "DEPOSIT@" -; 166b0 -Mom_HeldString: ; 166b0 +Mom_HeldString: db "HELD@" -; 166b5 -MenuHeader_0x166b5: ; 0x166b5 +MenuHeader_0x166b5: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, 10 dw MenuData_0x166bd db 1 ; default option -; 0x166bd -MenuData_0x166bd: ; 0x166bd +MenuData_0x166bd: db STATICMENU_CURSOR ; flags db 4 ; items db "GET@" db "SAVE@" db "CHANGE@" db "CANCEL@" -; 0x166d6 diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index de19a3674..dc10ede35 100644 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -5,7 +5,7 @@ const_value = 1 const MOM_ITEM const MOM_DOLL -MomTriesToBuySomething:: ; fcfec +MomTriesToBuySomething:: ld a, [wMapReentryScriptQueueFlag] and a ret nz @@ -23,14 +23,12 @@ MomTriesToBuySomething:: ; fcfec farcall LoadScriptBDE scf ret -; fd00f -.Script: ; 0xfd00f +.Script: callasm .ASMFunction farjump Script_ReceivePhoneCall -; 0xfd017 -.ASMFunction: ; fd017 +.ASMFunction: call MomBuysItem_DeductFunds call Mom_GetScriptPointer ld a, [wWhichMomItemSet] @@ -56,9 +54,8 @@ MomTriesToBuySomething:: ; fcfec ld a, d ld [hl], a ret -; fd044 -CheckBalance_MomItem2: ; fd044 +CheckBalance_MomItem2: ld a, [wWhichMomItem] cp NUM_MOM_ITEMS_2 jr nc, .nope @@ -115,10 +112,8 @@ CheckBalance_MomItem2: ; fd044 ld bc, hMoneyTemp farcall AddMoney ret -; fd0a6 - -MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) +MomBuysItem_DeductFunds: call GetItemFromMom ld de, 3 ; cost add hl, de @@ -133,8 +128,7 @@ MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) farcall TakeMoney ret - -Mom_GiveItemOrDoll: ; fd0c3 +Mom_GiveItemOrDoll: call GetItemFromMom ld de, 6 ; item type add hl, de @@ -156,10 +150,8 @@ Mom_GiveItemOrDoll: ; fd0c3 ld hl, wPCItems call ReceiveItem ret -; fd0eb - -Mom_GetScriptPointer: ; fd0eb (3f:50eb) +Mom_GetScriptPointer: call GetItemFromMom ld de, 6 ; item type add hl, de @@ -169,26 +161,22 @@ Mom_GetScriptPointer: ; fd0eb (3f:50eb) ret z ld de, .DollScript ret -; fd0fd (3f:50fd) -.ItemScript: ; 0xfd0fd +.ItemScript: writetext _MomText_HiHowAreYou writetext _MomText_FoundAnItem writetext _MomText_BoughtWithYourMoney writetext _MomText_ItsInPC end -; 0xfd10a -.DollScript: ; 0xfd10a +.DollScript: writetext _MomText_HiHowAreYou writetext _MomText_FoundADoll writetext _MomText_BoughtWithYourMoney writetext _MomText_ItsInRoom end -; 0xfd117 - -GetItemFromMom: ; fd117 +GetItemFromMom: ld a, [wWhichMomItemSet] and a jr z, .zero @@ -213,52 +201,44 @@ rept 3 ; multiply hl by 8 endr add hl, de ret -; fd136 INCLUDE "data/items/mom_phone.asm" db 0, 0, 0 ; unused -_MomText_HiHowAreYou: ; 0xfd1b1 +_MomText_HiHowAreYou: ; Hi, ! How are you? text_jump UnknownText_0x1bc615 db "@" -; 0xfd1b6 -_MomText_FoundAnItem: ; 0xfd1b6 +_MomText_FoundAnItem: ; I found a useful item shopping, so text_jump UnknownText_0x1bc62a db "@" -; 0xfd1bb -_MomText_BoughtWithYourMoney: ; 0xfd1bb +_MomText_BoughtWithYourMoney: ; I bought it with your money. Sorry! text_jump UnknownText_0x1bc64e db "@" -; 0xfd1c0 -_MomText_ItsInPC: ; 0xfd1c0 +_MomText_ItsInPC: ; It's in your PC. You'll like it! text_jump UnknownText_0x1bc673 db "@" -; 0xfd1c5 -_MomText_FoundADoll: ; 0xfd1c5 +_MomText_FoundADoll: ; While shopping today, I saw this adorable doll, so text_jump UnknownText_0x1bc693 db "@" -; 0xfd1ca -_MomText_ItsInRoom: ; 0xfd1ca +_MomText_ItsInRoom: ; It's in your room. You'll love it! text_jump UnknownText_0x1bc6c7 db "@" -; 0xfd1cf db 0 ; unused -DummyPredef3A: ; fd1d0 +DummyPredef3A: ret -; fd1d1 ret ; unused diff --git a/engine/events/money.asm b/engine/events/money.asm index 585c85618..c8f9d058e 100644 --- a/engine/events/money.asm +++ b/engine/events/money.asm @@ -1,4 +1,4 @@ -GiveMoney:: ; 15fd7 +GiveMoney:: ld a, 3 call AddMoney ld bc, MaxMoney @@ -21,14 +21,11 @@ GiveMoney:: ; 15fd7 .not_maxed_out and a ret -; 15ff7 -MaxMoney: ; 15ff7 +MaxMoney: dt MAX_MONEY -; 15ffa - -TakeMoney:: ; 15ffa +TakeMoney:: ld a, 3 call SubtractMoney jr nc, .okay @@ -45,11 +42,10 @@ TakeMoney:: ; 15ffa .okay and a ret -; 1600b -CompareMoney:: ; 1600b +CompareMoney:: ld a, 3 -CompareFunds: ; 1600d +CompareFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -94,11 +90,10 @@ CompareFunds: ; 1600d pop de pop hl ret -; 16035 -SubtractMoney: ; 16035 +SubtractMoney: ld a, 3 -SubtractFunds: ; 16037 +SubtractFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -130,11 +125,10 @@ SubtractFunds: ; 16037 pop de pop hl ret -; 16053 -AddMoney: ; 16053 +AddMoney: ld a, 3 -AddFunds: ; 16055 +AddFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -167,9 +161,8 @@ AddFunds: ; 16055 pop de pop hl ret -; 1606f -GiveCoins:: ; 1606f +GiveCoins:: ld a, 2 ld de, wCoins call AddFunds @@ -189,14 +182,11 @@ GiveCoins:: ; 1606f .not_maxed and a ret -; 1608d -.maxcoins ; 1608d +.maxcoins bigdw MAX_COINS -; 1608f - -TakeCoins:: ; 1608f +TakeCoins:: ld a, 2 ld de, wCoins call SubtractFunds @@ -212,10 +202,8 @@ TakeCoins:: ; 1608f .okay and a ret -; 160a1 -CheckCoins:: ; 160a1 +CheckCoins:: ld a, 2 ld de, wCoins jp CompareFunds -; 160a9 diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index f75bc44dd..f2b827227 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -59,55 +59,47 @@ MoveDeletion: call PrintText ret -.OnlyOneMoveText: ; 0x2c5d1 +.OnlyOneMoveText: ; That #MON knows only one move. text_jump UnknownText_0x1c5eba db "@" -; 0x2c5d6 -.ConfirmDeleteText: ; 0x2c5d6 +.ConfirmDeleteText: ; Oh, make it forget @ ? text_jump UnknownText_0x1c5eda db "@" -; 0x2c5db -.MoveDeletedText: ; 0x2c5db +.MoveDeletedText: ; Done! Your #MON forgot the move. text_jump UnknownText_0x1c5ef5 db "@" -; 0x2c5e0 -.EggText: ; 0x2c5e0 +.EggText: ; An EGG doesn't know any moves! text_jump UnknownText_0x1c5f17 db "@" -; 0x2c5e5 -.DeclinedDeletionText: ; 0x2c5e5 +.DeclinedDeletionText: ; No? Come visit me again. text_jump UnknownText_0x1c5f36 db "@" -; 0x2c5ea -.AskWhichMoveText: ; 0x2c5ea +.AskWhichMoveText: ; Which move should it forget, then? text_jump UnknownText_0x1c5f50 db "@" -; 0x2c5ef -.IntroText: ; 0x2c5ef +.IntroText: ; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget? text_jump UnknownText_0x1c5f74 db "@" -; 0x2c5f4 -.AskWhichMonText: ; 0x2c5f4 +.AskWhichMonText: ; Which #MON? text_jump UnknownText_0x1c5fd1 db "@" -; 0x2c5f9 -.DeleteMove: ; 2c5f9 +.DeleteMove: ld a, b push bc dec a diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index c11fe2fa1..67d0ca528 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -1,4 +1,4 @@ -MoveTutor: ; 4925b +MoveTutor: call FadeToMenu call ClearBGPalettes call ClearScreen @@ -33,7 +33,7 @@ MoveTutor: ; 4925b call CloseSubmenu ret -.GetMoveTutorMove: ; 492a5 +.GetMoveTutorMove: ld a, [wScriptVar] cp MOVETUTOR_FLAMETHROWER jr z, .flamethrower @@ -51,7 +51,7 @@ MoveTutor: ; 4925b ld a, THUNDERBOLT ret -CheckCanLearnMoveTutorMove: ; 492b9 +CheckCanLearnMoveTutorMove: ld hl, .MenuHeader call LoadMenuHeader @@ -98,6 +98,6 @@ CheckCanLearnMoveTutorMove: ; 492b9 scf ret -.MenuHeader: ; 0x4930a +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index aae070ca2..593d51c69 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -1,4 +1,4 @@ -_NameRater: ; fb6ed +_NameRater: ; Introduce himself ld hl, NameRaterIntroText call PrintText @@ -77,9 +77,8 @@ _NameRater: ; fb6ed .done call PrintText ret -; fb78a -CheckIfMonIsYourOT: ; fb78a +CheckIfMonIsYourOT: ; Checks to see if the partymon loaded in [wCurPartyMon] has the different OT as you. Returns carry if not. ld hl, wPartyMonOT ld bc, NAME_LENGTH @@ -110,9 +109,8 @@ CheckIfMonIsYourOT: ; fb78a .nope scf ret -; fb7be -IsNewNameEmpty: ; fb7be +IsNewNameEmpty: ; Checks to see if the nickname loaded in wStringBuffer2 is empty. If so, return carry. ld hl, wStringBuffer2 ld c, MON_NAME_LENGTH - 1 @@ -132,9 +130,8 @@ IsNewNameEmpty: ; fb7be .nonspace and a ret -; fb7d3 -CompareNewToOld: ; fb7d3 +CompareNewToOld: ; Compares the nickname in wStringBuffer2 to the previous nickname. If they are the same, return carry. ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH @@ -167,9 +164,8 @@ CompareNewToOld: ; fb7d3 .terminator scf ret -; fb802 -GetNicknameLength: ; fb802 +GetNicknameLength: ; Gets the length of the name starting at hl and returns it in c. ld c, 0 .loop @@ -181,70 +177,59 @@ GetNicknameLength: ; fb802 cp MON_NAME_LENGTH - 1 jr nz, .loop ret -; fb80f -NameRaterIntroText: ; 0xfb80f +NameRaterIntroText: ; Hello, hello! I'm the NAME RATER. ; I rate the names of #MON. ; Would you like me to rate names? text_jump UnknownText_0x1c0043 db "@" -; 0xfb814 -NameRaterWhichMonText: ; 0xfb814 +NameRaterWhichMonText: ; Which #MON's nickname should I rate for you? text_jump UnknownText_0x1c00a0 db "@" -; 0xfb819 -NameRaterIsGoodText: ; 0xfb819 +NameRaterIsGoodText: ; Hm… @ … That's a fairly decent name. ; But, how about a slightly better nickname? ; Want me to give it a better name? text_jump UnknownText_0x1c00cd db "@" -; 0xfb81e -NameRaterWhichNameText: ; 0xfb81e +NameRaterWhichNameText: ; All right. What name should we give it, then? text_jump UnknownText_0x1c0142 db "@" -; 0xfb823 -NameRaterEvenBetterText: ; 0xfb823 +NameRaterEvenBetterText: ; That's a better name than before! Well done! text_jump UnknownText_0x1c0171 db "@" -; 0xfb828 -NameRaterCancelText: ; 0xfb828 +NameRaterCancelText: ; OK, then. Come again sometime. text_jump UnknownText_0x1c019e db "@" -; 0xfb82d -NameRaterTradedText: ; 0xfb82d +NameRaterTradedText: ; Hm… @ ? What a great name! It's perfect. ; Treat @ with loving care. text_jump UnknownText_0x1c01be db "@" -; 0xfb832 -NameRaterEggText: ; 0xfb832 +NameRaterEggText: ; Whoa… That's just an EGG. text_jump UnknownText_0x1c0208 db "@" -; 0xfb837 -NameRaterSameAsBeforeText: ; 0xfb837 +NameRaterSameAsBeforeText: ; It might look the different as before, ; but this new name is much better! Well done! text_jump UnknownText_0x1c0222 db "@" -; 0xfb83c -NameRaterDoneText: ; 0xfb83c +NameRaterDoneText: ; All right. This #MON is now named @ . text_jump UnknownText_0x1c0272 db "@" -; 0xfb841 diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index d3991a28c..9cff40a2b 100644 --- a/engine/events/npc_trade.asm +++ b/engine/events/npc_trade.asm @@ -1,4 +1,4 @@ -NPCTrade:: ; fcba8 +NPCTrade:: ld a, e ld [wJumptableIndex], a call Trade_GetDialog @@ -51,9 +51,8 @@ NPCTrade:: ; fcba8 .done call PrintTradeText ret -; fcc07 -.TradeAnimation: ; fcc07 +.TradeAnimation: call DisableSpriteUpdates ld a, [wJumptableIndex] push af @@ -66,9 +65,8 @@ NPCTrade:: ; fcba8 ld [wJumptableIndex], a call ReturnToMapWithSpeechTextbox ret -; fcc23 -CheckTradeGender: ; fcc23 +CheckTradeGender: xor a ld [wMonType], a @@ -95,9 +93,8 @@ CheckTradeGender: ; fcc23 .not_matching scf ret -; fcc4a -TradeFlagAction: ; fcc4a +TradeFlagAction: ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a @@ -105,17 +102,15 @@ TradeFlagAction: ; fcc4a ld a, c and a ret -; fcc59 -Trade_GetDialog: ; fcc59 +Trade_GetDialog: ld e, NPCTRADE_DIALOG call GetTradeAttribute ld a, [hl] ld [wcf64], a ret -; fcc63 -DoNPCTrade: ; fcc63 +DoNPCTrade: ld e, NPCTRADE_GIVEMON call GetTradeAttribute ld a, [hl] @@ -275,10 +270,8 @@ DoNPCTrade: ; fcc63 pop bc pop af ret -; fcdc2 - -GetTradeAttribute: ; 0xfcdc2 +GetTradeAttribute: ld d, 0 push de ld a, [wJumptableIndex] @@ -292,73 +285,64 @@ GetTradeAttribute: ; 0xfcdc2 pop de add hl, de ret -; 0xfcdd7 -Trade_GetAttributeOfCurrentPartymon: ; fcdd7 +Trade_GetAttributeOfCurrentPartymon: ld a, [wCurPartyMon] call AddNTimes ret -; fcdde -Trade_GetAttributeOfLastPartymon: ; fcdde +Trade_GetAttributeOfLastPartymon: ld a, [wPartyCount] dec a call AddNTimes ld e, l ld d, h ret -; fcde8 -GetTradeMonName: ; fcde8 +GetTradeMonName: push de ld [wd265], a call GetBasePokemonName ld hl, wStringBuffer1 pop de ret -; fcdf4 -CopyTradeName: ; fcdf4 +CopyTradeName: ld bc, NAME_LENGTH call CopyBytes ret -; fcdfb -Unreferenced_Functionfcdfb: ; fcdfb +Unreferenced_Functionfcdfb: ld bc, 4 call CopyBytes ld a, "@" ld [de], a ret -; fce05 -Unreferenced_Functionfce05: ; fce05 +Unreferenced_Functionfce05: ld bc, 3 call CopyBytes ld a, "@" ld [de], a ret -; fce0f -Trade_CopyTwoBytes: ; fce0f +Trade_CopyTwoBytes: ld a, [hli] ld [de], a inc de ld a, [hl] ld [de], a ret -; fce15 -Trade_CopyTwoBytesReverseEndian: ; fce15 +Trade_CopyTwoBytesReverseEndian: ld a, [hli] ld [de], a dec de ld a, [hl] ld [de], a ret -; fce1b -GetTradeMonNames: ; fce1b +GetTradeMonNames: ld e, NPCTRADE_GETMON call GetTradeAttribute ld a, [hl] @@ -398,13 +382,10 @@ GetTradeMonNames: ; fce1b ld [hli], a ld [hl], "@" ret -; fce58 - INCLUDE "data/events/npc_trades.asm" - -PrintTradeText: ; fcf38 +PrintTradeText: push af call GetTradeMonNames pop af @@ -420,9 +401,8 @@ PrintTradeText: ; fcf38 ld l, a call PrintText ret -; fcf53 -TradeTexts: ; fcf53 +TradeTexts: ; entries correspond to TRADE_DIALOG_* × TRADE_DIALOGSET_* constants ; TRADE_DIALOG_INTRO dw TradeIntroText1 @@ -449,17 +429,13 @@ TradeTexts: ; fcf53 dw TradeAfterText2 dw TradeAfterText3 dw TradeAfterText4 -; fcf7b - -ConnectLinkCableText: ; 0xfcf7b +ConnectLinkCableText: ; OK, connect the Game Link Cable. text_jump UnknownText_0x1bd407 db "@" -; 0xfcf80 - -TradedForText: ; 0xfcf80 +TradedForText: ; traded givemon for getmon text_jump UnknownText_0x1bd429 start_asm @@ -474,113 +450,91 @@ TradedForText: ; 0xfcf80 ; interpret_data text_jump UnknownText_0x1bd445 db "@" -; 0xfcf97 - -TradeIntroText1: ; 0xfcf97 +TradeIntroText1: ; I collect #MON. Do you have @ ? Want to trade it for my @ ? text_jump UnknownText_0x1bd449 db "@" -; 0xfcf9c -TradeCancelText1: ; 0xfcf9c +TradeCancelText1: ; You don't want to trade? Aww… text_jump UnknownText_0x1bd48c db "@" -; 0xfcfa1 -TradeWrongText1: ; 0xfcfa1 +TradeWrongText1: ; Huh? That's not @ . What a letdown… text_jump UnknownText_0x1bd4aa db "@" -; 0xfcfa6 -TradeCompleteText1: ; 0xfcfa6 +TradeCompleteText1: ; Yay! I got myself @ ! Thanks! text_jump UnknownText_0x1bd4d2 db "@" -; 0xfcfab -TradeAfterText1: ; 0xfcfab +TradeAfterText1: ; Hi, how's my old @ doing? text_jump UnknownText_0x1bd4f4 db "@" -; 0xfcfb0 - TradeIntroText2: -TradeIntroText3: ; 0xfcfb0 +TradeIntroText3: ; Hi, I'm looking for this #MON. If you have @ , would you trade it for my @ ? text_jump UnknownText_0x1bd512 db "@" -; 0xfcfb5 TradeCancelText2: -TradeCancelText3: ; 0xfcfb5 +TradeCancelText3: ; You don't have one either? Gee, that's really disappointing… text_jump UnknownText_0x1bd565 db "@" -; 0xfcfba TradeWrongText2: -TradeWrongText3: ; 0xfcfba +TradeWrongText3: ; You don't have @ ? That's too bad, then. text_jump UnknownText_0x1bd5a1 db "@" -; 0xfcfbf -TradeCompleteText2: ; 0xfcfbf +TradeCompleteText2: ; Great! Thank you! I finally got @ . text_jump UnknownText_0x1bd5cc db "@" -; 0xfcfc4 -TradeAfterText2: ; 0xfcfc4 +TradeAfterText2: ; Hi! The @ you traded me is doing great! text_jump UnknownText_0x1bd5f4 db "@" -; 0xfcfc9 - -TradeIntroText4: ; 0xfcfc9 +TradeIntroText4: ; 's cute, but I don't have it. Do you have @ ? Want to trade it for my @ ? text_jump UnknownText_0x1bd621 db "@" -; 0xfcfce -TradeCancelText4: ; 0xfcfce +TradeCancelText4: ; You don't want to trade? Oh, darn… text_jump UnknownText_0x1bd673 db "@" -; 0xfcfd3 -TradeWrongText4: ; 0xfcfd3 +TradeWrongText4: ; That's not @ . Please trade with me if you get one. text_jump UnknownText_0x1bd696 db "@" -; 0xfcfd8 -TradeCompleteText4: ; 0xfcfd8 +TradeCompleteText4: ; Wow! Thank you! I always wanted @ ! text_jump UnknownText_0x1bd6cd db "@" -; 0xfcfdd -TradeAfterText4: ; 0xfcfdd +TradeAfterText4: ; How is that @ I traded you doing? Your @ 's so cute! text_jump UnknownText_0x1bd6f5 db "@" -; 0xfcfe2 - -TradeCompleteText3: ; 0xfcfe2 +TradeCompleteText3: ; Uh? What happened? text_jump UnknownText_0x1bd731 db "@" -; 0xfcfe7 -TradeAfterText3: ; 0xfcfe7 +TradeAfterText3: ; Trading is so odd… I still have a lot to learn about it. text_jump UnknownText_0x1bd745 db "@" -; 0xfcfec diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 3e58c2677..a6b244b1d 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -1,4 +1,4 @@ -_GiveOddEgg: ; 1fb4b6 +_GiveOddEgg: ; Figure out which egg to give. ; Compare a random word to @@ -39,7 +39,7 @@ _GiveOddEgg: ; 1fb4b6 .done ld hl, OddEggs - ld a, OddEgg2 - OddEgg1 + ld a, OddEgg1End - OddEgg1 call AddNTimes ld de, wOddEggSpecies @@ -88,7 +88,6 @@ _GiveOddEgg: ; 1fb4b6 ld [wMobileMonNicknamePointerBuffer + 1], a farcall AddMobileMonToParty ret -; 1fb546 .Odd: db "ODD@@@@@@@@@" diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index f9d67f0bd..e57635fef 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -1,11 +1,11 @@ -FieldMoveJumptableReset: ; c6ea +FieldMoveJumptableReset: xor a ld hl, wBuffer1 ld bc, 7 call ByteFill ret -FieldMoveJumptable: ; c6f5 +FieldMoveJumptable: ld a, [wBuffer1] rst JumpTable ld [wBuffer1], a @@ -19,7 +19,7 @@ FieldMoveJumptable: ; c6f5 scf ret -GetPartyNick: ; c706 +GetPartyNick: ; write wCurPartyMon nickname to wStringBuffer1-3 ld hl, wPartyMonNicknames ld a, BOXMON @@ -33,7 +33,7 @@ GetPartyNick: ; c706 call CopyName2 ret -CheckEngineFlag: ; c721 +CheckEngineFlag: ; Check engine flag de ; Return carry if flag is not set ld b, CHECK_FLAG @@ -47,7 +47,7 @@ CheckEngineFlag: ; c721 xor a ret -CheckBadge: ; c731 +CheckBadge: ; Check engine flag a (ENGINE_ZEPHYRBADGE thru ENGINE_EARTHBADGE) ; Display "Badge required" text and return carry if the badge is not owned call CheckEngineFlag @@ -57,13 +57,13 @@ CheckBadge: ; c731 scf ret -.BadgeRequiredText: ; c73d +.BadgeRequiredText: ; Sorry! A new BADGE ; is required. text_jump _BadgeRequiredText db "@" -CheckPartyMove: ; c742 +CheckPartyMove: ; Check if a monster in your party has move d. ld e, 0 @@ -107,17 +107,17 @@ CheckPartyMove: ; c742 scf ret -FieldMoveFailed: ; c779 +FieldMoveFailed: ld hl, .CantUseHere call MenuTextBoxBackup ret -.CantUseHere: ; 0xc780 +.CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c05c8 db "@" -CutFunction: ; c785 +CutFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -127,12 +127,12 @@ CutFunction: ; c785 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; c796 (3:4796) +.Jumptable: dw .CheckAble dw .DoCut dw .FailCut -.CheckAble: ; c79c (3:479c) +.CheckAble: ld de, ENGINE_HIVEBADGE call CheckBadge jr c, .nohivebadge @@ -149,29 +149,29 @@ CutFunction: ; c785 ld a, $2 ret -.DoCut: ; c7b2 (3:47b2) +.DoCut: ld hl, Script_CutFromMenu call QueueScript ld a, $81 ret -.FailCut: ; c7bb (3:47bb) +.FailCut: ld hl, Text_NothingToCut call MenuTextBoxBackup ld a, $80 ret -Text_UsedCut: ; 0xc7c4 +Text_UsedCut: ; used CUT! text_jump UnknownText_0x1c05dd db "@" -Text_NothingToCut: ; 0xc7c9 +Text_NothingToCut: ; There's nothing to CUT here. text_jump UnknownText_0x1c05ec db "@" -CheckMapForSomethingToCut: ; c7ce +CheckMapForSomethingToCut: ; Does the collision data of the facing tile permit cutting? call GetFacingTileCoord ld c, a @@ -206,11 +206,11 @@ CheckMapForSomethingToCut: ; c7ce scf ret -Script_CutFromMenu: ; c7fe +Script_CutFromMenu: reloadmappart special UpdateTimePals -Script_Cut: ; 0xc802 +Script_Cut: callasm GetPartyNick writetext Text_UsedCut reloadmappart @@ -218,7 +218,7 @@ Script_Cut: ; 0xc802 closetext end -CutDownTreeOrGrass: ; c810 +CutDownTreeOrGrass: ld hl, wBuffer3 ; OverworldMapTile ld a, [hli] ld h, [hl] @@ -240,7 +240,7 @@ CutDownTreeOrGrass: ; c810 call LoadStandardFont ret -CheckOverworldTileArrays: ; c840 +CheckOverworldTileArrays: ; Input: c contains the tile you're facing ; Output: Replacement tile in b and effect on wild encounters in c, plus carry set. ; Carry is not set if the facing tile cannot be replaced, or if the tileset @@ -276,17 +276,15 @@ CheckOverworldTileArrays: ; c840 xor a ret - INCLUDE "data/events/field_move_blocks.asm" - -OWFlash: ; c8ac +OWFlash: call .CheckUseFlash and $7f ld [wFieldMoveSucceeded], a ret -.CheckUseFlash: ; c8b5 +.CheckUseFlash: ; Flash ld de, ENGINE_ZEPHYRBADGE farcall CheckBadge @@ -312,11 +310,11 @@ OWFlash: ; c8ac ld a, $80 ret -UseFlash: ; c8e0 +UseFlash: ld hl, Script_UseFlash jp QueueScript -Script_UseFlash: ; 0xc8e6 +Script_UseFlash: reloadmappart special UpdateTimePals writetext UnknownText_0xc8f3 @@ -324,7 +322,7 @@ Script_UseFlash: ; 0xc8e6 closetext end -UnknownText_0xc8f3: ; 0xc8f3 +UnknownText_0xc8f3: text_jump UnknownText_0x1c0609 start_asm call WaitSFX @@ -334,10 +332,10 @@ UnknownText_0xc8f3: ; 0xc8f3 ld hl, .BlankText ret -.BlankText: ; 0xc908 +.BlankText: db "@" -SurfFunction: ; c909 +SurfFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -347,13 +345,13 @@ SurfFunction: ; c909 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; c91a (3:491a) +.Jumptable: dw .TrySurf dw .DoSurf dw .FailSurf dw .AlreadySurfing -.TrySurf: ; c922 (3:4922) +.TrySurf: ld de, ENGINE_FOGBADGE call CheckBadge jr c, .asm_c956 @@ -385,7 +383,7 @@ SurfFunction: ; c909 ld a, $2 ret -.DoSurf: ; c95f (3:495f) +.DoSurf: call GetSurfType ld [wBuffer2], a call GetPartyNick @@ -394,22 +392,22 @@ SurfFunction: ; c909 ld a, $81 ret -.FailSurf: ; c971 (3:4971) +.FailSurf: ld hl, CantSurfText call MenuTextBoxBackup ld a, $80 ret -.AlreadySurfing: ; c97a (3:497a) +.AlreadySurfing: ld hl, AlreadySurfingText call MenuTextBoxBackup ld a, $80 ret -SurfFromMenuScript: ; c983 +SurfFromMenuScript: special UpdateTimePals -UsedSurfScript: ; c986 +UsedSurfScript: writetext UsedSurfText ; "used SURF!" waitbutton closetext @@ -426,23 +424,23 @@ UsedSurfScript: ; c986 applymovement PLAYER, wMovementBuffer end -.empty_fn ; c9a2 +.empty_fn farcall StubbedTrainerRankings_Surf ret -UsedSurfText: ; c9a9 +UsedSurfText: text_jump _UsedSurfText db "@" -CantSurfText: ; c9ae +CantSurfText: text_jump _CantSurfText db "@" -AlreadySurfingText: ; c9b3 +AlreadySurfingText: text_jump _AlreadySurfingText db "@" -GetSurfType: ; c9b8 +GetSurfType: ; Surfing on Pikachu uses an alternate sprite. ; This is done by using a separate movement type. @@ -459,7 +457,7 @@ GetSurfType: ; c9b8 ld a, PLAYER_SURF ret -CheckDirection: ; c9cb +CheckDirection: ; Return carry if a tile permission prevents you ; from moving in the direction you're facing. @@ -490,7 +488,7 @@ CheckDirection: ; c9cb db FACE_LEFT db FACE_RIGHT -TrySurfOW:: ; c9e7 +TrySurfOW:: ; Checking a tile in the overworld. ; Return carry if fail is allowed. @@ -538,7 +536,7 @@ TrySurfOW:: ; c9e7 xor a ret -AskSurfScript: ; ca2c +AskSurfScript: opentext writetext AskSurfText yesorno @@ -546,11 +544,11 @@ AskSurfScript: ; ca2c closetext end -AskSurfText: ; ca36 +AskSurfText: text_jump _AskSurfText ; The water is calm. db "@" ; Want to SURF? -FlyFunction: ; ca3b +FlyFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -565,7 +563,7 @@ FlyFunction: ; ca3b dw .DoFly dw .FailFly -.TryFly: ; ca52 +.TryFly: ; Fly ld de, ENGINE_STORMBADGE call CheckBadge @@ -606,18 +604,18 @@ FlyFunction: ; ca3b ld a, $80 ret -.DoFly: ; ca94 +.DoFly: ld hl, .FlyScript call QueueScript ld a, $81 ret -.FailFly: ; ca9d +.FailFly: call FieldMoveFailed ld a, $82 ret -.FlyScript: ; 0xcaa3 +.FlyScript: reloadmappart callasm HideSprites special UpdateTimePals @@ -632,20 +630,20 @@ FlyFunction: ; ca3b callasm .ReturnFromFly end -.ReturnFromFly: ; cacb +.ReturnFromFly: farcall Function561d call DelayFrame call ReplaceKrisSprite farcall LoadOverworldFont ret -WaterfallFunction: ; cade +WaterfallFunction: call .TryWaterfall and $7f ld [wFieldMoveSucceeded], a ret -.TryWaterfall: ; cae7 +.TryWaterfall: ; Waterfall ld de, ENGINE_RISINGBADGE farcall CheckBadge @@ -663,7 +661,7 @@ WaterfallFunction: ; cade ld a, $80 ret -CheckMapCanWaterfall: ; cb07 +CheckMapCanWaterfall: ld a, [wPlayerDirection] and $c cp FACE_UP @@ -678,11 +676,11 @@ CheckMapCanWaterfall: ; cb07 scf ret -Script_WaterfallFromMenu: ; 0xcb1c +Script_WaterfallFromMenu: reloadmappart special UpdateTimePals -Script_UsedWaterfall: ; 0xcb20 +Script_UsedWaterfall: callasm GetPartyNick writetext .Text_UsedWaterfall waitbutton @@ -694,7 +692,7 @@ Script_UsedWaterfall: ; 0xcb20 iffalse .loop end -.CheckContinueWaterfall: ; cb38 +.CheckContinueWaterfall: xor a ld [wScriptVar], a ld a, [wPlayerStandingTile] @@ -705,16 +703,16 @@ Script_UsedWaterfall: ; 0xcb20 ld [wScriptVar], a ret -.WaterfallStep: ; cb4f +.WaterfallStep: turn_waterfall UP step_end -.Text_UsedWaterfall: ; 0xcb51 +.Text_UsedWaterfall: ; used WATERFALL! text_jump UnknownText_0x1c068e db "@" -TryWaterfallOW:: ; cb56 +TryWaterfallOW:: ld d, WATERFALL call CheckPartyMove jr c, .failed @@ -736,15 +734,15 @@ TryWaterfallOW:: ; cb56 scf ret -Script_CantDoWaterfall: ; 0xcb7e +Script_CantDoWaterfall: jumptext .Text_CantDoWaterfall -.Text_CantDoWaterfall: ; 0xcb81 +.Text_CantDoWaterfall: ; Wow, it's a huge waterfall. text_jump UnknownText_0x1c06a3 db "@" -Script_AskWaterfall: ; 0xcb86 +Script_AskWaterfall: opentext writetext .AskUseWaterfall yesorno @@ -752,17 +750,17 @@ Script_AskWaterfall: ; 0xcb86 closetext end -.AskUseWaterfall: ; 0xcb90 +.AskUseWaterfall: ; Do you want to use WATERFALL? text_jump UnknownText_0x1c06bf db "@" -EscapeRopeFunction: ; cb95 +EscapeRopeFunction: call FieldMoveJumptableReset ld a, $1 jr dig_incave -DigFunction: ; cb9c +DigFunction: call FieldMoveJumptableReset ld a, $2 @@ -776,12 +774,12 @@ dig_incave ld [wFieldMoveSucceeded], a ret -.DigTable: ; cbb2 +.DigTable: dw .CheckCanDig dw .DoDig dw .FailDig -.CheckCanDig: ; cbb8 +.CheckCanDig: call GetMapEnvironment cp CAVE jr z, .incave @@ -805,7 +803,7 @@ dig_incave ld a, $1 ret -.DoDig: ; cbd8 +.DoDig: ld hl, wDigWarpNumber ld de, wNextWarp ld bc, 3 @@ -826,7 +824,7 @@ dig_incave ld a, $81 ret -.FailDig: ; cc06 +.FailDig: ld a, [wBuffer2] cp $2 jr nz, .failescaperope @@ -839,33 +837,33 @@ dig_incave ld a, $80 ret -.Text_UsedDig: ; 0xcc1c +.Text_UsedDig: ; used DIG! text_jump UnknownText_0x1c06de db "@" -.Text_UsedEscapeRope: ; 0xcc21 +.Text_UsedEscapeRope: ; used an ESCAPE ROPE. text_jump UnknownText_0x1c06ed db "@" -.Text_CantUseHere: ; 0xcc26 +.Text_CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c0705 db "@" -.UsedEscapeRopeScript: ; 0xcc2b +.UsedEscapeRopeScript: reloadmappart special UpdateTimePals writetext .Text_UsedEscapeRope jump .UsedDigOrEscapeRopeScript -.UsedDigScript: ; 0xcc35 +.UsedDigScript: reloadmappart special UpdateTimePals writetext .Text_UsedDig -.UsedDigOrEscapeRopeScript: ; 0xcc3c +.UsedDigOrEscapeRopeScript: waitbutton closetext playsound SFX_WARP_TO @@ -878,17 +876,17 @@ dig_incave applymovement PLAYER, .DigReturn end -.DigOut: ; 0xcc59 +.DigOut: step_dig 32 hide_object step_end -.DigReturn: ; 0xcc5d +.DigReturn: show_object return_dig 32 step_end -TeleportFunction: ; cc61 +TeleportFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -898,12 +896,12 @@ TeleportFunction: ; cc61 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; cc72 +.Jumptable: dw .TryTeleport dw .DoTeleport dw .FailTeleport -.TryTeleport: ; cc78 +.TryTeleport: call GetMapEnvironment call CheckOutdoorMap jr z, .CheckIfSpawnPoint @@ -925,30 +923,30 @@ TeleportFunction: ; cc61 ld a, $2 ret -.DoTeleport: ; cc9c +.DoTeleport: call GetPartyNick ld hl, .TeleportScript call QueueScript ld a, $81 ret -.FailTeleport: ; cca8 +.FailTeleport: ld hl, .Text_CantUseHere call MenuTextBoxBackup ld a, $80 ret -.Text_ReturnToLastMonCenter: ; 0xccb1 +.Text_ReturnToLastMonCenter: ; Return to the last #MON CENTER. text_jump UnknownText_0x1c071a db "@" -.Text_CantUseHere: ; 0xccb6 +.Text_CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c073b db "@" -.TeleportScript: ; 0xccbb +.TeleportScript: reloadmappart special UpdateTimePals writetext .Text_ReturnToLastMonCenter @@ -965,21 +963,21 @@ TeleportFunction: ; cc61 applymovement PLAYER, .TeleportTo end -.TeleportFrom: ; cce1 +.TeleportFrom: teleport_from step_end -.TeleportTo: ; cce3 +.TeleportTo: teleport_to step_end -StrengthFunction: ; cce5 +StrengthFunction: call .TryStrength and $7f ld [wFieldMoveSucceeded], a ret -.TryStrength: ; ccee +.TryStrength: ; Strength ld de, ENGINE_PLAINBADGE call CheckBadge @@ -992,21 +990,21 @@ StrengthFunction: ; cce5 ld a, $80 ret -.JumpText: ; 0xcd01 +.JumpText: text_jump UnknownText_0x1c0751 db "@" -.Failed: ; cd06 +.Failed: ld a, $80 ret -.UseStrength: ; cd09 +.UseStrength: ld hl, Script_StrengthFromMenu call QueueScript ld a, $81 ret -SetStrengthFlag: ; cd12 +SetStrengthFlag: ld hl, wBikeFlags set BIKEFLAGS_STRENGTH_ACTIVE_F, [hl] ld a, [wCurPartyMon] @@ -1019,11 +1017,11 @@ SetStrengthFlag: ; cd12 call GetPartyNick ret -Script_StrengthFromMenu: ; 0xcd29 +Script_StrengthFromMenu: reloadmappart special UpdateTimePals -Script_UsedStrength: ; 0xcd2d +Script_UsedStrength: callasm SetStrengthFlag writetext .UsedStrength copybytetovar wBuffer6 @@ -1033,11 +1031,11 @@ Script_UsedStrength: ; 0xcd2d closetext end -.UsedStrength: ; 0xcd41 +.UsedStrength: text_jump UnknownText_0x1c0774 db "@" -.StrengthAllowedItToMoveBoulders: ; 0xcd46 +.StrengthAllowedItToMoveBoulders: text_jump UnknownText_0x1c0788 db "@" @@ -1047,13 +1045,13 @@ AskStrengthScript: ifequal $1, .DontMeetRequirements jump .AlreadyUsedStrength -.DontMeetRequirements: ; 0xcd59 +.DontMeetRequirements: jumptext UnknownText_0xcd73 -.AlreadyUsedStrength: ; 0xcd5c +.AlreadyUsedStrength: jumptext UnknownText_0xcd6e -.AskStrength: ; 0xcd5f +.AskStrength: opentext writetext UnknownText_0xcd69 yesorno @@ -1061,22 +1059,22 @@ AskStrengthScript: closetext end -UnknownText_0xcd69: ; 0xcd69 +UnknownText_0xcd69: ; A #MON may be able to move this. Want to use STRENGTH? text_jump UnknownText_0x1c07a0 db "@" -UnknownText_0xcd6e: ; 0xcd6e +UnknownText_0xcd6e: ; Boulders may now be moved! text_jump UnknownText_0x1c07d8 db "@" -UnknownText_0xcd73: ; 0xcd73 +UnknownText_0xcd73: ; A #MON may be able to move this. text_jump UnknownText_0x1c07f4 db "@" -TryStrengthOW: ; cd78 +TryStrengthOW: ld d, STRENGTH call CheckPartyMove jr c, .nope @@ -1104,7 +1102,7 @@ TryStrengthOW: ; cd78 ld [wScriptVar], a ret -WhirlpoolFunction: ; cd9d +WhirlpoolFunction: call FieldMoveJumptableReset .loop ld hl, Jumptable_cdae @@ -1114,12 +1112,12 @@ WhirlpoolFunction: ; cd9d ld [wFieldMoveSucceeded], a ret -Jumptable_cdae: ; cdae +Jumptable_cdae: dw .TryWhirlpool dw .DoWhirlpool dw .FailWhirlpool -.TryWhirlpool: ; cdb4 +.TryWhirlpool: ld de, ENGINE_GLACIERBADGE call CheckBadge jr c, .noglacierbadge @@ -1136,23 +1134,23 @@ Jumptable_cdae: ; cdae ld a, $80 ret -.DoWhirlpool: ; cdca +.DoWhirlpool: ld hl, Script_WhirlpoolFromMenu call QueueScript ld a, $81 ret -.FailWhirlpool: ; cdd3 +.FailWhirlpool: call FieldMoveFailed ld a, $80 ret -Text_UsedWhirlpool: ; 0xcdd9 +Text_UsedWhirlpool: ; used WHIRLPOOL! text_jump UnknownText_0x1c0816 db "@" -TryWhirlpoolMenu: ; cdde +TryWhirlpoolMenu: call GetFacingTileCoord ld c, a push de @@ -1181,11 +1179,11 @@ TryWhirlpoolMenu: ; cdde scf ret -Script_WhirlpoolFromMenu: ; 0xce0b +Script_WhirlpoolFromMenu: reloadmappart special UpdateTimePals -Script_UsedWhirlpool: ; 0xce0f +Script_UsedWhirlpool: callasm GetPartyNick writetext Text_UsedWhirlpool reloadmappart @@ -1193,7 +1191,7 @@ Script_UsedWhirlpool: ; 0xce0f closetext end -DisappearWhirlpool: ; ce1d +DisappearWhirlpool: ld hl, wBuffer3 ld a, [hli] ld h, [hl] @@ -1210,7 +1208,7 @@ DisappearWhirlpool: ; ce1d call GetMovementPermissions ret -TryWhirlpoolOW:: ; ce3e +TryWhirlpoolOW:: ld d, WHIRLPOOL call CheckPartyMove jr c, .failed @@ -1232,14 +1230,14 @@ TryWhirlpoolOW:: ; ce3e scf ret -Script_MightyWhirlpool: ; 0xce66 +Script_MightyWhirlpool: jumptext .MightyWhirlpoolText -.MightyWhirlpoolText: ; 0xce69 +.MightyWhirlpoolText: text_jump UnknownText_0x1c082b db "@" -Script_AskWhirlpoolOW: ; 0xce6e +Script_AskWhirlpoolOW: opentext writetext UnknownText_0xce78 yesorno @@ -1247,17 +1245,17 @@ Script_AskWhirlpoolOW: ; 0xce6e closetext end -UnknownText_0xce78: ; 0xce78 +UnknownText_0xce78: text_jump UnknownText_0x1c0864 db "@" -HeadbuttFunction: ; ce7d +HeadbuttFunction: call TryHeadbuttFromMenu and $7f ld [wFieldMoveSucceeded], a ret -TryHeadbuttFromMenu: ; ce86 +TryHeadbuttFromMenu: call GetFacingTileCoord call CheckHeadbuttTreeTile jr nz, .no_tree @@ -1272,21 +1270,21 @@ TryHeadbuttFromMenu: ; ce86 ld a, $80 ret -UnknownText_0xce9d: ; 0xce9d +UnknownText_0xce9d: ; did a HEADBUTT! text_jump UnknownText_0x1c0897 db "@" -UnknownText_0xcea2: ; 0xcea2 +UnknownText_0xcea2: ; Nope. Nothing… text_jump UnknownText_0x1c08ac db "@" -HeadbuttFromMenuScript: ; 0xcea7 +HeadbuttFromMenuScript: reloadmappart special UpdateTimePals -HeadbuttScript: ; 0xceab +HeadbuttScript: callasm GetPartyNick writetext UnknownText_0xce9d @@ -1307,7 +1305,7 @@ HeadbuttScript: ; 0xceab closetext end -TryHeadbuttOW:: ; cec9 +TryHeadbuttOW:: ld d, HEADBUTT call CheckPartyMove jr c, .no @@ -1322,7 +1320,7 @@ TryHeadbuttOW:: ; cec9 xor a ret -AskHeadbuttScript: ; 0xcedc +AskHeadbuttScript: opentext writetext UnknownText_0xcee6 yesorno @@ -1330,18 +1328,18 @@ AskHeadbuttScript: ; 0xcedc closetext end -UnknownText_0xcee6: ; 0xcee6 +UnknownText_0xcee6: ; A #MON could be in this tree. Want to HEADBUTT it? text_jump UnknownText_0x1c08bc db "@" -RockSmashFunction: ; ceeb +RockSmashFunction: call TryRockSmashFromMenu and $7f ld [wFieldMoveSucceeded], a ret -TryRockSmashFromMenu: ; cef4 +TryRockSmashFromMenu: call GetFacingObject jr c, .no_rock ld a, d @@ -1358,7 +1356,7 @@ TryRockSmashFromMenu: ; cef4 ld a, $80 ret -GetFacingObject: ; cf0d +GetFacingObject: farcall CheckFacingObject jr nc, .fail @@ -1380,11 +1378,11 @@ GetFacingObject: ; cf0d scf ret -RockSmashFromMenuScript: ; 0xcf2e +RockSmashFromMenuScript: reloadmappart special UpdateTimePals -RockSmashScript: ; cf32 +RockSmashScript: callasm GetPartyNick writetext UnknownText_0xcf58 closetext @@ -1403,15 +1401,15 @@ RockSmashScript: ; cf32 .done end -MovementData_0xcf55: ; 0xcf55 +MovementData_0xcf55: rock_smash 10 step_end -UnknownText_0xcf58: ; 0xcf58 +UnknownText_0xcf58: text_jump UnknownText_0x1c08f0 db "@" -AskRockSmashScript: ; 0xcf5d +AskRockSmashScript: callasm HasRockSmash ifequal 1, .no @@ -1424,17 +1422,17 @@ AskRockSmashScript: ; 0xcf5d .no jumptext UnknownText_0xcf72 -UnknownText_0xcf72: ; 0xcf72 +UnknownText_0xcf72: ; Maybe a #MON can break this. text_jump UnknownText_0x1c0906 db "@" -UnknownText_0xcf77: ; 0xcf77 +UnknownText_0xcf77: ; This rock looks breakable. Want to use ROCK SMASH? text_jump UnknownText_0x1c0924 db "@" -HasRockSmash: ; cf7c +HasRockSmash: ld d, ROCK_SMASH call CheckPartyMove jr nc, .yes @@ -1448,7 +1446,7 @@ HasRockSmash: ; cf7c ld [wScriptVar], a ret -FishFunction: ; cf8e +FishFunction: ld a, e push af call FieldMoveJumptableReset @@ -1462,14 +1460,14 @@ FishFunction: ; cf8e ld [wFieldMoveSucceeded], a ret -.FishTable: ; cfa5 +.FishTable: dw .TryFish dw .FishNoBite dw .FishGotSomething dw .FailFish dw .FishNoFish -.TryFish: ; cfaf +.TryFish: ld a, [wPlayerState] cp PLAYER_SURF jr z, .fail @@ -1510,11 +1508,11 @@ FishFunction: ; cf8e ld a, $1 ret -.FailFish: ; cff1 +.FailFish: ld a, $80 ret -.FishGotSomething: ; cff4 +.FishGotSomething: ld a, $1 ld [wBuffer6], a ld hl, Script_GotABite @@ -1522,7 +1520,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoBite: ; d002 +.FishNoBite: ld a, $2 ld [wBuffer6], a ld hl, Script_NotEvenANibble @@ -1530,7 +1528,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoFish: ; d010 +.FishNoFish: ld a, $0 ld [wBuffer6], a ld hl, Script_NotEvenANibble2 @@ -1538,32 +1536,32 @@ FishFunction: ; cf8e ld a, $81 ret -Script_NotEvenANibble: ; 0xd01e +Script_NotEvenANibble: scall Script_FishCastRod writetext UnknownText_0xd0a9 jump Script_NotEvenANibble_FallThrough -Script_NotEvenANibble2: ; 0xd027 +Script_NotEvenANibble2: scall Script_FishCastRod writetext UnknownText_0xd0a9 -Script_NotEvenANibble_FallThrough: ; 0xd02d +Script_NotEvenANibble_FallThrough: loademote EMOTE_SHADOW callasm PutTheRodAway closetext end -Script_GotABite: ; 0xd035 +Script_GotABite: scall Script_FishCastRod callasm Fishing_CheckFacingUp iffalse .NotFacingUp applymovement PLAYER, .Movement_FacingUp jump .FightTheHookedPokemon -.NotFacingUp: ; 0xd046 +.NotFacingUp: applymovement PLAYER, .Movement_NotFacingUp -.FightTheHookedPokemon: ; 0xd04a +.FightTheHookedPokemon: pause 40 applymovement PLAYER, .Movement_RestoreRod writetext UnknownText_0xd0a4 @@ -1574,7 +1572,7 @@ Script_GotABite: ; 0xd035 reloadmapafterbattle end -.Movement_NotFacingUp: ; d05c +.Movement_NotFacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1582,7 +1580,7 @@ Script_GotABite: ; 0xd035 show_emote step_end -.Movement_FacingUp: ; d062 +.Movement_FacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1591,12 +1589,12 @@ Script_GotABite: ; 0xd035 show_emote step_end -.Movement_RestoreRod: ; d069 +.Movement_RestoreRod: hide_emote fish_cast_rod step_end -Fishing_CheckFacingUp: ; d06c +Fishing_CheckFacingUp: ld a, [wPlayerDirection] and $c cp OW_UP @@ -1608,7 +1606,7 @@ Fishing_CheckFacingUp: ; d06c ld [wScriptVar], a ret -Script_FishCastRod: ; 0xd07c +Script_FishCastRod: reloadmappart loadvar hBGMapMode, $0 special UpdateTimePals @@ -1619,11 +1617,11 @@ Script_FishCastRod: ; 0xd07c pause 40 end -MovementData_0xd093: ; d093 +MovementData_0xd093: fish_cast_rod step_end -PutTheRodAway: ; d095 +PutTheRodAway: xor a ld [hBGMapMode], a ld a, $1 @@ -1632,12 +1630,12 @@ PutTheRodAway: ; d095 call ReplaceKrisSprite ret -UnknownText_0xd0a4: ; 0xd0a4 +UnknownText_0xd0a4: ; Oh! A bite! text_jump UnknownText_0x1c0958 db "@" -UnknownText_0xd0a9: ; 0xd0a9 +UnknownText_0xd0a9: ; Not even a nibble! text_jump UnknownText_0x1c0965 db "@" @@ -1647,13 +1645,13 @@ UnknownText_0xd0ae: ; unused text_jump UnknownText_0x1c0979 db "@" -BikeFunction: ; d0b3 +BikeFunction: call .TryBike and $7f ld [wFieldMoveSucceeded], a ret -.TryBike: ; d0bc +.TryBike: call .CheckEnvironment jr c, .CannotUseBike ld a, [wPlayerState] @@ -1704,7 +1702,7 @@ BikeFunction: ; d0b3 ld a, $1 ret -.CheckIfRegistered: ; d119 +.CheckIfRegistered: ld a, [wUsingItemWithSelect] and a ret z @@ -1712,7 +1710,7 @@ BikeFunction: ; d0b3 ld l, e ret -.CheckEnvironment: ; d121 +.CheckEnvironment: call GetMapEnvironment call CheckOutdoorMap jr z, .ok @@ -1733,7 +1731,7 @@ BikeFunction: ; d0b3 scf ret -Script_GetOnBike: ; 0xd13e +Script_GetOnBike: reloadmappart special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_BIKE @@ -1743,7 +1741,7 @@ Script_GetOnBike: ; 0xd13e special ReplaceKrisSprite end -Script_GetOnBike_Register: ; 0xd14e +Script_GetOnBike_Register: writecode VAR_MOVEMENT, PLAYER_BIKE closetext special ReplaceKrisSprite @@ -1753,7 +1751,7 @@ Script_GetOnBike_Register: ; 0xd14e nop ret -Script_GetOffBike: ; 0xd158 +Script_GetOffBike: reloadmappart special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_NORMAL @@ -1766,32 +1764,32 @@ FinishGettingOffBike: special PlayMapMusic end -Script_GetOffBike_Register: ; 0xd16b +Script_GetOffBike_Register: writecode VAR_MOVEMENT, PLAYER_NORMAL jump FinishGettingOffBike -Script_CantGetOffBike: ; 0xd171 +Script_CantGetOffBike: writetext .CantGetOffBikeText waitbutton closetext end -.CantGetOffBikeText: ; 0xd177 +.CantGetOffBikeText: ; You can't get off here! text_jump UnknownText_0x1c099a db "@" -GotOnTheBikeText: ; 0xd17c +GotOnTheBikeText: ; got on the @ . text_jump UnknownText_0x1c09b2 db "@" -GotOffTheBikeText: ; 0xd181 +GotOffTheBikeText: ; got off the @ . text_jump UnknownText_0x1c09c7 db "@" -TryCutOW:: ; d186 +TryCutOW:: ld d, CUT call CheckPartyMove jr c, .cant_cut @@ -1813,7 +1811,7 @@ TryCutOW:: ; d186 scf ret -AskCutScript: ; 0xd1a9 +AskCutScript: opentext writetext UnknownText_0xd1c8 yesorno @@ -1824,7 +1822,7 @@ AskCutScript: ; 0xd1a9 closetext end -.CheckMap: ; d1ba +.CheckMap: xor a ld [wScriptVar], a call CheckMapForSomethingToCut @@ -1833,13 +1831,13 @@ AskCutScript: ; 0xd1a9 ld [wScriptVar], a ret -UnknownText_0xd1c8: ; 0xd1c8 +UnknownText_0xd1c8: text_jump UnknownText_0x1c09dd db "@" -CantCutScript: ; 0xd1cd +CantCutScript: jumptext UnknownText_0xd1d0 -UnknownText_0xd1d0: ; 0xd1d0 +UnknownText_0xd1d0: text_jump UnknownText_0x1c0a05 db "@" diff --git a/engine/events/play_slow_cry.asm b/engine/events/play_slow_cry.asm index 1f27a7ca4..6839b3960 100644 --- a/engine/events/play_slow_cry.asm +++ b/engine/events/play_slow_cry.asm @@ -1,4 +1,4 @@ -PlaySlowCry: ; fb841 +PlaySlowCry: ld a, [wScriptVar] call LoadCry jr c, .done @@ -28,4 +28,3 @@ PlaySlowCry: ; fb841 .done ret -; fb877 diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index 5ea094db9..c7ba7660f 100644 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -1,4 +1,4 @@ -DoPoisonStep:: ; 505da +DoPoisonStep:: ld a, [wPartyCount] and a jr z, .no_faint @@ -55,9 +55,8 @@ DoPoisonStep:: ; 505da .no_faint xor a ret -; 5062e -.DamageMonIfPoisoned: ; 5062e +.DamageMonIfPoisoned: ; check if mon is poisoned, return if not ld a, MON_STATUS call GetPartyParamLocation @@ -98,31 +97,27 @@ DoPoisonStep:: ; 505da ld c, %01 scf ret -; 50658 -.PlayPoisonSFX: ; 50658 +.PlayPoisonSFX: ld de, SFX_POISON call PlaySFX ld b, $2 predef LoadPoisonBGPals call DelayFrame ret -; 50669 -.Script_MonFaintedToPoison: ; 50669 +.Script_MonFaintedToPoison: callasm .PlayPoisonSFX opentext callasm .CheckWhitedOut iffalse .whiteout closetext end -; 50677 -.whiteout ; 50677 +.whiteout farjump Script_OverworldWhiteout -; 5067b -.CheckWhitedOut: ; 5067b +.CheckWhitedOut: xor a ld [wCurPartyMon], a ld de, wEngineBuffer2 @@ -149,14 +144,11 @@ DoPoisonStep:: ; 505da ld a, d ld [wScriptVar], a ret -; 506b2 -.PoisonFaintText: ; 506b2 +.PoisonFaintText: text_jump UnknownText_0x1c0acc db "@" -; 506b7 -.PoisonWhiteOutText: ; 506b7 +.PoisonWhiteOutText: text_jump UnknownText_0x1c0ada db "@" -; 506bc diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index c1bfa49f0..354aabb28 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -1,11 +1,11 @@ -LoadPoisonBGPals: ; cbcdd +LoadPoisonBGPals: call .LoadPals ld a, [hCGB] and a ret nz ret ; ???? -.LoadPals: ; cbce5 +.LoadPals: ld a, [hCGB] and a jr nz, .cgb diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index c79298dd0..dc99cb536 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -15,7 +15,7 @@ const SEERACTION_CANT_TELL_2 const SEERACTION_LEVEL_ONLY -PokeSeer: ; 4f0bc +PokeSeer: ld a, SEER_INTRO call PrintSeerText call JoyWaitAorB @@ -47,34 +47,29 @@ PokeSeer: ; 4f0bc ld a, SEER_EGG call PrintSeerText ret -; 4f0ee - -SeerAction: ; 4f0ee +SeerAction: ld a, [wSeerAction] ld hl, SeerActions rst JumpTable ret -; 4f0f6 -SeerActions: ; 4f0f6 +SeerActions: dw SeerAction0 dw SeerAction1 dw SeerAction2 dw SeerAction3 dw SeerAction4 -; 4f100 -SeerAction0: ; 4f100 +SeerAction0: ld a, SEER_MET_AT call PrintSeerText ld a, SEER_TIME_LEVEL call PrintSeerText call SeerAdvice ret -; 4f10e -SeerAction1: ; 4f10e +SeerAction1: call GetCaughtOT ld a, SEER_TRADED call PrintSeerText @@ -82,28 +77,24 @@ SeerAction1: ; 4f10e call PrintSeerText call SeerAdvice ret -; 4f11f -SeerAction2: ; 4f11f +SeerAction2: ld a, SEER_CANT_TELL call PrintSeerText ret -; 4f125 -SeerAction3: ; 4f125 +SeerAction3: ld a, SEER_CANT_TELL call PrintSeerText ret -; 4f12b -SeerAction4: ; 4f12b +SeerAction4: ld a, SEER_LEVEL_ONLY call PrintSeerText call SeerAdvice ret -; 4f134 -ReadCaughtData: ; 4f134 +ReadCaughtData: ld a, MON_CAUGHTDATA call GetPartyParamLocation ld a, [hli] @@ -143,9 +134,8 @@ ReadCaughtData: ; 4f134 ld a, SEERACTION_CANT_TELL_1 ld [wSeerAction], a ret -; 4f176 -GetCaughtName: ; 4f176 +GetCaughtName: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH @@ -154,9 +144,8 @@ GetCaughtName: ; 4f176 ld bc, MON_NAME_LENGTH call CopyBytes ret -; 4f18c -GetCaughtLevel: ; 4f18c +GetCaughtLevel: ld a, "@" ld hl, wSeerCaughtLevelString ld bc, 4 @@ -185,13 +174,11 @@ GetCaughtLevel: ; 4f18c ld bc, 4 call CopyBytes ret -; 4f1c1 -.unknown_level ; 4f1c1 +.unknown_level db "???@" -; 4f1c5 -GetCaughtTime: ; 4f1c5 +GetCaughtTime: ld a, [wSeerCaughtData] and CAUGHT_TIME_MASK jr z, .none @@ -212,26 +199,22 @@ GetCaughtTime: ; 4f1c5 ld de, wSeerTimeOfDay call UnknownCaughtData ret -; 4f1e6 -.times ; 4f1e6 +.times db "Morning@" db "Day@" db "Night@" -; 4f1f8 -UnknownCaughtData: ; 4f1f8 +UnknownCaughtData: ld hl, .unknown ld bc, NAME_LENGTH call CopyBytes ret -; 4f202 -.unknown ; 4f202 +.unknown db "Unknown@" -; 4f20a -GetCaughtLocation: ; 4f20a +GetCaughtLocation: ld a, [wSeerCaughtGender] and CAUGHT_LOCATION_MASK jr z, .Unknown @@ -263,9 +246,8 @@ GetCaughtLocation: ; 4f20a ld [wSeerAction], a scf ret -; 4f242 -GetCaughtOT: ; 4f242 +GetCaughtOT: ld a, [wCurPartyMon] ld hl, wPartyMonOT ld bc, NAME_LENGTH @@ -286,15 +268,13 @@ GetCaughtOT: ; 4f242 ld a, "@" ld [de], a ret -; 4f26b -.male ; 4f26b +.male db "@" -.female ; 4f26c +.female db "@" -; 4f26d -PrintSeerText: ; 4f26d +PrintSeerText: ld e, a ld d, 0 ld hl, SeerTexts @@ -305,9 +285,8 @@ PrintSeerText: ; 4f26d ld l, a call PrintText ret -; 4f27c -SeerTexts: ; 4f27c +SeerTexts: dw SeerIntroText dw SeerCantTellText dw SeerMetAtText @@ -316,58 +295,48 @@ SeerTexts: ; 4f27c dw SeerCancelText dw SeerEggText dw SeerLevelOnlyText -; 4f28c -SeerIntroText: ; 0x4f28c +SeerIntroText: ; I see all. I know all… Certainly, I know of your #MON! text_jump UnknownText_0x1c475f db "@" -; 0x4f291 -SeerCantTellText: ; 0x4f291 +SeerCantTellText: ; Whaaaat? I can't tell a thing! How could I not know of this? text_jump UnknownText_0x1c4797 db "@" -; 0x4f296 -SeerMetAtText: ; 0x4f296 +SeerMetAtText: ; Hm… I see you met @ here: @ ! text_jump UnknownText_0x1c47d4 db "@" -; 0x4f29b -SeerTimeLevelText: ; 0x4f29b +SeerTimeLevelText: ; The time was @ ! Its level was @ ! Am I good or what? text_jump UnknownText_0x1c47fa db "@" -; 0x4f2a0 -SeerTradedText: ; 0x4f2a0 +SeerTradedText: ; Hm… @ came from @ in a trade? @ was where @ met @ ! text_jump UnknownText_0x1c4837 db "@" -; 0x4f2a5 -SeerLevelOnlyText: ; 0x4f2a5 +SeerLevelOnlyText: ; What!? Incredible! I don't understand how, but it is incredible! You are special. I can't tell where you met it, but it was at level @ . Am I good or what? text_jump UnknownText_0x1c487f db "@" -; 0x4f2aa -SeerEggText: ; 0x4f2aa +SeerEggText: ; Hey! That's an EGG! You can't say that you've met it yet… text_jump UnknownText_0x1c491d db "@" -; 0x4f2af -SeerCancelText: ; 0x4f2af +SeerCancelText: ; Fufufu! I saw that you'd do nothing! text_jump UnknownText_0x1c4955 db "@" -; 0x4f2b4 - -SeerAdvice: ; 4f2b4 +SeerAdvice: ld a, MON_LEVEL call GetPartyParamLocation ld a, [wSeerCaughtLevel] @@ -392,9 +361,8 @@ SeerAdvice: ; 4f2b4 ld l, a call PrintText ret -; 4f2d6 -SeerAdviceTexts: ; 4f2d6 +SeerAdviceTexts: ; level, text dbw 9, SeerAdvice1 dbw 29, SeerAdvice2 @@ -402,40 +370,33 @@ SeerAdviceTexts: ; 4f2d6 dbw 89, SeerAdvice4 dbw 100, SeerAdvice5 dbw 255, SeerAdvice1 -; 4f2e8 -SeerAdvice1: ; 0x4f2e8 +SeerAdvice1: ; Incidentally… It would be wise to raise your #MON with a little more care. text_jump UnknownText_0x1c497a db "@" -; 0x4f2ed -SeerAdvice2: ; 0x4f2ed +SeerAdvice2: ; Incidentally… It seems to have grown a little. @ seems to be becoming more confident. text_jump UnknownText_0x1c49c6 db "@" -; 0x4f2f2 -SeerAdvice3: ; 0x4f2f2 +SeerAdvice3: ; Incidentally… @ has grown. It's gained much strength. text_jump UnknownText_0x1c4a21 db "@" -; 0x4f2f7 -SeerAdvice4: ; 0x4f2f7 +SeerAdvice4: ; Incidentally… It certainly has grown mighty! This @ must have come through numerous #MON battles. It looks brimming with confidence. text_jump UnknownText_0x1c4a5b db "@" -; 0x4f2fc -SeerAdvice5: ; 0x4f2fc +SeerAdvice5: ; Incidentally… I'm impressed by your dedication. It's been a long time since I've seen a #MON as mighty as this @ . I'm sure that seeing @ in battle would excite anyone. text_jump UnknownText_0x1c4ae5 db "@" -; 0x4f301 - -GetCaughtGender: ; 4f301 +GetCaughtGender: ld hl, MON_CAUGHTGENDER add hl, bc @@ -458,4 +419,3 @@ GetCaughtGender: ; 4f301 .genderless ld c, CAUGHT_BY_UNKNOWN ret -; 4f31c diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 42284aeab..f1a593b5a 100644 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -1,4 +1,4 @@ -PokemonCenterPC: ; 1559a +PokemonCenterPC: call PC_CheckPartyForPokemon ret c call PC_PlayBootSound @@ -39,12 +39,19 @@ PokemonCenterPC: ; 1559a dw PlaceNthMenuStrings dw .JumpTable +PCPC_PLAYERS_PC EQU 0 +PCPC_BILLS_PC EQU 1 +PCPC_OAKS_PC EQU 2 +PCPC_HALL_OF_FAME EQU 3 +PCPC_TURN_OFF EQU 4 + .JumpTable: - dw PlayersPC, .String_PlayersPC - dw BillsPC, .String_BillsPC - dw OaksPC, .String_OaksPC +; entries correspond to PCPC_* constants + dw PlayersPC, .String_PlayersPC + dw BillsPC, .String_BillsPC + dw OaksPC, .String_OaksPC dw HallOfFamePC, .String_HallOfFame - dw TurnOffPC, .String_TurnOff + dw TurnOffPC, .String_TurnOff .String_PlayersPC: db "<PLAYER>'s PC@" .String_BillsPC: db "BILL's PC@" @@ -53,37 +60,45 @@ PokemonCenterPC: ; 1559a .String_TurnOff: db "TURN OFF@" .WhichPC: - ; before pokedex - db 3 ; items - db 1, 0, 4 ; bill's, player's, turn off - db -1 + ; before Pokédex + db 3 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_TURN_OFF + db -1 ; end ; before Hall Of Fame - db 4 ; items - db 1, 0, 2, 4 ; bill's, player's, oak's, turn off - db -1 + db 4 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_OAKS_PC + db PCPC_TURN_OFF + db -1 ; end ; postgame - db 5 ; items - db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off - db -1 + db 5 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_OAKS_PC + db PCPC_HALL_OF_FAME + db PCPC_TURN_OFF + db -1 ; end .ChooseWhichPCListToUse: call CheckReceivedDex jr nz, .got_dex - ld a, $0 + ld a, 0 ; before Pokédex ret .got_dex ld a, [wHallOfFameCount] and a - ld a, $1 + ld a, 1 ; before Hall Of Fame ret z - ld a, $2 + ld a, 2 ; postgame ret -; 15650 -PC_CheckPartyForPokemon: ; 15650 +PC_CheckPartyForPokemon: ld a, [wPartyCount] and a ret nz @@ -98,18 +113,16 @@ PC_CheckPartyForPokemon: ; 15650 ; Bzzzzt! You must have a #MON to use this! text_jump UnknownText_0x1c1328 db "@" -; 0x15668 -BillsPC: ; 15668 +BillsPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedBillsPC call PC_DisplayText farcall _BillsPC and a ret -; 15679 (5:5679) -PlayersPC: ; 15679 +PlayersPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedOwnPC call PC_DisplayText @@ -117,61 +130,56 @@ PlayersPC: ; 15679 call _PlayersPC and a ret -; 15689 -OaksPC: ; 15689 +OaksPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedOaksPC call PC_DisplayText farcall ProfOaksPC and a ret -; 1569a -HallOfFamePC: ; 1569a +HallOfFamePC: call PC_PlayChoosePCSound call FadeToMenu farcall _HallOfFamePC call CloseSubmenu and a ret -; 156ab -TurnOffPC: ; 156ab +TurnOffPC: ld hl, PokecenterPCText_LinkClosed call PrintText scf ret -; 156b3 -PC_PlayBootSound: ; 156b3 +PC_PlayBootSound: ld de, SFX_BOOT_PC jr PC_WaitPlaySFX -PC_PlayShutdownSound: ; 156b8 +PC_PlayShutdownSound: ld de, SFX_SHUT_DOWN_PC call PC_WaitPlaySFX call WaitSFX ret -PC_PlayChoosePCSound: ; 156c2 +PC_PlayChoosePCSound: ld de, SFX_CHOOSE_PC_OPTION jr PC_WaitPlaySFX -PC_PlaySwapItemsSound: ; 156c7 +PC_PlaySwapItemsSound: ld de, SFX_SWITCH_POKEMON call PC_WaitPlaySFX ld de, SFX_SWITCH_POKEMON -PC_WaitPlaySFX: ; 156d0 +PC_WaitPlaySFX: push de call WaitSFX pop de call PlaySFX ret -; 156d9 -_PlayersHousePC: ; 156d9 +_PlayersHousePC: call PC_PlayBootSound ld hl, UnknownText_0x156ff call PC_DisplayText @@ -190,15 +198,13 @@ _PlayersHousePC: ; 156d9 call ClearBGPalettes ld c, $1 ret -; 156ff -UnknownText_0x156ff: ; 0x156ff +UnknownText_0x156ff: ; turned on the PC. text_jump UnknownText_0x1c1353 db "@" -; 0x15704 -_PlayersPC: ; 15704 +_PlayersPC: ld a, b ld [wWhichIndexSet], a ld hl, UnknownText_0x157cc @@ -206,9 +212,8 @@ _PlayersPC: ; 15704 call Function15715 call ExitMenu ret -; 15715 -Function15715: ; 15715 +Function15715: xor a ld [wPCItemsCursor], a ld [wPCItemsScrollPosition], a @@ -228,9 +233,8 @@ Function15715: ; 15715 .asm_15732 call ExitMenu ret -; 15736 -PlayersPCMenuData: ; 0x15736 +PlayersPCMenuData: db MENU_BACKUP_TILES ; flags db 0, 0 ; top left corner coords (y, x) db 12, 15 ; bottom right corner coords (y, x) @@ -244,7 +248,16 @@ PlayersPCMenuData: ; 0x15736 dw PlaceNthMenuStrings dw .PlayersPCMenuPointers -.PlayersPCMenuPointers: ; 0x15746 +PLAYERSPC_WITHDRAW_ITEM EQU 0 +PLAYERSPC_DEPOSIT_ITEM EQU 1 +PLAYERSPC_TOSS_ITEM EQU 2 +PLAYERSPC_MAIL_BOX EQU 3 +PLAYERSPC_DECORATION EQU 4 +PLAYERSPC_TURN_OFF EQU 5 +PLAYERSPC_LOG_OFF EQU 6 + +.PlayersPCMenuPointers: +; entries correspond to PLAYERSPC_* constants dw PlayerWithdrawItemMenu, .WithdrawItem dw PlayerDepositItemMenu, .DepositItem dw PlayerTossItemMenu, .TossItem @@ -261,34 +274,26 @@ PlayersPCMenuData: ; 0x15736 .TurnOff: db "TURN OFF@" .LogOff: db "LOG OFF@" -WITHDRAW_ITEM EQU 0 -DEPOSIT_ITEM EQU 1 -TOSS_ITEM EQU 2 -MAIL_BOX EQU 3 -DECORATION EQU 4 -TURN_OFF EQU 5 -LOG_OFF EQU 6 - .PlayersPCMenuList1: db 5 - db WITHDRAW_ITEM - db DEPOSIT_ITEM - db TOSS_ITEM - db MAIL_BOX - db TURN_OFF - db -1 + db PLAYERSPC_WITHDRAW_ITEM + db PLAYERSPC_DEPOSIT_ITEM + db PLAYERSPC_TOSS_ITEM + db PLAYERSPC_MAIL_BOX + db PLAYERSPC_TURN_OFF + db -1 ; end .PlayersPCMenuList2: db 6 - db WITHDRAW_ITEM - db DEPOSIT_ITEM - db TOSS_ITEM - db MAIL_BOX - db DECORATION - db LOG_OFF - db -1 - -PC_DisplayTextWaitMenu: ; 157bb + db PLAYERSPC_WITHDRAW_ITEM + db PLAYERSPC_DEPOSIT_ITEM + db PLAYERSPC_TOSS_ITEM + db PLAYERSPC_MAIL_BOX + db PLAYERSPC_DECORATION + db PLAYERSPC_LOG_OFF + db -1 ; end + +PC_DisplayTextWaitMenu: ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -297,15 +302,13 @@ PC_DisplayTextWaitMenu: ; 157bb pop af ld [wOptions], a ret -; 157cc -UnknownText_0x157cc: ; 0x157cc +UnknownText_0x157cc: ; What do you want to do? text_jump UnknownText_0x1c1368 db "@" -; 0x157d1 -PlayerWithdrawItemMenu: ; 0x157d1 +PlayerWithdrawItemMenu: call LoadStandardMenuHeader farcall ClearPCItemScreen .loop @@ -369,19 +372,19 @@ PlayerWithdrawItemMenu: ; 0x157d1 .done ret -.HowManyText: ; 0x15850 +.HowManyText: text_jump _PlayersPCHowManyWithdrawText db "@" -.WithdrewText: ; 0x15855 +.WithdrewText: text_jump _PlayersPCWithdrewItemsText db "@" -.NoRoomText: ; 0x1585a +.NoRoomText: text_jump _PlayersPCNoRoomWithdrawText db "@" -PlayerTossItemMenu: ; 0x1585f +PlayerTossItemMenu: call LoadStandardMenuHeader farcall ClearPCItemScreen .loop @@ -395,24 +398,21 @@ PlayerTossItemMenu: ; 0x1585f call CloseSubmenu xor a ret -; 0x1587d -PlayerDecorationMenu: ; 0x1587d +PlayerDecorationMenu: farcall _PlayerDecorationMenu ld a, c and a ret z scf ret -; 0x15888 -PlayerLogOffMenu: ; 0x15888 +PlayerLogOffMenu: xor a scf ret -; 0x1588b -PlayerDepositItemMenu: ; 0x1588b +PlayerDepositItemMenu: call .CheckItemsInBag jr c, .nope call DisableSpriteUpdates @@ -461,13 +461,14 @@ PlayerDepositItemMenu: ; 0x1588b ret .dw - dw .tossable +; entries correspond to ITEMMENU_* constants + dw .tossable ; ITEMMENU_NOUSE dw .no_toss dw .no_toss dw .no_toss - dw .tossable - dw .tossable - dw .tossable + dw .tossable ; ITEMMENU_CURRENT + dw .tossable ; ITEMMENU_PARTY + dw .tossable ; ITEMMENU_CLOSE .no_toss ret @@ -531,25 +532,24 @@ PlayerDepositItemMenu: ; 0x1588b and a ret -.HowManyText: ; 0x1596e +.HowManyText: text_jump _PlayersPCHowManyDepositText db "@" -.DepositText: ; 0x15973 +.DepositText: text_jump _PlayersPCDepositItemsText db "@" -.NoRoomText: ; 0x15978 +.NoRoomText: text_jump _PlayersPCNoRoomDepositText db "@" -PlayerMailBoxMenu: ; 0x1597d +PlayerMailBoxMenu: farcall _PlayerMailBoxMenu xor a ret -; 0x15985 -PCItemsJoypad: ; 0x15985 +PCItemsJoypad: xor a ld [wSwitchItem], a .loop @@ -633,44 +633,37 @@ PCItemsJoypad: ; 0x15985 dba PlaceMenuItemQuantity dba UpdateItemDescription -PC_DisplayText: ; 15a20 +PC_DisplayText: call MenuTextBox call ExitMenu ret -; 15a27 -PokecenterPCText_BootedUpPC: ; 0x15a27 +PokecenterPCText_BootedUpPC: ; turned on the PC. text_jump UnknownText_0x1c144d db "@" -; 0x15a2c -PokecenterPCText_AccessWhosePC: ; 0x15a2c +PokecenterPCText_AccessWhosePC: ; Access whose PC? text_jump UnknownText_0x1c1462 db "@" -; 0x15a31 -PokecenterPCText_AccessedBillsPC: ; 0x15a31 +PokecenterPCText_AccessedBillsPC: ; BILL's PC accessed. #MON Storage System opened. text_jump UnknownText_0x1c1474 db "@" -; 0x15a36 -PokecenterPCText_AccessedOwnPC: ; 0x15a36 +PokecenterPCText_AccessedOwnPC: ; Accessed own PC. Item Storage System opened. text_jump UnknownText_0x1c14a4 db "@" -; 0x15a3b -PokecenterPCText_AccessedOaksPC: ; 0x15a3b +PokecenterPCText_AccessedOaksPC: ; PROF.OAK's PC accessed. #DEX Rating System opened. text_jump UnknownText_0x1c14d2 db "@" -; 0x15a40 -PokecenterPCText_LinkClosed: ; 0x15a40 +PokecenterPCText_LinkClosed: ; … Link closed… text_jump UnknownText_0x1c1505 db "@" -; 0x15a45 diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index e11c45f9b..10ca4280b 100644 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -1,4 +1,4 @@ -Pokepic:: ; 244e3 +Pokepic:: ld hl, PokepicMenuHeader call CopyMenuHeader call MenuBox @@ -27,7 +27,7 @@ Pokepic:: ; 244e3 call WaitBGMap ret -ClosePokepic:: ; 24528 +ClosePokepic:: ld hl, PokepicMenuHeader call CopyMenuHeader call ClearMenuBoxInterior @@ -41,7 +41,7 @@ ClosePokepic:: ; 24528 call LoadStandardFont ret -PokepicMenuHeader: ; 0x24547 +PokepicMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 4, 14, 13 dw NULL diff --git a/engine/events/pokerus/apply_pokerus_tick.asm b/engine/events/pokerus/apply_pokerus_tick.asm index e632fbfe4..223fe0147 100644 --- a/engine/events/pokerus/apply_pokerus_tick.asm +++ b/engine/events/pokerus/apply_pokerus_tick.asm @@ -1,4 +1,4 @@ -ApplyPokerusTick: ; 13988 +ApplyPokerusTick: ; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured. ld hl, wPartyMon1PokerusStatus ; wPartyMon1 + MON_PKRS ld a, [wPartyCount] diff --git a/engine/events/pokerus/check_pokerus.asm b/engine/events/pokerus/check_pokerus.asm index c739c59c5..201a37130 100644 --- a/engine/events/pokerus/check_pokerus.asm +++ b/engine/events/pokerus/check_pokerus.asm @@ -1,4 +1,4 @@ -_CheckPokerus: ; 4d860 +_CheckPokerus: ; Return carry if a monster in your party has Pokerus ; Get number of monsters to iterate over diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm index 5728cb181..a6764e3b5 100644 --- a/engine/events/pokerus/pokerus.asm +++ b/engine/events/pokerus/pokerus.asm @@ -1,4 +1,4 @@ -GivePokerusAndConvertBerries: ; 2ed44 +GivePokerusAndConvertBerries: call ConvertBerriesToBerryJuice ld hl, wPartyMon1PokerusStatus ld a, [wPartyCount] @@ -121,7 +121,7 @@ GivePokerusAndConvertBerries: ; 2ed44 ld [hl], a ret -ConvertBerriesToBerryJuice: ; 2ede6 +ConvertBerriesToBerryJuice: ; If we haven't been to Goldenrod City at least once, ; prevent Shuckle from turning held Berry into Berry Juice. ld hl, wStatusFlags2 diff --git a/engine/events/print_photo.asm b/engine/events/print_photo.asm index d8350a530..cb29693af 100644 --- a/engine/events/print_photo.asm +++ b/engine/events/print_photo.asm @@ -1,4 +1,4 @@ -PhotoStudio: ; 16dc7 +PhotoStudio: ld hl, .Text_AskWhichMon call PrintText farcall SelectMonFromParty @@ -28,34 +28,28 @@ PhotoStudio: ; 16dc7 .print_text call PrintText ret -; 16e04 -.Text_AskWhichMon: ; 0x16e04 +.Text_AskWhichMon: ; Which #MON should I photo- graph? text_jump UnknownText_0x1be024 db "@" -; 0x16e09 -.Text_HoldStill: ; 0x16e09 +.Text_HoldStill: ; All righty. Hold still for a bit. text_jump UnknownText_0x1be047 db "@" -; 0x16e0e -.Text_Presto: ; 0x16e0e +.Text_Presto: ; Presto! All done. Come again, OK? text_jump UnknownText_0x1be06a db "@" -; 0x16e13 -.Text_NoPicture: ; 0x16e13 +.Text_NoPicture: ; Oh, no picture? Come again, OK? text_jump UnknownText_0x1c0000 db "@" -; 0x16e18 -.Text_Egg: ; 0x16e18 +.Text_Egg: ; An EGG? My talent is worth more… text_jump UnknownText_0x1c0021 db "@" -; 0x16e1d diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index f8fa52af3..9e231f449 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -1,4 +1,7 @@ -_UnownPrinter: ; 16be4 +UNOWNSTAMP_BOLD_A EQUS "\"♂\"" ; $ef +UNOWNSTAMP_BOLD_B EQUS "\"♀\"" ; $f5 + +_UnownPrinter: ld a, [wUnownDex] and a ret z @@ -15,12 +18,12 @@ _UnownPrinter: ; 16be4 call ClearTileMap ld de, UnownDexATile - ld hl, vTiles1 tile $6f + ld hl, vTiles0 tile UNOWNSTAMP_BOLD_A lb bc, BANK(UnownDexBTile), 1 call Request1bpp ld de, UnownDexBTile - ld hl, vTiles1 tile $75 + ld hl, vTiles0 tile UNOWNSTAMP_BOLD_B lb bc, BANK(UnownDexBTile), 1 call Request1bpp @@ -94,9 +97,8 @@ _UnownPrinter: ; 16be4 ld [hInMenu], a call ReturnToMapFromSubmenu ret -; 16ca0 -.LeftRight: ; 16ca0 +.LeftRight: ld a, [hJoyLast] and D_RIGHT jr nz, .press_right @@ -127,9 +129,8 @@ _UnownPrinter: ; 16be4 .return call .UpdateUnownFrontpic ret -; 16cc8 -.UpdateUnownFrontpic: ; 16cc8 +.UpdateUnownFrontpic: ld a, [wJumptableIndex] cp 26 jr z, .vacant @@ -151,7 +152,7 @@ _UnownPrinter: ; 16be4 farcall RotateUnownFrontpic ret -.Load2bppToSRAM: ; 16cff +.Load2bppToSRAM: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -194,7 +195,6 @@ _UnownPrinter: ; 16be4 ld c, 20 call DelayFrames ret -; 16d57 AlphRuinsStampString: db " ALPH RUINS STAMP@" @@ -203,23 +203,21 @@ UnownDexDoWhatString: db "Do what?@" UnownDexMenuString: - db "♂ PRINT" - next "♀ CANCEL" + db UNOWNSTAMP_BOLD_A, " PRINT" + next UNOWNSTAMP_BOLD_B, " CANCEL" next "← PREVIOUS" next "→ NEXT" db "@" UnownDexVacantString: db "VACANT@" -; 16d9c -UnownDexATile: ; 16d9c +UnownDexATile: INCBIN "gfx/printer/bold_a.1bpp" -UnownDexBTile: ; 16da4 +UnownDexBTile: INCBIN "gfx/printer/bold_b.1bpp" -; 16dac -PlaceUnownPrinterFrontpic: ; 16dac +PlaceUnownPrinterFrontpic: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " @@ -230,4 +228,3 @@ PlaceUnownPrinterFrontpic: ; 16dac lb bc, 7, 7 predef PlaceGraphic ret -; 16dc7 diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index a2c1f47e3..02f3fadd9 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -1,4 +1,4 @@ -RotateUnownFrontpic: ; e0000 +RotateUnownFrontpic: ; something to do with Unown printer push de xor a ; sScratch @@ -43,7 +43,7 @@ RotateUnownFrontpic: ; e0000 call CloseSRAM ret -.Copy: ; e004e +.Copy: ld c, $10 .loop_copy ld a, [hli] @@ -53,7 +53,7 @@ RotateUnownFrontpic: ; e0000 jr nz, .loop_copy ret -.Rotate: ; e0057 +.Rotate: ld hl, wd012 ld e, %10000000 ld d, 8 @@ -75,7 +75,7 @@ RotateUnownFrontpic: ; e0000 jr nz, .loop_decompress ret -.CountSetBit: ; e0078 +.CountSetBit: ld b, 0 ld c, 8 .loop_count @@ -107,5 +107,5 @@ y = y + 1 endr ENDM -UnownPrinter_GBPrinterRectangle: ; e008b +UnownPrinter_GBPrinterRectangle: gbprinterrect 7, 7 diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index b80efe75b..df55394aa 100644 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -1,4 +1,4 @@ -ProfOaksPC: ; 0x265d3 +ProfOaksPC: ld hl, OakPCText1 call MenuTextBox call YesNoBox @@ -11,7 +11,7 @@ ProfOaksPC: ; 0x265d3 call ExitMenu ret -ProfOaksPCBoot ; 0x265ee +ProfOaksPCBoot: ld hl, OakPCText2 call PrintText call Rate @@ -20,7 +20,7 @@ ProfOaksPCBoot ; 0x265ee call WaitSFX ret -ProfOaksPCRating: ; 0x26601 +ProfOaksPCRating: call Rate push de ld de, MUSIC_NONE @@ -31,7 +31,7 @@ ProfOaksPCRating: ; 0x26601 call WaitSFX ret -Rate: ; 0x26616 +Rate: ; calculate Seen/Owned ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen @@ -55,7 +55,7 @@ Rate: ; 0x26616 pop de ret -.UpdateRatingBuffers: ; 0x26647 +.UpdateRatingBuffers: ld hl, wStringBuffer3 ld de, wd002 call .UpdateRatingBuffer @@ -64,7 +64,7 @@ Rate: ; 0x26616 call .UpdateRatingBuffer ret -.UpdateRatingBuffer: ; 0x2665a +.UpdateRatingBuffer: push hl ld a, "@" ld bc, ITEM_NAME_LENGTH @@ -74,7 +74,7 @@ Rate: ; 0x26616 call PrintNum ret -FindOakRating: ; 0x2666b +FindOakRating: ; return sound effect in de ; return text pointer in hl nop @@ -100,15 +100,15 @@ endr INCLUDE "data/events/pokedex_ratings.asm" -OakPCText1: ; 0x266de +OakPCText1: text_jump _OakPCText1 db "@" -OakPCText2: ; 0x266e3 +OakPCText2: text_jump _OakPCText2 db "@" -OakPCText3: ; 0x266e8 +OakPCText3: text_jump _OakPCText3 db "@" @@ -188,6 +188,6 @@ OakRating19: text_jump _OakRating19 db "@" -OakPCText4: ; 0x2674c +OakPCText4: text_jump _OakPCText4 db "@" diff --git a/engine/events/sacred_ash.asm b/engine/events/sacred_ash.asm index 2cb5e37a1..32f24253c 100644 --- a/engine/events/sacred_ash.asm +++ b/engine/events/sacred_ash.asm @@ -1,5 +1,5 @@ -_SacredAsh: ; 507e6 +_SacredAsh: ld a, $0 ld [wItemEffectSucceeded], a call CheckAnyFaintedMon @@ -10,9 +10,8 @@ _SacredAsh: ; 507e6 ld a, $1 ld [wItemEffectSucceeded], a ret -; 507fb -CheckAnyFaintedMon: ; 507fb +CheckAnyFaintedMon: ld de, PARTYMON_STRUCT_LENGTH ld bc, wPartySpecies ld hl, wPartyMon1HP @@ -46,9 +45,8 @@ CheckAnyFaintedMon: ; 507fb pop af scf ret -; 50821 -SacredAshScript: ; 0x50821 +SacredAshScript: special HealParty reloadmappart playsound SFX_WARP_TO @@ -65,10 +63,8 @@ SacredAshScript: ; 0x50821 waitbutton closetext end -; 0x50845 -UnknownText_0x50845: ; 0x50845 +UnknownText_0x50845: ; 's #MON were all healed! text_jump UnknownText_0x1c0b65 db "@" -; 0x5084a diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index 99fcd7924..c6d909afe 100644 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -1,7 +1,6 @@ MANIA_OT_ID EQU 00518 -GiveShuckle: ; 7305 - +GiveShuckle: ; Adding to the party. xor a ld [wMonType], a @@ -71,7 +70,7 @@ SpecialShuckleOT: SpecialShuckleNick: db "SHUCKIE@" -ReturnShuckle: ; 737e +ReturnShuckle: farcall SelectMonFromParty jr c, .refused diff --git a/engine/events/specials.asm b/engine/events/specials.asm index acfc3c450..35d32dde6 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -1,4 +1,4 @@ -Special:: ; c01b +Special:: ; Run script special de. ld hl, SpecialsPointers add hl, de @@ -12,22 +12,19 @@ Special:: ; c01b ld a, b rst FarCall ret -; c029 INCLUDE "data/special_pointers.asm" -DummySpecial_c224: ; c224 +DummySpecial_c224: ret -; c225 -SetPlayerPalette: ; c225 +SetPlayerPalette: ld a, [wScriptVar] ld d, a farcall _SetPlayerPalette ret -; c230 -GameCornerPrizeMonCheckDex: ; c230 +GameCornerPrizeMonCheckDex: ld a, [wScriptVar] dec a call CheckCaughtMon @@ -41,104 +38,95 @@ GameCornerPrizeMonCheckDex: ; c230 farcall NewPokedexEntry call ExitAllMenus ret -; c252 -UnusedSetSeenMon: ; c252 +UnusedSetSeenMon: ld a, [wScriptVar] dec a call SetSeenMon ret -; c25a -FindPartyMonAboveLevel: ; c25a +FindPartyMonAboveLevel: ld a, [wScriptVar] ld b, a farcall _FindPartyMonAboveLevel jr z, FoundNone jr FoundOne -FindPartyMonAtLeastThatHappy: ; c268 +FindPartyMonAtLeastThatHappy: ld a, [wScriptVar] ld b, a farcall _FindPartyMonAtLeastThatHappy jr z, FoundNone jr FoundOne -FindPartyMonThatSpecies: ; c276 +FindPartyMonThatSpecies: ld a, [wScriptVar] ld b, a farcall _FindPartyMonThatSpecies jr z, FoundNone jr FoundOne -FindPartyMonThatSpeciesYourTrainerID: ; c284 +FindPartyMonThatSpeciesYourTrainerID: ld a, [wScriptVar] ld b, a farcall _FindPartyMonThatSpeciesYourTrainerID jr z, FoundNone jr FoundOne -FoundOne: ; c292 +FoundOne: ld a, TRUE ld [wScriptVar], a ret -FoundNone: ; c298 +FoundNone: xor a ld [wScriptVar], a ret -; c29d -NameRival: ; 0xc29d +NameRival: ld b, $2 ; rival ld de, wRivalName farcall _NamingScreen ; default to "SILVER" ld hl, wRivalName - ld de, DefaultRivalName + ld de, .default call InitName ret -; 0xc2b2 -DefaultRivalName: ; 0xc2b2 +.default db "SILVER@" -NameRater: ; c2b9 +NameRater: farcall _NameRater ret -; c2c0 -OverworldTownMap: ; c2c0 +OverworldTownMap: call FadeToMenu farcall _TownMap call ExitAllMenus ret -; c2cd -UnownPrinter: ; c2cd +UnownPrinter: call FadeToMenu farcall _UnownPrinter call ExitAllMenus ret -; c2da -DisplayLinkRecord: ; c2da +DisplayLinkRecord: call FadeToMenu farcall _DisplayLinkRecord call ExitAllMenus ret -; c2e7 -PlayersHousePC: ; c2e7 +PlayersHousePC: xor a ld [wScriptVar], a farcall _PlayersHousePC ld a, c ld [wScriptVar], a ret -; c2f6 -CheckMysteryGift: ; c2f6 +CheckMysteryGift: ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] @@ -150,9 +138,8 @@ CheckMysteryGift: ; c2f6 ld [wScriptVar], a call CloseSRAM ret -; c309 -GetMysteryGiftItem: ; c309 +GetMysteryGiftItem: ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] @@ -179,65 +166,57 @@ GetMysteryGiftItem: ; c309 xor a ld [wScriptVar], a ret -; c345 -.ReceiveItemText: ; 0xc345 +.ReceiveItemText: ; received item text_jump UnknownText_0x1bd3be db "@" -; 0xc34a -BugContestJudging: ; c34a +BugContestJudging: farcall _BugContestJudging ld a, b ld [wScriptVar], a ret -; c355 -MapRadio: ; c355 +MapRadio: ld a, [wScriptVar] ld e, a farcall PlayRadio ret -; c360 -UnownPuzzle: ; c360 +UnownPuzzle: call FadeToMenu farcall _UnownPuzzle ld a, [wSolvedUnownPuzzle] ld [wScriptVar], a call ExitAllMenus ret -; c373 -SlotMachine: ; c373 +SlotMachine: call CheckCoinsAndCoinCase ret c ld a, BANK(_SlotMachine) ld hl, _SlotMachine call StartGameCornerGame ret -; c380 -CardFlip: ; c380 +CardFlip: call CheckCoinsAndCoinCase ret c ld a, BANK(_CardFlip) ld hl, _CardFlip call StartGameCornerGame ret -; c38d -DummyNonfunctionalGameCornerGame: ; c38d +DummyNonfunctionalGameCornerGame: call CheckCoinsAndCoinCase ret c ld a, BANK(_DummyGame) ld hl, _DummyGame call StartGameCornerGame ret -; c39a -StartGameCornerGame: ; c39a +StartGameCornerGame: call FarQueueScript call FadeToMenu ld hl, wQueuedScriptBank @@ -250,9 +229,8 @@ StartGameCornerGame: ; c39a rst FarCall call ExitAllMenus ret -; c3ae -CheckCoinsAndCoinCase: ; c3ae +CheckCoinsAndCoinCase: ld hl, wCoins ld a, [hli] or [hl] @@ -276,27 +254,23 @@ CheckCoinsAndCoinCase: ; c3ae call PrintText scf ret -; c3d1 -.NoCoinsText: ; 0xc3d1 +.NoCoinsText: ; You have no coins. text_jump UnknownText_0x1bd3d7 db "@" -; 0xc3d6 -.NoCoinCaseText: ; 0xc3d6 +.NoCoinCaseText: ; You don't have a COIN CASE. text_jump UnknownText_0x1bd3eb db "@" -; 0xc3db -ClearBGPalettesBufferScreen: ; c3db +ClearBGPalettesBufferScreen: call ClearBGPalettes call BufferScreen ret -; c3e2 -ScriptReturnCarry: ; c3e2 +ScriptReturnCarry: jr c, .carry xor a ld [wScriptVar], a @@ -305,23 +279,19 @@ ScriptReturnCarry: ; c3e2 ld a, 1 ld [wScriptVar], a ret -; c3ef -UnusedCheckUnusedTwoDayTimer: ; c3ef +UnusedCheckUnusedTwoDayTimer: farcall CheckUnusedTwoDayTimer ld a, [wUnusedTwoDayTimer] ld [wScriptVar], a ret -; c3fc -ActivateFishingSwarm: ; c3fc +ActivateFishingSwarm: ld a, [wScriptVar] ld [wFishingSwarmFlag], a ret -; c403 - -StoreSwarmMapIndices:: ; c403 +StoreSwarmMapIndices:: ld a, c and a jr nz, .yanma @@ -338,29 +308,24 @@ StoreSwarmMapIndices:: ; c403 ld a, e ld [wYanmaMapNumber], a ret -; c419 - -CheckPokerus: ; c419 +CheckPokerus: ; Check if a monster in your party has Pokerus farcall _CheckPokerus jp ScriptReturnCarry -; c422 -ResetLuckyNumberShowFlag: ; c422 +ResetLuckyNumberShowFlag: farcall RestartLuckyNumberCountdown ld hl, wLuckyNumberShowFlag res LUCKYNUMBERSHOW_GAME_OVER_F, [hl] farcall LoadOrRegenerateLuckyIDNumber ret -; c434 -CheckLuckyNumberShowFlag: ; c434 +CheckLuckyNumberShowFlag: farcall _CheckLuckyNumberShowFlag jp ScriptReturnCarry -; c43d -SnorlaxAwake: ; 0xc43d +SnorlaxAwake: ; Check if the Poké Flute channel is playing, and if the player is standing ; next to Snorlax. @@ -410,14 +375,11 @@ SnorlaxAwake: ; 0xc43d db 36, 9 ; right db -1 - -PlayCurMonCry: ; c472 +PlayCurMonCry: ld a, [wCurPartySpecies] jp PlayMonCry -; c478 - -GameboyCheck: ; c478 +GameboyCheck: ld a, [hCGB] and a jr nz, .cgb @@ -438,8 +400,7 @@ GameboyCheck: ; c478 ld [wScriptVar], a ret - -FadeOutMusic: ; c48f +FadeOutMusic: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -447,23 +408,20 @@ FadeOutMusic: ; c48f ld a, $2 ld [wMusicFade], a ret -; c49f -Diploma: ; c49f +Diploma: call FadeToMenu farcall _Diploma call ExitAllMenus ret -; c4ac -PrintDiploma: ; c4ac +PrintDiploma: call FadeToMenu farcall _PrintDiploma call ExitAllMenus ret -; c4b9 -TrainerHouse: ; 0xc4b9 +TrainerHouse: ld a, BANK(sMysteryGiftTrainerHouseFlag) call GetSRAMBank ld a, [sMysteryGiftTrainerHouseFlag] diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm index f6ab00951..74fd4d991 100644 --- a/engine/events/squirtbottle.asm +++ b/engine/events/squirtbottle.asm @@ -1,4 +1,4 @@ -_Squirtbottle: ; 50730 +_Squirtbottle: ld hl, .SquirtbottleScript call QueueScript ld a, $1 @@ -44,4 +44,3 @@ _Squirtbottle: ; 50730 xor a ld [wScriptVar], a ret -; 50779 diff --git a/engine/events/std_collision.asm b/engine/events/std_collision.asm index 775f7c10c..0e06b03c8 100644 --- a/engine/events/std_collision.asm +++ b/engine/events/std_collision.asm @@ -1,4 +1,4 @@ -CheckFacingTileForStdScript:: ; 1365b +CheckFacingTileForStdScript:: ; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry. ld a, c ld de, 3 @@ -25,5 +25,5 @@ CheckFacingTileForStdScript:: ; 1365b INCLUDE "data/events/collision_stdscripts.asm" -Script_JumpStdFromRAM: ; 0x1369a +Script_JumpStdFromRAM: jump wJumpStdScriptBuffer diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 6e873a7c7..28272405c 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -216,7 +216,7 @@ Radio2Script: closetext end -TrashCanScript: ; 0xbc1a5 +TrashCanScript: farjumptext TrashCanText PCScript: @@ -335,9 +335,8 @@ BugContestResults_DidNotWin: farwritetext ContestResults_DidNotWinText buttonsound jump BugContestResults_FinishUp -; 0xbc2b1 -BugContestResults_ReturnAfterWinnersPrize: ; 0xbc2b1 +BugContestResults_ReturnAfterWinnersPrize: farwritetext ContestResults_JoinUsNextTimeText buttonsound @@ -381,9 +380,8 @@ BugContestResults_CleanUp: setflag ENGINE_DAILY_BUG_CONTEST special PlayMapMusic end -; 0xbc31e -BugContestResults_FirstPlace: ; 0xbc31e +BugContestResults_FirstPlace: setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 itemtotext SUN_STONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText @@ -391,55 +389,48 @@ BugContestResults_FirstPlace: ; 0xbc31e verbosegiveitem SUN_STONE iffalse BugContestResults_NoRoomForSunStone jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc332 -BugContestResults_SecondPlace: ; 0xbc332 +BugContestResults_SecondPlace: itemtotext EVERSTONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem EVERSTONE iffalse BugContestResults_NoRoomForEverstone jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc343 -BugContestResults_ThirdPlace: ; 0xbc343 +BugContestResults_ThirdPlace: itemtotext GOLD_BERRY, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem GOLD_BERRY iffalse BugContestResults_NoRoomForGoldBerry jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc354 -BugContestResults_NoRoomForSunStone: ; 0xbc354 +BugContestResults_NoRoomForSunStone: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc35f -BugContestResults_NoRoomForEverstone: ; 0xbc35f +BugContestResults_NoRoomForEverstone: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc36a -BugContestResults_NoRoomForGoldBerry: ; 0xbc36a +BugContestResults_NoRoomForGoldBerry: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc375 -BugContestResults_NoRoomForBerry: ; 0xbc375 +BugContestResults_NoRoomForBerry: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_BERRY jump BugContestResults_DidNotWin -; 0xbc380 -BugContestResults_CopyContestantsToResults: ; 0xbc380 +BugContestResults_CopyContestantsToResults: checkevent EVENT_BUG_CATCHING_CONTESTANT_1A iftrue .skip1 clearevent EVENT_BUG_CATCHING_CONTESTANT_1B @@ -1489,7 +1480,7 @@ RegisteredNumberFScript: buttonsound end -NumberAcceptedFScript: ; 0xbcbd3 +NumberAcceptedFScript: checkcode VAR_CALLERID ifequal PHONE_POKEFAN_BEVERLY, .Beverly ifequal PHONE_COOLTRAINERF_BETH, .Beth @@ -1777,23 +1768,21 @@ GymStatue2Script: closetext end -ReceiveItemScript: ; 0xbcdb9 +ReceiveItemScript: waitsfx farwritetext ReceivedItemText playsound SFX_ITEM waitsfx end -; 0xbcdc3 -ReceiveTogepiEggScript: ; 0xbcdc3 +ReceiveTogepiEggScript: waitsfx farwritetext ReceivedItemText playsound SFX_GET_EGG_FROM_DAY_CARE_LADY waitsfx end -; 0xbcdcd -GameCornerCoinVendorScript: ; 0xbcdcd +GameCornerCoinVendorScript: faceplayer opentext farwritetext CoinVendor_WelcomeText @@ -1804,12 +1793,11 @@ GameCornerCoinVendorScript: ; 0xbcdcd waitbutton closetext end -; 0xbcde0 -CoinVendor_IntroScript: ; 0xbcde0 +CoinVendor_IntroScript: farwritetext CoinVendor_IntroText -.loop ; 0xbcde4 +.loop special DisplayMoneyAndCoinBalance loadmenu .MenuHeader verticalmenu @@ -1817,9 +1805,8 @@ CoinVendor_IntroScript: ; 0xbcde0 ifequal 1, .Buy50 ifequal 2, .Buy500 jump .Cancel -; 0xbcdf7 -.Buy50: ; 0xbcdf7 +.Buy50: checkcoins MAX_COINS - 50 ifequal HAVE_MORE, .CoinCaseFull checkmoney YOUR_MONEY, 1000 @@ -1831,9 +1818,8 @@ CoinVendor_IntroScript: ; 0xbcde0 farwritetext CoinVendor_Buy50CoinsText waitbutton jump .loop -; 0xbce1b -.Buy500: ; 0xbce1b +.Buy500: checkcoins MAX_COINS - 500 ifequal HAVE_MORE, .CoinCaseFull checkmoney YOUR_MONEY, 10000 @@ -1845,29 +1831,24 @@ CoinVendor_IntroScript: ; 0xbcde0 farwritetext CoinVendor_Buy500CoinsText waitbutton jump .loop -; 0xbce3f -.NotEnoughMoney: ; 0xbce3f +.NotEnoughMoney: farwritetext CoinVendor_NotEnoughMoneyText waitbutton closetext end -; 0xbce46 -.CoinCaseFull: ; 0xbce46 +.CoinCaseFull: farwritetext CoinVendor_CoinCaseFullText waitbutton closetext end -; 0xbce4d -.Cancel: ; 0xbce4d +.Cancel: farwritetext CoinVendor_CancelText waitbutton closetext end -; 0xbce54 - .MenuHeader: db MENU_BACKUP_TILES ; flags @@ -1881,8 +1862,6 @@ CoinVendor_IntroScript: ; 0xbcde0 db " 50 : ¥1000@" db "500 : ¥10000@" db "CANCEL@" -; 0xbce7f - HappinessCheckScript: faceplayer @@ -1907,9 +1886,8 @@ HappinessCheckScript: closetext end -Movement_ContestResults_WalkAfterWarp: ; bcea1 +Movement_ContestResults_WalkAfterWarp: step RIGHT step DOWN turn_head UP step_end -; bcea5 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index 509d9775d..1a378ede8 100644 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -1,12 +1,11 @@ -SweetScentFromMenu: ; 506bc +SweetScentFromMenu: ld hl, .SweetScent call QueueScript ld a, $1 ld [wFieldMoveSucceeded], a ret -; 506c8 -.SweetScent: ; 0x506c8 +.SweetScent: reloadmappart special UpdateTimePals callasm GetPartyNick @@ -20,20 +19,17 @@ SweetScentFromMenu: ; 506bc startbattle reloadmapafterbattle end -; 0x506e5 -.BugCatchingContest: ; 0x506e5 +.BugCatchingContest: farjump BugCatchingContestBattleScript -; 0x506e9 -SweetScentNothing: ; 0x506e9 +SweetScentNothing: writetext UnknownText_0x5072b waitbutton closetext end -; 0x506ef -SweetScentEncounter: ; 506ef +SweetScentEncounter: farcall CanUseSweetScent jr nc, .no_battle ld hl, wStatusFlags2 @@ -60,16 +56,13 @@ SweetScentEncounter: ; 506ef ld [wScriptVar], a ld [wBattleType], a ret -; 50726 -UnknownText_0x50726: ; 0x50726 +UnknownText_0x50726: ; used SWEET SCENT! text_jump UnknownText_0x1c0b03 db "@" -; 0x5072b -UnknownText_0x5072b: ; 0x5072b +UnknownText_0x5072b: ; Looks like there's nothing here… text_jump UnknownText_0x1c0b1a db "@" -; 0x50730 diff --git a/engine/events/trainer_scripts.asm b/engine/events/trainer_scripts.asm index abfcd8dee..6f0bb2d29 100644 --- a/engine/events/trainer_scripts.asm +++ b/engine/events/trainer_scripts.asm @@ -1,4 +1,4 @@ -TalkToTrainerScript:: ; 0xbe66a +TalkToTrainerScript:: faceplayer trainerflagaction CHECK_FLAG iftrue AlreadyBeatenTrainerScript @@ -6,7 +6,7 @@ TalkToTrainerScript:: ; 0xbe66a encountermusic jump StartBattleWithMapTrainerScript -SeenByTrainerScript:: ; 0xbe675 +SeenByTrainerScript:: loadmemtrainer encountermusic showemote EMOTE_SHOCK, LAST_TALKED, 30 @@ -16,7 +16,7 @@ SeenByTrainerScript:: ; 0xbe675 faceobject PLAYER, LAST_TALKED jump StartBattleWithMapTrainerScript -StartBattleWithMapTrainerScript: ; 0xbe68a +StartBattleWithMapTrainerScript: opentext trainertext $0 waitbutton diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm index 6d55004f4..cd78421d6 100644 --- a/engine/events/treemons.asm +++ b/engine/events/treemons.asm @@ -1,4 +1,4 @@ -TreeMonEncounter: ; b81ea +TreeMonEncounter: farcall StubbedTrainerRankings_TreeEncounters xor a @@ -25,10 +25,8 @@ TreeMonEncounter: ; b81ea xor a ld [wScriptVar], a ret -; b8219 - -RockMonEncounter: ; b8219 +RockMonEncounter: xor a ld [wTempWildMonSpecies], a ld [wCurPartyLevel], a @@ -54,11 +52,10 @@ RockMonEncounter: ; b8219 .no_battle xor a ret -; b823e db $05 ; ???? -GetTreeMonSet: ; b823f +GetTreeMonSet: ; Return carry and treemon set in a ; if the current map is in table hl. ld a, [wMapNumber] @@ -93,11 +90,10 @@ GetTreeMonSet: ; b823f ld a, [hl] scf ret -; b825e INCLUDE "data/wild/treemon_maps.asm" -GetTreeMons: ; b82d2 +GetTreeMons: ; Return the address of TreeMon table a in hl. ; Return nc if table a doesn't exist. @@ -123,11 +119,10 @@ GetTreeMons: ; b82d2 .quit xor a ret -; b82e8 INCLUDE "data/wild/treemons.asm" -GetTreeMon: ; b83e5 +GetTreeMon: push hl call GetTreeScore pop hl @@ -168,9 +163,8 @@ GetTreeMon: ; b83e5 jr nz, .skip call SelectTreeMon ret -; b841f -SelectTreeMon: ; b841f +SelectTreeMon: ; Read a TreeMons table and pick one monster at random. ld a, 100 @@ -195,14 +189,13 @@ SelectTreeMon: ; b841f scf ret -NoTreeMon: ; b843b +NoTreeMon: xor a ld [wTempWildMonSpecies], a ld [wCurPartyLevel], a ret -; b8443 -GetTreeScore: ; b8443 +GetTreeScore: call .CoordScore ld [wBuffer1], a call .OTIDScore @@ -228,9 +221,8 @@ GetTreeScore: ; b8443 .rare ld a, TREEMON_SCORE_RARE ret -; b8466 -.CoordScore: ; b8466 +.CoordScore: call GetFacingTileCoord ld hl, 0 ld c, e @@ -269,9 +261,8 @@ GetTreeScore: ; b8443 ld a, [hQuotient + 3] ret -; b849d -.OTIDScore: ; b849d +.OTIDScore: ld a, [wPlayerID] ld [hDividend], a ld a, [wPlayerID + 1] @@ -282,4 +273,3 @@ GetTreeScore: ; b8443 call Divide ld a, [hQuotient + 3] ret -; b84b3 diff --git a/engine/events/unown_walls.asm b/engine/events/unown_walls.asm index 64558167a..105337630 100644 --- a/engine/events/unown_walls.asm +++ b/engine/events/unown_walls.asm @@ -1,4 +1,4 @@ -HoOhChamber: ; 0x8addb +HoOhChamber: ld hl, wPartySpecies ld a, [hl] cp HO_OH ; is Ho-oh the first Pokémon in the party? @@ -9,9 +9,8 @@ HoOhChamber: ; 0x8addb call EventFlagAction .done ret -; 0x8adef -OmanyteChamber: ; 8adef +OmanyteChamber: call GetMapAttributesPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, CHECK_FLAG @@ -51,9 +50,8 @@ OmanyteChamber: ; 8adef .nope ret -; 8ae30 -SpecialAerodactylChamber: ; 8ae30 +SpecialAerodactylChamber: push de push bc @@ -79,9 +77,8 @@ SpecialAerodactylChamber: ; 8ae30 pop bc pop de ret -; 8ae4e -SpecialKabutoChamber: ; 8ae4e +SpecialKabutoChamber: push hl push de @@ -101,9 +98,8 @@ SpecialKabutoChamber: ; 8ae4e pop de pop hl ret -; 8ae68 -DisplayUnownWords: ; 8ae68 +DisplayUnownWords: ld a, [wScriptVar] ld hl, MenuHeaders_UnownWalls and a @@ -151,11 +147,10 @@ DisplayUnownWords: ; 8ae68 call PlayClickSFX call CloseWindow ret -; 8aebc INCLUDE "data/events/unown_walls.asm" -_DisplayUnownWords_FillAttr: ; 8aee9 +_DisplayUnownWords_FillAttr: ld a, [de] cp $ff ret z @@ -170,9 +165,8 @@ _DisplayUnownWords_FillAttr: ; 8aee9 inc hl inc de jr _DisplayUnownWords_FillAttr -; 8aefd -.PlaceSquare: ; 8aefd +.PlaceSquare: push hl ld [hli], a ld [hld], a @@ -183,9 +177,8 @@ _DisplayUnownWords_FillAttr: ; 8aee9 ld [hl], a pop hl ret -; 8af09 -_DisplayUnownWords_CopyWord: ; 8af09 +_DisplayUnownWords_CopyWord: push hl push de .word_loop @@ -203,9 +196,8 @@ _DisplayUnownWords_CopyWord: ; 8af09 pop de pop hl ret -; 8af1c -.ConvertChar: ; 8af1c +.ConvertChar: push hl ld a, c cp $60 @@ -264,4 +256,3 @@ _DisplayUnownWords_CopyWord: ; 8af09 ld [hl], $2 pop hl ret -; 8af6b diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index 4bf656055..82b7a4868 100644 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -1,13 +1,12 @@ -Script_BattleWhiteout:: ; 0x124c1 +Script_BattleWhiteout:: callasm BattleBGMap jump Script_Whiteout -; 0x124c8 -Script_OverworldWhiteout:: ; 0x124c8 +Script_OverworldWhiteout:: refreshscreen callasm OverworldBGMap -Script_Whiteout: ; 0x124ce +Script_Whiteout: writetext .WhitedOutText waitbutton special FadeOutPalettes @@ -24,31 +23,27 @@ Script_Whiteout: ; 0x124ce .bug_contest jumpstd bugcontestresultswarp -; 0x124f5 -.WhitedOutText: ; 0x124f5 +.WhitedOutText: ; is out of useable #MON! whited out! text_jump UnknownText_0x1c0a4e db "@" -; 0x124fa -OverworldBGMap: ; 124fa +OverworldBGMap: call ClearPalettes call ClearScreen call WaitBGMap2 call HideSprites call RotateThreePalettesLeft ret -; 1250a -BattleBGMap: ; 1250a +BattleBGMap: ld b, SCGB_BATTLE_GRAYSCALE call GetSGBLayout call SetPalettes ret -; 12513 -HalveMoney: ; 12513 +HalveMoney: farcall StubbedTrainerRankings_WhiteOuts ; Halve the player's money. @@ -63,10 +58,8 @@ HalveMoney: ; 12513 rra ld [hl], a ret -; 12527 - -GetWhiteoutSpawn: ; 12527 +GetWhiteoutSpawn: ld a, [wLastSpawnMapGroup] ld d, a ld a, [wLastSpawnMapNumber] @@ -79,4 +72,3 @@ GetWhiteoutSpawn: ; 12527 .yes ld [wDefaultSpawnpoint], a ret -; 1253d diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm index 8f5131983..805a3ca71 100644 --- a/engine/games/card_flip.asm +++ b/engine/games/card_flip.asm @@ -1,16 +1,16 @@ -CARDFLIP_LIGHT_OFF EQU $ef -CARDFLIP_LIGHT_ON EQU $f5 +CARDFLIP_LIGHT_OFF EQUS "\"♂\"" ; $ef +CARDFLIP_LIGHT_ON EQUS "\"♀\"" ; $f5 CARDFLIP_DECK_SIZE EQU 4 * 6 ; two labels below called from inside ./dummy_game.asm -Unknown_e00ed: ; e00ed (38:40ed) +Unknown_e00ed: ; Graphics for an unused Game Corner ; game were meant to be here. -ret_e00ed: ; e00ed (38:40ed) +ret_e00ed: ret -_CardFlip: ; e00ee (38:40ee) +_CardFlip: ld hl, wOptions set NO_TEXT_SCROLL, [hl] call ClearBGPalettes @@ -74,7 +74,7 @@ _CardFlip: ; e00ee (38:40ee) res 4, [hl] ret -.CardFlip: ; e0191 (38:4191) +.CardFlip: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -85,9 +85,8 @@ _CardFlip: ; e00ee (38:40ee) ld h, [hl] ld l, a jp hl -; e01a0 (38:41a0) -.Jumptable: ; e01a0 +.Jumptable: dw .AskPlayWithThree dw .DeductCoins dw .ChooseACard @@ -96,15 +95,13 @@ _CardFlip: ; e00ee (38:40ee) dw .TabulateTheResult dw .PlayAgain dw .Quit -; e01b0 -.Increment: ; e01b0 +.Increment: ld hl, wJumptableIndex inc [hl] ret -; e01b5 -.AskPlayWithThree: ; e01b5 +.AskPlayWithThree: ld hl, .PlayWithThreeCoinsText call CardFlip_UpdateCoinBalanceDisplay call YesNoBox @@ -117,15 +114,13 @@ _CardFlip: ; e00ee (38:40ee) ld a, 7 ld [wJumptableIndex], a ret -; e01cd -.PlayWithThreeCoinsText: ; 0xe01cd +.PlayWithThreeCoinsText: ; Play with three coins? text_jump UnknownText_0x1c5793 db "@" -; 0xe01d2 -.DeductCoins: ; e01d2 +.DeductCoins: ld a, [wCoins] ld h, a ld a, [wCoins + 1] @@ -159,15 +154,13 @@ _CardFlip: ; e00ee (38:40ee) call WaitSFX call .Increment ret -; e0212 -.NotEnoughCoinsText: ; 0xe0212 +.NotEnoughCoinsText: ; Not enough coins… text_jump UnknownText_0x1c57ab db "@" -; 0xe0217 -.ChooseACard: ; e0217 +.ChooseACard: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -238,15 +231,13 @@ _CardFlip: ; e00ee (38:40ee) ld [wCardFlipWhichCard], a call .Increment ret -; e02b2 -.ChooseACardText: ; 0xe02b2 +.ChooseACardText: ; Choose a card. text_jump UnknownText_0x1c57be db "@" -; 0xe02b7 -.PlaceYourBet: ; e02b7 +.PlaceYourBet: ld hl, .PlaceYourBetText call CardFlip_UpdateCoinBalanceDisplay .betloop @@ -262,15 +253,13 @@ _CardFlip: ; e00ee (38:40ee) .betdone call .Increment ret -; e02d5 -.PlaceYourBetText: ; 0xe02d5 +.PlaceYourBetText: ; Place your bet. text_jump UnknownText_0x1c57ce db "@" -; 0xe02da -.CheckTheCard: ; e02da +.CheckTheCard: xor a ld [hVBlankCounter], a call CardFlip_UpdateCursorOAM @@ -298,16 +287,14 @@ _CardFlip: ; e00ee (38:40ee) call WaitBGMap2 call .Increment ret -; e0314 -.TabulateTheResult: ; e0314 +.TabulateTheResult: call CardFlip_CheckWinCondition call WaitPressAorB_BlinkCursor call .Increment ret -; e031e -.PlayAgain: ; e031e +.PlayAgain: call ClearSprites ld hl, .PlayAgainText call CardFlip_UpdateCoinBalanceDisplay @@ -337,27 +324,23 @@ _CardFlip: ; e00ee (38:40ee) ld a, 1 ld [wJumptableIndex], a ret -; e0356 -.PlayAgainText: ; 0xe0356 +.PlayAgainText: ; Want to play again? text_jump UnknownText_0x1c57df db "@" -; 0xe035b -.CardsShuffledText: ; 0xe035b +.CardsShuffledText: ; The cards have been shuffled. text_jump UnknownText_0x1c57f4 db "@" -; 0xe0360 -.Quit: ; e0360 +.Quit: ld hl, wJumptableIndex set 7, [hl] ret -; e0366 -CardFlip_ShuffleDeck: ; e0366 +CardFlip_ShuffleDeck: ld hl, wDeck ld bc, CARDFLIP_DECK_SIZE xor a @@ -384,9 +367,8 @@ CardFlip_ShuffleDeck: ; e0366 ld bc, CARDFLIP_DECK_SIZE call ByteFill ret -; e0398 -CollapseCursorPosition: ; e0398 +CollapseCursorPosition: ld hl, 0 ld bc, 6 ld a, [wCardFlipCursorY] @@ -396,9 +378,8 @@ CollapseCursorPosition: ; e0398 ld c, a add hl, bc ret -; e03ac -GetCoordsOfChosenCard: ; e03ac +GetCoordsOfChosenCard: ld a, [wCardFlipWhichCard] and a jr nz, .BottomCard @@ -412,27 +393,24 @@ GetCoordsOfChosenCard: ; e03ac .done ret -; e03c1 -PlaceCardFaceDown: ; e03c1 +PlaceCardFaceDown: xor a ld [hBGMapMode], a ld de, .FaceDownCardTilemap lb bc, 6, 5 call CardFlip_CopyToBox ret -; e03ce -.FaceDownCardTilemap: ; e03ce +.FaceDownCardTilemap: db $08, $09, $09, $09, $0a db $0b, $28, $2b, $28, $0c db $0b, $2c, $2d, $2e, $0c db $0b, $2f, $30, $31, $0c db $0b, $32, $33, $34, $0c db $0d, $0e, $0e, $0e, $0f -; e03ec -CardFlip_DisplayCardFaceUp: ; e03ec +CardFlip_DisplayCardFaceUp: xor a ld [hBGMapMode], a push hl @@ -493,18 +471,16 @@ CardFlip_DisplayCardFaceUp: ; e03ec lb bc, 6, 5 call CardFlip_FillBox ret -; e043b -.FaceUpCardTilemap: ; e043b +.FaceUpCardTilemap: db $18, $19, $19, $19, $1a db $1b, $35, $7f, $7f, $1c db $0b, $28, $28, $28, $0c db $0b, $28, $28, $28, $0c db $0b, $28, $28, $28, $0c db $1d, $1e, $1e, $1e, $1f -; e0459 -.Deck: ; e0459 +.Deck: ; level, pic anchor (3x3) db "1", $4e, "1", $57, "1", $69, "1", $60 db "2", $4e, "2", $57, "2", $69, "2", $60 @@ -512,9 +488,8 @@ CardFlip_DisplayCardFaceUp: ; e03ec db "4", $4e, "4", $57, "4", $69, "4", $60 db "5", $4e, "5", $57, "5", $69, "5", $60 db "6", $4e, "6", $57, "6", $69, "6", $60 -; e0489 -CardFlip_UpdateCoinBalanceDisplay: ; e0489 +CardFlip_UpdateCoinBalanceDisplay: push hl hlcoord 0, 12 ld b, 4 @@ -524,9 +499,8 @@ CardFlip_UpdateCoinBalanceDisplay: ; e0489 call PrintTextBoxText call CardFlip_PrintCoinBalance ret -; e049c -CardFlip_PrintCoinBalance: ; e049c +CardFlip_PrintCoinBalance: hlcoord 9, 15 ld b, 1 ld c, 9 @@ -539,13 +513,11 @@ CardFlip_PrintCoinBalance: ; e049c lb bc, PRINTNUM_LEADINGZEROS | 2, 4 call PrintNum ret -; e04bc .CoinStr: db "COIN@" -; e04c1 -CardFlip_InitTilemap: ; e04c1 (38:44c1) +CardFlip_InitTilemap: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -560,12 +532,11 @@ CardFlip_InitTilemap: ; e04c1 (38:44c1) lb bc, 4, 18 call TextBox ret -; e04e5 (38:44e5) -CardFlip_FillGreenBox: ; e04e5 +CardFlip_FillGreenBox: ld a, $29 -CardFlip_FillBox: ; e04e7 (38:44e7) +CardFlip_FillBox: .row push bc push hl @@ -581,7 +552,7 @@ CardFlip_FillBox: ; e04e7 (38:44e7) jr nz, .row ret -CardFlip_CopyToBox: ; e04f7 (38:44f7) +CardFlip_CopyToBox: .row push bc push hl @@ -598,9 +569,8 @@ CardFlip_CopyToBox: ; e04f7 (38:44f7) dec b jr nz, .row ret -; e0509 (38:4509) -CardFlip_CopyOAM: ; e0509 +CardFlip_CopyOAM: ld de, wVirtualOAMSprite00 ld a, [hli] .loop @@ -623,9 +593,8 @@ CardFlip_CopyOAM: ; e0509 dec a jr nz, .loop ret -; e0521 -CardFlip_ShiftDigitsLeftTwoPixels: ; e0521 (38:4521) +CardFlip_ShiftDigitsLeftTwoPixels: ld de, vTiles0 tile "0" ld hl, vTiles0 tile "0" + 2 ld bc, 10 tiles - 2 @@ -635,9 +604,8 @@ CardFlip_ShiftDigitsLeftTwoPixels: ; e0521 (38:4521) ld [hli], a ld [hl], a ret -; e0534 (38:4534) -CardFlip_BlankDiscardedCardSlot: ; e0534 +CardFlip_BlankDiscardedCardSlot: xor a ld [hBGMapMode], a ld a, [wCardFlipFaceUpCard] @@ -660,18 +628,16 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 ld h, [hl] ld l, a jp hl -; e0553 -.Jumptable: ; e0553 +.Jumptable: dw .Level1 dw .Level2 dw .Level3 dw .Level4 dw .Level5 dw .Level6 -; e055f -.Level1: ; e055f +.Level1: ld hl, wDiscardPile + 4 add hl, de ld a, [hl] @@ -695,9 +661,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3d ret -; e0583 -.Level2: ; e0583 +.Level2: ld hl, wDiscardPile - 4 add hl, de ld a, [hl] @@ -721,9 +686,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3a ret -; e05a7 -.Level3: ; e05a7 +.Level3: ld hl, wDiscardPile + 4 add hl, de ld a, [hl] @@ -747,9 +711,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3d ret -; e05cb -.Level4: ; e05cb +.Level4: ld hl, wDiscardPile - 4 add hl, de ld a, [hl] @@ -773,9 +736,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3a ret -; e05ef -.Level5: ; e05ef +.Level5: ld hl, wDiscardPile + 4 add hl, de ld a, [hl] @@ -799,9 +761,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3d ret -; e0613 -.Level6: ; e0613 +.Level6: ld hl, wDiscardPile - 4 add hl, de ld a, [hl] @@ -825,9 +786,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 add hl, bc ld [hl], $3a ret -; e0637 -CardFlip_CheckWinCondition: ; e0637 +CardFlip_CheckWinCondition: call CollapseCursorPosition add hl, hl ld de, .Jumptable @@ -836,9 +796,8 @@ CardFlip_CheckWinCondition: ; e0637 ld h, [hl] ld l, a jp hl -; e0643 -.Jumptable: ; e0643 +.Jumptable: dw .Impossible dw .Impossible dw .PikaJiggly @@ -894,233 +853,226 @@ CardFlip_CheckWinCondition: ; e0637 dw .JigglySix dw .PoliSix dw .OddSix -; e06a3 -.Impossible: ; e06a3 +.Impossible: jp .Lose -; e06a6 -.PikaJiggly: ; e06a6 +.PikaJiggly: ld a, [wCardFlipFaceUpCard] and $2 jp nz, .Lose jr .WinSix -.PoliOddish: ; e06b0 +.PoliOddish: ld a, [wCardFlipFaceUpCard] and $2 jr nz, .WinSix jp .Lose -.WinSix: ; e06ba +.WinSix: ld c, $6 ld de, SFX_2ND_PLACE jp .Payout -; e06c2 -.OneTwo: ; e06c2 +.OneTwo: ld a, [wCardFlipFaceUpCard] and $18 jr z, .WinNine jp .Lose -.ThreeFour: ; e06cc +.ThreeFour: ld a, [wCardFlipFaceUpCard] and $18 cp $8 jr z, .WinNine jp .Lose -.FiveSix: ; e06d8 +.FiveSix: ld a, [wCardFlipFaceUpCard] and $18 cp $10 jr z, .WinNine jp .Lose -.WinNine: ; e06e4 +.WinNine: ld c, $9 ld de, SFX_2ND_PLACE jp .Payout -; e06ec -.Pikachu: ; e06ec +.Pikachu: ld a, [wCardFlipFaceUpCard] and $3 jr z, .WinTwelve jp .Lose -.Jigglypuff: ; e06f6 +.Jigglypuff: ld a, [wCardFlipFaceUpCard] and $3 cp $1 jr z, .WinTwelve jp .Lose -.Poliwag: ; e0702 +.Poliwag: ld a, [wCardFlipFaceUpCard] and $3 cp $2 jr z, .WinTwelve jp .Lose -.Oddish: ; e070e +.Oddish: ld a, [wCardFlipFaceUpCard] and $3 cp $3 jr z, .WinTwelve jp .Lose -.WinTwelve: ; e071a +.WinTwelve: ld c, $c ld de, SFX_2ND_PLACE jp .Payout -; e0722 -.One: ; e0722 +.One: ld a, [wCardFlipFaceUpCard] and $1c jr z, .WinEighteen jp .Lose -.Two: ; e072c +.Two: ld a, [wCardFlipFaceUpCard] and $1c cp $4 jr z, .WinEighteen jp .Lose -.Three: ; e0738 +.Three: ld a, [wCardFlipFaceUpCard] and $1c cp $8 jr z, .WinEighteen jp .Lose -.Four: ; e0744 +.Four: ld a, [wCardFlipFaceUpCard] and $1c cp $c jr z, .WinEighteen jp .Lose -.Five: ; e0750 +.Five: ld a, [wCardFlipFaceUpCard] and $1c cp $10 jr z, .WinEighteen jp .Lose -.Six: ; e075c +.Six: ld a, [wCardFlipFaceUpCard] and $1c cp $14 jr z, .WinEighteen jp .Lose -.WinEighteen: ; e0768 +.WinEighteen: ld c, $12 ld de, SFX_2ND_PLACE jp .Payout -; e0770 - -.PikaOne: ; e0770 +.PikaOne: ld e, $0 jr .CheckWin72 -.JigglyOne: ; e0774 +.JigglyOne: ld e, $1 jr .CheckWin72 -.PoliOne: ; e0778 +.PoliOne: ld e, $2 jr .CheckWin72 -.OddOne: ; e077c +.OddOne: ld e, $3 jr .CheckWin72 -.PikaTwo: ; e0780 +.PikaTwo: ld e, $4 jr .CheckWin72 -.JigglyTwo: ; e0784 +.JigglyTwo: ld e, $5 jr .CheckWin72 -.PoliTwo: ; e0788 +.PoliTwo: ld e, $6 jr .CheckWin72 -.OddTwo: ; e078c +.OddTwo: ld e, $7 jr .CheckWin72 -.PikaThree: ; e0790 +.PikaThree: ld e, $8 jr .CheckWin72 -.JigglyThree: ; e0794 +.JigglyThree: ld e, $9 jr .CheckWin72 -.PoliThree: ; e0798 +.PoliThree: ld e, $a jr .CheckWin72 -.OddThree: ; e079c +.OddThree: ld e, $b jr .CheckWin72 -.PikaFour: ; e07a0 +.PikaFour: ld e, $c jr .CheckWin72 -.JigglyFour: ; e07a4 +.JigglyFour: ld e, $d jr .CheckWin72 -.PoliFour: ; e07a8 +.PoliFour: ld e, $e jr .CheckWin72 -.OddFour: ; e07ac +.OddFour: ld e, $f jr .CheckWin72 -.PikaFive: ; e07b0 +.PikaFive: ld e, $10 jr .CheckWin72 -.JigglyFive: ; e07b4 +.JigglyFive: ld e, $11 jr .CheckWin72 -.PoliFive: ; e07b8 +.PoliFive: ld e, $12 jr .CheckWin72 -.OddFive: ; e07bc +.OddFive: ld e, $13 jr .CheckWin72 -.PikaSix: ; e07c0 +.PikaSix: ld e, $14 jr .CheckWin72 -.JigglySix: ; e07c4 +.JigglySix: ld e, $15 jr .CheckWin72 -.PoliSix: ; e07c8 +.PoliSix: ld e, $16 jr .CheckWin72 -.OddSix: ; e07cc +.OddSix: ld e, $17 -.CheckWin72: ; e07ce +.CheckWin72: ld a, [wCardFlipFaceUpCard] cp e jr nz, .Lose @@ -1128,7 +1080,7 @@ CardFlip_CheckWinCondition: ; e0637 ld de, SFX_2ND_PLACE jr .Payout -.Lose: ; e07db +.Lose: ld de, SFX_WRONG call PlaySFX ld hl, .Text_Darn @@ -1136,7 +1088,7 @@ CardFlip_CheckWinCondition: ; e0637 call WaitSFX ret -.Payout: ; e07eb +.Payout: push bc push de ld hl, .Text_Yeah @@ -1159,21 +1111,18 @@ CardFlip_CheckWinCondition: ; e0637 dec c jr nz, .loop ret -; e0811 -.Text_Yeah: ; 0xe0811 +.Text_Yeah: ; Yeah! text_jump UnknownText_0x1c5813 db "@" -; 0xe0816 -.Text_Darn: ; 0xe0816 +.Text_Darn: ; Darn… text_jump UnknownText_0x1c581a db "@" -; 0xe081b -.AddCoinPlaySFX: ; e081b +.AddCoinPlaySFX: ld a, [wCoins] ld h, a ld a, [wCoins + 1] @@ -1186,9 +1135,8 @@ CardFlip_CheckWinCondition: ; e0637 ld de, SFX_PAY_DAY call PlaySFX ret -; e0833 -.IsCoinCaseFull: ; e0833 +.IsCoinCaseFull: ld a, [wCoins] cp HIGH(MAX_COINS) jr c, .less @@ -1207,16 +1155,14 @@ CardFlip_CheckWinCondition: ; e0637 .less and a ret -; e0849 -PlaceOAMCardBorder: ; e0849 +PlaceOAMCardBorder: call GetCoordsOfChosenCard ld hl, .SpriteData call CardFlip_CopyOAM ret -; e0853 -.SpriteData: ; e0853 +.SpriteData: db 18 dsprite 0, 0, 0, 0, $04, 0 dsprite 0, 0, 1, 0, $06, 0 @@ -1241,9 +1187,8 @@ PlaceOAMCardBorder: ; e0849 dsprite 5, 0, 2, 0, $06, 0 | Y_FLIP dsprite 5, 0, 3, 0, $06, 0 | Y_FLIP dsprite 5, 0, 4, 0, $04, 0 | X_FLIP | Y_FLIP -; e089c -ChooseCard_HandleJoypad: ; e089c +ChooseCard_HandleJoypad: ld hl, hJoyLast ld a, [hl] and D_LEFT @@ -1258,9 +1203,8 @@ ChooseCard_HandleJoypad: ; e089c and D_DOWN jp nz, .d_down ret -; e08b8 -.d_left ; e08b8 +.d_left ld hl, wCardFlipCursorX ld a, [wCardFlipCursorY] and a @@ -1296,9 +1240,8 @@ ChooseCard_HandleJoypad: ; e089c ld a, $1 ld [wCardFlipCursorX], a jp .play_sound -; e08ef -.d_right ; e08ef +.d_right ld hl, wCardFlipCursorX ld a, [wCardFlipCursorY] and a @@ -1319,7 +1262,7 @@ ChooseCard_HandleJoypad: ; e089c inc [hl] jr .play_sound -.d_up ; e090a +.d_up ld hl, wCardFlipCursorY ld a, [wCardFlipCursorX] and a @@ -1356,7 +1299,7 @@ ChooseCard_HandleJoypad: ; e089c ld [wCardFlipCursorX], a jr .play_sound -.d_down ; e093d +.d_down ld hl, wCardFlipCursorY ld a, [wCardFlipCursorX] and a @@ -1377,13 +1320,12 @@ ChooseCard_HandleJoypad: ; e089c inc [hl] inc [hl] -.play_sound ; e0959 +.play_sound ld de, SFX_POKEBALLS_PLACED_ON_TABLE call PlaySFX ret -; e0960 -CardFlip_UpdateCursorOAM: ; e0960 +CardFlip_UpdateCursorOAM: call ClearSprites ld a, [hCGB] and a @@ -1407,9 +1349,8 @@ CardFlip_UpdateCursorOAM: ; e0960 ld l, a call CardFlip_CopyOAM ret -; e0981 -.OAMData: ; e0981 +.OAMData: cardflip_cursor: MACRO if _NARG >= 5 dbpixel \1, \2, \3, \4 @@ -1475,9 +1416,8 @@ ENDM cardflip_cursor 15, 12, 0, 4, .SingleTile cardflip_cursor 17, 12, 0, 4, .SingleTile cardflip_cursor 19, 12, 0, 4, .SingleTile -; e0a41 -.SingleTile: ; e0a41 +.SingleTile: db 6 dsprite 0, 0, -1, 7, $00, 0 | PRIORITY dsprite 0, 0, 0, 0, $02, 0 | PRIORITY @@ -1486,7 +1426,7 @@ ENDM dsprite 0, 5, 0, 0, $02, 0 | Y_FLIP | PRIORITY dsprite 0, 5, 1, 0, $03, 0 | PRIORITY -.PokeGroup: ; e0a5a +.PokeGroup: db 26 dsprite 0, 0, -1, 7, $00, 0 | PRIORITY dsprite 0, 0, 0, 0, $02, 0 | PRIORITY @@ -1515,7 +1455,7 @@ ENDM dsprite 10, 1, 0, 0, $02, 0 | Y_FLIP | PRIORITY dsprite 10, 1, 1, 0, $03, 0 | PRIORITY -.NumGroup: ; e0ac3 +.NumGroup: db 20 dsprite 0, 0, -1, 7, $00, 0 | PRIORITY dsprite 0, 0, 0, 0, $02, 0 | PRIORITY @@ -1538,7 +1478,7 @@ ENDM dsprite 0, 5, 7, 0, $02, 0 | Y_FLIP | PRIORITY dsprite 0, 5, 8, 0, $03, 0 | PRIORITY -.NumGroupPair: ; e0b14 +.NumGroupPair: db 30 dsprite 0, 0, 0, 0, $00, 0 | PRIORITY dsprite 0, 0, 1, 0, $02, 0 | PRIORITY @@ -1571,7 +1511,7 @@ ENDM dsprite 2, 1, 8, 0, $03, 0 | PRIORITY dsprite 2, 1, 9, 0, $03, 0 | PRIORITY -.PokeGroupPair: ; e0b8d +.PokeGroupPair: db 38 dsprite 0, 0, -1, 7, $00, 0 | PRIORITY dsprite 0, 0, 3, 0, $00, 0 | X_FLIP | PRIORITY @@ -1612,15 +1552,14 @@ ENDM dsprite 11, 1, 2, 0, $02, 0 | Y_FLIP | PRIORITY dsprite 11, 1, 3, 0, $03, 0 | X_FLIP | Y_FLIP | PRIORITY -.Impossible: ; e0c26 +.Impossible: db 4 dsprite 0, 0, 0, 0, $00, 0 | PRIORITY dsprite 0, 0, 1, 0, $00, 0 | X_FLIP | PRIORITY dsprite 1, 0, 0, 0, $00, 0 | Y_FLIP | PRIORITY dsprite 1, 0, 1, 0, $00, 0 | X_FLIP | Y_FLIP | PRIORITY -; e0c37 -CardFlip_InitAttrPals: ; e0c37 (38:4c37) +CardFlip_InitAttrPals: ld a, [hCGB] and a ret z @@ -1666,27 +1605,24 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37) pop af ld [rSVBK], a ret -; e0c93 (38:4c93) -.palettes ; e0c93 +.palettes INCLUDE "gfx/card_flip/card_flip.pal" -; e0cdb -CardFlipLZ03: ; e0cdb +CardFlipLZ03: INCBIN "gfx/card_flip/card_flip_3.2bpp.lz" -CardFlipOffButtonGFX: ; e0cf6 +CardFlipOffButtonGFX: INCBIN "gfx/card_flip/off.2bpp" -CardFlipOnButtonGFX: ; e0d06 +CardFlipOnButtonGFX: INCBIN "gfx/card_flip/on.2bpp" -CardFlipLZ01: ; e0d16 +CardFlipLZ01: INCBIN "gfx/card_flip/card_flip_1.2bpp.lz" -CardFlipLZ02: ; e0ea8 +CardFlipLZ02: INCBIN "gfx/card_flip/card_flip_2.2bpp.lz" -CardFlipTilemap: ; e110c +CardFlipTilemap: INCBIN "gfx/card_flip/card_flip.tilemap" -; e1190 diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm index 6d7e12196..c500dbf66 100644 --- a/engine/games/dummy_game.asm +++ b/engine/games/dummy_game.asm @@ -1,4 +1,4 @@ -_DummyGame: ; e1e5b (38:5e5b) +_DummyGame: call .LoadGFXAndPals call DelayFrame .loop @@ -243,9 +243,7 @@ endr ld [wJumptableIndex], a ret -; e2010 - -DummyGame_CheckMatch: ; e2010 +DummyGame_CheckMatch: ld hl, wDummyGameCard1 ld a, [hli] cp [hl] @@ -322,21 +320,17 @@ DummyGame_CheckMatch: ; e2010 inc bc ret -; e2093 - -DummyGameText_Yeah: ; 0xe2093 +DummyGameText_Yeah: ; , yeah! text_jump UnknownText_0x1c1a5b db "@" -; 0xe2098 -DummyGameText_Darn: ; 0xe2098 +DummyGameText_Darn: ; Darn… text_jump UnknownText_0x1c1a65 db "@" -; 0xe209d -DummyGame_InitBoard: ; e209d +DummyGame_InitBoard: ld hl, wDummyGameCards ld bc, wDummyGameCardsEnd - wDummyGameCards xor a @@ -385,9 +379,7 @@ DummyGame_InitBoard: ; e209d jr nz, .loop ret -; e20e5 - -DummyGame_SampleTilePlacement: ; e20e5 +DummyGame_SampleTilePlacement: push hl ld de, wDummyGameCards .loop @@ -408,9 +400,7 @@ DummyGame_SampleTilePlacement: ; e20e5 inc hl ret -; e2101 - -DummyGame_GetDistributionOfTiles: ; e2101 +DummyGame_GetDistributionOfTiles: ld a, [wMenuCursorY] dec a ld l, a @@ -426,9 +416,8 @@ DummyGame_GetDistributionOfTiles: ; e2101 db $02, $03, $06, $06, $06, $08, $08, $06 db $02, $02, $04, $06, $06, $08, $08, $09 db $02, $02, $02, $04, $07, $08, $08, $0c -; e2128 -DummyGame_PlaceCard: ; e2128 +DummyGame_PlaceCard: ld a, [wDummyGameLastCardPicked] sla a sla a @@ -446,9 +435,7 @@ DummyGame_PlaceCard: ; e2128 call DelayFrames ret -; e2142 - -DummyGame_DeleteCard: ; e2142 +DummyGame_DeleteCard: ld a, $1 ld [hli], a ld [hld], a @@ -460,9 +447,7 @@ DummyGame_DeleteCard: ; e2142 call DelayFrames ret -; e2152 - -DummyGame_InitStrings: ; e2152 +DummyGame_InitStrings: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $1 @@ -483,9 +468,8 @@ DummyGame_InitStrings: ; e2152 db "とったもの@" .japstr2 db "あと かい@" -; e2183 -DummyGame_Card2Coord: ; e2183 +DummyGame_Card2Coord: ld d, 0 .find_row sub 9 @@ -511,9 +495,7 @@ DummyGame_Card2Coord: ; e2183 add hl, de ret -; e21a1 - -DummyGame_InterpretJoypad_AnimateCursor: ; e21a1 (38:61a1) +DummyGame_InterpretJoypad_AnimateCursor: ld a, [wJumptableIndex] cp $7 jr nc, .quit @@ -606,7 +588,5 @@ DummyGame_InterpretJoypad_AnimateCursor: ; e21a1 (38:61a1) ld [hl], a ret -; e2221 (38:6221) - -LZ_e2221: ; e2221 +LZ_e2221: INCBIN "gfx/dummy_game/dummy_game.2bpp.lz" diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index 924c78924..0e7a566b9 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -94,7 +94,7 @@ _SlotMachine: res rLCDC_SPRITE_SIZE, [hl] ; 8x8 ret -.InitGFX: ; 926f7 (24:66f7) +.InitGFX: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -163,7 +163,7 @@ _SlotMachine: ld [wKeepSevenBiasChance], a ; 12.5% chance ret -Slots_GetPals: ; 9279b (24:679b) +Slots_GetPals: ld a, %11100100 call DmgToCgbBGPals lb de, %11100100, %11100100 @@ -175,7 +175,7 @@ Slots_GetPals: ; 9279b (24:679b) call DmgToCgbObjPals ret -SlotsLoop: ; 927af (24:67af) +SlotsLoop: ld a, [wJumptableIndex] bit SLOTS_END_LOOP_F, a jr nz, .stop @@ -194,7 +194,7 @@ SlotsLoop: ; 927af (24:67af) scf ret -.Stubbed_Function927d3: ; 927d3 (24:67d3) +.Stubbed_Function927d3: ; dummied out ret ld a, [wReel1ReelAction] @@ -219,9 +219,7 @@ SlotsLoop: ; 927af (24:67af) call DmgToCgbBGPals ret -; 927f8 - -.PrintCoinsAndPayout: ; 927f8 (24:67f8) +.PrintCoinsAndPayout: hlcoord 5, 1 ld de, wCoins lb bc, PRINTNUM_LEADINGZEROS | 2, 4 @@ -232,9 +230,7 @@ SlotsLoop: ; 927af (24:67af) call PrintNum ret -; 92811 (24:6811) - -Unreferenced_Function92811: ; 92811 +Unreferenced_Function92811: ; debug function? ld a, [wSlotBias] add 0 @@ -252,9 +248,7 @@ Unreferenced_Function92811: ; 92811 ld [hl], a ret -; 9282c - -Unreferenced_Function9282c: ; 9282c +Unreferenced_Function9282c: ; animate OAM tiles? ld hl, wcf66 ld a, [hl] @@ -274,9 +268,7 @@ endr jr nz, .loop ret -; 92844 - -SlotsJumptable: ; 92844 (24:6844) +SlotsJumptable: jumptable .Jumptable, wJumptableIndex .Jumptable: @@ -300,12 +292,12 @@ SlotsJumptable: ; 92844 (24:6844) dw SlotsAction_RestartOrQuit ; 11 dw SlotsAction_Quit ; 12 -SlotsAction_Next: ; 92879 (24:6879) +SlotsAction_Next: ld hl, wJumptableIndex inc [hl] ret -SlotsAction_Init: ; 9287e (24:687e) +SlotsAction_Init: call SlotsAction_Next xor a ld [wFirstTwoReelsMatching], a @@ -314,7 +306,7 @@ SlotsAction_Init: ; 9287e (24:687e) ld [wSlotMatched], a ret -SlotsAction_BetAndStart: ; 9288e (24:688e) +SlotsAction_BetAndStart: call Slots_AskBet jr nc, .proceed ld a, SLOTS_QUIT @@ -340,7 +332,7 @@ SlotsAction_BetAndStart: ; 9288e (24:688e) call Slots_PlaySFX ret -SlotsAction_WaitStart: ; 928c6 (24:68c6) +SlotsAction_WaitStart: ld hl, wSlotsDelay ld a, [hl] and a @@ -354,7 +346,7 @@ SlotsAction_WaitStart: ; 928c6 (24:68c6) ld [hJoypadSum], a ret -SlotsAction_WaitReel1: ; 928d6 (24:68d6) +SlotsAction_WaitReel1: ld hl, hJoypadSum ld a, [hl] and A_BUTTON @@ -362,7 +354,7 @@ SlotsAction_WaitReel1: ; 928d6 (24:68d6) call SlotsAction_Next call Slots_StopReel1 ld [wReel1ReelAction], a -SlotsAction_WaitStopReel1: ; 928e6 (24:68e6) +SlotsAction_WaitStopReel1: ld a, [wReel1ReelAction] cp REEL_ACTION_DO_NOTHING ret nz @@ -374,7 +366,7 @@ SlotsAction_WaitStopReel1: ; 928e6 (24:68e6) call SlotsAction_Next xor a ld [hJoypadSum], a -SlotsAction_WaitReel2: ; 92900 (24:6900) +SlotsAction_WaitReel2: ld hl, hJoypadSum ld a, [hl] and A_BUTTON @@ -382,7 +374,7 @@ SlotsAction_WaitReel2: ; 92900 (24:6900) call SlotsAction_Next call Slots_StopReel2 ld [wReel2ReelAction], a -SlotsAction_WaitStopReel2: ; 92910 (24:6910) +SlotsAction_WaitStopReel2: ld a, [wReel2ReelAction] cp REEL_ACTION_DO_NOTHING ret nz @@ -394,7 +386,7 @@ SlotsAction_WaitStopReel2: ; 92910 (24:6910) call SlotsAction_Next xor a ld [hJoypadSum], a -SlotsAction_WaitReel3: ; 9292a (24:692a) +SlotsAction_WaitReel3: ld hl, hJoypadSum ld a, [hl] and A_BUTTON @@ -402,7 +394,7 @@ SlotsAction_WaitReel3: ; 9292a (24:692a) call SlotsAction_Next call Slots_StopReel3 ld [wReel3ReelAction], a -SlotsAction_WaitStopReel3: ; 9293a (24:693a) +SlotsAction_WaitStopReel3: ld a, [wReel3ReelAction] cp REEL_ACTION_DO_NOTHING ret nz @@ -416,7 +408,7 @@ SlotsAction_WaitStopReel3: ; 9293a (24:693a) ld [hJoypadSum], a ret -SlotsAction_FlashIfWin: ; 92955 (24:6955) +SlotsAction_FlashIfWin: ld a, [wSlotMatched] cp SLOTS_NO_MATCH jr nz, .GotIt @@ -428,7 +420,7 @@ SlotsAction_FlashIfWin: ; 92955 (24:6955) call SlotsAction_Next ld a, 16 ld [wSlotsDelay], a -SlotsAction_FlashScreen: ; 9296b (24:696b) +SlotsAction_FlashScreen: ld hl, wSlotsDelay ld a, [hl] and a @@ -449,7 +441,7 @@ SlotsAction_FlashScreen: ; 9296b (24:696b) call SlotsAction_Next ret -SlotsAction_GiveEarnedCoins: ; 92987 (24:6987) +SlotsAction_GiveEarnedCoins: xor a ld [wFirstTwoReelsMatching], a ld [wFirstTwoReelsMatchingSevens], a @@ -461,10 +453,10 @@ SlotsAction_GiveEarnedCoins: ; 92987 (24:6987) call SlotsAction_Next ret -SlotsAction_PayoutTextAndAnim: ; 9299e (24:699e) +SlotsAction_PayoutTextAndAnim: call Slots_PayoutText call SlotsAction_Next -SlotsAction_PayoutAnim: ; 929a4 (24:69a4) +SlotsAction_PayoutAnim: ld hl, wSlotsDelay ld a, [hl] inc [hl] @@ -502,7 +494,7 @@ SlotsAction_PayoutAnim: ; 929a4 (24:69a4) call SlotsAction_Next ret -SlotsAction_RestartOrQuit: ; 929d9 (24:69d9) +SlotsAction_RestartOrQuit: call Slots_DeilluminateBetLights call WaitPressAorB_BlinkCursor call Slots_AskPlayAgain @@ -516,12 +508,12 @@ SlotsAction_RestartOrQuit: ; 929d9 (24:69d9) ld [wJumptableIndex], a ret -SlotsAction_Quit: ; 929f0 (24:69f0) +SlotsAction_Quit: ld hl, wJumptableIndex set SLOTS_END_LOOP_F, [hl] ret -Slots_LoadReelState: ; 929f6 (24:69f6) +Slots_LoadReelState: push de call Slots_GetCurrentReelState pop de @@ -535,7 +527,7 @@ Slots_LoadReelState: ; 929f6 (24:69f6) ld [de], a ret -Slots_CheckCoinCaseFull: ; 92a04 (24:6a04) +Slots_CheckCoinCaseFull: ld a, d cp HIGH(MAX_COINS) jr c, .not_full @@ -549,7 +541,7 @@ Slots_CheckCoinCaseFull: ; 92a04 (24:6a04) and a ret -Slots_GetCurrentReelState: ; 92a12 (24:6a12) +Slots_GetCurrentReelState: ld hl, REEL_POSITION add hl, bc ld a, [hl] @@ -569,12 +561,12 @@ Slots_GetCurrentReelState: ; 92a12 (24:6a12) add hl, de ret -Slots_StopReel1: ; 92a2b (24:6a2b) +Slots_StopReel1: ; Always set the REEL_ACTION_STOP_REEL1 action. ld a, REEL_ACTION_STOP_REEL1 ret -Slots_StopReel2: ; 92a2e (24:6a2e) +Slots_StopReel2: ; As long as, the following three meet, there's a 31.25% chance ; to set action REEL_ACTION_SET_UP_REEL2_SKIP_TO_7: ; - Bet is >= 2 coins @@ -603,7 +595,7 @@ Slots_StopReel2: ; 92a2e (24:6a2e) ld a, REEL_ACTION_STOP_REEL2 ret -.CheckReel1ForASeven: ; 92a51 (24:6a51) +.CheckReel1ForASeven: ld a, [wReel1Stopped] and a ret z @@ -614,7 +606,7 @@ Slots_StopReel2: ; 92a2e (24:6a2e) and a ret -Slots_StopReel3: ; 92a60 (24:6a60) +Slots_StopReel3: ; If no matching SEVEN symbols in reels #1 and #2: ; - REEL_ACTION_STOP_REEL3, 100% @@ -667,7 +659,7 @@ Slots_StopReel3: ; 92a60 (24:6a60) ld a, REEL_ACTION_STOP_REEL3 ret -Slots_InitReelTiles: ; 92a98 (24:6a98) +Slots_InitReelTiles: ld bc, wReel1 ld hl, REEL_OAM_ADDR add hl, bc @@ -723,7 +715,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) call .OAM ret -.OAM: ; 92af9 (24:6af9) +.OAM: ld hl, REEL_ACTION add hl, bc ld [hl], REEL_ACTION_DO_NOTHING @@ -736,7 +728,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) call Slots_UpdateReelPositionAndOAM ret -Slots_SpinReels: ; 92b0f (24:6b0f) +Slots_SpinReels: ld bc, wReel1 call .SpinReel ld bc, wReel2 @@ -745,7 +737,7 @@ Slots_SpinReels: ; 92b0f (24:6b0f) call .SpinReel ret -.SpinReel: ; 92b22 (24:6b22) +.SpinReel: ld hl, REEL_SPIN_DISTANCE add hl, bc ld a, [hl] @@ -782,7 +774,7 @@ Slots_SpinReels: ; 92b0f (24:6b0f) jr nz, .loop ret -Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) +Slots_UpdateReelPositionAndOAM: ld hl, REEL_X_COORD add hl, bc ld a, [hl] @@ -814,7 +806,7 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ld [hl], a ret -.LoadOAM: ; 92b83 (24:6b83) +.LoadOAM: ld hl, REEL_OAM_ADDR add hl, bc ld a, [hli] @@ -853,9 +845,7 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) jr nz, .loop ret -; 92bbe (24:6bbe) - -Unreferenced_Function92bbe: ; 92bbe +Unreferenced_Function92bbe: push hl srl a srl a @@ -868,13 +858,10 @@ Unreferenced_Function92bbe: ; 92bbe pop hl ret -; 92bce - -.Unknown_92bce: ; 92bce +.Unknown_92bce: db 0, 1, 2, 3, 4, 5 -; 92bd4 -ReelActionJumptable: ; 92bd4 (24:6bd4) +ReelActionJumptable: ld hl, REEL_ACTION add hl, bc ld e, [hl] @@ -887,9 +874,7 @@ ReelActionJumptable: ; 92bd4 (24:6bd4) ld l, a jp hl -; 92be4 (24:6be4) - -.Jumptable: ; 92be4 +.Jumptable: dw ReelAction_DoNothing ; 00 dw ReelAction_StopReelIgnoreJoypad ; 01 dw ReelAction_QuadrupleRate ; 02 @@ -915,54 +900,41 @@ ReelActionJumptable: ; 92bd4 (24:6bd4) dw ReelAction_WaitChansey ; 16 dw ReelAction_WaitEgg ; 17 dw ReelAction_DropReel ; 18 -; 92c16 -ReelAction_DoNothing: ; 92c16 +ReelAction_DoNothing: ret -; 92c17 - -ReelAction_QuadrupleRate: ; 92c17 +ReelAction_QuadrupleRate: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 16 ret -; 92c1e - -ReelAction_DoubleRate: ; 92c1e +ReelAction_DoubleRate: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 8 ret -; 92c25 - -ReelAction_NormalRate: ; 92c25 +ReelAction_NormalRate: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 4 ret -; 92c2c - -ReelAction_HalfRate: ; 92c2c +ReelAction_HalfRate: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 2 ret -; 92c33 - -ReelAction_QuarterRate: ; 92c33 +ReelAction_QuarterRate: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 1 ret -; 92c3a - -Slots_StopReel: ; 92c3a +Slots_StopReel: ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 @@ -972,7 +944,7 @@ Slots_StopReel: ; 92c3a ld hl, REEL_STOP_DELAY add hl, bc ld [hl], 3 -ReelAction_StopReelIgnoreJoypad: ; 92c4c +ReelAction_StopReelIgnoreJoypad: ld hl, REEL_STOP_DELAY add hl, bc ld a, [hl] @@ -988,9 +960,7 @@ ReelAction_StopReelIgnoreJoypad: ; 92c4c ld [hl], a ret -; 92c5e - -ReelAction_StopReel1: ; 92c5e +ReelAction_StopReel1: ; If no bias: don't manipulate reel. ; If bias: manipulate reel up to wReel1ManipCounter (i.e. 4) slots, ; stoping early if the biased symbol shows up anywhere in reel #1, @@ -1011,9 +981,7 @@ ReelAction_StopReel1: ; 92c5e call Slots_StopReel ret -; 92c76 - -.CheckForBias: ; 92c76 +.CheckForBias: call Slots_GetCurrentReelState ld a, [wSlotBias] ld e, a @@ -1027,9 +995,7 @@ ReelAction_StopReel1: ; 92c5e cp e ret -; 92c86 - -ReelAction_StopReel2: ; 92c86 +ReelAction_StopReel2: ; If no bias: don't manipulate reel. ; If bias: manipulate reel up to wReel2ManipCounter (i.e. 4) slots, ; stoping early if the biased symbol is lined up in the first two @@ -1057,9 +1023,7 @@ ReelAction_StopReel2: ; 92c86 call Slots_StopReel ret -; 92ca9 - -ReelAction_StopReel3: ; 92ca9 +ReelAction_StopReel3: ; Manipulate the reel up to wReel3ManipCounter (i.e. 4) slots, ; stopping early if the bias symbol is lined up for a win. ; If not biased to any symbols, stop as soon as nothing is lined up. @@ -1093,9 +1057,7 @@ ReelAction_StopReel3: ; 92ca9 call Slots_StopReel ret -; 92cd2 - -ReelAction_SetUpReel2SkipTo7: ; 92cd2 +ReelAction_SetUpReel2SkipTo7: ; Unique reel 2 action (see Slots_StopReel2) ; Ensures that 7 symbols become lined up in the first two reels, ; but more often than not, this is only a way to get our hopes up, as @@ -1123,9 +1085,7 @@ ReelAction_SetUpReel2SkipTo7: ; 92cd2 ld [hl], 0 ret -; 92cf8 - -ReelAction_WaitReel2SkipTo7: ; 92cf8 +ReelAction_WaitReel2SkipTo7: ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] @@ -1145,9 +1105,7 @@ ReelAction_WaitReel2SkipTo7: ; 92cf8 ld [hl], 8 ret -; 92d13 - -ReelAction_FastSpinReel2UntilLinedUp7s: ; 92d13 +ReelAction_FastSpinReel2UntilLinedUp7s: call Slots_CheckMatchedFirstTwoReels ret nc ld a, [wFirstTwoReelsMatchingSevens] @@ -1156,9 +1114,7 @@ ReelAction_FastSpinReel2UntilLinedUp7s: ; 92d13 call Slots_StopReel ret -; 92d20 - -ReelAction_InitGolem: ; 92d20 +ReelAction_InitGolem: ; Ensures SEVENs are lined up if there's bias to SEVEN. ; Ensures nothing is lined up if there's no bias symbols. ; No other bias symbols are compatible with this mode. @@ -1191,7 +1147,7 @@ ReelAction_InitGolem: ; 92d20 pop bc xor a ld [wSlotsDelay], a -ReelAction_WaitGolem: ; 92d4f +ReelAction_WaitGolem: ld a, [wSlotsDelay] cp 2 jr z, .two @@ -1213,9 +1169,7 @@ ReelAction_WaitGolem: ; 92d4f ld [hl], 8 ret -; 92d6e - -ReelAction_EndGolem: ; 92d6e +ReelAction_EndGolem: xor a ld [wSlotsDelay], a ld hl, REEL_ACTION @@ -1226,9 +1180,7 @@ ReelAction_EndGolem: ; 92d6e ld [hl], 0 ret -; 92d7e - -ReelAction_InitChansey: ; 92d7e +ReelAction_InitChansey: ; Ensures the lining up of SEVEN symbols, but this mode is only possible ; when there is bias to SEVEN symbols (and even then, it's still rare). ; Chansey releases and egg and reel #3 is made to advance 17 slots very @@ -1254,9 +1206,7 @@ ReelAction_InitChansey: ; 92d7e ld [wSlotsDelay], a ret -; 92da4 - -ReelAction_WaitChansey: ; 92da4 +ReelAction_WaitChansey: ld a, [wSlotsDelay] and a ret z @@ -1265,7 +1215,7 @@ ReelAction_WaitChansey: ; 92da4 inc [hl] ; REEL_ACTION_WAIT_EGG ld a, 2 ld [wSlotsDelay], a -ReelAction_WaitEgg: ; 92db3 +ReelAction_WaitEgg: ld a, [wSlotsDelay] cp $4 ret c @@ -1278,7 +1228,7 @@ ReelAction_WaitEgg: ; 92db3 ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], 17 -ReelAction_DropReel: ; 92dca +ReelAction_DropReel: ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] @@ -1309,9 +1259,7 @@ ReelAction_DropReel: ; 92dca ld [wSlotsDelay], a ret -; 92df7 - -ReelAction_Unused: ; 92df7 +ReelAction_Unused: call Slots_CheckMatchedAllThreeReels ret c ld a, SFX_STOP_SLOT @@ -1324,7 +1272,7 @@ ReelAction_Unused: ; 92df7 ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], a -ReelAction_CheckDropReel: ; 92e10 +ReelAction_CheckDropReel: ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] @@ -1345,7 +1293,7 @@ ReelAction_CheckDropReel: ; 92e10 ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 -ReelAction_WaitDropReel: ; 92e31 +ReelAction_WaitDropReel: ld hl, REEL_FIELD_0B add hl, bc ld a, [hl] @@ -1363,9 +1311,7 @@ ReelAction_WaitDropReel: ; 92e31 ld [hl], 8 ret -; 92e47 - -ReelAction_StartSlowAdvanceReel3: ; 92e47 +ReelAction_StartSlowAdvanceReel3: ; Ensures SEVENs are lined up if there's bias to SEVEN. ; Ensures nothing is lined up if there's no bias symbols. ; No other bias symbols are compatible with this mode. @@ -1387,7 +1333,7 @@ ReelAction_StartSlowAdvanceReel3: ; 92e47 ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], 16 -ReelAction_WaitSlowAdvanceReel3: ; 92e64 +ReelAction_WaitSlowAdvanceReel3: ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] @@ -1418,9 +1364,7 @@ ReelAction_WaitSlowAdvanceReel3: ; 92e64 call WaitSFX ret -; 92e94 - -Slots_CheckMatchedFirstTwoReels: ; 92e94 +Slots_CheckMatchedFirstTwoReels: xor a ld [wFirstTwoReelsMatching], a ld [wFirstTwoReelsMatchingSevens], a @@ -1447,77 +1391,62 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 scf ret -; 92ebd - -.Jumptable: ; 92ebd +.Jumptable: dw .zero dw .one dw .two dw .three -; 92ec5 -.three ; 92ec5 +.three call .CheckUpwardsDiag call .CheckDownwardsDiag -.two ; 92ecb +.two call .CheckBottomRow call .CheckTopRow -.one ; 92ed1 +.one call .CheckMiddleRow -.zero ; 92ed4 +.zero ret -; 92ed5 - -.CheckBottomRow: ; 92ed5 +.CheckBottomRow: ld hl, wCurrReelStopped ld a, [wReel1Stopped] cp [hl] call z, .StoreResult ret -; 92ee0 - -.CheckUpwardsDiag: ; 92ee0 +.CheckUpwardsDiag: ld hl, wCurrReelStopped + 1 ld a, [wReel1Stopped] cp [hl] call z, .StoreResult ret -; 92eeb - -.CheckMiddleRow: ; 92eeb +.CheckMiddleRow: ld hl, wCurrReelStopped + 1 ld a, [wReel1Stopped + 1] cp [hl] call z, .StoreResult ret -; 92ef6 - -.CheckDownwardsDiag: ; 92ef6 +.CheckDownwardsDiag: ld hl, wCurrReelStopped + 1 ld a, [wReel1Stopped + 2] cp [hl] call z, .StoreResult ret -; 92f01 - -.CheckTopRow: ; 92f01 +.CheckTopRow: ld hl, wCurrReelStopped + 2 ld a, [wReel1Stopped + 2] cp [hl] call z, .StoreResult ret -; 92f0c - -.StoreResult: ; 92f0c +.StoreResult: ld [wSlotBuildingMatch], a and a jr nz, .matching_sevens @@ -1529,9 +1458,7 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 ld [wFirstTwoReelsMatching], a ret -; 92f1d - -Slots_CheckMatchedAllThreeReels: ; 92f1d +Slots_CheckMatchedAllThreeReels: ld a, SLOTS_NO_MATCH ld [wSlotMatched], a call Slots_GetCurrentReelState @@ -1561,32 +1488,27 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d scf ret -; 92f48 - -.Jumptable: ; 92f48 +.Jumptable: dw .zero dw .one dw .two dw .three -; 92f50 -.three ; 92f50 +.three call .CheckUpwardsDiag call .CheckDownwardsDiag -.two ; 92f56 +.two call .CheckBottomRow call .CheckTopRow -.one ; 92f5c +.one call .CheckMiddleRow -.zero ; 92f5f +.zero ret -; 92f60 - -.CheckBottomRow: ; 92f60 +.CheckBottomRow: ld hl, wCurrReelStopped ld a, [wReel1Stopped] cp [hl] @@ -1596,9 +1518,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d call z, .StoreResult ret -; 92f70 - -.CheckUpwardsDiag: ; 92f70 +.CheckUpwardsDiag: ld hl, wCurrReelStopped + 2 ld a, [wReel1Stopped] cp [hl] @@ -1608,9 +1528,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d call z, .StoreResult ret -; 92f80 - -.CheckMiddleRow: ; 92f80 +.CheckMiddleRow: ld hl, wCurrReelStopped + 1 ld a, [wReel1Stopped + 1] cp [hl] @@ -1620,9 +1538,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d call z, .StoreResult ret -; 92f90 - -.CheckDownwardsDiag: ; 92f90 +.CheckDownwardsDiag: ld hl, wCurrReelStopped ld a, [wReel1Stopped + 2] cp [hl] @@ -1632,9 +1548,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d call z, .StoreResult ret -; 92fa0 - -.CheckTopRow: ; 92fa0 +.CheckTopRow: ld hl, wCurrReelStopped + 2 ld a, [wReel1Stopped + 2] cp [hl] @@ -1644,15 +1558,11 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d call z, .StoreResult ret -; 92fb0 - -.StoreResult: ; 92fb0 +.StoreResult: ld [wSlotMatched], a ret -; 92fb4 - -Slots_CopyReelState: ; 92fb4 +Slots_CopyReelState: ld de, wCurrReelStopped ld a, [hli] ld [de], a @@ -1664,9 +1574,7 @@ Slots_CopyReelState: ; 92fb4 ld [de], a ret -; 92fc0 - -Slots_GetNumberOfGolems: ; 92fc0 +Slots_GetNumberOfGolems: ld hl, REEL_POSITION add hl, bc ld a, [hl] @@ -1679,9 +1587,7 @@ Slots_GetNumberOfGolems: ; 92fc0 ld a, e ret -; 92fcf - -.Check7Bias: ; 92fcf +.Check7Bias: ld a, [wSlotBias] and a jr nz, .not_biased_to_seven @@ -1718,9 +1624,7 @@ Slots_GetNumberOfGolems: ; 92fc0 jr c, .loop2 ret -; 93002 - -Slots_InitBias: ; 93002 (24:7002) +Slots_InitBias: ld a, [wSlotBias] and a ret z @@ -1744,9 +1648,7 @@ Slots_InitBias: ; 93002 (24:7002) ld [wSlotBias], a ret -; 93023 (24:7023) - -.Normal: ; 93023 +.Normal: db $01, SLOTS_SEVEN ; 1/256 db $03, SLOTS_POKEBALL ; 1/128 db $0a, SLOTS_STARYU ; 7/256 @@ -1754,9 +1656,8 @@ Slots_InitBias: ; 93002 (24:7002) db $28, SLOTS_PIKACHU ; 5/64 db $30, SLOTS_CHERRY ; 1/32 db $ff, SLOTS_NO_BIAS ; everything else -; 93031 -.Lucky: ; 93031 +.Lucky: db $02, SLOTS_SEVEN ; 1/128 db $03, SLOTS_POKEBALL ; 1/256 db $08, SLOTS_STARYU ; 5/256 @@ -1764,9 +1665,8 @@ Slots_InitBias: ; 93002 (24:7002) db $1e, SLOTS_PIKACHU ; 7/128 db $50, SLOTS_CHERRY ; 25/128 db $ff, SLOTS_NO_BIAS ; everything else -; 9303f -Slots_IlluminateBetLights: ; 9303f (24:703f) +Slots_IlluminateBetLights: ld b, $14 ; turned on ld a, [wSlotBet] dec a @@ -1775,22 +1675,22 @@ Slots_IlluminateBetLights: ; 9303f (24:703f) jr z, Slots_Lights2OnOff jr Slots_Lights3OnOff -Slots_DeilluminateBetLights: ; 9304c (24:704c) +Slots_DeilluminateBetLights: ld b, $23 ; turned off -Slots_Lights3OnOff: ; 9304e (24:704e) +Slots_Lights3OnOff: hlcoord 3, 2 call Slots_TurnLightsOnOrOff hlcoord 3, 10 call Slots_TurnLightsOnOrOff -Slots_Lights2OnOff: ; 9305a (24:705a) +Slots_Lights2OnOff: hlcoord 3, 4 call Slots_TurnLightsOnOrOff hlcoord 3, 8 call Slots_TurnLightsOnOrOff -Slots_Lights1OnOff: ; 93066 (24:7066) +Slots_Lights1OnOff: hlcoord 3, 6 -Slots_TurnLightsOnOrOff: ; 93069 (24:7069) +Slots_TurnLightsOnOrOff: ld a, b ld [hl], a ld de, SCREEN_WIDTH / 2 + 3 @@ -1805,7 +1705,7 @@ Slots_TurnLightsOnOrOff: ; 93069 (24:7069) ld [hl], a ret -Slots_AskBet: ; 9307c (24:707c) +Slots_AskBet: .loop ld hl, .Text_BetHowManyCoins call PrintText @@ -1847,42 +1747,35 @@ Slots_AskBet: ; 9307c (24:707c) and a ret -; 930c7 (24:70c7) - -.Text_BetHowManyCoins: ; 0x930c7 +.Text_BetHowManyCoins: ; Bet how many coins? text_jump UnknownText_0x1c5049 db "@" -; 0x930cc -.Text_Start: ; 0x930cc +.Text_Start: ; Start! text_jump UnknownText_0x1c505e db "@" -; 0x930d1 -.Text_NotEnoughCoins: ; 0x930d1 +.Text_NotEnoughCoins: ; Not enough coins. text_jump UnknownText_0x1c5066 db "@" -; 0x930d6 -.MenuHeader: ; 0x930d6 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 14, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -; 0x930de -.MenuData: ; 0x930de +.MenuData: db STATICMENU_CURSOR ; flags db 3 ; items db " 3@" db " 2@" db " 1@" -; 0x930e9 -Slots_AskPlayAgain: ; 930e9 (24:70e9) +Slots_AskPlayAgain: ld hl, wCoins ld a, [hli] or [hl] @@ -1911,17 +1804,15 @@ Slots_AskPlayAgain: ; 930e9 (24:70e9) scf ret -; 9311a (24:711a) - -.Text_OutOfCoins: ; 9311a +.Text_OutOfCoins: text_jump UnknownText_0x1c5079 db "@" -.Text_PlayAgain: ; 9311f +.Text_PlayAgain: text_jump UnknownText_0x1c5092 db "@" -Slots_GetPayout: ; 93124 (24:7124) +Slots_GetPayout: ld a, [wSlotMatched] cp SLOTS_NO_MATCH jr z, .no_win @@ -1954,7 +1845,7 @@ Slots_GetPayout: ; 93124 (24:7124) ld [hl], a ret -Slots_PayoutText: ; 93158 (24:7158) +Slots_PayoutText: ld a, [wSlotMatched] cp SLOTS_NO_MATCH jr nz, .MatchedSomething @@ -1987,18 +1878,15 @@ Slots_PayoutText: ; 93158 (24:7158) farcall StubbedTrainerRankings_AddToSlotsWinStreak ret -; 93195 (24:7195) - -.PayoutStrings: ; 93195 +.PayoutStrings: dbw "300@", .LinedUpSevens dbw "50@@", .LinedUpPokeballs dbw "6@@@", .LinedUpMonOrCherry dbw "8@@@", .LinedUpMonOrCherry dbw "10@@", .LinedUpMonOrCherry dbw "15@@", .LinedUpMonOrCherry -; 931b9 -.Text_PrintPayout: ; 0x931b9 +.Text_PrintPayout: start_asm ld a, [wSlotMatched] add $25 @@ -2017,21 +1905,17 @@ rept 4 endr ret -; 931db - -.Text_LinedUpWonCoins: ; 0x931db +.Text_LinedUpWonCoins: ; lined up! Won @ coins! text_jump UnknownText_0x1c509f db "@" -; 0x931e0 -.Text_Darn: ; 0x931e0 +.Text_Darn: ; Darn! text_jump UnknownText_0x1c50bb db "@" -; 0x931e5 -.LinedUpSevens: ; 931e5 +.LinedUpSevens: ld a, SFX_2ND_PLACE call Slots_PlaySFX call WaitSFX @@ -2058,25 +1942,19 @@ endr ld [wSlotBias], a ret -; 9320b - -.LinedUpPokeballs: ; 9320b +.LinedUpPokeballs: ld a, SFX_3RD_PLACE call Slots_PlaySFX call WaitSFX ret -; 93214 - -.LinedUpMonOrCherry: ; 93214 +.LinedUpMonOrCherry: ld a, SFX_PRESENT call Slots_PlaySFX call WaitSFX ret -; 9321d - -Slots_AnimateGolem: ; 9321d (24:721d) +Slots_AnimateGolem: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld e, [hl] @@ -2089,12 +1967,12 @@ Slots_AnimateGolem: ; 9321d (24:721d) ld l, a jp hl -.Jumptable: ; 9322d (24:722d) +.Jumptable: dw .init dw .fall dw .roll -.init ; 93233 (24:7233) +.init ld hl, SPRITEANIMSTRUCT_0E add hl, bc ld a, [hl] @@ -2119,7 +1997,7 @@ Slots_AnimateGolem: ; 9321d (24:721d) add hl, bc ld [hl], $0 -.fall ; 93259 (24:7259) +.fall ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -2148,7 +2026,7 @@ Slots_AnimateGolem: ; 9321d (24:721d) call Slots_PlaySFX ret -.roll ; 93289 (24:7289) +.roll ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] @@ -2175,7 +2053,7 @@ Slots_AnimateGolem: ; 9321d (24:721d) ld [hSCY], a ret -Slots_AnimateChansey: ; 932ac (24:72ac) +Slots_AnimateChansey: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld e, [hl] @@ -2188,12 +2066,12 @@ Slots_AnimateChansey: ; 932ac (24:72ac) ld l, a jp hl -.Jumptable: ; 932bc (24:72bc) +.Jumptable: dw .walk dw .one dw .two -.walk ; 932c2 (24:72c2) +.walk ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2213,7 +2091,7 @@ Slots_AnimateChansey: ; 932ac (24:72ac) ld a, 1 ld [wSlotsDelay], a -.one ; 932e0 (24:72e0) +.one ld a, [wSlotsDelay] cp $2 jr z, .retain @@ -2231,7 +2109,7 @@ Slots_AnimateChansey: ; 932ac (24:72ac) ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], $8 -.two ; 932fc (24:72fc) +.two ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -2251,18 +2129,14 @@ Slots_AnimateChansey: ; 932ac (24:72ac) pop bc ret -; 93316 (24:7316) - -Slots_WaitSFX: ; 93316 +Slots_WaitSFX: push bc ld c, 16 call DelayFrames pop bc ret -; 9331e - -Slots_PlaySFX: ; 9331e (24:731e) +Slots_PlaySFX: push de ld e, a ld d, 0 @@ -2270,11 +2144,9 @@ Slots_PlaySFX: ; 9331e (24:731e) pop de ret -; 93327 (24:7327) - ; The first three positions are repeated to ; avoid needing to check indices when copying. -Reel1Tilemap: ; 93327 +Reel1Tilemap: db SLOTS_SEVEN ; 0 db SLOTS_CHERRY ; 1 db SLOTS_STARYU ; 2 @@ -2294,7 +2166,7 @@ Reel1Tilemap: ; 93327 db SLOTS_CHERRY ; 1 db SLOTS_STARYU ; 2 -Reel2Tilemap: ; 93339 +Reel2Tilemap: db SLOTS_SEVEN ; 0 db SLOTS_PIKACHU ; 1 db SLOTS_CHERRY ; 2 @@ -2314,7 +2186,7 @@ Reel2Tilemap: ; 93339 db SLOTS_PIKACHU ; 1 db SLOTS_CHERRY ; 2 -Reel3Tilemap: ; 9334b +Reel3Tilemap: db SLOTS_SEVEN ; 0 db SLOTS_PIKACHU ; 1 db SLOTS_CHERRY ; 2 @@ -2333,20 +2205,15 @@ Reel3Tilemap: ; 9334b db SLOTS_SEVEN ; 0 db SLOTS_PIKACHU ; 1 db SLOTS_CHERRY ; 2 -; 9335d -SlotsTilemap: ; 9335d +SlotsTilemap: INCBIN "gfx/slots/slots.tilemap" -; 9344d -Slots1LZ: ; 9344d +Slots1LZ: INCBIN "gfx/slots/slots_1.2bpp.lz" -; 935cd -Slots2LZ: ; 935cd +Slots2LZ: INCBIN "gfx/slots/slots_2.2bpp.lz" -; 9382d -Slots3LZ: ; 9382d +Slots3LZ: INCBIN "gfx/slots/slots_3.2bpp.lz" -; 93a3d diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index 300f07de4..40c6527d9 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -3,7 +3,7 @@ PUZZLE_VOID EQU $ef puzcoord EQUS "* 6 +" -_UnownPuzzle: ; e1190 +_UnownPuzzle: ld a, [hInMenu] push af ld a, $1 @@ -19,11 +19,11 @@ _UnownPuzzle: ; e1190 xor a call ByteFill ld hl, UnownPuzzleCursorGFX - ld de, vTiles1 tile $60 + ld de, vTiles0 tile $e0 ld bc, 4 tiles call CopyBytes ld hl, UnownPuzzleStartCancelLZ - ld de, vTiles1 tile $6d + ld de, vTiles0 tile $ed call Decompress call LoadUnownPuzzlePiecesGFX hlcoord 0, 0 @@ -88,9 +88,8 @@ _UnownPuzzle: ; e1190 ld a, LCDC_DEFAULT ld [rLCDC], a ret -; e124e -InitUnownPuzzlePiecePositions: ; e124e +InitUnownPuzzlePiecePositions: ld c, 1 ld b, 16 .load_loop @@ -111,9 +110,8 @@ InitUnownPuzzlePiecePositions: ; e124e dec b jr nz, .load_loop ret -; e126d -.PuzzlePieceInitialPositions: ; e126d +.PuzzlePieceInitialPositions: initpuzcoord: MACRO rept _NARG / 2 db \1 puzcoord \2 @@ -128,9 +126,8 @@ ENDM initpuzcoord 4,0, 4,5 initpuzcoord 5,0, 5,5 ; START > CANCEL -; e127d -PlaceStartCancelBox: ; e127d +PlaceStartCancelBox: call PlaceStartCancelBoxBorder hlcoord 5, 16 ld a, $f6 @@ -141,9 +138,8 @@ PlaceStartCancelBox: ; e127d dec c jr nz, .loop ret -; e128d -PlaceStartCancelBoxBorder: ; e128d +PlaceStartCancelBoxBorder: hlcoord 4, 15 ld a, $f0 ld [hli], a @@ -172,9 +168,8 @@ PlaceStartCancelBoxBorder: ; e128d ld a, $f5 ld [hl], a ret -; e12ca -UnownPuzzleJumptable: ; e12ca +UnownPuzzleJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -185,13 +180,11 @@ UnownPuzzleJumptable: ; e12ca ld h, [hl] ld l, a jp hl -; e12d9 -.Jumptable: ; e12d9 +.Jumptable: dw .Function -; e12db -.Function: ; e12db +.Function: ld a, [hJoyPressed] and START jp nz, UnownPuzzle_Quit @@ -299,9 +292,8 @@ UnownPuzzleJumptable: ; e12ca .play_sfx call PlaySFX ret -; e1376 -UnownPuzzle_A: ; e1376 +UnownPuzzle_A: ld a, [wHoldingUnownPuzzlePiece] and a jr nz, .TryPlacePiece @@ -348,19 +340,18 @@ UnownPuzzle_A: ; e1376 call SimpleWaitPressAorB ld a, TRUE ld [wSolvedUnownPuzzle], a -UnownPuzzle_Quit: ; e13de +UnownPuzzle_Quit: ld hl, wJumptableIndex set 7, [hl] ret -UnownPuzzle_InvalidAction: ; e13e4 +UnownPuzzle_InvalidAction: ld de, SFX_WRONG call PlaySFX call WaitSFX ret -; e13ee -UnownPuzzle_FillBox: ; e13ee +UnownPuzzle_FillBox: ld de, SCREEN_WIDTH .row push bc @@ -375,9 +366,8 @@ UnownPuzzle_FillBox: ; e13ee dec b jr nz, .row ret -; e13fe -UnownPuzzle_UpdateTilemap: ; e13fe +UnownPuzzle_UpdateTilemap: xor a ld [wUnownPuzzleCursorPosition], a ld c, 6 * 6 @@ -400,9 +390,8 @@ UnownPuzzle_UpdateTilemap: ; e13fe dec c jr nz, .loop ret -; e141f -PlaceUnownPuzzlePieceGFX: ; e141f +PlaceUnownPuzzlePieceGFX: ld a, $2 ; tilemap coords call GetUnownPuzzleCoordData ld a, [hli] @@ -427,9 +416,8 @@ PlaceUnownPuzzlePieceGFX: ; e141f dec b jr nz, .row ret -; e1441 -FillUnoccupiedPuzzleSpace: ; e1441 +FillUnoccupiedPuzzleSpace: ld a, 2 ; tilemap coords call GetUnownPuzzleCoordData ld a, [hli] @@ -454,9 +442,8 @@ FillUnoccupiedPuzzleSpace: ; e1441 dec b jr nz, .row ret -; e1463 -GetUnownPuzzleCoordData: ; e1463 +GetUnownPuzzleCoordData: ld e, a ld d, 0 ld hl, UnownPuzzleCoordData @@ -467,9 +454,8 @@ rept 6 add hl, de endr ret -; e1475 -UnownPuzzle_CheckCurrentTileOccupancy: ; e1475 +UnownPuzzle_CheckCurrentTileOccupancy: ld hl, wPuzzlePieces ld a, [wUnownPuzzleCursorPosition] ld e, a @@ -477,9 +463,8 @@ UnownPuzzle_CheckCurrentTileOccupancy: ; e1475 add hl, de ld a, [hl] ret -; e1481 -GetCurrentPuzzlePieceVTileCorner: ; e1481 +GetCurrentPuzzlePieceVTileCorner: ld a, [wUnownPuzzleHeldPiece] ld hl, .Corners add l @@ -489,9 +474,8 @@ GetCurrentPuzzlePieceVTileCorner: ; e1481 ld h, a ld a, [hl] ret -; e148f -.Corners: ; e148f +.Corners: ; 00, 01, 02 ; 0c, 0d, 0e ; 18, 19, 1a @@ -500,9 +484,8 @@ GetCurrentPuzzlePieceVTileCorner: ; e1481 db $24, $27, $2a, $2d db $48, $4b, $4e, $51 db $6c, $6f, $72, $75 -; e14a0 -CheckSolvedUnownPuzzle: ; e14a0 +CheckSolvedUnownPuzzle: ld hl, .SolvedPuzzleConfiguration ld de, wPuzzlePieces ld c, 6 * 6 @@ -520,18 +503,16 @@ CheckSolvedUnownPuzzle: ; e14a0 .not_solved and a ret -; e14b5 -.SolvedPuzzleConfiguration: ; e14b5 +.SolvedPuzzleConfiguration: db $00, $00, $00, $00, $00, $00 db $00, $01, $02, $03, $04, $00 db $00, $05, $06, $07, $08, $00 db $00, $09, $0a, $0b, $0c, $00 db $00, $0d, $0e, $0f, $10, $00 db $00, $00, $00, $00, $00, $00 -; e14d9 -RedrawUnownPuzzlePieces: ; e14d9 +RedrawUnownPuzzlePieces: call GetCurrentPuzzlePieceVTileCorner ld [wd002], a xor a @@ -570,9 +551,8 @@ RedrawUnownPuzzlePieces: ; e14d9 ld [de], a ; attributes inc de jr .loop -; e150f -.OAM_HoldingPiece: ; e150f +.OAM_HoldingPiece: dsprite -1, -4, -1, -4, $00, 0 dsprite -1, -4, 0, -4, $01, 0 dsprite -1, -4, 0, 4, $02, 0 @@ -584,7 +564,7 @@ RedrawUnownPuzzlePieces: ; e14d9 dsprite 0, 4, 0, 4, $1a, 0 db -1 -.OAM_NotHoldingPiece: ; e1534 +.OAM_NotHoldingPiece: dsprite -1, -4, -1, -4, $00, 0 dsprite -1, -4, 0, -4, $01, 0 dsprite -1, -4, 0, 4, $00, 0 | X_FLIP @@ -596,7 +576,7 @@ RedrawUnownPuzzlePieces: ; e14d9 dsprite 0, 4, 0, 4, $00, 0 | X_FLIP | Y_FLIP db -1 -UnownPuzzleCoordData: ; e1559 +UnownPuzzleCoordData: puzzle_coords: MACRO dbpixel \1, \2, \3, \4 @@ -646,7 +626,7 @@ ENDM puzzle_coords 15, 18, 4, 4, 13, 15, PUZZLE_BORDER, 0 puzzle_coords 18, 18, 4, 4, 16, 15, PUZZLE_BORDER, 0 -ConvertLoadedPuzzlePieces: ; e1631 +ConvertLoadedPuzzlePieces: ld hl, vTiles2 ld de, vTiles0 ld b, 6 @@ -667,9 +647,8 @@ ConvertLoadedPuzzlePieces: ; e1631 jr nz, .loop call UnownPuzzle_AddPuzzlePieceBorders ret -; e1654 -.EnlargePuzzlePieceTiles: ; e1654 +.EnlargePuzzlePieceTiles: ; double size ld c, 6 .loop1 @@ -738,9 +717,8 @@ ConvertLoadedPuzzlePieces: ; e1631 dec c jr nz, .loop1 ret -; e16aa -.GetEnlargedTile: ; e16aa +.GetEnlargedTile: push hl ld hl, .EnlargedTiles add l @@ -751,18 +729,15 @@ ConvertLoadedPuzzlePieces: ; e1631 ld a, [hl] pop hl ret -; e16b7 - -.EnlargedTiles: ; e16b7 +.EnlargedTiles: x = 0 rept 16 db ((x & %1000) * %11000) + ((x & %0100) * %1100) + ((x & %0010) * %110) + ((x & %0001) * %11) x = x + 1 endr -; e16c7 -UnownPuzzle_AddPuzzlePieceBorders: ; e16c7 +UnownPuzzle_AddPuzzlePieceBorders: ld hl, PuzzlePieceBorderData ld a, 8 .loop @@ -784,9 +759,8 @@ endr dec a jr nz, .loop ret -; e16e2 -.LoadGFX: ; e16e2 +.LoadGFX: lb bc, 4, 4 .loop1 push bc @@ -817,9 +791,8 @@ endr dec b jr nz, .loop1 ret -; e1703 -PuzzlePieceBorderData: ; e1703 +PuzzlePieceBorderData: dw .TileBordersGFX + 0 tiles, vTiles0 tile $00 dw .TileBordersGFX + 1 tiles, vTiles0 tile $01 dw .TileBordersGFX + 2 tiles, vTiles0 tile $02 @@ -828,12 +801,11 @@ PuzzlePieceBorderData: ; e1703 dw .TileBordersGFX + 5 tiles, vTiles0 tile $18 dw .TileBordersGFX + 6 tiles, vTiles0 tile $19 dw .TileBordersGFX + 7 tiles, vTiles0 tile $1a -; e1723 -.TileBordersGFX: ; e1723 +.TileBordersGFX: INCBIN "gfx/unown_puzzle/tile_borders.2bpp" -LoadUnownPuzzlePiecesGFX: ; e17a3 +LoadUnownPuzzlePiecesGFX: ld a, [wScriptVar] maskbits NUM_UNOWN_PUZZLES ld e, a @@ -848,30 +820,28 @@ LoadUnownPuzzlePiecesGFX: ; e17a3 call Decompress call ConvertLoadedPuzzlePieces ret -; e17bd -.LZPointers: ; e17bd +.LZPointers: ; entries correspond to UNOWNPUZZLE_* constants dw KabutoPuzzleLZ dw OmanytePuzzleLZ dw AerodactylPuzzleLZ dw HoOhPuzzleLZ -; e17c5 -UnownPuzzleCursorGFX: ; e17c5 +UnownPuzzleCursorGFX: INCBIN "gfx/unown_puzzle/cursor.2bpp" -UnownPuzzleStartCancelLZ: ; e1805 +UnownPuzzleStartCancelLZ: INCBIN "gfx/unown_puzzle/start_cancel.2bpp.lz" -HoOhPuzzleLZ: ; e18ab +HoOhPuzzleLZ: INCBIN "gfx/unown_puzzle/hooh.2bpp.lz" -AerodactylPuzzleLZ: ; e19fb +AerodactylPuzzleLZ: INCBIN "gfx/unown_puzzle/aerodactyl.2bpp.lz" -KabutoPuzzleLZ: ; e1bab +KabutoPuzzleLZ: INCBIN "gfx/unown_puzzle/kabuto.2bpp.lz" -OmanytePuzzleLZ: ; e1c9b +OmanytePuzzleLZ: INCBIN "gfx/unown_puzzle/omanyte.2bpp.lz" diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index b36dceeb6..d8f53d7fc 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -1,12 +1,11 @@ ; Replaces the functionality of sgb.asm to work with CGB hardware. -CheckCGB: ; 8d55 +CheckCGB: ld a, [hCGB] and a ret -; 8d59 -LoadSGBLayoutCGB: ; 8d59 +LoadSGBLayoutCGB: ld a, b cp SCGB_RAM jr nz, .not_ram @@ -26,13 +25,11 @@ LoadSGBLayoutCGB: ; 8d59 ld de, .ReturnFromJumpTable push de jp hl -; 8d79 -.ReturnFromJumpTable: ; 8d79 +.ReturnFromJumpTable: ret -; 8d7a -.dw ; 8d7a +.dw dw _CGB_BattleGrayscale dw _CGB_BattleColors dw _CGB_PokegearPals @@ -48,7 +45,7 @@ LoadSGBLayoutCGB: ; 8d59 dw _CGB_GSTitleScreen dw _CGB0d dw _CGB_MoveList - dw _CGB0f + dw _CGB_BetaPikachuMinigame dw _CGB_PokedexSearchOption dw _CGB11 dw _CGB_Pokepic @@ -64,9 +61,8 @@ LoadSGBLayoutCGB: ; 8d59 dw _CGB_TrainerOrMonFrontpicPals dw _CGB_MysteryGift dw _CGB1e -; 8db8 -_CGB_BattleGrayscale: ; 8db8 +_CGB_BattleGrayscale: ld hl, PalPacket_BattleGrayscale + 1 ld de, wBGPals1 ld c, 4 @@ -81,7 +77,7 @@ _CGB_BattleGrayscale: ; 8db8 call CopyPalettes jr _CGB_FinishBattleScreenLayout -_CGB_BattleColors: ; 8ddb +_CGB_BattleColors: ld de, wBGPals1 call GetBattlemonBackpicPalettePointer push hl @@ -115,7 +111,7 @@ _CGB_BattleColors: ; 8ddb ld a, SCGB_BATTLE_COLORS ld [wSGBPredef], a call ApplyPals -_CGB_FinishBattleScreenLayout: ; 8e23 +_CGB_FinishBattleScreenLayout: call InitPartyMenuBGPal7 hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -152,12 +148,10 @@ _CGB_FinishBattleScreenLayout: ; 8e23 call FarCopyWRAM call ApplyAttrMap ret -; 8e85 - -InitPartyMenuBGPal7: ; 8e85 +InitPartyMenuBGPal7: farcall Function100dc0 -Mobile_InitPartyMenuBGPal7: ; 8e8b +Mobile_InitPartyMenuBGPal7: ld hl, PartyMenuBGPalette jr nc, .not_mobile ld hl, PartyMenuBGMobilePalette @@ -167,9 +161,8 @@ Mobile_InitPartyMenuBGPal7: ; 8e8b ld a, BANK(wBGPals1) call FarCopyWRAM ret -; 8e9f -InitPartyMenuBGPal0: ; 8e9f +InitPartyMenuBGPal0: farcall Function100dc0 ld hl, PartyMenuBGPalette jr nc, .not_mobile @@ -180,9 +173,8 @@ InitPartyMenuBGPal0: ; 8e9f ld a, BANK(wBGPals1) call FarCopyWRAM ret -; 8eb9 -_CGB_PokegearPals: ; 8eb9 +_CGB_PokegearPals: ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a jr z, .male @@ -200,9 +192,8 @@ _CGB_PokegearPals: ; 8eb9 ld a, $1 ld [hCGBPalUpdate], a ret -; 8edb -_CGB_StatsScreenHPPals: ; 8edb +_CGB_StatsScreenHPPals: ld de, wBGPals1 ld a, [wCurHPPal] ld l, a @@ -255,17 +246,14 @@ _CGB_StatsScreenHPPals: ; 8edb ld a, $1 ld [hCGBPalUpdate], a ret -; 8f52 -StatsScreenPagePals: ; 8f52 +StatsScreenPagePals: INCLUDE "gfx/stats/pages.pal" -; 8f6a -StatsScreenPals: ; 8f6a +StatsScreenPals: INCLUDE "gfx/stats/stats.pal" -; 8f70 -_CGB_Pokedex: ; 8f70 +_CGB_Pokedex: ld de, wBGPals1 ld a, PREDEFPAL_POKEDEX call GetPredefPal @@ -297,17 +285,14 @@ _CGB_Pokedex: ; 8f70 ld a, $1 ld [hCGBPalUpdate], a ret -; 8fba -.PokedexQuestionMarkPalette: ; 8fba +.PokedexQuestionMarkPalette: INCLUDE "gfx/pokedex/question_mark.pal" -; 8fc2 -.PokedexCursorPalette: ; 8fc2 +.PokedexCursorPalette: INCLUDE "gfx/pokedex/cursor.pal" -; 8fca -_CGB_BillsPC: ; 8fca +_CGB_BillsPC: ld de, wBGPals1 ld a, PREDEFPAL_POKEDEX call GetPredefPal @@ -335,9 +320,8 @@ _CGB_BillsPC: ; 8fca ld a, $1 ld [hCGBPalUpdate], a ret -; 9009 -.Function9009: ; 9009 +.Function9009: ld hl, .BillsPCOrangePalette call LoadHLPaletteIntoDE jr .asm_901a @@ -358,13 +342,11 @@ _CGB_BillsPC: ; 8fca ld a, $1 ld [hCGBPalUpdate], a ret -; 9036 -.BillsPCOrangePalette: ; 9036 +.BillsPCOrangePalette: INCLUDE "gfx/pc/orange.pal" -; 903e -_CGB_PokedexUnownMode: ; 903e +_CGB_PokedexUnownMode: ld de, wBGPals1 ld a, PREDEFPAL_POKEDEX call GetPredefPal @@ -383,9 +365,8 @@ _CGB_PokedexUnownMode: ; 903e ld a, $1 ld [hCGBPalUpdate], a ret -; 906e -_CGB_SlotMachine: ; 906e +_CGB_SlotMachine: ld hl, SlotMachinePals ld de, wBGPals1 ld bc, 16 palettes @@ -437,9 +418,8 @@ _CGB_SlotMachine: ; 906e ld a, $1 ld [hCGBPalUpdate], a ret -; 90f8 -_CGB06: ; 90f8 +_CGB06: ld hl, PalPacket_SCGB_06 + 1 call CopyFourPalettes call WipeAttrMap @@ -456,9 +436,8 @@ _CGB06: ; 90f8 ld a, $1 ld [hCGBPalUpdate], a ret -; 9122 -_CGB_GSIntro: ; 9122 +_CGB_GSIntro: ld b, 0 ld hl, .Jumptable add hl, bc @@ -467,15 +446,13 @@ _CGB_GSIntro: ; 9122 ld h, [hl] ld l, a jp hl -; 912d -.Jumptable: ; 912d +.Jumptable: dw .ShellderLaprasScene dw .JigglypuffPikachuScene dw .StartersCharizardScene -; 9133 -.ShellderLaprasScene: ; 9133 +.ShellderLaprasScene: ld hl, .ShellderLaprasBGPalette ld de, wBGPals1 call LoadHLPaletteIntoDE @@ -486,15 +463,14 @@ _CGB_GSIntro: ; 9122 call FarCopyWRAM call WipeAttrMap ret -; 914e -.ShellderLaprasBGPalette: ; 914e +.ShellderLaprasBGPalette: RGB 19, 31, 19 RGB 18, 23, 31 RGB 11, 21, 28 RGB 04, 16, 24 -.ShellderLaprasOBPals: ; 9156 +.ShellderLaprasOBPals: RGB 29, 29, 29 RGB 20, 19, 20 RGB 19, 06, 04 @@ -504,9 +480,8 @@ _CGB_GSIntro: ; 9122 RGB 31, 31, 31 RGB 31, 00, 00 RGB 03, 04, 06 -; 9166 -.JigglypuffPikachuScene: ; 9166 +.JigglypuffPikachuScene: ld de, wBGPals1 ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG call GetPredefPal @@ -518,9 +493,8 @@ _CGB_GSIntro: ; 9122 call LoadHLPaletteIntoDE call WipeAttrMap ret -; 9180 -.StartersCharizardScene: ; 9180 +.StartersCharizardScene: ld hl, PalPacket_Pack + 1 call CopyFourPalettes ld de, wOBPals1 @@ -529,10 +503,9 @@ _CGB_GSIntro: ; 9122 call LoadHLPaletteIntoDE call WipeAttrMap ret -; 9195 -_CGB11: ; 9195 - ld hl, Palettes_SCGB_11 +_CGB11: + ld hl, BetaPokerPals ld de, wBGPals1 ld bc, 5 palettes ld a, BANK(wBGPals1) @@ -541,9 +514,8 @@ _CGB11: ; 9195 call WipeAttrMap call ApplyAttrMap ret -; 91ad -_CGB_Diploma: ; 91ad +_CGB_Diploma: ld hl, DiplomaPalettes ld de, wBGPals1 ld bc, 16 palettes @@ -555,16 +527,14 @@ _CGB_Diploma: ; 91ad call WipeAttrMap call ApplyAttrMap ret -; 91c8 -_CGB_MapPals: ; 91c8 +_CGB_MapPals: call LoadMapPals ld a, SCGB_MAPPALS ld [wSGBPredef], a ret -; 91d1 -_CGB_PartyMenu: ; 91d1 +_CGB_PartyMenu: ld hl, PalPacket_PartyMenu + 1 call CopyFourPalettes call InitPartyMenuBGPal0 @@ -572,9 +542,8 @@ _CGB_PartyMenu: ; 91d1 call InitPartyMenuOBPals call ApplyAttrMap ret -; 91e4 -_CGB_Evolution: ; 91e4 +_CGB_Evolution: ld de, wBGPals1 ld a, c and a @@ -607,9 +576,8 @@ _CGB_Evolution: ; 91e4 ld a, $1 ld [hCGBPalUpdate], a ret -; 9228 -_CGB_GSTitleScreen: ; 9228 +_CGB_GSTitleScreen: ld hl, UnusedGSTitleBGPals ld de, wBGPals1 ld bc, 5 palettes @@ -626,17 +594,15 @@ _CGB_GSTitleScreen: ; 9228 ld a, $1 ld [hCGBPalUpdate], a ret -; 9251 -_CGB0d: ; 9251 +_CGB0d: ld hl, PalPacket_Diploma + 1 call CopyFourPalettes call WipeAttrMap call ApplyAttrMap ret -; 925e -_CGB_UnownPuzzle: ; 925e +_CGB_UnownPuzzle: ld hl, PalPacket_UnownPuzzle + 1 call CopyFourPalettes ld de, wOBPals1 @@ -657,9 +623,8 @@ _CGB_UnownPuzzle: ; 925e call WipeAttrMap call ApplyAttrMap ret -; 9289 -_CGB_TrainerCard: ; 9289 +_CGB_TrainerCard: ld de, wBGPals1 xor a ; CHRIS call GetTrainerPalettePointer @@ -763,9 +728,8 @@ _CGB_TrainerCard: ; 9289 ld a, $1 ld [hCGBPalUpdate], a ret -; 9373 -_CGB_MoveList: ; 9373 +_CGB_MoveList: ld de, wBGPals1 ld a, PREDEFPAL_GOLDENROD call GetPredefPal @@ -788,10 +752,9 @@ _CGB_MoveList: ; 9373 ld a, $1 ld [hCGBPalUpdate], a ret -; 93a6 -_CGB0f: ; 93a6 - ld hl, PalPacket_SCGB_0F + 1 +_CGB_BetaPikachuMinigame: + ld hl, PalPacket_BetaPikachuMinigame + 1 call CopyFourPalettes call WipeAttrMap call ApplyAttrMap @@ -799,9 +762,8 @@ _CGB0f: ; 93a6 ld a, $1 ld [hCGBPalUpdate], a ret -; 93ba -_CGB_PokedexSearchOption: ; 93ba +_CGB_PokedexSearchOption: ld de, wBGPals1 ld a, PREDEFPAL_POKEDEX call GetPredefPal @@ -812,9 +774,8 @@ _CGB_PokedexSearchOption: ; 93ba ld a, $1 ld [hCGBPalUpdate], a ret -; 93d3 -_CGB_PackPals: ; 93d3 +_CGB_PackPals: ; pack pals ld a, [wBattleType] cp BATTLETYPE_TUTORIAL @@ -861,17 +822,14 @@ _CGB_PackPals: ; 93d3 ld a, $1 ld [hCGBPalUpdate], a ret -; 9439 -.ChrisPackPals: ; 9439 +.ChrisPackPals: INCLUDE "gfx/pack/pack.pal" -; 9469 -.KrisPackPals: ; 9469 +.KrisPackPals: INCLUDE "gfx/pack/pack_f.pal" -; 9499 -_CGB_Pokepic: ; 9499 +_CGB_Pokepic: call _CGB_MapPals ld de, SCREEN_WIDTH hlcoord 0, 0, wAttrMap @@ -904,9 +862,8 @@ _CGB_Pokepic: ; 9499 call FillBoxCGB call ApplyAttrMap ret -; 94d0 -_CGB13: ; 94d0 +_CGB13: ld hl, PalPacket_SCGB_13 + 1 call CopyFourPalettes call WipeAttrMap @@ -923,9 +880,8 @@ _CGB13: ; 94d0 ld a, $1 ld [hCGBPalUpdate], a ret -; 94fa -_CGB_GamefreakLogo: ; 94fa +_CGB_GamefreakLogo: ld de, wBGPals1 ld a, PREDEFPAL_GAMEFREAK_LOGO call GetPredefPal @@ -940,13 +896,11 @@ _CGB_GamefreakLogo: ; 94fa call ApplyAttrMap call ApplyPals ret -; 9521 -.Palette: ; 9521 +.Palette: INCLUDE "gfx/splash/logo.pal" -; 9529 -_CGB_PlayerOrMonFrontpicPals: ; 9529 +_CGB_PlayerOrMonFrontpicPals: ld de, wBGPals1 ld a, [wCurPartySpecies] ld bc, wTempMonDVs @@ -956,9 +910,8 @@ _CGB_PlayerOrMonFrontpicPals: ; 9529 call ApplyAttrMap call ApplyPals ret -; 9542 -_CGB1e: ; 9542 +_CGB1e: ld de, wBGPals1 ld a, [wCurPartySpecies] call GetMonPalettePointer_ @@ -966,9 +919,8 @@ _CGB1e: ; 9542 call WipeAttrMap call ApplyAttrMap ret -; 9555 -_CGB_TradeTube: ; 9555 +_CGB_TradeTube: ld hl, PalPacket_TradeTube + 1 call CopyFourPalettes ld hl, PartyMenuOBPals @@ -982,9 +934,8 @@ _CGB_TradeTube: ; 9555 call LoadHLPaletteIntoDE call WipeAttrMap ret -; 9578 -_CGB_TrainerOrMonFrontpicPals: ; 9578 +_CGB_TrainerOrMonFrontpicPals: ld de, wBGPals1 ld a, [wCurPartySpecies] ld bc, wTempMonDVs @@ -994,9 +945,8 @@ _CGB_TrainerOrMonFrontpicPals: ; 9578 call ApplyAttrMap call ApplyPals ret -; 9591 -_CGB_MysteryGift: ; 9591 +_CGB_MysteryGift: ld hl, .Palettes ld de, wBGPals1 ld bc, 2 palettes @@ -1026,8 +976,6 @@ _CGB_MysteryGift: ; 9591 call FillBoxCGB call ApplyAttrMap ret -; 95e0 -.Palettes: ; 95e0 +.Palettes: INCLUDE "gfx/mystery_gift/mystery_gift.pal" -; 95f0 diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 6cf896ff4..9a3b4f8ef 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -43,37 +43,36 @@ CheckShininess: and a ret -Unused_CheckContestMon: -; Check a mon's DVs at hl in the bug catching contest. -; Return carry if its DVs are good enough to place in the contest. +Unused_CheckShininess: +; Return carry if the DVs at hl are all 10 or higher. ; Attack ld a, [hl] cp 10 << 4 - jr c, .Bad + jr c, .NotShiny ; Defense ld a, [hli] and $f cp 10 - jr c, .Bad + jr c, .NotShiny ; Speed ld a, [hl] cp 10 << 4 - jr c, .Bad + jr c, .NotShiny ; Special ld a, [hl] and $f cp 10 - jr c, .Bad + jr c, .NotShiny -.Good: +.Shiny: scf ret -.Bad: +.NotShiny: and a ret @@ -108,7 +107,7 @@ InitPartyMenuPalettes: ret ; SGB layout for SCGB_PARTY_MENU_HP_PALS -SGB_ApplyPartyMenuHPPals: ; 8ade +SGB_ApplyPartyMenuHPPals: ld hl, wHPPals ld a, [wSGBPals] ld e, a @@ -182,12 +181,12 @@ Unreferenced_Function8b4d: ld a, [hSGB] and a ret z - ld hl, PalPacket_Function8b4d + ld hl, PalPacket_BetaIntroVenusaur jp PushSGBPals_ .cgb ld de, wOBPals1 - ld a, PREDEFPAL_3B + ld a, PREDEFPAL_BETA_INTRO_VENUSAUR call GetPredefPal jp LoadHLPaletteIntoDE @@ -649,7 +648,7 @@ ApplyAttrMap: ret ; CGB layout for SCGB_PARTY_MENU_HP_PALS -CGB_ApplyPartyMenuHPPals: ; 96f3 +CGB_ApplyPartyMenuHPPals: ld hl, wHPPals ld a, [wSGBPals] ld e, a @@ -1129,7 +1128,7 @@ SGBBorder_YetMorePalPushing: ld [rBGP], a ret -CopyData: ; 0x9a52 +CopyData: ; copy bc bytes of data from hl to de .loop ld a, [hli] @@ -1140,9 +1139,8 @@ CopyData: ; 0x9a52 or b jr nz, .loop ret -; 0x9a5b -ClearBytes: ; 0x9a5b +ClearBytes: ; clear bc bytes of data starting from de .loop xor a @@ -1153,9 +1151,8 @@ ClearBytes: ; 0x9a5b or b jr nz, .loop ret -; 0x9a64 -DrawDefaultTiles: ; 0x9a64 +DrawDefaultTiles: ; Draw 240 tiles (2/3 of the screen) from tiles in VRAM hlbgcoord 0, 0 ; BG Map 0 ld de, BG_MAP_WIDTH - SCREEN_WIDTH @@ -1173,7 +1170,6 @@ DrawDefaultTiles: ; 0x9a64 dec c jr nz, .line ret -; 0x9a7a SGBDelayCycles: ld de, 7000 @@ -1349,8 +1345,8 @@ INCLUDE "gfx/pokegear/pokegear.pal" FemalePokegearPals: INCLUDE "gfx/pokegear/pokegear_f.pal" -Palettes_SCGB_11: -INCLUDE "gfx/unknown/b789.pal" +BetaPokerPals: +INCLUDE "gfx/beta_poker/beta_poker.pal" SlotMachinePals: INCLUDE "gfx/slots/slots.pal" diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index 71e2e4f56..b9686701c 100644 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -1,4 +1,4 @@ -GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) +GetMysteryGift_MobileAdapterLayout: ld a, b cp SCGB_RAM jr nz, .not_ram @@ -20,15 +20,13 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) jp hl .done ret -; 49330 (12:5330) -.dw ; 49330 +.dw dw MG_Mobile_Layout00 dw MG_Mobile_Layout01 dw MG_Mobile_Layout02 -; 49336 -MG_Mobile_Layout_FillBox: ; 49336 +MG_Mobile_Layout_FillBox: .row push bc push hl @@ -43,16 +41,15 @@ MG_Mobile_Layout_FillBox: ; 49336 dec b jr nz, .row ret -; 49346 -MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) +MG_Mobile_Layout_WipeAttrMap: hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a call ByteFill ret -MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) +MG_Mobile_Layout_LoadPals: ld de, wBGPals1 ld hl, Palette_MysteryGiftMobile ld bc, 5 palettes @@ -65,7 +62,7 @@ MG_Mobile_Layout_LoadPals: ; 49351 (12:5351) call FarCopyWRAM ret -MG_Mobile_Layout00: ; 4936e (12:536e) +MG_Mobile_Layout00: call MG_Mobile_Layout_LoadPals call MG_Mobile_Layout_WipeAttrMap call MG_Mobile_Layout_CreatePalBoxes @@ -73,7 +70,7 @@ MG_Mobile_Layout00: ; 4936e (12:536e) farcall ApplyPals ret -MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) +MG_Mobile_Layout_CreatePalBoxes: hlcoord 0, 0, wAttrMap lb bc, 4, 1 ld a, $1 @@ -109,35 +106,30 @@ MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) ld a, $7 call ByteFill ret -; 493e1 (12:53e1) -Palette_MysteryGiftMobile: ; 493e1 +Palette_MysteryGiftMobile: INCLUDE "gfx/mystery_gift/mg_mobile.pal" -; 49409 -LoadOW_BGPal7:: ; 49409 +LoadOW_BGPal7:: ld hl, Palette_TextBG7 ld de, wBGPals1 palette PAL_BG_TEXT ld bc, 1 palettes ld a, BANK(wBGPals1) call FarCopyWRAM ret -; 49418 -Palette_TextBG7: ; 49418 +Palette_TextBG7: INCLUDE "gfx/font/bg_text.pal" -; 49420 -Function49420:: ; 49420 (12:5420) +Function49420:: ld hl, MansionPalette1 + 8 palettes ld de, wBGPals1 palette PAL_BG_ROOF ld bc, 1 palettes ld a, BANK(wBGPals1) call FarCopyWRAM ret -; 4942f (12:542f) -MG_Mobile_Layout01: ; 4942f +MG_Mobile_Layout01: call MG_Mobile_Layout_LoadPals ld de, wBGPals1 palette PAL_BG_TEXT ld hl, .Palette_49478 @@ -168,16 +160,14 @@ MG_Mobile_Layout01: ; 4942f ld a, $1 ld [hCGBPalUpdate], a ret -; 49478 -.Palette_49478: ; 49478 +.Palette_49478: RGB 31, 31, 31 RGB 26, 31, 00 RGB 20, 16, 03 RGB 00, 00, 00 -; 49480 -Function49480: ; 49480 +Function49480: hlcoord 0, 0, wAttrMap lb bc, 4, SCREEN_WIDTH ld a, $7 @@ -188,9 +178,8 @@ Function49480: ; 49480 hlcoord 19, 2, wAttrMap ld [hl], a ret -; 49496 -Function49496: ; 49496 +Function49496: hlcoord 0, 0, wAttrMap lb bc, 2, SCREEN_WIDTH ld a, $7 @@ -201,11 +190,10 @@ Function49496: ; 49496 hlcoord 19, 1, wAttrMap ld [hl], a ret -; 494ac INCLUDE "engine/tilesets/tileset_palettes.asm" -MG_Mobile_Layout02: ; 49706 +MG_Mobile_Layout02: ld hl, .Palette_49732 ld de, wBGPals1 ld bc, 1 palettes @@ -220,23 +208,20 @@ MG_Mobile_Layout02: ; 49706 ld a, BANK(wOBPals1) call FarCopyWRAM ret -; 49732 -.Palette_49732: ; 49732 +.Palette_49732: RGB 31, 31, 31 RGB 23, 16, 07 RGB 23, 07, 07 RGB 03, 07, 20 -; 4973a -.Palette_4973a: ; 4973a +.Palette_4973a: RGB 00, 00, 00 RGB 07, 05, 31 RGB 14, 18, 31 RGB 31, 31, 31 -; 49742 -Function49742: ; 49742 +Function49742: ld hl, .Palette_49757 ld de, wBGPals1 ld bc, 8 palettes @@ -244,13 +229,11 @@ Function49742: ; 49742 call FarCopyWRAM farcall ApplyPals ret -; 49757 -.Palette_49757: ; 49757 +.Palette_49757: INCLUDE "gfx/unknown/49757.pal" -; 49797 -_InitMG_Mobile_LinkTradePalMap: ; 49797 +_InitMG_Mobile_LinkTradePalMap: hlcoord 0, 0, wAttrMap lb bc, 16, 2 ld a, $4 @@ -300,9 +283,8 @@ _InitMG_Mobile_LinkTradePalMap: ; 49797 ld bc, 6 call ByteFill ret -; 49811 -LoadTradeRoomBGPals: ; 49811 +LoadTradeRoomBGPals: ld hl, TradeRoomPalette ld de, wBGPals1 palette PAL_BG_GREEN ld bc, 6 palettes @@ -310,16 +292,13 @@ LoadTradeRoomBGPals: ; 49811 call FarCopyWRAM farcall ApplyPals ret -; 49826 -TradeRoomPalette: ; 49826 +TradeRoomPalette: INCLUDE "gfx/trade/border.pal" -; 49856 -InitMG_Mobile_LinkTradePalMap: ; 49856 +InitMG_Mobile_LinkTradePalMap: call _InitMG_Mobile_LinkTradePalMap ret -; 4985a ; unused INCLUDE "gfx/unknown/4985a.asm" diff --git a/engine/gfx/dma_transfer.asm b/engine/gfx/dma_transfer.asm index e22adf69a..241649dc5 100644 --- a/engine/gfx/dma_transfer.asm +++ b/engine/gfx/dma_transfer.asm @@ -1,4 +1,4 @@ -HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000 +HDMATransferAttrMapAndTileMapToWRAMBank3:: ld hl, .Function jp CallInSafeGFXMode @@ -18,9 +18,8 @@ HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000 ld hl, wScratchAttrMap call HDMATransferToWRAMBank3 ret -; 10402d -HDMATransferTileMapToWRAMBank3:: ; 10402d +HDMATransferTileMapToWRAMBank3:: ld hl, .Function jp CallInSafeGFXMode @@ -33,9 +32,8 @@ HDMATransferTileMapToWRAMBank3:: ; 10402d ld hl, wScratchTileMap call HDMATransferToWRAMBank3 ret -; 104047 -HDMATransferAttrMapToWRAMBank3: ; 104047 +HDMATransferAttrMapToWRAMBank3: ld hl, .Function jp CallInSafeGFXMode @@ -48,9 +46,8 @@ HDMATransferAttrMapToWRAMBank3: ; 104047 ld hl, wScratchAttrMap call HDMATransferToWRAMBank3 ret -; 104061 -ReloadMapPart:: ; 104061 +ReloadMapPart:: ld hl, .Function jp CallInSafeGFXMode @@ -80,7 +77,7 @@ ReloadMapPart:: ; 104061 ret -Mobile_ReloadMapPart: ; 104099 +Mobile_ReloadMapPart: ld hl, ReloadMapPart ; useless ld hl, .Function jp CallInSafeGFXMode @@ -110,7 +107,6 @@ Mobile_ReloadMapPart: ; 104099 ei ret -; 1040d4 ; unused ld hl, .unreferenced_1040da @@ -134,7 +130,6 @@ Mobile_ReloadMapPart: ; 104099 ld [hDMATransfer], a call WaitDMATransfer ret -; 1040fb ; unused ld hl, .unreferenced_104101 @@ -148,9 +143,8 @@ Mobile_ReloadMapPart: ; 104099 ld hl, w3_d800 call HDMATransferToWRAMBank3 ret -; 104110 -OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110 +OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; OpenText ld hl, .Function jp CallInSafeGFXMode @@ -182,9 +176,8 @@ OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110 ld [rVBK], a ei ret -; 104148 -Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148) +Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ld hl, .Function jp CallInSafeGFXMode @@ -209,9 +202,8 @@ Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148) ld hl, wScratchTileMap call HDMATransfer_Wait127Scanlines_toBGMap ret -; 104177 -CallInSafeGFXMode: ; 104177 +CallInSafeGFXMode: ld a, [hBGMapMode] push af ld a, [hMapAnims] @@ -237,19 +229,16 @@ CallInSafeGFXMode: ; 104177 pop af ld [hBGMapMode], a ret -; 10419c -._hl_ ; 10419c +._hl_ jp hl -; 10419d - -HDMATransferToWRAMBank3: ; 10419d (41:419d) +HDMATransferToWRAMBank3: call _LoadHDMAParameters ld a, $23 ld [hDMATransfer], a -WaitDMATransfer: ; 104a14 +WaitDMATransfer: .loop call DelayFrame ld a, [hDMATransfer] @@ -257,7 +246,7 @@ WaitDMATransfer: ; 104a14 jr nz, .loop ret -HDMATransfer_Wait127Scanlines_toBGMap: ; 1041ad (41:41ad) +HDMATransfer_Wait127Scanlines_toBGMap: ; HDMA transfer from hl to [hBGMapAddress] ; hBGMapAddress -> de ; 2 * SCREEN_HEIGHT -> c @@ -268,7 +257,7 @@ HDMATransfer_Wait127Scanlines_toBGMap: ; 1041ad (41:41ad) ld c, 2 * SCREEN_HEIGHT jr HDMATransfer_Wait127Scanlines -HDMATransfer_Wait123Scanlines_toBGMap: ; 1041b7 (41:41b7) +HDMATransfer_Wait123Scanlines_toBGMap: ; HDMA transfer from hl to [hBGMapAddress] ; hBGMapAddress -> de ; 2 * SCREEN_HEIGHT -> c @@ -279,9 +268,8 @@ HDMATransfer_Wait123Scanlines_toBGMap: ; 1041b7 (41:41b7) ld e, a ld c, 2 * SCREEN_HEIGHT jr HDMATransfer_Wait123Scanlines -; 1041c1 (41:41c1) -HDMATransfer_NoDI: ; 1041c1 +HDMATransfer_NoDI: ; HDMA transfer from hl to [hBGMapAddress] ; [hBGMapAddress] --> de ; 2 * SCREEN_HEIGHT --> c @@ -339,13 +327,11 @@ HDMATransfer_NoDI: ; 1041c1 ld hl, rHDMA5 res 7, [hl] ret -; 104205 HDMATransfer_Wait123Scanlines: ld b, $7b jr _continue_HDMATransfer - HDMATransfer_Wait127Scanlines: ld b, $7f _continue_HDMATransfer: @@ -407,10 +393,8 @@ _continue_HDMATransfer: ei ret -; 10424e - -_LoadHDMAParameters: ; 10424e (41:424e) +_LoadHDMAParameters: ld a, h ld [rHDMA1], a ld a, l @@ -422,14 +406,14 @@ _LoadHDMAParameters: ; 10424e (41:424e) ld [rHDMA4], a ret -PadTilemapForHDMATransfer: ; 10425f (41:425f) +PadTilemapForHDMATransfer: ld c, " " jr PadMapForHDMATransfer -PadAttrMapForHDMATransfer: ; 104263 (41:4263) +PadAttrMapForHDMATransfer: ld c, $0 -PadMapForHDMATransfer: ; 104265 (41:4265) +PadMapForHDMATransfer: ; pad a 20x18 map to 32x18 for HDMA transfer ; back up the padding value in c to hMapObjectIndexBuffer ld a, [hMapObjectIndexBuffer] @@ -466,8 +450,7 @@ PadMapForHDMATransfer: ; 104265 (41:4265) ld [hMapObjectIndexBuffer], a ret - -_Get2bpp:: ; 104284 +_Get2bpp:: ; 2bpp when [rLCDC] & $80 ; switch to WRAM bank 6 ld a, [rSVBK] @@ -510,9 +493,8 @@ _Get2bpp:: ; 104284 pop af ld [rSVBK], a ret -; 1042b2 -_Get1bpp:: ; 1042b2 +_Get1bpp:: ; 1bpp when [rLCDC] & $80 .loop ld a, c @@ -537,9 +519,8 @@ _Get1bpp:: ; 1042b2 sub $10 ld c, a jr .loop -; 1042d6 -.bankswitch ; 1042d6 +.bankswitch ld a, [rSVBK] push af ld a, BANK(wScratchTileMap) @@ -576,12 +557,10 @@ _Get1bpp:: ; 1042b2 pop af ld [rSVBK], a ret -; 104303 -HDMATransfer_OnlyTopFourRows: ; 104303 +HDMATransfer_OnlyTopFourRows: ld hl, .Function jp CallInSafeGFXMode -; 104309 .Function: ld hl, wScratchTileMap @@ -604,7 +583,7 @@ HDMATransfer_OnlyTopFourRows: ; 104303 call HDMATransfer_Wait127Scanlines ret -.Copy: ; 10433a (41:433a) +.Copy: ld b, 4 .outer_loop ld c, SCREEN_WIDTH @@ -623,4 +602,3 @@ HDMATransfer_OnlyTopFourRows: ; 104303 dec b jr nz, .outer_loop ret -; 104350 diff --git a/engine/gfx/load_font.asm b/engine/gfx/load_font.asm index 40dbb9c10..41c0721d6 100644 --- a/engine/gfx/load_font.asm +++ b/engine/gfx/load_font.asm @@ -5,22 +5,20 @@ INCLUDE "gfx/font.asm" Unreferenced_fb434: db 0 -Unreferenced_Functionfb435: ; 4b435 +Unreferenced_Functionfb435: ld a, [Unreferenced_fb434] and a jp nz, Get1bpp_2 jp Get1bpp -; fb43f -Unreferenced_Functionfb43f: ; fb43f +Unreferenced_Functionfb43f: ld a, [Unreferenced_fb434] and a jp nz, Get2bpp_2 jp Get2bpp ; End unreferenced block -; fb449 -_LoadStandardFont:: ; fb449 +_LoadStandardFont:: ld de, Font ld hl, vTiles1 lb bc, BANK(Font), 128 ; "A" to "9" @@ -45,9 +43,8 @@ _LoadStandardFont:: ; fb449 lb bc, BANK(Font), 32 ; "'" to "9" call Get1bpp_2 ret -; fb48a -_LoadFontsExtra1:: ; fb48a +_LoadFontsExtra1:: ld de, FontsExtra_SolidBlackGFX ld hl, vTiles2 tile "■" ; $60 lb bc, BANK(FontsExtra_SolidBlackGFX), 1 @@ -61,26 +58,23 @@ _LoadFontsExtra1:: ; fb48a lb bc, BANK(FontExtra), 22 ; "<BOLD_D>" to "ぉ" call Get2bpp_2 jr LoadFrame -; fb4b0 -_LoadFontsExtra2:: ; fb4b0 +_LoadFontsExtra2:: ld de, FontsExtra2_UpArrowGFX ld hl, vTiles2 tile "▲" ; $61 ld b, BANK(FontsExtra2_UpArrowGFX) ld c, 1 call Get2bpp_2 ret -; fb4be -_LoadFontsBattleExtra:: ; fb4be +_LoadFontsBattleExtra:: ld de, FontBattleExtra ld hl, vTiles2 tile $60 lb bc, BANK(FontBattleExtra), 25 call Get2bpp_2 jr LoadFrame -; fb4cc -LoadFrame: ; fb4cc +LoadFrame: ld a, [wTextBoxFrame] maskbits NUM_FRAMES ld bc, 6 * LEN_1BPP_TILE @@ -96,9 +90,8 @@ LoadFrame: ; fb4cc lb bc, BANK(TextBoxSpaceGFX), 1 call Get1bpp_2 ret -; fb4f2 -LoadBattleFontsHPBar: ; fb4f2 +LoadBattleFontsHPBar: ld de, FontBattleExtra ld hl, vTiles2 tile $60 lb bc, BANK(FontBattleExtra), 12 @@ -109,7 +102,7 @@ LoadBattleFontsHPBar: ; fb4f2 call Get2bpp_2 call LoadFrame -LoadHPBar: ; fb50d +LoadHPBar: ld de, EnemyHPBarBorderGFX ld hl, vTiles2 tile $6c lb bc, BANK(EnemyHPBarBorderGFX), 4 @@ -127,9 +120,8 @@ LoadHPBar: ; fb50d lb bc, BANK(MobilePhoneTilesGFX), 2 call Get2bpp_2 ret -; fb53e -StatsScreen_LoadFont: ; fb53e +StatsScreen_LoadFont: call _LoadFontsBattleExtra ld de, EnemyHPBarBorderGFX ld hl, vTiles2 tile $6c @@ -147,10 +139,9 @@ StatsScreen_LoadFont: ; fb53e ld hl, vTiles2 tile $55 lb bc, BANK(ExpBarGFX), 8 call Get2bpp_2 -LoadStatsScreenPageTilesGFX: ; fb571 +LoadStatsScreenPageTilesGFX: ld de, StatsScreenPageTilesGFX ld hl, vTiles2 tile $31 lb bc, BANK(StatsScreenPageTilesGFX), 17 call Get2bpp_2 ret -; fb57e diff --git a/engine/gfx/load_overworld_font.asm b/engine/gfx/load_overworld_font.asm index f23f01c4e..f4ef84619 100644 --- a/engine/gfx/load_overworld_font.asm +++ b/engine/gfx/load_overworld_font.asm @@ -1,4 +1,4 @@ -LoadOverworldFont:: ; 106594 +LoadOverworldFont:: ld de, .OverworldFontGFX ld hl, vTiles1 lb bc, BANK(.OverworldFontGFX), $80 @@ -8,7 +8,6 @@ LoadOverworldFont:: ; 106594 lb bc, BANK(.OverworldFontSpaceGFX), 1 call Get2bpp ret -; 1065ad .OverworldFontGFX: INCBIN "gfx/font/overworld.2bpp" diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm index b533ee56b..64190083d 100644 --- a/engine/gfx/load_pics.asm +++ b/engine/gfx/load_pics.asm @@ -1,4 +1,4 @@ -GetUnownLetter: ; 51040 +GetUnownLetter: ; Return Unown letter in wUnownLetter based on DVs at hl ; Take the middle 2 bits of each DV and place them in order: @@ -48,7 +48,7 @@ GetUnownLetter: ; 51040 ld [wUnownLetter], a ret -GetMonFrontpic: ; 51077 +GetMonFrontpic: ld a, [wCurPartySpecies] ld [wCurSpecies], a call IsAPokemon @@ -60,7 +60,7 @@ GetMonFrontpic: ; 51077 ld [rSVBK], a ret -GetAnimatedFrontpic: ; 5108b +GetAnimatedFrontpic: ld a, [wCurPartySpecies] ld [wCurSpecies], a call IsAPokemon @@ -75,7 +75,7 @@ GetAnimatedFrontpic: ; 5108b ld [rSVBK], a ret -_GetFrontpic: ; 510a5 +_GetFrontpic: push de call GetBaseData ld a, [wBasePicSize] @@ -102,7 +102,7 @@ _GetFrontpic: ; 510a5 pop hl ret -GetFrontpicPointer: ; 510d7 +GetFrontpicPointer: ld a, [wCurPartySpecies] cp UNOWN jr z, .unown @@ -129,7 +129,7 @@ GetFrontpicPointer: ; 510d7 pop bc ret -GetAnimatedEnemyFrontpic: ; 51103 +GetAnimatedEnemyFrontpic: ld a, BANK(vTiles3) ld [rVBK], a push hl @@ -158,7 +158,6 @@ GetAnimatedEnemyFrontpic: ; 51103 ld de, wDecompressEnemyFrontpic + 7 * 7 tiles ld c, 7 * 7 .got_dims - push hl push bc call LoadFrontpicTiles @@ -172,7 +171,7 @@ GetAnimatedEnemyFrontpic: ; 51103 ld [rVBK], a ret -LoadFrontpicTiles: ; 5114f +LoadFrontpicTiles: ld hl, wDecompressScratch swap c ld a, c @@ -193,7 +192,7 @@ LoadFrontpicTiles: ; 5114f jr nz, .loop ret -GetMonBackpic: ; 5116c +GetMonBackpic: ld a, [wCurPartySpecies] call IsAPokemon ret c @@ -244,7 +243,7 @@ GetMonBackpic: ; 5116c ld [rSVBK], a ret -FixPicBank: ; 511c5 +FixPicBank: ; This is a thing for some reason. PICS_FIX EQU $36 @@ -252,7 +251,7 @@ GLOBAL PICS_FIX push hl push bc - sub BANK(Pics_1) - PICS_FIX + sub BANK("Pics 1") - PICS_FIX ld c, a ld b, 0 ld hl, .PicsBanks @@ -262,33 +261,33 @@ GLOBAL PICS_FIX pop hl ret -.PicsBanks: ; 511d4 - db BANK(Pics_1) + 0 - db BANK(Pics_1) + 1 - db BANK(Pics_1) + 2 - db BANK(Pics_1) + 3 - db BANK(Pics_1) + 4 - db BANK(Pics_1) + 5 - db BANK(Pics_1) + 6 - db BANK(Pics_1) + 7 - db BANK(Pics_1) + 8 - db BANK(Pics_1) + 9 - db BANK(Pics_1) + 10 - db BANK(Pics_1) + 11 - db BANK(Pics_1) + 12 - db BANK(Pics_1) + 13 - db BANK(Pics_1) + 14 - db BANK(Pics_1) + 15 - db BANK(Pics_1) + 16 - db BANK(Pics_1) + 17 - db BANK(Pics_1) + 18 - db BANK(Pics_1) + 19 - db BANK(Pics_1) + 20 - db BANK(Pics_1) + 21 - db BANK(Pics_1) + 22 - db BANK(Pics_1) + 23 - -Function511ec: ; 511ec +.PicsBanks: + db BANK("Pics 1") ; BANK("Pics 1") + 0 + db BANK("Pics 2") ; BANK("Pics 1") + 1 + db BANK("Pics 3") ; BANK("Pics 1") + 2 + db BANK("Pics 4") ; BANK("Pics 1") + 3 + db BANK("Pics 5") ; BANK("Pics 1") + 4 + db BANK("Pics 6") ; BANK("Pics 1") + 5 + db BANK("Pics 7") ; BANK("Pics 1") + 6 + db BANK("Pics 8") ; BANK("Pics 1") + 7 + db BANK("Pics 9") ; BANK("Pics 1") + 8 + db BANK("Pics 10") ; BANK("Pics 1") + 9 + db BANK("Pics 11") ; BANK("Pics 1") + 10 + db BANK("Pics 12") ; BANK("Pics 1") + 11 + db BANK("Pics 13") ; BANK("Pics 1") + 12 + db BANK("Pics 14") ; BANK("Pics 1") + 13 + db BANK("Pics 15") ; BANK("Pics 1") + 14 + db BANK("Pics 16") ; BANK("Pics 1") + 15 + db BANK("Pics 17") ; BANK("Pics 1") + 16 + db BANK("Pics 18") ; BANK("Pics 1") + 17 + db BANK("Pics 19") ; BANK("Pics 1") + 18 + db BANK("Pics 20") ; BANK("Pics 1") + 19 + db BANK("Pics 21") ; BANK("Pics 1") + 20 + db BANK("Pics 22") ; BANK("Pics 1") + 21 + db BANK("Pics 23") ; BANK("Pics 1") + 22 + db BANK("Pics 24") ; BANK("Pics 1") + 23 + +Function511ec: ld a, c push de ld hl, PokemonPicPointers @@ -307,7 +306,7 @@ Function511ec: ; 511ec call FarDecompress ret -GetTrainerPic: ; 5120d +GetTrainerPic: ld a, [wTrainerClass] and a ret z @@ -349,7 +348,7 @@ GetTrainerPic: ; 5120d ld [hBGMapMode], a ret -DecompressGet2bpp: ; 5125d +DecompressGet2bpp: ; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de. ld a, [rSVBK] @@ -373,7 +372,7 @@ DecompressGet2bpp: ; 5125d ld [rSVBK], a ret -FixBackpicAlignment: ; 5127c +FixBackpicAlignment: push de push bc ld a, [wBoxAlignment] @@ -409,7 +408,7 @@ FixBackpicAlignment: ; 5127c pop de ret -PadFrontpic: ; 512ab +PadFrontpic: ; pads frontpic to fill 7x7 box ld a, b cp 6 @@ -418,39 +417,39 @@ PadFrontpic: ; 512ab jr z, .five .seven_loop - ld c, $70 + ld c, 7 << 4 call LoadOrientedFrontpic dec b jr nz, .seven_loop ret .six - ld c, $70 + ld c, 7 << 4 xor a call .Fill .six_loop - ld c, $10 + ld c, (7 - 6) << 4 xor a call .Fill - ld c, $60 + ld c, 6 << 4 call LoadOrientedFrontpic dec b jr nz, .six_loop ret .five - ld c, $70 + ld c, 7 << 4 xor a call .Fill .five_loop - ld c, $20 + ld c, (7 - 5) << 4 xor a call .Fill - ld c, $50 + ld c, 5 << 4 call LoadOrientedFrontpic dec b jr nz, .five_loop - ld c, $70 + ld c, 7 << 4 xor a call .Fill ret @@ -461,7 +460,7 @@ PadFrontpic: ; 512ab jr nz, .Fill ret -LoadOrientedFrontpic: ; 512f2 +LoadOrientedFrontpic: ld a, [wBoxAlignment] and a jr nz, .x_flip diff --git a/engine/gfx/load_push_oam.asm b/engine/gfx/load_push_oam.asm index 95f67ff73..11045bb9d 100644 --- a/engine/gfx/load_push_oam.asm +++ b/engine/gfx/load_push_oam.asm @@ -1,4 +1,4 @@ -WriteOAMDMACodeToHRAM:: ; 4031 +WriteOAMDMACodeToHRAM:: ld c, hTransferVirtualOAM - $ff00 ld b, .PushOAMEnd - .PushOAM ld hl, .PushOAM @@ -10,7 +10,7 @@ WriteOAMDMACodeToHRAM:: ; 4031 jr nz, .loop ret -.PushOAM: ; 403f +.PushOAM: ld a, HIGH(wVirtualOAM) ld [rDMA], a ld a, NUM_SPRITE_OAM_STRUCTS diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 5a26d2d7c..5ae2fbf8b 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -1,4 +1,4 @@ -LoadOverworldMonIcon: ; 8e82b +LoadOverworldMonIcon: ld a, e call ReadMonMenuIcon ld l, a @@ -12,9 +12,8 @@ LoadOverworldMonIcon: ; 8e82b ld b, BANK(Icons) ld c, 8 ret -; 8e83f -LoadMenuMonIcon: ; 8e83f +LoadMenuMonIcon: push hl push de push bc @@ -23,9 +22,8 @@ LoadMenuMonIcon: ; 8e83f pop de pop hl ret -; 8e849 -.LoadIcon: ; 8e849 +.LoadIcon: ld d, 0 ld hl, .Jumptable add hl, de @@ -34,10 +32,8 @@ LoadMenuMonIcon: ; 8e83f ld h, [hl] ld l, a jp hl -; 8e854 - -.Jumptable: ; 8e854 (23:6854) +.Jumptable: dw PartyMenu_InitAnimatedMonIcon ; party menu dw NamingScreen_InitAnimatedMonIcon ; naming screen dw MoveList_InitAnimatedMonIcon ; moves (?) @@ -46,13 +42,13 @@ LoadMenuMonIcon: ; 8e83f dw Mobile_InitPartyMenuBGPal71 ; mobile dw .GetPartyMenuMonIcon ; unused -.GetPartyMenuMonIcon: ; 8e862 (23:6862) +.GetPartyMenuMonIcon: call InitPartyMenuIcon call .GetPartyMonItemGFX call SetPartyMonIconAnimSpeed ret -.GetPartyMonItemGFX: ; 8e86c (23:686c) +.GetPartyMonItemGFX: push bc ld a, [hObjectStructIndexBuffer] ld hl, wPartyMon1Item @@ -83,7 +79,7 @@ LoadMenuMonIcon: ; 8e83f ld [hl], a ret -Mobile_InitAnimatedMonIcon: ; 8e898 (23:6898) +Mobile_InitAnimatedMonIcon: call PartyMenu_InitAnimatedMonIcon ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc @@ -99,7 +95,7 @@ Mobile_InitAnimatedMonIcon: ; 8e898 (23:6898) ld [hl], a ret -Mobile_InitPartyMenuBGPal71: ; 8e8b1 (23:68b1) +Mobile_InitPartyMenuBGPal71: call InitPartyMenuIcon call SetPartyMonIconAnimSpeed ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID @@ -120,13 +116,13 @@ Mobile_InitPartyMenuBGPal71: ; 8e8b1 (23:68b1) ld [wc608 + 1], a ret -PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5) +PartyMenu_InitAnimatedMonIcon: call InitPartyMenuIcon call .SpawnItemIcon call SetPartyMonIconAnimSpeed ret -.SpawnItemIcon: ; 8e8df (23:68df) +.SpawnItemIcon: push bc ld a, [hObjectStructIndexBuffer] ld hl, wPartyMon1Item @@ -154,7 +150,7 @@ PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5) ld [hl], a ret -InitPartyMenuIcon: ; 8e908 (23:6908) +InitPartyMenuIcon: ld a, [wCurIconTile] push af ld a, [hObjectStructIndexBuffer] @@ -185,7 +181,7 @@ InitPartyMenuIcon: ; 8e908 (23:6908) ld [hl], a ret -SetPartyMonIconAnimSpeed: ; 8e936 (23:6936) +SetPartyMonIconAnimSpeed: push bc ld a, [hObjectStructIndexBuffer] ld b, a @@ -202,7 +198,7 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936) ld [hl], a ret -.getspeed ; 8e94c (23:694c) +.getspeed farcall PlacePartymonHPBar call GetHPPal ld e, d @@ -211,15 +207,13 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936) add hl, de ld b, [hl] ret -; 8e95e (23:695e) -.speeds ; 8e95e +.speeds db $00 ; HP_GREEN db $40 ; HP_YELLOW db $80 ; HP_RED -; 8e961 -NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961) +NamingScreen_InitAnimatedMonIcon: ld a, [wd265] call ReadMonMenuIcon ld [wCurIcon], a @@ -233,7 +227,7 @@ NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961) ld [hl], SPRITE_ANIM_SEQ_NULL ret -MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d) +MoveList_InitAnimatedMonIcon: ld a, [wd265] call ReadMonMenuIcon ld [wCurIcon], a @@ -248,7 +242,7 @@ MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d) ld [hl], SPRITE_ANIM_SEQ_NULL ret -Trade_LoadMonIconGFX: ; 8e99a (23:699a) +Trade_LoadMonIconGFX: ld a, [wd265] call ReadMonMenuIcon ld [wCurIcon], a @@ -257,7 +251,7 @@ Trade_LoadMonIconGFX: ; 8e99a (23:699a) call GetMemIconGFX ret -GetSpeciesIcon: ; 8e9ac +GetSpeciesIcon: ; Load species icon into VRAM at tile a push de ld a, [wd265] @@ -267,10 +261,8 @@ GetSpeciesIcon: ; 8e9ac ld a, e call GetIconGFX ret -; 8e9bc - -FlyFunction_GetMonIcon: ; 8e9bc (23:69bc) +FlyFunction_GetMonIcon: push de ld a, [wd265] call ReadMonMenuIcon @@ -279,9 +271,8 @@ FlyFunction_GetMonIcon: ; 8e9bc (23:69bc) ld a, e call GetIcon_a ret -; 8e9cc (23:69cc) -Unreferenced_GetMonIcon2: ; 8e9cc +Unreferenced_GetMonIcon2: push de ld a, [wd265] call ReadMonMenuIcon @@ -289,11 +280,10 @@ Unreferenced_GetMonIcon2: ; 8e9cc pop de call GetIcon_de ret -; 8e9db -GetMemIconGFX: ; 8e9db (23:69db) +GetMemIconGFX: ld a, [wCurIconTile] -GetIconGFX: ; 8e9de +GetIconGFX: call GetIcon_a ld de, 8 tiles add hl, de @@ -308,20 +298,19 @@ GetIconGFX: ; 8e9de HeldItemIcons: INCBIN "gfx/icons/mail.2bpp" INCBIN "gfx/icons/item.2bpp" -; 8ea17 -GetIcon_de: ; 8ea17 +GetIcon_de: ; Load icon graphics into VRAM starting from tile de. ld l, e ld h, d jr GetIcon -GetIcon_a: ; 8ea1b +GetIcon_a: ; Load icon graphics into VRAM starting from tile a. ld l, a ld h, 0 -GetIcon: ; 8ea1e +GetIcon: ; Load icon graphics into VRAM starting from tile hl. ; One tile is 16 bytes long. @@ -352,16 +341,14 @@ endr pop hl ret -; 8ea3f -GetGFXUnlessMobile: ; 8ea3f +GetGFXUnlessMobile: ld a, [wLinkMode] cp LINK_MOBILE jp nz, Request2bpp jp Get2bpp_2 -; 8ea4a -FreezeMonIcons: ; 8ea4a +FreezeMonIcons: ld hl, wSpriteAnimationStructs ld e, PARTY_LENGTH ld a, [wMenuCursorY] @@ -393,9 +380,8 @@ FreezeMonIcons: ; 8ea4a dec e jr nz, .loop ret -; 8ea71 -UnfreezeMonIcons: ; 8ea71 +UnfreezeMonIcons: ld hl, wSpriteAnimationStructs ld e, PARTY_LENGTH .loop @@ -415,9 +401,8 @@ UnfreezeMonIcons: ; 8ea71 dec e jr nz, .loop ret -; 8ea8c (23:6a8c) -HoldSwitchmonIcon: ; 8ea8c +HoldSwitchmonIcon: ld hl, wSpriteAnimationStructs ld e, PARTY_LENGTH ld a, [wSwitchMon] @@ -448,7 +433,7 @@ HoldSwitchmonIcon: ; 8ea8c jr nz, .loop ret -ReadMonMenuIcon: ; 8eab3 +ReadMonMenuIcon: cp EGG jr z, .egg dec a @@ -461,8 +446,6 @@ ReadMonMenuIcon: ; 8eab3 .egg ld a, ICON_EGG ret -; 8eac4 - INCLUDE "data/pokemon/menu_icons.asm" diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index 54999a6bb..843e5cba4 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -1,6 +1,6 @@ ; Pic animation arrangement. -Unused_AnimateMon_Slow_Normal: ; d0000 +Unused_AnimateMon_Slow_Normal: hlcoord 12, 0 ld a, [wBattleMode] cp WILD_BATTLE @@ -15,42 +15,36 @@ Unused_AnimateMon_Slow_Normal: ; d0000 ld d, $0 call AnimateFrontpic ret -; d001a -AnimateMon_Menu: ; d001a +AnimateMon_Menu: ld e, ANIM_MON_MENU ld d, $0 call AnimateFrontpic ret -; d0022 -AnimateMon_Trade: ; d0022 +AnimateMon_Trade: ld e, ANIM_MON_TRADE ld d, $0 call AnimateFrontpic ret -; d002a -AnimateMon_Evolve: ; d002a +AnimateMon_Evolve: ld e, ANIM_MON_EVOLVE ld d, $0 call AnimateFrontpic ret -; d0032 -AnimateMon_Hatch: ; d0032 +AnimateMon_Hatch: ld e, ANIM_MON_HATCH ld d, $0 call AnimateFrontpic ret -; d003a -AnimateMon_Unused: ; d003a +AnimateMon_Unused: ld e, ANIM_MON_UNUSED ld d, $0 call AnimateFrontpic ret -; d0042 pokeanim: MACRO rept _NARG @@ -64,7 +58,7 @@ endr db (PokeAnim_Finish_ - PokeAnim_SetupCommands) / 2 ENDM -PokeAnims: ; d0042 +PokeAnims: dw .Slow dw .Normal dw .Menu @@ -85,8 +79,7 @@ PokeAnims: ; d0042 .Egg1: pokeanim Setup, Play .Egg2: pokeanim Idle, Play - -AnimateFrontpic: ; d008e +AnimateFrontpic: call AnimateMon_CheckIfPokemon ret c call LoadMonAnimation @@ -97,9 +90,8 @@ AnimateFrontpic: ; d008e pop af jr nc, .loop ret -; d00a3 -LoadMonAnimation: ; d00a3 +LoadMonAnimation: push hl ld c, e ld b, 0 @@ -112,9 +104,8 @@ LoadMonAnimation: ; d00a3 pop hl call PokeAnim_InitPicAttributes ret -; d00b4 -SetUpPokeAnim: ; d00b4 +SetUpPokeAnim: ld a, [rSVBK] push af ld a, BANK(wPokeAnimSceneIndex) @@ -139,9 +130,8 @@ SetUpPokeAnim: ; d00b4 ret z scf ret -; d00da -PokeAnim_SetupCommands: ; d00da +PokeAnim_SetupCommands: setup_command: MACRO \1_: dw \1 ENDM @@ -157,16 +147,15 @@ ENDM setup_command PokeAnim_Cry setup_command PokeAnim_CryNoWait setup_command PokeAnim_StereoCry -; d00f2 -PokeAnim_SetWait: ; d00f2 +PokeAnim_SetWait: ld a, 18 ld [wPokeAnimWaitCounter], a ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a -PokeAnim_Wait: ; d00fe +PokeAnim_Wait: ld hl, wPokeAnimWaitCounter dec [hl] ret nz @@ -174,9 +163,8 @@ PokeAnim_Wait: ; d00fe inc a ld [wPokeAnimSceneIndex], a ret -; d010b -PokeAnim_Setup: ; d010b +PokeAnim_Setup: ld c, FALSE ld b, 0 call PokeAnim_InitAnim @@ -185,9 +173,8 @@ PokeAnim_Setup: ; d010b inc a ld [wPokeAnimSceneIndex], a ret -; d011d -PokeAnim_Setup2: ; d011d +PokeAnim_Setup2: ld c, FALSE ld b, 4 call PokeAnim_InitAnim @@ -196,9 +183,8 @@ PokeAnim_Setup2: ; d011d inc a ld [wPokeAnimSceneIndex], a ret -; d012f -PokeAnim_Idle: ; d012f +PokeAnim_Idle: ld c, TRUE ld b, 0 call PokeAnim_InitAnim @@ -207,9 +193,8 @@ PokeAnim_Idle: ; d012f inc a ld [wPokeAnimSceneIndex], a ret -; d0141 -PokeAnim_Play: ; d0141 +PokeAnim_Play: call PokeAnim_DoAnimScript ld a, [wPokeAnimJumptableIndex] bit 7, a @@ -219,9 +204,8 @@ PokeAnim_Play: ; d0141 inc a ld [wPokeAnimSceneIndex], a ret -; d0155 -PokeAnim_Play2: ; d0155 +PokeAnim_Play2: call PokeAnim_DoAnimScript ld a, [wPokeAnimJumptableIndex] bit 7, a @@ -230,42 +214,37 @@ PokeAnim_Play2: ; d0155 inc a ld [wPokeAnimSceneIndex], a ret -; d0166 -PokeAnim_BasePic: ; d0166 +PokeAnim_BasePic: call PokeAnim_DeinitFrames ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a ret -; d0171 -PokeAnim_Finish: ; d0171 +PokeAnim_Finish: call PokeAnim_DeinitFrames ld hl, wPokeAnimSceneIndex set 7, [hl] ret -; d017a -PokeAnim_Cry: ; d017a +PokeAnim_Cry: ld a, [wPokeAnimSpecies] call _PlayMonCry ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a ret -; d0188 -PokeAnim_CryNoWait: ; d0188 +PokeAnim_CryNoWait: ld a, [wPokeAnimSpecies] call PlayMonCry2 ld a, [wPokeAnimSceneIndex] inc a ld [wPokeAnimSceneIndex], a ret -; d0196 -PokeAnim_StereoCry: ; d0196 +PokeAnim_StereoCry: ld a, $f ld [wCryTracks], a ld a, [wPokeAnimSpecies] @@ -274,9 +253,8 @@ PokeAnim_StereoCry: ; d0196 inc a ld [wPokeAnimSceneIndex], a ret -; d01a9 -PokeAnim_DeinitFrames: ; d01a9 +PokeAnim_DeinitFrames: ld a, [rSVBK] push af ld a, BANK(wPokeAnimCoord) @@ -288,9 +266,8 @@ PokeAnim_DeinitFrames: ; d01a9 pop af ld [rSVBK], a ret -; d01c6 -AnimateMon_CheckIfPokemon: ; d01c6 +AnimateMon_CheckIfPokemon: ld a, [wCurPartySpecies] cp EGG jr z, .fail @@ -302,9 +279,8 @@ AnimateMon_CheckIfPokemon: ; d01c6 .fail scf ret -; d01d6 -PokeAnim_InitPicAttributes: ; d01d6 +PokeAnim_InitPicAttributes: ld a, [rSVBK] push af ld a, BANK(wPokeAnimSceneIndex) @@ -355,9 +331,8 @@ PokeAnim_InitPicAttributes: ; d01d6 pop af ld [rSVBK], a ret -; d0228 -PokeAnim_InitAnim: ; d0228 +PokeAnim_InitAnim: ld a, [rSVBK] push af ld a, BANK(wPokeAnimIdleFlag) @@ -378,9 +353,8 @@ PokeAnim_InitAnim: ; d0228 pop af ld [rSVBK], a ret -; d0250 -PokeAnim_DoAnimScript: ; d0250 +PokeAnim_DoAnimScript: xor a ld [hBGMapMode], a .loop @@ -389,43 +363,39 @@ PokeAnim_DoAnimScript: ; d0250 ld hl, .Jumptable rst JumpTable ret -; d025d -.Jumptable: ; d025d +.Jumptable: dw .RunAnim dw .WaitAnim -; d0261 -.RunAnim: ; d0261 +.RunAnim: call PokeAnim_GetPointer ld a, [wPokeAnimCommand] - cp -1 + cp endanim_command jr z, PokeAnim_End - cp -2 + cp setrepeat_command jr z, .SetRepeat - cp -3 + cp dorepeat_command jr z, .DoRepeat call PokeAnim_GetFrame ld a, [wPokeAnimParameter] call PokeAnim_GetDuration ld [wPokeAnimWaitCounter], a call PokeAnim_StartWaitAnim -.WaitAnim: ; d0282 +.WaitAnim: ld a, [wPokeAnimWaitCounter] dec a ld [wPokeAnimWaitCounter], a ret nz call PokeAnim_StopWaitAnim ret -; d028e -.SetRepeat: ; d028e +.SetRepeat: ld a, [wPokeAnimParameter] ld [wPokeAnimRepeatTimer], a jr .loop -; d0296 -.DoRepeat: ; d0296 +.DoRepeat: ld a, [wPokeAnimRepeatTimer] and a ret z @@ -435,15 +405,13 @@ PokeAnim_DoAnimScript: ; d0250 ld a, [wPokeAnimParameter] ld [wPokeAnimFrame], a jr .loop -; d02a8 -PokeAnim_End: ; d02a8 +PokeAnim_End: ld hl, wPokeAnimJumptableIndex set 7, [hl] ret -; d02ae -PokeAnim_GetDuration: ; d02ae +PokeAnim_GetDuration: ; a * (1 + [wPokeAnimSpeed] / 16) ld c, a ld b, $0 @@ -460,9 +428,8 @@ PokeAnim_GetDuration: ; d02ae or h add c ret -; d02c8 -PokeAnim_GetFrame: ; d02c8 +PokeAnim_GetFrame: call PokeAnim_PlaceGraphic ld a, [wPokeAnimCommand] and a @@ -473,35 +440,30 @@ PokeAnim_GetFrame: ; d02c8 pop hl call PokeAnim_ConvertAndApplyBitmask ret -; d02dc -PokeAnim_StartWaitAnim: ; d02dc +PokeAnim_StartWaitAnim: ld a, [wPokeAnimJumptableIndex] inc a ld [wPokeAnimJumptableIndex], a ret -; d02e4 -PokeAnim_StopWaitAnim: ; d02e4 +PokeAnim_StopWaitAnim: ld a, [wPokeAnimJumptableIndex] dec a ld [wPokeAnimJumptableIndex], a ret -; d02ec -PokeAnim_IsUnown: ; d02ec +PokeAnim_IsUnown: ld a, [wPokeAnimSpecies] cp UNOWN ret -; d02f2 -PokeAnim_IsEgg: ; d02f2 +PokeAnim_IsEgg: ld a, [wPokeAnimSpecies] cp EGG ret -; d02f8 -PokeAnim_GetPointer: ; d02f8 +PokeAnim_GetPointer: push hl ld a, [wPokeAnimFrame] ld e, a @@ -522,9 +484,8 @@ PokeAnim_GetPointer: ; d02f8 inc [hl] pop hl ret -; d031b -PokeAnim_GetBitmaskIndex: ; d031b +PokeAnim_GetBitmaskIndex: ld a, [wPokeAnimCommand] dec a ld c, a @@ -542,9 +503,8 @@ PokeAnim_GetBitmaskIndex: ; d031b ld [wPokeAnimCurBitmask], a inc hl ret -; d033b -PokeAnim_CopyBitmaskToBuffer: ; d033b +PokeAnim_CopyBitmaskToBuffer: call .GetSize push bc ld hl, wPokeAnimBitmaskAddr @@ -558,9 +518,8 @@ PokeAnim_CopyBitmaskToBuffer: ; d033b ld a, [wPokeAnimBitmaskBank] call FarCopyBytes ret -; d0356 -.GetSize: ; d0356 +.GetSize: push hl ld a, [wPokeAnimFrontpicHeight] sub 5 ; to get a number 0, 1, or 2 @@ -572,7 +531,6 @@ PokeAnim_CopyBitmaskToBuffer: ; d033b ld b, 0 pop hl ret -; d0368 .Sizes: db 4, 5, 7 @@ -588,7 +546,7 @@ y = y + 7 endr ENDM -PokeAnim_ConvertAndApplyBitmask: ; d036b +PokeAnim_ConvertAndApplyBitmask: xor a ld [wPokeAnimBitmaskCurBit], a ld [wPokeAnimBitmaskCurRow], a @@ -614,9 +572,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b pop hl jr nc, .loop ret -; d0392 -.IsCurBitSet: ; d0392 +.IsCurBitSet: ; which byte ld a, [wPokeAnimBitmaskCurBit] and $f8 @@ -652,9 +609,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b ld hl, wPokeAnimBitmaskCurBit inc [hl] ret -; d03bd -.ApplyFrame: ; d03bd +.ApplyFrame: push af call .GetCoord pop af @@ -665,9 +621,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b pop hl ld [hl], a ret -; d03cd -.GetCoord: ; d03cd +.GetCoord: call .GetStartCoord ld a, [wPokeAnimBitmaskCurRow] ld bc, SCREEN_WIDTH @@ -693,12 +648,11 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b .skip2 ret -; d03f4 ; unused db 6, 5, 4 -.GetTilemap: ; d03f7 +.GetTilemap: push af ld a, [wPokeAnimFrontpicHeight] cp 5 @@ -745,7 +699,6 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b .add_13 add 13 ret -; d042f ._5by5: poke_anim_box 5 @@ -764,8 +717,7 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b ; db 36, 37, 38, 39, 40, 41 ; db 43, 44, 45, 46, 47, 48 - -.GetStartCoord: ; d046c +.GetStartCoord: ld hl, wPokeAnimCoord ld a, [hli] ld h, [hl] @@ -793,9 +745,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b .add_bc add hl, bc ret -; d0499 -.NextBit: ; d0499 +.NextBit: ld a, [wPokeAnimBitmaskCurRow] inc a ld [wPokeAnimBitmaskCurRow], a @@ -818,9 +769,8 @@ PokeAnim_ConvertAndApplyBitmask: ; d036b .no_carry xor a ret -; d04bd -PokeAnim_PlaceGraphic: ; d04bd +PokeAnim_PlaceGraphic: call .ClearBox ld a, [wBoxAlignment] and a @@ -860,9 +810,8 @@ PokeAnim_PlaceGraphic: ; d04bd dec c jr nz, .loop ret -; d04f6 -.ClearBox: ; d04f6 +.ClearBox: ld hl, wPokeAnimCoord ld a, [hli] ld h, [hl] @@ -871,9 +820,8 @@ PokeAnim_PlaceGraphic: ; d04bd ld c, 7 call ClearBox ret -; d0504 -PokeAnim_SetVBank1: ; d0504 +PokeAnim_SetVBank1: ld a, [rSVBK] push af ld a, BANK(wPokeAnimCoord) @@ -885,9 +833,8 @@ PokeAnim_SetVBank1: ; d0504 pop af ld [rSVBK], a ret -; d051b -.SetFlag: ; d051b +.SetFlag: call PokeAnim_GetAttrMapCoord ld b, 7 ld c, 7 @@ -908,9 +855,8 @@ PokeAnim_SetVBank1: ; d0504 dec b jr nz, .row ret -; d0536 -PokeAnim_SetVBank0: ; d0536 +PokeAnim_SetVBank0: call PokeAnim_GetAttrMapCoord ld b, 7 ld c, 7 @@ -931,9 +877,8 @@ PokeAnim_SetVBank0: ; d0536 dec b jr nz, .row ret -; d0551 -PokeAnim_GetAttrMapCoord: ; d0551 +PokeAnim_GetAttrMapCoord: ld hl, wPokeAnimCoord ld a, [hli] ld h, [hl] @@ -941,9 +886,8 @@ PokeAnim_GetAttrMapCoord: ; d0551 ld de, wAttrMap - wTileMap add hl, de ret -; d055c -GetMonAnimPointer: ; d055c +GetMonAnimPointer: call PokeAnim_IsEgg jr z, .egg @@ -996,9 +940,8 @@ GetMonAnimPointer: ; d055c ld a, h ld [wPokeAnimPointerAddr + 1], a ret -; d05b4 -PokeAnim_GetFrontpicDims: ; d05b4 +PokeAnim_GetFrontpicDims: ld a, [rSVBK] push af ld a, BANK(wCurPartySpecies) @@ -1012,9 +955,8 @@ PokeAnim_GetFrontpicDims: ; d05b4 pop af ld [rSVBK], a ret -; d05ce -GetMonFramesPointer: ; d05ce +GetMonFramesPointer: call PokeAnim_IsEgg jr z, .egg @@ -1058,9 +1000,8 @@ GetMonFramesPointer: ; d05ce ld a, h ld [wPokeAnimFramesAddr + 1], a ret -; d061b -GetMonBitmaskPointer: ; d061b +GetMonBitmaskPointer: call PokeAnim_IsEgg jr z, .egg @@ -1097,9 +1038,8 @@ GetMonBitmaskPointer: ; d061b ld a, h ld [wPokeAnimBitmaskAddr + 1], a ret -; d065c -PokeAnim_GetSpeciesOrUnown: ; d065c +PokeAnim_GetSpeciesOrUnown: call PokeAnim_IsUnown jr z, .unown ld a, [wPokeAnimSpecies] @@ -1108,13 +1048,12 @@ PokeAnim_GetSpeciesOrUnown: ; d065c .unown ld a, [wPokeAnimUnownLetter] ret -; d0669 -Unused_HOF_AnimateAlignedFrontpic: ; d0669 +Unused_HOF_AnimateAlignedFrontpic: ld a, $1 ld [wBoxAlignment], a -HOF_AnimateFrontpic: ; d066e +HOF_AnimateFrontpic: call AnimateMon_CheckIfPokemon jr c, .fail ld h, d @@ -1138,4 +1077,3 @@ HOF_AnimateFrontpic: ; d066e inc a ld [wCurPartySpecies], a ret -; d0695 diff --git a/engine/gfx/place_graphic.asm b/engine/gfx/place_graphic.asm index 21b914950..628c72413 100644 --- a/engine/gfx/place_graphic.asm +++ b/engine/gfx/place_graphic.asm @@ -1,4 +1,4 @@ -PlaceGraphic: ; 2ef6e +PlaceGraphic: ; Fill wBoxAlignment-aligned box width b height c ; with iterating tile starting from hGraphicStartTile at hl. diff --git a/engine/gfx/player_gfx.asm b/engine/gfx/player_gfx.asm index deb16ad3a..9954143a8 100644 --- a/engine/gfx/player_gfx.asm +++ b/engine/gfx/player_gfx.asm @@ -1,4 +1,4 @@ -Unreferenced_Function88248: ; 88248 +Unreferenced_Function88248: ld c, CAL ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a @@ -10,17 +10,17 @@ Unreferenced_Function88248: ; 88248 ld [wTrainerClass], a ret -MovePlayerPicRight: ; 88258 +MovePlayerPicRight: hlcoord 6, 4 ld de, 1 jr MovePlayerPic -MovePlayerPicLeft: ; 88260 +MovePlayerPicLeft: hlcoord 13, 4 ld de, -1 ; fallthrough -MovePlayerPic: ; 88266 +MovePlayerPic: ; Move player pic at hl by de * 7 tiles. ld c, $8 .loop @@ -55,7 +55,7 @@ MovePlayerPic: ; 88266 pop hl jr .loop -ShowPlayerNamingChoices: ; 88297 +ShowPlayerNamingChoices: ld hl, ChrisNameMenuHeader ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a @@ -72,7 +72,7 @@ ShowPlayerNamingChoices: ; 88297 INCLUDE "data/player_names.asm" -GetPlayerNameArray: ; 88318 This Function is never called +Unreferenced_GetPlayerNameArray: ld hl, wPlayerName ld de, MalePlayerNameArray ld a, [wPlayerGender] @@ -84,7 +84,7 @@ GetPlayerNameArray: ; 88318 This Function is never called call InitName ret -GetPlayerIcon: ; 8832c +GetPlayerIcon: ; Get the player icon corresponding to gender ; Male @@ -102,7 +102,7 @@ GetPlayerIcon: ; 8832c .done ret -GetCardPic: ; 8833e +GetCardPic: ld hl, ChrisCardPic ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a @@ -120,23 +120,23 @@ GetCardPic: ; 8833e call FarCopyBytes ret -ChrisCardPic: ; 88365 +ChrisCardPic: INCBIN "gfx/trainer_card/chris_card.2bpp" -KrisCardPic: ; 88595 +KrisCardPic: INCBIN "gfx/trainer_card/kris_card.2bpp" -CardGFX: ; 887c5 +CardGFX: INCBIN "gfx/trainer_card/trainer_card.2bpp" -GetPlayerBackpic: ; 88825 +GetPlayerBackpic: ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a jr z, GetChrisBackpic call GetKrisBackpic ret -GetChrisBackpic: ; 88830 +GetChrisBackpic: ld hl, ChrisBackpic ld b, BANK(ChrisBackpic) ld de, vTiles2 tile $31 @@ -144,7 +144,7 @@ GetChrisBackpic: ; 88830 predef DecompressGet2bpp ret -HOF_LoadTrainerFrontpic: ; 88840 +HOF_LoadTrainerFrontpic: call WaitBGMap xor a ld [hBGMapMode], a @@ -173,7 +173,7 @@ HOF_LoadTrainerFrontpic: ; 88840 ld [hBGMapMode], a ret -DrawIntroPlayerPic: ; 88874 +DrawIntroPlayerPic: ; Draw the player pic at (6,4). ; Get class @@ -206,13 +206,13 @@ DrawIntroPlayerPic: ; 88874 predef PlaceGraphic ret -ChrisPic: ; 888a9 +ChrisPic: INCBIN "gfx/player/chris.2bpp" -KrisPic: ; 88bb9 +KrisPic: INCBIN "gfx/player/kris.2bpp" -GetKrisBackpic: ; 88ec9 +GetKrisBackpic: ; Kris's backpic is uncompressed. ld de, KrisBackpic ld hl, vTiles2 tile $31 @@ -220,5 +220,5 @@ GetKrisBackpic: ; 88ec9 call Get2bpp ret -KrisBackpic: ; 88ed6 +KrisBackpic: INCBIN "gfx/player/kris_back.2bpp" diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm index 24bdc952e..538132ce2 100644 --- a/engine/gfx/sgb_layouts.asm +++ b/engine/gfx/sgb_layouts.asm @@ -1,4 +1,4 @@ -LoadSGBLayout: ; 864c +LoadSGBLayout: call CheckCGB jp nz, LoadSGBLayoutCGB @@ -20,9 +20,8 @@ LoadSGBLayout: ; 864c ld de, _LoadSGBLayout_ReturnFromJumpTable push de jp hl -; 866f -.Jumptable: ; 866f +.Jumptable: dw .SGB_BattleGrayscale dw .SGB_BattleColors dw .SGB_PokegearPals @@ -38,9 +37,9 @@ LoadSGBLayout: ; 864c dw .SGB_GSTitleScreen dw .SGB0d dw .SGB_MoveList - dw .SGB0f + dw .SGB_BetaPikachuMinigame dw .SGB_PokedexSearchOption - dw .SGB11 + dw .SGB_BetaPoker dw .SGB12 dw .SGB13 dw .SGB_PackPals @@ -54,15 +53,13 @@ LoadSGBLayout: ; 864c dw .SGB_TrainerOrMonFrontpicPals dw .SGB_MysteryGift dw .SGB1e -; 86ad -.SGB_BattleGrayscale: ; 86ad +.SGB_BattleGrayscale: ld hl, PalPacket_BattleGrayscale ld de, BlkPacket_Battle ret -; 86b4 -.SGB_BattleColors: ; 86b4 +.SGB_BattleColors: ld hl, BlkPacket_Battle call PushSGBPals_ @@ -135,9 +132,8 @@ LoadSGBLayout: ; 864c ld a, SCGB_BATTLE_COLORS ld [wSGBPredef], a ret -; 873c -.SGB_MoveList: ; 873c +.SGB_MoveList: ld hl, PalPacket_9bd6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -154,15 +150,13 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, BlkPacket_MoveList ret -; 875c -.SGB_PokegearPals: ; 875c +.SGB_PokegearPals: ld hl, PalPacket_Pokegear ld de, BlkPacket_9a86 ret -; 8763 -.SGB_StatsScreenHPPals: ; 8763 +.SGB_StatsScreenHPPals: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -196,15 +190,13 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, BlkPacket_StatsScreen ret -; 87ab -.SGB_PartyMenu: ; 87ab +.SGB_PartyMenu: ld hl, PalPacket_PartyMenu ld de, wSGBPals + 1 ret -; 87b2 -.SGB_Pokedex: ; 87b2 +.SGB_Pokedex: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -230,9 +222,8 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, BlkPacket_Pokedex_PC ret -; 87e9 -.SGB_BillsPC: ; 87e9 +.SGB_BillsPC: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -259,15 +250,13 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, BlkPacket_Pokedex_PC ret -; 8823 -.SGB_PokedexUnownMode: ; 8823 +.SGB_PokedexUnownMode: call .SGB_Pokedex ld de, BlkPacket_PokedexUnownMode ret -; 882a -.SGB_PokedexSearchOption: ; 882a +.SGB_PokedexSearchOption: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -283,34 +272,29 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, BlkPacket_9a86 ret -; 884b -.SGB_PackPals: ; 884b +.SGB_PackPals: ld hl, PalPacket_Pack ld de, BlkPacket_9a86 ret -; 8852 -.SGB_SlotMachine: ; 8852 +.SGB_SlotMachine: ld hl, PalPacket_SlotMachine ld de, BlkPacket_SlotMachine ret -; 8859 -.SGB06: ; 8859 +.SGB06: ld hl, PalPacket_SCGB_06 ld de, BlkPacket_SCGB_06 ret -; 8860 .SGB_Diploma: -.SGB_MysteryGift: ; 8860 +.SGB_MysteryGift: ld hl, PalPacket_Diploma ld de, BlkPacket_9a86 ret -; 8867 -.SGB_GSIntro: ; 8867 +.SGB_GSIntro: ld b, 0 ld hl, .BlkPacketTable_GSIntro rept 4 @@ -324,45 +308,39 @@ endr ld h, [hl] ld l, a ret -; 8878 -.BlkPacketTable_GSIntro: ; 8878 +.BlkPacketTable_GSIntro: dw BlkPacket_9a86, PalPacket_GSIntroShellderLapras dw BlkPacket_GSIntroJigglypuffPikachu, PalPacket_GSIntroJigglypuffPikachu dw BlkPacket_9a86, PalPacket_GSIntroStartersTransition -; 8884 -.SGB_GSTitleScreen: ; 8884 +.SGB_GSTitleScreen: ld hl, PalPacket_GSTitleScreen ld de, BlkPacket_GSTitleScreen ld a, SCGB_DIPLOMA ld [wSGBPredef], a ret -; 8890 -.SGB13: ; 8890 +.SGB13: ld hl, PalPacket_SCGB_13 ld de, BlkPacket_SCGB_13 ret -; 8897 -.SGB0f: ; 8897 - ld hl, PalPacket_SCGB_0F +.SGB_BetaPikachuMinigame: + ld hl, PalPacket_BetaPikachuMinigame ld de, BlkPacket_9a86 ret -; 889e -.SGB11: ; 889e +.SGB_BetaPoker: ld hl, BlkPacket_9a86 ld de, wPlayerLightScreenCount ; ??? ld bc, PALPACKET_LENGTH call CopyBytes - ld hl, PalPacket_SCGB_11 + ld hl, PalPacket_BetaPoker ld de, BlkPacket_9a86 ret -; 88b1 -.SGB_MapPals: ; 88b1 +.SGB_MapPals: ld hl, PalPacket_9bd6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -374,9 +352,8 @@ endr ld a, SCGB_MAPPALS ld [wSGBPredef], a ret -; 88cd -.SGB_Evolution: ; 88cd +.SGB_Evolution: push bc ld hl, PalPacket_9ce6 ld de, wSGBPals @@ -419,22 +396,19 @@ endr ld hl, wSGBPals ld de, BlkPacket_9a86 ret -; 891a .SGB0d: -.SGB_TrainerCard: ; 891a +.SGB_TrainerCard: ld hl, PalPacket_Diploma ld de, BlkPacket_9a86 ret -; 8921 -.SGB_UnownPuzzle: ; 8921 +.SGB_UnownPuzzle: ld hl, PalPacket_UnownPuzzle ld de, BlkPacket_9a86 ret -; 8928 -.SGB12: ; 8928 +.SGB12: ld hl, PalPacket_9bd6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -462,9 +436,8 @@ endr ld hl, wSGBPals ld de, wSGBPals + PALPACKET_LENGTH ret -; 8969 -.SGB1e: ; 8969 +.SGB1e: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -495,15 +468,13 @@ endr ld hl, wSGBPals ld de, BlkPacket_9a86 ret -; 89a6 -.SGB_GamefreakLogo: ; 89a6 +.SGB_GamefreakLogo: ld hl, PalPacket_GamefreakLogo ld de, BlkPacket_9a86 ret -; 89ad -.SGB_PlayerOrMonFrontpicPals: ; 89ad +.SGB_PlayerOrMonFrontpicPals: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -522,15 +493,13 @@ endr ld hl, wSGBPals ld de, BlkPacket_9a86 ret -; 89d9 -.SGB_TradeTube: ; 89d9 +.SGB_TradeTube: ld hl, PalPacket_TradeTube ld de, BlkPacket_9a86 ret -; 89e0 -.SGB_TrainerOrMonFrontpicPals: ; 89e0 +.SGB_TrainerOrMonFrontpicPals: ld hl, PalPacket_9ce6 ld de, wSGBPals ld bc, PALPACKET_LENGTH @@ -549,9 +518,8 @@ endr ld hl, wSGBPals ld de, BlkPacket_9a86 ret -; 8a0c -.GetMapPalsIndex: ; 8a0c +.GetMapPalsIndex: ld a, [wTimeOfDayPal] cp NITE_F jr c, .morn_day @@ -593,13 +561,11 @@ endr .gate ld a, PREDEFPAL_PEWTER ret -; 8a45 INCLUDE "data/maps/sgb_roof_pal_inds.asm" -_LoadSGBLayout_ReturnFromJumpTable: ; 8a60 +_LoadSGBLayout_ReturnFromJumpTable: push de call PushSGBPals_ pop hl jp PushSGBPals_ -; 8a68 diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index 9353b71c9..1d3aa6a8b 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -1,4 +1,4 @@ -DoAnimFrame: ; 8d24b +DoAnimFrame: ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld e, [hl] @@ -10,9 +10,8 @@ DoAnimFrame: ; 8d24b ld h, [hl] ld l, a jp hl -; 8d25b -.Jumptable: ; 8d25b (23:525b) +.Jumptable: ; entries correspond to SPRITE_ANIM_SEQ_* constants dw .Null dw .PartyMon @@ -50,10 +49,10 @@ DoAnimFrame: ; 8d24b dw .IntroUnownF dw .IntroSuicuneAway -.Null: ; 8d2a1 (23:52a1) +.Null: ret -.PartyMon ; 8d2a2 (23:52a2) +.PartyMon ld a, [wMenuCursorY] ld hl, SPRITEANIMSTRUCT_INDEX @@ -70,7 +69,7 @@ DoAnimFrame: ; 8d24b ld [hl], $0 ret -.PartyMonSwitch ; 8d2b9 (23:52b9) +.PartyMonSwitch ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld [hl], 8 * 3 @@ -112,7 +111,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.PartyMonSelected ; 8d2ea (23:52ea) +.PartyMonSelected ld a, [wMenuCursorY] ld hl, SPRITEANIMSTRUCT_INDEX @@ -131,17 +130,15 @@ DoAnimFrame: ; 8d24b ld [hl], 8 * 3 ret -.GSTitleTrail ; 8d302 (23:5302) +.GSTitleTrail call .AnonymousJumptable jp hl -; 8d306 (23:5306) ; Anonymous dw (see .AnonymousJumptable) dw .four_zero dw .four_one -; 8d30a -.four_zero ; 8d30a +.four_zero call .IncrementJumptableIndex ld hl, SPRITEANIMSTRUCT_INDEX @@ -159,7 +156,7 @@ DoAnimFrame: ; 8d24b add hl, bc ld [hl], a -.four_one ; 8d321 +.four_one ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -200,9 +197,8 @@ DoAnimFrame: ; 8d24b .asm_8d356 call DeinitializeSprite ret -; 8d35a -.GSIntroHoOh ; 8d35a (23:535a) +.GSIntroHoOh ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -216,19 +212,19 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.NamingScreenCursor ; 8d36c (23:536c) +.NamingScreenCursor callfar NamingScreen_AnimateCursor ret -.MailCursor ; 8d373 (23:5373) +.MailCursor callfar ComposeMail_AnimateCursor ret -.GameFreakLogo: ; 8d37a (23:537a) +.GameFreakLogo: callfar GameFreakLogoJumper ret -.GSIntroStar ; 8d381 (23:5381) +.GSIntroStar ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -278,7 +274,7 @@ DoAnimFrame: ; 8d24b call DeinitializeSprite ret -.GSIntroSparkle ; 8d3c3 (23:53c3) +.GSIntroSparkle ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hli] @@ -355,11 +351,11 @@ DoAnimFrame: ; 8d24b call DeinitializeSprite ret -.SlotsGolem: ; 8d422 (23:5422) +.SlotsGolem: callfar Slots_AnimateGolem ret -.SlotsChansey: ; 8d429 (23:5429) +.SlotsChansey: callfar Slots_AnimateChansey ld hl, wcf64 ld a, [hl] @@ -370,7 +366,7 @@ DoAnimFrame: ; 8d24b call _ReinitSpriteAnimFrame ret -.SlotsChanseyEgg: ; 8d43e (23:543e) +.SlotsChanseyEgg: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld a, [hl] @@ -403,22 +399,21 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.UnusedCursor ; 8d46e (23:546e) +.UnusedCursor callfar ret_e00ed ret -.PokegearArrow ; 8d475 (23:5475) +.PokegearArrow callfar AnimatePokegearModeIndicatorArrow ret -.DummyGameCursor ; 8d47c (23:547c) +.DummyGameCursor callfar DummyGame_InterpretJoypad_AnimateCursor ret -.TradePokeBall ; 8d483 (23:5483) +.TradePokeBall call .AnonymousJumptable jp hl -; 8d487 (23:5487) ; Anonymous dw (see .AnonymousJumptable) dw .TradePokeBall_zero @@ -427,9 +422,8 @@ DoAnimFrame: ; 8d24b dw .TradePokeBall_three dw .TradePokeBall_four dw .TradePokeBall_five -; 8d493 -.TradePokeBall_zero ; 8d493 +.TradePokeBall_zero ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WOBBLE call _ReinitSpriteAnimFrame @@ -441,9 +435,8 @@ DoAnimFrame: ; 8d24b add hl, bc ld [hl], $20 ret -; 8d4a5 -.TradePokeBall_two ; 8d4a5 +.TradePokeBall_two ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -459,7 +452,7 @@ DoAnimFrame: ; 8d24b add hl, bc ld [hl], $40 -.TradePokeBall_three ; 8d4b8 +.TradePokeBall_three ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -478,9 +471,8 @@ DoAnimFrame: ; 8d24b ld de, SFX_GOT_SAFARI_BALLS call PlaySFX jr .TradePokeBall_five -; 8d4d5 -.TradePokeBall_one ; 8d4d5 +.TradePokeBall_one ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld [hl], $4 @@ -493,9 +485,8 @@ DoAnimFrame: ; 8d24b add hl, bc ld [hl], $24 ret -; 8d4e8 -.TradePokeBall_four ; 8d4e8 +.TradePokeBall_four ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -541,12 +532,11 @@ DoAnimFrame: ; 8d24b call .IncrementJumptableIndex ret -.TradePokeBall_five ; 8d526 +.TradePokeBall_five call DeinitializeSprite ret -; 8d52a -.TradeTubeBulge ; 8d52a (23:552a) +.TradeTubeBulge ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -564,11 +554,11 @@ DoAnimFrame: ; 8d24b call DeinitializeSprite ret -.TrademonInTube ; 8d543 (23:5543) +.TrademonInTube callfar TradeAnim_AnimateTrademonInTube ret -.RevealNewMon: ; 8d54a (23:554a) +.RevealNewMon: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -605,11 +595,11 @@ DoAnimFrame: ; 8d24b call DeinitializeSprite ret -.RadioTuningKnob: ; 8d578 (23:5578) +.RadioTuningKnob: callfar AnimateTuningKnob ret -.CutLeaves ; 8d57f (23:557f) +.CutLeaves ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld e, [hl] @@ -648,7 +638,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.FlyFrom: ; 8d5b0 (23:55b0) +.FlyFrom: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -687,7 +677,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.FlyLeaf: ; 8d5e2 (23:55e2) +.FlyLeaf: ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -716,7 +706,7 @@ DoAnimFrame: ; 8d24b call DeinitializeSprite ret -.FlyTo: ; 8d607 (23:5607) +.FlyTo: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -748,15 +738,15 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.MobileTradeSentPulse ; 8d630 (23:5630) +.MobileTradeSentPulse farcall Function108bc7 ret -.MobileTradeOTPulse ; 8d637 (23:5637) +.MobileTradeOTPulse farcall Function108be0 ret -.IntroSuicune ; 8d63e (23:563e) +.IntroSuicune ld a, [wcf65] and a jr nz, .asm_8d645 @@ -783,7 +773,7 @@ DoAnimFrame: ; 8d24b call _ReinitSpriteAnimFrame ret -.IntroPichuWooper ; 8d666 (23:5666) +.IntroPichuWooper ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -802,7 +792,7 @@ DoAnimFrame: ; 8d24b .asm_8d67f ret -.IntroUnown ; 8d680 (23:5680) +.IntroUnown ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld d, [hl] @@ -829,7 +819,7 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.IntroUnownF ; 8d6a2 (23:56a2) +.IntroUnownF ld a, [wcf64] cp $40 ret nz @@ -837,7 +827,7 @@ DoAnimFrame: ; 8d24b call _ReinitSpriteAnimFrame ret -.IntroSuicuneAway ; 8d6ae (23:56ae) +.IntroSuicuneAway ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -845,15 +835,15 @@ DoAnimFrame: ; 8d24b ld [hl], a ret -.EZChatCursor ; 8d6b7 (23:56b7) +.EZChatCursor farcall AnimateEZChatCursor ret -.Celebi ; 8d6be (23:56be) +.Celebi farcall UpdateCelebiPosition ret -.AnonymousJumptable: ; 8d6c5 (23:56c5) +.AnonymousJumptable: ld hl, sp+$0 ld e, [hl] inc hl @@ -870,20 +860,17 @@ DoAnimFrame: ; 8d24b ld h, [hl] ld l, a ret -; 8d6d8 (23:56d8) -.IncrementJumptableIndex: ; 8d6d8 +.IncrementJumptableIndex: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc inc [hl] ret -; 8d6de -.Sprites_Sine: ; 8d6de (23:56de) +.Sprites_Sine: call Sprites_Sine ret -.Sprites_Cosine: ; 8d6e2 (23:56e2) +.Sprites_Cosine: call Sprites_Cosine ret -; 8d6e6 (23:56e6) diff --git a/engine/gfx/sprites.asm b/engine/gfx/sprites.asm index 63666c624..1b22e5832 100644 --- a/engine/gfx/sprites.asm +++ b/engine/gfx/sprites.asm @@ -1,4 +1,4 @@ -ClearSpriteAnims: ; 8cf53 +ClearSpriteAnims: ld hl, wSpriteAnimDict ld bc, wSpriteAnimsEnd - wSpriteAnimDict .loop @@ -9,15 +9,13 @@ ClearSpriteAnims: ; 8cf53 or b jr nz, .loop ret -; 8cf62 -PlaySpriteAnimationsAndDelayFrame: ; 8cf62 +PlaySpriteAnimationsAndDelayFrame: call PlaySpriteAnimations call DelayFrame ret -; 8cf69 -PlaySpriteAnimations: ; 8cf69 +PlaySpriteAnimations: push hl push de push bc @@ -32,9 +30,8 @@ PlaySpriteAnimations: ; 8cf69 pop de pop hl ret -; 8cf7a -DoNextFrameForAllSprites: ; 8cf7a +DoNextFrameForAllSprites: ld hl, wSpriteAnimationStructs ld e, NUM_SPRITE_ANIM_STRUCTS @@ -72,9 +69,8 @@ DoNextFrameForAllSprites: ; 8cf7a .done ret -; 8cfa8 -DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) +DoNextFrameForFirst16Sprites: ld hl, wSpriteAnimationStructs ld e, NUM_SPRITE_ANIM_STRUCTS @@ -113,7 +109,7 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) .done ret -InitSpriteAnimStruct:: ; 8cfd6 +InitSpriteAnimStruct:: ; Initialize animation a at pixel x=e, y=d ; Find if there's any room in the wSpriteAnimationStructs array, which is 10x16 push de @@ -208,18 +204,15 @@ endr ld a, b ld [wSpriteAnimAddrBackup + 1], a ret -; 8d036 -DeinitializeSprite: ; 8d036 +DeinitializeSprite: ; Clear the index field of the struct in bc. ld hl, SPRITEANIMSTRUCT_INDEX add hl, bc ld [hl], $0 ret -; 8d03d - -DeinitializeAllSprites: ; 8d03d (23:503d) +DeinitializeAllSprites: ; Clear the index field of every struct in the wSpriteAnimationStructs array. ld hl, wSpriteAnimationStructs ld bc, SPRITEANIMSTRUCT_LENGTH @@ -232,8 +225,7 @@ DeinitializeAllSprites: ; 8d03d (23:503d) jr nz, .loop ret - -UpdateAnimFrame: ; 8d04c +UpdateAnimFrame: call InitSpriteAnimBuffer ; init WRAM call GetSpriteAnimFrame ; read from a memory array cp -3 @@ -319,9 +311,8 @@ UpdateAnimFrame: ; 8d04c pop bc scf ret -; 8d0be -AddOrSubtractY: ; 8d0be +AddOrSubtractY: push hl ld a, [hl] ld hl, wCurrSpriteAddSubFlags @@ -335,9 +326,8 @@ AddOrSubtractY: ; 8d0be .ok pop hl ret -; 8d0ce -AddOrSubtractX: ; 8d0ce +AddOrSubtractX: push hl ld a, [hl] ld hl, wCurrSpriteAddSubFlags @@ -351,9 +341,8 @@ AddOrSubtractX: ; 8d0ce .ok pop hl ret -; 8d0de -GetSpriteOAMAttr: ; 8d0de +GetSpriteOAMAttr: ld a, [wCurrSpriteAddSubFlags] ld b, a ld a, [hl] @@ -364,9 +353,8 @@ GetSpriteOAMAttr: ; 8d0de and $1f or b ret -; 8d0ec -InitSpriteAnimBuffer: ; 8d0ec +InitSpriteAnimBuffer: xor a ld [wCurrSpriteAddSubFlags], a ld hl, SPRITEANIMSTRUCT_TILE_ID @@ -382,9 +370,8 @@ InitSpriteAnimBuffer: ; 8d0ec ld a, [hli] ld [wCurrAnimYOffset], a ret -; 8d109 -GetSpriteAnimVTile: ; 8d109 +GetSpriteAnimVTile: ; a = wSpriteAnimDict[a] if a in wSpriteAnimDict else 0 ; vTiles offset push hl @@ -409,9 +396,8 @@ GetSpriteAnimVTile: ; 8d109 pop bc pop hl ret -; 8d120 -_ReinitSpriteAnimFrame:: ; 8d120 +_ReinitSpriteAnimFrame:: ld hl, SPRITEANIMSTRUCT_FRAMESET_ID add hl, bc ld [hl], a @@ -422,10 +408,8 @@ _ReinitSpriteAnimFrame:: ; 8d120 add hl, bc ld [hl], -1 ret -; 8d132 - -GetSpriteAnimFrame: ; 8d132 +GetSpriteAnimFrame: .loop ld hl, SPRITEANIMSTRUCT_DURATION add hl, bc @@ -491,9 +475,8 @@ GetSpriteAnimFrame: ; 8d132 add hl, bc ld [hl], a jr .loop -; 8d189 -.GetPointer: ; 8d189 +.GetPointer: ; Get the data for the current frame for the current animation sequence ; SpriteAnimFrameData[SpriteAnim[SPRITEANIMSTRUCT_FRAMESET_ID]][SpriteAnim[SPRITEANIMSTRUCT_FRAME]] @@ -514,9 +497,8 @@ GetSpriteAnimFrame: ; 8d132 add hl, hl add hl, de ret -; 8d1a2 -GetFrameOAMPointer: ; 8d1a2 +GetFrameOAMPointer: ; Load OAM data pointer ld e, a ld d, 0 @@ -525,9 +507,8 @@ GetFrameOAMPointer: ; 8d1a2 add hl, de add hl, de ret -; 8d1ac -Unreferenced_BrokenGetStdGraphics: ; 8d1ac +Unreferenced_BrokenGetStdGraphics: push hl ld l, a ld h, 0 @@ -547,8 +528,6 @@ Unreferenced_BrokenGetStdGraphics: ; 8d1ac call Request2bpp pop bc ret -; 8d1c4 - INCLUDE "data/sprite_anims/sequences.asm" @@ -558,7 +537,6 @@ INCLUDE "data/sprite_anims/framesets.asm" INCLUDE "data/sprite_anims/oam.asm" - BrokenStdGFXPointers: ; tile count, bank, pointer ; (all pointers were dummied out to .deleted) @@ -573,19 +551,16 @@ BrokenStdGFXPointers: dbbw 16, $21, .deleted .deleted -; 8e72a (23:672a) - -Sprites_Cosine: ; 8e72a +Sprites_Cosine: ; a = d * cos(a * pi/32) add %010000 ; cos(x) = sin(x + pi/2) ; fallthrough -Sprites_Sine: ; 8e72c +Sprites_Sine: ; a = d * sin(a * pi/32) calc_sine_wave - -AnimateEndOfExpBar: ; 8e79d +AnimateEndOfExpBar: ld a, [hSGB] ld de, EndOfExpBarGFX and a @@ -609,9 +584,8 @@ AnimateEndOfExpBar: ; 8e79d jr nz, .loop call ClearSprites ret -; 8e7c6 -.AnimateFrame: ; 8e7c6 +.AnimateFrame: ld hl, wVirtualOAMSprite00 ld c, 8 ; number of animated circles .anim_loop @@ -648,14 +622,13 @@ AnimateEndOfExpBar: ; 8e79d ld a, PAL_BATTLE_OB_BLUE ld [hli], a ; attributes jr .anim_loop -; 8e7f4 -EndOfExpBarGFX: ; 8e7f4 +EndOfExpBarGFX: INCBIN "gfx/battle/expbarend.2bpp" -SGBEndOfExpBarGFX: ; 8e804 +SGBEndOfExpBarGFX: INCBIN "gfx/battle/expbarend_sgb.2bpp" -ClearSpriteAnims2: ; 8e814 +ClearSpriteAnims2: push hl push de push bc @@ -674,4 +647,3 @@ ClearSpriteAnims2: ; 8e814 pop de pop hl ret -; 8e82b diff --git a/engine/gfx/trademon_frontpic.asm b/engine/gfx/trademon_frontpic.asm index d5f7b55de..d557123e9 100644 --- a/engine/gfx/trademon_frontpic.asm +++ b/engine/gfx/trademon_frontpic.asm @@ -1,4 +1,4 @@ -GetTrademonFrontpic: ; 4d7fd +GetTrademonFrontpic: ld a, [wOTTrademonSpecies] ld hl, wOTTrademonDVs ld de, vTiles2 @@ -13,7 +13,7 @@ GetTrademonFrontpic: ; 4d7fd predef GetAnimatedFrontpic ret -AnimateTrademonFrontpic: ; 4d81e +AnimateTrademonFrontpic: ld a, [wOTTrademonSpecies] call IsAPokemon ret c diff --git a/engine/items/buy_sell_toss.asm b/engine/items/buy_sell_toss.asm index 84481d030..3303f4319 100644 --- a/engine/items/buy_sell_toss.asm +++ b/engine/items/buy_sell_toss.asm @@ -1,13 +1,12 @@ -SelectQuantityToToss: ; 24fbf +SelectQuantityToToss: ld hl, TossItem_MenuHeader call LoadMenuHeader call Toss_Sell_Loop ret -; 24fc9 -SelectQuantityToBuy: ; 24fc9 +SelectQuantityToBuy: farcall GetItemPrice -RooftopSale_SelectQuantityToBuy: ; 24fcf +RooftopSale_SelectQuantityToBuy: ld a, d ld [wBuffer1], a ld a, e @@ -16,9 +15,8 @@ RooftopSale_SelectQuantityToBuy: ; 24fcf call LoadMenuHeader call Toss_Sell_Loop ret -; 24fe1 -SelectQuantityToSell: ; 24fe1 +SelectQuantityToSell: farcall GetItemPrice ld a, d ld [wBuffer1], a @@ -28,9 +26,8 @@ SelectQuantityToSell: ; 24fe1 call LoadMenuHeader call Toss_Sell_Loop ret -; 24ff9 -Toss_Sell_Loop: ; 24ff9 +Toss_Sell_Loop: ld a, 1 ld [wItemQuantityChangeBuffer], a .loop @@ -45,9 +42,8 @@ Toss_Sell_Loop: ; 24ff9 .nope and a ret -; 2500e -BuySellToss_InterpretJoypad: ; 2500e +BuySellToss_InterpretJoypad: call JoyTextDelay_ForcehJoyDown ; get joypad bit B_BUTTON_F, c jr nz, .b @@ -126,9 +122,8 @@ BuySellToss_InterpretJoypad: ; 2500e ld [wItemQuantityChangeBuffer], a and a ret -; 25072 -BuySellToss_UpdateQuantityDisplay: ; 25072 +BuySellToss_UpdateQuantityDisplay: call MenuBox call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 @@ -145,26 +140,22 @@ BuySellToss_UpdateQuantityDisplay: ; 25072 ld a, [wMenuDataBank] call FarCall_de ret -; 25097 -ret_25097: ; 25097 +ret_25097: ret -; 25098 -DisplayPurchasePrice: ; 25098 +DisplayPurchasePrice: call BuySell_MultiplyPrice call BuySell_DisplaySubtotal ret -; 2509f -DisplaySellingPrice: ; 2509f +DisplaySellingPrice: call BuySell_MultiplyPrice call Sell_HalvePrice call BuySell_DisplaySubtotal ret -; 250a9 -BuySell_MultiplyPrice: ; 250a9 +BuySell_MultiplyPrice: xor a ld [hMultiplicand + 0], a ld a, [wBuffer1] @@ -177,9 +168,8 @@ BuySell_MultiplyPrice: ; 250a9 call Multiply pop hl ret -; 250c1 -Sell_HalvePrice: ; 250c1 +Sell_HalvePrice: push hl ld hl, hProduct + 1 ld a, [hl] @@ -193,9 +183,8 @@ Sell_HalvePrice: ; 250c1 ld [hl], a pop hl ret -; 250d1 -BuySell_DisplaySubtotal: ; 250d1 +BuySell_DisplaySubtotal: push hl ld hl, hMoneyTemp ld a, [hProduct + 1] @@ -211,25 +200,21 @@ BuySell_DisplaySubtotal: ; 250d1 call PrintNum call WaitBGMap ret -; 250ed -TossItem_MenuHeader: ; 0x250ed +TossItem_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 15, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw ret_25097 db 0 ; default option -; 0x250f5 -BuyItem_MenuHeader: ; 0x250f5 +BuyItem_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw DisplayPurchasePrice db -1 ; default option -; 0x250fd -SellItem_MenuHeader: ; 0x250fd +SellItem_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw DisplaySellingPrice db 0 ; default option -; 0x25105 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index a32ce0ef7..1439b2c6d 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1,4 +1,4 @@ -_DoItemEffect:: ; e722 +_DoItemEffect:: ld a, [wCurItem] ld [wd265], a call GetItemName @@ -10,10 +10,8 @@ _DoItemEffect:: ; e722 ld hl, ItemEffects rst JumpTable ret -; e73c - -ItemEffects: ; e73c +ItemEffects: ; entries correspond to item ids dw PokeBallEffect ; MASTER_BALL dw PokeBallEffect ; ULTRA_BALL @@ -194,10 +192,8 @@ ItemEffects: ; e73c dw PokeBallEffect ; PARK_BALL dw NoEffect ; RAINBOW_WING dw NoEffect ; ITEM_B3 -; e8a2 - -PokeBallEffect: ; e8a2 +PokeBallEffect: ld a, [wBattleMode] dec a jp nz, UseBallInTrainerBattle @@ -488,8 +484,8 @@ PokeBallEffect: ; e8a2 ld de, wEnemyMonPP ld bc, NUM_MOVES call CopyBytes -.Transformed: +.Transformed: ld a, [wEnemyMonSpecies] ld [wWildMon], a ld [wCurPartySpecies], a @@ -564,8 +560,8 @@ PokeBallEffect: ; e8a2 ld a, FRIEND_BALL_HAPPINESS ld [hl], a -.SkipPartyMonFriendBall: +.SkipPartyMonFriendBall: ld hl, Text_AskNicknameNewlyCaughtMon call PrintText @@ -713,8 +709,6 @@ PokeBallEffect: ; e8a2 ld hl, wParkBallsRemaining dec [hl] ret -; ec0a - BallMultiplierFunctionTable: ; table of routines that increase or decrease the catch rate based on @@ -767,10 +761,10 @@ GetPokedexEntryBank: ret .PokedexEntryBanks: - db BANK(PokedexEntries1) - db BANK(PokedexEntries2) - db BANK(PokedexEntries3) - db BANK(PokedexEntries4) + db BANK("Pokedex Entries 001-064") + db BANK("Pokedex Entries 065-128") + db BANK("Pokedex Entries 129-192") + db BANK("Pokedex Entries 193-251") HeavyBallMultiplier: ; subtract 20 from catch rate if weight < 102.4 kg @@ -907,7 +901,7 @@ MoonBallMultiplier: pop bc push bc - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte cp EVOLVE_ITEM pop bc @@ -921,7 +915,7 @@ MoonBallMultiplier: ; No Pokémon evolve with Burn Heal, ; so Moon Balls always have a catch rate of 1×. push bc - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte cp MOON_STONE_RED ; BURN_HEAL pop bc @@ -1067,43 +1061,37 @@ LevelBallMultiplier: ; These two texts were carried over from gen 1. ; They are not used in gen 2, and are dummied out. -Text_RBY_CatchMarowak: ; 0xedab +Text_RBY_CatchMarowak: ; It dodged the thrown BALL! This #MON can't be caught! text_jump UnknownText_0x1c5a5a db "@" -; 0xedb0 -Text_RBY_NoShake: ; 0xedb0 +Text_RBY_NoShake: ; You missed the #MON! text_jump UnknownText_0x1c5a90 db "@" -; 0xedb5 -Text_NoShake: ; 0xedb5 +Text_NoShake: ; Oh no! The #MON broke free! text_jump UnknownText_0x1c5aa6 db "@" -; 0xedba -Text_OneShake: ; 0xedba +Text_OneShake: ; Aww! It appeared to be caught! text_jump UnknownText_0x1c5ac3 db "@" -; 0xedbf -Text_TwoShakes: ; 0xedbf +Text_TwoShakes: ; Aargh! Almost had it! text_jump UnknownText_0x1c5ae3 db "@" -; 0xedc4 -Text_ThreeShakes: ; 0xedc4 +Text_ThreeShakes: ; Shoot! It was so close too! text_jump UnknownText_0x1c5afa db "@" -; 0xedc9 -Text_GotchaMonWasCaught: ; 0xedc9 +Text_GotchaMonWasCaught: ; Gotcha! @ was caught!@ @ text_jump UnknownText_0x1c5b17 start_asm @@ -1117,49 +1105,40 @@ Text_GotchaMonWasCaught: ; 0xedc9 pop bc ld hl, TextJump_Waitbutton ret -; ede6 -TextJump_Waitbutton: ; 0xede6 +TextJump_Waitbutton: ; @ text_jump Text_Waitbutton_2 db "@" -; 0xedeb -Text_SentToBillsPC: ; 0xedeb +Text_SentToBillsPC: ; was sent to BILL's PC. text_jump UnknownText_0x1c5b38 db "@" -; 0xedf0 -Text_AddedToPokedex: ; 0xedf0 +Text_AddedToPokedex: ; 's data was newly added to the #DEX.@ @ text_jump UnknownText_0x1c5b53 db "@" -; 0xedf5 -Text_AskNicknameNewlyCaughtMon: ; 0xedf5 +Text_AskNicknameNewlyCaughtMon: ; Give a nickname to @ ? text_jump UnknownText_0x1c5b7f db "@" -; 0xedfa -ReturnToBattle_UseBall: ; edfa (3:6dfa) +ReturnToBattle_UseBall: farcall _ReturnToBattle_UseBall ret -TownMapEffect: ; ee01 +TownMapEffect: farcall PokegearMap ret -; ee08 - -BicycleEffect: ; ee08 +BicycleEffect: farcall BikeFunction ret -; ee0f - -EvoStoneEffect: ; ee0f +EvoStoneEffect: ld b, PARTYMENUACTION_EVO_STONE call UseItem_SelectMon @@ -1189,10 +1168,8 @@ EvoStoneEffect: ; ee0f xor a ld [wItemEffectSucceeded], a ret -; ee3d - -VitaminEffect: ; ee3d +VitaminEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon @@ -1235,15 +1212,12 @@ VitaminEffect: ; ee3d jp UseDisposableItem - -NoEffectMessage: ; ee83 +NoEffectMessage: ld hl, WontHaveAnyEffectText call PrintText jp ClearPalettes -; ee8c - -UpdateStatsAfterItem: ; ee8c +UpdateStatsAfterItem: ld a, MON_MAXHP call GetPartyParamLocation ld d, h @@ -1252,23 +1226,18 @@ UpdateStatsAfterItem: ; ee8c call GetPartyParamLocation ld b, TRUE predef_jump CalcMonStats -; ee9f -RareCandy_StatBooster_ExitMenu: ; ee9f +RareCandy_StatBooster_ExitMenu: xor a ld [wItemEffectSucceeded], a jp ClearPalettes -; eea6 - -Text_StatRose: ; 0xeea6 +Text_StatRose: ; 's @ rose. text_jump UnknownText_0x1c5b9a db "@" -; 0xeeab - -StatStrings: ; eeab +StatStrings: dw .health dw .attack dw .defense @@ -1280,10 +1249,8 @@ StatStrings: ; eeab .defense db "DEFENSE@" .speed db "SPEED@" .special db "SPECIAL@" -; eed9 - -GetStatExpRelativePointer: ; eed9 +GetStatExpRelativePointer: ld a, [wCurItem] ld hl, Table_eeeb .next @@ -1298,18 +1265,15 @@ GetStatExpRelativePointer: ; eed9 ld c, a ld b, 0 ret -; eeeb -Table_eeeb: ; eeeb +Table_eeeb: db HP_UP, MON_HP_EXP - MON_STAT_EXP db PROTEIN, MON_ATK_EXP - MON_STAT_EXP db IRON, MON_DEF_EXP - MON_STAT_EXP db CARBOS, MON_SPD_EXP - MON_STAT_EXP db CALCIUM, MON_SPC_EXP - MON_STAT_EXP -; eef5 - -RareCandy_StatBooster_GetParameters: ; eef5 +RareCandy_StatBooster_GetParameters: ld a, [wCurPartySpecies] ld [wCurSpecies], a ld [wd265], a @@ -1322,10 +1286,8 @@ RareCandy_StatBooster_GetParameters: ; eef5 ld hl, wPartyMonNicknames call GetNick ret -; 0xef14 - -RareCandyEffect: ; ef14 +RareCandyEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon @@ -1414,10 +1376,8 @@ RareCandyEffect: ; ef14 farcall EvolvePokemon jp UseDisposableItem -; efad - -HealPowderEffect: ; efad +HealPowderEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon @@ -1436,21 +1396,17 @@ HealPowderEffect: ; efad .asm_efc9 jp StatusHealer_Jumptable -; efcc - -StatusHealingEffect: ; efcc +StatusHealingEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon jp c, StatusHealer_ExitMenu -FullyHealStatus: ; efd4 +FullyHealStatus: call UseStatusHealer jp StatusHealer_Jumptable -; efda - -UseStatusHealer: ; efda (3:6fda) +UseStatusHealer: call IsMonFainted ld a, $1 ret z @@ -1476,7 +1432,7 @@ UseStatusHealer: ; efda (3:6fda) ld a, $0 ret -IsItemUsedOnConfusedMon: ; f009 (3:7009) +IsItemUsedOnConfusedMon: call IsItemUsedOnBattleMon jr nc, .nope ld a, [wPlayerSubStatus3] @@ -1492,7 +1448,7 @@ IsItemUsedOnConfusedMon: ; f009 (3:7009) and a ret -BattlemonRestoreHealth: ; f01e (3:701e) +BattlemonRestoreHealth: call IsItemUsedOnBattleMon ret nc ld a, MON_HP @@ -1503,7 +1459,7 @@ BattlemonRestoreHealth: ; f01e (3:701e) ld [wBattleMonHP + 1], a ret -HealStatus: ; f030 (3:7030) +HealStatus: call IsItemUsedOnBattleMon ret nc xor a @@ -1524,7 +1480,7 @@ HealStatus: ; f030 (3:7030) pop bc ret -GetItemHealingAction: ; f058 (3:7058) +GetItemHealingAction: push hl ld a, [wCurItem] ld hl, StatusHealingActions @@ -1544,22 +1500,20 @@ GetItemHealingAction: ; f058 (3:7058) cp %11111111 pop hl ret -; f071 (3:7071) INCLUDE "data/items/heal_status.asm" -StatusHealer_Jumptable: ; f09e (3:709e) +StatusHealer_Jumptable: ld hl, .dw rst JumpTable ret -.dw ; f0a3 (3:70a3) +.dw dw StatusHealer_ClearPalettes dw StatusHealer_NoEffect dw StatusHealer_ExitMenu - -RevivalHerbEffect: ; f0a9 +RevivalHerbEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon jp c, StatusHealer_ExitMenu @@ -1575,20 +1529,16 @@ RevivalHerbEffect: ; f0a9 .asm_f0c5 jp StatusHealer_Jumptable -; f0c8 - -ReviveEffect: ; f0c8 +ReviveEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon jp c, StatusHealer_ExitMenu call RevivePokemon jp StatusHealer_Jumptable -; f0d6 - -RevivePokemon: ; f0d6 +RevivePokemon: call IsMonFainted ld a, 1 ret nz @@ -1633,10 +1583,8 @@ RevivePokemon: ; f0d6 call UseDisposableItem ld a, 0 ret -; f128 - -FullRestoreEffect: ; f128 +FullRestoreEffect: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon jp c, StatusHealer_ExitMenu @@ -1652,10 +1600,8 @@ FullRestoreEffect: ; f128 .NotAtFullHealth: call .FullRestore jp StatusHealer_Jumptable -; f144 - -.FullRestore: ; f144 +.FullRestore: xor a ld [wLowHealthAlarm], a call ReviveFullHP @@ -1673,10 +1619,8 @@ FullRestoreEffect: ; f128 call UseDisposableItem ld a, 0 ret -; f16a - -BitterBerryEffect: ; f16a +BitterBerryEffect: ld hl, wPlayerSubStatus3 bit SUBSTATUS_CONFUSED, [hl] ld a, 1 @@ -1694,25 +1638,19 @@ BitterBerryEffect: ; f16a .done jp StatusHealer_Jumptable -; f186 - -RestoreHPEffect: ; f186 +RestoreHPEffect: call ItemRestoreHP jp StatusHealer_Jumptable -; f18c - -EnergypowderEffect: ; f18c +EnergypowderEffect: ld c, HAPPINESS_BITTERPOWDER jr EnergypowderEnergyRootCommon -; f190 -EnergyRootEffect: ; f190 +EnergyRootEffect: ld c, HAPPINESS_ENERGYROOT -; f192 -EnergypowderEnergyRootCommon: ; f192 +EnergypowderEnergyRootCommon: push bc call ItemRestoreHP pop bc @@ -1725,10 +1663,8 @@ EnergypowderEnergyRootCommon: ; f192 .skip_happiness jp StatusHealer_Jumptable -; f1a9 - -ItemRestoreHP: ; f1a9 (3:71a9) +ItemRestoreHP: ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon ld a, 2 @@ -1755,7 +1691,7 @@ ItemRestoreHP: ; f1a9 (3:71a9) ld a, 0 ret -HealHP_SFX_GFX: ; f1db (3:71db) +HealHP_SFX_GFX: push de ld de, SFX_POTION call WaitPlaySFX @@ -1768,7 +1704,7 @@ HealHP_SFX_GFX: ; f1db (3:71db) ld [wWhichHPBar], a predef_jump AnimateHPBar -UseItem_SelectMon: ; f1f9 (3:71f9) +UseItem_SelectMon: call .SelectMon ret c @@ -1784,7 +1720,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9) and a ret -.SelectMon: ; f20b (3:720b) +.SelectMon: ld a, b ld [wPartyMenuActionText], a push hl @@ -1797,7 +1733,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9) pop hl ret -ChooseMonToUseItemOn: ; f21c (3:721c) +ChooseMonToUseItemOn: farcall LoadPartyMenuGFX farcall InitPartyMenuWithCancel farcall InitPartyMenuGFX @@ -1809,7 +1745,7 @@ ChooseMonToUseItemOn: ; f21c (3:721c) farcall PartyMenuSelect ret -ItemActionText: ; f24a (3:724a) +ItemActionText: ld [wPartyMenuActionText], a ld a, [wCurPartySpecies] push af @@ -1832,7 +1768,7 @@ ItemActionText: ; f24a (3:724a) ld [wCurPartySpecies], a ret -ItemActionTextWaitButton: ; f279 (3:7279) +ItemActionTextWaitButton: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -1847,18 +1783,18 @@ ItemActionTextWaitButton: ; f279 (3:7279) call DelayFrames jp WaitPressAorB_BlinkCursor -StatusHealer_NoEffect: ; f299 (3:7299) +StatusHealer_NoEffect: call WontHaveAnyEffectMessage jr StatusHealer_ClearPalettes -StatusHealer_ExitMenu: ; f29e (3:729e) +StatusHealer_ExitMenu: xor a ld [wItemEffectSucceeded], a -StatusHealer_ClearPalettes: ; f2a2 (3:72a2) +StatusHealer_ClearPalettes: call ClearPalettes ret -IsItemUsedOnBattleMon: ; f2a6 (3:72a6) +IsItemUsedOnBattleMon: ld a, [wBattleMode] and a ret z @@ -1875,15 +1811,15 @@ IsItemUsedOnBattleMon: ; f2a6 (3:72a6) xor a ret -ReviveHalfHP: ; f2ba (3:72ba) +ReviveHalfHP: call LoadHPFromBuffer1 srl d rr e jr ContinueRevive -ReviveFullHP: ; f2c3 (3:72c3) +ReviveFullHP: call LoadHPFromBuffer1 -ContinueRevive: ; f2c6 (3:72c6) +ContinueRevive: ld a, MON_HP call GetPartyParamLocation ld [hl], d @@ -1891,7 +1827,7 @@ ContinueRevive: ; f2c6 (3:72c6) ld [hl], e jp LoadCurHPIntoBuffer5 -RestoreHealth: ; f2d1 (3:72d1) +RestoreHealth: ld a, MON_HP + 1 call GetPartyParamLocation ld a, [hl] @@ -1920,7 +1856,7 @@ RestoreHealth: ; f2d1 (3:72d1) .finish ret -RemoveHP: ; f2f9 (3:72f9) +RemoveHP: ld a, MON_HP + 1 call GetPartyParamLocation ld a, [hl] @@ -1937,7 +1873,7 @@ RemoveHP: ; f2f9 (3:72f9) call LoadCurHPIntoBuffer5 ret -IsMonFainted: ; f30d (3:730d) +IsMonFainted: push de call LoadMaxHPToBuffer1 call LoadCurHPToBuffer3 @@ -1947,7 +1883,7 @@ IsMonFainted: ; f30d (3:730d) pop de ret -IsMonAtFullHealth: ; f31b (3:731b) +IsMonAtFullHealth: call LoadHPFromBuffer3 ld h, d ld l, e @@ -1958,7 +1894,7 @@ IsMonAtFullHealth: ; f31b (3:731b) sbc d ret -LoadCurHPIntoBuffer5: ; f328 (3:7328) +LoadCurHPIntoBuffer5: ld a, MON_HP call GetPartyParamLocation ld a, [hli] @@ -1966,25 +1902,22 @@ LoadCurHPIntoBuffer5: ; f328 (3:7328) ld a, [hl] ld [wBuffer5], a ret -; f336 (3:7336) -LoadHPIntoBuffer5: ; f336 +LoadHPIntoBuffer5: ld a, d ld [wBuffer6], a ld a, e ld [wBuffer5], a ret -; f33f -LoadHPFromBuffer5: ; f33f +LoadHPFromBuffer5: ld a, [wBuffer6] ld d, a ld a, [wBuffer5] ld e, a ret -; f348 -LoadCurHPToBuffer3: ; f348 (3:7348) +LoadCurHPToBuffer3: ld a, MON_HP call GetPartyParamLocation ld a, [hli] @@ -1993,14 +1926,14 @@ LoadCurHPToBuffer3: ; f348 (3:7348) ld [wBuffer3], a ret -LoadHPFromBuffer3: ; f356 (3:7356) +LoadHPFromBuffer3: ld a, [wBuffer4] ld d, a ld a, [wBuffer3] ld e, a ret -LoadMaxHPToBuffer1: ; f35f (3:735f) +LoadMaxHPToBuffer1: push hl ld a, MON_MAXHP call GetPartyParamLocation @@ -2011,14 +1944,14 @@ LoadMaxHPToBuffer1: ; f35f (3:735f) pop hl ret -LoadHPFromBuffer1: ; f36f (3:736f) +LoadHPFromBuffer1: ld a, [wBuffer2] ld d, a ld a, [wBuffer1] ld e, a ret -GetOneFifthMaxHP: ; f378 (3:7378) +GetOneFifthMaxHP: push bc ld a, MON_MAXHP call GetPartyParamLocation @@ -2037,7 +1970,7 @@ GetOneFifthMaxHP: ; f378 (3:7378) pop bc ret -GetHealingItemAmount: ; f395 (3:7395) +GetHealingItemAmount: push hl ld a, [wCurItem] ld hl, HealingHPAmounts @@ -2060,11 +1993,10 @@ GetHealingItemAmount: ; f395 (3:7395) ld d, [hl] pop hl ret -; f3af (3:73af) INCLUDE "data/items/heal_hp.asm" -Softboiled_MilkDrinkFunction: ; f3df (3:73df) +Softboiled_MilkDrinkFunction: ; Softboiled/Milk Drink in the field ld a, [wPartyMenuCursor] dec a @@ -2094,7 +2026,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) ld [wPartyMenuCursor], a ret -.SelectMilkDrinkRecipient: ; f419 (3:7419) +.SelectMilkDrinkRecipient: .loop push bc ld a, PARTYMENUACTION_HEALING_ITEM @@ -2127,16 +2059,13 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) call MenuTextBoxBackup pop bc jr .loop -; f44a (3:744a) -.Text_CantBeUsed: ; 0xf44a +.Text_CantBeUsed: ; That can't be used on this #MON. text_jump UnknownText_0x1c5bac db "@" -; 0xf44f - -EscapeRopeEffect: ; f44f +EscapeRopeEffect: xor a ld [wItemEffectSucceeded], a farcall EscapeRopeFunction @@ -2145,24 +2074,19 @@ EscapeRopeEffect: ; f44f cp 1 call z, UseDisposableItem ret -; f462 - -SuperRepelEffect: ; f462 +SuperRepelEffect: ld b, 200 jr UseRepel -; f466 -MaxRepelEffect: ; f466 +MaxRepelEffect: ld b, 250 jr UseRepel -; f466 -RepelEffect: ; f46a +RepelEffect: ld b, 100 -; f46c -UseRepel: ; f46c +UseRepel: ld a, [wRepelEffect] and a ld hl, TextJump_RepelUsedEarlierIsStillInEffect @@ -2172,24 +2096,19 @@ UseRepel: ; f46c ld [wRepelEffect], a jp UseItemText - -TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d +TextJump_RepelUsedEarlierIsStillInEffect: ; The REPEL used earlier is still in effect. text_jump Text_RepelUsedEarlierIsStillInEffect db "@" -; 0xf482 - -XAccuracyEffect: ; f482 +XAccuracyEffect: ld hl, wPlayerSubStatus4 bit SUBSTATUS_X_ACCURACY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_X_ACCURACY, [hl] jp UseItemText -; f48f - -PokeDollEffect: ; f48f +PokeDollEffect: ld a, [wBattleMode] dec a jr nz, .asm_f4a6 @@ -2205,28 +2124,22 @@ PokeDollEffect: ; f48f xor a ld [wItemEffectSucceeded], a ret -; f4ab - -GuardSpecEffect: ; f4ab +GuardSpecEffect: ld hl, wPlayerSubStatus4 bit SUBSTATUS_MIST, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_MIST, [hl] jp UseItemText -; f4b8 - -DireHitEffect: ; f4b8 +DireHitEffect: ld hl, wPlayerSubStatus4 bit SUBSTATUS_FOCUS_ENERGY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_FOCUS_ENERGY, [hl] jp UseItemText -; f4c5 - -XItemEffect: ; f4c5 +XItemEffect: call UseItemText ld a, [wCurItem] @@ -2257,12 +2170,10 @@ XItemEffect: ; f4c5 ld c, HAPPINESS_USEDXITEM farcall ChangeHappiness ret -; f504 INCLUDE "data/items/x_stats.asm" - -PokeFluteEffect: ; f50c +PokeFluteEffect: ld a, [wBattleMode] and a jr nz, .dummy @@ -2306,7 +2217,6 @@ PokeFluteEffect: ; f50c ld hl, .AllSleepingMonWokeUp jp PrintText - .CureSleep: ld de, PARTYMON_STRUCT_LENGTH ld c, PARTY_LENGTH @@ -2326,22 +2236,18 @@ PokeFluteEffect: ; f50c dec c jr nz, .loop ret -; f56c - -.CatchyTune: ; 0xf56c +.CatchyTune: ; Played the # FLUTE. Now, that's a catchy tune! text_jump UnknownText_0x1c5bf9 db "@" -; 0xf571 -.AllSleepingMonWokeUp: ; 0xf571 +.AllSleepingMonWokeUp: ; All sleeping #MON woke up. text_jump UnknownText_0x1c5c28 db "@" -; 0xf576 -.PlayedTheFlute: ; 0xf576 +.PlayedTheFlute: ; played the # FLUTE.@ @ text_jump UnknownText_0x1c5c44 start_asm @@ -2357,57 +2263,44 @@ PokeFluteEffect: ; f50c .battle jp PokeFluteTerminatorCharacter -; f58f - -BlueCardEffect: ; f58f +BlueCardEffect: ld hl, .bluecardtext jp MenuTextBoxWaitButton .bluecardtext text_jump UnknownText_0x1c5c5e db "@" -; f59a - -CoinCaseEffect: ; f59a +CoinCaseEffect: ld hl, .coincasetext jp MenuTextBoxWaitButton .coincasetext text_jump UnknownText_0x1c5c7b db "@" -; f5a5 - -OldRodEffect: ; f5a5 +OldRodEffect: ld e, $0 jr UseRod -; f5a9 -GoodRodEffect: ; f5a9 +GoodRodEffect: ld e, $1 jr UseRod -; f5ad -SuperRodEffect: ; f5ad +SuperRodEffect: ld e, $2 jr UseRod -; f5b1 -UseRod: ; f5b1 +UseRod: farcall FishFunction ret -; f5b8 - -ItemfinderEffect: ; f5b8 +ItemfinderEffect: farcall ItemFinder ret -; f5bf - -RestorePPEffect: ; f5bf +RestorePPEffect: ld a, [wCurItem] ld [wd002], a @@ -2488,12 +2381,11 @@ RestorePPEffect: ; f5bf ld hl, TextJump_PPsIncreased call PrintText -FinishPPRestore: ; f64c +FinishPPRestore: call ClearPalettes jp UseDisposableItem -; f652 -BattleRestorePP: ; f652 +BattleRestorePP: ld a, [wBattleMode] and a jr z, .not_in_battle @@ -2548,15 +2440,13 @@ endr .done ret -; f6a7 -Not_PP_Up: ; f6a7 +Not_PP_Up: call RestorePP jr nz, BattleRestorePP jp PPRestoreItem_NoEffect -; f6af -Elixer_RestorePPofAllMoves: ; f6af +Elixer_RestorePPofAllMoves: xor a ld hl, wMenuCursorY ld [hli], a @@ -2586,17 +2476,16 @@ Elixer_RestorePPofAllMoves: ; f6af and a jp nz, BattleRestorePP -PPRestoreItem_NoEffect: ; f6dd +PPRestoreItem_NoEffect: call WontHaveAnyEffectMessage -PPRestoreItem_Cancel: ; f6e0 +PPRestoreItem_Cancel: call ClearPalettes xor a ld [wItemEffectSucceeded], a ret -; f6e8 -RestorePP: ; f6e8 +RestorePP: xor a ; PARTYMON ld [wMonType], a call GetMaxPPOfMove @@ -2640,115 +2529,93 @@ RestorePP: ; f6e8 .dont_restore xor a ret -; f725 -TextJump_RaiseThePPOfWhichMove: ; 0xf725 +TextJump_RaiseThePPOfWhichMove: ; Raise the PP of which move? text_jump Text_RaiseThePPOfWhichMove db "@" -; 0xf72a -TextJump_RestoreThePPOfWhichMove: ; 0xf72a +TextJump_RestoreThePPOfWhichMove: ; Restore the PP of which move? text_jump Text_RestoreThePPOfWhichMove db "@" -; 0xf72f -TextJump_PPIsMaxedOut: ; 0xf72f +TextJump_PPIsMaxedOut: ; 's PP is maxed out. text_jump Text_PPIsMaxedOut db "@" -; 0xf734 -TextJump_PPsIncreased: ; 0xf734 +TextJump_PPsIncreased: ; 's PP increased. text_jump Text_PPsIncreased db "@" -; 0xf739 -UnknownText_0xf739: ; 0xf739 +UnknownText_0xf739: ; PP was restored. text_jump UnknownText_0x1c5cf1 db "@" -; 0xf73e - -SquirtbottleEffect: ; f73e +SquirtbottleEffect: farcall _Squirtbottle ret -; f745 - -CardKeyEffect: ; f745 +CardKeyEffect: farcall _CardKey ret -; f74c - -BasementKeyEffect: ; f74c +BasementKeyEffect: farcall _BasementKey ret -; f753 - -SacredAshEffect: ; f753 +SacredAshEffect: farcall _SacredAsh ld a, [wItemEffectSucceeded] cp $1 ret nz call UseDisposableItem ret -; f763 - -NormalBoxEffect: ; f763 +NormalBoxEffect: ld c, DECOFLAG_SILVER_TROPHY_DOLL jr OpenBox -; f767 -GorgeousBoxEffect: ; f767 +GorgeousBoxEffect: ld c, DECOFLAG_GOLD_TROPHY_DOLL -OpenBox: ; f769 +OpenBox: farcall SetSpecificDecorationFlag ld hl, .text call PrintText jp UseDisposableItem -; f778 -.text ; 0xf778 +.text ; There was a trophy inside! text_jump UnknownText_0x1c5d03 db "@" -; 0xf77d -NoEffect: ; f77d +NoEffect: jp IsntTheTimeMessage -; f780 - -Play_SFX_FULL_HEAL: ; f780 +Play_SFX_FULL_HEAL: push de ld de, SFX_FULL_HEAL call WaitPlaySFX pop de ret -; f789 -UseItemText: ; f789 +UseItemText: ld hl, UsedItemText call PrintText call Play_SFX_FULL_HEAL call WaitPressAorB_BlinkCursor -UseDisposableItem: ; f795 +UseDisposableItem: ld hl, wNumItems ld a, 1 ld [wItemQuantityChangeBuffer], a jp TossItem -; f7a0 -UseBallInTrainerBattle: ; f7a0 +UseBallInTrainerBattle: call ReturnToBattle_UseBall ld de, ANIM_THROW_POKE_BALL ld a, e @@ -2765,9 +2632,8 @@ UseBallInTrainerBattle: ; f7a0 ld hl, DontBeAThiefText call PrintText jr UseDisposableItem -; f7ca -WontHaveAnyEffect_NotUsedMessage: ; f7ca +WontHaveAnyEffect_NotUsedMessage: ld hl, WontHaveAnyEffectText call PrintText @@ -2775,14 +2641,12 @@ WontHaveAnyEffect_NotUsedMessage: ; f7ca ld a, $2 ld [wItemEffectSucceeded], a ret -; f7d6 -LooksBitterMessage: ; f7d6 +LooksBitterMessage: ld hl, LooksBitterText jp PrintText -; f7dc -Ball_BoxIsFullMessage: ; f7dc +Ball_BoxIsFullMessage: ld hl, Ball_BoxIsFullText call PrintText @@ -2790,118 +2654,102 @@ Ball_BoxIsFullMessage: ; f7dc ld a, $2 ld [wItemEffectSucceeded], a ret -; f7e8 -CantUseOnEggMessage: ; f7e8 +CantUseOnEggMessage: ld hl, CantUseOnEggText jr CantUseItemMessage -IsntTheTimeMessage: ; f7ed +IsntTheTimeMessage: ld hl, IsntTheTimeText jr CantUseItemMessage -WontHaveAnyEffectMessage: ; f7f2 +WontHaveAnyEffectMessage: ld hl, WontHaveAnyEffectText jr CantUseItemMessage -BelongsToSomeoneElseMessage: ; f7f7 +BelongsToSomeoneElseMessage: ld hl, BelongsToSomeoneElseText jr CantUseItemMessage -CyclingIsntAllowedMessage: ; f7fc +CyclingIsntAllowedMessage: ld hl, CyclingIsntAllowedText jr CantUseItemMessage -CantGetOnYourBikeMessage: ; f801 +CantGetOnYourBikeMessage: ld hl, CantGetOnYourBikeText -CantUseItemMessage: ; f804 +CantUseItemMessage: ; Item couldn't be used. xor a ld [wItemEffectSucceeded], a jp PrintText -; f80b -LooksBitterText: ; 0xf80b +LooksBitterText: ; It looks bitter… text_jump UnknownText_0x1c5d3e db "@" -; 0xf810 -CantUseOnEggText: ; 0xf810 +CantUseOnEggText: ; That can't be used on an EGG. text_jump UnknownText_0x1c5d50 db "@" -; 0xf815 -IsntTheTimeText: ; 0xf815 +IsntTheTimeText: ; OAK: ! This isn't the time to use that! text_jump UnknownText_0x1c5d6e db "@" -; 0xf81a -BelongsToSomeoneElseText: ; 0xf81a +BelongsToSomeoneElseText: ; That belongs to someone else! text_jump UnknownText_0x1c5d97 db "@" -; 0xf81f -WontHaveAnyEffectText: ; 0xf81f +WontHaveAnyEffectText: ; It won't have any effect. text_jump UnknownText_0x1c5db6 db "@" -; 0xf824 -BlockedTheBallText: ; 0xf824 +BlockedTheBallText: ; The trainer blocked the BALL! text_jump UnknownText_0x1c5dd0 db "@" -; 0xf829 -DontBeAThiefText: ; 0xf829 +DontBeAThiefText: ; Don't be a thief! text_jump UnknownText_0x1c5def db "@" -; 0xf82e -CyclingIsntAllowedText: ; 0xf82e +CyclingIsntAllowedText: ; Cycling isn't allowed here. text_jump UnknownText_0x1c5e01 db "@" -; 0xf833 -CantGetOnYourBikeText: ; 0xf833 +CantGetOnYourBikeText: ; Can't get on your @ now. text_jump UnknownText_0x1c5e1d db "@" -; 0xf838 -Ball_BoxIsFullText: ; 0xf838 +Ball_BoxIsFullText: ; The #MON BOX is full. That can't be used now. text_jump UnknownText_0x1c5e3a db "@" -; 0xf83d -UsedItemText: ; 0xf83d +UsedItemText: ; used the@ . text_jump UnknownText_0x1c5e68 db "@" -; 0xf842 -GotOnTheItemText: ; 0xf842 +GotOnTheItemText: ; got on the@ . text_jump UnknownText_0x1c5e7b db "@" -; 0xf847 -GotOffTheItemText: ; 0xf847 +GotOffTheItemText: ; got off@ the @ . text_jump UnknownText_0x1c5e90 db "@" -; 0xf84c - -ApplyPPUp: ; f84c +ApplyPPUp: ld a, MON_MOVES call GetPartyParamLocation push hl @@ -2935,11 +2783,8 @@ ApplyPPUp: ; f84c inc hl inc de jr .loop -; f881 - - -ComputeMaxPP: ; f881 +ComputeMaxPP: push bc ; Divide the base PP by 5. ld a, [de] @@ -2987,9 +2832,8 @@ ComputeMaxPP: ; f881 ld [hl], b pop bc ret -; f8b9 -RestoreAllPP: ; f8b9 +RestoreAllPP: ld a, MON_PP call GetPartyParamLocation push hl @@ -3023,10 +2867,8 @@ RestoreAllPP: ; f8b9 dec c jr nz, .loop ret -; f8ec - -GetMaxPPOfMove: ; f8ec +GetMaxPPOfMove: ld a, [wStringBuffer1 + 0] push af ld a, [wStringBuffer1 + 1] @@ -3103,16 +2945,14 @@ GetMaxPPOfMove: ; f8ec pop af ld [wStringBuffer1 + 0], a ret -; f963 -GetMthMoveOfNthPartymon: ; f963 +GetMthMoveOfNthPartymon: ld a, [wCurPartyMon] call AddNTimes -GetMthMoveOfCurrentMon: ; f969 +GetMthMoveOfCurrentMon: ld a, [wMenuCursorY] ld c, a ld b, 0 add hl, bc ret -; f971 diff --git a/engine/items/items.asm b/engine/items/items.asm index c07042aed..28c79f4cc 100644 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1,4 +1,4 @@ -_ReceiveItem:: ; d1d5 +_ReceiveItem:: call DoesHLEqualNumItems jp nz, PutItemInPocket push hl @@ -10,28 +10,28 @@ _ReceiveItem:: ; d1d5 rst JumpTable ret -.Pockets: ; d1e9 +.Pockets: ; entries correspond to item types dw .Item dw .KeyItem dw .Ball dw .TMHM -.Item: ; d1f1 +.Item: ld h, d ld l, e jp PutItemInPocket -.KeyItem: ; d1f6 +.KeyItem: ld h, d ld l, e jp ReceiveKeyItem -.Ball: ; d1fb +.Ball: ld hl, wNumBalls jp PutItemInPocket -.TMHM: ; d201 +.TMHM: ld h, d ld l, e ld a, [wCurItem] @@ -39,7 +39,7 @@ _ReceiveItem:: ; d1d5 call GetTMHMNumber jp ReceiveTMHM -_TossItem:: ; d20d +_TossItem:: call DoesHLEqualNumItems jr nz, .remove push hl @@ -58,11 +58,11 @@ _TossItem:: ; d20d dw .Ball dw .TMHM -.Ball: ; d228 +.Ball: ld hl, wNumBalls jp RemoveItemFromPocket -.TMHM: ; d22e +.TMHM: ld h, d ld l, e ld a, [wCurItem] @@ -70,19 +70,19 @@ _TossItem:: ; d20d call GetTMHMNumber jp TossTMHM -.KeyItem: ; d23a +.KeyItem: ld h, d ld l, e jp TossKeyItem -.Item: ; d23f +.Item: ld h, d ld l, e .remove jp RemoveItemFromPocket -_CheckItem:: ; d244 +_CheckItem:: call DoesHLEqualNumItems jr nz, .nope push hl @@ -101,11 +101,11 @@ _CheckItem:: ; d244 dw .Ball dw .TMHM -.Ball: ; d25f +.Ball: ld hl, wNumBalls jp CheckTheItem -.TMHM: ; d265 +.TMHM: ld h, d ld l, e ld a, [wCurItem] @@ -113,19 +113,19 @@ _CheckItem:: ; d244 call GetTMHMNumber jp CheckTMHM -.KeyItem: ; d271 +.KeyItem: ld h, d ld l, e jp CheckKeyItems -.Item: ; d276 +.Item: ld h, d ld l, e .nope jp CheckTheItem -DoesHLEqualNumItems: ; d27b +DoesHLEqualNumItems: ld a, l cp LOW(wNumItems) ret nz @@ -133,7 +133,7 @@ DoesHLEqualNumItems: ; d27b cp HIGH(wNumItems) ret -GetPocketCapacity: ; d283 +GetPocketCapacity: ld c, MAX_ITEMS ld a, e cp LOW(wNumItems) @@ -155,7 +155,7 @@ GetPocketCapacity: ; d283 ld c, MAX_BALLS ret -PutItemInPocket: ; d29c +PutItemInPocket: ld d, h ld e, l inc hl @@ -231,7 +231,7 @@ PutItemInPocket: ; d29c scf ret -RemoveItemFromPocket: ; d2ff +RemoveItemFromPocket: ld d, h ld e, l ld a, [hli] @@ -296,7 +296,7 @@ RemoveItemFromPocket: ; d2ff and a ret -CheckTheItem: ; d349 +CheckTheItem: ld a, [wCurItem] ld c, a .loop @@ -313,7 +313,7 @@ CheckTheItem: ; d349 and a ret -ReceiveKeyItem: ; d35a +ReceiveKeyItem: ld hl, wNumKeyItems ld a, [hli] cp MAX_KEY_ITEMS @@ -333,7 +333,7 @@ ReceiveKeyItem: ; d35a and a ret -TossKeyItem: ; d374 +TossKeyItem: ld a, [wCurItemQuantity] ld e, a ld d, 0 @@ -363,7 +363,7 @@ TossKeyItem: ; d374 scf ret -.Toss: ; d396 +.Toss: ld hl, wNumKeyItems ld a, [wCurItem] ld c, a @@ -384,7 +384,7 @@ TossKeyItem: ; d374 scf ret -CheckKeyItems: ; d3b1 +CheckKeyItems: ld a, [wCurItem] ld c, a ld hl, wKeyItems @@ -401,7 +401,7 @@ CheckKeyItems: ; d3b1 scf ret -ReceiveTMHM: ; d3c4 +ReceiveTMHM: dec c ld b, 0 ld hl, wTMsHMs @@ -418,7 +418,7 @@ ReceiveTMHM: ; d3c4 and a ret -TossTMHM: ; d3d8 +TossTMHM: dec c ld b, 0 ld hl, wTMsHMs @@ -445,7 +445,7 @@ TossTMHM: ; d3d8 and a ret -CheckTMHM: ; d3fb +CheckTMHM: dec c ld b, $0 ld hl, wTMsHMs @@ -456,7 +456,7 @@ CheckTMHM: ; d3fb scf ret -GetTMHMNumber:: ; d407 +GetTMHMNumber:: ; Return the number of a TM/HM by item id c. ld a, c ; Skip any dummy items. @@ -473,7 +473,7 @@ GetTMHMNumber:: ; d407 ld c, a ret -GetNumberedTMHM: ; d417 +GetNumberedTMHM: ; Return the item id of a TM/HM by number c. ld a, c ; Skip any gaps. @@ -491,7 +491,7 @@ GetNumberedTMHM: ; d417 ld c, a ret -_CheckTossableItem:: ; d427 +_CheckTossableItem:: ; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be removed from the bag. ld a, ITEMATTR_PERMISSIONS call GetItemAttr @@ -500,7 +500,7 @@ _CheckTossableItem:: ; d427 and a ret -CheckSelectableItem: ; d432 +CheckSelectableItem: ; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be selected. ld a, ITEMATTR_PERMISSIONS call GetItemAttr @@ -509,7 +509,7 @@ CheckSelectableItem: ; d432 and a ret -CheckItemPocket:: ; d43d +CheckItemPocket:: ; Return the pocket for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_POCKET call GetItemAttr @@ -517,7 +517,7 @@ CheckItemPocket:: ; d43d ld [wItemAttributeParamBuffer], a ret -CheckItemContext: ; d448 +CheckItemContext: ; Return the context for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_HELP call GetItemAttr @@ -525,7 +525,7 @@ CheckItemContext: ; d448 ld [wItemAttributeParamBuffer], a ret -CheckItemMenu: ; d453 +CheckItemMenu: ; Return the menu for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_HELP call GetItemAttr @@ -534,7 +534,7 @@ CheckItemMenu: ; d453 ld [wItemAttributeParamBuffer], a ret -GetItemAttr: ; d460 +GetItemAttr: ; Get attribute a of wCurItem. push hl @@ -560,13 +560,13 @@ GetItemAttr: ; d460 pop hl ret -ItemAttr_ReturnCarry: ; d47f +ItemAttr_ReturnCarry: ld a, 1 ld [wItemAttributeParamBuffer], a scf ret -GetItemPrice: ; d486 +GetItemPrice: ; Return the price of wCurItem in de. push hl push bc diff --git a/engine/items/mart.asm b/engine/items/mart.asm index 911251f65..7e185662b 100644 --- a/engine/items/mart.asm +++ b/engine/items/mart.asm @@ -6,7 +6,7 @@ const MARTTEXT_HERE_YOU_GO const MARTTEXT_SOLD_OUT -OpenMartDialog:: ; 15a45 +OpenMartDialog:: call GetMart ld a, c ld [wEngineBuffer1], a @@ -15,7 +15,6 @@ OpenMartDialog:: ; 15a45 ld hl, .dialogs rst JumpTable ret -; 15a57 .dialogs dw MartDialog @@ -23,18 +22,16 @@ OpenMartDialog:: ; 15a45 dw BargainShop dw Pharmacist dw RooftopSale -; 15a61 -MartDialog: ; 15a61 +MartDialog: ld a, 0 ld [wEngineBuffer1], a - xor a + xor a ; STANDARDMART_HOWMAYIHELPYOU ld [wEngineBuffer5], a call StandardMart ret -; 15a6e -HerbShop: ; 15a6e +HerbShop: call FarReadMart call LoadStandardMenuHeader ld hl, Text_HerbShop_Intro @@ -43,9 +40,8 @@ HerbShop: ; 15a6e ld hl, Text_HerbShop_ComeAgain call MartTextBox ret -; 15a84 -BargainShop: ; 15a84 +BargainShop: ld b, BANK(BargainShopData) ld de, BargainShopData call LoadMartPointer @@ -65,9 +61,8 @@ BargainShop: ; 15a84 ld hl, Text_BargainShop_ComeAgain call MartTextBox ret -; 15aae -Pharmacist: ; 15aae +Pharmacist: call FarReadMart call LoadStandardMenuHeader ld hl, Text_Pharmacist_Intro @@ -76,9 +71,8 @@ Pharmacist: ; 15aae ld hl, Text_Pharmacist_ComeAgain call MartTextBox ret -; 15ac4 -RooftopSale: ; 15ac4 +RooftopSale: ld b, BANK(RooftopSaleMart1) ld de, RooftopSaleMart1 ld hl, wStatusFlags @@ -97,11 +91,10 @@ RooftopSale: ; 15ac4 ld hl, Text_Mart_ComeAgain call MartTextBox ret -; 15aee INCLUDE "data/items/rooftop_sale.asm" -LoadMartPointer: ; 15b10 +LoadMartPointer: ld a, b ld [wMartPointerBank], a ld a, e @@ -110,16 +103,15 @@ LoadMartPointer: ; 15b10 ld [wMartPointer + 1], a ld hl, wCurMart xor a - ld bc, 16 + ld bc, wCurMartEnd - wCurMart call ByteFill xor a ld [wEngineBuffer5], a ld [wBargainShopFlags], a ld [wFacingDirection], a ret -; 15b31 -GetMart: ; 15b31 +GetMart: ld a, e cp (Marts.End - Marts) / 2 jr c, .IsAMart @@ -136,36 +128,43 @@ GetMart: ; 15b31 ld d, [hl] ld b, BANK(Marts) ret -; 15b47 -StandardMart: ; 15b47 +; StandardMart.MartFunctions indexes + const_def + const STANDARDMART_HOWMAYIHELPYOU ; 0 + const STANDARDMART_TOPMENU ; 1 + const STANDARDMART_BUY ; 2 + const STANDARDMART_SELL ; 3 + const STANDARDMART_QUIT ; 4 + const STANDARDMART_ANYTHINGELSE ; 5 + +StandardMart: .loop ld a, [wEngineBuffer5] ld hl, .MartFunctions rst JumpTable ld [wEngineBuffer5], a - cp $ff + cp -1 jr nz, .loop ret .MartFunctions: +; entries correspond to STANDARDMART_* constants dw .HowMayIHelpYou dw .TopMenu dw .Buy dw .Sell dw .Quit dw .AnythingElse -; 15b62 -.HowMayIHelpYou: ; 15b62 +.HowMayIHelpYou: call LoadStandardMenuHeader ld hl, Text_Mart_HowMayIHelpYou call PrintText - ld a, $1 ; top menu + ld a, STANDARDMART_TOPMENU ret -; 15b6e -.TopMenu: ; 15b6e +.TopMenu: ld hl, MenuHeader_BuySell call CopyMenuHeader call VerticalMenu @@ -176,49 +175,44 @@ StandardMart: ; 15b47 cp $2 jr z, .sell .quit - ld a, $4 ; Come again! + ld a, STANDARDMART_QUIT ret .buy - ld a, $2 ; buy + ld a, STANDARDMART_BUY ret .sell - ld a, $3 ; sell + ld a, STANDARDMART_SELL ret -; 15b8d -.Buy: ; 15b8d +.Buy: call ExitMenu call FarReadMart call BuyMenu and a - ld a, $5 ; Anything else? + ld a, STANDARDMART_ANYTHINGELSE ret -; 15b9a -.Sell: ; 15b9a +.Sell: call ExitMenu call SellMenu - ld a, $5 ; Anything else? + ld a, STANDARDMART_ANYTHINGELSE ret -; 15ba3 -.Quit: ; 15ba3 +.Quit: call ExitMenu ld hl, Text_Mart_ComeAgain call MartTextBox - ld a, $ff ; exit + ld a, -1 ret -; 15baf -.AnythingElse: ; 15baf +.AnythingElse: call LoadStandardMenuHeader ld hl, Text_Mart_AnythingElse call PrintText - ld a, $1 ; top menu + ld a, STANDARDMART_TOPMENU ret -; 15bbb -FarReadMart: ; 15bbb +FarReadMart: ld hl, wMartPointer ld a, [hli] ld h, [hl] @@ -246,16 +240,15 @@ FarReadMart: ; 15bbb .done ret -; 15be5 -GetMartItemPrice: ; 15be5 +GetMartItemPrice: ; Return the price of item a in BCD at hl and in tiles at wStringBuffer1. push hl ld [wCurItem], a farcall GetItemPrice pop hl -GetMartPrice: ; 15bf0 +GetMartPrice: ; Return price de in BCD at hl and in tiles at wStringBuffer1. push hl ld a, d @@ -280,9 +273,8 @@ GetMartPrice: ; 15bf0 dec c jr nz, .loop ret -; 15c1a -.CharToNybble: ; 15c1a +.CharToNybble: ld a, [de] inc de cp " " @@ -292,9 +284,8 @@ GetMartPrice: ; 15bf0 .not_space sub "0" ret -; 15c25 -ReadMart: ; 15c25 +ReadMart: ; Load the mart pointer. Mart data is local (no need for bank). ld hl, wMartPointer ld a, [hli] @@ -337,12 +328,10 @@ ReadMart: ; 15c25 ld a, [hl] ld [wCurMart], a ret -; 15c51 INCLUDE "data/items/bargain_shop.asm" - -BuyMenu: ; 15c62 +BuyMenu: call FadeToMenu farcall BlankScreen xor a @@ -354,9 +343,8 @@ BuyMenu: ; 15c62 jr nc, .loop call CloseSubmenu ret -; 15c7d -LoadBuyMenuText: ; 15c7d +LoadBuyMenuText: ; load text from a nested table ; which table is in wEngineBuffer1 ; which entry is in register a @@ -375,9 +363,8 @@ LoadBuyMenuText: ; 15c7d ld l, a call PrintText ret -; 15c91 -MartAskPurchaseQuantity: ; 15c91 +MartAskPurchaseQuantity: call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers inc hl inc hl @@ -387,9 +374,8 @@ MartAskPurchaseQuantity: ; 15c91 cp 1 jp z, BargainShopAskPurchaseQuantity jp RooftopSaleAskPurchaseQuantity -; 15ca3 -GetMartDialogGroup: ; 15ca3 +GetMartDialogGroup: ld a, [wEngineBuffer1] ld e, a ld d, 0 @@ -398,17 +384,15 @@ GetMartDialogGroup: ; 15ca3 add hl, de add hl, de ret -; 15cb0 -.MartTextFunctionPointers: ; 15cb0 +.MartTextFunctionPointers: dwb .StandardMartPointers, 0 dwb .HerbShopPointers, 0 dwb .BargainShopPointers, 1 dwb .PharmacyPointers, 0 dwb .StandardMartPointers, 2 -; 15cbf -.StandardMartPointers: ; 15cbf +.StandardMartPointers: dw Text_Mart_HowMany dw Text_Mart_CostsThisMuch dw Text_Mart_InsufficientFunds @@ -416,7 +400,7 @@ GetMartDialogGroup: ; 15ca3 dw Text_Mart_HereYouGo dw BuyMenuLoop -.HerbShopPointers: ; 15ccb +.HerbShopPointers: dw Text_HerbShop_HowMany dw Text_HerbShop_CostsThisMuch dw Text_HerbShop_InsufficientFunds @@ -424,7 +408,7 @@ GetMartDialogGroup: ; 15ca3 dw Text_HerbShop_HereYouGo dw BuyMenuLoop -.BargainShopPointers: ; 15cd7 +.BargainShopPointers: dw BuyMenuLoop dw Text_BargainShop_CostsThisMuch dw Text_BargainShop_InsufficientFunds @@ -432,17 +416,15 @@ GetMartDialogGroup: ; 15ca3 dw Text_BargainShop_HereYouGo dw Text_BargainShop_SoldOut -.PharmacyPointers: ; 15ce3 +.PharmacyPointers: dw Text_Pharmacy_HowMany dw Text_Pharmacy_CostsThisMuch dw Text_Pharmacy_InsufficientFunds dw Text_Pharmacy_BagFull dw Text_Pharmacy_HereYouGo dw BuyMenuLoop -; 15cef - -BuyMenuLoop: ; 15cef +BuyMenuLoop: farcall PlaceMoneyTopRight call UpdateSprites ld hl, MenuHeader_Buy @@ -470,7 +452,7 @@ BuyMenuLoop: ; 15cef jr c, .cancel ld de, wMoney ld bc, hMoneyTemp - ld a, $3 ; useless load + ld a, 3 ; useless load call CompareMoney jr c, .insufficient_funds ld hl, wNumItems @@ -478,7 +460,7 @@ BuyMenuLoop: ; 15cef jr nc, .insufficient_bag_space ld a, [wMartItemID] ld e, a - ld d, $0 + ld d, 0 ld b, SET_FLAG ld hl, wBargainShopFlags call FlagAction @@ -512,7 +494,6 @@ BuyMenuLoop: ; 15cef call JoyWaitAorB and a ret -; 15d83 StandardMartAskPurchaseQuantity: ld a, 99 @@ -522,22 +503,20 @@ StandardMartAskPurchaseQuantity: farcall SelectQuantityToBuy call ExitMenu ret -; 15d97 -MartConfirmPurchase: ; 15d97 +MartConfirmPurchase: predef PartyMonItemName ld a, MARTTEXT_COSTS_THIS_MUCH call LoadBuyMenuText call YesNoBox ret -; 15da5 BargainShopAskPurchaseQuantity: ld a, 1 ld [wItemQuantityChangeBuffer], a ld a, [wMartItemID] ld e, a - ld d, $0 + ld d, 0 ld b, CHECK_FLAG ld hl, wBargainShopFlags call FlagAction @@ -546,7 +525,7 @@ BargainShopAskPurchaseQuantity: jr nz, .SoldOut ld a, [wMartItemID] ld e, a - ld d, $0 + ld d, 0 ld hl, wMartPointer ld a, [hli] ld h, [hl] @@ -571,7 +550,6 @@ BargainShopAskPurchaseQuantity: call JoyWaitAorB scf ret -; 15de2 RooftopSaleAskPurchaseQuantity: ld a, MARTTEXT_HOW_MANY @@ -582,9 +560,8 @@ RooftopSaleAskPurchaseQuantity: farcall RooftopSale_SelectQuantityToBuy call ExitMenu ret -; 15df9 -.GetSalePrice: ; 15df9 +.GetSalePrice: ld a, [wMartItemID] ld e, a ld d, 0 @@ -601,29 +578,24 @@ RooftopSaleAskPurchaseQuantity: inc hl ld d, [hl] ret -; 15e0e - -Text_Mart_HowMany: ; 0x15e0e +Text_Mart_HowMany: ; How many? text_jump UnknownText_0x1c4bfd db "@" -; 0x15e13 -Text_Mart_CostsThisMuch: ; 0x15e13 +Text_Mart_CostsThisMuch: ; @ (S) will be ¥@ . text_jump UnknownText_0x1c4c08 db "@" -; 0x15e18 -MenuHeader_Buy: ; 0x15e18 +MenuHeader_Buy: db MENU_BACKUP_TILES ; flags menu_coords 1, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x15e20 -.MenuData ; 0x15e20 +.MenuData db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags db 4, 8 ; rows, columns db 1 ; horizontal spacing @@ -631,9 +603,8 @@ MenuHeader_Buy: ; 0x15e18 dba PlaceMenuItemName dba .PrintBCDPrices dba UpdateItemDescription -; 15e30 -.PrintBCDPrices: ; 15e30 +.PrintBCDPrices: ld a, [wScrollingMenuCursorPosition] ld c, a ld b, 0 @@ -650,136 +621,113 @@ MenuHeader_Buy: ; 0x15e18 ld c, PRINTNUM_LEADINGZEROS | PRINTNUM_MONEY | 3 call PrintBCDNumber ret -; 15e4a (5:5e4a) -Text_HerbShop_Intro: ; 0x15e4a +Text_HerbShop_Intro: ; Hello, dear. I sell inexpensive herbal medicine. They're good, but a trifle bitter. Your #MON may not like them. Hehehehe… text_jump UnknownText_0x1c4c28 db "@" -; 0x15e4f -Text_HerbShop_HowMany: ; 0x15e4f +Text_HerbShop_HowMany: ; How many? text_jump UnknownText_0x1c4ca3 db "@" -; 0x15e54 -Text_HerbShop_CostsThisMuch: ; 0x15e54 +Text_HerbShop_CostsThisMuch: ; @ (S) will be ¥@ . text_jump UnknownText_0x1c4cae db "@" -; 0x15e59 -Text_HerbShop_HereYouGo: ; 0x15e59 +Text_HerbShop_HereYouGo: ; Thank you, dear. Hehehehe… text_jump UnknownText_0x1c4cce db "@" -; 0x15e5e -Text_HerbShop_BagFull: ; 0x15e5e +Text_HerbShop_BagFull: ; Oh? Your PACK is full, dear. text_jump UnknownText_0x1c4cea db "@" -; 0x15e63 -Text_HerbShop_InsufficientFunds: ; 0x15e63 +Text_HerbShop_InsufficientFunds: ; Hehehe… You don't have the money. text_jump UnknownText_0x1c4d08 db "@" -; 0x15e68 -Text_HerbShop_ComeAgain: ; 0x15e68 +Text_HerbShop_ComeAgain: ; Come again, dear. Hehehehe… text_jump UnknownText_0x1c4d2a db "@" -; 0x15e6d -Text_BargainShop_Intro: ; 0x15e6d +Text_BargainShop_Intro: ; Hiya! Care to see some bargains? I sell rare items that nobody else carries--but only one of each item. text_jump UnknownText_0x1c4d47 db "@" -; 0x15e72 -Text_BargainShop_CostsThisMuch: ; 0x15e72 +Text_BargainShop_CostsThisMuch: ; costs ¥@ . Want it? text_jump UnknownText_0x1c4db0 db "@" -; 0x15e77 -Text_BargainShop_HereYouGo: ; 0x15e77 +Text_BargainShop_HereYouGo: ; Thanks. text_jump UnknownText_0x1c4dcd db "@" -; 0x15e7c -Text_BargainShop_BagFull: ; 0x15e7c +Text_BargainShop_BagFull: ; Uh-oh, your PACK is chock-full. text_jump UnknownText_0x1c4dd6 db "@" -; 0x15e81 -Text_BargainShop_SoldOut: ; 0x15e81 +Text_BargainShop_SoldOut: ; You bought that already. I'm all sold out of it. text_jump UnknownText_0x1c4df7 db "@" -; 0x15e86 -Text_BargainShop_InsufficientFunds: ; 0x15e86 +Text_BargainShop_InsufficientFunds: ; Uh-oh, you're short on funds. text_jump UnknownText_0x1c4e28 db "@" -; 0x15e8b -Text_BargainShop_ComeAgain: ; 0x15e8b +Text_BargainShop_ComeAgain: ; Come by again sometime. text_jump UnknownText_0x1c4e46 db "@" -; 0x15e90 -Text_Pharmacist_Intro: ; 0x15e90 +Text_Pharmacist_Intro: ; What's up? Need some medicine? text_jump UnknownText_0x1c4e5f db "@" -; 0x15e95 -Text_Pharmacy_HowMany: ; 0x15e95 +Text_Pharmacy_HowMany: ; How many? text_jump UnknownText_0x1c4e7e db "@" -; 0x15e9a -Text_Pharmacy_CostsThisMuch: ; 0x15e9a +Text_Pharmacy_CostsThisMuch: ; @ (S) will cost ¥@ . text_jump UnknownText_0x1c4e89 db "@" -; 0x15e9f -Text_Pharmacy_HereYouGo: ; 0x15e9f +Text_Pharmacy_HereYouGo: ; Thanks much! text_jump UnknownText_0x1c4eab db "@" -; 0x15ea4 -Text_Pharmacy_BagFull: ; 0x15ea4 +Text_Pharmacy_BagFull: ; You don't have any more space. text_jump UnknownText_0x1c4eb9 db "@" -; 0x15ea9 -Text_Pharmacy_InsufficientFunds: ; 0x15ea9 +Text_Pharmacy_InsufficientFunds: ; Huh? That's not enough money. text_jump UnknownText_0x1c4ed8 db "@" -; 0x15eae -Text_Pharmacist_ComeAgain: ; 0x15eae +Text_Pharmacist_ComeAgain: ; All right. See you around. text_jump UnknownText_0x1c4ef6 db "@" -; 0x15eb3 - -SellMenu: ; 15eb3 +SellMenu: call DisableSpriteUpdates farcall DepositSellInitPackBuffers .loop @@ -794,31 +742,26 @@ SellMenu: ; 15eb3 call ReturnToMapWithSpeechTextbox and a ret -; 15ed3 .Unreferenced_NothingToSell: ld hl, .NothingToSellText call MenuTextBoxBackup and a ret -; 15edb -.NothingToSellText: ; 0x15edb +.NothingToSellText: ; You don't have anything to sell. text_jump UnknownText_0x1c4f12 db "@" -; 0x15ee0 - -.TryToSellItem: ; 15ee0 +.TryToSellItem: farcall CheckItemMenu ld a, [wItemAttributeParamBuffer] ld hl, .dw rst JumpTable ret -; 15eee -.dw ; 15eee +.dw dw .try_sell dw .cant_buy dw .cant_buy @@ -826,14 +769,11 @@ SellMenu: ; 15eb3 dw .try_sell dw .try_sell dw .try_sell -; 15efc -.cant_buy ; 15efc +.cant_buy ret -; 15efd - -.try_sell ; 15efd +.try_sell farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a @@ -877,94 +817,79 @@ SellMenu: ; 15eb3 call ExitMenu and a ret -; 15f73 -Text_Mart_SellHowMany: ; 0x15f73 +Text_Mart_SellHowMany: ; How many? text_jump UnknownText_0x1c4f33 db "@" -; 0x15f78 -Text_Mart_ICanPayThisMuch: ; 0x15f78 +Text_Mart_ICanPayThisMuch: ; I can pay you ¥@ . Is that OK? text_jump UnknownText_0x1c4f3e db "@" -; 0x15f7d -.UnusedString15f7d: ; 15f7d +.UnusedString15f7d: db "!ダミー!@" -Text_Mart_HowMayIHelpYou: ; 0x15f83 +Text_Mart_HowMayIHelpYou: ; Welcome! How may I help you? text_jump UnknownText_0x1c4f62 db "@" -; 0x15f88 -MenuHeader_BuySell: ; 0x15f88 +MenuHeader_BuySell: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 7, 8 dw .MenuData db 1 ; default option -; 0x15f90 -.MenuData ; 0x15f90 +.MenuData db STATICMENU_CURSOR ; strings db 3 ; items db "BUY@" db "SELL@" db "QUIT@" -; 0x15f96 -Text_Mart_HereYouGo: ; 0x15fa0 +Text_Mart_HereYouGo: ; Here you are. Thank you! text_jump UnknownText_0x1c4f80 db "@" -; 0x15fa5 -Text_Mart_InsufficientFunds: ; 0x15fa5 +Text_Mart_InsufficientFunds: ; You don't have enough money. text_jump UnknownText_0x1c4f9a db "@" -; 0x15faa -Text_Mart_BagFull: ; 0x15faa +Text_Mart_BagFull: ; You can't carry any more items. text_jump UnknownText_0x1c4fb7 db "@" -; 0x15faf -TextMart_CantBuyFromYou: ; 0x15faf +TextMart_CantBuyFromYou: ; Sorry, I can't buy that from you. text_jump UnknownText_0x1c4fd7 db "@" -; 0x15fb4 -Text_Mart_ComeAgain: ; 0x15fb4 +Text_Mart_ComeAgain: ; Please come again! text_jump UnknownText_0x1c4ff9 db "@" -; 0x15fb9 -Text_Mart_AnythingElse: ; 0x15fb9 +Text_Mart_AnythingElse: text_jump UnknownText_0x1c500d db "@" -; 0x15fbe -Text_Mart_SoldForAmount: ; 0x15fbe +Text_Mart_SoldForAmount: text_jump UnknownText_0x1c502e db "@" -; 0x15fc3 -PlayTransactionSound: ; 15fc3 +PlayTransactionSound: call WaitSFX ld de, SFX_TRANSACTION call PlaySFX ret -; 15fcd -MartTextBox: ; 15fcd +MartTextBox: call MenuTextBox call JoyWaitAorB call ExitMenu ret -; 15fd7 diff --git a/engine/items/pack.asm b/engine/items/pack.asm index ea3a051ac..67e9fe900 100644 --- a/engine/items/pack.asm +++ b/engine/items/pack.asm @@ -12,7 +12,7 @@ const PACKSTATE_QUITNOSCRIPT ; 9 const PACKSTATE_QUITRUNSCRIPT ; 10 -Pack: ; 10000 +Pack: ld hl, wOptions set NO_TEXT_SCROLL, [hl] call InitPackBuffers @@ -31,17 +31,14 @@ Pack: ; 10000 ld hl, wOptions res NO_TEXT_SCROLL, [hl] ret -; 10026 -.RunJumptable: ; 10026 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call Pack_GetJumptablePointer jp hl -; 10030 - -.Jumptable: ; 10030 (4:4030) +.Jumptable: ; entries correspond to PACKSTATE_* constants dw .InitGFX ; 0 dw .InitItemsPocket ; 1 @@ -55,7 +52,7 @@ Pack: ; 10000 dw Pack_QuitNoScript ; 9 dw Pack_QuitRunScript ; 10 -.InitGFX: ; 10046 (4:4046) +.InitGFX: xor a ld [hBGMapMode], a call Pack_InitGFX @@ -64,7 +61,7 @@ Pack: ; 10000 call Pack_InitColors ret -.InitItemsPocket: ; 10056 (4:4056) +.InitItemsPocket: xor a ; ITEM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -73,7 +70,7 @@ Pack: ; 10000 call Pack_JumptableNext ret -.ItemsPocketMenu: ; 10067 (4:4067) +.ItemsPocketMenu: ld hl, ItemsPocketMenuHeader call CopyMenuHeader ld a, [wItemsPocketCursor] @@ -92,7 +89,7 @@ Pack: ; 10000 call .ItemBallsKey_LoadSubmenu ret -.InitKeyItemsPocket: ; 10094 (4:4094) +.InitKeyItemsPocket: ld a, KEY_ITEM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -101,7 +98,7 @@ Pack: ; 10000 call Pack_JumptableNext ret -.KeyItemsPocketMenu: ; 100a6 (4:40a6) +.KeyItemsPocketMenu: ld hl, KeyItemsPocketMenuHeader call CopyMenuHeader ld a, [wKeyItemsPocketCursor] @@ -120,7 +117,7 @@ Pack: ; 10000 call .ItemBallsKey_LoadSubmenu ret -.InitTMHMPocket: ; 100d3 (4:40d3) +.InitTMHMPocket: ld a, TM_HM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -131,7 +128,7 @@ Pack: ; 10000 call Pack_JumptableNext ret -.TMHMPocketMenu: ; 100e8 (4:40e8) +.TMHMPocketMenu: farcall TMHMPocket ld b, PACKSTATE_INITKEYITEMSPOCKET ; left ld c, PACKSTATE_INITITEMSPOCKET ; right @@ -160,49 +157,41 @@ Pack: ; 10000 call Pack_GetJumptablePointer jp hl -; 10124 (4:4124) -.MenuHeader1: ; 0x10124 +.MenuHeader1: db MENU_BACKUP_TILES ; flags menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData_1 db 1 ; default option -; 0x1012c -.MenuData_1: ; 0x1012c +.MenuData_1: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "USE@" db "QUIT@" -; 0x10137 -.Jumptable1: ; 10137 +.Jumptable1: dw .UseItem dw QuitItemSubmenu -; 1013b - -.MenuHeader2: ; 0x1013b +.MenuHeader2: db MENU_BACKUP_TILES ; flags menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData_2 db 1 ; default option -; 0x10143 -.MenuData_2: ; 0x10143 +.MenuData_2: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "USE@" db "GIVE@" db "QUIT@" -; 0x10153 -.Jumptable2: ; 10153 +.Jumptable2: dw .UseItem dw GiveItem dw QuitItemSubmenu -; 10159 -.UseItem: ; 10159 +.UseItem: farcall AskTeachTMHM ret c farcall ChooseMonToLearnTMHM @@ -222,7 +211,7 @@ Pack: ; 10000 call Pack_InitColors ret -.InitBallsPocket: ; 10186 (4:4186) +.InitBallsPocket: ld a, BALL_POCKET ld [wCurrPocket], a call ClearPocketList @@ -231,7 +220,7 @@ Pack: ; 10000 call Pack_JumptableNext ret -.BallsPocketMenu: ; 10198 (4:4198) +.BallsPocketMenu: ld hl, BallsPocketMenuHeader call CopyMenuHeader ld a, [wBallsPocketCursor] @@ -250,7 +239,7 @@ Pack: ; 10000 call .ItemBallsKey_LoadSubmenu ret -.ItemBallsKey_LoadSubmenu: ; 101c5 (4:41c5) +.ItemBallsKey_LoadSubmenu: farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a @@ -319,15 +308,13 @@ Pack: ; 10000 call Pack_GetJumptablePointer jp hl -; 10249 (4:4249) -MenuHeader_UsableKeyItem: ; 0x10249 +MenuHeader_UsableKeyItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10251 -.MenuData: ; 0x10251 +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 5 ; items db "USE@" @@ -335,133 +322,114 @@ MenuHeader_UsableKeyItem: ; 0x10249 db "TOSS@" db "SEL@" db "QUIT@" -; 0x1026a -Jumptable_UseGiveTossRegisterQuit: ; 1026a +Jumptable_UseGiveTossRegisterQuit: dw UseItem dw GiveItem dw TossMenu dw RegisterItem dw QuitItemSubmenu -; 10274 -MenuHeader_UsableItem: ; 0x10274 +MenuHeader_UsableItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x1027c -.MenuData: ; 0x1027c +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 4 ; items db "USE@" db "GIVE@" db "TOSS@" db "QUIT@" -; 0x10291 -Jumptable_UseGiveTossQuit: ; 10291 +Jumptable_UseGiveTossQuit: dw UseItem dw GiveItem dw TossMenu dw QuitItemSubmenu -; 10299 -MenuHeader_UnusableItem: ; 0x10299 +MenuHeader_UnusableItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x102a1 -.MenuData: ; 0x102a1 +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "USE@" db "QUIT@" -; 0x102ac -Jumptable_UseQuit: ; 102ac +Jumptable_UseQuit: dw UseItem dw QuitItemSubmenu -; 102b0 -MenuHeader_UnusableKeyItem: ; 0x102b0 +MenuHeader_UnusableKeyItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x102b8 -.MenuData: ; 0x102b8 +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "USE@" db "SEL@" db "QUIT@" -; 0x102c7 -Jumptable_UseRegisterQuit: ; 102c7 +Jumptable_UseRegisterQuit: dw UseItem dw RegisterItem dw QuitItemSubmenu -; 102cd -MenuHeader_HoldableKeyItem: ; 0x102cd +MenuHeader_HoldableKeyItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x102d5 -.MenuData: ; 0x102d5 +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 4 ; items db "GIVE@" db "TOSS@" db "SEL@" db "QUIT@" -; 0x102ea -Jumptable_GiveTossRegisterQuit: ; 102ea +Jumptable_GiveTossRegisterQuit: dw GiveItem dw TossMenu dw RegisterItem dw QuitItemSubmenu -; 102f2 -MenuHeader_HoldableItem: ; 0x102f2 +MenuHeader_HoldableItem: db MENU_BACKUP_TILES ; flags menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x102fa -.MenuData: ; 0x102fa +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "GIVE@" db "TOSS@" db "QUIT@" -; 0x1030b -Jumptable_GiveTossQuit: ; 1030b +Jumptable_GiveTossQuit: dw GiveItem dw TossMenu dw QuitItemSubmenu -; 10311 - -UseItem: ; 10311 +UseItem: farcall CheckItemMenu ld a, [wItemAttributeParamBuffer] ld hl, .dw rst JumpTable ret -; 1031f -.dw ; 1031f (4:431f) +.dw ; entries correspond to ITEMMENU_* constants dw .Oak ; ITEMMENU_NOUSE dw .Oak @@ -470,18 +438,17 @@ UseItem: ; 10311 dw .Current ; ITEMMENU_CURRENT dw .Party ; ITEMMENU_PARTY dw .Field ; ITEMMENU_CLOSE -; 1035c -.Oak: ; 1032d (4:432d) +.Oak: ld hl, Text_ThisIsntTheTime call Pack_PrintTextNoScroll ret -.Current: ; 10334 (4:4334) +.Current: call DoItemEffect ret -.Party: ; 10338 (4:4338) +.Party: ld a, [wPartyCount] and a jr z, .NoPokemon @@ -498,7 +465,7 @@ UseItem: ; 10311 call Pack_PrintTextNoScroll ret -.Field: ; 10355 (4:4355) +.Field: call DoItemEffect ld a, [wItemEffectSucceeded] and a @@ -506,9 +473,8 @@ UseItem: ; 10311 ld a, PACKSTATE_QUITRUNSCRIPT ld [wJumptableIndex], a ret -; 10364 (4:4364) -TossMenu: ; 10364 +TossMenu: ld hl, Text_ThrowAwayHowMany call Pack_PrintTextNoScroll farcall SelectQuantityToToss @@ -532,9 +498,8 @@ TossMenu: ; 10364 call Pack_PrintTextNoScroll .finish ret -; 1039d -Unreferenced_ResetPocketCursorPositions: ; 1039d +Unreferenced_ResetPocketCursorPositions: ld a, [wCurrPocket] and a ; ITEM_POCKET jr z, .items @@ -561,9 +526,8 @@ Unreferenced_ResetPocketCursorPositions: ; 1039d ld [wKeyItemsPocketCursor], a ld [wKeyItemsPocketScrollPosition], a ret -; 103c2 -RegisterItem: ; 103c2 +RegisterItem: farcall CheckSelectableItem ld a, [wItemAttributeParamBuffer] and a @@ -571,11 +535,11 @@ RegisterItem: ; 103c2 ld a, [wCurrPocket] rrca rrca - and $c0 + and REGISTERED_POCKET ld b, a ld a, [wCurItemQuantity] inc a - and $3f + and REGISTERED_NUMBER or b ld [wWhichRegisteredItem], a ld a, [wCurItem] @@ -591,9 +555,8 @@ RegisterItem: ; 103c2 ld hl, Text_CantRegister call Pack_PrintTextNoScroll ret -; 103fd -GiveItem: ; 103fd +GiveItem: ld a, [wPartyCount] and a jp z, .NoPokemon @@ -647,22 +610,19 @@ GiveItem: ; 103fd call Pack_InitColors ret -.NoPokemon: ; 10486 (4:4486) +.NoPokemon: ld hl, TextJump_YouDontHaveAMon call Pack_PrintTextNoScroll ret -; 1048d (4:448d) -.Egg: ; 0x1048d +.Egg: ; An EGG can't hold an item. text_jump Text_AnEGGCantHoldAnItem db "@" -; 0x10492 -QuitItemSubmenu: ; 10492 +QuitItemSubmenu: ret -; 10493 -BattlePack: ; 10493 +BattlePack: ld hl, wOptions set NO_TEXT_SCROLL, [hl] call InitPackBuffers @@ -681,17 +641,14 @@ BattlePack: ; 10493 ld hl, wOptions res NO_TEXT_SCROLL, [hl] ret -; 104b9 -.RunJumptable: ; 104b9 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call Pack_GetJumptablePointer jp hl -; 104c3 - -.Jumptable: ; 104c3 (4:44c3) +.Jumptable: ; entries correspond to PACKSTATE_* constants dw .InitGFX ; 0 dw .InitItemsPocket ; 1 @@ -705,7 +662,7 @@ BattlePack: ; 10493 dw Pack_QuitNoScript ; 9 dw Pack_QuitRunScript ; 10 -.InitGFX: ; 104d9 (4:44d9) +.InitGFX: xor a ld [hBGMapMode], a call Pack_InitGFX @@ -714,7 +671,7 @@ BattlePack: ; 10493 call Pack_InitColors ret -.InitItemsPocket: ; 104e9 (4:44e9) +.InitItemsPocket: xor a ; ITEM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -723,7 +680,7 @@ BattlePack: ; 10493 call Pack_JumptableNext ret -.ItemsPocketMenu: ; 104fa (4:44fa) +.ItemsPocketMenu: ld hl, ItemsPocketMenuHeader call CopyMenuHeader ld a, [wItemsPocketCursor] @@ -742,7 +699,7 @@ BattlePack: ; 10493 call ItemSubmenu ret -.InitKeyItemsPocket: ; 10527 (4:4527) +.InitKeyItemsPocket: ld a, KEY_ITEM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -751,7 +708,7 @@ BattlePack: ; 10493 call Pack_JumptableNext ret -.KeyItemsPocketMenu: ; 10539 (4:4539) +.KeyItemsPocketMenu: ld hl, KeyItemsPocketMenuHeader call CopyMenuHeader ld a, [wKeyItemsPocketCursor] @@ -770,7 +727,7 @@ BattlePack: ; 10493 call ItemSubmenu ret -.InitTMHMPocket: ; 10566 (4:4566) +.InitTMHMPocket: ld a, TM_HM_POCKET ld [wCurrPocket], a call ClearPocketList @@ -783,7 +740,7 @@ BattlePack: ; 10493 call Pack_JumptableNext ret -.TMHMPocketMenu: ; 10581 (4:4581) +.TMHMPocketMenu: farcall TMHMPocket ld b, PACKSTATE_INITKEYITEMSPOCKET ; left ld c, PACKSTATE_INITITEMSPOCKET ; right @@ -793,7 +750,7 @@ BattlePack: ; 10493 call TMHMSubmenu ret -.InitBallsPocket: ; 10594 (4:4594) +.InitBallsPocket: ld a, BALL_POCKET ld [wCurrPocket], a call ClearPocketList @@ -802,7 +759,7 @@ BattlePack: ; 10493 call Pack_JumptableNext ret -.BallsPocketMenu: ; 105a6 (4:45a6) +.BallsPocketMenu: ld hl, BallsPocketMenuHeader call CopyMenuHeader ld a, [wBallsPocketCursor] @@ -821,10 +778,10 @@ BattlePack: ; 10493 call ItemSubmenu ret -ItemSubmenu: ; 105d3 (4:45d3) +ItemSubmenu: farcall CheckItemContext ld a, [wItemAttributeParamBuffer] -TMHMSubmenu: ; 105dc (4:45dc) +TMHMSubmenu: and a jr z, .NoUse ld hl, .UsableMenuHeader @@ -846,51 +803,44 @@ TMHMSubmenu: ; 105dc (4:45dc) call Pack_GetJumptablePointer jp hl -; 10601 (4:4601) -.UsableMenuHeader: ; 0x10601 +.UsableMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .UsableMenuData db 1 ; default option -; 0x10609 -.UsableMenuData: ; 0x10609 +.UsableMenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "USE@" db "QUIT@" -; 0x10614 -.UsableJumptable: ; 10614 +.UsableJumptable: dw .Use dw .Quit -; 10618 -.UnusableMenuHeader: ; 0x10618 +.UnusableMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .UnusableMenuData db 1 ; default option -; 0x10620 -.UnusableMenuData: ; 0x10620 +.UnusableMenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 1 ; items db "QUIT@" -; 0x10627 -.UnusableJumptable: ; 10627 +.UnusableJumptable: dw .Quit -; 10629 -.Use: ; 10629 +.Use: farcall CheckItemContext ld a, [wItemAttributeParamBuffer] ld hl, .ItemFunctionJumptable rst JumpTable ret -.ItemFunctionJumptable: ; 10637 (4:4637) +.ItemFunctionJumptable: ; entries correspond to ITEMMENU_* constants dw .Oak ; ITEMMENU_NOUSE dw .Oak @@ -900,19 +850,19 @@ TMHMSubmenu: ; 105dc (4:45dc) dw .BattleField ; ITEMMENU_PARTY dw .BattleOnly ; ITEMMENU_CLOSE -.Oak: ; 10645 (4:4645) +.Oak: ld hl, Text_ThisIsntTheTime call Pack_PrintTextNoScroll ret -.Unused: ; 1064c (4:464c) +.Unused: call DoItemEffect ld a, [wItemEffectSucceeded] and a jr nz, .ReturnToBattle ret -.BattleField: ; 10656 (4:4656) +.BattleField: call DoItemEffect ld a, [wItemEffectSucceeded] and a @@ -924,32 +874,30 @@ TMHMSubmenu: ; 105dc (4:45dc) call Pack_InitColors ret -.ReturnToBattle: ; 1066c (4:466c) +.ReturnToBattle: call ClearBGPalettes jr .quit_run_script -.BattleOnly: ; 10671 (4:4671) +.BattleOnly: call DoItemEffect ld a, [wItemEffectSucceeded] and a jr z, .Oak cp $2 jr z, .didnt_use_item -.quit_run_script ; 1067e (4:467e) +.quit_run_script ld a, PACKSTATE_QUITRUNSCRIPT ld [wJumptableIndex], a ret -.didnt_use_item ; 10684 (4:4684) +.didnt_use_item xor a ld [wItemEffectSucceeded], a ret -; 10689 (4:4689) -.Quit: ; 10689 +.Quit: ret -; 1068a -InitPackBuffers: ; 1068a +InitPackBuffers: xor a ld [wJumptableIndex], a ; pocket id -> jumptable index @@ -965,9 +913,8 @@ InitPackBuffers: ; 1068a xor a ld [wSwitchItem], a ret -; 106a5 -DepositSellInitPackBuffers: ; 106a5 +DepositSellInitPackBuffers: xor a ld [hBGMapMode], a ld [wJumptableIndex], a ; PACKSTATE_INITGFX @@ -978,32 +925,28 @@ DepositSellInitPackBuffers: ; 106a5 call Pack_InitGFX call Pack_InitColors ret -; 106be -DepositSellPack: ; 106be +DepositSellPack: .loop call .RunJumptable call DepositSellTutorial_InterpretJoypad jr c, .loop ret -; 106c7 -.RunJumptable: ; 106c7 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call Pack_GetJumptablePointer jp hl -; 106d1 - -.Jumptable: ; 106d1 (4:46d1) +.Jumptable: ; entries correspond to *_POCKET constants dw .ItemsPocket dw .BallsPocket dw .KeyItemsPocket dw .TMHMPocket -.ItemsPocket: ; 106d9 (4:46d9) +.ItemsPocket: xor a ; ITEM_POCKET call InitPocket ld hl, PC_Mart_ItemsPocketMenuHeader @@ -1019,7 +962,7 @@ DepositSellPack: ; 106be ld [wItemsPocketCursor], a ret -.KeyItemsPocket: ; 106ff (4:46ff) +.KeyItemsPocket: ld a, KEY_ITEM_POCKET call InitPocket ld hl, PC_Mart_KeyItemsPocketMenuHeader @@ -1035,7 +978,7 @@ DepositSellPack: ; 106be ld [wKeyItemsPocketCursor], a ret -.TMHMPocket: ; 10726 (4:4726) +.TMHMPocket: ld a, TM_HM_POCKET call InitPocket call WaitBGMap_DrawPackGFX @@ -1044,7 +987,7 @@ DepositSellPack: ; 106be ld [wCurItem], a ret -.BallsPocket: ; 1073b (4:473b) +.BallsPocket: ld a, BALL_POCKET call InitPocket ld hl, PC_Mart_BallsPocketMenuHeader @@ -1060,14 +1003,14 @@ DepositSellPack: ; 106be ld [wBallsPocketCursor], a ret -InitPocket: ; 10762 (4:4762) +InitPocket: ld [wCurrPocket], a call ClearPocketList call DrawPocketName call WaitBGMap_DrawPackGFX ret -DepositSellTutorial_InterpretJoypad: ; 1076f +DepositSellTutorial_InterpretJoypad: ld hl, wMenuJoypad ld a, [hl] and A_BUTTON @@ -1119,9 +1062,8 @@ DepositSellTutorial_InterpretJoypad: ; 1076f pop de scf ret -; 107bb -TutorialPack: ; 107bb +TutorialPack: call DepositSellInitPackBuffers ld a, [wInputType] or a @@ -1134,37 +1076,32 @@ TutorialPack: ; 107bb xor a ; FALSE ld [wPackUsedItem], a ret -; 107d7 -.RunJumptable: ; 107d7 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .dw call Pack_GetJumptablePointer jp hl -; 107e1 - -.dw ; 107e1 (4:47e1) +.dw ; entries correspond to *_POCKET constants dw .Items dw .Balls dw .KeyItems dw .TMHM -.Items: ; 107e9 (4:47e9) +.Items: xor a ; ITEM_POCKET ld hl, .ItemsMenuHeader jr .DisplayPocket -; 107ef (4:47ef) -.ItemsMenuHeader: ; 0x107ef +.ItemsMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .ItemsMenuData db 1 ; default option -; 0x107f7 -.ItemsMenuData: ; 0x107f7 +.ItemsMenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1172,22 +1109,19 @@ TutorialPack: ; 107bb dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10807 -.KeyItems: ; 10807 (4:4807) +.KeyItems: ld a, KEY_ITEM_POCKET ld hl, .KeyItemsMenuHeader jr .DisplayPocket -; 1080e (4:480e) -.KeyItemsMenuHeader: ; 0x1080e +.KeyItemsMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .KeyItemsMenuData db 1 ; default option -; 0x10816 -.KeyItemsMenuData: ; 0x10816 +.KeyItemsMenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 1 ; horizontal spacing @@ -1195,9 +1129,8 @@ TutorialPack: ; 107bb dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10826 -.TMHM: ; 10826 (4:4826) +.TMHM: ld a, TM_HM_POCKET call InitPocket call WaitBGMap_DrawPackGFX @@ -1206,20 +1139,18 @@ TutorialPack: ; 107bb ld [wCurItem], a ret -.Balls: ; 1083b (4:483b) +.Balls: ld a, BALL_POCKET ld hl, .BallsMenuHeader jr .DisplayPocket -; 10842 (4:4842) -.BallsMenuHeader: ; 0x10842 +.BallsMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .BallsMenuData db 1 ; default option -; 0x1084a -.BallsMenuData: ; 0x1084a +.BallsMenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1227,9 +1158,8 @@ TutorialPack: ; 107bb dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 1085a -.DisplayPocket: ; 1085a (4:485a) +.DisplayPocket: push hl call InitPocket pop hl @@ -1237,12 +1167,12 @@ TutorialPack: ; 107bb call ScrollingMenu ret -Pack_JumptableNext: ; 10866 (4:4866) +Pack_JumptableNext: ld hl, wJumptableIndex inc [hl] ret -Pack_GetJumptablePointer: ; 1086b +Pack_GetJumptablePointer: ld e, a ld d, 0 add hl, de @@ -1251,23 +1181,22 @@ Pack_GetJumptablePointer: ; 1086b ld h, [hl] ld l, a ret -; 10874 -Pack_QuitNoScript: ; 10874 (4:4874) +Pack_QuitNoScript: ld hl, wJumptableIndex set 7, [hl] xor a ; FALSE ld [wPackUsedItem], a ret -Pack_QuitRunScript: ; 1087e (4:487e) +Pack_QuitRunScript: ld hl, wJumptableIndex set 7, [hl] ld a, TRUE ld [wPackUsedItem], a ret -Pack_PrintTextNoScroll: ; 10889 (4:4889) +Pack_PrintTextNoScroll: ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -1277,13 +1206,13 @@ Pack_PrintTextNoScroll: ; 10889 (4:4889) ld [wOptions], a ret -WaitBGMap_DrawPackGFX: ; 1089a (4:489a) +WaitBGMap_DrawPackGFX: call WaitBGMap -DrawPackGFX: ; 1089d +DrawPackGFX: ld a, [wCurrPocket] maskbits NUM_POCKETS ld e, a - ld d, $0 + ld d, 0 ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .male_dude @@ -1305,16 +1234,14 @@ DrawPackGFX: ; 1089d .female farcall DrawKrisPackGFX ret -; 108cc -PackGFXPointers: ; 108cc +PackGFXPointers: dw PackGFX + (15 tiles) * 1 ; ITEM_POCKET dw PackGFX + (15 tiles) * 3 ; BALL_POCKET dw PackGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET dw PackGFX + (15 tiles) * 2 ; TM_HM_POCKET -; 108d4 -Pack_InterpretJoypad: ; 108d4 (4:48d4) +Pack_InterpretJoypad: ld hl, wMenuJoypad ld a, [wSwitchItem] and a @@ -1398,7 +1325,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) scf ret -Pack_InitGFX: ; 10955 +Pack_InitGFX: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -1435,9 +1362,8 @@ Pack_InitGFX: ; 10955 call EnableLCD call DrawPackGFX ret -; 109a5 -PlacePackGFX: ; 109a5 +PlacePackGFX: hlcoord 0, 3 ld a, $50 ld de, SCREEN_WIDTH - 5 @@ -1453,9 +1379,8 @@ PlacePackGFX: ; 109a5 dec b jr nz, .row ret -; 109bb -DrawPocketName: ; 109bb +DrawPocketName: ld a, [wCurrPocket] ; * 15 ld d, a @@ -1484,9 +1409,8 @@ DrawPocketName: ; 109bb dec c jr nz, .row ret -; 109e1 -.tilemap ; 109e1 +.tilemap ; ITEM_POCKET db $00, $04, $04, $04, $01 ; top border db $06, $07, $08, $09, $0a ; Items @@ -1503,47 +1427,42 @@ DrawPocketName: ; 109bb db $00, $04, $04, $04, $01 ; top border db $10, $11, $12, $13, $14 ; TM/HM db $02, $05, $05, $05, $03 ; bottom border -; 10a1d -Pack_GetItemName: ; 10a1d +Pack_GetItemName: ld a, [wCurItem] ld [wNamedObjectIndexBuffer], a call GetItemName call CopyName1 ret -; 10a2a -Unreferenced_Pack_ClearTilemap: ; 10a2a +Unreferenced_Pack_ClearTilemap: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ret -; 10a36 -ClearPocketList: ; 10a36 (4:4a36) +ClearPocketList: hlcoord 5, 2 lb bc, 10, SCREEN_WIDTH - 5 call ClearBox ret -Pack_InitColors: ; 10a40 +Pack_InitColors: call WaitBGMap ld b, SCGB_PACKPALS call GetSGBLayout call SetPalettes call DelayFrame ret -; 10a4f -ItemsPocketMenuHeader: ; 0x10a4f +ItemsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10a57 -.MenuData: ; 0x10a57 +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1551,16 +1470,14 @@ ItemsPocketMenuHeader: ; 0x10a4f dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10a67 -PC_Mart_ItemsPocketMenuHeader: ; 0x10a67 +PC_Mart_ItemsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10a6f -.MenuData: ; 0x10a6f +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1568,16 +1485,14 @@ PC_Mart_ItemsPocketMenuHeader: ; 0x10a67 dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10a7f -KeyItemsPocketMenuHeader: ; 0x10a7f +KeyItemsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10a87 -.MenuData: ; 0x10a87 +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 1 ; horizontal spacing @@ -1585,16 +1500,14 @@ KeyItemsPocketMenuHeader: ; 0x10a7f dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10a97 -PC_Mart_KeyItemsPocketMenuHeader: ; 0x10a97 +PC_Mart_KeyItemsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10a9f -.MenuData: ; 0x10a9f +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 1 ; horizontal spacing @@ -1602,16 +1515,14 @@ PC_Mart_KeyItemsPocketMenuHeader: ; 0x10a97 dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10aaf -BallsPocketMenuHeader: ; 0x10aaf +BallsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10ab7 -.MenuData: ; 0x10ab7 +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1619,16 +1530,14 @@ BallsPocketMenuHeader: ; 0x10aaf dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10ac7 -PC_Mart_BallsPocketMenuHeader: ; 0x10ac7 +PC_Mart_BallsPocketMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -; 0x10acf -.MenuData: ; 0x10acf +.MenuData: db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing @@ -1636,74 +1545,62 @@ PC_Mart_BallsPocketMenuHeader: ; 0x10ac7 dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription -; 10adf -Text_PackNoItems: ; 0x10adf +Text_PackNoItems: ; No items. text_jump UnknownText_0x1c0b9a db "@" -; 0x10ae4 -Text_ThrowAwayHowMany: ; 0x10ae4 +Text_ThrowAwayHowMany: ; Throw away how many? text_jump UnknownText_0x1c0ba5 db "@" -; 0x10ae9 -Text_ConfirmThrowAway: ; 0x10ae9 +Text_ConfirmThrowAway: ; Throw away @ @ (S)? text_jump UnknownText_0x1c0bbb db "@" -; 0x10aee -Text_ThrewAway: ; 0x10aee +Text_ThrewAway: ; Threw away @ (S). text_jump UnknownText_0x1c0bd8 db "@" -; 0x10af3 -Text_ThisIsntTheTime: ; 0x10af3 +Text_ThisIsntTheTime: ; OAK: ! This isn't the time to use that! text_jump UnknownText_0x1c0bee db "@" -; 0x10af8 -TextJump_YouDontHaveAMon: ; 0x10af8 +TextJump_YouDontHaveAMon: ; You don't have a #MON! text_jump Text_YouDontHaveAMon db "@" -; 0x10afd -Text_RegisteredItem: ; 0x10afd +Text_RegisteredItem: ; Registered the @ . text_jump UnknownText_0x1c0c2e db "@" -; 0x10b02 -Text_CantRegister: ; 0x10b02 +Text_CantRegister: ; You can't register that item. text_jump UnknownText_0x1c0c45 db "@" -; 0x10b07 -Text_MoveItemWhere: ; 0x10b07 +Text_MoveItemWhere: ; Where should this be moved to? text_jump UnknownText_0x1c0c63 db "@" -; 0x10b0c -Text_PackEmptyString: ; 0x10b0c +Text_PackEmptyString: ; text_jump UnknownText_0x1c0c83 db "@" -; 0x10b11 -TextJump_YouCantUseItInABattle: ; 0x10b11 +TextJump_YouCantUseItInABattle: ; Doesn't seem to be used anywhere ; "You can't use it in a battle." text_jump Text_YouCantUseItInABattle db "@" -; 0x10b16 PackMenuGFX: INCBIN "gfx/pack/pack_menu.2bpp" diff --git a/engine/items/pack_kris.asm b/engine/items/pack_kris.asm index 54a21e447..1a169ea6e 100644 --- a/engine/items/pack_kris.asm +++ b/engine/items/pack_kris.asm @@ -1,4 +1,4 @@ -DrawKrisPackGFX: ; 48e81 +DrawKrisPackGFX: ld hl, PackFGFXPointers add hl, de add hl, de @@ -10,11 +10,11 @@ DrawKrisPackGFX: ; 48e81 call Request2bpp ret -PackFGFXPointers: ; 48e93 +PackFGFXPointers: dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET -PackFGFX: ; 48e9b +PackFGFX: INCBIN "gfx/pack/pack_f.2bpp" diff --git a/engine/items/print_item_description.asm b/engine/items/print_item_description.asm index 2a9007b97..b0a3a0b33 100644 --- a/engine/items/print_item_description.asm +++ b/engine/items/print_item_description.asm @@ -1,4 +1,4 @@ -PrintItemDescription: ; 0x1c8955 +PrintItemDescription: ; Print the description for item [wCurSpecies] at de. ld a, [wCurSpecies] @@ -28,4 +28,5 @@ PrintItemDescription: ; 0x1c8955 ld d, [hl] pop hl jp PlaceString -; 0x1c8987 + +INCLUDE "data/items/descriptions.asm" diff --git a/engine/items/switch_items.asm b/engine/items/switch_items.asm index 77b635246..81b5ac6a5 100644 --- a/engine/items/switch_items.asm +++ b/engine/items/switch_items.asm @@ -1,4 +1,4 @@ -SwitchItemsInBag: ; 2490c (9:490c) +SwitchItemsInBag: ld a, [wSwitchItem] and a jr z, .init @@ -84,7 +84,7 @@ SwitchItemsInBag: ; 2490c (9:490c) ld [wSwitchItem], a ret -Function249a7: ; 249a7 (9:49a7) +Function249a7: ld a, [wSwitchItem] call ItemSwitch_GetNthItem ld d, h @@ -110,7 +110,7 @@ Function249a7: ; 249a7 (9:49a7) scf ret -Function249d1: ; 249d1 (9:49d1) +Function249d1: ld a, [wSwitchItem] call ItemSwitch_GetNthItem inc hl @@ -180,14 +180,14 @@ Function249d1: ; 249d1 (9:49d1) ld [wSwitchItem], a ret -Function24a40: ; 24a40 (9:4a40) +Function24a40: call ItemSwitch_GetNthItem ld de, wd002 call ItemSwitch_ConvertSpacingToDW call CopyBytes ret -Function24a4d: ; 24a4d (9:4a4d) +Function24a4d: call ItemSwitch_GetNthItem ld d, h ld e, l @@ -196,7 +196,7 @@ Function24a4d: ; 24a4d (9:4a4d) call CopyBytes ret -ItemSwitch_GetNthItem: ; 24a5c (9:4a5c) +ItemSwitch_GetNthItem: push af call ItemSwitch_ConvertSpacingToDW ld hl, wMenuData_ItemsPointerAddr @@ -208,7 +208,7 @@ ItemSwitch_GetNthItem: ; 24a5c (9:4a5c) call AddNTimes ret -Function24a6c: ; 24a6c (9:4a6c) +Function24a6c: push hl call ItemSwitch_ConvertSpacingToDW ld a, d @@ -224,7 +224,7 @@ Function24a6c: ; 24a6c (9:4a6c) pop hl ret -ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80) +ItemSwitch_ConvertSpacingToDW: ; This function is absolutely idiotic. push hl ld a, [wMenuData_ScrollingMenuSpacing] @@ -239,13 +239,10 @@ ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80) pop hl ret -; 24a91 (9:4a91) - -.spacing_dws ; 24a91 +.spacing_dws dw 0, 1, 2 -; 24a97 -Function24a97: ; 24a97 (9:4a97) +Function24a97: push af call ItemSwitch_ConvertSpacingToDW ld a, c @@ -262,7 +259,7 @@ Function24a97: ; 24a97 (9:4a97) ld a, $1 ret -Function24aab: ; 24aab (9:4aab) +Function24aab: .loop ld a, [hld] ld [de], a diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 442f73cfa..4958d2afc 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -1,4 +1,4 @@ -TMHMPocket: ; 2c76f (b:476f) +TMHMPocket: ld a, $1 ld [hInMenu], a call TMHM_PocketLoop @@ -20,7 +20,7 @@ TMHMPocket: ; 2c76f (b:476f) scf ret -.ConvertItemToTMHMNumber: ; 2c798 (b:4798) +.ConvertItemToTMHMNumber: ld a, [wCurItem] ld c, a callfar GetNumberedTMHM @@ -28,7 +28,7 @@ TMHMPocket: ; 2c76f (b:476f) ld [wCurItem], a ret -ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) +ConvertCurItemIntoCurTMHM: ld a, [wCurItem] ld c, a callfar GetTMHMNumber @@ -36,12 +36,12 @@ ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) ld [wCurTMHM], a ret -GetTMHMItemMove: ; 2c7b6 (b:47b6) +GetTMHMItemMove: call ConvertCurItemIntoCurTMHM predef GetTMHMMove ret -AskTeachTMHM: ; 2c7bf (b:47bf) +AskTeachTMHM: ld hl, wOptions ld a, [hl] push af @@ -70,13 +70,13 @@ AskTeachTMHM: ; 2c7bf (b:47bf) ld [wOptions], a ret -ChooseMonToLearnTMHM: ; 2c7fb +ChooseMonToLearnTMHM: ld hl, wStringBuffer2 ld de, wTMHMMoveNameBackup ld bc, 12 call CopyBytes call ClearBGPalettes -ChooseMonToLearnTMHM_NoRefresh: ; 2c80a +ChooseMonToLearnTMHM_NoRefresh: farcall LoadPartyMenuGFX farcall InitPartyMenuWithCancel farcall InitPartyMenuGFX @@ -115,9 +115,8 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a pop de pop hl jr .loopback -; 2c867 -TeachTMHM: ; 2c867 +TeachTMHM: predef CanLearnTMHMMove push bc @@ -166,33 +165,28 @@ TeachTMHM: ; 2c867 .learned_move scf ret -; 2c8bf (b:48bf) -Text_BootedTM: ; 0x2c8bf +Text_BootedTM: ; Booted up a TM. text_jump UnknownText_0x1c0373 db "@" -; 0x2c8c4 -Text_BootedHM: ; 0x2c8c4 +Text_BootedHM: ; Booted up an HM. text_jump UnknownText_0x1c0384 db "@" -; 0x2c8c9 -Text_ItContained: ; 0x2c8c9 +Text_ItContained: ; It contained @ . Teach @ to a #MON? text_jump UnknownText_0x1c0396 db "@" -; 0x2c8ce -Text_TMHMNotCompatible: ; 0x2c8ce +Text_TMHMNotCompatible: ; is not compatible with @ . It can't learn @ . text_jump UnknownText_0x1c03c2 db "@" -; 0x2c8d3 -TMHM_PocketLoop: ; 2c8d3 (b:48d3) +TMHM_PocketLoop: xor a ld [hBGMapMode], a call TMHM_DisplayPocketItems @@ -225,7 +219,7 @@ TMHM_PocketLoop: ; 2c8d3 (b:48d3) ld [wMenuCursorX], a jr TMHM_ShowTMMoveDescription -TMHM_JoypadLoop: ; 2c915 (b:4915) +TMHM_JoypadLoop: call TMHM_DisplayPocketItems call StaticMenuJoypad ld b, a @@ -247,7 +241,7 @@ TMHM_JoypadLoop: ; 2c915 (b:4915) jp nz, TMHM_ExitPocket bit D_LEFT_F, a jp nz, TMHM_ExitPocket -TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) +TMHM_ShowTMMoveDescription: call TMHM_CheckHoveringOverCancel jp nc, TMHM_ExitPocket hlcoord 0, 12 @@ -265,7 +259,7 @@ TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) call PrintMoveDesc jp TMHM_JoypadLoop -TMHM_ChooseTMorHM: ; 2c974 (b:4974) +TMHM_ChooseTMorHM: call TMHM_PlaySFX_ReadText2 call CountTMsHMs ; This stores the count to wd265. ld a, [wMenuCursorY] @@ -277,7 +271,7 @@ TMHM_ChooseTMorHM: ; 2c974 (b:4974) ld a, [wd265] cp b jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL -TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a) +TMHM_CheckHoveringOverCancel: call TMHM_GetCurrentPocketPosition ld a, [wMenuCursorY] ld b, a @@ -297,19 +291,19 @@ TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a) cp -1 ret -TMHM_ExitPack: ; 2c9a5 (b:49a5) +TMHM_ExitPack: call TMHM_PlaySFX_ReadText2 -_TMHM_ExitPack: ; 2c9a8 (b:49a8) +_TMHM_ExitPack: ld a, $2 ld [wMenuJoypad], a and a ret -TMHM_ExitPocket: ; 2c9af (b:49af) +TMHM_ExitPocket: and a ret -TMHM_ScrollPocket: ; 2c9b1 (b:49b1) +TMHM_ScrollPocket: ld a, b bit 7, a jr nz, .skip @@ -339,7 +333,7 @@ TMHM_ScrollPocket: ; 2c9b1 (b:49b1) call TMHM_DisplayPocketItems jp TMHM_ShowTMMoveDescription -TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) +TMHM_DisplayPocketItems: ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jp z, Tutorial_TMHMPocket @@ -433,7 +427,7 @@ TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) .done ret -TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86) +TMHMPocket_GetCurrentLineCoord: hlcoord 5, 0 ld bc, 2 * SCREEN_WIDTH ld a, 6 @@ -445,9 +439,8 @@ TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86) dec e jr nz, .loop ret -; 2ca95 (b:4a95) -Unreferenced_Function2ca95: ; 2ca95 +Unreferenced_Function2ca95: pop hl ld bc, 3 add hl, bc @@ -459,13 +452,11 @@ Unreferenced_Function2ca95: ; 2ca95 call PlaceString pop hl ret -; 2caae -TMHM_String_Cancel: ; 2caae +TMHM_String_Cancel: db "CANCEL@" -; 2cab5 -TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5) +TMHM_GetCurrentPocketPosition: ld hl, wTMsHMs ld a, [wTMHMPocketScrollPosition] ld b, a @@ -482,7 +473,7 @@ TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5) dec c ret -Tutorial_TMHMPocket: ; 2caca (b:4aca) +Tutorial_TMHMPocket: hlcoord 9, 3 push de ld de, TMHM_String_Cancel @@ -490,15 +481,14 @@ Tutorial_TMHMPocket: ; 2caca (b:4aca) pop de ret -TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6) +TMHM_PlaySFX_ReadText2: push de ld de, SFX_READ_TEXT_2 call PlaySFX pop de ret -; 2cadf (b:4adf) -Unreferenced_Function2cadf: ; 2cadf +Unreferenced_Function2cadf: call ConvertCurItemIntoCurTMHM call .CheckHaveRoomForTMHM ld hl, .NoRoomText @@ -506,21 +496,18 @@ Unreferenced_Function2cadf: ; 2cadf ld hl, .ReceivedText .print jp PrintText -; 2caf0 -.NoRoomText: ; 0x2caf0 +.NoRoomText: ; You have no room for any more @ S. text_jump UnknownText_0x1c03fa db "@" -; 0x2caf5 -.ReceivedText: ; 0x2caf5 +.ReceivedText: ; You received @ ! text_jump UnknownText_0x1c0421 db "@" -; 0x2cafa -.CheckHaveRoomForTMHM: ; 2cafa +.CheckHaveRoomForTMHM: ld a, [wd265] dec a ld hl, wTMsHMs @@ -533,9 +520,8 @@ Unreferenced_Function2cadf: ; 2cadf ret nc ld [hl], a ret -; 2cb0c -ConsumeTM: ; 2cb0c (b:4b0c) +ConsumeTM: call ConvertCurItemIntoCurTMHM ld a, [wd265] dec a @@ -556,7 +542,7 @@ ConsumeTM: ; 2cb0c (b:4b0c) ld [wTMHMPocketScrollPosition], a ret -CountTMsHMs: ; 2cb2a (b:4b2a) +CountTMsHMs: ld b, 0 ld c, NUM_TMS + NUM_HMS ld hl, wTMsHMs @@ -572,7 +558,7 @@ CountTMsHMs: ; 2cb2a (b:4b2a) ld [wd265], a ret -PrintMoveDesc: ; 2cb3e +PrintMoveDesc: push hl ld hl, MoveDescriptions ld a, [wCurSpecies] @@ -586,4 +572,3 @@ PrintMoveDesc: ; 2cb3e ld d, [hl] pop hl jp PlaceString -; 2cb52 diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm index 9db3dc291..10206d36b 100644 --- a/engine/items/tmhm2.asm +++ b/engine/items/tmhm2.asm @@ -1,4 +1,4 @@ -CanLearnTMHMMove: ; 11639 +CanLearnTMHMMove: ld a, [wCurPartySpecies] ld [wCurSpecies], a call GetBaseData @@ -31,9 +31,8 @@ CanLearnTMHMMove: ; 11639 pop hl ld c, 0 ret -; 1166a -GetTMHMMove: ; 1166a +GetTMHMMove: ld a, [wd265] dec a ld hl, TMHMMoves @@ -43,7 +42,5 @@ GetTMHMMove: ; 1166a ld a, [hl] ld [wd265], a ret -; 1167a - INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/items/update_item_description.asm b/engine/items/update_item_description.asm index fdb1e864d..d4bc731a1 100644 --- a/engine/items/update_item_description.asm +++ b/engine/items/update_item_description.asm @@ -1,4 +1,4 @@ -UpdateItemDescription: ; 0x244c3 +UpdateItemDescription: ld a, [wMenuSelection] ld [wCurSpecies], a hlcoord 0, 12 diff --git a/engine/link/init_list.asm b/engine/link/init_list.asm index 26c77b5bb..8557b2e9f 100644 --- a/engine/link/init_list.asm +++ b/engine/link/init_list.asm @@ -1,4 +1,4 @@ -InitList: ; 50db9 +InitList: ld a, [wInitListType] cp INIT_ENEMYOT_LIST diff --git a/engine/link/link.asm b/engine/link/link.asm index e0b7f7972..e5f354f57 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -1,4 +1,4 @@ -LinkCommunications: ; 28000 +LinkCommunications: call ClearBGPalettes ld c, 80 call DelayFrames @@ -35,7 +35,7 @@ LinkCommunications: ; 28000 cp LINK_TIMECAPSULE jp nz, Gen2ToGen2LinkComms -Gen2ToGen1LinkComms: ; 2805d +Gen2ToGen1LinkComms: call ClearLinkData call Link_PrepPartyData_Gen1 call FixDataForLinkTransfer @@ -177,9 +177,8 @@ Gen2ToGen1LinkComms: ; 2805d ld de, MUSIC_ROUTE_30 call PlayMusic jp InitTradeMenuDisplay -; 28177 -Gen2ToGen2LinkComms: ; 28177 +Gen2ToGen2LinkComms: call ClearLinkData call Link_PrepPartyData_Gen2 call FixDataForLinkTransfer @@ -474,9 +473,8 @@ Gen2ToGen2LinkComms: ; 28177 ld de, MUSIC_ROUTE_30 call PlayMusic jp InitTradeMenuDisplay -; 283b2 -LinkTimeout: ; 283b2 +LinkTimeout: ld de, .TooMuchTimeHasElapsed ld b, 10 .loop @@ -506,15 +504,13 @@ LinkTimeout: ; 283b2 call GetSGBLayout call WaitBGMap2 ret -; 283ed -.TooMuchTimeHasElapsed: ; 0x283ed +.TooMuchTimeHasElapsed: ; Too much time has elapsed. Please try again. text_jump UnknownText_0x1c4183 db "@" -; 0x283f2 -ExchangeBytes: ; 283f2 +ExchangeBytes: ld a, TRUE ld [hSerialIgnoringInitialData], a .loop @@ -546,13 +542,11 @@ ExchangeBytes: ; 283f2 or c jr nz, .loop ret -; 28419 -String_PleaseWait: ; 28419 +String_PleaseWait: db "PLEASE WAIT!@" -; 28426 -ClearLinkData: ; 28426 +ClearLinkData: ld hl, wLinkData ld bc, wLinkDataEnd - wLinkData .loop @@ -563,9 +557,8 @@ ClearLinkData: ; 28426 or c jr nz, .loop ret -; 28434 -FixDataForLinkTransfer: ; 28434 +FixDataForLinkTransfer: ld hl, wd1f3 ld a, SERIAL_PREAMBLE_BYTE ld b, wLinkBattleRNs - wd1f3 @@ -636,9 +629,8 @@ FixDataForLinkTransfer: ; 28434 ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a ret -; 28499 -Link_PrepPartyData_Gen1: ; 28499 +Link_PrepPartyData_Gen1: ld de, wLinkData ld a, SERIAL_PREAMBLE_BYTE ld b, PARTY_LENGTH @@ -693,9 +685,8 @@ Link_PrepPartyData_Gen1: ; 28499 .copy_ot_nicks ld bc, PARTY_LENGTH * NAME_LENGTH jp CopyBytes -; 284f6 -.ConvertPartyStruct2to1: ; 284f6 +.ConvertPartyStruct2to1: ld b, h ld c, l push de @@ -804,9 +795,8 @@ Link_PrepPartyData_Gen1: ; 28499 ld h, b ld l, c ret -; 28595 -Link_PrepPartyData_Gen2: ; 28595 +Link_PrepPartyData_Gen2: ld de, wLinkData ld a, SERIAL_PREAMBLE_BYTE ld b, PARTY_LENGTH @@ -942,9 +932,8 @@ Link_PrepPartyData_Gen2: ; 28595 ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a ret -; 28682 -Function28682: ; 28682 +Function28682: ld c, 5 .loop ld [de], a @@ -952,9 +941,8 @@ Function28682: ; 28682 dec c jr nz, .loop ret -; 2868a -Function2868a: ; 2868a +Function2868a: push hl ld d, h ld e, l @@ -980,9 +968,8 @@ Function2868a: ; 2868a ld de, wOTPartyMonNicknames ld bc, PARTY_LENGTH * MON_NAME_LENGTH jp CopyBytes -; 286ba -.ConvertToGen2: ; 286ba +.ConvertToGen2: ld b, h ld c, l ld a, [de] @@ -1102,9 +1089,8 @@ Function2868a: ; 2868a inc de inc de ret -; 28771 -TimeCapsule_ReplaceTeruSama: ; 28771 +TimeCapsule_ReplaceTeruSama: ld a, b and a ret z @@ -1126,11 +1112,9 @@ TimeCapsule_ReplaceTeruSama: ; 28771 pop hl ret - INCLUDE "data/items/catch_rate_items.asm" - -Link_CopyOTData: ; 2879e +Link_CopyOTData: .loop ld a, [hli] cp SERIAL_NO_DATA_BYTE @@ -1142,9 +1126,8 @@ Link_CopyOTData: ; 2879e or c jr nz, .loop ret -; 287ab -Link_CopyRandomNumbers: ; 287ab +Link_CopyRandomNumbers: ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ret z @@ -1163,9 +1146,8 @@ Link_CopyRandomNumbers: ; 287ab dec c jr nz, .loop ret -; 287ca -Link_FindFirstNonControlCharacter_SkipZero: ; 287ca +Link_FindFirstNonControlCharacter_SkipZero: .loop ld a, [hli] and a @@ -1176,9 +1158,8 @@ Link_FindFirstNonControlCharacter_SkipZero: ; 287ca jr z, .loop dec hl ret -; 287d8 -Link_FindFirstNonControlCharacter_AllowZero: ; 287d8 +Link_FindFirstNonControlCharacter_AllowZero: .loop ld a, [hli] cp SERIAL_PREAMBLE_BYTE @@ -1187,9 +1168,8 @@ Link_FindFirstNonControlCharacter_AllowZero: ; 287d8 jr z, .loop dec hl ret -; 287e3 -InitTradeMenuDisplay: ; 287e3 +InitTradeMenuDisplay: call ClearScreen call LoadTradeScreenBorder farcall InitTradeSpeciesList @@ -1204,9 +1184,8 @@ InitTradeMenuDisplay: ; 287e3 inc a ld [wPlayerLinkAction], a jp LinkTrade_PlayerPartyMenu -; 28803 -LinkTrade_OTPartyMenu: ; 28803 +LinkTrade_OTPartyMenu: ld a, OTPARTYMON ld [wMonType], a ld a, A_BUTTON | D_UP | D_DOWN @@ -1228,7 +1207,7 @@ LinkTrade_OTPartyMenu: ; 28803 xor a ld [w2DMenuFlags2], a -LinkTradeOTPartymonMenuLoop: ; 28835 +LinkTradeOTPartymonMenuLoop: farcall LinkTradeMenu ld a, d and a @@ -1268,9 +1247,8 @@ LinkTradeOTPartymonMenuLoop: ; 28835 bit D_DOWN_F, a jp z, LinkTradePartiesMenuMasterLoop jp Function28ac9 -; 2888b -LinkTrade_PlayerPartyMenu: ; 2888b +LinkTrade_PlayerPartyMenu: farcall InitMG_Mobile_LinkTradePalMap xor a ld [wMonType], a @@ -1294,7 +1272,7 @@ LinkTrade_PlayerPartyMenu: ; 2888b ld [w2DMenuFlags2], a call WaitBGMap2 -LinkTradePartymonMenuLoop: ; 288c5 +LinkTradePartymonMenuLoop: farcall LinkTradeMenu ld a, d and a @@ -1343,16 +1321,14 @@ LinkTradePartymonMenuLoop: ; 288c5 pop bc pop hl jp Function28ade -; 2891c -LinkTradePartiesMenuMasterLoop: ; 2891c +LinkTradePartiesMenuMasterLoop: ld a, [wMonType] and a jp z, LinkTradePartymonMenuLoop ; PARTYMON jp LinkTradeOTPartymonMenuLoop ; OTPARTYMON -; 28926 -Function28926: ; 28926 +Function28926: call LoadTileMapToTempTileMap ld a, [wMenuCursorY] push af @@ -1510,26 +1486,21 @@ Function28926: ; 28926 ld c, 100 call DelayFrames jp InitTradeMenuDisplay -; 28aaf - -.Text_CantTradeLastMon: ; 0x28aaf +.Text_CantTradeLastMon: ; If you trade that #MON, you won't be able to battle. text_jump UnknownText_0x1c41b1 db "@" -; 0x28ab4 -.String_Stats_Trade: ; 28ab4 +.String_Stats_Trade: db "STATS TRADE@" -.Text_Abnormal: ; 0x28ac4 +.Text_Abnormal: ; Your friend's @ appears to be abnormal! text_jump UnknownText_0x1c41e6 db "@" -; 0x28ac9 - -Function28ac9: ; 28ac9 +Function28ac9: ld a, [wMenuCursorY] cp 1 jp nz, LinkTradePartiesMenuMasterLoop @@ -1541,7 +1512,7 @@ Function28ac9: ; 28ac9 ld [hl], " " pop bc pop hl -Function28ade: ; 28ade +Function28ade: .loop1 ld a, "▶" ldcoord_a 9, 17 @@ -1576,7 +1547,7 @@ Function28ade: ; 28ade ld a, [wOtherPlayerLinkMode] cp $f jr nz, .loop1 -Function28b22: ; 28b22 +Function28b22: call RotateThreePalettesRight call ClearScreen ld b, SCGB_DIPLOMA @@ -1592,9 +1563,8 @@ Function28b22: ; 28b22 ld a, (1 << rSC_ON) | 1 ld [rSC], a ret -; 28b42 -Unreferenced_Function28b42: ; 28b42 +Unreferenced_Function28b42: hlcoord 0, 16 ld a, "┘" ld bc, 2 * SCREEN_WIDTH @@ -1606,22 +1576,19 @@ Unreferenced_Function28b42: ; 28b42 hlcoord 2, 16 ld de, .Cancel jp PlaceString -; 28b61 -.Cancel: ; 28b61 +.Cancel: db "CANCEL@" -; 28b68 -Function28b68: ; 28b68 +Function28b68: ld a, [wOtherPlayerLinkMode] hlcoord 6, 9 ld bc, SCREEN_WIDTH call AddNTimes ld [hl], "▷" ret -; 28b77 -LinkEngine_FillBox: ; 28b77 +LinkEngine_FillBox: .row push bc push hl @@ -1636,9 +1603,8 @@ LinkEngine_FillBox: ; 28b77 dec b jr nz, .row ret -; 28b87 -LinkTrade: ; 28b87 +LinkTrade: xor a ld [wcf57], a ld [wOtherPlayerLinkAction], a @@ -1972,51 +1938,44 @@ LinkTrade: ; 28b87 cp LINK_TIMECAPSULE jp z, Gen2ToGen1LinkComms jp Gen2ToGen2LinkComms -; 28ea3 -Function28ea3: ; 28ea3 +Function28ea3: ld c, 100 call DelayFrames jp InitTradeMenuDisplay -; 28eab -String28eab: ; 28eab +String28eab: db "TRADE" next "CANCEL@" -UnknownText_0x28eb8: ; 0x28eb8 +UnknownText_0x28eb8: ; Trade @ for @ ? text_jump UnknownText_0x1c4212 db "@" -; 0x28ebd -String28ebd: ; 28ebd +String28ebd: db "Trade completed!@" -String_TooBadTheTradeWasCanceled: ; 28ece +String_TooBadTheTradeWasCanceled: db "Too bad! The trade" next "was canceled!@" - -LinkTextboxAtHL: ; 28eef +LinkTextboxAtHL: ld d, h ld e, l farcall LinkTextbox ret -; 28ef8 -LoadTradeScreenBorder: ; 28ef8 +LoadTradeScreenBorder: farcall _LoadTradeScreenBorder ret -; 28eff -SetTradeRoomBGPals: ; 28eff +SetTradeRoomBGPals: farcall LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful call SetPalettes ret -; 28f09 -Unreferenced_Function28f09: ; 28f09 +Unreferenced_Function28f09: hlcoord 0, 0 ld b, 6 ld c, 18 @@ -2027,11 +1986,10 @@ Unreferenced_Function28f09: ; 28f09 call LinkTextboxAtHL farcall PlaceTradePartnerNamesAndParty ret -; 28f24 INCLUDE "engine/movie/trade_animation.asm" -CheckTimeCapsuleCompatibility: ; 29bfb +CheckTimeCapsuleCompatibility: ; Checks to see if your party is compatible with the Gen 1 games. ; Returns the following in wScriptVar: ; 0: Party is okay @@ -2081,7 +2039,7 @@ CheckTimeCapsuleCompatibility: ; 29bfb jr nc, .move_too_new dec c jr nz, .move_next - ld de, wPartyMon2 - (wPartyMon1 + NUM_MOVES) + ld de, PARTYMON_STRUCT_LENGTH - NUM_MOVES add hl, de dec b jr nz, .move_loop @@ -2111,9 +2069,8 @@ CheckTimeCapsuleCompatibility: ; 29bfb .done ld [wScriptVar], a ret -; 29c67 -Function29c67: ; 29c67 +Function29c67: ld a, [wPartyCount] sub b ld c, a @@ -2125,9 +2082,8 @@ Function29c67: ; 29c67 ld [wd265], a call GetPokemonName ret -; 29c7b -EnterTimeCapsule: ; 29c7b +EnterTimeCapsule: ld c, 10 call DelayFrames ld a, $4 @@ -2139,9 +2095,8 @@ EnterTimeCapsule: ; 29c7b inc a ld [wLinkMode], a ret -; 29c92 -WaitForOtherPlayerToExit: ; 29c92 +WaitForOtherPlayerToExit: ld c, 3 call DelayFrames ld a, CONNECTION_NOT_ESTABLISHED @@ -2187,23 +2142,20 @@ WaitForOtherPlayerToExit: ; 29c92 ld [hVBlank], a ld [wLinkMode], a ret -; 29ce8 -SetBitsForLinkTradeRequest: ; 29ce8 +SetBitsForLinkTradeRequest: ld a, LINK_TRADECENTER - 1 ld [wPlayerLinkAction], a ld [wd265], a ret -; 29cf1 -SetBitsForBattleRequest: ; 29cf1 +SetBitsForBattleRequest: ld a, LINK_COLOSSEUM - 1 ld [wPlayerLinkAction], a ld [wd265], a ret -; 29cfa -SetBitsForTimeCapsuleRequest: ; 29cfa +SetBitsForTimeCapsuleRequest: ld a, $2 ld [rSB], a xor a @@ -2216,9 +2168,8 @@ SetBitsForTimeCapsuleRequest: ; 29cfa ld [wPlayerLinkAction], a ld [wd265], a ret -; 29d11 -WaitForLinkedFriend: ; 29d11 +WaitForLinkedFriend: ld a, [wPlayerLinkAction] and a jr z, .no_link_action @@ -2288,9 +2239,8 @@ WaitForLinkedFriend: ; 29d11 xor a ld [wScriptVar], a ret -; 29d92 -CheckLinkTimeout: ; 29d92 +CheckLinkTimeout: ld a, $1 ld [wPlayerLinkAction], a ld hl, wLinkTimeoutFrames @@ -2310,9 +2260,8 @@ CheckLinkTimeout: ; 29d92 and a ret nz jp Link_ResetSerialRegistersAfterLinkClosure -; 29dba -Function29dba: ; 29dba +Function29dba: ld a, $5 ld [wPlayerLinkAction], a ld hl, wLinkTimeoutFrames @@ -2358,9 +2307,8 @@ Function29dba: ; 29dba xor a ld [hVBlank], a ret -; 29e0c -Link_CheckCommunicationError: ; 29e0c +Link_CheckCommunicationError: xor a ld [hSerialReceivedNewData], a ld a, [wLinkTimeoutFrames] @@ -2389,9 +2337,8 @@ Link_CheckCommunicationError: ; 29e0c ld [hli], a ld [hl], a ret -; 29e3b -.CheckConnected: ; 29e3b +.CheckConnected: call WaitLinkTransfer ld hl, wLinkTimeoutFrames ld a, [hli] @@ -2400,9 +2347,8 @@ Link_CheckCommunicationError: ; 29e0c ld a, [hl] inc a ret -; 29e47 -.AcknowledgeSerial: ; 29e47 +.AcknowledgeSerial: ld b, 10 .loop call DelayFrame @@ -2410,9 +2356,8 @@ Link_CheckCommunicationError: ; 29e0c dec b jr nz, .loop ret -; 29e53 -.ConvertDW: ; 29e53 +.ConvertDW: ; [wLinkTimeoutFrames] = ((hl - $100) / 4) + $100 ; = (hl / 4) + $c0 dec h @@ -2426,9 +2371,8 @@ Link_CheckCommunicationError: ; 29e0c ld a, l ld [wLinkTimeoutFrames + 1], a ret -; 29e66 -TryQuickSave: ; 29e66 +TryQuickSave: ld a, [wd265] push af farcall Link_SaveGame @@ -2442,9 +2386,8 @@ TryQuickSave: ; 29e66 pop af ld [wd265], a ret -; 29e82 -CheckBothSelectedSameRoom: ; 29e82 +CheckBothSelectedSameRoom: ld a, [wd265] call Link_EnsureSync push af @@ -2469,9 +2412,8 @@ CheckBothSelectedSameRoom: ; 29e82 xor a ; FALSE ld [wScriptVar], a ret -; 29eaf -TimeCapsule: ; 29eaf +TimeCapsule: ld a, LINK_TIMECAPSULE ld [wLinkMode], a call DisableSpriteUpdates @@ -2480,9 +2422,8 @@ TimeCapsule: ; 29eaf xor a ld [hVBlank], a ret -; 29ec4 -TradeCenter: ; 29ec4 +TradeCenter: ld a, LINK_TRADECENTER ld [wLinkMode], a call DisableSpriteUpdates @@ -2491,9 +2432,8 @@ TradeCenter: ; 29ec4 xor a ld [hVBlank], a ret -; 29ed9 -Colosseum: ; 29ed9 +Colosseum: ld a, LINK_COLOSSEUM ld [wLinkMode], a call DisableSpriteUpdates @@ -2502,24 +2442,21 @@ Colosseum: ; 29ed9 xor a ld [hVBlank], a ret -; 29eee -CloseLink: ; 29eee +CloseLink: xor a ld [wLinkMode], a ld c, 3 call DelayFrames jp Link_ResetSerialRegistersAfterLinkClosure -; 29efa -FailedLinkToPast: ; 29efa +FailedLinkToPast: ld c, 40 call DelayFrames ld a, $e jp Link_EnsureSync -; 29f04 -Link_ResetSerialRegistersAfterLinkClosure: ; 29f04 +Link_ResetSerialRegistersAfterLinkClosure: ld c, 3 call DelayFrames ld a, CONNECTION_NOT_ESTABLISHED @@ -2530,9 +2467,8 @@ Link_ResetSerialRegistersAfterLinkClosure: ; 29f04 ld [hSerialReceive], a ld [rSC], a ret -; 29f17 -Link_EnsureSync: ; 29f17 +Link_EnsureSync: add $d0 ld [wPlayerLinkAction], a ld [wcf57], a @@ -2559,9 +2495,8 @@ Link_EnsureSync: ; 29f17 ld a, b and $f ret -; 29f47 -CableClubCheckWhichChris: ; 29f47 +CableClubCheckWhichChris: ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK ld a, TRUE @@ -2571,11 +2506,9 @@ CableClubCheckWhichChris: ; 29f47 .yes ld [wScriptVar], a ret -; 29f54 -Unreferenced_Gen1LinkCommsBorderGFX: ; 29f54 +Unreferenced_Gen1LinkCommsBorderGFX: INCBIN "gfx/trade/unused_gen_1_border_tiles.2bpp" -; 29fe4 Unreferenced_Function29fe4: ld a, BANK(sPartyMail) diff --git a/engine/link/link_2.asm b/engine/link/link_2.asm index e2fe47dc5..9406e43bb 100644 --- a/engine/link/link_2.asm +++ b/engine/link/link_2.asm @@ -1,4 +1,4 @@ -LinkMonStatsScreen: ; 4d319 +LinkMonStatsScreen: ld a, [wMenuCursorY] dec a ld [wCurPartyMon], a @@ -17,12 +17,12 @@ LinkMonStatsScreen: ; 4d319 call WaitBGMap2 ret -Link_WaitBGMap: ; 4d354 +Link_WaitBGMap: call WaitBGMap call WaitBGMap2 ret -LinkTextbox2: ; 4d35b +LinkTextbox2: ld h, d ld l, e push bc @@ -52,9 +52,8 @@ LinkTextbox2: ; 4d35b dec b jr nz, .row ret -; 4d37e -.PlaceBorder: ; 4d37e +.PlaceBorder: push hl ld a, $76 ld [hli], a @@ -67,26 +66,25 @@ LinkTextbox2: ; 4d35b add hl, de .loop push hl - ld a, "┌" + ld a, $79 ld [hli], a ld a, " " call .PlaceRow - ld [hl], "─" + ld [hl], $7a pop hl ld de, SCREEN_WIDTH add hl, de dec b jr nz, .loop - ld a, "┐" + ld a, $7b ld [hli], a - ld a, "│" + ld a, $7c call .PlaceRow - ld [hl], "└" + ld [hl], $7d ret -; 4d3ab -.PlaceRow: ; 4d3ab +.PlaceRow: ld d, c .row_loop ld [hli], a diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm index 4c2af0842..a3c596bfe 100644 --- a/engine/link/link_trade.asm +++ b/engine/link/link_trade.asm @@ -1,24 +1,21 @@ LinkCommsBorderGFX: INCBIN "gfx/trade/border_tiles.2bpp" -; 16d421 -__LoadTradeScreenBorder: ; 16d421 +__LoadTradeScreenBorder: ld de, LinkCommsBorderGFX ld hl, vTiles2 lb bc, BANK(LinkCommsBorderGFX), 70 call Get2bpp ret -; 16d42e -Function16d42e: ; 16d42e +Function16d42e: ld hl, Tilemap_MobileTradeBorderFullscreen decoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret -; 16d43b -Function16d43b: ; 16d43b +Function16d43b: call LoadStandardMenuHeader call ClearBGPalettes call ClearTileMap @@ -32,7 +29,6 @@ Function16d43b: ; 16d43b call JoyWaitAorB call Call_ExitMenu ret -; 16d465 Tilemap_MobileTradeBorderFullscreen: INCBIN "gfx/trade/border_mobile_fullscreen.tilemap" @@ -43,7 +39,7 @@ INCBIN "gfx/trade/border_cable_top.tilemap" Tilemap_CableTradeBorderBottom: INCBIN "gfx/trade/border_cable_bottom.tilemap" -_LinkTextbox: ; 16d61d +_LinkTextbox: ld h, d ld l, e push bc @@ -73,9 +69,8 @@ _LinkTextbox: ; 16d61d dec b jr nz, .row ret -; 16d640 -.PlaceBorder ; 16d640 +.PlaceBorder push hl ld a, $30 ld [hli], a @@ -105,18 +100,16 @@ _LinkTextbox: ; 16d61d call .PlaceRow ld [hl], $37 ret -; 16d66d -.PlaceRow ; 16d66d +.PlaceRow ld d, c .row_loop ld [hli], a dec d jr nz, .row_loop ret -; 16d673 -InitTradeSpeciesList: ; 16d673 +InitTradeSpeciesList: call _LoadTradeScreenBorder call Function16d6ae farcall InitMG_Mobile_LinkTradePalMap @@ -125,32 +118,26 @@ InitTradeSpeciesList: ; 16d673 ld de, .CANCEL call PlaceString ret -; 16d68f -.CANCEL: ; 16d68f +.CANCEL: db "CANCEL@" -; 16d696 -_LoadTradeScreenBorder: ; 16d696 +_LoadTradeScreenBorder: call __LoadTradeScreenBorder ret -; 16d69a - -LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a +LinkComms_LoadPleaseWaitTextboxBorderGFX: ld de, LinkCommsBorderGFX + $30 tiles ld hl, vTiles2 tile $76 lb bc, BANK(LinkCommsBorderGFX), 8 call Get2bpp ret -; 16d6a7 -LoadTradeRoomBGPals_: ; 16d6a7 +LoadTradeRoomBGPals_: farcall LoadTradeRoomBGPals ret -; 16d6ae -Function16d6ae: ; 16d6ae +Function16d6ae: call Function16d42e ld hl, Tilemap_CableTradeBorderTop decoord 0, 0 @@ -161,23 +148,20 @@ Function16d6ae: ; 16d6ae ld bc, 2 * SCREEN_WIDTH call CopyBytes ret -; 16d6ca -LinkTextbox: ; 16d6ca +LinkTextbox: call _LinkTextbox ret -; 16d6ce -Function16d6ce: ; 16d6ce +Function16d6ce: call LoadStandardMenuHeader call Function16d6e1 farcall WaitLinkTransfer call Call_ExitMenu call WaitBGMap2 ret -; 16d6e1 -Function16d6e1: ; 16d6e1 +Function16d6e1: hlcoord 4, 10 ld b, 1 ld c, 10 @@ -189,19 +173,16 @@ Function16d6e1: ; 16d6e1 call WaitBGMap2 ld c, 50 jp DelayFrames -; 16d701 -.Waiting: ; 16d701 +.Waiting: db "WAITING..!@" -; 16d70c -LinkTradeMenu: ; 16d70c +LinkTradeMenu: call .MenuAction call .GetJoypad ret -; 16d713 -.GetJoypad: ; 16d713 +.GetJoypad: push bc push af ld a, [hJoyLast] @@ -216,9 +197,8 @@ LinkTradeMenu: ; 16d70c pop bc ld d, a ret -; 16d725 -.MenuAction: ; 16d725 +.MenuAction: ld hl, w2DMenuFlags2 res 7, [hl] ld a, [hBGMapMode] @@ -246,9 +226,8 @@ LinkTradeMenu: ; 16d70c .done ret -; 16d759 -.UpdateBGMapAndOAM: ; 16d759 +.UpdateBGMapAndOAM: ld a, [hOAMUpdate] push af ld a, $1 @@ -269,9 +248,8 @@ LinkTradeMenu: ; 16d70c jr z, .loop2 and a ret -; 16d77a -.UpdateCursor: ; 16d77a +.UpdateCursor: ld hl, wCursorCurrentTile ld a, [hli] ld h, [hl] @@ -346,9 +324,8 @@ LinkTradeMenu: ; 16d70c ld a, h ld [wCursorCurrentTile + 1], a ret -; 16d7e7 -.TryAnims: ; 16d7e7 +.TryAnims: ld a, [w2DMenuFlags1] bit 6, a jr z, .skip_anims @@ -360,4 +337,3 @@ LinkTradeMenu: ; 16d70c ret z scf ret -; 16d7fe diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 4aed9ee70..0a5dfcec3 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -1,4 +1,4 @@ -DoMysteryGift: ; 1048ba (41:48ba) +DoMysteryGift: call ClearTileMap call ClearSprites call WaitBGMap @@ -98,84 +98,74 @@ DoMysteryGift: ; 1048ba (41:48ba) ld hl, .Text_Sent ; sent item jr .PrintTextAndExit -.LinkCanceled: ; 1049af (41:49af) +.LinkCanceled: ld hl, .Text_LinkCanceled ; Link has been canceled jr .PrintTextAndExit -.CommunicationError: ; 1049b4 (41:49b4) +.CommunicationError: ld hl, .Text_CommunicationError ; Communication error call PrintText jp DoMysteryGift -.GiftWaiting: ; 1049bd (41:49bd) +.GiftWaiting: ld hl, .Text_ReceiveGiftAtCounter ; receive gift at counter jr .PrintTextAndExit -.FriendNotReady: ; 1049c2 (41:49c2) +.FriendNotReady: ld hl, .Text_FriendNotReady ; friend not ready -.PrintTextAndExit: ; 1049c5 (41:49c5) +.PrintTextAndExit: call PrintText ld a, LCDC_DEFAULT ld [rLCDC], a ret -; 1049cd (41:49cd) -.String_PressAToLink_BToCancel: ; 1049cd +.String_PressAToLink_BToCancel: db "Press A to" next "link IR-Device" next "Press B to" next "cancel it." db "@" -; 1049fd -.Text_LinkCanceled: ; 1049fd +.Text_LinkCanceled: text_jump UnknownText_0x1c0436 db "@" -; 104a02 -.Text_CommunicationError: ; 104a02 +.Text_CommunicationError: text_jump UnknownText_0x1c0454 db "@" -; 104a07 -.Text_ReceiveGiftAtCounter: ; 104a07 +.Text_ReceiveGiftAtCounter: text_jump UnknownText_0x1c046a db "@" -; 104a0c -.Text_FriendNotReady: ; 104a0c +.Text_FriendNotReady: text_jump UnknownText_0x1c048e db "@" -; 104a11 -.Text_MaxFiveGifts: ; 104a11 +.Text_MaxFiveGifts: text_jump UnknownText_0x1c04a7 db "@" -; 104a16 -.Text_MaxOneGiftPerPerson: ; 104a16 +.Text_MaxOneGiftPerPerson: text_jump UnknownText_0x1c04c6 db "@" -; 104a1b -.Text_Sent: ; 104a1b +.Text_Sent: text_jump UnknownText_0x1c04e9 db "@" -; 104a20 -.Text_SentToHome: ; 104a20 +.Text_SentToHome: text_jump UnknownText_0x1c04fa db "@" -; 104a25 -.CheckAlreadyGotFiveGiftsToday: ; 104a25 (41:4a25) +.CheckAlreadyGotFiveGiftsToday: call GetMysteryGiftBank ld a, [sNumDailyMysteryGiftPartnerIDs] cp $5 jp CloseSRAM -.CheckAlreadyGotAGiftFromThatPerson: ; 104a30 (41:4a30) +.CheckAlreadyGotAGiftFromThatPerson: call GetMysteryGiftBank ld a, [wMysteryGiftPartnerID] ld b, a @@ -203,7 +193,7 @@ DoMysteryGift: ; 1048ba (41:48ba) .No: jp CloseSRAM -.AddMysteryGiftPartnerID: ; 104a56 (41:4a56) +.AddMysteryGiftPartnerID: call GetMysteryGiftBank ld hl, sNumDailyMysteryGiftPartnerIDs ld a, [hl] @@ -219,7 +209,7 @@ DoMysteryGift: ; 1048ba (41:48ba) ld [hl], a jp CloseSRAM -.SaveMysteryGiftTrainerName: ; 104a71 (41:4a71) +.SaveMysteryGiftTrainerName: call GetMysteryGiftBank ld a, $1 ld [sMysteryGiftTrainerHouseFlag], a @@ -235,7 +225,7 @@ DoMysteryGift: ; 1048ba (41:48ba) call CopyBytes jp CloseSRAM -Function104a95: ; 104a95 (41:4a95) +Function104a95: di farcall ClearChannels call Function104d5e @@ -305,10 +295,10 @@ Function104a95: ; 104a95 (41:4a95) ld [hMGStatusFlags], a jp Function104bd0 -Function104b04: ; 104b04 (41:4b04) +Function104b04: call Function104b40 jp nz, Function104bd0 -Function104b0a: ; 104b0a (41:4b0a) +Function104b0a: call Function104d38 jp nz, Function104bd0 call Function104b88 @@ -318,7 +308,7 @@ Function104b0a: ; 104b0a (41:4b0a) call Function105033 jp Function104bd0 -Function104b22: ; 104b22 (41:4b22) +Function104b22: call Function104b88 jp nz, Function104bd0 call Function104d43 @@ -330,13 +320,13 @@ Function104b22: ; 104b22 (41:4b22) call Function10502e jp Function104bd0 -Function104b40: ; 104b40 (41:4b40) +Function104b40: ld hl, hPrintNum1 ld b, $1 call Function104d56 ret nz -Function104b49: ; 104b49 (41:4b49) +Function104b49: call Function105033 ld a, [hMGStatusFlags] cp $6c @@ -368,7 +358,7 @@ Function104b49: ; 104b49 (41:4b49) cp $6c ret -Function104b88: ; 104b88 (41:4b88) +Function104b88: ld a, $96 ld [hPrintNum1], a ld hl, hPrintNum1 @@ -404,7 +394,7 @@ Function104b88: ; 104b88 (41:4b88) cp $6c ret -Function104bd0: ; 104bd0 (41:4bd0) +Function104bd0: nop ld a, [hMGStatusFlags] cp $10 @@ -451,7 +441,7 @@ Function104bd0: ; 104bd0 (41:4bd0) pop af ret -Function104c2d: ; 104c2d (41:4c2d) +Function104c2d: di farcall ClearChannels call Function104d5e @@ -488,7 +478,7 @@ Function104c2d: ; 104c2d (41:4c2d) call Function10502e jp Function104d1c -Function104c8a: ; 104c8a (41:4c8a) +Function104c8a: ld hl, hPrintNum1 ld b, $1 call Function104d56 @@ -524,7 +514,7 @@ Function104c8a: ; 104c8a (41:4c8a) cp $6c ret -Function104cd2: ; 104cd2 (41:4cd2) +Function104cd2: ld a, $3c ld [hPrintNum1], a ld hl, hPrintNum1 @@ -561,7 +551,7 @@ Function104cd2: ; 104cd2 (41:4cd2) cp $6c ret -Function104d1c: ; 104d1c (41:4d1c) +Function104d1c: nop ld a, [hMGStatusFlags] push af @@ -576,39 +566,39 @@ Function104d1c: ; 104d1c (41:4d1c) pop af ret -Function104d32: ; 104d32 (41:4d32) +Function104d32: ld a, $80 ld [hMGStatusFlags], a and a ret -Function104d38: ; 104d38 (41:4d38) +Function104d38: call Function104d96 call Function104e46 ld a, [hMGStatusFlags] cp $6c ret -Function104d43: ; 104d43 (41:4d43) +Function104d43: call Function104d96 call Function104dfe ld a, [hMGStatusFlags] cp $6c ret -Function104d4e: ; 104d4e (41:4d4e) +Function104d4e: call Function104e93 ld a, [hMGStatusFlags] cp $6c ret -Function104d56: ; 104d56 (41:4d56) +Function104d56: call Function104f57 ld a, [hMGStatusFlags] cp $6c ret -Function104d5e: ; 104d5e (41:4d5e) +Function104d5e: call Function104d74 ld a, $4 ld [rIE], a @@ -624,7 +614,7 @@ Function104d5e: ; 104d5e (41:4d5e) jr nz, .asm_104d6d ret -Function104d74: ; 104d74 (41:4d74) +Function104d74: xor a ld [rTAC], a ld a, $fe @@ -636,7 +626,7 @@ Function104d74: ; 104d74 (41:4d74) ld [rTAC], a ret -Function104d86: ; 104d86 (41:4d86) +Function104d86: xor a ld [rTAC], a ld [rTMA], a @@ -647,21 +637,21 @@ Function104d86: ; 104d86 (41:4d86) ld [rTAC], a ret -Function104d96: ; 104d96 (41:4d96) +Function104d96: ld a, $c0 call Function104e8c ld a, $1 ld [hPrintNum9], a ret -Function104da0: ; 104da0 (41:4da0) +Function104da0: xor a call Function104e8c ld a, $2 ld [rTAC], a ret -Function104da9: ; 104da9 (41:4da9) +Function104da9: inc d ret z xor a @@ -673,7 +663,7 @@ Function104da9: ; 104da9 (41:4da9) or a ret -Function104db7: ; 104db7 (41:4db7) +Function104db7: inc d ret z xor a @@ -685,7 +675,7 @@ Function104db7: ; 104db7 (41:4db7) or a ret -Function104dc5: ; 104dc5 (41:4dc5) +Function104dc5: ld a, $c1 ld [$ff00+c], a .wait @@ -696,7 +686,7 @@ Function104dc5: ; 104dc5 (41:4dc5) halt jr .wait -Function104dd1: ; 104dd1 (41:4dd1) +Function104dd1: ld a, $c0 ld [$ff00+c], a .wait @@ -707,7 +697,7 @@ Function104dd1: ; 104dd1 (41:4dd1) halt jr .wait -Function104ddd: ; 104ddd (41:4ddd) +Function104ddd: ld d, $0 ld e, d ld a, $1 @@ -730,7 +720,7 @@ Function104ddd: ; 104ddd (41:4ddd) and b jr nz, .loop -Function104dfe: ; 104dfe (41:4dfe) +Function104dfe: ld c, LOW(rRP) ld d, $0 ld e, d @@ -757,7 +747,7 @@ Function104dfe: ; 104dfe (41:4dfe) call Function104dd1 ret -Function104e3a: ; 104e3a (41:4e3a) +Function104e3a: ; Wait a random amount of time call Random ld e, a @@ -768,7 +758,7 @@ Function104e3a: ; 104e3a (41:4e3a) ld a, d or e jr nz, .loop -Function104e46: ; 104e46 (41:4e46) +Function104e46: ld a, $2 ld [hPrintNum9], a ld c, LOW(rRP) @@ -800,13 +790,13 @@ Function104e46: ; 104e46 (41:4e46) ld [hMGStatusFlags], a ret -Function104e8c: ; 104e8c (41:4e8c) +Function104e8c: ld [rRP], a ld a, $ff ld [hMGStatusFlags], a ret -Function104e93: ; 104e93 (41:4e93) +Function104e93: xor a ld [hPrintNum5], a ld [hPrintNum6], a @@ -843,7 +833,7 @@ Function104e93: ; 104e93 (41:4e93) pop hl ret -Function104ed6: ; 104ed6 (41:4ed6) +Function104ed6: ld c, LOW(rRP) ld d, $5 call Function104dd1 @@ -910,25 +900,25 @@ Function104ed6: ; 104ed6 (41:4ed6) call Function104dd1 ret -Function104f42: ; 104f42 (41:4f42) +Function104f42: ld a, [hMGStatusFlags] or $2 ld [hMGStatusFlags], a ret -Function104f49: ; 104f49 (41:4f49) +Function104f49: ld a, [hMGStatusFlags] or $1 ld [hMGStatusFlags], a ret -Function104f50: ; 104f50 (41:4f50) +Function104f50: ld a, [hMGStatusFlags] or $80 ld [hMGStatusFlags], a ret -Function104f57: ; 104f57 (41:4f57) +Function104f57: xor a ld [hPrintNum5], a ld [hPrintNum6], a @@ -980,7 +970,7 @@ Function104f57: ; 104f57 (41:4f57) ld [hPrintNum6], a ret -Function104faf: ; 104faf (41:4faf) +Function104faf: ld c, LOW(rRP) ld d, $0 call Function104db7 @@ -1059,15 +1049,15 @@ Function104faf: ; 104faf (41:4faf) call Function104dd1 ret -Function10502e: ; 10502e (41:502e) +Function10502e: ld b, $0 jp Function104e93 -Function105033: ; 105033 (41:5033) +Function105033: ld b, $0 jp Function104f57 -MysteryGift_ReadJoypad: ; 105038 (41:5038) +MysteryGift_ReadJoypad: ; We can only get four inputs at a time. ; We take d-pad first for no particular reason. ld a, R_DPAD @@ -1112,7 +1102,7 @@ endr ld [rJOYP], a ret -MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) +MysteryGift_CheckAndSetDecorationAlreadyReceived: call GetMysteryGiftBank ld d, $0 ld b, CHECK_FLAG @@ -1134,7 +1124,7 @@ MysteryGift_CheckAndSetDecorationAlreadyReceived: ; 105069 (41:5069) xor a ret -MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) +MysteryGift_CopyReceivedDecosToPC: call GetMysteryGiftBank ld c, $0 .loop @@ -1157,7 +1147,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091) jr c, .loop jp CloseSRAM -UnlockMysteryGift: ; 1050b9 +UnlockMysteryGift: call GetMysteryGiftBank ld hl, sMysteryGiftUnlocked ld a, [hl] @@ -1167,9 +1157,8 @@ UnlockMysteryGift: ; 1050b9 ld [hl], a .ok jp CloseSRAM -; 1050c8 -Function1050c8: ; 1050c8 +Function1050c8: call GetMysteryGiftBank ld a, [sNumDailyMysteryGiftPartnerIDs] cp $ff @@ -1178,10 +1167,8 @@ Function1050c8: ; 1050c8 ld [sNumDailyMysteryGiftPartnerIDs], a .okay jp CloseSRAM -; 1050d9 - -BackupMysteryGift: ; 1050d9 +BackupMysteryGift: call GetMysteryGiftBank ld hl, sMysteryGiftItem ld de, sBackupMysteryGiftItem @@ -1191,10 +1178,8 @@ BackupMysteryGift: ; 1050d9 ld a, [hl] ld [de], a jp CloseSRAM -; 1050ea - -RestoreMysteryGift: ; 1050ea (41:50ea) +RestoreMysteryGift: call GetMysteryGiftBank ld hl, sBackupMysteryGiftItem ld de, sMysteryGiftItem @@ -1205,7 +1190,7 @@ RestoreMysteryGift: ; 1050ea (41:50ea) ld [de], a jp CloseSRAM -MysteryGift_ClearTrainerData: ; 1050fb (41:50fb) +MysteryGift_ClearTrainerData: ld hl, wMysteryGiftTrainerData xor a ld b, wMysteryGiftTrainerDataEnd - wMysteryGiftTrainerData @@ -1215,14 +1200,11 @@ MysteryGift_ClearTrainerData: ; 1050fb (41:50fb) jr nz, .loop ret - -GetMysteryGiftBank: ; 105106 +GetMysteryGiftBank: ld a, BANK(sBackupMysteryGiftItem) jp GetSRAMBank -; 10510b - -StagePartyDataForMysteryGift: ; 10510b (41:510b) +StagePartyDataForMysteryGift: ; You will be sending this data to your mystery gift partner. ; Structure is the same as a trainer with species and moves ; defined. @@ -1273,7 +1255,7 @@ StagePartyDataForMysteryGift: ; 10510b (41:510b) ld [wca00], a jp CloseSRAM -InitMysteryGiftLayout: ; 105153 (41:5153) +InitMysteryGiftLayout: call ClearBGPalettes call DisableLCD ld hl, MysteryGiftGFX @@ -1364,37 +1346,36 @@ InitMysteryGiftLayout: ; 105153 (41:5153) call SetPalettes ret -.Load5GFX: ; 10522e (41:522e) +.Load5GFX: ld b, 5 jr .gfx_loop -; 105232 (41:5232) .Unreferenced_Load6GFX: ld b, 6 jr .gfx_loop -.Load16GFX: ; 105236 (41:5236) +.Load16GFX: ld b, 16 -.gfx_loop ; 105238 (41:5238) +.gfx_loop ld [hli], a inc a dec b jr nz, .gfx_loop ret -.Load9Column: ; 10523e (41:523e) +.Load9Column: ld b, 9 jr .col_loop -.Load11Column: ; 105242 (41:5242) +.Load11Column: ld b, 11 jr .col_loop -.Load14Column: ; 105246 (41:5246) +.Load14Column: ld b, 14 -.col_loop ; 105248 (41:5248) +.col_loop ld [hl], a ld de, SCREEN_WIDTH add hl, de @@ -1402,7 +1383,7 @@ InitMysteryGiftLayout: ; 105153 (41:5153) jr nz, .col_loop ret -.Load16Row: ; 105251 (41:5251) +.Load16Row: ld b, 16 .row_loop ld [hli], a @@ -1410,11 +1391,11 @@ InitMysteryGiftLayout: ; 105153 (41:5153) jr nz, .row_loop ret -MysteryGiftGFX: ; 105258 +MysteryGiftGFX: INCBIN "gfx/mystery_gift/mystery_gift.2bpp" .End -Function105688: ; 105688 (41:5688) +Function105688: call ClearTileMap call ClearSprites call WaitBGMap @@ -1455,7 +1436,7 @@ Function105688: ; 105688 (41:5688) ld hl, Text_ListedCardAsNumber jr PrintTextAndExit_JP -Function1056eb: ; 1056eb (41:56eb) +Function1056eb: ld c, 16 .loop ld hl, wVirtualOAMSprite00YCoord @@ -1484,55 +1465,51 @@ endr pop bc jr .loop -Function105712: ; 105712 (41:5712) +Function105712: call Function105777 ld hl, Text_MGLinkCanceled jr PrintTextAndExit_JP -Function10571a: ; 10571a (41:571a) +Function10571a: call Function105777 ld hl, Text_MGCommError call PrintText jp Function105688 -PrintTextAndExit_JP: ; 105726 (41:5726) +PrintTextAndExit_JP: call PrintText ld a, LCDC_DEFAULT ld [rLCDC], a ret -; 10572e (41:572e) -String_PressAToLink_BToCancel_JP: ; 10572e +String_PressAToLink_BToCancel_JP: db "エーボタン<WO>おすと" next "つうしん<PKMN>おこなわれるよ!" next "ビーボタン<WO>おすと" next "つうしん<WO>ちゅうし します" db "@" -; 10575e - -Text_ReceivedCard: ; 10575e +Text_ReceivedCard: text_jump UnknownText_0x1c051a db "@" -Text_ListedCardAsNumber: ; 105763 +Text_ListedCardAsNumber: text_jump UnknownText_0x1c0531 db "@" -Text_CardNotRegistered: ; 105768 +Text_CardNotRegistered: text_jump UnknownText_0x1c0555 db "@" -Text_MGLinkCanceled: ; 10576d +Text_MGLinkCanceled: text_jump UnknownText_0x1c0573 db "@" -Text_MGCommError: ; 105772 +Text_MGCommError: text_jump UnknownText_0x1c0591 db "@" -; 105777 -Function105777: ; 105777 (41:5777) +Function105777: call ClearSprites call ClearTileMap call EnableLCD @@ -1542,7 +1519,7 @@ Function105777: ; 105777 (41:5777) call SetPalettes ret -Function10578c: ; 10578c (41:578c) +Function10578c: ld de, wLinkData ld a, BANK(sPlayerData) call GetSRAMBank @@ -1572,7 +1549,7 @@ Function10578c: ; 10578c (41:578c) call CloseSRAM ret -Function1057d7: ; 1057d7 (41:57d7) +Function1057d7: call ClearBGPalettes call DisableLCD ld hl, MysteryGiftJP_GFX @@ -1666,36 +1643,36 @@ Function1057d7: ; 1057d7 (41:57d7) farcall GetMysteryGift_MobileAdapterLayout jp SetPalettes -.Load6Row: ; 1058c6 (41:58c6) +.Load6Row: ld b, 6 jr .row_loop -.Load11Row: ; 1058ca (41:58ca) +.Load11Row: ld b, 11 jr .row_loop -.Load12Row: ; 1058ce (41:58ce) +.Load12Row: ld b, 12 -.row_loop ; 1058d0 (41:58d0) +.row_loop ld [hli], a inc a dec b jr nz, .row_loop ret -.Load9Column: ; 1058d6 (41:58d6) +.Load9Column: ld b, 9 jr .column_loop -.Load11Column: ; 1058da (41:58da) +.Load11Column: ld b, 11 jr .column_loop -.Load14Column: ; 1058de (41:58de) +.Load14Column: ld b, 14 -.column_loop ; 1058e0 (41:58e0) +.column_loop ld [hl], a ld de, SCREEN_WIDTH add hl, de @@ -1703,16 +1680,15 @@ Function1057d7: ; 1057d7 (41:57d7) jr nz, .column_loop ret -.Load16Row: ; 1058e9 (41:58e9) +.Load16Row: ld b, 16 .row_loop_no_inc ld [hli], a dec b jr nz, .row_loop_no_inc ret -; 1058f0 (41:58f0) -.OAM_data: ; 1058f0 +.OAM_data: dsprite 2, 1, 6, 4, $00, 0 dsprite 2, 1, 7, 4, $01, 0 dsprite 2, 1, 8, 4, $02, 0 @@ -1731,5 +1707,5 @@ Function1057d7: ; 1057d7 (41:57d7) dsprite 1, 1, 14, 4, $07, 0 ; japanese mystery gift gfx -MysteryGiftJP_GFX: ; 105930 +MysteryGiftJP_GFX: INCBIN "gfx/mystery_gift/mystery_gift_jp.2bpp" diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm index e0e2e88fd..c1b258724 100644 --- a/engine/link/mystery_gift_2.asm +++ b/engine/link/mystery_gift_2.asm @@ -1,4 +1,4 @@ -PrepMysteryGiftDataToSend: ; 2c642 (b:4642) +PrepMysteryGiftDataToSend: ld de, wMysteryGiftStaging ld a, $1 ld [de], a @@ -56,7 +56,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) ld bc, wMysteryGiftPlayerDataEnd - wMysteryGiftPlayerData jp CopyBytes -.RandomSample: ; 2c6ac (b:46ac) +.RandomSample: push de call Random cp 10 percent @@ -121,7 +121,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) pop de ret -MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708) +MysteryGiftGetItemHeldEffect: ld a, c cp MysteryGiftItems.End - MysteryGiftItems jr nc, MysteryGiftFallbackItem @@ -131,7 +131,7 @@ MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708) ld c, [hl] ret -MysteryGiftGetDecoration: ; 2c715 (b:4715) +MysteryGiftGetDecoration: ld a, c cp MysteryGiftDecos.End - MysteryGiftDecos jr nc, MysteryGiftFallbackItem @@ -141,11 +141,9 @@ MysteryGiftGetDecoration: ; 2c715 (b:4715) ld c, [hl] ret -MysteryGiftFallbackItem: ; 2c722 (b:4722) +MysteryGiftFallbackItem: ld c, DECO_POLKADOT_BED ; GREAT_BALL ret -; 2c725 (b:4725) - INCLUDE "data/items/mystery_gift_items.asm" diff --git a/engine/link/place_waiting_text.asm b/engine/link/place_waiting_text.asm index 9b2260722..147683042 100644 --- a/engine/link/place_waiting_text.asm +++ b/engine/link/place_waiting_text.asm @@ -1,4 +1,4 @@ -PlaceWaitingText:: ; 4000 +PlaceWaitingText:: hlcoord 3, 10 ld b, 1 ld c, 11 @@ -20,5 +20,5 @@ PlaceWaitingText:: ; 4000 ld c, 50 jp DelayFrames -.Waiting: ; 4025 +.Waiting: db "Waiting...!@" diff --git a/engine/link/time_capsule.asm b/engine/link/time_capsule.asm index f90b7e249..195062c1e 100644 --- a/engine/link/time_capsule.asm +++ b/engine/link/time_capsule.asm @@ -1,6 +1,6 @@ ; These functions seem to be related to backwards compatibility -ValidateOTTrademon: ; fb57e +ValidateOTTrademon: ld a, [wd003] ld hl, wOTPartyMon1Species call GetPartyLocation @@ -63,9 +63,8 @@ ValidateOTTrademon: ; fb57e .abnormal scf ret -; fb5dd -Functionfb5dd: ; fb5dd +Functionfb5dd: ld a, [wd002] ld d, a ld a, [wPartyCount] @@ -100,9 +99,8 @@ Functionfb5dd: ; fb5dd .done and a ret -; fb60d -PlaceTradePartnerNamesAndParty: ; fb60d +PlaceTradePartnerNamesAndParty: hlcoord 4, 0 ld de, wPlayerName call PlaceString @@ -118,7 +116,7 @@ PlaceTradePartnerNamesAndParty: ; fb60d call .PlaceSpeciesNames hlcoord 7, 9 ld de, wOTPartySpecies -.PlaceSpeciesNames: ; fb634 +.PlaceSpeciesNames: ld c, $0 .loop ld a, [de] @@ -142,6 +140,5 @@ PlaceTradePartnerNamesAndParty: ; fb60d pop bc inc c jr .loop -; fb656 INCLUDE "data/pokemon/gen1_base_special.asm" diff --git a/engine/link/time_capsule_2.asm b/engine/link/time_capsule_2.asm index a56e51785..be7027f34 100644 --- a/engine/link/time_capsule_2.asm +++ b/engine/link/time_capsule_2.asm @@ -1,4 +1,4 @@ -ConvertMon_2to1: ; fb8f1 +ConvertMon_2to1: ; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265. push bc push hl @@ -16,9 +16,8 @@ ConvertMon_2to1: ; fb8f1 pop hl pop bc ret -; fb908 -ConvertMon_1to2: ; fb908 +ConvertMon_1to2: ; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265. push bc push hl @@ -33,7 +32,5 @@ ConvertMon_1to2: ; fb908 pop hl pop bc ret -; fb91c - INCLUDE "data/pokemon/gen1_order.asm" diff --git a/engine/math/get_square_root.asm b/engine/math/get_square_root.asm index 412fd04ff..6791fd7b8 100644 --- a/engine/math/get_square_root.asm +++ b/engine/math/get_square_root.asm @@ -1,6 +1,6 @@ NUM_SQUARE_ROOTS EQU 255 -GetSquareRoot: ; 13b87 +GetSquareRoot: ; Return the square root of de in b. ; Rather than calculating the result, we take the index of the @@ -24,7 +24,7 @@ GetSquareRoot: ; 13b87 jr c, .loop ret -.Squares: ; 13b98 +.Squares: x = 1 rept NUM_SQUARE_ROOTS dw x * x diff --git a/engine/math/math.asm b/engine/math/math.asm index 0cd6b0b47..c2e5f70a3 100644 --- a/engine/math/math.asm +++ b/engine/math/math.asm @@ -1,5 +1,4 @@ -_Multiply:: ; 66de - +_Multiply:: ; hMultiplier is one byte. ld a, 8 ld b, a @@ -11,7 +10,6 @@ _Multiply:: ; 66de ld [hMathBuffer + 3], a ld [hMathBuffer + 4], a - .loop ld a, [hMultiplier] srl a @@ -46,7 +44,6 @@ _Multiply:: ; 66de dec b jr z, .done - ; hMultiplicand <<= 1 ld a, [hMultiplicand + 2] @@ -67,7 +64,6 @@ _Multiply:: ; 66de jr .loop - .done ld a, [hMathBuffer + 4] ld [hProduct + 3], a @@ -82,10 +78,8 @@ _Multiply:: ; 66de ld [hProduct + 0], a ret -; 673e - -_Divide:: ; 673e +_Divide:: xor a ld [hMathBuffer + 0], a ld [hMathBuffer + 1], a @@ -193,4 +187,3 @@ _Divide:: ; 673e ld [hDividend + 0], a ret -; 67c1 diff --git a/engine/math/print_num.asm b/engine/math/print_num.asm index fec798d5c..c8899be6c 100644 --- a/engine/math/print_num.asm +++ b/engine/math/print_num.asm @@ -1,4 +1,4 @@ -_PrintNum:: ; c4c7 +_PrintNum:: ; Print c digits of the b-byte value from de to hl. ; Allows 2 to 7 digits. For 1-digit numbers, add ; the value to char "0" instead of calling PrintNum. @@ -178,7 +178,7 @@ _PrintNum:: ; c4c7 pop bc ret -.PrintYen: ; c5ba +.PrintYen: push af ld a, [hPrintNum1] and a @@ -193,7 +193,7 @@ _PrintNum:: ; c4c7 pop af ret -.PrintDigit: ; c5cb (3:45cb) +.PrintDigit: dec e jr nz, .ok ld a, "0" @@ -278,14 +278,14 @@ _PrintNum:: ; c4c7 ld [hl], "<DOT>" ret -.PrintLeadingZero: ; c644 +.PrintLeadingZero: ; prints a leading zero unless they are turned off in the flags bit 7, d ; print leading zeroes? ret z ld [hl], "0" ret -.AdvancePointer: ; c64a +.AdvancePointer: ; increments the pointer unless leading zeroes are not being printed, ; the number is left-aligned, and no nonzero digits have been printed yet bit 7, d ; print leading zeroes? diff --git a/engine/math/sine.asm b/engine/math/sine.asm index 23e86c015..c7422aaf8 100644 --- a/engine/math/sine.asm +++ b/engine/math/sine.asm @@ -1,4 +1,4 @@ -_Sine:: ; 84d9 +_Sine:: ; a = d * sin(e * pi/32) ld a, e calc_sine_wave diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm index d148af542..a48322488 100644 --- a/engine/menus/debug.asm +++ b/engine/menus/debug.asm @@ -22,7 +22,7 @@ const DEBUGTEST_E ; $7e const DEBUGTEST_F ; $7f -ColorTest: ; 818ac +ColorTest: ; A debug menu to test monster and trainer palettes at runtime. ld a, [hCGB] @@ -62,15 +62,14 @@ ColorTest: ; 818ac pop af ld [hInMenu], a ret -; 818f4 -Function818f4: ; 818f4 +Function818f4: ld a, [wd002] and a jr nz, Function81911 ld hl, PokemonPalettes -Function818fd: ; 818fd +Function818fd: ld de, wOverworldMapBlocks ld c, NUM_POKEMON + 1 .asm_81902 @@ -85,7 +84,7 @@ Function818fd: ; 818fd jr nz, .asm_81902 ret -Function81911: ; 81911 +Function81911: ld hl, TrainerPalettes ld de, wOverworldMapBlocks ld c, NUM_TRAINER_CLASSES @@ -100,9 +99,8 @@ Function81911: ; 81911 dec c jr nz, .asm_81919 ret -; 81928 -Function81928: ; 81928 +Function81928: ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes) call GetFarByte ld [de], a @@ -123,9 +121,8 @@ Function81928: ; 81928 ld [de], a inc de ret -; 81948 -Function81948: ; 81948 +Function81948: ld a, $1 ld [rVBK], a ld hl, vTiles0 @@ -148,9 +145,8 @@ Function81948: ; 81948 call ByteFill call ClearSprites ret -; 8197c -Function8197c: ; 8197c +Function8197c: ld hl, DebugColorTestGFX + 1 tiles ld de, vTiles2 tile DEBUGTEST_UP_ARROW ld bc, 22 tiles @@ -171,9 +167,8 @@ Function8197c: ; 8197c or b jr nz, .asm_8199d ret -; 819a7 -Function819a7: ; 819a7 +Function819a7: ld a, [hCGB] and a ret z @@ -214,16 +209,14 @@ Function819a7: ; 819a7 pop af ld [rSVBK], a ret -; 819f4 -Palette_DebugBG: ; 819f4 +Palette_DebugBG: INCLUDE "gfx/debug/bg.pal" -Palette_DebugOB: ; 81a34 +Palette_DebugOB: INCLUDE "gfx/debug/ob.pal" -; 81a74 -Function81a74: ; 81a74 +Function81a74: call JoyTextDelay ld a, [wJumptableIndex] cp $4 @@ -273,9 +266,8 @@ Function81a74: ; 81a74 ld a, $0 ld [wJumptableIndex], a ret -; 81ac3 -Function81ac3: ; 81ac3 +Function81ac3: ; Looping back around the pic set. ld a, [wd002] and a @@ -286,18 +278,16 @@ Function81ac3: ; 81ac3 .asm_81acc ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN ret -; 81acf -Jumptable_81acf: ; 81acf +Jumptable_81acf: dw Function81adb dw Function81c18 dw Function81c33 dw Function81cc2 dw Function81d8e dw Function81daf -; 81adb -Function81adb: ; 81adb +Function81adb: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -382,14 +372,12 @@ Function81adb: ; 81adb ld a, $1 ld [wJumptableIndex], a ret -; 81baf String_81baf: db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; rare (shiny) String_81bb4: db "ノーマル@" ; normal String_81bb9: db DEBUGTEST_A, "きりかえ▶@" ; (A) switches -; 81bc0 -Function81bc0: ; 81bc0 +Function81bc0: decoord 0, 11, wAttrMap hlcoord 2, 11 ld a, $1 @@ -402,7 +390,7 @@ Function81bc0: ; 81bc0 hlcoord 2, 15 ld a, $3 -Function81bde: ; 81bde +Function81bde: push af ld a, DEBUGTEST_UP_ARROW ld [hli], a @@ -415,9 +403,8 @@ Function81bde: ; 81bde ld bc, $28 call ByteFill ret -; 81bf4 -Function81bf4: ; 81bf4 +Function81bf4: ld a, [wcf66] inc a ld l, a @@ -435,9 +422,8 @@ Function81bf4: ; 81bf4 ld de, wc608 call Function81ea5 ret -; 81c18 -Function81c18: ; 81c18 +Function81c18: ld a, [hCGB] and a jr z, .asm_81c2a @@ -452,9 +438,8 @@ Function81c18: ; 81c18 ld a, $2 ld [wJumptableIndex], a ret -; 81c33 -Function81c33: ; 81c33 +Function81c33: ld a, [hCGB] and a jr z, .asm_81c69 @@ -511,9 +496,8 @@ Function81c33: ; 81c33 ld a, $3 ld [wJumptableIndex], a ret -; 81ca7 -Function81ca7: ; 81ca7 +Function81ca7: inc hl inc hl inc hl @@ -528,14 +512,13 @@ Function81ca7: ; 81ca7 ld a, [de] swap a -Function81cbc: ; 81cbc +Function81cbc: and $f add DEBUGTEST_0 ld [hld], a ret -; 81cc2 -Function81cc2: ; 81cc2 +Function81cc2: ld a, [hJoyLast] and B_BUTTON jr nz, .asm_81cdf @@ -574,16 +557,14 @@ Function81cc2: ; 81cc2 ld a, $0 ld [wJumptableIndex], a ret -; 81d02 -Jumptable_81d02: ; 81d02 +Jumptable_81d02: dw Function81d0a dw Function81d34 dw Function81d46 dw Function81d58 -; 81d0a -Function81d0a: ; 81d0a +Function81d0a: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -610,7 +591,7 @@ Function81d0a: ; 81d0a call Function81ea5 ret -Function81d34: ; 81d34 +Function81d34: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -621,7 +602,7 @@ Function81d34: ; 81d34 ld hl, wc608 + 10 jr Function81d63 -Function81d46: ; 81d46 +Function81d46: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -632,14 +613,14 @@ Function81d46: ; 81d46 ld hl, wc608 + 11 jr Function81d63 -Function81d58: ; 81d58 +Function81d58: ld hl, hJoyLast ld a, [hl] and D_UP jr nz, Function81d84 ld hl, wc608 + 12 -Function81d63: ; 81d63 +Function81d63: ld a, [hJoyLast] and D_RIGHT jr nz, Function81d70 @@ -648,37 +629,36 @@ Function81d63: ; 81d63 jr nz, Function81d77 ret -Function81d70: ; 81d70 +Function81d70: ld a, [hl] cp $1f ret nc inc [hl] jr Function81d7b -Function81d77: ; 81d77 +Function81d77: ld a, [hl] and a ret z dec [hl] -Function81d7b: ; 81d7b +Function81d7b: call Function81e67 ld a, $2 ld [wJumptableIndex], a ret -Function81d84: ; 81d84 +Function81d84: ld hl, wcf64 dec [hl] ret -Function81d89: ; 81d89 +Function81d89: ld hl, wcf64 inc [hl] ret -; 81d8e -Function81d8e: ; 81d8e +Function81d8e: hlcoord 0, 10 ld bc, $a0 ld a, DEBUGTEST_BLACK @@ -692,9 +672,8 @@ Function81d8e: ; 81d8e ld a, $5 ld [wJumptableIndex], a ret -; 81daf -Function81daf: ; 81daf +Function81daf: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -706,15 +685,13 @@ Function81daf: ; 81daf ld a, $0 ld [wJumptableIndex], a ret -; 81dc1 -Function81dc1: ; 81dc1 +Function81dc1: ld hl, wJumptableIndex set 7, [hl] ret -; 81dc7 -Function81dc7: ; 81dc7 +Function81dc7: ld hl, hJoyLast ld a, [hl] and D_UP @@ -749,9 +726,8 @@ Function81dc7: ; 81dc7 ld [wd004], a call Function81df4 ret -; 81df4 -Function81df4: ; 81df4 +Function81df4: hlcoord 10, 11 call Function81e5e hlcoord 10, 12 @@ -783,13 +759,11 @@ Function81df4: ; 81df4 hlcoord 10, 14 call PlaceString ret -; 81e46 String_81e46: db "おぼえられる@" ; can be taught String_81e4d: db "おぼえられない@" ; cannot be taught -; 81e55 -Function81e55: ; 81e55 +Function81e55: cp $32 jr c, .asm_81e5b inc a @@ -798,16 +772,14 @@ Function81e55: ; 81e55 .asm_81e5b add $bf ret -; 81e5e -Function81e5e: ; 81e5e +Function81e5e: ld bc, 10 ld a, DEBUGTEST_BLACK call ByteFill ret -; 81e67 -Function81e67: ; 81e67 +Function81e67: ld a, [wc608 + 10] and $1f ld e, a @@ -843,9 +815,8 @@ Function81e67: ; 81e67 ld a, d ld [wc608 + 1], a ret -; 81ea5 -Function81ea5: ; 81ea5 +Function81ea5: ld a, [de] and $1f ld [wc608 + 10], a @@ -867,9 +838,8 @@ Function81ea5: ; 81ea5 srl a ld [wc608 + 12], a ret -; 81eca -Function81eca: ; 81eca +Function81eca: ld a, [wcf66] inc a ld l, a @@ -884,9 +854,8 @@ Function81eca: ; 81eca ld bc, 4 call CopyBytes ret -; 81ee3 -Function81ee3: ; 81ee3 +Function81ee3: .asm_81ee3 ld a, LOW(PALRGB_WHITE) ld [hli], a @@ -910,9 +879,8 @@ Function81ee3: ; 81ee3 dec c jr nz, .asm_81ee3 ret -; 81efc -Bank20_FillBoxWithByte: ; 81efc +Bank20_FillBoxWithByte: ; For some reason, we have another copy of FillBoxWithByte here .row push bc @@ -928,9 +896,8 @@ Bank20_FillBoxWithByte: ; 81efc dec b jr nz, .row ret -; 81f0c -Function81f0c: ; 81f0c +Function81f0c: ld a, [wcfbe] push af set 7, a @@ -939,9 +906,8 @@ Function81f0c: ; 81f0c pop af ld [wcfbe], a ret -; 81f1d -Function81f1d: ; 81f1d +Function81f1d: ld a, [hl] and $7 ret z @@ -989,9 +955,8 @@ Function81f1d: ; 81f1d dec b jr nz, .asm_81f22 ret -; 81f5e -Function81f5e: ; 81f5e +Function81f5e: ld a, DEBUGTEST_BLACK hlcoord 10, 0 ld [hl], a @@ -1059,19 +1024,16 @@ Function81f5e: ; 81f5e .asm_81fc9 call ClearSprites ret -; 81fcd -String_81fcd: ; 81fcd +String_81fcd: db "おわりますか?" ; Are you finished? next "はい<DOT><DOT><DOT>", DEBUGTEST_A ; YES...(A) next "いいえ<DOT><DOT>", DEBUGTEST_B ; NO..(B) db "@" -; 81fe3 DebugColorTestGFX: INCBIN "gfx/debug/color_test.2bpp" - TilesetColorTest: ret xor a @@ -1122,17 +1084,16 @@ TilesetColorTest: ld a, $40 ld [hWY], a ret -; 821d2 -Function821d2: ; 821d2 +Function821d2: hlcoord 0, 0 call Function821de -Function821d8: ; 821d8 +Function821d8: ld a, [wcf64] hlcoord 0, 0, wAttrMap -Function821de: ; 821de +Function821de: add hl, de rept 4 ld [hli], a @@ -1148,25 +1109,23 @@ rept 4 ld [hli], a endr ret -; 821f4 -Function821f4: ; 821f4 +Function821f4: hlcoord 2, 4 call Function82203 hlcoord 2, 6 call Function82203 hlcoord 2, 8 -Function82203: ; 82203 +Function82203: ld a, DEBUGTEST_UP_ARROW ld [hli], a ld bc, $10 - 1 ld a, DEBUGTEST_TICKS call ByteFill ret -; 8220f -Function8220f: ; 8220f +Function8220f: ld a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -1187,10 +1146,8 @@ Function8220f: ; 8220f pop af ld [rSVBK], a ret -; 82236 - -Function82236: ; 82236 +Function82236: ld hl, hJoyLast ld a, [hl] and SELECT @@ -1247,9 +1204,8 @@ Function82236: ; 82236 xor $d0 ld [hWY], a ret -; 822a3 -Function822a3: ; 822a3 +Function822a3: ld a, [rSVBK] push af ld a, BANK(wBGPals2) @@ -1281,9 +1237,8 @@ Function822a3: ; 822a3 ld [hCGBPalUpdate], a call DelayFrame ret -; 822f0 -Function822f0: ; 822f0 +Function822f0: ld a, [wcf65] and 3 ld e, a @@ -1295,16 +1250,14 @@ Function822f0: ; 822f0 ld h, [hl] ld l, a jp hl -; 82301 -.dw ; 82301 +.dw dw Function82309 dw Function82339 dw Function8234b dw Function8235d -; 82309 -Function82309: ; 82309 +Function82309: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1339,7 +1292,7 @@ Function82309: ; 82309 call Function81ea5 ret -Function82339: ; 82338 +Function82339: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1350,7 +1303,7 @@ Function82339: ; 82338 ld hl, wc608 + 10 jr Function82368 -Function8234b: ; 8234b +Function8234b: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1361,14 +1314,14 @@ Function8234b: ; 8234b ld hl, wc608 + 11 jr Function82368 -Function8235d: ; 8235d +Function8235d: ld hl, hJoyLast ld a, [hl] and D_UP jr nz, Function82387 ld hl, wc608 + 12 -Function82368: ; 82368 +Function82368: ld a, [hJoyLast] and D_RIGHT jr nz, .asm_82375 @@ -1395,18 +1348,17 @@ Function82368: ; 82368 call Function822a3 ret -Function82387: ; 82387 +Function82387: ld hl, wcf65 dec [hl] ret -Function8238c: ; 8238c +Function8238c: ld hl, wcf65 inc [hl] ret -; 82391 -Function82391: ; 82391 +Function82391: ld a, [wc608 + 10] and $1f ld e, a @@ -1437,11 +1389,9 @@ Function82391: ; 82391 ld [hli], a ld [hl], d ret -; 823c6 -Function823c6: ; 823c6 +Function823c6: ret -Function823c7: ; 823c7 +Function823c7: ret -; 823c8 diff --git a/engine/menus/delete_save.asm b/engine/menus/delete_save.asm index a86faf06a..8be78e979 100644 --- a/engine/menus/delete_save.asm +++ b/engine/menus/delete_save.asm @@ -1,4 +1,4 @@ -_DeleteSaveData: ; 4d54c +_DeleteSaveData: farcall BlankScreen ld b, SCGB_DIPLOMA call GetSGBLayout @@ -18,18 +18,18 @@ _DeleteSaveData: ; 4d54c farcall EmptyAllSRAMBanks ret -.Text_ClearAllSaveData: ; 0x4d580 +.Text_ClearAllSaveData: ; Clear all save data? text_jump UnknownText_0x1c564a db "@" -.NoYesMenuHeader: ; 0x4d585 +.NoYesMenuHeader: db 0 ; flags menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option -.MenuData: ; 0x4d58d +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" diff --git a/engine/menus/empty_sram.asm b/engine/menus/empty_sram.asm index 8b060f3ef..45a4a8884 100644 --- a/engine/menus/empty_sram.asm +++ b/engine/menus/empty_sram.asm @@ -1,4 +1,4 @@ -EmptyAllSRAMBanks: ; 4cf1f +EmptyAllSRAMBanks: ld a, 0 call .EmptyBank ld a, 1 @@ -9,7 +9,7 @@ EmptyAllSRAMBanks: ; 4cf1f call .EmptyBank ret -.EmptyBank: ; 4cf34 +.EmptyBank: call GetSRAMBank ld hl, SRAM_Begin ld bc, SRAM_End - SRAM_Begin diff --git a/engine/menus/init_gender.asm b/engine/menus/init_gender.asm index 8fd95bc85..21871d0ab 100644 --- a/engine/menus/init_gender.asm +++ b/engine/menus/init_gender.asm @@ -1,4 +1,4 @@ -InitCrystalData: ; 48000 +InitCrystalData: ld a, $1 ld [wd474], a xor a @@ -18,11 +18,10 @@ InitCrystalData: ; 48000 res 1, a ld [wd479], a ret -; 4802f INCLUDE "mobile/mobile_12.asm" -InitGender: ; 48dcb (12:4dcb) +InitGender: call InitGenderScreen call LoadGenderScreenPal call LoadGenderScreenLightBlueTile @@ -41,29 +40,25 @@ InitGender: ; 48dcb (12:4dcb) ld c, 10 call DelayFrames ret -; 48dfc (12:4dfc) -.MenuHeader: ; 0x48dfc +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 4, 12, 9 dw .MenuData db 1 ; default option -; 0x48e04 -.MenuData: ; 0x48e04 +.MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_DISABLE_B ; flags db 2 ; items db "Boy@" db "Girl@" -; 0x48e0f -TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f +TextJump_AreYouABoyOrAreYouAGirl: ; Are you a boy? Or are you a girl? text_jump Text_AreYouABoyOrAreYouAGirl db "@" -; 0x48e14 -InitGenderScreen: ; 48e14 (12:4e14) +InitGenderScreen: ld a, $10 ld [wMusicFade], a ld a, MUSIC_NONE @@ -85,7 +80,7 @@ InitGenderScreen: ; 48e14 (12:4e14) call ByteFill ret -LoadGenderScreenPal: ; 48e47 (12:4e47) +LoadGenderScreenPal: ld hl, .Palette ld de, wBGPals1 ld bc, 1 palettes @@ -93,19 +88,16 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) call FarCopyWRAM farcall ApplyPals ret -; 48e5c (12:4e5c) -.Palette: ; 48e5c +.Palette: INCLUDE "gfx/new_game/gender_screen.pal" -; 48e64 -LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) +LoadGenderScreenLightBlueTile: ld de, .LightBlueTile ld hl, vTiles2 tile $00 lb bc, BANK(.LightBlueTile), 1 call Get2bpp ret -; 48e71 (12:4e71) -.LightBlueTile: ; 48e71 +.LightBlueTile: INCBIN "gfx/new_game/gender_screen.2bpp" diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index af6e0c09e..9652dd73e 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -1,4 +1,4 @@ -_MainMenu: ; 5ae8 +_MainMenu: ld de, MUSIC_NONE call PlayMusic call DelayFrame @@ -8,13 +8,11 @@ _MainMenu: ; 5ae8 call PlayMusic farcall MainMenu jp StartTitleScreen -; 5b04 ; unused ret -; 5b05 -PrintDayOfWeek: ; 5b05 +PrintDayOfWeek: push de ld hl, .Days ld a, b @@ -28,9 +26,8 @@ PrintDayOfWeek: ; 5b05 ld de, .Day call PlaceString ret -; 5b1c -.Days: ; 5b1c +.Days: db "SUN@" db "MON@" db "TUES@" @@ -38,13 +35,11 @@ PrintDayOfWeek: ; 5b05 db "THURS@" db "FRI@" db "SATUR@" -; 5b40 -.Day: ; 5b40 +.Day: db "DAY@" -; 5b44 -NewGame_ClearTileMapEtc: ; 5b44 +NewGame_ClearTileMapEtc: xor a ld [hMapAnims], a call ClearTileMap @@ -52,21 +47,18 @@ NewGame_ClearTileMapEtc: ; 5b44 call LoadStandardFont call ClearWindowData ret -; 5b54 -MysteryGift: ; 5b54 +MysteryGift: call UpdateTime farcall DoMysteryGiftIfDayHasPassed farcall DoMysteryGift ret -; 5b64 -OptionsMenu: ; 5b64 +OptionsMenu: farcall _OptionsMenu ret -; 5b6b -NewGame: ; 5b6b +NewGame: xor a ld [wMonStatusFlags], a call ResetWRAM @@ -83,9 +75,8 @@ NewGame: ; 5b6b ld a, MAPSETUP_WARP ld [hMapEntryMethod], a jp FinishContinueFunction -; 5b8f -AreYouABoyOrAreYouAGirl: ; 5b8f +AreYouABoyOrAreYouAGirl: farcall Mobile_AlwaysReturnNotCarry ; some mobile stuff jr c, .ok farcall InitGender @@ -95,17 +86,14 @@ AreYouABoyOrAreYouAGirl: ; 5b8f ld c, 0 farcall InitMobileProfile ; mobile ret -; 5ba7 -ResetWRAM: ; 5ba7 +ResetWRAM: xor a ld [hBGMapMode], a call _ResetWRAM ret -; 5bae - -_ResetWRAM: ; 5bae +_ResetWRAM: ld hl, wVirtualOAM ld bc, wOptions - wVirtualOAM xor a @@ -228,18 +216,16 @@ endc call ResetGameTime ret -; 5ca1 -.InitList: ; 5ca1 +.InitList: ; Loads 0 in the count and -1 in the first item or mon slot. xor a ld [hli], a dec a ld [hl], a ret -; 5ca6 -SetDefaultBoxNames: ; 5ca6 +SetDefaultBoxNames: ld hl, wBoxNames ld c, 0 .loop @@ -270,9 +256,8 @@ SetDefaultBoxNames: ; 5ca6 .Box: db "BOX@" -; 5cd3 -InitializeMagikarpHouse: ; 5cd3 +InitializeMagikarpHouse: ld hl, wBestMagikarpLengthFeet ld a, $3 ld [hli], a @@ -281,13 +266,11 @@ InitializeMagikarpHouse: ; 5cd3 ld de, .Ralph call CopyName2 ret -; 5ce3 -.Ralph: ; 5ce3 +.Ralph: db "RALPH@" -; 5ce9 -InitializeNPCNames: ; 5ce9 +InitializeNPCNames: ld hl, .Rival ld de, wRivalName call .Copy @@ -312,16 +295,14 @@ InitializeNPCNames: ; 5ce9 .Red: db "RED@" .Green: db "GREEN@" .Mom: db "MOM@" -; 5d23 -InitializeWorld: ; 5d23 +InitializeWorld: call ShrinkPlayer farcall SpawnPlayer farcall _InitializeStartDay ret -; 5d33 -LoadOrRegenerateLuckyIDNumber: ; 5d33 +LoadOrRegenerateLuckyIDNumber: ld a, BANK(sLuckyIDNumber) call GetSRAMBank ld a, [wCurDay] @@ -346,9 +327,8 @@ LoadOrRegenerateLuckyIDNumber: ; 5d33 ld [wLuckyIDNumber + 1], a ld [sLuckyIDNumber + 1], a jp CloseSRAM -; 5d65 -Continue: ; 5d65 +Continue: farcall TryLoadSaveFile jr c, .FailToLoad farcall _LoadData @@ -400,22 +380,19 @@ Continue: ; 5d65 ld [wDefaultSpawnpoint], a call PostCreditsSpawn jp FinishContinueFunction -; 5de2 -SpawnAfterRed: ; 5de2 +SpawnAfterRed: ld a, SPAWN_MT_SILVER ld [wDefaultSpawnpoint], a -; 5de7 -PostCreditsSpawn: ; 5de7 +PostCreditsSpawn: xor a ld [wSpawnAfterChampion], a ld a, MAPSETUP_WARP ld [hMapEntryMethod], a ret -; 5df0 -Continue_MobileAdapterMenu: ; 5df0 +Continue_MobileAdapterMenu: farcall Mobile_AlwaysReturnNotCarry ; mobile check ret nc @@ -444,9 +421,8 @@ Continue_MobileAdapterMenu: ; 5df0 ld c, 35 call DelayFrames ret -; 5e34 -ConfirmContinue: ; 5e34 +ConfirmContinue: .loop call DelayFrame call GetJoypad @@ -460,9 +436,8 @@ ConfirmContinue: ; 5e34 .PressA: ret -; 5e48 -Continue_CheckRTC_RestartClock: ; 5e48 +Continue_CheckRTC_RestartClock: call CheckRTCStatus and %10000000 ; Day count exceeded 16383 jr z, .pass @@ -476,9 +451,8 @@ Continue_CheckRTC_RestartClock: ; 5e48 .pass xor a ret -; 5e5d -FinishContinueFunction: ; 5e5d +FinishContinueFunction: .loop xor a ld [wDontPlayMapMusicOnReload], a @@ -497,9 +471,8 @@ FinishContinueFunction: ; 5e5d .AfterRed: call SpawnAfterRed jr .loop -; 5e85 -DisplaySaveInfoOnContinue: ; 5e85 +DisplaySaveInfoOnContinue: call CheckRTCStatus and %10000000 jr z, .clock_ok @@ -511,32 +484,28 @@ DisplaySaveInfoOnContinue: ; 5e85 lb de, 4, 8 call DisplayNormalContinueData ret -; 5e9a -DisplaySaveInfoOnSave: ; 5e9a +DisplaySaveInfoOnSave: lb de, 4, 0 jr DisplayNormalContinueData -; 5e9f -DisplayNormalContinueData: ; 5e9f +DisplayNormalContinueData: call Continue_LoadMenuHeader call Continue_DisplayBadgesDexPlayerName call Continue_PrintGameTime call LoadFontsExtra call UpdateSprites ret -; 5eaf -DisplayContinueDataWithRTCError: ; 5eaf +DisplayContinueDataWithRTCError: call Continue_LoadMenuHeader call Continue_DisplayBadgesDexPlayerName call Continue_UnknownGameTime call LoadFontsExtra call UpdateSprites ret -; 5ebf -Continue_LoadMenuHeader: ; 5ebf +Continue_LoadMenuHeader: xor a ld [hBGMapMode], a ld hl, .MenuHeader_Dex @@ -550,42 +519,36 @@ Continue_LoadMenuHeader: ; 5ebf call MenuBox call PlaceVerticalMenuItems ret -; 5ed9 -.MenuHeader_Dex: ; 5ed9 +.MenuHeader_Dex: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 15, 9 dw .MenuData_Dex db 1 ; default option -; 5ee1 -.MenuData_Dex: ; 5ee1 +.MenuData_Dex: db 0 ; flags db 4 ; items db "PLAYER@" db "BADGES@" db "#DEX@" db "TIME@" -; 5efb -.MenuHeader_NoDex: ; 5efb +.MenuHeader_NoDex: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 15, 9 dw .MenuData_NoDex db 1 ; default option -; 5f03 -.MenuData_NoDex: ; 5f03 +.MenuData_NoDex: db 0 ; flags db 4 ; items db "PLAYER <PLAYER>@" db "BADGES@" db " @" db "TIME@" -; 5f1c - -Continue_DisplayBadgesDexPlayerName: ; 5f1c +Continue_DisplayBadgesDexPlayerName: call MenuBoxCoord2Tile push hl decoord 13, 4, 0 @@ -607,16 +570,14 @@ Continue_DisplayBadgesDexPlayerName: ; 5f1c .Player: db "<PLAYER>@" -; 5f40 -Continue_PrintGameTime: ; 5f40 +Continue_PrintGameTime: decoord 9, 8, 0 add hl, de call Continue_DisplayGameTime ret -; 5f48 -Continue_UnknownGameTime: ; 5f48 +Continue_UnknownGameTime: decoord 9, 8, 0 add hl, de ld de, .three_question_marks @@ -625,9 +586,8 @@ Continue_UnknownGameTime: ; 5f48 .three_question_marks db " ???@" -; 5f58 -Continue_DisplayBadgeCount: ; 5f58 +Continue_DisplayBadgeCount: push hl ld hl, wJohtoBadges ld b, 2 @@ -636,9 +596,8 @@ Continue_DisplayBadgeCount: ; 5f58 ld de, wd265 lb bc, 1, 2 jp PrintNum -; 5f6b -Continue_DisplayPokedexNumCaught: ; 5f6b +Continue_DisplayPokedexNumCaught: ld a, [wStatusFlags] bit STATUSFLAGS_POKEDEX_F, a ret z @@ -654,9 +613,8 @@ endc ld de, wd265 lb bc, 1, 3 jp PrintNum -; 5f84 -Continue_DisplayGameTime: ; 5f84 +Continue_DisplayGameTime: ld de, wGameTimeHours lb bc, 2, 3 call PrintNum @@ -665,10 +623,8 @@ Continue_DisplayGameTime: ; 5f84 ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum -; 5f99 - -OakSpeech: ; 0x5f99 +OakSpeech: farcall InitClock call RotateFourPalettesLeft call ClearTileMap @@ -746,11 +702,11 @@ OakSpeech: ; 0x5f99 call PrintText ret -OakText1: ; 0x6045 +OakText1: text_jump _OakText1 db "@" -OakText2: ; 0x604a +OakText2: text_jump _OakText2 start_asm ld a, WOOPER @@ -759,27 +715,27 @@ OakText2: ; 0x604a ld hl, OakText3 ret -OakText3: ; 0x605b +OakText3: text_jump _OakText3 db "@" -OakText4: ; 0x6060 +OakText4: text_jump _OakText4 db "@" -OakText5: ; 0x6065 +OakText5: text_jump _OakText5 db "@" -OakText6: ; 0x606a +OakText6: text_jump _OakText6 db "@" -OakText7: ; 0x606f +OakText7: text_jump _OakText7 db "@" -NamePlayer: ; 0x6074 +NamePlayer: farcall MovePlayerPicRight farcall ShowPlayerNamingChoices ld a, [wMenuCursorY] @@ -823,7 +779,6 @@ NamePlayer: ; 0x6074 db "CHRIS@@@@@@" .Kris: db "KRIS@@@@@@@" -; 60e9 Unreferenced_Function60e9: call LoadMenuHeader @@ -833,9 +788,8 @@ Unreferenced_Function60e9: call CopyNameFromMenu call CloseWindow ret -; 60fa -StorePlayerName: ; 60fa +StorePlayerName: ld a, "@" ld bc, NAME_LENGTH ld hl, wPlayerName @@ -844,10 +798,8 @@ StorePlayerName: ; 60fa ld de, wStringBuffer2 call CopyName2 ret -; 610f - -ShrinkPlayer: ; 610f +ShrinkPlayer: ld a, [hROMBank] push af @@ -898,9 +850,8 @@ ShrinkPlayer: ; 610f call RotateThreePalettesRight call ClearTileMap ret -; 616a -Intro_RotatePalettesLeftFrontpic: ; 616a +Intro_RotatePalettesLeftFrontpic: ld hl, IntroFadePalettes ld b, IntroFadePalettes.End - IntroFadePalettes .loop @@ -911,9 +862,8 @@ Intro_RotatePalettesLeftFrontpic: ; 616a dec b jr nz, .loop ret -; 617c -IntroFadePalettes: ; 0x617c +IntroFadePalettes: db %01010100 db %10101000 db %11111100 @@ -921,9 +871,8 @@ IntroFadePalettes: ; 0x617c db %11110100 db %11100100 .End -; 6182 -Intro_WipeInFrontpic: ; 6182 +Intro_WipeInFrontpic: ld a, $77 ld [hWX], a call DelayFrame @@ -937,9 +886,8 @@ Intro_WipeInFrontpic: ; 6182 ret z ld [hWX], a jr .loop -; 619c -Intro_PrepTrainerPic: ; 619c +Intro_PrepTrainerPic: ld de, vTiles2 farcall GetTrainerPic xor a @@ -948,9 +896,8 @@ Intro_PrepTrainerPic: ; 619c lb bc, 7, 7 predef PlaceGraphic ret -; 61b4 -ShrinkFrame: ; 61b4 +ShrinkFrame: ld de, vTiles2 ld c, 7 * 7 predef DecompressGet2bpp @@ -960,10 +907,8 @@ ShrinkFrame: ; 61b4 lb bc, 7, 7 predef PlaceGraphic ret -; 61cd - -Intro_PlacePlayerSprite: ; 61cd +Intro_PlacePlayerSprite: farcall GetPlayerIcon ld c, $c ld hl, vTiles0 @@ -998,24 +943,21 @@ Intro_PlacePlayerSprite: ; 61cd dec c jr nz, .loop ret -; 61fe -.sprites ; 61fe +.sprites db 4 ; y pxl, x pxl, tile offset db 9 * 8 + 4, 9 * 8, 0 db 9 * 8 + 4, 10 * 8, 1 db 10 * 8 + 4, 9 * 8, 2 db 10 * 8 + 4, 10 * 8, 3 -; 620b - -CrystalIntroSequence: ; 620b +CrystalIntroSequence: callfar Copyright_GFPresents jr c, StartTitleScreen farcall CrystalIntro -StartTitleScreen: ; 6219 +StartTitleScreen: ld a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -1062,7 +1004,6 @@ StartTitleScreen: ; 6219 ld h, [hl] ld l, a jp hl -; 626a .dw dw _MainMenu @@ -1070,15 +1011,12 @@ StartTitleScreen: ; 6219 dw CrystalIntroSequence dw CrystalIntroSequence dw ResetClock -; 6274 - -.TitleScreen: ; 6274 +.TitleScreen: farcall _TitleScreen ret -; 627b -RunTitleScreen: ; 627b +RunTitleScreen: ld a, [wJumptableIndex] bit 7, a jr nz, .done_title @@ -1091,9 +1029,8 @@ RunTitleScreen: ; 627b .done_title scf ret -; 6292 -Unreferenced_Function6292: ; 6292 +Unreferenced_Function6292: ld a, [hVBlankCounter] and $7 ret nz @@ -1103,9 +1040,8 @@ Unreferenced_Function6292: ; 6292 ld bc, 2 * SCREEN_WIDTH call ByteFill ret -; 62a3 -TitleScreenScene: ; 62a3 +TitleScreenScene: ld e, a ld d, 0 ld hl, .scenes @@ -1115,24 +1051,19 @@ TitleScreenScene: ; 62a3 ld h, [hl] ld l, a jp hl -; 62af .scenes dw TitleScreenEntrance dw TitleScreenTimer dw TitleScreenMain dw TitleScreenEnd -; 62b7 .Unreferenced_NextScene: ld hl, wJumptableIndex inc [hl] ret -; 62bc - - -TitleScreenEntrance: ; 62bc +TitleScreenEntrance: ; Animate the logo: ; Move each line by 4 pixels until our count hits 0. ld a, [hSCX] @@ -1178,11 +1109,8 @@ TitleScreenEntrance: ; 62bc ld a, $88 ld [hWY], a ret -; 62f6 - - -TitleScreenTimer: ; 62f6 +TitleScreenTimer: ; Next scene ld hl, wJumptableIndex inc [hl] @@ -1194,10 +1122,8 @@ TitleScreenTimer: ; 62f6 inc hl ld [hl], d ret -; 6304 - -TitleScreenMain: ; 6304 +TitleScreenMain: ; Run the timer down. ld hl, wTitleScreenTimer ld e, [hl] @@ -1296,10 +1222,8 @@ TitleScreenMain: ; 6304 ld hl, wJumptableIndex set 7, [hl] ret -; 6375 - -TitleScreenEnd: ; 6375 +TitleScreenEnd: ; Wait until the music is done fading. ld hl, wTitleScreenTimer @@ -1316,17 +1240,14 @@ TitleScreenEnd: ; 6375 ld hl, wJumptableIndex set 7, [hl] ret -; 6389 -DeleteSaveData: ; 6389 +DeleteSaveData: farcall _DeleteSaveData jp Init -; 6392 -ResetClock: ; 6392 +ResetClock: farcall _ResetClock jp Init -; 639b Unreferenced_Function639b: ; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here. @@ -1359,9 +1280,8 @@ Unreferenced_Function639b: ld a, SPRITE_ANIM_INDEX_GS_TITLE_TRAIL call _InitSpriteAnimStruct ret -; 63ca -.Data63ca: ; 63ca +.Data63ca: ; frame 0 y, x; frame 1 y, x db 11 * 8 + 4, 10 * 8, 0 * 8, 0 * 8 db 11 * 8 + 4, 13 * 8, 11 * 8 + 4, 11 * 8 @@ -1369,9 +1289,8 @@ Unreferenced_Function639b: db 11 * 8 + 4, 17 * 8, 11 * 8 + 4, 15 * 8 db 0 * 8, 0 * 8, 11 * 8 + 4, 15 * 8 db 0 * 8, 0 * 8, 11 * 8 + 4, 11 * 8 -; 63e2 -Copyright: ; 63e2 +Copyright: call ClearTileMap call LoadFontsExtra ld de, CopyrightGFX @@ -1381,9 +1300,8 @@ Copyright: ; 63e2 hlcoord 2, 7 ld de, CopyrightString jp PlaceString -; 63fd -CopyrightString: ; 63fd +CopyrightString: ; ©1995-2001 Nintendo db $60, $61, $62, $63, $64, $65, $66 db $67, $68, $69, $6a, $6b, $6c @@ -1397,9 +1315,8 @@ CopyrightString: ; 63fd db $73, $74, $75, $76, $77, $78, $79, $7a, $7b, $7c db "@" -; 642e -GameInit:: ; 642e +GameInit:: farcall TryLoadSaveData call ClearWindowData call ClearBGPalettes @@ -1415,4 +1332,3 @@ GameInit:: ; 642e ld [hWY], a call WaitBGMap jp CrystalIntroSequence -; 6454 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index d83ce873b..d6afda483 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -1,8 +1,7 @@ -GFX_49c0c: ; 49c0c +GFX_49c0c: INCBIN "gfx/unknown/049c0c.2bpp" -; 49cdc -MainMenu: ; 49cdc +MainMenu: xor a ld [wDisableTextAcceleration], a call Function49ed0 @@ -27,24 +26,21 @@ MainMenu: ; 49cdc .quit ret -; 49d14 -.MenuHeader: ; 49d14 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 16, 7 dw .MenuData db 1 ; default option -; 49d1c -.MenuData: ; 49d1c +.MenuData: db STATICMENU_CURSOR ; flags db 0 ; items dw MainMenuItems dw PlaceMenuStrings dw .Strings -; 49d20 -.Strings: ; 49d24 +.Strings: db "CONTINUE@" db "NEW GAME@" db "OPTION@" @@ -52,14 +48,13 @@ MainMenu: ; 49cdc db "MOBILE@" db "MOBILE STUDIUM@" -.Jumptable: ; 0x49d60 +.Jumptable: dw MainMenu_Continue dw MainMenu_NewGame dw MainMenu_Options dw MainMenu_MysteryGift dw MainMenu_Mobile dw MainMenu_MobileStudium -; 0x49d6c CONTINUE EQU 0 NEW_GAME EQU 1 @@ -70,20 +65,20 @@ MOBILE_STUDIUM EQU 5 MainMenuItems: -NewGameMenu: ; 0x49d6c +NewGameMenu: db 2 db NEW_GAME db OPTION db -1 -ContinueMenu: ; 0x49d70 +ContinueMenu: db 3 db CONTINUE db NEW_GAME db OPTION db -1 -MobileMysteryMenu: ; 0x49d75 +MobileMysteryMenu: db 5 db CONTINUE db NEW_GAME @@ -92,7 +87,7 @@ MobileMysteryMenu: ; 0x49d75 db MOBILE db -1 -MobileMenu: ; 0x49d7c +MobileMenu: db 4 db CONTINUE db NEW_GAME @@ -100,7 +95,7 @@ MobileMenu: ; 0x49d7c db MOBILE db -1 -MobileStudiumMenu: ; 0x49d82 +MobileStudiumMenu: db 5 db CONTINUE db NEW_GAME @@ -109,7 +104,7 @@ MobileStudiumMenu: ; 0x49d82 db MOBILE_STUDIUM db -1 -MysteryMobileStudiumMenu: ; 0x49d89 +MysteryMobileStudiumMenu: db 6 db CONTINUE db NEW_GAME @@ -119,7 +114,7 @@ MysteryMobileStudiumMenu: ; 0x49d89 db MOBILE_STUDIUM db -1 -MysteryMenu: ; 0x49d91 +MysteryMenu: db 4 db CONTINUE db NEW_GAME @@ -127,7 +122,7 @@ MysteryMenu: ; 0x49d91 db MYSTERY_GIFT db -1 -MysteryStudiumMenu: ; 0x49d97 +MysteryStudiumMenu: db 5 db CONTINUE db NEW_GAME @@ -136,7 +131,7 @@ MysteryStudiumMenu: ; 0x49d97 db MOBILE_STUDIUM db -1 -StudiumMenu: ; 0x49d9e +StudiumMenu: db 4 db CONTINUE db NEW_GAME @@ -144,8 +139,7 @@ StudiumMenu: ; 0x49d9e db MOBILE_STUDIUM db -1 - -MainMenu_GetWhichMenu: ; 49da4 +MainMenu_GetWhichMenu: nop nop nop @@ -193,9 +187,8 @@ MainMenu_GetWhichMenu: ; 49da4 .ok4 ld a, $6 ; Mystery Gift ret -; 49de4 -MainMenuJoypadLoop: ; 49de4 +MainMenuJoypadLoop: call SetUpMenu .loop call MainMenu_PrintCurrentTimeAndDay @@ -218,9 +211,8 @@ MainMenuJoypadLoop: ; 49de4 .b_button scf ret -; 49e09 -MainMenu_PrintCurrentTimeAndDay: ; 49e09 +MainMenu_PrintCurrentTimeAndDay: ld a, [wSaveFileExists] and a ret z @@ -237,10 +229,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 ld a, $1 ld [hBGMapMode], a ret -; 49e27 - -.PlaceBox: ; 49e27 +.PlaceBox: call CheckRTCStatus and $80 jr nz, .TimeFail @@ -253,10 +243,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 .TimeFail: call SpeechTextBox ret -; 49e3d - -.PlaceTime: ; 49e3d +.PlaceTime: ld a, [wSaveFileExists] and a ret z @@ -282,26 +270,22 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 .min ; unused db "min.@" -; 49e75 -.PrintTimeNotSet: ; 49e75 +.PrintTimeNotSet: hlcoord 1, 14 ld de, .TimeNotSet call PlaceString ret -; 49e7f -.TimeNotSet: ; 49e7f +.TimeNotSet: db "TIME NOT SET@" -; 49e8c -.UnusedText: ; 49e8c +.UnusedText: ; Clock time unknown text_jump UnknownText_0x1c5182 db "@" -; 49e91 -.PlaceCurrentDay: ; 49e91 +.PlaceCurrentDay: push de ld hl, .Days ld a, b @@ -315,7 +299,6 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 ld de, .Day call PlaceString ret -; 49ea8 .Days: db "SUN@" @@ -327,9 +310,8 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 db "SATUR@" .Day: db "DAY@" -; 49ed0 -Function49ed0: ; 49ed0 +Function49ed0: xor a ld [hMapAnims], a call ClearTileMap @@ -337,25 +319,19 @@ Function49ed0: ; 49ed0 call LoadStandardFont call ClearWindowData ret -; 49ee0 - -MainMenu_NewGame: ; 49ee0 +MainMenu_NewGame: farcall NewGame ret -; 49ee7 -MainMenu_Options: ; 49ee7 +MainMenu_Options: farcall OptionsMenu ret -; 49eee -MainMenu_Continue: ; 49eee +MainMenu_Continue: farcall Continue ret -; 49ef5 -MainMenu_MysteryGift: ; 49ef5 +MainMenu_MysteryGift: farcall MysteryGift ret -; 49efc diff --git a/engine/menus/menu.asm b/engine/menus/menu.asm index 51de2e1a4..c9ce72b13 100644 --- a/engine/menus/menu.asm +++ b/engine/menus/menu.asm @@ -1,4 +1,4 @@ -_2DMenu_:: ; 2400e +_2DMenu_:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -8,9 +8,8 @@ _2DMenu_:: ; 2400e call ApplyTilemap call Get2DMenuSelection ret -; 24022 -_InterpretBattleMenu:: ; 24022 +_InterpretBattleMenu:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -21,9 +20,8 @@ _InterpretBattleMenu:: ; 24022 call ApplyTilemap call Get2DMenuSelection ret -; 2403c -_InterpretMobileMenu:: ; 2403c +_InterpretMobileMenu:: ld hl, CopyMenuData ld a, [wMenuData_2DMenuItemStringsBank] rst FarCall @@ -56,23 +54,19 @@ _InterpretMobileMenu:: ; 2403c ld [wMenuCursorBuffer], a and a ret -; 24085 - - -Draw2DMenu: ; 24085 +Draw2DMenu: xor a ld [hBGMapMode], a call MenuBox call Place2DMenuItemStrings ret -; 2408f -Get2DMenuSelection: ; 2408f +Get2DMenuSelection: call Init2DMenuCursorPosition call StaticMenuJoypad call MenuClickSound -Mobile_GetMenuSelection: ; 24098 +Mobile_GetMenuSelection: ld a, [wMenuDataFlags] bit 1, a jr z, .skip @@ -108,22 +102,19 @@ Mobile_GetMenuSelection: ; 24098 .quit2 scf ret -; 240cd -Get2DMenuNumberOfColumns: ; 240cd +Get2DMenuNumberOfColumns: ld a, [wMenuData_2DMenuDimensions] and $f ret -; 240d3 -Get2DMenuNumberOfRows: ; 240d3 +Get2DMenuNumberOfRows: ld a, [wMenuData_2DMenuDimensions] swap a and $f ret -; 240db -Place2DMenuItemStrings: ; 240db +Place2DMenuItemStrings: ld hl, wMenuData_2DMenuItemStringsAddr ld e, [hl] inc hl @@ -164,10 +155,8 @@ Place2DMenuItemStrings: ; 240db ld a, [wMenuData_2DMenuFunctionBank] rst FarCall ret -; 2411a - -Init2DMenuCursorPosition: ; 2411a (9:411a) +Init2DMenuCursorPosition: call GetMenuTextStartCoord ld a, b ld [w2DMenuCursorInitY], a @@ -222,9 +211,8 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) ld [wCursorCurrentTile], a ld [wCursorCurrentTile + 1], a ret -; 24179 -.InitFlags_a: ; 24179 +.InitFlags_a: xor a ld hl, w2DMenuFlags1 ld [hli], a @@ -235,16 +223,14 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) set 5, [hl] set 4, [hl] ret -; 2418a -.InitFlags_b: ; 2418a +.InitFlags_b: ld a, [wMenuData_2DMenuSpacing] or $20 ld [w2DMenuCursorOffsets], a ret -; 24193 -.InitFlags_c: ; 24193 +.InitFlags_c: ld hl, wMenuDataFlags ld a, A_BUTTON bit 0, [hl] @@ -257,12 +243,10 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) .skip2 ld [wMenuJoypadFilter], a ret -; 241a8 - -_StaticMenuJoypad:: ; 241a8 +_StaticMenuJoypad:: call Place2DMenuCursor -_ScrollingMenuJoypad:: ; 241ab +_ScrollingMenuJoypad:: ld hl, w2DMenuFlags2 res 7, [hl] ld a, [hBGMapMode] @@ -271,9 +255,8 @@ _ScrollingMenuJoypad:: ; 241ab pop af ld [hBGMapMode], a ret -; 241ba -MobileMenuJoypad: ; 241ba +MobileMenuJoypad: ld hl, w2DMenuFlags2 res 7, [hl] ld a, [hBGMapMode] @@ -288,10 +271,8 @@ MobileMenuJoypad: ; 241ba call GetMenuJoypad ld c, a ret -; 241d5 - -Unreferenced_Function241d5: ; 241d5 +Unreferenced_Function241d5: call Place2DMenuCursor .loop call Move2DMenuCursor @@ -328,10 +309,8 @@ Unreferenced_Function241d5: ; 241d5 jr z, .loop2 and a ret -; 24216 - -MenuJoypadLoop: ; 24216 +MenuJoypadLoop: .loop call Move2DMenuCursor call .BGMap_OAM @@ -350,9 +329,8 @@ MenuJoypadLoop: ; 24216 .done ret -; 24238 -.BGMap_OAM: ; 24238 +.BGMap_OAM: ld a, [hOAMUpdate] push af ld a, $1 @@ -363,9 +341,8 @@ MenuJoypadLoop: ; 24216 xor a ld [hBGMapMode], a ret -; 24249 -Do2DMenuRTCJoypad: ; 24249 +Do2DMenuRTCJoypad: .loopRTC call RTC call Menu_WasButtonPressed @@ -375,9 +352,8 @@ Do2DMenuRTCJoypad: ; 24249 jr z, .loopRTC and a ret -; 24259 -Menu_WasButtonPressed: ; 24259 +Menu_WasButtonPressed: ld a, [w2DMenuFlags1] bit 6, a jr z, .skip_to_joypad @@ -390,9 +366,8 @@ Menu_WasButtonPressed: ; 24259 ret z scf ret -; 24270 -_2DMenuInterpretJoypad: ; 24270 +_2DMenuInterpretJoypad: call GetMenuJoypad bit A_BUTTON_F, a jp nz, .a_b_start_select @@ -413,7 +388,7 @@ _2DMenuInterpretJoypad: ; 24270 and a ret -.set_bit_7 ; 24299 +.set_bit_7 ld hl, w2DMenuFlags2 set 7, [hl] scf @@ -512,14 +487,12 @@ _2DMenuInterpretJoypad: ; 24270 ld [hl], $1 xor a ret -; 24318 -.a_b_start_select ; 24318 +.a_b_start_select xor a ret -; 2431a -Move2DMenuCursor: ; 2431a +Move2DMenuCursor: ld hl, wCursorCurrentTile ld a, [hli] ld h, [hl] @@ -529,7 +502,7 @@ Move2DMenuCursor: ; 2431a jr nz, Place2DMenuCursor ld a, [wCursorOffCharacter] ld [hl], a -Place2DMenuCursor: ; 24329 +Place2DMenuCursor: ld a, [w2DMenuCursorInitY] ld b, a ld a, [w2DMenuCursorInitX] @@ -580,9 +553,8 @@ Place2DMenuCursor: ; 24329 ld a, h ld [wCursorCurrentTile + 1], a ret -; 24374 -_PushWindow:: ; 24374 +_PushWindow:: ld a, [rSVBK] push af ld a, BANK(wWindowStack) @@ -651,9 +623,8 @@ _PushWindow:: ; 24374 ld hl, wWindowStackSize inc [hl] ret -; 243cd -.copy ; 243cd +.copy call GetMenuBoxDims inc b inc c @@ -678,13 +649,11 @@ _PushWindow:: ; 24374 jr nz, .row ret -; 243e7 -.ret ; 243e7 +.ret ret -; 243e8 -_ExitMenu:: ; 243e8 +_ExitMenu:: xor a ld [hBGMapMode], a @@ -722,9 +691,8 @@ _ExitMenu:: ; 243e8 ld hl, wWindowStackSize dec [hl] ret -; 24423 -Unreferenced_Function24423: ; 24423 +Unreferenced_Function24423: ld a, [wVramState] bit 0, a ret z @@ -755,22 +723,19 @@ Unreferenced_Function24423: ; 24423 jr nz, .loop call CloseSRAM ret -; 2445d -Error_Cant_ExitMenu: ; 2445d +Error_Cant_ExitMenu: ld hl, .Text_NoWindowsAvailableForPopping call PrintText call WaitBGMap .InfiniteLoop: jr .InfiniteLoop -; 24468 -.Text_NoWindowsAvailableForPopping: ; 24468 +.Text_NoWindowsAvailableForPopping: text_jump UnknownText_0x1c46b7 db "@" -; 2446d -_InitVerticalMenuCursor:: ; 2446d +_InitVerticalMenuCursor:: ld a, [wMenuDataFlags] ld b, a ld hl, w2DMenuCursorInitY @@ -838,4 +803,3 @@ _InitVerticalMenuCursor:: ; 2446d ld [hli], a ld [hli], a ret -; 244c3 diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index 16cce5348..b039b590f 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -1,4 +1,4 @@ -PlaceMenuItemName: ; 0x24ab4 +PlaceMenuItemName: push de ld a, [wMenuSelection] ld [wNamedObjectIndexBuffer], a @@ -7,7 +7,7 @@ PlaceMenuItemName: ; 0x24ab4 call PlaceString ret -PlaceMenuItemQuantity: ; 0x24ac3 +PlaceMenuItemQuantity: push de ld a, [wMenuSelection] ld [wCurItem], a @@ -27,22 +27,22 @@ PlaceMenuItemQuantity: ; 0x24ac3 .done ret -PlaceMoneyTopRight: ; 24ae8 +PlaceMoneyTopRight: ld hl, MenuHeader_0x24b15 call CopyMenuHeader jr PlaceMoneyTextBox -PlaceMoneyBottomLeft: ; 24af0 +PlaceMoneyBottomLeft: ld hl, MenuHeader_0x24b1d call CopyMenuHeader jr PlaceMoneyTextBox -PlaceMoneyAtTopLeftOfTextbox: ; 24af8 +PlaceMoneyAtTopLeftOfTextbox: ld hl, MenuHeader_0x24b15 lb de, 0, 11 call OffsetMenuHeader -PlaceMoneyTextBox: ; 24b01 +PlaceMoneyTextBox: call MenuBox call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 @@ -52,19 +52,19 @@ PlaceMoneyTextBox: ; 24b01 call PrintNum ret -MenuHeader_0x24b15: ; 0x24b15 +MenuHeader_0x24b15: db MENU_BACKUP_TILES ; flags menu_coords 11, 0, SCREEN_WIDTH - 1, 2 dw NULL db 1 ; default option -MenuHeader_0x24b1d: ; 0x24b1d +MenuHeader_0x24b1d: db MENU_BACKUP_TILES ; flags menu_coords 0, 11, 8, 13 dw NULL db 1 ; default option -DisplayCoinCaseBalance: ; 24b25 +DisplayCoinCaseBalance: ; Place a text box of size 1x7 at 11, 0. hlcoord 11, 0 ld b, 1 @@ -82,7 +82,7 @@ DisplayCoinCaseBalance: ; 24b25 call PrintNum ret -DisplayMoneyAndCoinBalance: ; 24b4e +DisplayMoneyAndCoinBalance: hlcoord 5, 0 ld b, 3 ld c, 13 @@ -103,14 +103,14 @@ DisplayMoneyAndCoinBalance: ; 24b4e call PrintNum ret -MoneyString: ; 24b83 +MoneyString: db "MONEY@" -CoinString: ; 24b89 +CoinString: db "COIN@" -ShowMoney_TerminatorString: ; 24b8e +ShowMoney_TerminatorString: db "@" -Unreferenced_Function24b8f: ; 24b8f +Unreferenced_Function24b8f: ; related to safari? ld hl, wOptions ld a, [hl] @@ -138,19 +138,19 @@ Unreferenced_Function24b8f: ; 24b8f ld [wOptions], a ret -.slash_500 ; 24bcf +.slash_500 db "/500@" -.booru_ko ; 24bd4 +.booru_ko db "ボール こ@" -StartMenu_DrawBugContestStatusBox: ; 24bdc +StartMenu_DrawBugContestStatusBox: hlcoord 0, 0 ld b, 5 ld c, 17 call TextBox ret -StartMenu_PrintBugContestStatus: ; 24be7 +StartMenu_PrintBugContestStatus: ld hl, wOptions ld a, [hl] push af @@ -194,18 +194,18 @@ StartMenu_PrintBugContestStatus: ; 24be7 ld [wOptions], a ret -.Balls_JP: ; 24c43 +.Balls_JP: db "ボール こ@" -.CAUGHT: ; 24c4b +.CAUGHT: db "CAUGHT@" -.Balls_EN: ; 24c52 +.Balls_EN: db "BALLS:@" -.None: ; 24c59 +.None: db "None@" -.LEVEL: ; 24c5e +.LEVEL: db "LEVEL@" -FindApricornsInBag: ; 24c64 +FindApricornsInBag: ; Checks the bag for Apricorns. ld hl, wBuffer1 xor a @@ -239,7 +239,7 @@ FindApricornsInBag: ; 24c64 scf ret -.addtobuffer ; 24c94 +.addtobuffer push hl ld hl, wBuffer1 inc [hl] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index a958e10eb..8a8303067 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -4,15 +4,13 @@ NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60 NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb NAMINGSCREEN_UNDERLINE EQUS "\"<DOT>\"" ; $f2 -_NamingScreen: ; 0x116b7 +_NamingScreen: call DisableSpriteUpdates call NamingScreen call ReturnToMapWithSpeechTextbox ret -; 0x116c1 - -NamingScreen: ; 116c1 +NamingScreen: ld hl, wNamingScreenDestinationPointer ld [hl], e inc hl @@ -45,9 +43,7 @@ NamingScreen: ; 116c1 call ClearJoypad ret -; 116f8 - -.SetUpNamingScreen: ; 116f8 +.SetUpNamingScreen: call ClearBGPalettes ld b, SCGB_DIPLOMA call GetSGBLayout @@ -63,9 +59,7 @@ NamingScreen: ; 116c1 call NamingScreen_InitNameEntry ret -; 1171d - -.GetNamingScreenSetup: ; 1171d +.GetNamingScreenSetup: ld a, [wNamingScreenType] and 7 ld e, a @@ -78,9 +72,7 @@ NamingScreen: ; 116c1 ld l, a jp hl -; 1172e - -.Jumptable: ; 1172e (4:572e) +.Jumptable: dw .Pokemon dw .Player dw .Rival @@ -90,7 +82,7 @@ NamingScreen: ; 116c1 dw .Pokemon dw .Pokemon -.Pokemon: ; 1173e (4:573e) +.Pokemon: ld a, [wCurPartySpecies] ld [wd265], a ld hl, LoadMenuMonIcon @@ -121,15 +113,11 @@ NamingScreen: ; 116c1 call .StoreMonIconParams ret -; 11780 (4:5780) - -.NicknameStrings: ; 11780 +.NicknameStrings: db "'S@" db "NICKNAME?@" -; 1178d - -.Player: ; 1178d (4:578d) +.Player: farcall GetPlayerIcon call .LoadSprite hlcoord 5, 2 @@ -138,14 +126,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117a3 (4:57a3) - -.PlayerNameString: ; 117a3 +.PlayerNameString: db "YOUR NAME?@" -; 117ae - -.Rival: ; 117ae (4:57ae) +.Rival: ld de, SilverSpriteGFX ld b, BANK(SilverSpriteGFX) call .LoadSprite @@ -155,14 +139,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117c3 (4:57c3) - -.RivalNameString: ; 117c3 +.RivalNameString: db "RIVAL'S NAME?@" -; 117d1 - -.Mom: ; 117d1 (4:57d1) +.Mom: ld de, MomSpriteGFX ld b, BANK(MomSpriteGFX) call .LoadSprite @@ -172,14 +152,10 @@ NamingScreen: ; 116c1 call .StoreSpriteIconParams ret -; 117e6 (4:57e6) - -.MomNameString: ; 117e6 +.MomNameString: db "MOTHER'S NAME?@" -; 117f5 - -.Box: ; 117f5 (4:57f5) +.Box: ld de, PokeBallSpriteGFX ld hl, vTiles0 tile $00 lb bc, BANK(PokeBallSpriteGFX), 4 @@ -200,28 +176,20 @@ NamingScreen: ; 116c1 call .StoreBoxIconParams ret -; 11822 (4:5822) - -.BoxNameString: ; 11822 +.BoxNameString: db "BOX NAME?@" -; 1182c - -.Tomodachi: ; 1182c (4:582c) +.Tomodachi: hlcoord 3, 2 ld de, .oTomodachi_no_namae_sutoringu call PlaceString call .StoreSpriteIconParams ret -; 11839 (4:5839) - -.oTomodachi_no_namae_sutoringu ; 11839 +.oTomodachi_no_namae_sutoringu db "おともだち の なまえは?@" -; 11847 - -.LoadSprite: ; 11847 (4:5847) +.LoadSprite: push de ld hl, vTiles0 tile $00 ld c, $4 @@ -253,22 +221,22 @@ NamingScreen: ; 116c1 call _InitSpriteAnimStruct ret -.StoreMonIconParams: ; 1187b (4:587b) +.StoreMonIconParams: ld a, MON_NAME_LENGTH - 1 hlcoord 5, 6 jr .StoreParams -.StoreSpriteIconParams: ; 11882 (4:5882) +.StoreSpriteIconParams: ld a, PLAYER_NAME_LENGTH - 1 hlcoord 5, 6 jr .StoreParams -.StoreBoxIconParams: ; 11889 (4:5889) +.StoreBoxIconParams: ld a, BOX_NAME_LENGTH - 1 hlcoord 5, 4 jr .StoreParams -.StoreParams: ; 11890 (4:5890) +.StoreParams: ld [wNamingScreenMaxNameLength], a ld a, l ld [wNamingScreenStringEntryCoord], a @@ -276,7 +244,7 @@ NamingScreen: ; 116c1 ld [wNamingScreenStringEntryCoord + 1], a ret -NamingScreen_IsTargetBox: ; 1189c +NamingScreen_IsTargetBox: push bc push af ld a, [wNamingScreenType] @@ -287,9 +255,7 @@ NamingScreen_IsTargetBox: ; 1189c pop bc ret -; 118a8 - -NamingScreen_InitText: ; 118a8 +NamingScreen_InitText: call WaitTop hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -304,7 +270,7 @@ NamingScreen_InitText: ; 118a8 .not_box call ClearBox ld de, NameInputUpper -NamingScreen_ApplyTextInputMode: ; 118ca +NamingScreen_ApplyTextInputMode: call NamingScreen_IsTargetBox jr nz, .not_box ld hl, BoxNameInputLower - NameInputLower @@ -350,9 +316,7 @@ NamingScreen_ApplyTextInputMode: ; 118ca jr nz, .row ret -; 11915 - -NamingScreenJoypadLoop: ; 11915 +NamingScreenJoypadLoop: call JoyTextDelay ld a, [wJumptableIndex] bit 7, a @@ -373,9 +337,7 @@ NamingScreenJoypadLoop: ; 11915 scf ret -; 11940 - -.UpdateStringEntry: ; 11940 +.UpdateStringEntry: xor a ld [hBGMapMode], a hlcoord 1, 5 @@ -399,9 +361,7 @@ NamingScreenJoypadLoop: ; 11915 ld [hBGMapMode], a ret -; 11968 - -.RunJumptable: ; 11968 +.RunJumptable: ld a, [wJumptableIndex] ld e, a ld d, $0 @@ -413,13 +373,11 @@ NamingScreenJoypadLoop: ; 11915 ld l, a jp hl -; 11977 - -.Jumptable: ; 11977 (4:5977) +.Jumptable: dw .InitCursor dw .ReadButtons -.InitCursor: ; 1197b (4:597b) +.InitCursor: depixel 10, 3 call NamingScreen_IsTargetBox jr nz, .got_cursor_position @@ -441,7 +399,7 @@ NamingScreenJoypadLoop: ; 11915 inc [hl] ret -.ReadButtons: ; 119a1 (4:59a1) +.ReadButtons: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON @@ -510,13 +468,13 @@ NamingScreenJoypadLoop: ; 11915 call NamingScreen_ApplyTextInputMode ret -.GetCursorPosition: ; 11a0b (4:5a0b) +.GetCursorPosition: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl ld b, [hl] -NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) +NamingScreen_GetCursorPosition: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -551,7 +509,7 @@ NamingScreen_GetCursorPosition: ; 11a11 (4:5a11) xor a ret -NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) +NamingScreen_AnimateCursor: call .GetDPad ld hl, SPRITEANIMSTRUCT_0D add hl, bc @@ -590,17 +548,13 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) ld [hl], a ret -; 11a79 (4:5a79) - -.LetterEntries: ; 11a79 +.LetterEntries: db $00, $10, $20, $30, $40, $50, $60, $70, $80 -.CaseDelEnd: ; 11a82 +.CaseDelEnd: db $00, $00, $00, $30, $30, $30, $60, $60, $60 -; 11a8b - -.GetDPad: ; 11a8b (4:5a8b) +.GetDPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -713,9 +667,9 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b) inc [hl] ret -NamingScreen_TryAddCharacter: ; 11b14 (4:5b14) +NamingScreen_TryAddCharacter: ld a, [wNamingScreenLastCharacter] ; lost -MailComposition_TryAddCharacter: ; 11b17 (4:5b17) +MailComposition_TryAddCharacter: ld a, [wNamingScreenMaxNameLength] ld c, a ld a, [wNamingScreenCurrNameLength] @@ -724,11 +678,11 @@ MailComposition_TryAddCharacter: ; 11b17 (4:5b17) ld a, [wNamingScreenLastCharacter] -NamingScreen_LoadNextCharacter: ; 11b23 +NamingScreen_LoadNextCharacter: call NamingScreen_GetTextCursorPosition ld [hl], a -NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 +NamingScreen_AdvanceCursor_CheckEndOfString: ld hl, wNamingScreenCurrNameLength inc [hl] call NamingScreen_GetTextCursorPosition @@ -743,8 +697,6 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 scf ret -; 11b39 (4:5b39) - ; unused ld a, [wNamingScreenCurrNameLength] and a @@ -769,13 +721,9 @@ NamingScreen_AdvanceCursor_CheckEndOfString: ; 11b27 ld a, [hl] jr NamingScreen_LoadNextCharacter -; 11b56 - INCLUDE "data/text/unused_dakutens.asm" -; 11bbc - -NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) +NamingScreen_DeleteCharacter: ld hl, wNamingScreenCurrNameLength ld a, [hl] and a @@ -790,7 +738,7 @@ NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc) ld [hl], NAMINGSCREEN_MIDDLELINE ret -NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) +NamingScreen_GetTextCursorPosition: push af ld hl, wNamingScreenDestinationPointer ld a, [hli] @@ -803,9 +751,7 @@ NamingScreen_GetTextCursorPosition: ; 11bd0 (4:5bd0) pop af ret -; 11be0 - -NamingScreen_InitNameEntry: ; 11be0 +NamingScreen_InitNameEntry: ; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer ld hl, wNamingScreenDestinationPointer ld a, [hli] @@ -824,9 +770,7 @@ NamingScreen_InitNameEntry: ; 11be0 ld [hl], "@" ret -; 11bf7 - -NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) +NamingScreen_StoreEntry: ld hl, wNamingScreenDestinationPointer ld a, [hli] ld h, [hl] @@ -847,7 +791,7 @@ NamingScreen_StoreEntry: ; 11bf7 (4:5bf7) jr nz, .loop ret -NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) +NamingScreen_GetLastCharacter: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl @@ -890,7 +834,7 @@ NamingScreen_GetLastCharacter: ; 11c11 (4:5c11) ld [wNamingScreenLastCharacter], a ret -LoadNamingScreenGFX: ; 11c51 +LoadNamingScreenGFX: call ClearSprites callfar ClearSpriteAnims call LoadStandardFont @@ -935,32 +879,24 @@ LoadNamingScreenGFX: ; 11c51 ld [hWX], a ret -; 11cb7 - -NamingScreenGFX_Border: ; 11cb7 +NamingScreenGFX_Border: INCBIN "gfx/naming_screen/border.2bpp" -; 11cc7 -NamingScreenGFX_Cursor: ; 11cc7 +NamingScreenGFX_Cursor: INCBIN "gfx/naming_screen/cursor.2bpp" -; 11ce7 INCLUDE "data/text/name_input_chars.asm" -; 11e5d NamingScreenGFX_End: ; unused INCBIN "gfx/naming_screen/end.1bpp" -; 11e6d NamingScreenGFX_MiddleLine: INCBIN "gfx/naming_screen/middle_line.1bpp" -; 11e6d -NamingScreenGFX_UnderLine: ; 11e6d +NamingScreenGFX_UnderLine: INCBIN "gfx/naming_screen/underline.1bpp" -; 11e75 -_ComposeMailMessage: ; 11e75 (mail?) +_ComposeMailMessage: ld hl, wNamingScreenDestinationPointer ld [hl], e inc hl @@ -986,7 +922,7 @@ _ComposeMailMessage: ; 11e75 (mail?) ld [hMapAnims], a ret -.InitBlankMail: ; 11e9a (4:5e9a) +.InitBlankMail: call ClearBGPalettes call DisableLCD call LoadNamingScreenGFX @@ -1030,25 +966,18 @@ _ComposeMailMessage: ; 11e75 (mail?) ld [hl], "<NEXT>" ret -; 11ef4 (4:5ef4) - -.MailIcon: ; 11ef4 +.MailIcon: INCBIN "gfx/icons/mail_big.2bpp" -; 11f74 -.initwNamingScreenMaxNameLength ; 11f74 (4:5f74) +.initwNamingScreenMaxNameLength ld a, MAIL_MSG_LENGTH + 1 ld [wNamingScreenMaxNameLength], a ret -; 11f7a (4:5f7a) - .UnusedString11f7a: db "メールを かいてね@" -; 11f84 - -.InitCharset: ; 11f84 (4:5f84) +.InitCharset: call WaitTop hlcoord 0, 0 ld bc, 6 * SCREEN_WIDTH @@ -1063,7 +992,7 @@ INCBIN "gfx/icons/mail_big.2bpp" call ClearBox ld de, MailEntry_Uppercase -.PlaceMailCharset: ; 11fa9 (4:5fa9) +.PlaceMailCharset: hlcoord 1, 7 ld b, 6 .next @@ -1082,7 +1011,7 @@ INCBIN "gfx/icons/mail_big.2bpp" jr nz, .next ret -.DoMailEntry: ; 11fc0 (4:5fc0) +.DoMailEntry: call JoyTextDelay ld a, [wJumptableIndex] bit 7, a @@ -1103,7 +1032,7 @@ INCBIN "gfx/icons/mail_big.2bpp" scf ret -.Update: ; 11feb (4:5feb) +.Update: xor a ld [hBGMapMode], a hlcoord 1, 1 @@ -1119,7 +1048,7 @@ INCBIN "gfx/icons/mail_big.2bpp" ld [hBGMapMode], a ret -.DoJumptable: ; 12008 (4:6008) +.DoJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -1131,11 +1060,11 @@ INCBIN "gfx/icons/mail_big.2bpp" ld l, a jp hl -.Jumptable: ; 12017 (4:6017) +.Jumptable: dw .init_blinking_cursor dw .process_joypad -.init_blinking_cursor ; 1201b (4:601b) +.init_blinking_cursor depixel 9, 2 ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR call _InitSpriteAnimStruct @@ -1153,7 +1082,7 @@ INCBIN "gfx/icons/mail_big.2bpp" inc [hl] ret -.process_joypad ; 1203a (4:603a) +.process_joypad ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON @@ -1240,7 +1169,7 @@ INCBIN "gfx/icons/mail_big.2bpp" ; called from engine/sprite_anims.asm -ComposeMail_AnimateCursor: ; 120c1 (4:60c1) +ComposeMail_AnimateCursor: call .GetDPad ld hl, SPRITEANIMSTRUCT_0D add hl, bc @@ -1274,17 +1203,13 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1) ld [hl], a ret -; 120f8 (4:60f8) - -.LetterEntries: ; 120f8 +.LetterEntries: db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90 -.CaseDelEnd: ; 12102 +.CaseDelEnd: db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60 -; 1210c - -.GetDPad: ; 1210c (4:610c) +.GetDPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -1386,13 +1311,13 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1) ld [hl], $5 ret -NamingScreen_PressedA_GetCursorCommand: ; 12185 (4:6185) +NamingScreen_PressedA_GetCursorCommand: ld hl, wNamingScreenCursorObjectPointer ld c, [hl] inc hl ld b, [hl] -ComposeMail_GetCursorPosition: ; 1218b (4:618b) +ComposeMail_GetCursorPosition: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -1420,12 +1345,10 @@ ComposeMail_GetCursorPosition: ; 1218b (4:618b) xor a ret -MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) +MailComposition_TryAddLastCharacter: ld a, [wNamingScreenLastCharacter] jp MailComposition_TryAddCharacter -; 121b2 (4:61b2) - ; unused ld a, [wNamingScreenCurrNameLength] and a @@ -1460,8 +1383,4 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac) ld a, [hl] jp NamingScreen_LoadNextCharacter -; 121dd - INCLUDE "data/text/mail_input_chars.asm" - -; 122c1 diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index c0a255cb0..4dc6c0fe1 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -1,4 +1,4 @@ -_OptionsMenu: ; e41d0 +_OptionsMenu: ld hl, hInMenu ld a, [hl] push af @@ -59,28 +59,25 @@ _OptionsMenu: ; e41d0 pop af ld [hInMenu], a ret -; e4241 - -StringOptions: ; e4241 - db "TEXT SPEED<LNBRK>" - db " :<LNBRK>" - db "BATTLE SCENE<LNBRK>" - db " :<LNBRK>" - db "BATTLE STYLE<LNBRK>" - db " :<LNBRK>" - db "SOUND<LNBRK>" - db " :<LNBRK>" - db "PRINT<LNBRK>" - db " :<LNBRK>" - db "MENU ACCOUNT<LNBRK>" - db " :<LNBRK>" - db "FRAME<LNBRK>" - db " :TYPE<LNBRK>" - db "CANCEL@" -; e42d6 +StringOptions: + db "TEXT SPEED<LF>" + db " :<LF>" + db "BATTLE SCENE<LF>" + db " :<LF>" + db "BATTLE STYLE<LF>" + db " :<LF>" + db "SOUND<LF>" + db " :<LF>" + db "PRINT<LF>" + db " :<LF>" + db "MENU ACCOUNT<LF>" + db " :<LF>" + db "FRAME<LF>" + db " :TYPE<LF>" + db "CANCEL@" -GetOptionPointer: ; e42d6 +GetOptionPointer: ld a, [wJumptableIndex] ; load the cursor position to a ld e, a ; copy it to de ld d, 0 @@ -91,7 +88,6 @@ GetOptionPointer: ; e42d6 ld h, [hl] ld l, a jp hl ; jump to the code of the current highlighted item -; e42e5 .Pointers: dw Options_TextSpeed @@ -102,15 +98,13 @@ GetOptionPointer: ; e42d6 dw Options_MenuAccount dw Options_Frame dw Options_Cancel -; e42f5 - const_def const OPT_TEXT_SPEED_FAST ; 0 const OPT_TEXT_SPEED_MED ; 1 const OPT_TEXT_SPEED_SLOW ; 2 -Options_TextSpeed: ; e42f5 +Options_TextSpeed: call GetTextSpeed ld a, [hJoyPressed] bit D_LEFT_F, a @@ -156,7 +150,6 @@ Options_TextSpeed: ; e42f5 call PlaceString and a ret -; e4331 .Strings: ; entries correspond to OPT_TEXT_SPEED_* constants @@ -167,14 +160,12 @@ Options_TextSpeed: ; e42f5 .Fast: db "FAST@" .Mid: db "MID @" .Slow: db "SLOW@" -; e4346 - -GetTextSpeed: ; e4346 +GetTextSpeed: ; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, ; with previous/next TEXT_DELAY_* values in d/e ld a, [wOptions] - and $7 + and TEXT_DELAY_MASK cp TEXT_DELAY_SLOW jr z, .slow cp TEXT_DELAY_FAST @@ -193,10 +184,8 @@ GetTextSpeed: ; e4346 ld c, OPT_TEXT_SPEED_FAST lb de, TEXT_DELAY_SLOW, TEXT_DELAY_MED ret -; e4365 - -Options_BattleScene: ; e4365 +Options_BattleScene: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -231,14 +220,11 @@ Options_BattleScene: ; e4365 call PlaceString and a ret -; e4398 .On: db "ON @" .Off: db "OFF@" -; e43a0 - -Options_BattleStyle: ; e43a0 +Options_BattleStyle: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -272,14 +258,11 @@ Options_BattleStyle: ; e43a0 call PlaceString and a ret -; e43d1 .Shift: db "SHIFT@" .Set: db "SET @" -; e43dd - -Options_Sound: ; e43dd +Options_Sound: ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a @@ -320,12 +303,9 @@ Options_Sound: ; e43dd call PlaceString and a ret -; e4416 .Mono: db "MONO @" .Stereo: db "STEREO@" -; e4424 - const_def const OPT_PRINT_LIGHTEST ; 0 @@ -334,7 +314,7 @@ Options_Sound: ; e43dd const OPT_PRINT_DARKER ; 3 const OPT_PRINT_DARKEST ; 4 -Options_Print: ; e4424 +Options_Print: call GetPrinterSetting ld a, [hJoyPressed] bit D_LEFT_F, a @@ -377,7 +357,6 @@ Options_Print: ; e4424 call PlaceString and a ret -; e445a .Strings: ; entries correspond to OPT_PRINT_* constants @@ -392,10 +371,8 @@ Options_Print: ; e4424 .Normal: db "NORMAL @" .Darker: db "DARKER @" .Darkest: db "DARKEST @" -; e4491 - -GetPrinterSetting: ; e4491 +GetPrinterSetting: ; converts GBPRINTER_* value in a to OPT_PRINT_* value in c, ; with previous/next GBPRINTER_* values in d/e ld a, [wGBPrinter] @@ -431,9 +408,8 @@ GetPrinterSetting: ; e4491 ld c, OPT_PRINT_DARKEST lb de, GBPRINTER_DARKER, GBPRINTER_LIGHTEST ret -; e44c1 -Options_MenuAccount: ; e44c1 +Options_MenuAccount: ld hl, wOptions2 ld a, [hJoyPressed] bit D_LEFT_F, a @@ -467,14 +443,11 @@ Options_MenuAccount: ; e44c1 call PlaceString and a ret -; e44f2 .Off: db "OFF@" .On: db "ON @" -; e44fa - -Options_Frame: ; e44fa +Options_Frame: ld hl, wTextBoxFrame ld a, [hJoyPressed] bit D_LEFT_F, a @@ -494,9 +467,9 @@ Options_Frame: ; e44fa dec a .Save: - and $7 + maskbits NUM_FRAMES ld [hl], a -UpdateFrame: ; e4512 +UpdateFrame: ld a, [wTextBoxFrame] hlcoord 16, 15 ; where on the screen the number is drawn add "1" @@ -504,9 +477,8 @@ UpdateFrame: ; e4512 call LoadFontsExtra and a ret -; e4520 -Options_Cancel: ; e4520 +Options_Cancel: ld a, [hJoyPressed] and A_BUTTON jr nz, .Exit @@ -516,9 +488,8 @@ Options_Cancel: ; e4520 .Exit: scf ret -; e452a -OptionsControl: ; e452a +OptionsControl: ld hl, wJumptableIndex ld a, [hJoyLast] cp D_DOWN @@ -563,9 +534,8 @@ OptionsControl: ; e452a dec [hl] scf ret -; e455c -Options_UpdateCursorPosition: ; e455c +Options_UpdateCursorPosition: hlcoord 1, 1 ld de, SCREEN_WIDTH ld c, $10 @@ -580,4 +550,3 @@ Options_UpdateCursorPosition: ; e455c call AddNTimes ld [hl], "▶" ret -; e4579 diff --git a/engine/menus/save.asm b/engine/menus/save.asm index efde37ffe..190f5f887 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -1,4 +1,4 @@ -SaveMenu: ; 14a1a +SaveMenu: call LoadStandardMenuHeader farcall DisplaySaveInfoOnSave call SpeechTextBox @@ -23,7 +23,7 @@ SaveMenu: ; 14a1a scf ret -SaveAfterLinkTrade: ; 14a58 +SaveAfterLinkTrade: call PauseGameLogic farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -35,10 +35,8 @@ SaveAfterLinkTrade: ; 14a58 farcall SaveRTC call ResumeGameLogic ret -; 14a83 - -ChangeBoxSaveGame: ; 14a83 (5:4a83) +ChangeBoxSaveGame: push de ld hl, Text_SaveOnBoxSwitch call MenuTextBox @@ -62,7 +60,7 @@ ChangeBoxSaveGame: ; 14a83 (5:4a83) pop de ret -Link_SaveGame: ; 14ab2 +Link_SaveGame: call AskOverwriteSaveFile jr c, .refused call PauseGameLogic @@ -72,9 +70,8 @@ Link_SaveGame: ; 14ab2 .refused ret -; 14ac2 -MoveMonWOMail_SaveGame: ; 14ac2 +MoveMonWOMail_SaveGame: call PauseGameLogic push de call SaveBox @@ -84,16 +81,15 @@ MoveMonWOMail_SaveGame: ; 14ac2 call LoadBox call ResumeGameLogic ret -; 14ad5 -MoveMonWOMail_InsertMon_SaveGame: ; 14ad5 +MoveMonWOMail_InsertMon_SaveGame: call PauseGameLogic push de call SaveBox pop de ld a, e ld [wCurBox], a - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -117,9 +113,8 @@ MoveMonWOMail_InsertMon_SaveGame: ; 14ad5 ld c, 24 call DelayFrames ret -; 14b34 -StartMoveMonWOMail_SaveGame: ; 14b34 +StartMoveMonWOMail_SaveGame: ld hl, Text_SaveOnMoveMonWOMail call MenuTextBox call YesNoBox @@ -136,22 +131,18 @@ StartMoveMonWOMail_SaveGame: ; 14b34 .refused scf ret -; 14b54 -PauseGameLogic: ; 14b54 +PauseGameLogic: ld a, $1 ld [wGameLogicPaused], a ret -; 14b5a -ResumeGameLogic: ; 14b5a +ResumeGameLogic: xor a ld [wGameLogicPaused], a ret -; 14b5f - -AddHallOfFameEntry: ; 14b5f +AddHallOfFameEntry: ld a, BANK(sHallOfFame) call GetSRAMBank ld hl, sHallOfFame + HOF_LENGTH * (NUM_HOF_TEAMS - 1) - 1 @@ -171,14 +162,12 @@ AddHallOfFameEntry: ; 14b5f call CopyBytes call CloseSRAM ret -; 14b85 -SaveGameData: ; 14b85 +SaveGameData: call SaveGameData_ ret -; 14b89 -AskOverwriteSaveFile: ; 14b89 +AskOverwriteSaveFile: ld a, [wSaveFileExists] and a jr z, .erase @@ -205,9 +194,8 @@ AskOverwriteSaveFile: ; 14b89 .refused scf ret -; 14baf -SaveTheGame_yesorno: ; 14baf +SaveTheGame_yesorno: ld b, BANK(Text_WouldYouLikeToSaveTheGame) call MapTextbox call LoadMenuTextBox @@ -221,9 +209,8 @@ SaveTheGame_yesorno: ; 14baf pop af and a ret -; 14bcb -CompareLoadedAndSavedPlayerID: ; 14bcb +CompareLoadedAndSavedPlayerID: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, sPlayerData + (wPlayerID - wPlayerData) @@ -237,11 +224,10 @@ CompareLoadedAndSavedPlayerID: ; 14bcb ld a, [wPlayerID + 1] cp c ret -; 14be3 -_SavingDontTurnOffThePower: ; 14be3 +_SavingDontTurnOffThePower: call SavingDontTurnOffThePower -SavedTheGame: ; 14be6 +SavedTheGame: call SaveGameData_ ; wait 32 frames ld c, $20 @@ -265,11 +251,9 @@ SavedTheGame: ; 14be6 ld c, $1e call DelayFrames ret -; 14c10 - -SaveGameData_: ; 14c10 - ld a, 1 +SaveGameData_: + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -298,9 +282,8 @@ SaveGameData_: ; 14c10 .ok call CloseSRAM ret -; 14c6b -UpdateStackTop: ; 14c6b +UpdateStackTop: ; sStackTop appears to be unused. ; It could have been used to debug stack overflow during saving. call FindStackTop @@ -327,9 +310,8 @@ UpdateStackTop: ; 14c6b .done call CloseSRAM ret -; 14c90 -FindStackTop: ; 14c90 +FindStackTop: ; Find the furthest point that sp has traversed to. ; This is distinct from the current value of sp. ld hl, wStack - $ff @@ -339,9 +321,8 @@ FindStackTop: ; 14c90 ret nz inc hl jr .loop -; 14c99 -SavingDontTurnOffThePower: ; 14c99 +SavingDontTurnOffThePower: ; Prevent joypad interrupts xor a ld [hJoypadReleased], a @@ -364,10 +345,8 @@ SavingDontTurnOffThePower: ; 14c99 ld c, $10 call DelayFrames ret -; 14cbb - -ErasePreviousSave: ; 14cbb +ErasePreviousSave: call EraseBoxes call EraseHallOfFame call EraseLinkBattleStats @@ -383,9 +362,8 @@ ErasePreviousSave: ; 14cbb ld a, $1 ld [wSavedAtLeastOnce], a ret -; 14ce2 -EraseLinkBattleStats: ; 14ce2 +EraseLinkBattleStats: ld a, BANK(sLinkBattleStats) call GetSRAMBank ld hl, sLinkBattleStats @@ -393,9 +371,8 @@ EraseLinkBattleStats: ; 14ce2 xor a call ByteFill jp CloseSRAM -; 14cf4 -EraseMysteryGift: ; 14cf4 +EraseMysteryGift: ld a, BANK(sBackupMysteryGiftItem) call GetSRAMBank ld hl, sBackupMysteryGiftItem @@ -403,9 +380,8 @@ EraseMysteryGift: ; 14cf4 xor a call ByteFill jp CloseSRAM -; 14d06 -EraseHallOfFame: ; 14d06 +EraseHallOfFame: ld a, BANK(sHallOfFame) call GetSRAMBank ld hl, sHallOfFame @@ -413,9 +389,8 @@ EraseHallOfFame: ; 14d06 xor a call ByteFill jp CloseSRAM -; 14d18 -Unreferenced_Function14d18: ; 14d18 +Unreferenced_Function14d18: ; copy .Data to SRA4:a007 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank @@ -424,9 +399,8 @@ Unreferenced_Function14d18: ; 14d18 ld bc, .DataEnd - .Data call CopyBytes jp CloseSRAM -; 14d2c -.Data: ; 14d2c +.Data: db $0d, $02, $00, $05, $00, $00 db $22, $02, $01, $05, $00, $00 db $03, $04, $05, $08, $03, $05 @@ -435,23 +409,20 @@ Unreferenced_Function14d18: ; 14d18 db $04, $07, $01, $05, $00, $00 db $0f, $05, $14, $07, $05, $05 db $11, $0c, $0c, $06, $06, $04 -; 14d5c .DataEnd -EraseBattleTowerStatus: ; 14d5c +EraseBattleTowerStatus: ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank xor a ld [sBattleTowerChallengeState], a jp CloseSRAM -; 14d68 -SaveData: ; 14d68 +SaveData: call _SaveData ret -; 14d6c -Unreferenced_Function14d6c: ; 14d6c +Unreferenced_Function14d6c: ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$a60b] ; address of MBC30 bank @@ -465,9 +436,8 @@ Unreferenced_Function14d6c: ; 14d6c ld [$a60b], a ; address of MBC30 bank call CloseSRAM ret -; 14d83 -Unreferenced_Function14d83: ; 14d83 +Unreferenced_Function14d83: ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a @@ -475,27 +445,23 @@ Unreferenced_Function14d83: ; 14d83 ld [$a60d], a ; address of MBC30 bank call CloseSRAM ret -; 14d93 -Unreferenced_Function14d93: ; 14d93 +Unreferenced_Function14d93: ld a, 7 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank xor a ld [$a000], a ; address of MBC30 bank call CloseSRAM ret -; 14da0 - -HallOfFame_InitSaveIfNeeded: ; 14da0 +HallOfFame_InitSaveIfNeeded: ld a, [wSavedAtLeastOnce] and a ret nz call ErasePreviousSave ret -; 14da9 -ValidateSave: ; 14da9 +ValidateSave: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, SAVE_CHECK_VALUE_1 @@ -503,9 +469,8 @@ ValidateSave: ; 14da9 ld a, SAVE_CHECK_VALUE_2 ld [sCheckValue2], a jp CloseSRAM -; 14dbb -SaveOptions: ; 14dbb +SaveOptions: ld a, BANK(sOptions) call GetSRAMBank ld hl, wOptions @@ -516,9 +481,8 @@ SaveOptions: ; 14dbb and $ff ^ (1 << NO_TEXT_SCROLL) ld [sOptions], a jp CloseSRAM -; 14dd7 -SavePlayerData: ; 14dd7 +SavePlayerData: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, wPlayerData @@ -530,9 +494,8 @@ SavePlayerData: ; 14dd7 ld bc, wCurrMapDataEnd - wCurrMapData call CopyBytes jp CloseSRAM -; 14df7 -SavePokemonData: ; 14df7 +SavePokemonData: ld a, BANK(sPokemonData) call GetSRAMBank ld hl, wPokemonData @@ -541,15 +504,13 @@ SavePokemonData: ; 14df7 call CopyBytes call CloseSRAM ret -; 14e0c -SaveBox: ; 14e0c +SaveBox: call GetBoxAddress call SaveBoxAddress ret -; 14e13 -SaveChecksum: ; 14e13 +SaveChecksum: ld hl, sGameData ld bc, sGameDataEnd - sGameData ld a, BANK(sGameData) @@ -561,9 +522,8 @@ SaveChecksum: ; 14e13 ld [sChecksum + 1], a call CloseSRAM ret -; 14e2d -ValidateBackupSave: ; 14e2d +ValidateBackupSave: ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2) call GetSRAMBank ld a, SAVE_CHECK_VALUE_1 @@ -572,9 +532,8 @@ ValidateBackupSave: ; 14e2d ld [sBackupCheckValue2], a call CloseSRAM ret -; 14e40 -SaveBackupOptions: ; 14e40 +SaveBackupOptions: ld a, BANK(sBackupOptions) call GetSRAMBank ld hl, wOptions @@ -583,9 +542,8 @@ SaveBackupOptions: ; 14e40 call CopyBytes call CloseSRAM ret -; 14e55 -SaveBackupPlayerData: ; 14e55 +SaveBackupPlayerData: ld a, BANK(sBackupPlayerData) call GetSRAMBank ld hl, wPlayerData @@ -598,9 +556,8 @@ SaveBackupPlayerData: ; 14e55 call CopyBytes call CloseSRAM ret -; 14e76 -SaveBackupPokemonData: ; 14e76 +SaveBackupPokemonData: ld a, BANK(sBackupPokemonData) call GetSRAMBank ld hl, wPokemonData @@ -609,9 +566,8 @@ SaveBackupPokemonData: ; 14e76 call CopyBytes call CloseSRAM ret -; 14e8b -SaveBackupChecksum: ; 14e8b +SaveBackupChecksum: ld hl, sBackupGameData ld bc, sBackupGameDataEnd - sBackupGameData ld a, BANK(sBackupGameData) @@ -623,10 +579,8 @@ SaveBackupChecksum: ; 14e8b ld [sBackupChecksum + 1], a call CloseSRAM ret -; 14ea5 - -TryLoadSaveFile: ; 14ea5 (5:4ea5) +TryLoadSaveFile: call VerifyChecksum jr nz, .backup call LoadPlayerData @@ -672,9 +626,8 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5) scf ret - -TryLoadSaveData: ; 14f1c - xor a +TryLoadSaveData: + xor a ; FALSE ld [wSaveFileExists], a call CheckPrimarySaveFile ld a, [wSaveFileExists] @@ -720,13 +673,10 @@ TryLoadSaveData: ; 14f1c call CopyBytes call PanicResetClock ret -; 14f7c - INCLUDE "data/default_options.asm" - -CheckPrimarySaveFile: ; 14f84 +CheckPrimarySaveFile: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, [sCheckValue1] @@ -740,15 +690,14 @@ CheckPrimarySaveFile: ; 14f84 ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a .nope call CloseSRAM ret -; 14faf -CheckBackupSaveFile: ; 14faf +CheckBackupSaveFile: ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2) call GetSRAMBank ld a, [sBackupCheckValue1] @@ -767,10 +716,8 @@ CheckBackupSaveFile: ; 14faf .nope call CloseSRAM ret -; 14fd7 - -LoadPlayerData: ; 14fd7 (5:4fd7) +LoadPlayerData: ld a, BANK(sPlayerData) call GetSRAMBank ld hl, sPlayerData @@ -793,7 +740,7 @@ LoadPlayerData: ; 14fd7 (5:4fd7) call CloseSRAM ret -LoadPokemonData: ; 1500c +LoadPokemonData: ld a, BANK(sPokemonData) call GetSRAMBank ld hl, sPokemonData @@ -802,14 +749,13 @@ LoadPokemonData: ; 1500c call CopyBytes call CloseSRAM ret -; 15021 -LoadBox: ; 15021 (5:5021) +LoadBox: call GetBoxAddress call LoadBoxAddress ret -VerifyChecksum: ; 15028 (5:5028) +VerifyChecksum: ld hl, sGameData ld bc, sGameDataEnd - sGameData ld a, BANK(sGameData) @@ -826,7 +772,7 @@ VerifyChecksum: ; 15028 (5:5028) pop af ret -LoadBackupPlayerData: ; 15046 (5:5046) +LoadBackupPlayerData: ld a, BANK(sBackupPlayerData) call GetSRAMBank ld hl, sBackupPlayerData @@ -840,7 +786,7 @@ LoadBackupPlayerData: ; 15046 (5:5046) call CloseSRAM ret -LoadBackupPokemonData: ; 15067 (5:5067) +LoadBackupPokemonData: ld a, BANK(sBackupPokemonData) call GetSRAMBank ld hl, sBackupPokemonData @@ -850,7 +796,7 @@ LoadBackupPokemonData: ; 15067 (5:5067) call CloseSRAM ret -VerifyBackupChecksum: ; 1507c (5:507c) +VerifyBackupChecksum: ld hl, sBackupGameData ld bc, sBackupGameDataEnd - sBackupGameData ld a, BANK(sBackupGameData) @@ -867,8 +813,7 @@ VerifyBackupChecksum: ; 1507c (5:507c) pop af ret - -_SaveData: ; 1509a +_SaveData: ; This is called within two scenarios: ; a) ErasePreviousSave (the process of erasing the save from a previous game file) ; b) unused mobile functionality @@ -894,8 +839,7 @@ _SaveData: ; 1509a jp CloseSRAM - -_LoadData: ; 150b9 +_LoadData: ld a, BANK(sCrystalData) call GetSRAMBank ld hl, sCrystalData @@ -914,8 +858,7 @@ _LoadData: ; 150b9 jp CloseSRAM - -GetBoxAddress: ; 150d8 +GetBoxAddress: ld a, [wCurBox] cp NUM_BOXES jr c, .ok @@ -940,9 +883,8 @@ endr ld l, a pop af ret -; 150f9 -SaveBoxAddress: ; 150f9 +SaveBoxAddress: ; Save box via wBoxPartialData. ; We do this in three steps because the size of wBoxPartialData is less than ; the size of sBox. @@ -1016,10 +958,8 @@ SaveBoxAddress: ; 150f9 pop hl ret -; 1517d - -LoadBoxAddress: ; 1517d (5:517d) +LoadBoxAddress: ; Load box via wBoxPartialData. ; We do this in three steps because the size of wBoxPartialData is less than ; the size of sBox. @@ -1082,8 +1022,7 @@ LoadBoxAddress: ; 1517d (5:517d) pop hl ret - -EraseBoxes: ; 151fb +EraseBoxes: ld hl, BoxAddresses ld c, NUM_BOXES .next @@ -1123,9 +1062,8 @@ EraseBoxes: ; 151fb dec c jr nz, .next ret -; 1522d -BoxAddresses: ; 1522d +BoxAddresses: ; dbww bank, address, address dbww BANK(sBox1), sBox1, sBox1End dbww BANK(sBox2), sBox2, sBox2End @@ -1141,10 +1079,8 @@ BoxAddresses: ; 1522d dbww BANK(sBox12), sBox12, sBox12End dbww BANK(sBox13), sBox13, sBox13End dbww BANK(sBox14), sBox14, sBox14End -; 15273 - -Checksum: ; 15273 +Checksum: ld de, 0 .loop ld a, [hli] @@ -1158,53 +1094,43 @@ Checksum: ; 15273 or c jr nz, .loop ret -; 15283 - -Text_WouldYouLikeToSaveTheGame: ; 0x15283 +Text_WouldYouLikeToSaveTheGame: ; Would you like to save the game? text_jump UnknownText_0x1c454b db "@" -; 0x15288 -Text_SavingDontTurnOffThePower: ; 0x15288 +Text_SavingDontTurnOffThePower: ; SAVING… DON'T TURN OFF THE POWER. text_jump UnknownText_0x1c456d db "@" -; 0x1528d -Text_PlayerSavedTheGame: ; 0x1528d +Text_PlayerSavedTheGame: ; saved the game. text_jump UnknownText_0x1c4590 db "@" -; 0x15292 -Text_AlreadyASaveFile: ; 0x15292 +Text_AlreadyASaveFile: ; There is already a save file. Is it OK to overwrite? text_jump UnknownText_0x1c45a3 db "@" -; 0x15297 -Text_AnotherSaveFile: ; 0x15297 +Text_AnotherSaveFile: ; There is another save file. Is it OK to overwrite? text_jump UnknownText_0x1c45d9 db "@" -; 0x1529c -Text_SaveFileCorrupted: ; 0x1529c +Text_SaveFileCorrupted: ; The save file is corrupted! text_jump UnknownText_0x1c460d db "@" -; 0x152a1 -Text_SaveOnBoxSwitch: ; 0x152a1 +Text_SaveOnBoxSwitch: ; When you change a #MON BOX, data will be saved. OK? text_jump UnknownText_0x1c462a db "@" -; 0x152a6 -Text_SaveOnMoveMonWOMail: ; 0x152a6 +Text_SaveOnMoveMonWOMail: ; Each time you move a #MON, data will be saved. OK? text_jump UnknownText_0x1c465f db "@" -; 0x152ab diff --git a/engine/menus/savemenu_copytilemapatonce.asm b/engine/menus/savemenu_copytilemapatonce.asm index 9b50494a4..8271603d9 100644 --- a/engine/menus/savemenu_copytilemapatonce.asm +++ b/engine/menus/savemenu_copytilemapatonce.asm @@ -1,4 +1,4 @@ -SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) +SaveMenu_CopyTilemapAtOnce: ld a, [hCGB] and a jp z, WaitBGMap @@ -38,7 +38,7 @@ SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) ld [hBGMapMode], a ret -.CopyTilemapAtOnce: ; 4cf80 (13:4f80) +.CopyTilemapAtOnce: ld [hSPBuffer], sp ; $ffd9 ld sp, hl ld a, [hBGMapAddress + 1] diff --git a/engine/menus/scrolling_menu.asm b/engine/menus/scrolling_menu.asm index 3be3d839c..a313c6646 100644 --- a/engine/menus/scrolling_menu.asm +++ b/engine/menus/scrolling_menu.asm @@ -1,4 +1,4 @@ -_InitScrollingMenu:: ; 245af +_InitScrollingMenu:: xor a ld [wMenuJoypad], a ld [hBGMapMode], a @@ -12,25 +12,22 @@ _InitScrollingMenu:: ; 245af xor a ld [hBGMapMode], a ret -; 245cb -_ScrollingMenu:: ; 245cb +_ScrollingMenu:: .loop call ScrollingMenuJoyAction jp c, .exit call z, .zero jr .loop -; 245d6 -.exit ; 245d6 +.exit call MenuClickSound ld [wMenuJoypad], a ld a, 0 ld [hInMenu], a ret -; 245e1 -.zero ; 245e1 +.zero call ScrollingMenu_InitDisplay ld a, 1 ld [hBGMapMode], a @@ -39,9 +36,8 @@ _ScrollingMenu:: ; 245cb xor a ld [hBGMapMode], a ret -; 245f1 -ScrollingMenu_InitDisplay: ; 245f1 +ScrollingMenu_InitDisplay: xor a ld [hBGMapMode], a ld hl, wOptions @@ -54,9 +50,8 @@ ScrollingMenu_InitDisplay: ; 245f1 pop af ld [wOptions], a ret -; 24609 -ScrollingMenuJoyAction: ; 24609 +ScrollingMenuJoyAction: .loop call ScrollingMenuJoypad ld a, [hJoyLast] @@ -82,15 +77,13 @@ ScrollingMenuJoyAction: ; 24609 bit D_DOWN_F, a jp nz, .d_down jr .loop -; 24640 .unreferenced ; unused ld a, -1 and a ret -; 24644 -.a_button ; 24644 +.a_button call PlaceHollowCursor ld a, [wMenuCursorY] dec a @@ -109,15 +102,13 @@ ScrollingMenuJoyAction: ; 24609 ld a, A_BUTTON scf ret -; 2466f -.b_button ; 2466f +.b_button ld a, B_BUTTON scf ret -; 24673 -.select ; 24673 +.select ld a, [wMenuDataFlags] bit 7, a jp z, xor_a_dec_a @@ -133,18 +124,16 @@ ScrollingMenuJoyAction: ; 24609 ld a, SELECT scf ret -; 24695 -.start ; 24695 +.start ld a, [wMenuDataFlags] bit 6, a jp z, xor_a_dec_a ld a, START scf ret -; 246a1 -.d_left ; 246a1 +.d_left ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a_dec_a @@ -154,9 +143,8 @@ ScrollingMenuJoyAction: ; 24609 ld a, D_LEFT scf ret -; 246b5 -.d_right ; 246b5 +.d_right ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a_dec_a @@ -166,9 +154,8 @@ ScrollingMenuJoyAction: ; 24609 ld a, D_RIGHT scf ret -; 246c9 -.d_up ; 246c9 +.d_up ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a @@ -181,9 +168,8 @@ ScrollingMenuJoyAction: ; 24609 .xor_dec_up jp xor_a_dec_a -; 246df -.d_down ; 246df +.d_down ld hl, w2DMenuFlags2 bit 7, [hl] jp z, xor_a @@ -199,18 +185,16 @@ ScrollingMenuJoyAction: ; 24609 .xor_dec_down jp xor_a_dec_a -; 246fc -ScrollingMenu_GetCursorPosition: ; 246fc +ScrollingMenu_GetCursorPosition: ld a, [wMenuScrollPosition] ld c, a ld a, [wMenuCursorY] add c ld c, a ret -; 24706 -ScrollingMenu_ClearLeftColumn: ; 24706 (9:4706) +ScrollingMenu_ClearLeftColumn: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH add hl, de @@ -223,7 +207,7 @@ ScrollingMenu_ClearLeftColumn: ; 24706 (9:4706) jr nz, .loop ret -InitScrollingMenuCursor: ; 2471a +InitScrollingMenuCursor: ld hl, wMenuData_ItemsPointerAddr ld a, [hli] ld h, [hl] @@ -271,9 +255,8 @@ InitScrollingMenuCursor: ; 2471a .asm_24763 ret -; 24764 -ScrollingMenu_InitFlags: ; 24764 +ScrollingMenu_InitFlags: ld a, [wMenuDataFlags] ld c, a ld a, [wScrollingMenuListSize] @@ -343,9 +326,8 @@ ScrollingMenu_InitFlags: ; 24764 ld [wCursorCurrentTile + 1], a ld [wCursorOffCharacter], a ret -; 247dd -ScrollingMenu_ValidateSwitchItem: ; 247dd +ScrollingMenu_ValidateSwitchItem: ld a, [wScrollingMenuListSize] ld c, a ld a, [wSwitchItem] @@ -359,9 +341,8 @@ ScrollingMenu_ValidateSwitchItem: ; 247dd .done ret -; 247f0 -ScrollingMenu_UpdateDisplay: ; 247f0 +ScrollingMenu_UpdateDisplay: call ClearWholeMenuBox ld a, [wMenuDataFlags] bit 4, a ; place arrows @@ -432,9 +413,8 @@ ScrollingMenu_UpdateDisplay: ; 247f0 ld e, l ld hl, wMenuData_ScrollingMenuFunction1 jp CallPointerAt -; 2486e -ScrollingMenu_CallFunctions1and2: ; 2486e +ScrollingMenu_CallFunctions1and2: push hl ld d, h ld e, l @@ -454,9 +434,8 @@ ScrollingMenu_CallFunctions1and2: ; 2486e .done ret -; 2488b -ScrollingMenu_PlaceCursor: ; 2488b +ScrollingMenu_PlaceCursor: ld a, [wSwitchItem] and a jr z, .done @@ -486,9 +465,8 @@ ScrollingMenu_PlaceCursor: ; 2488b .done ret -; 248b8 -ScrollingMenu_CheckCallFunction3: ; 248b8 +ScrollingMenu_CheckCallFunction3: ld a, [wMenuDataFlags] bit 5, a ; call function 3 ret z @@ -505,9 +483,8 @@ ScrollingMenu_CheckCallFunction3: ; 248b8 ld hl, wMenuData_ScrollingMenuFunction3 call CallPointerAt ret -; 248d5 -ScrollingMenu_GetListItemCoordAndFunctionArgs: ; 248d5 +ScrollingMenu_GetListItemCoordAndFunctionArgs: push de push hl ld e, a @@ -540,4 +517,3 @@ ScrollingMenu_GetListItemCoordAndFunctionArgs: ; 248d5 pop hl pop de ret -; 2490c diff --git a/engine/menus/start_menu.asm b/engine/menus/start_menu.asm index 037efd947..108a4edf6 100644 --- a/engine/menus/start_menu.asm +++ b/engine/menus/start_menu.asm @@ -10,9 +10,7 @@ const STARTMENUITEM_POKEGEAR ; 7 const STARTMENUITEM_QUIT ; 8 - -StartMenu:: ; 125cd - +StartMenu:: call ClearWindowData ld de, SFX_MENU @@ -25,8 +23,8 @@ StartMenu:: ; 125cd ld hl, .MenuHeader jr z, .GotMenuData ld hl, .ContestMenuHeader -.GotMenuData: +.GotMenuData: call LoadMenuHeader call .SetUpMenuItems ld a, [wBattleMenuCursorBuffer] @@ -118,23 +116,20 @@ StartMenu:: ; 125cd .b scf ret -; 12691 -.ExitMenuRunScript: ; 12691 +.ExitMenuRunScript: call ExitMenu ld a, HMENURETURN_SCRIPT ld [hMenuReturn], a ret -; 12699 -.ExitMenuRunScriptCloseText: ; 12699 +.ExitMenuRunScriptCloseText: call ExitMenu ld a, HMENURETURN_SCRIPT ld [hMenuReturn], a jr .ReturnEnd2 -; 126a2 -.ExitMenuCallFuncCloseText: ; 126a2 +.ExitMenuCallFuncCloseText: call ExitMenu ld hl, wQueuedScriptAddr ld a, [hli] @@ -143,14 +138,12 @@ StartMenu:: ; 125cd ld a, [wQueuedScriptBank] rst FarCall jr .ReturnEnd2 -; 126b1 -.ReturnRedraw: ; 126b1 +.ReturnRedraw: call .Clear jp .Reopen -; 126b7 -.Clear: ; 126b7 +.Clear: call ClearBGPalettes call Call_ExitMenu call ReloadTilesetAndPalettes @@ -161,8 +154,6 @@ StartMenu:: ; 125cd call ret_d90 call FinishExitMenu ret -; 126d3 - .MenuHeader: db MENU_BACKUP_TILES ; flags @@ -241,17 +232,15 @@ StartMenu:: ; 125cd db "Quit and" next "be judged.@" - -.OpenMenu: ; 127e5 +.OpenMenu: ld a, [wMenuSelection] call .GetMenuAccountTextPointer ld a, [hli] ld h, [hl] ld l, a jp hl -; 127ef -.MenuString: ; 127ef +.MenuString: push de ld a, [wMenuSelection] call .GetMenuAccountTextPointer @@ -263,9 +252,8 @@ StartMenu:: ; 125cd pop hl call PlaceString ret -; 12800 -.MenuDesc: ; 12800 +.MenuDesc: push de ld a, [wMenuSelection] cp $ff @@ -283,10 +271,8 @@ endr .none pop de ret -; 12819 - -.GetMenuAccountTextPointer: ; 12819 +.GetMenuAccountTextPointer: ld e, a ld d, 0 ld hl, wMenuDataPointerTableAddr @@ -297,10 +283,8 @@ rept 6 add hl, de endr ret -; 12829 - -.SetUpMenuItems: ; 12829 +.SetUpMenuItems: xor a ld [wWhichIndexSet], a call .FillMenuList @@ -358,10 +342,8 @@ endr ld a, c ld [wMenuItemsList], a ret -; 1288d - -.FillMenuList: ; 1288d +.FillMenuList: xor a ld hl, wMenuItemsList ld [hli], a @@ -371,28 +353,24 @@ endr ld de, wMenuItemsList + 1 ld c, 0 ret -; 128a0 -.AppendMenuList: ; 128a0 +.AppendMenuList: ld [de], a inc de inc c ret -; 128a4 -.DrawMenuAccount_: ; 128a4 +.DrawMenuAccount_: jp .DrawMenuAccount -; 128a7 -.PrintMenuAccount: ; 128a7 +.PrintMenuAccount: call .IsMenuAccountOn ret z call .DrawMenuAccount decoord 0, 14 jp .MenuDesc -; 128b4 -.DrawMenuAccount: ; 128b4 +.DrawMenuAccount: call .IsMenuAccountOn ret z hlcoord 0, 13 @@ -402,23 +380,20 @@ endr ld b, 3 ld c, 8 jp TextBoxPalette -; 128cb -.IsMenuAccountOn: ; 128cb +.IsMenuAccountOn: ld a, [wOptions2] and 1 << MENU_ACCOUNT ret -; 128d1 -.DrawBugContestStatusBox: ; 128d1 +.DrawBugContestStatusBox: ld hl, wStatusFlags2 bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] ret z farcall StartMenu_DrawBugContestStatusBox ret -; 128de -.DrawBugContestStatus: ; 128de +.DrawBugContestStatus: ld hl, wStatusFlags2 bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] jr nz, .contest @@ -426,18 +401,14 @@ endr .contest farcall StartMenu_PrintBugContestStatus ret -; 128ed - -StartMenu_Exit: ; 128ed +StartMenu_Exit: ; Exit the menu. ld a, 1 ret -; 128f0 - -StartMenu_Quit: ; 128f0 +StartMenu_Quit: ; Retire from the bug catching contest. ld hl, .EndTheContestText @@ -456,10 +427,8 @@ StartMenu_Quit: ; 128f0 .EndTheContestText: text_jump UnknownText_0x1c1a6c db "@" -; 1290b - -StartMenu_Save: ; 1290b +StartMenu_Save: ; Save the game. call BufferScreen @@ -470,20 +439,16 @@ StartMenu_Save: ; 1290b .asm_12919 ld a, 1 ret -; 1291c - -StartMenu_Option: ; 1291c +StartMenu_Option: ; Game options. call FadeToMenu farcall OptionsMenu ld a, 6 ret -; 12928 - -StartMenu_Status: ; 12928 +StartMenu_Status: ; Player status. call FadeToMenu @@ -491,11 +456,8 @@ StartMenu_Status: ; 12928 call CloseSubmenu ld a, 0 ret -; 12937 - - -StartMenu_Pokedex: ; 12937 +StartMenu_Pokedex: ld a, [wPartyCount] and a jr z, .asm_12949 @@ -507,21 +469,15 @@ StartMenu_Pokedex: ; 12937 .asm_12949 ld a, 0 ret -; 1294c - - -StartMenu_Pokegear: ; 1294c +StartMenu_Pokegear: call FadeToMenu farcall PokeGear call CloseSubmenu ld a, 0 ret -; 1295b - - -StartMenu_Pack: ; 1295b +StartMenu_Pack: call FadeToMenu farcall Pack ld a, [wPackUsedItem] @@ -535,11 +491,8 @@ StartMenu_Pack: ; 1295b call ExitAllMenus ld a, 4 ret -; 12976 - - -StartMenu_Pokemon: ; 12976 +StartMenu_Pokemon: ld a, [wPartyCount] and a jr z, .return @@ -586,9 +539,8 @@ StartMenu_Pokemon: ; 12976 call ExitAllMenus pop af ret -; 129d5 -HasNoItems: ; 129d5 +HasNoItems: ld a, [wNumItems] and a ret nz @@ -612,7 +564,7 @@ HasNoItems: ; 129d5 and a ret -TossItemFromPC: ; 129f4 +TossItemFromPC: push de call PartyMonItemName farcall _CheckTossableItem @@ -675,38 +627,30 @@ TossItemFromPC: ; 129f4 ; That's too impor- tant to toss out! text_jump UnknownText_0x1c1adf db "@" -; 0x12a60 -CantUseItem: ; 12a60 +CantUseItem: ld hl, CantUseItemText call MenuTextBoxWaitButton ret -; 12a67 -CantUseItemText: ; 12a67 +CantUseItemText: text_jump UnknownText_0x1c1b03 db "@" -; 12a6c - -PartyMonItemName: ; 12a6c +PartyMonItemName: ld a, [wCurItem] ld [wd265], a call GetItemName call CopyName1 ret -; 12a79 - -CancelPokemonAction: ; 12a79 +CancelPokemonAction: farcall InitPartyMenuWithCancel farcall UnfreezeMonIcons ld a, 1 ret -; 12a88 - -PokemonActionSubmenu: ; 12a88 +PokemonActionSubmenu: hlcoord 1, 15 lb bc, 2, 18 call ClearBox @@ -749,11 +693,8 @@ PokemonActionSubmenu: ; 12a88 dbw MONMENUITEM_CANCEL, CancelPokemonAction dbw MONMENUITEM_MOVE, ManagePokemonMoves dbw MONMENUITEM_MAIL, MonMailAction -; 12aec - - -SwitchPartyMons: ; 12aec +SwitchPartyMons: ; Don't try if there's nothing to switch! ld a, [wPartyCount] cp 2 @@ -802,11 +743,8 @@ SwitchPartyMons: ; 12aec ld [wPartyMenuActionText], a call CancelPokemonAction ret -; 12b60 - - -GiveTakePartyMonItem: ; 12b60 +GiveTakePartyMonItem: ; Eggs can't hold items! ld a, [wCurPartySpecies] cp EGG @@ -844,11 +782,8 @@ GiveTakePartyMonItem: ; 12b60 .cancel ld a, 3 ret -; 12ba9 - .GiveItem: - farcall DepositSellInitPackBuffers .loop @@ -877,11 +812,8 @@ GiveTakePartyMonItem: ; 12b60 .quit ret -; 12bd9 - - -TryGiveItemToPartymon: ; 12bd9 +TryGiveItemToPartymon: call SpeechTextBox call PartyMonItemName call GetPartyItemLocation @@ -942,11 +874,8 @@ TryGiveItemToPartymon: ; 12bd9 .abort ret -; 12c4c - - -GivePartyItem: ; 12c4c +GivePartyItem: call GetPartyItemLocation ld a, [wCurItem] ld [hl], a @@ -957,11 +886,8 @@ GivePartyItem: ; 12c4c .done ret -; 12c60 - - -TakePartyItem: ; 12c60 +TakePartyItem: call SpeechTextBox call GetPartyItemLocation ld a, [hl] @@ -993,10 +919,8 @@ TakePartyItem: ; 12c60 .asm_12c9a ret -; 12c9b - -GiveTakeItemMenuData: ; 12c9b +GiveTakeItemMenuData: db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .Items @@ -1007,81 +931,64 @@ GiveTakeItemMenuData: ; 12c9b db 2 ; # items db "GIVE@" db "TAKE@" -; 12caf - -TookAndMadeHoldText: ; 12caf +TookAndMadeHoldText: text_jump UnknownText_0x1c1b2c db "@" -; 12cb4 -MadeHoldText: ; 12cb4 +MadeHoldText: text_jump UnknownText_0x1c1b57 db "@" -; 12cb9 -PleaseRemoveMailText: ; 12cb9 +PleaseRemoveMailText: text_jump UnknownText_0x1c1b6f db "@" -; 12cbe -IsntHoldingAnythingText: ; 12cbe +IsntHoldingAnythingText: text_jump UnknownText_0x1c1b8e db "@" -; 12cc3 -ItemStorageIsFullText: ; 12cc3 +ItemStorageIsFullText: text_jump UnknownText_0x1c1baa db "@" -; 12cc8 -TookFromText: ; 12cc8 +TookFromText: text_jump UnknownText_0x1c1bc4 db "@" -; 12ccd -SwitchAlreadyHoldingText: ; 12ccd +SwitchAlreadyHoldingText: text_jump UnknownText_0x1c1bdc db "@" -; 12cd2 -CantBeHeldText: ; 12cd2 +CantBeHeldText: text_jump UnknownText_0x1c1c09 db "@" -; 12cd7 - -GetPartyItemLocation: ; 12cd7 +GetPartyItemLocation: push af ld a, MON_ITEM call GetPartyParamLocation pop af ret -; 12cdf - -ReceiveItemFromPokemon: ; 12cdf +ReceiveItemFromPokemon: ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, wNumItems jp ReceiveItem -; 12cea - -GiveItemToPokemon: ; 12cea (4:6cea) +GiveItemToPokemon: ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, wNumItems jp TossItem -StartMenuYesNo: ; 12cf5 +StartMenuYesNo: call MenuTextBox call YesNoBox jp ExitMenu -; 12cfe - -ComposeMailMessage: ; 12cfe (4:6cfe) +ComposeMailMessage: ld de, wTempMailMessage farcall _ComposeMailMessage ld hl, wPlayerName @@ -1110,7 +1017,7 @@ ComposeMailMessage: ; 12cfe (4:6cfe) call CloseSRAM ret -MonMailAction: ; 12d45 +MonMailAction: ; If in the time capsule or trade center, ; selecting the mail only allows you to ; read the mail. @@ -1181,15 +1088,12 @@ MonMailAction: ; 12d45 .done ld a, $3 ret -; 12dc9 - .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -; 0x12dd1 .MenuData: db STATICMENU_CURSOR ; flags @@ -1197,47 +1101,38 @@ MonMailAction: ; 12d45 db "READ@" db "TAKE@" db "QUIT@" -; 0x12de2 - .mailwilllosemessagetext ; The MAIL will lose its message. OK? text_jump UnknownText_0x1c1c22 db "@" -; 0x12de7 .tookmailfrommontext ; MAIL detached from <POKEMON>. text_jump UnknownText_0x1c1c47 db "@" -; 0x12dec .bagfulltext ; There's no space for removing MAIL. text_jump UnknownText_0x1c1c62 db "@" -; 0x12df1 .sendmailtopctext ; Send the removed MAIL to your PC? text_jump UnknownText_0x1c1c86 db "@" -; 0x12df6 .mailboxfulltext ; Your PC's MAILBOX is full. text_jump UnknownText_0x1c1ca9 db "@" -; 0x12dfb .sentmailtopctext ; The MAIL was sent to your PC. text_jump UnknownText_0x1c1cc4 db "@" -; 0x12e00 - -OpenPartyStats: ; 12e00 +OpenPartyStats: call LoadStandardMenuHeader call ClearSprites ; PartyMon @@ -1249,10 +1144,8 @@ OpenPartyStats: ; 12e00 call Call_ExitMenu ld a, 0 ret -; 12e1b - -MonMenu_Cut: ; 12e1b +MonMenu_Cut: farcall CutFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1264,10 +1157,8 @@ MonMenu_Cut: ; 12e1b .Fail: ld a, $3 ret -; 12e30 - -MonMenu_Fly: ; 12e30 +MonMenu_Fly: farcall FlyFunction ld a, [wFieldMoveSucceeded] cp $2 @@ -1290,9 +1181,8 @@ MonMenu_Fly: ; 12e30 .Unreferenced: ld a, $1 ret -; 12e55 -MonMenu_Flash: ; 12e55 +MonMenu_Flash: farcall OWFlash ld a, [wFieldMoveSucceeded] cp $1 @@ -1304,9 +1194,8 @@ MonMenu_Flash: ; 12e55 .Fail: ld a, $3 ret -; 12e6a -MonMenu_Strength: ; 12e6a +MonMenu_Strength: farcall StrengthFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1318,9 +1207,8 @@ MonMenu_Strength: ; 12e6a .Fail: ld a, $3 ret -; 12e7f -MonMenu_Whirlpool: ; 12e7f +MonMenu_Whirlpool: farcall WhirlpoolFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1332,9 +1220,8 @@ MonMenu_Whirlpool: ; 12e7f .Fail: ld a, $3 ret -; 12e94 -MonMenu_Waterfall: ; 12e94 +MonMenu_Waterfall: farcall WaterfallFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1346,9 +1233,8 @@ MonMenu_Waterfall: ; 12e94 .Fail: ld a, $3 ret -; 12ea9 -MonMenu_Teleport: ; 12ea9 +MonMenu_Teleport: farcall TeleportFunction ld a, [wFieldMoveSucceeded] and a @@ -1360,9 +1246,8 @@ MonMenu_Teleport: ; 12ea9 .Fail: ld a, $3 ret -; 12ebd -MonMenu_Surf: ; 12ebd +MonMenu_Surf: farcall SurfFunction ld a, [wFieldMoveSucceeded] and a @@ -1374,9 +1259,8 @@ MonMenu_Surf: ; 12ebd .Fail: ld a, $3 ret -; 12ed1 -MonMenu_Dig: ; 12ed1 +MonMenu_Dig: farcall DigFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1388,9 +1272,8 @@ MonMenu_Dig: ; 12ed1 .Fail: ld a, $3 ret -; 12ee6 -MonMenu_Softboiled_MilkDrink: ; 12ee6 +MonMenu_Softboiled_MilkDrink: call .CheckMonHasEnoughHP jr nc, .NotEnoughHP farcall Softboiled_MilkDrinkFunction @@ -1405,13 +1288,11 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6 ld [wPartyMenuActionText], a ld a, $3 ret -; 12f00 .Text_NotEnoughHP: ; Not enough HP! text_jump UnknownText_0x1c1ce3 db "@" -; 0x12f05 .CheckMonHasEnoughHP: ; Need to have at least (MaxHP / 5) HP left. @@ -1433,9 +1314,8 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6 ld a, [hQuotient + 1] sbc [hl] ret -; 12f26 -MonMenu_Headbutt: ; 12f26 +MonMenu_Headbutt: farcall HeadbuttFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1447,9 +1327,8 @@ MonMenu_Headbutt: ; 12f26 .Fail: ld a, $3 ret -; 12f3b -MonMenu_RockSmash: ; 12f3b +MonMenu_RockSmash: farcall RockSmashFunction ld a, [wFieldMoveSucceeded] cp $1 @@ -1461,16 +1340,14 @@ MonMenu_RockSmash: ; 12f3b .Fail: ld a, $3 ret -; 12f50 -MonMenu_SweetScent: ; 12f50 +MonMenu_SweetScent: farcall SweetScentFromMenu ld b, $4 ld a, $2 ret -; 12f5b -ChooseMoveToDelete: ; 12f5b +ChooseMoveToDelete: ld hl, wOptions ld a, [hl] push af @@ -1484,7 +1361,6 @@ ChooseMoveToDelete: ; 12f5b call ClearBGPalettes pop af ret -; 12f73 .ChooseMoveToDelete call SetUpMoveScreenBG @@ -1506,7 +1382,6 @@ ChooseMoveToDelete: ; 12f5b call PrepareToPlaceMoveData call PlaceMoveData jp .loop -; 12f9c .a_button and a @@ -1525,17 +1400,15 @@ ChooseMoveToDelete: ; 12f5b call ClearTileMap pop af ret -; 12fb2 -DeleteMoveScreenAttrs: ; 12fb2 +DeleteMoveScreenAttrs: db 3, 1 db 3, 1 db $40, $00 dn 2, 0 db D_UP | D_DOWN | A_BUTTON | B_BUTTON -; 12fba -ManagePokemonMoves: ; 12fba +ManagePokemonMoves: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -1551,9 +1424,8 @@ ManagePokemonMoves: ; 12fba .egg ld a, $0 ret -; 12fd5 -MoveScreenLoop: ; 12fd5 +MoveScreenLoop: ld a, [wCurPartyMon] inc a ld [wPartyMenuCursor], a @@ -1613,7 +1485,6 @@ MoveScreenLoop: ; 12fd5 lb bc, 8, SCREEN_WIDTH - 2 call ClearBox jp .loop -; 1305b .d_right ld a, [wMoveSwapBuffer] @@ -1678,7 +1549,6 @@ MoveScreenLoop: ; 12fd5 and a jr z, .cycle_right jr .cycle_left_loop -; 130c6 .a_button call PlayClickSFX @@ -1729,7 +1599,6 @@ MoveScreenLoop: ; 12fd5 lb bc, 1, 9 call ClearBox jp .loop -; 1313a .copy_move push hl @@ -1752,7 +1621,6 @@ MoveScreenLoop: ; 12fd5 ld a, b ld [de], a ret -; 13154 .exit xor a @@ -1761,21 +1629,18 @@ MoveScreenLoop: ; 12fd5 res 6, [hl] call ClearSprites jp ClearTileMap -; 13163 -MoveScreenAttributes: ; 13163 +MoveScreenAttributes: db 3, 1 db 3, 1 db $40, $00 dn 2, 0 db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON -; 1316b -String_MoveWhere: ; 1316b +String_MoveWhere: db "Where?@" -; 13172 -SetUpMoveScreenBG: ; 13172 +SetUpMoveScreenBG: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -1821,9 +1686,8 @@ SetUpMoveScreenBG: ; 13172 hlcoord 16, 0 lb bc, 1, 3 jp ClearBox -; 131ef -SetUpMoveList: ; 131ef +SetUpMoveList: xor a ld [hBGMapMode], a ld [wMoveSwapBuffer], a @@ -1848,9 +1712,8 @@ SetUpMoveList: ; 131ef ld b, 5 ld c, 18 jp TextBox -; 13235 -PrepareToPlaceMoveData: ; 13235 +PrepareToPlaceMoveData: ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH ld a, [wCurPartyMon] @@ -1865,9 +1728,8 @@ PrepareToPlaceMoveData: ; 13235 hlcoord 1, 12 lb bc, 5, 18 jp ClearBox -; 13256 -PlaceMoveData: ; 13256 +PlaceMoveData: xor a ld [hBGMapMode], a hlcoord 0, 10 @@ -1909,28 +1771,22 @@ PlaceMoveData: ; 13256 ld a, $1 ld [hBGMapMode], a ret -; 132ba -String_MoveType_Top: ; 132ba +String_MoveType_Top: db "┌─────┐@" -; 132c2 -String_MoveType_Bottom: ; 132c2 +String_MoveType_Bottom: db "│TYPE/└@" -; 132ca -String_MoveAtk: ; 132ca +String_MoveAtk: db "ATK/@" -; 132cf -String_MoveNoPower: ; 132cf +String_MoveNoPower: db "---@" -; 132d3 -Function132d3: ; 132d3 +Function132d3: call Function132da call Function132fe ret -; 132da -Function132da: ; 132da +Function132da: ld a, [wCurPartyMon] and a ret z @@ -1958,9 +1814,8 @@ Function132da: ; 132da hlcoord 16, 0 ld [hl], "◀" ret -; 132fe -Function132fe: ; 132fe +Function132fe: ld a, [wCurPartyMon] inc a ld c, a @@ -1990,4 +1845,3 @@ Function132fe: ; 132fe hlcoord 18, 0 ld [hl], "▶" ret -; 13327 diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index e84c1c9f3..f48636f67 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -8,7 +8,7 @@ const TRAINERCARDSTATE_PAGE3_JOYPAD ; 5 const TRAINERCARDSTATE_QUIT ; 6 -TrainerCard: ; 25105 +TrainerCard: ld a, [wVramState] push af xor a @@ -38,7 +38,7 @@ TrainerCard: ; 25105 ld [wVramState], a ret -.InitRAM: ; 2513b (9:513b) +.InitRAM: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -78,10 +78,10 @@ TrainerCard: ; 25105 ld [hl], a ; wTrainerCardBadgeAttributes ret -.RunJumptable: ; 2518e (9:518e) +.RunJumptable: jumptable .Jumptable, wJumptableIndex -.Jumptable: ; 2519d (9:519d) +.Jumptable: ; entries correspond to TRAINERCARDSTATE_* constants dw TrainerCard_Page1_LoadGFX dw TrainerCard_Page1_Joypad @@ -91,17 +91,17 @@ TrainerCard: ; 25105 dw TrainerCard_Page3_Joypad dw TrainerCard_Quit -TrainerCard_IncrementJumptable: ; 251ab (9:51ab) +TrainerCard_IncrementJumptable: ld hl, wJumptableIndex inc [hl] ret -TrainerCard_Quit: ; 251b0 (9:51b0) +TrainerCard_Quit: ld hl, wJumptableIndex set 7, [hl] ret -TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6) +TrainerCard_Page1_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -115,7 +115,7 @@ TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6) call TrainerCard_IncrementJumptable ret -TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) +TrainerCard_Page1_Joypad: call TrainerCard_Page1_PrintGameTime ld hl, hJoyLast ld a, [hl] @@ -136,9 +136,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) ld [wJumptableIndex], a ret -; 251f4 - -TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) +TrainerCard_Page2_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -156,7 +154,7 @@ TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) call TrainerCard_IncrementJumptable ret -TrainerCard_Page2_Joypad: ; 25221 (9:5221) +TrainerCard_Page2_Joypad: ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast @@ -186,7 +184,7 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) ld [wJumptableIndex], a ret -TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) +TrainerCard_Page3_LoadGFX: call ClearSprites hlcoord 0, 8 ld d, 6 @@ -204,7 +202,7 @@ TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) call TrainerCard_IncrementJumptable ret -TrainerCard_Page3_Joypad: ; 25279 (9:5279) +TrainerCard_Page3_Joypad: ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast @@ -226,7 +224,7 @@ TrainerCard_Page3_Joypad: ; 25279 (9:5279) ld [wJumptableIndex], a ret -TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) +TrainerCard_PrintTopHalfOfCard: hlcoord 0, 0 ld d, 5 call TrainerCard_InitBorder @@ -257,21 +255,18 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) predef PlaceGraphic ret -; 252ec (9:52ec) - -.Name_Money: ; 252ec +.Name_Money: db "NAME/" next "" next "MONEY@" -.ID_No: ; 252f9 +.ID_No: db $27, $28, -1 ; ID NO -.HorizontalDivider: ; 252fc +.HorizontalDivider: db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, -1 ; ____________> -; 2530a -TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) +TrainerCard_Page1_PrintDexCaught_GameTime: hlcoord 2, 10 ld de, .Dex_PlayTime call PlaceString @@ -304,11 +299,10 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) .Badges: db " BADGES▶@" -.StatusTilemap: ; 25366 +.StatusTilemap: db $29, $2a, $2b, $2c, $2d, -1 -; 2536c -TrainerCard_Page2_3_InitObjectsAndStrings: ; 2536c (9:536c) +TrainerCard_Page2_3_InitObjectsAndStrings: hlcoord 2, 8 ld de, .BadgesTilemap call TrainerCardSetup_PlaceTilemapString @@ -338,13 +332,10 @@ endr call TrainerCard_Page2_3_OAMUpdate ret -; 253a2 (9:53a2) - -.BadgesTilemap: ; 253a2 +.BadgesTilemap: db $79, $7a, $7b, $7c, $7d, -1 ; "BADGES" -; 253a8 -TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8) +TrainerCardSetup_PlaceTilemapString: .loop ld a, [de] cp -1 @@ -353,7 +344,7 @@ TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8) inc de jr .loop -TrainerCard_InitBorder: ; 253b0 (9:53b0) +TrainerCard_InitBorder: ld e, SCREEN_WIDTH .loop1 ld a, $23 @@ -411,7 +402,7 @@ TrainerCard_InitBorder: ; 253b0 (9:53b0) jr nz, .loop6 ret -TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4) +TrainerCard_Page2_3_PlaceLeadersFaces: push de push hl ld [hli], a @@ -442,7 +433,7 @@ TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4) pop de ret -TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) +TrainerCard_Page1_PrintGameTime: hlcoord 11, 12 ld de, wGameTimeHours lb bc, 2, 4 @@ -460,7 +451,7 @@ TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) ld [hl], a ret -TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438) +TrainerCard_Page2_3_AnimateBadges: ld a, [hVBlankCounter] and %111 ret nz @@ -470,7 +461,7 @@ TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438) ld [wTrainerCardBadgeFrameCounter], a jr TrainerCard_Page2_3_OAMUpdate -TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) +TrainerCard_Page2_3_OAMUpdate: ; copy flag array pointer ld a, [hli] ld e, a @@ -510,7 +501,7 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) jr nz, .loop ret -.PrepOAM: ; 2547b (9:547b) +.PrepOAM: ld a, [wTrainerCardBadgeTileID] and 1 << 7 jr nz, .xflip @@ -546,23 +537,21 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) inc de jr .loop2 -; 254a7 (9:54a7) - -.facing1 ; 254a7 +.facing1 dsprite 0, 0, 0, 0, $00, 0 dsprite 0, 0, 1, 0, $01, 0 dsprite 1, 0, 0, 0, $02, 0 dsprite 1, 0, 1, 0, $03, 0 db -1 -.facing2 ; 254b8 +.facing2 dsprite 0, 0, 0, 0, $01, 0 | X_FLIP dsprite 0, 0, 1, 0, $00, 0 | X_FLIP dsprite 1, 0, 0, 0, $03, 0 | X_FLIP dsprite 1, 0, 1, 0, $02, 0 | X_FLIP db -1 -TrainerCard_JohtoBadgesOAM: ; 254c9 +TrainerCard_JohtoBadgesOAM: ; Template OAM data for each badge on the trainer card. ; Format: ; y, x, palette @@ -611,7 +600,6 @@ TrainerCard_JohtoBadgesOAM: ; 254c9 db $80, $78, 0 db $1c, $20, $24, $20 | (1 << 7) db $1c | (1 << 7), $20, $24, $20 | (1 << 7) -; 25523 CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp" diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 1aaecf64a..97828ab58 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -3,7 +3,7 @@ INCLUDE "constants.asm" SECTION "Credits", ROMX -Credits:: ; 109847 +Credits:: bit 6, b ; Hall Of Fame ld a, $0 jr z, .okay @@ -104,18 +104,16 @@ Credits:: ; 109847 pop af ld [rSVBK], a ret -; 1098fd -Credits_HandleAButton: ; 1098fd +Credits_HandleAButton: ld a, [hJoypadDown] and A_BUTTON ret z ld a, [wJumptableIndex] bit 7, a ret -; 109908 -Credits_HandleBButton: ; 109908 +Credits_HandleBButton: ld a, [hJoypadDown] and B_BUTTON ret z @@ -136,9 +134,8 @@ Credits_HandleBButton: ; 109908 ret z dec [hl] ret -; 109926 -Credits_Jumptable: ; 109926 +Credits_Jumptable: ld a, [wJumptableIndex] and $f ld e, a @@ -150,9 +147,8 @@ Credits_Jumptable: ; 109926 ld h, [hl] ld l, a jp hl -; 109937 -.Jumptable: ; 109937 (42:5937) +.Jumptable: dw ParseCredits dw Credits_Next dw Credits_Next @@ -167,24 +163,24 @@ Credits_Jumptable: ; 109926 dw Credits_RequestGFX dw Credits_LoopBack -Credits_Next: ; 109951 (42:5951) +Credits_Next: ld hl, wJumptableIndex inc [hl] ret -Credits_LoopBack: ; 109956 (42:5956) +Credits_LoopBack: ld hl, wJumptableIndex ld a, [hl] and $f0 ld [hl], a ret -Credits_PrepBGMapUpdate: ; 10995e (42:595e) +Credits_PrepBGMapUpdate: xor a ld [hBGMapMode], a jp Credits_Next -Credits_UpdateGFXRequestPath: ; 109964 (42:5964) +Credits_UpdateGFXRequestPath: call Credits_LoadBorderGFX ld a, l ld [wRequested2bppSource], a @@ -196,14 +192,14 @@ Credits_UpdateGFXRequestPath: ; 109964 (42:5964) ld [wRequested2bppDest + 1], a jr Credits_RequestGFX -Credits_RequestGFX: ; 10997b (42:597b) +Credits_RequestGFX: xor a ld [hBGMapMode], a ld a, $8 ld [wRequested2bpp], a jp Credits_Next -Credits_LYOverride: ; 109986 (42:5986) +Credits_LYOverride: ld a, [rLY] cp $30 jr c, Credits_LYOverride @@ -217,17 +213,15 @@ Credits_LYOverride: ; 109986 (42:5986) call .Fill jp Credits_Next -.Fill: ; 1099a3 (42:59a3) +.Fill: ld c, $8 .loop ld [hli], a dec c jr nz, .loop ret -; 1099aa - -ParseCredits: ; 1099aa +ParseCredits: ld hl, wJumptableIndex bit 7, [hl] jp nz, .done @@ -397,10 +391,8 @@ ParseCredits: ; 1099aa pop de pop hl ret -; 109a95 - -ConstructCreditsTilemap: ; 109a95 (42:5a95) +ConstructCreditsTilemap: xor a ld [hBGMapMode], a ld a, $c @@ -453,7 +445,7 @@ ConstructCreditsTilemap: ; 109a95 (42:5a95) call WaitBGMap2 ret -.InitTopPortion: ; 109aff (42:5aff) +.InitTopPortion: ld b, 5 .outer_loop push hl @@ -478,7 +470,7 @@ endr jr nz, .outer_loop ret -DrawCreditsBorder: ; 109b1d (42:5b1d) +DrawCreditsBorder: ld c, SCREEN_WIDTH / 4 .loop push af @@ -492,7 +484,7 @@ endr jr nz, .loop ret -GetCreditsPalette: ; 109b2c +GetCreditsPalette: call .GetPalAddress push hl @@ -541,9 +533,8 @@ GetCreditsPalette: ; 109b2c CreditsPalettes: INCLUDE "gfx/credits/credits.pal" -; 109bca -Credits_LoadBorderGFX: ; 109bca (42:5bca) +Credits_LoadBorderGFX: ld hl, wCreditsBorderFrame ld a, [hl] cp $ff @@ -572,9 +563,8 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca) .init ld hl, wCreditsFaux2bpp ret -; 109bf1 (42:5bf1) -.Frames: ; 109bf1 +.Frames: dw CreditsPichuGFX dw CreditsPichuGFX + 16 tiles dw CreditsPichuGFX + 32 tiles @@ -591,14 +581,13 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca) dw CreditsIgglybuffGFX + 16 tiles dw CreditsIgglybuffGFX + 32 tiles dw CreditsIgglybuffGFX + 48 tiles -; 109c11 -Credits_TheEnd: ; 109c11 (42:5c11) +Credits_TheEnd: ld a, $40 hlcoord 6, 9 call .Load hlcoord 6, 10 -.Load: ; 109c1c (42:5c1c) +.Load: ld c, 8 .loop ld [hli], a @@ -606,12 +595,10 @@ Credits_TheEnd: ; 109c11 (42:5c11) dec c jr nz, .loop ret -; 109c24 (42:5c24) - CreditsBorderGFX: INCBIN "gfx/credits/border.2bpp" -CreditsMonsGFX: +CreditsMonsGFX: ; used only for BANK(CreditsMonsGFX) CreditsPichuGFX: INCBIN "gfx/credits/pichu.2bpp" CreditsSmoochumGFX: INCBIN "gfx/credits/smoochum.2bpp" CreditsDittoGFX: INCBIN "gfx/credits/ditto.2bpp" diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm index 56bb02750..467c1671a 100644 --- a/engine/movie/crystal_intro.asm +++ b/engine/movie/crystal_intro.asm @@ -1,4 +1,4 @@ -Copyright_GFPresents: ; e4579 +Copyright_GFPresents: ld de, MUSIC_NONE call PlayMusic call ClearBGPalettes @@ -47,9 +47,8 @@ Copyright_GFPresents: ; e4579 call .StopGamefreakAnim and a ret -; e45e8 -.GetGFLogoGFX: ; e45e8 +.GetGFLogoGFX: ld de, GameFreakLogo ld hl, vTiles2 lb bc, BANK(GameFreakLogo), 28 @@ -104,18 +103,16 @@ Copyright_GFPresents: ; e4579 lb de, %11100100, %11100100 call DmgToCgbObjPals ret -; e465e -.StopGamefreakAnim: ; e465e +.StopGamefreakAnim: farcall ClearSpriteAnims call ClearTileMap call ClearSprites ld c, 16 call DelayFrames ret -; e4670 -PlaceGameFreakPresents: ; e4670 +PlaceGameFreakPresents: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -126,26 +123,22 @@ PlaceGameFreakPresents: ; e4670 ld h, [hl] ld l, a jp hl -; e467f -.dw ; e467f +.dw dw PlaceGameFreakPresents_0 dw PlaceGameFreakPresents_1 dw PlaceGameFreakPresents_2 dw PlaceGameFreakPresents_3 -; e4687 -PlaceGameFreakPresents_AdvanceIndex: ; e4687 +PlaceGameFreakPresents_AdvanceIndex: ld hl, wJumptableIndex inc [hl] ret -; e468c -PlaceGameFreakPresents_0: ; e468c +PlaceGameFreakPresents_0: ret -; e468d -PlaceGameFreakPresents_1: ; e468d +PlaceGameFreakPresents_1: ld hl, wIntroSceneTimer ld a, [hl] cp $20 @@ -163,16 +156,14 @@ PlaceGameFreakPresents_1: ; e468d ld de, SFX_GAME_FREAK_PRESENTS call PlaySFX ret -; e46af .GAME_FREAK: ; G A M E _ F R E A K db 0, 1, 2, 3, 13, 4, 5, 3, 1, 6 .end db "@" -; e46ba -PlaceGameFreakPresents_2: ; e46ba +PlaceGameFreakPresents_2: ld hl, wIntroSceneTimer ld a, [hl] cp $40 @@ -188,15 +179,13 @@ PlaceGameFreakPresents_2: ; e46ba call CopyBytes call PlaceGameFreakPresents_AdvanceIndex ret -; e46d6 .presents db 7, 8, 9, 10, 11, 12 .end db "@" -; e46dd -PlaceGameFreakPresents_3: ; e46dd +PlaceGameFreakPresents_3: ld hl, wIntroSceneTimer ld a, [hl] cp $80 @@ -208,10 +197,8 @@ PlaceGameFreakPresents_3: ; e46dd ld hl, wJumptableIndex set 7, [hl] ret -; e46ed - -GameFreakLogoJumper: ; e46ed (39:46ed) +GameFreakLogoJumper: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld e, [hl] @@ -224,20 +211,20 @@ GameFreakLogoJumper: ; e46ed (39:46ed) ld l, a jp hl -GameFreakLogoScenes: ; e46fd (39:46fd) +GameFreakLogoScenes: dw GameFreakLogoScene1 dw GameFreakLogoScene2 dw GameFreakLogoScene3 dw GameFreakLogoScene4 dw GameFreakLogoScene5 -GameFreakLogoScene1: ; e4707 (39:4707) +GameFreakLogoScene1: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc inc [hl] ret -GameFreakLogoScene2: ; e470d (39:470d) +GameFreakLogoScene2: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -283,7 +270,7 @@ GameFreakLogoScene2: ; e470d (39:470d) call PlaySFX ret -GameFreakLogoScene3: ; e4759 (39:4759) +GameFreakLogoScene3: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -303,7 +290,7 @@ GameFreakLogoScene3: ; e4759 (39:4759) call PlaySFX ret -GameFreakLogoScene4: ; e4776 (39:4776) +GameFreakLogoScene4: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] @@ -336,20 +323,17 @@ GameFreakLogoScene4: ; e4776 (39:4776) add hl, bc inc [hl] call PlaceGameFreakPresents_AdvanceIndex -GameFreakLogoScene5: ; e47ab (39:47ab) +GameFreakLogoScene5: ret -; e47ac (39:47ac) -GameFreakLogoPalettes: ; e47ac +GameFreakLogoPalettes: INCLUDE "gfx/intro/gamefreak_logo.pal" -; e47cc -GameFreakLogo: ; e47cc +GameFreakLogo: INCBIN "gfx/splash/logo1.1bpp" INCBIN "gfx/splash/logo2.1bpp" -; e48ac -CrystalIntro: ; e48ac +CrystalIntro: ld a, [rSVBK] push af ld a, BANK(wGBCPalettes) @@ -359,7 +343,7 @@ CrystalIntro: ; e48ac ld a, [hVBlank] push af call .InitRAMAddrs -.loop ; e48bc +.loop call JoyTextDelay ld a, [hJoyLast] and BUTTONS @@ -394,9 +378,8 @@ CrystalIntro: ; e48ac pop af ld [rSVBK], a ret -; e4901 -.InitRAMAddrs: ; e4901 +.InitRAMAddrs: xor a ld [hVBlank], a ld a, $1 @@ -405,9 +388,8 @@ CrystalIntro: ; e48ac ld [hMapAnims], a ld [wJumptableIndex], a ret -; e490f -IntroSceneJumper: ; e490f +IntroSceneJumper: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -418,9 +400,8 @@ IntroSceneJumper: ; e490f ld h, [hl] ld l, a jp hl -; e491e -IntroScenes: ; e491e (39:491e) +IntroScenes: dw IntroScene1 dw IntroScene2 dw IntroScene3 @@ -450,12 +431,12 @@ IntroScenes: ; e491e (39:491e) dw IntroScene27 dw IntroScene28 -NextIntroScene: ; e4956 (39:4956) +NextIntroScene: ld hl, wJumptableIndex inc [hl] ret -IntroScene1: ; e495b (39:495b) +IntroScene1: ; Setup the next scene. call Intro_ClearBGPals call ClearSprites @@ -507,7 +488,7 @@ IntroScene1: ; e495b (39:495b) call NextIntroScene ret -IntroScene2: ; e49d6 (39:49d6) +IntroScene2: ; First Unown (A) fades in, pulses, then fades out. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -531,7 +512,7 @@ IntroScene2: ; e49d6 (39:49d6) call NextIntroScene ret -IntroScene3: ; e49fd (39:49fd) +IntroScene3: ; More setup. Transition to the outdoor scene. call Intro_ClearBGPals call ClearSprites @@ -579,7 +560,7 @@ IntroScene3: ; e49fd (39:49fd) call NextIntroScene ret -IntroScene4: ; e4a69 (39:4a69) +IntroScene4: ; Scroll the outdoor panorama for a bit. call Intro_PerspectiveScrollBG ld hl, wIntroSceneFrameCounter @@ -593,7 +574,7 @@ IntroScene4: ; e4a69 (39:4a69) call NextIntroScene ret -IntroScene5: ; e4a7a (39:4a7a) +IntroScene5: ; Go back to the Unown. call Intro_ClearBGPals call ClearSprites @@ -646,7 +627,7 @@ IntroScene5: ; e4a7a (39:4a7a) call NextIntroScene ret -IntroScene6: ; e4af7 (39:4af7) +IntroScene6: ; Two more Unown (I, H) fade in. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -691,7 +672,7 @@ IntroScene6: ; e4af7 (39:4af7) call NextIntroScene ret -IntroScene7: ; e4b3f (39:4b3f) +IntroScene7: ; Back to the outdoor scene. call Intro_ClearBGPals call ClearSprites @@ -762,7 +743,7 @@ IntroScene7: ; e4b3f (39:4b3f) call NextIntroScene ret -IntroScene8: ; e4bd3 (39:4bd3) +IntroScene8: ; Scroll the scene, then show Suicune running across the screen. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -791,7 +772,7 @@ IntroScene8: ; e4bd3 (39:4bd3) call NextIntroScene ret -IntroScene9: ; e4c04 (39:4c04) +IntroScene9: ; Set up the next scene (same bg). xor a ld [hLCDCPointer], a @@ -828,7 +809,7 @@ IntroScene9: ; e4c04 (39:4c04) call NextIntroScene ret -IntroScene10: ; e4c4f (39:4c4f) +IntroScene10: ; Wooper and Pichu enter. call Intro_RustleGrass ld hl, wIntroSceneFrameCounter @@ -861,7 +842,7 @@ IntroScene10: ; e4c4f (39:4c4f) call NextIntroScene ret -IntroScene11: ; e4c86 (39:4c86) +IntroScene11: ; Back to Unown again. call Intro_ClearBGPals call ClearSprites @@ -911,7 +892,7 @@ IntroScene11: ; e4c86 (39:4c86) call NextIntroScene ret -IntroScene12: ; e4cfa (39:4cfa) +IntroScene12: ; Even more Unown. call .PlayUnownSound ld hl, wIntroSceneFrameCounter @@ -951,7 +932,7 @@ IntroScene12: ; e4cfa (39:4cfa) call NextIntroScene ret -.PlayUnownSound: ; e4d36 (39:4d36) +.PlayUnownSound: ld a, [wIntroSceneFrameCounter] ld c, a ld hl, .UnownSounds @@ -973,9 +954,8 @@ IntroScene12: ; e4cfa (39:4cfa) pop de call PlaySFX ret -; e4d54 (39:4d54) -.UnownSounds: ; e4d54 +.UnownSounds: dbw $00, SFX_INTRO_UNOWN_3 dbw $20, SFX_INTRO_UNOWN_2 dbw $40, SFX_INTRO_UNOWN_1 @@ -984,9 +964,9 @@ IntroScene12: ; e4cfa (39:4cfa) dbw $90, SFX_INTRO_UNOWN_2 dbw $a0, SFX_INTRO_UNOWN_1 dbw $b0, SFX_INTRO_UNOWN_2 - db -1 ; e4d6d + db -1 -IntroScene13: ; e4d6d (39:4d6d) +IntroScene13: ; Switch scenes again. call Intro_ClearBGPals call ClearSprites @@ -1045,7 +1025,7 @@ IntroScene13: ; e4d6d (39:4d6d) call NextIntroScene ret -IntroScene14: ; e4dfa (39:4dfa) +IntroScene14: ; Suicune runs then jumps. ld a, [hSCX] sub 10 @@ -1090,7 +1070,7 @@ IntroScene14: ; e4dfa (39:4dfa) call NextIntroScene ret -IntroScene15: ; e4e40 (39:4e40) +IntroScene15: ; Transition to a new scene. call Intro_ClearBGPals call ClearSprites @@ -1154,7 +1134,7 @@ IntroScene15: ; e4e40 (39:4e40) call NextIntroScene ret -IntroScene16: ; e4edc (39:4edc) +IntroScene16: ; Suicune shows its face. An Unown appears in front. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1172,7 +1152,7 @@ IntroScene16: ; e4edc (39:4edc) call NextIntroScene ret -IntroScene17: ; e4ef5 (39:4ef5) +IntroScene17: ; ... call Intro_ClearBGPals call ClearSprites @@ -1221,7 +1201,7 @@ IntroScene17: ; e4ef5 (39:4ef5) call NextIntroScene ret -IntroScene18: ; e4f67 (39:4f67) +IntroScene18: ; Suicune close up. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1238,7 +1218,7 @@ IntroScene18: ; e4f67 (39:4f67) call NextIntroScene ret -IntroScene19: ; e4f7e (39:4f7e) +IntroScene19: ; More setup. call Intro_ClearBGPals call ClearSprites @@ -1303,7 +1283,7 @@ IntroScene19: ; e4f7e (39:4f7e) call NextIntroScene ret -IntroScene20: ; e5019 (39:5019) +IntroScene20: ; Suicune running away. A bunch of Unown appear. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1335,7 +1315,6 @@ IntroScene20: ; e5019 (39:5019) xor a call Intro_Scene20_AppearUnown ret -; e5049 (39:5049) ; unused ld a, c and $1c @@ -1350,7 +1329,7 @@ IntroScene20: ; e5019 (39:5019) call NextIntroScene ret -IntroScene21: ; e505d (39:505d) +IntroScene21: ; Suicune gets more distant and turns black. call Intro_ColoredSuicuneFrameSwap ld c, 3 @@ -1362,7 +1341,7 @@ IntroScene21: ; e505d (39:505d) call NextIntroScene ret -IntroScene22: ; e5072 (39:5072) +IntroScene22: ld hl, wIntroSceneFrameCounter ld a, [hl] inc [hl] @@ -1374,13 +1353,13 @@ IntroScene22: ; e5072 (39:5072) call NextIntroScene ret -IntroScene23: ; e5086 (39:5086) +IntroScene23: xor a ld [wIntroSceneFrameCounter], a call NextIntroScene ret -IntroScene24: ; e508e (39:508e) +IntroScene24: ; Fade to white. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1404,7 +1383,7 @@ IntroScene24: ; e508e (39:508e) call NextIntroScene ret -IntroScene25: ; e50ad (39:50ad) +IntroScene25: ; Wait around a bit. ld a, [wIntroSceneFrameCounter] dec a @@ -1416,7 +1395,7 @@ IntroScene25: ; e50ad (39:50ad) call NextIntroScene ret -IntroScene26: ; e50bb (39:50bb) +IntroScene26: ; Load the final scene. call ClearBGPalettes call ClearSprites @@ -1465,7 +1444,7 @@ IntroScene26: ; e50bb (39:50bb) call NextIntroScene ret -IntroScene27: ; e512d (39:512d) +IntroScene27: ; Spell out C R Y S T A L with Unown. ld hl, wIntroSceneTimer inc [hl] @@ -1490,7 +1469,7 @@ IntroScene27: ; e512d (39:512d) ld [wIntroSceneFrameCounter], a ret -IntroScene28: ; e5152 (39:5152) +IntroScene28: ; Cut out when the music ends, and lead into the title screen. ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1502,7 +1481,7 @@ IntroScene28: ; e5152 (39:5152) cp $8 ret nz - ld de, SFX_UNKNOWN_CB + ld de, SFX_INTRO_WHOOSH call PlaySFX ret @@ -1515,7 +1494,7 @@ IntroScene28: ; e5152 (39:5152) set 7, [hl] ret -Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172) +Intro_Scene24_ApplyPaletteFade: ; load the (a)th palette from .FadePals to all wBGPals2 ld hl, .FadePals add l @@ -1547,13 +1526,11 @@ Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172) ld a, $1 ld [hCGBPalUpdate], a ret -; e519c (39:519c) -.FadePals: ; e519c +.FadePals: INCLUDE "gfx/intro/fade.pal" -; e51dc -CrystalIntro_InitUnownAnim: ; e51dc (39:51dc) +CrystalIntro_InitUnownAnim: push de ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN call _InitSpriteAnimStruct @@ -1593,7 +1570,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc) call ReinitSpriteAnimFrame ret -CrystalIntro_UnownFade: ; e5223 (39:5223) +CrystalIntro_UnownFade: add a add a add a @@ -1673,36 +1650,32 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) ld a, $1 ld [hCGBPalUpdate], a ret -; e5288 (39:5288) -.BWFade: ; e5288 +.BWFade: ; Fade between black and white. hue = 0 rept 32 RGB hue, hue, hue hue = hue + 1 endr -; e52c8 -.BlackLBlueFade: ; e52c8 +.BlackLBlueFade: ; Fade between black and light blue. hue = 0 rept 32 RGB 0, hue / 2, hue hue = hue + 1 endr -; e5308 -.BlackBlueFade: ; e5308 +.BlackBlueFade: ; Fade between black and blue. hue = 0 rept 32 RGB 0, 0, hue hue = hue + 1 endr -; e5348 -Intro_Scene20_AppearUnown: ; e5348 (39:5348) +Intro_Scene20_AppearUnown: ; Spawn the palette for the nth Unown and a jr nz, .load_pal_2 @@ -1755,25 +1728,20 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348) ld a, $1 ld [hCGBPalUpdate], a ret -; e538d (39:538d) -.pal1 ; e538d +.pal1 RGB 24, 12, 09 RGB 31, 31, 31 RGB 12, 00, 31 RGB 00, 00, 00 -; e5395 - -.pal2 ; e5395 +.pal2 RGB 24, 12, 09 RGB 31, 31, 31 RGB 31, 31, 31 RGB 31, 31, 31 -; e539d - -Intro_FadeUnownWordPals: ; e539d (39:539d) +Intro_FadeUnownWordPals: add a add a add a @@ -1823,9 +1791,8 @@ endr ld a, $1 ld [hCGBPalUpdate], a ret -; e53db (39:53db) -.FastFadePalettes: ; e53db +.FastFadePalettes: hue = 31 rept 8 RGB hue, hue, hue @@ -1833,17 +1800,15 @@ hue = hue + -1 RGB hue, hue, hue hue = hue + -2 endr -; e53fb -.SlowFadePalettes: ; e53fb +.SlowFadePalettes: hue = 31 rept 16 RGB hue, hue, hue hue = hue + -1 endr -; e541b -Intro_LoadTilemap: ; e541b (39:541b) +Intro_LoadTilemap: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -1873,7 +1838,7 @@ Intro_LoadTilemap: ; e541b (39:541b) ld [rSVBK], a ret -Intro_Scene16_AnimateSuicune: ; e5441 (39:5441) +Intro_Scene16_AnimateSuicune: ld a, [wIntroSceneFrameCounter] and $3 jr z, Intro_ColoredSuicuneFrameSwap @@ -1886,7 +1851,7 @@ Intro_Scene16_AnimateSuicune: ; e5441 (39:5441) ld [hBGMapMode], a ret -Intro_ColoredSuicuneFrameSwap: ; e5451 (39:5451) +Intro_ColoredSuicuneFrameSwap: hlcoord 0, 0 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH .loop @@ -1907,7 +1872,7 @@ Intro_ColoredSuicuneFrameSwap: ; e5451 (39:5451) ld [hBGMapMode], a ret -Intro_RustleGrass: ; e546d (39:546d) +Intro_RustleGrass: ld a, [wIntroSceneFrameCounter] cp 36 ret nc @@ -1928,21 +1893,19 @@ Intro_RustleGrass: ; e546d (39:546d) ld a, 4 ld [wRequested2bppSize], a ret -; e5496 (39:5496) -.RustlingGrassPointers: ; e5496 +.RustlingGrassPointers: dw IntroGrass1GFX dw IntroGrass2GFX dw IntroGrass3GFX dw IntroGrass2GFX -; e549e -Intro_SetCGBPalUpdate: ; e549e (39:549e) +Intro_SetCGBPalUpdate: ld a, $1 ld [hCGBPalUpdate], a ret -Intro_ClearBGPals: ; e54a3 (39:54a3) +Intro_ClearBGPals: ld a, [rSVBK] push af ld a, BANK(wBGPals2) @@ -1961,7 +1924,7 @@ Intro_ClearBGPals: ; e54a3 (39:54a3) call DelayFrame ret -Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) +Intro_DecompressRequest2bpp_128Tiles: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -1980,7 +1943,7 @@ Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2) ld [rSVBK], a ret -Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) +Intro_DecompressRequest2bpp_255Tiles: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -1999,7 +1962,7 @@ Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de) ld [rSVBK], a ret -Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) +Intro_DecompressRequest2bpp_64Tiles: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -2018,7 +1981,7 @@ Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) ld [rSVBK], a ret -Intro_ResetLYOverrides: ; e5516 (39:5516) +Intro_ResetLYOverrides: ld a, [rSVBK] push af ld a, BANK(wLYOverrides) @@ -2035,7 +1998,7 @@ Intro_ResetLYOverrides: ; e5516 (39:5516) ld [hLCDCPointer], a ret -Intro_PerspectiveScrollBG: ; e552f (39:552f) +Intro_PerspectiveScrollBG: ld a, [rSVBK] push af ld a, BANK(wLYOverrides) @@ -2066,134 +2029,104 @@ Intro_PerspectiveScrollBG: ; e552f (39:552f) ld [rSVBK], a ret -IntroSuicuneRunGFX: ; e555d +IntroSuicuneRunGFX: INCBIN "gfx/intro/suicune_run.2bpp.lz" -; e592d -IntroPichuWooperGFX: ; e592d +IntroPichuWooperGFX: INCBIN "gfx/intro/pichu_wooper.2bpp.lz" -; e5c7d -IntroBackgroundGFX: ; e5c7d +IntroBackgroundGFX: INCBIN "gfx/intro/background.2bpp.lz" -; e5e6d -IntroTilemap004: ; e5e6d +IntroTilemap004: INCBIN "gfx/intro/004.tilemap.lz" -; e5ecd -IntroTilemap003: ; e5ecd +IntroTilemap003: INCBIN "gfx/intro/003.tilemap.lz" -; e5edd -IntroPalette1: ; e5edd +IntroPalette1: INCLUDE "gfx/intro/intro_1.pal" -; e5f5d -IntroUnownsGFX: ; e5f5d +IntroUnownsGFX: INCBIN "gfx/intro/unowns.2bpp.lz" -; e634d -IntroPulseGFX: ; e634d +IntroPulseGFX: INCBIN "gfx/intro/pulse.2bpp.lz" -; e63dd -IntroTilemap002: ; e63dd +IntroTilemap002: INCBIN "gfx/intro/002.tilemap.lz" -; e641d -IntroTilemap001: ; e641d +IntroTilemap001: INCBIN "gfx/intro/001.tilemap.lz" -; e642d -IntroTilemap006: ; e642d +IntroTilemap006: INCBIN "gfx/intro/006.tilemap.lz" -; e647d -IntroTilemap005: ; e647d +IntroTilemap005: INCBIN "gfx/intro/005.tilemap.lz" -; e649d -IntroTilemap008: ; e649d +IntroTilemap008: INCBIN "gfx/intro/008.tilemap.lz" -; e655d -IntroTilemap007: ; e655d +IntroTilemap007: INCBIN "gfx/intro/007.tilemap.lz" -; e65ad -IntroPalette2: ; e65ad +IntroPalette2: INCLUDE "gfx/intro/intro_2.pal" -; e662d -IntroCrystalUnownsGFX: ; e662d +IntroCrystalUnownsGFX: INCBIN "gfx/intro/crystal_unowns.2bpp.lz" -; e672d -IntroTilemap017: ; e672d +IntroTilemap017: INCBIN "gfx/intro/017.tilemap.lz" -; e676d -IntroTilemap015: ; e676d +IntroTilemap015: INCBIN "gfx/intro/015.tilemap.lz" -; e679d -IntroPalette3: ; e679d +IntroPalette3: INCLUDE "gfx/intro/intro_3.pal" -; e681d -IntroSuicuneCloseGFX: ; e681d +IntroSuicuneCloseGFX: INCBIN "gfx/intro/suicune_close.2bpp.lz" -; e6c3d -IntroTilemap012: ; e6c3d +IntroTilemap012: INCBIN "gfx/intro/012.tilemap.lz" -; e6d0d -IntroTilemap011: ; e6d0d +IntroTilemap011: INCBIN "gfx/intro/011.tilemap.lz" -; e6d6d -IntroPalette4: ; e6d6d +IntroPalette4: INCLUDE "gfx/intro/intro_4.pal" -; e6ded -IntroSuicuneJumpGFX: ; e6ded +IntroSuicuneJumpGFX: INCBIN "gfx/intro/suicune_jump.2bpp.lz" -; e72ad -IntroSuicuneBackGFX: ; e72ad +IntroSuicuneBackGFX: INCBIN "gfx/intro/suicune_back.2bpp.lz" -; e764d -IntroTilemap010: ; e764d +IntroTilemap010: INCBIN "gfx/intro/010.tilemap.lz" -; e76ad -IntroTilemap009: ; e76ad +IntroTilemap009: INCBIN "gfx/intro/009.tilemap.lz" -; e76bd -IntroTilemap014: ; e76bd +IntroTilemap014: INCBIN "gfx/intro/014.tilemap.lz" -; e778d -IntroTilemap013: ; e778d +IntroTilemap013: INCBIN "gfx/intro/013.tilemap.lz" -; e77dd -IntroPalette5: ; e77dd +IntroPalette5: INCLUDE "gfx/intro/intro_5.pal" -IntroUnownBackGFX: ; e785d +IntroUnownBackGFX: INCBIN "gfx/intro/unown_back.2bpp.lz" -; e799d -IntroGrass1GFX: ; e799d +IntroGrass1GFX: INCBIN "gfx/intro/grass1.2bpp" -IntroGrass2GFX: ; e79dd +IntroGrass2GFX: INCBIN "gfx/intro/grass2.2bpp" -IntroGrass3GFX: ; e7a1d +IntroGrass3GFX: INCBIN "gfx/intro/grass3.2bpp" -IntroGrass4GFX: ; e7a5d +IntroGrass4GFX: INCBIN "gfx/intro/grass4.2bpp" diff --git a/engine/movie/evolution_animation.asm b/engine/movie/evolution_animation.asm index 978f9e968..8f245f003 100644 --- a/engine/movie/evolution_animation.asm +++ b/engine/movie/evolution_animation.asm @@ -1,4 +1,4 @@ -EvolutionAnimation: ; 4e5e1 +EvolutionAnimation: push hl push de push bc @@ -27,9 +27,8 @@ EvolutionAnimation: ; 4e5e1 scf ret -; 4e607 -.EvolutionAnimation: ; 4e607 +.EvolutionAnimation: ld a, %11100100 ld [rOBP0], a @@ -150,20 +149,17 @@ EvolutionAnimation: ; 4e5e1 ld a, [wPlayerHPPal] call PlayMonCry ret -; 4e703 -.GetSGBLayout: ; 4e703 +.GetSGBLayout: ld b, SCGB_EVOLUTION jp GetSGBLayout -; 4e708 -.PlaceFrontpic: ; 4e708 +.PlaceFrontpic: call GetBaseData hlcoord 7, 2 jp PrepMonFrontpic -; 4e711 -.LoadFrontpic: ; 4e711 +.LoadFrontpic: call GetBaseData ld a, $1 ld [wBoxAlignment], a @@ -172,9 +168,8 @@ EvolutionAnimation: ; 4e5e1 xor a ld [wBoxAlignment], a ret -; 4e726 -.AnimationSequence: ; 4e726 +.AnimationSequence: call ClearJoypad lb bc, 1, 2 * 7 ; flash b times, wait c frames in between .loop @@ -195,9 +190,8 @@ EvolutionAnimation: ; 4e5e1 .exit_sequence scf ret -; 4e741 -.Flash: ; 4e741 +.Flash: ld a, -7 * 7 ; new stage ld [wEvolutionPicOffset], a call .ReplaceFrontpic @@ -207,9 +201,8 @@ EvolutionAnimation: ; 4e5e1 dec b jr nz, .Flash ret -; 4e755 -.ReplaceFrontpic: ; 4e755 +.ReplaceFrontpic: push bc xor a ld [hBGMapMode], a @@ -233,9 +226,8 @@ EvolutionAnimation: ; 4e5e1 call WaitBGMap pop bc ret -; 4e779 -.WaitFrames_CheckPressedB: ; 4e779 +.WaitFrames_CheckPressedB: call DelayFrame push bc call JoyTextDelay @@ -255,9 +247,8 @@ EvolutionAnimation: ; 4e5e1 jr nz, .loop3 scf ret -; 4e794 -.check_statused ; 4e794 +.check_statused ld a, [wCurPartyMon] ld hl, wPartyMon1Species call GetPartyLocation @@ -265,9 +256,8 @@ EvolutionAnimation: ; 4e5e1 ld c, l farcall CheckFaintedFrzSlp ret -; 4e7a6 -.PlayEvolvedSFX: ; 4e7a6 +.PlayEvolvedSFX: ld a, [wEvolutionCanceled] and a ret nz @@ -292,9 +282,8 @@ EvolutionAnimation: ; 4e5e1 pop af ld [wJumptableIndex], a ret -; 4e7cf -.balls_of_light ; 4e7cf +.balls_of_light ld hl, wJumptableIndex ld a, [hl] cp 32 @@ -311,9 +300,8 @@ EvolutionAnimation: ; 4e5e1 .done_balls scf ret -; 4e7e8 -.GenerateBallOfLight: ; 4e7e8 +.GenerateBallOfLight: push de depixel 9, 11 ld a, SPRITE_ANIM_INDEX_EVOLUTION_BALL_OF_LIGHT @@ -333,9 +321,8 @@ EvolutionAnimation: ; 4e5e1 add hl, bc ld [hl], $10 ret -; 4e80c -.AnimateBallsOfLight: ; 4e80c +.AnimateBallsOfLight: push bc callfar PlaySpriteAnimations ; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES @@ -360,8 +347,6 @@ endr pop bc call DelayFrame ret -; 4e831 - .GFX: INCBIN "gfx/evo/bubble_large.2bpp" diff --git a/engine/movie/gbc_only.asm b/engine/movie/gbc_only.asm index badd953aa..2ea8ff33c 100644 --- a/engine/movie/gbc_only.asm +++ b/engine/movie/gbc_only.asm @@ -1,5 +1,4 @@ -GBCOnlyScreen: ; 4ea82 - +GBCOnlyScreen: ld a, [hCGB] and a ret nz @@ -37,11 +36,8 @@ GBCOnlyScreen: ; 4ea82 .loop call DelayFrame jr .loop -; 4eac5 - - -DrawGBCOnlyScreen: ; 4eac5 +DrawGBCOnlyScreen: call DrawGBCOnlyBorder ; Pokemon @@ -63,11 +59,8 @@ DrawGBCOnlyScreen: ; 4eac5 call PlaceString ret -; 4eaea - - -DrawGBCOnlyBorder: ; 4eaea +DrawGBCOnlyBorder: hlcoord 0, 0 ld [hl], 0 ; top-left @@ -94,18 +87,16 @@ DrawGBCOnlyBorder: ; 4eaea ld [hl], 7 ; bottom-right ret -; 4eb15 -.FillRow: ; 4eb15 +.FillRow: ld c, SCREEN_WIDTH - 2 .next_column ld [hli], a dec c jr nz, .next_column ret -; 4eb1c -.FillColumn: ; 4eb1c +.FillColumn: ld de, SCREEN_WIDTH ld c, SCREEN_HEIGHT - 2 .next_row @@ -114,10 +105,8 @@ DrawGBCOnlyBorder: ; 4eaea dec c jr nz, .next_row ret -; 4eb27 - -DrawGBCOnlyGraphic: ; 4eb27 +DrawGBCOnlyGraphic: ld de, SCREEN_WIDTH .y push bc @@ -133,17 +122,12 @@ DrawGBCOnlyGraphic: ; 4eb27 dec c jr nz, .y ret -; 4eb38 - -GBCOnlyString: ; 4eb38 +GBCOnlyString: db "This Game Pak is" next "designed only for" next "use on the" next "Game Boy Color.@" -; 4eb76 - -GBCOnlyGFX: ; 4eb76 +GBCOnlyGFX: INCBIN "gfx/sgb/gbc_only.2bpp.lz" -; 4f0bc diff --git a/engine/movie/init_hof_credits.asm b/engine/movie/init_hof_credits.asm index e8e98a0e1..152167b76 100644 --- a/engine/movie/init_hof_credits.asm +++ b/engine/movie/init_hof_credits.asm @@ -1,4 +1,4 @@ -InitDisplayForHallOfFame: ; 4e881 +InitDisplayForHallOfFame: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -23,12 +23,12 @@ InitDisplayForHallOfFame: ; 4e881 call SetPalettes ret -.SavingRecordDontTurnOff: ; 0x4e8bd +.SavingRecordDontTurnOff: ; SAVING RECORD… DON'T TURN OFF! text_jump UnknownText_0x1bd39e db "@" -InitDisplayForRedCredits: ; 4e8c2 +InitDisplayForRedCredits: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -60,7 +60,7 @@ InitDisplayForRedCredits: ; 4e8c2 call SetPalettes ret -ResetDisplayBetweenHallOfFameMons: ; 4e906 +ResetDisplayBetweenHallOfFameMons: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) diff --git a/engine/movie/title.asm b/engine/movie/title.asm index ad1246790..eb639489f 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -1,5 +1,4 @@ -_TitleScreen: ; 10ed67 - +_TitleScreen: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -18,25 +17,21 @@ _TitleScreen: ; 10ed67 ; Turn LCD off call DisableLCD - ; VRAM bank 1 ld a, 1 ld [rVBK], a - ; Decompress running Suicune gfx ld hl, TitleSuicuneGFX ld de, vTiles1 call Decompress - ; Clear screen palettes hlbgcoord 0, 0 ld bc, 20 * BG_MAP_WIDTH xor a call ByteFill - ; Fill tile palettes: ; BG Map 1: @@ -47,7 +42,6 @@ _TitleScreen: ; 10ed67 ld a, 7 ; palette call ByteFill - ; BG Map 0: ; Apply logo gradient: @@ -78,7 +72,6 @@ _TitleScreen: ; 10ed67 ld a, 6 call ByteFill - ; 'CRYSTAL VERSION' hlbgcoord 5, 9 ld bc, NAME_LENGTH ; length of version text @@ -91,12 +84,10 @@ _TitleScreen: ; 10ed67 ld a, 0 | VRAM_BANK_1 call ByteFill - ; Back to VRAM bank 0 ld a, $0 ld [rVBK], a - ; Decompress logo ld hl, TitleLogoGFX ld de, vTiles1 @@ -107,7 +98,6 @@ _TitleScreen: ; 10ed67 ld de, vTiles0 call Decompress - ; Clear screen tiles hlbgcoord 0, 0 ld bc, 64 * BG_MAP_WIDTH @@ -157,7 +147,6 @@ _TitleScreen: ; 10ed67 pop af ld [rSVBK], a - ; LY/SCX trickery starts here ld a, [rSVBK] @@ -194,7 +183,6 @@ _TitleScreen: ; 10ed67 pop af ld [rSVBK], a - ; Reset audio call ChannelsOff call EnableLCD @@ -228,9 +216,8 @@ _TitleScreen: ; 10ed67 call PlaySFX ret -; 10eea7 -SuicuneFrameIterator: ; 10eea7 +SuicuneFrameIterator: ld hl, wd002 ld a, [hl] ld c, a @@ -257,17 +244,14 @@ SuicuneFrameIterator: ; 10eea7 ld a, $3 ld [hBGMapThird], a ret -; 10eece -.Frames: ; 10eece - db $80 ; vTiles4 tile $00 - db $88 ; vTiles4 tile $08 +.Frames: + db $80 ; vTiles3 tile $80 + db $88 ; vTiles3 tile $88 db $00 ; vTiles5 tile $00 db $08 ; vTiles5 tile $08 -; 10eed2 - -LoadSuicuneFrame: ; 10eed2 +LoadSuicuneFrame: hlcoord 6, 12 ld b, 6 .bgrows @@ -290,9 +274,8 @@ LoadSuicuneFrame: ; 10eed2 dec b jr nz, .bgrows ret -; 10eeef -DrawTitleGraphic: ; 10eeef +DrawTitleGraphic: ; input: ; hl: draw location ; b: height @@ -320,9 +303,8 @@ DrawTitleGraphic: ; 10eeef dec b jr nz, .bgrows ret -; 10ef06 -InitializeBackground: ; 10ef06 +InitializeBackground: ld hl, wVirtualOAMSprite00 ld d, -$22 ld e, $0 @@ -337,9 +319,8 @@ InitializeBackground: ; 10ef06 dec c jr nz, .loop ret -; 10ef1c -.InitColumn: ; 10ef1c +.InitColumn: ld c, $6 ld b, $40 .loop2 @@ -358,10 +339,8 @@ InitializeBackground: ; 10ef06 dec c jr nz, .loop2 ret -; 10ef32 - -AnimateTitleCrystal: ; 10ef32 +AnimateTitleCrystal: ; Move the title screen crystal downward until it's fully visible ; Stop at y=6 @@ -384,19 +363,15 @@ endr jr nz, .loop ret -; 10ef46 -TitleSuicuneGFX: ; 10ef46 +TitleSuicuneGFX: INCBIN "gfx/title/suicune.2bpp.lz" -; 10f326 -TitleLogoGFX: ; 10f326 +TitleLogoGFX: INCBIN "gfx/title/logo.2bpp.lz" -; 10fcee -TitleCrystalGFX: ; 10fcee +TitleCrystalGFX: INCBIN "gfx/title/crystal.2bpp.lz" -; 10fede TitleScreenPalettes: INCLUDE "gfx/title/title.pal" diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index 0b9c72681..e60344430 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -1,5 +1,5 @@ -TRADEANIM_RIGHT_ARROW EQU $ed -TRADEANIM_LEFT_ARROW EQU $ee +TRADEANIM_RIGHT_ARROW EQUS "\"▶\"" ; $ed +TRADEANIM_LEFT_ARROW EQUS "\"▼\"" ; $ee ; TradeAnim_TubeAnimJumptable.Jumptable indexes const_def @@ -9,7 +9,7 @@ TRADEANIM_LEFT_ARROW EQU $ee const TRADEANIMSTATE_3 ; 3 TRADEANIMJUMPTABLE_LENGTH EQU const_value -TradeAnimation: ; 28f24 +TradeAnimation: xor a ld [wcf66], a ld hl, wPlayerTrademonSenderName @@ -60,7 +60,7 @@ TradeAnimation: ; 28f24 tradeanim_scroll_out_right tradeanim_end -TradeAnimationPlayer2: ; 28f63 +TradeAnimationPlayer2: xor a ld [wcf66], a ld hl, wOTTrademonSenderName @@ -110,7 +110,7 @@ TradeAnimationPlayer2: ; 28f63 tradeanim_scroll_out_right tradeanim_end -RunTradeAnimScript: ; 28fa1 +RunTradeAnimScript: ld hl, wTradeAnimAddress ld [hl], e inc hl @@ -144,9 +144,7 @@ RunTradeAnimScript: ; 28fa1 ld [hMapAnims], a ret -; 28fdb - -.TradeAnimLayout: ; 28fdb +.TradeAnimLayout: xor a ld [wJumptableIndex], a call ClearBGPalettes @@ -212,9 +210,7 @@ RunTradeAnimScript: ; 28fa1 call TradeAnim_NormalPals ret -; 29082 - -DoTradeAnimation: ; 29082 +DoTradeAnimation: ld a, [wJumptableIndex] bit 7, a jr nz, .finished @@ -231,9 +227,7 @@ DoTradeAnimation: ; 29082 scf ret -; 290a0 - -.DoTradeAnimCommand: ; 290a0 +.DoTradeAnimCommand: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -244,9 +238,8 @@ DoTradeAnimation: ; 29082 ld h, [hl] ld l, a jp hl -; 290af -.JumpTable: ; 290af +.JumpTable: ; entries correspond to macros/scripts/trade_anims.asm enumeration dw TradeAnim_AdvanceScriptPointer ; 00 dw TradeAnim_ShowGivemonData ; 01 @@ -296,16 +289,13 @@ DoTradeAnimation: ; 29082 dw TraideAnim_Wait96 ; 2d dw TraideAnim_Wait80IfOTEgg ; 2e dw TraideAnim_Wait180IfOTEgg ; 2f -; 2910f -TradeAnim_IncrementJumptableIndex: ; 2910f +TradeAnim_IncrementJumptableIndex: ld hl, wJumptableIndex inc [hl] ret -; 29114 - -TradeAnim_AdvanceScriptPointer: ; 29114 +TradeAnim_AdvanceScriptPointer: ld hl, wTradeAnimAddress ld e, [hl] inc hl @@ -318,16 +308,12 @@ TradeAnim_AdvanceScriptPointer: ; 29114 ld [hl], e ret -; 29123 - -TradeAnim_End: ; 29123 +TradeAnim_End: ld hl, wJumptableIndex set 7, [hl] ret -; 29129 - -TradeAnim_TubeToOT1: ; 29129 +TradeAnim_TubeToOT1: ld a, TRADEANIM_RIGHT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeSendmonSpecies] @@ -337,7 +323,7 @@ TradeAnim_TubeToOT1: ; 29129 ld b, $0 jr TradeAnim_InitTubeAnim -TradeAnim_TubeToPlayer1: ; 2913c +TradeAnim_TubeToPlayer1: ld a, TRADEANIM_LEFT_ARROW call TradeAnim_PlaceTrademonStatsOnTubeAnim ld a, [wLinkTradeGetmonSpecies] @@ -345,7 +331,7 @@ TradeAnim_TubeToPlayer1: ; 2913c ld a, TRADEANIMSTATE_2 depixel 9, 18, 4, 4 ld b, $4 -TradeAnim_InitTubeAnim: ; 2914e +TradeAnim_InitTubeAnim: push bc push de push bc @@ -402,9 +388,7 @@ TradeAnim_InitTubeAnim: ; 2914e ld [wFrameCounter], a ret -; 291af - -TradeAnim_TubeToOT2: ; 291af +TradeAnim_TubeToOT2: call TradeAnim_FlashBGPals ld a, [hSCX] add $2 @@ -416,9 +400,7 @@ TradeAnim_TubeToOT2: ; 291af call TradeAnim_IncrementJumptableIndex ret -; 291c4 - -TradeAnim_TubeToOT3: ; 291c4 +TradeAnim_TubeToOT3: call TradeAnim_FlashBGPals ld a, [hSCX] add $2 @@ -430,9 +412,7 @@ TradeAnim_TubeToOT3: ; 291c4 call TradeAnim_IncrementJumptableIndex ret -; 291d9 - -TradeAnim_TubeToOT4: ; 291d9 +TradeAnim_TubeToOT4: call TradeAnim_FlashBGPals ld a, [hSCX] add $2 @@ -442,9 +422,7 @@ TradeAnim_TubeToOT4: ; 291d9 call TradeAnim_IncrementJumptableIndex ret -; 291e8 - -TradeAnim_TubeToPlayer3: ; 291e8 +TradeAnim_TubeToPlayer3: call TradeAnim_FlashBGPals ld a, [hSCX] sub $2 @@ -456,9 +434,7 @@ TradeAnim_TubeToPlayer3: ; 291e8 call TradeAnim_IncrementJumptableIndex ret -; 291fd - -TradeAnim_TubeToPlayer4: ; 291fd +TradeAnim_TubeToPlayer4: call TradeAnim_FlashBGPals ld a, [hSCX] sub $2 @@ -470,9 +446,7 @@ TradeAnim_TubeToPlayer4: ; 291fd call TradeAnim_IncrementJumptableIndex ret -; 29211 - -TradeAnim_TubeToPlayer5: ; 29211 +TradeAnim_TubeToPlayer5: call TradeAnim_FlashBGPals ld a, [hSCX] sub $2 @@ -482,19 +456,15 @@ TradeAnim_TubeToPlayer5: ; 29211 call TradeAnim_IncrementJumptableIndex ret -; 29220 - TradeAnim_TubeToOT6: -TradeAnim_TubeToPlayer6: ; 29220 +TradeAnim_TubeToPlayer6: ld a, 128 ld [wFrameCounter], a call TradeAnim_IncrementJumptableIndex ret -; 29229 - TradeAnim_TubeToOT8: -TradeAnim_TubeToPlayer8: ; 29229 +TradeAnim_TubeToPlayer8: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -515,12 +485,10 @@ TradeAnim_TubeToPlayer8: ; 29229 call TradeAnim_AdvanceScriptPointer ret -; 2925d - TradeAnim_TubeToOT5: TradeAnim_TubeToOT7: TradeAnim_TubeToPlayer2: -TradeAnim_TubeToPlayer7: ; 2925d +TradeAnim_TubeToPlayer7: call TradeAnim_FlashBGPals ld hl, wFrameCounter ld a, [hl] @@ -533,25 +501,19 @@ TradeAnim_TubeToPlayer7: ; 2925d call TradeAnim_IncrementJumptableIndex ret -; 2926d - -TradeAnim_GiveTrademonSFX: ; 2926d +TradeAnim_GiveTrademonSFX: call TradeAnim_AdvanceScriptPointer ld de, SFX_GIVE_TRADEMON call PlaySFX ret -; 29277 - -TradeAnim_GetTrademonSFX: ; 29277 +TradeAnim_GetTrademonSFX: call TradeAnim_AdvanceScriptPointer ld de, SFX_GET_TRADEMON call PlaySFX ret -; 29281 - -TradeAnim_TubeAnimJumptable: ; 29281 +TradeAnim_TubeAnimJumptable: maskbits TRADEANIMJUMPTABLE_LENGTH ld e, a ld d, 0 @@ -562,18 +524,16 @@ TradeAnim_TubeAnimJumptable: ; 29281 ld h, [hl] ld l, a jp hl -; 2928f -.Jumptable: ; 2928f +.Jumptable: ; entries correspond to TRADEANIMSTATE_* constants dw .Zero dw .One dw .Two dw .Three -; 29297 -.Zero: ; 29297 -.Three: ; 29297 +.Zero: +.Three: call TradeAnim_BlankTileMap hlcoord 9, 3 ld [hl], $5b @@ -585,9 +545,7 @@ TradeAnim_TubeAnimJumptable: ; 29281 call TradeAnim_CopyTradeGameBoyTilemap ret -; 292af - -.One: ; 292af +.One: call TradeAnim_BlankTileMap hlcoord 0, 3 ld bc, SCREEN_WIDTH @@ -595,9 +553,7 @@ TradeAnim_TubeAnimJumptable: ; 29281 call ByteFill ret -; 292be - -.Two: ; 292be +.Two: call TradeAnim_BlankTileMap hlcoord 0, 3 ld bc, $11 @@ -625,17 +581,13 @@ TradeAnim_TubeAnimJumptable: ; 29281 call TradeAnim_CopyTradeGameBoyTilemap ret -; 292ec - -TradeAnim_CopyTradeGameBoyTilemap: ; 292ec +TradeAnim_CopyTradeGameBoyTilemap: ld de, TradeGameBoyTilemap lb bc, 8, 6 call TradeAnim_CopyBoxFromDEtoHL ret -; 292f6 - -TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6 +TradeAnim_PlaceTrademonStatsOnTubeAnim: push af call ClearBGPalettes call WaitTop @@ -674,9 +626,7 @@ TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6 call ClearTileMap ret -; 29348 - -TradeAnim_EnterLinkTube1: ; 29348 +TradeAnim_EnterLinkTube1: call ClearTileMap call WaitTop ld a, $a0 @@ -698,9 +648,7 @@ TradeAnim_EnterLinkTube1: ; 29348 call TradeAnim_IncrementJumptableIndex ret -; 2937e - -TradeAnim_EnterLinkTube2: ; 2937e +TradeAnim_EnterLinkTube2: ld a, [hSCX] and a jr z, .done @@ -714,9 +662,7 @@ TradeAnim_EnterLinkTube2: ; 2937e call TradeAnim_AdvanceScriptPointer ret -; 29391 - -TradeAnim_ExitLinkTube: ; 29391 +TradeAnim_ExitLinkTube: ld a, [hSCX] cp $a0 jr z, .done @@ -731,9 +677,7 @@ TradeAnim_ExitLinkTube: ; 29391 call TradeAnim_AdvanceScriptPointer ret -; 293a6 - -TradeAnim_SetupGivemonScroll: ; 293a6 +TradeAnim_SetupGivemonScroll: ld a, $8f ld [hWX], a ld a, $88 @@ -743,9 +687,7 @@ TradeAnim_SetupGivemonScroll: ; 293a6 call TradeAnim_AdvanceScriptPointer ret -; 293b6 - -TradeAnim_DoGivemonScroll: ; 293b6 +TradeAnim_DoGivemonScroll: ld a, [hWX] cp $7 jr z, .done @@ -764,9 +706,7 @@ TradeAnim_DoGivemonScroll: ; 293b6 call TradeAnim_AdvanceScriptPointer ret -; 293d2 - -TradeAnim_FrontpicScrollStart: ; 293d2 +TradeAnim_FrontpicScrollStart: ld a, $7 ld [hWX], a ld a, $50 @@ -774,9 +714,7 @@ TradeAnim_FrontpicScrollStart: ; 293d2 call TradeAnim_AdvanceScriptPointer ret -; 293de - -TradeAnim_TextboxScrollStart: ; 293de +TradeAnim_TextboxScrollStart: ld a, $7 ld [hWX], a ld a, $90 @@ -784,9 +722,7 @@ TradeAnim_TextboxScrollStart: ; 293de call TradeAnim_AdvanceScriptPointer ret -; 293ea - -TradeAnim_ScrollOutRight: ; 293ea +TradeAnim_ScrollOutRight: call WaitTop ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a @@ -803,9 +739,7 @@ TradeAnim_ScrollOutRight: ; 293ea call TradeAnim_IncrementJumptableIndex ret -; 2940c - -TradeAnim_ScrollOutRight2: ; 2940c +TradeAnim_ScrollOutRight2: ld a, [hWX] cp $a1 jr nc, .done @@ -826,9 +760,7 @@ TradeAnim_ScrollOutRight2: ; 2940c call TradeAnim_AdvanceScriptPointer ret -; 2942e - -TradeAnim_ShowGivemonData: ; 2942e +TradeAnim_ShowGivemonData: call ShowPlayerTrademonStats ld a, [wPlayerTrademonSpecies] ld [wCurPartySpecies], a @@ -853,9 +785,7 @@ TradeAnim_ShowGivemonData: ; 2942e call TradeAnim_AdvanceScriptPointer ret -; 29461 - -TradeAnim_ShowGetmonData: ; 29461 +TradeAnim_ShowGetmonData: call ShowOTTrademonStats ld a, [wOTTrademonSpecies] ld [wCurPartySpecies], a @@ -871,16 +801,12 @@ TradeAnim_ShowGetmonData: ; 29461 call TradeAnim_AdvanceScriptPointer ret -; 29487 - -TradeAnim_AnimateFrontpic: ; 29487 +TradeAnim_AnimateFrontpic: farcall AnimateTrademonFrontpic call TradeAnim_AdvanceScriptPointer ret -; 29491 - -TradeAnim_GetFrontpic: ; 29491 +TradeAnim_GetFrontpic: push de push af predef GetUnownLetter @@ -892,9 +818,7 @@ TradeAnim_GetFrontpic: ; 29491 predef GetMonFrontpic ret -; 294a9 - -TradeAnim_GetNickname: ; 294a9 +TradeAnim_GetNickname: push de ld [wd265], a call GetPokemonName @@ -904,15 +828,13 @@ TradeAnim_GetNickname: ; 294a9 call CopyBytes ret -; 294bb - -TradeAnim_ShowGivemonFrontpic: ; 294bb +TradeAnim_ShowGivemonFrontpic: ld de, vTiles0 jr TradeAnim_ShowFrontpic -TradeAnim_ShowGetmonFrontpic: ; 294c0 +TradeAnim_ShowGetmonFrontpic: ld de, vTiles0 tile $31 -TradeAnim_ShowFrontpic: ; 294c3 +TradeAnim_ShowFrontpic: call DelayFrame ld hl, vTiles2 lb bc, 10, $31 @@ -927,58 +849,45 @@ TradeAnim_ShowFrontpic: ; 294c3 call WaitBGMap ret -; 294e7 - -TraideAnim_Wait80: ; 294e7 +TraideAnim_Wait80: ld c, 80 call DelayFrames call TradeAnim_AdvanceScriptPointer ret -; 294f0 - -TraideAnim_Wait40: ; 294f0 +TraideAnim_Wait40: ld c, 40 call DelayFrames call TradeAnim_AdvanceScriptPointer ret -; 294f9 - -TraideAnim_Wait96: ; 294f9 +TraideAnim_Wait96: ld c, 96 call DelayFrames call TradeAnim_AdvanceScriptPointer ret -; 29502 - -TraideAnim_Wait80IfOTEgg: ; 29502 +TraideAnim_Wait80IfOTEgg: call IsOTTrademonEgg ret nz ld c, 80 call DelayFrames ret -; 2950c - -TraideAnim_Wait180IfOTEgg: ; 2950c +TraideAnim_Wait180IfOTEgg: call IsOTTrademonEgg ret nz ld c, 180 call DelayFrames ret -; 29516 - -IsOTTrademonEgg: ; 29516 +IsOTTrademonEgg: call TradeAnim_AdvanceScriptPointer ld a, [wOTTrademonSpecies] cp EGG ret -; 2951f -ShowPlayerTrademonStats: ; 2951f +ShowPlayerTrademonStats: ld de, wPlayerTrademonSpecies ld a, [de] cp EGG @@ -996,9 +905,7 @@ ShowPlayerTrademonStats: ; 2951f call TrademonStats_WaitBGMap ret -; 29549 - -ShowOTTrademonStats: ; 29549 +ShowOTTrademonStats: ld de, wOTTrademonSpecies ld a, [de] cp EGG @@ -1016,9 +923,7 @@ ShowOTTrademonStats: ; 29549 call TrademonStats_WaitBGMap ret -; 29573 - -TrademonStats_MonTemplate: ; 29573 +TrademonStats_MonTemplate: call WaitTop call TradeAnim_BlankTileMap ld a, HIGH(vBGMap1) @@ -1032,16 +937,13 @@ TrademonStats_MonTemplate: ; 29573 call PlaceString ret -; 29591 - -.OTMonData: ; 29591 +.OTMonData: db "─── №." next "" next "OT/" next "<ID>№.@" -; 295a1 -TrademonStats_Egg: ; 295a1 +TrademonStats_Egg: call WaitTop call TradeAnim_BlankTileMap ld a, HIGH(vBGMap1) @@ -1056,40 +958,31 @@ TrademonStats_Egg: ; 295a1 call TrademonStats_WaitBGMap ret -; 295c2 - -.EggData: ; 295c2 +.EggData: db "EGG" next "OT/?????" next "<ID>№.?????@" -; 295d8 -TrademonStats_WaitBGMap: ; 295d8 +TrademonStats_WaitBGMap: call WaitBGMap call WaitTop ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a ret -; 295e3 - -TrademonStats_PrintSpeciesNumber: ; 295e3 +TrademonStats_PrintSpeciesNumber: hlcoord 10, 0 lb bc, PRINTNUM_LEADINGZEROS | 1, 3 call PrintNum ld [hl], " " ret -; 295ef - -TrademonStats_PrintSpeciesName: ; 295ef +TrademonStats_PrintSpeciesName: hlcoord 4, 2 call PlaceString ret -; 295f6 - -TrademonStats_PrintOTName: ; 295f6 +TrademonStats_PrintOTName: cp 3 jr c, .caught_gender_okay xor a @@ -1107,21 +1000,16 @@ TrademonStats_PrintOTName: ; 295f6 ld [bc], a ret -; 2960e - -.Gender: ; 2960e +.Gender: db " ", "♂", "♀" -; 29611 -TrademonStats_PrintTrademonID: ; 29611 +TrademonStats_PrintTrademonID: hlcoord 7, 6 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ret -; 2961b - -TradeAnim_RockingBall: ; 2961b +TradeAnim_RockingBall: depixel 10, 11, 4, 0 ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL call _InitSpriteAnimStruct @@ -1130,9 +1018,7 @@ TradeAnim_RockingBall: ; 2961b ld [wFrameCounter], a ret -; 2962c - -TradeAnim_DropBall: ; 2962c +TradeAnim_DropBall: depixel 10, 11, 4, 0 ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL call _InitSpriteAnimStruct @@ -1147,9 +1033,7 @@ TradeAnim_DropBall: ; 2962c ld [wFrameCounter], a ret -; 29649 - -TradeAnim_Poof: ; 29649 +TradeAnim_Poof: depixel 10, 11, 4, 0 ld a, SPRITE_ANIM_INDEX_TRADE_POOF call _InitSpriteAnimStruct @@ -1160,9 +1044,7 @@ TradeAnim_Poof: ; 29649 call PlaySFX ret -; 29660 - -TradeAnim_BulgeThroughTube: ; 29660 +TradeAnim_BulgeThroughTube: ld a, %11100100 ; 3,2,1,0 call DmgToCgbObjPal0 depixel 5, 11 @@ -1173,9 +1055,7 @@ TradeAnim_BulgeThroughTube: ; 29660 ld [wFrameCounter], a ret -; 29676 - -TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) +TradeAnim_AnimateTrademonInTube: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld e, [hl] @@ -1187,9 +1067,8 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) ld h, [hl] ld l, a jp hl -; 29686 -.Jumptable: ; 29686 (a:5686) +.Jumptable: dw .InitTimer dw .WaitTimer1 dw .MoveRight @@ -1197,22 +1076,21 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) dw .MoveUp dw .MoveLeft dw .WaitTimer2 -; 2969a -.JumptableNext: ; 29694 (a:5694) +.JumptableNext: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc inc [hl] ret -.InitTimer: ; 2969a (a:569a) +.InitTimer: call .JumptableNext ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], $80 ret -.WaitTimer1: ; 296a4 (a:56a4) +.WaitTimer1: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -1221,7 +1099,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) ret nz call .JumptableNext -.MoveRight: ; 296af (a:56af) +.MoveRight: ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1233,7 +1111,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) .done_move_right call .JumptableNext -.MoveDown: ; 296bd (a:56bd) +.MoveDown: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -1248,7 +1126,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) ld [hl], $0 ret -.MoveUp: ; 296cf (a:56cf) +.MoveUp: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -1260,7 +1138,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) .done_move_up call .JumptableNext -.MoveLeft: ; 296dd (a:56dd) +.MoveLeft: ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1276,7 +1154,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) ld [hl], $80 ret -.WaitTimer2: ; 296f2 (a:56f2) +.WaitTimer2: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -1288,9 +1166,7 @@ TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676) ld [hl], $0 ret -; 29701 (a:5701) - -TradeAnim_SentToOTText: ; 29701 +TradeAnim_SentToOTText: ld a, [wLinkMode] cp LINK_TIMECAPSULE jr z, .time_capsule @@ -1313,21 +1189,17 @@ TradeAnim_SentToOTText: ; 29701 call TradeAnim_AdvanceScriptPointer ret -; 29732 - -.Text_WasSentTo: ; 0x29732 +.Text_WasSentTo: ; was sent to @ . text_jump UnknownText_0x1bc6e9 db "@" -; 0x29737 -.Text_MonName: ; 0x29737 +.Text_MonName: ; text_jump UnknownText_0x1bc701 db "@" -; 0x2973c -TradeAnim_OTBidsFarewell: ; 2973c +TradeAnim_OTBidsFarewell: ld hl, .Text_BidsFarewellToMon call PrintText call TradeAnim_Wait80Frames @@ -1337,21 +1209,17 @@ TradeAnim_OTBidsFarewell: ; 2973c call TradeAnim_AdvanceScriptPointer ret -; 29752 - -.Text_BidsFarewellToMon: ; 0x29752 +.Text_BidsFarewellToMon: ; bids farewell to text_jump UnknownText_0x1bc703 db "@" -; 0x29757 -.Text_MonName: ; 0x29757 +.Text_MonName: ; . text_jump UnknownText_0x1bc719 db "@" -; 0x2975c -TradeAnim_TakeCareOfText: ; 2975c +TradeAnim_TakeCareOfText: call WaitTop hlcoord 0, 10 ld bc, 8 * SCREEN_WIDTH @@ -1364,15 +1232,12 @@ TradeAnim_TakeCareOfText: ; 2975c call TradeAnim_AdvanceScriptPointer ret -; 2977a - -.Text_TakeGoodCareOfMon: ; 0x2977a +.Text_TakeGoodCareOfMon: ; Take good care of @ . text_jump UnknownText_0x1bc71f db "@" -; 0x2977f -TradeAnim_OTSendsText1: ; 2977f +TradeAnim_OTSendsText1: ld hl, .Text_ForYourMon call PrintText call TradeAnim_Wait80Frames @@ -1384,21 +1249,17 @@ TradeAnim_OTSendsText1: ; 2977f call TradeAnim_AdvanceScriptPointer ret -; 2979a - -.Text_ForYourMon: ; 0x2979a +.Text_ForYourMon: ; For @ 's @ , text_jump UnknownText_0x1bc739 db "@" -; 0x2979f -.Text_OTSends: ; 0x2979f +.Text_OTSends: ; sends @ . text_jump UnknownText_0x1bc74c db "@" -; 0x297a4 -TradeAnim_OTSendsText2: ; 297a4 +TradeAnim_OTSendsText2: ld hl, .Text_WillTrade call PrintText call TradeAnim_Wait80Frames @@ -1410,37 +1271,29 @@ TradeAnim_OTSendsText2: ; 297a4 call TradeAnim_AdvanceScriptPointer ret -; 297bf - -.Text_WillTrade: ; 0x297bf +.Text_WillTrade: ; will trade @ @ text_jump UnknownText_0x1bc75e db "@" -; 0x297c4 -.Text_ForYourMon: ; 0x297c4 +.Text_ForYourMon: ; for @ 's @ . text_jump UnknownText_0x1bc774 db "@" -; 0x297c9 -TradeAnim_Wait80Frames: ; 297c9 +TradeAnim_Wait80Frames: ld c, 80 call DelayFrames ret -; 297cf - -TradeAnim_BlankTileMap: ; 297cf +TradeAnim_BlankTileMap: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ret -; 297db - -TradeAnim_CopyBoxFromDEtoHL: ; 297db +TradeAnim_CopyBoxFromDEtoHL: .row push bc push hl @@ -1458,9 +1311,7 @@ TradeAnim_CopyBoxFromDEtoHL: ; 297db jr nz, .row ret -; 297ed - -TradeAnim_NormalPals: ; 297ed +TradeAnim_NormalPals: ld a, [hSGB] and a ld a, %11100100 ; 3,2,1,0 @@ -1473,9 +1324,7 @@ TradeAnim_NormalPals: ; 297ed call DmgToCgbBGPals ret -; 297ff - -LinkTradeAnim_LoadTradePlayerNames: ; 297ff +LinkTradeAnim_LoadTradePlayerNames: push de ld de, wLinkPlayer1Name ld bc, NAME_LENGTH @@ -1486,18 +1335,14 @@ LinkTradeAnim_LoadTradePlayerNames: ; 297ff call CopyBytes ret -; 29814 - -LinkTradeAnim_LoadTradeMonSpecies: ; 29814 +LinkTradeAnim_LoadTradeMonSpecies: ld a, [hl] ld [wLinkTradeSendmonSpecies], a ld a, [de] ld [wLinkTradeGetmonSpecies], a ret -; 2981d - -TradeAnim_FlashBGPals: ; 2981d +TradeAnim_FlashBGPals: ld a, [wcf65] and $7 ret nz @@ -1506,9 +1351,7 @@ TradeAnim_FlashBGPals: ; 2981d call DmgToCgbBGPals ret -; 2982b - -LoadTradeBallAndCableGFX: ; 2982b +LoadTradeBallAndCableGFX: call DelayFrame ld de, TradeBallGFX ld hl, vTiles0 tile $62 @@ -1528,9 +1371,7 @@ LoadTradeBallAndCableGFX: ; 2982b ld [hl], $62 ret -; 2985a - -LoadTradeBubbleGFX: ; 2985a +LoadTradeBubbleGFX: call DelayFrame ld e, $3 callfar LoadMenuMonIcon @@ -1544,9 +1385,7 @@ LoadTradeBubbleGFX: ; 2985a ld [hl], $62 ret -; 29879 - -TradeAnim_WaitAnim: ; 29879 +TradeAnim_WaitAnim: ld hl, wFrameCounter ld a, [hl] and a @@ -1558,9 +1397,7 @@ TradeAnim_WaitAnim: ; 29879 call TradeAnim_AdvanceScriptPointer ret -; 29886 - -TradeAnim_WaitAnim2: ; 29886 +TradeAnim_WaitAnim2: ld hl, wFrameCounter ld a, [hl] and a @@ -1572,10 +1409,7 @@ TradeAnim_WaitAnim2: ; 29886 call TradeAnim_AdvanceScriptPointer ret -; 29893 - - -Unreferenced_DebugTrade: ; 29893 +Unreferenced_DebugTrade: ; This function is not referenced. ; It was meant for use in Japanese versions, so the ; constant used for copy length was changed by accident. @@ -1605,21 +1439,17 @@ Unreferenced_DebugTrade: ; 29893 jr nz, .loop2 ret -; 298b5 - debugtrade: MACRO ; species, ot name, ot id (?) db \1, \2 dw \3 ENDM -.DebugTradeData: ; 298b5 +.DebugTradeData: debugtrade VENUSAUR, "ゲーフり@@", $0123 ; GAME FREAK debugtrade CHARIZARD, "クりーチャ@", $0456 ; Creatures Inc. -; 298c7 - -TradeGameBoyTilemap: ; 298c7 +TradeGameBoyTilemap: ; 6x8 db $31, $32, $32, $32, $32, $33 db $34, $35, $36, $36, $37, $38 @@ -1629,14 +1459,12 @@ TradeGameBoyTilemap: ; 298c7 db $46, $47, $43, $48, $49, $4a db $41, $43, $4b, $4c, $4d, $4e db $4f, $50, $50, $50, $51, $52 -; 297f7 -TradeLinkTubeTilemap: ; 297f7 +TradeLinkTubeTilemap: ; 12x3 db $43, $55, $56, $53, $53, $53, $53, $53, $53, $53, $53, $53 db $43, $57, $58, $54, $54, $54, $54, $54, $54, $54, $54, $54 db $43, $59, $5a, $43, $43, $43, $43, $43, $43, $43, $43, $43 -; 2991b TradeArrowGFX: INCBIN "gfx/trade/arrow.2bpp" TradeCableGFX: INCBIN "gfx/trade/cable.2bpp" diff --git a/engine/movie/unused_title.asm b/engine/movie/unused_title.asm index 8e52a71bb..0c97c840a 100644 --- a/engine/movie/unused_title.asm +++ b/engine/movie/unused_title.asm @@ -1,5 +1,4 @@ -UnusedTitleScreen: ; 10c000 - +UnusedTitleScreen: call ClearBGPalettes call ClearTileMap call DisableLCD @@ -96,30 +95,24 @@ UnusedTitleScreen: ; 10c000 call PlayMusic ret -; 10c0b1 -UnusedTitleBG_GFX: ; 10c0b1 +UnusedTitleBG_GFX: INCBIN "gfx/title/old_bg.2bpp" -; 10d0b1 -UnusedTitleBG_Tilemap: ; 10d0b1 +UnusedTitleBG_Tilemap: ; 32x32 (alternating tiles and attributes) INCBIN "gfx/title/old_bg.tilemap" -; 10d8b1 -UnusedTitleBG_Palettes: ; 10d8b1 +UnusedTitleBG_Palettes: INCLUDE "gfx/title/old_bg.pal" -; 10dab1 -UnusedTitleFG_GFX: ; 10dab1 +UnusedTitleFG_GFX: INCBIN "gfx/title/old_fg.2bpp" -; 10eab1 -UnusedTitleFG_Palettes: ; 10eab1 +UnusedTitleFG_Palettes: INCLUDE "gfx/title/old_fg.pal" -; 10ecb1 -UnusedTitleFG_OAM: ; 10ecb1 +UnusedTitleFG_OAM: dsprite 3, 0, 7, 0, $00, 1 dsprite 3, 0, 8, 0, $02, 1 dsprite 3, 0, 9, 0, $04, 1 @@ -160,9 +153,8 @@ UnusedTitleFG_OAM: ; 10ecb1 dsprite 11, 0, 12, 0, $4a, 1 dsprite 11, 0, 13, 0, $4c, 1 dsprite 11, 0, 14, 0, $4e, 1 -; 10ed51 -Function10ed51: ; 10ed51 +Function10ed51: call _TitleScreen .loop call JoyTextDelay @@ -175,4 +167,3 @@ Function10ed51: ; 10ed51 jr .loop .done ret -; 10ed67 diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 33d0ca0cd..bea2e0cdb 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -1,11 +1,11 @@ -InitDecorations: ; 26751 (9:6751) +InitDecorations: ld a, DECO_FEATHERY_BED ld [wDecoBed], a ld a, DECO_TOWN_MAP ld [wDecoPoster], a ret -_PlayerDecorationMenu: ; 0x2675c +_PlayerDecorationMenu: ld a, [wWhichIndexSet] push af ld hl, .MenuHeader @@ -34,24 +34,21 @@ _PlayerDecorationMenu: ; 0x2675c ld a, [wBuffer5] ld c, a ret -; 0x2679a -.MenuHeader: ; 0x2679a +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 5, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -; 0x267a2 -.MenuData: ; 0x267a2 +.MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items dw wd002 dw PlaceNthMenuStrings dw .pointers -; 0x267aa -.pointers ; 267aa +.pointers dw DecoBedMenu, .bed dw DecoCarpetMenu, .carpet dw DecoPlantMenu, .plant @@ -69,9 +66,8 @@ _PlayerDecorationMenu: ; 0x2675c .ornament db "ORNAMENT@" .big_doll db "BIG DOLL@" .exit db "EXIT@" -; 26806 -.FindCategoriesWithOwnedDecos: ; 26806 +.FindCategoriesWithOwnedDecos: xor a ld [wWhichIndexSet], a call .ClearStringBuffer2 @@ -84,7 +80,7 @@ _PlayerDecorationMenu: ; 0x2675c call CopyBytes ret -.ClearStringBuffer2: ; 26822 (9:6822) +.ClearStringBuffer2: ld hl, wStringBuffer2 xor a ld [hli], a @@ -93,7 +89,7 @@ _PlayerDecorationMenu: ; 0x2675c call ByteFill ret -.AppendToStringBuffer2: ; 26830 (9:6830) +.AppendToStringBuffer2: ld hl, wStringBuffer2 inc [hl] ld e, [hl] @@ -102,7 +98,7 @@ _PlayerDecorationMenu: ; 0x2675c ld [hl], a ret -.FindOwndDecos: ; 2683a (9:683a) +.FindOwndDecos: ld hl, .dw .loop ld a, [hli] @@ -124,9 +120,8 @@ _PlayerDecorationMenu: ; 0x2675c jr .loop .done ret -; 26855 (9:6855) -.dw ; 26855 +.dw dwb FindOwnedBeds, 0 ; bed dwb FindOwnedCarpets, 1 ; carpet dwb FindOwnedPlants, 2 ; plant @@ -135,9 +130,8 @@ _PlayerDecorationMenu: ; 0x2675c dwb FindOwnedOrnaments, 5 ; ornament dwb FindOwnedBigDolls, 6 ; big doll dw 0 ; end -; 2686c -Deco_FillTempWithMinusOne: ; 2686c +Deco_FillTempWithMinusOne: xor a ld hl, wd002 ld [hli], a @@ -145,9 +139,8 @@ Deco_FillTempWithMinusOne: ; 2686c ld bc, $10 call ByteFill ret -; 2687a -CheckAllDecorationFlags: ; 2687a +CheckAllDecorationFlags: .loop ld a, [hli] cp -1 @@ -166,9 +159,8 @@ CheckAllDecorationFlags: ; 2687a .done ret -; 26891 -AppendDecoIndex: ; 26891 +AppendDecoIndex: ld hl, wd002 inc [hl] ld e, [hl] @@ -176,9 +168,8 @@ AppendDecoIndex: ; 26891 add hl, de ld [hl], a ret -; 2689b -FindOwnedDecosInCategory: ; 2689b +FindOwnedDecosInCategory: push bc push hl call Deco_FillTempWithMinusOne @@ -195,126 +186,108 @@ FindOwnedDecosInCategory: ; 2689b call AppendDecoIndex scf ret -; 268b5 -DecoBedMenu: ; 268b5 +DecoBedMenu: call FindOwnedBeds call PopulateDecoCategoryMenu xor a ret -; 268bd -FindOwnedBeds: ; 268bd +FindOwnedBeds: ld hl, .beds ld c, BEDS jp FindOwnedDecosInCategory -; 268c5 -.beds ; 268c5 +.beds db DECO_FEATHERY_BED ; 2 db DECO_PINK_BED ; 3 db DECO_POLKADOT_BED ; 4 db DECO_PIKACHU_BED ; 5 db -1 -; 268ca -DecoCarpetMenu: ; 268ca +DecoCarpetMenu: call FindOwnedCarpets call PopulateDecoCategoryMenu xor a ret -; 268d2 -FindOwnedCarpets: ; 268d2 +FindOwnedCarpets: ld hl, .carpets ld c, CARPETS jp FindOwnedDecosInCategory -; 268da -.carpets ; 268da +.carpets db DECO_RED_CARPET ; 7 db DECO_BLUE_CARPET ; 8 db DECO_YELLOW_CARPET ; 9 db DECO_GREEN_CARPET ; a db -1 -; 268df -DecoPlantMenu: ; 268df +DecoPlantMenu: call FindOwnedPlants call PopulateDecoCategoryMenu xor a ret -; 268e7 -FindOwnedPlants: ; 268e7 +FindOwnedPlants: ld hl, .plants ld c, PLANTS jp FindOwnedDecosInCategory -; 268ef -.plants ; 268ef +.plants db DECO_MAGNAPLANT ; c db DECO_TROPICPLANT ; d db DECO_JUMBOPLANT ; e db -1 -; 268f3 -DecoPosterMenu: ; 268f3 +DecoPosterMenu: call FindOwnedPosters call PopulateDecoCategoryMenu xor a ret -; 268fb -FindOwnedPosters: ; 268fb +FindOwnedPosters: ld hl, .posters ld c, POSTERS jp FindOwnedDecosInCategory -; 26903 -.posters ; 26903 +.posters db DECO_TOWN_MAP ; 10 db DECO_PIKACHU_POSTER ; 11 db DECO_CLEFAIRY_POSTER ; 12 db DECO_JIGGLYPUFF_POSTER ; 13 db -1 -; 26908 -DecoConsoleMenu: ; 26908 +DecoConsoleMenu: call FindOwnedConsoles call PopulateDecoCategoryMenu xor a ret -; 26910 -FindOwnedConsoles: ; 26910 +FindOwnedConsoles: ld hl, .consoles ld c, CONSOLES jp FindOwnedDecosInCategory -; 26918 -.consoles ; 26918 +.consoles db DECO_FAMICOM ; 15 db DECO_SNES ; 16 db DECO_N64 ; 17 db DECO_VIRTUAL_BOY ; 18 db -1 -; 2691d -DecoOrnamentMenu: ; 2691d +DecoOrnamentMenu: call FindOwnedOrnaments call PopulateDecoCategoryMenu xor a ret -; 26925 -FindOwnedOrnaments: ; 26925 +FindOwnedOrnaments: ld hl, .ornaments ld c, DOLLS jp FindOwnedDecosInCategory -; 2692d -.ornaments ; 2692d +.ornaments db DECO_PIKACHU_DOLL ; 1e db DECO_SURF_PIKACHU_DOLL ; 1f db DECO_CLEFAIRY_DOLL ; 20 @@ -339,34 +312,29 @@ FindOwnedOrnaments: ; 26925 db DECO_GOLD_TROPHY_DOLL ; 33 db DECO_SILVER_TROPHY_DOLL ; 34 db -1 -; 26945 -DecoBigDollMenu: ; 26945 +DecoBigDollMenu: call FindOwnedBigDolls call PopulateDecoCategoryMenu xor a ret -; 2694d -FindOwnedBigDolls: ; 2694d +FindOwnedBigDolls: ld hl, .big_dolls ld c, BIG_DOLLS jp FindOwnedDecosInCategory -; 26955 -.big_dolls ; 26955 +.big_dolls db DECO_BIG_SNORLAX_DOLL ; 1a db DECO_BIG_ONIX_DOLL ; 1b db DECO_BIG_LAPRAS_DOLL ; 1c db -1 -; 26959 -DecoExitMenu: ; 26959 +DecoExitMenu: scf ret -; 2695b -PopulateDecoCategoryMenu: ; 2695b +PopulateDecoCategoryMenu: ld a, [wd002] and a jr z, .empty @@ -413,37 +381,32 @@ PopulateDecoCategoryMenu: ; 2695b ld hl, .Text_nothing_to_choose call MenuTextBoxBackup ret -; 269b0 -.Text_nothing_to_choose: ; 0x269b0 +.Text_nothing_to_choose: ; There's nothing to choose. text_jump UnknownText_0x1bc471 db "@" -; 0x269b5 -.NonscrollingMenuHeader: ; 0x269b5 +.NonscrollingMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .NonscrollingMenuData db 1 ; default option -; 0x269bd -.NonscrollingMenuData: ; 0x269bd +.NonscrollingMenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items dw wd002 dw DecorationMenuFunction dw DecorationAttributes -; 0x269c5 -.ScrollingMenuHeader: ; 0x269c5 +.ScrollingMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, SCREEN_WIDTH - 2, SCREEN_HEIGHT - 2 dw .ScrollingMenuData db 1 ; default option -; 0x269cd -.ScrollingMenuData: ; 0x269cd +.ScrollingMenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 8, 0 ; rows, columns db 1 ; horizontal spacing @@ -451,26 +414,22 @@ PopulateDecoCategoryMenu: ; 2695b dba DecorationMenuFunction dbw 0, 0 dbw 0, 0 -; 269dd - -GetDecorationData: ; 269dd +GetDecorationData: ld hl, DecorationAttributes ld bc, 6 call AddNTimes ret -; 269e7 -GetDecorationName: ; 269e7 +GetDecorationName: push hl call GetDecorationData call GetDecoName pop hl call CopyName2 ret -; 269f3 -DecorationMenuFunction: ; 269f3 +DecorationMenuFunction: ld a, [wMenuSelection] push de call GetDecorationData @@ -478,9 +437,8 @@ DecorationMenuFunction: ; 269f3 pop hl call PlaceString ret -; 26a02 -DoDecorationAction2: ; 26a02 +DoDecorationAction2: ld a, [wMenuSelection] call GetDecorationData ld de, 2 ; function 2 @@ -489,9 +447,8 @@ DoDecorationAction2: ; 26a02 ld hl, .DecoActions rst JumpTable ret -; 26a12 -.DecoActions: ; 26a12 +.DecoActions: dw DecoAction_nothing dw DecoAction_setupbed dw DecoAction_putawaybed @@ -507,10 +464,8 @@ DoDecorationAction2: ; 26a02 dw DecoAction_putawaybigdoll dw DecoAction_setupornament dw DecoAction_putawayornament -; 26a30 - -GetDecorationFlag: ; 26a30 +GetDecorationFlag: call GetDecorationData ld de, 3 ; event flag add hl, de @@ -518,17 +473,15 @@ GetDecorationFlag: ; 26a30 ld d, [hl] ld e, a ret -; 26a3b -DecorationFlagAction: ; 26a3b +DecorationFlagAction: push bc call GetDecorationFlag pop bc call EventFlagAction ret -; 26a44 -GetDecorationSprite: ; 26a44 +GetDecorationSprite: ld a, c call GetDecorationData ld de, 5 ; sprite @@ -536,13 +489,12 @@ GetDecorationSprite: ; 26a44 ld a, [hl] ld c, a ret -; 26a4f INCLUDE "data/decorations/attributes.asm" INCLUDE "data/decorations/names.asm" -GetDecoName: ; 26c72 +GetDecoName: ld a, [hli] ld e, [hl] ld bc, wStringBuffer2 @@ -551,9 +503,8 @@ GetDecoName: ; 26c72 rst JumpTable pop de ret -; 26c7e -.NameFunctions: ; 26c7e +.NameFunctions: dw .invalid dw .plant dw .bed @@ -561,40 +512,37 @@ GetDecoName: ; 26c72 dw .poster dw .doll dw .bigdoll -; 26c8c - -.invalid ; 26c8c +.invalid ret -; 26c8d -.plant ; 26c8d +.plant ld a, e jr .getdeconame -.bed ; 26c90 +.bed call .plant ld a, _BED jr .getdeconame -.carpet ; 26c97 +.carpet call .plant ld a, _CARPET jr .getdeconame -.poster ; 26c9e +.poster ld a, e call .getpokename ld a, _POSTER jr .getdeconame -.doll ; 26ca6 +.doll ld a, e call .getpokename ld a, _DOLL jr .getdeconame -.bigdoll ; 26cae +.bigdoll push de ld a, BIG_ call .getdeconame @@ -602,25 +550,25 @@ GetDecoName: ; 26c72 ld a, e jr .getpokename -.unused ; 26cb8 +.unused push de call .getdeconame pop de ld a, e jr .getdeconame -.getpokename ; 26cc0 +.getpokename push bc ld [wd265], a call GetPokemonName pop bc jr .copy -.getdeconame ; 26cca +.getdeconame call ._getdeconame jr .copy -._getdeconame ; 26ccf +._getdeconame push bc ld hl, DecorationNames call GetNthString @@ -629,7 +577,7 @@ GetDecoName: ; 26c72 pop bc ret -.copy ; 26cda +.copy ld h, b ld l, c call CopyName2 @@ -637,74 +585,60 @@ GetDecoName: ; 26c72 ld b, h ld c, l ret -; 26ce3 -DecoAction_nothing: ; 26ce3 +DecoAction_nothing: scf ret -; 26ce5 -DecoAction_setupbed: ; 26ce5 +DecoAction_setupbed: ld hl, wDecoBed jp DecoAction_TrySetItUp -; 26ceb -DecoAction_putawaybed: ; 26ceb +DecoAction_putawaybed: ld hl, wDecoBed jp DecoAction_TryPutItAway -; 26cf1 -DecoAction_setupcarpet: ; 26cf1 +DecoAction_setupcarpet: ld hl, wDecoCarpet jp DecoAction_TrySetItUp -; 26cf7 -DecoAction_putawaycarpet: ; 26cf7 +DecoAction_putawaycarpet: ld hl, wDecoCarpet jp DecoAction_TryPutItAway -; 26cfd -DecoAction_setupplant: ; 26cfd +DecoAction_setupplant: ld hl, wDecoPlant jp DecoAction_TrySetItUp -; 26d03 -DecoAction_putawayplant: ; 26d03 +DecoAction_putawayplant: ld hl, wDecoPlant jp DecoAction_TryPutItAway -; 26d09 -DecoAction_setupposter: ; 26d09 +DecoAction_setupposter: ld hl, wDecoPoster jp DecoAction_TrySetItUp -; 26d0f -DecoAction_putawayposter: ; 26d0f +DecoAction_putawayposter: ld hl, wDecoPoster jp DecoAction_TryPutItAway -; 26d15 -DecoAction_setupconsole: ; 26d15 +DecoAction_setupconsole: ld hl, wDecoConsole jp DecoAction_TrySetItUp -; 26d1b -DecoAction_putawayconsole: ; 26d1b +DecoAction_putawayconsole: ld hl, wDecoConsole jp DecoAction_TryPutItAway -; 26d21 -DecoAction_setupbigdoll: ; 26d21 +DecoAction_setupbigdoll: ld hl, wDecoBigDoll jp DecoAction_TrySetItUp -; 26d27 -DecoAction_putawaybigdoll: ; 26d27 +DecoAction_putawaybigdoll: ld hl, wDecoBigDoll jp DecoAction_TryPutItAway -; 26d2d -DecoAction_TrySetItUp: ; 26d2d +DecoAction_TrySetItUp: ld a, [hl] ld [wBuffer1], a push hl @@ -722,9 +656,8 @@ DecoAction_TrySetItUp: ; 26d2d pop hl xor a ret -; 26d46 -DecoAction_SetItUp: ; 26d46 +DecoAction_SetItUp: ; See if there's anything of the same type already out ld a, [wBuffer1] and a @@ -760,9 +693,8 @@ DecoAction_SetItUp: ; 26d46 call MenuTextBoxBackup scf ret -; 26d86 -DecoAction_TryPutItAway: ; 26d86 +DecoAction_TryPutItAway: ; If there is no item of that type already set, there is nothing to put away. ld a, [hl] ld [wBuffer1], a @@ -788,9 +720,8 @@ DecoAction_TryPutItAway: ; 26d86 call MenuTextBoxBackup xor a ret -; 26db3 -DecoAction_setupornament: ; 26db3 +DecoAction_setupornament: ld hl, UnknownText_0x26e41 call DecoAction_AskWhichSide jr c, .cancel @@ -804,7 +735,7 @@ DecoAction_setupornament: ; 26db3 xor a ret -DecoAction_putawayornament: ; 26dc9 +DecoAction_putawayornament: ld hl, DecoText_WhichSide call DecoAction_AskWhichSide jr nc, .incave @@ -814,7 +745,7 @@ DecoAction_putawayornament: ; 26dc9 .incave call DecoAction_PutItAway_Ornament -DecoAction_FinishUp_Ornament: ; 26dd6 +DecoAction_FinishUp_Ornament: call QueryWhichSide ld a, [wSelectedDecoration] ld [hl], a @@ -822,9 +753,8 @@ DecoAction_FinishUp_Ornament: ; 26dd6 ld [de], a xor a ret -; 26de3 -DecoAction_SetItUp_Ornament: ; 26de3 +DecoAction_SetItUp_Ornament: ld a, [wSelectedDecoration] and a jr z, .nothingthere @@ -863,9 +793,8 @@ DecoAction_SetItUp_Ornament: ; 26de3 call MenuTextBoxBackup scf ret -; 26e33 -.getwhichside ; 26e33 +.getwhichside ld a, [wMenuSelection] ld b, a ld a, [wOtherDecoration] @@ -874,15 +803,13 @@ DecoAction_SetItUp_Ornament: ; 26de3 xor a ld [wOtherDecoration], a ret -; 26e41 -UnknownText_0x26e41: ; 0x26e41 +UnknownText_0x26e41: ; Which side do you want to put it on? text_jump UnknownText_0x1bc48c db "@" -; 0x26e46 -DecoAction_PutItAway_Ornament: ; 26e46 +DecoAction_PutItAway_Ornament: ld a, [wSelectedDecoration] and a jr z, .nothingthere @@ -902,15 +829,13 @@ DecoAction_PutItAway_Ornament: ; 26e46 call MenuTextBoxBackup xor a ret -; 26e6b -DecoText_WhichSide: ; 0x26e6b +DecoText_WhichSide: ; Which side do you want to put away? text_jump UnknownText_0x1bc4b2 db "@" -; 0x26e70 -DecoAction_AskWhichSide: ; 26e70 +DecoAction_AskWhichSide: call MenuTextBox ld hl, MenuHeader_0x26eab call GetMenu2 @@ -932,9 +857,8 @@ DecoAction_AskWhichSide: ; 26e70 .nope scf ret -; 26e9a -QueryWhichSide: ; 26e9a +QueryWhichSide: ld hl, wDecoRightOrnament ld de, wDecoLeftOrnament ld a, [wBuffer2] @@ -945,68 +869,57 @@ QueryWhichSide: ; 26e9a ld l, e pop de ret -; 26eab -MenuHeader_0x26eab: ; 0x26eab +MenuHeader_0x26eab: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 13, 7 dw MenuData_0x26eb3 db 1 ; default option -; 0x26eb3 -MenuData_0x26eb3: ; 0x26eb3 +MenuData_0x26eb3: db STATICMENU_CURSOR ; flags db 3 ; items db "RIGHT SIDE@" db "LEFT SIDE@" db "CANCEL@" -; 0x26ed1 -DecoText_PutAwayTheDeco: ; 0x26ed1 +DecoText_PutAwayTheDeco: ; Put away the @ . text_jump UnknownText_0x1bc4d7 db "@" -; 0x26ed6 -DecoText_NothingToPutAway: ; 0x26ed6 +DecoText_NothingToPutAway: ; There's nothing to put away. text_jump UnknownText_0x1bc4ec db "@" -; 0x26edb -DecoText_SetUpTheDeco: ; 0x26edb +DecoText_SetUpTheDeco: ; Set up the @ . text_jump UnknownText_0x1bc509 db "@" -; 0x26ee0 -DecoText_PutAwayAndSetUp: ; 0x26ee0 +DecoText_PutAwayAndSetUp: ; Put away the @ and set up the @ . text_jump UnknownText_0x1bc51c db "@" -; 0x26ee5 -DecoText_AlreadySetUp: ; 0x26ee5 +DecoText_AlreadySetUp: ; That's already set up. text_jump UnknownText_0x1bc546 db "@" -; 0x26eea -GetDecorationName_c_de: ; 26eea +GetDecorationName_c_de: ld a, c ld h, d ld l, e call GetDecorationName ret -; 26ef1 -DecorationFlagAction_c: ; 26ef1 +DecorationFlagAction_c: ld a, c jp DecorationFlagAction -; 26ef5 - -GetDecorationName_c: ; 26ef5 (9:6ef5) +GetDecorationName_c: ld a, c call GetDecorationID ld hl, wStringBuffer1 @@ -1015,16 +928,14 @@ GetDecorationName_c: ; 26ef5 (9:6ef5) pop de ret - -SetSpecificDecorationFlag: ; 26f02 +SetSpecificDecorationFlag: ld a, c call GetDecorationID ld b, SET_FLAG call DecorationFlagAction ret -; 26f0c -GetDecorationID: ; 26f0c +GetDecorationID: push hl push de ld e, a @@ -1035,9 +946,8 @@ GetDecorationID: ; 26f0c pop de pop hl ret -; 26f19 -SetAllDecorationFlags: ; 26f19 +SetAllDecorationFlags: ld hl, DecorationIDs .loop ld a, [hli] @@ -1051,27 +961,24 @@ SetAllDecorationFlags: ; 26f19 .done ret -; 26f2b INCLUDE "data/decorations/decorations.asm" -DescribeDecoration:: ; 26f59 +DescribeDecoration:: ld a, b ld hl, .JumpTable rst JumpTable ret -; 26f5f -.JumpTable: ; 26f5f +.JumpTable: ; entries correspond to DECODESC_* constants dw DecorationDesc_Poster dw DecorationDesc_LeftOrnament dw DecorationDesc_RightOrnament dw DecorationDesc_GiantOrnament dw DecorationDesc_Console -; 26f69 -DecorationDesc_Poster: ; 26f69 +DecorationDesc_Poster: ld a, [wDecoPoster] ld hl, DecorationDesc_PosterPointers ld de, 3 @@ -1088,124 +995,108 @@ DecorationDesc_Poster: ; 26f69 ld d, [hl] ld e, a ret -; 26f84 -DecorationDesc_PosterPointers: ; 26f84 +DecorationDesc_PosterPointers: dbw DECO_TOWN_MAP, DecorationDesc_TownMapPoster dbw DECO_PIKACHU_POSTER, DecorationDesc_PikachuPoster dbw DECO_CLEFAIRY_POSTER, DecorationDesc_ClefairyPoster dbw DECO_JIGGLYPUFF_POSTER, DecorationDesc_JigglypuffPoster db -1 -; 26f91 -DecorationDesc_TownMapPoster: ; 0x26f91 +DecorationDesc_TownMapPoster: opentext writetext .TownMapText waitbutton special OverworldTownMap closetext end -; 0x26f9b -.TownMapText: ; 0x26f9b +.TownMapText: ; It's the TOWN MAP. text_jump UnknownText_0x1bc55d db "@" -; 0x26fa0 -DecorationDesc_PikachuPoster: ; 0x26fa0 +DecorationDesc_PikachuPoster: jumptext .PikaPosterText -; 0x26fa3 -.PikaPosterText: ; 0x26fa3 +.PikaPosterText: ; It's a poster of a cute PIKACHU. text_jump UnknownText_0x1bc570 db "@" -; 0x26fa8 -DecorationDesc_ClefairyPoster: ; 0x26fa8 +DecorationDesc_ClefairyPoster: jumptext .ClefairyPosterText -; 0x26fab -.ClefairyPosterText: ; 0x26fab +.ClefairyPosterText: ; It's a poster of a cute CLEFAIRY. text_jump UnknownText_0x1bc591 db "@" -; 0x26fb0 -DecorationDesc_JigglypuffPoster: ; 0x26fb0 +DecorationDesc_JigglypuffPoster: jumptext .JigglypuffPosterText -; 0x26fb3 -.JigglypuffPosterText: ; 0x26fb3 +.JigglypuffPosterText: ; It's a poster of a cute JIGGLYPUFF. text_jump UnknownText_0x1bc5b3 db "@" -; 0x26fb8 -DecorationDesc_NullPoster: ; 26fb8 +DecorationDesc_NullPoster: end -; 26fb9 -DecorationDesc_LeftOrnament: ; 26fb9 +DecorationDesc_LeftOrnament: ld a, [wDecoLeftOrnament] jr DecorationDesc_OrnamentOrConsole -DecorationDesc_RightOrnament: ; 26fbe +DecorationDesc_RightOrnament: ld a, [wDecoRightOrnament] jr DecorationDesc_OrnamentOrConsole -DecorationDesc_Console: ; 26fc3 +DecorationDesc_Console: ld a, [wDecoConsole] jr DecorationDesc_OrnamentOrConsole -DecorationDesc_OrnamentOrConsole: ; 26fc8 +DecorationDesc_OrnamentOrConsole: ld c, a ld de, wStringBuffer3 call GetDecorationName_c_de ld b, BANK(.OrnamentConsoleScript) ld de, .OrnamentConsoleScript ret -; 26fd5 -.OrnamentConsoleScript: ; 26fd5 +.OrnamentConsoleScript: jumptext .OrnamentConsoleText -; 26fd8 -.OrnamentConsoleText: ; 0x26fd8 +.OrnamentConsoleText: ; It's an adorable @ . text_jump UnknownText_0x1bc5d7 db "@" -; 0x26fdd -DecorationDesc_GiantOrnament: ; 26fdd +DecorationDesc_GiantOrnament: ld b, BANK(.BigDollScript) ld de, .BigDollScript ret -; 26fe3 -.BigDollScript: ; 26fe3 +.BigDollScript: jumptext .BigDollText -; 26fe6 -.BigDollText: ; 0x26fe6 +.BigDollText: ; A giant doll! It's fluffy and cuddly. text_jump UnknownText_0x1bc5ef db "@" -; 0x26feb -ToggleMaptileDecorations: ; 26feb - lb de, 0, 4 +ToggleMaptileDecorations: + ; tile coordinates work the same way as for changeblock + lb de, 0, 4 ; bed coordinates ld a, [wDecoBed] call SetDecorationTile - lb de, 7, 4 + lb de, 7, 4 ; plant coordinates ld a, [wDecoPlant] call SetDecorationTile - lb de, 6, 0 + lb de, 6, 0 ; poster coordinates ld a, [wDecoPoster] call SetDecorationTile call SetPosterVisibility - lb de, 0, 0 + lb de, 0, 0 ; carpet top-left coordinates call PadCoords_de ld a, [wDecoCarpet] and a @@ -1213,19 +1104,18 @@ ToggleMaptileDecorations: ; 26feb call _GetDecorationSprite ld [hl], a push af - lb de, 0, 2 + lb de, 0, 2 ; carpet bottom-left coordinates call PadCoords_de pop af inc a - ld [hli], a + ld [hli], a ; carpet bottom-left block inc a - ld [hli], a + ld [hli], a ; carpet bottom-middle block dec a - ld [hl], a + ld [hl], a ; carpet bottom-right block ret -; 27027 -SetPosterVisibility: ; 27027 +SetPosterVisibility: ld b, SET_FLAG ld a, [wDecoPoster] and a @@ -1235,9 +1125,8 @@ SetPosterVisibility: ; 27027 .ok ld de, EVENT_PLAYERS_ROOM_POSTER jp EventFlagAction -; 27037 -SetDecorationTile: ; 27037 +SetDecorationTile: push af call PadCoords_de pop af @@ -1246,9 +1135,8 @@ SetDecorationTile: ; 27037 call _GetDecorationSprite ld [hl], a ret -; 27043 -ToggleDecorationsVisibility: ; 27043 +ToggleDecorationsVisibility: ld de, EVENT_PLAYERS_HOUSE_2F_CONSOLE ld hl, wVariableSprites + SPRITE_CONSOLE - SPRITE_VARS ld a, [wDecoConsole] @@ -1266,9 +1154,8 @@ ToggleDecorationsVisibility: ; 27043 ld a, [wDecoBigDoll] call ToggleDecorationVisibility ret -; 27074 -ToggleDecorationVisibility: ; 27074 +ToggleDecorationVisibility: and a jr z, .hide call _GetDecorationSprite @@ -1279,9 +1166,8 @@ ToggleDecorationVisibility: ; 27074 .hide ld b, SET_FLAG jp EventFlagAction -; 27085 -_GetDecorationSprite: ; 27085 +_GetDecorationSprite: ld c, a push de push hl @@ -1290,9 +1176,9 @@ _GetDecorationSprite: ; 27085 pop de ld a, c ret -; 27092 -PadCoords_de: ; 27092 +PadCoords_de: +; adjusts coordinates, the same way as Script_changeblock ld a, d add 4 ld d, a diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index cc2c8c574..e4defbc2b 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -3,7 +3,7 @@ INCLUDE "constants.asm" SECTION "Events", ROMX -OverworldLoop:: ; 966b0 +OverworldLoop:: xor a ld [wMapStatus], a .loop @@ -21,99 +21,83 @@ OverworldLoop:: ; 966b0 dw EnterMap dw HandleMap dw .done -; 966cb -DisableEvents: ; 966cb +DisableEvents: xor a ld [wScriptFlags3], a ret -; 966d0 -EnableEvents:: ; 966d0 +EnableEvents:: ld a, $ff ld [wScriptFlags3], a ret -; 966d6 -CheckBit5_ScriptFlags3: ; 966d6 +CheckBit5_ScriptFlags3: ld hl, wScriptFlags3 bit 5, [hl] ret -; 966dc -DisableWarpsConnxns: ; 966dc +DisableWarpsConnxns: ld hl, wScriptFlags3 res 2, [hl] ret -; 966e2 -DisableCoordEvents: ; 966e2 +DisableCoordEvents: ld hl, wScriptFlags3 res 1, [hl] ret -; 966e8 -DisableStepCount: ; 966e8 +DisableStepCount: ld hl, wScriptFlags3 res 0, [hl] ret -; 966ee -DisableWildEncounters: ; 966ee +DisableWildEncounters: ld hl, wScriptFlags3 res 4, [hl] ret -; 966f4 -EnableWarpsConnxns: ; 966f4 +EnableWarpsConnxns: ld hl, wScriptFlags3 set 2, [hl] ret -; 966fa -EnableCoordEvents: ; 966fa +EnableCoordEvents: ld hl, wScriptFlags3 set 1, [hl] ret -; 96700 -EnableStepCount: ; 96700 +EnableStepCount: ld hl, wScriptFlags3 set 0, [hl] ret -; 96706 -EnableWildEncounters: ; 96706 +EnableWildEncounters: ld hl, wScriptFlags3 set 4, [hl] ret -; 9670c -CheckWarpConnxnScriptFlag: ; 9670c +CheckWarpConnxnScriptFlag: ld hl, wScriptFlags3 bit 2, [hl] ret -; 96712 -CheckCoordEventScriptFlag: ; 96712 +CheckCoordEventScriptFlag: ld hl, wScriptFlags3 bit 1, [hl] ret -; 96718 -CheckStepCountScriptFlag: ; 96718 +CheckStepCountScriptFlag: ld hl, wScriptFlags3 bit 0, [hl] ret -; 9671e -CheckWildEncountersScriptFlag: ; 9671e +CheckWildEncountersScriptFlag: ld hl, wScriptFlags3 bit 4, [hl] ret -; 96724 -StartMap: ; 96724 +StartMap: xor a ld [wScriptVar], a xor a @@ -123,7 +107,7 @@ StartMap: ; 96724 call ByteFill farcall InitCallReceiveDelay call ClearJoypad -EnterMap: ; 9673e +EnterMap: xor a ld [wXYComparePointer], a ld [wXYComparePointer + 1], a @@ -149,15 +133,13 @@ EnterMap: ; 9673e ld a, 2 ; HandleMap ld [wMapStatus], a ret -; 9676d -UnusedWait30Frames: ; 9676d +UnusedWait30Frames: ld c, 30 call DelayFrames ret -; 96773 -HandleMap: ; 96773 +HandleMap: call ResetOverworldDelay call HandleMapTimeAndJoypad farcall HandleCmdQueue ; no need to farcall @@ -173,9 +155,8 @@ HandleMap: ; 96773 call HandleMapBackground call CheckPlayerState ret -; 96795 -MapEvents: ; 96795 +MapEvents: ld a, [wMapEventStatus] ld hl, .jumps rst JumpTable @@ -184,39 +165,33 @@ MapEvents: ; 96795 .jumps dw .events dw .no_events -; 967a1 -.events ; 967a1 +.events call PlayerEvents call DisableEvents farcall ScriptEvents ret -; 967ae -.no_events ; 967ae +.no_events ret -; 967af -MaxOverworldDelay: ; 967af +MaxOverworldDelay: db 2 -; 967b0 -ResetOverworldDelay: ; 967b0 +ResetOverworldDelay: ld a, [MaxOverworldDelay] ld [wOverworldDelay], a ret -; 967b7 -NextOverworldFrame: ; 967b7 +NextOverworldFrame: ld a, [wOverworldDelay] and a ret z ld c, a call DelayFrames ret -; 967c1 -HandleMapTimeAndJoypad: ; 967c1 +HandleMapTimeAndJoypad: ld a, [wMapEventStatus] cp 1 ; no events ret z @@ -225,23 +200,20 @@ HandleMapTimeAndJoypad: ; 967c1 call GetJoypad call TimeOfDayPals ret -; 967d1 -HandleMapObjects: ; 967d1 +HandleMapObjects: farcall HandleNPCStep ; engine/map_objects.asm farcall _HandlePlayerStep call _CheckObjectEnteringVisibleRange ret -; 967e1 -HandleMapBackground: ; 967e1 +HandleMapBackground: farcall _UpdateSprites farcall ScrollScreen farcall PlaceMapNameSign ret -; 967f4 -CheckPlayerState: ; 967f4 +CheckPlayerState: ld a, [wPlayerStepFlags] bit 5, a ; in the middle of step jr z, .events @@ -259,17 +231,15 @@ CheckPlayerState: ; 967f4 ld a, 1 ; no events ld [wMapEventStatus], a ret -; 96812 -_CheckObjectEnteringVisibleRange: ; 96812 +_CheckObjectEnteringVisibleRange: ld hl, wPlayerStepFlags bit 6, [hl] ret z farcall CheckObjectEnteringVisibleRange ret -; 9681f -PlayerEvents: ; 9681f +PlayerEvents: xor a ; If there's already a player event, don't interrupt it. ld a, [wScriptRunning] @@ -318,9 +288,8 @@ PlayerEvents: ; 9681f .ok2 scf ret -; 96867 -CheckTrainerBattle3: ; 96867 +CheckTrainerBattle3: nop nop call CheckTrainerBattle2 @@ -333,9 +302,8 @@ CheckTrainerBattle3: ; 96867 .nope xor a ret -; 96874 -CheckTileEvent: ; 96874 +CheckTileEvent: ; Check for warps, coord events, or wild battles. call CheckWarpConnxnScriptFlag @@ -399,9 +367,8 @@ CheckTileEvent: ; 96874 call GetMapScriptsBank call CallScript ret -; 968c7 -CheckWildEncounterCooldown:: ; 968c7 +CheckWildEncounterCooldown:: ld hl, wWildEncounterCooldown ld a, [hl] and a @@ -410,35 +377,30 @@ CheckWildEncounterCooldown:: ; 968c7 ret z scf ret -; 968d1 -SetUpFiveStepWildEncounterCooldown: ; 968d1 +SetUpFiveStepWildEncounterCooldown: ld a, 5 ld [wWildEncounterCooldown], a ret -; 968d7 -ret_968d7: ; 968d7 +ret_968d7: ret -;968d8 -SetMinTwoStepWildEncounterCooldown: ; 968d8 +SetMinTwoStepWildEncounterCooldown: ld a, [wWildEncounterCooldown] cp 2 ret nc ld a, 2 ld [wWildEncounterCooldown], a ret -; 968e4 -Dummy_CheckScriptFlags3Bit5: ; 968e4 +Dummy_CheckScriptFlags3Bit5: call CheckBit5_ScriptFlags3 ret z call ret_2f3e ret -; 968ec -RunSceneScript: ; 968ec +RunSceneScript: ld a, [wCurrMapSceneScriptCount] and a jr z, .nope @@ -485,9 +447,8 @@ endr .nope xor a ret -; 9693a -CheckTimeEvents: ; 9693a +CheckTimeEvents: ld a, [wLinkMode] and a jr nz, .nothing @@ -517,16 +478,13 @@ CheckTimeEvents: ; 9693a call CallScript scf ret -; 96970 -.unused ; 96970 +.unused ld a, 8 scf ret -; 96974 - -OWPlayerInput: ; 96974 +OWPlayerInput: call PlayerMovement ret c and a @@ -552,9 +510,8 @@ OWPlayerInput: ; 96974 pop af scf ret -; 96999 -CheckAPressOW: ; 96999 +CheckAPressOW: ld a, [hJoyPressed] and A_BUTTON ret z @@ -566,17 +523,15 @@ CheckAPressOW: ; 96999 ret c xor a ret -; 969ac -PlayTalkObject: ; 969ac +PlayTalkObject: push de ld de, SFX_READ_TEXT_2 call PlaySFX pop de ret -; 969b5 -TryObjectEvent: ; 969b5 +TryObjectEvent: farcall CheckFacingObject jr c, .IsObject xor a @@ -627,9 +582,8 @@ TryObjectEvent: ; 969b5 dbw OBJECTTYPE_5, .five dbw OBJECTTYPE_6, .six db -1 -; 96a04 -.script ; 96a04 +.script ld hl, MAPOBJECT_SCRIPT_POINTER add hl, bc ld a, [hli] @@ -638,9 +592,8 @@ TryObjectEvent: ; 969b5 call GetMapScriptsBank call CallScript ret -; 96a12 -.itemball ; 96a12 +.itemball ld hl, MAPOBJECT_SCRIPT_POINTER add hl, bc ld a, [hli] @@ -653,36 +606,30 @@ TryObjectEvent: ; 969b5 ld a, PLAYEREVENT_ITEMBALL scf ret -; 96a29 -.trainer ; 96a29 +.trainer call TalkToTrainer ld a, PLAYEREVENT_TALKTOTRAINER scf ret -; 96a30 -.three ; 96a30 +.three xor a ret -; 96a32 -.four ; 96a32 +.four xor a ret -; 96a34 -.five ; 96a34 +.five xor a ret -; 96a36 -.six ; 96a36 +.six xor a ret -; 96a38 -TryBGEvent: ; 96a38 +TryBGEvent: call CheckFacingBGEvent jr c, .is_bg_event xor a @@ -704,7 +651,6 @@ TryBGEvent: ; 96a38 dw .ifnotset dw .itemifset dw .copy -; 96a59 .up ld b, OW_UP @@ -784,9 +730,8 @@ TryBGEvent: ; 96a38 .dontread xor a ret -; 96ad8 -CheckBGEventFlag: ; 96ad8 +CheckBGEventFlag: ld hl, wEngineBuffer4 ld a, [hli] ld h, [hl] @@ -802,16 +747,14 @@ CheckBGEventFlag: ; 96ad8 and a pop hl ret -; 96af0 -PlayerMovement: ; 96af0 +PlayerMovement: farcall DoPlayerMovement ld a, c ld hl, .pointers rst JumpTable ld a, c ret -; 96afd .pointers dw .zero @@ -824,34 +767,30 @@ PlayerMovement: ; 96af0 dw .seven .zero -.four ; 96b0d +.four xor a ld c, a ret -; 96b10 -.seven ; 96b10 +.seven call ret_968d7 ; mobile xor a ld c, a ret -; 96b16 -.one ; 96b16 +.one ld a, 5 ld c, a scf ret -; 96b1b -.two ; 96b1b +.two ld a, 9 ld c, a scf ret -; 96b20 -.three ; 96b20 +.three ; force the player to move in some direction ld a, BANK(Script_ForcedMovement) ld hl, Script_ForcedMovement @@ -860,17 +799,15 @@ PlayerMovement: ; 96af0 ld c, a scf ret -; 96b2b .five -.six ; 96b2b +.six ld a, -1 ld c, a and a ret -; 96b30 -CheckMenuOW: ; 96b30 +CheckMenuOW: xor a ld [hMenuReturn], a ld [hMenuReturn + 1], a @@ -899,36 +836,30 @@ CheckMenuOW: ; 96b30 call CallScript scf ret -; 96b58 -StartMenuScript: ; 96b58 +StartMenuScript: callasm StartMenu jump StartMenuCallback -; 96b5f -SelectMenuScript: ; 96b5f +SelectMenuScript: callasm SelectMenu jump SelectMenuCallback -; 96b66 StartMenuCallback: -SelectMenuCallback: ; 96b66 +SelectMenuCallback: copybytetovar hMenuReturn ifequal HMENURETURN_SCRIPT, .Script ifequal HMENURETURN_ASM, .Asm end -; 96b72 -.Script: ; 96b72 +.Script: ptjump wQueuedScriptBank -; 96b75 -.Asm: ; 96b75 +.Asm: ptcallasm wQueuedScriptBank end -; 96b79 -CountStep: ; 96b79 +CountStep: ; Don't count steps in link communication rooms. ld a, [wLinkMode] and a @@ -993,16 +924,14 @@ CountStep: ; 96b79 ld a, 8 scf ret -; 96bd3 ; unused -.unreferenced ; 96bd3 +.unreferenced ld a, 7 scf ret -; 96bd7 -DoRepelStep: ; 96bd7 +DoRepelStep: ld a, [wRepelEffect] and a ret z @@ -1016,9 +945,8 @@ DoRepelStep: ; 96bd7 call CallScript scf ret -; 96beb -DoPlayerEvent: ; 96beb +DoPlayerEvent: ld a, [wScriptRunning] and a ret z @@ -1042,9 +970,8 @@ DoPlayerEvent: ; 96beb ld a, [hl] ld [wScriptPos + 1], a ret -; 96c0c -PlayerEventScriptPointers: ; 96c0c +PlayerEventScriptPointers: dba Invalid_0x96c2d ; 0 dba SeenByTrainerScript ; 1 dba TalkToTrainerScript ; 2 @@ -1056,56 +983,656 @@ PlayerEventScriptPointers: ; 96c0c dba HatchEggScript ; 8 dba ChangeDirectionScript ; 9 dba Invalid_0x96c2d ; 10 -; 96c2d -Invalid_0x96c2d: ; 96c2d +Invalid_0x96c2d: end -; 96c2e ; unused end -; 96c2f -HatchEggScript: ; 96c2f +HatchEggScript: callasm OverworldHatchEgg end -; 96c34 -WarpToNewMapScript: ; 96c34 +WarpToNewMapScript: warpsound newloadmap MAPSETUP_DOOR end -; 96c38 -FallIntoMapScript: ; 96c38 +FallIntoMapScript: newloadmap MAPSETUP_FALL playsound SFX_KINESIS applymovement PLAYER, MovementData_0x96c48 playsound SFX_STRENGTH scall LandAfterPitfallScript end -; 96c48 -MovementData_0x96c48: ; 96c48 +MovementData_0x96c48: skyfall step_end -; 96c4a -LandAfterPitfallScript: ; 96c4a +LandAfterPitfallScript: earthquake 16 end -; 96c4d EdgeWarpScript: ; 4 reloadandreturn MAPSETUP_CONNECTION -; 96c4f ChangeDirectionScript: ; 9 deactivatefacing 3 callasm EnableWildEncounters end -; 96c56 INCLUDE "engine/overworld/scripting.asm" -INCLUDE "engine/overworld/events_2.asm" +WarpToSpawnPoint:: + ld hl, wStatusFlags2 + res STATUSFLAGS2_SAFARI_GAME_F, [hl] + res STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] + ret + +RunMemScript:: +; If there is no script here, we don't need to be here. + ld a, [wMapReentryScriptQueueFlag] + and a + ret z +; Execute the script at (wMapReentryScriptBank):(wMapReentryScriptAddress). + ld hl, wMapReentryScriptAddress + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [wMapReentryScriptBank] + call CallScript + scf +; Clear the buffer for the next script. + push af + xor a + ld hl, wMapReentryScriptQueueFlag + ld bc, 8 + call ByteFill + pop af + ret + +LoadScriptBDE:: +; If there's already a script here, don't overwrite. + ld hl, wMapReentryScriptQueueFlag + ld a, [hl] + and a + ret nz +; Set the flag + ld [hl], 1 + inc hl +; Load the script pointer b:de into (wMapReentryScriptBank):(wMapReentryScriptAddress) + ld [hl], b + inc hl + ld [hl], e + inc hl + ld [hl], d + scf + ret + +TryTileCollisionEvent:: + call GetFacingTileCoord + ld [wEngineBuffer1], a + ld c, a + farcall CheckFacingTileForStdScript + jr c, .done + + call CheckCutTreeTile + jr nz, .whirlpool + farcall TryCutOW + jr .done + +.whirlpool + ld a, [wEngineBuffer1] + call CheckWhirlpoolTile + jr nz, .waterfall + farcall TryWhirlpoolOW + jr .done + +.waterfall + ld a, [wEngineBuffer1] + call CheckWaterfallTile + jr nz, .headbutt + farcall TryWaterfallOW + jr .done + +.headbutt + ld a, [wEngineBuffer1] + call CheckHeadbuttTreeTile + jr nz, .surf + farcall TryHeadbuttOW + jr c, .done + jr .noevent + +.surf + farcall TrySurfOW + jr nc, .noevent + jr .done + +.noevent + xor a + ret + +.done + call PlayClickSFX + ld a, $ff + scf + ret + +RandomEncounter:: +; Random encounter + + call CheckWildEncounterCooldown + jr c, .nope + call CanUseSweetScent + jr nc, .nope + ld hl, wStatusFlags2 + bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] + jr nz, .bug_contest + farcall TryWildEncounter + jr nz, .nope + jr .ok + +.bug_contest + call _TryWildEncounter_BugContest + jr nc, .nope + jr .ok_bug_contest + +.nope + ld a, 1 + and a + ret + +.ok + ld a, BANK(WildBattleScript) + ld hl, WildBattleScript + jr .done + +.ok_bug_contest + ld a, BANK(BugCatchingContestBattleScript) + ld hl, BugCatchingContestBattleScript + jr .done + +.done + call CallScript + scf + ret + +WildBattleScript: + randomwildmon + startbattle + reloadmapafterbattle + end + +CanUseSweetScent:: + ld hl, wStatusFlags + bit STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl] + jr nz, .no + ld a, [wEnvironment] + cp CAVE + jr z, .ice_check + cp DUNGEON + jr z, .ice_check + farcall CheckGrassCollision + jr nc, .no + +.ice_check + ld a, [wPlayerStandingTile] + call CheckIceTile + jr z, .no + scf + ret + +.no + and a + ret + +_TryWildEncounter_BugContest: + call TryWildEncounter_BugContest + ret nc + call ChooseWildEncounter_BugContest + farcall CheckRepelEffect + ret + +ChooseWildEncounter_BugContest:: +; Pick a random mon out of ContestMons. + +.loop + call Random + cp 100 << 1 + jr nc, .loop + srl a + + ld hl, ContestMons + ld de, 4 +.CheckMon: + sub [hl] + jr c, .GotMon + add hl, de + jr .CheckMon + +.GotMon: + inc hl + +; Species + ld a, [hli] + ld [wTempWildMonSpecies], a + +; Min level + ld a, [hli] + ld d, a + +; Max level + ld a, [hl] + + sub d + jr nz, .RandomLevel + +; If min and max are the same. + ld a, d + jr .GotLevel + +.RandomLevel: +; Get a random level between the min and max. + ld c, a + inc c + call Random + ld a, [hRandomAdd] + call SimpleDivide + add d + +.GotLevel: + ld [wCurPartyLevel], a + + xor a + ret + +TryWildEncounter_BugContest: + ld a, [wPlayerStandingTile] + call CheckSuperTallGrassTile + ld b, 40 percent + jr z, .ok + ld b, 20 percent + +.ok + farcall ApplyMusicEffectOnEncounterRate + farcall ApplyCleanseTagEffectOnEncounterRate + call Random + ld a, [hRandomAdd] + cp b + ret c + ld a, 1 + and a + ret + +INCLUDE "data/wild/bug_contest_mons.asm" + +DoBikeStep:: + nop + nop + ; If the bike shop owner doesn't have our number, or + ; if we've already gotten the call, we don't have to + ; be here. + ld hl, wStatusFlags2 + bit STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl] + jr z, .NoCall + + ; If we're not on the bike, we don't have to be here. + ld a, [wPlayerState] + cp PLAYER_BIKE + jr nz, .NoCall + + ; If we're not in an area of phone service, we don't + ; have to be here. + call GetMapPhoneService + and a + jr nz, .NoCall + + ; Check the bike step count and check whether we've + ; taken 65536 of them yet. + ld hl, wBikeStep + ld a, [hli] + ld d, a + ld e, [hl] + cp 255 + jr nz, .increment + ld a, e + cp 255 + jr z, .dont_increment + +.increment + inc de + ld [hl], e + dec hl + ld [hl], d + +.dont_increment + ; If we've taken at least 1024 steps, have the bike + ; shop owner try to call us. + ld a, d + cp HIGH(1024) + jr c, .NoCall + + ; If a call has already been queued, don't overwrite + ; that call. + ld a, [wSpecialPhoneCallID] + and a + jr nz, .NoCall + + ; Queue the call. + ld a, SPECIALCALL_BIKESHOP + ld [wSpecialPhoneCallID], a + xor a + ld [wSpecialPhoneCallID + 1], a + ld hl, wStatusFlags2 + res STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl] + scf + ret + +.NoCall: + xor a + ret + +ClearCmdQueue:: + ld hl, wCmdQueue + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY + xor a +.loop + ld [hl], a + add hl, de + dec c + jr nz, .loop + ret + +HandleCmdQueue:: + ld hl, wCmdQueue + xor a +.loop + ld [hMapObjectIndexBuffer], a + ld a, [hl] + and a + jr z, .skip + push hl + ld b, h + ld c, l + call HandleQueuedCommand + pop hl + +.skip + ld de, CMDQUEUE_ENTRY_SIZE + add hl, de + ld a, [hMapObjectIndexBuffer] + inc a + cp CMDQUEUE_CAPACITY + jr nz, .loop + ret + +Unreferenced_GetNthCmdQueueEntry: + ld hl, wCmdQueue + ld bc, CMDQUEUE_ENTRY_SIZE + call AddNTimes + ld b, h + ld c, l + ret + +WriteCmdQueue:: + push bc + push de + call .GetNextEmptyEntry + ld d, h + ld e, l + pop hl + pop bc + ret c + ld a, b + ld bc, CMDQUEUE_ENTRY_SIZE - 1 + call FarCopyBytes + xor a + ld [hl], a + ret + +.GetNextEmptyEntry: + ld hl, wCmdQueue + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY +.loop + ld a, [hl] + and a + jr z, .done + add hl, de + dec c + jr nz, .loop + scf + ret + +.done + ld a, CMDQUEUE_CAPACITY + sub c + and a + ret + +DelCmdQueue:: + ld hl, wCmdQueue + ld de, CMDQUEUE_ENTRY_SIZE + ld c, CMDQUEUE_CAPACITY +.loop + ld a, [hl] + cp b + jr z, .done + add hl, de + dec c + jr nz, .loop + and a + ret + +.done + xor a + ld [hl], a + scf + ret + +_DelCmdQueue: + ld hl, CMDQUEUE_TYPE + add hl, bc + ld [hl], 0 + ret + +HandleQueuedCommand: + ld hl, CMDQUEUE_TYPE + add hl, bc + ld a, [hl] + cp NUM_CMDQUEUE_TYPES + jr c, .okay + xor a + +.okay + ld e, a + ld d, 0 + ld hl, .Jumptable + add hl, de + add hl, de + add hl, de + ld a, [hli] + push af + ld a, [hli] + ld h, [hl] + ld l, a + pop af + rst FarCall + ret + +.Jumptable: + dba CmdQueue_Null + dba CmdQueue_Null2 + dba CmdQueue_StoneTable + dba CmdQueue_Type3 + dba CmdQueue_Type4 + +CmdQueueAnonymousJumptable: + ld hl, CMDQUEUE_05 + add hl, bc + ld a, [hl] + pop hl + rst JumpTable + ret + +CmdQueueAnonJT_Increment: + ld hl, CMDQUEUE_05 + add hl, bc + inc [hl] + ret + +CmdQueueAnonJT_Decrement: + ld hl, CMDQUEUE_05 + add hl, bc + dec [hl] + ret + +CmdQueue_Null: + ret + +CmdQueue_Null2: + call ret_2f3e + ret + +CmdQueue_Type4: + call CmdQueueAnonymousJumptable + ; anonymous dw + dw .zero + dw .one + +.zero + ld a, [hSCY] + ld hl, 4 + add hl, bc + ld [hl], a + call CmdQueueAnonJT_Increment +.one + ld hl, 1 + add hl, bc + ld a, [hl] + dec a + ld [hl], a + jr z, .finish + and $1 + jr z, .add + ld hl, 2 + add hl, bc + ld a, [hSCY] + sub [hl] + ld [hSCY], a + ret + +.add + ld hl, 2 + add hl, bc + ld a, [hSCY] + add [hl] + ld [hSCY], a + ret + +.finish + ld hl, 4 + add hl, bc + ld a, [hl] + ld [hSCY], a + call _DelCmdQueue + ret + +CmdQueue_Type3: + call CmdQueueAnonymousJumptable + ; anonymous dw + dw .zero + dw .one + dw .two + +.zero + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Increment +.one + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Increment + + ld hl, 2 + add hl, bc + ld a, [hl] + ld [wd173], a + ret + +.two + call .IsPlayerFacingDown + jr z, .PlayerNotFacingDown + call CmdQueueAnonJT_Decrement + + ld hl, 3 + add hl, bc + ld a, [hl] + ld [wd173], a + ret + +.PlayerNotFacingDown: + ld a, $7f + ld [wd173], a + ld hl, 5 + add hl, bc + ld [hl], 0 + ret + +.IsPlayerFacingDown: + push bc + ld bc, wPlayerStruct + call GetSpriteDirection + and a + pop bc + ret + +CmdQueue_StoneTable: + ld de, wPlayerStruct + ld a, NUM_OBJECT_STRUCTS +.loop + push af + + ld hl, OBJECT_SPRITE + add hl, de + ld a, [hl] + and a + jr z, .next + + ld hl, OBJECT_MOVEMENTTYPE + add hl, de + ld a, [hl] + cp SPRITEMOVEDATA_STRENGTH_BOULDER + jr nz, .next + + ld hl, OBJECT_NEXT_TILE + add hl, de + ld a, [hl] + call CheckPitTile + jr nz, .next + + ld hl, OBJECT_DIRECTION_WALKING + add hl, de + ld a, [hl] + cp STANDING + jr nz, .next + call HandleStoneQueue + jr c, .fall_down_hole + +.next + ld hl, OBJECT_STRUCT_LENGTH + add hl, de + ld d, h + ld e, l + + pop af + dec a + jr nz, .loop + ret + +.fall_down_hole + pop af + ret diff --git a/engine/overworld/events_2.asm b/engine/overworld/events_2.asm deleted file mode 100644 index 6e106541a..000000000 --- a/engine/overworld/events_2.asm +++ /dev/null @@ -1,650 +0,0 @@ -; More overworld event handling. - - -WarpToSpawnPoint:: ; 97c28 - ld hl, wStatusFlags2 - res STATUSFLAGS2_SAFARI_GAME_F, [hl] - res STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] - ret -; 97c30 - -RunMemScript:: ; 97c30 -; If there is no script here, we don't need to be here. - ld a, [wMapReentryScriptQueueFlag] - and a - ret z -; Execute the script at (wMapReentryScriptBank):(wMapReentryScriptAddress). - ld hl, wMapReentryScriptAddress - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [wMapReentryScriptBank] - call CallScript - scf -; Clear the buffer for the next script. - push af - xor a - ld hl, wMapReentryScriptQueueFlag - ld bc, 8 - call ByteFill - pop af - ret -; 97c4f - -LoadScriptBDE:: ; 97c4f -; If there's already a script here, don't overwrite. - ld hl, wMapReentryScriptQueueFlag - ld a, [hl] - and a - ret nz -; Set the flag - ld [hl], 1 - inc hl -; Load the script pointer b:de into (wMapReentryScriptBank):(wMapReentryScriptAddress) - ld [hl], b - inc hl - ld [hl], e - inc hl - ld [hl], d - scf - ret -; 97c5f - -TryTileCollisionEvent:: ; 97c5f - call GetFacingTileCoord - ld [wEngineBuffer1], a - ld c, a - farcall CheckFacingTileForStdScript - jr c, .done - - call CheckCutTreeTile - jr nz, .whirlpool - farcall TryCutOW - jr .done - -.whirlpool - ld a, [wEngineBuffer1] - call CheckWhirlpoolTile - jr nz, .waterfall - farcall TryWhirlpoolOW - jr .done - -.waterfall - ld a, [wEngineBuffer1] - call CheckWaterfallTile - jr nz, .headbutt - farcall TryWaterfallOW - jr .done - -.headbutt - ld a, [wEngineBuffer1] - call CheckHeadbuttTreeTile - jr nz, .surf - farcall TryHeadbuttOW - jr c, .done - jr .noevent - -.surf - farcall TrySurfOW - jr nc, .noevent - jr .done - -.noevent - xor a - ret - -.done - call PlayClickSFX - ld a, $ff - scf - ret -; 97cc0 - - -RandomEncounter:: ; 97cc0 -; Random encounter - - call CheckWildEncounterCooldown - jr c, .nope - call CanUseSweetScent - jr nc, .nope - ld hl, wStatusFlags2 - bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] - jr nz, .bug_contest - farcall TryWildEncounter - jr nz, .nope - jr .ok - -.bug_contest - call _TryWildEncounter_BugContest - jr nc, .nope - jr .ok_bug_contest - -.nope - ld a, 1 - and a - ret - -.ok - ld a, BANK(WildBattleScript) - ld hl, WildBattleScript - jr .done - -.ok_bug_contest - ld a, BANK(BugCatchingContestBattleScript) - ld hl, BugCatchingContestBattleScript - jr .done - -.done - call CallScript - scf - ret -; 97cf9 - -WildBattleScript: ; 97cf9 - randomwildmon - startbattle - reloadmapafterbattle - end -; 97cfd - -CanUseSweetScent:: ; 97cfd - ld hl, wStatusFlags - bit STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl] - jr nz, .no - ld a, [wEnvironment] - cp CAVE - jr z, .ice_check - cp DUNGEON - jr z, .ice_check - farcall CheckGrassCollision - jr nc, .no - -.ice_check - ld a, [wPlayerStandingTile] - call CheckIceTile - jr z, .no - scf - ret - -.no - and a - ret -; 97d23 - -_TryWildEncounter_BugContest: ; 97d23 - call TryWildEncounter_BugContest - ret nc - call ChooseWildEncounter_BugContest - farcall CheckRepelEffect - ret -; 97d31 - -ChooseWildEncounter_BugContest:: ; 97d31 -; Pick a random mon out of ContestMons. - -.loop - call Random - cp 100 << 1 - jr nc, .loop - srl a - - ld hl, ContestMons - ld de, 4 -.CheckMon: - sub [hl] - jr c, .GotMon - add hl, de - jr .CheckMon - -.GotMon: - inc hl - -; Species - ld a, [hli] - ld [wTempWildMonSpecies], a - -; Min level - ld a, [hli] - ld d, a - -; Max level - ld a, [hl] - - sub d - jr nz, .RandomLevel - -; If min and max are the same. - ld a, d - jr .GotLevel - -.RandomLevel: -; Get a random level between the min and max. - ld c, a - inc c - call Random - ld a, [hRandomAdd] - call SimpleDivide - add d - -.GotLevel: - ld [wCurPartyLevel], a - - xor a - ret -; 97d64 - -TryWildEncounter_BugContest: ; 97d64 - ld a, [wPlayerStandingTile] - call CheckSuperTallGrassTile - ld b, 40 percent - jr z, .ok - ld b, 20 percent - -.ok - farcall ApplyMusicEffectOnEncounterRate - farcall ApplyCleanseTagEffectOnEncounterRate - call Random - ld a, [hRandomAdd] - cp b - ret c - ld a, 1 - and a - ret -; 97d87 - - -INCLUDE "data/wild/bug_contest_mons.asm" - - -DoBikeStep:: ; 97db3 - nop - nop - ; If the bike shop owner doesn't have our number, or - ; if we've already gotten the call, we don't have to - ; be here. - ld hl, wStatusFlags2 - bit STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl] - jr z, .NoCall - - ; If we're not on the bike, we don't have to be here. - ld a, [wPlayerState] - cp PLAYER_BIKE - jr nz, .NoCall - - ; If we're not in an area of phone service, we don't - ; have to be here. - call GetMapPhoneService - and a - jr nz, .NoCall - - ; Check the bike step count and check whether we've - ; taken 65536 of them yet. - ld hl, wBikeStep - ld a, [hli] - ld d, a - ld e, [hl] - cp 255 - jr nz, .increment - ld a, e - cp 255 - jr z, .dont_increment - -.increment - inc de - ld [hl], e - dec hl - ld [hl], d - -.dont_increment - ; If we've taken at least 1024 steps, have the bike - ; shop owner try to call us. - ld a, d - cp HIGH(1024) - jr c, .NoCall - - ; If a call has already been queued, don't overwrite - ; that call. - ld a, [wSpecialPhoneCallID] - and a - jr nz, .NoCall - - ; Queue the call. - ld a, SPECIALCALL_BIKESHOP - ld [wSpecialPhoneCallID], a - xor a - ld [wSpecialPhoneCallID + 1], a - ld hl, wStatusFlags2 - res STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl] - scf - ret - -.NoCall: - xor a - ret -; 97df9 - -ClearCmdQueue:: ; 97df9 - ld hl, wCmdQueue - ld de, 6 - ld c, 4 - xor a -.loop - ld [hl], a - add hl, de - dec c - jr nz, .loop - ret -; 97e08 - -HandleCmdQueue:: ; 97e08 - ld hl, wCmdQueue - xor a -.loop - ld [hMapObjectIndexBuffer], a - ld a, [hl] - and a - jr z, .skip - push hl - ld b, h - ld c, l - call HandleQueuedCommand - pop hl - -.skip - ld de, CMDQUEUE_ENTRY_SIZE - add hl, de - ld a, [hMapObjectIndexBuffer] - inc a - cp CMDQUEUE_CAPACITY - jr nz, .loop - ret -; 97e25 - -Unreferenced_GetNthCmdQueueEntry: ; 97e25 - ld hl, wCmdQueue - ld bc, CMDQUEUE_ENTRY_SIZE - call AddNTimes - ld b, h - ld c, l - ret -; 97e31 - -WriteCmdQueue:: ; 97e31 - push bc - push de - call .GetNextEmptyEntry - ld d, h - ld e, l - pop hl - pop bc - ret c - ld a, b - ld bc, CMDQUEUE_ENTRY_SIZE - 1 - call FarCopyBytes - xor a - ld [hl], a - ret -; 97e45 - -.GetNextEmptyEntry: ; 97e45 - ld hl, wCmdQueue - ld de, CMDQUEUE_ENTRY_SIZE - ld c, CMDQUEUE_CAPACITY -.loop - ld a, [hl] - and a - jr z, .done - add hl, de - dec c - jr nz, .loop - scf - ret - -.done - ld a, CMDQUEUE_CAPACITY - sub c - and a - ret -; 97e5c - -DelCmdQueue:: ; 97e5c - ld hl, wCmdQueue - ld de, CMDQUEUE_ENTRY_SIZE - ld c, CMDQUEUE_CAPACITY -.loop - ld a, [hl] - cp b - jr z, .done - add hl, de - dec c - jr nz, .loop - and a - ret - -.done - xor a - ld [hl], a - scf - ret -; 97e72 - -_DelCmdQueue: ; 97e72 - ld hl, CMDQUEUE_TYPE - add hl, bc - ld [hl], 0 - ret -; 97e79 - -HandleQueuedCommand: ; 97e79 - ld hl, CMDQUEUE_TYPE - add hl, bc - ld a, [hl] - cp 5 - jr c, .okay - xor a - -.okay - ld e, a - ld d, 0 - ld hl, .Jumptable - add hl, de - add hl, de - add hl, de - ld a, [hli] - push af - ld a, [hli] - ld h, [hl] - ld l, a - pop af - rst FarCall - ret -; 97e94 - -.Jumptable: ; 97e94 - dba CmdQueue_Null - dba CmdQueue_Null2 - dba CmdQueue_StoneTable - dba CmdQueue_Type3 - dba CmdQueue_Type4 -; 97ea3 - -CmdQueueAnonymousJumptable: ; 97ea3 - ld hl, CMDQUEUE_05 - add hl, bc - ld a, [hl] - pop hl - rst JumpTable - ret -; 97eab - -CmdQueueAnonJT_Increment: ; 97eab - ld hl, CMDQUEUE_05 - add hl, bc - inc [hl] - ret -; 97eb1 - -CmdQueueAnonJT_Decrement: ; 97eb1 - ld hl, CMDQUEUE_05 - add hl, bc - dec [hl] - ret -; 97eb7 - -CmdQueue_Null: ; 97eb7 - ret -; 97eb8 - -CmdQueue_Null2: ; 97eb8 - call ret_2f3e - ret -; 97ebc - -CmdQueue_Type4: ; 97ebc - call CmdQueueAnonymousJumptable - ; anonymous dw - dw .zero - dw .one -; 97ec3 - -.zero ; 97ec3 - ld a, [hSCY] - ld hl, 4 - add hl, bc - ld [hl], a - call CmdQueueAnonJT_Increment -.one ; 97ecd - ld hl, 1 - add hl, bc - ld a, [hl] - dec a - ld [hl], a - jr z, .finish - and $1 - jr z, .add - ld hl, 2 - add hl, bc - ld a, [hSCY] - sub [hl] - ld [hSCY], a - ret - -.add - ld hl, 2 - add hl, bc - ld a, [hSCY] - add [hl] - ld [hSCY], a - ret - -.finish - ld hl, 4 - add hl, bc - ld a, [hl] - ld [hSCY], a - call _DelCmdQueue - ret -; 97ef9 - -CmdQueue_Type3: ; 97ef9 - call CmdQueueAnonymousJumptable - ; anonymous dw - dw .zero - dw .one - dw .two -; 97f02 - -.zero ; 97f02 - call .IsPlayerFacingDown - jr z, .PlayerNotFacingDown - call CmdQueueAnonJT_Increment -.one ; 97f0a - call .IsPlayerFacingDown - jr z, .PlayerNotFacingDown - call CmdQueueAnonJT_Increment - - ld hl, 2 - add hl, bc - ld a, [hl] - ld [wd173], a - ret -; 97f1b - -.two ; 97f1b - call .IsPlayerFacingDown - jr z, .PlayerNotFacingDown - call CmdQueueAnonJT_Decrement - - ld hl, 3 - add hl, bc - ld a, [hl] - ld [wd173], a - ret -; 97f2c - -.PlayerNotFacingDown: ; 97f2c - ld a, $7f - ld [wd173], a - ld hl, 5 - add hl, bc - ld [hl], 0 - ret -; 97f38 - -.IsPlayerFacingDown: ; 97f38 - push bc - ld bc, wPlayerStruct - call GetSpriteDirection - and a - pop bc - ret -; 97f42 - -CmdQueue_StoneTable: ; 97f42 - ld de, wPlayerStruct - ld a, NUM_OBJECT_STRUCTS -.loop - push af - - ld hl, OBJECT_SPRITE - add hl, de - ld a, [hl] - and a - jr z, .next - - ld hl, OBJECT_MOVEMENTTYPE - add hl, de - ld a, [hl] - cp SPRITEMOVEDATA_STRENGTH_BOULDER - jr nz, .next - - ld hl, OBJECT_NEXT_TILE - add hl, de - ld a, [hl] - call CheckPitTile - jr nz, .next - - ld hl, OBJECT_DIRECTION_WALKING - add hl, de - ld a, [hl] - cp STANDING - jr nz, .next - call HandleStoneQueue - jr c, .fall_down_hole - -.next - ld hl, OBJECT_STRUCT_LENGTH - add hl, de - ld d, h - ld e, l - - pop af - dec a - jr nz, .loop - ret - -.fall_down_hole - pop af - ret -; 97f7e diff --git a/engine/overworld/init_map.asm b/engine/overworld/init_map.asm index 2eb4998a6..ba1e74295 100644 --- a/engine/overworld/init_map.asm +++ b/engine/overworld/init_map.asm @@ -1,4 +1,4 @@ -ReanchorBGMap_NoOAMUpdate:: ; 6454 +ReanchorBGMap_NoOAMUpdate:: call DelayFrame ld a, [hOAMUpdate] push af @@ -50,13 +50,13 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454 call ApplyBGMapAnchorToObjects ret -.LoadBGMapAddrIntoHRAM: ; 64b9 +.LoadBGMapAddrIntoHRAM: ld [hBGMapAddress + 1], a xor a ld [hBGMapAddress], a ret -LoadFonts_NoOAMUpdate:: ; 64bf +LoadFonts_NoOAMUpdate:: ld a, [hOAMUpdate] push af ld a, $1 @@ -76,7 +76,7 @@ LoadFonts_NoOAMUpdate:: ; 64bf call LoadStandardFont ret -HDMATransfer_FillBGMap0WithBlack: ; 64db +HDMATransfer_FillBGMap0WithBlack: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) diff --git a/engine/overworld/landmarks.asm b/engine/overworld/landmarks.asm index f16f48e67..9deafb8e6 100644 --- a/engine/overworld/landmarks.asm +++ b/engine/overworld/landmarks.asm @@ -1,4 +1,4 @@ -GetLandmarkCoords: ; 0x1ca896 +GetLandmarkCoords: ; Return coordinates (d, e) of landmark e. push hl ld l, e @@ -12,10 +12,8 @@ GetLandmarkCoords: ; 0x1ca896 ld d, [hl] pop hl ret -; 0x1ca8a5 - -GetLandmarkName:: ; 0x1ca8a5 +GetLandmarkName:: ; Copy the name of landmark e to wStringBuffer1. push hl push de @@ -44,13 +42,10 @@ GetLandmarkName:: ; 0x1ca8a5 pop de pop hl ret -; 0x1ca8c3 - INCLUDE "data/maps/landmarks.asm" - -RegionCheck: ; 0x1caea1 +RegionCheck: ; Checks if the player is in Kanto or Johto. ; If in Johto, returns 0 in e. ; If in Kanto, returns 1 in e. diff --git a/engine/overworld/load_map_part.asm b/engine/overworld/load_map_part.asm index 9eeef7259..da1436406 100644 --- a/engine/overworld/load_map_part.asm +++ b/engine/overworld/load_map_part.asm @@ -1,4 +1,4 @@ -_LoadMapPart:: ; 4d15b +_LoadMapPart:: ld hl, wSurroundingTiles ld a, [wMetatileStandingY] and a diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm index c82cd80a2..2c4834a3d 100644 --- a/engine/overworld/map_object_action.asm +++ b/engine/overworld/map_object_action.asm @@ -1,4 +1,4 @@ -ObjectActionPairPointers: ; 445f +ObjectActionPairPointers: ; entries correspond to OBJECT_ACTION_* constants dw SetFacingStanding, SetFacingStanding dw SetFacingStandAction, SetFacingCurrent @@ -17,37 +17,33 @@ ObjectActionPairPointers: ; 445f dw SetFacingBoulderDust, SetFacingStanding dw SetFacingGrassShake, SetFacingStanding dw SetFacingSkyfall, SetFacingCurrent -; 44a3 -SetFacingStanding: ; 44a3 +SetFacingStanding: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], STANDING ret -; 44aa -SetFacingCurrent: ; 44aa +SetFacingCurrent: call GetSpriteDirection or FACING_STEP_DOWN_0 ; useless ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret -; 44b5 -SetFacingStandAction: ; 44b5 +SetFacingStandAction: ld hl, OBJECT_FACING_STEP add hl, bc ld a, [hl] and 1 jr nz, SetFacingStepAction jp SetFacingCurrent -; 44c1 -SetFacingStepAction: ; 44c1 +SetFacingStepAction: ld hl, OBJECT_FLAGS1 add hl, bc - bit SLIDING, [hl] + bit SLIDING_F, [hl] jp nz, SetFacingCurrent ld hl, OBJECT_STEP_FRAME @@ -59,7 +55,7 @@ SetFacingStepAction: ; 44c1 rrca rrca - and %00000011 + maskbits NUM_DIRECTIONS ld d, a call GetSpriteDirection @@ -69,12 +65,11 @@ SetFacingStepAction: ; 44c1 add hl, bc ld [hl], a ret -; 44e4 -SetFacingSkyfall: ; 44e4 +SetFacingSkyfall: ld hl, OBJECT_FLAGS1 add hl, bc - bit SLIDING, [hl] + bit SLIDING_F, [hl] jp nz, SetFacingCurrent ld hl, OBJECT_STEP_FRAME @@ -86,7 +81,7 @@ SetFacingSkyfall: ; 44e4 rrca rrca - and %00000011 + maskbits NUM_DIRECTIONS ld d, a call GetSpriteDirection @@ -96,12 +91,11 @@ SetFacingSkyfall: ; 44e4 add hl, bc ld [hl], a ret -; 4508 -SetFacingBumpAction: ; 4508 +SetFacingBumpAction: ld hl, OBJECT_FLAGS1 add hl, bc - bit SLIDING, [hl] + bit SLIDING_F, [hl] jp nz, SetFacingCurrent ld hl, OBJECT_STEP_FRAME @@ -112,7 +106,7 @@ SetFacingBumpAction: ; 4508 rrca rrca rrca - and %00000011 + maskbits NUM_DIRECTIONS ld d, a call GetSpriteDirection @@ -122,9 +116,8 @@ SetFacingBumpAction: ; 4508 add hl, bc ld [hl], a ret -; 4529 -SetFacingCounterclockwiseSpin: ; 4529 +SetFacingCounterclockwiseSpin: call CounterclockwiseSpinAction ld hl, OBJECT_FACING add hl, bc @@ -134,14 +127,12 @@ SetFacingCounterclockwiseSpin: ; 4529 add hl, bc ld [hl], a ret -; 4539 -SetFacingCounterclockwiseSpin2: ; 4539 +SetFacingCounterclockwiseSpin2: call CounterclockwiseSpinAction jp SetFacingStanding -; 453f -CounterclockwiseSpinAction: ; 453f +CounterclockwiseSpinAction: ; Here, OBJECT_STEP_FRAME consists of two 2-bit components, ; using only bits 0,1 and 4,5. ; bits 0,1 is a timer (4 overworld frames) @@ -179,13 +170,11 @@ CounterclockwiseSpinAction: ; 453f add hl, bc ld [hl], a ret -; 456a -.Directions: ; 456a +.Directions: db OW_DOWN, OW_RIGHT, OW_UP, OW_LEFT -; 456e -SetFacingFish: ; 456e +SetFacingFish: call GetSpriteDirection rrca rrca @@ -194,30 +183,26 @@ SetFacingFish: ; 456e add hl, bc ld [hl], a ret -; 457b -SetFacingShadow: ; 457b +SetFacingShadow: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], FACING_SHADOW ret -; 4582 -SetFacingEmote: ; 4582 emote +SetFacingEmote: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], FACING_EMOTE ret -; 4589 -SetFacingBigDollSym: ; 4589 +SetFacingBigDollSym: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], FACING_BIG_DOLL_SYM ret -; 4590 -SetFacingBounce: ; 4590 +SetFacingBounce: ld hl, OBJECT_STEP_FRAME add hl, bc ld a, [hl] @@ -230,22 +215,20 @@ SetFacingBounce: ; 4590 add hl, bc ld [hl], FACING_STEP_UP_0 ret -; 45a4 -SetFacingFreezeBounce: ; 45a4 +SetFacingFreezeBounce: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], FACING_STEP_DOWN_0 ret -; 45ab -SetFacingWeirdTree: ; 45ab +SetFacingWeirdTree: ld hl, OBJECT_STEP_FRAME add hl, bc ld a, [hl] inc a ld [hl], a - and %00001100 + maskbits NUM_DIRECTIONS, 2 rrca rrca add FACING_WEIRD_TREE_0 @@ -253,16 +236,14 @@ SetFacingWeirdTree: ; 45ab add hl, bc ld [hl], a ret -; 45be -SetFacingBigDollAsym: ; 45be +SetFacingBigDollAsym: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], FACING_BIG_DOLL_ASYM ret -; 45c5 -SetFacingBigDoll: ; 45c5 +SetFacingBigDoll: ld a, [wVariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS] ld d, FACING_BIG_DOLL_SYM ; symmetric cp SPRITE_BIG_SNORLAX @@ -276,9 +257,8 @@ SetFacingBigDoll: ; 45c5 add hl, bc ld [hl], d ret -; 45da -SetFacingBoulderDust: ; 45da +SetFacingBoulderDust: ld hl, OBJECT_STEP_FRAME add hl, bc inc [hl] @@ -293,9 +273,8 @@ SetFacingBoulderDust: ; 45da .ok ld [hl], a ret -; 45ed -SetFacingGrassShake: ; 45ed +SetFacingGrassShake: ld hl, OBJECT_STEP_FRAME add hl, bc inc [hl] @@ -310,4 +289,3 @@ SetFacingGrassShake: ; 45ed .ok ld [hl], a ret -; 4600 diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 1573a27b5..8c1171981 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2,9 +2,7 @@ INCLUDE "data/sprites/facings.asm" INCLUDE "data/sprites/map_objects.asm" - -; 4357 -DeleteMapObject:: ; 4357 +DeleteMapObject:: push bc ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc @@ -27,9 +25,8 @@ DeleteMapObject:: ; 4357 .ok pop bc ret -; 437b -Function437b: ; 437b +Function437b: call .CheckObjectStillVisible ret c call .HandleStepType @@ -93,7 +90,7 @@ Function437b: ; 437b .ok2 ld hl, OBJECT_FLAGS1 add hl, bc - bit 1, [hl] + bit WONT_DELETE_F, [hl] jr nz, .yes2 call DeleteMapObject scf @@ -146,7 +143,7 @@ Function437b: ; 437b .HandleObjectAction: ld hl, OBJECT_FLAGS1 add hl, bc - bit INVISIBLE, [hl] + bit INVISIBLE_F, [hl] jr nz, SetFacingStanding ld hl, OBJECT_FLAGS2 add hl, bc @@ -156,17 +153,15 @@ Function437b: ; 437b jr nz, asm_4448 ld de, ObjectActionPairPointers ; use first column jr _HandleObjectAction -; 4440 -Function4440: ; 4440 +Function4440: ld hl, OBJECT_FLAGS1 add hl, bc - bit INVISIBLE, [hl] + bit INVISIBLE_F, [hl] jr nz, SetFacingStanding asm_4448: ld de, ObjectActionPairPointers + 2 ; use second column jr _HandleObjectAction -; 444d _HandleObjectAction: ; call [4 * wObjectStructs[ObjInd, OBJECT_ACTION] + de] @@ -183,11 +178,10 @@ _HandleObjectAction: ld l, a call _hl_ ret -; 445f INCLUDE "engine/overworld/map_object_action.asm" -CopyNextCoordsTileToStandingCoordsTile: ; 4600 +CopyNextCoordsTileToStandingCoordsTile: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] @@ -212,9 +206,8 @@ CopyNextCoordsTileToStandingCoordsTile: ; 4600 ld a, [hl] call UselessAndA ret -; 462a -Function462a: ; 462a +Function462a: ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] @@ -228,12 +221,11 @@ Function462a: ; 462a add hl, bc ld [hl], a ret -; 463f -UpdateTallGrassFlags: ; 463f +UpdateTallGrassFlags: ld hl, OBJECT_FLAGS2 add hl, bc - bit OVERHEAD, [hl] + bit OVERHEAD_F, [hl] jr z, .ok ld hl, OBJECT_NEXT_TILE add hl, bc @@ -250,9 +242,8 @@ UpdateTallGrassFlags: ; 463f ld a, [hl] call UselessAndA ret -; 4661 -SetTallGrassFlags: ; 4661 +SetTallGrassFlags: call CheckSuperTallGrassTile jr z, .set call CheckGrassTile @@ -260,22 +251,20 @@ SetTallGrassFlags: ; 4661 .set ld hl, OBJECT_FLAGS2 add hl, bc - set OVERHEAD, [hl] + set OVERHEAD_F, [hl] ret .reset ld hl, OBJECT_FLAGS2 add hl, bc - res OVERHEAD, [hl] + res OVERHEAD_F, [hl] ret -; 4679 -UselessAndA: ; 4679 +UselessAndA: and a ret -; 467b -EndSpriteMovement: ; 467b +EndSpriteMovement: xor a ld hl, OBJECT_STEP_FRAME add hl, bc @@ -290,15 +279,14 @@ EndSpriteMovement: ; 467b add hl, bc ld [hl], STANDING ret -; 4690 -InitStep: ; 4690 +InitStep: ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], a ld hl, OBJECT_FLAGS1 add hl, bc - bit FIXED_FACING, [hl] + bit FIXED_FACING_F, [hl] jr nz, GetNextTile add a add a @@ -306,7 +294,7 @@ InitStep: ; 4690 ld hl, OBJECT_FACING add hl, bc ld [hl], a -GetNextTile: ; 46a6 +GetNextTile: call GetStepVector ld hl, OBJECT_STEP_DURATION add hl, bc @@ -336,9 +324,8 @@ GetNextTile: ; 46a6 add hl, bc ld [hl], a ret -; 46d7 -AddStepVector: ; 46d7 +AddStepVector: call GetStepVector ld hl, OBJECT_SPRITE_X add hl, bc @@ -351,9 +338,8 @@ AddStepVector: ; 46d7 add e ld [hl], a ret -; 46e9 -GetStepVector: ; 46e9 +GetStepVector: ; Return (x, y, duration, speed) in (d, e, a, h). ld hl, OBJECT_DIRECTION_WALKING add hl, bc @@ -372,9 +358,8 @@ GetStepVector: ; 46e9 ld a, [hli] ld h, [hl] ret -; 4700 -StepVectors: ; 4700 +StepVectors: ; x, y, duration, speed ; slow db 0, 1, 16, 1 @@ -391,18 +376,16 @@ StepVectors: ; 4700 db 0, -4, 4, 4 db -4, 0, 4, 4 db 4, 0, 4, 4 -; 4730 -GetStepVectorSign: ; 4730 +GetStepVectorSign: add a ret z ; 0 or 128 ld a, 1 ret nc ; 1 - 127 ld a, -1 ret ; 129 - 255 -; 4738 -UpdatePlayerStep: ; 4738 +UpdatePlayerStep: ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] @@ -418,9 +401,8 @@ UpdatePlayerStep: ; 4738 ld hl, wPlayerStepFlags set 5, [hl] ret -; 4759 -Unreferenced_Function4759: ; 4759 +Unreferenced_Function4759: push bc ld e, a ld d, 0 @@ -432,9 +414,8 @@ Unreferenced_Function4759: ; 4759 ld a, [hl] pop bc ret -; 4769 -RestoreDefaultMovement: ; 4769 +RestoreDefaultMovement: ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] @@ -451,76 +432,66 @@ RestoreDefaultMovement: ; 4769 .ok ld a, SPRITEMOVEFN_STANDING ret -; 4780 -ClearObjectMovementByteIndex: ; 4780 +ClearObjectMovementByteIndex: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld [hl], 0 ret -; 4787 -IncrementObjectMovementByteIndex: ; 4787 +IncrementObjectMovementByteIndex: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc inc [hl] ret -; 478d -DecrementObjectMovementByteIndex: ; 478d +DecrementObjectMovementByteIndex: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc dec [hl] ret -; 4793 -MovementAnonymousJumptable: ; 4793 +MovementAnonymousJumptable: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld a, [hl] pop hl rst JumpTable ret -; 479b -ClearObjectStructField1c: ; 479b +ClearObjectStructField1c: ld hl, OBJECT_1C add hl, bc ld [hl], 0 ret -; 47a2 -IncrementObjectStructField1c: ; 47a2 +IncrementObjectStructField1c: ld hl, OBJECT_1C add hl, bc inc [hl] ret -; 47a8 -Field1cAnonymousJumptable: ; 47a8 +Field1cAnonymousJumptable: ld hl, OBJECT_1C add hl, bc ld a, [hl] pop hl rst JumpTable ret -; 47b0 -GetValueObjectStructField1c: ; 47b0 +GetValueObjectStructField1c: ld hl, OBJECT_1C add hl, bc ld a, [hl] ret -; 47b6 -SetValueObjectStructField1c: ; 47b6 +SetValueObjectStructField1c: ld hl, OBJECT_1C add hl, bc ld [hl], a ret -; 47bc -ObjectMovementReset: ; 47bc +ObjectMovementReset: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] @@ -539,9 +510,8 @@ ObjectMovementReset: ; 47bc add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 47dd -MapObjectMovementPattern: ; 47dd +MapObjectMovementPattern: call ClearObjectStructField1c call GetSpriteMovementFunction ld a, [hl] @@ -549,7 +519,7 @@ MapObjectMovementPattern: ; 47dd rst JumpTable ret -.Pointers: ; 47e9 +.Pointers: ; entries correspond to SPRITEMOVEFN_* constants dw .Null_00 ; 00 dw .RandomWalkY ; 01 @@ -696,7 +666,7 @@ MapObjectMovementPattern: ; 47dd and %00000011 or 0 call InitStep - call Function6ec1 + call CanObjectMoveInDirection jr c, .ok2 ld de, SFX_STRENGTH call PlaySFX @@ -848,7 +818,7 @@ MapObjectMovementPattern: ; 47dd call .MovementSpinNextFacing jr .MovementSpinCounterclockwise -.DirectionData_Counterclockwise: ; 49c0 +.DirectionData_Counterclockwise: db OW_RIGHT, OW_LEFT, OW_DOWN, OW_UP .MovementSpinTurnRight: @@ -856,7 +826,7 @@ MapObjectMovementPattern: ; 47dd call .MovementSpinNextFacing jr .MovementSpinClockwise -.DirectionData_Clockwise: ; 49cc +.DirectionData_Clockwise: db OW_LEFT, OW_RIGHT, OW_UP, OW_DOWN .MovementSpinNextFacing: @@ -969,7 +939,7 @@ MapObjectMovementPattern: ; 47dd ld [hl], STEP_TYPE_TRACKING_OBJECT ret -.data_4a81 ; 4a81 +.data_4a81 ; x, y db 0, -4 db 0, 8 @@ -1049,7 +1019,7 @@ MapObjectMovementPattern: ; 47dd .RandomWalkContinue: call InitStep - call Function6ec1 ; check whether the object can move in that direction + call CanObjectMoveInDirection ; check whether the object can move in that direction jr c, .NewDuration call UpdateTallGrassFlags ld hl, OBJECT_ACTION @@ -1073,18 +1043,17 @@ MapObjectMovementPattern: ; 47dd .NewDuration: call EndSpriteMovement call Function462a -RandomStepDuration_Slow: ; 4b1d +RandomStepDuration_Slow: call Random ld a, [hRandomAdd] and %01111111 jr SetRandomStepDuration -; 4b26 -RandomStepDuration_Fast: ; 4b26 +RandomStepDuration_Fast: call Random ld a, [hRandomAdd] and %00011111 -SetRandomStepDuration: ; 4b2d +SetRandomStepDuration: ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a @@ -1098,9 +1067,8 @@ SetRandomStepDuration: ; 4b2d add hl, bc ld [hl], STEP_TYPE_03 ret -; 4b45 -StepTypesJumptable: ; 4b45 +StepTypesJumptable: ; entries correspond to STEP_TYPE_* constants dw ObjectMovementReset ; 00 dw MapObjectMovementPattern ; 01 @@ -1128,9 +1096,8 @@ StepTypesJumptable: ; 4b45 dw StepType17 ; 17 dw StepType18 ; 18 dw SkyfallTop ; 19 -; 4b79 -WaitStep_InPlace: ; 4b79 +WaitStep_InPlace: ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] @@ -1139,9 +1106,8 @@ WaitStep_InPlace: ; 4b79 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4b86 -NPCJump: ; 4b86 +NPCJump: call Field1cAnonymousJumptable ; anonymous dw dw .Jump @@ -1174,9 +1140,8 @@ NPCJump: ; 4b86 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4bbf -PlayerJump: ; 4bbf +PlayerJump: call Field1cAnonymousJumptable ; anonymous dw dw .initjump @@ -1224,16 +1189,14 @@ PlayerJump: ; 4bbf add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4c18 -TeleportFrom: ; 4c18 +TeleportFrom: call Field1cAnonymousJumptable ; anonymous dw dw .InitSpin dw .DoSpin dw .InitSpinRise dw .DoSpinRise -; 4c23 .InitSpin: ld hl, OBJECT_STEP_FRAME @@ -1294,9 +1257,8 @@ TeleportFrom: ; 4c18 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4c89 -TeleportTo: ; 4c89 +TeleportTo: call Field1cAnonymousJumptable ; anonymous dw dw .InitWait @@ -1306,7 +1268,6 @@ TeleportTo: ; 4c89 dw .InitFinalSpin dw .DoFinalSpin dw .FinishStep -; 4c9a .InitWait: ld hl, OBJECT_ACTION @@ -1317,7 +1278,6 @@ TeleportTo: ; 4c89 ld [hl], 16 call IncrementObjectStructField1c ret -; 4caa .DoWait: ld hl, OBJECT_STEP_DURATION @@ -1337,7 +1297,6 @@ TeleportTo: ; 4c89 ld [hl], 16 call IncrementObjectStructField1c ret -; 4cc9 .DoDescent: ld hl, OBJECT_ACTION @@ -1365,7 +1324,6 @@ TeleportTo: ; 4c89 ld [hl], 16 call IncrementObjectStructField1c ret -; 4cf5 .DoFinalSpin: ld hl, OBJECT_ACTION @@ -1386,16 +1344,14 @@ TeleportTo: ; 4c89 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4d14 -Skyfall: ; 4d14 +Skyfall: call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Step dw .Fall dw .Finish -; 4d1f .Init: ld hl, OBJECT_ACTION @@ -1451,14 +1407,12 @@ Skyfall: ; 4d14 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4d7e -GotBiteStep: ; 4d7e +GotBiteStep: call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Run -; 4d85 .Init: ld hl, OBJECT_STEP_DURATION @@ -1485,12 +1439,10 @@ GotBiteStep: ; 4d7e add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4daf -RockSmashStep: ; 4daf +RockSmashStep: call .Step jp WaitStep_InPlace -; 4db5 .Step: ld hl, OBJECT_STEP_DURATION @@ -1505,9 +1457,8 @@ RockSmashStep: ; 4daf add hl, bc ld [hl], a ret -; 4dc8 -ReturnDigStep: ; 4dc8 +ReturnDigStep: ld hl, OBJECT_STEP_DURATION add hl, bc ld a, [hl] @@ -1520,9 +1471,8 @@ ReturnDigStep: ; 4dc8 add hl, bc ld [hl], a jp WaitStep_InPlace -; 4ddd -StepType03: ; 4ddd +StepType03: ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING @@ -1534,9 +1484,8 @@ StepType03: ; 4ddd add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4df0 -StepType18: ; 4df0 +StepType18: ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING @@ -1545,9 +1494,8 @@ StepType18: ; 4df0 dec [hl] ret nz jp DeleteMapObject -; 4dff -StepTypeBump: ; 4dff +StepTypeBump: ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] @@ -1556,9 +1504,8 @@ StepTypeBump: ; 4dff add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4e0c -StepType05: ; 4e0c +StepType05: call Field1cAnonymousJumptable ; anonymous dw dw .Reset @@ -1571,15 +1518,14 @@ StepType05: ; 4e0c add hl, bc ld [hl], a call IncrementObjectStructField1c -StepType04: ; 4e21 +StepType04: call Stubbed_Function4fb2 ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING ret -; 4e2b -NPCStep: ; 4e2b +NPCStep: call Stubbed_Function4fb2 call AddStepVector ld hl, OBJECT_STEP_DURATION @@ -1594,9 +1540,8 @@ NPCStep: ; 4e2b add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4e47 -StepType07: ; 4e47 +StepType07: call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1604,9 +1549,8 @@ StepType07: ; 4e47 ret nz call CopyNextCoordsTileToStandingCoordsTile jp RandomStepDuration_Slow -; 4e56 -PlayerStep: ; 4e56 +PlayerStep: ; AnimateStep? call Field1cAnonymousJumptable ; anonymous dw @@ -1633,9 +1577,8 @@ PlayerStep: ; 4e56 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4e83 -PlayerOrNPCTurnStep: ; 4e83 +PlayerOrNPCTurnStep: call Field1cAnonymousJumptable ; anonymous dw dw .init1 @@ -1681,9 +1624,8 @@ PlayerOrNPCTurnStep: ; 4e83 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4ecd -StepType0f: ; 4ecd +StepType0f: call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1713,9 +1655,8 @@ StepType0f: ; 4ecd add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4f04 -StepTypeTrackingObject: ; 4f04 +StepTypeTrackingObject: ld hl, OBJECT_1D add hl, bc ld e, [hl] @@ -1747,10 +1688,9 @@ StepTypeTrackingObject: ; 4f04 ret nz .nope jp DeleteMapObject -; 4f33 -StepType14: ; 4f33 -StepType15: ; 4f33 +StepType14: +StepType15: call Field1cAnonymousJumptable ; anonymous dw dw .Init @@ -1797,21 +1737,18 @@ StepType15: ; 4f33 cpl inc a ret -; 4f77 -StepType16: ; 4f77 +StepType16: call Field1cAnonymousJumptable ; ???? -; 4f7a -StepType17: ; 4f7a +StepType17: call Field1cAnonymousJumptable ; anonymous dw dw .null dw .null dw .null .null -; 4f83 -SkyfallTop: ; 4f83 +SkyfallTop: call Field1cAnonymousJumptable ; anonymous dw dw .Init @@ -1841,7 +1778,6 @@ SkyfallTop: ; 4f83 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 4fb2 Stubbed_Function4fb2: ret @@ -1862,10 +1798,9 @@ Stubbed_Function4fb2: ld [hl], a ret -.y ; 4fcd +.y db 0, -1, -2, -3, -4, -3, -2, -1 -; 4fd5 -UpdateJumpPosition: ; 4fd5 +UpdateJumpPosition: call GetStepVector ld a, h ld hl, OBJECT_1F @@ -1884,10 +1819,9 @@ UpdateJumpPosition: ; 4fd5 ld [hl], a ret -.y ; 4ff0 +.y db -4, -6, -8, -10, -11, -12, -12, -12 db -11, -10, -9, -8, -6, -4, 0, 0 -; 5000 Function5000: ; unscripted? ; copy [wPlayerNextMovement] to [wPlayerMovement] ld a, [wPlayerNextMovement] @@ -1899,15 +1833,13 @@ Function5000: ; unscripted? ; recover the previous value of [wPlayerNextMovement] ld a, [hl] ret -; 500e GetMovementByte: ld hl, wMovementDataPointer call _GetMovementByte ret -; 5015 -Function5015: ; 5015 +Function5015: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld e, [hl] @@ -1920,9 +1852,8 @@ Function5015: ; 5015 add hl, de ld a, [hl] ret -; 5026 -Function5026: ; 5026 +Function5026: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld e, [hl] @@ -1935,19 +1866,16 @@ Function5026: ; 5026 add hl, de ld a, [hl] ret -; 5037 -_GetMovementObject: ; 5037 +_GetMovementObject: ld hl, GetMovementObject jp HandleMovementData -; 503d -GetMovementObject: ; 503d +GetMovementObject: ld a, [wMovementObject] ret -; 5041 -HandleMovementData: ; 5041 +HandleMovementData: call .StorePointer .loop xor a @@ -1965,35 +1893,30 @@ HandleMovementData: ; 5041 ld a, h ld [wMovementPointer + 1], a ret -; 505e -JumpMovementPointer: ; 505e +JumpMovementPointer: ld hl, wMovementPointer ld a, [hli] ld h, [hl] ld l, a jp hl -; 5065 -ContinueReadingMovement: ; 5065 +ContinueReadingMovement: ld a, 1 ld [wMovementByteWasControlSwitch], a ret -; 506b -DoMovementFunction: ; 506b +DoMovementFunction: push af call ApplyMovementToFollower pop af ld hl, MovementPointers rst JumpTable ret -; 5075 INCLUDE "engine/overworld/movement.asm" -; 54b8 -ApplyMovementToFollower: ; 54b8 +ApplyMovementToFollower: ld e, a ld a, [wObjectFollow_Follower] cp -1 @@ -2024,9 +1947,8 @@ ApplyMovementToFollower: ; 54b8 pop af ld [hl], a ret -; 54e6 -GetFollowerNextMovementByte: ; 54e6 +GetFollowerNextMovementByte: ld hl, wFollowerMovementQueueLength ld a, [hl] and a @@ -2075,9 +1997,8 @@ GetFollowerNextMovementByte: ; 54e6 ld a, movement_step_end scf ret -; 5529 -SpawnShadow: ; 5529 +SpawnShadow: push bc ld de, .ShadowObject call CopyTempObjectData @@ -2088,9 +2009,8 @@ SpawnShadow: ; 5529 .ShadowObject: ; vtile, palette, movement db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SHADOW -; 5538 -SpawnStrengthBoulderDust: ; 5538 +SpawnStrengthBoulderDust: push bc ld de, .BoulderDustObject call CopyTempObjectData @@ -2100,9 +2020,8 @@ SpawnStrengthBoulderDust: ; 5538 .BoulderDustObject: db $00, PAL_OW_SILVER, SPRITEMOVEDATA_BOULDERDUST -; 5547 -SpawnEmote: ; 5547 +SpawnEmote: push bc ld de, .EmoteObject call CopyTempObjectData @@ -2112,21 +2031,19 @@ SpawnEmote: ; 5547 .EmoteObject: db $00, PAL_OW_SILVER, SPRITEMOVEDATA_EMOTE -; 5556 -ShakeGrass: ; 5556 +ShakeGrass: push bc - ld de, .data_5562 + ld de, .GrassObject call CopyTempObjectData call InitTempObject pop bc ret -.data_5562 +.GrassObject db $00, PAL_OW_TREE, SPRITEMOVEDATA_GRASS -; 5565 -ShakeScreen: ; 5565 +ShakeScreen: push bc push af ld de, .ScreenShakeObject @@ -2139,8 +2056,8 @@ ShakeScreen: ; 5565 .ScreenShakeObject: db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SCREENSHAKE -; 5579 -DespawnEmote: ; 5579 + +DespawnEmote: push bc ld a, [hMapObjectIndexBuffer] ld c, a @@ -2155,7 +2072,7 @@ DespawnEmote: ; 5579 push af ld hl, OBJECT_FLAGS1 add hl, de - bit EMOTE_OBJECT, [hl] + bit EMOTE_OBJECT_F, [hl] jr z, .next ld hl, OBJECT_SPRITE add hl, de @@ -2176,18 +2093,16 @@ DespawnEmote: ; 5579 dec a jr nz, .loop ret -; 55ac -InitTempObject: ; 55ac +InitTempObject: call FindFirstEmptyObjectStruct ret nc ld d, h ld e, l farcall CopyTempObjectToObjectStruct ret -; 55b9 -CopyTempObjectData: ; 55b9 +CopyTempObjectData: ; load into wTempObjectCopy: ; -1, -1, [de], [de + 1], [de + 2], [hMapObjectIndexBuffer], [NextMapX], [NextMapY], -1 ; This spawns the object at the same place as whichever object is loaded into bc. @@ -2220,9 +2135,8 @@ CopyTempObjectData: ; 55b9 inc hl ld [hl], -1 ret -; 55e0 -Function55e0:: ; 55e0 +Function55e0:: ld a, [wVramState] bit 0, a ret z @@ -2243,9 +2157,9 @@ Function55e0:: ; 55e0 cp NUM_OBJECT_STRUCTS jr nz, .loop ret -; 5602 -Function5602: ; 5602, called at battle start +Function5602: +; called at battle start call Function5645 ; clear sprites ld a, PLAYER call Function5629 ; respawn player @@ -2259,17 +2173,15 @@ Function5602: ; 5602, called at battle start .ok call _UpdateSprites ret -; 561d -Function561d: ; 561d +Function561d: call Function5645 ; clear sprites ld a, PLAYER call Function5629 ; respawn player call _UpdateSprites ret -; 5629 -Function5629: ; 5629 +Function5629: cp NUM_OBJECTS ret nc call GetMapObject @@ -2285,9 +2197,8 @@ Function5629: ; 5629 ret z call Function5673 ret -; 5645 -Function5645: ; 5645 +Function5645: xor a ld bc, wObjectStructs .loop @@ -2302,9 +2213,8 @@ Function5645: ; 5645 cp NUM_OBJECT_STRUCTS jr nz, .loop ret -; 565c -Function565c: ; 565c +Function565c: push bc call Function56cd pop bc @@ -2315,25 +2225,22 @@ Function565c: ; 565c farcall Function4440 xor a ret -; 5673 -Function5673: ; 5673 +Function5673: call Function56a3 jr c, SetFacing_Standing farcall Function4440 ; no need to farcall xor a ret -; 5680 -SetFacing_Standing: ; 5680 +SetFacing_Standing: ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], STANDING scf ret -; 5688 -Function5688: ; 5688 +Function5688: push bc ld hl, OBJECT_NEXT_MAP_X add hl, bc @@ -2348,9 +2255,8 @@ Function5688: ; 5688 ld [hl], a farcall UpdateTallGrassFlags ; no need to farcall ret -; 56a3 -Function56a3: ; 56a3 +Function56a3: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] @@ -2381,9 +2287,8 @@ Function56a3: ; 56a3 .nope scf ret -; 56cd -Function56cd: ; 56cd +Function56cd: ld a, [wPlayerBGMapOffsetX] ld d, a ld hl, OBJECT_SPRITE_X_OFFSET @@ -2444,7 +2349,7 @@ Function56cd: ; 56cd ld [hUsedSpriteTile], a ld hl, OBJECT_PALETTE add hl, bc - bit 7, [hl] + bit BIG_OBJECT_F, [hl] jr z, .ok7 ld a, d add 2 @@ -2491,9 +2396,8 @@ Function56cd: ; 56cd .nope scf ret -; 576a -HandleNPCStep:: ; 576a +HandleNPCStep:: call .ResetStepVector call .DoStepsForAllObjects ret @@ -2525,9 +2429,8 @@ HandleNPCStep:: ; 576a cp NUM_OBJECT_STRUCTS jr nz, .loop ret -; 579d -RefreshPlayerSprite: ; 579d +RefreshPlayerSprite: ld a, movement_step_sleep ld [wPlayerNextMovement], a ld [wPlayerMovement], a @@ -2539,9 +2442,8 @@ RefreshPlayerSprite: ; 579d call c, SpawnInFacingDown call .SpawnInCustomFacing ret -; 57bc -.TryResetPlayerAction: ; 57bc +.TryResetPlayerAction: ld hl, wPlayerSpriteSetupFlags bit PLAYERSPRITESETUP_RESET_ACTION_F, [hl] jr nz, .ok @@ -2551,9 +2453,8 @@ RefreshPlayerSprite: ; 579d ld a, OBJECT_ACTION_00 ld [wPlayerAction], a ret -; 57ca -.SpawnInCustomFacing: ; 57ca +.SpawnInCustomFacing: ld hl, wPlayerSpriteSetupFlags bit PLAYERSPRITESETUP_CUSTOM_FACING_F, [hl] ret z @@ -2562,19 +2463,17 @@ RefreshPlayerSprite: ; 579d add a add a jr ContinueSpawnFacing -; 57d9 -SpawnInFacingDown: ; 57d9 +SpawnInFacingDown: ld a, 0 -ContinueSpawnFacing: ; 57db +ContinueSpawnFacing: ld bc, wPlayerStruct call SetSpriteDirection ret -; 57e2 -_SetPlayerPalette: ; 57e2 +_SetPlayerPalette: ld a, d - and %10000000 + and 1 << 7 ret z ld bc, 0 ; debug? ld hl, OBJECT_FACING @@ -2584,19 +2483,18 @@ _SetPlayerPalette: ; 57e2 ld [hl], a ld a, d swap a - and %00000111 + and PALETTE_MASK ld d, a ld bc, wPlayerStruct ld hl, OBJECT_PALETTE add hl, bc ld a, [hl] - and %11111000 + and $ff ^ PALETTE_MASK or d ld [hl], a ret -; 5803 -StartFollow:: ; 5803 +StartFollow:: push bc ld a, b call SetLeaderIfVisible @@ -2606,29 +2504,25 @@ StartFollow:: ; 5803 call SetFollowerIfVisible farcall QueueFollowerFirstStep ret -; 5815 -SetLeaderIfVisible: ; 5815 +SetLeaderIfVisible: call CheckObjectVisibility ret c ld a, [hObjectStructIndexBuffer] ld [wObjectFollow_Leader], a ret -; 581f -StopFollow:: ; 581f +StopFollow:: call ResetLeader call ResetFollower ret -; 5826 -ResetLeader: ; 5826 +ResetLeader: ld a, -1 ld [wObjectFollow_Leader], a ret -; 582c -SetFollowerIfVisible: ; 582c +SetFollowerIfVisible: push af call ResetFollower pop af @@ -2643,9 +2537,8 @@ SetFollowerIfVisible: ; 582c ld a, [hObjectStructIndexBuffer] ld [wObjectFollow_Follower], a ret -; 5847 -ResetFollower: ; 5847 +ResetFollower: ld a, [wObjectFollow_Follower] cp -1 ret z @@ -2654,9 +2547,8 @@ ResetFollower: ; 5847 ld a, -1 ld [wObjectFollow_Follower], a ret -; 585c -SetFlagsForMovement_1:: ; 585c +SetFlagsForMovement_1:: ld a, c call CheckObjectVisibility ret c @@ -2668,9 +2560,8 @@ SetFlagsForMovement_1:: ; 585c res 5, [hl] xor a ret -; 586e -Function586e: ; 586e +Function586e: call CheckObjectVisibility ret c ld hl, OBJECT_FLAGS2 @@ -2678,9 +2569,8 @@ Function586e: ; 586e set 5, [hl] xor a ret -; 587a -Function587a: ; 587a +Function587a: ld bc, wObjectStructs xor a .loop @@ -2700,9 +2590,8 @@ Function587a: ; 587a cp NUM_OBJECT_STRUCTS jr nz, .loop ret -; 5897 -_SetFlagsForMovement_2:: ; 5897 +_SetFlagsForMovement_2:: ld a, [wObjectFollow_Leader] cp -1 ret z @@ -2722,9 +2611,8 @@ _SetFlagsForMovement_2:: ; 5897 add hl, bc res 5, [hl] ret -; 58b9 -Function58b9:: ; 58b9 +Function58b9:: push bc ld bc, wObjectStructs xor a @@ -2746,18 +2634,16 @@ Function58b9:: ; 58b9 jr nz, .loop pop bc ret -; 58d8 -Function58d8: ; 58d8 +Function58d8: call CheckObjectVisibility ret c ld hl, OBJECT_FLAGS2 add hl, bc res 5, [hl] ret -; 58e3 -Function58e3: ; 58e3 +Function58e3: ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] @@ -2776,9 +2662,8 @@ Function58e3: ; 58e3 add hl, bc ld [hl], STEP_TYPE_00 ret -; 5903 -Function5903: ; 5903 +Function5903: call GetSpriteDirection rrca rrca @@ -2800,9 +2685,8 @@ Function5903: ; 5903 db SPRITEMOVEDATA_STANDING_UP db SPRITEMOVEDATA_STANDING_LEFT db SPRITEMOVEDATA_STANDING_RIGHT -; 5920 -_UpdateSprites:: ; 5920 +_UpdateSprites:: ld a, [wVramState] bit 0, a ret z @@ -2839,9 +2723,8 @@ _UpdateSprites:: ; 5920 cp l jr nz, .loop ret -; 5958 -ApplyBGMapAnchorToObjects: ; 5958 +ApplyBGMapAnchorToObjects: push hl push de push bc @@ -2880,14 +2763,12 @@ ApplyBGMapAnchorToObjects: ; 5958 pop de pop hl ret -; 5991 - PRIORITY_LOW EQU $10 PRIORITY_NORM EQU $20 PRIORITY_HIGH EQU $30 -InitSprites: ; 5991 +InitSprites: call .DeterminePriorities ld c, PRIORITY_HIGH call .InitSpritesByPriority @@ -2918,10 +2799,10 @@ InitSprites: ; 5991 ld e, PRIORITY_LOW ld hl, OBJECT_FLAGS2 add hl, bc - bit LOW_PRIORITY, [hl] + bit LOW_PRIORITY_F, [hl] jr nz, .add ld e, PRIORITY_NORM - bit HIGH_PRIORITY, [hl] + bit HIGH_PRIORITY_F, [hl] jr z, .add ld e, PRIORITY_HIGH jr .add @@ -2973,35 +2854,35 @@ InitSprites: ; 5991 ld hl, OBJECT_SPRITE_TILE add hl, bc ld a, [hl] - and %01111111 + and $ff ^ (1 << 7) ld [hFFC1], a xor a bit 7, [hl] jr nz, .skip1 - or %00001000 + or VRAM_BANK_1 .skip1 ld hl, OBJECT_FLAGS2 add hl, bc ld e, [hl] bit 7, e jr z, .skip2 - or %10000000 + or PRIORITY .skip2 - bit 4, e + bit USE_OBP1_F, e jr z, .skip3 - or %00010000 + or OBP_NUM .skip3 ld hl, OBJECT_PALETTE add hl, bc ld d, a ld a, [hl] - and %00000111 + and PALETTE_MASK or d ld d, a xor a - bit 3, e + bit OVERHEAD_F, e jr z, .skip4 - or %10000000 + or PRIORITY .skip4 ld [hFFC2], a ld hl, OBJECT_SPRITE_X @@ -3063,7 +2944,7 @@ InitSprites: ; 5991 ld e, [hl] inc hl ld a, [hFFC1] - bit 2, e + bit ABSOLUTE_TILE_ID_F, e jr z, .nope1 xor a .nope1 @@ -3072,7 +2953,7 @@ InitSprites: ; 5991 ld [bc], a ; tile id inc c ld a, e - bit 1, a + bit RELATIVE_ATTRIBUTES_F, a jr z, .nope2 ld a, [hFFC2] or e @@ -3106,7 +2987,7 @@ InitSprites: ; 5991 ld b, [hl] ret -.Addresses: ; 5ace +.Addresses: dw wPlayerStruct dw wObject1Struct dw wObject2Struct @@ -3120,4 +3001,3 @@ InitSprites: ; 5991 dw wObject10Struct dw wObject11Struct dw wObject12Struct -; 5ae8 diff --git a/engine/overworld/map_objects_2.asm b/engine/overworld/map_objects_2.asm index 038e2b49b..f055e0fd9 100644 --- a/engine/overworld/map_objects_2.asm +++ b/engine/overworld/map_objects_2.asm @@ -1,4 +1,4 @@ -LoadObjectMasks: ; 2454f +LoadObjectMasks: ld hl, wObjectMasks xor a ld bc, NUM_OBJECTS @@ -29,7 +29,7 @@ LoadObjectMasks: ; 2454f jr nz, .loop ret -CheckObjectFlag: ; 2457d (9:457d) +CheckObjectFlag: ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] @@ -62,7 +62,7 @@ CheckObjectFlag: ; 2457d (9:457d) scf ret -GetObjectTimeMask: ; 245a7 (9:45a7) +GetObjectTimeMask: call CheckObjectTime ld a, -1 ret c diff --git a/engine/overworld/map_setup.asm b/engine/overworld/map_setup.asm index 268574de0..b09404240 100644 --- a/engine/overworld/map_setup.asm +++ b/engine/overworld/map_setup.asm @@ -1,4 +1,4 @@ -RunMapSetupScript:: ; 15363 +RunMapSetupScript:: ld a, [hMapEntryMethod] and $f dec a @@ -12,11 +12,10 @@ RunMapSetupScript:: ; 15363 ld l, a call ReadMapSetupScript ret -; 15377 INCLUDE "data/maps/setup_scripts.asm" -ReadMapSetupScript: ; 1541d +ReadMapSetupScript: .loop ld a, [hli] cp -1 @@ -58,9 +57,8 @@ ReadMapSetupScript: ; 1541d pop hl jr .loop -; 15440 -MapSetupCommands: ; 15440 +MapSetupCommands: ; entries correspond to command indexes in constants/map_setup_constants.asm dba EnableLCD ; 00 dba DisableLCD ; 01 @@ -108,51 +106,43 @@ MapSetupCommands: ; 15440 dba RetainOldPalettes ; 2b dba DontScrollText ; 2c dba ReturnFromMapSetupScript ; 2d -; 154ca - -DontScrollText: ; 154ca +DontScrollText: xor a ld [wDisableTextAcceleration], a ret -; 154cf -ActivateMapAnims: ; 154cf +ActivateMapAnims: ld a, $1 ld [hMapAnims], a ret -; 154d3 -SuspendMapAnims: ; 154d3 +SuspendMapAnims: xor a ld [hMapAnims], a ret -; 154d7 -LoadObjectsRunCallback_02: ; 154d7 +LoadObjectsRunCallback_02: ld a, MAPCALLBACK_OBJECTS call RunMapCallback farcall LoadObjectMasks farcall InitializeVisibleSprites ret -; 154ea (5:54ea) ; unused ret -; 154eb -DelayClearingOldSprites: ; 154eb +DelayClearingOldSprites: ld hl, wPlayerSpriteSetupFlags set PLAYERSPRITESETUP_RESET_ACTION_F, [hl] ret -; 154f1 -DelayLoadingNewSprites: ; 154f1 +DelayLoadingNewSprites: ld hl, wPlayerSpriteSetupFlags set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl] ret -CheckReplaceKrisSprite: ; 154f7 +CheckReplaceKrisSprite: nop call .CheckBiking jr c, .ok @@ -166,7 +156,7 @@ CheckReplaceKrisSprite: ; 154f7 call ReplaceKrisSprite ret -.CheckBiking: ; 1550c (5:550c) +.CheckBiking: and a ld hl, wBikeFlags bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl] @@ -176,7 +166,7 @@ CheckReplaceKrisSprite: ; 154f7 scf ret -.CheckSurfing2: ; 1551a (5:551a) +.CheckSurfing2: ld a, [wPlayerState] cp PLAYER_NORMAL jr z, .nope @@ -208,7 +198,7 @@ CheckReplaceKrisSprite: ; 154f7 and a ret -.CheckSurfing: ; 1554e (5:554e) +.CheckSurfing: call CheckOnWater jr nz, .ret_nc ld a, [wPlayerState] @@ -224,19 +214,17 @@ CheckReplaceKrisSprite: ; 154f7 .ret_nc and a ret -; 15567 -FadeOldMapMusic: ; 15567 +FadeOldMapMusic: ld a, 6 call SkipMusic ret -; 1556d -RetainOldPalettes: ; 1556d +RetainOldPalettes: farcall _UpdateTimePals ret -RotatePalettesRightMapAndMusic: ; 15574 +RotatePalettesRightMapAndMusic: ld e, 0 ld a, [wMusicFadeID] ld d, 0 @@ -245,9 +233,8 @@ RotatePalettesRightMapAndMusic: ; 15574 ld [wMusicFade], a call RotateThreePalettesRight ret -; 15587 -ForceMapMusic: ; 15587 +ForceMapMusic: ld a, [wPlayerState] cp PLAYER_BIKE jr nz, .notbiking @@ -257,4 +244,3 @@ ForceMapMusic: ; 15587 .notbiking call TryRestartMapMusic ret -; 1559a diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 3dbb0b83a..f7054c680 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -1,4 +1,4 @@ -MovementPointers: ; 5075 +MovementPointers: ; entries correspond to macros/scripts/movement.asm enumeration dw Movement_turn_head_down ; 00 dw Movement_turn_head_up ; 01 @@ -90,38 +90,32 @@ MovementPointers: ; 5075 dw Movement_rock_smash ; 57 dw Movement_return_dig ; 58 dw Movement_skyfall_top ; 59 -; 5129 - -Movement_teleport_from: ; 5129 +Movement_teleport_from: ld hl, OBJECT_STEP_TYPE add hl, bc ld [hl], STEP_TYPE_TELEPORT_FROM ret -; 5130 -Movement_teleport_to: ; 5130 +Movement_teleport_to: ld hl, OBJECT_STEP_TYPE add hl, bc ld [hl], STEP_TYPE_TELEPORT_TO ret -; 5137 -Movement_skyfall: ; 5137 +Movement_skyfall: ld hl, OBJECT_STEP_TYPE add hl, bc ld [hl], STEP_TYPE_SKYFALL ret -; 513e -Movement_skyfall_top: ; 513e +Movement_skyfall_top: ld hl, OBJECT_STEP_TYPE add hl, bc ld [hl], STEP_TYPE_SKYFALL_TOP ret -; 5145 -Movement_step_dig: ; 5145 +Movement_step_dig: call GetSpriteDirection rlca rlca @@ -142,9 +136,8 @@ Movement_step_dig: ; 5145 add hl, bc ld [hl], STANDING ret -; 516a -Movement_return_dig: ; 516a +Movement_return_dig: call GetSpriteDirection rlca rlca @@ -162,9 +155,8 @@ Movement_return_dig: ; 516a add hl, bc ld [hl], STEP_TYPE_RETURN_DIG ret -; 5189 -Movement_fish_got_bite: ; 5189 +Movement_fish_got_bite: ld hl, OBJECT_ACTION add hl, bc ld [hl], OBJECT_ACTION_FISHING @@ -172,9 +164,8 @@ Movement_fish_got_bite: ; 5189 add hl, bc ld [hl], STEP_TYPE_GOT_BITE ret -; 5196 -Movement_rock_smash: ; 5196 +Movement_rock_smash: call JumpMovementPointer ld hl, OBJECT_STEP_DURATION add hl, bc @@ -186,9 +177,8 @@ Movement_rock_smash: ; 5196 add hl, bc ld [hl], STEP_TYPE_ROCK_SMASH ret -; 51ab -Movement_fish_cast_rod: ; 51ab +Movement_fish_cast_rod: ld hl, OBJECT_ACTION add hl, bc ld [hl], OBJECT_ACTION_FISHING @@ -196,16 +186,14 @@ Movement_fish_cast_rod: ; 51ab add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 51b8 -Movement_step_loop: ; 51b8 +Movement_step_loop: ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld [hl], $0 jp ContinueReadingMovement -; 51c1 -Movement_step_end: ; 51c1 +Movement_step_end: call RestoreDefaultMovement ld hl, OBJECT_MOVEMENTTYPE add hl, bc @@ -222,9 +210,8 @@ Movement_step_end: ; 51c1 add hl, bc ld [hl], STEP_TYPE_SLEEP ret -; 51db -Movement_48: ; 51db +Movement_48: call RestoreDefaultMovement ld hl, OBJECT_MOVEMENTTYPE add hl, bc @@ -246,9 +233,8 @@ Movement_48: ; 51db ld hl, wVramState res 7, [hl] ret -; 51fd -Movement_remove_object: ; 51fd +Movement_remove_object: call DeleteMapObject ld hl, wObjectFollow_Leader ld a, [hMapObjectIndexBuffer] @@ -260,9 +246,8 @@ Movement_remove_object: ; 51fd ld hl, wVramState res 7, [hl] ret -; 5210 -Movement_4b: ; 5210 +Movement_4b: ld hl, OBJECT_ACTION add hl, bc ld [hl], OBJECT_ACTION_STAND @@ -274,48 +259,47 @@ Movement_4b: ; 5210 ld hl, wVramState res 7, [hl] ret -; 5222 -Movement_step_sleep_1: ; 5222 +Movement_step_sleep_1: ld a, 1 jr Movement_step_sleep_common -Movement_step_sleep_2: ; 5226 +Movement_step_sleep_2: ld a, 2 jr Movement_step_sleep_common -Movement_step_sleep_3: ; 522a +Movement_step_sleep_3: ld a, 3 jr Movement_step_sleep_common -Movement_step_sleep_4: ; 522e +Movement_step_sleep_4: ld a, 4 jr Movement_step_sleep_common -Movement_step_sleep_5: ; 5232 +Movement_step_sleep_5: ld a, 5 jr Movement_step_sleep_common -Movement_step_sleep_6: ; 5236 +Movement_step_sleep_6: ld a, 6 jr Movement_step_sleep_common -Movement_step_sleep_7: ; 523a +Movement_step_sleep_7: ld a, 7 jr Movement_step_sleep_common -Movement_step_sleep_8: ; 523e +Movement_step_sleep_8: ld a, 8 jr Movement_step_sleep_common -Movement_step_sleep: ; 5242 +Movement_step_sleep: ; parameters: ; duration (DecimalParam) call JumpMovementPointer jr Movement_step_sleep_common -Movement_step_sleep_common: ; 5247 +Movement_step_sleep_common: ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a @@ -332,9 +316,8 @@ Movement_step_sleep_common: ; 5247 add hl, bc ld [hl], STANDING ret -; 525f -Movement_step_bump: ; 525f +Movement_step_bump: ld a, 1 ld hl, OBJECT_STEP_DURATION add hl, bc @@ -352,9 +335,8 @@ Movement_step_bump: ; 525f add hl, bc ld [hl], STANDING ret -; 5279 -Movement_tree_shake: ; 5279 +Movement_tree_shake: ld a, 24 ld hl, OBJECT_STEP_DURATION add hl, bc @@ -372,86 +354,76 @@ Movement_tree_shake: ; 5279 add hl, bc ld [hl], STANDING ret -; 5293 -Movement_remove_sliding: ; 5293 +Movement_remove_sliding: ld hl, OBJECT_FLAGS1 add hl, bc - res SLIDING, [hl] + res SLIDING_F, [hl] jp ContinueReadingMovement -; 529c -Movement_set_sliding: ; 529c +Movement_set_sliding: ld hl, OBJECT_FLAGS1 add hl, bc - set SLIDING, [hl] + set SLIDING_F, [hl] jp ContinueReadingMovement -; 52a5 -Movement_remove_fixed_facing: ; 52a5 +Movement_remove_fixed_facing: ld hl, OBJECT_FLAGS1 add hl, bc - res FIXED_FACING, [hl] + res FIXED_FACING_F, [hl] jp ContinueReadingMovement -; 52ae -Movement_fix_facing: ; 52ae +Movement_fix_facing: ld hl, OBJECT_FLAGS1 add hl, bc - set FIXED_FACING, [hl] + set FIXED_FACING_F, [hl] jp ContinueReadingMovement -; 52b7 -Movement_show_object: ; 52b7 +Movement_show_object: ld hl, OBJECT_FLAGS1 add hl, bc - res INVISIBLE, [hl] + res INVISIBLE_F, [hl] jp ContinueReadingMovement -; 52c0 -Movement_hide_object: ; 52c0 +Movement_hide_object: ld hl, OBJECT_FLAGS1 add hl, bc - set INVISIBLE, [hl] + set INVISIBLE_F, [hl] jp ContinueReadingMovement -; 52c9 -Movement_hide_emote: ; 52c9 +Movement_hide_emote: call DespawnEmote jp ContinueReadingMovement -; 52cf -Movement_show_emote: ; 52cf +Movement_show_emote: call SpawnEmote jp ContinueReadingMovement -; 52d5 -Movement_step_shake: ; 52d5 +Movement_step_shake: ; parameters: ; displacement (DecimalParam) call JumpMovementPointer call ShakeScreen jp ContinueReadingMovement -; 52de -Movement_turn_head_down: ; 52de +Movement_turn_head_down: ld a, OW_DOWN jr TurnHead -Movement_turn_head_up: ; 52e2 +Movement_turn_head_up: ld a, OW_UP jr TurnHead -Movement_turn_head_left: ; 52e6 +Movement_turn_head_left: ld a, OW_LEFT jr TurnHead -Movement_turn_head_right: ; 52ea +Movement_turn_head_right: ld a, OW_RIGHT jr TurnHead -TurnHead: ; 52ee +TurnHead: ld hl, OBJECT_FACING add hl, bc ld [hl], a @@ -464,269 +436,216 @@ TurnHead: ; 52ee add hl, bc ld [hl], STANDING ret -; 5300 -Movement_slow_step_down: ; 5300 +Movement_slow_step_down: ld a, STEP_SLOW << 2 | DOWN jp NormalStep -; 5305 -Movement_slow_step_up: ; 5305 +Movement_slow_step_up: ld a, STEP_SLOW << 2 | UP jp NormalStep -; 530a -Movement_slow_step_left: ; 530a +Movement_slow_step_left: ld a, STEP_SLOW << 2 | LEFT jp NormalStep -; 530f -Movement_slow_step_right: ; 530f +Movement_slow_step_right: ld a, STEP_SLOW << 2 | RIGHT jp NormalStep -; 5314 -Movement_step_down: ; 5314 +Movement_step_down: ld a, STEP_WALK << 2 | DOWN jp NormalStep -; 5319 -Movement_step_up: ; 5319 +Movement_step_up: ld a, STEP_WALK << 2 | UP jp NormalStep -; 531e -Movement_step_left: ; 531e +Movement_step_left: ld a, STEP_WALK << 2 | LEFT jp NormalStep -; 5323 -Movement_step_right: ; 5323 +Movement_step_right: ld a, STEP_WALK << 2 | RIGHT jp NormalStep -; 5328 -Movement_big_step_down: ; 5328 +Movement_big_step_down: ld a, STEP_BIKE << 2 | DOWN jp NormalStep -; 532d -Movement_big_step_up: ; 532d +Movement_big_step_up: ld a, STEP_BIKE << 2 | UP jp NormalStep -; 5332 -Movement_big_step_left: ; 5332 +Movement_big_step_left: ld a, STEP_BIKE << 2 | LEFT jp NormalStep -; 5337 -Movement_big_step_right: ; 5337 +Movement_big_step_right: ld a, STEP_BIKE << 2 | RIGHT jp NormalStep -; 533c - -Movement_turn_away_down: ; 533c +Movement_turn_away_down: ld a, STEP_SLOW << 2 | DOWN jp TurningStep -; 5341 -Movement_turn_away_up: ; 5341 +Movement_turn_away_up: ld a, STEP_SLOW << 2 | UP jp TurningStep -; 5346 -Movement_turn_away_left: ; 5346 +Movement_turn_away_left: ld a, STEP_SLOW << 2 | LEFT jp TurningStep -; 534b -Movement_turn_away_right: ; 534b +Movement_turn_away_right: ld a, STEP_SLOW << 2 | RIGHT jp TurningStep -; 5350 -Movement_turn_in_down: ; 5350 +Movement_turn_in_down: ld a, STEP_WALK << 2 | DOWN jp TurningStep -; 5355 -Movement_turn_in_up: ; 5355 +Movement_turn_in_up: ld a, STEP_WALK << 2 | UP jp TurningStep -; 535a -Movement_turn_in_left: ; 535a +Movement_turn_in_left: ld a, STEP_WALK << 2 | LEFT jp TurningStep -; 535f -Movement_turn_in_right: ; 535f +Movement_turn_in_right: ld a, STEP_WALK << 2 | RIGHT jp TurningStep -; 5364 -Movement_turn_waterfall_down: ; 5364 +Movement_turn_waterfall_down: ld a, STEP_BIKE << 2 | DOWN jp TurningStep -; 5369 -Movement_turn_waterfall_up: ; 5369 +Movement_turn_waterfall_up: ld a, STEP_BIKE << 2 | UP jp TurningStep -; 536e -Movement_turn_waterfall_left: ; 536e +Movement_turn_waterfall_left: ld a, STEP_BIKE << 2 | LEFT jp TurningStep -; 5373 -Movement_turn_waterfall_right: ; 5373 +Movement_turn_waterfall_right: ld a, STEP_BIKE << 2 | RIGHT jp TurningStep -; 5378 - -Movement_slow_slide_step_down: ; 5378 +Movement_slow_slide_step_down: ld a, STEP_SLOW << 2 | DOWN jp SlideStep -; 537d -Movement_slow_slide_step_up: ; 537d +Movement_slow_slide_step_up: ld a, STEP_SLOW << 2 | UP jp SlideStep -; 5382 -Movement_slow_slide_step_left: ; 5382 +Movement_slow_slide_step_left: ld a, STEP_SLOW << 2 | LEFT jp SlideStep -; 5387 -Movement_slow_slide_step_right: ; 5387 +Movement_slow_slide_step_right: ld a, STEP_SLOW << 2 | RIGHT jp SlideStep -; 538c -Movement_slide_step_down: ; 538c +Movement_slide_step_down: ld a, STEP_WALK << 2 | DOWN jp SlideStep -; 5391 -Movement_slide_step_up: ; 5391 +Movement_slide_step_up: ld a, STEP_WALK << 2 | UP jp SlideStep -; 5396 -Movement_slide_step_left: ; 5396 +Movement_slide_step_left: ld a, STEP_WALK << 2 | LEFT jp SlideStep -; 539b -Movement_slide_step_right: ; 539b +Movement_slide_step_right: ld a, STEP_WALK << 2 | RIGHT jp SlideStep -; 53a0 -Movement_fast_slide_step_down: ; 53a0 +Movement_fast_slide_step_down: ld a, STEP_BIKE << 2 | DOWN jp SlideStep -; 53a5 -Movement_fast_slide_step_up: ; 53a5 +Movement_fast_slide_step_up: ld a, STEP_BIKE << 2 | UP jp SlideStep -; 53aa -Movement_fast_slide_step_left: ; 53aa +Movement_fast_slide_step_left: ld a, STEP_BIKE << 2 | LEFT jp SlideStep -; 53af -Movement_fast_slide_step_right: ; 53af +Movement_fast_slide_step_right: ld a, STEP_BIKE << 2 | RIGHT jp SlideStep -; 53b4 - -Movement_slow_jump_step_down: ; 53b4 +Movement_slow_jump_step_down: ld a, STEP_SLOW << 2 | DOWN jp JumpStep -; 53b9 -Movement_slow_jump_step_up: ; 53b9 +Movement_slow_jump_step_up: ld a, STEP_SLOW << 2 | UP jp JumpStep -; 53be -Movement_slow_jump_step_left: ; 53be +Movement_slow_jump_step_left: ld a, STEP_SLOW << 2 | LEFT jp JumpStep -; 53c3 -Movement_slow_jump_step_right: ; 53c3 +Movement_slow_jump_step_right: ld a, STEP_SLOW << 2 | RIGHT jp JumpStep -; 53c8 -Movement_jump_step_down: ; 53c8 +Movement_jump_step_down: ld a, STEP_WALK << 2 | DOWN jp JumpStep -; 53cd -Movement_jump_step_up: ; 53cd +Movement_jump_step_up: ld a, STEP_WALK << 2 | UP jp JumpStep -; 53d2 -Movement_jump_step_left: ; 53d2 +Movement_jump_step_left: ld a, STEP_WALK << 2 | LEFT jp JumpStep -; 53d7 -Movement_jump_step_right: ; 53d7 +Movement_jump_step_right: ld a, STEP_WALK << 2 | RIGHT jp JumpStep -; 53dc -Movement_fast_jump_step_down: ; 53dc +Movement_fast_jump_step_down: ld a, STEP_BIKE << 2 | DOWN jp JumpStep -; 53e1 -Movement_fast_jump_step_up: ; 53e1 +Movement_fast_jump_step_up: ld a, STEP_BIKE << 2 | UP jp JumpStep -; 53e6 -Movement_fast_jump_step_left: ; 53e6 +Movement_fast_jump_step_left: ld a, STEP_BIKE << 2 | LEFT jp JumpStep -; 53eb -Movement_fast_jump_step_right: ; 53eb +Movement_fast_jump_step_right: ld a, STEP_BIKE << 2 | RIGHT jp JumpStep -; 53f0 - -Movement_turn_step_down: ; 53f0 +Movement_turn_step_down: ld a, OW_DOWN jr TurnStep -Movement_turn_step_up: ; 53f4 +Movement_turn_step_up: ld a, OW_UP jr TurnStep -Movement_turn_step_left: ; 53f8 +Movement_turn_step_left: ld a, OW_LEFT jr TurnStep -Movement_turn_step_right: ; 53fc +Movement_turn_step_right: ld a, OW_RIGHT jr TurnStep -TurnStep: ; 5400 +TurnStep: ld hl, OBJECT_1D ; new facing add hl, bc ld [hl], a @@ -739,9 +658,8 @@ TurnStep: ; 5400 add hl, bc ld [hl], STEP_TYPE_HALF_STEP ret -; 5412 -NormalStep: ; 5412 +NormalStep: call InitStep call UpdateTallGrassFlags ld hl, OBJECT_ACTION @@ -776,9 +694,8 @@ NormalStep: ; 5412 add hl, bc ld [hl], STEP_TYPE_PLAYER_WALK ret -; 5446 -TurningStep: ; 5446 +TurningStep: call InitStep call UpdateTallGrassFlags @@ -801,10 +718,8 @@ TurningStep: ; 5446 add hl, bc ld [hl], STEP_TYPE_PLAYER_WALK ret -; 5468 - -SlideStep: ; 5468 +SlideStep: call InitStep call UpdateTallGrassFlags @@ -827,10 +742,8 @@ SlideStep: ; 5468 add hl, bc ld [hl], STEP_TYPE_PLAYER_WALK ret -; 548a - -JumpStep: ; 548a +JumpStep: call InitStep ld hl, OBJECT_1F add hl, bc @@ -838,7 +751,7 @@ JumpStep: ; 548a ld hl, OBJECT_FLAGS2 add hl, bc - res OVERHEAD, [hl] + res OVERHEAD_F, [hl] ld hl, OBJECT_ACTION add hl, bc @@ -861,4 +774,3 @@ JumpStep: ; 548a add hl, bc ld [hl], STEP_TYPE_PLAYER_JUMP ret -; 54b8 diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 5670935e8..b4b5ef467 100644 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -1,37 +1,37 @@ -Function6ec1: ; 6ec1 - +CanObjectMoveInDirection: ld hl, OBJECT_PALETTE add hl, bc - bit 5, [hl] - jr z, .not_bit_5 + bit SWIMMING_F, [hl] + jr z, .not_swimming ld hl, OBJECT_FLAGS1 add hl, bc - bit 4, [hl] ; lost, uncomment next line to fix -; jr nz, .resume + bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix + ; jr nz, .noclip_tiles push hl push bc - call Function6f2c + call WillObjectBumpIntoLand pop bc pop hl ret c - jr .resume + jr .continue -.not_bit_5 +.not_swimming ld hl, OBJECT_FLAGS1 add hl, bc - bit 4, [hl] - jr nz, .resume + bit NOCLIP_TILES_F, [hl] + jr nz, .noclip_tiles push hl push bc - call Function6f07 + call WillObjectBumpIntoWater pop bc pop hl ret c -.resume - bit 6, [hl] - jr nz, .bit_6 +.noclip_tiles +.continue + bit NOCLIP_OBJS_F, [hl] + jr nz, .noclip_objs push hl push bc @@ -40,9 +40,9 @@ Function6ec1: ; 6ec1 pop hl ret c -.bit_6 - bit 5, [hl] - jr nz, .bit_5 +.noclip_objs + bit MOVE_ANYWHERE_F, [hl] + jr nz, .move_anywhere push hl call HasObjectReachedMovementLimit pop hl @@ -53,13 +53,11 @@ Function6ec1: ; 6ec1 pop hl ret c -.bit_5 +.move_anywhere and a ret -; 6f07 - -Function6f07: ; 6f07 +WillObjectBumpIntoWater: call Function6f5f ret c ld hl, OBJECT_NEXT_MAP_X @@ -78,12 +76,11 @@ Function6f07: ; 6f07 ld d, a call GetTileCollision and a ; LANDTILE - jr z, Function6f3e + jr z, WillObjectBumpIntoTile scf ret -; 6f2c -Function6f2c: ; 6f2c +WillObjectBumpIntoLand: call Function6f5f ret c ld hl, OBJECT_NEXT_TILE @@ -91,12 +88,11 @@ Function6f2c: ; 6f2c ld a, [hl] call GetTileCollision cp WATERTILE - jr z, Function6f3e + jr z, WillObjectBumpIntoTile scf ret -; 6f3e -Function6f3e: ; 6f3e +WillObjectBumpIntoTile: ld hl, OBJECT_NEXT_TILE add hl, bc ld a, [hl] @@ -116,13 +112,11 @@ Function6f3e: ; 6f3e ret z scf ret -; 6f5b .data_6f5b db DOWN_MASK, UP_MASK, RIGHT_MASK, LEFT_MASK -; 6f5f -Function6f5f: ; 6f5f +Function6f5f: ld hl, OBJECT_STANDING_TILE add hl, bc ld a, [hl] @@ -141,18 +135,16 @@ Function6f5f: ; 6f5f ret z scf ret -; 6f7b .data_6f7b db UP_MASK, DOWN_MASK, LEFT_MASK, RIGHT_MASK -; 6f7f -Function6f7f: ; 6f7f +Function6f7f: ld d, a and $f0 - cp $b0 + cp HI_NYBBLE_SIDE_WALLS jr z, .done - cp $c0 + cp HI_NYBBLE_UNUSED_C0 jr z, .done xor a ret @@ -167,14 +159,12 @@ Function6f7f: ; 6f7f ld a, [hl] scf ret -; 6f99 .data_6f99 db 8, 4, 1, 2 db 10, 6, 9, 5 -; 6fa1 -Function6fa1: ; 6fa1 +Function6fa1: ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] @@ -223,12 +213,8 @@ Function6fa1: ; 6fa1 .not_land scf ret -; 6fd9 - - - -CheckFacingObject:: ; 6fd9 +CheckFacingObject:: call GetFacingTileCoord ; Double the distance for counter tiles. @@ -266,10 +252,8 @@ CheckFacingObject:: ; 6fd9 .standing scf ret -; 7009 - -WillObjectBumpIntoSomeoneElse: ; 7009 +WillObjectBumpIntoSomeoneElse: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] @@ -277,7 +261,6 @@ WillObjectBumpIntoSomeoneElse: ; 7009 add hl, bc ld e, [hl] jr IsNPCAtCoord -; 7015 Unreferenced_Function7015: ld a, [hMapObjectIndexBuffer] @@ -286,7 +269,7 @@ Unreferenced_Function7015: call IsNPCAtCoord ret -.CheckWillBeFacingNPC: ; 7021 +.CheckWillBeFacingNPC: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] @@ -314,9 +297,8 @@ Unreferenced_Function7015: .left dec d ret -; 7041 -IsNPCAtCoord: ; 7041 +IsNPCAtCoord: ld bc, wObjectStructs xor a .loop @@ -331,7 +313,7 @@ IsNPCAtCoord: ; 7041 ld hl, OBJECT_PALETTE add hl, bc - bit 7, [hl] + bit BIG_OBJECT_F, [hl] jr z, .got call Function7171 @@ -389,9 +371,8 @@ IsNPCAtCoord: ; 7041 .setcarry scf ret -; 70a4 -HasObjectReachedMovementLimit: ; 70a4 +HasObjectReachedMovementLimit: ld hl, OBJECT_RADIUS add hl, bc ld a, [hl] @@ -449,9 +430,8 @@ HasObjectReachedMovementLimit: ; 70a4 .yes scf ret -; 70ed -IsObjectMovingOffEdgeOfScreen: ; 70ed +IsObjectMovingOffEdgeOfScreen: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [wXCoord] @@ -480,7 +460,6 @@ IsObjectMovingOffEdgeOfScreen: ; 70ed .yes scf ret -; 7113 Unreferenced_Function7113: ld a, [wPlayerStandingMapX] @@ -546,10 +525,8 @@ Unreferenced_Function7113: .yes scf ret -; 7171 - -Function7171: ; 7171 +Function7171: ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, d @@ -570,4 +547,3 @@ Function7171: ; 7171 .nope and a ret -; 718d diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm index 381c2d89f..f3dcb5b96 100644 --- a/engine/overworld/overworld.asm +++ b/engine/overworld/overworld.asm @@ -1,13 +1,12 @@ -GetEmote2bpp: ; 1412a +GetEmote2bpp: ld a, $1 ld [rVBK], a call Get2bpp xor a ld [rVBK], a ret -; 14135 -_ReplaceKrisSprite:: ; 14135 +_ReplaceKrisSprite:: call GetPlayerSprite ld a, [wUsedSprites] ld [hUsedSpriteIndex], a @@ -15,7 +14,6 @@ _ReplaceKrisSprite:: ; 14135 ld [hUsedSpriteTile], a call GetUsedSprite ret -; 14146 Function14146: ; mobile ld hl, wSpriteFlags @@ -27,7 +25,6 @@ Function14146: ; mobile pop af ld [wSpriteFlags], a ret -; 14157 Function14157: ; mobile ld hl, wSpriteFlags @@ -39,15 +36,13 @@ Function14157: ; mobile pop af ld [wSpriteFlags], a ret -; 14168 -RefreshSprites:: ; 14168 +RefreshSprites:: call .Refresh call LoadUsedSpritesGFX ret -; 1416f -.Refresh: ; 1416f +.Refresh: xor a ld bc, wUsedSpritesEnd - wUsedSprites ld hl, wUsedSprites @@ -56,9 +51,8 @@ RefreshSprites:: ; 14168 call AddMapSprites call LoadAndSortSprites ret -; 14183 -GetPlayerSprite: ; 14183 +GetPlayerSprite: ; Get Chris or Kris's sprite. ld hl, ChrisStateSprites ld a, [wPlayerSpriteSetupFlags] @@ -97,8 +91,7 @@ GetPlayerSprite: ; 14183 INCLUDE "data/sprites/player_sprites.asm" - -AddMapSprites: ; 141c9 +AddMapSprites: call GetMapEnvironment call CheckOutdoorMap jr z, .outdoor @@ -108,10 +101,8 @@ AddMapSprites: ; 141c9 .outdoor call AddOutdoorSprites ret -; 141d9 - -AddIndoorSprites: ; 141d9 +AddIndoorSprites: ld hl, wMap1ObjectSprite ld a, 1 .loop @@ -125,10 +116,8 @@ AddIndoorSprites: ; 141d9 cp NUM_OBJECTS jr nz, .loop ret -; 141ee - -AddOutdoorSprites: ; 141ee +AddOutdoorSprites: ld a, [wMapGroup] dec a ld c, a @@ -148,18 +137,15 @@ AddOutdoorSprites: ; 141ee dec c jr nz, .loop ret -; 14209 - -LoadUsedSpritesGFX: ; 14209 +LoadUsedSpritesGFX: ld a, MAPCALLBACK_SPRITES call RunMapCallback call GetUsedSprites call .LoadMiscTiles ret -; 14215 -.LoadMiscTiles: ; 14215 +.LoadMiscTiles: ld a, [wSpriteFlags] bit 6, a ret nz @@ -174,18 +160,14 @@ LoadUsedSpritesGFX: ; 14209 .outdoor farcall LoadEmote ret -; 14236 - - -SafeGetSprite: ; 14236 +SafeGetSprite: push hl call GetSprite pop hl ret -; 1423c -GetSprite: ; 1423c +GetSprite: call GetMonSprite ret c @@ -211,10 +193,8 @@ GetSprite: ; 1423c ld l, [hl] ld h, a ret -; 14259 - -GetMonSprite: ; 14259 +GetMonSprite: ; Return carry if a monster sprite was loaded. cp SPRITE_POKEMON @@ -275,10 +255,8 @@ GetMonSprite: ; 14259 ld h, 0 and a ret -; 142a7 - -_DoesSpriteHaveFacings:: ; 142a7 +_DoesSpriteHaveFacings:: ; Checks to see whether we can apply a facing to a sprite. ; Returns carry unless the sprite is a Pokemon or a Still Sprite. cp SPRITE_POKEMON @@ -303,10 +281,8 @@ _DoesSpriteHaveFacings:: ; 142a7 .only_down and a ret -; 142c4 - -_GetSpritePalette:: ; 142c4 +_GetSpritePalette:: ld a, c call GetMonSprite jr c, .is_pokemon @@ -324,18 +300,14 @@ _GetSpritePalette:: ; 142c4 xor a ld c, a ret -; 142db - -LoadAndSortSprites: ; 142db +LoadAndSortSprites: call LoadSpriteGFX call SortUsedSprites call ArrangeUsedSprites ret -; 142e5 - -AddSpriteGFX: ; 142e5 +AddSpriteGFX: ; Add any new sprite ids to a list of graphics to be loaded. ; Return carry if the list is full. @@ -372,10 +344,8 @@ AddSpriteGFX: ; 142e5 pop hl and a ret -; 14306 - -LoadSpriteGFX: ; 14306 +LoadSpriteGFX: ; Bug: b is not preserved, so it's useless as a next count. ; Uncomment the lines below to fix. @@ -401,10 +371,8 @@ LoadSpriteGFX: ; 14306 ; pop bc ld a, l ret -; 1431e - -SortUsedSprites: ; 1431e +SortUsedSprites: ; Bubble-sort sprites by type. ; Run backwards through wUsedSprites to find the last one. @@ -473,10 +441,8 @@ SortUsedSprites: ; 1431e .quit ret -; 14355 - -ArrangeUsedSprites: ; 14355 +ArrangeUsedSprites: ; Get the length of each sprite and space them out in VRAM. ; Crystal introduces a second table in VRAM bank 0. @@ -533,10 +499,8 @@ ArrangeUsedSprites: ; 14355 .quit ret -; 14386 - -GetSpriteLength: ; 14386 +GetSpriteLength: ; Return the length of sprite type a in tiles. cp WALKING_SPRITE @@ -556,10 +520,8 @@ GetSpriteLength: ; 14386 .OneDirection: ld a, 4 ret -; 1439b - -GetUsedSprites: ; 1439b +GetUsedSprites: ld hl, wUsedSprites ld c, SPRITE_GFX_LIST_CAPACITY @@ -594,9 +556,8 @@ GetUsedSprites: ; 1439b .done ret -; 143c8 -GetUsedSprite: ; 143c8 +GetUsedSprite: ld a, [hUsedSpriteIndex] call SafeGetSprite ld a, [hUsedSpriteTile] @@ -639,9 +600,8 @@ endr .done ret -; 14406 -.GetTileAddr: ; 14406 +.GetTileAddr: ; Return the address of tile (a) in (hl). and $7f ld l, a @@ -656,9 +616,8 @@ endr adc HIGH(vTiles0) ld h, a ret -; 14418 -.CopyToVram: ; 14418 +.CopyToVram: ld a, [rVBK] push af ld a, [wSpriteFlags] @@ -673,9 +632,8 @@ endr pop af ld [rVBK], a ret -; 1442f -LoadEmote:: ; 1442f +LoadEmote:: ; Get the address of the pointer to emote c. ld a, c ld bc, 6 ; sizeof(emote) @@ -703,8 +661,6 @@ LoadEmote:: ; 1442f ret z call GetEmote2bpp ret -; 1444d - INCLUDE "data/sprites/emotes.asm" diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index ef9afc7ad..a4926e7e5 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -1,4 +1,4 @@ -DoPlayerMovement:: ; 80000 +DoPlayerMovement:: call .GetDPad ld a, movement_step_sleep @@ -30,7 +30,6 @@ DoPlayerMovement:: ; 80000 or D_DOWN ld [wCurInput], a ret -; 8002d .TranslateIntoMovement: ld a, [wPlayerState] @@ -112,9 +111,8 @@ DoPlayerMovement:: ; 80000 call .StandInPlace xor a ret -; 800b7 -.CheckTile: ; 800b7 +.CheckTile: ; Tiles such as waterfalls and warps move the player ; in a given direction, overriding input. @@ -227,9 +225,8 @@ DoPlayerMovement:: ; 80000 ld a, 5 scf ret -; 80147 -.CheckTurning: ; 80147 +.CheckTurning: ; If the player is turning, change direction first. This also lets ; the player change facing without moving by tapping a direction. @@ -257,10 +254,8 @@ DoPlayerMovement:: ; 80000 .not_turning xor a ret -; 8016b - -.TryStep: ; 8016b +.TryStep: ; Surfing actually calls .TrySurf directly instead of passing through here. ld a, [wPlayerState] cp PLAYER_SURF @@ -323,10 +318,8 @@ DoPlayerMovement:: ; 80000 .bump xor a ret -; 801c0 - -.TrySurf: ; 801c0 +.TrySurf: call .CheckSurfPerms ld [wd040], a jr c, .surf_bump @@ -359,9 +352,8 @@ DoPlayerMovement:: ; 80000 .surf_bump xor a ret -; 801f3 -.TryJump: ; 801f3 +.TryJump: ld a, [wPlayerStandingTile] ld e, a and $f0 @@ -399,10 +391,8 @@ DoPlayerMovement:: ; 80000 db FACE_DOWN | FACE_LEFT ; COLL_HOP_DOWN_LEFT db FACE_UP | FACE_RIGHT ; COLL_HOP_UP_RIGHT db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT -; 80226 - -.CheckWarp: ; 80226 +.CheckWarp: ; Bug: Since no case is made for STANDING here, it will check ; [.edgewarps + $ff]. This resolves to $3e at $8035a. ; This causes wd041 to be nonzero when standing on tile $3e, @@ -450,7 +440,6 @@ DoPlayerMovement:: ; 80000 db COLL_WARP_CARPET_UP db COLL_WARP_CARPET_LEFT db COLL_WARP_CARPET_RIGHT -; 8025f .DoStep: ld e, a @@ -529,27 +518,24 @@ DoPlayerMovement:: ; 80000 db $80 + UP db $80 + LEFT db $80 + RIGHT -; 802b3 -.StandInPlace: ; 802b3 +.StandInPlace: ld a, 0 ld [wPlayerTurningDirection], a ld a, movement_step_sleep ld [wMovementAnimation], a xor a ret -; 802bf -._WalkInPlace: ; 802bf +._WalkInPlace: ld a, 0 ld [wPlayerTurningDirection], a ld a, movement_step_bump ld [wMovementAnimation], a xor a ret -; 802cb -.CheckForced: ; 802cb +.CheckForced: ; When sliding on ice, input is forced to remain in the same direction. call CheckStandingOnIce @@ -572,13 +558,12 @@ DoPlayerMovement:: ; 80000 .forced_dpad db D_DOWN, D_UP, D_LEFT, D_RIGHT -; 802ec -.GetAction: ; 802ec +.GetAction: ; Poll player input and update movement info. - ld hl, .table - ld de, .table2 - .table1 + ld hl, .action_table + ld de, .action_table_1_end - .action_table_1 ld a, [wCurInput] bit D_DOWN_F, a jr nz, .d_down @@ -612,28 +597,22 @@ DoPlayerMovement:: ; 80000 ld [wWalkingTile], a ret -.table -; struct: -; walk direction -; facing -; x movement -; y movement -; tile collision pointer -.table1 - db STANDING, FACE_CURRENT, 0, 0 - dw wPlayerStandingTile -.table2 - db RIGHT, FACE_RIGHT, 1, 0 - dw wTileRight - db LEFT, FACE_LEFT, -1, 0 - dw wTileLeft - db UP, FACE_UP, 0, -1 - dw wTileUp - db DOWN, FACE_DOWN, 0, 1 - dw wTileDown -; 80341 - -.CheckNPC: ; 80341 +player_action: MACRO +; walk direction, facing, x movement, y movement, tile collision pointer + db \1, \2, \3, \4 + dw \5 +ENDM + +.action_table: +.action_table_1 + player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile +.action_table_1_end + player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight + player_action LEFT, FACE_LEFT, -1, 0, wTileLeft + player_action UP, FACE_UP, 0, -1, wTileUp + player_action DOWN, FACE_DOWN, 0, 1, wTileDown + +.CheckNPC: ; Returns 0 if there is an NPC in front that you can't move ; Returns 1 if there is no NPC in front ; Returns 2 if there is a movable NPC in front @@ -668,10 +647,8 @@ DoPlayerMovement:: ; 80000 .no_bump ld a, 2 ret -; 8036f - -.CheckStrengthBoulder: ; 8036f +.CheckStrengthBoulder: ld hl, wBikeFlags bit BIKEFLAGS_STRENGTH_ACTIVE_F, [hl] jr z, .not_boulder @@ -684,7 +661,7 @@ DoPlayerMovement:: ; 80000 ld hl, OBJECT_PALETTE add hl, bc - bit 6, [hl] + bit STRENGTH_BOULDER_F, [hl] jr z, .not_boulder ld hl, OBJECT_FLAGS2 @@ -696,7 +673,7 @@ DoPlayerMovement:: ; 80000 ld hl, OBJECT_RANGE add hl, bc ld a, [hl] - and $fc + and %11111100 or d ld [hl], a @@ -706,9 +683,8 @@ DoPlayerMovement:: ; 80000 .not_boulder xor a ret -; 8039e -.CheckLandPerms: ; 8039e +.CheckLandPerms: ; Return 0 if walking onto land and tile permissions allow it. ; Otherwise, return carry. @@ -728,9 +704,8 @@ DoPlayerMovement:: ; 80000 .NotWalkable: scf ret -; 803b4 -.CheckSurfPerms: ; 803b4 +.CheckSurfPerms: ; Return 0 if moving in water, or 1 if moving onto land. ; Otherwise, return carry. @@ -750,17 +725,15 @@ DoPlayerMovement:: ; 80000 .NotSurfable: scf ret -; 803ca -.BikeCheck: ; 803ca +.BikeCheck: ld a, [wPlayerState] cp PLAYER_BIKE ret z cp PLAYER_SKATE ret -; 803d3 -.CheckWalkable: ; 803d3 +.CheckWalkable: ; Return 0 if tile a is land. Otherwise, return carry. call GetTileCollision @@ -768,9 +741,8 @@ DoPlayerMovement:: ; 80000 ret z scf ret -; 803da -.CheckSurfable: ; 803da +.CheckSurfable: ; Return 0 if tile a is water, or 1 if land. ; Otherwise, return carry. @@ -796,27 +768,23 @@ DoPlayerMovement:: ; 80000 .Neither: scf ret -; 803ee - -.BumpSound: ; 803ee +.BumpSound: call CheckSFX ret c ld de, SFX_BUMP call PlaySFX ret -; 803f9 -.GetOutOfWater: ; 803f9 +.GetOutOfWater: push bc ld a, PLAYER_NORMAL ld [wPlayerState], a call ReplaceKrisSprite ; UpdateSprites pop bc ret -; 80404 -CheckStandingOnIce:: ; 80404 +CheckStandingOnIce:: ld a, [wPlayerTurningDirection] cp 0 jr z, .not_ice @@ -836,9 +804,8 @@ CheckStandingOnIce:: ; 80404 .not_ice and a ret -; 80422 -StopPlayerForEvent:: ; 80422 +StopPlayerForEvent:: ld hl, wPlayerNextMovement ld a, movement_step_sleep cp [hl] @@ -848,4 +815,3 @@ StopPlayerForEvent:: ; 80422 ld a, 0 ld [wPlayerTurningDirection], a ret -; 80430 diff --git a/engine/overworld/player_object.asm b/engine/overworld/player_object.asm index 7d287dedb..08a990f4b 100644 --- a/engine/overworld/player_object.asm +++ b/engine/overworld/player_object.asm @@ -1,4 +1,4 @@ -BlankScreen: ; 8000 +BlankScreen: call DisableSpriteUpdates xor a ld [hBGMapMode], a @@ -16,7 +16,7 @@ BlankScreen: ; 8000 call SetPalettes ret -SpawnPlayer: ; 8029 +SpawnPlayer: ld a, -1 ld [wObjectFollow_Leader], a ld [wObjectFollow_Follower], a @@ -51,13 +51,13 @@ SpawnPlayer: ; 8029 ld [wCenteredObject], a ret -PlayerObjectTemplate: ; 8071 +PlayerObjectTemplate: ; A dummy map object used to initialize the player object. ; Shorter than the actual amount copied by two bytes. ; Said bytes seem to be unused. object_event -4, -4, SPRITE_CHRIS, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, 0, -1 -CopyDECoordsToMapObject:: ; 807e +CopyDECoordsToMapObject:: push de ld a, b call GetMapObject @@ -70,7 +70,7 @@ CopyDECoordsToMapObject:: ; 807e ld [hl], e ret -PlayerSpawn_ConvertCoords: ; 808f +PlayerSpawn_ConvertCoords: push bc ld a, [wXCoord] add 4 @@ -82,7 +82,7 @@ PlayerSpawn_ConvertCoords: ; 808f call CopyDECoordsToMapObject ret -WriteObjectXY:: ; 80a1 +WriteObjectXY:: ld a, b call CheckObjectVisibility ret c @@ -99,7 +99,7 @@ WriteObjectXY:: ; 80a1 and a ret -RefreshPlayerCoords: ; 80b8 +RefreshPlayerCoords: ld a, [wXCoord] add 4 ld d, a @@ -127,7 +127,7 @@ RefreshPlayerCoords: ; 80b8 ret nz ; wtf ret -CopyObjectStruct:: ; 80e7 +CopyObjectStruct:: call CheckObjectMask and a ret nz ; masked @@ -161,12 +161,12 @@ CopyObjectStruct:: ; 80e7 set 5, [hl] ret -CopyMapObjectToObjectStruct: ; 8116 +CopyMapObjectToObjectStruct: call .CopyMapObjectToTempObject call CopyTempObjectToObjectStruct ret -.CopyMapObjectToTempObject: ; 811d +.CopyMapObjectToTempObject: ld a, [hObjectStructIndexBuffer] ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc @@ -223,7 +223,7 @@ CopyMapObjectToObjectStruct: ; 8116 ld [wTempObjectCopyRadius], a ret -InitializeVisibleSprites: ; 8177 +InitializeVisibleSprites: ld bc, wMapObjects + OBJECT_LENGTH ld a, 1 .loop @@ -281,10 +281,10 @@ InitializeVisibleSprites: ; 8177 jr nz, .loop ret -.ret ; 81c9 +.ret ret -CheckObjectEnteringVisibleRange:: ; 81ca +CheckObjectEnteringVisibleRange:: nop ld a, [wPlayerStepDirection] cp STANDING @@ -293,21 +293,21 @@ CheckObjectEnteringVisibleRange:: ; 81ca rst JumpTable ret -.dw ; 81d6 +.dw dw .Down dw .Up dw .Left dw .Right -.Up: ; 81de +.Up: ld a, [wYCoord] sub 1 jr .Vertical -.Down: ; 81e5 +.Down: ld a, [wYCoord] add 9 -.Vertical: ; 81ea +.Vertical: ld d, a ld a, [wXCoord] ld e, a @@ -355,15 +355,15 @@ CheckObjectEnteringVisibleRange:: ; 81ca jr nz, .loop_v ret -.Left: ; 8232 +.Left: ld a, [wXCoord] sub 1 jr .Horizontal -.Right: ; 8239 +.Right: ld a, [wXCoord] add 10 -.Horizontal: ; 823e +.Horizontal: ld e, a ld a, [wYCoord] ld d, a @@ -411,7 +411,7 @@ CheckObjectEnteringVisibleRange:: ; 81ca jr nz, .loop_h ret -CopyTempObjectToObjectStruct: ; 8286 +CopyTempObjectToObjectStruct: ld a, [wTempObjectCopyMapObjectIndex] ld hl, OBJECT_MAP_OBJECT_INDEX add hl, de @@ -461,7 +461,7 @@ CopyTempObjectToObjectStruct: ; 8286 and a ret -.InitYCoord: ; 82d5 +.InitYCoord: ld hl, OBJECT_INIT_Y add hl, de ld [hl], a @@ -481,7 +481,7 @@ CopyTempObjectToObjectStruct: ; 8286 ld [hl], a ret -.InitXCoord: ; 82f1 +.InitXCoord: ld hl, OBJECT_INIT_X add hl, de ld [hl], a @@ -499,7 +499,7 @@ CopyTempObjectToObjectStruct: ; 8286 ld [hl], a ret -.InitRadius: ; 830d +.InitRadius: ld h, a inc a and $f @@ -513,7 +513,7 @@ CopyTempObjectToObjectStruct: ; 8286 ld [hl], a ret -TrainerWalkToPlayer: ; 831e +TrainerWalkToPlayer: ld a, [hLastTalked] call InitMovementBuffer ld a, movement_step_sleep @@ -533,7 +533,7 @@ TrainerWalkToPlayer: ; 831e call AppendToMovementBuffer ret -.GetPathToPlayer: ; 8341 +.GetPathToPlayer: push de push bc ; get player object struct, load to de @@ -577,7 +577,7 @@ TrainerWalkToPlayer: ; 831e call ComputePathToWalkToPlayer ret -SurfStartStep: ; 8379 +SurfStartStep: call InitMovementBuffer call .GetMovementData call AppendToMovementBuffer @@ -585,7 +585,7 @@ SurfStartStep: ; 8379 call AppendToMovementBuffer ret -.GetMovementData: ; 8388 +.GetMovementData: ld a, [wPlayerDirection] srl a srl a @@ -603,7 +603,7 @@ SurfStartStep: ; 8379 slow_step LEFT slow_step RIGHT -FollowNotExact:: ; 839e +FollowNotExact:: push bc ld a, c call CheckObjectVisibility @@ -690,7 +690,7 @@ FollowNotExact:: ; 839e ld [hl], STEP_TYPE_00 ret -GetRelativeFacing:: ; 8417 +GetRelativeFacing:: ; Determines which way map object e would have to turn to face map object d. Returns carry if it's impossible for whatever reason. ld a, d call GetMapObject @@ -715,7 +715,7 @@ GetRelativeFacing:: ; 8417 scf ret -.GetFacing_e_relativeto_d: ; 8439 +.GetFacing_e_relativeto_d: ; Determines which way object e would have to turn to face object d. Returns carry if it's impossible. ; load the coordinates of object d into bc ld a, d @@ -796,7 +796,7 @@ GetRelativeFacing:: ; 8417 scf ret -QueueFollowerFirstStep: ; 848a +QueueFollowerFirstStep: call .QueueFirstStep jr c, .same ld [wFollowMovementQueue], a diff --git a/engine/overworld/player_step.asm b/engine/overworld/player_step.asm index 675c6553b..eba149b57 100644 --- a/engine/overworld/player_step.asm +++ b/engine/overworld/player_step.asm @@ -1,4 +1,4 @@ -_HandlePlayerStep:: ; d497 (3:5497) +_HandlePlayerStep:: ld a, [wPlayerStepFlags] and a ret z @@ -34,7 +34,7 @@ _HandlePlayerStep:: ; d497 (3:5497) ld [wPlayerBGMapOffsetY], a ret -ScrollScreen:: ; d4d2 (3:54d2) +ScrollScreen:: ld a, [wPlayerStepVectorX] ld d, a ld a, [wPlayerStepVectorY] @@ -47,7 +47,7 @@ ScrollScreen:: ; d4d2 (3:54d2) ld [hSCY], a ret -HandlePlayerStep: ; d4e5 (3:54e5) +HandlePlayerStep: ld hl, wHandlePlayerStep ld a, [hl] and a @@ -58,7 +58,7 @@ HandlePlayerStep: ; d4e5 (3:54e5) rst JumpTable ret -.Jumptable: ; d4f2 (3:54f2) +.Jumptable: dw GetMovementPermissions dw BufferScreen dw .mobile @@ -72,17 +72,17 @@ HandlePlayerStep: ; d4e5 (3:54e5) dw .fail1 dw .fail1 -.fail1 ; d508 (3:5508) +.fail1 ret -.mobile ; d509 (3:5509) +.mobile farcall StubbedTrainerRankings_StepCount ret -.fail2 ; d510 (3:5510) +.fail2 ret -UpdatePlayerCoords: ; d511 (3:5511) +UpdatePlayerCoords: ld a, [wPlayerStepDirection] and a jr nz, .check_step_down @@ -111,7 +111,7 @@ UpdatePlayerCoords: ; d511 (3:5511) inc [hl] ret -UpdateOverworldMap: ; d536 (3:5536) +UpdateOverworldMap: ld a, [wPlayerStepDirection] and a jr z, .step_down @@ -147,7 +147,7 @@ UpdateOverworldMap: ; d536 (3:5536) call ScrollMapLeft ret -.ScrollOverworldMapDown: ; d571 (3:5571) +.ScrollOverworldMapDown: ld a, [wBGMapAnchor] add 2 * BG_MAP_WIDTH ld [wBGMapAnchor], a @@ -168,7 +168,7 @@ UpdateOverworldMap: ; d536 (3:5536) .done_down ret -.Add6ToOverworldMapAnchor: ; d595 (3:5595) +.Add6ToOverworldMapAnchor: ld hl, wOverworldMapAnchor ld a, [wMapWidth] add 6 @@ -178,7 +178,7 @@ UpdateOverworldMap: ; d536 (3:5536) inc [hl] ret -.ScrollOverworldMapUp: ; d5a2 (3:55a2) +.ScrollOverworldMapUp: ld a, [wBGMapAnchor] sub 2 * BG_MAP_WIDTH ld [wBGMapAnchor], a @@ -199,7 +199,7 @@ UpdateOverworldMap: ; d536 (3:5536) .done_up ret -.Sub6FromOverworldMapAnchor: ; d5c6 (3:55c6) +.Sub6FromOverworldMapAnchor: ld hl, wOverworldMapAnchor ld a, [wMapWidth] add 6 @@ -211,7 +211,7 @@ UpdateOverworldMap: ; d536 (3:5536) dec [hl] ret -.ScrollOverworldMapLeft: ; d5d5 (3:55d5) +.ScrollOverworldMapLeft: ld a, [wBGMapAnchor] ld e, a and $e0 @@ -231,7 +231,7 @@ UpdateOverworldMap: ; d536 (3:5536) .done_left ret -.DecrementwOverworldMapAnchor: ; d5f4 (3:55f4) +.DecrementwOverworldMapAnchor: ld hl, wOverworldMapAnchor ld a, [hl] sub 1 @@ -240,7 +240,7 @@ UpdateOverworldMap: ; d536 (3:5536) dec [hl] ret -.ScrollOverworldMapRight: ; d5fe (3:55fe) +.ScrollOverworldMapRight: ld a, [wBGMapAnchor] ld e, a and $e0 @@ -260,7 +260,7 @@ UpdateOverworldMap: ; d536 (3:5536) .done_right ret -.IncrementwOverworldMapAnchor: ; d61d (3:561d) +.IncrementwOverworldMapAnchor: ld hl, wOverworldMapAnchor ld a, [hl] add 1 diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index a18be2e6c..f8e702eb9 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1,6 +1,5 @@ ; Event scripting commands. - EnableScriptMode:: push af ld a, SCRIPT_READ @@ -62,7 +61,6 @@ RunScriptCommand: rst JumpTable ret - ScriptCommandTable: ; entries correspond to macros/scripts/events.asm enumeration dw Script_scall ; 00 @@ -332,7 +330,6 @@ JumpTextScript: closetext end - if _CRYSTAL Script_farjumptext: @@ -351,7 +348,6 @@ Script_farjumptext: endc - Script_writetext: ; script command 0x4c ; parameters: text_pointer @@ -521,7 +517,6 @@ Script_verbosegiveitem: ld de, GiveItemScript jp ScriptCall - ret_96f76: ret @@ -544,7 +539,6 @@ ReceivedItemText: text_jump UnknownText_0x1c4719 db "@" - Script_verbosegiveitem2: ; script command 0x9f ; parameters: item, var @@ -608,7 +602,6 @@ Script_specialsound: call WaitSFX ret - GetPocketName: farcall CheckItemPocket ld a, [wItemAttributeParamBuffer] @@ -634,7 +627,6 @@ CurItemName: call GetItemName ret - PutItemInPocketText: text_jump UnknownText_0x1c472c db "@" @@ -643,7 +635,6 @@ PocketIsFullText: text_jump UnknownText_0x1c474b db "@" - Script_pokemart: ; script command 0x94 ; parameters: dialog_id, mart_id @@ -1071,7 +1062,7 @@ ApplyObjectFacing: jr c, .not_visible ; STILL_SPRITE ld hl, OBJECT_FLAGS1 add hl, bc - bit FIXED_FACING, [hl] + bit FIXED_FACING_F, [hl] jr nz, .not_visible pop de ld a, e @@ -1274,7 +1265,6 @@ ShowEmoteScript: step_sleep 1 step_end - Script_earthquake: ; script command 0x78 ; parameters: param @@ -1301,7 +1291,6 @@ EarthquakeMovement: step_end .End - Script_loadpikachudata: ; script command 0x5a @@ -2664,7 +2653,6 @@ Script_closetext: call CloseText ret - Script_passtoengine: ; script command 0x89 ; parameters: data_pointer @@ -2834,7 +2822,6 @@ Script_checksave: ld [wScriptVar], a ret - ; unused ld a, [.byte] ld [wScriptVar], a diff --git a/engine/overworld/select_menu.asm b/engine/overworld/select_menu.asm index 9898afda2..9eba9de83 100644 --- a/engine/overworld/select_menu.asm +++ b/engine/overworld/select_menu.asm @@ -1,5 +1,4 @@ -SelectMenu:: ; 13327 - +SelectMenu:: call CheckRegisteredItem jr c, .NotRegistered jp UseRegisteredItem @@ -11,17 +10,12 @@ SelectMenu:: ; 13327 call MapTextbox call WaitButton jp CloseText -; 13340 - -ItemMayBeRegisteredText: ; 13340 +ItemMayBeRegisteredText: text_jump UnknownText_0x1c1cf3 db "@" -; 13345 - - -CheckRegisteredItem: ; 13345 +CheckRegisteredItem: ld a, [wWhichRegisteredItem] and a jr z, .NoRegisteredItem @@ -86,10 +80,8 @@ CheckRegisteredItem: ; 13345 ld [wRegisteredItem], a scf ret -; 133a6 - -.CheckRegisteredNo: ; 133a6 +.CheckRegisteredNo: ld a, [wWhichRegisteredItem] and REGISTERED_NUMBER dec a @@ -102,10 +94,8 @@ CheckRegisteredItem: ; 13345 .NotEnoughItems: scf ret -; 133b6 - -.IsSameItem: ; 133b6 +.IsSameItem: ld a, [wRegisteredItem] cp [hl] jr nz, .NotSameItem @@ -116,11 +106,8 @@ CheckRegisteredItem: ; 13345 .NotSameItem: scf ret -; 133c3 - - -UseRegisteredItem: ; 133c3 +UseRegisteredItem: farcall CheckItemMenu ld a, [wItemAttributeParamBuffer] ld hl, .SwitchTo @@ -136,25 +123,22 @@ UseRegisteredItem: ; 133c3 dw .Current dw .Party dw .Overworld -; 133df -.NoFunction: ; 133df +.NoFunction: call OpenText call CantUseItem call CloseText and a ret -; 133ea -.Current: ; 133ea +.Current: call OpenText call DoItemEffect call CloseText and a ret -; 133f5 -.Party: ; 133f5 +.Party: call RefreshScreen call FadeToMenu call DoItemEffect @@ -162,9 +146,8 @@ UseRegisteredItem: ; 133c3 call CloseText and a ret -; 13406 -.Overworld: ; 13406 +.Overworld: call RefreshScreen ld a, 1 ld [wUsingItemWithSelect], a @@ -178,9 +161,8 @@ UseRegisteredItem: ; 133c3 ld a, HMENURETURN_SCRIPT ld [hMenuReturn], a ret -; 13422 -.CantUse: ; 13422 +.CantUse: call RefreshScreen ._cantuse @@ -188,4 +170,3 @@ UseRegisteredItem: ; 133c3 call CloseText and a ret -; 1342d diff --git a/engine/overworld/spawn_points.asm b/engine/overworld/spawn_points.asm index 1a3d12441..6b4476f2b 100644 --- a/engine/overworld/spawn_points.asm +++ b/engine/overworld/spawn_points.asm @@ -1,7 +1,6 @@ INCLUDE "data/maps/spawn_points.asm" - -LoadSpawnPoint: ; 1531f +LoadSpawnPoint: ; loads the spawn point in wDefaultSpawnpoint push hl push de @@ -26,10 +25,8 @@ LoadSpawnPoint: ; 1531f pop de pop hl ret -; 15344 - -IsSpawnPoint: ; 15344 +IsSpawnPoint: ; Checks if the map loaded in de is a spawn point. Returns carry if it's a spawn point. ld hl, SpawnPoints ld c, 0 @@ -59,4 +56,3 @@ IsSpawnPoint: ; 15344 .yes scf ret -; 15363 diff --git a/engine/overworld/tile_events.asm b/engine/overworld/tile_events.asm index 705c0e427..bb566c997 100644 --- a/engine/overworld/tile_events.asm +++ b/engine/overworld/tile_events.asm @@ -1,4 +1,4 @@ -CheckWarpCollision:: ; 1499a +CheckWarpCollision:: ; Is this tile a warp? ld a, [wPlayerStandingTile] cp COLL_PIT @@ -14,9 +14,8 @@ CheckWarpCollision:: ; 1499a .warp scf ret -; 149af -CheckDirectionalWarp:: ; 149af +CheckDirectionalWarp:: ; If this is a directional warp, clear carry (press the designated button to warp). ; Else, set carry (immediate warp). ld a, [wPlayerStandingTile] @@ -34,17 +33,15 @@ CheckDirectionalWarp:: ; 149af .directional xor a ret -; 149c6 -CheckWarpFacingDown: ; 149c6 +CheckWarpFacingDown: ld de, 1 ld hl, .blocks ld a, [wPlayerStandingTile] call IsInArray ret -; 149d3 -.blocks ; 149d3 +.blocks db COLL_DOOR db COLL_DOOR_79 db COLL_STAIRCASE @@ -55,17 +52,15 @@ CheckWarpFacingDown: ; 149c6 db COLL_DOOR_75 db COLL_DOOR_7D db -1 -; 149dd -CheckGrassCollision:: ; 149dd +CheckGrassCollision:: ld a, [wPlayerStandingTile] ld hl, .blocks ld de, 1 call IsInArray ret -; 149ea -.blocks ; 149ea +.blocks db COLL_CUT_08 db COLL_TALL_GRASS db COLL_LONG_GRASS @@ -77,17 +72,15 @@ CheckGrassCollision:: ; 149dd db COLL_GRASS_4B db COLL_GRASS_4C db -1 -; 149f5 -CheckCutCollision: ; 149f5 +CheckCutCollision: ld a, c ld hl, .blocks ld de, 1 call IsInArray ret -; 14a00 -.blocks ; 14a00 +.blocks db COLL_CUT_TREE db COLL_CUT_TREE_1A db COLL_TALL_GRASS_10 @@ -95,9 +88,8 @@ CheckCutCollision: ; 149f5 db COLL_LONG_GRASS db COLL_LONG_GRASS_1C db -1 -; 14a07 -GetWarpSFX:: ; 14a07 +GetWarpSFX:: ld a, [wPlayerStandingTile] ld de, SFX_ENTER_DOOR cp COLL_DOOR @@ -107,4 +99,3 @@ GetWarpSFX:: ; 14a07 ret z ld de, SFX_EXIT_BUILDING ret -; 14a1a diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index 0f83447cc..abb12d87d 100644 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -1,21 +1,19 @@ -_InitializeStartDay: ; 113d6 +_InitializeStartDay: call InitializeStartDay ret -; 113da -ClearDailyTimers: ; 113da +ClearDailyTimers: xor a ld [wLuckyNumberDayBuffer], a ld [wUnusedTwoDayTimer], a ld [wDailyResetTimer], a ret -; 113e5 -InitCallReceiveDelay:: ; 113e5 +InitCallReceiveDelay:: xor a ld [wTimeCyclesSinceLastCall], a -NextCallReceiveDelay: ; 113e9 +NextCallReceiveDelay: ld a, [wTimeCyclesSinceLastCall] cp 3 jr c, .okay @@ -28,13 +26,11 @@ NextCallReceiveDelay: ; 113e9 add hl, de ld a, [hl] jp RestartReceiveCallDelay -; 113fd .ReceiveCallDelays: db 20, 10, 5, 3 -; 11401 -CheckReceiveCallTimer: ; 11401 +CheckReceiveCallTimer: call CheckReceiveCallDelay ; check timer ret nc ld hl, wTimeCyclesSinceLastCall @@ -47,12 +43,11 @@ CheckReceiveCallTimer: ; 11401 call NextCallReceiveDelay ; restart timer scf ret -; 11413 -InitOneDayCountdown: ; 11413 +InitOneDayCountdown: ld a, 1 -InitNDaysCountdown: ; 11415 +InitNDaysCountdown: ld [hl], a push hl call UpdateTime @@ -60,9 +55,8 @@ InitNDaysCountdown: ; 11415 inc hl call CopyDayToHL ret -; 11420 -CheckDayDependentEventHL: ; 11420 +CheckDayDependentEventHL: inc hl push hl call CalcDaysSince @@ -71,32 +65,28 @@ CheckDayDependentEventHL: ; 11420 dec hl call UpdateTimeRemaining ret -; 1142e -RestartReceiveCallDelay: ; 1142e +RestartReceiveCallDelay: ld hl, wReceiveCallDelay_MinsRemaining ld [hl], a call UpdateTime ld hl, wReceiveCallDelay_StartTime call CopyDayHourMinToHL ret -; 1143c -CheckReceiveCallDelay: ; 1143c +CheckReceiveCallDelay: ld hl, wReceiveCallDelay_StartTime call CalcMinsHoursDaysSince call GetMinutesSinceIfLessThan60 ld hl, wReceiveCallDelay_MinsRemaining call UpdateTimeRemaining ret -; 1144c -RestartDailyResetTimer: ; 1144c +RestartDailyResetTimer: ld hl, wDailyResetTimer jp InitOneDayCountdown -; 11452 -CheckDailyResetTimer:: ; 11452 +CheckDailyResetTimer:: ld hl, wDailyResetTimer call CheckDayDependentEventHL ret nc @@ -128,18 +118,16 @@ endr call SampleKenjiBreakCountdown .DontRestartKenjiBreakCountdown: jr RestartDailyResetTimer -; 11485 -SampleKenjiBreakCountdown: ; 11485 +SampleKenjiBreakCountdown: ; Generate a random number between 3 and 6 call Random and %11 add 3 ld [wKenjiBreakTimer], a ret -; 11490 -StartBugContestTimer: ; 11490 +StartBugContestTimer: ld a, BUG_CONTEST_MINUTES ld [wBugContestMinsRemaining], a ld a, BUG_CONTEST_SECONDS @@ -148,10 +136,8 @@ StartBugContestTimer: ; 11490 ld hl, wBugContestStartTime call CopyDayHourMinSecToHL ret -; 114a4 - -CheckBugContestTimer:: ; 114a4 (4:54a4) +CheckBugContestTimer:: ld hl, wBugContestStartTime call CalcSecsMinsHoursDaysSince ld a, [wDaysSince] @@ -185,15 +171,13 @@ CheckBugContestTimer:: ; 114a4 (4:54a4) scf ret - -InitializeStartDay: ; 114dd +InitializeStartDay: call UpdateTime ld hl, wTimerEventStartDay call CopyDayToHL ret -; 114e7 -CheckPokerusTick:: ; 114e7 +CheckPokerusTick:: ld hl, wTimerEventStartDay call CalcDaysSince call GetDaysSince @@ -204,9 +188,8 @@ CheckPokerusTick:: ; 114e7 .done xor a ret -; 114fc -SetUnusedTwoDayTimer: ; 114fc +SetUnusedTwoDayTimer: ld a, 2 ld hl, wUnusedTwoDayTimer ld [hl], a @@ -214,22 +197,19 @@ SetUnusedTwoDayTimer: ; 114fc ld hl, wUnusedTwoDayTimerStartDate call CopyDayToHL ret -; 1150c -CheckUnusedTwoDayTimer: ; 1150c +CheckUnusedTwoDayTimer: ld hl, wUnusedTwoDayTimerStartDate call CalcDaysSince call GetDaysSince ld hl, wUnusedTwoDayTimer call UpdateTimeRemaining ret -; 1151c ; unused ld hl, wDailyFlags set DAILYFLAGS_FISH_SWARM_F, [hl] ret -; 11522 ; unused and a @@ -238,15 +218,13 @@ CheckUnusedTwoDayTimer: ; 1150c ret nz scf ret -; 1152b -RestartLuckyNumberCountdown: ; 1152b +RestartLuckyNumberCountdown: call .GetDaysUntilNextFriday ld hl, wLuckyNumberDayBuffer jp InitNDaysCountdown -; 11534 -.GetDaysUntilNextFriday: ; 11534 +.GetDaysUntilNextFriday: call GetWeekday ld c, a ld a, FRIDAY @@ -259,14 +237,12 @@ RestartLuckyNumberCountdown: ; 1152b .earlier ret -; 11542 -_CheckLuckyNumberShowFlag: ; 11542 +_CheckLuckyNumberShowFlag: ld hl, wLuckyNumberDayBuffer jp CheckDayDependentEventHL -; 11548 -DoMysteryGiftIfDayHasPassed: ; 11548 +DoMysteryGiftIfDayHasPassed: ld a, BANK(sMysteryGiftTimer) call GetSRAMBank ld hl, sMysteryGiftTimer @@ -294,9 +270,8 @@ DoMysteryGiftIfDayHasPassed: ; 11548 ld [sMysteryGiftTimer + 1], a call CloseSRAM ret -; 11586 -UpdateTimeRemaining: ; 11586 +UpdateTimeRemaining: ; If the amount of time elapsed exceeds the capacity of its ; unit, skip this part. cp -1 @@ -318,9 +293,8 @@ UpdateTimeRemaining: ; 11586 ld [hl], a scf ret -; 11599 -GetSecondsSinceIfLessThan60: ; 11599 +GetSecondsSinceIfLessThan60: ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -331,9 +305,8 @@ GetSecondsSinceIfLessThan60: ; 11599 jr nz, GetTimeElapsed_ExceedsUnitLimit ld a, [wSecondsSince] ret -; 115ae -GetMinutesSinceIfLessThan60: ; 115ae +GetMinutesSinceIfLessThan60: ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -342,45 +315,38 @@ GetMinutesSinceIfLessThan60: ; 115ae jr nz, GetTimeElapsed_ExceedsUnitLimit ld a, [wMinutesSince] ret -; 115be -GetHoursSinceIfLessThan24: ; 115be +GetHoursSinceIfLessThan24: ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit ld a, [wHoursSince] ret -; 115c8 -GetDaysSince: ; 115c8 +GetDaysSince: ld a, [wDaysSince] ret -; 115cc -GetTimeElapsed_ExceedsUnitLimit: ; 115cc +GetTimeElapsed_ExceedsUnitLimit: ld a, -1 ret -; 115cf -CalcDaysSince: ; 115cf +CalcDaysSince: xor a jr _CalcDaysSince -; 115d2 -CalcHoursDaysSince: ; 115d2 +CalcHoursDaysSince: inc hl xor a jr _CalcHoursDaysSince -; 115d6 -CalcMinsHoursDaysSince: ; 115d6 +CalcMinsHoursDaysSince: inc hl inc hl xor a jr _CalcMinsHoursDaysSince -; 115db -CalcSecsMinsHoursDaysSince: ; 115db +CalcSecsMinsHoursDaysSince: inc hl inc hl inc hl @@ -394,7 +360,7 @@ CalcSecsMinsHoursDaysSince: ; 115db dec hl ld [wSecondsSince], a ; seconds since -_CalcMinsHoursDaysSince: ; 115eb +_CalcMinsHoursDaysSince: ld a, [hMinutes] ld c, a sbc [hl] @@ -405,7 +371,7 @@ _CalcMinsHoursDaysSince: ; 115eb dec hl ld [wMinutesSince], a ; minutes since -_CalcHoursDaysSince: ; 115f8 +_CalcHoursDaysSince: ld a, [hHours] ld c, a sbc [hl] @@ -426,9 +392,8 @@ _CalcDaysSince: ld [hl], c ; current days ld [wDaysSince], a ; days since ret -; 11613 -CopyDayHourMinSecToHL: ; 11613 +CopyDayHourMinSecToHL: ld a, [wCurDay] ld [hli], a ld a, [hHours] @@ -438,23 +403,20 @@ CopyDayHourMinSecToHL: ; 11613 ld a, [hSeconds] ld [hli], a ret -; 11621 -CopyDayToHL: ; 11621 +CopyDayToHL: ld a, [wCurDay] ld [hl], a ret -; 11626 -CopyDayHourToHL: ; 11626 +CopyDayHourToHL: ld a, [wCurDay] ld [hli], a ld a, [hHours] ld [hli], a ret -; 1162e -CopyDayHourMinToHL: ; 1162e +CopyDayHourMinToHL: ld a, [wCurDay] ld [hli], a ld a, [hHours] @@ -462,4 +424,3 @@ CopyDayHourMinToHL: ; 1162e ld a, [hMinutes] ld [hli], a ret -; 11639 diff --git a/engine/overworld/variables.asm b/engine/overworld/variables.asm index 3adf6df33..9b5e3846c 100644 --- a/engine/overworld/variables.asm +++ b/engine/overworld/variables.asm @@ -1,4 +1,4 @@ -_GetVarAction:: ; 80648 (20:4648) +_GetVarAction:: ld a, c cp NUM_VARS jr c, .valid @@ -28,13 +28,12 @@ _GetVarAction:: ; 80648 (20:4648) call _de_ ret -.loadstringbuffer2 ; 8066c (20:466c) +.loadstringbuffer2 ld de, wStringBuffer2 ld [de], a ret -; 80671 (20:4671) -.VarActionTable: ; 80671 +.VarActionTable: ; entries correspond to VAR_* constants ; RETVAR_STRBUF2: copy [de] to wStringBuffer2 ; RETVAR_ADDR_DE: return address in de @@ -67,51 +66,45 @@ _GetVarAction:: ; 80648 (20:4648) dwb wBuenasPassword, RETVAR_ADDR_DE dwb wKenjiBreakTimer, RETVAR_STRBUF2 dwb NULL, RETVAR_STRBUF2 -; 806c5 -.CountCaughtMons: ; 806c5 +.CountCaughtMons: ; Caught mons. ld hl, wPokedexCaught ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits ld a, [wd265] jp .loadstringbuffer2 -; 806d3 -.CountSeenMons: ; 806d3 +.CountSeenMons: ; Seen mons. ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits ld a, [wd265] jp .loadstringbuffer2 -; 806e1 -.CountBadges: ; 806e1 +.CountBadges: ; Number of owned badges. ld hl, wBadges ld b, 2 call CountSetBits ld a, [wd265] jp .loadstringbuffer2 -; 806ef -.PlayerFacing: ; 806ef +.PlayerFacing: ; The direction the player is facing. ld a, [wPlayerDirection] and $c rrca rrca jp .loadstringbuffer2 -; 806f9 -.DayOfWeek: ; 806f9 +.DayOfWeek: ; The day of the week. call GetWeekday jp .loadstringbuffer2 -; 806ff -.UnownCaught: ; 806ff +.UnownCaught: ; Number of unique Unown caught. call .count ld a, b @@ -129,9 +122,8 @@ _GetVarAction:: ; 80648 (20:4648) cp NUM_UNOWN jr c, .loop ret -; 80715 -.BoxFreeSpace: ; 80715 +.BoxFreeSpace: ; Remaining slots in the current box. ld a, BANK(sBoxCount) call GetSRAMBank @@ -142,10 +134,8 @@ _GetVarAction:: ; 80648 (20:4648) call CloseSRAM ld a, b jp .loadstringbuffer2 -; 80728 -.BattleResult: ; 80728 +.BattleResult: ld a, [wBattleResult] and $ff ^ BATTLERESULT_BITMASK jp .loadstringbuffer2 -; 80730 diff --git a/engine/overworld/warp_connection.asm b/engine/overworld/warp_connection.asm index 2f5e488cc..54df4a97f 100644 --- a/engine/overworld/warp_connection.asm +++ b/engine/overworld/warp_connection.asm @@ -1,5 +1,5 @@ -HandleNewMap: ; 1045b0 +HandleNewMap: call Clearwc7e8 call ResetMapBufferEventFlags call ResetFlashIfOutOfCave @@ -7,7 +7,7 @@ HandleNewMap: ; 1045b0 call ResetBikeFlags ld a, MAPCALLBACK_NEWMAP call RunMapCallback -InitCommandQueue: ; 1045c4 +InitCommandQueue: farcall ClearCmdQueue ld a, MAPCALLBACK_CMDQUEUE call RunMapCallback @@ -15,8 +15,7 @@ InitCommandQueue: ; 1045c4 ld [wMapTimeOfDay], a ret - -EnterMapConnection: ; 1045d6 +EnterMapConnection: ; Return carry if a connection has been entered. ld a, [wPlayerStepDirection] and a @@ -150,9 +149,8 @@ EnterMapConnection: ; 1045d6 .done scf ret -; 1046c6 -LoadWarpData: ; 1046c6 +LoadWarpData: call .SaveDigWarp call .SetSpawn ld a, [wNextWarp] @@ -163,7 +161,7 @@ LoadWarpData: ; 1046c6 ld [wMapNumber], a ret -.SaveDigWarp: ; 1046df (41:46df) +.SaveDigWarp: call GetMapEnvironment call CheckOutdoorMap ret nz @@ -195,7 +193,7 @@ LoadWarpData: ; 1046c6 ld [wDigMapNumber], a ret -.SetSpawn: ; 104718 (41:4718) +.SetSpawn: call GetMapEnvironment call CheckOutdoorMap ret nz @@ -227,7 +225,7 @@ LoadWarpData: ; 1046c6 ld [wLastSpawnMapNumber], a ret -LoadMapTimeOfDay: ; 104750 +LoadMapTimeOfDay: ld hl, wVramState res 6, [hl] ld a, $1 @@ -239,7 +237,7 @@ LoadMapTimeOfDay: ; 104750 call .PushAttrMap ret -.ClearBGMap: ; 104770 (41:4770) +.ClearBGMap: ld a, HIGH(vBGMap0) ld [wBGMapAnchor + 1], a xor a ; LOW(vBGMap0) @@ -267,7 +265,7 @@ LoadMapTimeOfDay: ; 104750 call ByteFill ret -.PushAttrMap: ; 1047a3 (41:47a3) +.PushAttrMap: decoord 0, 0 call .copy ld a, [hCGB] @@ -298,7 +296,7 @@ LoadMapTimeOfDay: ; 104750 ld [rVBK], a ret -LoadGraphics: ; 1047cf +LoadGraphics: call LoadTileset call LoadTilesetGFX xor a @@ -310,12 +308,11 @@ LoadGraphics: ; 1047cf farcall LoadOverworldFont ret -LoadMapPalettes: ; 1047eb +LoadMapPalettes: ld b, SCGB_MAPPALS jp GetSGBLayout -; 1047f0 -RefreshMapSprites: ; 1047f0 +RefreshMapSprites: call ClearSprites farcall ReturnFromMapSetupScript call GetMovementPermissions @@ -333,7 +330,7 @@ RefreshMapSprites: ; 1047f0 ld [wPlayerSpriteSetupFlags], a ret -CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) +CheckMovingOffEdgeOfMap:: ld a, [wPlayerStepDirection] cp STANDING ret z @@ -390,8 +387,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) scf ret - -GetCoordOfUpperLeftCorner:: ; 10486d +GetCoordOfUpperLeftCorner:: ld hl, wOverworldMapBlocks ld a, [wXCoord] bit 0, a @@ -436,4 +432,3 @@ GetCoordOfUpperLeftCorner:: ; 10486d and $1 ld [wMetatileStandingX], a ret -; 1048ba diff --git a/engine/overworld/wildmons.asm b/engine/overworld/wildmons.asm index 20375ba6c..d88e5908f 100644 --- a/engine/overworld/wildmons.asm +++ b/engine/overworld/wildmons.asm @@ -1,4 +1,4 @@ -LoadWildMonData: ; 29ff8 +LoadWildMonData: call _GrassWildmonLookup jr c, .copy ld hl, wMornEncounterRate @@ -25,7 +25,7 @@ LoadWildMonData: ; 29ff8 ld [wWaterEncounterRate], a ret -FindNest: ; 2a01f +FindNest: ; Parameters: ; e: 0 = Johto, 1 = Kanto ; wNamedObjectIndexBuffer: species @@ -51,9 +51,8 @@ FindNest: ; 2a01f call .FindGrass ld hl, KantoWaterWildMons jp .FindWater -; 2a052 -.FindGrass: ; 2a052 +.FindGrass: ld a, [hl] cp -1 ret z @@ -76,9 +75,8 @@ FindNest: ; 2a01f ld bc, GRASS_WILDDATA_LENGTH add hl, bc jr .FindGrass -; 2a06e -.FindWater: ; 2a06e +.FindWater: ld a, [hl] cp -1 ret z @@ -88,7 +86,7 @@ FindNest: ; 2a01f ld a, [hli] ld c, a inc hl - ld a, 3 + ld a, NUM_WATERMON call .SearchMapForMon jr nc, .next_water ld [de], a @@ -96,12 +94,11 @@ FindNest: ; 2a01f .next_water pop hl - ld bc, 3 * 3 + ld bc, WATER_WILDDATA_LENGTH add hl, bc jr .FindWater -; 2a088 -.SearchMapForMon: ; 2a088 +.SearchMapForMon: inc hl .ScanMapLoop: push af @@ -119,9 +116,8 @@ FindNest: ; 2a01f .found pop af jp .AppendNest -; 2a09c -.AppendNest: ; 2a09c +.AppendNest: push de call GetWorldMapLocation ld c, a @@ -144,9 +140,8 @@ FindNest: ; 2a01f pop de and a ret -; 2a0b7 -.RoamMon1: ; 2a0b7 +.RoamMon1: ld a, [wRoamMon1Species] ld b, a ld a, [wNamedObjectIndexBuffer] @@ -161,9 +156,8 @@ FindNest: ; 2a01f ld [de], a inc de ret -; 2a0cf -.RoamMon2: ; 2a0cf +.RoamMon2: ld a, [wRoamMon2Species] ld b, a ld a, [wNamedObjectIndexBuffer] @@ -178,9 +172,8 @@ FindNest: ; 2a01f ld [de], a inc de ret -; 2a0e7 -TryWildEncounter:: ; 2a0e7 +TryWildEncounter:: ; Try to trigger a wild encounter. call .EncounterRate jr nc, .no_battle @@ -198,18 +191,16 @@ TryWildEncounter:: ; 2a0e7 ld a, 1 and a ret -; 2a103 -.EncounterRate: ; 2a103 +.EncounterRate: call GetMapEncounterRate call ApplyMusicEffectOnEncounterRate call ApplyCleanseTagEffectOnEncounterRate call Random cp b ret -; 2a111 -GetMapEncounterRate: ; 2a111 +GetMapEncounterRate: ld hl, wMornEncounterRate call CheckOnWater ld a, wWaterEncounterRate - wMornEncounterRate @@ -221,9 +212,8 @@ GetMapEncounterRate: ; 2a111 add hl, bc ld b, [hl] ret -; 2a124 -ApplyMusicEffectOnEncounterRate:: ; 2a124 +ApplyMusicEffectOnEncounterRate:: ; Pokemon March and Ruins of Alph signal double encounter rate. ; Pokemon Lullaby halves encounter rate. ld a, [wMapMusic] @@ -239,9 +229,8 @@ ApplyMusicEffectOnEncounterRate:: ; 2a124 .double sla b ret -; 2a138 -ApplyCleanseTagEffectOnEncounterRate:: ; 2a138 +ApplyCleanseTagEffectOnEncounterRate:: ; Cleanse Tag halves encounter rate. ld hl, wPartyMon1Item ld de, PARTYMON_STRUCT_LENGTH @@ -259,9 +248,8 @@ ApplyCleanseTagEffectOnEncounterRate:: ; 2a138 .cleansetag srl b ret -; 2a14f -ChooseWildEncounter: ; 2a14f +ChooseWildEncounter: call LoadWildMonDataPointer jp nc, .nowildbattle call CheckEncounterRoamMon @@ -276,7 +264,7 @@ ChooseWildEncounter: ; 2a14f inc hl inc hl ld a, [wTimeOfDay] - ld bc, $e + ld bc, NUM_GRASSMON * 2 call AddNTimes ld de, GrassMonProbTable @@ -355,11 +343,10 @@ ChooseWildEncounter: ; 2a14f .startwildbattle xor a ret -; 2a1cb INCLUDE "data/wild/probabilities.asm" -CheckRepelEffect:: ; 2a1df +CheckRepelEffect:: ; If there is no active Repel, there's no need to be here. ld a, [wRepelEffect] and a @@ -389,13 +376,12 @@ endr .encounter scf ret -; 2a200 -LoadWildMonDataPointer: ; 2a200 +LoadWildMonDataPointer: call CheckOnWater jr z, _WaterWildmonLookup -_GrassWildmonLookup: ; 2a205 +_GrassWildmonLookup: ld hl, SwarmGrassWildMons ld bc, GRASS_WILDDATA_LENGTH call _SwarmWildmonCheck @@ -406,7 +392,7 @@ _GrassWildmonLookup: ; 2a205 ld bc, GRASS_WILDDATA_LENGTH jr _NormalWildmonOK -_WaterWildmonLookup: ; 2a21d +_WaterWildmonLookup: ld hl, SwarmWaterWildMons ld bc, WATER_WILDDATA_LENGTH call _SwarmWildmonCheck @@ -467,17 +453,15 @@ _NoSwarmWildmon: _NormalWildmonOK: call CopyCurrMapDE jr LookUpWildmonsForMapDE -; 2a27f -CopyCurrMapDE: ; 2a27f +CopyCurrMapDE: ld a, [wMapGroup] ld d, a ld a, [wMapNumber] ld e, a ret -; 2a288 -LookUpWildmonsForMapDE: ; 2a288 +LookUpWildmonsForMapDE: .loop push hl ld a, [hl] @@ -505,10 +489,8 @@ LookUpWildmonsForMapDE: ; 2a288 pop hl scf ret -; 2a2a0 - -InitRoamMons: ; 2a2a0 +InitRoamMons: ; initialize wRoamMon structs ; species @@ -540,10 +522,8 @@ InitRoamMons: ; 2a2a0 ld [wRoamMon2HP], a ret -; 2a2ce - -CheckEncounterRoamMon: ; 2a2ce +CheckEncounterRoamMon: push hl ; Don't trigger an encounter if we're on water. call CheckOnWater @@ -589,10 +569,8 @@ CheckEncounterRoamMon: ; 2a2ce pop hl and a ret -; 2a30d - -UpdateRoamMons: ; 2a30d +UpdateRoamMons: ld a, [wRoamMon1MapGroup] cp GROUP_N_A jr z, .SkipRaikou @@ -633,10 +611,8 @@ UpdateRoamMons: ; 2a30d .Finished: jp _BackUpMapIndices -; 2a355 - -.Update: ; 2a355 +.Update: ld hl, RoamMaps .loop ; Are we at the end of the table? @@ -675,7 +651,7 @@ UpdateRoamMons: ; 2a30d jr nc, .update_loop ; invalid index, try again inc hl ld c, a - ld b, $0 + ld b, 0 add hl, bc add hl, bc ld a, [wRoamMons_LastMapGroup] @@ -693,7 +669,7 @@ UpdateRoamMons: ; 2a30d ld c, [hl] ret -JumpRoamMons: ; 2a394 +JumpRoamMons: ld a, [wRoamMon1MapGroup] cp GROUP_N_A jr z, .SkipRaikou @@ -726,7 +702,7 @@ JumpRoamMons: ; 2a394 .Finished: jp _BackUpMapIndices -JumpRoamMon: ; 2a3cd +JumpRoamMon: .loop ld hl, RoamMaps .innerloop1 ; This loop happens to be unnecessary. @@ -760,9 +736,8 @@ JumpRoamMon: ; 2a3cd ld b, a ld c, [hl] ret -; 2a3f6 -_BackUpMapIndices: ; 2a3f6 +_BackUpMapIndices: ld a, [wRoamMons_CurrentMapNumber] ld [wRoamMons_LastMapNumber], a ld a, [wRoamMons_CurrentMapGroup] @@ -772,13 +747,10 @@ _BackUpMapIndices: ; 2a3f6 ld a, [wMapGroup] ld [wRoamMons_CurrentMapGroup], a ret -; 2a40f - INCLUDE "data/wild/roammon_maps.asm" - -ValidateTempWildMonSpecies: ; 2a4a0 +ValidateTempWildMonSpecies: ; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a. and a jr z, .nowildmon ; = 0 @@ -790,11 +762,10 @@ ValidateTempWildMonSpecies: ; 2a4a0 .nowildmon scf ret -; 2a4ab ; Finds a rare wild Pokemon in the route of the trainer calling, then checks if it's been Seen already. ; The trainer will then tell you about the Pokemon if you haven't seen it. -RandomUnseenWildMon: ; 2a4ab +RandomUnseenWildMon: farcall GetCallerLocation ld d, b ld e, c @@ -819,7 +790,7 @@ RandomUnseenWildMon: ; 2a4ab jr z, .randloop1 dec a ld c, a - ld b, $0 + ld b, 0 add hl, bc add hl, bc ; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area. @@ -865,9 +836,8 @@ RandomUnseenWildMon: ; 2a4ab ; I just saw some rare @ in @ . I'll call you if I see another rare #MON, OK? text_jump UnknownText_0x1bd34b db "@" -; 0x2a51f -RandomPhoneWildMon: ; 2a51f +RandomPhoneWildMon: farcall GetCallerLocation ld d, b ld e, c @@ -894,7 +864,7 @@ RandomPhoneWildMon: ; 2a51f call Random and %11 ld c, a - ld b, $0 + ld b, 0 add hl, bc add hl, bc inc hl @@ -905,9 +875,8 @@ RandomPhoneWildMon: ; 2a51f ld de, wStringBuffer4 ld bc, MON_NAME_LENGTH jp CopyBytes -; 2a567 -RandomPhoneMon: ; 2a567 +RandomPhoneMon: ; Get a random monster owned by the trainer who's calling. farcall GetCallerLocation ld hl, TrainerGroups @@ -989,8 +958,6 @@ RandomPhoneMon: ; 2a567 ld de, wStringBuffer4 ld bc, MON_NAME_LENGTH jp CopyBytes -; 2a5e9 - INCLUDE "data/wild/johto_grass.asm" INCLUDE "data/wild/johto_water.asm" diff --git a/engine/phone/buenas_password.asm b/engine/phone/buenas_password.asm index 82a696648..68c5c01b9 100644 --- a/engine/phone/buenas_password.asm +++ b/engine/phone/buenas_password.asm @@ -165,6 +165,5 @@ BuenaPhoneScript_Random1: .two writetext UnknownText_0xa1e2f end -; a0c28 INCLUDE "data/phone/text/buena.asm" diff --git a/engine/phone/generic_calls.asm b/engine/phone/generic_calls.asm index b3b3eb56a..407480d36 100644 --- a/engine/phone/generic_calls.asm +++ b/engine/phone/generic_calls.asm @@ -1254,8 +1254,6 @@ PhoneScript_MonFlavorText: farwritetext UnknownText_0x1b522b buttonsound farjump PhoneScript_HangupText_Male -; be643 - GrandmaString: db "Grandma@" GrandpaString: db "Grandpa@" @@ -1263,4 +1261,3 @@ MomString: db "Mom@" DadString: db "Dad@" SisterString: db "Sister@" BrotherString: db "Brother@" - diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 41f7bf47f..06a241cad 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -1,4 +1,4 @@ -AddPhoneNumber:: ; 90000 +AddPhoneNumber:: call _CheckCellNum jr c, .cant_add call Phone_FindOpenSlot @@ -10,10 +10,8 @@ AddPhoneNumber:: ; 90000 .cant_add scf ret -; 9000f - -DelCellNum:: ; 9000f +DelCellNum:: call _CheckCellNum jr nc, .not_in_list xor a @@ -23,13 +21,11 @@ DelCellNum:: ; 9000f .not_in_list scf ret -; 90019 -CheckCellNum:: ; 90019 +CheckCellNum:: jp _CheckCellNum ; wtf -; 9001c -_CheckCellNum: ; 9001c +_CheckCellNum: ld hl, wPhoneList ld b, CONTACT_LIST_SIZE .loop @@ -45,9 +41,8 @@ _CheckCellNum: ; 9001c dec hl scf ret -; 9002d -Phone_FindOpenSlot: ; 9002d +Phone_FindOpenSlot: call GetRemainingSpaceInPhoneList ld b, a ld hl, wPhoneList @@ -64,9 +59,8 @@ Phone_FindOpenSlot: ; 9002d dec hl scf ret -; 90040 -GetRemainingSpaceInPhoneList: ; 90040 +GetRemainingSpaceInPhoneList: xor a ld [wBuffer1], a ld hl, PermanentNumbers @@ -96,12 +90,10 @@ GetRemainingSpaceInPhoneList: ; 90040 ld hl, wBuffer1 sub [hl] ret -; 90066 INCLUDE "data/phone/permanent_numbers.asm" - -FarPlaceString: ; 90069 +FarPlaceString: ld a, [hROMBank] push af ld a, b @@ -112,10 +104,8 @@ FarPlaceString: ; 90069 pop af rst Bankswitch ret -; 90074 - -CheckPhoneCall:: ; 90074 (24:4074) +CheckPhoneCall:: ; Check if the phone is ringing in the overworld. call CheckStandingOnEntrance @@ -151,11 +141,11 @@ CheckPhoneCall:: ; 90074 (24:4074) xor a ret -.timecheck ; 900a6 (24:40a6) +.timecheck farcall CheckReceiveCallTimer ret -CheckPhoneContactTimeOfDay: ; 900ad (24:40ad) +CheckPhoneContactTimeOfDay: push hl push bc push de @@ -171,7 +161,7 @@ CheckPhoneContactTimeOfDay: ; 900ad (24:40ad) pop hl ret -ChooseRandomCaller: ; 900bf (24:40bf) +ChooseRandomCaller: ; If no one is available to call, don't return anything. ld a, [wEngineBuffer3] and a @@ -198,7 +188,7 @@ ChooseRandomCaller: ; 900bf (24:40bf) xor a ret -GetAvailableCallers: ; 900de (24:40de) +GetAvailableCallers: farcall CheckTime ld a, c ld [wEngineBuffer1], a @@ -246,7 +236,7 @@ GetAvailableCallers: ; 900de (24:40de) jr nz, .loop ret -CheckSpecialPhoneCall:: ; 90136 (24:4136) +CheckSpecialPhoneCall:: ld a, [wSpecialPhoneCallID] and a jr z, .NoPhoneCall @@ -288,14 +278,12 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136) .NoPhoneCall: xor a ret -; 90173 (24:4173) -.script ; 0x90173 +.script pause 30 jump Script_ReceivePhoneCall -; 0x90178 -.DoSpecialPhoneCall: ; 90178 (24:4178) +.DoSpecialPhoneCall: ld a, [wSpecialPhoneCallID] dec a ld c, a @@ -305,7 +293,7 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136) call AddNTimes ret -SpecialCallOnlyWhenOutside: ; 90188 +SpecialCallOnlyWhenOutside: ld a, [wEnvironment] cp TOWN jr z, .outside @@ -318,11 +306,11 @@ SpecialCallOnlyWhenOutside: ; 90188 scf ret -SpecialCallWhereverYouAre: ; 90197 +SpecialCallWhereverYouAre: scf ret -Function90199: ; 90199 (24:4199) +Function90199: ; Don't do the call if you're in a link communication ld a, [wLinkMode] and a @@ -388,19 +376,16 @@ Function90199: ; 90199 (24:4199) ld de, UnknownScript_0x90205 call ExecuteCallbackScript ret -; 90205 (24:4205) -UnknownScript_0x90205: ; 0x90205 +UnknownScript_0x90205: ptcall wd002 return -; 0x90209 -UnknownScript_0x90209: ; 0x90209 +UnknownScript_0x90209: scall UnknownScript_0x90657 return -; 0x9020d -LoadCallerScript: ; 9020d (24:420d) +LoadCallerScript: nop nop ld a, e @@ -422,9 +407,8 @@ LoadCallerScript: ; 9020d (24:420d) ld bc, 12 call FarCopyBytes ret -; 90233 (24:4233) -WrongNumber: ; 90233 +WrongNumber: db TRAINER_NONE, PHONE_00 dba .script .script @@ -434,9 +418,8 @@ WrongNumber: ; 90233 ; Huh? Sorry, wrong number! text_jump UnknownText_0x1c5565 db "@" -; 90241 -Script_ReceivePhoneCall: ; 0x90241 +Script_ReceivePhoneCall: refreshscreen callasm RingTwice_StartCall ptcall wPhoneScriptPointer @@ -445,18 +428,16 @@ Script_ReceivePhoneCall: ; 0x90241 closetext callasm InitCallReceiveDelay end -; 0x90255 -Script_SpecialBillCall:: ; 0x90255 +Script_SpecialBillCall:: callasm .LoadBillScript jump Script_ReceivePhoneCall .LoadBillScript: ld e, PHONE_BILL jp LoadCallerScript -; 90261 -UnknownScript_0x90261: ; 0x90261 +UnknownScript_0x90261: callasm .LoadElmScript pause 30 jump Script_ReceivePhoneCall @@ -464,16 +445,14 @@ UnknownScript_0x90261: ; 0x90261 .LoadElmScript: ld e, PHONE_ELM jp LoadCallerScript -; 9026f -RingTwice_StartCall: ; 9026f +RingTwice_StartCall: call .Ring call .Ring farcall StubbedTrainerRankings_PhoneCalls ret -; 9027c -.Ring: ; 9027c (24:427c) +.Ring: call Phone_StartRinging call Phone_Wait20Frames call Phone_CallerTextboxWithName @@ -483,13 +462,13 @@ RingTwice_StartCall: ; 9026f call Phone_CallerTextboxWithName ret -Phone_CallerTextboxWithName: ; 90292 (24:4292) +Phone_CallerTextboxWithName: ld a, [wCurrentCaller] ld b, a call Function90363 ret -PhoneCall:: ; 9029a +PhoneCall:: ld a, b ld [wPhoneScriptBank], a ld a, e @@ -500,9 +479,8 @@ PhoneCall:: ; 9029a call Phone_FirstOfTwoRings farcall StubbedTrainerRankings_PhoneCalls ret -; 902b3 -Phone_FirstOfTwoRings: ; 902b3 +Phone_FirstOfTwoRings: call Phone_StartRinging call Phone_Wait20Frames call Phone_CallerTextboxWithName2 @@ -511,9 +489,8 @@ Phone_FirstOfTwoRings: ; 902b3 call Phone_Wait20Frames call Phone_CallerTextboxWithName2 ret -; 902c9 -Phone_CallerTextboxWithName2: ; 902c9 +Phone_CallerTextboxWithName2: call Phone_CallerTextbox hlcoord 1, 2 ld [hl], "☎" @@ -527,15 +504,13 @@ Phone_CallerTextboxWithName2: ; 902c9 ld d, a call FarPlaceString ret -; 902e3 - -Phone_NoSignal: ; 902e3 (24:42e3) +Phone_NoSignal: ld de, SFX_NO_SIGNAL call PlaySFX jr Phone_CallEnd -HangUp:: ; 902eb +HangUp:: call HangUp_Beep call HangUp_Wait20Frames Phone_CallEnd: @@ -552,46 +527,37 @@ Phone_CallEnd: call HangUp_BoopOff call HangUp_Wait20Frames ret -; 90316 -Function90316: ; 90316 +Function90316: ld de, SFX_SHUT_DOWN_PC call PlaySFX ret -; 9031d -HangUp_Beep: ; 9031d +HangUp_Beep: ld hl, UnknownText_0x9032a call PrintText ld de, SFX_HANG_UP call PlaySFX ret -; 9032a -UnknownText_0x9032a: ; 9032a +UnknownText_0x9032a: text_jump UnknownText_0x1c5580 db "@" -; 9032f - -HangUp_BoopOn: ; 9032f +HangUp_BoopOn: ld hl, UnknownText_0x90336 call PrintText ret -; 90336 -UnknownText_0x90336: ; 0x90336 +UnknownText_0x90336: text_jump UnknownText_0x1c5588 db "@" -; 0x9033b - -HangUp_BoopOff: ; 9033b +HangUp_BoopOff: call SpeechTextBox ret -; 9033f -Phone_StartRinging: ; 9033f +Phone_StartRinging: call WaitSFX ld de, SFX_CALL call PlaySFX @@ -599,9 +565,8 @@ Phone_StartRinging: ; 9033f call UpdateSprites farcall PhoneRing_CopyTilemapAtOnce ret -; 90355 -HangUp_Wait20Frames: ; 90355 +HangUp_Wait20Frames: jr Phone_Wait20Frames Phone_Wait20Frames: @@ -609,10 +574,8 @@ Phone_Wait20Frames: call DelayFrames farcall PhoneRing_CopyTilemapAtOnce ret -; 90363 - -Function90363: ; 90363 (24:4363) +Function90363: push bc call Phone_CallerTextbox hlcoord 1, 1 @@ -625,17 +588,14 @@ Function90363: ; 90363 (24:4363) call Function90380 ret - -Phone_CallerTextbox: ; 90375 +Phone_CallerTextbox: hlcoord 0, 0 ld b, 2 ld c, SCREEN_WIDTH - 2 call TextBox ret -; 90380 - -Function90380: ; 90380 (24:4380) +Function90380: ld h, d ld l, e ld a, b @@ -643,7 +603,7 @@ Function90380: ; 90380 (24:4380) call GetCallerName ret -CheckCanDeletePhoneNumber: ; 9038a (24:438a) +CheckCanDeletePhoneNumber: ld a, c call GetCallerTrainerClass ld a, c @@ -657,7 +617,7 @@ CheckCanDeletePhoneNumber: ; 9038a (24:438a) ld c, $1 ret -GetCallerTrainerClass: ; 9039a +GetCallerTrainerClass: push hl ld hl, PhoneContacts + PHONE_CONTACT_TRAINER_CLASS ld bc, PHONE_TABLE_WIDTH @@ -667,10 +627,8 @@ GetCallerTrainerClass: ; 9039a ld c, a pop hl ret -; 903a9 - -GetCallerName: ; 903a9 (24:43a9) +GetCallerName: ld a, c and a jr z, .NotTrainer @@ -702,11 +660,10 @@ GetCallerName: ; 903a9 (24:43a9) pop hl call PlaceString ret -; 903d6 (24:43d6) INCLUDE "data/phone/non_trainer_names.asm" -Phone_GetTrainerName: ; 90423 (24:4423) +Phone_GetTrainerName: push hl push bc farcall GetTrainerName @@ -714,7 +671,7 @@ Phone_GetTrainerName: ; 90423 (24:4423) pop hl ret -Phone_GetTrainerClassName: ; 9042e (24:442e) +Phone_GetTrainerClassName: push hl push bc farcall GetTrainerClassName @@ -722,7 +679,7 @@ Phone_GetTrainerClassName: ; 9042e (24:442e) pop hl ret -GetCallerLocation: ; 90439 +GetCallerLocation: ld a, [wCurrentCaller] call GetCallerTrainerClass ld d, c @@ -742,43 +699,34 @@ GetCallerLocation: ; 90439 pop bc pop de ret -; 9045f - INCLUDE "data/phone/phone_contacts.asm" INCLUDE "data/phone/special_calls.asm" - -UnknownScript_0x90657: ; 0x90657 +UnknownScript_0x90657: writetext UnknownText_0x9065b end -; 0x9065b -UnknownText_0x9065b: ; 0x9065b +UnknownText_0x9065b: ; That number is out of the area. text_jump UnknownText_0x1c558b db "@" -; 0x90660 -PhoneScript_JustTalkToThem: ; 0x90660 +PhoneScript_JustTalkToThem: writetext UnknownText_0x90664 end -; 0x90664 -UnknownText_0x90664: ; 0x90664 +UnknownText_0x90664: ; Just go talk to that person! text_jump UnknownText_0x1c55ac db "@" -; 0x90669 -UnknownScript_0x90669: ; 0x90669 +UnknownScript_0x90669: writetext UnknownText_0x9066d end -; 0x9066d -UnknownText_0x9066d: ; 0x9066d +UnknownText_0x9066d: ; Thank you! text_jump UnknownText_0x1c55ca db "@" -; 0x90672 diff --git a/engine/phone/phone_scripts.asm b/engine/phone/phone_scripts.asm index 6a4813634..4296b9023 100644 --- a/engine/phone/phone_scripts.asm +++ b/engine/phone/phone_scripts.asm @@ -1,10 +1,10 @@ -UnusedPhoneScript: ; 0xbcea5 +UnusedPhoneScript: farwritetext UnusedPhoneText end ; Mom -MomPhoneScript: ; 0xbceaa +MomPhoneScript: checkevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST iftrue .bcec5 checkevent EVENT_DUDE_TALKED_TO_YOU @@ -15,7 +15,7 @@ MomPhoneScript: ; 0xbceaa iftrue MomPhoneNoPokedexScript jump MomPhoneNoPokemonScript -.bcec5 ; 0xbcec5 +.bcec5 checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_8 iftrue MomPhoneHangUpScript farwritetext MomPhoneGreetingText @@ -26,12 +26,12 @@ MomPhoneScript: ; 0xbceaa ifequal 2, MomPhonePalette2 jump MomPhoneOther -MomPhoneLandmark: ; 0xbcedf +MomPhoneLandmark: farwritetext MomPhoneLandmarkText buttonsound jump MomSavingMoney -MomPhonePalette1: ; 0xbcee7 +MomPhonePalette1: checkcode VAR_MAPGROUP ifequal GROUP_NEW_BARK_TOWN, .newbark ifequal GROUP_CHERRYGROVE_CITY, .cherrygrove @@ -42,103 +42,103 @@ MomPhonePalette1: ; 0xbcee7 buttonsound jump MomSavingMoney -.newbark ; 0xbcf05 +.newbark farwritetext MomPhoneNewBarkText buttonsound jump MomSavingMoney -.cherrygrove ; 0xbcf0d +.cherrygrove farwritetext MomPhoneCherrygroveText buttonsound jump MomSavingMoney -.violet ; 0xbcf15 +.violet landmarktotext SPROUT_TOWER, MEM_BUFFER_1 jump MomPhoneLandmark -.azalea ; 0xbcf1b +.azalea landmarktotext SLOWPOKE_WELL, MEM_BUFFER_1 jump MomPhoneLandmark -.goldenrod ; 0xbcf21 +.goldenrod landmarktotext RADIO_TOWER, MEM_BUFFER_1 jump MomPhoneLandmark -MomPhonePalette2: ; 0xbcf27 +MomPhonePalette2: farwritetext MomOtherAreaText buttonsound jump MomSavingMoney -MomPhoneOther: ; 0xbcf2f +MomPhoneOther: farwritetext MomDeterminedText buttonsound jump MomSavingMoney -MomSavingMoney: ; 0xbcf37 +MomSavingMoney: checkflag ENGINE_MOM_SAVING_MONEY iffalse .NotSaving checkmoney MOMS_MONEY, 0 ifequal HAVE_MORE, .SavingHasMoney jump .SavingNoMoney -.NotSaving: ; 0xbcf49 +.NotSaving: checkmoney MOMS_MONEY, 0 ifequal HAVE_MORE, .HasMoney jump .NoMoney -.SavingHasMoney: ; 0xbcf55 +.SavingHasMoney: readmoney MOMS_MONEY, MEM_BUFFER_0 farwritetext MomCheckBalanceText yesorno iftrue MomPhoneSaveMoneyScript jump MomPhoneWontSaveMoneyScript -.SavingNoMoney: ; 0xbcf63 +.SavingNoMoney: farwritetext MomImportantToSaveText yesorno iftrue MomPhoneSaveMoneyScript jump MomPhoneWontSaveMoneyScript -.NoMoney: ; 0xbcf6e +.NoMoney: farwritetext MomYoureNotSavingText yesorno iftrue MomPhoneSaveMoneyScript jump MomPhoneWontSaveMoneyScript -.HasMoney: ; 0xbcf79 +.HasMoney: readmoney MOMS_MONEY, MEM_BUFFER_0 farwritetext MomYouveSavedText yesorno iftrue MomPhoneSaveMoneyScript jump MomPhoneWontSaveMoneyScript -MomPhoneSaveMoneyScript: ; 0xbcf87 +MomPhoneSaveMoneyScript: setflag ENGINE_MOM_SAVING_MONEY farwritetext MomOKIllSaveText buttonsound jump MomPhoneHangUpScript -MomPhoneWontSaveMoneyScript: ; 0xbcf92 +MomPhoneWontSaveMoneyScript: clearflag ENGINE_MOM_SAVING_MONEY farwritetext MomPhoneWontSaveMoneyText buttonsound jump MomPhoneHangUpScript -MomPhoneHangUpScript: ; 0xbcf9d +MomPhoneHangUpScript: farwritetext MomPhoneHangUpText end -MomPhoneNoPokemonScript: ; 0xbcfa2 +MomPhoneNoPokemonScript: farwritetext MomPhoneNoPokemonText end -MomPhoneNoPokedexScript: ; 0xbcfa7 +MomPhoneNoPokedexScript: farwritetext MomPhoneNoPokedexText end -MomPhoneNoGymQuestScript: ; 0xbcfac +MomPhoneNoGymQuestScript: farwritetext MomPhoneNoGymQuestText end -MomPhoneLectureScript: ; 0xbcfb1 +MomPhoneLectureScript: setevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST setflag ENGINE_MOM_ACTIVE specialphonecall SPECIALCALL_NONE @@ -149,7 +149,7 @@ MomPhoneLectureScript: ; 0xbcfb1 ; Bill -BillPhoneScript1: ; 0xbcfc5 +BillPhoneScript1: checktime DAY iftrue .daygreet checktime NITE @@ -158,17 +158,17 @@ BillPhoneScript1: ; 0xbcfc5 buttonsound jump .main -.daygreet ; 0xbcfd7 +.daygreet farwritetext BillPhoneDayGreetingText buttonsound jump .main -.nitegreet ; 0xbcfdf +.nitegreet farwritetext BillPhoneNiteGreetingText buttonsound jump .main -.main ; 0xbcfe7 +.main farwritetext BillPhoneGenericText buttonsound checkcode VAR_BOXSPACE @@ -178,22 +178,22 @@ BillPhoneScript1: ; 0xbcfc5 farwritetext BillPhoneNotFullText end -.nearlyfull ; 0xbcffd +.nearlyfull farwritetext BillPhoneNearlyFullText end -.full ; 0xbd002 +.full farwritetext BillPhoneFullText end -BillPhoneScript2: ; 0xbd007 +BillPhoneScript2: farwritetext BillPhoneNewlyFullText waitbutton end ; Elm -ElmPhoneScript1: ; 0xbd00d +ElmPhoneScript1: checkcode VAR_SPECIALPHONECALL ifequal SPECIALCALL_POKERUS, .pokerus checkevent EVENT_SHOWED_TOGEPI_TO_ELM @@ -216,47 +216,47 @@ ElmPhoneScript1: ; 0xbd00d farwritetext ElmPhoneStartText end -.sawmrpokemon ; 0xbd048 +.sawmrpokemon farwritetext ElmPhoneSawMrPokemonText end -.stolen ; 0xbd04d +.stolen farwritetext ElmPhonePokemonStolenText end -.checkingegg ; 0xbd052 +.checkingegg farwritetext ElmPhoneCheckingEggText end -.assistant ; 0xbd057 +.assistant farwritetext ElmPhoneAssistantText end -.eggunhatched ; 0xbd05c +.eggunhatched farwritetext ElmPhoneEggUnhatchedText end -.egghatched ; 0xbd061 +.egghatched farwritetext ElmPhoneEggHatchedText setevent EVENT_TOLD_ELM_ABOUT_TOGEPI_OVER_THE_PHONE end -.discovery ; 0xbd069 +.discovery random 2 ifequal 0, .nextdiscovery farwritetext ElmPhoneDiscovery1Text end -.nextdiscovery ; 0xbd074 +.nextdiscovery farwritetext ElmPhoneDiscovery2Text end -.pokerus ; 0xbd079 +.pokerus farwritetext ElmPhonePokerusText specialphonecall SPECIALCALL_NONE end -ElmPhoneScript2: ; 0xbd081 +ElmPhoneScript2: checkcode VAR_SPECIALPHONECALL ifequal SPECIALCALL_ROBBED, .disaster ifequal SPECIALCALL_ASSISTANT, .assistant @@ -267,34 +267,33 @@ ElmPhoneScript2: ; 0xbd081 specialphonecall SPECIALCALL_NONE end -.disaster ; 0xbd09f +.disaster farwritetext ElmPhoneDisasterText specialphonecall SPECIALCALL_NONE setevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON end -.assistant ; 0xbd0aa +.assistant farwritetext ElmPhoneEggAssistantText specialphonecall SPECIALCALL_NONE clearevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER setevent EVENT_ELMS_AIDE_IN_LAB end -.rocket ; 0xbd0b8 +.rocket farwritetext ElmPhoneRocketText specialphonecall SPECIALCALL_NONE end -.gift ; 0xbd0c0 +.gift farwritetext ElmPhoneGiftText specialphonecall SPECIALCALL_NONE end -.unused ; 0xbd0c8 +.unused farwritetext ElmPhoneUnusedText specialphonecall SPECIALCALL_NONE end -; bd0d0 ; Jack diff --git a/engine/phone/phonering_copytilemapatonce.asm b/engine/phone/phonering_copytilemapatonce.asm index b0d4ffa1e..41f92a5e3 100644 --- a/engine/phone/phonering_copytilemapatonce.asm +++ b/engine/phone/phonering_copytilemapatonce.asm @@ -1,4 +1,4 @@ -PhoneRing_CopyTilemapAtOnce: ; 4d188 +PhoneRing_CopyTilemapAtOnce: ld a, [hCGB] and a jp z, WaitBGMap @@ -41,7 +41,7 @@ PhoneRing_CopyTilemapAtOnce: ; 4d188 ld [hBGMapMode], a ret -.CopyTilemapAtOnce: ; 4d1cb +.CopyTilemapAtOnce: ld [hSPBuffer], sp ld sp, hl ld a, [hBGMapAddress + 1] diff --git a/engine/pokedex/new_pokedex_entry.asm b/engine/pokedex/new_pokedex_entry.asm index 365cf1b70..765f2f576 100644 --- a/engine/pokedex/new_pokedex_entry.asm +++ b/engine/pokedex/new_pokedex_entry.asm @@ -1,4 +1,4 @@ -NewPokedexEntry: ; fb877 +NewPokedexEntry: ld a, [hMapAnims] push af xor a @@ -32,9 +32,8 @@ NewPokedexEntry: ; fb877 pop af ld [hMapAnims], a ret -; fb8c8 -.ReturnFromDexRegistration: ; fb8c8 +.ReturnFromDexRegistration: call ClearTileMap call LoadFontsExtra call LoadStandardFont @@ -49,4 +48,3 @@ NewPokedexEntry: ; fb877 call GetSGBLayout call SetPalettes ret -; fb8f1 diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index 2e36175ab..787645823 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -18,8 +18,7 @@ POKEDEX_SCX EQU 5 GLOBAL POKEDEX_SCX -Pokedex: ; 40000 - +Pokedex: ld a, [hWX] ld l, a ld a, [hWY] @@ -77,7 +76,7 @@ Pokedex: ; 40000 ld [hWY], a ret -InitPokedex: ; 40063 +InitPokedex: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -106,7 +105,7 @@ InitPokedex: ; 40063 call Pokedex_ResetBGMapMode ret -Pokedex_CheckUnlockedUnownMode: ; 400a2 +Pokedex_CheckUnlockedUnownMode: ld a, [wStatusFlags] bit STATUSFLAGS_UNOWN_DEX_F, a jr nz, .unlocked @@ -120,7 +119,7 @@ Pokedex_CheckUnlockedUnownMode: ; 400a2 ld [wUnlockedUnownMode], a ret -Pokedex_InitCursorPosition: ; 400b4 +Pokedex_InitCursorPosition: ld hl, wPokedexOrder ld a, [wPrevDexEntry] and a @@ -162,7 +161,7 @@ Pokedex_InitCursorPosition: ; 400b4 .done ret -Pokedex_GetLandmark: ; 400ed +Pokedex_GetLandmark: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -182,13 +181,13 @@ Pokedex_GetLandmark: ; 400ed ld [wDexCurrentLocation], a ret -Pokedex_RunJumptable: ; 4010b +Pokedex_RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call Pokedex_LoadPointer jp hl -.Jumptable: ; 40115 (10:4115) +.Jumptable: ; entries correspond to DEXSTATE_* constants dw Pokedex_InitMainScreen dw Pokedex_UpdateMainScreen @@ -205,17 +204,17 @@ Pokedex_RunJumptable: ; 4010b dw Pokedex_UpdateUnownMode dw Pokedex_Exit -Pokedex_IncrementDexPointer: ; 40131 (10:4131) +Pokedex_IncrementDexPointer: ld hl, wJumptableIndex inc [hl] ret -Pokedex_Exit: ; 40136 (10:4136) +Pokedex_Exit: ld hl, wJumptableIndex set 7, [hl] ret -Pokedex_InitMainScreen: ; 4013c (10:413c) +Pokedex_InitMainScreen: xor a ld [hBGMapMode], a call ClearSprites @@ -263,7 +262,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateMainScreen: ; 401ae (10:41ae) +Pokedex_UpdateMainScreen: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -324,7 +323,7 @@ Pokedex_UpdateMainScreen: ; 401ae (10:41ae) ld [wJumptableIndex], a ret -Pokedex_InitDexEntryScreen: ; 40217 (10:4217) +Pokedex_InitDexEntryScreen: call LowVolume xor a ; page 1 ld [wPokedexStatus], a @@ -350,7 +349,7 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) +Pokedex_UpdateDexEntryScreen: ld de, DexEntryScreen_ArrowCursorData call Pokedex_MoveArrowCursor ld hl, hJoyPressed @@ -384,7 +383,7 @@ Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) ld [wJumptableIndex], a ret -Pokedex_Page: ; 40292 +Pokedex_Page: ld a, [wPokedexStatus] xor 1 ; toggle page ld [wPokedexStatus], a @@ -394,7 +393,7 @@ Pokedex_Page: ; 40292 call WaitBGMap ret -Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) +Pokedex_ReinitDexEntryScreen: ; Reinitialize the Pokédex entry screen after changing the selected mon. call Pokedex_BlackOutBG xor a ; page 1 @@ -420,21 +419,20 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) dec [hl] ret -DexEntryScreen_ArrowCursorData: ; 402e8 +DexEntryScreen_ArrowCursorData: db D_RIGHT | D_LEFT, 4 dwcoord 1, 17 ; PAGE dwcoord 6, 17 ; AREA dwcoord 11, 17 ; CRY dwcoord 15, 17 ; PRNT - -DexEntryScreen_MenuActionJumptable: ; 402f2 +DexEntryScreen_MenuActionJumptable: dw Pokedex_Page dw .Area dw .Cry dw .Print -.Area: ; 402fa +.Area: call Pokedex_BlackOutBG xor a ld [hSCX], a @@ -465,7 +463,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_GetSGBLayout ret -.Cry: ; 40340 +.Cry: call Pokedex_GetSelectedMon ld a, [wd265] call GetCryIndex @@ -474,7 +472,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call PlayCry ret -.Print: ; 4034f +.Print: call Pokedex_ApplyPrintPals xor a ld [hSCX], a @@ -502,14 +500,14 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_ApplyUsualPals ret -Pokedex_RedisplayDexEntry: ; 4038d +Pokedex_RedisplayDexEntry: call Pokedex_DrawDexEntryScreenBG call Pokedex_GetSelectedMon farcall DisplayDexEntry call Pokedex_DrawFootprint ret -Pokedex_InitOptionScreen: ; 4039d (10:439d) +Pokedex_InitOptionScreen: xor a ld [hBGMapMode], a call ClearSprites @@ -524,7 +522,7 @@ Pokedex_InitOptionScreen: ; 4039d (10:439d) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateOptionScreen: ; 403be (10:43be) +Pokedex_UpdateOptionScreen: ld a, [wUnlockedUnownMode] and a jr nz, .okay @@ -556,37 +554,37 @@ Pokedex_UpdateOptionScreen: ; 403be (10:43be) ld [wJumptableIndex], a ret -.NoUnownModeArrowCursorData: ; 403f3 +.NoUnownModeArrowCursorData: db D_UP | D_DOWN, 3 dwcoord 2, 4 ; NEW dwcoord 2, 6 ; OLD dwcoord 2, 8 ; ABC -.ArrowCursorData: ; 403fb +.ArrowCursorData: db D_UP | D_DOWN, 4 dwcoord 2, 4 ; NEW dwcoord 2, 6 ; OLD dwcoord 2, 8 ; ABC dwcoord 2, 10 ; UNOWN -.MenuActionJumptable: ; 40405 (10:4405) +.MenuActionJumptable: dw .MenuAction_NewMode dw .MenuAction_OldMode dw .MenuAction_ABCMode dw .MenuAction_UnownMode -.MenuAction_NewMode: ; 4040d (10:440d) +.MenuAction_NewMode: ld b, DEXMODE_NEW jr .ChangeMode -.MenuAction_OldMode: ; 40411 (10:4411) +.MenuAction_OldMode: ld b, DEXMODE_OLD jr .ChangeMode -.MenuAction_ABCMode: ; 40415 (10:4415) +.MenuAction_ABCMode: ld b, DEXMODE_ABC -.ChangeMode: ; 40417 (10:4417) +.ChangeMode: ld a, [wCurrentDexMode] cp b jr z, .skip_changing_mode ; Skip if new mode is same as current. @@ -606,13 +604,13 @@ Pokedex_UpdateOptionScreen: ; 403be (10:43be) ld [wJumptableIndex], a ret -.MenuAction_UnownMode: ; 4043a (10:443a) +.MenuAction_UnownMode: call Pokedex_BlackOutBG ld a, DEXSTATE_UNOWN_MODE ld [wJumptableIndex], a ret -Pokedex_InitSearchScreen: ; 40443 (10:4443) +Pokedex_InitSearchScreen: xor a ld [hBGMapMode], a call ClearSprites @@ -632,7 +630,7 @@ Pokedex_InitSearchScreen: ; 40443 (10:4443) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateSearchScreen: ; 40471 (10:4471) +Pokedex_UpdateSearchScreen: ld de, .ArrowCursorData call Pokedex_MoveArrowCursor call Pokedex_UpdateSearchMonType @@ -658,25 +656,25 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) ld [wJumptableIndex], a ret -.ArrowCursorData: ; 4049e +.ArrowCursorData: db D_UP | D_DOWN, 4 dwcoord 2, 4 ; TYPE 1 dwcoord 2, 6 ; TYPE 2 dwcoord 2, 13 ; BEGIN SEARCH dwcoord 2, 15 ; CANCEL -.MenuActionJumptable: ; 404a8 +.MenuActionJumptable: dw .MenuAction_MonSearchType dw .MenuAction_MonSearchType dw .MenuAction_BeginSearch dw .MenuAction_Cancel -.MenuAction_MonSearchType: ; 404b0 +.MenuAction_MonSearchType: call Pokedex_NextSearchMonType call Pokedex_PlaceSearchScreenTypeStrings ret -.MenuAction_BeginSearch: ; 404b7 +.MenuAction_BeginSearch: call Pokedex_SearchForMons farcall AnimateDexSearchSlowpoke ld a, [wDexSearchResultCount] @@ -710,13 +708,13 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) ld [wJumptableIndex], a ret -.MenuAction_Cancel: ; 40501 +.MenuAction_Cancel: call Pokedex_BlackOutBG ld a, DEXSTATE_MAIN_SCR ld [wJumptableIndex], a ret -Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) +Pokedex_InitSearchResultsScreen: xor a ld [hBGMapMode], a xor a @@ -751,7 +749,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) +Pokedex_UpdateSearchResultsScreen: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -797,7 +795,7 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ld [hWX], a ret -Pokedex_InitUnownMode: ; 405bd (10:45bd) +Pokedex_InitUnownMode: call Pokedex_LoadUnownFont call Pokedex_DrawUnownModeBG xor a @@ -811,7 +809,7 @@ Pokedex_InitUnownMode: ; 405bd (10:45bd) call Pokedex_IncrementDexPointer ret -Pokedex_UpdateUnownMode: ; 405df (10:45df) +Pokedex_UpdateUnownMode: ld hl, hJoyPressed ld a, [hl] and A_BUTTON | B_BUTTON @@ -838,7 +836,7 @@ Pokedex_UpdateUnownMode: ; 405df (10:45df) .done ret -Pokedex_UnownModeHandleDPadInput: ; 40610 (10:4610) +Pokedex_UnownModeHandleDPadInput: ld hl, hJoyLast ld a, [hl] and D_RIGHT @@ -883,15 +881,15 @@ Pokedex_UnownModeHandleDPadInput: ; 40610 (10:4610) call DelayFrame ret -Pokedex_UnownModeEraseCursor: ; 40654 (10:4654) +Pokedex_UnownModeEraseCursor: ld c, " " jr Pokedex_UnownModeUpdateCursorGfx -Pokedex_UnownModePlaceCursor: ; 40658 (10:4658) +Pokedex_UnownModePlaceCursor: ld a, [wDexCurrentUnownIndex] ld c, $5a ; diamond cursor -Pokedex_UnownModeUpdateCursorGfx: ; 4065d (10:465d) +Pokedex_UnownModeUpdateCursorGfx: ld e, a ld d, 0 ld hl, UnownModeLetterAndCursorCoords + 2 @@ -904,7 +902,7 @@ endr ld [hl], c ret -Pokedex_NextOrPreviousDexEntry: ; 4066c (10:466c) +Pokedex_NextOrPreviousDexEntry: ld a, [wDexListingCursor] ld [wBackupDexListingCursor], a ld a, [wDexListingScrollOffset] @@ -955,7 +953,7 @@ Pokedex_NextOrPreviousDexEntry: ; 4066c (10:466c) and a ret -Pokedex_ListingHandleDPadInput: ; 406c5 (10:46c5) +Pokedex_ListingHandleDPadInput: ; Handles D-pad input for a list of Pokémon. ld a, [wDexListingHeight] ld d, a @@ -979,7 +977,7 @@ Pokedex_ListingHandleDPadInput: ; 406c5 (10:46c5) jr nz, Pokedex_ListingMoveDownOnePage jr Pokedex_ListingPosStayedSame -Pokedex_ListingMoveCursorUp: ; 406ea (10:46ea) +Pokedex_ListingMoveCursorUp: ld hl, wDexListingCursor ld a, [hl] and a @@ -994,7 +992,7 @@ Pokedex_ListingMoveCursorUp: ; 406ea (10:46ea) dec [hl] jr Pokedex_ListingPosChanged -Pokedex_ListingMoveCursorDown: ; 406fe (10:46fe) +Pokedex_ListingMoveCursorDown: ld hl, wDexListingCursor ld a, [hl] inc a @@ -1012,7 +1010,7 @@ Pokedex_ListingMoveCursorDown: ; 406fe (10:46fe) inc [hl] jr Pokedex_ListingPosChanged -Pokedex_ListingMoveUpOnePage: ; 40716 (10:4716) +Pokedex_ListingMoveUpOnePage: ld hl, wDexListingScrollOffset ld a, [hl] and a @@ -1028,7 +1026,7 @@ Pokedex_ListingMoveUpOnePage: ; 40716 (10:4716) ld [hl], a jr Pokedex_ListingPosChanged -Pokedex_ListingMoveDownOnePage: ; 40728 (10:4728) +Pokedex_ListingMoveDownOnePage: ; When moving down a page, the return value always report a change in position. ld hl, wDexListingScrollOffset ld a, d @@ -1048,15 +1046,15 @@ Pokedex_ListingMoveDownOnePage: ; 40728 (10:4728) ld [hl], a jr Pokedex_ListingPosChanged -Pokedex_ListingPosStayedSame: ; 4073d (10:473d) +Pokedex_ListingPosStayedSame: and a ret -Pokedex_ListingPosChanged: ; 4073f (10:473f) +Pokedex_ListingPosChanged: scf ret -Pokedex_FillColumn: ; 40741 +Pokedex_FillColumn: ; Fills a column starting at HL, going downwards. ; B is the height of the column and A is the tile it's filled with. push de @@ -1069,8 +1067,7 @@ Pokedex_FillColumn: ; 40741 pop de ret - -Pokedex_DrawMainScreenBG: ; 4074c (10:474c) +Pokedex_DrawMainScreenBG: ; Draws the left sidebar and the bottom bar on the main screen. hlcoord 0, 17 ld de, String_START_SEARCH @@ -1127,17 +1124,17 @@ Pokedex_DrawMainScreenBG: ; 4074c (10:474c) call Pokedex_PlaceFrontpicTopLeftCorner ret -String_SEEN: ; 407e1 +String_SEEN: db "SEEN", -1 -String_OWN: ; 407e6 +String_OWN: db "OWN", -1 -String_SELECT_OPTION: ; 407ea +String_SELECT_OPTION: db $3b, $48, $49, $4a, $44, $45, $46, $47 ; SELECT > OPTION ; fallthrough -String_START_SEARCH: ; 407f2 +String_START_SEARCH: db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, -1 ; START > SEARCH -Pokedex_DrawDexEntryScreenBG: ; 407fd +Pokedex_DrawDexEntryScreenBG: call Pokedex_FillBackgroundColor2 hlcoord 0, 0 lb bc, 15, 18 @@ -1169,16 +1166,16 @@ Pokedex_DrawDexEntryScreenBG: ; 407fd call Pokedex_PlaceFrontpicTopLeftCorner ret -.Unused: ; 4084f +.Unused: db $5c, $5d, -1 ; No. -.Height: ; 40852 +.Height: db "HT ?", $5e, "??", $5f, -1 ; HT ?'??" -.Weight: ; 4085c +.Weight: db "WT ???lb", -1 ; WT ???lb -.MenuItems: ; 40867 +.MenuItems: db $3b, " PAGE AREA CRY PRNT", -1 -Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) +Pokedex_DrawOptionScreenBG: call Pokedex_FillBackgroundColor2 hlcoord 0, 2 lb bc, 8, 18 @@ -1200,19 +1197,19 @@ Pokedex_DrawOptionScreenBG: ; 4087c (10:487c) call PlaceString ret -.Title: ; 408b2 +.Title: db $3b, " OPTION ", $3c, -1 -.Modes: ; 408bd +.Modes: db "NEW #DEX MODE" next "OLD #DEX MODE" next "A to Z MODE" db "@" -.UnownMode: ; 408e5 +.UnownMode: db "UNOWN MODE@" -Pokedex_DrawSearchScreenBG: ; 408f0 (10:48f0) +Pokedex_DrawSearchScreenBG: call Pokedex_FillBackgroundColor2 hlcoord 0, 2 lb bc, 14, 18 @@ -1234,23 +1231,23 @@ Pokedex_DrawSearchScreenBG: ; 408f0 (10:48f0) call PlaceString ret -.Title: ; 4092a +.Title: db $3b, " SEARCH ", $3c, -1 -.TypeLeftRightArrows: ; 40935 +.TypeLeftRightArrows: db $3d, " ", $3e, -1 -.Types: ; 40940 +.Types: db "TYPE1" next "TYPE2" db "@" -.Menu: ; 4094c +.Menu: db "BEGIN SEARCH!!" next "CANCEL" db "@" -Pokedex_DrawSearchResultsScreenBG: ; 40962 (10:4962) +Pokedex_DrawSearchResultsScreenBG: call Pokedex_FillBackgroundColor2 hlcoord 0, 0 lb bc, 7, 7 @@ -1280,13 +1277,13 @@ Pokedex_DrawSearchResultsScreenBG: ; 40962 (10:4962) call Pokedex_PlaceFrontpicTopLeftCorner ret -.BottomWindowText: ; 409ae +.BottomWindowText: db "SEARCH RESULTS" next " TYPE" next " FOUND!" db "@" -Pokedex_PlaceSearchResultsTypeStrings: ; 409cf (10:49cf) +Pokedex_PlaceSearchResultsTypeStrings: ld a, [wDexSearchMonType1] hlcoord 0, 14 call Pokedex_PlaceTypeString @@ -1304,7 +1301,7 @@ Pokedex_PlaceSearchResultsTypeStrings: ; 409cf (10:49cf) .done ret -Pokedex_DrawUnownModeBG: ; 409f1 (10:49f1) +Pokedex_DrawUnownModeBG: call Pokedex_FillBackgroundColor2 hlcoord 2, 1 lb bc, 10, 13 @@ -1320,7 +1317,7 @@ Pokedex_DrawUnownModeBG: ; 409f1 (10:49f1) call Pokedex_PlaceFrontpicAtHL ld de, 0 ld b, 0 - ld c, 26 + ld c, NUM_UNOWN .loop ld hl, wUnownDex add hl, de @@ -1347,7 +1344,7 @@ endr ld [wDexUnownCount], a ret -UnownModeLetterAndCursorCoords: ; 40a3e +UnownModeLetterAndCursorCoords: ; entries correspond to Unown forms ; letter, cursor dwcoord 4,11, 3,11 ; A @@ -1377,16 +1374,16 @@ UnownModeLetterAndCursorCoords: ; 40a3e dwcoord 14, 9, 15, 9 ; Y dwcoord 14,10, 15,10 ; Z -Pokedex_FillBackgroundColor2: ; 40aa6 +Pokedex_FillBackgroundColor2: hlcoord 0, 0 ld a, $32 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill ret -Pokedex_PlaceFrontpicTopLeftCorner: ; 40ab2 +Pokedex_PlaceFrontpicTopLeftCorner: hlcoord 1, 1 -Pokedex_PlaceFrontpicAtHL: ; 40ab5 +Pokedex_PlaceFrontpicAtHL: xor a ld b, $7 .row @@ -1407,7 +1404,7 @@ Pokedex_PlaceFrontpicAtHL: ; 40ab5 jr nz, .row ret -Pokedex_PlaceString: ; 40acd +Pokedex_PlaceString: .loop ld a, [de] cp -1 @@ -1416,8 +1413,7 @@ Pokedex_PlaceString: ; 40acd ld [hli], a jr .loop - -Pokedex_PlaceBorder: ; 40ad5 +Pokedex_PlaceBorder: push hl ld a, $33 ld [hli], a @@ -1449,7 +1445,7 @@ Pokedex_PlaceBorder: ; 40ad5 ld [hl], a ret -.FillRow: ; 40b06 +.FillRow: ld e, c .row_loop ld a, e @@ -1460,8 +1456,7 @@ Pokedex_PlaceBorder: ; 40ad5 dec e jr .row_loop - -Pokedex_PrintListing: ; 40b0f (10:4b0f) +Pokedex_PrintListing: ; Prints the list of Pokémon on the main Pokédex screen. ; This check is completely useless. @@ -1512,7 +1507,7 @@ Pokedex_PrintListing: ; 40b0f (10:4b0f) call Pokedex_LoadSelectedMonTiles ret -.PrintEntry: ; 40b55 (10:4b55) +.PrintEntry: ; Prints one entry in the list of Pokémon on the main Pokédex screen. and a ret z @@ -1526,7 +1521,7 @@ Pokedex_PrintListing: ; 40b0f (10:4b0f) call PlaceString ret -Pokedex_PrintNumberIfOldMode: ; 40b6a (10:4b6a) +Pokedex_PrintNumberIfOldMode: ld a, [wCurrentDexMode] cp DEXMODE_OLD jr z, .printnum @@ -1542,7 +1537,7 @@ Pokedex_PrintNumberIfOldMode: ; 40b6a (10:4b6a) pop hl ret -Pokedex_PlaceCaughtSymbolIfCaught: ; 40b82 (10:4b82) +Pokedex_PlaceCaughtSymbolIfCaught: call Pokedex_CheckCaught jr nz, .place_caught_symbol inc hl @@ -1553,7 +1548,7 @@ Pokedex_PlaceCaughtSymbolIfCaught: ; 40b82 (10:4b82) ld [hli], a ret -Pokedex_PlaceDefaultStringIfNotSeen: ; 40b8d (10:4b8d) +Pokedex_PlaceDefaultStringIfNotSeen: call Pokedex_CheckSeen ret nz inc hl @@ -1562,10 +1557,10 @@ Pokedex_PlaceDefaultStringIfNotSeen: ; 40b8d (10:4b8d) scf ret -.NameNotSeen: ; 40b9a +.NameNotSeen: db "-----@" -Pokedex_DrawFootprint: ; 40ba0 +Pokedex_DrawFootprint: hlcoord 18, 1 ld a, $62 ld [hli], a @@ -1578,8 +1573,7 @@ Pokedex_DrawFootprint: ; 40ba0 ld [hl], a ret - -Pokedex_GetSelectedMon: ; 40bb1 +Pokedex_GetSelectedMon: ; Gets the species of the currently selected Pokémon. This corresponds to the ; position of the cursor in the main listing, but this function can be used ; on all Pokédex screens. @@ -1594,8 +1588,7 @@ Pokedex_GetSelectedMon: ; 40bb1 ld [wd265], a ret - -Pokedex_CheckCaught: ; 40bc4 (10:4bc4) +Pokedex_CheckCaught: push de push hl ld a, [wd265] @@ -1605,8 +1598,7 @@ Pokedex_CheckCaught: ; 40bc4 (10:4bc4) pop de ret - -Pokedex_CheckSeen: ; 40bd0 +Pokedex_CheckSeen: push de push hl ld a, [wd265] @@ -1616,9 +1608,7 @@ Pokedex_CheckSeen: ; 40bd0 pop de ret - - -Pokedex_OrderMonsByMode: ; 40bdc +Pokedex_OrderMonsByMode: ld hl, wPokedexOrder ld bc, wPokedexOrderEnd - wPokedexOrder xor a @@ -1628,12 +1618,12 @@ Pokedex_OrderMonsByMode: ; 40bdc call Pokedex_LoadPointer jp hl -.Jumptable: ; 40bf0 (10:4bf0) +.Jumptable: dw .NewMode dw .OldMode dw Pokedex_ABCMode -.NewMode: ; 40bf6 (10:4bf6) +.NewMode: ld de, NewPokedexOrder ld hl, wPokedexOrder ld c, NUM_POKEMON @@ -1646,7 +1636,7 @@ Pokedex_OrderMonsByMode: ; 40bdc call .FindLastSeen ret -.OldMode: ; 40c08 (10:4c08) +.OldMode: ld hl, wPokedexOrder ld a, $1 ld c, NUM_POKEMON @@ -1658,7 +1648,7 @@ Pokedex_OrderMonsByMode: ; 40bdc call .FindLastSeen ret -.FindLastSeen: ; 40c18 (10:4c18) +.FindLastSeen: ld hl, wPokedexOrder + NUM_POKEMON - 1 ld d, NUM_POKEMON ld e, d @@ -1675,7 +1665,7 @@ Pokedex_OrderMonsByMode: ; 40bdc ld [wDexListingEnd], a ret -Pokedex_ABCMode: ; 40c30 +Pokedex_ABCMode: xor a ld [wDexListingEnd], a ld hl, wPokedexOrder @@ -1711,13 +1701,11 @@ Pokedex_ABCMode: ; 40c30 .doneabc ret - INCLUDE "data/pokemon/dex_order_alpha.asm" INCLUDE "data/pokemon/dex_order_new.asm" - -Pokedex_DisplayModeDescription: ; 40e5b +Pokedex_DisplayModeDescription: xor a ld [hBGMapMode], a hlcoord 0, 12 @@ -1734,29 +1722,29 @@ Pokedex_DisplayModeDescription: ; 40e5b ld [hBGMapMode], a ret -.Modes: ; 40e7d +.Modes: dw .NewMode dw .OldMode dw .ABCMode dw .UnownMode -.NewMode: ; 40e85 +.NewMode: db "<PK><MN> are listed by" next "evolution type.@" -.OldMode: ; 40ea6 +.OldMode: db "<PK><MN> are listed by" next "official type.@" -.ABCMode: ; 40ec6 +.ABCMode: db "<PK><MN> are listed" next "alphabetically.@" -.UnownMode: ; 40ee4 +.UnownMode: db "UNOWN are listed" next "in catching order.@" -Pokedex_DisplayChangingModesMessage: ; 40f08 (10:4f08) +Pokedex_DisplayChangingModesMessage: xor a ld [hBGMapMode], a hlcoord 0, 12 @@ -1775,11 +1763,11 @@ Pokedex_DisplayChangingModesMessage: ; 40f08 (10:4f08) call DelayFrames ret -String_ChangingModesPleaseWait: ; 40f32 +String_ChangingModesPleaseWait: db "Changing modes." next "Please wait.@" -Pokedex_UpdateSearchMonType: ; 40f4f (10:4f4f) +Pokedex_UpdateSearchMonType: ld a, [wDexArrowCursorPosIndex] cp 2 jr nc, .no_change @@ -1794,7 +1782,7 @@ Pokedex_UpdateSearchMonType: ; 40f4f (10:4f4f) and a ret -Pokedex_PrevSearchMonType: ; 40f65 +Pokedex_PrevSearchMonType: ld a, [wDexArrowCursorPosIndex] and a jr nz, .type2 @@ -1821,7 +1809,7 @@ Pokedex_PrevSearchMonType: ; 40f65 scf ret -Pokedex_NextSearchMonType: ; 40f84 +Pokedex_NextSearchMonType: ld a, [wDexArrowCursorPosIndex] and a jr nz, .type2 @@ -1850,7 +1838,7 @@ Pokedex_NextSearchMonType: ; 40f84 scf ret -Pokedex_PlaceSearchScreenTypeStrings: ; 40fa8 (10:4fa8) +Pokedex_PlaceSearchScreenTypeStrings: xor a ld [hBGMapMode], a hlcoord 9, 3 @@ -1867,7 +1855,7 @@ Pokedex_PlaceSearchScreenTypeStrings: ; 40fa8 (10:4fa8) ld [hBGMapMode], a ret -Pokedex_PlaceTypeString: ; 40fcd (10:4fcd) +Pokedex_PlaceTypeString: push hl ld e, a ld d, 0 @@ -1883,7 +1871,7 @@ endr INCLUDE "data/types/search_strings.asm" -Pokedex_SearchForMons: ; 41086 +Pokedex_SearchForMons: ld a, [wDexSearchMonType2] and a call nz, .Search @@ -1892,7 +1880,7 @@ Pokedex_SearchForMons: ; 41086 call nz, .Search ret -.Search: ; 41095 +.Search: dec a ld e, a ld d, 0 @@ -1960,7 +1948,7 @@ Pokedex_SearchForMons: ; 41086 INCLUDE "data/types/search_types.asm" -Pokedex_DisplayTypeNotFoundMessage: ; 41107 +Pokedex_DisplayTypeNotFoundMessage: xor a ld [hBGMapMode], a hlcoord 0, 12 @@ -1975,11 +1963,11 @@ Pokedex_DisplayTypeNotFoundMessage: ; 41107 call DelayFrames ret -.TypeNotFound: ; 41126 +.TypeNotFound: db "The specified type" next "was not found.@" -Pokedex_UpdateCursorOAM: ; 41148 (10:5148) +Pokedex_UpdateCursorOAM: ld a, [wCurrentDexMode] cp DEXMODE_OLD jp z, Pokedex_PutOldModeCursorOAM @@ -1987,7 +1975,7 @@ Pokedex_UpdateCursorOAM: ; 41148 (10:5148) call Pokedex_PutScrollbarOAM ret -Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) +Pokedex_PutOldModeCursorOAM: ld hl, .CursorOAM ld a, [wDexListingCursor] or a @@ -1997,7 +1985,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) call Pokedex_LoadCursorOAM ret -.CursorOAM: ; 41167 +.CursorOAM: dsprite 3, 0, 9, -1, $30, 7 dsprite 2, 0, 9, -1, $31, 7 dsprite 2, 0, 10, -1, $32, 7 @@ -2024,7 +2012,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP db -1 -.CursorAtTopOAM: ; 411c8 +.CursorAtTopOAM: ; OAM data for when the cursor is at the top of the list. The tiles at the top ; are cut off so they don't show up outside the list area. dsprite 3, 0, 9, -1, $30, 7 @@ -2053,12 +2041,12 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157) dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP db -1 -Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) +Pokedex_PutNewModeABCModeCursorOAM: ld hl, .CursorOAM call Pokedex_LoadCursorOAM ret -.CursorOAM: ; 41230 +.CursorOAM: dsprite 3, 3, 9, -1, $30, 7 dsprite 2, 3, 9, -1, $31, 7 dsprite 2, 3, 10, -1, $32, 7 @@ -2081,7 +2069,7 @@ Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP db -1 -Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) +Pokedex_UpdateSearchResultsCursorOAM: ld a, [wCurrentDexMode] cp DEXMODE_OLD jp z, Pokedex_PutOldModeCursorOAM @@ -2089,7 +2077,7 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) call Pokedex_LoadCursorOAM ret -.CursorOAM: ; 41290 +.CursorOAM: dsprite 3, 3, 9, -1, $30, 7 dsprite 2, 3, 9, -1, $31, 7 dsprite 2, 3, 10, -1, $32, 7 @@ -2116,7 +2104,7 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP db -1 -Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) +Pokedex_LoadCursorOAM: ld de, wVirtualOAMSprite00 .loop ld a, [hl] @@ -2140,7 +2128,7 @@ Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) inc de jr .loop -Pokedex_PutScrollbarOAM: ; 4130e (10:530e) +Pokedex_PutScrollbarOAM: ; Writes the OAM data for the scrollbar in the new mode and ABC mode. push de ld a, [wDexListingEnd] @@ -2186,14 +2174,14 @@ Pokedex_PutScrollbarOAM: ; 4130e (10:530e) ld [hl], $0 ret -Pokedex_InitArrowCursor: ; 4134f (10:534f) +Pokedex_InitArrowCursor: xor a ld [wDexArrowCursorPosIndex], a ld [wDexArrowCursorDelayCounter], a ld [wDexArrowCursorBlinkCounter], a ret -Pokedex_MoveArrowCursor: ; 4135a (10:535a) +Pokedex_MoveArrowCursor: ; bc = [de] - 1 ld a, [de] ld b, a @@ -2275,7 +2263,7 @@ Pokedex_MoveArrowCursor: ; 4135a (10:535a) ld [wDexArrowCursorPosIndex], a jr .update_cursor_pos -Pokedex_GetArrowCursorPos: ; 413d4 (10:53d4) +Pokedex_GetArrowCursorPos: ld a, [wDexArrowCursorPosIndex] add a ld l, a @@ -2286,7 +2274,7 @@ Pokedex_GetArrowCursorPos: ; 413d4 (10:53d4) ld l, a ret -Pokedex_BlinkArrowCursor: ; 413e0 (10:53e0) +Pokedex_BlinkArrowCursor: ld hl, wDexArrowCursorBlinkCounter ld a, [hl] inc [hl] @@ -2301,7 +2289,7 @@ Pokedex_BlinkArrowCursor: ; 413e0 (10:53e0) ld [hl], "▶" ret -Pokedex_ArrowCursorDelay: ; 413f5 (10:53f5) +Pokedex_ArrowCursorDelay: ; Updates the delay counter set when moving the arrow cursor. ; Returns whether the delay is active in carry. ld hl, wDexArrowCursorDelayCounter @@ -2313,10 +2301,10 @@ Pokedex_ArrowCursorDelay: ; 413f5 (10:53f5) scf ret -Pokedex_FillBox: ; 413fe (10:53fe) +Pokedex_FillBox: jp FillBoxWithByte -Pokedex_BlackOutBG: ; 41401 (10:5401) +Pokedex_BlackOutBG: ; Make BG palettes black so that the BG becomes all black. ld a, [rSVBK] push af @@ -2329,7 +2317,7 @@ Pokedex_BlackOutBG: ; 41401 (10:5401) pop af ld [rSVBK], a -Pokedex_ApplyPrintPals: ; 41415 +Pokedex_ApplyPrintPals: ld a, $ff call DmgToCgbBGPals ld a, $ff @@ -2337,11 +2325,11 @@ Pokedex_ApplyPrintPals: ; 41415 call DelayFrame ret -Pokedex_GetSGBLayout: ; 41423 +Pokedex_GetSGBLayout: ld b, a call GetSGBLayout -Pokedex_ApplyUsualPals: ; 41427 +Pokedex_ApplyUsualPals: ; This applies the palettes used for most Pokédex screens. ld a, $e4 call DmgToCgbBGPals @@ -2349,8 +2337,7 @@ Pokedex_ApplyUsualPals: ; 41427 call DmgToCgbObjPal0 ret - -Pokedex_LoadPointer: ; 41432 +Pokedex_LoadPointer: ld e, a ld d, 0 add hl, de @@ -2360,7 +2347,7 @@ Pokedex_LoadPointer: ; 41432 ld l, a ret -Pokedex_LoadSelectedMonTiles: ; 4143b +Pokedex_LoadSelectedMonTiles: ; Loads the tiles of the currently selected Pokémon. call Pokedex_GetSelectedMon call Pokedex_CheckSeen @@ -2387,11 +2374,10 @@ Pokedex_LoadSelectedMonTiles: ; 4143b call CloseSRAM ret - -Pokedex_LoadCurrentFootprint: ; 41478 (10:5478) +Pokedex_LoadCurrentFootprint: call Pokedex_GetSelectedMon -Pokedex_LoadAnyFootprint: ; 4147b +Pokedex_LoadAnyFootprint: ld a, [wd265] dec a and %11111000 @@ -2431,8 +2417,7 @@ Pokedex_LoadAnyFootprint: ; 4147b ret - -Pokedex_LoadGFX: ; 414b7 +Pokedex_LoadGFX: call DisableLCD ld hl, vTiles2 ld bc, $31 tiles @@ -2462,12 +2447,12 @@ Pokedex_LoadGFX: ; 414b7 call EnableLCD ret -Pokedex_LoadInvertedFont: ; 414fb +Pokedex_LoadInvertedFont: call LoadStandardFont ld hl, vTiles1 ld bc, $80 tiles -Pokedex_InvertTiles: ; 41504 +Pokedex_InvertTiles: .loop ld a, [hl] xor $ff @@ -2478,13 +2463,13 @@ Pokedex_InvertTiles: ; 41504 jr nz, .loop ret -PokedexLZ: ; 4150e +PokedexLZ: INCBIN "gfx/pokedex/pokedex.2bpp.lz" -PokedexSlowpokeLZ: ; 416b0 +PokedexSlowpokeLZ: INCBIN "gfx/pokedex/slowpoke.2bpp.lz" -Pokedex_CheckSGB: ; 41a24 +Pokedex_CheckSGB: ld a, [hCGB] or a ret nz @@ -2492,7 +2477,7 @@ Pokedex_CheckSGB: ; 41a24 dec a ret -Pokedex_LoadUnownFont: ; 41a2c +Pokedex_LoadUnownFont: ld a, BANK(sScratch) call GetSRAMBank ld hl, UnownFont @@ -2501,16 +2486,16 @@ Pokedex_LoadUnownFont: ; 41a2c ld a, BANK(UnownFont) call FarCopyBytes ld hl, sScratch + $188 - ld bc, 27 tiles + ld bc, (NUM_UNOWN + 1) tiles call Pokedex_InvertTiles ld de, sScratch + $188 ld hl, vTiles2 tile $40 - lb bc, BANK(Pokedex_LoadUnownFont), 27 + lb bc, BANK(Pokedex_LoadUnownFont), NUM_UNOWN + 1 call Request2bpp call CloseSRAM ret -Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) +Pokedex_LoadUnownFrontpicTiles: ld a, [wUnownLetter] push af ld a, [wDexCurrentUnownIndex] @@ -2529,7 +2514,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) ld [wUnownLetter], a ret -_NewPokedexEntry: ; 41a7f +_NewPokedexEntry: xor a ld [hBGMapMode], a farcall DrawDexEntryScreenRightEdge @@ -2561,22 +2546,21 @@ _NewPokedexEntry: ; 41a7f call PlayMonCry ret - -Pokedex_SetBGMapMode3: ; 41ad7 (10:5ad7) +Pokedex_SetBGMapMode3: ld a, $3 ld [hBGMapMode], a ld c, 4 call DelayFrames ret -Pokedex_SetBGMapMode4: ; 41ae1 (10:5ae1) +Pokedex_SetBGMapMode4: ld a, $4 ld [hBGMapMode], a ld c, 4 call DelayFrames ret -Pokedex_SetBGMapMode_3ifDMG_4ifCGB: ; 41aeb (10:5aeb) +Pokedex_SetBGMapMode_3ifDMG_4ifCGB: ld a, [hCGB] and a jr z, .DMG @@ -2585,8 +2569,7 @@ Pokedex_SetBGMapMode_3ifDMG_4ifCGB: ; 41aeb (10:5aeb) call Pokedex_SetBGMapMode3 ret - -Pokedex_ResetBGMapMode: ; 41af7 +Pokedex_ResetBGMapMode: xor a ld [hBGMapMode], a ret diff --git a/engine/pokedex/pokedex_2.asm b/engine/pokedex/pokedex_2.asm index b17832216..8105a080a 100644 --- a/engine/pokedex/pokedex_2.asm +++ b/engine/pokedex/pokedex_2.asm @@ -1,4 +1,4 @@ -AnimateDexSearchSlowpoke: ; 441cf +AnimateDexSearchSlowpoke: ld hl, .FrameIDs ld b, 25 .loop @@ -29,7 +29,7 @@ AnimateDexSearchSlowpoke: ; 441cf call DelayFrames ret -.FrameIDs: ; 441fc +.FrameIDs: ; frame ID, duration db 0, 7 db 1, 7 @@ -38,7 +38,7 @@ AnimateDexSearchSlowpoke: ; 441cf db 4, 7 db -2 -DoDexSearchSlowpokeFrame: ; 44207 +DoDexSearchSlowpokeFrame: ld a, [wDexSearchSlowpokeFrame] ld hl, .SlowpokeSpriteData ld de, wVirtualOAMSprite00 @@ -64,7 +64,7 @@ DoDexSearchSlowpokeFrame: ; 44207 inc de jr .loop -.SlowpokeSpriteData: ; 44228 +.SlowpokeSpriteData: dsprite 11, 0, 9, 0, $00, 0 dsprite 11, 0, 10, 0, $01, 0 dsprite 11, 0, 11, 0, $02, 0 @@ -76,7 +76,7 @@ DoDexSearchSlowpokeFrame: ; 44207 dsprite 13, 0, 11, 0, $22, 0 db -1 -DisplayDexEntry: ; 4424d +DisplayDexEntry: call GetPokemonName hlcoord 9, 3 call PlaceString ; mon species @@ -211,11 +211,11 @@ DisplayDexEntry: ; 4424d call FarString ret -UnreferencedPOKeString: ; 44331 +UnreferencedPOKeString: ; unused db "#@" -GetDexEntryPointer: ; 44333 +GetDexEntryPointer: ; return dex entry pointer b:de push hl ld hl, PokedexDataPointerTable @@ -242,13 +242,13 @@ GetDexEntryPointer: ; 44333 ret .PokedexEntryBanks: - db BANK(PokedexEntries1) - db BANK(PokedexEntries2) - db BANK(PokedexEntries3) - db BANK(PokedexEntries4) + db BANK("Pokedex Entries 001-064") + db BANK("Pokedex Entries 065-128") + db BANK("Pokedex Entries 129-192") + db BANK("Pokedex Entries 193-251") -GetDexEntryPagePointer: ; 44355 - call GetDexEntryPointer ; b:de +GetDexEntryPagePointer: + call GetDexEntryPointer push hl ld h, d ld l, e @@ -279,3 +279,5 @@ endr ld e, l pop hl ret + +INCLUDE "data/pokemon/dex_entry_pointers.asm" diff --git a/engine/pokedex/pokedex_3.asm b/engine/pokedex/pokedex_3.asm index 51399f434..d11c18fc6 100644 --- a/engine/pokedex/pokedex_3.asm +++ b/engine/pokedex/pokedex_3.asm @@ -1,29 +1,29 @@ -LoadSGBPokedexGFX: ; 1ddf1c +LoadSGBPokedexGFX: ld hl, SGBPokedexGFX_LZ ld de, vTiles2 tile $31 call Decompress ret -LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26) +LoadSGBPokedexGFX2: ld hl, SGBPokedexGFX_LZ ld de, vTiles2 tile $31 lb bc, BANK(SGBPokedexGFX_LZ), 58 call DecompressRequest2bpp ret -SGBPokedexGFX_LZ: ; 1ddf33 +SGBPokedexGFX_LZ: INCBIN "gfx/pokedex/sgb.2bpp.lz" -LoadQuestionMarkPic: ; 1de0d7 +LoadQuestionMarkPic: ld hl, .QuestionMarkLZ ld de, sScratch call Decompress ret -.QuestionMarkLZ: ; 1de0e1 +.QuestionMarkLZ: INCBIN "gfx/pokedex/question_mark.2bpp.lz" -DrawPokedexListWindow: ; 1de171 (77:6171) +DrawPokedexListWindow: ld a, $32 hlcoord 0, 17 ld bc, 12 @@ -68,7 +68,7 @@ DrawPokedexListWindow: ; 1de171 (77:6171) .Done: ret -DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1) +DrawPokedexSearchResultsWindow: ld a, $34 hlcoord 0, 0 ld bc, 11 @@ -111,14 +111,14 @@ DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1) call PlaceString ret -.esults_D ; 1de23c +.esults_D ; (SEARCH R) db "ESULTS" next "" ; (### FOUN) next "D!@" -DrawDexEntryScreenRightEdge: ; 1de247 +DrawDexEntryScreenRightEdge: ld a, [hBGMapAddress] ld l, a ld a, [hBGMapAddress + 1] @@ -150,7 +150,7 @@ DrawDexEntryScreenRightEdge: ; 1de247 ld [hBGMapAddress + 1], a ret -Bank77_FillColumn: ; 1de27f +Bank77_FillColumn: push de ld de, SCREEN_WIDTH .loop diff --git a/engine/pokedex/unown_dex.asm b/engine/pokedex/unown_dex.asm index a35a266b7..054c945cf 100644 --- a/engine/pokedex/unown_dex.asm +++ b/engine/pokedex/unown_dex.asm @@ -1,4 +1,4 @@ -UpdateUnownDex: ; fba18 +UpdateUnownDex: ld a, [wUnownLetter] ld c, a ld b, NUM_UNOWN @@ -17,9 +17,8 @@ UpdateUnownDex: ; fba18 dec hl ld [hl], c ret -; fba2e -PrintUnownWord: ; fba2e (3e:7a2e) +PrintUnownWord: hlcoord 4, 15 ld bc, 12 ld a, " " @@ -46,7 +45,5 @@ PrintUnownWord: ; fba2e (3e:7a2e) inc de ld [hli], a jr .loop -; fba5a (3e:7a5a) - INCLUDE "data/pokemon/unown_words.asm" diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm index f04276b2d..8fc5ffa3d 100644 --- a/engine/pokegear/pokegear.asm +++ b/engine/pokegear/pokegear.asm @@ -22,7 +22,7 @@ NUM_POKEGEAR_CARDS EQU const_value const POKEGEARSTATE_RADIOINIT ; b const POKEGEARSTATE_RADIOJOYPAD ; c -PokeGear: ; 90b8d (24:4b8d) +PokeGear: ld hl, wOptions ld a, [hl] push af @@ -68,7 +68,7 @@ PokeGear: ; 90b8d (24:4b8d) call ExitPokegearRadio_HandleMusic ret -.InitTilemap: ; 90bea (24:4bea) +.InitTilemap: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -109,7 +109,7 @@ PokeGear: ; 90b8d (24:4b8d) call DmgToCgbObjPal0 ret -Pokegear_LoadGFX: ; 90c4e +Pokegear_LoadGFX: call ClearVBank1 ld hl, TownMapGFX ld de, vTiles2 @@ -157,13 +157,10 @@ Pokegear_LoadGFX: ; 90c4e call CopyBytes ret -; 90cb2 - -FastShipGFX: ; 90cb2 +FastShipGFX: INCBIN "gfx/pokegear/fast_ship.2bpp" -; 90d32 -InitPokegearModeIndicatorArrow: ; 90d32 (24:4d32) +InitPokegearModeIndicatorArrow: depixel 4, 2, 4, 0 ld a, SPRITE_ANIM_INDEX_POKEGEAR_ARROW call _InitSpriteAnimStruct @@ -172,7 +169,7 @@ InitPokegearModeIndicatorArrow: ; 90d32 (24:4d32) ld [hl], $0 ret -AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) +AnimatePokegearModeIndicatorArrow: ld hl, wPokegearCard ld e, [hl] ld d, 0 @@ -184,16 +181,13 @@ AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) ld [hl], a ret -; 90d52 (24:4d52) - -.XCoords: ; 90d52 +.XCoords: db $00 ; POKEGEARCARD_CLOCK db $10 ; POKEGEARCARD_MAP db $20 ; POKEGEARCARD_PHONE db $30 ; POKEGEARCARD_RADIO -; 90d56 -TownMap_GetCurrentLandmark: ; 90d56 +TownMap_GetCurrentLandmark: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -208,9 +202,7 @@ TownMap_GetCurrentLandmark: ; 90d56 call GetWorldMapLocation ret -; 90d70 - -TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) +TownMap_InitCursorAndPlayerIconPositions: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -236,14 +228,14 @@ TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) ld [wPokegearMapCursorLandmark], a ret -Pokegear_InitJumptableIndices: ; 90d9e (24:4d9e) +Pokegear_InitJumptableIndices: ld a, POKEGEARSTATE_CLOCKINIT ld [wJumptableIndex], a xor a ; POKEGEARCARD_CLOCK ld [wPokegearCard], a ret -InitPokegearTilemap: ; 90da8 (24:4da8) +InitPokegearTilemap: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -294,7 +286,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld [wPokegearMapRegion], a ret -.UpdateBGMap: ; 90e00 (24:4e00) +.UpdateBGMap: ld a, [hCGB] and a jr z, .dmg @@ -306,17 +298,14 @@ InitPokegearTilemap: ; 90da8 (24:4da8) call WaitBGMap ret -; 90e12 (24:4e12) - -.Jumptable: ; 90e12 +.Jumptable: ; entries correspond to POKEGEARCARD_* constants dw .Clock dw .Map dw .Phone dw .Radio -; 90e1a -.Clock: ; 90e1a +.Clock: ld de, ClockTilemapRLE call Pokegear_LoadTilemapRLE hlcoord 12, 1 @@ -328,13 +317,10 @@ InitPokegearTilemap: ; 90da8 (24:4da8) call Pokegear_UpdateClock ret -; 90e36 (24:4e36) - .switch db " SWITCH▶@" -; 90e3f -.Map: ; 90e3f +.Map: ld a, [wPokegearMapPlayerIconLandmark] cp FAST_SHIP jr z, .johto @@ -360,9 +346,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) call PokegearMap_UpdateLandmarkName ret -; 90e72 - -.Radio: ; 90e72 +.Radio: ld de, RadioTilemapRLE call Pokegear_LoadTilemapRLE hlcoord 0, 12 @@ -370,9 +354,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) call TextBox ret -; 90e82 - -.Phone: ; 90e82 +.Phone: ld de, PhoneTilemapRLE call Pokegear_LoadTilemapRLE hlcoord 0, 12 @@ -382,9 +364,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) call PokegearPhone_UpdateDisplayList ret -; 90e98 - -.PlacePhoneBars: ; 90e98 (24:4e98) +.PlacePhoneBars: hlcoord 17, 1 ld a, $3c ld [hli], a @@ -400,7 +380,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld [hl], $3f ret -Pokegear_FinishTilemap: ; 90eb0 (24:4eb0) +Pokegear_FinishTilemap: hlcoord 0, 0 ld bc, $8 ld a, $4f @@ -424,20 +404,20 @@ Pokegear_FinishTilemap: ; 90eb0 (24:4eb0) call .PlacePokegearCardIcon ret -.PlaceMapIcon: ; 90ee4 (24:4ee4) +.PlaceMapIcon: hlcoord 2, 0 ld a, $40 jr .PlacePokegearCardIcon -.PlacePhoneIcon: ; 90eeb (24:4eeb) +.PlacePhoneIcon: hlcoord 4, 0 ld a, $44 jr .PlacePokegearCardIcon -.PlaceRadioIcon: ; 90ef2 (24:4ef2) +.PlaceRadioIcon: hlcoord 6, 0 ld a, $42 -.PlacePokegearCardIcon: ; 90ef7 (24:4ef7) +.PlacePokegearCardIcon: ld [hli], a inc a ld [hld], a @@ -449,7 +429,7 @@ Pokegear_FinishTilemap: ; 90eb0 (24:4eb0) ld [hld], a ret -PokegearJumptable: ; 90f04 (24:4f04) +PokegearJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -461,7 +441,7 @@ PokegearJumptable: ; 90f04 (24:4f04) ld l, a jp hl -.Jumptable: ; 90f13 (24:4f13) +.Jumptable: ; entries correspond to POKEGEARSTATE_* constants dw PokegearClock_Init dw PokegearClock_Joypad @@ -477,7 +457,7 @@ PokegearJumptable: ; 90f04 (24:4f04) dw PokegearRadio_Init dw PokegearRadio_Joypad -PokegearClock_Init: ; 90f2d (24:4f2d) +PokegearClock_Init: call InitPokegearTilemap ld hl, PokegearText_PressAnyButtonToExit call PrintText @@ -486,7 +466,7 @@ PokegearClock_Init: ; 90f2d (24:4f2d) call ExitPokegearRadio_HandleMusic ret -PokegearClock_Joypad: ; 90f3e (24:4f3e) +PokegearClock_Joypad: call .UpdateClock ld hl, hJoyLast ld a, [hl] @@ -525,7 +505,7 @@ PokegearClock_Joypad: ; 90f3e (24:4f3e) set 7, [hl] ret -.UpdateClock: ; 90f7b (24:4f7b) +.UpdateClock: xor a ld [hBGMapMode], a call Pokegear_UpdateClock @@ -533,7 +513,7 @@ PokegearClock_Joypad: ; 90f3e (24:4f3e) ld [hBGMapMode], a ret -Pokegear_UpdateClock: ; 90f86 (24:4f86) +Pokegear_UpdateClock: hlcoord 3, 5 lb bc, 5, 14 call ClearBox @@ -548,17 +528,14 @@ Pokegear_UpdateClock: ; 90f86 (24:4f86) call PlaceHLTextAtBC ret -; 90fa8 (24:4fa8) db "ごぜん@" db "ごご@" -.DayText: ; 0x90faf +.DayText: text_jump UnknownText_0x1c5821 db "@" -; 0x90fb4 - -PokegearMap_CheckRegion: ; 90fb4 (24:4fb4) +PokegearMap_CheckRegion: ld a, [wPokegearMapPlayerIconLandmark] cp FAST_SHIP jr z, .johto @@ -576,7 +553,7 @@ PokegearMap_CheckRegion: ; 90fb4 (24:4fb4) call ExitPokegearRadio_HandleMusic ret -PokegearMap_Init: ; 90fcd (24:4fcd) +PokegearMap_Init: call InitPokegearTilemap ld a, [wPokegearMapPlayerIconLandmark] call PokegearMap_InitPlayerIcon @@ -590,14 +567,14 @@ PokegearMap_Init: ; 90fcd (24:4fcd) inc [hl] ret -PokegearMap_KantoMap: ; 90fe9 (24:4fe9) +PokegearMap_KantoMap: call TownMap_GetKantoLandmarkLimits jr PokegearMap_ContinueMap -PokegearMap_JohtoMap: ; 90fee (24:4fee) +PokegearMap_JohtoMap: ld d, SILVER_CAVE ld e, NEW_BARK_TOWN -PokegearMap_ContinueMap: ; 90ff2 (24:4ff2) +PokegearMap_ContinueMap: ld hl, hJoyLast ld a, [hl] and B_BUTTON @@ -639,7 +616,7 @@ PokegearMap_ContinueMap: ; 90ff2 (24:4ff2) set 7, [hl] ret -.DPad: ; 9102f (24:502f) +.DPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -682,7 +659,7 @@ PokegearMap_ContinueMap: ; 90ff2 (24:4ff2) call PokegearMap_UpdateCursorPosition ret -PokegearMap_InitPlayerIcon: ; 9106a +PokegearMap_InitPlayerIcon: push af depixel 0, 0 ld b, SPRITE_ANIM_INDEX_RED_WALK @@ -709,9 +686,7 @@ PokegearMap_InitPlayerIcon: ; 9106a ld [hl], d ret -; 91098 - -PokegearMap_InitCursor: ; 91098 +PokegearMap_InitCursor: push af depixel 0, 0 ld a, SPRITE_ANIM_INDEX_POKEGEAR_ARROW @@ -728,9 +703,7 @@ PokegearMap_InitCursor: ; 91098 pop bc ret -; 910b4 - -PokegearMap_UpdateLandmarkName: ; 910b4 +PokegearMap_UpdateLandmarkName: push af hlcoord 8, 0 lb bc, 2, 12 @@ -745,9 +718,7 @@ PokegearMap_UpdateLandmarkName: ; 910b4 ld [hl], $34 ret -; 910d4 - -PokegearMap_UpdateCursorPosition: ; 910d4 +PokegearMap_UpdateCursorPosition: push bc ld e, a farcall GetLandmarkCoords @@ -760,9 +731,7 @@ PokegearMap_UpdateCursorPosition: ; 910d4 ld [hl], d ret -; 910e8 - -TownMap_GetKantoLandmarkLimits: ; 910e8 +TownMap_GetKantoLandmarkLimits: ld a, [wStatusFlags] bit STATUSFLAGS_HALL_OF_FAME_F, a jr z, .not_hof @@ -775,9 +744,7 @@ TownMap_GetKantoLandmarkLimits: ; 910e8 ld e, VICTORY_ROAD ret -; 910f9 - -PokegearRadio_Init: ; 910f9 (24:50f9) +PokegearRadio_Init: call InitPokegearTilemap depixel 4, 10, 4, 4 ld a, SPRITE_ANIM_INDEX_RADIO_TUNING_KNOB @@ -790,7 +757,7 @@ PokegearRadio_Init: ; 910f9 (24:50f9) inc [hl] ret -PokegearRadio_Joypad: ; 91112 (24:5112) +PokegearRadio_Joypad: ld hl, hJoyLast ld a, [hl] and B_BUTTON @@ -836,7 +803,7 @@ PokegearRadio_Joypad: ; 91112 (24:5112) set 7, [hl] ret -PokegearPhone_Init: ; 91156 (24:5156) +PokegearPhone_Init: ld hl, wJumptableIndex inc [hl] xor a @@ -849,7 +816,7 @@ PokegearPhone_Init: ; 91156 (24:5156) call PrintText ret -PokegearPhone_Joypad: ; 91171 (24:5171) +PokegearPhone_Joypad: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -925,7 +892,7 @@ PokegearPhone_Joypad: ; 91171 (24:5171) ld [wJumptableIndex], a ret -PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) +PokegearPhone_MakePhoneCall: call GetMapPhoneService and a jr nz, .no_service @@ -967,23 +934,17 @@ PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) call PrintText ret -; 9124c (24:524c) - -.dotdotdot ; 0x9124c +.dotdotdot ; text_jump UnknownText_0x1c5824 db "@" -; 0x91251 - -.OutOfServiceArea: ; 0x91251 +.OutOfServiceArea: ; You're out of the service area. text_jump UnknownText_0x1c5827 db "@" -; 0x91256 - -PokegearPhone_FinishPhoneCall: ; 91256 (24:5256) +PokegearPhone_FinishPhoneCall: ld a, [hJoyPressed] and A_BUTTON | B_BUTTON ret z @@ -994,7 +955,7 @@ PokegearPhone_FinishPhoneCall: ; 91256 (24:5256) call PrintText ret -PokegearPhone_GetDPad: ; 9126d (24:526d) +PokegearPhone_GetDPad: ld hl, hJoyLast ld a, [hl] and D_UP @@ -1050,7 +1011,7 @@ PokegearPhone_GetDPad: ; 9126d (24:526d) call WaitBGMap ret -PokegearPhone_UpdateCursor: ; 912b7 (24:52b7) +PokegearPhone_UpdateCursor: ld a, " " hlcoord 1, 4 ld [hl], a @@ -1067,7 +1028,7 @@ PokegearPhone_UpdateCursor: ; 912b7 (24:52b7) ld [hl], "▶" ret -PokegearPhone_UpdateDisplayList: ; 912d8 (24:52d8) +PokegearPhone_UpdateDisplayList: hlcoord 1, 3 ld b, 9 ld a, " " @@ -1110,9 +1071,7 @@ PokegearPhone_UpdateDisplayList: ; 912d8 (24:52d8) call PokegearPhone_UpdateCursor ret -; 9131e (24:531e) - -PokegearPhone_DeletePhoneNumber: ; 9131e +PokegearPhone_DeletePhoneNumber: ld hl, wPhoneList ld a, [wPokegearPhoneScrollPosition] ld e, a @@ -1137,9 +1096,7 @@ PokegearPhone_DeletePhoneNumber: ; 9131e jr nz, .loop ret -; 91342 - -PokegearPhoneContactSubmenu: ; 91342 (24:5342) +PokegearPhoneContactSubmenu: ld hl, wPhoneList ld a, [wPokegearPhoneScrollPosition] ld e, a @@ -1248,15 +1205,13 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342) ld l, a jp hl -.Cancel: ; 913f1 +.Cancel: ld hl, PokegearText_WhomToCall call PrintText scf ret -; 913f9 (24:53f9) - -.Delete: ; 913f9 +.Delete: ld hl, PokegearText_DeleteStoredNumber call MenuTextBox call YesNoBox @@ -1273,15 +1228,11 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342) scf ret -; 9141b - -.Call: ; 9141b +.Call: and a ret -; 9141d - -.UpdateCursor: ; 9141d (24:541d) +.UpdateCursor: push de ld a, [de] inc de @@ -1307,38 +1258,30 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342) pop de ret -; 9143f (24:543f) - -.CallDeleteCancelStrings: ; 9143f +.CallDeleteCancelStrings: dwcoord 10, 6 db 3 db "CALL" next "DELETE" next "CANCEL" db "@" -; 91455 -.CallDeleteCancelJumptable: ; 91455 +.CallDeleteCancelJumptable: dw .Call dw .Delete dw .Cancel -; 9145b - -.CallCancelStrings: ; 9145b +.CallCancelStrings: dwcoord 10, 8 db 2 db "CALL" next "CANCEL" db "@" -; 9146a -.CallCancelJumptable: ; 9146a +.CallCancelJumptable: dw .Call dw .Cancel -; 9146e - ; unused ld a, [hHours] cp 12 @@ -1353,9 +1296,7 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342) and a ret -; 91480 - -Pokegear_SwitchPage: ; 91480 (24:5480) +Pokegear_SwitchPage: ld de, SFX_READ_TEXT_2 call PlaySFX ld a, c @@ -1365,7 +1306,7 @@ Pokegear_SwitchPage: ; 91480 (24:5480) call DeleteSpriteAnimStruct2ToEnd ret -ExitPokegearRadio_HandleMusic: ; 91492 +ExitPokegearRadio_HandleMusic: ld a, [wPokegearRadioMusicPlaying] cp RESTART_MAP_MUSIC jr z, .restart_map_music @@ -1381,9 +1322,7 @@ ExitPokegearRadio_HandleMusic: ; 91492 ld [wPokegearRadioMusicPlaying], a ret -; 914ab - -DeleteSpriteAnimStruct2ToEnd: ; 914ab (24:54ab) +DeleteSpriteAnimStruct2ToEnd: ld hl, wSpriteAnim2 ld bc, wSpriteAnimationStructsEnd - wSpriteAnim2 xor a @@ -1392,7 +1331,7 @@ DeleteSpriteAnimStruct2ToEnd: ; 914ab (24:54ab) ld [wSpriteAnimCount], a ret -Pokegear_LoadTilemapRLE: ; 914bb (24:54bb) +Pokegear_LoadTilemapRLE: ; Format: repeat count, tile ID ; Terminated with -1 hlcoord 0, 0 @@ -1412,47 +1351,37 @@ Pokegear_LoadTilemapRLE: ; 914bb (24:54bb) jr nz, .load jr .loop -; 914ce (24:54ce) - -PokegearText_WhomToCall: ; 0x914ce +PokegearText_WhomToCall: ; Whom do you want to call? text_jump UnknownText_0x1c5847 db "@" -; 0x914d3 - -PokegearText_PressAnyButtonToExit: ; 0x914d3 +PokegearText_PressAnyButtonToExit: ; Press any button to exit. text_jump UnknownText_0x1c5862 db "@" -; 0x914d8 - -PokegearText_DeleteStoredNumber: ; 0x914d8 +PokegearText_DeleteStoredNumber: ; Delete this stored phone number? text_jump UnknownText_0x1c587d db "@" -; 0x914dd - -PokegearSpritesGFX: ; 914dd +PokegearSpritesGFX: INCBIN "gfx/pokegear/pokegear_sprites.2bpp.lz" -; 9150d -RadioTilemapRLE: ; 9150d +RadioTilemapRLE: INCBIN "gfx/pokegear/radio.tilemap.rle" -PhoneTilemapRLE: ; 9158a +PhoneTilemapRLE: INCBIN "gfx/pokegear/phone.tilemap.rle" -ClockTilemapRLE: ; 915db +ClockTilemapRLE: INCBIN "gfx/pokegear/clock.tilemap.rle" -; 9163e -_UpdateRadioStation: ; 9163e (24:563e) +_UpdateRadioStation: jr UpdateRadioStation ; called from engine/sprite_anims.asm -AnimateTuningKnob: ; 91640 (24:5640) +AnimateTuningKnob: push bc call .TuningKnob pop bc @@ -1462,7 +1391,7 @@ AnimateTuningKnob: ; 91640 (24:5640) ld [hl], a ret -.TuningKnob: ; 9164e (24:564e) +.TuningKnob: ld hl, hJoyLast ld a, [hl] and D_DOWN @@ -1489,7 +1418,7 @@ AnimateTuningKnob: ; 91640 (24:5640) inc [hl] inc [hl] .update -UpdateRadioStation: ; 9166f (24:566f) +UpdateRadioStation: ld hl, wRadioTuningKnob ld d, [hl] ld hl, RadioChannels @@ -1527,8 +1456,6 @@ UpdateRadioStation: ; 9166f (24:566f) ld [hBGMapMode], a ret -; 916a1 (24:56a1) - ; unused ld [wPokegearRadioChannelBank], a ld a, [hli] @@ -1537,8 +1464,6 @@ UpdateRadioStation: ; 9166f (24:566f) ld [wPokegearRadioChannelAddr + 1], a ret -; 916ad - RadioChannels: ; entries correspond to constants/radio_constants.asm @@ -1611,7 +1536,7 @@ RadioChannels: jp LoadStation_PokeFluteRadio .EvolutionRadio: -; This station airs in the Lake of Rage area when Rocket are still in Mahogany. +; This station airs in the Lake of Rage area when Team Rocket is still in Mahogany. ld a, [wStatusFlags] bit STATUSFLAGS_ROCKET_SIGNAL_F, a jr z, .NoSignal @@ -1646,7 +1571,7 @@ RadioChannels: scf ret -LoadStation_OaksPokemonTalk: ; 91753 (24:5753) +LoadStation_OaksPokemonTalk: xor a ; OAKS_POKEMON_TALK ld [wCurrentRadioLine], a ld [wNumRadioLinesPrinted], a @@ -1656,7 +1581,7 @@ LoadStation_OaksPokemonTalk: ; 91753 (24:5753) ld de, OaksPKMNTalkName ret -LoadStation_PokedexShow: ; 91766 (24:5766) +LoadStation_PokedexShow: ld a, POKEDEX_SHOW ld [wCurrentRadioLine], a xor a @@ -1667,7 +1592,7 @@ LoadStation_PokedexShow: ; 91766 (24:5766) ld de, PokedexShowName ret -LoadStation_PokemonMusic: ; 9177b (24:577b) +LoadStation_PokemonMusic: ld a, POKEMON_MUSIC ld [wCurrentRadioLine], a xor a @@ -1678,7 +1603,7 @@ LoadStation_PokemonMusic: ; 9177b (24:577b) ld de, PokemonMusicName ret -LoadStation_LuckyChannel: ; 91790 (24:5790) +LoadStation_LuckyChannel: ld a, LUCKY_CHANNEL ld [wCurrentRadioLine], a xor a @@ -1689,7 +1614,7 @@ LoadStation_LuckyChannel: ; 91790 (24:5790) ld de, LuckyChannelName ret -LoadStation_BuenasPassword: ; 917a5 (24:57a5) +LoadStation_BuenasPassword: ld a, BUENAS_PASSWORD ld [wCurrentRadioLine], a xor a @@ -1704,12 +1629,10 @@ LoadStation_BuenasPassword: ; 917a5 (24:57a5) ld de, BuenasPasswordName ret -; 917c3 (24:57c3) - BuenasPasswordName: db "BUENA'S PASSWORD@" NotBuenasPasswordName: db "@" -LoadStation_UnownRadio: ; 917d5 (24:57d5) +LoadStation_UnownRadio: ld a, UNOWN_RADIO ld [wCurrentRadioLine], a xor a @@ -1720,7 +1643,7 @@ LoadStation_UnownRadio: ; 917d5 (24:57d5) ld de, UnownStationName ret -LoadStation_PlacesAndPeople: ; 917ea (24:57ea) +LoadStation_PlacesAndPeople: ld a, PLACES_AND_PEOPLE ld [wCurrentRadioLine], a xor a @@ -1731,7 +1654,7 @@ LoadStation_PlacesAndPeople: ; 917ea (24:57ea) ld de, PlacesAndPeopleName ret -LoadStation_LetsAllSing: ; 917ff (24:57ff) +LoadStation_LetsAllSing: ld a, LETS_ALL_SING ld [wCurrentRadioLine], a xor a @@ -1742,9 +1665,7 @@ LoadStation_LetsAllSing: ; 917ff (24:57ff) ld de, LetsAllSingName ret -; 91814 (24:5814) - -LoadStation_RocketRadio: ; 91814 +LoadStation_RocketRadio: ld a, ROCKET_RADIO ld [wCurrentRadioLine], a xor a @@ -1755,9 +1676,7 @@ LoadStation_RocketRadio: ; 91814 ld de, LetsAllSingName ret -; 91829 - -LoadStation_PokeFluteRadio: ; 91829 (24:5829) +LoadStation_PokeFluteRadio: ld a, POKE_FLUTE_RADIO ld [wCurrentRadioLine], a xor a @@ -1768,7 +1687,7 @@ LoadStation_PokeFluteRadio: ; 91829 (24:5829) ld de, PokeFluteStationName ret -LoadStation_EvolutionRadio: ; 9183e (24:583e) +LoadStation_EvolutionRadio: ld a, EVOLUTION_RADIO ld [wCurrentRadioLine], a xor a @@ -1779,12 +1698,10 @@ LoadStation_EvolutionRadio: ; 9183e (24:583e) ld de, UnownStationName ret -; 91853 (24:5853) - -Unreferenced_LoadStation: ; 91853 +Unreferenced_LoadStation: ret -RadioMusicRestartDE: ; 91854 (24:5854) +RadioMusicRestartDE: push de ld a, e ld [wPokegearRadioMusicPlaying], a @@ -1796,7 +1713,7 @@ RadioMusicRestartDE: ; 91854 (24:5854) call PlayMusic ret -RadioMusicRestartPokemonChannel: ; 91868 (24:5868) +RadioMusicRestartPokemonChannel: push de ld a, RESTART_MAP_MUSIC ld [wPokegearRadioMusicPlaying], a @@ -1807,7 +1724,7 @@ RadioMusicRestartPokemonChannel: ; 91868 (24:5868) call PlayMusic ret -Radio_BackUpFarCallParams: ; 9187c (24:587c) +Radio_BackUpFarCallParams: ld [wPokegearRadioChannelBank], a ld a, l ld [wPokegearRadioChannelAddr], a @@ -1815,7 +1732,7 @@ Radio_BackUpFarCallParams: ; 9187c (24:587c) ld [wPokegearRadioChannelAddr + 1], a ret -NoRadioStation: ; 91888 (24:5888) +NoRadioStation: call NoRadioMusic call NoRadioName xor a @@ -1826,14 +1743,14 @@ NoRadioStation: ; 91888 (24:5888) ld [hBGMapMode], a ret -NoRadioMusic: ; 9189d (24:589d) +NoRadioMusic: ld de, MUSIC_NONE call PlayMusic ld a, ENTER_MAP_MUSIC ld [wPokegearRadioMusicPlaying], a ret -NoRadioName: ; 918a9 (24:58a9) +NoRadioName: xor a ld [hBGMapMode], a hlcoord 1, 8 @@ -1844,8 +1761,6 @@ NoRadioName: ; 918a9 (24:58a9) call TextBox ret -; 918bf - OaksPKMNTalkName: db "OAK's <PK><MN> Talk@" PokedexShowName: db "#DEX Show@" PokemonMusicName: db "#MON Music@" @@ -1855,9 +1770,8 @@ UnownStationName: db "?????@" PlacesAndPeopleName: db "Places & People@" LetsAllSingName: db "Let's All Sing!@" PokeFluteStationName: db "# FLUTE@" -; 9191c -_TownMap: ; 9191c +_TownMap: ld hl, wOptions ld a, [hl] push af @@ -1990,9 +1904,8 @@ _TownMap: ; 9191c call PokegearMap_UpdateCursorPosition pop de jr .loop2 -; 91a04 -.InitTilemap: ; 91a04 +.InitTilemap: ld a, [wTownMapPlayerIconLandmark] cp KANTO_LANDMARK jr nc, .kanto2 @@ -2025,9 +1938,8 @@ _TownMap: ; 9191c call PokegearMap_UpdateLandmarkName farcall TownMapPals ret -; 91a53 -PlayRadio: ; 91a53 +PlayRadio: ld hl, wOptions ld a, [hl] push af @@ -2058,9 +1970,7 @@ PlayRadio: ; 91a53 call ExitPokegearRadio_HandleMusic ret -; 91a87 - -.PlayStation: ; 91a87 +.PlayStation: ld a, ENTER_MAP_MUSIC ld [wPokegearRadioMusicPlaying], a ld hl, .StationPointers @@ -2080,19 +1990,17 @@ PlayRadio: ; 91a53 lb bc, 4, 18 call TextBox hlcoord 1, 14 - ld [hl], $72 + ld [hl], "“" pop de hlcoord 2, 14 call PlaceString ld h, b ld l, c - ld [hl], $73 + ld [hl], "”" call WaitBGMap ret -; 91ab9 - -.StationPointers: ; 91ab9 +.StationPointers: ; entries correspond to MAPRADIO_* constants dw .OakOrPnP dw LoadStation_OaksPokemonTalk @@ -2104,9 +2012,7 @@ PlayRadio: ; 91a53 dw LoadStation_LetsAllSing dw LoadStation_RocketRadio -; 91acb - -.OakOrPnP: ; 91acb +.OakOrPnP: call IsInJohto and a jr nz, .kanto @@ -2119,9 +2025,7 @@ PlayRadio: ; 91a53 .kanto jp LoadStation_PlacesAndPeople -; 91ae1 - -PokegearMap: ; 91ae1 +PokegearMap: ld a, e and a jr nz, .kanto @@ -2134,9 +2038,7 @@ PokegearMap: ; 91ae1 call FillKantoMap ret -; 91af3 - -_FlyMap: ; 91af3 +_FlyMap: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -2199,9 +2101,7 @@ _FlyMap: ; 91af3 ld e, a ret -; 91b73 - -FlyMapScroll: ; 91b73 +FlyMapScroll: ld a, [wStartFlypoint] ld e, a ld a, [wEndFlypoint] @@ -2248,9 +2148,7 @@ FlyMapScroll: ; 91b73 ld [hBGMapMode], a ret -; 91bb5 - -TownMapBubble: ; 91bb5 +TownMapBubble: ; Draw the bubble containing the location text in the town map HUD ; Top-left corner @@ -2312,9 +2210,7 @@ TownMapBubble: ; 91bb5 call PlaceString ret -; 91c17 - -GetMapCursorCoordinates: ; 91c17 +GetMapCursorCoordinates: ld a, [wTownMapPlayerIconLandmark] ld l, a ld h, 0 @@ -2335,9 +2231,7 @@ GetMapCursorCoordinates: ; 91c17 ld [hl], d ret -; 91c3c - -CheckIfVisitedFlypoint: ; 91c3c +CheckIfVisitedFlypoint: ; Check if the flypoint loaded in [hl] has been visited yet. push bc push de @@ -2355,9 +2249,7 @@ CheckIfVisitedFlypoint: ; 91c3c and a ret -; 91c50 - -HasVisitedSpawn: ; 91c50 +HasVisitedSpawn: ; Check if spawn point c has been visited. ld hl, wVisitedSpawns ld b, CHECK_FLAG @@ -2366,16 +2258,12 @@ HasVisitedSpawn: ; 91c50 ld a, c ret -; 91c5e - INCLUDE "data/maps/flypoints.asm" -ret_91c8f: ; 91c8f +ret_91c8f: ret -; 91c90 - -FlyMap: ; 91c90 +FlyMap: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -2469,9 +2357,7 @@ FlyMap: ; 91c90 ld [wTownMapCursorCoordinates + 1], a ret -; 91d11 - -Pokedex_GetArea: ; 91d11 +Pokedex_GetArea: ; e: Current landmark ld a, [wTownMapPlayerIconLandmark] push af @@ -2537,9 +2423,7 @@ Pokedex_GetArea: ; 91d11 ld [wTownMapPlayerIconLandmark], a ret -; 91d9b - -.LeftRightInput: ; 91d9b +.LeftRightInput: ld a, [hl] and D_LEFT jr nz, .left @@ -2573,9 +2457,7 @@ Pokedex_GetArea: ; 91d11 call .GetAndPlaceNest ret -; 91dcd - -.BlinkNestIcons: ; 91dcd +.BlinkNestIcons: ld a, [hVBlankCounter] ld e, a and $f @@ -2593,9 +2475,7 @@ Pokedex_GetArea: ; 91d11 call CopyBytes ret -; 91de9 - -.PlaceString_MonsNest: ; 91de9 +.PlaceString_MonsNest: hlcoord 0, 0 ld bc, SCREEN_WIDTH ld a, " " @@ -2616,13 +2496,10 @@ Pokedex_GetArea: ; 91d11 call PlaceString ret -; 91e16 - .String_SNest: db "'S NEST@" -; 91e1e -.GetAndPlaceNest: ; 91e1e +.GetAndPlaceNest: ld [wTownMapCursorLandmark], a ld e, a farcall FindNest ; load nest landmarks into wTileMap[0,0] @@ -2660,9 +2537,7 @@ Pokedex_GetArea: ; 91d11 call CopyBytes ret -; 91e5a - -.HideNestsShowPlayer: ; 91e5a +.HideNestsShowPlayer: call .CheckPlayerLocation ret c ld a, [wTownMapPlayerIconLandmark] @@ -2706,18 +2581,15 @@ Pokedex_GetArea: ; 91d11 call ByteFill ret -; 91e9c - -.PlayerOAM: ; 91e9c +.PlayerOAM: ; y pxl, x pxl, tile offset db -1 * 8, -1 * 8, 0 ; top left db -1 * 8, 0 * 8, 1 ; top right db 0 * 8, -1 * 8, 2 ; bottom left db 0 * 8, 0 * 8, 3 ; bottom right db $80 ; terminator -; 91ea9 -.CheckPlayerLocation: ; 91ea9 +.CheckPlayerLocation: ; Don't show the player's sprite if you're ; not in the same region as what's currently ; on the screen. @@ -2748,9 +2620,7 @@ Pokedex_GetArea: ; 91d11 scf ret -; 91ed0 - -.GetPlayerOrFastShipIcon: ; 91ed0 +.GetPlayerOrFastShipIcon: ld a, [wTownMapPlayerIconLandmark] cp FAST_SHIP jr z, .FastShip @@ -2762,9 +2632,7 @@ Pokedex_GetArea: ; 91d11 ld b, BANK(FastShipGFX) ret -; 91ee4 - -TownMapBGUpdate: ; 91ee4 +TownMapBGUpdate: ; Update BG Map tiles and attributes ; BG Map address @@ -2792,15 +2660,13 @@ TownMapBGUpdate: ; 91ee4 ld [hBGMapMode], a ret -; 91eff - -FillJohtoMap: ; 91eff +FillJohtoMap: ld de, JohtoMap jr FillTownMap -FillKantoMap: ; 91f04 +FillKantoMap: ld de, KantoMap -FillTownMap: ; 91f07 +FillTownMap: hlcoord 0, 0 .loop ld a, [de] @@ -2811,9 +2677,7 @@ FillTownMap: ; 91f07 inc de jr .loop -; 91f13 - -TownMapPals: ; 91f13 +TownMapPals: ; Assign palettes based on tile ids hlcoord 0, 0 decoord 0, 0, wAttrMap @@ -2866,9 +2730,8 @@ TownMapPals: ; 91f13 .PalMap: INCLUDE "gfx/pokegear/town_map_palette_map.asm" -; 91f7b -TownMapMon: ; 91f7b +TownMapMon: ; Draw the FlyMon icon at town map location ; Get FlyMon species @@ -2894,9 +2757,7 @@ TownMapMon: ; 91f7b ld [hl], SPRITE_ANIM_SEQ_NULL ret -; 91fa6 - -TownMapPlayerIcon: ; 91fa6 +TownMapPlayerIcon: ; Draw the player icon at town map location in a push af farcall GetPlayerIcon @@ -2939,28 +2800,22 @@ TownMapPlayerIcon: ; 91fa6 ld [hl], d ret -; 0x91ff2 - -LoadTownMapGFX: ; 91ff2 +LoadTownMapGFX: ld hl, TownMapGFX ld de, vTiles2 lb bc, BANK(TownMapGFX), 48 call DecompressRequest2bpp ret -; 91fff - -JohtoMap: ; 91fff +JohtoMap: INCBIN "gfx/pokegear/johto.bin" -; 92168 -KantoMap: ; 92168 +KantoMap: INCBIN "gfx/pokegear/kanto.bin" -; 922d1 -PokedexNestIconGFX: ; 922d1 +PokedexNestIconGFX: INCBIN "gfx/pokegear/dexmap_nest_icon.2bpp" -FlyMapLabelBorderGFX: ; 922e1 +FlyMapLabelBorderGFX: INCBIN "gfx/pokegear/flymap_label_border.1bpp" Unreferenced_Function92311: @@ -3041,9 +2896,7 @@ Unreferenced_Function92311: ld e, a ret -; 923b8 - -.HandleDPad: ; 923b8 +.HandleDPad: ld hl, hJoyLast ld a, [hl] and D_DOWN | D_RIGHT @@ -3093,5 +2946,3 @@ Unreferenced_Function92311: xor a ld [hBGMapMode], a ret - -; 92402 diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index ffaef80f0..b76cad13e 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -126,7 +126,6 @@ RadioJumptable: dw PokedexShow7 ; $56 dw PokedexShow8 ; $57 - PrintRadioLine: ld [wNextRadioLine], a ld hl, wRadioText @@ -703,10 +702,10 @@ PokedexShow_GetDexEntryBank: ret .PokedexEntryBanks: - db BANK(PokedexEntries1) - db BANK(PokedexEntries2) - db BANK(PokedexEntries3) - db BANK(PokedexEntries4) + db BANK("Pokedex Entries 001-064") + db BANK("Pokedex Entries 065-128") + db BANK("Pokedex Entries 129-192") + db BANK("Pokedex Entries 193-251") PokedexShow1: call StartRadioStation diff --git a/engine/pokegear/townmap_convertlinebreakcharacters.asm b/engine/pokegear/townmap_convertlinebreakcharacters.asm index 6ccd79aae..a881b9260 100644 --- a/engine/pokegear/townmap_convertlinebreakcharacters.asm +++ b/engine/pokegear/townmap_convertlinebreakcharacters.asm @@ -1,18 +1,18 @@ -TownMap_ConvertLineBreakCharacters: ; 1de2c5 +TownMap_ConvertLineBreakCharacters: ld hl, wStringBuffer1 .loop ld a, [hl] cp "@" jr z, .end cp "%" - jr z, .line_break + jr z, .line_feed cp "¯" - jr z, .line_break + jr z, .line_feed inc hl jr .loop -.line_break - ld [hl], "<LNBRK>" +.line_feed + ld [hl], "<LF>" .end ld de, wStringBuffer1 diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 75cc3fe35..65621192d 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1,4 +1,4 @@ -_DepositPKMN: ; e2391 (38:6391) +_DepositPKMN: ld hl, wOptions ld a, [hl] push af @@ -35,20 +35,20 @@ _DepositPKMN: ; e2391 (38:6391) ld [wOptions], a ret -.RunJumptable: ; e23d5 (38:63d5) +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -.Jumptable: ; e23df (38:63df) +.Jumptable: dw .Init dw .HandleJoypad dw .WhatsUp dw .Submenu dw BillsPC_EndJumptableLoop -.Init: ; e23e9 (38:63e9) +.Init: xor a ld [hBGMapMode], a call ClearSprites @@ -69,7 +69,7 @@ _DepositPKMN: ; e2391 (38:6391) call BillsPC_IncrementJumptableIndex ret -.HandleJoypad: ; e241a (38:641a) +.HandleJoypad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and B_BUTTON @@ -100,7 +100,6 @@ _DepositPKMN: ; e2391 (38:6391) ld a, $2 ld [wJumptableIndex], a ret -; e2452 (38:6452) .go_back ld hl, wJumptableIndex @@ -112,7 +111,7 @@ _DepositPKMN: ; e2391 (38:6391) ld [wJumptableIndex], a ret -.WhatsUp: ; e245d (38:645d) +.WhatsUp: xor a ld [hBGMapMode], a call ClearSprites @@ -127,7 +126,7 @@ _DepositPKMN: ; e2391 (38:6391) call BillsPC_IncrementJumptableIndex ret -.Submenu: ; e247d (38:647d) +.Submenu: ld hl, BillsPCDepositMenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -147,14 +146,13 @@ _DepositPKMN: ; e2391 (38:6391) ld l, a jp hl -BillsPCDepositJumptable: ; e24a1 (38:64a1) +BillsPCDepositJumptable: dw BillsPCDepositFuncDeposit ; Deposit Pokemon dw BillsPCDepositFuncStats ; Pokemon Stats dw BillsPCDepositFuncRelease ; Release Pokemon dw BillsPCDepositFuncCancel ; Cancel - -BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) +BillsPCDepositFuncDeposit: call BillsPC_CheckMail_PreventBlackout jp c, BillsPCDepositFuncCancel call DepositPokemon @@ -171,7 +169,7 @@ BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) call BillsPC_PlaceString ret -BillsPCDepositFuncStats: ; e24c8 (38:64c8) +BillsPCDepositFuncStats: call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -182,7 +180,7 @@ BillsPCDepositFuncStats: ; e24c8 (38:64c8) call BillsPC_ApplyPalettes ret -BillsPCDepositFuncRelease: ; e24e0 (38:64e0) +BillsPCDepositFuncRelease: call BillsPC_CheckMail_PreventBlackout jr c, BillsPCDepositFuncCancel call BillsPC_IsMonAnEgg @@ -222,29 +220,26 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0) ld [wMenuCursorY], a ret -BillsPCDepositFuncCancel: ; e2537 (38:6537) +BillsPCDepositFuncCancel: ld a, $0 ld [wJumptableIndex], a ret -; e253d (38:653d) -BillsPCDepositMenuHeader: ; 0xe253d (38:653d) +BillsPCDepositMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe2545 -.MenuData: ; 0xe2545 (38:6545) +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "DEPOSIT@" db "STATS@" db "RELEASE@" db "CANCEL@" -; 0xe2564 (38:6564) -Unreferenced_BillsPCClearThreeBoxes: ; e2564 +Unreferenced_BillsPCClearThreeBoxes: hlcoord 0, 0 ld b, 4 ld c, 8 @@ -258,9 +253,8 @@ Unreferenced_BillsPCClearThreeBoxes: ; e2564 ld c, 8 call ClearBox ret -; e2583 -_WithdrawPKMN: ; e2583 (38:6583) +_WithdrawPKMN: ld hl, wOptions ld a, [hl] push af @@ -297,20 +291,20 @@ _WithdrawPKMN: ; e2583 (38:6583) ld [wOptions], a ret -.RunJumptable: ; e25c8 (38:65c8) +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -.Jumptable: ; e25d2 (38:65d2) +.Jumptable: dw .Init dw .Joypad dw .PrepSubmenu dw BillsPC_Withdraw dw BillsPC_EndJumptableLoop -.Init: ; e25dc (38:65dc) +.Init: ld a, NUM_BOXES + 1 ld [wBillsPC_LoadedBox], a xor a @@ -333,7 +327,7 @@ _WithdrawPKMN: ; e2583 (38:6583) call BillsPC_IncrementJumptableIndex ret -.Joypad: ; e2612 (38:6612) +.Joypad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and B_BUTTON @@ -362,7 +356,7 @@ _WithdrawPKMN: ; e2583 (38:6583) jr z, .b_button ld a, $2 ld [wJumptableIndex], a - ret ; e264a (38:664a) + ret .unused ld hl, wJumptableIndex @@ -373,9 +367,8 @@ _WithdrawPKMN: ; e2583 (38:6583) ld a, $4 ld [wJumptableIndex], a ret -; e2655 -.PrepSubmenu: ; e2655 (38:6655) +.PrepSubmenu: xor a ld [hBGMapMode], a call ClearSprites @@ -390,7 +383,7 @@ _WithdrawPKMN: ; e2583 (38:6583) call BillsPC_IncrementJumptableIndex ret -BillsPC_Withdraw: ; e2675 (38:6675) +BillsPC_Withdraw: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -410,14 +403,13 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld l, a jp hl -.dw ; e2699 (38:6699) #mark +.dw dw .withdraw ; Withdraw dw .stats ; Stats dw .release ; Release dw .cancel ; Cancel - -.withdraw ; e26a1 (38:66a1) +.withdraw call BillsPC_CheckMail_PreventBlackout jp c, .cancel call TryWithdrawPokemon @@ -433,7 +425,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) call BillsPC_PlaceString ret -.stats ; e26c0 (38:66c0) +.stats call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -444,7 +436,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) call BillsPC_ApplyPalettes ret -.release ; e26d8 (38:66d8) +.release ld a, [wMenuCursorY] push af call BillsPC_IsMonAnEgg @@ -481,29 +473,26 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld [wMenuCursorY], a ret -.cancel ; e272b (38:672b) +.cancel ld a, $0 ld [wJumptableIndex], a ret -; e2731 (38:6731) -.MenuHeader: ; 0xe2731 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe2739 -.MenuData: ; 0xe2739 +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "WITHDRAW@" db "STATS@" db "RELEASE@" db "CANCEL@" -; 0xe2759 -_MovePKMNWithoutMail: ; e2759 +_MovePKMNWithoutMail: ld hl, wOptions ld a, [hl] push af @@ -542,16 +531,14 @@ _MovePKMNWithoutMail: ; e2759 pop af ld [wOptions], a ret -; e27a2 -.RunJumptable: ; e27a2 +.RunJumptable: ld a, [wJumptableIndex] ld hl, .Jumptable call BillsPC_Jumptable jp hl -; e27ac -.Jumptable: ; e27ac +.Jumptable: dw .Init dw .Joypad dw .PrepSubmenu @@ -559,9 +546,8 @@ _MovePKMNWithoutMail: ; e2759 dw .PrepInsertCursor dw .Joypad2 dw BillsPC_EndJumptableLoop -; e27ba -.Init: ; e27ba +.Init: xor a ld [hBGMapMode], a call ClearSprites @@ -581,9 +567,8 @@ _MovePKMNWithoutMail: ; e2759 call BillsPC_UpdateSelectionCursor call BillsPC_IncrementJumptableIndex ret -; e27eb -.Joypad: ; e27eb +.Joypad: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -633,9 +618,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $6 ld [wJumptableIndex], a ret -; e283d -.PrepSubmenu: ; e283d +.PrepSubmenu: xor a ld [hBGMapMode], a call ClearSprites @@ -649,9 +633,8 @@ _MovePKMNWithoutMail: ; e2759 ld [wMenuCursorY], a call BillsPC_IncrementJumptableIndex ret -; e285d -.MoveMonWOMailSubmenu: ; e285d +.MoveMonWOMailSubmenu: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuCursorY] @@ -670,15 +653,13 @@ _MovePKMNWithoutMail: ; e2759 ld h, [hl] ld l, a jp hl -; e2881 -.Jumptable2: ; e2881 +.Jumptable2: dw .Move dw .Stats dw .Cancel -; e2887 -.Move: ; e2887 +.Move: call BillsPC_CheckMail_PreventBlackout jp c, .Cancel ld a, [wBillsPC_ScrollPosition] @@ -690,9 +671,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $4 ld [wJumptableIndex], a ret -; e28a5 -.Stats: ; e28a5 +.Stats: call LoadStandardMenuHeader call BillsPC_StatsScreen call ExitMenu @@ -702,30 +682,26 @@ _MovePKMNWithoutMail: ; e2759 ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ret -; e28bd -.Cancel: ; e28bd +.Cancel: ld a, $0 ld [wJumptableIndex], a ret -; e28c3 -.MenuHeader: ; 0xe28c3 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 9, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe28cb -.MenuData: ; 0xe28cb +.MenuData: db STATICMENU_CURSOR ; flags db 3 ; items db "MOVE@" db "STATS@" db "CANCEL@" -; 0xe28df -.PrepInsertCursor: ; e28df +.PrepInsertCursor: xor a ld [hBGMapMode], a call CopyBoxmonSpecies @@ -740,9 +716,8 @@ _MovePKMNWithoutMail: ; e2759 call WaitBGMap call BillsPC_IncrementJumptableIndex ret -; e2903 -.Joypad2: ; e2903 +.Joypad2: ld hl, hJoyPressed ld a, [hl] and B_BUTTON @@ -795,9 +770,8 @@ _MovePKMNWithoutMail: ; e2759 ld a, $0 ld [wJumptableIndex], a ret -; e2963 -BillsPC_InitRAM: ; e2963 (38:6963) +BillsPC_InitRAM: call ClearBGPalettes call ClearSprites call ClearTileMap @@ -815,17 +789,17 @@ BillsPC_InitRAM: ; e2963 (38:6963) ld [wBillsPC_ScrollPosition], a ret -BillsPC_IncrementJumptableIndex: ; e298d (38:698d) +BillsPC_IncrementJumptableIndex: ld hl, wJumptableIndex inc [hl] ret -BillsPC_EndJumptableLoop: ; e2992 (38:6992) +BillsPC_EndJumptableLoop: ld hl, wJumptableIndex set 7, [hl] ret -_StatsScreenDPad: ; e2998 (38:6998) +_StatsScreenDPad: ld a, [wBillsPC_NumMonsOnScreen] ld d, a ld a, [wBillsPC_NumMonsInBox] @@ -844,7 +818,7 @@ _StatsScreenDPad: ; e2998 (38:6998) .empty jp BillsPC_JoypadDidNothing -Withdraw_UpDown: ; e29b5 (38:69b5) +Withdraw_UpDown: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -860,9 +834,8 @@ Withdraw_UpDown: ; e29b5 (38:69b5) jr nz, BillsPC_PressDown .empty jp BillsPC_JoypadDidNothing -; e29d0 (38:69d0) -MoveMonWithoutMail_DPad: ; e29d0 +MoveMonWithoutMail_DPad: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -886,7 +859,7 @@ MoveMonWithoutMail_DPad: ; e29d0 jr nz, BillsPC_PressRight jr BillsPC_JoypadDidNothing -MoveMonWithoutMail_DPad_2: ; e29f4 +MoveMonWithoutMail_DPad_2: ld hl, hJoyLast ld a, [wBillsPC_NumMonsOnScreen] ld d, a @@ -911,7 +884,7 @@ MoveMonWithoutMail_DPad_2: ; e29f4 jr nz, BillsPC_PressRight jr BillsPC_JoypadDidNothing -BillsPC_PressUp: ; e2a18 (38:6a18) +BillsPC_PressUp: ld hl, wBillsPC_CursorPosition ld a, [hl] and a @@ -927,7 +900,7 @@ BillsPC_PressUp: ; e2a18 (38:6a18) dec [hl] jr BillsPC_UpDownDidSomething -BillsPC_PressDown: ; e2a2c (38:6a2c) +BillsPC_PressDown: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -947,9 +920,8 @@ BillsPC_PressDown: ; e2a2c (38:6a2c) ld hl, wBillsPC_ScrollPosition inc [hl] jr BillsPC_UpDownDidSomething -; e2a48 (38:6a48) -BillsPC_PressLeft: ; e2a48 +BillsPC_PressLeft: ld hl, wBillsPC_LoadedBox ld a, [hl] and a @@ -961,7 +933,7 @@ BillsPC_PressLeft: ; e2a48 ld [hl], NUM_BOXES jr BillsPC_LeftRightDidSomething -BillsPC_PressRight: ; e2a56 +BillsPC_PressRight: ld hl, wBillsPC_LoadedBox ld a, [hl] cp NUM_BOXES @@ -973,23 +945,21 @@ BillsPC_PressRight: ; e2a56 ld [hl], 0 jr BillsPC_LeftRightDidSomething -BillsPC_JoypadDidNothing: ; e2a65 (38:6a65) +BillsPC_JoypadDidNothing: xor a and a ret -BillsPC_UpDownDidSomething: ; e2a68 (38:6a68) +BillsPC_UpDownDidSomething: ld a, TRUE and a ret -; e2a6c (38:6a6c) -BillsPC_LeftRightDidSomething: ; e2a6c +BillsPC_LeftRightDidSomething: scf ret -; e2a6e -BillsPC_PlaceString: ; e2a6e (38:6a6e) +BillsPC_PlaceString: push de hlcoord 0, 15 lb bc, 1, 18 @@ -998,18 +968,16 @@ BillsPC_PlaceString: ; e2a6e (38:6a6e) hlcoord 1, 16 call PlaceString ret -; e2a80 (38:6a80) -BillsPC_MoveMonWOMail_BoxNameAndArrows: ; e2a80 +BillsPC_MoveMonWOMail_BoxNameAndArrows: call BillsPC_BoxName hlcoord 8, 1 ld [hl], $5f hlcoord 19, 1 ld [hl], $5e ret -; e2a8e -BillsPC_BoxName: ; e2a8e (38:6a8e) +BillsPC_BoxName: hlcoord 8, 0 lb bc, 1, 10 call TextBox @@ -1038,13 +1006,11 @@ BillsPC_BoxName: ; e2a8e (38:6a8e) hlcoord 10, 1 call PlaceString ret -; e2abd (38:6abd) .PartyPKMN: db "PARTY <PK><MN>@" -; e2ac6 -PCMonInfo: ; e2ac6 (38:6ac6) +PCMonInfo: ; Display a monster's pic and ; attributes when highlighting ; it in a PC menu. @@ -1143,7 +1109,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld [hl], a ret -BillsPC_LoadMonStats: ; e2b6d (38:6b6d) +BillsPC_LoadMonStats: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1250,7 +1216,7 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) call CloseSRAM ret -BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) +BillsPC_RefreshTextboxes: hlcoord 8, 2 lb bc, 10, 10 call TextBox @@ -1287,13 +1253,11 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) dec a jr nz, .loop ret -; e2c67 (38:6c67) .CancelString: db "CANCEL@" -; e2c6e -.PlaceNickname: ; e2c6e (38:6c6e) +.PlaceNickname: ld a, [de] and a ret z @@ -1402,11 +1366,9 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) ld de, .Placeholder call PlaceString ret -; e2d2a (38:6d2a) .Placeholder: db "-----@" -; e2d30 copy_box_data: MACRO .loop\@ @@ -1442,7 +1404,7 @@ endc ld [wBillsPC_NumMonsInBox], a ENDM -CopyBoxmonSpecies: ; e2d30 (38:6d30) +CopyBoxmonSpecies: xor a ld hl, wBillsPCPokemonList ld bc, 3 * 30 @@ -1476,7 +1438,7 @@ CopyBoxmonSpecies: ; e2d30 (38:6d30) copy_box_data 1 ret -BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def) +BillsPC_GetSelectedPokemonSpecies: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1489,7 +1451,7 @@ BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def) ld a, [hl] ret -BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01) +BillsPC_UpdateSelectionCursor: ld a, [wBillsPC_NumMonsInBox] and a jr nz, .place_cursor @@ -1516,9 +1478,8 @@ rept SPRITEOAMSTRUCT_LENGTH + -1 inc de endr jr .loop -; e2e2b (38:6e2b) -.OAM: ; e2e2b +.OAM: dsprite 4, 6, 10, 0, $00, 0 dsprite 4, 6, 11, 0, $00, 0 dsprite 4, 6, 12, 0, $00, 0 @@ -1544,9 +1505,8 @@ endr dsprite 5, 6, 19, 1, $01, 0 | X_FLIP dsprite 6, 1, 19, 1, $01, 0 | X_FLIP | Y_FLIP db -1 -; e2e8c -BillsPC_UpdateInsertCursor: ; e2e8c +BillsPC_UpdateInsertCursor: ld hl, .OAM ld de, wVirtualOAMSprite00 .loop @@ -1566,9 +1526,8 @@ rept SPRITEOAMSTRUCT_LENGTH + -1 inc de endr jr .loop -; e2eac -.OAM: ; e2eac +.OAM: dsprite 4, 7, 10, 0, $06, 0 dsprite 5, 3, 11, 0, $00, 0 | Y_FLIP dsprite 5, 3, 12, 0, $00, 0 | Y_FLIP @@ -1580,9 +1539,8 @@ endr dsprite 5, 3, 18, 0, $00, 0 | Y_FLIP dsprite 4, 7, 19, 0, $07, 0 db -1 -; e2ed5 -Unreferenced_BillsPC_FillBox: ; e2ed5 +Unreferenced_BillsPC_FillBox: .row push bc push hl @@ -1597,9 +1555,8 @@ Unreferenced_BillsPC_FillBox: ; e2ed5 dec b jr nz, .row ret -; e2ee5 -BillsPC_CheckSpaceInDestination: ; e2ee5 +BillsPC_CheckSpaceInDestination: ; If moving within a box, no need to be here. ld hl, wBillsPC_LoadedBox ld a, [wBillsPC_BackupLoadedBox] @@ -1633,9 +1590,8 @@ BillsPC_CheckSpaceInDestination: ; e2ee5 call DelayFrames scf ret -; e2f18 -BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) +BillsPC_CheckMail_PreventBlackout: ld a, [wBillsPC_LoadedBox] and a jr nz, .Okay @@ -1675,7 +1631,7 @@ BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) scf ret -BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f) +BillsPC_IsMonAnEgg: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -1693,7 +1649,7 @@ BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f) scf ret -BillsPC_StatsScreen: ; e2f7e (38:6f7e) +BillsPC_StatsScreen: call LowVolume call BillsPC_CopyMon ld a, $3 @@ -1703,7 +1659,7 @@ BillsPC_StatsScreen: ; e2f7e (38:6f7e) call MaxVolume ret -StatsScreenDPad: ; e2f95 (38:6f95) +StatsScreenDPad: ld hl, hJoyPressed ; $ffa7 ld a, [hl] and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT @@ -1737,7 +1693,7 @@ StatsScreenDPad: ; e2f95 (38:6f95) ld [wMenuJoypad], a ret -BillsPC_CopyMon: ; e2fd6 (38:6fd6) +BillsPC_CopyMon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1809,7 +1765,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6) farcall CalcBufferMonStats ret -DepositPokemon: ; e307c (38:707c) +DepositPokemon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1861,7 +1817,7 @@ DepositPokemon: ; e307c (38:707c) scf ret -TryWithdrawPokemon: ; e30fa (38:70fa) +TryWithdrawPokemon: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -1916,8 +1872,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) scf ret - -ReleasePKMN_ByePKMN: ; e3180 (38:7180) +ReleasePKMN_ByePKMN: hlcoord 0, 0 lb bc, 15, 8 call ClearBox @@ -1962,9 +1917,8 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) ld c, 50 call DelayFrames ret -; e31e7 (38:71e7) -MovePKMNWitoutMail_InsertMon: ; e31e7 +MovePKMNWitoutMail_InsertMon: push hl push de push bc @@ -2005,27 +1959,23 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld de, .dw_return push de jp hl -; e322a -.dw_return ; e322a +.dw_return pop af ld e, a farcall MoveMonWOMail_InsertMon_SaveGame ret -; e3233 .Saving_LeaveOn: db "Saving… Leave ON!@" -; e3245 -.Jumptable: ; e3245 +.Jumptable: dw .BoxToBox dw .PartyToBox dw .BoxToParty dw .PartyToParty -; e324d -.BoxToBox: ; e324d +.BoxToBox: ld hl, wBillsPC_BackupLoadedBox ld a, [wBillsPC_LoadedBox] cp [hl] @@ -2039,9 +1989,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 call .CheckTrivialMove call .CopyToBox ret -; e3267 -.PartyToBox: ; e3267 +.PartyToBox: call .CopyFromParty ld a, $1 ld [wGameLogicPaused], a @@ -2050,22 +1999,19 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wGameLogicPaused], a call .CopyToBox ret -; e327d -.BoxToParty: ; e327d +.BoxToParty: call .CopyFromBox call .CopyToParty ret -; e3284 -.PartyToParty: ; e3284 +.PartyToParty: call .CopyFromParty call .CheckTrivialMove call .CopyToParty ret -; e328e -.CheckTrivialMove: ; e328e +.CheckTrivialMove: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] @@ -2089,9 +2035,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ret z dec [hl] ret -; e32b0 -.CopyFromBox: ; e32b0 +.CopyFromBox: ld a, [wBillsPC_BackupLoadedBox] dec a ld e, a @@ -2117,9 +2062,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ret -; e32fa -.CopyToBox: ; e32fa +.CopyToBox: ld a, [wBillsPC_LoadedBox] dec a ld e, a @@ -2130,9 +2074,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wCurPartyMon], a farcall InsertPokemonIntoBox ret -; e3316 -.CopyFromParty: ; e3316 +.CopyFromParty: ld a, [wBillsPC_BackupCursorPosition] ld hl, wBillsPC_BackupScrollPosition add [hl] @@ -2150,18 +2093,16 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox ret -; e3346 -.CopyToParty: ; e3346 +.CopyToParty: ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] ld [wCurPartyMon], a farcall InsertPokemonIntoParty ret -; e3357 -CopySpeciesToTemp: ; e3357 (38:7357) +CopySpeciesToTemp: ld a, [wCurPartyMon] ld c, a ld b, $0 @@ -2170,7 +2111,7 @@ CopySpeciesToTemp: ; e3357 (38:7357) ld [wCurPartySpecies], a ret -CopyNicknameToTemp: ; e3363 (38:7363) +CopyNicknameToTemp: ld bc, MON_NAME_LENGTH ld a, [wCurPartyMon] call AddNTimes @@ -2179,7 +2120,7 @@ CopyNicknameToTemp: ; e3363 (38:7363) call CopyBytes ret -CopyOTNameToTemp: ; e3376 (38:7376) +CopyOTNameToTemp: ld bc, NAME_LENGTH ld a, [wCurPartyMon] call AddNTimes @@ -2188,14 +2129,14 @@ CopyOTNameToTemp: ; e3376 (38:7376) call CopyBytes ret -CopyMonToTemp: ; e3389 (38:7389) +CopyMonToTemp: ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMon call CopyBytes ret -GetBoxPointer: ; e3396 (38:7396) +GetBoxPointer: dec b ld c, b ld b, 0 @@ -2209,9 +2150,8 @@ GetBoxPointer: ; e3396 (38:7396) ld h, [hl] ld l, a ret -; e33a6 (38:73a6) -.boxes ; e33a6 +.boxes ; bank, address dba sBox1 dba sBox2 @@ -2227,9 +2167,8 @@ GetBoxPointer: ; e3396 (38:7396) dba sBox12 dba sBox13 dba sBox14 -; e33d0 -BillsPC_ApplyPalettes: ; e33d0 (38:73d0) +BillsPC_ApplyPalettes: ld b, a call GetSGBLayout ld a, %11100100 @@ -2238,7 +2177,7 @@ BillsPC_ApplyPalettes: ; e33d0 (38:73d0) call DmgToCgbObjPal0 ret -BillsPC_Jumptable: ; e33df (38:73df) +BillsPC_Jumptable: ld e, a ld d, $0 add hl, de @@ -2248,7 +2187,7 @@ BillsPC_Jumptable: ; e33df (38:73df) ld l, a ret -BillsPC_InitGFX: ; e33e8 (38:73e8) +BillsPC_InitGFX: call DisableLCD ld hl, vTiles2 tile $00 ld bc, $31 tiles @@ -2267,11 +2206,9 @@ BillsPC_InitGFX: ; e33e8 (38:73e8) call SkipMusic call EnableLCD ret -; e3419 (38:7419) PCSelectLZ: INCBIN "gfx/pc/pc.2bpp.lz" PCMailGFX: INCBIN "gfx/pc/pc_mail.2bpp" -; e34dd PCString_ChooseaPKMN: db "Choose a <PK><MN>.@" PCString_WhatsUp: db "What's up?@" @@ -2289,10 +2226,8 @@ PCString_Non: db "Non.@" PCString_BoxFull: db "The BOX is full.@" PCString_PartyFull: db "The party's full!@" PCString_NoReleasingEGGS: db "No releasing EGGS!@" -; e35aa - -_ChangeBox: ; e35aa (38:75aa) +_ChangeBox: call LoadStandardMenuHeader call BillsPC_ClearTilemap .loop @@ -2318,7 +2253,7 @@ _ChangeBox: ; e35aa (38:75aa) call CloseWindow ret -BillsPC_ClearTilemap: ; e35e2 (38:75e2) +BillsPC_ClearTilemap: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -2326,16 +2261,14 @@ BillsPC_ClearTilemap: ; e35e2 (38:75e2) ld a, " " call ByteFill ret -; e35f1 (38:75f1) -_ChangeBox_MenuHeader: ; 0xe35f1 +_ChangeBox_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 5, 9, 12 dw .MenuData db 1 ; default option -; 0xe35f9 -.MenuData ; 0xe35f9 +.MenuData db MENU_UNUSED_1 | MENU_UNUSED_3 ; flags db 4, 0 db 1 @@ -2343,9 +2276,8 @@ _ChangeBox_MenuHeader: ; 0xe35f1 dba .boxnames dba NULL dba BillsPC_PrintBoxCountAndCapacity -; e3609 -.boxes ; e3609 +.boxes db NUM_BOXES x = 1 rept NUM_BOXES @@ -2353,9 +2285,8 @@ rept NUM_BOXES x = x + 1 endr db -1 -; e3619 -.boxnames ; e3619 +.boxnames push de ld a, [wMenuSelection] dec a @@ -2363,18 +2294,16 @@ endr pop hl call PlaceString ret -; e3626 -GetBoxName: ; e3626 (38:7626) +GetBoxName: ld bc, BOX_NAME_LENGTH ld hl, wBoxNames call AddNTimes ld d, h ld e, l ret -; e3632 (38:7632) -BillsPC_PrintBoxCountAndCapacity: ; e3632 +BillsPC_PrintBoxCountAndCapacity: hlcoord 11, 7 lb bc, 5, 7 call TextBox @@ -2393,21 +2322,18 @@ BillsPC_PrintBoxCountAndCapacity: ; e3632 ld de, .out_of_20 call PlaceString ret -; e3663 -.Pokemon: ; e3663 +.Pokemon: db "#MON@" -; e3668 -.out_of_20 ; e3668 +.out_of_20 ; db "/20@" db "/" db "0" + MONS_PER_BOX / 10 ; "2" db "0" + MONS_PER_BOX % 10 ; "0" db "@" -; e366c -GetBoxCount: ; e366c (38:766c) +GetBoxCount: ld a, [wCurBox] ld c, a ld a, [wMenuSelection] @@ -2447,9 +2373,8 @@ GetBoxCount: ; e366c (38:766c) ld a, [hl] call CloseSRAM ret -; e36a5 (38:76a5) -.boxbanks ; e36a5 +.boxbanks dba sBox1 dba sBox2 dba sBox3 @@ -2464,9 +2389,8 @@ GetBoxCount: ; e366c (38:766c) dba sBox12 dba sBox13 dba sBox14 -; e36cf -BillsPC_PrintBoxName: ; e36cf (38:76cf) +BillsPC_PrintBoxName: hlcoord 0, 0 ld b, 2 ld c, 18 @@ -2480,13 +2404,11 @@ BillsPC_PrintBoxName: ; e36cf (38:76cf) hlcoord 11, 2 call PlaceString ret -; e36f1 (38:76f1) -.Current: ; e36f1 +.Current: db "CURRENT@" -; e36f9 -BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) +BillsPC_ChangeBoxSubmenu: ld hl, .MenuHeader call LoadMenuHeader call VerticalMenu @@ -2552,45 +2474,38 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ld de, wd002 call CopyName2 ret -; e3778 (38:7778) hlcoord 11, 7 ; unused -.MenuHeader: ; 0xe377b +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 11, 4, SCREEN_WIDTH - 1, 13 dw .MenuData db 1 ; default option -; 0xe3783 -.MenuData: ; 0xe3783 +.MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "SWITCH@" db "NAME@" db "PRINT@" db "QUIT@" -; 0xe379c -BillsPC_PlaceChooseABoxString: ; e379c (38:779c) +BillsPC_PlaceChooseABoxString: ld de, .ChooseABox jr BillsPC_PlaceChangeBoxString -; e37a1 (38:77a1) -.ChooseABox: ; e37a1 +.ChooseABox: db "Choose a BOX.@" -; e37af -BillsPC_PlaceWhatsUpString: ; e37af (38:77af) +BillsPC_PlaceWhatsUpString: ld de, .WhatsUp jr BillsPC_PlaceChangeBoxString -; e37b4 (38:77b4) -.WhatsUp: ; e37b4 +.WhatsUp: db "What's up?@" -; e37be -BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be) +BillsPC_PlaceEmptyBoxString_SFX: ld de, .NoMonString call BillsPC_PlaceChangeBoxString ld de, SFX_WRONG @@ -2599,13 +2514,11 @@ BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be) ld c, 50 call DelayFrames ret -; e37d3 (38:77d3) -.NoMonString: ; e37d3 +.NoMonString: db "There's no #MON.@" -; e37e3 -BillsPC_PlaceChangeBoxString: ; e37e3 (38:77e3) +BillsPC_PlaceChangeBoxString: push de hlcoord 0, 14 lb bc, 2, 18 diff --git a/engine/pokemon/bills_pc_top.asm b/engine/pokemon/bills_pc_top.asm index 1e808c02c..550892f65 100644 --- a/engine/pokemon/bills_pc_top.asm +++ b/engine/pokemon/bills_pc_top.asm @@ -1,11 +1,11 @@ -_BillsPC: ; e3fd +_BillsPC: call .CheckCanUsePC ret c call .LogIn call .UseBillsPC jp .LogOut -.CheckCanUsePC: ; e40a (3:640a) +.CheckCanUsePC: ld a, [wPartyCount] and a ret nz @@ -14,12 +14,12 @@ _BillsPC: ; e3fd scf ret -.Text_GottaHavePokemon: ; 0xe417 +.Text_GottaHavePokemon: ; You gotta have #MON to call! text_jump UnknownText_0x1c1006 db "@" -.LogIn: ; e41c (3:641c) +.LogIn: xor a ld [hBGMapMode], a call LoadStandardMenuHeader @@ -35,16 +35,16 @@ _BillsPC: ; e3fd call LoadFontsBattleExtra ret -.Text_What: ; 0xe43a +.Text_What: ; What? text_jump UnknownText_0x1c1024 db "@" -.LogOut: ; e43f (3:643f) +.LogOut: call CloseSubmenu ret -.UseBillsPC: ; e443 (3:6443) +.UseBillsPC: ld hl, .MenuHeader call LoadMenuHeader ld a, $1 @@ -68,47 +68,47 @@ _BillsPC: ; e3fd call CloseWindow ret -.MenuHeader: ; 0xe46f +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw .MenuData db 1 ; default option -.MenuData: ; 0xe477 +.MenuData: db STATICMENU_CURSOR ; flags db 0 ; items dw .items dw PlaceMenuStrings dw .strings -.strings ; e47f +.strings db "WITHDRAW <PK><MN>@" db "DEPOSIT <PK><MN>@" db "CHANGE BOX@" db "MOVE <PK><MN> W/O MAIL@" db "SEE YA!@" -.Jumptable: ; e4ba (3:64ba) +.Jumptable: dw BillsPC_WithdrawMenu dw BillsPC_DepositMenu dw BillsPC_ChangeBoxMenu dw BillsPC_MovePKMNMenu dw BillsPC_SeeYa -.items ; e4c4 - db 5 +.items + db 5 ; # items db 0 ; WITHDRAW - db 1; DEPOSIT + db 1 ; DEPOSIT db 2 ; CHANGE BOX db 3 ; MOVE PKMN db 4 ; SEE YA! db -1 -BillsPC_SeeYa: ; e4cb +BillsPC_SeeYa: scf ret -BillsPC_MovePKMNMenu: ; e4cd +BillsPC_MovePKMNMenu: call LoadStandardMenuHeader farcall IsAnyMonHoldingMail jr nc, .no_mail @@ -128,12 +128,12 @@ BillsPC_MovePKMNMenu: ; e4cd and a ret -.Text_MonHoldingMail: ; 0xe4f9 +.Text_MonHoldingMail: ; There is a #MON holding MAIL. Please remove the MAIL. text_jump UnknownText_0x1c102b db "@" -BillsPC_DepositMenu: ; e4fe (3:64fe) +BillsPC_DepositMenu: call LoadStandardMenuHeader farcall _DepositPKMN call ReturnToMapFromSubmenu @@ -163,17 +163,17 @@ Unreferenced_Functione512: scf ret -.Text_NoMon: ; 0xe52e +.Text_NoMon: ; You don't have a single #MON! text_jump UnknownText_0x1c1062 db "@" -.Text_ItsYourLastMon: ; 0xe533 +.Text_ItsYourLastMon: ; You can't deposit your last #MON! text_jump UnknownText_0x1c1080 db "@" -CheckCurPartyMonFainted: ; e538 +CheckCurPartyMonFainted: ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH ld b, $0 @@ -202,7 +202,7 @@ CheckCurPartyMonFainted: ; e538 and a ret -BillsPC_WithdrawMenu: ; e559 (3:6559) +BillsPC_WithdrawMenu: call LoadStandardMenuHeader farcall _WithdrawPKMN call ReturnToMapFromSubmenu @@ -224,17 +224,17 @@ Unreferenced_Functione56d: scf ret -UnknownText_0xe57e: ; 0xe57e +UnknownText_0xe57e: ; You can't take any more #MON. text_jump UnknownText_0x1c10a2 db "@" -BillsPC_ChangeBoxMenu: ; e583 (3:6583) +BillsPC_ChangeBoxMenu: farcall _ChangeBox and a ret -ClearPCItemScreen: ; e58b +ClearPCItemScreen: call DisableSpriteUpdates xor a ld [hBGMapMode], a @@ -254,7 +254,7 @@ ClearPCItemScreen: ; e58b call SetPalettes ; load regular palettes? ret -CopyBoxmonToTempMon: ; e5bb +CopyBoxmonToTempMon: ld a, [wCurPartyMon] ld hl, sBoxMon1Species ld bc, BOXMON_STRUCT_LENGTH @@ -370,7 +370,7 @@ Unreferenced_Functione5d9: call CloseSRAM ret -.BoxAddrs: ; e66e +.BoxAddrs: dba sBox1 dba sBox2 dba sBox3 diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index e32d1a3a6..7e7f0e097 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -1,4 +1,4 @@ -CheckBreedmonCompatibility: ; 16e1d +CheckBreedmonCompatibility: call .CheckBreedingGroupCompatibility ld c, $0 jp nc, .done @@ -83,10 +83,8 @@ CheckBreedmonCompatibility: ; 16e1d ld a, c ld [wd265], a ret -; 16ebc - -.CheckDVs: ; 16ebc (5:6ebc) +.CheckDVs: ; If Defense DVs match and the lower 3 bits of the Special DVs match, ; avoid breeding ld a, [wBreedMon1DVs] @@ -103,9 +101,8 @@ CheckBreedmonCompatibility: ; 16e1d and %111 cp b ret -; 16ed6 -.CheckBreedingGroupCompatibility: ; 16ed6 +.CheckBreedingGroupCompatibility: ; If either mon is in the No Eggs group, ; they are not compatible. ld a, [wBreedMon2Species] @@ -173,9 +170,8 @@ CheckBreedmonCompatibility: ; 16e1d .Compatible: scf ret -; 16f3e -DoEggStep:: ; 16f3e +DoEggStep:: ld de, wPartySpecies ld hl, wPartyMon1Happiness ld c, 0 @@ -198,24 +194,22 @@ DoEggStep:: ; 16f3e add hl, de pop de jr .loop -; 16f5e -OverworldHatchEgg:: ; 16f5e +OverworldHatchEgg:: call RefreshScreen call LoadStandardMenuHeader call HatchEggs call ExitAllMenus call RestartMapMusic jp CloseText -; 16f70 -HatchEggs: ; 16f70 (5:6f70) +HatchEggs: ld de, wPartySpecies ld hl, wPartyMon1Happiness xor a ld [wCurPartyMon], a -.loop ; 16f7a (5:6f7a) +.loop ld a, [de] inc de cp -1 @@ -348,7 +342,7 @@ HatchEggs: ; 16f70 (5:6f70) ld bc, MON_NAME_LENGTH call CopyBytes -.next ; 1707d (5:707d) +.next ld hl, wCurPartyMon inc [hl] pop hl @@ -357,11 +351,10 @@ HatchEggs: ; 16f70 (5:6f70) pop de jp .loop -.done ; 1708a (5:708a) +.done ret -; 1708b (5:708b) -.Text_HatchEgg: ; 0x1708b +.Text_HatchEgg: ; Huh? @ @ text_jump UnknownText_0x1c0db0 start_asm @@ -382,27 +375,23 @@ HatchEggs: ; 16f70 (5:6f70) pop hl ld hl, .CameOutOfItsEgg ret -; 170b0 (5:70b0) -.ClearTextbox: ; 0x170b0 +.ClearTextbox: ; text_jump UnknownText_0x1c0db8 db "@" -; 0x170b5 -.CameOutOfItsEgg: ; 0x170b5 +.CameOutOfItsEgg: ; came out of its EGG!@ @ text_jump UnknownText_0x1c0dba db "@" -; 0x170ba -.Text_NicknameHatchling: ; 0x170ba +.Text_NicknameHatchling: ; Give a nickname to @ ? text_jump UnknownText_0x1c0dd8 db "@" -; 0x170bf -InitEggMoves: ; 170bf +InitEggMoves: call GetHeritableMoves ld d, h ld e, l @@ -431,9 +420,8 @@ InitEggMoves: ; 170bf .done ret -; 170e4 -GetEggMove: ; 170e4 +GetEggMove: push bc ld a, [wEggMonSpecies] dec a @@ -445,7 +433,7 @@ GetEggMove: ; 170e4 ld a, BANK(EggMovePointers) call GetFarHalfword .loop - ld a, BANK(EggMoves) + ld a, BANK("Egg Moves") call GetFarByte cp -1 jr z, .reached_end @@ -479,18 +467,18 @@ GetEggMove: ; 170e4 ld a, BANK(EvosAttacksPointers) call GetFarHalfword .loop3 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte inc hl and a jr nz, .loop3 .loop4 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte and a jr z, .inherit_tmhm inc hl - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") call GetFarByte ld b, a ld a, [de] @@ -526,9 +514,8 @@ GetEggMove: ; 170e4 pop bc and a ret -; 17169 -LoadEggMove: ; 17169 +LoadEggMove: push de push bc ld a, [de] @@ -561,9 +548,8 @@ LoadEggMove: ; 17169 pop bc pop de ret -; 17197 -GetHeritableMoves: ; 17197 +GetHeritableMoves: ld hl, wBreedMon2Moves ld a, [wBreedMon1Species] cp DITTO @@ -619,9 +605,8 @@ GetHeritableMoves: ; 17197 pop af ld [wCurPartySpecies], a ret -; 1720b -GetBreedmonMovePointer: ; 1720b +GetBreedmonMovePointer: ld hl, wBreedMon1Moves ld a, [wBreedMon1Species] cp DITTO @@ -636,10 +621,8 @@ GetBreedmonMovePointer: ; 1720b .ditto ld hl, wBreedMon2Moves ret -; 17224 - -GetEggFrontpic: ; 17224 (5:7224) +GetEggFrontpic: push de ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -649,7 +632,7 @@ GetEggFrontpic: ; 17224 (5:7224) pop de predef_jump GetMonFrontpic -GetHatchlingFrontpic: ; 1723c (5:723c) +GetHatchlingFrontpic: push de ld [wCurPartySpecies], a ld [wCurSpecies], a @@ -659,7 +642,7 @@ GetHatchlingFrontpic: ; 1723c (5:723c) pop de predef_jump GetAnimatedFrontpic -Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) +Hatch_UpdateFrontpicBGMapCenter: push af call WaitTop push hl @@ -681,7 +664,7 @@ Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254) call SetPalettes jp WaitBGMap -EggHatch_DoAnimFrame: ; 1727f (5:727f) +EggHatch_DoAnimFrame: push hl push de push bc @@ -692,7 +675,7 @@ EggHatch_DoAnimFrame: ; 1727f (5:727f) pop hl ret -EggHatch_AnimationSequence: ; 1728f (5:728f) +EggHatch_AnimationSequence: ld a, [wd265] ld [wJumptableIndex], a ld a, [wCurSpecies] @@ -782,13 +765,13 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) ld [wCurSpecies], a ret -Hatch_LoadFrontpicPal: ; 17363 (5:7363) +Hatch_LoadFrontpicPal: ld [wPlayerHPPal], a ld b, SCGB_EVOLUTION ld c, $0 jp GetSGBLayout -EggHatch_CrackShell: ; 1736d (5:736d) +EggHatch_CrackShell: ld a, [wFrameCounter] dec a and $7 @@ -808,13 +791,11 @@ EggHatch_CrackShell: ; 1736d (5:736d) ld [hl], $0 ld de, SFX_EGG_CRACK jp PlaySFX -; 17393 (5:7393) -EggHatchGFX: ; 17393 +EggHatchGFX: INCBIN "gfx/evo/egg_hatch.2bpp" -; 173b3 -Hatch_InitShellFragments: ; 173b3 (5:73b3) +Hatch_InitShellFragments: farcall ClearSpriteAnims ld hl, .SpriteData .loop @@ -856,14 +837,13 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3) call PlaySFX call EggHatch_DoAnimFrame ret -; 173ef (5:73ef) shell_fragment: MACRO ; y tile, y pxl, x tile, x pxl, frameset offset, ??? db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6 ENDM -.SpriteData: ; 173ef +.SpriteData: shell_fragment 10, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $3c shell_fragment 11, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $04 shell_fragment 10, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $30 @@ -875,9 +855,8 @@ ENDM shell_fragment 10, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $2a shell_fragment 12, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $16 db -1 -; 17418 -Hatch_ShellFragmentLoop: ; 17418 (5:7418) +Hatch_ShellFragmentLoop: ld c, 129 .loop call EggHatch_DoAnimFrame @@ -885,7 +864,7 @@ Hatch_ShellFragmentLoop: ; 17418 (5:7418) jr nz, .loop ret -DayCareMon1: ; 17421 +DayCareMon1: ld hl, DayCareMon1Text call PrintText ld a, [wBreedMon1Species] @@ -898,7 +877,7 @@ DayCareMon1: ; 17421 call DayCareMonCompatibilityText jp PrintText -DayCareMon2: ; 17440 +DayCareMon2: ld hl, DayCareMon2Text call PrintText ld a, [wBreedMon2Species] @@ -911,23 +890,20 @@ DayCareMon2: ; 17440 call DayCareMonCompatibilityText jp PrintText -DayCareMonCursor: ; 1745f +DayCareMonCursor: jp WaitPressAorB_BlinkCursor -; 17462 -DayCareMon2Text: ; 0x17462 +DayCareMon2Text: ; It's @ that was left with the DAY-CARE LADY. text_jump UnknownText_0x1c0df3 db "@" -; 0x17467 -DayCareMon1Text: ; 0x17467 +DayCareMon1Text: ; It's @ that was left with the DAY-CARE MAN. text_jump UnknownText_0x1c0e24 db "@" -; 0x1746c -DayCareMonCompatibilityText: ; 1746c +DayCareMonCompatibilityText: push bc ld de, wStringBuffer1 ld bc, NAME_LENGTH @@ -951,44 +927,35 @@ DayCareMonCompatibilityText: ; 1746c .done ret -; 1749c -.AllAlone: ; 0x1749c +.AllAlone: ; It's brimming with energy. text_jump UnknownText_0x1c0e54 db "@" -; 0x174a1 -.Incompatible: ; 0x174a1 +.Incompatible: ; It has no interest in @ . text_jump UnknownText_0x1c0e6f db "@" -; 0x174a6 -.HighCompatibility: ; 0x174a6 +.HighCompatibility: ; It appears to care for @ . text_jump UnknownText_0x1c0e8d db "@" -; 0x174ab -.ModerateCompatibility: ; 0x174ab +.ModerateCompatibility: ; It's friendly with @ . text_jump UnknownText_0x1c0eac db "@" -; 0x174b0 -.SlightCompatibility: ; 0x174b0 +.SlightCompatibility: ; It shows interest in @ . text_jump UnknownText_0x1c0ec6 db "@" -; 0x174b5 -Unreferenced_DayCareMonPrintEmptyString: ; 174b5 +Unreferenced_DayCareMonPrintEmptyString: ld hl, .string ret -; 174b9 -.string ; 174b9 +.string db "@" -; 174ba - diff --git a/engine/pokemon/breedmon_level_growth.asm b/engine/pokemon/breedmon_level_growth.asm index dc22db798..c6356dd6e 100644 --- a/engine/pokemon/breedmon_level_growth.asm +++ b/engine/pokemon/breedmon_level_growth.asm @@ -1,4 +1,4 @@ -GetBreedMon1LevelGrowth: ; e698 +GetBreedMon1LevelGrowth: ld hl, wBreedMon1Stats ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH @@ -12,7 +12,7 @@ GetBreedMon1LevelGrowth: ; e698 ld d, a ret -GetBreedMon2LevelGrowth: ; e6b3 +GetBreedMon2LevelGrowth: ld hl, wBreedMon2Stats ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH diff --git a/engine/pokemon/caught_data.asm b/engine/pokemon/caught_data.asm index 3bfacf539..89d22fdf6 100644 --- a/engine/pokemon/caught_data.asm +++ b/engine/pokemon/caught_data.asm @@ -1,4 +1,4 @@ -CheckPartyFullAfterContest: ; 4d9e5 +CheckPartyFullAfterContest: ld a, [wContestMon] and a jp z, .DidntCatchAnything @@ -85,7 +85,7 @@ CheckPartyFullAfterContest: ; 4d9e5 ld [wScriptVar], a ret -.TryAddToBox: ; 4daa3 +.TryAddToBox: ld a, BANK(sBoxCount) call GetSRAMBank ld hl, sBoxCount @@ -146,27 +146,27 @@ CheckPartyFullAfterContest: ; 4d9e5 ld [wScriptVar], a ret -.DidntCatchAnything: ; 4db35 +.DidntCatchAnything: ld a, BUGCONTEST_NO_CATCH ld [wScriptVar], a ret -GiveANickname_YesNo: ; 4db3b +GiveANickname_YesNo: ld hl, TextJump_GiveANickname call PrintText jp YesNoBox -TextJump_GiveANickname: ; 0x4db44 +TextJump_GiveANickname: ; Give a nickname to the @ you received? text_jump UnknownText_0x1c12fc db "@" -SetCaughtData: ; 4db49 +SetCaughtData: ld a, [wPartyCount] dec a ld hl, wPartyMon1CaughtLevel call GetPartyLocation -SetBoxmonOrEggmonCaughtData: ; 4db53 +SetBoxmonOrEggmonCaughtData: ld a, [wTimeOfDay] inc a rrca @@ -199,7 +199,7 @@ SetBoxmonOrEggmonCaughtData: ; 4db53 ld [hl], a ret -SetBoxMonCaughtData: ; 4db83 +SetBoxMonCaughtData: ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank ld hl, sBoxMon1CaughtLevel @@ -207,7 +207,7 @@ SetBoxMonCaughtData: ; 4db83 call CloseSRAM ret -SetGiftBoxMonCaughtData: ; 4db92 +SetGiftBoxMonCaughtData: push bc ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank @@ -217,14 +217,14 @@ SetGiftBoxMonCaughtData: ; 4db92 call CloseSRAM ret -SetGiftPartyMonCaughtData: ; 4dba3 +SetGiftPartyMonCaughtData: ld a, [wPartyCount] dec a ld hl, wPartyMon1CaughtLevel push bc call GetPartyLocation pop bc -SetGiftMonCaughtData: ; 4dbaf +SetGiftMonCaughtData: xor a ld [hli], a ld a, GIFT_LOCATION @@ -233,7 +233,7 @@ SetGiftMonCaughtData: ; 4dbaf ld [hl], a ret -SetEggMonCaughtData: ; 4dbb8 (13:5bb8) +SetEggMonCaughtData: ld a, [wCurPartyMon] ld hl, wPartyMon1CaughtLevel call GetPartyLocation diff --git a/engine/pokemon/correct_nick_errors.asm b/engine/pokemon/correct_nick_errors.asm index 5d44846bf..335540cfe 100644 --- a/engine/pokemon/correct_nick_errors.asm +++ b/engine/pokemon/correct_nick_errors.asm @@ -1,4 +1,4 @@ -CorrectNickErrors:: ; 669f +CorrectNickErrors:: ; error-check monster nick before use ; must be a peace offering to gamesharkers @@ -60,7 +60,7 @@ CorrectNickErrors:: ; 669f pop bc ret -.textcommands ; 66cf +.textcommands ; table defining which characters are actually text commands ; format: ; ≥ < diff --git a/engine/pokemon/correct_party_errors.asm b/engine/pokemon/correct_party_errors.asm index cf60115ee..50a9f3562 100644 --- a/engine/pokemon/correct_party_errors.asm +++ b/engine/pokemon/correct_party_errors.asm @@ -201,13 +201,11 @@ Unreferenced_CorrectPartyErrors: dec b jr nz, .loop5 ret -; 13b6b -.TAMAGO: ; 13b6b +.TAMAGO: db "タマゴ@@@" -; 13b71 -.GetLengthOfStringWith6CharCap: ; 13b71 +.GetLengthOfStringWith6CharCap: push de ld c, 1 ld b, NAME_LENGTH_JAPANESE @@ -226,4 +224,3 @@ Unreferenced_CorrectPartyErrors: .done pop de ret -; 13b87 diff --git a/engine/pokemon/european_mail.asm b/engine/pokemon/european_mail.asm index 8f037cc43..38c542d35 100644 --- a/engine/pokemon/european_mail.asm +++ b/engine/pokemon/european_mail.asm @@ -1,4 +1,4 @@ -IsMailEuropean: ; 1de5c8 +IsMailEuropean: ; return 1 if French ; return 2 if German ; return 3 if Italian @@ -27,18 +27,18 @@ IsMailEuropean: ; 1de5c8 ret ; The regular font. -StandardEnglishFont: ; 1de5e6 +StandardEnglishFont: INCBIN "gfx/font/english.1bpp" ; An extended font. -FrenchGermanFont: ; 1de9e6 +FrenchGermanFont: INCBIN "gfx/font/french_german.1bpp" ; An even more extended font. -SpanishItalianFont: ; 1dede6 +SpanishItalianFont: INCBIN "gfx/font/spanish_italian.1bpp" -HandleFrenchGermanMail: ; 1df1e6 +HandleFrenchGermanMail: ; called if mail is french or german ; fix 's 't 'v ld b, sPartyMon1MailAuthor - sPartyMon1Mail @@ -68,7 +68,7 @@ HandleFrenchGermanMail: ; 1df1e6 ret LireLeCourrierAnglais: -DeutenEnglischenPost: ; 1df203 +DeutenEnglischenPost: ; Cette fonction convertit certains des caractères anglais pour ; leur équivalent dans le jeu de caractères français. ; Diese Funktion wandelt bestimmte englische Zeichen, um ihre @@ -99,7 +99,7 @@ DeutenEnglischenPost: ; 1df203 jr nz, .loop ret -HandleSpanishItalianMail: ; 1df220 +HandleSpanishItalianMail: LeerCorreosIngleses: LeggiPostaInglese: ; This function converts certain characters between diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm index 291bd79b0..571cff0b8 100644 --- a/engine/pokemon/evolve.asm +++ b/engine/pokemon/evolve.asm @@ -1,4 +1,4 @@ -EvolvePokemon: ; 421d8 +EvolvePokemon: ld hl, wEvolvableFlags xor a ld [hl], a @@ -6,7 +6,7 @@ EvolvePokemon: ; 421d8 ld c, a ld b, SET_FLAG call EvoFlagAction -EvolveAfterBattle: ; 421e6 +EvolveAfterBattle: xor a ld [wMonTriedToEvolve], a dec a @@ -87,7 +87,6 @@ EvolveAfterBattle_MasterLoop: cp EVOLVE_HAPPINESS jr z, .happiness - ; EVOLVE_STAT ld a, [wTempMonLevel] cp [hl] @@ -116,7 +115,6 @@ EvolveAfterBattle_MasterLoop: inc hl jr .proceed - .happiness ld a, [wTempMonHappiness] cp HAPPINESS_TO_EVOLVE @@ -143,7 +141,6 @@ EvolveAfterBattle_MasterLoop: jp z, .dont_evolve_3 jr .proceed - .trade ld a, [wLinkMode] and a @@ -169,7 +166,6 @@ EvolveAfterBattle_MasterLoop: ld [wTempMonItem], a jr .proceed - .item ld a, [hli] ld b, a @@ -185,7 +181,6 @@ EvolveAfterBattle_MasterLoop: jp nz, .dont_evolve_3 jr .proceed - .level ld a, [hli] ld b, a @@ -323,7 +318,6 @@ EvolveAfterBattle_MasterLoop: ld l, e ld h, d jp EvolveAfterBattle_MasterLoop -; 423f8 .dont_evolve_1 inc hl @@ -349,9 +343,8 @@ EvolveAfterBattle_MasterLoop: and a call nz, RestartMapMusic ret -; 42414 -UpdateSpeciesNameIfNotNicknamed: ; 42414 +UpdateSpeciesNameIfNotNicknamed: ld a, [wCurSpecies] push af ld a, [wBaseDexNo] @@ -382,17 +375,15 @@ UpdateSpeciesNameIfNotNicknamed: ; 42414 pop de ld bc, MON_NAME_LENGTH jp CopyBytes -; 42454 -CancelEvolution: ; 42454 +CancelEvolution: ld hl, Text_StoppedEvolving call PrintText call ClearTileMap pop hl jp EvolveAfterBattle_MasterLoop -; 42461 -IsMonHoldingEverstone: ; 42461 +IsMonHoldingEverstone: push hl ld a, [wCurPartyMon] ld hl, wPartyMon1Item @@ -402,34 +393,28 @@ IsMonHoldingEverstone: ; 42461 cp EVERSTONE pop hl ret -; 42473 -Text_CongratulationsYourPokemon: ; 0x42473 +Text_CongratulationsYourPokemon: ; Congratulations! Your @ @ text_jump UnknownText_0x1c4b92 db "@" -; 0x42478 -Text_EvolvedIntoPKMN: ; 0x42478 +Text_EvolvedIntoPKMN: ; evolved into @ ! text_jump UnknownText_0x1c4baf db "@" -; 0x4247d -Text_StoppedEvolving: ; 0x4247d +Text_StoppedEvolving: ; Huh? @ stopped evolving! text_jump UnknownText_0x1c4bc5 db "@" -; 0x42482 -Text_WhatEvolving: ; 0x42482 +Text_WhatEvolving: ; What? @ is evolving! text_jump UnknownText_0x1c4be3 db "@" -; 0x42487 - -LearnLevelMoves: ; 42487 +LearnLevelMoves: ld a, [wd265] ld [wCurPartySpecies], a dec a @@ -492,10 +477,8 @@ LearnLevelMoves: ; 42487 ld a, [wCurPartySpecies] ld [wd265], a ret -; 424e1 - -FillMoves: ; 424e1 +FillMoves: ; Fill in moves at de for wCurPartySpecies at wCurPartyLevel push hl @@ -604,9 +587,8 @@ FillMoves: ; 424e1 pop de pop hl ret -; 4256e -ShiftMoves: ; 4256e +ShiftMoves: ld c, NUM_MOVES - 1 .loop inc de @@ -615,18 +597,15 @@ ShiftMoves: ; 4256e dec c jr nz, .loop ret -; 42577 - -EvoFlagAction: ; 42577 +EvoFlagAction: push de ld d, $0 predef SmallFarFlagAction pop de ret -; 42581 -GetPreEvolution: ; 42581 +GetPreEvolution: ; Find the first mon to evolve into wCurPartySpecies. ; Return carry and the new species in wCurPartySpecies @@ -673,4 +652,3 @@ GetPreEvolution: ; 42581 ld [wCurPartySpecies], a scf ret -; 425b1 diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 6b94ed357..3c3b10439 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -1,4 +1,4 @@ -CalcLevel: ; 50e1b +CalcLevel: ld a, [wTempMonSpecies] ld [wCurSpecies], a call GetBaseData @@ -30,7 +30,7 @@ CalcLevel: ; 50e1b dec d ret -CalcExpAtLevel: ; 50e47 +CalcExpAtLevel: ; (a/b)*n**3 + c*n**2 + d*n - e ld a, [wBaseGrowthRate] add a @@ -150,7 +150,7 @@ CalcExpAtLevel: ; 50e47 ld [hMultiplicand], a ret -.LevelSquared: ; 50eed +.LevelSquared: xor a ld [hMultiplicand + 0], a ld [hMultiplicand + 1], a diff --git a/engine/pokemon/health.asm b/engine/pokemon/health.asm index cc47e8252..229da1e19 100644 --- a/engine/pokemon/health.asm +++ b/engine/pokemon/health.asm @@ -1,4 +1,4 @@ -HealParty: ; c658 +HealParty: xor a ld [wCurPartyMon], a ld hl, wPartySpecies @@ -22,7 +22,7 @@ HealParty: ; c658 .done ret -HealPartyMon: ; c677 +HealPartyMon: ld a, MON_SPECIES call GetPartyParamLocation ld d, h @@ -52,7 +52,7 @@ HealPartyMon: ; c677 farcall RestoreAllPP ret -ComputeHPBarPixels: ; c699 +ComputeHPBarPixels: ; e = bc * (6 * 8) / de ld a, b or c @@ -103,7 +103,7 @@ ComputeHPBarPixels: ; c699 ld e, 0 ret -AnimateHPBar: ; c6e0 +AnimateHPBar: call WaitBGMap call _AnimateHPBar call WaitBGMap diff --git a/engine/pokemon/knows_move.asm b/engine/pokemon/knows_move.asm index 4ec3da347..d84a0d424 100644 --- a/engine/pokemon/knows_move.asm +++ b/engine/pokemon/knows_move.asm @@ -1,4 +1,4 @@ -KnowsMove: ; f9ea +KnowsMove: ld a, MON_MOVES call GetPartyParamLocation ld a, [wPutativeTMHMMove] @@ -19,7 +19,7 @@ KnowsMove: ; f9ea scf ret -.Text_knows: ; 0xfa06 +.Text_knows: ; knows @ . text_jump UnknownText_0x1c5ea8 db "@" diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm index fb62289a7..20294c878 100644 --- a/engine/pokemon/learn.asm +++ b/engine/pokemon/learn.asm @@ -1,4 +1,4 @@ -LearnMove: ; 6508 +LearnMove: call LoadTileMapToTempTileMap ld a, [wCurPartyMon] ld hl, wPartyMonNicknames @@ -117,9 +117,8 @@ LearnMove: ; 6508 call PrintText ld b, 1 ret -; 65d3 -ForgetMove: ; 65d3 +ForgetMove: push hl ld hl, Text_TryingToLearn call PrintText @@ -200,40 +199,34 @@ ForgetMove: ; 65d3 .cancel scf ret -; 666b -Text_LearnedMove: ; 666b +Text_LearnedMove: ; <MON> learned <MOVE>! text_jump UnknownText_0x1c5660 db "@" -; 6670 -Text_ForgetWhich: ; 6670 +Text_ForgetWhich: ; Which move should be forgotten? text_jump UnknownText_0x1c5678 db "@" -; 6675 -Text_StopLearning: ; 6675 +Text_StopLearning: ; Stop learning <MOVE>? text_jump UnknownText_0x1c5699 db "@" -; 667a -Text_DidNotLearn: ; 667a +Text_DidNotLearn: ; <MON> did not learn <MOVE>. text_jump UnknownText_0x1c56af db "@" -; 667f -Text_TryingToLearn: ; 667f +Text_TryingToLearn: ; <MON> is trying to learn <MOVE>. But <MON> can't learn more than ; four moves. Delete an older move to make room for <MOVE>? text_jump UnknownText_0x1c56c9 db "@" -; 6684 -Text_1_2_and_Poof: ; 6684 +Text_1_2_and_Poof: text_jump UnknownText_0x1c5740 ; 1, 2 and… start_asm push de @@ -247,10 +240,8 @@ Text_1_2_and_Poof: ; 6684 ; Poof! <MON> forgot <MOVE>. And… text_jump UnknownText_0x1c574e db "@" -; 669a -Text_CantForgetHM: ; 669a +Text_CantForgetHM: ; HM moves can't be forgotten now. text_jump UnknownText_0x1c5772 db "@" -; 669f diff --git a/engine/pokemon/level_up_happiness.asm b/engine/pokemon/level_up_happiness.asm index 8c6dd92fe..533399d9f 100644 --- a/engine/pokemon/level_up_happiness.asm +++ b/engine/pokemon/level_up_happiness.asm @@ -1,4 +1,4 @@ -LevelUpHappinessMod: ; 2709e +LevelUpHappinessMod: ld a, [wCurPartyMon] ld hl, wPartyMon1CaughtLocation call GetPartyLocation diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm index 33bce604d..359d2ac8e 100644 --- a/engine/pokemon/mail.asm +++ b/engine/pokemon/mail.asm @@ -1,4 +1,4 @@ -SendMailToPC: ; 4456e +SendMailToPC: ld a, MON_ITEM call GetPartyParamLocation ld d, [hl] @@ -37,9 +37,8 @@ SendMailToPC: ; 4456e .full scf ret -; 445c0 -DeleteMailFromPC: ; 445c0 (11:45c0) +DeleteMailFromPC: ; Shift all mail messages in the mailbox ld a, BANK(sMailboxCount) call GetSRAMBank @@ -71,9 +70,8 @@ DeleteMailFromPC: ; 445c0 (11:45c0) ld hl, sMailboxCount dec [hl] jp CloseSRAM -; 445f4 (11:45f4) -ReadMailMessage: ; 445f4 +ReadMailMessage: ld a, b ld hl, sMailbox ld bc, MAIL_STRUCT_LENGTH @@ -83,7 +81,7 @@ ReadMailMessage: ; 445f4 farcall ReadAnyMail ret -MoveMailFromPCToParty: ; 44607 +MoveMailFromPCToParty: ld a, BANK(sMailboxCount) call GetSRAMBank push bc @@ -114,17 +112,15 @@ MoveMailFromPCToParty: ; 44607 call CloseSRAM pop bc jp DeleteMailFromPC -; 44648 (11:4648) -GetMailboxCount: ; 44648 +GetMailboxCount: ld a, BANK(sMailboxCount) call GetSRAMBank ld a, [sMailboxCount] ld c, a jp CloseSRAM -; 44654 -CheckPokeMail:: ; 44654 +CheckPokeMail:: push bc push de farcall SelectMonFromParty @@ -191,10 +187,8 @@ CheckPokeMail:: ; 44654 .return ld [wScriptVar], a ret -; 446cc - -GivePokeMail:: ; 446cc +GivePokeMail:: ld a, [wPartyCount] dec a push af @@ -241,10 +235,8 @@ GivePokeMail:: ; 446cc ld a, b ld [de], a jp CloseSRAM -; 44725 - -BackupPartyMonMail: ; 44725 +BackupPartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank ld hl, sPartyMail @@ -256,9 +248,8 @@ BackupPartyMonMail: ; 44725 ld bc, 1 + 10 * MAIL_STRUCT_LENGTH call CopyBytes jp CloseSRAM -; 44745 -RestorePartyMonMail: ; 44745 (11:4745) +RestorePartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank ld hl, sPartyMailBackup @@ -271,7 +262,7 @@ RestorePartyMonMail: ; 44745 (11:4745) call CopyBytes jp CloseSRAM -DeletePartyMonMail: ; 44765 (11:4765) +DeletePartyMonMail: ld a, BANK(sPartyMail) call GetSRAMBank xor a @@ -283,10 +274,8 @@ DeletePartyMonMail: ; 44765 (11:4765) ld bc, 1 + 10 * MAIL_STRUCT_LENGTH call ByteFill jp CloseSRAM -; 44781 (11:4781) - -IsAnyMonHoldingMail: ; 44781 +IsAnyMonHoldingMail: ld a, [wPartyCount] and a jr z, .no_mons @@ -308,9 +297,8 @@ IsAnyMonHoldingMail: ; 44781 .no_mons and a ret -; 447a0 -_PlayerMailBoxMenu: ; 0x447a0 +_PlayerMailBoxMenu: call InitMail jr z, .nomail call LoadStandardMenuHeader @@ -320,13 +308,12 @@ _PlayerMailBoxMenu: ; 0x447a0 .nomail ld hl, .EmptyMailboxText jp MenuTextBoxBackup -; 0x447b4 -.EmptyMailboxText: ; 0x447b4 +.EmptyMailboxText: text_jump _EmptyMailboxText db "@" -InitMail: ; 0x447b9 +InitMail: ; initialize wMailboxCount and beyond with incrementing values, one per mail ; set z if no mail ld a, BANK(sMailboxCount) @@ -353,9 +340,8 @@ InitMail: ; 0x447b9 ld a, [wMailboxCount] and a ret -; 0x447da -MailboxPC_GetMailAuthor: ; 0x447da +MailboxPC_GetMailAuthor: dec a ld hl, sMailbox1Author ld bc, MAIL_STRUCT_LENGTH @@ -371,17 +357,15 @@ MailboxPC_GetMailAuthor: ; 0x447da call CloseSRAM pop de ret -; 0x447fb -MailboxPC_PrintMailAuthor: ; 0x447fb +MailboxPC_PrintMailAuthor: push de ld a, [wMenuSelection] call MailboxPC_GetMailAuthor pop hl jp PlaceString -; 0x44806 -MailboxPC: ; 0x44806 +MailboxPC: xor a ld [wCurMessageScrollPosition], a ld a, 1 @@ -414,9 +398,8 @@ MailboxPC: ; 0x44806 .exit xor a ret -; 0x4484a -.Submenu: ; 0x4484a +.Submenu: ld hl, .SubMenuHeader call LoadMenuHeader call VerticalMenu @@ -429,7 +412,6 @@ MailboxPC: ; 0x44806 .subexit ret -; 0x44861 .JumpTable: dw .ReadMail @@ -437,16 +419,15 @@ MailboxPC: ; 0x44806 dw .AttachMail dw .Cancel -.ReadMail: ; 0x44869 +.ReadMail: call FadeToMenu ld a, [wMenuSelection] dec a ld b, a call ReadMailMessage jp CloseSubmenu -; 0x44877 -.PutInPack: ; 0x44877 +.PutInPack: ld hl, .MessageLostText call MenuTextBox call YesNoBox @@ -470,21 +451,20 @@ MailboxPC: ; 0x44806 call DeleteMailFromPC ld hl, .PutAwayText jp MenuTextBoxBackup -; 0x448ac -.PutAwayText: ; 0x448ac +.PutAwayText: text_jump ClearedMailPutAwayText db "@" -.PackFullText: ; 0x448b1 +.PackFullText: text_jump MailPackFullText db "@" -.MessageLostText: ; 0x448b6 +.MessageLostText: text_jump MailMessageLostText db "@" -.GetMailType: ; 0x448bb +.GetMailType: push af ld a, BANK(sMailboxCount) call GetSRAMBank @@ -495,9 +475,8 @@ MailboxPC: ; 0x44806 ld a, [hl] ld [wCurItem], a jp CloseSRAM -; 0x448d2 -.AttachMail: ; 0x448d2 +.AttachMail: call FadeToMenu xor a ld [wPartyMenuActionText], a @@ -540,24 +519,23 @@ MailboxPC: ; 0x44806 .exit2 jp CloseSubmenu -; 0x4493c -.HoldingMailText: ; 0x4493c +.HoldingMailText: text_jump MailAlreadyHoldingItemText db "@" -.EggText: ; 0x44941 +.EggText: text_jump MailEggText db "@" -.MailMovedText: ; 0x44946 +.MailMovedText: text_jump MailMovedFromBoxText db "@" .Cancel: ret -.TopMenuHeader: ; 0x4494c +.TopMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 8, 1, SCREEN_WIDTH - 2, 10 dw .TopMenuData @@ -572,7 +550,7 @@ MailboxPC: ; 0x44806 dba NULL dba NULL -.SubMenuHeader: ; 0x44964 +.SubMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 13, 9 dw .SubMenuData diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index 6e326641b..1cc776706 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -1,11 +1,11 @@ -ReadPartyMonMail: ; b9229 +ReadPartyMonMail: ld a, [wCurPartyMon] ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld d, h ld e, l -ReadAnyMail: ; b9237 +ReadAnyMail: push de call ClearBGPalettes call ClearSprites @@ -63,9 +63,8 @@ ReadAnyMail: ; b9237 pop af ld [wJumptableIndex], a jr .loop -; b92b8 -.LoadGFX: ; b92b8 +.LoadGFX: ld h, d ld l, e push hl @@ -110,9 +109,8 @@ ReadAnyMail: ; b9237 jp hl .done ret -; b92f8 -MailGFXPointers: ; b92f8 +MailGFXPointers: dbw FLOWER_MAIL, LoadFlowerMailGFX dbw SURF_MAIL, LoadSurfMailGFX dbw LITEBLUEMAIL, LoadLiteBlueMailGFX @@ -124,9 +122,8 @@ MailGFXPointers: ; b92f8 dbw MUSIC_MAIL, LoadMusicMailGFX dbw MIRAGE_MAIL, LoadMirageMailGFX db -1 -; b9317 -LoadSurfMailGFX: ; b9317 +LoadSurfMailGFX: push bc ld hl, vTiles2 tile $31 ld de, SurfMailBorderGFX @@ -140,7 +137,7 @@ LoadSurfMailGFX: ; b9317 call LoadMailGFX_Color2 jr FinishLoadingSurfLiteBlueMailGFX -LoadLiteBlueMailGFX: ; b9335 +LoadLiteBlueMailGFX: push bc ld hl, vTiles2 tile $31 ld de, LiteBlueMailBorderGFX @@ -153,7 +150,7 @@ LoadLiteBlueMailGFX: ; b9335 ld c, 1 * 8 call LoadMailGFX_Color2 -FinishLoadingSurfLiteBlueMailGFX: ; b9351 +FinishLoadingSurfLiteBlueMailGFX: ld de, SurfLiteBlueMailSmallShapesGFX ld c, 2 * 8 call LoadMailGFX_Color2 @@ -209,9 +206,8 @@ FinishLoadingSurfLiteBlueMailGFX: ; b9351 ld [hli], a pop hl jp MailGFX_PlaceMessage -; b93d2 -LoadEonMailGFX: ; b93d2 +LoadEonMailGFX: push bc ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX @@ -259,9 +255,8 @@ LoadEonMailGFX: ; b93d2 call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b944b -LoadLovelyMailGFX: ; b944b +LoadLovelyMailGFX: push bc ld hl, vTiles2 tile $31 ld de, LovelyMailBorderGFX @@ -290,9 +285,8 @@ LoadLovelyMailGFX: ; b944b call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b9491 -LovelyEonMail_PlaceIcons: ; b9491 +LovelyEonMail_PlaceIcons: ld a, $3d hlcoord 2, 2 call Mail_Draw2x2Graphic @@ -322,9 +316,8 @@ LovelyEonMail_PlaceIcons: ; b9491 hlcoord 16, 12 ld [hl], a ret -; b94d6 -LoadMorphMailGFX: ; b94d6 +LoadMorphMailGFX: push bc ld hl, vTiles2 tile $31 ld bc, 5 * 8 @@ -398,9 +391,8 @@ LoadMorphMailGFX: ; b94d6 call Mail_Draw3x2Graphic pop hl jp MailGFX_PlaceMessage -; b9582 -LoadBlueSkyMailGFX: ; b9582 +LoadBlueSkyMailGFX: push bc ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX @@ -476,9 +468,8 @@ LoadBlueSkyMailGFX: ; b9582 call Mail_Draw2x2Graphic pop hl jp MailGFX_PlaceMessage -; b9636 -Mail_Place6TileRow: ; b9636 +Mail_Place6TileRow: ld b, $6 .loop ld [hli], a @@ -486,9 +477,8 @@ Mail_Place6TileRow: ; b9636 dec b jr nz, .loop ret -; b963e -LoadFlowerMailGFX: ; b963e +LoadFlowerMailGFX: push bc ld hl, vTiles2 tile $31 ld de, FlowerMailBorderGFX @@ -541,9 +531,8 @@ LoadFlowerMailGFX: ; b963e call Mail_Draw2x2Graphic pop hl jp MailGFX_PlaceMessage -; b96ca -LoadPortraitMailGFX: ; b96ca +LoadPortraitMailGFX: push bc ld hl, vTiles2 tile $31 ld de, PortraitMailBorderGFX @@ -572,9 +561,8 @@ LoadPortraitMailGFX: ; b96ca call PrepMonFrontpic pop hl jp MailGFX_PlaceMessage -; b9710 -LoadMusicMailGFX: ; b9710 +LoadMusicMailGFX: push bc ld hl, vTiles2 tile $31 ld de, MusicMailBorderGFX @@ -615,9 +603,8 @@ LoadMusicMailGFX: ; b9710 call LovelyEonMail_PlaceIcons pop hl jp MailGFX_PlaceMessage -; b9776 -LoadMirageMailGFX: ; b9776 +LoadMirageMailGFX: push bc ld hl, vTiles2 tile $31 ld bc, 5 * 8 @@ -676,9 +663,8 @@ LoadMirageMailGFX: ; b9776 call Mail_Draw16TileRow pop hl jp MailGFX_PlaceMessage -; b97f8 -MailGFX_GenerateMonochromeTilesColor2: ; b97f8 +MailGFX_GenerateMonochromeTilesColor2: .loop xor a ld [hli], a @@ -689,9 +675,8 @@ MailGFX_GenerateMonochromeTilesColor2: ; b97f8 or c jr nz, .loop ret -; b9803 -MailGFX_PlaceMessage: ; b9803 +MailGFX_PlaceMessage: ld bc, MAIL_STRUCT_LENGTH ld de, wTempMail ld a, BANK(sPartyMail) @@ -723,9 +708,8 @@ MailGFX_PlaceMessage: ; b9803 .place_author jp PlaceString -; b984e -Unreferenced_Functionb984e: ; b984e +Unreferenced_Functionb984e: .loop ld a, [hl] xor $ff @@ -735,9 +719,8 @@ Unreferenced_Functionb984e: ; b984e or c jr nz, .loop ret -; b9858 -DrawMailBorder: ; b9858 +DrawMailBorder: hlcoord 0, 0 ld a, $31 ld [hli], a @@ -757,9 +740,8 @@ DrawMailBorder: ; b9858 ld a, $38 ld [hl], a ret -; b987b -DrawMailBorder2: ; b987b +DrawMailBorder2: hlcoord 0, 0 ld a, $31 ld [hli], a @@ -778,23 +760,22 @@ DrawMailBorder2: ; b987b call Mail_DrawLeftRightBorder ld [hl], $31 ret -; b989e -Mail_Place14TileAlternatingRow: ; b989e +Mail_Place14TileAlternatingRow: push af ld b, 14 / 2 jr Mail_PlaceAlternatingRow -Mail_Place16TileAlternatingRow: ; b98a3 +Mail_Place16TileAlternatingRow: push af ld b, 16 / 2 jr Mail_PlaceAlternatingRow -Mail_Place18TileAlternatingRow: ; b98a8 +Mail_Place18TileAlternatingRow: push af ld b, 18 / 2 -Mail_PlaceAlternatingRow: ; b98ab +Mail_PlaceAlternatingRow: .loop ld [hli], a inc a @@ -805,18 +786,17 @@ Mail_PlaceAlternatingRow: ; b98ab ld [hl], a pop af ret -; b98b5 -Mail_Place14TileAlternatingColumn: ; b98b5 +Mail_Place14TileAlternatingColumn: push af ld b, 14 / 2 jr Mail_PlaceAlternatingColumn -Mail_Place16TileAlternatingColumn: ; b98ba +Mail_Place16TileAlternatingColumn: push af ld b, 16 / 2 -Mail_PlaceAlternatingColumn: ; b98bd +Mail_PlaceAlternatingColumn: .loop ld [hl], a ld de, SCREEN_WIDTH @@ -830,36 +810,34 @@ Mail_PlaceAlternatingColumn: ; b98bd ld [hl], a pop af ret -; b98cc -Mail_Draw7TileRow: ; b98cc +Mail_Draw7TileRow: ld b, $7 jr Mail_DrawRowLoop -Mail_Draw13TileRow: ; b98d0 +Mail_Draw13TileRow: ld b, $d jr Mail_DrawRowLoop -Mail_Draw16TileRow: ; b98d4 +Mail_Draw16TileRow: ld b, $10 jr Mail_DrawRowLoop -Mail_DrawTopBottomBorder: ; b98d8 +Mail_DrawTopBottomBorder: ld b, SCREEN_WIDTH - 2 jr Mail_DrawRowLoop -Mail_DrawFullWidthBorder: ; b98dc +Mail_DrawFullWidthBorder: ld b, SCREEN_WIDTH -Mail_DrawRowLoop: ; b98de +Mail_DrawRowLoop: .loop ld [hli], a dec b jr nz, .loop ret -; b98e3 -Mail_DrawLeftRightBorder: ; b98e3 +Mail_DrawLeftRightBorder: ld b, SCREEN_HEIGHT - 2 ld de, SCREEN_WIDTH .loop @@ -868,9 +846,8 @@ Mail_DrawLeftRightBorder: ; b98e3 dec b jr nz, .loop ret -; b98ee -Mail_Draw2x2Graphic: ; b98ee +Mail_Draw2x2Graphic: push af ld [hli], a inc a @@ -883,9 +860,8 @@ Mail_Draw2x2Graphic: ; b98ee ld [hl], a pop af ret -; b98fc -Mail_Draw3x2Graphic: ; b98fc +Mail_Draw3x2Graphic: ld [hli], a inc a ld [hli], a @@ -900,9 +876,8 @@ Mail_Draw3x2Graphic: ; b98fc inc a ld [hl], a ret -; b990c -LoadMailGFX_Color1: ; b990c +LoadMailGFX_Color1: .loop ld a, [de] inc de @@ -912,9 +887,8 @@ LoadMailGFX_Color1: ; b990c dec c jr nz, .loop ret -; b9915 -LoadMailGFX_Color2: ; b9915 +LoadMailGFX_Color2: .loop xor a ld [hli], a @@ -924,9 +898,8 @@ LoadMailGFX_Color2: ; b9915 dec c jr nz, .loop ret -; b991e -LoadMailGFX_Color3: ; b991e +LoadMailGFX_Color3: .loop ld a, [de] inc de @@ -935,15 +908,13 @@ LoadMailGFX_Color3: ; b991e dec c jr nz, .loop ret -; b9926 INCLUDE "gfx/mail.asm" -ItemIsMail: ; b9e76 +ItemIsMail: ld a, d ld hl, MailItems ld de, 1 jp IsInArray -; b9e80 INCLUDE "data/items/mail_items.asm" diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 088b1b1a3..2d14bd603 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -1,6 +1,6 @@ INCLUDE "data/mon_menu.asm" -MonSubmenu: ; 24d19 +MonSubmenu: xor a ld [hBGMapMode], a call GetMonSubmenuItems @@ -17,16 +17,14 @@ MonSubmenu: ; 24d19 call ExitMenu ret -; 24d3f -.MenuHeader: ; 24d3f +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw 0 db 1 ; default option -; 24d47 -.GetTopCoord: ; 24d47 +.GetTopCoord: ; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) ld a, [wBuffer1] inc a @@ -38,9 +36,8 @@ MonSubmenu: ; 24d19 ld [wMenuBorderTopCoord], a call MenuBox ret -; 24d59 -MonMenuLoop: ; 24d59 +MonMenuLoop: .loop ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags ld [wMenuDataFlags], a @@ -72,9 +69,8 @@ MonMenuLoop: ; 24d59 add hl, bc ld a, [hl] ret -; 24d91 -PopulateMonMenu: ; 24d91 +PopulateMonMenu: call MenuBoxCoord2Tile ld bc, 2 * SCREEN_WIDTH + 2 add hl, bc @@ -93,9 +89,8 @@ PopulateMonMenu: ; 24d91 add hl, bc pop de jr .loop -; 24db0 -GetMonMenuString: ; 24db0 +GetMonMenuString: ld hl, MonMenuOptions + 1 ld de, 3 call IsInArray @@ -118,9 +113,8 @@ GetMonMenuString: ; 24db0 ld d, h ld e, l ret -; 24dd4 -GetMonSubmenuItems: ; 24dd4 +GetMonSubmenuItems: call ResetMonSubmenu ld a, [wCurPartySpecies] cp EGG @@ -195,9 +189,8 @@ GetMonSubmenuItems: ; 24dd4 call AddMonMenuItem call TerminateMonSubmenu ret -; 24e52 -IsFieldMove: ; 24e52 +IsFieldMove: ld b, a ld hl, MonMenuOptions .next @@ -216,18 +209,16 @@ IsFieldMove: ; 24e52 .nope ret -; 24e68 -ResetMonSubmenu: ; 24e68 +ResetMonSubmenu: xor a ld [wBuffer1], a ld hl, wBuffer2 ld bc, NUM_MONMENU_ITEMS + 1 call ByteFill ret -; 24e76 -TerminateMonSubmenu: ; 24e76 +TerminateMonSubmenu: ld a, [wBuffer1] ld e, a ld d, 0 @@ -235,9 +226,8 @@ TerminateMonSubmenu: ; 24e76 add hl, de ld [hl], -1 ret -; 24e83 -AddMonMenuItem: ; 24e83 +AddMonMenuItem: push hl push de push af @@ -253,9 +243,8 @@ AddMonMenuItem: ; 24e83 pop de pop hl ret -; 24e99 -BattleMonMenu: ; 24e99 +BattleMonMenu: ld hl, MenuHeader_0x24ed4 call CopyMenuHeader xor a @@ -286,19 +275,16 @@ BattleMonMenu: ; 24e99 .clear_carry and a ret -; 24ed4 -MenuHeader_0x24ed4: ; 24ed4 +MenuHeader_0x24ed4: db 0 ; flags menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24edc db 1 ; default option -; 24edc -MenuData_0x24edc: ; 24edc +MenuData_0x24edc: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 3 ; items db "SWITCH@" db "STATS@" db "CANCEL@" -; 24ef2 diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index 5468d76fe..76f09b461 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -1,11 +1,11 @@ -DrawPlayerHP: ; 50b0a +DrawPlayerHP: ld a, $1 jr DrawHP -DrawEnemyHP: ; 50b0e +DrawEnemyHP: ld a, $2 -DrawHP: ; 50b10 +DrawHP: ld [wWhichHPBar], a push hl push bc @@ -82,7 +82,7 @@ DrawHP: ; 50b10 pop de ret -PrintTempMonStats: ; 50b7b +PrintTempMonStats: ; Print wTempMon's stats at hl, with spacing bc. push bc push hl @@ -105,7 +105,7 @@ PrintTempMonStats: ; 50b7b ld de, wTempMonSpeed jp PrintNum -.PrintStat: ; 50bab +.PrintStat: push hl call PrintNum pop hl @@ -113,7 +113,7 @@ PrintTempMonStats: ; 50b7b add hl, de ret -.StatNames: ; 50bb5 +.StatNames: db "ATTACK" next "DEFENSE" next "SPCL.ATK" @@ -121,7 +121,7 @@ PrintTempMonStats: ; 50b7b next "SPEED" next "@" -GetGender: ; 50bdd +GetGender: ; Return the gender of a given monster (wCurPartyMon/wCurOTMon/wCurWildMon). ; When calling this function, a should be set to an appropriate wMonType value. @@ -170,7 +170,6 @@ GetGender: ; 50bdd call AddNTimes .DVs: - ; sBoxMon data is read directly from SRAM. ld a, [wMonType] cp BOXMON @@ -235,7 +234,7 @@ GetGender: ; 50bdd scf ret -ListMovePP: ; 50c50 +ListMovePP: ld a, [wNumMoves] inc a ld c, a @@ -316,7 +315,7 @@ ListMovePP: ; 50c50 .done ret -.load_loop ; 50cc9 +.load_loop ld [hli], a ld [hld], a add hl, de @@ -324,7 +323,7 @@ ListMovePP: ; 50c50 jr nz, .load_loop ret -Unreferenced_Function50cd0: ; 50cd0 +Unreferenced_Function50cd0: .loop ld [hl], $32 inc hl @@ -363,7 +362,7 @@ Unused_PlaceEnemyHPLevel: .egg ret -PlaceStatusString: ; 50d0a +PlaceStatusString: push de inc de inc de @@ -382,10 +381,10 @@ PlaceStatusString: ; 50d0a and a ret -FntString: ; 50d22 +FntString: db "FNT@" -CopyStatusString: ; 50d25 +CopyStatusString: ld a, [de] inc de ld [hli], a @@ -396,7 +395,7 @@ CopyStatusString: ; 50d25 ld [hl], a ret -PlaceNonFaintStatus: ; 50d2e +PlaceNonFaintStatus: push de ld a, [de] ld de, PsnString @@ -430,7 +429,7 @@ BrnString: db "BRN@" FrzString: db "FRZ@" ParString: db "PAR@" -ListMoves: ; 50d6f +ListMoves: ; List moves at hl, spaced every [wBuffer1] tiles. ld de, wListMoves_MoveIndicesBuffer ld b, $0 diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 630479797..128bbf200 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -1,4 +1,4 @@ -TryAddMonToParty: ; d88c +TryAddMonToParty: ; Check if to copy wild mon or generate a new one ; Whose is it? ld de, wPartyCount @@ -76,7 +76,7 @@ TryAddMonToParty: ; d88c dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes -GeneratePartyMonStats: ; d906 +GeneratePartyMonStats: ; wBattleMode specifies whether it's a wild mon or not. ; wMonType specifies whether it's an opposing mon or not. ; wCurPartySpecies/wCurPartyLevel specify the species and level. @@ -360,9 +360,8 @@ endr .done scf ; When this function returns, the carry flag indicates success vs failure. ret -; da6d -FillPP: ; da6d +FillPP: push bc ld b, NUM_MOVES .loop @@ -391,9 +390,8 @@ FillPP: ; da6d jr nz, .loop pop bc ret -; da96 -AddTempmonToParty: ; da96 +AddTempmonToParty: ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH @@ -477,7 +475,7 @@ AddTempmonToParty: ; da96 and a ret -SendGetMonIntoFromBox: ; db3f +SendGetMonIntoFromBox: ; Sents/Gets mon into/from Box depending on Parameter ; wPokemonWithdrawDepositParameter == 0: get mon into Party ; wPokemonWithdrawDepositParameter == 1: sent mon into Box @@ -702,15 +700,13 @@ SendGetMonIntoFromBox: ; db3f call CloseSRAM and a ret -; dcb1 -CloseSRAM_And_SetCarryFlag: ; dcb1 +CloseSRAM_And_SetCarryFlag: call CloseSRAM scf ret -; dcb6 -RestorePPofDepositedPokemon: ; dcb6 +RestorePPofDepositedPokemon: ld a, b ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH @@ -773,9 +769,8 @@ RestorePPofDepositedPokemon: ; dcb6 pop af ld [wMenuCursorY], a ret -; dd21 -RetrieveMonFromDayCareMan: ; dd21 +RetrieveMonFromDayCareMan: ld a, [wBreedMon1Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION @@ -789,9 +784,8 @@ RetrieveMonFromDayCareMan: ; dd21 xor a ld [wPokemonWithdrawDepositParameter], a jp RetrieveBreedmon -; dd42 -RetrieveMonFromDayCareLady: ; dd42 +RetrieveMonFromDayCareLady: ld a, [wBreedMon2Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION @@ -805,9 +799,8 @@ RetrieveMonFromDayCareLady: ; dd42 ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a jp RetrieveBreedmon -; dd64 -RetrieveBreedmon: ; dd64 +RetrieveBreedmon: ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH @@ -902,9 +895,8 @@ RetrieveBreedmon: ; dd64 ld [hl], a and a ret -; de1a -GetLastPartyMon: ; de1a +GetLastPartyMon: ld a, [wPartyCount] dec a ld hl, wPartyMon1Species @@ -913,25 +905,22 @@ GetLastPartyMon: ; de1a ld d, h ld e, l ret -; de2a -DepositMonWithDayCareMan: ; de2a +DepositMonWithDayCareMan: ld de, wBreedMon1Nick call DepositBreedmon xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a jp RemoveMonFromPartyOrBox -; de37 -DepositMonWithDayCareLady: ; de37 +DepositMonWithDayCareLady: ld de, wBreedMon2Nick call DepositBreedmon xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a jp RemoveMonFromPartyOrBox -; de44 -DepositBreedmon: ; de44 +DepositBreedmon: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames call SkipNames @@ -947,7 +936,7 @@ DepositBreedmon: ; de44 ld bc, BOXMON_STRUCT_LENGTH jp CopyBytes -SendMonIntoBox: ; de6e +SendMonIntoBox: ; Sends the mon into one of Bills Boxes ; the data comes mainly from 'wEnemyMon:' ld a, BANK(sBoxCount) @@ -1073,15 +1062,13 @@ SendMonIntoBox: ; de6e call CloseSRAM scf ret -; df42 -.full ; df42 +.full call CloseSRAM and a ret -; df47 -ShiftBoxMon: ; df47 +ShiftBoxMon: ld hl, sBoxMonOT ld bc, NAME_LENGTH call .shift @@ -1127,9 +1114,8 @@ ShiftBoxMon: ; df47 or b jr nz, .loop ret -; df8c -GiveEgg:: ; df8c +GiveEgg:: ld a, [wCurPartySpecies] push af callfar GetPreEvolution @@ -1226,13 +1212,11 @@ GiveEgg:: ; df8c ld [hl], a and a ret -; e035 -String_Egg: ; e035 +String_Egg: db "EGG@" -; e039 -RemoveMonFromPartyOrBox: ; e039 +RemoveMonFromPartyOrBox: ld hl, wPartyCount ld a, [wPokemonWithdrawDepositParameter] @@ -1382,10 +1366,8 @@ RemoveMonFromPartyOrBox: ; e039 jr nz, .loop2 .close_sram jp CloseSRAM -; e134 - -ComputeNPCTrademonStats: ; e134 +ComputeNPCTrademonStats: ld a, MON_LEVEL call GetPartyParamLocation ld a, [hl] @@ -1413,16 +1395,15 @@ ComputeNPCTrademonStats: ; e134 ld a, [de] ld [hl], a ret -; e167 -CalcMonStats: ; e167 +CalcMonStats: ; Calculates all 6 Stats of a mon ; b: Take into account stat EXP if TRUE ; 'c' counts from 1-6 and points with 'wBaseStats' to the base value ; hl is the path to the Stat EXP ; de points to where the final stats will be saved - ld c, $0 + ld c, STAT_HP - 1 ; first stat .loop inc c call CalcMonStatC @@ -1433,12 +1414,11 @@ CalcMonStats: ; e167 ld [de], a inc de ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .loop ret -; e17b -CalcMonStatC: ; e17b +CalcMonStatC: ; 'c' is 1-6 and points to the BaseStat ; 1: HP ; 2: Attack @@ -1454,14 +1434,14 @@ CalcMonStatC: ; e17b push hl ld hl, wBaseStats dec hl ; has to be decreased, because 'c' begins with 1 - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld e, a pop hl push hl ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .not_spdef dec hl dec hl @@ -1497,29 +1477,29 @@ CalcMonStatC: ; e17b jr z, .Special cp STAT_SDEF jr z, .Special -; DV_HP = (DV_ATK & 1) << 3 + (DV_DEF & 1) << 2 + (DV_SPD & 1) << 1 + (DV_SPC & 1) +; DV_HP = (DV_ATK & 1) << 3 | (DV_DEF & 1) << 2 | (DV_SPD & 1) << 1 | (DV_SPC & 1) push bc ld a, [hl] swap a - and $1 + and 1 add a add a add a ld b, a ld a, [hli] - and $1 + and 1 add a add a add b ld b, a ld a, [hl] swap a - and $1 + and 1 add a add b ld b, a ld a, [hl] - and $1 + and 1 add b pop bc jr .GotDV @@ -1632,9 +1612,8 @@ CalcMonStatC: ; e17b pop de pop hl ret -; e277 -GivePoke:: ; e277 +GivePoke:: push de push bc xor a ; PARTYMON @@ -1812,22 +1791,19 @@ GivePoke:: ; e277 call CloseSRAM ld b, $1 ret -; e3d4 -.FailedToGiveMon: ; e3d4 +.FailedToGiveMon: pop bc pop de ld b, $2 ret -; e3d9 -TextJump_WasSentToBillsPC: ; 0xe3d9 +TextJump_WasSentToBillsPC: ; was sent to BILL's PC. text_jump Text_WasSentToBillsPC db "@" -; 0xe3de -InitNickname: ; e3de +InitNickname: push de call LoadStandardMenuHeader call DisableSpriteUpdates @@ -1842,4 +1818,3 @@ InitNickname: ; e3de ld hl, ExitAllMenus rst FarCall ret -; e3fd diff --git a/engine/pokemon/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm index 5d81da8a0..1dab879c7 100644 --- a/engine/pokemon/move_mon_wo_mail.asm +++ b/engine/pokemon/move_mon_wo_mail.asm @@ -1,4 +1,4 @@ -InsertPokemonIntoBox: ; 51322 +InsertPokemonIntoBox: ld a, BANK(sBoxCount) call GetSRAMBank ld hl, sBoxCount @@ -37,7 +37,7 @@ InsertPokemonIntoBox: ; 51322 farcall RestorePPofDepositedPokemon jp CloseSRAM -InsertPokemonIntoParty: ; 5138b +InsertPokemonIntoParty: ld hl, wPartyCount call InsertSpeciesIntoBoxOrParty ld a, [wPartyCount] @@ -63,7 +63,7 @@ InsertPokemonIntoParty: ; 5138b call InsertDataIntoBoxOrParty ret -InsertSpeciesIntoBoxOrParty: ; 513cb +InsertSpeciesIntoBoxOrParty: inc [hl] inc hl ld a, [wCurPartyMon] @@ -81,7 +81,7 @@ InsertSpeciesIntoBoxOrParty: ; 513cb jr nz, .loop ret -InsertDataIntoBoxOrParty: ; 513e0 +InsertDataIntoBoxOrParty: push de push hl push bc diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index 11edc0412..c3a70dbdc 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -1,4 +1,4 @@ -SelectMonFromParty: ; 50000 +SelectMonFromParty: call DisableSpriteUpdates xor a ld [wPartyMenuActionText], a @@ -10,10 +10,8 @@ SelectMonFromParty: ; 50000 call PartyMenuSelect call ReturnToMapWithSpeechTextbox ret -; 5001d - -SelectTradeOrDayCareMon: ; 5001d +SelectTradeOrDayCareMon: ld a, b ld [wPartyMenuActionText], a call DisableSpriteUpdates @@ -27,26 +25,22 @@ SelectTradeOrDayCareMon: ; 5001d call PartyMenuSelect call ReturnToMapWithSpeechTextbox ret -; 5003f -InitPartyMenuLayout: ; 5003f +InitPartyMenuLayout: call LoadPartyMenuGFX call InitPartyMenuWithCancel call InitPartyMenuGFX call WritePartyMenuTilemap call PrintPartyMenuText ret -; 5004f -LoadPartyMenuGFX: ; 5004f +LoadPartyMenuGFX: call LoadFontsBattleExtra callfar InitPartyMenuPalettes ; engine/color.asm callfar ClearSpriteAnims2 ret -; 5005f - -WritePartyMenuTilemap: ; 0x5005f +WritePartyMenuTilemap: ld hl, wOptions ld a, [hl] push af @@ -71,9 +65,8 @@ WritePartyMenuTilemap: ; 0x5005f pop af ld [wOptions], a ret -; 0x50089 -.Jumptable: ; 50089 +.Jumptable: ; entries correspond to PARTYMENUQUALITY_* constants dw PlacePartyNicknames dw PlacePartyHPBar @@ -84,9 +77,8 @@ WritePartyMenuTilemap: ; 0x5005f dw PlacePartyMonEvoStoneCompatibility dw PlacePartyMonGender dw PlacePartyMonMobileBattleSelection -; 5009b -PlacePartyNicknames: ; 5009b +PlacePartyNicknames: hlcoord 3, 1 ld a, [wPartyCount] and a @@ -116,14 +108,11 @@ PlacePartyNicknames: ; 5009b ld de, .CANCEL call PlaceString ret -; 500c8 -.CANCEL: ; 500c8 +.CANCEL: db "CANCEL@" -; 500cf - -PlacePartyHPBar: ; 500cf +PlacePartyHPBar: xor a ld [wSGBPals], a ld a, [wPartyCount] @@ -164,9 +153,8 @@ PlacePartyHPBar: ; 500cf ld b, SCGB_PARTY_MENU call GetSGBLayout ret -; 50117 -PlacePartymonHPBar: ; 50117 +PlacePartymonHPBar: ld a, b ld bc, PARTYMON_STRUCT_LENGTH ld hl, wPartyMon1HP @@ -191,9 +179,8 @@ PlacePartymonHPBar: ; 50117 ld e, a predef ComputeHPBarPixels ret -; 50138 -PlacePartyMenuHPDigits: ; 50138 +PlacePartyMenuHPDigits: ld a, [wPartyCount] and a ret z @@ -233,9 +220,8 @@ PlacePartyMenuHPDigits: ; 50138 dec c jr nz, .loop ret -; 50176 -PlacePartyMonLevel: ; 50176 +PlacePartyMonLevel: ld a, [wPartyCount] and a ret z @@ -276,9 +262,8 @@ PlacePartyMonLevel: ; 50176 dec c jr nz, .loop ret -; 501b2 -PlacePartyMonStatus: ; 501b2 +PlacePartyMonStatus: ld a, [wPartyCount] and a ret z @@ -309,9 +294,8 @@ PlacePartyMonStatus: ; 501b2 dec c jr nz, .loop ret -; 501e0 -PlacePartyMonTMHMCompatibility: ; 501e0 +PlacePartyMonTMHMCompatibility: ld a, [wPartyCount] and a ret z @@ -344,9 +328,8 @@ PlacePartyMonTMHMCompatibility: ; 501e0 dec c jr nz, .loop ret -; 50215 -.PlaceAbleNotAble: ; 50215 +.PlaceAbleNotAble: ld a, c and a jr nz, .able @@ -356,18 +339,14 @@ PlacePartyMonTMHMCompatibility: ; 501e0 .able ld de, .string_able ret -; 50221 -.string_able ; 50221 +.string_able db "ABLE@" -; 50226 -.string_not_able ; 50226 +.string_not_able db "NOT ABLE@" -; 5022f - -PlacePartyMonEvoStoneCompatibility: ; 5022f +PlacePartyMonEvoStoneCompatibility: ld a, [wPartyCount] and a ret z @@ -404,9 +383,8 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f dec c jr nz, .loop ret -; 50268 -.DetermineCompatibility: ; 50268 +.DetermineCompatibility: ld de, wStringBuffer1 ld a, BANK(EvosAttacksPointers) ld bc, 2 @@ -416,7 +394,7 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f ld h, [hl] ld l, a ld de, wStringBuffer1 - ld a, BANK(EvosAttacks) + ld a, BANK("Evolutions and Attacks") ld bc, 10 call FarCopyBytes ld hl, wStringBuffer1 @@ -441,17 +419,13 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f .nope ld de, .string_not_able ret -; 502a3 -.string_able ; 502a3 +.string_able db "ABLE@" -; 502a8 -.string_not_able ; 502a8 +.string_not_able db "NOT ABLE@" -; 502b1 - -PlacePartyMonGender: ; 502b1 +PlacePartyMonGender: ld a, [wPartyCount] and a ret z @@ -489,22 +463,17 @@ PlacePartyMonGender: ; 502b1 dec c jr nz, .loop ret -; 502ee -.male ; 502ee +.male db "♂…MALE@" -; 502f5 -.female ; 502f5 +.female db "♀…FEMALE@" -; 502fe -.unknown ; 502fe +.unknown db "…UNKNOWN@" -; 50307 - -PlacePartyMonMobileBattleSelection: ; 50307 +PlacePartyMonMobileBattleSelection: ld a, [wPartyCount] and a ret z @@ -571,23 +540,17 @@ PlacePartyMonMobileBattleSelection: ; 50307 dec b ret z jr .loop2 -; 5036b -.String_Banme: ; 5036b +.String_Banme: db " ばんめ @" ; Place -; 50372 -.String_Sanka_Shinai: ; 50372 +.String_Sanka_Shinai: db "さんかしない@" ; Cancel -; 50379 -.String_Kettei_Yameru: ; 50379 +.String_Kettei_Yameru: db "けってい やめる@" ; Quit -; 50383 -.Strings_1_2_3: ; 50383 +.Strings_1_2_3: db "1@", "2@", "3@" ; 1st, 2nd, 3rd -; 50389 - -PartyMenuCheckEgg: ; 50389 +PartyMenuCheckEgg: ld a, LOW(wPartySpecies) add b ld e, a @@ -597,9 +560,8 @@ PartyMenuCheckEgg: ; 50389 ld a, [de] cp EGG ret -; 50396 -GetPartyMenuQualityIndexes: ; 50396 +GetPartyMenuQualityIndexes: ld a, [wPartyMenuActionText] and $f0 jr nz, .skip @@ -618,12 +580,10 @@ GetPartyMenuQualityIndexes: ; 50396 .skip ld hl, PartyMenuQualityPointers.Default ret -; 503b2 INCLUDE "data/party_menu_qualities.asm" - -InitPartyMenuGFX: ; 503e0 +InitPartyMenuGFX: ld hl, wPartyCount ld a, [hli] and a @@ -647,9 +607,8 @@ InitPartyMenuGFX: ; 503e0 jr nz, .loop callfar PlaySpriteAnimations ret -; 50405 -InitPartyMenuWithCancel: ; 50405 +InitPartyMenuWithCancel: ; with cancel xor a ld [wSwitchMon], a @@ -675,9 +634,8 @@ InitPartyMenuWithCancel: ; 50405 ld a, A_BUTTON | B_BUTTON ld [wMenuJoypadFilter], a ret -; 5042d -InitPartyMenuNoCancel: ; 0x5042d +InitPartyMenuNoCancel: ; no cancel ld de, PartyMenuAttributes call SetMenuAttributes @@ -697,9 +655,8 @@ InitPartyMenuNoCancel: ; 0x5042d ld a, A_BUTTON | B_BUTTON ld [wMenuJoypadFilter], a ret -; 5044f (14:444f) -PartyMenuAttributes: ; 5044f +PartyMenuAttributes: ; cursor y ; cursor x ; num rows @@ -713,9 +670,8 @@ PartyMenuAttributes: ; 5044f db $60, $00 dn 2, 0 db 0 -; 50457 -PartyMenuSelect: ; 0x50457 +PartyMenuSelect: ; sets carry if exitted menu. call StaticMenuJoypad call PlaceHollowCursor @@ -752,10 +708,8 @@ PartyMenuSelect: ; 0x50457 call WaitSFX scf ret -; 0x5049a - -PrintPartyMenuText: ; 5049a +PrintPartyMenuText: hlcoord 0, 14 lb bc, 2, 18 call TextBox @@ -764,7 +718,7 @@ PrintPartyMenuText: ; 5049a jr nz, .haspokemon ld de, YouHaveNoPKMNString jr .gotstring -.haspokemon ; 504ae +.haspokemon ld a, [wPartyMenuActionText] and $f ; drop high nibble ld hl, PartyMenuStrings @@ -775,7 +729,7 @@ PrintPartyMenuText: ; 5049a ld a, [hli] ld d, [hl] ld e, a -.gotstring ; 504be +.gotstring ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -785,9 +739,8 @@ PrintPartyMenuText: ; 5049a pop af ld [wOptions], a ret -; 0x504d2 -PartyMenuStrings: ; 0x504d2 +PartyMenuStrings: dw ChooseAMonString dw UseOnWhichPKMNString dw WhichPKMNString @@ -798,36 +751,36 @@ PartyMenuStrings: ; 0x504d2 dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString dw ToWhichPKMNString -ChooseAMonString: ; 0x504e4 +ChooseAMonString: db "Choose a #MON.@" -UseOnWhichPKMNString: ; 0x504f3 +UseOnWhichPKMNString: db "Use on which <PK><MN>?@" -WhichPKMNString: ; 0x50504 +WhichPKMNString: db "Which <PK><MN>?@" -TeachWhichPKMNString: ; 0x5050e +TeachWhichPKMNString: db "Teach which <PK><MN>?@" -MoveToWhereString: ; 0x5051e +MoveToWhereString: db "Move to where?@" -ChooseAFemalePKMNString: ; 0x5052d +ChooseAFemalePKMNString: ; unused db "Choose a ♀<PK><MN>.@" -ChooseAMalePKMNString: ; 0x5053b +ChooseAMalePKMNString: ; unused db "Choose a ♂<PK><MN>.@" -ToWhichPKMNString: ; 0x50549 +ToWhichPKMNString: db "To which <PK><MN>?@" -YouHaveNoPKMNString: ; 0x50556 +YouHaveNoPKMNString: db "You have no <PK><MN>!@" -PrintPartyMenuActionText: ; 50566 +PrintPartyMenuActionText: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames call GetNick @@ -836,9 +789,8 @@ PrintPartyMenuActionText: ; 50566 ld hl, .MenuActionTexts call .PrintText ret -; 5057b -.MenuActionTexts: ; 5057b +.MenuActionTexts: ; entries correspond to PARTYMENUTEXT_* constants dw .Text_CuredOfPoison dw .Text_BurnWasHealed @@ -850,70 +802,58 @@ PrintPartyMenuActionText: ; 50566 dw .Text_Revitalized dw .Text_GrewToLevel dw .Text_CameToItsSenses -; 5058f -.Text_RecoveredSomeHP: ; 0x5058f +.Text_RecoveredSomeHP: ; recovered @ HP! text_jump UnknownText_0x1bc0a2 db "@" -; 0x50594 -.Text_CuredOfPoison: ; 0x50594 +.Text_CuredOfPoison: ; 's cured of poison. text_jump UnknownText_0x1bc0bb db "@" -; 0x50599 -.Text_RidOfParalysis: ; 0x50599 +.Text_RidOfParalysis: ; 's rid of paralysis. text_jump UnknownText_0x1bc0d2 db "@" -; 0x5059e -.Text_BurnWasHealed: ; 0x5059e +.Text_BurnWasHealed: ; 's burn was healed. text_jump UnknownText_0x1bc0ea db "@" -; 0x505a3 -.Text_Defrosted: ; 0x505a3 +.Text_Defrosted: ; was defrosted. text_jump UnknownText_0x1bc101 db "@" -; 0x505a8 -.Text_WokeUp: ; 0x505a8 +.Text_WokeUp: ; woke up. text_jump UnknownText_0x1bc115 db "@" -; 0x505ad -.Text_HealthReturned: ; 0x505ad +.Text_HealthReturned: ; 's health returned. text_jump UnknownText_0x1bc123 db "@" -; 0x505b2 -.Text_Revitalized: ; 0x505b2 +.Text_Revitalized: ; is revitalized. text_jump UnknownText_0x1bc13a db "@" -; 0x505b7 -.Text_GrewToLevel: ; 0x505b7 +.Text_GrewToLevel: ; grew to level @ !@ @ text_jump UnknownText_0x1bc14f db "@" -; 0x505bc -.Text_CameToItsSenses: ; 0x505bc +.Text_CameToItsSenses: ; came to its senses. text_jump UnknownText_0x1bc16e db "@" -; 0x505c1 - -.PrintText: ; 505c1 +.PrintText: ld e, a ld d, 0 add hl, de @@ -929,4 +869,3 @@ PrintPartyMenuActionText: ; 50566 pop af ld [wOptions], a ret -; 505da diff --git a/engine/pokemon/search.asm b/engine/pokemon/search.asm index 57b489a37..c8d4439df 100644 --- a/engine/pokemon/search.asm +++ b/engine/pokemon/search.asm @@ -1,4 +1,4 @@ -BeastsCheck: ; 0x4a6e8 +BeastsCheck: ; Check if the player owns all three legendary beasts. ; They must exist in either party or PC, and have the player's OT and ID. ; Return the result in wScriptVar. @@ -28,8 +28,7 @@ BeastsCheck: ; 0x4a6e8 ld [wScriptVar], a ret - -MonCheck: ; 0x4a711 +MonCheck: ; Check if the player owns any Pokémon of the species in wScriptVar. ; Return the result in wScriptVar. @@ -46,8 +45,7 @@ MonCheck: ; 0x4a711 ld [wScriptVar], a ret - -CheckOwnMonAnywhere: ; 0x4a721 +CheckOwnMonAnywhere: ; Check if the player owns any monsters of the species in wScriptVar. ; It must exist in either party or PC, and have the player's OT and ID. @@ -178,8 +176,7 @@ CheckOwnMonAnywhere: ; 0x4a721 and a ret - -CheckOwnMon: ; 0x4a7ba +CheckOwnMon: ; Check if a Pokémon belongs to the player and is of a specific species. ; inputs: @@ -246,9 +243,8 @@ endr pop bc scf ret -; 0x4a810 -BoxAddressTable1: ; 4a810 +BoxAddressTable1: dba sBox1 dba sBox2 dba sBox3 @@ -263,9 +259,8 @@ BoxAddressTable1: ; 4a810 dba sBox12 dba sBox13 dba sBox14 -; 4a83a -UpdateOTPointer: ; 0x4a83a +UpdateOTPointer: push hl ld hl, NAME_LENGTH add hl, bc @@ -273,4 +268,3 @@ UpdateOTPointer: ; 0x4a83a ld c, l pop hl ret -; 0x4a843 diff --git a/engine/pokemon/search2.asm b/engine/pokemon/search2.asm index b7112f1f8..7af93282e 100644 --- a/engine/pokemon/search2.asm +++ b/engine/pokemon/search2.asm @@ -1,18 +1,18 @@ -_FindPartyMonAboveLevel: ; 4dbd2 +_FindPartyMonAboveLevel: ld hl, wPartyMon1Level call FindAboveLevel ret -_FindPartyMonAtLeastThatHappy: ; 4dbd9 +_FindPartyMonAtLeastThatHappy: ld hl, wPartyMon1Happiness call FindAtLeastThatHappy ret -_FindPartyMonThatSpecies: ; 4dbe0 +_FindPartyMonThatSpecies: ld hl, wPartyMon1Species jp FindThatSpecies -_FindPartyMonThatSpeciesYourTrainerID: ; 4dbe6 +_FindPartyMonThatSpeciesYourTrainerID: ld hl, wPartyMon1Species call FindThatSpecies ret z @@ -35,7 +35,7 @@ _FindPartyMonThatSpeciesYourTrainerID: ; 4dbe6 xor a ret -FindAtLeastThatHappy: ; 4dc0a +FindAtLeastThatHappy: ; Sets the bits for the Pokemon that have a happiness greater than or equal to b. ; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy. ld c, $0 @@ -69,7 +69,7 @@ FindAtLeastThatHappy: ; 4dc0a and a ret -FindAboveLevel: ; 4dc31 +FindAboveLevel: ld c, $0 ld a, [wPartyCount] ld d, a @@ -98,7 +98,7 @@ FindAboveLevel: ; 4dc31 and a ret -FindThatSpecies: ; 4dc56 +FindThatSpecies: ; Find species b in your party. ; If you have no Pokemon, returns c = -1 and z. ; If that species is in your party, returns its location in c, and nz. @@ -116,7 +116,7 @@ FindThatSpecies: ; 4dc56 and a ret -RetroactivelyIgnoreEggs: ; 4dc67 +RetroactivelyIgnoreEggs: ld e, -2 ld hl, wPartySpecies .loop diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index 7e44cb96e..dfc704f1a 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -4,7 +4,7 @@ const BLUE_PAGE ; 3 NUM_STAT_PAGES EQU const_value + -1 -BattleStatsScreenInit: ; 4dc7b (13:5c7b) +BattleStatsScreenInit: ld a, [wLinkMode] cp LINK_MOBILE jr nz, StatsScreenInit @@ -14,15 +14,15 @@ BattleStatsScreenInit: ; 4dc7b (13:5c7b) jr z, StatsScreenInit jr _MobileStatsScreenInit -StatsScreenInit: ; 4dc8a +StatsScreenInit: ld hl, StatsScreenMain jr StatsScreenInit_gotaddress -_MobileStatsScreenInit: ; 4dc8f +_MobileStatsScreenInit: ld hl, StatsScreenMobile jr StatsScreenInit_gotaddress -StatsScreenInit_gotaddress: ; 4dc94 +StatsScreenInit_gotaddress: ld a, [hMapAnims] push af xor a @@ -56,9 +56,8 @@ StatsScreenInit_gotaddress: ; 4dc94 pop af ld [hMapAnims], a ret -; 0x4dcd2 -StatsScreenMain: ; 0x4dcd2 +StatsScreenMain: xor a ld [wJumptableIndex], a ; stupid interns @@ -67,7 +66,7 @@ StatsScreenMain: ; 0x4dcd2 and %11111100 or 1 ld [wcf64], a -.loop ; 4dce3 +.loop ld a, [wJumptableIndex] and $ff ^ (1 << 7) ld hl, StatsScreenPointerTable @@ -77,9 +76,8 @@ StatsScreenMain: ; 0x4dcd2 bit 7, a jr z, .loop ret -; 0x4dcf7 -StatsScreenMobile: ; 4dcf7 +StatsScreenMobile: xor a ld [wJumptableIndex], a ; stupid interns @@ -103,9 +101,8 @@ StatsScreenMobile: ; 4dcf7 .exit ret -; 4dd2a -StatsScreenPointerTable: ; 4dd2a +StatsScreenPointerTable: dw MonStatsInit ; regular pokémon dw EggStatsInit ; egg dw StatsScreenWaitCry @@ -114,10 +111,8 @@ StatsScreenPointerTable: ; 4dd2a dw StatsScreenWaitCry dw MonStatsJoypad dw StatsScreen_Exit -; 4dd3a - -StatsScreen_WaitAnim: ; 4dd3a (13:5d3a) +StatsScreen_WaitAnim: ld hl, wcf64 bit 6, [hl] jr nz, .try_anim @@ -137,19 +132,19 @@ StatsScreen_WaitAnim: ; 4dd3a (13:5d3a) farcall HDMATransferTileMapToWRAMBank3 ret -StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62) +StatsScreen_SetJumptableIndex: ld a, [wJumptableIndex] and $80 or h ld [wJumptableIndex], a ret -StatsScreen_Exit: ; 4dd6c (13:5d6c) +StatsScreen_Exit: ld hl, wJumptableIndex set 7, [hl] ret -MonStatsInit: ; 4dd72 (13:5d72) +MonStatsInit: ld hl, wcf64 res 6, [hl] call ClearBGPalettes @@ -171,16 +166,14 @@ MonStatsInit: ; 4dd72 (13:5d72) call StatsScreen_SetJumptableIndex ret -EggStatsInit: ; 4dda1 +EggStatsInit: call EggStatsScreen ld a, [wJumptableIndex] inc a ld [wJumptableIndex], a ret -; 0x4ddac - -EggStatsJoypad: ; 4ddac (13:5dac) +EggStatsJoypad: call StatsScreen_GetJoypad jr nc, .check ld h, 0 @@ -198,7 +191,7 @@ EggStatsJoypad: ; 4ddac (13:5dac) call StatsScreen_SetJumptableIndex ret -StatsScreen_LoadPage: ; 4ddc6 (13:5dc6) +StatsScreen_LoadPage: call StatsScreen_LoadGFX ld hl, wcf64 res 4, [hl] @@ -207,7 +200,7 @@ StatsScreen_LoadPage: ; 4ddc6 (13:5dc6) ld [wJumptableIndex], a ret -MonStatsJoypad: ; 4ddd6 (13:5dd6) +MonStatsJoypad: call StatsScreen_GetJoypad jr nc, .next ld h, 0 @@ -218,7 +211,7 @@ MonStatsJoypad: ; 4ddd6 (13:5dd6) and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON jp StatsScreen_JoypadAction -StatsScreenWaitCry: ; 4dde6 (13:5de6) +StatsScreenWaitCry: call IsSFXPlaying ret nc ld a, [wJumptableIndex] @@ -226,7 +219,7 @@ StatsScreenWaitCry: ; 4dde6 (13:5de6) ld [wJumptableIndex], a ret -StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) +StatsScreen_CopyToTempMon: ld a, [wMonType] cp TEMPMON jr nz, .breedmon @@ -252,7 +245,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) and a ret -StatsScreen_GetJoypad: ; 4de2c (13:5e2c) +StatsScreen_GetJoypad: call GetJoypad ld a, [wMonType] cp TEMPMON @@ -280,7 +273,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c) scf ret -StatsScreen_JoypadAction: ; 4de54 (13:5e54) +StatsScreen_JoypadAction: push af ld a, [wcf64] maskbits NUM_STAT_PAGES @@ -374,12 +367,12 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) call StatsScreen_SetJumptableIndex ret -.b_button ; 4dee4 (13:5ee4) +.b_button ld h, 7 call StatsScreen_SetJumptableIndex ret -StatsScreen_InitUpperHalf: ; 4deea (13:5eea) +StatsScreen_InitUpperHalf: call .PlaceHPBar xor a ld [hBGMapMode], a @@ -416,7 +409,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) call StatsScreen_PlaceShinyIcon ret -.PlaceHPBar: ; 4df45 (13:5f45) +.PlaceHPBar: ld hl, wTempMonHP ld a, [hli] ld b, a @@ -433,7 +426,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) call DelayFrame ret -.PlaceGenderChar: ; 4df66 (13:5f66) +.PlaceGenderChar: push hl farcall GetGender pop hl @@ -444,16 +437,14 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) .got_gender ld [hl], a ret -; 4df77 (13:5f77) -.NicknamePointers: ; 4df77 +.NicknamePointers: dw wPartyMonNicknames dw wOTPartyMonNicknames dw sBoxMonNicknames dw wBufferMonNick -; 4df7f -Unreferenced_Function4df7f: ; 4df7f +Unreferenced_Function4df7f: hlcoord 7, 0 ld bc, SCREEN_WIDTH ld d, SCREEN_HEIGHT @@ -464,9 +455,8 @@ Unreferenced_Function4df7f: ; 4df7f dec d jr nz, .loop ret -; 4df8f -StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f) +StatsScreen_PlaceHorizontalDivider: hlcoord 0, 7 ld b, SCREEN_WIDTH ld a, $62 ; horizontal divider (empty HP/exp bar) @@ -476,14 +466,14 @@ StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f) jr nz, .loop ret -StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b) +StatsScreen_PlacePageSwitchArrows: hlcoord 12, 6 ld [hl], "◀" hlcoord 19, 6 ld [hl], "▶" ret -StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) +StatsScreen_PlaceShinyIcon: ld bc, wTempMonDVs farcall CheckShininess ret nc @@ -491,7 +481,7 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) ld [hl], "⁂" ret -StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) +StatsScreen_LoadGFX: ld a, [wBaseDexNo] ld [wd265], a ld [wCurSpecies], a @@ -510,7 +500,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call StatsScreen_PlaceFrontpic ret -.ClearBox: ; 4dfda (13:5fda) +.ClearBox: ld a, [wcf64] maskbits NUM_STAT_PAGES ld c, a @@ -520,7 +510,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call ClearBox ret -.LoadPals: ; 4dfed (13:5fed) +.LoadPals: ld a, [wcf64] maskbits NUM_STAT_PAGES ld c, a @@ -530,7 +520,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) set 5, [hl] ret -.PageTilemap: ; 4e002 (13:6002) +.PageTilemap: ld a, [wcf64] maskbits NUM_STAT_PAGES dec a @@ -538,13 +528,13 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) rst JumpTable ret -.Jumptable: ; 4e00d (13:600d) +.Jumptable: ; entries correspond to *_PAGE constants dw .PinkPage dw .GreenPage dw .BluePage -.PinkPage: ; 4e013 (13:6013) +.PinkPage: hlcoord 0, 9 ld b, $0 predef DrawPlayerHP @@ -624,7 +614,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hl], $41 ; right exp bar end cap ret -.PrintNextLevel: ; 4e0d3 (13:60d3) +.PrintNextLevel: ld a, [wTempMonLevel] push af cp MAX_LEVEL @@ -637,7 +627,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [wTempMonLevel], a ret -.CalcExpToNextLevel: ; 4e0e7 (13:60e7) +.CalcExpToNextLevel: ld a, [wTempMonLevel] cp MAX_LEVEL jr z, .AlreadyAtMaxLevel @@ -666,34 +656,27 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hli], a ld [hl], a ret -; 4e119 (13:6119) -.Status_Type: ; 4e119 +.Status_Type: db "STATUS/" next "TYPE/@" -; 4e127 -.OK_str: ; 4e127 +.OK_str: db "OK @" -; 4e12b -.ExpPointStr: ; 4e12b +.ExpPointStr: db "EXP POINTS@" -; 4e136 -.LevelUpStr: ; 4e136 +.LevelUpStr: db "LEVEL UP@" -; 4e13f -.ToStr: ; 4e13f +.ToStr: db "TO@" -; 4e142 -.PkrsStr: ; 4e142 +.PkrsStr: db "#RUS@" -; 4e147 -.GreenPage: ; 4e147 (13:6147) +.GreenPage: ld de, .Item hlcoord 0, 8 call PlaceString @@ -717,7 +700,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) predef ListMovePP ret -.GetItemName: ; 4e189 (13:6189) +.GetItemName: ld de, .ThreeDashes ld a, [wTempMonItem] and a @@ -728,21 +711,17 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [wd265], a call GetItemName ret -; 4e1a0 (13:61a0) -.Item: ; 4e1a0 +.Item: db "ITEM@" -; 4e1a5 -.ThreeDashes: ; 4e1a5 +.ThreeDashes: db "---@" -; 4e1a9 -.Move: ; 4e1a9 +.Move: db "MOVE@" -; 4e1ae -.BluePage: ; 4e1ae (13:61ae) +.BluePage: call .PlaceOTInfo hlcoord 10, 8 ld de, SCREEN_WIDTH @@ -758,7 +737,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) predef PrintTempMonStats ret -.PlaceOTInfo: ; 4e1cc (13:61cc) +.PlaceOTInfo: ld de, IDNoString hlcoord 0, 9 call PlaceString @@ -789,24 +768,20 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld [hl], a .done ret -; 4e216 (13:6216) -.OTNamePointers: ; 4e216 +.OTNamePointers: dw wPartyMonOT dw wOTPartyMonOT dw sBoxMonOT dw wBufferMonOT -; 4e21e -IDNoString: ; 4e21e +IDNoString: db "<ID>№.@" -OTString: ; 4e222 +OTString: db "OT/@" -; 4e226 - -StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) +StatsScreen_PlaceFrontpic: ld hl, wTempMonDVs predef GetUnownLetter call StatsScreen_GetAnimationParam @@ -832,7 +807,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call PlayMonCry2 ret -.AnimateMon: ; 4e253 (13:6253) +.AnimateMon: ld hl, wcf64 set 5, [hl] ld a, [wCurPartySpecies] @@ -849,7 +824,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call _PrepMonFrontpic ret -.AnimateEgg: ; 4e271 (13:6271) +.AnimateEgg: ld a, [wCurPartySpecies] cp UNOWN jr z, .unownegg @@ -864,7 +839,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call .get_animation ret -.get_animation ; 4e289 (13:6289) +.get_animation ld a, [wCurPartySpecies] call IsAPokemon ret c @@ -879,20 +854,20 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) set 6, [hl] ret -StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) +StatsScreen_GetAnimationParam: ld a, [wMonType] ld hl, .Jumptable rst JumpTable ret -.Jumptable: ; 4e2b5 (13:62b5) +.Jumptable: dw .PartyMon dw .OTPartyMon dw .BoxMon dw .Tempmon dw .Wildmon -.PartyMon: ; 4e2bf (13:62bf) +.PartyMon: ld a, [wCurPartyMon] ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH @@ -901,11 +876,11 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) ld c, l jr .CheckEggFaintedFrzSlp -.OTPartyMon: ; 4e2cf (13:62cf) +.OTPartyMon: xor a ret -.BoxMon: ; 4e2d1 (13:62d1) +.BoxMon: ld hl, sBoxMons ld bc, PARTYMON_STRUCT_LENGTH ld a, [wCurPartyMon] @@ -920,11 +895,11 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) pop af ret -.Tempmon: ; 4e2ed (13:62ed) +.Tempmon: ld bc, wTempMonSpecies jr .CheckEggFaintedFrzSlp ; utterly pointless -.CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2) +.CheckEggFaintedFrzSlp: ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -935,16 +910,16 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) scf ret -.Wildmon: ; 4e301 (13:6301) +.Wildmon: ld a, $1 and a ret -.FaintedFrzSlp: ; 4e305 (13:6305) +.FaintedFrzSlp: xor a ret -StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) +StatsScreen_LoadTextBoxSpaceGFX: nop push hl push de @@ -966,14 +941,12 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) pop de pop hl ret -; 4e32a (13:632a) -Unreferenced_4e32a: ; 4e32a +Unreferenced_4e32a: ; A blank space tile? ds 16 -; 4e33a -EggStatsScreen: ; 4e33a +EggStatsScreen: xor a ld [hBGMapMode], a ld hl, wCurHPPal @@ -1025,38 +998,35 @@ EggStatsScreen: ; 4e33a ld de, SFX_2_BOOPS call PlaySFX ret -; 0x4e3c0 -EggString: ; 4e3c0 +EggString: db "EGG@" -FiveQMarkString: ; 4e3c4 +FiveQMarkString: db "?????@" -EggSoonString: ; 0x4e3ca +EggSoonString: db "It's making sounds" next "inside. It's going" next "to hatch soon!@" -EggCloseString: ; 0x4e3fd +EggCloseString: db "It moves around" next "inside sometimes." next "It must be close" next "to hatching.@" -EggMoreTimeString: ; 0x4e43d +EggMoreTimeString: db "Wonder what's" next "inside? It needs" next "more time, though.@" -EggALotMoreTimeString: ; 0x4e46e +EggALotMoreTimeString: db "This EGG needs a" next "lot more time to" next "hatch.@" -; 0x4e497 - -StatsScreen_AnimateEgg: ; 4e497 (13:6497) +StatsScreen_AnimateEgg: call StatsScreen_GetAnimationParam ret nc ld a, [wTempMonHappiness] @@ -1083,7 +1053,7 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) set 6, [hl] ret -StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) +StatsScreen_LoadPageIndicators: hlcoord 13, 5 ld a, $36 ; first of 4 small square tiles call .load_square @@ -1101,7 +1071,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE) jr z, .load_square hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE) -.load_square ; 4e4f7 (13:64f7) +.load_square push bc ld [hli], a inc a @@ -1115,7 +1085,7 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) pop bc ret -CopyNickname: ; 4e505 (13:6505) +CopyNickname: ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH jr .okay ; utterly pointless @@ -1137,7 +1107,7 @@ CopyNickname: ; 4e505 (13:6505) pop de ret -GetNicknamePointer: ; 4e528 (13:6528) +GetNicknamePointer: ld a, [wMonType] add a ld c, a @@ -1152,8 +1122,7 @@ GetNicknamePointer: ; 4e528 (13:6528) ld a, [wCurPartyMon] jp SkipNames - -CheckFaintedFrzSlp: ; 4e53f +CheckFaintedFrzSlp: ld hl, MON_HP add hl, bc ld a, [hli] @@ -1170,4 +1139,3 @@ CheckFaintedFrzSlp: ; 4e53f .fainted_frz_slp scf ret -; 4e554 diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index b01178417..d612a3472 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -16,7 +16,7 @@ _SwitchPartyMons: .skip ret -.ClearSprite: ; 50f34 (14:4f34) +.ClearSprite: push af hlcoord 0, 1 ld bc, 2 * SCREEN_WIDTH @@ -39,7 +39,7 @@ _SwitchPartyMons: call WaitPlaySFX ret -.SwapMonAndMail: ; 50f62 (14:4f62) +.SwapMonAndMail: push hl push de push bc @@ -136,10 +136,10 @@ _SwitchPartyMons: pop hl ret -.CopyNameTowd002: ; 51036 (14:5036) +.CopyNameTowd002: ld de, wd002 -.CopyName: ; 51039 (14:5039) +.CopyName: ld bc, NAME_LENGTH call CopyBytes ret diff --git a/engine/pokemon/tempmon.asm b/engine/pokemon/tempmon.asm index 723bfb1dd..4547a02b9 100644 --- a/engine/pokemon/tempmon.asm +++ b/engine/pokemon/tempmon.asm @@ -1,4 +1,4 @@ -CopyMonToTempMon: ; 5084a +CopyMonToTempMon: ; gets the BaseData of a mon ; and copies the party_struct to wTempMon @@ -32,13 +32,13 @@ CopyMonToTempMon: ; 5084a .done ret -CalcBufferMonStats: ; 5088b +CalcBufferMonStats: ld bc, wBufferMon jr _TempMonStatsCalculation -CalcTempmonStats: ; 50890 +CalcTempmonStats: ld bc, wTempMon -_TempMonStatsCalculation: ; 50893 +_TempMonStatsCalculation: ld hl, MON_LEVEL add hl, bc ld a, [hl] @@ -82,7 +82,7 @@ _TempMonStatsCalculation: ; 50893 ld [hl], a ret -GetMonSpecies: ; 508d5 +GetMonSpecies: ; [wMonType] has the type of the mon ; e = Nr. of mon (i.e. [wCurPartyMon]) diff --git a/engine/pokemon/types.asm b/engine/pokemon/types.asm index dc0df61ae..4e2ca3e45 100644 --- a/engine/pokemon/types.asm +++ b/engine/pokemon/types.asm @@ -1,4 +1,4 @@ -PrintMonTypes: ; 5090d +PrintMonTypes: ; Print one or both types of [wCurSpecies] ; on the stats screen at hl. @@ -37,10 +37,8 @@ PrintMonTypes: ; 5090d add hl, bc ld bc, NAME_LENGTH_JAPANESE - 1 jp ByteFill -; 5093a - -PrintMoveType: ; 5093a +PrintMoveType: ; Print the type of move b at hl. push hl @@ -57,8 +55,7 @@ PrintMoveType: ; 5093a ld b, a - -PrintType: ; 50953 +PrintType: ; Print type b at hl. ld a, b @@ -75,10 +72,8 @@ PrintType: ; 50953 pop hl jp PlaceString -; 50964 - -GetTypeName: ; 50964 +GetTypeName: ; Copy the name of type [wd265] to wStringBuffer1. ld a, [wd265] @@ -93,7 +88,5 @@ GetTypeName: ; 50964 ld de, wStringBuffer1 ld bc, MOVE_NAME_LENGTH jp CopyBytes -; 5097b - INCLUDE "data/types/names.asm" diff --git a/engine/predef.asm b/engine/predef.asm index 13c593c90..e18765b0a 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -1,4 +1,4 @@ -GetPredefPointer:: ; 854b +GetPredefPointer:: ; Return the bank and address of wPredefID in a and wPredefAddress. ; Save hl for later (back in Predef) @@ -24,6 +24,5 @@ GetPredefPointer:: ; 854b ld a, [hl] ret -; 856b INCLUDE "data/predef_pointers.asm" diff --git a/engine/printer/print_party.asm b/engine/printer/print_party.asm index 1095ce584..eeb694d62 100644 --- a/engine/printer/print_party.asm +++ b/engine/printer/print_party.asm @@ -1,6 +1,6 @@ PRINTPARTY_HP EQUS "\"◀\"" ; $71 -PrintPage1: ; 1dc1b0 +PrintPage1: hlcoord 0, 0 decoord 0, 0, wPrinterTileMapBuffer ld bc, 17 * SCREEN_WIDTH @@ -50,9 +50,8 @@ PrintPage1: ; 1dc1b0 jr nz, .column_loop ld [hl], $3a ret -; 1dc213 -PrintPage2: ; 1dc213 +PrintPage2: hlcoord 0, 0, wPrinterTileMapBuffer ld bc, 8 * SCREEN_WIDTH ld a, " " @@ -89,9 +88,8 @@ PrintPage2: ; 1dc213 ld a, b call nz, FarString ret -; 1dc26a -.FillColumn: ; 1dc26a +.FillColumn: push de ld de, SCREEN_WIDTH .column_loop @@ -101,9 +99,8 @@ PrintPage2: ; 1dc213 jr nz, .column_loop pop de ret -; 1dc275 -GBPrinterStrings: +GBPrinterStrings: ; used only for BANK(GBPrinterStrings) GBPrinterString_Null: db "@" GBPrinterString_CheckingLink: next " CHECKING LINK...@" GBPrinterString_Transmitting: next " TRANSMITTING...@" @@ -132,9 +129,8 @@ GBPrinterString_PrinterError4: next "Check the Game Boy" next "Printer Manual." db "@" -; 1dc381 -PrintPartyMonPage1: ; 1dc381 +PrintPartyMonPage1: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -232,9 +228,8 @@ PrintPartyMonPage1: ; 1dc381 call GetSGBLayout call SetPalettes ret -; 1dc47b -PrintPartyMonPage2: ; 1dc47b +PrintPartyMonPage2: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -284,24 +279,21 @@ PrintPartyMonPage2: ; 1dc47b call GetSGBLayout call SetPalettes ret -; 1dc507 -.PrintTempMonStats: ; 1dc507 +.PrintTempMonStats: lb bc, 2, 3 call PrintNum ret -; 1dc50e -Function1dc50e: ; 1dc50e +Function1dc50e: ld bc, NAME_LENGTH ld a, [wCurPartyMon] call AddNTimes ld e, l ld d, h ret -; 1dc51a -Function1dc51a: ; 1dc51a +Function1dc51a: and a jr z, .no_move @@ -315,9 +307,8 @@ Function1dc51a: ; 1dc51a .got_string call PlaceString ret -; 1dc52c -Function1dc52c: ; 1dc52c +Function1dc52c: farcall GetGender ld a, " " jr c, .got_gender @@ -334,18 +325,17 @@ Function1dc52c: ; 1dc52c hlcoord 18, 2 ld [hl], "⁂" ret -; 1dc550 -String1dc550: ; 1dc550 +String1dc550: db "OT/@" -String1dc554: ; 1dc554 +String1dc554: db "MOVE@" -String1dc559: ; 1dc559 +String1dc559: db "<ID>№.@" -String1dc55d: ; 1dc55d +String1dc55d: db "ATTACK" next "DEFENSE" next "SPCL.ATK" @@ -353,12 +343,11 @@ String1dc55d: ; 1dc55d next "SPEED" db "@" -String1dc584: ; 1dc584 +String1dc584: db "------------@" -; 1dc591 -GBPrinterHPIcon: ; 1dc591 +GBPrinterHPIcon: INCBIN "gfx/printer/hp.1bpp" -GBPrinterLvIcon: ; 1dc599 +GBPrinterLvIcon: INCBIN "gfx/printer/lv.1bpp" diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index 0264b4f7a..4dc74c6d2 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -1,6 +1,4 @@ -INCLUDE "engine/printer/printer_serial.asm" - -SendScreenToPrinter: ; 843f0 +SendScreenToPrinter: .loop call JoyTextDelay call CheckCancelPrint @@ -21,31 +19,27 @@ SendScreenToPrinter: ; 843f0 .cancel scf ret -; 84411 -Printer_CleanUpAfterSend: ; 84411 +Printer_CleanUpAfterSend: xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a ret -; 84419 -Printer_PrepareTileMapForPrint: ; 84419 +Printer_PrepareTileMapForPrint: push af call Printer_StartTransmission pop af ld [wcbfa], a call Printer_CopyTileMapToBuffer ret -; 84425 -Printer_ExitPrinter: ; 84425 +Printer_ExitPrinter: call ReturnToMapFromSubmenu call Printer_RestartMapMusic ret -; 8442c -PrintDexEntry: ; 8442c +PrintDexEntry: ld a, [wPrinterQueueLength] push af @@ -121,9 +115,8 @@ PrintDexEntry: ; 8442c pop af ld [wPrinterQueueLength], a ret -; 844bc -PrintPCBox: ; 844bc (21:44bc) +PrintPCBox: ld a, [wPrinterQueueLength] push af ld a, 18 / 2 @@ -211,12 +204,12 @@ PrintPCBox: ; 844bc (21:44bc) ld [wPrinterQueueLength], a ret -Printer_ResetRegistersAndStartDataSend: ; 84559 (21:4559) +Printer_ResetRegistersAndStartDataSend: call Printer_ResetJoypadRegisters call SendScreenToPrinter ret -PrintUnownStamp: ; 84560 +PrintUnownStamp: ld a, [wPrinterQueueLength] push af xor a @@ -274,15 +267,13 @@ PrintUnownStamp: ; 84560 pop af ld [wPrinterQueueLength], a ret -; 845d4 -PrintMail: ; 845d4 +PrintMail: call PrintMail_ call Printer_ExitPrinter ret -; 845db -PrintMail_: ; 845db +PrintMail_: ld a, [wPrinterQueueLength] push af xor a @@ -323,9 +314,8 @@ PrintMail_: ; 845db pop af ld [wPrinterQueueLength], a ret -; 8461a -PrintPartymon: ; 8461a +PrintPartymon: ld a, [wPrinterQueueLength] push af xor a @@ -385,9 +375,8 @@ PrintPartymon: ; 8461a pop af ld [wPrinterQueueLength], a ret -; 84688 -_PrintDiploma: ; 84688 +_PrintDiploma: ld a, [wPrinterQueueLength] push af @@ -449,9 +438,8 @@ _PrintDiploma: ; 84688 pop af ld [wPrinterQueueLength], a ret -; 846f6 -CheckCancelPrint: ; 846f6 +CheckCancelPrint: ld a, [hJoyDown] and B_BUTTON jr nz, .pressed_b @@ -484,45 +472,39 @@ CheckCancelPrint: ; 846f6 ld [hPrinter], a scf ret -; 84728 -Printer_CopyTileMapToBuffer: ; 84728 +Printer_CopyTileMapToBuffer: hlcoord 0, 0 ld de, wPrinterTileMapBuffer ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret -; 84735 -Printer_CopyBufferToTileMap: ; 84735 +Printer_CopyBufferToTileMap: ld hl, wPrinterTileMapBuffer decoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret -; 84742 -Printer_ResetJoypadRegisters: ; 84742 +Printer_ResetJoypadRegisters: xor a ld [hJoyReleased], a ld [hJoyPressed], a ld [hJoyDown], a ld [hJoyLast], a ret -; 8474c -Printer_PlayMusic: ; 8474c +Printer_PlayMusic: ld de, MUSIC_PRINTER call PlayMusic2 ret -; 84753 -Printer_RestartMapMusic: ; 84753 +Printer_RestartMapMusic: call RestartMapMusic ret -; 84757 -CheckPrinterStatus: ; 84757 +CheckPrinterStatus: ; Check for printer errors ; If [ca88] == -1, we're disconnected ld a, [wPrinterHandshake] @@ -561,9 +543,8 @@ CheckPrinterStatus: ; 84757 .load_text_index ld [wPrinterStatus], a ret -; 84785 -PlacePrinterStatusString: ; 84785 +PlacePrinterStatusString: ; Print nonzero printer status ld a, [wPrinterStatus] and a @@ -594,9 +575,8 @@ PlacePrinterStatusString: ; 84785 xor a ld [wPrinterStatus], a ret -; 847bd -Unreferenced_Function847bd: ; 847bd +Unreferenced_Function847bd: ld a, [wPrinterStatus] and a ret z @@ -626,13 +606,11 @@ Unreferenced_Function847bd: ; 847bd xor a ld [wPrinterStatus], a ret -; 847f5 String_PressBToCancel: db "Press B to Cancel@" -; 84807 -PrinterStatusStringPointers: ; 84807 +PrinterStatusStringPointers: dw GBPrinterString_Null ; @ dw GBPrinterString_CheckingLink ; CHECKING LINK dw GBPrinterString_Transmitting ; TRANSMITTING @@ -641,9 +619,8 @@ PrinterStatusStringPointers: ; 84807 dw GBPrinterString_PrinterError2 ; error 2 dw GBPrinterString_PrinterError3 ; error 3 dw GBPrinterString_PrinterError4 ; error 4 -; 84817 -PrintPCBox_Page1: ; 84817 (21:4817) +PrintPCBox_Page1: xor a ld [wWhichBoxMonToPrint], a hlcoord 0, 0 @@ -678,13 +655,11 @@ PrintPCBox_Page1: ; 84817 (21:4817) ld c, 3 call Printer_PrintBoxListSegment ret -; 84865 (21:4865) .String_PokemonList: db "#MON LIST@" -; 8486f -PrintPCBox_Page2: ; 8486f (21:486f) +PrintPCBox_Page2: hlcoord 0, 0 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld a, " " @@ -701,7 +676,7 @@ PrintPCBox_Page2: ; 8486f (21:486f) call Printer_PrintBoxListSegment ret -PrintPCBox_Page3: ; 84893 (21:4893) +PrintPCBox_Page3: hlcoord 0, 0 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld a, " " @@ -718,7 +693,7 @@ PrintPCBox_Page3: ; 84893 (21:4893) call Printer_PrintBoxListSegment ret -PrintPCBox_Page4: ; 848b7 (21:48b7) +PrintPCBox_Page4: hlcoord 0, 0 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld a, " " @@ -739,7 +714,7 @@ PrintPCBox_Page4: ; 848b7 (21:48b7) call Printer_PrintBoxListSegment ret -Printer_PrintBoxListSegment: ; 848e7 (21:48e7) +Printer_PrintBoxListSegment: ld a, [wBankOfBoxToPrint] call GetSRAMBank .loop @@ -839,7 +814,7 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) call CloseSRAM ret -Printer_GetMonGender: ; 8498a (21:498a) +Printer_GetMonGender: push hl ld a, [wAddrOfBoxToPrint] ld l, a @@ -871,7 +846,7 @@ Printer_GetMonGender: ; 8498a (21:498a) ld [hli], a ret -Printer_GetBoxMonSpecies: ; 849c6 (21:49c6) +Printer_GetBoxMonSpecies: push hl ld e, a ld d, $0 @@ -885,7 +860,7 @@ Printer_GetBoxMonSpecies: ; 849c6 (21:49c6) pop hl ret -Printer_PlaceTopBorder: ; 849d7 (21:49d7) +Printer_PlaceTopBorder: hlcoord 0, 0 ld a, "┌" ld [hli], a @@ -899,7 +874,7 @@ Printer_PlaceTopBorder: ; 849d7 (21:49d7) ld [hl], a ret -Printer_PlaceSideBorders: ; 849e9 (21:49e9) +Printer_PlaceSideBorders: hlcoord 0, 0 ld de, SCREEN_WIDTH - 1 ld c, SCREEN_HEIGHT @@ -913,7 +888,7 @@ Printer_PlaceSideBorders: ; 849e9 (21:49e9) jr nz, .loop ret -Printer_PlaceBottomBorders: ; 849fc (21:49fc) +Printer_PlaceBottomBorders: hlcoord 0, 17 ld a, "└" ld [hli], a @@ -927,7 +902,7 @@ Printer_PlaceBottomBorders: ; 849fc (21:49fc) ld [hl], a ret -Printer_PlaceEmptyBoxSlotString: ; 84a0e (21:4a0e) +Printer_PlaceEmptyBoxSlotString: hlcoord 2, 0 ld c, $6 .loop @@ -942,8 +917,6 @@ Printer_PlaceEmptyBoxSlotString: ; 84a0e (21:4a0e) dec c jr nz, .loop ret -; 84a25 (21:4a25) -String84a25: ; 84a25 +String84a25: db " ------@" -; 84a2e diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm index 4e0d10851..e8f106ac4 100644 --- a/engine/printer/printer_serial.asm +++ b/engine/printer/printer_serial.asm @@ -1,4 +1,4 @@ -Printer_StartTransmission: ; 84000 +Printer_StartTransmission: ld hl, wGameboyPrinterRAM ld bc, wGameboyPrinterRAMEnd - wGameboyPrinterRAM xor a @@ -14,9 +14,8 @@ Printer_StartTransmission: ; 84000 xor a ld [wJumptableIndex], a ret -; 84022 -PrinterJumptableIteration: ; 84022 +PrinterJumptableIteration: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -27,9 +26,8 @@ PrinterJumptableIteration: ; 84022 ld h, [hl] ld l, a jp hl -; 84031 -.Jumptable: ; 84031 (21:4031) +.Jumptable: dw Print_InitPrinterHandshake ; 00 dw Printer_CheckConnectionStatus ; 01 dw Printer_WaitSerial ; 02 @@ -53,33 +51,33 @@ PrinterJumptableIteration: ; 84022 dw Printer_WaitLoopBack ; 12 dw Printer_WaitLoopBack_ ; 13 -Printer_NextSection: ; 84059 (21:4059) +Printer_NextSection: ld hl, wJumptableIndex inc [hl] ret -Printer_PrevSection: ; 8405e (21:405e) +Printer_PrevSection: ld hl, wJumptableIndex dec [hl] ret -Printer_Quit: ; 84063 (21:4063) +Printer_Quit: xor a ld [wPrinterStatusFlags], a ld hl, wJumptableIndex set 7, [hl] ret -Printer_NextSection_: ; 8406d (21:406d) +Printer_NextSection_: call Printer_NextSection ret -Printer_SectionOne: ; 84071 (21:4071) +Printer_SectionOne: ld a, $1 ld [wJumptableIndex], a ret -Print_InitPrinterHandshake: ; 84077 (21:4077) +Print_InitPrinterHandshake: call Printer_ResetData ld hl, PrinterDataPacket1 call Printer_CopyPacket @@ -94,7 +92,7 @@ Print_InitPrinterHandshake: ; 84077 (21:4077) ld [wPrinterStatus], a ret -Printer_StartTransmittingTilemap: ; 84099 (21:4099) +Printer_StartTransmittingTilemap: call Printer_ResetData ; check ??? ld hl, wPrinterRowIndex @@ -118,7 +116,7 @@ Printer_StartTransmittingTilemap: ; 84099 (21:4099) ld [wPrinterStatus], a ret -Printer_EndTilemapTransmission: ; 840c5 (21:40c5) +Printer_EndTilemapTransmission: ; ensure that we go from here to routine 7 ld a, $6 ld [wJumptableIndex], a @@ -133,7 +131,7 @@ Printer_EndTilemapTransmission: ; 840c5 (21:40c5) call Printer_WaitHandshake ret -Printer_SignalSendHeader: ; 840de (21:40de) +Printer_SignalSendHeader: call Printer_ResetData ld hl, PrinterDataPacket2 ; signal request print call Printer_CopyPacket @@ -151,7 +149,7 @@ Printer_SignalSendHeader: ; 840de (21:40de) ld [wPrinterStatus], a ret -Printer_SignalLoopBack: ; 84103 (21:4103) +Printer_SignalLoopBack: call Printer_ResetData ; send packet 1 ld hl, PrinterDataPacket1 ; signal no transmission @@ -166,7 +164,7 @@ Printer_SignalLoopBack: ; 84103 (21:4103) call Printer_WaitHandshake ret -Printer_WaitSerial: ; 84120 (21:4120) +Printer_WaitSerial: ld hl, wPrinterSerialFrameDelay inc [hl] ld a, [hl] @@ -177,7 +175,7 @@ Printer_WaitSerial: ; 84120 (21:4120) call Printer_NextSection ret -Printer_WaitSerialAndLoopBack2: ; 8412e (21:412e) +Printer_WaitSerialAndLoopBack2: ld hl, wPrinterSerialFrameDelay inc [hl] ld a, [hl] @@ -191,7 +189,7 @@ Printer_WaitSerialAndLoopBack2: ; 8412e (21:412e) call Printer_PrevSection ret -Printer_CheckConnectionStatus: ; 84143 (21:4143) +Printer_CheckConnectionStatus: ld a, [wPrinterOpcode] and a ret nz @@ -224,7 +222,7 @@ Printer_CheckConnectionStatus: ; 84143 (21:4143) ld [wJumptableIndex], a ret -Printer_TransmissionLoop: ; 84180 (21:4180) +Printer_TransmissionLoop: ld a, [wPrinterOpcode] and a ret nz @@ -246,7 +244,7 @@ Printer_TransmissionLoop: ; 84180 (21:4180) ld [wJumptableIndex], a ret -Printer_WaitUntilFinished: ; 841a1 (21:41a1) +Printer_WaitUntilFinished: ld a, [wPrinterOpcode] and a ret nz @@ -256,9 +254,9 @@ Printer_WaitUntilFinished: ; 841a1 (21:41a1) call Printer_NextSection ret -Printer_WaitLoopBack: ; 841b0 (21:41b0) +Printer_WaitLoopBack: call Printer_NextSection -Printer_WaitLoopBack_: ; 841b3 (21:41b3) +Printer_WaitLoopBack_: ld a, [wPrinterOpcode] and a ret nz @@ -269,7 +267,7 @@ Printer_WaitLoopBack_: ; 841b3 (21:41b3) ld [wJumptableIndex], a ret -Printer_WaitHandshake: ; 841c3 (21:41c3) +Printer_WaitHandshake: .loop ld a, [wPrinterOpcode] and a @@ -287,7 +285,7 @@ Printer_WaitHandshake: ; 841c3 (21:41c3) ld [rSC], a ret -Printer_CopyPacket: ; 841e2 (21:41e2) +Printer_CopyPacket: ld a, [hli] ld [wPrinterData], a ld a, [hli] @@ -302,7 +300,7 @@ Printer_CopyPacket: ; 841e2 (21:41e2) ld [wPrinterChecksum + 1], a ret -Printer_ResetData: ; 841fb (21:41fb) +Printer_ResetData: xor a ld hl, wPrinterData ld [hli], a @@ -320,7 +318,7 @@ Printer_ResetData: ; 841fb (21:41fb) call Printer_ByteFill ret -Printer_ComputeChecksum: ; 84219 (21:4219) +Printer_ComputeChecksum: ld hl, 0 ld bc, 4 ld de, wPrinterData @@ -337,7 +335,7 @@ Printer_ComputeChecksum: ; 84219 (21:4219) ld [wPrinterChecksum + 1], a ret -.ComputeChecksum: ; 8423c (21:423c) +.ComputeChecksum: .loop ld a, [de] inc de @@ -352,7 +350,7 @@ Printer_ComputeChecksum: ; 84219 (21:4219) jr nz, .loop ret -Printer_StageHeaderForSend: ; 84249 (21:4249) +Printer_StageHeaderForSend: ld a, $1 ld [wGameboyPrinter2bppSource + 0], a ld a, [wcbfa] @@ -363,7 +361,7 @@ Printer_StageHeaderForSend: ; 84249 (21:4249) ld [wGameboyPrinter2bppSource + 3], a ret -Printer_Convert2RowsTo2bpp: ; 84260 (21:4260) +Printer_Convert2RowsTo2bpp: ; de = wPrinterTileMapBuffer + 2 * SCREEN_WIDTH * ([wPrinterQueueLength] - [wPrinterRowIndex]) ld a, [wPrinterRowIndex] xor $ff @@ -420,7 +418,7 @@ Printer_Convert2RowsTo2bpp: ; 84260 (21:4260) jr nz, .loop2 ret -Printer_ByteFill: ; 842ab +Printer_ByteFill: push de ld e, a .loop @@ -433,7 +431,6 @@ Printer_ByteFill: ; 842ab ld a, e pop de ret -; 842b7 PrinterDataPacket1: db 1, 0, $00, 0 @@ -453,9 +450,8 @@ PrinterDataPacket5: ; unused PrinterDataPacket6: ; unused db 15, 0, $00, 0 dw 15 -; 842db -_PrinterReceive:: ; 842db +_PrinterReceive:: ld a, [wPrinterOpcode] add a ld e, a @@ -466,9 +462,8 @@ _PrinterReceive:: ; 842db ld h, [hl] ld l, a jp hl -; 842ea -.Jumptable: ; 842ea (21:42ea) +.Jumptable: dw Printer_DoNothing ; 00 dw Printer_Send0x33 ; 01 @@ -505,45 +500,45 @@ _PrinterReceive:: ; 842db dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f -Printer_NextInstruction: ; 8432a (21:432a) +Printer_NextInstruction: ld hl, wPrinterOpcode inc [hl] ret -Printer_DoNothing: ; 8432f (21:432f) +Printer_DoNothing: ret -Printer_Send0x33: ; 84330 (21:4330) +Printer_Send0x33: ld a, $33 call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendPrinterData1: ; 84339 (21:4339) +Printer_SendPrinterData1: ld a, [wPrinterData] call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendPrinterData2: ; 84343 (21:4343) +Printer_SendPrinterData2: ld a, [wPrinterData + 1] call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendPrinterData3: ; 8434d (21:434d) +Printer_SendPrinterData3: ld a, [wPrinterData + 2] call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendPrinterData4: ; 84357 (21:4357) +Printer_SendPrinterData4: ld a, [wPrinterData + 3] call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendNextByte: ; 84361 (21:4361) +Printer_SendNextByte: ; decrement 16-bit counter ld hl, wPrinterSendByteCounter ld a, [hli] @@ -573,25 +568,25 @@ Printer_SendNextByte: ; 84361 (21:4361) .done call Printer_NextInstruction -Printer_SendwPrinterChecksumLo: ; 8438b (21:438b) +Printer_SendwPrinterChecksumLo: ld a, [wPrinterChecksum] call Printer_SerialSend call Printer_NextInstruction ret -Printer_SendwPrinterChecksumHi: ; 84395 (21:4395) +Printer_SendwPrinterChecksumHi: ld a, [wPrinterChecksum + 1] call Printer_SerialSend call Printer_NextInstruction ret -Printer_Send0x00: ; 8439f (21:439f) +Printer_Send0x00: ld a, $0 call Printer_SerialSend call Printer_NextInstruction ret -Printer_ReceiveTowPrinterHandshakeAndSend0x00: ; 843a8 (21:43a8) +Printer_ReceiveTowPrinterHandshakeAndSend0x00: ld a, [rSB] ld [wPrinterHandshake], a ld a, $0 @@ -599,32 +594,32 @@ Printer_ReceiveTowPrinterHandshakeAndSend0x00: ; 843a8 (21:43a8) call Printer_NextInstruction ret -Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop: ; 843b6 (21:43b6) +Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop: ld a, [rSB] ld [wPrinterStatusFlags], a xor a ld [wPrinterOpcode], a ret -Printer_Send0x0f: ; 843c0 (21:43c0) +Printer_Send0x0f: ld a, $f call Printer_SerialSend call Printer_NextInstruction ret -Printer_Send0x00_: ; 843c9 (21:43c9) +Printer_Send0x00_: ld a, $0 call Printer_SerialSend call Printer_NextInstruction ret -Printer_Send0x08: ; 843d2 (21:43d2) +Printer_Send0x08: ld a, $8 call Printer_SerialSend call Printer_NextInstruction ret -Printer_SerialSend: ; 843db (21:43db) +Printer_SerialSend: ld [rSB], a ld a, $1 ; switch to internal clock ld [rSC], a @@ -632,7 +627,7 @@ Printer_SerialSend: ; 843db (21:43db) ld [rSC], a ret -Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_: ; 843e6 (21:43e6) +Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_: ld a, [rSB] ld [wPrinterStatusFlags], a xor a diff --git a/engine/rtc/print_hours_mins.asm b/engine/rtc/print_hours_mins.asm index eb7dc1619..f4abc0c1b 100644 --- a/engine/rtc/print_hours_mins.asm +++ b/engine/rtc/print_hours_mins.asm @@ -1,4 +1,4 @@ -Unreferenced_Function1dd6a9: ; 1dd6a9 +Unreferenced_Function1dd6a9: ld a, b ld b, c ld c, a @@ -13,7 +13,7 @@ Unreferenced_Function1dd6a9: ; 1dd6a9 pop bc ret -PrintHoursMins: ; 1dd6bb (77:56bb) +PrintHoursMins: ; Hours in b, minutes in c ld a, b cp 12 @@ -59,5 +59,5 @@ PrintHoursMins: ; 1dd6bb (77:56bb) call PlaceString ret -String_AM: db "AM@" ; 1dd6fc -String_PM: db "PM@" ; 1dd6ff +String_AM: db "AM@" +String_PM: db "PM@" diff --git a/engine/rtc/reset_password.asm b/engine/rtc/reset_password.asm index fd5007ba7..1a5461b15 100644 --- a/engine/rtc/reset_password.asm +++ b/engine/rtc/reset_password.asm @@ -1,4 +1,4 @@ -_ResetClock: ; 4d3b1 +_ResetClock: farcall BlankScreen ld b, SCGB_DIPLOMA call GetSGBLayout @@ -31,34 +31,34 @@ _ResetClock: ; 4d3b1 call PrintText ret -.text_okay ; 0x4d3fe +.text_okay ; Password OK. Select CONTINUE & reset settings. text_jump UnknownText_0x1c55db db "@" -.text_wrong ; 0x4d403 +.text_wrong ; Wrong password! text_jump UnknownText_0x1c560b db "@" -.text_askreset ; 0x4d408 +.text_askreset ; Reset the clock? text_jump UnknownText_0x1c561c db "@" -.NoYes_MenuHeader: ; 0x4d40d +.NoYes_MenuHeader: db 0 ; flags menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 dw .NoYes_MenuData db 1 ; default option -.NoYes_MenuData: ; 0x4d415 +.NoYes_MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 ; items db "NO@" db "YES@" -ClockResetPassword: ; 4d41e +ClockResetPassword: call .CalculatePassword push de ld hl, wStringBuffer2 @@ -101,12 +101,12 @@ ClockResetPassword: ; 4d41e scf ret -.pleaseenterpasswordtext ; 0x4d463 +.pleaseenterpasswordtext ; Please enter the password. text_jump UnknownText_0x1c562e db "@" -.updateIDdisplay ; 4d468 +.updateIDdisplay hlcoord 14, 15 ld de, wStringBuffer2 ld c, 5 @@ -129,7 +129,7 @@ ClockResetPassword: ; 4d41e ld [hl], "▲" ret -.dpadinput ; 4d490 +.dpadinput ld a, b and D_LEFT jr nz, .left @@ -186,7 +186,7 @@ ClockResetPassword: ; 4d41e ld [hl], 9 ret -.getcurrentdigit ; 4d4d5 +.getcurrentdigit ld a, [wStringBuffer2 + 5] ld e, a ld d, $0 @@ -194,7 +194,7 @@ ClockResetPassword: ; 4d41e add hl, de ret -.ConvertDecIDToBytes: ; 4d4e0 +.ConvertDecIDToBytes: ld hl, 0 ld de, wStringBuffer2 + 4 ld bc, 1 @@ -206,7 +206,7 @@ ClockResetPassword: ; 4d41e ld bc, 1000 call .ConvertToBytes ld bc, 10000 -.ConvertToBytes: ; 4d501 +.ConvertToBytes: ld a, [de] dec de push hl @@ -218,7 +218,7 @@ ClockResetPassword: ; 4d41e add hl, bc ret -.CalculatePassword: ; 4d50f +.CalculatePassword: ld a, BANK(sPlayerData) call GetSRAMBank ld de, 0 @@ -234,7 +234,7 @@ ClockResetPassword: ; 4d41e call CloseSRAM ret -.ComponentFromNumber: ; 4d533 +.ComponentFromNumber: ld a, [hli] add e ld e, a @@ -245,7 +245,7 @@ ClockResetPassword: ; 4d41e jr nz, .ComponentFromNumber ret -.ComponentFromString: ; 4d53e +.ComponentFromString: ld a, [hli] cp "@" ret z diff --git a/engine/rtc/restart_clock.asm b/engine/rtc/restart_clock.asm index 5fbac80dd..5071fef48 100644 --- a/engine/rtc/restart_clock.asm +++ b/engine/rtc/restart_clock.asm @@ -1,4 +1,4 @@ -RestartClock_GetWraparoundTime: ; 20000 (8:4000) +RestartClock_GetWraparoundTime: push hl dec a ld e, a @@ -16,9 +16,8 @@ endr ld c, [hl] pop hl ret -; 20015 (8:4015) -.WrapAroundTimes: ; 20015 +.WrapAroundTimes: dw wBuffer4 db 7, 4 @@ -27,9 +26,8 @@ endr dw wBuffer6 db 60, 15 -; 20021 -RestartClock: ; 20021 (8:4021) +RestartClock: ; If we're here, we had an RTC overflow. ld hl, .Text_ClockTimeMayBeWrong call PrintText @@ -48,21 +46,18 @@ RestartClock: ; 20021 (8:4021) ld [hl], b ld c, a ret -; 20047 (8:4047) -.Text_ClockTimeMayBeWrong: ; 0x20047 +.Text_ClockTimeMayBeWrong: ; The clock's time may be wrong. Please reset the time. text_jump UnknownText_0x1c40e6 db "@" -; 0x2004c -.Text_SetWithControlPad: ; 0x2004c +.Text_SetWithControlPad: ; Set with the Control Pad. Confirm: A Button Cancel: B Button text_jump UnknownText_0x1c411c db "@" -; 0x20051 -.SetClock: ; 20051 (8:4051) +.SetClock: ld a, 1 ld [wBuffer1], a ; which digit ld [wBuffer2], a @@ -105,19 +100,16 @@ RestartClock: ; 20021 (8:4021) .cancel ld a, $1 ret -; 200b0 (8:40b0) -.Text_IsThisOK: ; 0x200b0 +.Text_IsThisOK: ; Is this OK? text_jump UnknownText_0x1c415b db "@" -; 0x200b5 -.Text_ClockReset: ; 0x200b5 +.Text_ClockReset: ; The clock has been reset. text_jump UnknownText_0x1c4168 db "@" -; 0x200ba .joy_loop call JoyTextDelay_ForcehJoyDown @@ -193,7 +185,7 @@ RestartClock: ; 20021 (8:4021) xor a ret -.PrintTime: ; 2011f (8:411f) +.PrintTime: hlcoord 0, 5 ld b, 5 ld c, 18 @@ -217,17 +209,15 @@ RestartClock: ; 20021 (8:4021) ld a, [wBuffer1] ld [wBuffer2], a ret -; 20160 (8:4160) -.unreferenced ; 20160 +.unreferenced ; unused ld a, [wBuffer3] ld b, a call Coord2Tile ret -; 20168 -.PlaceChars: ; 20168 (8:4168) +.PlaceChars: push de call RestartClock_GetWraparoundTime ld a, [wBuffer3] @@ -240,14 +230,11 @@ RestartClock: ; 20021 (8:4021) add hl, bc ld [hl], e ret -; 2017c (8:417c) -UnreferencedString_HourJP: ; 2017c +UnreferencedString_HourJP: ; unused db "じ@" ; HR -; 2017e -UnreferencedString_MinuteJP: ; 2017e +UnreferencedString_MinuteJP: ; unused db "ふん@" ; MIN -; 20181 diff --git a/engine/rtc/rtc.asm b/engine/rtc/rtc.asm index 37e24c1ed..4a8aab50a 100644 --- a/engine/rtc/rtc.asm +++ b/engine/rtc/rtc.asm @@ -9,9 +9,8 @@ Unreferenced_StopRTC: ld [MBC3RTC], a call CloseSRAM ret -; 14019 -StartRTC: ; 14019 +StartRTC: ld a, SRAM_ENABLE ld [MBC3SRamEnable], a call LatchClock @@ -22,9 +21,8 @@ StartRTC: ; 14019 ld [MBC3RTC], a call CloseSRAM ret -; 14032 -GetTimeOfDay:: ; 14032 +GetTimeOfDay:: ; get time of day based on the current hour ld a, [hHours] ; hour ld hl, TimesOfDay @@ -46,9 +44,8 @@ GetTimeOfDay:: ; 14032 ld a, [hl] ld [wTimeOfDay], a ret -; 14044 -TimesOfDay: ; 14044 +TimesOfDay: ; hours for the time of day ; 0400-0959 morn | 1000-1759 day | 1800-0359 nite db MORN_HOUR, NITE_F @@ -56,16 +53,14 @@ TimesOfDay: ; 14044 db NITE_HOUR, DAY_F db MAX_HOUR, NITE_F db -1, MORN_F -; 1404e Unreferenced_1404e: db 20, NITE_F db 40, MORN_F db 60, DAY_F db -1, MORN_F -; 14056 -StageRTCTimeForSave: ; 14056 +StageRTCTimeForSave: call UpdateTime ld hl, wRTC ld a, [wCurDay] @@ -77,9 +72,8 @@ StageRTCTimeForSave: ; 14056 ld a, [hSeconds] ld [hli], a ret -; 1406a -SaveRTC: ; 1406a +SaveRTC: ld a, $a ld [MBC3SRamEnable], a call LatchClock @@ -93,9 +87,8 @@ SaveRTC: ; 1406a ld [sRTCStatusFlags], a call CloseSRAM ret -; 14089 -StartClock:: ; 14089 +StartClock:: call GetClock call Function1409b call FixDays @@ -107,9 +100,8 @@ StartClock:: ; 14089 .skip_set call StartRTC ret -; 1409b -Function1409b: ; 1409b +Function1409b: ld hl, hRTCDayHi bit 7, [hl] jr nz, .set_bit_7 @@ -123,9 +115,8 @@ Function1409b: ; 1409b ld a, %10000000 call RecordRTCStatus ; set bit 7 on sRTCStatusFlags ret -; 140ae -Function140ae: ; 140ae +Function140ae: call CheckRTCStatus ld c, a and %11000000 ; Day count exceeded 255 or 16383 @@ -160,9 +151,8 @@ Function140ae: ; 140ae .dont_update xor a ret -; 140ed -_InitTime:: ; 140ed +_InitTime:: call GetClock call FixDays ld hl, hRTCSeconds @@ -206,4 +196,3 @@ _InitTime:: ; 140ed .okay_days ld [de], a ret -; 1412a diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm index eda3094e1..06f800c45 100644 --- a/engine/rtc/timeset.asm +++ b/engine/rtc/timeset.asm @@ -1,7 +1,7 @@ TIMESET_UP_ARROW EQUS "\"♂\"" ; $ef TIMESET_DOWN_ARROW EQUS "\"♀\"" ; $f5 -InitClock: ; 90672 (24:4672) +InitClock: ; Ask the player to set the time. ld a, [hInMenu] push af @@ -120,7 +120,7 @@ InitClock: ; 90672 (24:4672) ld [hInMenu], a ret -.ClearScreen: ; 90783 (24:4783) +.ClearScreen: xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -131,7 +131,7 @@ InitClock: ; 90672 (24:4672) ld [hBGMapMode], a ret -SetHour: ; 90795 (24:4795) +SetHour: ld a, [hJoyPressed] and A_BUTTON jr nz, .Confirm @@ -183,7 +183,7 @@ SetHour: ; 90795 (24:4795) scf ret -DisplayHourOClock: ; 907de (24:47de) +DisplayHourOClock: push hl ld a, [wInitHourBuffer] ld c, a @@ -195,9 +195,8 @@ DisplayHourOClock: ; 907de (24:47de) call PlaceString pop hl ret -; 907f1 (24:47f1) -UnreferencedFunction907f1: ; 907f1 +UnreferencedFunction907f1: ld h, d ld l, e push hl @@ -222,9 +221,8 @@ UnreferencedFunction907f1: ; 907f1 inc hl inc hl ret -; 90810 -SetMinutes: ; 90810 (24:4810) +SetMinutes: ld a, [hJoyPressed] and A_BUTTON jr nz, .a_button @@ -273,7 +271,7 @@ SetMinutes: ; 90810 (24:4810) scf ret -DisplayMinutesWithMinString: ; 90859 (24:4859) +DisplayMinutesWithMinString: ld de, wInitMinuteBuffer call PrintTwoDigitNumberRightAlign inc hl @@ -281,7 +279,7 @@ DisplayMinutesWithMinString: ; 90859 (24:4859) call PlaceString ret -PrintTwoDigitNumberRightAlign: ; 90867 (24:4867) +PrintTwoDigitNumberRightAlign: push hl ld a, " " ld [hli], a @@ -290,25 +288,21 @@ PrintTwoDigitNumberRightAlign: ; 90867 (24:4867) lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum ret -; 90874 (24:4874) -Text_WokeUpOak: ; 0x90874 +Text_WokeUpOak: ; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me? text_jump UnknownText_0x1bc29c db "@" -; 0x90879 -Text_WhatTimeIsIt: ; 0x90879 +Text_WhatTimeIsIt: ; What time is it? text_jump UnknownText_0x1bc2eb db "@" -; 0x9087e String_oclock: db "o'clock@" -; 90886 -Text_WhatHrs: ; 0x90886 +Text_WhatHrs: ; What?@ @ text_jump UnknownText_0x1bc2fd start_asm @@ -316,25 +310,21 @@ Text_WhatHrs: ; 0x90886 call DisplayHourOClock ld hl, .QuestionMark ret -; 90895 (24:4895) -.QuestionMark: ; 0x90895 +.QuestionMark: ; ? text_jump UnknownText_0x1bc305 db "@" -; 0x9089a -Text_HowManyMinutes: ; 0x9089a +Text_HowManyMinutes: ; How many minutes? text_jump UnknownText_0x1bc308 db "@" -; 0x9089f String_min: db "min.@" -; 908a4 -Text_WhoaMins: ; 0x908a4 +Text_WhoaMins: ; Whoa!@ @ text_jump UnknownText_0x1bc31b start_asm @@ -342,15 +332,13 @@ Text_WhoaMins: ; 0x908a4 call DisplayMinutesWithMinString ld hl, .QuestionMark ret -; 908b3 (24:48b3) -.QuestionMark: ; 0x908b3 +.QuestionMark: ; ? text_jump UnknownText_0x1bc323 db "@" -; 0x908b8 -OakText_ResponseToSetTime: ; 0x908b8 +OakText_ResponseToSetTime: start_asm decoord 1, 14 ld a, [wInitHourBuffer] @@ -379,35 +367,30 @@ OakText_ResponseToSetTime: ; 0x908b8 .day: ld hl, .yikes ret -; 908ec (24:48ec) -.overslept ; 0x908ec +.overslept ; ! I overslept! text_jump UnknownText_0x1bc326 db "@" -; 0x908f1 -.yikes ; 0x908f1 +.yikes ; ! Yikes! I over- slept! text_jump UnknownText_0x1bc336 db "@" -; 0x908f6 -.sodark ; 0x908f6 +.sodark ; ! No wonder it's so dark! text_jump UnknownText_0x1bc34f db "@" -; 0x908fb -TimeSetBackgroundGFX: ; 908fb +TimeSetBackgroundGFX: INCBIN "gfx/new_game/timeset_bg.1bpp" -TimeSetUpArrowGFX: ; 90903 +TimeSetUpArrowGFX: INCBIN "gfx/new_game/up_arrow.1bpp" -TimeSetDownArrowGFX: ; 9090b +TimeSetDownArrowGFX: INCBIN "gfx/new_game/down_arrow.1bpp" -; 90913 -SetDayOfWeek: ; 90913 +SetDayOfWeek: ld a, [hInMenu] push af ld a, $1 @@ -459,9 +442,8 @@ SetDayOfWeek: ; 90913 pop af ld [hInMenu], a ret -; 90993 -.GetJoypadAction: ; 90993 +.GetJoypadAction: ld a, [hJoyPressed] and A_BUTTON jr z, .not_A @@ -515,9 +497,8 @@ SetDayOfWeek: ; 90913 call WaitBGMap and a ret -; 909de -.PlaceWeekdayString: ; 909de +.PlaceWeekdayString: push hl ld a, [wTempDayOfWeek] ld e, a @@ -531,9 +512,8 @@ SetDayOfWeek: ; 90913 pop hl call PlaceString ret -; 909f2 -.WeekdayStrings: ; 909f2 +.WeekdayStrings: ; entries correspond to wCurDay constants (see constants/wram_constants.asm) dw .Sunday dw .Monday @@ -552,28 +532,24 @@ SetDayOfWeek: ; 90913 .Friday: db " FRIDAY@" .Saturday: db "SATURDAY@" - -.WhatDayIsItText: ; 0x90a3f +.WhatDayIsItText: ; What day is it? text_jump UnknownText_0x1bc369 db "@" -; 0x90a44 -.ConfirmWeekdayText: ; 0x90a44 +.ConfirmWeekdayText: start_asm hlcoord 1, 14 call .PlaceWeekdayString ld hl, .IsIt ret -; 90a4f (24:4a4f) -.IsIt: ; 0x90a4f +.IsIt: ; , is it? text_jump UnknownText_0x1bc37a db "@" -; 0x90a54 -InitialSetDSTFlag: ; 90a54 +InitialSetDSTFlag: ld a, [wDST] set 7, a ld [wDST], a @@ -583,9 +559,8 @@ InitialSetDSTFlag: ; 90a54 ld hl, .Text call PlaceHLTextAtBC ret -; 90a6c -.Text: ; 90a6c +.Text: start_asm call UpdateTime ld a, [hHours] @@ -596,15 +571,13 @@ InitialSetDSTFlag: ; 90a54 farcall PrintHoursMins ld hl, .DSTIsThatOK ret -; 90a83 (24:4a83) -.DSTIsThatOK: ; 0x90a83 +.DSTIsThatOK: ; DST, is that OK? text_jump Text_DSTIsThatOK db "@" -; 0x90a88 -InitialClearDSTFlag: ; 90a88 +InitialClearDSTFlag: ld a, [wDST] res 7, a ld [wDST], a @@ -614,9 +587,8 @@ InitialClearDSTFlag: ; 90a88 ld hl, .Text call PlaceHLTextAtBC ret -; 90aa0 -.Text: ; 90aa0 +.Text: start_asm call UpdateTime ld a, [hHours] @@ -627,24 +599,21 @@ InitialClearDSTFlag: ; 90a88 farcall PrintHoursMins ld hl, .IsThatOK ret -; 90ab7 -.IsThatOK: ; 0x90ab7 +.IsThatOK: ; , is that OK? text_jump UnknownText_0x1c5ff1 db "@" -; 0x90abc -DebugDisplayTime: ; 90abc +DebugDisplayTime: hlcoord 1, 14 lb bc, 3, SCREEN_WIDTH - 2 call ClearBox ld hl, .Text call PlaceHLTextAtBC ret -; 90acc -.Text: ; 0x90acc +.Text: start_asm call UpdateTime @@ -694,14 +663,12 @@ DebugDisplayTime: ; 90abc .done ld hl, .NowOnDebug ret -; 90b13 -.NowOnDebug: ; 0x90b13 +.NowOnDebug: text "<PARA>Now on DEBUG…" prompt -; 0x90b23 -.PrintTime: ; 90b23 +.PrintTime: lb bc, 1, 3 call PrintNum ld [hl], "." @@ -715,9 +682,8 @@ DebugDisplayTime: ; 90abc lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 90b3e -PrintHour: ; 90b3e (24:4b3e) +PrintHour: ld l, e ld h, d push bc @@ -733,7 +699,7 @@ PrintHour: ; 90b3e (24:4b3e) call PrintTwoDigitNumberRightAlign ret -GetTimeOfDayString: ; 90b58 (24:4b58) +GetTimeOfDayString: ld a, c cp MORN_HOUR jr c, .nite @@ -750,12 +716,10 @@ GetTimeOfDayString: ; 90b58 (24:4b58) .day ld de, .day_string ret -; 90b71 (24:4b71) .nite_string: db "NITE@" .morn_string: db "MORN@" .day_string: db "DAY@" -; 90b7f AdjustHourForAMorPM: ; Convert the hour stored in c (0-23) to a 1-12 value diff --git a/engine/smallflag.asm b/engine/smallflag.asm index 2a6d91ee1..22819e5d5 100644 --- a/engine/smallflag.asm +++ b/engine/smallflag.asm @@ -1,4 +1,4 @@ -SmallFarFlagAction: ; 4d7c1 +SmallFarFlagAction: ; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. diff --git a/engine/tilesets/map_palettes.asm b/engine/tilesets/map_palettes.asm index a9d2b382f..5f943795a 100644 --- a/engine/tilesets/map_palettes.asm +++ b/engine/tilesets/map_palettes.asm @@ -1,4 +1,4 @@ -SwapTextboxPalettes:: ; 4c000 +SwapTextboxPalettes:: hlcoord 0, 0 decoord 0, 0, wAttrMap ld b, SCREEN_HEIGHT @@ -44,7 +44,7 @@ SwapTextboxPalettes:: ; 4c000 jr nz, .loop ret -ScrollBGMapPalettes:: ; 4c03f +ScrollBGMapPalettes:: ld hl, wBGMapBuffer ld de, wBGMapPalBuffer .loop diff --git a/engine/tilesets/mapgroup_roofs.asm b/engine/tilesets/mapgroup_roofs.asm index 58e5e7cfe..b269e5277 100644 --- a/engine/tilesets/mapgroup_roofs.asm +++ b/engine/tilesets/mapgroup_roofs.asm @@ -1,4 +1,4 @@ -LoadMapGroupRoof:: ; 1c000 +LoadMapGroupRoof:: ld a, [wMapGroup] ld e, a ld d, 0 @@ -14,7 +14,5 @@ LoadMapGroupRoof:: ; 1c000 ld bc, 9 tiles call CopyBytes ret -; 1c021 - INCLUDE "data/maps/roofs.asm" diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index bf0037e65..2827b3a92 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -1,4 +1,4 @@ -_AnimateTileset:: ; fc000 +_AnimateTileset:: ; Iterate over a given pointer array of ; animation functions (one per frame). @@ -32,39 +32,36 @@ _AnimateTileset:: ; fc000 ld l, a jp hl -; fc01b -Tileset0Anim: ; 0xfc01b -TilesetJohtoModernAnim: ; 0xfc01b -TilesetKantoAnim: ; 0xfc01b +Tileset0Anim: +TilesetJohtoModernAnim: +TilesetKantoAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc047 -TilesetParkAnim: ; 0xfc047 +TilesetParkAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw vTiles2 tile $5f, AnimateFountain dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc073 -TilesetForestAnim: ; 0xfc073 +TilesetForestAnim: dw NULL, ForestTreeLeftAnimation dw NULL, ForestTreeRightAnimation dw NULL, WaitTileAnimation @@ -74,16 +71,15 @@ TilesetForestAnim: ; 0xfc073 dw NULL, ForestTreeRightAnimation2 dw NULL, AnimateFlowerTile dw vTiles2 tile $14, AnimateWaterTile - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc0a3 -TilesetJohtoAnim: ; 0xfc0a3 +TilesetJohtoAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw WhirlpoolFrames1, AnimateWhirlpoolTile @@ -93,9 +89,8 @@ TilesetJohtoAnim: ; 0xfc0a3 dw NULL, WaitTileAnimation dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc0d7 -UnusedTilesetAnim_fc0d7: ; 0xfc0d7 +UnusedTilesetAnim_fc0d7: dw vTiles2 tile $03, WriteTileToBuffer dw wTileAnimBuffer, ScrollTileRightLeft dw vTiles2 tile $03, WriteTileFromBuffer @@ -107,9 +102,8 @@ UnusedTilesetAnim_fc0d7: ; 0xfc0d7 dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, DoneTileAnimation -; 0xfc103 -UnusedTilesetAnim_fc103: ; 0xfc103 +UnusedTilesetAnim_fc103: dw vTiles2 tile $14, WriteTileToBuffer dw wTileAnimBuffer, ScrollTileRightLeft dw vTiles2 tile $14, WriteTileFromBuffer @@ -121,24 +115,22 @@ UnusedTilesetAnim_fc103: ; 0xfc103 dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, DoneTileAnimation -; 0xfc12f -TilesetPortAnim: ; 0xfc12f +TilesetPortAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc15f -TilesetEliteFourRoomAnim: ; 0xfc15f +TilesetEliteFourRoomAnim: dw NULL, LavaBubbleAnim2 dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -147,9 +139,8 @@ TilesetEliteFourRoomAnim: ; 0xfc15f dw NULL, WaitTileAnimation dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation -; 0xfc17f -UnusedTilesetAnim_fc17f: ; 0xfc17f +UnusedTilesetAnim_fc17f: dw vTiles2 tile $53, WriteTileToBuffer dw wTileAnimBuffer, ScrollTileDown dw wTileAnimBuffer, ScrollTileDown @@ -162,9 +153,8 @@ UnusedTilesetAnim_fc17f: ; 0xfc17f dw wTileAnimBuffer, ScrollTileDown dw vTiles2 tile $53, WriteTileFromBuffer dw NULL, DoneTileAnimation -; 0xfc1af -UnusedTilesetAnim_fc1af: ; 0xfc1af +UnusedTilesetAnim_fc1af: dw vTiles2 tile $54, WriteTileToBuffer dw wTileAnimBuffer, ScrollTileDown dw wTileAnimBuffer, ScrollTileDown @@ -179,17 +169,16 @@ UnusedTilesetAnim_fc1af: ; 0xfc1af dw wTileAnimBuffer, ScrollTileDown dw vTiles2 tile $54, WriteTileFromBuffer dw NULL, DoneTileAnimation -; 0xfc1e7 -TilesetCaveAnim: ; 0xfc1e7 -TilesetDarkCaveAnim: ; 0xfc1e7 +TilesetCaveAnim: +TilesetDarkCaveAnim: dw vTiles2 tile $14, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette dw wTileAnimBuffer, ScrollTileRightLeft dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $14, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $40, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -202,16 +191,15 @@ TilesetDarkCaveAnim: ; 0xfc1e7 dw vTiles2 tile $40, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette dw NULL, DoneTileAnimation -; 0xfc233 -TilesetIcePathAnim: ; 0xfc233 +TilesetIcePathAnim: dw vTiles2 tile $35, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette dw wTileAnimBuffer, ScrollTileRightLeft dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $35, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $31, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -224,9 +212,8 @@ TilesetIcePathAnim: ; 0xfc233 dw vTiles2 tile $31, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette dw NULL, DoneTileAnimation -; 0xfc27f -TilesetTowerAnim: ; 0xfc27f +TilesetTowerAnim: dw TowerPillarTilePointer9, AnimateTowerPillarTile dw TowerPillarTilePointer10, AnimateTowerPillarTile dw TowerPillarTilePointer7, AnimateTowerPillarTile @@ -243,9 +230,8 @@ TilesetTowerAnim: ; 0xfc27f dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, DoneTileAnimation -; 0xfc2bf -UnusedTilesetAnim_fc2bf: ; 0xfc2bf +UnusedTilesetAnim_fc2bf: dw vTiles2 tile $4f, WriteTileToBuffer dw wTileAnimBuffer, ScrollTileRightLeft dw vTiles2 tile $4f, WriteTileFromBuffer @@ -256,60 +242,55 @@ UnusedTilesetAnim_fc2bf: ; 0xfc2bf dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, DoneTileAnimation -; 0xfc2e7 - -TilesetBattleTowerOutsideAnim: ; 0xfc2e7 -TilesetHouseAnim: ; 0xfc2e7 -TilesetPlayersHouseAnim: ; 0xfc2e7 -TilesetPokecenterAnim: ; 0xfc2e7 -TilesetGateAnim: ; 0xfc2e7 -TilesetLabAnim: ; 0xfc2e7 -TilesetFacilityAnim: ; 0xfc2e7 -TilesetMartAnim: ; 0xfc2e7 -TilesetMansionAnim: ; 0xfc2e7 -TilesetGameCornerAnim: ; 0xfc2e7 -TilesetTraditionalHouseAnim: ; 0xfc2e7 -TilesetTrainStationAnim: ; 0xfc2e7 -TilesetChampionsRoomAnim: ; 0xfc2e7 -TilesetLighthouseAnim: ; 0xfc2e7 -TilesetPlayersRoomAnim: ; 0xfc2e7 -TilesetPokeComCenterAnim: ; 0xfc2e7 -TilesetBattleTowerAnim: ; 0xfc2e7 -TilesetRuinsOfAlphAnim: ; 0xfc2e7 -TilesetRadioTowerAnim: ; 0xfc2e7 -TilesetUndergroundAnim: ; 0xfc2e7 -TilesetBetaWordRoomAnim: ; 0xfc2e7 -TilesetHoOhWordRoomAnim: ; 0xfc2e7 -TilesetKabutoWordRoomAnim: ; 0xfc2e7 -TilesetOmanyteWordRoomAnim: ; 0xfc2e7 -TilesetAerodactylWordRoomAnim: ; 0xfc2e7 + +TilesetBattleTowerOutsideAnim: +TilesetHouseAnim: +TilesetPlayersHouseAnim: +TilesetPokecenterAnim: +TilesetGateAnim: +TilesetLabAnim: +TilesetFacilityAnim: +TilesetMartAnim: +TilesetMansionAnim: +TilesetGameCornerAnim: +TilesetTraditionalHouseAnim: +TilesetTrainStationAnim: +TilesetChampionsRoomAnim: +TilesetLighthouseAnim: +TilesetPlayersRoomAnim: +TilesetPokeComCenterAnim: +TilesetBattleTowerAnim: +TilesetRuinsOfAlphAnim: +TilesetRadioTowerAnim: +TilesetUndergroundAnim: +TilesetBetaWordRoomAnim: +TilesetHoOhWordRoomAnim: +TilesetKabutoWordRoomAnim: +TilesetOmanyteWordRoomAnim: +TilesetAerodactylWordRoomAnim: dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, DoneTileAnimation -; 0xfc2fb -DoneTileAnimation: ; fc2fb +DoneTileAnimation: ; Reset the animation command loop. xor a ld [hTileAnimFrame], a -WaitTileAnimation: ; fc2fe +WaitTileAnimation: ; Do nothing this frame. ret -; fc2ff -StandingTileFrame8: ; fc2ff +StandingTileFrame8: ld a, [wTileAnimationTimer] inc a and %111 ld [wTileAnimationTimer], a ret -; fc309 - -ScrollTileRightLeft: ; fc309 +ScrollTileRightLeft: ; Scroll right for 4 ticks, then left for 4 ticks. ld a, [wTileAnimationTimer] inc a @@ -318,9 +299,8 @@ ScrollTileRightLeft: ; fc309 and %100 jr nz, ScrollTileLeft jr ScrollTileRight -; fc318 -ScrollTileUpDown: ; fc318 +ScrollTileUpDown: ; Scroll up for 4 ticks, then down for 4 ticks. ld a, [wTileAnimationTimer] inc a @@ -329,9 +309,8 @@ ScrollTileUpDown: ; fc318 and %100 jr nz, ScrollTileDown jr ScrollTileUp -; fc327 -ScrollTileLeft: ; fc327 +ScrollTileLeft: ld h, d ld l, e ld c, 4 @@ -344,9 +323,8 @@ endr dec c jr nz, .loop ret -; fc33b -ScrollTileRight: ; fc33b +ScrollTileRight: ld h, d ld l, e ld c, 4 @@ -359,9 +337,8 @@ endr dec c jr nz, .loop ret -; fc34f -ScrollTileUp: ; fc34f +ScrollTileUp: ld h, d ld l, e ld d, [hl] @@ -386,9 +363,8 @@ ScrollTileUp: ; fc34f dec a jr nz, .loop ret -; fc36a -ScrollTileDown: ; fc36a +ScrollTileDown: ld h, d ld l, e ld de, TILE_WIDTH * 2 - 2 @@ -415,10 +391,8 @@ ScrollTileDown: ; fc36a dec a jr nz, .loop ret -; fc387 - -AnimateFountain: ; fc387 +AnimateFountain: ld hl, sp+0 ld b, h ld c, l @@ -454,10 +428,8 @@ AnimateFountain: ; fc387 .frame3 INCBIN "gfx/tilesets/fountain/3.2bpp" .frame4 INCBIN "gfx/tilesets/fountain/4.2bpp" .frame5 INCBIN "gfx/tilesets/fountain/5.2bpp" -; fc402 - -AnimateWaterTile: ; fc402 +AnimateWaterTile: ; Draw a water tile for the current frame in VRAM tile at de. ; Save sp in bc (see WriteTile). @@ -488,14 +460,11 @@ AnimateWaterTile: ; fc402 ld h, d jp WriteTile -; fc41c -WaterTileFrames: ; fc41c +WaterTileFrames: INCBIN "gfx/tilesets/water/water.2bpp" -; fc45c - -ForestTreeLeftAnimation: ; fc45c +ForestTreeLeftAnimation: ld hl, sp+0 ld b, h ld c, l @@ -523,21 +492,16 @@ ForestTreeLeftAnimation: ; fc45c ld sp, hl ld hl, vTiles2 tile $0c jp WriteTile -; fc484 - -ForestTreeLeftFrames: ; fc484 +ForestTreeLeftFrames: INCBIN "gfx/tilesets/forest-tree/1.2bpp" INCBIN "gfx/tilesets/forest-tree/2.2bpp" -; fc4a4 -ForestTreeRightFrames: ; fc4a4 +ForestTreeRightFrames: INCBIN "gfx/tilesets/forest-tree/3.2bpp" INCBIN "gfx/tilesets/forest-tree/4.2bpp" -; fc4c4 - -ForestTreeRightAnimation: ; fc4c4 +ForestTreeRightAnimation: ld hl, sp+0 ld b, h ld c, l @@ -569,10 +533,8 @@ ForestTreeRightAnimation: ; fc4c4 ld sp, hl ld hl, vTiles2 tile $0f jp WriteTile -; fc4f2 - -ForestTreeLeftAnimation2: ; fc4f2 +ForestTreeLeftAnimation2: ld hl, sp+0 ld b, h ld c, l @@ -601,10 +563,8 @@ ForestTreeLeftAnimation2: ; fc4f2 ld sp, hl ld hl, vTiles2 tile $0c jp WriteTile -; fc51c - -ForestTreeRightAnimation2: ; fc51c +ForestTreeRightAnimation2: ld hl, sp+0 ld b, h ld c, l @@ -637,10 +597,8 @@ ForestTreeRightAnimation2: ; fc51c ld sp, hl ld hl, vTiles2 tile $0f jp WriteTile -; fc54c - -GetForestTreeFrame: ; fc54c +GetForestTreeFrame: ; Return 0 if a is even, or 2 if odd. and a jr z, .even @@ -663,10 +621,8 @@ GetForestTreeFrame: ; fc54c .even xor a ret -; fc56d - -AnimateFlowerTile: ; fc56d +AnimateFlowerTile: ; No parameters. ; Save sp in bc (see WriteTile). @@ -694,17 +650,14 @@ AnimateFlowerTile: ; fc56d ld hl, vTiles2 tile $03 jp WriteTile -; fc58c -FlowerTileFrames: ; fc58c +FlowerTileFrames: INCBIN "gfx/tilesets/flower/dmg_1.2bpp" INCBIN "gfx/tilesets/flower/cgb_1.2bpp" INCBIN "gfx/tilesets/flower/dmg_2.2bpp" INCBIN "gfx/tilesets/flower/cgb_2.2bpp" -; fc5cc - -LavaBubbleAnim1: ; fc5cc +LavaBubbleAnim1: ; Splash in the bottom-right corner of the fountain. ld hl, sp+0 ld b, h @@ -723,10 +676,8 @@ LavaBubbleAnim1: ; fc5cc ld sp, hl ld hl, vTiles2 tile $5b jp WriteTile -; fc5eb - -LavaBubbleAnim2: ; fc5eb +LavaBubbleAnim2: ; Splash in the top-left corner of the fountain. ld hl, sp+0 ld b, h @@ -743,18 +694,14 @@ LavaBubbleAnim2: ; fc5eb ld sp, hl ld hl, vTiles2 tile $38 jp WriteTile -; fc605 - -LavaBubbleFrames: ; fc605 +LavaBubbleFrames: INCBIN "gfx/tilesets/lava/1.2bpp" INCBIN "gfx/tilesets/lava/2.2bpp" INCBIN "gfx/tilesets/lava/3.2bpp" INCBIN "gfx/tilesets/lava/4.2bpp" -; fc645 - -AnimateTowerPillarTile: ; fc645 +AnimateTowerPillarTile: ; Read from struct at de: ; Destination (VRAM) ; Address of the first tile in the frame array @@ -799,17 +746,13 @@ AnimateTowerPillarTile: ; fc645 .frames db $00, $10, $20, $30, $40, $30, $20, $10 -; fc673 - -StandingTileFrame: ; fc673 +StandingTileFrame: ld hl, wTileAnimationTimer inc [hl] ret -; fc678 - -AnimateWhirlpoolTile: ; fc678 +AnimateWhirlpoolTile: ; Update whirlpool tile using struct at de. ; Struct: @@ -852,10 +795,8 @@ AnimateWhirlpoolTile: ; fc678 ld h, d jr WriteTile -; fc696 - -WriteTileFromBuffer: ; fc696 +WriteTileFromBuffer: ; Write tiledata at wTileAnimBuffer to de. ; wTileAnimBuffer is loaded to sp for WriteTile. @@ -869,10 +810,8 @@ WriteTileFromBuffer: ; fc696 ld h, d ld l, e jr WriteTile -; fc6a2 - -WriteTileToBuffer: ; fc6a2 +WriteTileToBuffer: ; Write tiledata de to wTileAnimBuffer. ; de is loaded to sp for WriteTile. @@ -888,7 +827,7 @@ WriteTileToBuffer: ; fc6a2 ; fallthrough -WriteTile: ; fc6ac +WriteTile: ; Write one 8x8 tile ($10 bytes) from sp to hl. ; Warning: sp is saved in bc so we can abuse pop. @@ -912,10 +851,8 @@ endr ld l, c ld sp, hl ret -; fc6d7 - -TileAnimationPalette: ; fc6d7 +AnimateWaterPalette: ; Transition between color values 0-2 for color 0 in palette 3. ; No palette changes on DMG. @@ -978,10 +915,8 @@ TileAnimationPalette: ; fc6d7 pop af ld [rSVBK], a ret -; fc71e - -FlickeringCaveEntrancePalette: ; fc71e +FlickeringCaveEntrancePalette: ; No palette changes on DMG. ld a, [hCGB] and a @@ -1020,8 +955,6 @@ FlickeringCaveEntrancePalette: ; fc71e pop af ld [rSVBK], a ret -; fc750 - TowerPillarTilePointer1: dw vTiles2 tile $2d, TowerPillarTile1 TowerPillarTilePointer2: dw vTiles2 tile $2f, TowerPillarTile2 @@ -1044,17 +977,13 @@ TowerPillarTile7: INCBIN "gfx/tilesets/tower-pillar/7.2bpp" TowerPillarTile8: INCBIN "gfx/tilesets/tower-pillar/8.2bpp" TowerPillarTile9: INCBIN "gfx/tilesets/tower-pillar/9.2bpp" TowerPillarTile10: INCBIN "gfx/tilesets/tower-pillar/10.2bpp" -; fca98 - WhirlpoolFrames1: dw vTiles2 tile $32, WhirlpoolTiles1 WhirlpoolFrames2: dw vTiles2 tile $33, WhirlpoolTiles2 WhirlpoolFrames3: dw vTiles2 tile $42, WhirlpoolTiles3 WhirlpoolFrames4: dw vTiles2 tile $43, WhirlpoolTiles4 -; fcaa8 WhirlpoolTiles1: INCBIN "gfx/tilesets/whirlpool/1.2bpp" WhirlpoolTiles2: INCBIN "gfx/tilesets/whirlpool/2.2bpp" WhirlpoolTiles3: INCBIN "gfx/tilesets/whirlpool/3.2bpp" WhirlpoolTiles4: INCBIN "gfx/tilesets/whirlpool/4.2bpp" -; fcba8 diff --git a/engine/tilesets/tileset_palettes.asm b/engine/tilesets/tileset_palettes.asm index e2c39c0ab..1e433b158 100644 --- a/engine/tilesets/tileset_palettes.asm +++ b/engine/tilesets/tileset_palettes.asm @@ -1,4 +1,4 @@ -LoadSpecialMapPalette: ; 494ac +LoadSpecialMapPalette: ld a, [wMapTileset] cp TILESET_POKECOM_CENTER jr z, .pokecom_2f @@ -51,78 +51,66 @@ LoadSpecialMapPalette: ; 494ac .do_nothing and a ret -; 494f2 -LoadPokeComPalette: ; 494f2 +LoadPokeComPalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, PokeComPalette ld bc, 8 palettes call FarCopyWRAM ret -; 49501 -PokeComPalette: ; 49501 +PokeComPalette: INCLUDE "gfx/tilesets/pokecom_center.pal" -; 49541 -LoadBattleTowerPalette: ; 49541 +LoadBattleTowerPalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, BattleTowerPalette ld bc, 8 palettes call FarCopyWRAM ret -; 49550 -BattleTowerPalette: ; 49550 +BattleTowerPalette: INCLUDE "gfx/tilesets/battle_tower.pal" -; 49590 -LoadIcePathPalette: ; 49590 +LoadIcePathPalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, IcePathPalette ld bc, 8 palettes call FarCopyWRAM ret -; 4959f -IcePathPalette: ; 4959f +IcePathPalette: INCLUDE "gfx/tilesets/ice_path.pal" -; 495df -LoadHousePalette: ; 495df +LoadHousePalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, HousePalette ld bc, 8 palettes call FarCopyWRAM ret -; 495ee -HousePalette: ; 495ee +HousePalette: INCLUDE "gfx/tilesets/house.pal" -; 4962e -LoadRadioTowerPalette: ; 4962e +LoadRadioTowerPalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, RadioTowerPalette ld bc, 8 palettes call FarCopyWRAM ret -; 4963d -RadioTowerPalette: ; 4963d +RadioTowerPalette: INCLUDE "gfx/tilesets/radio_tower.pal" -; 4967d -MansionPalette1: ; 4967d +MansionPalette1: INCLUDE "gfx/tilesets/mansion_1.pal" -; 496c5 -LoadMansionPalette: ; 496c5 +LoadMansionPalette: ld a, BANK(wBGPals1) ld de, wBGPals1 ld hl, MansionPalette1 @@ -144,8 +132,6 @@ LoadMansionPalette: ; 496c5 ld bc, 1 palettes call FarCopyWRAM ret -; 496fe -MansionPalette2: ; 496fe +MansionPalette2: INCLUDE "gfx/tilesets/mansion_2.pal" -; 49706 diff --git a/engine/tilesets/timeofday_pals.asm b/engine/tilesets/timeofday_pals.asm index b8d43d252..58bbe9183 100644 --- a/engine/tilesets/timeofday_pals.asm +++ b/engine/tilesets/timeofday_pals.asm @@ -1,18 +1,16 @@ -DummyPredef35: ; 8c000 +DummyPredef35: DummyPredef36: ret -UpdateTimeOfDayPal:: ; 8c001 +UpdateTimeOfDayPal:: call UpdateTime ld a, [wTimeOfDay] ld [wCurTimeOfDay], a call GetTimePalette ld [wTimeOfDayPal], a ret -; 8c011 - -_TimeOfDayPals:: ; 8c011 +_TimeOfDayPals:: ; return carry if pals are changed ; forced pals? @@ -66,12 +64,10 @@ _TimeOfDayPals:: ; 8c011 ld a, b ld [rSVBK], a - ; update sgb pals ld b, SCGB_MAPPALS call GetSGBLayout - ; restore bg palette 7 ld hl, wOBPals1 - 1 ; last byte in wBGPals1 @@ -109,34 +105,29 @@ _TimeOfDayPals:: ; 8c011 ; no change occurred and a ret -; 8c070 - -_UpdateTimePals:: ; 8c070 +_UpdateTimePals:: ld c, $9 ; normal call GetTimePalFade call DmgToCgbTimePals ret -; 8c079 -FadeInPalettes:: ; 8c079 +FadeInPalettes:: ld c, $12 call GetTimePalFade ld b, $4 call ConvertTimePalsDecHL ret -; 8c084 -FadeOutPalettes:: ; 8c084 +FadeOutPalettes:: call FillWhiteBGColor ld c, $9 call GetTimePalFade ld b, $4 call ConvertTimePalsIncHL ret -; 8c092 -BattleTowerFade: ; 8c092 +BattleTowerFade: call FillWhiteBGColor ld c, $9 call GetTimePalFade @@ -151,26 +142,22 @@ BattleTowerFade: ; 8c092 dec b jr nz, .asm_8c09c ret -; 8c0ab -FadeInQuickly: ; 8c0ab +FadeInQuickly: ld c, $0 call GetTimePalFade ld b, $4 call ConvertTimePalsIncHL ret -; 8c0b6 -FadeBlackQuickly: ; 8c0b6 +FadeBlackQuickly: ld c, $9 call GetTimePalFade ld b, $4 call ConvertTimePalsDecHL ret -; 8c0c1 - -FillWhiteBGColor: ; 8c0c1 +FillWhiteBGColor: ld a, [rSVBK] push af ld a, BANK(wBGPals1) @@ -197,9 +184,8 @@ endr pop af ld [rSVBK], a ret -; 8c0e5 -ReplaceTimeOfDayPals: ; 8c0e5 +ReplaceTimeOfDayPals: ld hl, .BrightnessLevels ld a, [wMapTimeOfDay] cp $4 ; Dark cave, needs Flash @@ -226,9 +212,8 @@ ReplaceTimeOfDayPals: ; 8c0e5 ld a, %10101010 ; 2, 2, 2, 2 ld [wTimeOfDayPalset], a ret -; 8c10f (23:410f) -.BrightnessLevels: ; 8c10f +.BrightnessLevels: dc 3, 2, 1, 0 dc 1, 1, 1, 1 dc 2, 2, 2, 2 @@ -237,9 +222,8 @@ ReplaceTimeOfDayPals: ; 8c0e5 dc 3, 2, 1, 0 dc 3, 2, 1, 0 dc 3, 2, 1, 0 -; 8c117 -GetTimePalette: ; 8c117 +GetTimePalette: ld a, [wTimeOfDay] ld e, a ld d, 0 @@ -250,7 +234,6 @@ GetTimePalette: ; 8c117 ld h, [hl] ld l, a jp hl -; 8c126 .TimePalettes: dw .MorningPalette @@ -282,10 +265,8 @@ GetTimePalette: ; 8c117 rlca rlca ret -; 8c14e - -DmgToCgbTimePals: ; 8c14e +DmgToCgbTimePals: push hl push de ld a, [hli] @@ -298,9 +279,8 @@ DmgToCgbTimePals: ; 8c14e pop de pop hl ret -; 8c15e -ConvertTimePalsIncHL: ; 8c15e +ConvertTimePalsIncHL: .loop call DmgToCgbTimePals inc hl @@ -311,9 +291,8 @@ ConvertTimePalsIncHL: ; 8c15e dec b jr nz, .loop ret -; 8c16d -ConvertTimePalsDecHL: ; 8c16d +ConvertTimePalsDecHL: .loop call DmgToCgbTimePals dec hl @@ -324,10 +303,8 @@ ConvertTimePalsDecHL: ; 8c16d dec b jr nz, .loop ret -; 8c17c - -GetTimePalFade: ; 8c17c +GetTimePalFade: ; check cgb ld a, [hCGB] and a @@ -412,4 +389,3 @@ GetTimePalFade: ; 8c17c db %10010000, %10010000, %10010000 db %01000000, %01000000, %01000000 db %00000000, %00000000, %00000000 -; 8c20f |