diff options
Diffstat (limited to 'engine/events')
73 files changed, 698 insertions, 1150 deletions
diff --git a/engine/events/basement_key.asm b/engine/events/basement_key.asm index 879c86a34..64c172ac2 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,7 +26,6 @@ _BasementKey: ; 507b4 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507e1 .BasementKeyScript: ; 0x507e1 closetext diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index d75015d5b..e1aa177e9 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 @@ -278,7 +265,7 @@ RunBattleTowerTrainer: ; 17024d ret -ReadBTTrainerParty: ; 1702b7 +ReadBTTrainerParty: ; Initialise the BattleTower-Trainer and his mon call CopyBTTrainer_FromBT_OT_TowBT_OTTemp @@ -394,9 +381,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 +487,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 +552,11 @@ 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 +578,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 +599,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 +623,8 @@ Function1704e1: ; 1704e1 .done ret -; 170510 -.DoJumptable: ; 170510 +.DoJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -656,15 +635,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 @@ -744,9 +721,8 @@ Function1704e1: ; 1704e1 ld hl, wJumptableIndex inc [hl] ret -; 1705b7 -.DrawBorder: ; 1705b7 +.DrawBorder: hlcoord 0, 4 ld a, "┌" ld [hli], a @@ -786,9 +762,8 @@ Function1704e1: ; 1704e1 dec c jr nz, .right_border_loop ret -; 1705f0 -.PlaceTextItems: ; 1705f0 +.PlaceTextItems: call .ClearBox call .PlaceUpDownArrows ld a, $50 @@ -855,9 +830,8 @@ Function1704e1: ; 1704e1 dec a jr nz, .loop1 ret -; 17064b -.ClearBox: ; 17064b +.ClearBox: hlcoord 1, 5 xor a ld b, 12 @@ -872,9 +846,8 @@ Function1704e1: ; 1704e1 dec b jr nz, .clearbox_row ret -; 17065d -.PlaceUpDownArrows: ; 17065d +.PlaceUpDownArrows: ld a, [wNrOfBeatenBattleTowerTrainers] and a jr z, .nope @@ -890,17 +863,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 +881,9 @@ 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 @@ -950,7 +919,7 @@ BattleTowerAction: ; 170687 ; 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 +935,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 +964,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 +972,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 +980,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 +1005,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 +1019,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 +1028,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 +1037,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 +1051,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 +1092,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 +1102,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 +1113,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 +1156,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 +1170,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 +1184,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 +1199,15 @@ 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 +1215,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 +1234,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 @@ -1293,7 +1261,7 @@ Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d ret -Function170923: ; 170923 +Function170923: ld a, $5 call GetSRAMBank xor a @@ -1304,10 +1272,9 @@ 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 +1340,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 +1355,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 +1381,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 +1417,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 +1478,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 +1493,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 +1501,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 +1515,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 +1524,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 +1544,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] @@ -1646,15 +1607,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 +1625,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..3e6dead8a 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) @@ -92,7 +92,7 @@ endc ret -Function_LoadRandomBattleTowerMon: ; 1f8081 +Function_LoadRandomBattleTowerMon: ld c, BATTLETOWER_PARTY_LENGTH .loop push bc @@ -207,7 +207,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..49b7b1af0 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -1,27 +1,24 @@ -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 ; Excuse me! @@ -29,7 +26,7 @@ CheckForMobileBattleRules: ; 8b1e1 db "@" ; 0x8b201 -_CheckForBattleTowerRules: ; 8b201 +_CheckForBattleTowerRules: ld hl, wStringBuffer2 ld [hl], "3" inc hl @@ -40,27 +37,24 @@ _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 ; Excuse me. You're not ready. @@ -68,11 +62,10 @@ JumpText_ExcuseMeYoureNotReady: ; 0x8b22c db "@" ; 0x8b231 -BattleTower_PleaseReturnWhenReady: ; 8b231 +BattleTower_PleaseReturnWhenReady: ld hl, .PleaseReturnWhenReady call PrintText ret -; 8b238 .PleaseReturnWhenReady: ; 0x8b238 ; Please return when you're ready. @@ -116,7 +109,7 @@ JumpText_YouCantTakeAnEgg: ; 0x8b256 db "@" ; 0x8b25b -BattleTower_ExecuteJumptable: ; 8b25b +BattleTower_ExecuteJumptable: ld bc, 0 .loop call .DoJumptableFunction @@ -126,9 +119,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, b and a ret -; 8b26c -.DoJumptableFunction: ; 8b26c +.DoJumptableFunction: push de push bc call .GetFunctionPointer @@ -137,16 +129,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 +144,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, [de] ld h, a ret -; 8b281 -.GetTextPointers: ; 8b281 +.GetTextPointers: inc de inc de inc de @@ -166,16 +155,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 +173,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 +194,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 +220,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 +276,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 +293,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 +315,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..968bd4366 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,18 @@ 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 +121,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTGreetingM24 dw BTGreetingM25 -.PlayerLost: ; 11f36a +.PlayerLost: dw BTLossM1 dw BTLossM2 dw BTLossM3 @@ -149,7 +148,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTLossM24 dw BTLossM25 -.PlayerWon: ; 11f39c +.PlayerWon: dw BTWinM1 dw BTWinM2 dw BTWinM3 @@ -182,7 +181,7 @@ BTFemaleTrainerTexts: dw .PlayerLost dw .PlayerWon -.Greetings: ; 11f3d4 +.Greetings: dw BTGreetingF1 dw BTGreetingF2 dw BTGreetingF3 @@ -199,7 +198,7 @@ BTFemaleTrainerTexts: dw BTGreetingF14 dw BTGreetingF15 -.PlayerLost: ; 11f3f2 +.PlayerLost: dw BTLossF1 dw BTLossF2 dw BTLossF3 @@ -216,7 +215,7 @@ BTFemaleTrainerTexts: dw BTLossF14 dw BTLossF15 -.PlayerWon: ; 11f410 +.PlayerWon: dw BTWinF1 dw BTWinF2 dw BTWinF3 diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 533ce43ef..637fa0862 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,7 +26,6 @@ BuenasPassword: ; 8af6b ld a, b ld [wScriptVar], a ret -; 8afa9 .MenuHeader: ; 0x8afa9 db MENU_BACKUP_TILES ; flags @@ -44,7 +43,7 @@ BuenasPassword: ; 8af6b dw .PlacePasswordChoices ; 0x8afb4 -.PasswordIndices: ; 8afb8 +.PasswordIndices: db NUM_PASSWORDS_PER_CATEGORY x = 0 rept NUM_PASSWORDS_PER_CATEGORY @@ -53,7 +52,7 @@ x = x + 1 endr db -1 -.PlacePasswordChoices: ; 8afbd +.PlacePasswordChoices: push de ld a, [wBuenasPassword] and $f0 @@ -65,9 +64,8 @@ endr pop hl call PlaceString ret -; 8afd4 -BuenaPrize: ; 8afd4 +BuenaPrize: xor a ld [wMenuScrollPosition], a ld a, $1 @@ -149,7 +147,6 @@ BuenaPrize: ; 8afd4 call JoyWaitAorB call PlayClickSFX ret -; 8b072 .Text_AskWhichPrize: ; 0x8b072 ; Which prize would you like? @@ -186,19 +183,17 @@ BuenaPrize: ; 8afd4 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 +216,24 @@ PrintBlueCardBalance: ; 8b097 lb bc, 1, 2 call PrintNum ret -; 8b0ca .Points_string: db "Points@" -; 8b0d1 BlueCardBalanceMenuHeader: ; 0x8b0d1 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 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,7 +258,6 @@ Buena_PrizeMenu: ; 8b0e2 .cancel xor a ret -; 8b113 .MenuHeader: ; 0x8b113 db MENU_BACKUP_TILES ; flags @@ -286,11 +275,10 @@ Buena_PrizeMenu: ; 8b0e2 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 +286,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 +297,8 @@ endr pop hl call PlaceString ret -; 8b147 -.prizepoints ; 8b147 +.prizepoints ld a, [wMenuSelection] call Buena_getprize inc hl @@ -321,9 +307,8 @@ endr add c ld [de], a ret -; 8b154 -Buena_getprize: ; 8b154 +Buena_getprize: dec a ld hl, BuenaPrizeItems ld b, 0 @@ -331,6 +316,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..fcde2b70a 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 diff --git a/engine/events/bug_contest/contest.asm b/engine/events/bug_contest/contest.asm index c25da1658..e08a434e0 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 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..21380149b 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,12 +86,12 @@ 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 @@ -103,5 +103,5 @@ DisplayAlreadyCaughtText: ; cc0c7 DummyPredef2F: DummyPredef38: -DummyPredef39: ; cc0d5 +DummyPredef39: ret diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index a338e83ec..8a77f6ab7 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,7 +24,6 @@ _BugContestJudging: ; 1369d ld hl, BugContest_FirstPlaceText call PrintText jp BugContest_GetPlayersResult -; 136eb BugContest_FirstPlaceText: ; 0x136eb text_jump ContestJudging_FirstPlaceText @@ -34,7 +33,6 @@ BugContest_FirstPlaceText: ; 0x136eb call WaitSFX ld hl, BugContest_FirstPlaceScoreText ret -; 136fd BugContest_FirstPlaceScoreText: ; 0x136fd ; The winning score was @ points! @@ -51,7 +49,6 @@ BugContest_SecondPlaceText: ; 0x13702 call WaitSFX ld hl, BugContest_SecondPlaceScoreText ret -; 13714 BugContest_SecondPlaceScoreText: ; 0x13714 ; The score was @ points! @@ -68,7 +65,6 @@ BugContest_ThirdPlaceText: ; 0x13719 call WaitSFX ld hl, BugContest_ThirdPlaceScoreText ret -; 1372b BugContest_ThirdPlaceScoreText: ; 0x1372b ; The score was @ points! @@ -76,7 +72,7 @@ BugContest_ThirdPlaceScoreText: ; 0x1372b db "@" ; 0x13730 -LoadContestantName: ; 13730 +LoadContestantName: ; If a = 1, get your name. dec a ; BUG_CONTEST_PLAYER jr z, .player @@ -131,14 +127,12 @@ 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 +146,8 @@ BugContest_GetPlayersResult: ; 13807 .done ret -; 13819 -BugContest_JudgeContestants: ; 13819 +BugContest_JudgeContestants: call ClearContestResults call ComputeAIContestantScores ld hl, wBugContestTempWinnerID @@ -168,9 +161,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 +171,8 @@ ClearContestResults: ; 13833 dec b jr nz, .loop ret -; 1383e -DetermineContestWinners: ; 1383e +DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestFirstPlaceScore ld c, 2 @@ -224,9 +215,8 @@ DetermineContestWinners: ; 1383e .done ret -; 138a0 -CopyTempContestant: ; 138a0 +CopyTempContestant: ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID rept BUG_CONTESTANT_SIZE + -1 @@ -238,9 +228,8 @@ endr inc de ld [hl], a ret -; 138b0 -ComputeAIContestantScores: ; 138b0 +ComputeAIContestantScores: ld e, 0 .loop push de @@ -298,9 +287,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 +371,8 @@ ContestScore: ; 13900 .done ret -; 1397f -.AddContestStat: ; 1397f +.AddContestStat: ld hl, hMultiplicand add [hl] ld [hl], a @@ -393,4 +380,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..6a2dda75d 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,7 +31,6 @@ _CardKey: ; 50779 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507af .CardKeyScript: ; 0x507af closetext 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 70f4f0ef7..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: ; 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..c0f4fcf36 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 @@ -49,9 +49,8 @@ CelebiShrineEvent: ; 4989a call CelebiEvent_SetBattleType ret -; 498f9 -.RestorePlayerSprite_DespawnLeaves: ; 498f9 +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -69,9 +68,8 @@ endr call ByteFill ret -; 49912 -LoadCelebiGFX: ; 49912 +LoadCelebiGFX: farcall ClearSpriteAnims ld de, SpecialCelebiLeafGFX ld hl, vTiles1 @@ -85,9 +83,8 @@ LoadCelebiGFX: ; 49912 ld [wJumptableIndex], a ret -; 49935 -CelebiEvent_CountDown: ; 49935 +CelebiEvent_CountDown: ld hl, wFrameCounter ld a, [hl] and a @@ -101,9 +98,8 @@ CelebiEvent_CountDown: ; 49935 set 7, [hl] ret -; 49944 -CelebiEvent_SpawnLeaf: ; 49944 +CelebiEvent_SpawnLeaf: ; unused ld hl, wcf65 ld a, [hl] @@ -123,19 +119,18 @@ 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] @@ -230,7 +225,7 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) ret -.FreezeCelebiPosition: ; 49b30 (12:5b30) +.FreezeCelebiPosition: pop af ld hl, SPRITEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -239,13 +234,12 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) 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 @@ -304,9 +298,8 @@ GetCelebiSpriteTile: ; 49bae pop hl ret -; 49bed -.AddE: ; 49bed +.AddE: push af ld a, d add e @@ -314,16 +307,14 @@ 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 @@ -339,4 +330,3 @@ CheckCaughtCelebi: ; 49bf9 .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..904a4b698 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,7 +165,6 @@ DayCareAskDepositPokemon: ; 16798 ld a, DAYCARETEXT_REMOVE_MAIL scf ret -; 167f1 .DummyText: ; 0x167f1 ; @@ -177,7 +172,7 @@ DayCareAskDepositPokemon: ; 16798 db "@" ; 0x167f6 -DayCare_DepositPokemonText: ; 167f6 +DayCare_DepositPokemonText: ld a, DAYCARETEXT_DEPOSIT call PrintDayCareText ld a, [wCurPartySpecies] @@ -185,9 +180,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 +226,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 +238,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 +260,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 +272,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,7 +295,6 @@ PrintDayCareText: ; 1689b dw .NotEnoughMoney ; 11 dw .OhFineThen ; 12 dw .ComeAgain ; 13 -; 168d2 .DayCareManIntro: ; 0x168d2 ; I'm the DAY-CARE MAN. Want me to raise a #MON? @@ -427,7 +416,7 @@ PrintDayCareText: ; 1689b db "@" ; 0x16936 -DayCareManOutside: ; 16936 +DayCareManOutside: ld hl, wDayCareMan bit DAYCAREMAN_HAS_EGG_F, [hl] jr nz, .AskGiveEgg @@ -441,7 +430,7 @@ DayCareManOutside: ; 16936 db "@" ; 0x16949 -.AskGiveEgg: ; 16949 +.AskGiveEgg: ld hl, .IntroText call PrintText call YesNoBox @@ -477,7 +466,6 @@ DayCareManOutside: ; 16936 ld a, TRUE ld [wScriptVar], a ret -; 16993 .IntroText: ; 0x16993 ; 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? @@ -509,7 +497,7 @@ DayCareManOutside: ; 16936 db "@" ; 0x169ac -DayCare_GiveEgg: ; 169ac +DayCare_GiveEgg: ld a, [wEggMonLevel] ld [wCurPartyLevel], a ld hl, wPartyCount @@ -580,18 +568,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 +598,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 +773,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..7d8a224ba 100644 --- a/engine/events/dratini.asm +++ b/engine/events/dratini.asm @@ -109,4 +109,3 @@ GiveDratini: ; 0x8b170 .EmptyParty: scf ret -; 8b1e1 diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index bcad170d4..377560071 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,7 +136,6 @@ Elevator_AskWhichFloor: ; 134dd .cancel scf ret -; 1350d Elevator_WhichFloorText: ; 0x1350d ; Which floor? @@ -150,7 +144,7 @@ Elevator_WhichFloorText: ; 0x1350d ; 0x13512 -Elevator_GetCurrentFloorText: ; 13512 +Elevator_GetCurrentFloorText: ld hl, wOptions ld a, [hl] push af @@ -167,14 +161,12 @@ 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,7 +177,6 @@ Elevator_GetCurrentFloorString: ; 1353f pop de call GetFloorString ret -; 13550 Elevator_MenuHeader: ; 0x13550 db MENU_BACKUP_TILES ; flags @@ -202,20 +193,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 +216,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..7c894587c 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 @@ -80,7 +80,6 @@ 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..b8157fe38 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,12 +1,11 @@ -PlayWhirlpoolSound: ; 8c7d4 +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,9 +16,8 @@ BlindingFlash: ; 8c7e1 farcall LoadOW_BGPal7 farcall FadeInPalettes ret -; 8c80a -ShakeHeadbuttTree: ; 8c80a +ShakeHeadbuttTree: farcall ClearSpriteAnims ld de, CutGrassGFX ld hl, vTiles1 @@ -72,13 +70,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,16 +99,14 @@ 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 @@ -136,9 +130,8 @@ OWCutAnimation: ; 8c940 .finish ret -; 8c96d -.LoadCutGFX: ; 8c96d +.LoadCutGFX: callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX ld hl, vTiles1 @@ -149,17 +142,14 @@ OWCutAnimation: ; 8c940 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,17 +160,16 @@ 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 @@ -195,7 +184,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 +201,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,7 +221,7 @@ 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 @@ -250,7 +239,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 +262,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 +283,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 +296,15 @@ 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 @@ -352,9 +337,8 @@ FlyFromAnim: ; 8caed pop af ld [wVramState], a ret -; 8cb33 -FlyToAnim: ; 8cb33 +FlyToAnim: call DelayFrame ld a, [wVramState] push af @@ -392,7 +376,7 @@ FlyToAnim: ; 8cb33 call .RestorePlayerSprite_DespawnLeaves ret -.RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82) +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -410,7 +394,7 @@ endr call ByteFill ret -FlyFunction_InitGFX: ; 8cb9b (23:4b9b) +FlyFunction_InitGFX: callfar ClearSpriteAnims ld de, CutGrassGFX ld hl, vTiles1 tile $00 @@ -429,7 +413,7 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) ld [wJumptableIndex], a ret -FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) +FlyFunction_FrameTimer: call .SpawnLeaf ld hl, wFrameCounter ld a, [hl] @@ -449,7 +433,7 @@ FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) set 7, [hl] ret -.SpawnLeaf: ; 8cbe6 (23:4be6) +.SpawnLeaf: ld hl, wcf65 ld a, [hl] inc [hl] diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 09de8f2b7..ec3e9a727 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. @@ -20,10 +20,9 @@ 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 +89,9 @@ endr ld d, [hl] inc hl ret -; 9245b -GetFishGroupIndex: ; 9245b +GetFishGroupIndex: ; Return the index of fishgroup d in de. push hl @@ -127,7 +125,6 @@ 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..25d1ee77a 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 @@ -23,9 +23,8 @@ LoadFishingGFX: ; b84b3 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/fruit_trees.asm b/engine/events/fruit_trees.asm index 47d7702b4..4e955147a 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,27 @@ 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..803fc8005 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -35,7 +35,7 @@ HallOfFame:: ; 0x8640e ret ; 0x86455 -RedCredits:: ; 86455 +RedCredits:: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -56,9 +56,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 +71,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 +80,8 @@ HallOfFame_PlayMusicDE: ; 864b4 pop de call PlayMusic ret -; 864c3 -AnimateHallOfFame: ; 864c3 +AnimateHallOfFame: xor a ld [wJumptableIndex], a call LoadHOFTeam @@ -120,9 +117,8 @@ AnimateHallOfFame: ; 864c3 ld c, 8 call DelayFrames ret -; 8650c -.DisplayNewHallOfFamer: ; 8650c +.DisplayNewHallOfFamer: call DisplayHOFMon ld de, .String_NewHallOfFamer hlcoord 1, 2 @@ -135,14 +131,12 @@ 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 +221,8 @@ GetHallOfFameParty: ; 8653f ld a, -1 ld [de], a ret -; 865b5 -AnimateHOFMonEntrance: ; 865b5 +AnimateHOFMonEntrance: push hl call ClearBGPalettes farcall ResetDisplayBetweenHallOfFameMons @@ -281,7 +274,6 @@ AnimateHOFMonEntrance: ; 865b5 ld [hSCY], a call HOF_SlideFrontpic ret -; 86635 HOF_SlideBackpic: .backpicloop @@ -292,7 +284,6 @@ HOF_SlideBackpic: ld [hSCX], a call DelayFrame jr .backpicloop -; 86643 HOF_SlideFrontpic: .frontpicloop @@ -304,9 +295,8 @@ HOF_SlideFrontpic: ld [hSCX], a call DelayFrame jr .frontpicloop -; 86650 -_HallOfFamePC: ; 86650 +_HallOfFamePC: call LoadFontsBattleExtra xor a ld [wJumptableIndex], a @@ -415,9 +405,8 @@ _HallOfFamePC: ; 86650 .TimeFamer: db " -Time Famer@" -; 8671c -LoadHOFTeam: ; 8671c +LoadHOFTeam: ld a, [wJumptableIndex] cp NUM_HOF_TEAMS jr nc, .invalid @@ -442,9 +431,8 @@ LoadHOFTeam: ; 8671c .invalid scf ret -; 86748 -DisplayHOFMon: ; 86748 +DisplayHOFMon: xor a ld [hBGMapMode], a ld a, [hli] @@ -529,9 +517,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 +601,7 @@ 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..d261caa3c 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] @@ -106,7 +106,7 @@ ChangeHappiness: ; 71c2 INCLUDE "data/events/happiness_changes.asm" -StepHappiness:: ; 725a +StepHappiness:: ; Raise the party's happiness by 1 point every other step cycle. ld hl, wHappinessStepCount @@ -142,7 +142,7 @@ StepHappiness:: ; 725a 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..9727cdac9 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,7 +25,6 @@ ItemFinder: ; 12580 dec c jr nz, .sfx_loop ret -; 125ad .Script_FoundSomething: ; 0x125ad reloadmappart diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 8fe78f5b6..a40702f9e 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -1,8 +1,7 @@ -Kurt_PrintTextWhichApricorn: ; 88000 +Kurt_PrintTextWhichApricorn: ld hl, .Text call PrintText ret -; 88007 .Text: ; 0x88007 ; Which APRICORN should I use? @@ -10,11 +9,10 @@ Kurt_PrintTextWhichApricorn: ; 88000 db "@" ; 0x8800c -Kurt_PrintTextHowMany: ; 8800c +Kurt_PrintTextHowMany: ld hl, .Text call PrintText ret -; 88013 .Text: ; 0x88013 ; How many should I make? @@ -22,7 +20,7 @@ Kurt_PrintTextHowMany: ; 8800c db "@" ; 0x88018 -SelectApricornForKurt: ; 88018 +SelectApricornForKurt: call LoadStandardMenuHeader ld c, $1 xor a @@ -54,9 +52,8 @@ SelectApricornForKurt: ; 88018 .done call Call_ExitMenu ret -; 88055 -Kurt_SelectApricorn: ; 88055 +Kurt_SelectApricorn: farcall FindApricornsInBag jr c, .nope ld hl, .MenuHeader @@ -81,7 +78,6 @@ Kurt_SelectApricorn: ; 88055 .done ld c, a ret -; 88086 .MenuHeader: ; 0x88086 db MENU_BACKUP_TILES ; flags @@ -101,15 +97,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 +113,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,7 +149,6 @@ Kurt_SelectQuantity: ; 880c2 .done call CloseWindow ret -; 8810d .MenuHeader: ; 0x8810d db MENU_BACKUP_TILES ; flags @@ -164,7 +157,7 @@ Kurt_SelectQuantity: ; 880c2 db -1 ; default option db 0 -.PlaceApricornName: ; 88116 +.PlaceApricornName: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 add hl, de @@ -172,9 +165,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 +175,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 +207,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 +342,8 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 pop bc pop de ret -; 88201 -Kurt_GetAddressOfApricornQuantity: ; 88201 +Kurt_GetAddressOfApricornQuantity: push hl push bc ld hl, wNumItems @@ -368,9 +357,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 +397,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..2dff44fcf 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 @@ -216,7 +216,7 @@ CheckForLuckyNumberWinners: ; 4d87a 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..06f077b62 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,7 +70,6 @@ CheckMagikarpLength: ; fbb32 xor a ; MAGIKARPLENGTH_NOT_MAGIKARP ld [wScriptVar], a ret -; fbba9 .MeasureItText: ; 0xfbba9 ; Let me measure that MAGIKARP. …Hm, it measures @ . @@ -78,19 +77,17 @@ CheckMagikarpLength: ; fbb32 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 +102,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: @@ -283,9 +279,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 +290,8 @@ CalcMagikarpLength: ; fbbfc ld a, c cp e ret -; fbca1 -.BCMinusDE: ; fbca1 +.BCMinusDE: ; bc -= de ld a, c sub e @@ -306,13 +300,12 @@ 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,7 +314,6 @@ MagikarpHouseSign: ; fbcd2 ld hl, .CurrentRecordtext call PrintText ret -; fbce8 .CurrentRecordtext: ; 0xfbce8 ; "CURRENT RECORD" 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..1d8736e54 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,9 @@ 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 @@ -131,25 +126,23 @@ PlaceMapNameSign:: ; b8098 (2e:4098) 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 +158,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) call PlaceString ret -.GetNameLength: ; b8101 (2e:4101) +.GetNameLength: ld c, 0 push hl ld hl, wStringBuffer1 @@ -182,7 +175,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) ret -InitMapSignAttrMap: ; b8115 +InitMapSignAttrMap: ld de, wAttrMap - wTileMap add hl, de inc b @@ -204,9 +197,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 +235,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 +244,8 @@ PlaceMapNameFrame: ; b812f dec c jr nz, .loop ret -; b8164 -.FillTopBottom: ; b8164 +.FillTopBottom: ld c, 5 jr .enterloop @@ -271,4 +261,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..5e78f079e 100644 --- a/engine/events/misc_scripts.asm +++ b/engine/events/misc_scripts.asm @@ -41,7 +41,7 @@ FindItemInBallScript:: ; 0x122ce db "@" ; 0x122f8 -.TryReceiveItem: ; 122f8 +.TryReceiveItem: xor a ld [wScriptVar], a ld a, [wEngineBuffer1] @@ -59,4 +59,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..e02476816 100644 --- a/engine/events/misc_scripts_2.asm +++ b/engine/events/misc_scripts_2.asm @@ -27,7 +27,7 @@ HiddenItemScript:: ; 0x13625 writetext .no_room_text waitbutton -.finish ; 13643 +.finish closetext end @@ -41,7 +41,7 @@ HiddenItemScript:: ; 0x13625 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..0648ae542 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,14 +382,12 @@ 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 ; Do you want to adjust your clock for Daylight Saving Time? @@ -441,13 +426,13 @@ DSTChecks: ; 16439 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 +463,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 +573,8 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 add hl, de pop de ret -; 16613 -.DigitQuantities: ; 16613 +.DigitQuantities: dt 100000 dt 10000 dt 1000 @@ -613,7 +595,6 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 dt 900 dt 90 dt 9 -; 16649 UnknownText_0x16649: ; 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? @@ -711,21 +692,17 @@ UnknownText_0x16694: ; 0x16694 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 db MENU_BACKUP_TILES ; flags diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index de19a3674..d82690940 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,13 @@ MomTriesToBuySomething:: ; fcfec farcall LoadScriptBDE scf ret -; fd00f .Script: ; 0xfd00f callasm .ASMFunction farjump Script_ReceivePhoneCall ; 0xfd017 -.ASMFunction: ; fd017 +.ASMFunction: call MomBuysItem_DeductFunds call Mom_GetScriptPointer ld a, [wWhichMomItemSet] @@ -56,9 +55,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 +113,9 @@ 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 @@ -134,7 +131,7 @@ MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) ret -Mom_GiveItemOrDoll: ; fd0c3 +Mom_GiveItemOrDoll: call GetItemFromMom ld de, 6 ; item type add hl, de @@ -156,10 +153,9 @@ 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,7 +165,6 @@ Mom_GetScriptPointer: ; fd0eb (3f:50eb) ret z ld de, .DollScript ret -; fd0fd (3f:50fd) .ItemScript: ; 0xfd0fd writetext _MomText_HiHowAreYou @@ -188,7 +183,7 @@ Mom_GetScriptPointer: ; fd0eb (3f:50eb) ; 0xfd117 -GetItemFromMom: ; fd117 +GetItemFromMom: ld a, [wWhichMomItemSet] and a jr z, .zero @@ -213,7 +208,6 @@ rept 3 ; multiply hl by 8 endr add hl, de ret -; fd136 INCLUDE "data/items/mom_phone.asm" @@ -257,8 +251,7 @@ _MomText_ItsInRoom: ; 0xfd1ca db 0 ; unused -DummyPredef3A: ; fd1d0 +DummyPredef3A: ret -; fd1d1 ret ; unused diff --git a/engine/events/money.asm b/engine/events/money.asm index 585c85618..c4e20fc3e 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,12 @@ 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 +43,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 +91,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 +126,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 +162,8 @@ AddFunds: ; 16055 pop de pop hl ret -; 1606f -GiveCoins:: ; 1606f +GiveCoins:: ld a, 2 ld de, wCoins call AddFunds @@ -189,14 +183,12 @@ 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 +204,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..1b8e1a169 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -107,7 +107,7 @@ MoveDeletion: 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..a7805b6d0 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 diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index aae070ca2..87d35e8ed 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,7 +177,6 @@ GetNicknameLength: ; fb802 cp MON_NAME_LENGTH - 1 jr nz, .loop ret -; fb80f NameRaterIntroText: ; 0xfb80f ; Hello, hello! I'm the NAME RATER. diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index d3991a28c..26a5559dd 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,7 +270,6 @@ DoNPCTrade: ; fcc63 pop bc pop af ret -; fcdc2 GetTradeAttribute: ; 0xfcdc2 @@ -294,71 +288,63 @@ GetTradeAttribute: ; 0xfcdc2 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 +384,12 @@ 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 +405,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,7 +433,6 @@ TradeTexts: ; fcf53 dw TradeAfterText2 dw TradeAfterText3 dw TradeAfterText4 -; fcf7b ConnectLinkCableText: ; 0xfcf7b diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 3e58c2677..10d7cf9aa 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 @@ -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..b4e95987c 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,7 +107,7 @@ CheckPartyMove: ; c742 scf ret -FieldMoveFailed: ; c779 +FieldMoveFailed: ld hl, .CantUseHere call MenuTextBoxBackup ret @@ -117,7 +117,7 @@ FieldMoveFailed: ; c779 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,13 +149,13 @@ 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 @@ -171,7 +171,7 @@ Text_NothingToCut: ; 0xc7c9 text_jump UnknownText_0x1c05ec db "@" -CheckMapForSomethingToCut: ; c7ce +CheckMapForSomethingToCut: ; Does the collision data of the facing tile permit cutting? call GetFacingTileCoord ld c, a @@ -206,7 +206,7 @@ CheckMapForSomethingToCut: ; c7ce scf ret -Script_CutFromMenu: ; c7fe +Script_CutFromMenu: reloadmappart special UpdateTimePals @@ -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 @@ -280,13 +280,13 @@ CheckOverworldTileArrays: ; c840 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,7 +312,7 @@ OWFlash: ; c8ac ld a, $80 ret -UseFlash: ; c8e0 +UseFlash: ld hl, Script_UseFlash jp QueueScript @@ -337,7 +337,7 @@ UnknownText_0xc8f3: ; 0xc8f3 .BlankText: ; 0xc908 db "@" -SurfFunction: ; c909 +SurfFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -347,13 +347,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 +385,7 @@ SurfFunction: ; c909 ld a, $2 ret -.DoSurf: ; c95f (3:495f) +.DoSurf: call GetSurfType ld [wBuffer2], a call GetPartyNick @@ -394,22 +394,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 +426,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 +459,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 +490,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 +538,7 @@ TrySurfOW:: ; c9e7 xor a ret -AskSurfScript: ; ca2c +AskSurfScript: opentext writetext AskSurfText yesorno @@ -546,11 +546,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 +565,7 @@ FlyFunction: ; ca3b dw .DoFly dw .FailFly -.TryFly: ; ca52 +.TryFly: ; Fly ld de, ENGINE_STORMBADGE call CheckBadge @@ -606,13 +606,13 @@ 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 @@ -632,20 +632,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 +663,7 @@ WaterfallFunction: ; cade ld a, $80 ret -CheckMapCanWaterfall: ; cb07 +CheckMapCanWaterfall: ld a, [wPlayerDirection] and $c cp FACE_UP @@ -694,7 +694,7 @@ Script_UsedWaterfall: ; 0xcb20 iffalse .loop end -.CheckContinueWaterfall: ; cb38 +.CheckContinueWaterfall: xor a ld [wScriptVar], a ld a, [wPlayerStandingTile] @@ -705,7 +705,7 @@ Script_UsedWaterfall: ; 0xcb20 ld [wScriptVar], a ret -.WaterfallStep: ; cb4f +.WaterfallStep: turn_waterfall UP step_end @@ -714,7 +714,7 @@ Script_UsedWaterfall: ; 0xcb20 text_jump UnknownText_0x1c068e db "@" -TryWaterfallOW:: ; cb56 +TryWaterfallOW:: ld d, WATERFALL call CheckPartyMove jr c, .failed @@ -757,12 +757,12 @@ Script_AskWaterfall: ; 0xcb86 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 +776,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 +805,7 @@ dig_incave ld a, $1 ret -.DoDig: ; cbd8 +.DoDig: ld hl, wDigWarpNumber ld de, wNextWarp ld bc, 3 @@ -826,7 +826,7 @@ dig_incave ld a, $81 ret -.FailDig: ; cc06 +.FailDig: ld a, [wBuffer2] cp $2 jr nz, .failescaperope @@ -888,7 +888,7 @@ dig_incave return_dig 32 step_end -TeleportFunction: ; cc61 +TeleportFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -898,12 +898,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,14 +925,14 @@ 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 @@ -965,21 +965,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 @@ -996,17 +996,17 @@ StrengthFunction: ; cce5 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] @@ -1076,7 +1076,7 @@ UnknownText_0xcd73: ; 0xcd73 text_jump UnknownText_0x1c07f4 db "@" -TryStrengthOW: ; cd78 +TryStrengthOW: ld d, STRENGTH call CheckPartyMove jr c, .nope @@ -1104,7 +1104,7 @@ TryStrengthOW: ; cd78 ld [wScriptVar], a ret -WhirlpoolFunction: ; cd9d +WhirlpoolFunction: call FieldMoveJumptableReset .loop ld hl, Jumptable_cdae @@ -1114,12 +1114,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,13 +1136,13 @@ 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 @@ -1152,7 +1152,7 @@ Text_UsedWhirlpool: ; 0xcdd9 text_jump UnknownText_0x1c0816 db "@" -TryWhirlpoolMenu: ; cdde +TryWhirlpoolMenu: call GetFacingTileCoord ld c, a push de @@ -1193,7 +1193,7 @@ Script_UsedWhirlpool: ; 0xce0f closetext end -DisappearWhirlpool: ; ce1d +DisappearWhirlpool: ld hl, wBuffer3 ld a, [hli] ld h, [hl] @@ -1210,7 +1210,7 @@ DisappearWhirlpool: ; ce1d call GetMovementPermissions ret -TryWhirlpoolOW:: ; ce3e +TryWhirlpoolOW:: ld d, WHIRLPOOL call CheckPartyMove jr c, .failed @@ -1251,13 +1251,13 @@ UnknownText_0xce78: ; 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 @@ -1307,7 +1307,7 @@ HeadbuttScript: ; 0xceab closetext end -TryHeadbuttOW:: ; cec9 +TryHeadbuttOW:: ld d, HEADBUTT call CheckPartyMove jr c, .no @@ -1335,13 +1335,13 @@ UnknownText_0xcee6: ; 0xcee6 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 +1358,7 @@ TryRockSmashFromMenu: ; cef4 ld a, $80 ret -GetFacingObject: ; cf0d +GetFacingObject: farcall CheckFacingObject jr nc, .fail @@ -1384,7 +1384,7 @@ RockSmashFromMenuScript: ; 0xcf2e reloadmappart special UpdateTimePals -RockSmashScript: ; cf32 +RockSmashScript: callasm GetPartyNick writetext UnknownText_0xcf58 closetext @@ -1434,7 +1434,7 @@ UnknownText_0xcf77: ; 0xcf77 text_jump UnknownText_0x1c0924 db "@" -HasRockSmash: ; cf7c +HasRockSmash: ld d, ROCK_SMASH call CheckPartyMove jr nc, .yes @@ -1448,7 +1448,7 @@ HasRockSmash: ; cf7c ld [wScriptVar], a ret -FishFunction: ; cf8e +FishFunction: ld a, e push af call FieldMoveJumptableReset @@ -1462,14 +1462,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 +1510,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 +1522,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoBite: ; d002 +.FishNoBite: ld a, $2 ld [wBuffer6], a ld hl, Script_NotEvenANibble @@ -1530,7 +1530,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoFish: ; d010 +.FishNoFish: ld a, $0 ld [wBuffer6], a ld hl, Script_NotEvenANibble2 @@ -1574,7 +1574,7 @@ Script_GotABite: ; 0xd035 reloadmapafterbattle end -.Movement_NotFacingUp: ; d05c +.Movement_NotFacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1582,7 +1582,7 @@ Script_GotABite: ; 0xd035 show_emote step_end -.Movement_FacingUp: ; d062 +.Movement_FacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1591,12 +1591,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 @@ -1619,11 +1619,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 @@ -1647,13 +1647,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 +1704,7 @@ BikeFunction: ; d0b3 ld a, $1 ret -.CheckIfRegistered: ; d119 +.CheckIfRegistered: ld a, [wUsingItemWithSelect] and a ret z @@ -1712,7 +1712,7 @@ BikeFunction: ; d0b3 ld l, e ret -.CheckEnvironment: ; d121 +.CheckEnvironment: call GetMapEnvironment call CheckOutdoorMap jr z, .ok @@ -1791,7 +1791,7 @@ GotOffTheBikeText: ; 0xd181 text_jump UnknownText_0x1c09c7 db "@" -TryCutOW:: ; d186 +TryCutOW:: ld d, CUT call CheckPartyMove jr c, .cant_cut @@ -1824,7 +1824,7 @@ AskCutScript: ; 0xd1a9 closetext end -.CheckMap: ; d1ba +.CheckMap: xor a ld [wScriptVar], a call CheckMapForSomethingToCut 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..2a4177178 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,30 @@ 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 +78,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 +135,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 +145,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 +175,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 +200,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 +247,8 @@ GetCaughtLocation: ; 4f20a ld [wSeerAction], a scf ret -; 4f242 -GetCaughtOT: ; 4f242 +GetCaughtOT: ld a, [wCurPartyMon] ld hl, wPartyMonOT ld bc, NAME_LENGTH @@ -286,15 +269,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 +286,8 @@ PrintSeerText: ; 4f26d ld l, a call PrintText ret -; 4f27c -SeerTexts: ; 4f27c +SeerTexts: dw SeerIntroText dw SeerCantTellText dw SeerMetAtText @@ -316,7 +296,6 @@ SeerTexts: ; 4f27c dw SeerCancelText dw SeerEggText dw SeerLevelOnlyText -; 4f28c SeerIntroText: ; 0x4f28c ; I see all. I know all… Certainly, I know of your #MON! @@ -367,7 +346,7 @@ SeerCancelText: ; 0x4f2af ; 0x4f2b4 -SeerAdvice: ; 4f2b4 +SeerAdvice: ld a, MON_LEVEL call GetPartyParamLocation ld a, [wSeerCaughtLevel] @@ -392,9 +371,8 @@ SeerAdvice: ; 4f2b4 ld l, a call PrintText ret -; 4f2d6 -SeerAdviceTexts: ; 4f2d6 +SeerAdviceTexts: ; level, text dbw 9, SeerAdvice1 dbw 29, SeerAdvice2 @@ -402,7 +380,6 @@ SeerAdviceTexts: ; 4f2d6 dbw 89, SeerAdvice4 dbw 100, SeerAdvice5 dbw 255, SeerAdvice1 -; 4f2e8 SeerAdvice1: ; 0x4f2e8 ; Incidentally… It would be wise to raise your #MON with a little more care. @@ -435,7 +412,7 @@ SeerAdvice5: ; 0x4f2fc ; 0x4f301 -GetCaughtGender: ; 4f301 +GetCaughtGender: ld hl, MON_CAUGHTGENDER add hl, bc @@ -458,4 +435,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 6e33d376c..2d4ee28c5 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 @@ -97,9 +97,8 @@ PCPC_TURN_OFF EQU 4 ret z ld a, 2 ; postgame ret -; 15650 -PC_CheckPartyForPokemon: ; 15650 +PC_CheckPartyForPokemon: ld a, [wPartyCount] and a ret nz @@ -116,16 +115,15 @@ PC_CheckPartyForPokemon: ; 15650 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 @@ -133,61 +131,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 @@ -206,7 +199,6 @@ _PlayersHousePC: ; 156d9 call ClearBGPalettes ld c, $1 ret -; 156ff UnknownText_0x156ff: ; 0x156ff ; turned on the PC. @@ -214,7 +206,7 @@ UnknownText_0x156ff: ; 0x156ff db "@" ; 0x15704 -_PlayersPC: ; 15704 +_PlayersPC: ld a, b ld [wWhichIndexSet], a ld hl, UnknownText_0x157cc @@ -222,9 +214,8 @@ _PlayersPC: ; 15704 call Function15715 call ExitMenu ret -; 15715 -Function15715: ; 15715 +Function15715: xor a ld [wPCItemsCursor], a ld [wPCItemsScrollPosition], a @@ -244,7 +235,6 @@ Function15715: ; 15715 .asm_15732 call ExitMenu ret -; 15736 PlayersPCMenuData: ; 0x15736 db MENU_BACKUP_TILES ; flags @@ -305,7 +295,7 @@ PLAYERSPC_LOG_OFF EQU 6 db PLAYERSPC_LOG_OFF db -1 ; end -PC_DisplayTextWaitMenu: ; 157bb +PC_DisplayTextWaitMenu: ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -314,7 +304,6 @@ PC_DisplayTextWaitMenu: ; 157bb pop af ld [wOptions], a ret -; 157cc UnknownText_0x157cc: ; 0x157cc ; What do you want to do? @@ -651,11 +640,10 @@ PCItemsJoypad: ; 0x15985 dba PlaceMenuItemQuantity dba UpdateItemDescription -PC_DisplayText: ; 15a20 +PC_DisplayText: call MenuTextBox call ExitMenu ret -; 15a27 PokecenterPCText_BootedUpPC: ; 0x15a27 ; turned on the PC. diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index e11c45f9b..b866c4f0d 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 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..524533abc 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,7 +28,6 @@ PhotoStudio: ; 16dc7 .print_text call PrintText ret -; 16e04 .Text_AskWhichMon: ; 0x16e04 ; Which #MON should I photo- graph? diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index f8fa52af3..ed7087e35 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -1,4 +1,4 @@ -_UnownPrinter: ; 16be4 +_UnownPrinter: ld a, [wUnownDex] and a ret z @@ -94,9 +94,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 +126,8 @@ _UnownPrinter: ; 16be4 .return call .UpdateUnownFrontpic ret -; 16cc8 -.UpdateUnownFrontpic: ; 16cc8 +.UpdateUnownFrontpic: ld a, [wJumptableIndex] cp 26 jr z, .vacant @@ -151,7 +149,7 @@ _UnownPrinter: ; 16be4 farcall RotateUnownFrontpic ret -.Load2bppToSRAM: ; 16cff +.Load2bppToSRAM: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -194,7 +192,6 @@ _UnownPrinter: ; 16be4 ld c, 20 call DelayFrames ret -; 16d57 AlphRuinsStampString: db " ALPH RUINS STAMP@" @@ -211,15 +208,13 @@ UnownDexMenuString: 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 +225,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/sacred_ash.asm b/engine/events/sacred_ash.asm index 2cb5e37a1..cf1570ee4 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,7 +45,6 @@ CheckAnyFaintedMon: ; 507fb pop af scf ret -; 50821 SacredAshScript: ; 0x50821 special HealParty diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index 99fcd7924..6ac6eeb08 100644 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -1,6 +1,6 @@ MANIA_OT_ID EQU 00518 -GiveShuckle: ; 7305 +GiveShuckle: ; Adding to the party. xor a @@ -71,7 +71,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 533f59520..65c353d0e 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,53 +38,50 @@ 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 ld b, $2 ; rival @@ -103,42 +97,37 @@ NameRival: ; 0xc29d db "SILVER@" ; 0xc2b9 -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 +139,8 @@ CheckMysteryGift: ; c2f6 ld [wScriptVar], a call CloseSRAM ret -; c309 -GetMysteryGiftItem: ; c309 +GetMysteryGiftItem: ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] @@ -179,7 +167,6 @@ GetMysteryGiftItem: ; c309 xor a ld [wScriptVar], a ret -; c345 .ReceiveItemText: ; 0xc345 ; received item @@ -187,57 +174,51 @@ GetMysteryGiftItem: ; c309 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 +231,8 @@ StartGameCornerGame: ; c39a rst FarCall call ExitAllMenus ret -; c3ae -CheckCoinsAndCoinCase: ; c3ae +CheckCoinsAndCoinCase: ld hl, wCoins ld a, [hli] or [hl] @@ -276,7 +256,6 @@ CheckCoinsAndCoinCase: ; c3ae call PrintText scf ret -; c3d1 .NoCoinsText: ; 0xc3d1 ; You have no coins. @@ -290,13 +269,12 @@ CheckCoinsAndCoinCase: ; c3ae db "@" ; 0xc3db -ClearBGPalettesBufferScreen: ; c3db +ClearBGPalettesBufferScreen: call ClearBGPalettes call BufferScreen ret -; c3e2 -ScriptReturnCarry: ; c3e2 +ScriptReturnCarry: jr c, .carry xor a ld [wScriptVar], a @@ -305,23 +283,20 @@ 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,27 +313,23 @@ 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 ; Check if the Poké Flute channel is playing, and if the player is standing @@ -411,13 +382,12 @@ SnorlaxAwake: ; 0xc43d db -1 -PlayCurMonCry: ; c472 +PlayCurMonCry: ld a, [wCurPartySpecies] jp PlayMonCry -; c478 -GameboyCheck: ; c478 +GameboyCheck: ld a, [hCGB] and a jr nz, .cgb @@ -439,7 +409,7 @@ GameboyCheck: ; c478 ret -FadeOutMusic: ; c48f +FadeOutMusic: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -447,21 +417,18 @@ 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 ld a, BANK(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..320953cf9 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 diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 6e873a7c7..0831f92e0 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -1907,9 +1907,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..7c6df4948 100644 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -1,10 +1,9 @@ -SweetScentFromMenu: ; 506bc +SweetScentFromMenu: ld hl, .SweetScent call QueueScript ld a, $1 ld [wFieldMoveSucceeded], a ret -; 506c8 .SweetScent: ; 0x506c8 reloadmappart @@ -33,7 +32,7 @@ SweetScentNothing: ; 0x506e9 end ; 0x506ef -SweetScentEncounter: ; 506ef +SweetScentEncounter: farcall CanUseSweetScent jr nc, .no_battle ld hl, wStatusFlags2 @@ -60,7 +59,6 @@ SweetScentEncounter: ; 506ef ld [wScriptVar], a ld [wBattleType], a ret -; 50726 UnknownText_0x50726: ; 0x50726 ; used SWEET SCENT! diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm index 6d55004f4..1fdeceb0a 100644 --- a/engine/events/treemons.asm +++ b/engine/events/treemons.asm @@ -1,4 +1,4 @@ -TreeMonEncounter: ; b81ea +TreeMonEncounter: farcall StubbedTrainerRankings_TreeEncounters xor a @@ -25,9 +25,8 @@ TreeMonEncounter: ; b81ea xor a ld [wScriptVar], a ret -; b8219 -RockMonEncounter: ; b8219 +RockMonEncounter: xor a ld [wTempWildMonSpecies], a @@ -54,11 +53,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 +91,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 +120,10 @@ GetTreeMons: ; b82d2 .quit xor a ret -; b82e8 INCLUDE "data/wild/treemons.asm" -GetTreeMon: ; b83e5 +GetTreeMon: push hl call GetTreeScore pop hl @@ -168,9 +164,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 +190,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 +222,8 @@ GetTreeScore: ; b8443 .rare ld a, TREEMON_SCORE_RARE ret -; b8466 -.CoordScore: ; b8466 +.CoordScore: call GetFacingTileCoord ld hl, 0 ld c, e @@ -269,9 +262,8 @@ GetTreeScore: ; b8443 ld a, [hQuotient + 3] ret -; b849d -.OTIDScore: ; b849d +.OTIDScore: ld a, [wPlayerID] ld [hDividend], a ld a, [wPlayerID + 1] @@ -282,4 +274,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..4b4aaaf87 100644 --- a/engine/events/unown_walls.asm +++ b/engine/events/unown_walls.asm @@ -11,7 +11,7 @@ HoOhChamber: ; 0x8addb ret ; 0x8adef -OmanyteChamber: ; 8adef +OmanyteChamber: call GetMapAttributesPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, CHECK_FLAG @@ -51,9 +51,8 @@ OmanyteChamber: ; 8adef .nope ret -; 8ae30 -SpecialAerodactylChamber: ; 8ae30 +SpecialAerodactylChamber: push de push bc @@ -79,9 +78,8 @@ SpecialAerodactylChamber: ; 8ae30 pop bc pop de ret -; 8ae4e -SpecialKabutoChamber: ; 8ae4e +SpecialKabutoChamber: push hl push de @@ -101,9 +99,8 @@ SpecialKabutoChamber: ; 8ae4e pop de pop hl ret -; 8ae68 -DisplayUnownWords: ; 8ae68 +DisplayUnownWords: ld a, [wScriptVar] ld hl, MenuHeaders_UnownWalls and a @@ -151,11 +148,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 +166,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 +178,8 @@ _DisplayUnownWords_FillAttr: ; 8aee9 ld [hl], a pop hl ret -; 8af09 -_DisplayUnownWords_CopyWord: ; 8af09 +_DisplayUnownWords_CopyWord: push hl push de .word_loop @@ -203,9 +197,8 @@ _DisplayUnownWords_CopyWord: ; 8af09 pop de pop hl ret -; 8af1c -.ConvertChar: ; 8af1c +.ConvertChar: push hl ld a, c cp $60 @@ -264,4 +257,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..2eb24487c 100644 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -32,23 +32,21 @@ Script_Whiteout: ; 0x124ce 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 +61,9 @@ HalveMoney: ; 12513 rra ld [hl], a ret -; 12527 -GetWhiteoutSpawn: ; 12527 +GetWhiteoutSpawn: ld a, [wLastSpawnMapGroup] ld d, a ld a, [wLastSpawnMapNumber] @@ -79,4 +76,3 @@ GetWhiteoutSpawn: ; 12527 .yes ld [wDefaultSpawnpoint], a ret -; 1253d |