diff options
Diffstat (limited to 'engine/events')
76 files changed, 1276 insertions, 2006 deletions
diff --git a/engine/events/basement_key.asm b/engine/events/basement_key.asm index 879c86a34..d30149fbe 100644 --- a/engine/events/basement_key.asm +++ b/engine/events/basement_key.asm @@ -1,4 +1,4 @@ -_BasementKey: ; 507b4 +_BasementKey: ; Are we even in the right map to use this? ld a, [wMapGroup] cp GROUP_GOLDENROD_UNDERGROUND @@ -26,9 +26,7 @@ _BasementKey: ; 507b4 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507e1 -.BasementKeyScript: ; 0x507e1 +.BasementKeyScript: closetext farjump BasementDoorScript -; 0x507e6 diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index d75015d5b..534e2c331 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -1,17 +1,15 @@ -BattleTowerRoomMenu: ; 1700b0 +BattleTowerRoomMenu: ; special call InitBattleTowerChallengeRAM farcall _BattleTowerRoomMenu ret -; 1700ba -Function1700ba: ; 1700ba +Function1700ba: call InitBattleTowerChallengeRAM farcall Function11811a ret -; 1700c4 -Function1700c4: ; 1700c4 +Function1700c4: ld a, [rSVBK] push af ld a, $3 @@ -51,16 +49,14 @@ Function1700c4: ; 1700c4 pop af ld [rSVBK], a ret -; 170114 -Function170114: ; 170114 +Function170114: call InitBattleTowerChallengeRAM call .Function170121 farcall Function11805f ret -; 170121 -.Function170121: ; 170121 +.Function170121: ld a, $5 call GetSRAMBank ld hl, $a948 @@ -70,9 +66,8 @@ Function170114: ; 170114 call CloseSRAM call Function170c8b ret -; 170139 -Function170139: ; 170139 +Function170139: ; Convert the 4-digit decimal number at 5:aa41 into binary ld a, $5 call GetSRAMBank @@ -167,9 +162,8 @@ Function170139: ; 170139 call CopyBytes call CloseSRAM ret -; 17020c -.DecToBin: ; 17020c +.DecToBin: ld a, [de] inc de and a @@ -180,29 +174,25 @@ Function170139: ; 170139 dec a jr nz, .digit_loop ret -; 170215 -BattleTowerBattle: ; 170215 +BattleTowerBattle: xor a ld [wBattleTowerBattleEnded], a call _BattleTowerBattle ret -; 17021d -DummySpecial_17021d: ; 17021d +DummySpecial_17021d: ret -; 17021e -InitBattleTowerChallengeRAM: ; 17021e +InitBattleTowerChallengeRAM: xor a ld [wBattleTowerBattleEnded], a ld [wNrOfBeatenBattleTowerTrainers], a ld [wcf65], a ld [wcf66], a ret -; 17022c -_BattleTowerBattle: ; 17022c +_BattleTowerBattle: .loop call .do_dw call DelayFrame @@ -210,9 +200,8 @@ _BattleTowerBattle: ; 17022c cp $1 jr nz, .loop ret -; 17023a -.do_dw ; 17023a +.do_dw ld a, [wBattleTowerBattleEnded] ld e, a ld d, 0 @@ -223,14 +212,12 @@ _BattleTowerBattle: ; 17022c ld h, [hl] ld l, a jp hl -; 170249 -.dw ; 170249 +.dw dw RunBattleTowerTrainer dw SkipBattleTowerTrainer -; 17024d -RunBattleTowerTrainer: ; 17024d +RunBattleTowerTrainer: ld a, [wOptions] push af ld hl, wOptions @@ -277,14 +264,13 @@ RunBattleTowerTrainer: ; 17024d ld [wBattleTowerBattleEnded], a ret - -ReadBTTrainerParty: ; 1702b7 +ReadBTTrainerParty: ; Initialise the BattleTower-Trainer and his mon call CopyBTTrainer_FromBT_OT_TowBT_OTTemp ; Check the nicknames for illegal characters, and replace bad nicknames ; with their species names. - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_1 @@ -294,44 +280,44 @@ ReadBTTrainerParty: ; 1702b7 call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon1Name ; $c643 + ld de, wBT_OTTempMon1Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_1 - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_2 - ld a, [wBT_OTTempMon2] ; [$c64e] + ld a, [wBT_OTTempMon2] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon2Name ; $c67e + ld de, wBT_OTTempMon2Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_2 - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld c, MON_NAME_LENGTH farcall CheckStringForErrors jr nc, .skip_mon_3 - ld a, [wBT_OTTempMon3] ; [$c689] + ld a, [wBT_OTTempMon3] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld l, e ld h, d - ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9 + ld de, wBT_OTTempMon3Name ld bc, MON_NAME_LENGTH call CopyBytes .skip_mon_3 ; Add the terminator character to each of these names ld a, "@" - ld [wBT_OTTempMon1NameEnd - 1], a ; $c64d - ld [wBT_OTTempMon2NameEnd - 1], a ; $c688 - ld [wBT_OTTempMon3NameEnd - 1], a ; $c68a + 57 = $c6c3 + ld [wBT_OTTempMon1NameEnd - 1], a + ld [wBT_OTTempMon2NameEnd - 1], a + ld [wBT_OTTempMon3NameEnd - 1], a ; Fix errors in the movesets call CheckBTMonMovesForErrors ; Repair the trainer name if needed, then copy it to wOTPlayerName @@ -343,7 +329,7 @@ ReadBTTrainerParty: ; 1702b7 jr .done_trainer_name .trainer_name_okay - ld hl, wBT_OTTempName ; 0xc608 + ld hl, wBT_OTTempName .done_trainer_name ld de, wOTPlayerName @@ -394,9 +380,8 @@ ReadBTTrainerParty: ; 1702b7 ld a, -1 ld [bc], a ret -; 170394 -ValidateBTParty: ; 170394 +ValidateBTParty: ; Check for and fix errors in party data ld hl, wBT_OTTempMon1Species ld d, BATTLETOWER_PARTY_LENGTH @@ -501,13 +486,11 @@ endr dec d jp nz, .pkmn_loop ret -; 170426 -BT_ChrisName: ; 170426 +BT_ChrisName: db "CHRIS@" -; 17042c -Function17042c: ; 17042c +Function17042c: ld hl, w3_d202TrainerData ld a, BATTLETOWER_STREAK_LENGTH .loop @@ -568,12 +551,10 @@ Function17042c: ; 17042c dec a jr nz, .loop ret -; 170470 INCLUDE "data/battle_tower/unknown_levels.asm" - -CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 +CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; copy the BattleTower-Trainer data that lies at 'wBT_OTTrainer' to 'wBT_OTTemp' ld a, [rSVBK] push af @@ -595,11 +576,10 @@ CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 ld hl, sNrOfBeatenBattleTowerTrainers inc [hl] call CloseSRAM -SkipBattleTowerTrainer: ; 1704c9 +SkipBattleTowerTrainer: ret -; 1704ca -Unreferenced_Function1704ca: ; 1704ca +Unreferenced_Function1704ca: ld a, [$be46] cp $7 jr c, .asm_1704d3 @@ -617,18 +597,16 @@ Unreferenced_Function1704ca: ; 1704ca .asm_1704e0 ret -; 1704e1 -Function1704e1: ; 1704e1 +Function1704e1: call SpeechTextBox call FadeToMenu call InitBattleTowerChallengeRAM call .JumptableLoop call CloseSubmenu ret -; 1704f1 -.JumptableLoop: ; 1704f1 +.JumptableLoop: call ClearBGPalettes call ClearSprites call ClearScreen @@ -643,9 +621,8 @@ Function1704e1: ; 1704e1 .done ret -; 170510 -.DoJumptable: ; 170510 +.DoJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -656,15 +633,13 @@ Function1704e1: ; 1704e1 ld h, [hl] ld l, a jp hl -; 17051f -.dw ; 17051f +.dw dw .Jumptable_0 dw .Jumptable_1 dw .Jumptable_2 -; 170525 -.Jumptable_0: ; 170525 +.Jumptable_0: ld a, $5 call GetSRAMBank @@ -695,12 +670,10 @@ Function1704e1: ; 1704e1 call .PlaceTextItems jr .NextJumptableFunction - .Jumptable_1: call SetPalettes call .NextJumptableFunction - .Jumptable_2: ld hl, hJoyPressed ld a, [hl] @@ -744,9 +717,8 @@ Function1704e1: ; 1704e1 ld hl, wJumptableIndex inc [hl] ret -; 1705b7 -.DrawBorder: ; 1705b7 +.DrawBorder: hlcoord 0, 4 ld a, "┌" ld [hli], a @@ -786,9 +758,8 @@ Function1704e1: ; 1704e1 dec c jr nz, .right_border_loop ret -; 1705f0 -.PlaceTextItems: ; 1705f0 +.PlaceTextItems: call .ClearBox call .PlaceUpDownArrows ld a, $50 @@ -855,9 +826,8 @@ Function1704e1: ; 1704e1 dec a jr nz, .loop1 ret -; 17064b -.ClearBox: ; 17064b +.ClearBox: hlcoord 1, 5 xor a ld b, 12 @@ -872,9 +842,8 @@ Function1704e1: ; 1704e1 dec b jr nz, .clearbox_row ret -; 17065d -.PlaceUpDownArrows: ; 17065d +.PlaceUpDownArrows: ld a, [wNrOfBeatenBattleTowerTrainers] and a jr z, .nope @@ -890,17 +859,14 @@ Function1704e1: ; 1704e1 ld a, "▼" ld [hl], a ret -; 170676 -.String_Mail: ; 170676 +.String_Mail: db "ルーム@" -; 17067a -.String_PastReaders: ; 17067a +.String_PastReaders: db "れきだいりーダーいちらん@" -; 170687 -BattleTowerAction: ; 170687 +BattleTowerAction: ld a, [wScriptVar] ld e, a ld d, 0 @@ -911,10 +877,8 @@ BattleTowerAction: ; 170687 ld h, [hl] ld l, a jp hl -; 170696 - -.dw ; 170696 (5c:4696) +.dw dw BattleTowerAction_CheckExplanationRead ; 0x00 dw BattleTowerAction_SetExplanationRead ; 0x01 dw BattleTowerAction_GetChallengeState ; 0x02 @@ -948,9 +912,8 @@ BattleTowerAction: ; 170687 dw BattleTower_RandomlyChooseReward ; 0x1e dw BattleTower_SaveOptions ; 0x1f - ; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) -ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a +ResetBattleTowerTrainersSRAM: ; BattleTowerAction $1a ld a, BANK(sBTTrainers) call GetSRAMBank @@ -966,7 +929,7 @@ ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a ret -BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b +BattleTower_GiveReward: ; BattleTowerAction $1b ld a, BANK(sBattleTowerReward) call GetSRAMBank @@ -995,7 +958,7 @@ BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b ld [wScriptVar], a ret -Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c +Function17071b: ; BattleTowerAction $1c ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, BATTLETOWER_WON_CHALLENGE @@ -1003,7 +966,7 @@ Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c call CloseSRAM ret -Function170729: ; 170729 (5c:4729) BattleTowerAction $1d +Function170729: ; BattleTowerAction $1d ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, BATTLETOWER_RECEIVED_REWARD @@ -1011,11 +974,11 @@ Function170729: ; 170729 (5c:4729) BattleTowerAction $1d call CloseSRAM ret -BattleTower_SaveOptions: ; 170737 (5c:4737) BattleTowerAction $1f +BattleTower_SaveOptions: ; BattleTowerAction $1f farcall SaveOptions ret -BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e +BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e ; Generate a random stat boosting item. .loop call Random @@ -1036,7 +999,7 @@ BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e call CloseSRAM ret -BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 +BattleTowerAction_CheckExplanationRead: ; BattleTowerAction $00 call BattleTower_CheckSaveFileExistsAndIsYours ld a, [wScriptVar] and a @@ -1050,7 +1013,7 @@ BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 call CloseSRAM ret -BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 +BattleTowerAction_GetChallengeState: ; BattleTowerAction $02 ld hl, sBattleTowerChallengeState ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank @@ -1059,7 +1022,7 @@ BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 call CloseSRAM ret -BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01 +BattleTowerAction_SetExplanationRead: ; BattleTowerAction $01 ld a, BANK(sBattleTowerSaveFileFlags) call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] @@ -1068,13 +1031,13 @@ BattleTowerAction_SetExplanationRead: ; 170788 (5c:4788) BattleTowerAction $01 call CloseSRAM ret -BattleTowerAction_SetByteToQuickSaveChallenge: ; 170799 (5c:4799) BattleTowerAction $03 +BattleTowerAction_SetByteToQuickSaveChallenge: ; BattleTowerAction $03 ld c, BATTLETOWER_SAVED_AND_LEFT jr asm_17079f -BattleTowerAction_SetByteToCancelChallenge: ; 17079d (5c:479d) BattleTowerAction $04 +BattleTowerAction_SetByteToCancelChallenge: ; BattleTowerAction $04 ld c, BATTLETOWER_NO_CHALLENGE -asm_17079f: ; 17079f (5c:479f) +asm_17079f: ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, c @@ -1082,7 +1045,7 @@ asm_17079f: ; 17079f (5c:479f) call CloseSRAM ret -Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 +Function1707ac: ; BattleTowerAction $05 ld a, $5 call GetSRAMBank ld a, [$aa8c] @@ -1123,7 +1086,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 ld a, $8 ld [wScriptVar], a -Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 +Function1707f4: ; BattleTowerAction $06 ld a, $5 call GetSRAMBank xor a @@ -1133,7 +1096,7 @@ Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 call CloseSRAM ret -Function170807: ; 170807 (5c:4807) BattleTowerAction $16 +Function170807: ; BattleTowerAction $16 call UpdateTime ld a, $5 call GetSRAMBank @@ -1144,7 +1107,7 @@ Function170807: ; 170807 (5c:4807) BattleTowerAction $16 call CloseSRAM ret -Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 +Function17081d: ; BattleTowerAction $17 xor a ld [wScriptVar], a ld a, $5 @@ -1187,7 +1150,7 @@ Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 call CloseSRAM ret -SaveBattleTowerLevelGroup: ; 170868 (5c:4868) BattleTowerAction $07 +SaveBattleTowerLevelGroup: ; BattleTowerAction $07 ld a, BANK(sBTChoiceOfLevelGroup) call GetSRAMBank ld a, [rSVBK] @@ -1201,7 +1164,7 @@ SaveBattleTowerLevelGroup: ; 170868 (5c:4868) BattleTowerAction $07 call CloseSRAM ret -LoadBattleTowerLevelGroup: ; 170881 (5c:4881) BattleTowerAction $08 ; Load level group choice +LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice ld a, BANK(sBTChoiceOfLevelGroup) call GetSRAMBank ld a, [rSVBK] @@ -1215,7 +1178,7 @@ LoadBattleTowerLevelGroup: ; 170881 (5c:4881) BattleTowerAction $08 ; Load level call CloseSRAM ret -BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 +BattleTower_CheckSaveFileExistsAndIsYours: ; BattleTowerAction $09 ld a, [wSaveFileExists] and a jr z, .nope @@ -1230,16 +1193,14 @@ BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 .nope ld [wScriptVar], a ret -; 1708b1 - -Function1708b1: ; 1708b1 (5c:48b1) BattleTowerAction $0a +Function1708b1: ; BattleTowerAction $0a xor a ld [wMusicFade], a call MaxVolume ret -CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do with GS Ball +CheckMobileEventIndex: ; BattleTowerAction $0b something to do with GS Ball ld a, BANK(sMobileEventIndex) call GetSRAMBank ld a, [sMobileEventIndex] @@ -1247,7 +1208,7 @@ CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do call CloseSRAM ret -Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c +Function1708c8: ; BattleTowerAction $0c call UpdateTime ld a, $5 call GetSRAMBank @@ -1266,7 +1227,7 @@ Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c call CloseSRAM ret -Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d +Function1708f0: ; BattleTowerAction $0d xor a ld [wScriptVar], a call UpdateTime @@ -1292,8 +1253,7 @@ Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d ld [wScriptVar], a ret - -Function170923: ; 170923 +Function170923: ld a, $5 call GetSRAMBank xor a @@ -1304,10 +1264,8 @@ Function170923: ; 170923 call ByteFill call CloseSRAM ret -; 17093c - -BattleTowerAction_EggTicket: ; 17093c (5c:493c) BattleTowerAction $0e +BattleTowerAction_EggTicket: ; BattleTowerAction $0e xor a ld [wScriptVar], a ld a, EGG_TICKET @@ -1373,12 +1331,11 @@ endr dec c jr nz, .loop ret -; 1709a4 (5c:49a4) -String_MysteryJP: ; 1709a4 +String_MysteryJP: db "なぞナゾ@@" ; MYSTERY -Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f +Function1709aa: ; BattleTowerAction $0f ld a, [rSVBK] push af ld a, BANK(w3_d090) @@ -1389,7 +1346,7 @@ Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f ld [rSVBK], a ret -Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 +Function1709bb: ; BattleTowerAction $10 xor a ld [wScriptVar], a ld a, $5 @@ -1415,29 +1372,26 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 ld [$a800], a call CloseSRAM ret -; 1709e7 (5c:49e7) -.jumptable: ; 1709e7 +.jumptable: dw .NoAction dw .NoAction dw .DoAction1 dw .DoAction1 dw .Action4 dw .Action5 -; 1709f3 -.DoAction1: ; 1709f3 +.DoAction1: ld a, $5 call GetSRAMBank ld a, $1 ld [$a800], a call CloseSRAM -.NoAction: ; 170a00 +.NoAction: ret -; 170a01 -.Action4: ; 170a01 +.Action4: ld a, $5 call GetSRAMBank ld hl, $b023 @@ -1454,9 +1408,8 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 ld a, $1 ld [wScriptVar], a ret -; 170a33 -.Action5: ; 170a33 +.Action5: ld a, $0 call GetSRAMBank ld hl, wRTC @@ -1516,15 +1469,14 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 .no_scene_2 ret -; 170a9c -Function170a9c: ; 170a9c (5c:4a9c) BattleTowerAction $11 +Function170a9c: ; BattleTowerAction $11 ld c, FALSE jr asm_170aa2 -Function170aa0: ; 170aa0 (5c:4aa0) BattleTowerAction $12 +Function170aa0: ; BattleTowerAction $12 ld c, TRUE -asm_170aa2: ; 170aa2 (5c:4aa2) +asm_170aa2: ld a, $5 call GetSRAMBank ld a, c @@ -1532,7 +1484,7 @@ asm_170aa2: ; 170aa2 (5c:4aa2) call CloseSRAM ret -Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 +Function170aaf: ; BattleTowerAction $13 ld a, $5 call GetSRAMBank ld a, [$aa8d] @@ -1540,7 +1492,7 @@ Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 call CloseSRAM ret -Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 +Function170abe: ; BattleTowerAction $14 call BattleTower_CheckSaveFileExistsAndIsYours ld a, [wScriptVar] and a @@ -1554,7 +1506,7 @@ Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 call CloseSRAM ret -Function170ad7: ; 170ad7 (5c:4ad7) BattleTowerAction $15 +Function170ad7: ; BattleTowerAction $15 ld a, BANK(sBattleTowerSaveFileFlags) call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] @@ -1563,7 +1515,7 @@ Function170ad7: ; 170ad7 (5c:4ad7) BattleTowerAction $15 call CloseSRAM ret -BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 +BattleTowerAction_LevelCheck: ; BattleTowerAction $18 ld a, $5 call GetSRAMBank ld a, [$b2fb] @@ -1583,7 +1535,7 @@ BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 ld [wScriptVar], a ret -BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 +BattleTowerAction_UbersCheck: ; BattleTowerAction $19 ld a, $5 call GetSRAMBank ld a, [$b2fb] @@ -1603,7 +1555,7 @@ BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 ld [wScriptVar], a ret -LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 +LoadOpponentTrainerAndPokemonWithOTSprite: farcall Function_LoadOpponentTrainerAndPokemons ld a, [rSVBK] push af @@ -1646,15 +1598,13 @@ LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 ld [hUsedSpriteTile], a farcall GetUsedSprite ret -; 170b90 INCLUDE "data/trainers/sprites.asm" -DummySpecial_170bd2: ; 170bd2 +DummySpecial_170bd2: ret -; 170bd3 -CheckForBattleTowerRules: ; 170bd3 +CheckForBattleTowerRules: farcall _CheckForBattleTowerRules jr c, .asm_170bde xor a ; FALSE @@ -1666,4 +1616,3 @@ CheckForBattleTowerRules: ; 170bd3 .asm_170be0 ld [wScriptVar], a ret -; 170be4 diff --git a/engine/events/battle_tower/get_trainer_class.asm b/engine/events/battle_tower/get_trainer_class.asm index 570104a2a..3b94b4d35 100644 --- a/engine/events/battle_tower/get_trainer_class.asm +++ b/engine/events/battle_tower/get_trainer_class.asm @@ -5,7 +5,7 @@ GetMobileOTTrainerClass: ; mobile function ld c, a ret -.GetMobileOTTrainerClass: ; 4e930 +.GetMobileOTTrainerClass: ld a, [hli] xor [hl] ld c, a diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index f3db16293..f9be02b28 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -1,4 +1,4 @@ -Function_LoadOpponentTrainerAndPokemons: ; 1f8000 +Function_LoadOpponentTrainerAndPokemons: ld a, [rSVBK] push af ld a, BANK(wBT_OTTrainer) @@ -91,8 +91,7 @@ endc ret - -Function_LoadRandomBattleTowerMon: ; 1f8081 +Function_LoadRandomBattleTowerMon: ld c, BATTLETOWER_PARTY_LENGTH .loop push bc @@ -105,7 +104,7 @@ Function_LoadRandomBattleTowerMon: ; 1f8081 ld a, [wBTChoiceOfLvlGroup] dec a ld hl, BattleTowerMons - ld bc, BattleTowerMons2 - BattleTowerMons1 + ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group call AddNTimes ld a, [hRandomAdd] @@ -207,7 +206,6 @@ Function_LoadRandomBattleTowerMon: ; 1f8081 ld [sBTMonPrevTrainer3], a call CloseSRAM ret -; 1f814e INCLUDE "data/battle_tower/classes.asm" diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index 7ed51315f..6a2990118 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -1,35 +1,31 @@ -CheckForMobileBattleRules: ; 8b1e1 +CheckForMobileBattleRules: ld de, .PointerTables call BattleTower_ExecuteJumptable ret z call BattleTower_PleaseReturnWhenReady scf ret -; 8b1ed -.PointerTables: ; 8b1ed +.PointerTables: db 2 dw .Functions dw .TextPointers -.Functions: ; 8b1f2 +.Functions: dw BattleTower_CheckPartyLengthIs3 dw BattleTower_CheckPartyHasThreeMonsThatAreNotEggs -; 8b1f6 -.TextPointers: ; 8b1f6 +.TextPointers: dw .ExcuseMeText dw JumpText_NeedAtLeastThreeMon dw JumpText_EggDoesNotQualify -; 8b1fc -.ExcuseMeText: ; 0x8b1fc +.ExcuseMeText: ; Excuse me! text_jump UnknownText_0x1c5937 db "@" -; 0x8b201 -_CheckForBattleTowerRules: ; 8b201 +_CheckForBattleTowerRules: ld hl, wStringBuffer2 ld [hl], "3" inc hl @@ -40,83 +36,71 @@ _CheckForBattleTowerRules: ; 8b201 call BattleTower_PleaseReturnWhenReady scf ret -; 8b215 -.PointerTables: ; 8b215 +.PointerTables: db 4 dw .Functions dw .TextPointers -.Functions: ; 8b21a +.Functions: dw Function_PartyCountEq3 dw Function_PartySpeciesAreUnique dw Function_PartyItemsAreUnique dw Function_HasPartyAnEgg -; 8b222 -.TextPointers: ; 8b222 +.TextPointers: dw JumpText_ExcuseMeYoureNotReady dw JumpText_OnlyThreeMonMayBeEntered dw JumpText_TheMonMustAllBeDifferentKinds dw JumpText_TheMonMustNotHoldTheSameItems dw JumpText_YouCantTakeAnEgg -; 8b22c -JumpText_ExcuseMeYoureNotReady: ; 0x8b22c +JumpText_ExcuseMeYoureNotReady: ; Excuse me. You're not ready. text_jump Text_ExcuseMeYoureNotReady db "@" -; 0x8b231 -BattleTower_PleaseReturnWhenReady: ; 8b231 +BattleTower_PleaseReturnWhenReady: ld hl, .PleaseReturnWhenReady call PrintText ret -; 8b238 -.PleaseReturnWhenReady: ; 0x8b238 +.PleaseReturnWhenReady: ; Please return when you're ready. text_jump UnknownText_0x1c5962 db "@" -; 0x8b23d -JumpText_NeedAtLeastThreeMon: ; 0x8b23d +JumpText_NeedAtLeastThreeMon: ; You need at least three #MON. text_jump UnknownText_0x1c5983 db "@" -; 0x8b242 -JumpText_EggDoesNotQualify: ; 0x8b242 +JumpText_EggDoesNotQualify: ; Sorry, an EGG doesn't qualify. text_jump UnknownText_0x1c59a3 db "@" -; 0x8b247 -JumpText_OnlyThreeMonMayBeEntered: ; 0x8b247 +JumpText_OnlyThreeMonMayBeEntered: ; Only three #MON may be entered. text_jump Text_OnlyThreeMonMayBeEntered db "@" -; 0x8b24c -JumpText_TheMonMustAllBeDifferentKinds: ; 0x8b24c +JumpText_TheMonMustAllBeDifferentKinds: ; The @ #MON must all be different kinds. text_jump Text_TheMonMustAllBeDifferentKinds db "@" -; 0x8b251 -JumpText_TheMonMustNotHoldTheSameItems: ; 0x8b251 +JumpText_TheMonMustNotHoldTheSameItems: ; The @ #MON must not hold the same items. text_jump Text_TheMonMustNotHoldTheSameItems db "@" -; 0x8b256 -JumpText_YouCantTakeAnEgg: ; 0x8b256 +JumpText_YouCantTakeAnEgg: ; You can't take an EGG! text_jump Text_YouCantTakeAnEgg db "@" -; 0x8b25b -BattleTower_ExecuteJumptable: ; 8b25b +BattleTower_ExecuteJumptable: ld bc, 0 .loop call .DoJumptableFunction @@ -126,9 +110,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, b and a ret -; 8b26c -.DoJumptableFunction: ; 8b26c +.DoJumptableFunction: push de push bc call .GetFunctionPointer @@ -137,16 +120,14 @@ BattleTower_ExecuteJumptable: ; 8b25b pop bc pop de ret -; 8b276 -.Next_CheckReachedEnd: ; 8b276 +.Next_CheckReachedEnd: inc c ld a, [de] cp c ret -; 8b27a -.GetFunctionPointer: ; 8b27a +.GetFunctionPointer: inc de ld a, [de] ld l, a @@ -154,9 +135,8 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, [de] ld h, a ret -; 8b281 -.GetTextPointers: ; 8b281 +.GetTextPointers: inc de inc de inc de @@ -166,16 +146,14 @@ BattleTower_ExecuteJumptable: ; 8b25b ld a, [de] ld h, a ret -; 8b28a -.LoadTextPointer: ; 8b28a +.LoadTextPointer: ld a, [hli] ld h, [hl] ld l, a ret -; 8b28e -.PrintFailureText: ; 8b28e +.PrintFailureText: push de push bc ld a, b @@ -186,18 +164,16 @@ BattleTower_ExecuteJumptable: ; 8b25b ld b, $1 pop de ret -; 8b29d -.PrintFirstText: ; 8b29d +.PrintFirstText: push de call .GetTextPointers call .LoadTextPointer call PrintText pop de ret -; 8b2a9 -.PrintNthText: ; 8b2a9 +.PrintNthText: push bc call .GetTextPointers inc hl @@ -209,15 +185,13 @@ BattleTower_ExecuteJumptable: ; 8b25b call PrintText pop bc ret -; 8b2bb -BattleTower_CheckPartyLengthIs3: ; 8b2bb +BattleTower_CheckPartyLengthIs3: ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret -; 8b2c1 -BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 +BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ld hl, wPartyCount ld a, [hli] ld b, $0 @@ -237,23 +211,20 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 ld a, b cp BATTLETOWER_PARTY_LENGTH ret -; 8b2da -Function_PartyCountEq3: ; 8b2da +Function_PartyCountEq3: ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret z scf ret -; 8b2e2 -Function_PartySpeciesAreUnique: ; 8b2e2 +Function_PartySpeciesAreUnique: ld hl, wPartyMon1Species call VerifyUniqueness ret -; 8b2e9 -VerifyUniqueness: ; 8b2e9 +VerifyUniqueness: ld de, wPartyCount ld a, [de] inc de @@ -296,18 +267,16 @@ VerifyUniqueness: ; 8b2e9 pop hl scf ret -; 8b31a -.nextmon ; 8b31a +.nextmon push bc ld bc, PARTYMON_STRUCT_LENGTH add hl, bc inc de pop bc ret -; 8b322 -.isegg ; 8b322 +.isegg push bc ld b, a ld a, [de] @@ -315,15 +284,13 @@ VerifyUniqueness: ; 8b2e9 ld a, b pop bc ret -; 8b32a -Function_PartyItemsAreUnique: ; 8b32a +Function_PartyItemsAreUnique: ld hl, wPartyMon1Item call VerifyUniqueness ret -; 8b331 -Function_HasPartyAnEgg: ; 8b331 +Function_HasPartyAnEgg: ld hl, wPartyCount ld a, [hli] ld c, a @@ -339,4 +306,3 @@ Function_HasPartyAnEgg: ; 8b331 .found scf ret -; 8b342 diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm index c4bcedf64..e2db148b7 100644 --- a/engine/events/battle_tower/trainer_text.asm +++ b/engine/events/battle_tower/trainer_text.asm @@ -1,4 +1,4 @@ -BattleTowerText:: ; 11c000 +BattleTowerText:: ; Print text c for trainer [wBT_OTTrainerClass] ; 1: Intro text ; 2: Player lost @@ -83,19 +83,17 @@ endc ld [rSVBK], a call PlaceHLTextAtBC ret -; 11c05d INCLUDE "mobile/fixed_words.asm" INCLUDE "data/trainers/genders.asm" - -BTMaleTrainerTexts: ; 11f332 +BTMaleTrainerTexts: dw .Greetings dw .PlayerLost dw .PlayerWon -.Greetings: ; 11f338 +.Greetings: dw BTGreetingM1 dw BTGreetingM2 dw BTGreetingM3 @@ -122,7 +120,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTGreetingM24 dw BTGreetingM25 -.PlayerLost: ; 11f36a +.PlayerLost: dw BTLossM1 dw BTLossM2 dw BTLossM3 @@ -149,7 +147,7 @@ BTMaleTrainerTexts: ; 11f332 dw BTLossM24 dw BTLossM25 -.PlayerWon: ; 11f39c +.PlayerWon: dw BTWinM1 dw BTWinM2 dw BTWinM3 @@ -176,13 +174,12 @@ BTMaleTrainerTexts: ; 11f332 dw BTWinM24 dw BTWinM25 - BTFemaleTrainerTexts: dw .Greetings dw .PlayerLost dw .PlayerWon -.Greetings: ; 11f3d4 +.Greetings: dw BTGreetingF1 dw BTGreetingF2 dw BTGreetingF3 @@ -199,7 +196,7 @@ BTFemaleTrainerTexts: dw BTGreetingF14 dw BTGreetingF15 -.PlayerLost: ; 11f3f2 +.PlayerLost: dw BTLossF1 dw BTLossF2 dw BTLossF3 @@ -216,7 +213,7 @@ BTFemaleTrainerTexts: dw BTLossF14 dw BTLossF15 -.PlayerWon: ; 11f410 +.PlayerWon: dw BTWinF1 dw BTWinF2 dw BTWinF3 @@ -233,486 +230,482 @@ BTFemaleTrainerTexts: dw BTWinF14 dw BTWinF15 - -BTGreetingM1: ; 0x11f42e +BTGreetingM1: text_jump BattleTowerText_0x1ec000 db "@" -BTLossM1: ; 0x11f433 +BTLossM1: text_jump BattleTowerText_0x1ec03b db "@" -BTWinM1: ; 0x11f438 +BTWinM1: text_jump UnknownText_0x1ec060 db "@" -BTGreetingM2: ; 0x11f43d +BTGreetingM2: text_jump BattleTowerText_0x1ec080 db "@" -BTLossM2: ; 0x11f442 +BTLossM2: text_jump UnknownText_0x1ec0a3 db "@" -BTWinM2: ; 0x11f447 +BTWinM2: text_jump UnknownText_0x1ec0c4 db "@" -BTGreetingM3: ; 0x11f44c +BTGreetingM3: text_jump UnknownText_0x1ec0e1 db "@" -BTLossM3: ; 0x11f451 +BTLossM3: text_jump UnknownText_0x1ec108 db "@" -BTWinM3: ; 0x11f456 +BTWinM3: text_jump UnknownText_0x1ec12a db "@" -BTGreetingM4: ; 0x11f45b +BTGreetingM4: text_jump UnknownText_0x1ec14d db "@" -BTLossM4: ; 0x11f460 +BTLossM4: text_jump UnknownText_0x1ec16f db "@" -BTWinM4: ; 0x11f465 +BTWinM4: text_jump UnknownText_0x1ec190 db "@" -BTGreetingM5: ; 0x11f46a +BTGreetingM5: text_jump UnknownText_0x1ec1ae db "@" -BTLossM5: ; 0x11f46f +BTLossM5: text_jump UnknownText_0x1ec1d0 db "@" -BTWinM5: ; 0x11f474 +BTWinM5: text_jump UnknownText_0x1ec1f4 db "@" -BTGreetingM6: ; 0x11f479 +BTGreetingM6: text_jump UnknownText_0x1ec216 db "@" -BTLossM6: ; 0x11f47e +BTLossM6: text_jump UnknownText_0x1ec238 db "@" -BTWinM6: ; 0x11f483 +BTWinM6: text_jump UnknownText_0x1ec259 db "@" -BTGreetingM7: ; 0x11f488 +BTGreetingM7: text_jump UnknownText_0x1ec27b db "@" -BTLossM7: ; 0x11f48d +BTLossM7: text_jump UnknownText_0x1ec2a0 db "@" -BTWinM7: ; 0x11f492 +BTWinM7: text_jump UnknownText_0x1ec2c0 db "@" -BTGreetingM8: ; 0x11f497 +BTGreetingM8: text_jump UnknownText_0x1ec2d9 db "@" -BTLossM8: ; 0x11f49c +BTLossM8: text_jump UnknownText_0x1ec2fe db "@" -BTWinM8: ; 0x11f4a1 +BTWinM8: text_jump UnknownText_0x1ec320 db "@" -BTGreetingM9: ; 0x11f4a6 +BTGreetingM9: text_jump UnknownText_0x1ec33f db "@" -BTLossM9: ; 0x11f4ab +BTLossM9: text_jump UnknownText_0x1ec36c db "@" -BTWinM9: ; 0x11f4b0 +BTWinM9: text_jump UnknownText_0x1ec389 db "@" -BTGreetingM10: ; 0x11f4b5 +BTGreetingM10: text_jump UnknownText_0x1ec3ad db "@" -BTLossM10: ; 0x11f4ba +BTLossM10: text_jump UnknownText_0x1ec3c5 db "@" -BTWinM10: ; 0x11f4bf +BTWinM10: text_jump UnknownText_0x1ec3e5 db "@" -BTGreetingM11: ; 0x11f4c4 +BTGreetingM11: text_jump UnknownText_0x1ec402 db "@" -BTLossM11: ; 0x11f4c9 +BTLossM11: text_jump UnknownText_0x1ec411 db "@" -BTWinM11: ; 0x11f4ce +BTWinM11: text_jump UnknownText_0x1ec41f db "@" -BTGreetingM12: ; 0x11f4d3 +BTGreetingM12: text_jump UnknownText_0x1ec42e db "@" -BTLossM12: ; 0x11f4d8 +BTLossM12: text_jump UnknownText_0x1ec461 db "@" -BTWinM12: ; 0x11f4dd +BTWinM12: text_jump UnknownText_0x1ec4a0 db "@" -BTGreetingM13: ; 0x11f4e2 +BTGreetingM13: text_jump UnknownText_0x1ec4d6 db "@" -BTLossM13: ; 0x11f4e7 +BTLossM13: text_jump UnknownText_0x1ec4f5 db "@" -BTWinM13: ; 0x11f4ec +BTWinM13: text_jump UnknownText_0x1ec512 db "@" -BTGreetingM14: ; 0x11f4f1 +BTGreetingM14: text_jump UnknownText_0x1ec532 db "@" -BTLossM14: ; 0x11f4f6 +BTLossM14: text_jump UnknownText_0x1ec54b db "@" -BTWinM14: ; 0x11f4fb +BTWinM14: text_jump UnknownText_0x1ec565 db "@" -BTGreetingM15: ; 0x11f500 +BTGreetingM15: text_jump UnknownText_0x1ec580 db "@" -BTLossM15: ; 0x11f505 +BTLossM15: text_jump UnknownText_0x1ec59d db "@" -BTWinM15: ; 0x11f50a +BTWinM15: text_jump UnknownText_0x1ec5b5 db "@" -BTGreetingM16: ; 0x11f50f +BTGreetingM16: text_jump UnknownText_0x1ec5d3 db "@" -BTLossM16: ; 0x11f514 +BTLossM16: text_jump UnknownText_0x1ec5ee db "@" -BTWinM16: ; 0x11f519 +BTWinM16: text_jump UnknownText_0x1ec60d db "@" -BTGreetingM17: ; 0x11f51e +BTGreetingM17: text_jump UnknownText_0x1ec631 db "@" -BTLossM17: ; 0x11f523 +BTLossM17: text_jump UnknownText_0x1ec651 db "@" -BTWinM17: ; 0x11f528 +BTWinM17: text_jump UnknownText_0x1ec68f db "@" -BTGreetingM18: ; 0x11f52d +BTGreetingM18: text_jump UnknownText_0x1ec6b1 db "@" -BTLossM18: ; 0x11f532 +BTLossM18: text_jump UnknownText_0x1ec6d0 db "@" -BTWinM18: ; 0x11f537 +BTWinM18: text_jump UnknownText_0x1ec708 db "@" -BTGreetingM19: ; 0x11f53c +BTGreetingM19: text_jump UnknownText_0x1ec720 db "@" -BTLossM19: ; 0x11f541 +BTLossM19: text_jump UnknownText_0x1ec73e db "@" -BTWinM19: ; 0x11f546 +BTWinM19: text_jump UnknownText_0x1ec75b db "@" -BTGreetingM20: ; 0x11f54b +BTGreetingM20: text_jump UnknownText_0x1ec77f db "@" -BTLossM20: ; 0x11f550 +BTLossM20: text_jump UnknownText_0x1ec798 db "@" -BTWinM20: ; 0x11f555 +BTWinM20: text_jump UnknownText_0x1ec7bb db "@" -BTGreetingM21: ; 0x11f55a +BTGreetingM21: text_jump UnknownText_0x1ec7d8 db "@" -BTLossM21: ; 0x11f55f +BTLossM21: text_jump UnknownText_0x1ec818 db "@" -BTWinM21: ; 0x11f564 +BTWinM21: text_jump UnknownText_0x1ec837 db "@" -BTGreetingM22: ; 0x11f569 +BTGreetingM22: text_jump UnknownText_0x1ec858 db "@" -BTLossM22: ; 0x11f56e +BTLossM22: text_jump UnknownText_0x1ec876 db "@" -BTWinM22: ; 0x11f573 +BTWinM22: text_jump UnknownText_0x1ec898 db "@" -BTGreetingM23: ; 0x11f578 +BTGreetingM23: text_jump UnknownText_0x1ec8b1 db "@" -BTLossM23: ; 0x11f57d +BTLossM23: text_jump UnknownText_0x1ec8d5 db "@" -BTWinM23: ; 0x11f582 +BTWinM23: text_jump UnknownText_0x1ec8f0 db "@" -BTGreetingM24: ; 0x11f587 +BTGreetingM24: text_jump UnknownText_0x1ec911 db "@" -BTLossM24: ; 0x11f58c +BTLossM24: text_jump UnknownText_0x1ec928 db "@" -BTWinM24: ; 0x11f591 +BTWinM24: text_jump UnknownText_0x1ec949 db "@" -BTGreetingM25: ; 0x11f596 +BTGreetingM25: text_jump UnknownText_0x1ec969 db "@" -BTLossM25: ; 0x11f59b +BTLossM25: text_jump UnknownText_0x1ec986 db "@" -BTWinM25: ; 0x11f5a0 +BTWinM25: text_jump UnknownText_0x1ec99b db "@" - - - -BTGreetingF1: ; 0x11f5a5 +BTGreetingF1: text_jump UnknownText_0x1ec9bd db "@" -BTLossF1: ; 0x11f5aa +BTLossF1: text_jump UnknownText_0x1ec9d9 db "@" -BTWinF1: ; 0x11f5af +BTWinF1: text_jump UnknownText_0x1ec9f7 db "@" -BTGreetingF2: ; 0x11f5b4 +BTGreetingF2: text_jump UnknownText_0x1eca0a db "@" -BTLossF2: ; 0x11f5b9 +BTLossF2: text_jump UnknownText_0x1eca2a db "@" -BTWinF2: ; 0x11f5be +BTWinF2: text_jump UnknownText_0x1eca47 db "@" -BTGreetingF3: ; 0x11f5c3 +BTGreetingF3: text_jump UnknownText_0x1eca64 db "@" -BTLossF3: ; 0x11f5c8 +BTLossF3: text_jump UnknownText_0x1eca82 db "@" -BTWinF3: ; 0x11f5cd +BTWinF3: text_jump UnknownText_0x1eca9d db "@" -BTGreetingF4: ; 0x11f5d2 +BTGreetingF4: text_jump UnknownText_0x1ecabf db "@" -BTLossF4: ; 0x11f5d7 +BTLossF4: text_jump UnknownText_0x1ecade db "@" -BTWinF4: ; 0x11f5dc +BTWinF4: text_jump UnknownText_0x1ecafa db "@" -BTGreetingF5: ; 0x11f5e1 +BTGreetingF5: text_jump UnknownText_0x1ecb19 db "@" -BTLossF5: ; 0x11f5e6 +BTLossF5: text_jump UnknownText_0x1ecb37 db "@" -BTWinF5: ; 0x11f5eb +BTWinF5: text_jump UnknownText_0x1ecb55 db "@" -BTGreetingF6: ; 0x11f5f0 +BTGreetingF6: text_jump UnknownText_0x1ecb70 db "@" -BTLossF6: ; 0x11f5f5 +BTLossF6: text_jump UnknownText_0x1ecb92 db "@" -BTWinF6: ; 0x11f5fa +BTWinF6: text_jump UnknownText_0x1ecbb6 db "@" -BTGreetingF7: ; 0x11f5ff +BTGreetingF7: text_jump UnknownText_0x1ecbd9 db "@" -BTLossF7: ; 0x11f604 +BTLossF7: text_jump UnknownText_0x1ecbf3 db "@" -BTWinF7: ; 0x11f609 +BTWinF7: text_jump UnknownText_0x1ecc15 db "@" -BTGreetingF8: ; 0x11f60e +BTGreetingF8: text_jump UnknownText_0x1ecc39 db "@" -BTLossF8: ; 0x11f613 +BTLossF8: text_jump UnknownText_0x1ecc55 db "@" -BTWinF8: ; 0x11f618 +BTWinF8: text_jump UnknownText_0x1ecc75 db "@" -BTGreetingF9: ; 0x11f61d +BTGreetingF9: text_jump UnknownText_0x1ecc92 db "@" -BTLossF9: ; 0x11f622 +BTLossF9: text_jump UnknownText_0x1ecca7 db "@" -BTWinF9: ; 0x11f627 +BTWinF9: text_jump UnknownText_0x1eccc1 db "@" -BTGreetingF10: ; 0x11f62c +BTGreetingF10: text_jump UnknownText_0x1eccd7 db "@" -BTLossF10: ; 0x11f631 +BTLossF10: text_jump UnknownText_0x1eccef db "@" -BTWinF10: ; 0x11f636 +BTWinF10: text_jump UnknownText_0x1ecd0e db "@" -BTGreetingF11: ; 0x11f63b +BTGreetingF11: text_jump UnknownText_0x1ecd2b db "@" -BTLossF11: ; 0x11f640 +BTLossF11: text_jump UnknownText_0x1ecd4d db "@" -BTWinF11: ; 0x11f645 +BTWinF11: text_jump UnknownText_0x1ecd6b db "@" -BTGreetingF12: ; 0x11f64a +BTGreetingF12: text_jump UnknownText_0x1ecd8d db "@" -BTLossF12: ; 0x11f64f +BTLossF12: text_jump UnknownText_0x1ecdaf db "@" -BTWinF12: ; 0x11f654 +BTWinF12: text_jump UnknownText_0x1ecdcf db "@" -BTGreetingF13: ; 0x11f659 +BTGreetingF13: text_jump UnknownText_0x1ecded db "@" -BTLossF13: ; 0x11f65e +BTLossF13: text_jump UnknownText_0x1ece0d db "@" -BTWinF13: ; 0x11f663 +BTWinF13: text_jump UnknownText_0x1ece2a db "@" -BTGreetingF14: ; 0x11f668 +BTGreetingF14: text_jump UnknownText_0x1ece4b db "@" -BTLossF14: ; 0x11f66d +BTLossF14: text_jump UnknownText_0x1ece70 db "@" -BTWinF14: ; 0x11f672 +BTWinF14: text_jump UnknownText_0x1ece8a db "@" -BTGreetingF15: ; 0x11f677 +BTGreetingF15: text_jump UnknownText_0x1ecea8 db "@" -BTLossF15: ; 0x11f67c +BTLossF15: text_jump UnknownText_0x1ecec9 db "@" -BTWinF15: ; 0x11f681 +BTWinF15: text_jump UnknownText_0x1ecee8 db "@" diff --git a/engine/events/buena.asm b/engine/events/buena.asm index 533ce43ef..c5260760a 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -1,4 +1,4 @@ -BuenasPassword: ; 8af6b +BuenasPassword: xor a ld [wWhichIndexSet], a ld hl, .MenuHeader @@ -26,25 +26,22 @@ BuenasPassword: ; 8af6b ld a, b ld [wScriptVar], a ret -; 8afa9 -.MenuHeader: ; 0x8afa9 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, 7 dw .MenuData db 1 ; default option -; 0x8afb1 db 0 -.MenuData: ; 0x8afb2 +.MenuData: db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags db 0 ; items dw .PasswordIndices dw .PlacePasswordChoices -; 0x8afb4 -.PasswordIndices: ; 8afb8 +.PasswordIndices: db NUM_PASSWORDS_PER_CATEGORY x = 0 rept NUM_PASSWORDS_PER_CATEGORY @@ -53,7 +50,7 @@ x = x + 1 endr db -1 -.PlacePasswordChoices: ; 8afbd +.PlacePasswordChoices: push de ld a, [wBuenasPassword] and $f0 @@ -65,9 +62,8 @@ endr pop hl call PlaceString ret -; 8afd4 -BuenaPrize: ; 8afd4 +BuenaPrize: xor a ld [wMenuScrollPosition], a ld a, $1 @@ -149,56 +145,47 @@ BuenaPrize: ; 8afd4 call JoyWaitAorB call PlayClickSFX ret -; 8b072 -.Text_AskWhichPrize: ; 0x8b072 +.Text_AskWhichPrize: ; Which prize would you like? text_jump UnknownText_0x1c589f db "@" -; 0x8b077 -.Text_IsThatRight: ; 0x8b077 +.Text_IsThatRight: ; ? Is that right? text_jump UnknownText_0x1c58bc db "@" -; 0x8b07c .Text_HereYouGo: ; Here you go! text_jump UnknownText_0x1c58d1 db "@" -; 0x8b081 -.Text_NotEnoughPoints: ; 0x8b081 +.Text_NotEnoughPoints: ; You don't have enough points. text_jump UnknownText_0x1c58e0 db "@" -; 0x8b086 -.Text_NoRoom: ; 0x8b086 +.Text_NoRoom: ; You have no room for it. text_jump UnknownText_0x1c58ff db "@" -; 0x8b08b -.Text_PleaseComeBackAgain: ; 0x8b08b +.Text_PleaseComeBackAgain: ; Oh. Please come back again! text_jump UnknownText_0x1c591a db "@" -; 0x8b090 -Buena_DisplayBlueCardBalance: ; 8b090 +Buena_DisplayBlueCardBalance: ld hl, BlueCardBalanceMenuHeader call LoadMenuHeader ret -; 8b097 -PrintBlueCardBalance: ; 8b097 +PrintBlueCardBalance: ld de, wBlueCardBalance call .DrawBox ret -; 8b09e -.DrawBox: ; 8b09e +.DrawBox: push de xor a ld [hBGMapMode], a @@ -221,29 +208,24 @@ PrintBlueCardBalance: ; 8b097 lb bc, 1, 2 call PrintNum ret -; 8b0ca .Points_string: db "Points@" -; 8b0d1 -BlueCardBalanceMenuHeader: ; 0x8b0d1 +BlueCardBalanceMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 11, 11, 13 -; 8b0d6 -Buena_PlacePrizeMenuBox: ; 8b0d6 +Buena_PlacePrizeMenuBox: ld hl, .MenuHeader call LoadMenuHeader ret -; 8b0dd -.MenuHeader ; 0x8b0dd +.MenuHeader db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 17, TEXTBOX_Y - 1 -; 8b0e2 -Buena_PrizeMenu: ; 8b0e2 +Buena_PrizeMenu: ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuSelection] @@ -268,29 +250,26 @@ Buena_PrizeMenu: ; 8b0e2 .cancel xor a ret -; 8b113 -.MenuHeader: ; 0x8b113 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, 16, 9 dw .MenuData db 1 ; default option -; 0x8b11b db 0 -.MenuData: ; 0x8b11c +.MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 13 ; rows, columns db 1 ; spacing dba .indices dba .prizeitem dba .prizepoints -; 8b129 NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2) -.indices ; 8b129 +.indices db NUM_BUENA_PRIZES x = 1 rept NUM_BUENA_PRIZES @@ -298,9 +277,8 @@ rept NUM_BUENA_PRIZES x = x + 1 endr db -1 -; 8b134 -.prizeitem ; 8b134 +.prizeitem ld a, [wMenuSelection] call Buena_getprize ld a, [hl] @@ -310,9 +288,8 @@ endr pop hl call PlaceString ret -; 8b147 -.prizepoints ; 8b147 +.prizepoints ld a, [wMenuSelection] call Buena_getprize inc hl @@ -321,9 +298,8 @@ endr add c ld [de], a ret -; 8b154 -Buena_getprize: ; 8b154 +Buena_getprize: dec a ld hl, BuenaPrizeItems ld b, 0 @@ -331,6 +307,5 @@ Buena_getprize: ; 8b154 add hl, bc add hl, bc ret -; 8b15e INCLUDE "data/items/buena_prizes.asm" diff --git a/engine/events/buena_menu.asm b/engine/events/buena_menu.asm index d55a6c9fa..e498a3ab8 100644 --- a/engine/events/buena_menu.asm +++ b/engine/events/buena_menu.asm @@ -1,4 +1,4 @@ -AskRememberPassword: ; 4ae12 +AskRememberPassword: call .DoMenu ld a, $0 jr c, .okay @@ -8,7 +8,7 @@ AskRememberPassword: ; 4ae12 ld [wScriptVar], a ret -.DoMenu: ; 4ae1f +.DoMenu: lb bc, 14, 7 push bc ld hl, YesNoMenuHeader @@ -42,7 +42,7 @@ AskRememberPassword: ; 4ae12 scf ret -Buena_ExitMenu: ; 4ae5e +Buena_ExitMenu: ld a, [hOAMUpdate] push af call ExitMenu diff --git a/engine/events/bug_contest/caught_mon.asm b/engine/events/bug_contest/caught_mon.asm index 4bad01829..45212ae3e 100644 --- a/engine/events/bug_contest/caught_mon.asm +++ b/engine/events/bug_contest/caught_mon.asm @@ -1,4 +1,4 @@ -BugContest_SetCaughtContestMon: ; e6ce +BugContest_SetCaughtContestMon: ld a, [wContestMon] and a jr z, .firstcatch @@ -18,7 +18,7 @@ BugContest_SetCaughtContestMon: ; e6ce call PrintText ret -.generatestats ; e6fd +.generatestats ld a, [wTempEnemyMonSpecies] ld [wCurSpecies], a ld [wCurPartySpecies], a @@ -32,7 +32,7 @@ BugContest_SetCaughtContestMon: ; e6ce ld hl, wContestMon jp GeneratePartyMonStats -.caughttext ; 0xe71d +.caughttext ; Caught @ ! text_jump UnknownText_0x1c10c0 db "@" diff --git a/engine/events/bug_contest/contest.asm b/engine/events/bug_contest/contest.asm index c25da1658..4cf4f949a 100644 --- a/engine/events/bug_contest/contest.asm +++ b/engine/events/bug_contest/contest.asm @@ -1,4 +1,4 @@ -GiveParkBalls: ; 135db +GiveParkBalls: xor a ld [wContestMon], a ld a, 20 @@ -6,7 +6,7 @@ GiveParkBalls: ; 135db farcall StartBugContestTimer ret -BugCatchingContestBattleScript:: ; 0x135eb +BugCatchingContestBattleScript:: writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST randomwildmon startbattle @@ -15,29 +15,29 @@ BugCatchingContestBattleScript:: ; 0x135eb iffalse BugCatchingContestOutOfBallsScript end -BugCatchingContestOverScript:: ; 0x135f8 +BugCatchingContestOverScript:: playsound SFX_ELEVATOR_END opentext writetext BugCatchingContestText_BeeepTimesUp waitbutton jump BugCatchingContestReturnToGateScript -BugCatchingContestOutOfBallsScript: ; 0x13603 +BugCatchingContestOutOfBallsScript: playsound SFX_ELEVATOR_END opentext writetext BugCatchingContestText_ContestIsOver waitbutton -BugCatchingContestReturnToGateScript: ; 0x1360b +BugCatchingContestReturnToGateScript: closetext jumpstd bugcontestresultswarp -BugCatchingContestText_BeeepTimesUp: ; 0x1360f +BugCatchingContestText_BeeepTimesUp: ; ANNOUNCER: BEEEP! Time's up! text_jump UnknownText_0x1bd2ca db "@" -BugCatchingContestText_ContestIsOver: ; 0x13614 +BugCatchingContestText_ContestIsOver: ; ANNOUNCER: The Contest is over! text_jump UnknownText_0x1bd2e7 db "@" diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 3e3b16b21..9cf70a03e 100644 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -1,4 +1,4 @@ -SelectRandomBugContestContestants: ; 139a8 +SelectRandomBugContestContestants: ; Select five random people to participate in the current contest. ; First we have to make sure that any old data is cleared away. @@ -54,9 +54,8 @@ SelectRandomBugContestContestants: ; 139a8 dec c jr nz, .loop2 ret -; 139ed -CheckBugContestContestantFlag: ; 139ed +CheckBugContestContestantFlag: ; Checks the flag of the Bug Catching Contestant whose index is loaded in a. ; Bug: If a >= NUM_BUG_CONTESTANTS when this is called, @@ -73,11 +72,10 @@ CheckBugContestContestantFlag: ; 139ed ld b, CHECK_FLAG call EventFlagAction ret -; 139fe INCLUDE "data/events/bug_contest_flags.asm" -ContestDropOffMons: ; 13a12 +ContestDropOffMons: ld hl, wPartyMon1HP ld a, [hli] or [hl] @@ -100,9 +98,8 @@ ContestDropOffMons: ; 13a12 ld a, $1 ld [wScriptVar], a ret -; 13a31 -ContestReturnMons: ; 13a31 +ContestReturnMons: ; Restore the species of the second mon. ld hl, wPartySpecies + 1 ld a, [wBugContestSecondPartySpecies] @@ -120,4 +117,3 @@ ContestReturnMons: ; 13a31 ld a, b ld [wPartyCount], a ret -; 13a47 diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 9f6eb50d0..94a5e9511 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -1,4 +1,4 @@ -DisplayCaughtContestMonStats: ; cc000 +DisplayCaughtContestMonStats: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -86,22 +86,22 @@ DisplayCaughtContestMonStats: ; cc000 .This: db " THIS <PKMN> @" -SwitchMonText: ; cc0c2 +SwitchMonText: ; Switch #MON? text_jump UnknownText_0x1c10cf db "@" -DisplayAlreadyCaughtText: ; cc0c7 +DisplayAlreadyCaughtText: call GetPokemonName ld hl, .AlreadyCaughtText jp PrintText -.AlreadyCaughtText: ; 0xcc0d0 +.AlreadyCaughtText: ; You already caught a @ . text_jump UnknownText_0x1c10dd db "@" DummyPredef2F: DummyPredef38: -DummyPredef39: ; cc0d5 +DummyPredef39: ret diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index a338e83ec..d8f9d7657 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -1,4 +1,4 @@ -_BugContestJudging: ; 1369d +_BugContestJudging: call ContestScore farcall StubbedTrainerRankings_BugContestScore call BugContest_JudgeContestants @@ -24,9 +24,8 @@ _BugContestJudging: ; 1369d ld hl, BugContest_FirstPlaceText call PrintText jp BugContest_GetPlayersResult -; 136eb -BugContest_FirstPlaceText: ; 0x136eb +BugContest_FirstPlaceText: text_jump ContestJudging_FirstPlaceText start_asm ld de, SFX_1ST_PLACE @@ -34,15 +33,13 @@ BugContest_FirstPlaceText: ; 0x136eb call WaitSFX ld hl, BugContest_FirstPlaceScoreText ret -; 136fd -BugContest_FirstPlaceScoreText: ; 0x136fd +BugContest_FirstPlaceScoreText: ; The winning score was @ points! text_jump ContestJudging_FirstPlaceScoreText db "@" -; 0x13702 -BugContest_SecondPlaceText: ; 0x13702 +BugContest_SecondPlaceText: ; Placing second was @ , who caught a @ !@ @ text_jump ContestJudging_SecondPlaceText start_asm @@ -51,15 +48,13 @@ BugContest_SecondPlaceText: ; 0x13702 call WaitSFX ld hl, BugContest_SecondPlaceScoreText ret -; 13714 -BugContest_SecondPlaceScoreText: ; 0x13714 +BugContest_SecondPlaceScoreText: ; The score was @ points! text_jump ContestJudging_SecondPlaceScoreText db "@" -; 0x13719 -BugContest_ThirdPlaceText: ; 0x13719 +BugContest_ThirdPlaceText: ; Placing third was @ , who caught a @ !@ @ text_jump ContestJudging_ThirdPlaceText start_asm @@ -68,15 +63,13 @@ BugContest_ThirdPlaceText: ; 0x13719 call WaitSFX ld hl, BugContest_ThirdPlaceScoreText ret -; 1372b -BugContest_ThirdPlaceScoreText: ; 0x1372b +BugContest_ThirdPlaceScoreText: ; The score was @ points! text_jump ContestJudging_ThirdPlaceScoreText db "@" -; 0x13730 -LoadContestantName: ; 13730 +LoadContestantName: ; If a = 1, get your name. dec a ; BUG_CONTEST_PLAYER jr z, .player @@ -131,14 +124,10 @@ LoadContestantName: ; 13730 ld de, wBugContestWinnerName ld bc, NAME_LENGTH jp CopyBytes -; 13783 - INCLUDE "data/events/bug_contest_winners.asm" -; 13807 - -BugContest_GetPlayersResult: ; 13807 +BugContest_GetPlayersResult: ld hl, wBugContestThirdPlaceWinnerID ld de, - BUG_CONTESTANT_SIZE ld b, 3 ; 3rd, 2nd, or 1st @@ -152,9 +141,8 @@ BugContest_GetPlayersResult: ; 13807 .done ret -; 13819 -BugContest_JudgeContestants: ; 13819 +BugContest_JudgeContestants: call ClearContestResults call ComputeAIContestantScores ld hl, wBugContestTempWinnerID @@ -168,9 +156,8 @@ BugContest_JudgeContestants: ; 13819 ld [hl], a call DetermineContestWinners ret -; 13833 -ClearContestResults: ; 13833 +ClearContestResults: ld hl, wBugContestResults ld b, wBugContestWinnersEnd - wBugContestResults xor a @@ -179,9 +166,8 @@ ClearContestResults: ; 13833 dec b jr nz, .loop ret -; 1383e -DetermineContestWinners: ; 1383e +DetermineContestWinners: ld de, wBugContestTempScore ld hl, wBugContestFirstPlaceScore ld c, 2 @@ -224,9 +210,8 @@ DetermineContestWinners: ; 1383e .done ret -; 138a0 -CopyTempContestant: ; 138a0 +CopyTempContestant: ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID rept BUG_CONTESTANT_SIZE + -1 @@ -238,9 +223,8 @@ endr inc de ld [hl], a ret -; 138b0 -ComputeAIContestantScores: ; 138b0 +ComputeAIContestantScores: ld e, 0 .loop push de @@ -298,9 +282,8 @@ ComputeAIContestantScores: ; 138b0 cp NUM_BUG_CONTESTANTS jr nz, .loop ret -; 13900 -ContestScore: ; 13900 +ContestScore: ; Determine the player's score in the Bug Catching Contest. xor a @@ -383,9 +366,8 @@ ContestScore: ; 13900 .done ret -; 1397f -.AddContestStat: ; 1397f +.AddContestStat: ld hl, hMultiplicand add [hl] ld [hl], a @@ -393,4 +375,3 @@ ContestScore: ; 13900 dec hl inc [hl] ret -; 13988 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index f4f36e402..eb013cfa2 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -1,4 +1,4 @@ -_CardKey: ; 50779 +_CardKey: ; Are we even in the right map to use this? ld a, [wMapGroup] cp GROUP_RADIO_TOWER_3F @@ -31,9 +31,7 @@ _CardKey: ; 50779 ld a, FALSE ld [wItemEffectSucceeded], a ret -; 507af -.CardKeyScript: ; 0x507af +.CardKeyScript: closetext farjump CardKeySlotScript -; 0x507b4 diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm index 6ae3b4a3b..898fb826f 100644 --- a/engine/events/catch_tutorial.asm +++ b/engine/events/catch_tutorial.asm @@ -1,4 +1,4 @@ -CatchTutorial:: ; 4e554 +CatchTutorial:: ld a, [wBattleType] dec a ld c, a @@ -11,12 +11,12 @@ CatchTutorial:: ; 4e554 ld l, a jp hl -.dw ; 4e564 (13:6564) +.dw dw .DudeTutorial dw .DudeTutorial dw .DudeTutorial -.DudeTutorial: ; 4e56a (13:656a) +.DudeTutorial: ; Back up your name to your Mom's name. ld hl, wPlayerName ld de, wMomsName @@ -52,7 +52,7 @@ CatchTutorial:: ; 4e554 call CopyBytes ret -.LoadDudeData: ; 4e5b7 (13:65b7) +.LoadDudeData: ld hl, wDudeNumItems ld [hl], 1 inc hl @@ -68,14 +68,14 @@ CatchTutorial:: ; 4e554 ld hl, wDudeNumBalls ld a, 1 ld [hli], a - ld a, POKE_BALL ; 5 + ld a, POKE_BALL ld [hli], a ld [hli], a ld [hl], -1 ret -.Dude: ; 4e5da +.Dude: db "DUDE@" -.AutoInput: ; 4e5df +.AutoInput: db NO_INPUT, $ff ; end diff --git a/engine/events/catch_tutorial_input.asm b/engine/events/catch_tutorial_input.asm index 9d2a03db2..cca2db2d5 100644 --- a/engine/events/catch_tutorial_input.asm +++ b/engine/events/catch_tutorial_input.asm @@ -1,35 +1,35 @@ -_DudeAutoInput_A:: ; 1de28a +_DudeAutoInput_A:: ld hl, DudeAutoInput_A jr _DudeAutoInput -_DudeAutoInput_RightA: ; 1de28f +_DudeAutoInput_RightA: ld hl, DudeAutoInput_RightA jr _DudeAutoInput -_DudeAutoInput_DownA: ; 1de294 +_DudeAutoInput_DownA: ld hl, DudeAutoInput_DownA jr _DudeAutoInput -_DudeAutoInput: ; 1de299 +_DudeAutoInput: ld a, BANK(DudeAutoInputs) call StartAutoInput ret -DudeAutoInputs: +DudeAutoInputs: ; used only for BANK(DudeAutoInputs) -DudeAutoInput_A: ; 1de29f +DudeAutoInput_A: db NO_INPUT, $50 db A_BUTTON, $00 db NO_INPUT, $ff ; end -DudeAutoInput_RightA: ; 1de2a5 +DudeAutoInput_RightA: db NO_INPUT, $08 db D_RIGHT, $00 db NO_INPUT, $08 db A_BUTTON, $00 db NO_INPUT, $ff ; end -DudeAutoInput_DownA: ; 1de2af +DudeAutoInput_DownA: db NO_INPUT, $fe db NO_INPUT, $fe db NO_INPUT, $fe diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index cb5d08d95..a34f3935a 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -1,6 +1,6 @@ SPECIALCELEBIEVENT_CELEBI EQU $84 -CelebiShrineEvent: ; 4989a +CelebiShrineEvent: call DelayFrame ld a, [wVramState] push af @@ -31,7 +31,7 @@ CelebiShrineEvent: ; 4989a call GetCelebiSpriteTile inc d push de - ld a, $90 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call CelebiEvent_CountDown @@ -41,7 +41,6 @@ CelebiShrineEvent: ; 4989a pop bc jr .loop - .done pop af ld [wVramState], a @@ -49,9 +48,7 @@ CelebiShrineEvent: ; 4989a call CelebiEvent_SetBattleType ret -; 498f9 - -.RestorePlayerSprite_DespawnLeaves: ; 498f9 +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -69,9 +66,7 @@ endr call ByteFill ret -; 49912 - -LoadCelebiGFX: ; 49912 +LoadCelebiGFX: farcall ClearSpriteAnims ld de, SpecialCelebiLeafGFX ld hl, vTiles1 @@ -85,9 +80,7 @@ LoadCelebiGFX: ; 49912 ld [wJumptableIndex], a ret -; 49935 - -CelebiEvent_CountDown: ; 49935 +CelebiEvent_CountDown: ld hl, wFrameCounter ld a, [hl] and a @@ -95,15 +88,12 @@ CelebiEvent_CountDown: ; 49935 dec [hl] ret - .done ld hl, wJumptableIndex set 7, [hl] ret -; 49944 - -CelebiEvent_SpawnLeaf: ; 49944 +CelebiEvent_SpawnLeaf: ; unused ld hl, wcf65 ld a, [hl] @@ -123,19 +113,16 @@ CelebiEvent_SpawnLeaf: ; 49944 ld [hl], $80 ret -; 49962 - -SpecialCelebiLeafGFX: ; 49962 +SpecialCelebiLeafGFX: INCBIN "gfx/overworld/cut_grass.2bpp" -SpecialCelebiGFX: ; 499a2 +SpecialCelebiGFX: INCBIN "gfx/overworld/celebi/1.2bpp" INCBIN "gfx/overworld/celebi/2.2bpp" INCBIN "gfx/overworld/celebi/3.2bpp" INCBIN "gfx/overworld/celebi/4.2bpp" - -UpdateCelebiPosition: ; 49aa2 (12:5aa2) +UpdateCelebiPosition: ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] @@ -229,8 +216,7 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) .done ret - -.FreezeCelebiPosition: ; 49b30 (12:5b30) +.FreezeCelebiPosition: pop af ld hl, SPRITEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -238,14 +224,12 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) call ReinitSpriteAnimFrame ret - -CelebiEvent_Cosine: ; 49b3b (12:5b3b) +CelebiEvent_Cosine: ; a = d * cos(a * pi/32) add %010000 ; cos(x) = sin(x + pi/2) calc_sine_wave -; 49bae -GetCelebiSpriteTile: ; 49bae +GetCelebiSpriteTile: push hl push bc push de @@ -267,22 +251,18 @@ GetCelebiSpriteTile: ; 49bae jr c, .done jr .restart - .Frame1: ld a, SPECIALCELEBIEVENT_CELEBI jr .load_tile - .Frame2: ld a, SPECIALCELEBIEVENT_CELEBI + 4 jr .load_tile - .Frame3: ld a, SPECIALCELEBIEVENT_CELEBI + 8 jr .load_tile - .Frame4: ld a, SPECIALCELEBIEVENT_CELEBI + 12 @@ -292,7 +272,6 @@ GetCelebiSpriteTile: ; 49bae ld [hl], a jr .done - .restart pop de ld d, $ff @@ -304,9 +283,7 @@ GetCelebiSpriteTile: ; 49bae pop hl ret -; 49bed - -.AddE: ; 49bed +.AddE: push af ld a, d add e @@ -314,16 +291,12 @@ GetCelebiSpriteTile: ; 49bae pop af ret -; 49bf3 - -CelebiEvent_SetBattleType: ; 49bf3 +CelebiEvent_SetBattleType: ld a, BATTLETYPE_CELEBI ld [wBattleType], a ret -; 49bf9 - -CheckCaughtCelebi: ; 49bf9 +CheckCaughtCelebi: ld a, [wBattleResult] bit BATTLERESULT_CAUGHT_CELEBI, a jr z, .false @@ -331,12 +304,9 @@ CheckCaughtCelebi: ; 49bf9 ld [wScriptVar], a jr .done - .false xor a ; FALSE ld [wScriptVar], a .done ret - -; 49c0c diff --git a/engine/events/checkforhiddenitems.asm b/engine/events/checkforhiddenitems.asm index 7396bd39a..2af9a1a1f 100644 --- a/engine/events/checkforhiddenitems.asm +++ b/engine/events/checkforhiddenitems.asm @@ -1,4 +1,4 @@ -CheckForHiddenItems: ; b8172 +CheckForHiddenItems: ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. call GetMapScriptsBank ld [wBuffer1], a @@ -75,11 +75,9 @@ CheckForHiddenItems: ; b8172 pop hl scf ret -; b81e2 -.GetFarByte: ; b81e2 +.GetFarByte: ld a, [wBuffer1] call GetFarByte inc hl ret -; b81ea diff --git a/engine/events/checksave.asm b/engine/events/checksave.asm index 2280f0e53..1e9d18e71 100644 --- a/engine/events/checksave.asm +++ b/engine/events/checksave.asm @@ -1,4 +1,4 @@ -CheckSave:: ; 4cffe +CheckSave:: ld a, BANK(sCheckValue1) ; BANK(sCheckValue2) call GetSRAMBank ld a, [sCheckValue1] diff --git a/engine/events/checktime.asm b/engine/events/checktime.asm index 4c7d033ff..6e470e883 100644 --- a/engine/events/checktime.asm +++ b/engine/events/checktime.asm @@ -1,4 +1,4 @@ -CheckTime:: ; c000 +CheckTime:: ld a, [wTimeOfDay] ld hl, .TimeOfDayTable ld de, 2 @@ -11,7 +11,7 @@ CheckTime:: ; c000 ld c, a ret -.TimeOfDayTable: ; c012 +.TimeOfDayTable: db MORN_F, MORN db DAY_F, DAY db NITE_F, NITE diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 4b256da28..5904a476d 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -21,7 +21,7 @@ const DAYCARETEXT_OH_FINE const DAYCARETEXT_COME_AGAIN -DayCareMan: ; 166d6 +DayCareMan: ld hl, wDayCareMan bit DAYCAREMAN_HAS_MON_F, [hl] jr nz, .AskWithdrawMon @@ -58,9 +58,8 @@ DayCareMan: ; 166d6 ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret -; 1672a -DayCareLady: ; 1672a +DayCareLady: ld hl, wDayCareLady bit DAYCARELADY_HAS_MON_F, [hl] jr nz, .AskWithdrawMon @@ -98,9 +97,8 @@ DayCareLady: ; 1672a ld a, DAYCARETEXT_COME_AGAIN call PrintDayCareText ret -; 16781 -DayCareLadyIntroText: ; 16781 +DayCareLadyIntroText: bit DAYCARELADY_ACTIVE_F, [hl] jr nz, .okay set DAYCARELADY_ACTIVE_F, [hl] @@ -109,16 +107,14 @@ DayCareLadyIntroText: ; 16781 call PrintDayCareText call YesNoBox ret -; 1678f -DayCareManIntroText: ; 1678f +DayCareManIntroText: set DAYCAREMAN_ACTIVE_F, [hl] call PrintDayCareText call YesNoBox ret -; 16798 -DayCareAskDepositPokemon: ; 16798 +DayCareAskDepositPokemon: ld a, [wPartyCount] cp 2 jr c, .OnlyOneMon @@ -169,15 +165,13 @@ DayCareAskDepositPokemon: ; 16798 ld a, DAYCARETEXT_REMOVE_MAIL scf ret -; 167f1 -.DummyText: ; 0x167f1 +.DummyText: ; text_jump UnknownText_0x1bdaa7 db "@" -; 0x167f6 -DayCare_DepositPokemonText: ; 167f6 +DayCare_DepositPokemonText: ld a, DAYCARETEXT_DEPOSIT call PrintDayCareText ld a, [wCurPartySpecies] @@ -185,9 +179,8 @@ DayCare_DepositPokemonText: ; 167f6 ld a, DAYCARETEXT_COME_BACK_LATER call PrintDayCareText ret -; 16807 -DayCare_AskWithdrawBreedMon: ; 16807 +DayCare_AskWithdrawBreedMon: ld a, [wStringBuffer2 + 1] and a jr nz, .grew_at_least_one_level @@ -232,9 +225,8 @@ DayCare_AskWithdrawBreedMon: ; 16807 ld a, DAYCARETEXT_PARTY_FULL scf ret -; 16850 -DayCare_GetBackMonForMoney: ; 16850 +DayCare_GetBackMonForMoney: ld bc, wStringBuffer2 + 2 ld de, wMoney farcall TakeMoney @@ -245,9 +237,8 @@ DayCare_GetBackMonForMoney: ; 16850 ld a, DAYCARETEXT_GOT_BACK call PrintDayCareText ret -; 1686d -GetPriceToRetrieveBreedmon: ; 1686d +GetPriceToRetrieveBreedmon: ld a, b ld [wStringBuffer2], a ld a, d @@ -268,9 +259,8 @@ GetPriceToRetrieveBreedmon: ; 1686d ld a, l ld [wStringBuffer2 + 4], a ret -; 1689b -PrintDayCareText: ; 1689b +PrintDayCareText: ld e, a ld d, 0 ld hl, .TextTable @@ -281,9 +271,8 @@ PrintDayCareText: ; 1689b ld l, a call PrintText ret -; 168aa -.TextTable: ; 168aa +.TextTable: ; entries correspond to DAYCARETEXT_* constants dw .DayCareManIntro ; 00 dw .DayCareManOddEgg ; 01 @@ -305,129 +294,108 @@ PrintDayCareText: ; 1689b dw .NotEnoughMoney ; 11 dw .OhFineThen ; 12 dw .ComeAgain ; 13 -; 168d2 -.DayCareManIntro: ; 0x168d2 +.DayCareManIntro: ; I'm the DAY-CARE MAN. Want me to raise a #MON? text_jump UnknownText_0x1bdaa9 db "@" -; 0x168d7 -.DayCareManOddEgg: ; 0x168d7 +.DayCareManOddEgg: ; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON? text_jump UnknownText_0x1bdad8 db "@" -; 0x168dc -.DayCareLadyIntro: ; 0x168dc +.DayCareLadyIntro: ; I'm the DAY-CARE LADY. Should I raise a #MON for you? text_jump UnknownText_0x1bdb85 db "@" -; 0x168e1 -.DayCareLadyOddEgg: ; 0x168e1 +.DayCareLadyOddEgg: ; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you? text_jump UnknownText_0x1bdbbb db "@" -; 0x168e6 -.WhichOne: ; 0x168e6 +.WhichOne: ; What should I raise for you? text_jump UnknownText_0x1bdc79 db "@" -; 0x168eb -.JustOneMon: ; 0x168eb +.JustOneMon: ; Oh? But you have just one #MON. text_jump UnknownText_0x1bdc97 db "@" -; 0x168f0 -.CantAcceptEgg: ; 0x168f0 +.CantAcceptEgg: ; Sorry, but I can't accept an EGG. text_jump UnknownText_0x1bdcb8 db "@" -; 0x168f5 -.RemoveMail: ; 0x168f5 +.RemoveMail: ; Remove MAIL before you come see me. text_jump UnknownText_0x1bdcda db "@" -; 0x168fa -.LastHealthyMon: ; 0x168fa +.LastHealthyMon: ; If you give me that, what will you battle with? text_jump UnknownText_0x1bdcff db "@" -; 0x168ff -.OkayIllRaiseYourMon: ; 0x168ff +.OkayIllRaiseYourMon: ; OK. I'll raise your @ . text_jump UnknownText_0x1bdd30 db "@" -; 0x16904 -.ComeBackForItLater: ; 0x16904 +.ComeBackForItLater: ; Come back for it later. text_jump UnknownText_0x1bdd4b db "@" -; 0x16909 -.AreWeGeniusesOrWhat: ; 0x16909 +.AreWeGeniusesOrWhat: ; Are we geniuses or what? Want to see your @ ? text_jump UnknownText_0x1bdd64 db "@" -; 0x1690e -.AskRetrieveMon: ; 0x1690e +.AskRetrieveMon: ; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ . text_jump UnknownText_0x1bdd96 db "@" -; 0x16913 -.PerfectHeresYourMon: ; 0x16913 +.PerfectHeresYourMon: ; Perfect! Here's your #MON. text_jump UnknownText_0x1bde04 db "@" -; 0x16918 -.GotBackMon: ; 0x16918 +.GotBackMon: ; got back @ . text_jump UnknownText_0x1bde1f db "@" -; 0x1691d -.ImmediatelyWithdrawMon: ; 0x1691d +.ImmediatelyWithdrawMon: ; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100. text_jump UnknownText_0x1bde32 db "@" -; 0x16922 -.PartyFull: ; 0x16922 +.PartyFull: ; You have no room for it. text_jump UnknownText_0x1bdea2 db "@" -; 0x16927 -.NotEnoughMoney: ; 0x16927 +.NotEnoughMoney: ; You don't have enough money. text_jump UnknownText_0x1bdebc db "@" -; 0x1692c -.OhFineThen: ; 0x1692c +.OhFineThen: ; Oh, fine then. text_jump UnknownText_0x1bded9 db "@" -; 0x16931 -.ComeAgain: ; 0x16931 +.ComeAgain: ; Come again. text_jump UnknownText_0x1bdee9 db "@" -; 0x16936 -DayCareManOutside: ; 16936 +DayCareManOutside: ld hl, wDayCareMan bit DAYCAREMAN_HAS_EGG_F, [hl] jr nz, .AskGiveEgg @@ -435,13 +403,12 @@ DayCareManOutside: ; 16936 call PrintText ret -.NotYet: ; 0x16944 +.NotYet: ; Not yet… text_jump UnknownText_0x1bdef6 db "@" -; 0x16949 -.AskGiveEgg: ; 16949 +.AskGiveEgg: ld hl, .IntroText call PrintText call YesNoBox @@ -477,39 +444,33 @@ DayCareManOutside: ; 16936 ld a, TRUE ld [wScriptVar], a ret -; 16993 -.IntroText: ; 0x16993 +.IntroText: ; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it? text_jump UnknownText_0x1bdf00 db "@" -; 0x16998 -.GotEggText: ; 0x16998 +.GotEggText: ; received the EGG! text_jump UnknownText_0x1bdfa5 db "@" -; 0x1699d -.TakeGoodCareOfItText: ; 0x1699d +.TakeGoodCareOfItText: ; Take good care of it. text_jump UnknownText_0x1bdfba db "@" -; 0x169a2 -.IllKeepItThanksText: ; 0x169a2 +.IllKeepItThanksText: ; Well then, I'll keep it. Thanks! text_jump UnknownText_0x1bdfd1 db "@" -; 0x169a7 -.PartyFullText: ; 0x169a7 +.PartyFullText: ; You have no room in your party. Come back later. text_jump UnknownText_0x1bdff2 db "@" -; 0x169ac -DayCare_GiveEgg: ; 169ac +DayCare_GiveEgg: ld a, [wEggMonLevel] ld [wCurPartyLevel], a ld hl, wPartyCount @@ -580,18 +541,16 @@ DayCare_GiveEgg: ; 169ac .PartyFull: scf ret -; 16a31 -DayCare_GetCurrentPartyMember: ; 16a31 +DayCare_GetCurrentPartyMember: ld a, [wPartyCount] dec a call AddNTimes ld d, h ld e, l ret -; 16a3b -DayCare_InitBreeding: ; 16a3b +DayCare_InitBreeding: ld a, [wDayCareLady] bit DAYCARELADY_HAS_MON_F, a ret z @@ -612,9 +571,8 @@ DayCare_InitBreeding: ; 16a3b jr c, .loop ld [wStepsToEgg], a jp .UselessJump -; 16a66 -.UselessJump: ; 16a66 +.UselessJump: xor a ld hl, wEggMon ld bc, wEggMonEnd - wEggMon @@ -788,8 +746,6 @@ DayCare_InitBreeding: ; 16a3b ld a, [wCurPartyLevel] ld [wEggMonLevel], a ret -; 16be0 -.String_EGG: ; 16be0 +.String_EGG: db "EGG@" -; 16be4 diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 5d0482cc4..aa4755e4f 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -1,10 +1,9 @@ -_Diploma: ; 1dd702 +_Diploma: call PlaceDiplomaOnScreen call WaitPressAorB_BlinkCursor ret -; 1dd709 -PlaceDiplomaOnScreen: ; 1dd709 +PlaceDiplomaOnScreen: call ClearBGPalettes call ClearTileMap call ClearSprites @@ -35,7 +34,6 @@ PlaceDiplomaOnScreen: ; 1dd709 call SetPalettes call DelayFrame ret -; 1dd760 .Player: db "PLAYER@" @@ -50,9 +48,8 @@ PlaceDiplomaOnScreen: ; 1dd709 next "new #DEX." next "Congratulations!" db "@" -; 1dd7ae -PrintDiplomaPage2: ; 1dd7ae +PrintDiplomaPage2: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f @@ -77,17 +74,15 @@ PrintDiplomaPage2: ; 1dd7ae lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 1dd7f0 .PlayTime: db "PLAY TIME@" .GameFreak: db "GAME FREAK@" -; 1dd805 -DiplomaGFX: ; 1dd805 +DiplomaGFX: INCBIN "gfx/diploma/diploma.2bpp.lz" -DiplomaPage1Tilemap: ; 1ddc4b +DiplomaPage1Tilemap: INCBIN "gfx/diploma/page1.tilemap" -DiplomaPage2Tilemap: ; 1dddb3 +DiplomaPage2Tilemap: INCBIN "gfx/diploma/page2.tilemap" diff --git a/engine/events/dratini.asm b/engine/events/dratini.asm index 1019e302e..2dd97eaee 100644 --- a/engine/events/dratini.asm +++ b/engine/events/dratini.asm @@ -1,4 +1,4 @@ -GiveDratini: ; 0x8b170 +GiveDratini: ; if wScriptVar is 0 or 1, change the moveset of the last Dratini in the party. ; 0: give it a special moveset with Extremespeed. ; 1: give it the normal moveset of a level 15 Dratini. @@ -84,7 +84,7 @@ GiveDratini: ; 0x8b170 db TWISTER db 0 -.GetNthPartyMon: ; 0x8b1ce +.GetNthPartyMon: ; inputs: ; hl must be set to 0 before calling this function. ; a must be set to the number of Pokémon in the party. @@ -109,4 +109,3 @@ GiveDratini: ; 0x8b170 .EmptyParty: scf ret -; 8b1e1 diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index bcad170d4..705b24992 100644 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -1,4 +1,4 @@ -Elevator:: ; 1342d +Elevator:: call .LoadPointer call .FindCurrentFloor jr c, .quit @@ -15,9 +15,8 @@ Elevator:: ; 1342d .quit scf ret -; 1344a -.LoadPointer: ; 1344a +.LoadPointer: ld a, b ld [wElevatorPointerBank], a ld a, e @@ -26,9 +25,8 @@ Elevator:: ; 1342d ld [wElevatorPointer + 1], a call .LoadFloors ret -; 1345a -.LoadFloors: ; 1345a +.LoadFloors: ld de, wCurElevator ld bc, 4 ld hl, wElevatorPointer @@ -49,9 +47,8 @@ Elevator:: ; 1342d cp -1 jr nz, .loop ret -; 1347d -.FindCurrentFloor: ; 1347d +.FindCurrentFloor: ld hl, wElevatorPointer ld a, [hli] ld h, [hl] @@ -98,9 +95,8 @@ Elevator:: ; 1342d .fail scf ret -; 134c0 -Elevator_GoToFloor: ; 134c0 +Elevator_GoToFloor: push af ld hl, wElevatorPointer ld a, [hli] @@ -116,9 +112,8 @@ Elevator_GoToFloor: ; 134c0 ld bc, 3 call FarCopyBytes ret -; 134dd -Elevator_AskWhichFloor: ; 134dd +Elevator_AskWhichFloor: call LoadStandardMenuHeader ld hl, Elevator_WhichFloorText call PrintText @@ -141,16 +136,13 @@ Elevator_AskWhichFloor: ; 134dd .cancel scf ret -; 1350d -Elevator_WhichFloorText: ; 0x1350d +Elevator_WhichFloorText: ; Which floor? text_jump UnknownText_0x1bd2bc db "@" -; 0x13512 - -Elevator_GetCurrentFloorText: ; 13512 +Elevator_GetCurrentFloorText: ld hl, wOptions ld a, [hl] push af @@ -167,14 +159,11 @@ Elevator_GetCurrentFloorText: ; 13512 pop af ld [wOptions], a ret -; 13537 -Elevator_CurrentFloorText: ; 13537 +Elevator_CurrentFloorText: db "Now on:@" -; 1353f - -Elevator_GetCurrentFloorString: ; 1353f +Elevator_GetCurrentFloorString: push hl ld a, [wElevatorOriginFloor] ld e, a @@ -185,16 +174,14 @@ Elevator_GetCurrentFloorString: ; 1353f pop de call GetFloorString ret -; 13550 -Elevator_MenuHeader: ; 0x13550 +Elevator_MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 12, 1, 18, 9 dw Elevator_MenuData db 1 ; default option -; 0x13558 -Elevator_MenuData: ; 0x13558 +Elevator_MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 0 ; rows, columns db 1 ; horizontal spacing @@ -202,20 +189,18 @@ Elevator_MenuData: ; 0x13558 dba GetElevatorFloorStrings dba NULL dba NULL -; 13568 -GetElevatorFloorStrings: ; 13568 +GetElevatorFloorStrings: ld a, [wMenuSelection] -GetFloorString: ; 1356b +GetFloorString: push de call FloorToString ld d, h ld e, l pop hl jp PlaceString -; 13575 -FloorToString: ; 13575 +FloorToString: push de ld e, a ld d, 0 @@ -227,6 +212,5 @@ FloorToString: ; 13575 ld l, a pop de ret -; 13583 INCLUDE "data/events/elevator_floors.asm" diff --git a/engine/events/engine_flags.asm b/engine/events/engine_flags.asm index acda9ede7..6c2148f79 100644 --- a/engine/events/engine_flags.asm +++ b/engine/events/engine_flags.asm @@ -1,4 +1,4 @@ -EngineFlagAction:: ; 80430 +EngineFlagAction:: ; Do action b on engine flag de ; ; b = 0: reset flag @@ -7,7 +7,6 @@ EngineFlagAction:: ; 80430 ; ; Setting/resetting does not return a result. - ; 16-bit flag ids are considered invalid, but it's nice ; to know that the infrastructure is there. @@ -80,7 +79,5 @@ EngineFlagAction:: ; 80430 and c ld [de], a ret -; 80462 - INCLUDE "data/engine_flags.asm" diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 2fc30d25c..6adb80ba6 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,12 +1,15 @@ -PlayWhirlpoolSound: ; 8c7d4 +FIELDMOVE_GRASS EQU $80 +FIELDMOVE_TREE EQU $84 +FIELDMOVE_FLY EQU $84 + +PlayWhirlpoolSound: call WaitSFX ld de, SFX_SURF call PlaySFX call WaitSFX ret -; 8c7e1 -BlindingFlash: ; 8c7e1 +BlindingFlash: farcall FadeOutPalettes ld hl, wStatusFlags set STATUSFLAGS_FLASH_F, [hl] @@ -17,16 +20,15 @@ BlindingFlash: ; 8c7e1 farcall LoadOW_BGPal7 farcall FadeInPalettes ret -; 8c80a -ShakeHeadbuttTree: ; 8c80a +ShakeHeadbuttTree: farcall ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, HeadbuttTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing @@ -34,8 +36,8 @@ ShakeHeadbuttTree: ; 8c80a call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 - ld a, 36 * 4 + ld [hl], FIELDMOVE_TREE + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree @@ -50,7 +52,7 @@ ShakeHeadbuttTree: ; 8c80a and a jr z, .done dec [hl] - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call DelayFrame @@ -72,13 +74,11 @@ ShakeHeadbuttTree: ; 8c80a call Get1bpp call ReplaceKrisSprite ret -; 8c893 -HeadbuttTreeGFX: ; 8c893 +HeadbuttTreeGFX: INCBIN "gfx/overworld/headbutt_tree.2bpp" -; 8c913 -HideHeadbuttTree: ; 8c913 +HideHeadbuttTree: xor a ld [hBGMapMode], a ld a, [wPlayerDirection] @@ -103,21 +103,19 @@ HideHeadbuttTree: ; 8c913 xor a ld [hBGMapMode], a ret -; 8c938 -TreeRelativeLocationTable: ; 8c938 +TreeRelativeLocationTable: dwcoord 8, 8 + 2 ; RIGHT dwcoord 8, 8 - 2 ; LEFT dwcoord 8 - 2, 8 ; DOWN dwcoord 8 + 2, 8 ; UP -; 8c940 -OWCutAnimation: ; 8c940 +OWCutAnimation: ; Animation index in e ; 0: Split tree in half ; 1: Mow the lawn ld a, e - and $1 + and 1 ld [wJumptableIndex], a call .LoadCutGFX call WaitSFX @@ -127,7 +125,7 @@ OWCutAnimation: ; 8c940 ld a, [wJumptableIndex] bit 7, a jr nz, .finish - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call OWCutJumptable @@ -136,30 +134,26 @@ OWCutAnimation: ; 8c940 .finish ret -; 8c96d -.LoadCutGFX: ; 8c96d +.LoadCutGFX: callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX - ld hl, vTiles1 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, CutTreeGFX - ld hl, vTiles1 tile $4 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(CutTreeGFX), 4 call Request2bpp ret -; 8c98c -CutTreeGFX: ; c898c +CutTreeGFX: INCBIN "gfx/overworld/cut_tree.2bpp" -; c89cc -CutGrassGFX: ; 8c9cc +CutGrassGFX: INCBIN "gfx/overworld/cut_grass.2bpp" -; 8ca0c -OWCutJumptable: ; 8ca0c +OWCutJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -170,23 +164,20 @@ OWCutJumptable: ; 8ca0c ld h, [hl] ld l, a jp hl -; 8ca1b - -.dw ; 8ca1b (23:4a1b) +.dw dw Cut_SpawnAnimateTree dw Cut_SpawnAnimateLeaves dw Cut_StartWaiting dw Cut_WaitAnimSFX - -Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) +Cut_SpawnAnimateTree: call Cut_Headbutt_GetPixelFacing ld a, SPRITE_ANIM_INDEX_CUT_TREE ; cut tree call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_TREE ld a, 32 ld [wFrameCounter], a ; Cut_StartWaiting @@ -195,7 +186,7 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) inc [hl] ret -Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) +Cut_SpawnAnimateLeaves: call Cut_GetLeafSpawnCoords xor a call Cut_SpawnLeaf @@ -212,14 +203,14 @@ Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) inc [hl] ret -Cut_StartWaiting: ; 8ca5c (23:4a5c) +Cut_StartWaiting: ld a, $1 ld [hBGMapMode], a ; Cut_WaitAnimSFX ld hl, wJumptableIndex inc [hl] -Cut_WaitAnimSFX: ; 8ca64 (23:4a64) +Cut_WaitAnimSFX: ld hl, wFrameCounter ld a, [hl] and a @@ -232,14 +223,14 @@ Cut_WaitAnimSFX: ; 8ca64 (23:4a64) set 7, [hl] ret -Cut_SpawnLeaf: ; 8ca73 (23:4a73) +Cut_SpawnLeaf: push de push af ld a, SPRITE_ANIM_INDEX_LEAF ; leaf call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ld hl, SPRITEANIMSTRUCT_0E add hl, bc ld [hl], $4 @@ -250,7 +241,7 @@ Cut_SpawnLeaf: ; 8ca73 (23:4a73) pop de ret -Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) +Cut_GetLeafSpawnCoords: ld de, 0 ld a, [wMetatileStandingX] bit 0, a @@ -273,9 +264,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) inc hl ld d, [hl] ret -; 8cab3 (23:4ab3) -.Coords: ; 8cab3 +.Coords: dbpixel 11, 12 ; facing down, top left dbpixel 9, 12 ; facing down, top right dbpixel 11, 14 ; facing down, bottom left @@ -295,9 +285,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) dbpixel 13, 12 ; facing right, top right dbpixel 11, 10 ; facing right, bottom left dbpixel 13, 10 ; facing right, bottom right -; 8cad3 -Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) +Cut_Headbutt_GetPixelFacing: ld a, [wPlayerDirection] and %00001100 srl a @@ -309,17 +298,14 @@ Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) inc hl ld d, [hl] ret -; 8cae5 (23:4ae5) -.Coords: ; 8cae5 +.Coords: dbpixel 10, 13 dbpixel 10, 9 dbpixel 8, 11 dbpixel 12, 11 -; 8caed - -FlyFromAnim: ; 8caed +FlyFromAnim: call DelayFrame ld a, [wVramState] push af @@ -331,7 +317,7 @@ FlyFromAnim: ; 8caed call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM @@ -341,7 +327,7 @@ FlyFromAnim: ; 8caed ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -352,9 +338,8 @@ FlyFromAnim: ; 8caed pop af ld [wVramState], a ret -; 8cb33 -FlyToAnim: ; 8cb33 +FlyToAnim: call DelayFrame ld a, [wVramState] push af @@ -366,7 +351,7 @@ FlyToAnim: ; 8cb33 call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_TO @@ -379,7 +364,7 @@ FlyToAnim: ; 8cb33 ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -392,7 +377,7 @@ FlyToAnim: ; 8cb33 call .RestorePlayerSprite_DespawnLeaves ret -.RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82) +.RestorePlayerSprite_DespawnLeaves: ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 @@ -410,10 +395,10 @@ endr call ByteFill ret -FlyFunction_InitGFX: ; 8cb9b (23:4b9b) +FlyFunction_InitGFX: callfar ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld a, [wCurPartyMon] @@ -423,13 +408,13 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) add hl, de ld a, [hl] ld [wd265], a - ld e, $84 + ld e, FIELDMOVE_FLY farcall FlyFunction_GetMonIcon xor a ld [wJumptableIndex], a ret -FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) +FlyFunction_FrameTimer: call .SpawnLeaf ld hl, wFrameCounter ld a, [hl] @@ -449,7 +434,7 @@ FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) set 7, [hl] ret -.SpawnLeaf: ; 8cbe6 (23:4be6) +.SpawnLeaf: ld hl, wcf65 ld a, [hl] inc [hl] @@ -465,5 +450,5 @@ FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ret diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 09de8f2b7..a1df536bb 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -1,4 +1,4 @@ -Fish: ; 92402 +Fish: ; Using a fishing rod. ; Fish for monsters with rod e in encounter group d. ; Return monster e at level d. @@ -11,7 +11,7 @@ Fish: ; 92402 call GetFishGroupIndex ld hl, FishGroups -rept 7 +rept FISHGROUP_DATA_LENGTH add hl, de endr call .Fish @@ -20,10 +20,8 @@ endr pop bc pop af ret -; 9241a - -.Fish: ; 9241a +.Fish: ; Fish for monsters with rod b from encounter data in FishGroup at hl. ; Return monster e at level d. @@ -90,10 +88,8 @@ endr ld d, [hl] inc hl ret -; 9245b - -GetFishGroupIndex: ; 9245b +GetFishGroupIndex: ; Return the index of fishgroup d in de. push hl @@ -127,7 +123,5 @@ GetFishGroupIndex: ; 9245b jr nz, .done ld d, FISHGROUP_REMORAID_SWARM jr .done -; 92488 - INCLUDE "data/wild/fish.asm" diff --git a/engine/events/fishing_gfx.asm b/engine/events/fishing_gfx.asm index 3d3ab0ba0..159f0022d 100644 --- a/engine/events/fishing_gfx.asm +++ b/engine/events/fishing_gfx.asm @@ -1,4 +1,4 @@ -LoadFishingGFX: ; b84b3 +LoadFishingGFX: ld a, [rVBK] push af ld a, $1 @@ -17,15 +17,14 @@ LoadFishingGFX: ; b84b3 call .LoadGFX ld hl, vTiles0 tile $0a call .LoadGFX - ld hl, vTiles1 tile $7c + ld hl, vTiles0 tile $fc call .LoadGFX pop af ld [rVBK], a ret -; b84e3 -.LoadGFX: ; b84e3 +.LoadGFX: lb bc, BANK(FishingGFX), 2 push de call Get2bpp @@ -35,12 +34,9 @@ LoadFishingGFX: ; b84b3 ld d, h ld e, l ret -; b84f2 -FishingGFX: ; b84f2 +FishingGFX: INCBIN "gfx/overworld/chris_fish.2bpp" -; b8582 -KrisFishingGFX: ; b8582 +KrisFishingGFX: INCBIN "gfx/overworld/kris_fish.2bpp" -; b8612 diff --git a/engine/events/forced_movement.asm b/engine/events/forced_movement.asm index 2d03659ff..69f27bfe2 100644 --- a/engine/events/forced_movement.asm +++ b/engine/events/forced_movement.asm @@ -1,60 +1,51 @@ -Script_ForcedMovement:: ; 0x1253d +Script_ForcedMovement:: checkcode VAR_FACING ifequal DOWN, .down ifequal UP, .up ifequal LEFT, .left ifequal RIGHT, .right end -; 0x12550 -.up ; 0x12550 +.up applymovement PLAYER, .MovementData_up end -; 0x12555 -.down ; 0x12555 +.down applymovement PLAYER, .MovementData_down end -; 0x1255a -.right ; 0x1255a +.right applymovement PLAYER, .MovementData_right end -; 0x1255f -.left ; 0x1255f +.left applymovement PLAYER, .MovementData_left end -; 0x12564 -.MovementData_up: ; 0x12564 +.MovementData_up: step_dig 16 turn_in DOWN step_dig 16 turn_head DOWN step_end -; 0x1256b -.MovementData_down: ; 0x1256b +.MovementData_down: step_dig 16 turn_in UP step_dig 16 turn_head UP step_end -; 0x12572 -.MovementData_right: ; 0x12572 +.MovementData_right: step_dig 16 turn_in LEFT step_dig 16 turn_head LEFT step_end -; 0x12579 -.MovementData_left: ; 0x12579 +.MovementData_left: step_dig 16 turn_in RIGHT step_dig 16 turn_head RIGHT step_end -; 0x12580 diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index 47d7702b4..6d5ca6a1d 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -1,4 +1,4 @@ -FruitTreeScript:: ; 44000 +FruitTreeScript:: callasm GetCurTreeFruit opentext copybytetovar wCurFruit @@ -32,38 +32,33 @@ FruitTreeScript:: ; 44000 .end closetext end -; 44041 -GetCurTreeFruit: ; 44041 +GetCurTreeFruit: ld a, [wCurFruitTree] dec a call GetFruitTreeItem ld [wCurFruit], a ret -; 4404c -TryResetFruitTrees: ; 4404c +TryResetFruitTrees: ld hl, wDailyFlags bit DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] ret nz jp ResetFruitTrees -; 44055 -CheckFruitTree: ; 44055 +CheckFruitTree: ld b, 2 call GetFruitTreeFlag ld a, c ld [wScriptVar], a ret -; 4405f -PickedFruitTree: ; 4405f +PickedFruitTree: farcall StubbedTrainerRankings_FruitPicked ld b, 1 jp GetFruitTreeFlag -; 4406a -ResetFruitTrees: ; 4406a +ResetFruitTrees: xor a ld hl, wFruitTreeFlags ld [hli], a @@ -73,9 +68,8 @@ ResetFruitTrees: ; 4406a ld hl, wDailyFlags set DAILYFLAGS_ALL_FRUIT_TREES_F, [hl] ret -; 44078 -GetFruitTreeFlag: ; 44078 +GetFruitTreeFlag: push hl push de ld a, [wCurFruitTree] @@ -87,9 +81,8 @@ GetFruitTreeFlag: ; 44078 pop de pop hl ret -; 4408a -GetFruitTreeItem: ; 4408a +GetFruitTreeItem: push hl push de ld e, a @@ -100,33 +93,25 @@ GetFruitTreeItem: ; 4408a pop de pop hl ret -; 44097 - INCLUDE "data/items/fruit_trees.asm" - -FruitBearingTreeText: ; 440b5 +FruitBearingTreeText: text_jump _FruitBearingTreeText db "@" -; 440ba -HeyItsFruitText: ; 440ba +HeyItsFruitText: text_jump _HeyItsFruitText db "@" -; 440bf -ObtainedFruitText: ; 440bf +ObtainedFruitText: text_jump _ObtainedFruitText db "@" -; 440c4 -FruitPackIsFullText: ; 440c4 +FruitPackIsFullText: text_jump _FruitPackIsFullText db "@" -; 440c9 -NothingHereText: ; 440c9 +NothingHereText: text_jump _NothingHereText db "@" -; 440ce diff --git a/engine/events/haircut.asm b/engine/events/haircut.asm index 0e4400235..d5b0afe8b 100644 --- a/engine/events/haircut.asm +++ b/engine/events/haircut.asm @@ -1,4 +1,4 @@ -BillsGrandfather: ; 73f7 +BillsGrandfather: farcall SelectMonFromParty jr c, .cancel ld a, [wCurPartySpecies] @@ -12,19 +12,19 @@ BillsGrandfather: ; 73f7 ld [wScriptVar], a ret -YoungerHaircutBrother: ; 7413 +YoungerHaircutBrother: ld hl, HappinessData_YoungerHaircutBrother jr HaircutOrGrooming -OlderHaircutBrother: ; 7418 +OlderHaircutBrother: ld hl, HappinessData_OlderHaircutBrother jr HaircutOrGrooming -DaisysGrooming: ; 741d +DaisysGrooming: ld hl, HappinessData_DaisysGrooming ; fallthrough -HaircutOrGrooming: ; 7420 +HaircutOrGrooming: push hl farcall SelectMonFromParty pop hl @@ -72,11 +72,11 @@ HaircutOrGrooming: ; 7420 INCLUDE "data/events/happiness_probabilities.asm" -CopyPokemonName_Buffer1_Buffer3: ; 746e +CopyPokemonName_Buffer1_Buffer3: ld hl, wStringBuffer1 ld de, wStringBuffer3 ld bc, MON_NAME_LENGTH jp CopyBytes -DummyPredef1: ; 747a +DummyPredef1: ret diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index b6b547aae..6cbc749d5 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -1,6 +1,6 @@ HALLOFFAME_COLON EQU $63 -HallOfFame:: ; 0x8640e +HallOfFame:: call HallOfFame_FadeOutMusic ld a, [wStatusFlags] push af @@ -33,9 +33,8 @@ HallOfFame:: ; 0x8640e ld b, a farcall Credits ret -; 0x86455 -RedCredits:: ; 86455 +RedCredits:: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -56,9 +55,8 @@ RedCredits:: ; 86455 ld b, a farcall Credits ret -; 8648e -HallOfFame_FadeOutMusic: ; 8648e +HallOfFame_FadeOutMusic: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -72,9 +70,8 @@ HallOfFame_FadeOutMusic: ; 8648e farcall InitDisplayForHallOfFame ld c, 100 jp DelayFrames -; 864b4 -HallOfFame_PlayMusicDE: ; 864b4 +HallOfFame_PlayMusicDE: push de ld de, MUSIC_NONE call PlayMusic @@ -82,9 +79,8 @@ HallOfFame_PlayMusicDE: ; 864b4 pop de call PlayMusic ret -; 864c3 -AnimateHallOfFame: ; 864c3 +AnimateHallOfFame: xor a ld [wJumptableIndex], a call LoadHOFTeam @@ -120,9 +116,8 @@ AnimateHallOfFame: ; 864c3 ld c, 8 call DelayFrames ret -; 8650c -.DisplayNewHallOfFamer: ; 8650c +.DisplayNewHallOfFamer: call DisplayHOFMon ld de, .String_NewHallOfFamer hlcoord 1, 2 @@ -135,14 +130,11 @@ AnimateHallOfFame: ; 864c3 call DelayFrames and a ret -; 8652c .String_NewHallOfFamer: db "New Hall of Famer!@" -; 8653f - -GetHallOfFameParty: ; 8653f +GetHallOfFameParty: ld hl, wHallOfFamePokemonList ld bc, wHallOfFamePokemonListEnd - wHallOfFamePokemonList + 1 xor a @@ -227,9 +219,8 @@ GetHallOfFameParty: ; 8653f ld a, -1 ld [de], a ret -; 865b5 -AnimateHOFMonEntrance: ; 865b5 +AnimateHOFMonEntrance: push hl call ClearBGPalettes farcall ResetDisplayBetweenHallOfFameMons @@ -281,7 +272,6 @@ AnimateHOFMonEntrance: ; 865b5 ld [hSCY], a call HOF_SlideFrontpic ret -; 86635 HOF_SlideBackpic: .backpicloop @@ -292,7 +282,6 @@ HOF_SlideBackpic: ld [hSCX], a call DelayFrame jr .backpicloop -; 86643 HOF_SlideFrontpic: .frontpicloop @@ -304,9 +293,8 @@ HOF_SlideFrontpic: ld [hSCX], a call DelayFrame jr .frontpicloop -; 86650 -_HallOfFamePC: ; 86650 +_HallOfFamePC: call LoadFontsBattleExtra xor a ld [wJumptableIndex], a @@ -415,9 +403,8 @@ _HallOfFamePC: ; 86650 .TimeFamer: db " -Time Famer@" -; 8671c -LoadHOFTeam: ; 8671c +LoadHOFTeam: ld a, [wJumptableIndex] cp NUM_HOF_TEAMS jr nc, .invalid @@ -442,9 +429,8 @@ LoadHOFTeam: ; 8671c .invalid scf ret -; 86748 -DisplayHOFMon: ; 86748 +DisplayHOFMon: xor a ld [hBGMapMode], a ld a, [hli] @@ -529,9 +515,8 @@ DisplayHOFMon: ; 86748 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ret -; 86810 -HOF_AnimatePlayerPic: ; 86810 +HOF_AnimatePlayerPic: call ClearBGPalettes ld hl, vTiles2 tile HALLOFFAME_COLON ld de, FontExtra + 13 tiles ; "<COLON>" @@ -614,9 +599,6 @@ HOF_AnimatePlayerPic: ; 86810 call WaitBGMap farcall ProfOaksPCRating ret -; 868ed .PlayTime: db "PLAY TIME@" -; 868f7 - diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 998e7e07a..41f9a4411 100644 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -1,4 +1,4 @@ -GetFirstPokemonHappiness: ; 718d +GetFirstPokemonHappiness: ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH ld de, wPartySpecies @@ -17,7 +17,7 @@ GetFirstPokemonHappiness: ; 718d call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 -CheckFirstMonIsEgg: ; 71ac +CheckFirstMonIsEgg: ld a, [wPartySpecies] ld [wd265], a cp EGG @@ -30,7 +30,7 @@ CheckFirstMonIsEgg: ; 71ac call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 -ChangeHappiness: ; 71c2 +ChangeHappiness: ; Perform happiness action c on wCurPartyMon ld a, [wCurPartyMon] @@ -102,11 +102,9 @@ ChangeHappiness: ; 71c2 ld [wBattleMonHappiness], a ret - INCLUDE "data/events/happiness_changes.asm" - -StepHappiness:: ; 725a +StepHappiness:: ; Raise the party's happiness by 1 point every other step cycle. ld hl, wHappinessStepCount @@ -141,8 +139,7 @@ StepHappiness:: ; 725a jr nz, .loop ret - -DayCareStep:: ; 7282 +DayCareStep:: ; Raise the experience of Day-Care Pokémon every step cycle. ld a, [wDayCareMan] diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 955449280..559886289 100644 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -7,7 +7,7 @@ const HEALMACHINESTATE_HOFPLAYSFX const HEALMACHINESTATE_FINISH -HealMachineAnim: ; 12324 +HealMachineAnim: ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. ld a, [wPartyCount] and a @@ -24,9 +24,8 @@ HealMachineAnim: ; 12324 ld a, [wBuffer2] call DmgToCgbObjPal1 ret -; 1233e -.DoJumptableFunctions: ; 1233e +.DoJumptableFunctions: xor a ld [wBuffer3], a .jumpable_loop @@ -53,14 +52,12 @@ HealMachineAnim: ; 12324 .finish ret -; 12365 -.Pointers: ; 12365 +.Pointers: ; entries correspond to HEALMACHINE_* constants dw .Pokecenter dw .ElmLab dw .HallOfFame -; 1236b healmachineanimseq: MACRO rept _NARG @@ -69,15 +66,14 @@ rept _NARG endr ENDM -.Pokecenter: ; 1236b +.Pokecenter: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH -.ElmLab: ; 1236f +.ElmLab: healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH -.HallOfFame: ; 12373 +.HallOfFame: healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH -; 12377 -.Jumptable: ; 12377 +.Jumptable: ; entries correspond to HEALMACHINESTATE_* constants dw .LoadGFX dw .PC_LoadBallsOntoMachine @@ -85,29 +81,27 @@ ENDM dw .PlayHealMusic dw .HOF_PlaySFX dw .dummy_5 ; never encountered -; 12383 -.LoadGFX: ; 12383 +.LoadGFX: call .LoadPalettes ld de, .HealMachineGFX ld hl, vTiles0 tile $7c lb bc, BANK(.HealMachineGFX), 2 call Request2bpp ret -; 12393 -.PC_LoadBallsOntoMachine: ; 12393 +.PC_LoadBallsOntoMachine: ld hl, wVirtualOAMSprite32 ld de, .PC_ElmsLab_OAM call .PlaceHealingMachineTile call .PlaceHealingMachineTile jr .LoadBallsOntoMachine -.HOF_LoadBallsOntoMachine: ; 123a1 +.HOF_LoadBallsOntoMachine: ld hl, wVirtualOAMSprite32 ld de, .HOF_OAM -.LoadBallsOntoMachine: ; 123a7 +.LoadBallsOntoMachine: ld a, [wPartyCount] ld b, a .party_loop @@ -121,15 +115,13 @@ ENDM dec b jr nz, .party_loop ret -; 123bf -.PlayHealMusic: ; 123bf +.PlayHealMusic: ld de, MUSIC_HEAL call PlayMusic jp .FlashPalettes8Times -; 123c8 -.HOF_PlaySFX: ; 123c8 +.HOF_PlaySFX: ld de, SFX_GAME_FREAK_LOGO_GS call PlaySFX call .FlashPalettes8Times @@ -137,13 +129,11 @@ ENDM ld de, SFX_BOOT_PC call PlaySFX ret -; 123db -.dummy_5 ; 123db +.dummy_5 ret -; 123dc -.PC_ElmsLab_OAM: ; 123dc +.PC_ElmsLab_OAM: dsprite 4, 0, 4, 2, $7c, PAL_OW_TREE | OBP_NUM dsprite 4, 0, 4, 6, $7c, PAL_OW_TREE | OBP_NUM dsprite 4, 6, 4, 0, $7d, PAL_OW_TREE | OBP_NUM @@ -152,22 +142,19 @@ ENDM dsprite 5, 3, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP dsprite 6, 0, 4, 0, $7d, PAL_OW_TREE | OBP_NUM dsprite 6, 0, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP -; 123fc -.HealMachineGFX: ; 123fc +.HealMachineGFX: INCBIN "gfx/overworld/heal_machine.2bpp" -; 1241c -.HOF_OAM: ; 1241c +.HOF_OAM: dsprite 7, 4, 10, 1, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 4, 10, 6, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 3, 9, 5, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 3, 11, 2, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 1, 9, 1, $7d, PAL_OW_TREE | OBP_NUM dsprite 7, 1, 11, 5, $7d, PAL_OW_TREE | OBP_NUM -; 12434 -.LoadPalettes: ; 12434 +.LoadPalettes: call IsCGB jr nz, .cgb ld a, %11100000 @@ -183,13 +170,11 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ld a, $1 ld [hCGBPalUpdate], a ret -; 12451 -.palettes ; 12451 +.palettes INCLUDE "gfx/overworld/heal_machine.pal" -; 12459 -.FlashPalettes8Times: ; 12459 +.FlashPalettes8Times: ld c, 8 .palette_loop push bc @@ -200,9 +185,8 @@ INCLUDE "gfx/overworld/heal_machine.pal" dec c jr nz, .palette_loop ret -; 12469 -.FlashPalettes: ; 12469 +.FlashPalettes: call IsCGB jr nz, .go ld a, [rOBP1] @@ -250,9 +234,8 @@ INCLUDE "gfx/overworld/heal_machine.pal" ld a, $1 ld [hCGBPalUpdate], a ret -; 124a3 -.PlaceHealingMachineTile: ; 124a3 +.PlaceHealingMachineTile: push bc ld a, [wBuffer1] bcpixel 2, 4 @@ -277,4 +260,3 @@ INCLUDE "gfx/overworld/heal_machine.pal" ld [hli], a ; attributes pop bc ret -; 124c1 diff --git a/engine/events/itemfinder.asm b/engine/events/itemfinder.asm index 71aaa5b69..6a4d6edf3 100644 --- a/engine/events/itemfinder.asm +++ b/engine/events/itemfinder.asm @@ -1,4 +1,4 @@ -ItemFinder: ; 12580 +ItemFinder: farcall CheckForHiddenItems jr c, .found_something ld hl, .Script_FoundNothing @@ -12,9 +12,8 @@ ItemFinder: ; 12580 ld a, $1 ld [wItemEffectSucceeded], a ret -; 12599 -.ItemfinderSound: ; 12599 +.ItemfinderSound: ld c, 4 .sfx_loop push bc @@ -26,33 +25,28 @@ ItemFinder: ; 12580 dec c jr nz, .sfx_loop ret -; 125ad -.Script_FoundSomething: ; 0x125ad +.Script_FoundSomething: reloadmappart special UpdateTimePals callasm .ItemfinderSound writetext .Text_FoundSomething closetext end -; 0x125ba -.Script_FoundNothing: ; 0x125ba +.Script_FoundNothing: reloadmappart special UpdateTimePals writetext .Text_FoundNothing closetext end -; 0x125c3 -.Text_FoundSomething: ; 0x125c3 +.Text_FoundSomething: ; Yes! ITEMFINDER indicates there's an item nearby. text_jump UnknownText_0x1c0a77 db "@" -; 0x125c8 -.Text_FoundNothing: ; 0x125c8 +.Text_FoundNothing: ; Nope! ITEMFINDER isn't responding. text_jump UnknownText_0x1c0aa9 db "@" -; 0x125cd diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 8fe78f5b6..d4342b3e4 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -1,28 +1,24 @@ -Kurt_PrintTextWhichApricorn: ; 88000 +Kurt_PrintTextWhichApricorn: ld hl, .Text call PrintText ret -; 88007 -.Text: ; 0x88007 +.Text: ; Which APRICORN should I use? text_jump UnknownText_0x1bc06b db "@" -; 0x8800c -Kurt_PrintTextHowMany: ; 8800c +Kurt_PrintTextHowMany: ld hl, .Text call PrintText ret -; 88013 -.Text: ; 0x88013 +.Text: ; How many should I make? text_jump UnknownText_0x1bc089 db "@" -; 0x88018 -SelectApricornForKurt: ; 88018 +SelectApricornForKurt: call LoadStandardMenuHeader ld c, $1 xor a @@ -54,9 +50,8 @@ SelectApricornForKurt: ; 88018 .done call Call_ExitMenu ret -; 88055 -Kurt_SelectApricorn: ; 88055 +Kurt_SelectApricorn: farcall FindApricornsInBag jr c, .nope ld hl, .MenuHeader @@ -81,18 +76,16 @@ Kurt_SelectApricorn: ; 88055 .done ld c, a ret -; 88086 -.MenuHeader: ; 0x88086 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, 13, 10 dw .MenuData db 1 ; default option -; 0x8808e db 0 ; XXX -.MenuData: ; 0x8808f +.MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 7 db 1 @@ -101,15 +94,14 @@ Kurt_SelectApricorn: ; 88055 dba .Quantity dba NULL -.Name: ; 8809f +.Name: ld a, [wMenuSelection] and a ret z farcall PlaceMenuItemName ret -; 880ab -.Quantity: ; 880ab +.Quantity: ld a, [wMenuSelection] ld [wCurItem], a call Kurt_GetQuantityOfApricorn @@ -118,9 +110,8 @@ Kurt_SelectApricorn: ; 88055 ld [wMenuSelectionQuantity], a farcall PlaceMenuItemQuantity ret -; 880c2 -Kurt_SelectQuantity: ; 880c2 +Kurt_SelectQuantity: ld a, [wCurItem] ld [wMenuSelection], a call Kurt_GetQuantityOfApricorn @@ -155,16 +146,15 @@ Kurt_SelectQuantity: ; 880c2 .done call CloseWindow ret -; 8810d -.MenuHeader: ; 0x8810d +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 9, SCREEN_WIDTH - 1, 12 dw NULL db -1 ; default option db 0 -.PlaceApricornName: ; 88116 +.PlaceApricornName: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 add hl, de @@ -172,9 +162,8 @@ Kurt_SelectQuantity: ; 880c2 ld e, l farcall PlaceMenuItemName ret -; 88126 -PlaceApricornQuantity: ; 88126 +PlaceApricornQuantity: call MenuBoxCoord2Tile ld de, 2 * SCREEN_WIDTH + 10 add hl, de @@ -183,9 +172,8 @@ PlaceApricornQuantity: ; 88126 ld de, wItemQuantityChangeBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum -; 88139 -Kurt_GetQuantityOfApricorn: ; 88139 +Kurt_GetQuantityOfApricorn: push bc ld hl, wNumItems ld a, [wCurItem] @@ -216,9 +204,8 @@ Kurt_GetQuantityOfApricorn: ; 88139 and a pop bc ret -; 88161 -Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 +Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; Get the quantity of Apricorns of type [wCurItem] ; in the bag. Compatible with multiple stacks. @@ -352,9 +339,8 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 pop bc pop de ret -; 88201 -Kurt_GetAddressOfApricornQuantity: ; 88201 +Kurt_GetAddressOfApricornQuantity: push hl push bc ld hl, wNumItems @@ -368,9 +354,8 @@ Kurt_GetAddressOfApricornQuantity: ; 88201 pop bc pop hl ret -; 88211 -Kurt_GetRidOfItem: ; 88211 +Kurt_GetRidOfItem: push bc ld hl, wNumItems ld a, [wCurItemQuantity] @@ -409,4 +394,3 @@ Kurt_GetRidOfItem: ; 88211 ld [wItemQuantityChangeBuffer], a pop bc ret -; 88248 diff --git a/engine/events/kurt_selectquantity_interpretjoypad.asm b/engine/events/kurt_selectquantity_interpretjoypad.asm index 12a43e325..44b71a113 100644 --- a/engine/events/kurt_selectquantity_interpretjoypad.asm +++ b/engine/events/kurt_selectquantity_interpretjoypad.asm @@ -1,4 +1,4 @@ -Kurt_SelectQuantity_InterpretJoypad: ; 27a28 +Kurt_SelectQuantity_InterpretJoypad: call BuySellToss_InterpretJoypad ld b, a ret diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index f482ce9d6..c5d6d18e0 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -1,4 +1,4 @@ -CheckForLuckyNumberWinners: ; 4d87a +CheckForLuckyNumberWinners: xor a ld [wScriptVar], a ld [wFoundMatchingIDInParty], a @@ -118,7 +118,7 @@ CheckForLuckyNumberWinners: ; 4d87a .print jp PrintText -.CompareLuckyNumberToMonID: ; 4d939 +.CompareLuckyNumberToMonID: push bc push de push hl @@ -190,7 +190,7 @@ CheckForLuckyNumberWinners: ; 4d87a and a ret -.BoxBankAddresses: ; 4d99f +.BoxBankAddresses: dba sBox1 dba sBox2 dba sBox3 @@ -206,17 +206,17 @@ CheckForLuckyNumberWinners: ; 4d87a dba sBox13 dba sBox14 -.FoundPartymonText: ; 0x4d9c9 +.FoundPartymonText: ; Congratulations! We have a match with the ID number of @ in your party. text_jump UnknownText_0x1c1261 db "@" -.FoundBoxmonText: ; 0x4d9ce +.FoundBoxmonText: ; Congratulations! We have a match with the ID number of @ in your PC BOX. text_jump UnknownText_0x1c12ae db "@" -PrintTodaysLuckyNumber: ; 4d9d3 +PrintTodaysLuckyNumber: ld hl, wStringBuffer3 ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index f5180a8e5..7fe8adba7 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -1,4 +1,4 @@ -CheckMagikarpLength: ; fbb32 +CheckMagikarpLength: ; Returns 3 if you select a Magikarp that beats the previous record. ; Returns 2 if you select a Magikarp, but the current record is longer. ; Returns 1 if you press B in the Pokemon selection menu. @@ -70,27 +70,23 @@ CheckMagikarpLength: ; fbb32 xor a ; MAGIKARPLENGTH_NOT_MAGIKARP ld [wScriptVar], a ret -; fbba9 -.MeasureItText: ; 0xfbba9 +.MeasureItText: ; Let me measure that MAGIKARP. …Hm, it measures @ . text_jump UnknownText_0x1c1203 db "@" -; 0xfbbae -Magikarp_LoadFeetInchesChars: ; fbbae +Magikarp_LoadFeetInchesChars: ld hl, vTiles2 tile "′" ; $6e ld de, .feetinchchars lb bc, BANK(.feetinchchars), 2 call Request2bpp ret -; fbbbb -.feetinchchars ; fbbb +.feetinchchars INCBIN "gfx/font/feet_inches.2bpp" -; fbbdb -PrintMagikarpLength: ; fbbdb +PrintMagikarpLength: call Magikarp_LoadFeetInchesChars ld hl, wStringBuffer1 ld de, wMagikarpLength @@ -105,9 +101,8 @@ PrintMagikarpLength: ; fbbdb inc hl ld [hl], "@" ret -; fbbfc -CalcMagikarpLength: ; fbbfc +CalcMagikarpLength: ; Return Magikarp's length (in feet and inches) at wMagikarpLength (big endian). ; ; input: @@ -144,7 +139,6 @@ CalcMagikarpLength: ; fbbfc ; if b = 252-253: x = 65210, y = 5, z = 13 ; if b = 254: x = 65410, y = 2, z = 14 - ; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) ; id @@ -283,9 +277,8 @@ CalcMagikarpLength: ; fbbfc inc hl ld [hl], e ; in ret -; fbc9a -.BCLessThanDE: ; fbc9a +.BCLessThanDE: ; Intention: Return bc < de. ; Reality: Return b < d. ld a, b @@ -295,9 +288,8 @@ CalcMagikarpLength: ; fbbfc ld a, c cp e ret -; fbca1 -.BCMinusDE: ; fbca1 +.BCMinusDE: ; bc -= de ld a, c sub e @@ -306,13 +298,10 @@ CalcMagikarpLength: ; fbbfc sbc d ld b, a ret -; fbca8 INCLUDE "data/events/magikarp_lengths.asm" - - -MagikarpHouseSign: ; fbcd2 +MagikarpHouseSign: ld a, [wBestMagikarpLengthFeet] ld [wMagikarpLength], a ld a, [wBestMagikarpLengthInches] @@ -321,10 +310,8 @@ MagikarpHouseSign: ; fbcd2 ld hl, .CurrentRecordtext call PrintText ret -; fbce8 -.CurrentRecordtext: ; 0xfbce8 +.CurrentRecordtext: ; "CURRENT RECORD" text_jump UnknownText_0x1c123a db "@" -; 0xfbced diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 6f2aa2d1f..010983627 100644 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -1,4 +1,4 @@ -MagnetTrain: ; 8cc04 +MagnetTrain: ld a, [wScriptVar] and a jr nz, .ToGoldenrod @@ -81,9 +81,8 @@ MagnetTrain: ; 8cc04 pop af ld [rSVBK], a ret -; 8cc99 -MagnetTrain_UpdateLYOverrides: ; 8cc99 +MagnetTrain_UpdateLYOverrides: ld hl, wLYOverridesBackup ld c, $2f ld a, [wMagnetTrainOffset] @@ -111,9 +110,8 @@ MagnetTrain_UpdateLYOverrides: ; 8cc99 dec c jr nz, .loadloop ret -; 8ccc9 -MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 +MagntTrain_LoadGFX_PlayMusic: call ClearBGPalettes call ClearSprites call DisableLCD @@ -155,9 +153,8 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 ld de, MUSIC_MAGNET_TRAIN call PlayMusic2 ret -; 8cd27 -DrawMagnetTrain: ; 8cd27 +DrawMagnetTrain: hlbgcoord 0, 0 xor a .loop @@ -184,18 +181,16 @@ DrawMagnetTrain: ; 8cd27 ld c, 20 call .FillLine ret -; 8cd65 -.FillLine: ; 8cd65 +.FillLine: ld a, [de] inc de ld [hli], a dec c jr nz, .FillLine ret -; 8cd6c -.FillAlt: ; 8cd6c +.FillAlt: ld [hl], e inc hl ld [hl], d @@ -203,9 +198,8 @@ DrawMagnetTrain: ; 8cd27 dec b jr nz, .FillAlt ret -; 8cd74 -GetMagnetTrainBGTiles: ; 8cd74 +GetMagnetTrainBGTiles: push hl ld e, a ld d, 0 @@ -217,9 +211,8 @@ GetMagnetTrainBGTiles: ; 8cd74 ld d, [hl] pop hl ret -; 8cd82 -MagnetTrainBGTiles: ; 8cd82 +MagnetTrainBGTiles: ; Alternating tiles for each line of the Magnet Train tilemap. db $4c, $4d ; bush db $5c, $5d ; bush @@ -239,9 +232,8 @@ MagnetTrainBGTiles: ; 8cd82 db $5c, $5d ; bush db $4c, $4d ; bush db $5c, $5d ; bush -; 8cda6 -MagnetTrain_InitLYOverrides: ; 8cda6 +MagnetTrain_InitLYOverrides: ld hl, wLYOverrides ld bc, wLYOverridesEnd - wLYOverrides ld a, [wMagnetTrainInitPosition] @@ -253,9 +245,8 @@ MagnetTrain_InitLYOverrides: ; 8cda6 ld a, rSCX - $ff00 ld [hLCDCPointer], a ret -; 8cdc3 -SetMagnetTrainPals: ; 8cdc3 +SetMagnetTrainPals: ld a, $1 ld [rVBK], a @@ -286,9 +277,8 @@ SetMagnetTrainPals: ; 8cdc3 ld a, $0 ld [rVBK], a ret -; 8cdf7 -MagnetTrain_Jumptable: ; 8cdf7 +MagnetTrain_Jumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -299,9 +289,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld h, [hl] ld l, a jp hl -; 8ce06 -.Jumptable: ; 8ce06 +.Jumptable: dw .InitPlayerSpriteAnim dw .WaitScene dw .MoveTrain1 @@ -309,15 +298,13 @@ MagnetTrain_Jumptable: ; 8cdf7 dw .MoveTrain2 dw .WaitScene dw .TrainArrived -; 8ce14 -.Next: ; 8ce14 +.Next: ld hl, wJumptableIndex inc [hl] ret -; 8ce19 -.InitPlayerSpriteAnim: ; 8ce19 +.InitPlayerSpriteAnim: ld d, 10 * 8 + 5 ld a, [wMagnetTrainPlayerSpriteInitX] ld e, a @@ -343,9 +330,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, $80 ld [wMagnetTrainWaitCounter], a ret -; 8ce47 -.MoveTrain1: ; 8ce47 +.MoveTrain1: ld hl, wMagnetTrainHoldPosition ld a, [wMagnetTrainPosition] cp [hl] @@ -367,9 +353,8 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, $80 ld [wMagnetTrainWaitCounter], a ret -; 8ce6d -.WaitScene: ; 8ce6d +.WaitScene: ld hl, wMagnetTrainWaitCounter ld a, [hl] and a @@ -380,9 +365,8 @@ MagnetTrain_Jumptable: ; 8cdf7 .DoneWaiting: call .Next ret -; 8ce7a -.MoveTrain2: ; 8ce7a +.MoveTrain2: ld hl, wMagnetTrainFinalPosition ld a, [wMagnetTrainPosition] cp [hl] @@ -410,17 +394,15 @@ MagnetTrain_Jumptable: ; 8cdf7 .PrepareToFinishAnim: call .Next ret -; 8cea2 -.TrainArrived: ; 8cea2 +.TrainArrived: ld a, $80 ld [wJumptableIndex], a ld de, SFX_TRAIN_ARRIVED call PlaySFX ret -; 8ceae -MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae +MagnetTrain_Jumptable_FirstRunThrough: farcall PlaySpriteAnimations call MagnetTrain_Jumptable call MagnetTrain_UpdateLYOverrides @@ -455,7 +437,6 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae pop af ld [rSVBK], a ret -; 8ceff MagnetTrainTilemap1: db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f @@ -465,4 +446,3 @@ MagnetTrainTilemap3: db $24, $25, $26, $27, $07, $2f, $29, $28, $28, $28, $28, $28, $28, $29, $07, $2f, $2a, $2b, $2c, $2d MagnetTrainTilemap4: db $20, $1f, $2e, $1f, $17, $00, $2e, $1f, $1f, $1f, $1f, $1f, $1f, $2e, $17, $00, $1f, $2e, $1f, $0f -; 8cf4f diff --git a/engine/events/map_name_sign.asm b/engine/events/map_name_sign.asm index 385ddf802..859f30034 100644 --- a/engine/events/map_name_sign.asm +++ b/engine/events/map_name_sign.asm @@ -1,14 +1,13 @@ MAP_NAME_SIGN_START EQU $60 -ReturnFromMapSetupScript:: ; b8000 +ReturnFromMapSetupScript:: xor a ld [hBGMapMode], a farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes ret -; b800a ; should have just been a fallthrough -.inefficient_farcall ; b800a +.inefficient_farcall ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -57,9 +56,8 @@ ReturnFromMapSetupScript:: ; b8000 xor a ld [hLCDCPointer], a ret -; b8064 -.CheckMovingWithinLandmark: ; b8064 +.CheckMovingWithinLandmark: ld a, [wCurrentLandmark] ld c, a ld a, [wPreviousLandmark] @@ -67,9 +65,8 @@ ReturnFromMapSetupScript:: ; b8000 ret z cp SPECIAL_MAP ret -; b8070 -.CheckSpecialMap: ; b8070 +.CheckSpecialMap: ; These landmarks do not get pop-up signs. cp -1 ret z @@ -88,9 +85,8 @@ ReturnFromMapSetupScript:: ; b8000 ld a, 1 and a ret -; b8089 -.CheckNationalParkGate: ; b8089 +.CheckNationalParkGate: ld a, [wMapGroup] cp GROUP_ROUTE_35_NATIONAL_PARK_GATE ret nz @@ -99,10 +95,8 @@ ReturnFromMapSetupScript:: ; b8000 ret z cp MAP_ROUTE_36_NATIONAL_PARK_GATE ret -; b8098 - -PlaceMapNameSign:: ; b8098 (2e:4098) +PlaceMapNameSign:: ld hl, wLandmarkSignTimer ld a, [hl] and a @@ -130,26 +124,22 @@ PlaceMapNameSign:: ; b8098 (2e:4098) ld [hLCDCPointer], a ret - -LoadMapNameSignGFX: ; b80c6 +LoadMapNameSignGFX: ld de, MapEntryFrameGFX ld hl, vTiles2 tile MAP_NAME_SIGN_START lb bc, BANK(MapEntryFrameGFX), 14 call Get2bpp ret -; b80d3 -InitMapNameFrame: ; b80d3 +InitMapNameFrame: hlcoord 0, 0 ld b, 2 ld c, 18 call InitMapSignAttrMap call PlaceMapNameFrame ret -; b80e1 - -PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) +PlaceMapNameCenterAlign: ld a, [wCurrentLandmark] ld e, a farcall GetLandmarkName @@ -165,7 +155,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) call PlaceString ret -.GetNameLength: ; b8101 (2e:4101) +.GetNameLength: ld c, 0 push hl ld hl, wStringBuffer1 @@ -181,8 +171,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) pop hl ret - -InitMapSignAttrMap: ; b8115 +InitMapSignAttrMap: ld de, wAttrMap - wTileMap add hl, de inc b @@ -204,9 +193,8 @@ InitMapSignAttrMap: ; b8115 dec b jr nz, .loop ret -; b812f -PlaceMapNameFrame: ; b812f +PlaceMapNameFrame: hlcoord 0, 0 ; top left ld a, MAP_NAME_SIGN_START + 1 @@ -243,9 +231,8 @@ PlaceMapNameFrame: ; b812f ld a, MAP_NAME_SIGN_START + 10 ld [hl], a ret -; b815b -.FillMiddle: ; b815b +.FillMiddle: ld c, SCREEN_WIDTH - 2 ld a, MAP_NAME_SIGN_START + 13 .loop @@ -253,9 +240,8 @@ PlaceMapNameFrame: ; b812f dec c jr nz, .loop ret -; b8164 -.FillTopBottom: ; b8164 +.FillTopBottom: ld c, 5 jr .enterloop @@ -271,4 +257,3 @@ PlaceMapNameFrame: ; b812f dec c jr nz, .continueloop ret -; b8172 diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm index b79889f72..f88e72c45 100644 --- a/engine/events/misc_scripts.asm +++ b/engine/events/misc_scripts.asm @@ -1,4 +1,4 @@ -Script_AbortBugContest: ; 0x122c1 +Script_AbortBugContest: checkflag ENGINE_BUG_CONTEST_TIMER iffalse .finish setflag ENGINE_DAILY_BUG_CONTEST @@ -6,7 +6,7 @@ Script_AbortBugContest: ; 0x122c1 .finish end -FindItemInBallScript:: ; 0x122ce +FindItemInBallScript:: callasm .TryReceiveItem iffalse .no_room disappear LAST_TALKED @@ -17,9 +17,8 @@ FindItemInBallScript:: ; 0x122ce itemnotify closetext end -; 0x122e3 -.no_room ; 0x122e3 +.no_room opentext writetext .text_found waitbutton @@ -27,21 +26,18 @@ FindItemInBallScript:: ; 0x122ce waitbutton closetext end -; 0x122ee -.text_found ; 0x122ee +.text_found ; found @ ! text_jump UnknownText_0x1c0a1c db "@" -; 0x122f3 -.text_bag_full ; 0x122f3 +.text_bag_full ; But can't carry any more items. text_jump UnknownText_0x1c0a2c db "@" -; 0x122f8 -.TryReceiveItem: ; 122f8 +.TryReceiveItem: xor a ld [wScriptVar], a ld a, [wEngineBuffer1] @@ -59,4 +55,3 @@ FindItemInBallScript:: ; 0x122ce ld a, $1 ld [wScriptVar], a ret -; 12324 diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm index dd705b547..cb26ce12e 100644 --- a/engine/events/misc_scripts_2.asm +++ b/engine/events/misc_scripts_2.asm @@ -1,16 +1,16 @@ -RepelWoreOffScript:: ; 0x13619 +RepelWoreOffScript:: opentext writetext .text waitbutton closetext end -.text ; 0x13620 +.text ; REPEL's effect wore off. text_jump UnknownText_0x1bd308 db "@" -HiddenItemScript:: ; 0x13625 +HiddenItemScript:: opentext copybytetovar wEngineBuffer3 itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 @@ -22,26 +22,26 @@ HiddenItemScript:: ; 0x13625 itemnotify jump .finish -.bag_full ; 0x1363e +.bag_full buttonsound writetext .no_room_text waitbutton -.finish ; 13643 +.finish closetext end -.found_text ; 0x13645 +.found_text ; found @ ! text_jump UnknownText_0x1bd321 db "@" -.no_room_text ; 0x1364a +.no_room_text ; But has no space left… text_jump UnknownText_0x1bd331 db "@" -SetMemEvent: ; 1364f +SetMemEvent: ld hl, wEngineBuffer1 ld a, [hli] ld d, [hl] diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 1a00b723a..adaee701f 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -1,4 +1,4 @@ -BankOfMom: ; 16218 +BankOfMom: ld a, [hInMenu] push af ld a, $1 @@ -16,9 +16,8 @@ BankOfMom: ; 16218 pop af ld [hInMenu], a ret -; 16233 -.RunJumptable: ; 16233 +.RunJumptable: ld a, [wJumptableIndex] ld e, a ld d, 0 @@ -29,9 +28,8 @@ BankOfMom: ; 16218 ld h, [hl] ld l, a jp hl -; 16242 -.dw ; 16242 +.dw dw .CheckIfBankInitialized dw .InitializeBank @@ -42,9 +40,8 @@ BankOfMom: ; 16218 dw .StopOrStartSavingMoney dw .AskDST dw .JustDoWhatYouCan -; 16254 -.CheckIfBankInitialized: ; 16254 +.CheckIfBankInitialized: ld a, [wMomSavingMoney] bit MOM_ACTIVE_F, a jr nz, .savingmoneyalready @@ -59,9 +56,8 @@ BankOfMom: ; 16218 .done_0 ld [wJumptableIndex], a ret -; 1626a -.InitializeBank: ; 1626a +.InitializeBank: ld hl, UnknownText_0x16649 call PrintText call YesNoBox @@ -81,9 +77,8 @@ BankOfMom: ; 16218 ld a, $8 ld [wJumptableIndex], a ret -; 16290 -.IsThisAboutYourMoney: ; 16290 +.IsThisAboutYourMoney: ld hl, UnknownText_0x16658 call PrintText call YesNoBox @@ -98,9 +93,8 @@ BankOfMom: ; 16218 .done_2 ld [wJumptableIndex], a ret -; 162a8 -.AccessBankOfMom: ; 162a8 +.AccessBankOfMom: ld hl, UnknownText_0x1665d call PrintText call LoadStandardMenuHeader @@ -135,9 +129,8 @@ BankOfMom: ; 16218 .done_3 ld [wJumptableIndex], a ret -; 162e0 -.StoreMoney: ; 162e0 +.StoreMoney: ld hl, UnknownText_0x16662 call PrintText xor a @@ -202,9 +195,8 @@ BankOfMom: ; 16218 .done_4 ld [wJumptableIndex], a ret -; 16373 -.TakeMoney: ; 16373 +.TakeMoney: ld hl, UnknownText_0x16667 call PrintText xor a @@ -269,9 +261,8 @@ BankOfMom: ; 16218 .done_5 ld [wJumptableIndex], a ret -; 16406 -.StopOrStartSavingMoney: ; 16406 +.StopOrStartSavingMoney: ld hl, UnknownText_0x1666c call PrintText call YesNoBox @@ -290,19 +281,17 @@ BankOfMom: ; 16218 ld a, $7 ld [wJumptableIndex], a ret -; 1642d -.AskDST: ; 1642d +.AskDST: ld hl, UnknownText_0x16694 call PrintText -.JustDoWhatYouCan: ; 16433 +.JustDoWhatYouCan: ld hl, wJumptableIndex set 7, [hl] ret -; 16439 -DSTChecks: ; 16439 +DSTChecks: ; check the time; avoid changing DST if doing so would change the current day ld a, [wDST] bit 7, a @@ -364,9 +353,8 @@ DSTChecks: ; 16439 ld hl, .Text_SetClockForward call PlaceHLTextAtBC ret -; 164b9 -.SetClockForward: ; 164b9 +.SetClockForward: ld a, [wStartHour] add 1 sub 24 @@ -379,9 +367,8 @@ DSTChecks: ; 16439 adc 0 ld [wStartDay], a ret -; 164d1 -.SetClockBack: ; 164d1 +.SetClockBack: ld a, [wStartHour] sub 1 jr nc, .DontLoopHourBack @@ -395,59 +382,51 @@ DSTChecks: ; 16439 .DontLoopDayBack: ld [wStartDay], a ret -; 164ea -.ClearBox: ; 164ea +.ClearBox: hlcoord 1, 14 lb bc, 3, 18 call ClearBox ret -; 164f4 -.Text_AdjustClock: ; 0x164f4 +.Text_AdjustClock: ; Do you want to adjust your clock for Daylight Saving Time? text_jump UnknownText_0x1c6095 db "@" -; 0x164f9 -.Text_LostInstructionBooklet: ; 0x164f9 +.Text_LostInstructionBooklet: ; I lost the instruction booklet for the POKéGEAR. ; Come back again in a while. text_jump UnknownText_0x1c60d1 db "@" -; 0x164fe -.Text_SwitchToDST: ; 0x164fe +.Text_SwitchToDST: ; Do you want to switch to Daylight Saving Time? text_jump UnknownText_0x1c6000 db "@" -; 0x16503 -.Text_SetClockForward: ; 0x16503 +.Text_SetClockForward: ; I set the clock forward by one hour. text_jump UnknownText_0x1c6030 db "@" -; 0x16508 -.Text_IsDSTOver: ; 0x16508 +.Text_IsDSTOver: ; Is Daylight Saving Time over? text_jump UnknownText_0x1c6056 db "@" -; 0x1650d -.Text_SetClockBack: ; 0x1650d +.Text_SetClockBack: ; I put the clock back one hour. text_jump UnknownText_0x1c6075 db "@" -; 0x16512 -Mom_SetUpWithdrawMenu: ; 16512 +Mom_SetUpWithdrawMenu: ld de, Mon_WithdrawString jr Mom_ContinueMenuSetup -Mom_SetUpDepositMenu: ; 16517 +Mom_SetUpDepositMenu: ld de, Mom_DepositString -Mom_ContinueMenuSetup: ; 1651a +Mom_ContinueMenuSetup: push de xor a ld [hBGMapMode], a @@ -478,15 +457,13 @@ Mom_ContinueMenuSetup: ; 1651a call UpdateSprites call CGBOnly_CopyTilemapAtOnce ret -; 1656b -Mom_Wait10Frames: ; 1656b +Mom_Wait10Frames: ld c, 10 call DelayFrames ret -; 16571 -Mom_WithdrawDepositMenuJoypad: ; 16571 +Mom_WithdrawDepositMenuJoypad: .loop call JoyTextDelay ld hl, hJoyPressed @@ -590,9 +567,8 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 add hl, de pop de ret -; 16613 -.DigitQuantities: ; 16613 +.DigitQuantities: dt 100000 dt 10000 dt 1000 @@ -613,132 +589,109 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 dt 900 dt 90 dt 9 -; 16649 -UnknownText_0x16649: ; 0x16649 +UnknownText_0x16649: ; Wow, that's a cute #MON. Where did you get it? … So, you're leaving on an adventure… OK! I'll help too. But what can I do for you? I know! I'll save money for you. On a long journey, money's important. Do you want me to save your money? text_jump UnknownText_0x1bd77f db "@" -; 0x1664e -UnknownText_0x1664e: ; 0x1664e +UnknownText_0x1664e: ; OK, I'll take care of your money. text_jump UnknownText_0x1bd868 db "@" -; 0x16653 -UnknownText_0x16653: ; 0x16653 +UnknownText_0x16653: ; Be careful. #MON are your friends. You need to work as a team. Now, go on! text_jump UnknownText_0x1bd88e db "@" -; 0x16658 -UnknownText_0x16658: ; 0x16658 +UnknownText_0x16658: ; Hi! Welcome home! You're trying very hard, I see. I've kept your room tidy. Or is this about your money? text_jump UnknownText_0x1bd8da db "@" -; 0x1665d -UnknownText_0x1665d: ; 0x1665d +UnknownText_0x1665d: ; What do you want to do? text_jump UnknownText_0x1bd942 db "@" -; 0x16662 -UnknownText_0x16662: ; 0x16662 +UnknownText_0x16662: ; How much do you want to save? text_jump UnknownText_0x1bd95b db "@" -; 0x16667 -UnknownText_0x16667: ; 0x16667 +UnknownText_0x16667: ; How much do you want to take? text_jump UnknownText_0x1bd97a db "@" -; 0x1666c -UnknownText_0x1666c: ; 0x1666c +UnknownText_0x1666c: ; Do you want to save some money? text_jump UnknownText_0x1bd999 db "@" -; 0x16671 -UnknownText_0x16671: ; 0x16671 +UnknownText_0x16671: ; You haven't saved that much. text_jump UnknownText_0x1bd9ba db "@" -; 0x16676 -UnknownText_0x16676: ; 0x16676 +UnknownText_0x16676: ; You can't take that much. text_jump UnknownText_0x1bd9d7 db "@" -; 0x1667b -UnknownText_0x1667b: ; 0x1667b +UnknownText_0x1667b: ; You don't have that much. text_jump UnknownText_0x1bd9f1 db "@" -; 0x16680 -UnknownText_0x16680: ; 0x16680 +UnknownText_0x16680: ; You can't save that much. text_jump UnknownText_0x1bda0b db "@" -; 0x16685 -UnknownText_0x16685: ; 0x16685 +UnknownText_0x16685: ; OK, I'll save your money. Trust me! , stick with it! text_jump UnknownText_0x1bda25 db "@" -; 0x1668a -UnknownText_0x1668a: ; 0x1668a +UnknownText_0x1668a: ; Your money's safe here! Get going! text_jump UnknownText_0x1bda5b db "@" -; 0x1668f -UnknownText_0x1668f: ; 0x1668f +UnknownText_0x1668f: ; , don't give up! text_jump UnknownText_0x1bda7e db "@" -; 0x16694 -UnknownText_0x16694: ; 0x16694 +UnknownText_0x16694: ; Just do what you can. text_jump UnknownText_0x1bda90 db "@" -; 0x16699 -Mom_SavedString: ; 16699 +Mom_SavedString: db "SAVED@" -; 1669f -Mon_WithdrawString: ; 1669f +Mon_WithdrawString: db "WITHDRAW@" -; 166a8 -Mom_DepositString: ; 166a8 +Mom_DepositString: db "DEPOSIT@" -; 166b0 -Mom_HeldString: ; 166b0 +Mom_HeldString: db "HELD@" -; 166b5 -MenuHeader_0x166b5: ; 0x166b5 +MenuHeader_0x166b5: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, 10, 10 dw MenuData_0x166bd db 1 ; default option -; 0x166bd -MenuData_0x166bd: ; 0x166bd +MenuData_0x166bd: db STATICMENU_CURSOR ; flags db 4 ; items db "GET@" db "SAVE@" db "CHANGE@" db "CANCEL@" -; 0x166d6 diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index de19a3674..dc10ede35 100644 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -5,7 +5,7 @@ const_value = 1 const MOM_ITEM const MOM_DOLL -MomTriesToBuySomething:: ; fcfec +MomTriesToBuySomething:: ld a, [wMapReentryScriptQueueFlag] and a ret nz @@ -23,14 +23,12 @@ MomTriesToBuySomething:: ; fcfec farcall LoadScriptBDE scf ret -; fd00f -.Script: ; 0xfd00f +.Script: callasm .ASMFunction farjump Script_ReceivePhoneCall -; 0xfd017 -.ASMFunction: ; fd017 +.ASMFunction: call MomBuysItem_DeductFunds call Mom_GetScriptPointer ld a, [wWhichMomItemSet] @@ -56,9 +54,8 @@ MomTriesToBuySomething:: ; fcfec ld a, d ld [hl], a ret -; fd044 -CheckBalance_MomItem2: ; fd044 +CheckBalance_MomItem2: ld a, [wWhichMomItem] cp NUM_MOM_ITEMS_2 jr nc, .nope @@ -115,10 +112,8 @@ CheckBalance_MomItem2: ; fd044 ld bc, hMoneyTemp farcall AddMoney ret -; fd0a6 - -MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) +MomBuysItem_DeductFunds: call GetItemFromMom ld de, 3 ; cost add hl, de @@ -133,8 +128,7 @@ MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) farcall TakeMoney ret - -Mom_GiveItemOrDoll: ; fd0c3 +Mom_GiveItemOrDoll: call GetItemFromMom ld de, 6 ; item type add hl, de @@ -156,10 +150,8 @@ Mom_GiveItemOrDoll: ; fd0c3 ld hl, wPCItems call ReceiveItem ret -; fd0eb - -Mom_GetScriptPointer: ; fd0eb (3f:50eb) +Mom_GetScriptPointer: call GetItemFromMom ld de, 6 ; item type add hl, de @@ -169,26 +161,22 @@ Mom_GetScriptPointer: ; fd0eb (3f:50eb) ret z ld de, .DollScript ret -; fd0fd (3f:50fd) -.ItemScript: ; 0xfd0fd +.ItemScript: writetext _MomText_HiHowAreYou writetext _MomText_FoundAnItem writetext _MomText_BoughtWithYourMoney writetext _MomText_ItsInPC end -; 0xfd10a -.DollScript: ; 0xfd10a +.DollScript: writetext _MomText_HiHowAreYou writetext _MomText_FoundADoll writetext _MomText_BoughtWithYourMoney writetext _MomText_ItsInRoom end -; 0xfd117 - -GetItemFromMom: ; fd117 +GetItemFromMom: ld a, [wWhichMomItemSet] and a jr z, .zero @@ -213,52 +201,44 @@ rept 3 ; multiply hl by 8 endr add hl, de ret -; fd136 INCLUDE "data/items/mom_phone.asm" db 0, 0, 0 ; unused -_MomText_HiHowAreYou: ; 0xfd1b1 +_MomText_HiHowAreYou: ; Hi, ! How are you? text_jump UnknownText_0x1bc615 db "@" -; 0xfd1b6 -_MomText_FoundAnItem: ; 0xfd1b6 +_MomText_FoundAnItem: ; I found a useful item shopping, so text_jump UnknownText_0x1bc62a db "@" -; 0xfd1bb -_MomText_BoughtWithYourMoney: ; 0xfd1bb +_MomText_BoughtWithYourMoney: ; I bought it with your money. Sorry! text_jump UnknownText_0x1bc64e db "@" -; 0xfd1c0 -_MomText_ItsInPC: ; 0xfd1c0 +_MomText_ItsInPC: ; It's in your PC. You'll like it! text_jump UnknownText_0x1bc673 db "@" -; 0xfd1c5 -_MomText_FoundADoll: ; 0xfd1c5 +_MomText_FoundADoll: ; While shopping today, I saw this adorable doll, so text_jump UnknownText_0x1bc693 db "@" -; 0xfd1ca -_MomText_ItsInRoom: ; 0xfd1ca +_MomText_ItsInRoom: ; It's in your room. You'll love it! text_jump UnknownText_0x1bc6c7 db "@" -; 0xfd1cf db 0 ; unused -DummyPredef3A: ; fd1d0 +DummyPredef3A: ret -; fd1d1 ret ; unused diff --git a/engine/events/money.asm b/engine/events/money.asm index 585c85618..c8f9d058e 100644 --- a/engine/events/money.asm +++ b/engine/events/money.asm @@ -1,4 +1,4 @@ -GiveMoney:: ; 15fd7 +GiveMoney:: ld a, 3 call AddMoney ld bc, MaxMoney @@ -21,14 +21,11 @@ GiveMoney:: ; 15fd7 .not_maxed_out and a ret -; 15ff7 -MaxMoney: ; 15ff7 +MaxMoney: dt MAX_MONEY -; 15ffa - -TakeMoney:: ; 15ffa +TakeMoney:: ld a, 3 call SubtractMoney jr nc, .okay @@ -45,11 +42,10 @@ TakeMoney:: ; 15ffa .okay and a ret -; 1600b -CompareMoney:: ; 1600b +CompareMoney:: ld a, 3 -CompareFunds: ; 1600d +CompareFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -94,11 +90,10 @@ CompareFunds: ; 1600d pop de pop hl ret -; 16035 -SubtractMoney: ; 16035 +SubtractMoney: ld a, 3 -SubtractFunds: ; 16037 +SubtractFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -130,11 +125,10 @@ SubtractFunds: ; 16037 pop de pop hl ret -; 16053 -AddMoney: ; 16053 +AddMoney: ld a, 3 -AddFunds: ; 16055 +AddFunds: ; a: number of bytes ; bc: start addr of amount (big-endian) ; de: start addr of account (big-endian) @@ -167,9 +161,8 @@ AddFunds: ; 16055 pop de pop hl ret -; 1606f -GiveCoins:: ; 1606f +GiveCoins:: ld a, 2 ld de, wCoins call AddFunds @@ -189,14 +182,11 @@ GiveCoins:: ; 1606f .not_maxed and a ret -; 1608d -.maxcoins ; 1608d +.maxcoins bigdw MAX_COINS -; 1608f - -TakeCoins:: ; 1608f +TakeCoins:: ld a, 2 ld de, wCoins call SubtractFunds @@ -212,10 +202,8 @@ TakeCoins:: ; 1608f .okay and a ret -; 160a1 -CheckCoins:: ; 160a1 +CheckCoins:: ld a, 2 ld de, wCoins jp CompareFunds -; 160a9 diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index f75bc44dd..f2b827227 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -59,55 +59,47 @@ MoveDeletion: call PrintText ret -.OnlyOneMoveText: ; 0x2c5d1 +.OnlyOneMoveText: ; That #MON knows only one move. text_jump UnknownText_0x1c5eba db "@" -; 0x2c5d6 -.ConfirmDeleteText: ; 0x2c5d6 +.ConfirmDeleteText: ; Oh, make it forget @ ? text_jump UnknownText_0x1c5eda db "@" -; 0x2c5db -.MoveDeletedText: ; 0x2c5db +.MoveDeletedText: ; Done! Your #MON forgot the move. text_jump UnknownText_0x1c5ef5 db "@" -; 0x2c5e0 -.EggText: ; 0x2c5e0 +.EggText: ; An EGG doesn't know any moves! text_jump UnknownText_0x1c5f17 db "@" -; 0x2c5e5 -.DeclinedDeletionText: ; 0x2c5e5 +.DeclinedDeletionText: ; No? Come visit me again. text_jump UnknownText_0x1c5f36 db "@" -; 0x2c5ea -.AskWhichMoveText: ; 0x2c5ea +.AskWhichMoveText: ; Which move should it forget, then? text_jump UnknownText_0x1c5f50 db "@" -; 0x2c5ef -.IntroText: ; 0x2c5ef +.IntroText: ; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget? text_jump UnknownText_0x1c5f74 db "@" -; 0x2c5f4 -.AskWhichMonText: ; 0x2c5f4 +.AskWhichMonText: ; Which #MON? text_jump UnknownText_0x1c5fd1 db "@" -; 0x2c5f9 -.DeleteMove: ; 2c5f9 +.DeleteMove: ld a, b push bc dec a diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index c11fe2fa1..67d0ca528 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -1,4 +1,4 @@ -MoveTutor: ; 4925b +MoveTutor: call FadeToMenu call ClearBGPalettes call ClearScreen @@ -33,7 +33,7 @@ MoveTutor: ; 4925b call CloseSubmenu ret -.GetMoveTutorMove: ; 492a5 +.GetMoveTutorMove: ld a, [wScriptVar] cp MOVETUTOR_FLAMETHROWER jr z, .flamethrower @@ -51,7 +51,7 @@ MoveTutor: ; 4925b ld a, THUNDERBOLT ret -CheckCanLearnMoveTutorMove: ; 492b9 +CheckCanLearnMoveTutorMove: ld hl, .MenuHeader call LoadMenuHeader @@ -98,6 +98,6 @@ CheckCanLearnMoveTutorMove: ; 492b9 scf ret -.MenuHeader: ; 0x4930a +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index aae070ca2..593d51c69 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -1,4 +1,4 @@ -_NameRater: ; fb6ed +_NameRater: ; Introduce himself ld hl, NameRaterIntroText call PrintText @@ -77,9 +77,8 @@ _NameRater: ; fb6ed .done call PrintText ret -; fb78a -CheckIfMonIsYourOT: ; fb78a +CheckIfMonIsYourOT: ; Checks to see if the partymon loaded in [wCurPartyMon] has the different OT as you. Returns carry if not. ld hl, wPartyMonOT ld bc, NAME_LENGTH @@ -110,9 +109,8 @@ CheckIfMonIsYourOT: ; fb78a .nope scf ret -; fb7be -IsNewNameEmpty: ; fb7be +IsNewNameEmpty: ; Checks to see if the nickname loaded in wStringBuffer2 is empty. If so, return carry. ld hl, wStringBuffer2 ld c, MON_NAME_LENGTH - 1 @@ -132,9 +130,8 @@ IsNewNameEmpty: ; fb7be .nonspace and a ret -; fb7d3 -CompareNewToOld: ; fb7d3 +CompareNewToOld: ; Compares the nickname in wStringBuffer2 to the previous nickname. If they are the same, return carry. ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH @@ -167,9 +164,8 @@ CompareNewToOld: ; fb7d3 .terminator scf ret -; fb802 -GetNicknameLength: ; fb802 +GetNicknameLength: ; Gets the length of the name starting at hl and returns it in c. ld c, 0 .loop @@ -181,70 +177,59 @@ GetNicknameLength: ; fb802 cp MON_NAME_LENGTH - 1 jr nz, .loop ret -; fb80f -NameRaterIntroText: ; 0xfb80f +NameRaterIntroText: ; Hello, hello! I'm the NAME RATER. ; I rate the names of #MON. ; Would you like me to rate names? text_jump UnknownText_0x1c0043 db "@" -; 0xfb814 -NameRaterWhichMonText: ; 0xfb814 +NameRaterWhichMonText: ; Which #MON's nickname should I rate for you? text_jump UnknownText_0x1c00a0 db "@" -; 0xfb819 -NameRaterIsGoodText: ; 0xfb819 +NameRaterIsGoodText: ; Hm… @ … That's a fairly decent name. ; But, how about a slightly better nickname? ; Want me to give it a better name? text_jump UnknownText_0x1c00cd db "@" -; 0xfb81e -NameRaterWhichNameText: ; 0xfb81e +NameRaterWhichNameText: ; All right. What name should we give it, then? text_jump UnknownText_0x1c0142 db "@" -; 0xfb823 -NameRaterEvenBetterText: ; 0xfb823 +NameRaterEvenBetterText: ; That's a better name than before! Well done! text_jump UnknownText_0x1c0171 db "@" -; 0xfb828 -NameRaterCancelText: ; 0xfb828 +NameRaterCancelText: ; OK, then. Come again sometime. text_jump UnknownText_0x1c019e db "@" -; 0xfb82d -NameRaterTradedText: ; 0xfb82d +NameRaterTradedText: ; Hm… @ ? What a great name! It's perfect. ; Treat @ with loving care. text_jump UnknownText_0x1c01be db "@" -; 0xfb832 -NameRaterEggText: ; 0xfb832 +NameRaterEggText: ; Whoa… That's just an EGG. text_jump UnknownText_0x1c0208 db "@" -; 0xfb837 -NameRaterSameAsBeforeText: ; 0xfb837 +NameRaterSameAsBeforeText: ; It might look the different as before, ; but this new name is much better! Well done! text_jump UnknownText_0x1c0222 db "@" -; 0xfb83c -NameRaterDoneText: ; 0xfb83c +NameRaterDoneText: ; All right. This #MON is now named @ . text_jump UnknownText_0x1c0272 db "@" -; 0xfb841 diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index d3991a28c..9cff40a2b 100644 --- a/engine/events/npc_trade.asm +++ b/engine/events/npc_trade.asm @@ -1,4 +1,4 @@ -NPCTrade:: ; fcba8 +NPCTrade:: ld a, e ld [wJumptableIndex], a call Trade_GetDialog @@ -51,9 +51,8 @@ NPCTrade:: ; fcba8 .done call PrintTradeText ret -; fcc07 -.TradeAnimation: ; fcc07 +.TradeAnimation: call DisableSpriteUpdates ld a, [wJumptableIndex] push af @@ -66,9 +65,8 @@ NPCTrade:: ; fcba8 ld [wJumptableIndex], a call ReturnToMapWithSpeechTextbox ret -; fcc23 -CheckTradeGender: ; fcc23 +CheckTradeGender: xor a ld [wMonType], a @@ -95,9 +93,8 @@ CheckTradeGender: ; fcc23 .not_matching scf ret -; fcc4a -TradeFlagAction: ; fcc4a +TradeFlagAction: ld hl, wTradeFlags ld a, [wJumptableIndex] ld c, a @@ -105,17 +102,15 @@ TradeFlagAction: ; fcc4a ld a, c and a ret -; fcc59 -Trade_GetDialog: ; fcc59 +Trade_GetDialog: ld e, NPCTRADE_DIALOG call GetTradeAttribute ld a, [hl] ld [wcf64], a ret -; fcc63 -DoNPCTrade: ; fcc63 +DoNPCTrade: ld e, NPCTRADE_GIVEMON call GetTradeAttribute ld a, [hl] @@ -275,10 +270,8 @@ DoNPCTrade: ; fcc63 pop bc pop af ret -; fcdc2 - -GetTradeAttribute: ; 0xfcdc2 +GetTradeAttribute: ld d, 0 push de ld a, [wJumptableIndex] @@ -292,73 +285,64 @@ GetTradeAttribute: ; 0xfcdc2 pop de add hl, de ret -; 0xfcdd7 -Trade_GetAttributeOfCurrentPartymon: ; fcdd7 +Trade_GetAttributeOfCurrentPartymon: ld a, [wCurPartyMon] call AddNTimes ret -; fcdde -Trade_GetAttributeOfLastPartymon: ; fcdde +Trade_GetAttributeOfLastPartymon: ld a, [wPartyCount] dec a call AddNTimes ld e, l ld d, h ret -; fcde8 -GetTradeMonName: ; fcde8 +GetTradeMonName: push de ld [wd265], a call GetBasePokemonName ld hl, wStringBuffer1 pop de ret -; fcdf4 -CopyTradeName: ; fcdf4 +CopyTradeName: ld bc, NAME_LENGTH call CopyBytes ret -; fcdfb -Unreferenced_Functionfcdfb: ; fcdfb +Unreferenced_Functionfcdfb: ld bc, 4 call CopyBytes ld a, "@" ld [de], a ret -; fce05 -Unreferenced_Functionfce05: ; fce05 +Unreferenced_Functionfce05: ld bc, 3 call CopyBytes ld a, "@" ld [de], a ret -; fce0f -Trade_CopyTwoBytes: ; fce0f +Trade_CopyTwoBytes: ld a, [hli] ld [de], a inc de ld a, [hl] ld [de], a ret -; fce15 -Trade_CopyTwoBytesReverseEndian: ; fce15 +Trade_CopyTwoBytesReverseEndian: ld a, [hli] ld [de], a dec de ld a, [hl] ld [de], a ret -; fce1b -GetTradeMonNames: ; fce1b +GetTradeMonNames: ld e, NPCTRADE_GETMON call GetTradeAttribute ld a, [hl] @@ -398,13 +382,10 @@ GetTradeMonNames: ; fce1b ld [hli], a ld [hl], "@" ret -; fce58 - INCLUDE "data/events/npc_trades.asm" - -PrintTradeText: ; fcf38 +PrintTradeText: push af call GetTradeMonNames pop af @@ -420,9 +401,8 @@ PrintTradeText: ; fcf38 ld l, a call PrintText ret -; fcf53 -TradeTexts: ; fcf53 +TradeTexts: ; entries correspond to TRADE_DIALOG_* × TRADE_DIALOGSET_* constants ; TRADE_DIALOG_INTRO dw TradeIntroText1 @@ -449,17 +429,13 @@ TradeTexts: ; fcf53 dw TradeAfterText2 dw TradeAfterText3 dw TradeAfterText4 -; fcf7b - -ConnectLinkCableText: ; 0xfcf7b +ConnectLinkCableText: ; OK, connect the Game Link Cable. text_jump UnknownText_0x1bd407 db "@" -; 0xfcf80 - -TradedForText: ; 0xfcf80 +TradedForText: ; traded givemon for getmon text_jump UnknownText_0x1bd429 start_asm @@ -474,113 +450,91 @@ TradedForText: ; 0xfcf80 ; interpret_data text_jump UnknownText_0x1bd445 db "@" -; 0xfcf97 - -TradeIntroText1: ; 0xfcf97 +TradeIntroText1: ; I collect #MON. Do you have @ ? Want to trade it for my @ ? text_jump UnknownText_0x1bd449 db "@" -; 0xfcf9c -TradeCancelText1: ; 0xfcf9c +TradeCancelText1: ; You don't want to trade? Aww… text_jump UnknownText_0x1bd48c db "@" -; 0xfcfa1 -TradeWrongText1: ; 0xfcfa1 +TradeWrongText1: ; Huh? That's not @ . What a letdown… text_jump UnknownText_0x1bd4aa db "@" -; 0xfcfa6 -TradeCompleteText1: ; 0xfcfa6 +TradeCompleteText1: ; Yay! I got myself @ ! Thanks! text_jump UnknownText_0x1bd4d2 db "@" -; 0xfcfab -TradeAfterText1: ; 0xfcfab +TradeAfterText1: ; Hi, how's my old @ doing? text_jump UnknownText_0x1bd4f4 db "@" -; 0xfcfb0 - TradeIntroText2: -TradeIntroText3: ; 0xfcfb0 +TradeIntroText3: ; Hi, I'm looking for this #MON. If you have @ , would you trade it for my @ ? text_jump UnknownText_0x1bd512 db "@" -; 0xfcfb5 TradeCancelText2: -TradeCancelText3: ; 0xfcfb5 +TradeCancelText3: ; You don't have one either? Gee, that's really disappointing… text_jump UnknownText_0x1bd565 db "@" -; 0xfcfba TradeWrongText2: -TradeWrongText3: ; 0xfcfba +TradeWrongText3: ; You don't have @ ? That's too bad, then. text_jump UnknownText_0x1bd5a1 db "@" -; 0xfcfbf -TradeCompleteText2: ; 0xfcfbf +TradeCompleteText2: ; Great! Thank you! I finally got @ . text_jump UnknownText_0x1bd5cc db "@" -; 0xfcfc4 -TradeAfterText2: ; 0xfcfc4 +TradeAfterText2: ; Hi! The @ you traded me is doing great! text_jump UnknownText_0x1bd5f4 db "@" -; 0xfcfc9 - -TradeIntroText4: ; 0xfcfc9 +TradeIntroText4: ; 's cute, but I don't have it. Do you have @ ? Want to trade it for my @ ? text_jump UnknownText_0x1bd621 db "@" -; 0xfcfce -TradeCancelText4: ; 0xfcfce +TradeCancelText4: ; You don't want to trade? Oh, darn… text_jump UnknownText_0x1bd673 db "@" -; 0xfcfd3 -TradeWrongText4: ; 0xfcfd3 +TradeWrongText4: ; That's not @ . Please trade with me if you get one. text_jump UnknownText_0x1bd696 db "@" -; 0xfcfd8 -TradeCompleteText4: ; 0xfcfd8 +TradeCompleteText4: ; Wow! Thank you! I always wanted @ ! text_jump UnknownText_0x1bd6cd db "@" -; 0xfcfdd -TradeAfterText4: ; 0xfcfdd +TradeAfterText4: ; How is that @ I traded you doing? Your @ 's so cute! text_jump UnknownText_0x1bd6f5 db "@" -; 0xfcfe2 - -TradeCompleteText3: ; 0xfcfe2 +TradeCompleteText3: ; Uh? What happened? text_jump UnknownText_0x1bd731 db "@" -; 0xfcfe7 -TradeAfterText3: ; 0xfcfe7 +TradeAfterText3: ; Trading is so odd… I still have a lot to learn about it. text_jump UnknownText_0x1bd745 db "@" -; 0xfcfec diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 3e58c2677..a6b244b1d 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -1,4 +1,4 @@ -_GiveOddEgg: ; 1fb4b6 +_GiveOddEgg: ; Figure out which egg to give. ; Compare a random word to @@ -39,7 +39,7 @@ _GiveOddEgg: ; 1fb4b6 .done ld hl, OddEggs - ld a, OddEgg2 - OddEgg1 + ld a, OddEgg1End - OddEgg1 call AddNTimes ld de, wOddEggSpecies @@ -88,7 +88,6 @@ _GiveOddEgg: ; 1fb4b6 ld [wMobileMonNicknamePointerBuffer + 1], a farcall AddMobileMonToParty ret -; 1fb546 .Odd: db "ODD@@@@@@@@@" diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index f9d67f0bd..e57635fef 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -1,11 +1,11 @@ -FieldMoveJumptableReset: ; c6ea +FieldMoveJumptableReset: xor a ld hl, wBuffer1 ld bc, 7 call ByteFill ret -FieldMoveJumptable: ; c6f5 +FieldMoveJumptable: ld a, [wBuffer1] rst JumpTable ld [wBuffer1], a @@ -19,7 +19,7 @@ FieldMoveJumptable: ; c6f5 scf ret -GetPartyNick: ; c706 +GetPartyNick: ; write wCurPartyMon nickname to wStringBuffer1-3 ld hl, wPartyMonNicknames ld a, BOXMON @@ -33,7 +33,7 @@ GetPartyNick: ; c706 call CopyName2 ret -CheckEngineFlag: ; c721 +CheckEngineFlag: ; Check engine flag de ; Return carry if flag is not set ld b, CHECK_FLAG @@ -47,7 +47,7 @@ CheckEngineFlag: ; c721 xor a ret -CheckBadge: ; c731 +CheckBadge: ; Check engine flag a (ENGINE_ZEPHYRBADGE thru ENGINE_EARTHBADGE) ; Display "Badge required" text and return carry if the badge is not owned call CheckEngineFlag @@ -57,13 +57,13 @@ CheckBadge: ; c731 scf ret -.BadgeRequiredText: ; c73d +.BadgeRequiredText: ; Sorry! A new BADGE ; is required. text_jump _BadgeRequiredText db "@" -CheckPartyMove: ; c742 +CheckPartyMove: ; Check if a monster in your party has move d. ld e, 0 @@ -107,17 +107,17 @@ CheckPartyMove: ; c742 scf ret -FieldMoveFailed: ; c779 +FieldMoveFailed: ld hl, .CantUseHere call MenuTextBoxBackup ret -.CantUseHere: ; 0xc780 +.CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c05c8 db "@" -CutFunction: ; c785 +CutFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -127,12 +127,12 @@ CutFunction: ; c785 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; c796 (3:4796) +.Jumptable: dw .CheckAble dw .DoCut dw .FailCut -.CheckAble: ; c79c (3:479c) +.CheckAble: ld de, ENGINE_HIVEBADGE call CheckBadge jr c, .nohivebadge @@ -149,29 +149,29 @@ CutFunction: ; c785 ld a, $2 ret -.DoCut: ; c7b2 (3:47b2) +.DoCut: ld hl, Script_CutFromMenu call QueueScript ld a, $81 ret -.FailCut: ; c7bb (3:47bb) +.FailCut: ld hl, Text_NothingToCut call MenuTextBoxBackup ld a, $80 ret -Text_UsedCut: ; 0xc7c4 +Text_UsedCut: ; used CUT! text_jump UnknownText_0x1c05dd db "@" -Text_NothingToCut: ; 0xc7c9 +Text_NothingToCut: ; There's nothing to CUT here. text_jump UnknownText_0x1c05ec db "@" -CheckMapForSomethingToCut: ; c7ce +CheckMapForSomethingToCut: ; Does the collision data of the facing tile permit cutting? call GetFacingTileCoord ld c, a @@ -206,11 +206,11 @@ CheckMapForSomethingToCut: ; c7ce scf ret -Script_CutFromMenu: ; c7fe +Script_CutFromMenu: reloadmappart special UpdateTimePals -Script_Cut: ; 0xc802 +Script_Cut: callasm GetPartyNick writetext Text_UsedCut reloadmappart @@ -218,7 +218,7 @@ Script_Cut: ; 0xc802 closetext end -CutDownTreeOrGrass: ; c810 +CutDownTreeOrGrass: ld hl, wBuffer3 ; OverworldMapTile ld a, [hli] ld h, [hl] @@ -240,7 +240,7 @@ CutDownTreeOrGrass: ; c810 call LoadStandardFont ret -CheckOverworldTileArrays: ; c840 +CheckOverworldTileArrays: ; Input: c contains the tile you're facing ; Output: Replacement tile in b and effect on wild encounters in c, plus carry set. ; Carry is not set if the facing tile cannot be replaced, or if the tileset @@ -276,17 +276,15 @@ CheckOverworldTileArrays: ; c840 xor a ret - INCLUDE "data/events/field_move_blocks.asm" - -OWFlash: ; c8ac +OWFlash: call .CheckUseFlash and $7f ld [wFieldMoveSucceeded], a ret -.CheckUseFlash: ; c8b5 +.CheckUseFlash: ; Flash ld de, ENGINE_ZEPHYRBADGE farcall CheckBadge @@ -312,11 +310,11 @@ OWFlash: ; c8ac ld a, $80 ret -UseFlash: ; c8e0 +UseFlash: ld hl, Script_UseFlash jp QueueScript -Script_UseFlash: ; 0xc8e6 +Script_UseFlash: reloadmappart special UpdateTimePals writetext UnknownText_0xc8f3 @@ -324,7 +322,7 @@ Script_UseFlash: ; 0xc8e6 closetext end -UnknownText_0xc8f3: ; 0xc8f3 +UnknownText_0xc8f3: text_jump UnknownText_0x1c0609 start_asm call WaitSFX @@ -334,10 +332,10 @@ UnknownText_0xc8f3: ; 0xc8f3 ld hl, .BlankText ret -.BlankText: ; 0xc908 +.BlankText: db "@" -SurfFunction: ; c909 +SurfFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -347,13 +345,13 @@ SurfFunction: ; c909 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; c91a (3:491a) +.Jumptable: dw .TrySurf dw .DoSurf dw .FailSurf dw .AlreadySurfing -.TrySurf: ; c922 (3:4922) +.TrySurf: ld de, ENGINE_FOGBADGE call CheckBadge jr c, .asm_c956 @@ -385,7 +383,7 @@ SurfFunction: ; c909 ld a, $2 ret -.DoSurf: ; c95f (3:495f) +.DoSurf: call GetSurfType ld [wBuffer2], a call GetPartyNick @@ -394,22 +392,22 @@ SurfFunction: ; c909 ld a, $81 ret -.FailSurf: ; c971 (3:4971) +.FailSurf: ld hl, CantSurfText call MenuTextBoxBackup ld a, $80 ret -.AlreadySurfing: ; c97a (3:497a) +.AlreadySurfing: ld hl, AlreadySurfingText call MenuTextBoxBackup ld a, $80 ret -SurfFromMenuScript: ; c983 +SurfFromMenuScript: special UpdateTimePals -UsedSurfScript: ; c986 +UsedSurfScript: writetext UsedSurfText ; "used SURF!" waitbutton closetext @@ -426,23 +424,23 @@ UsedSurfScript: ; c986 applymovement PLAYER, wMovementBuffer end -.empty_fn ; c9a2 +.empty_fn farcall StubbedTrainerRankings_Surf ret -UsedSurfText: ; c9a9 +UsedSurfText: text_jump _UsedSurfText db "@" -CantSurfText: ; c9ae +CantSurfText: text_jump _CantSurfText db "@" -AlreadySurfingText: ; c9b3 +AlreadySurfingText: text_jump _AlreadySurfingText db "@" -GetSurfType: ; c9b8 +GetSurfType: ; Surfing on Pikachu uses an alternate sprite. ; This is done by using a separate movement type. @@ -459,7 +457,7 @@ GetSurfType: ; c9b8 ld a, PLAYER_SURF ret -CheckDirection: ; c9cb +CheckDirection: ; Return carry if a tile permission prevents you ; from moving in the direction you're facing. @@ -490,7 +488,7 @@ CheckDirection: ; c9cb db FACE_LEFT db FACE_RIGHT -TrySurfOW:: ; c9e7 +TrySurfOW:: ; Checking a tile in the overworld. ; Return carry if fail is allowed. @@ -538,7 +536,7 @@ TrySurfOW:: ; c9e7 xor a ret -AskSurfScript: ; ca2c +AskSurfScript: opentext writetext AskSurfText yesorno @@ -546,11 +544,11 @@ AskSurfScript: ; ca2c closetext end -AskSurfText: ; ca36 +AskSurfText: text_jump _AskSurfText ; The water is calm. db "@" ; Want to SURF? -FlyFunction: ; ca3b +FlyFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -565,7 +563,7 @@ FlyFunction: ; ca3b dw .DoFly dw .FailFly -.TryFly: ; ca52 +.TryFly: ; Fly ld de, ENGINE_STORMBADGE call CheckBadge @@ -606,18 +604,18 @@ FlyFunction: ; ca3b ld a, $80 ret -.DoFly: ; ca94 +.DoFly: ld hl, .FlyScript call QueueScript ld a, $81 ret -.FailFly: ; ca9d +.FailFly: call FieldMoveFailed ld a, $82 ret -.FlyScript: ; 0xcaa3 +.FlyScript: reloadmappart callasm HideSprites special UpdateTimePals @@ -632,20 +630,20 @@ FlyFunction: ; ca3b callasm .ReturnFromFly end -.ReturnFromFly: ; cacb +.ReturnFromFly: farcall Function561d call DelayFrame call ReplaceKrisSprite farcall LoadOverworldFont ret -WaterfallFunction: ; cade +WaterfallFunction: call .TryWaterfall and $7f ld [wFieldMoveSucceeded], a ret -.TryWaterfall: ; cae7 +.TryWaterfall: ; Waterfall ld de, ENGINE_RISINGBADGE farcall CheckBadge @@ -663,7 +661,7 @@ WaterfallFunction: ; cade ld a, $80 ret -CheckMapCanWaterfall: ; cb07 +CheckMapCanWaterfall: ld a, [wPlayerDirection] and $c cp FACE_UP @@ -678,11 +676,11 @@ CheckMapCanWaterfall: ; cb07 scf ret -Script_WaterfallFromMenu: ; 0xcb1c +Script_WaterfallFromMenu: reloadmappart special UpdateTimePals -Script_UsedWaterfall: ; 0xcb20 +Script_UsedWaterfall: callasm GetPartyNick writetext .Text_UsedWaterfall waitbutton @@ -694,7 +692,7 @@ Script_UsedWaterfall: ; 0xcb20 iffalse .loop end -.CheckContinueWaterfall: ; cb38 +.CheckContinueWaterfall: xor a ld [wScriptVar], a ld a, [wPlayerStandingTile] @@ -705,16 +703,16 @@ Script_UsedWaterfall: ; 0xcb20 ld [wScriptVar], a ret -.WaterfallStep: ; cb4f +.WaterfallStep: turn_waterfall UP step_end -.Text_UsedWaterfall: ; 0xcb51 +.Text_UsedWaterfall: ; used WATERFALL! text_jump UnknownText_0x1c068e db "@" -TryWaterfallOW:: ; cb56 +TryWaterfallOW:: ld d, WATERFALL call CheckPartyMove jr c, .failed @@ -736,15 +734,15 @@ TryWaterfallOW:: ; cb56 scf ret -Script_CantDoWaterfall: ; 0xcb7e +Script_CantDoWaterfall: jumptext .Text_CantDoWaterfall -.Text_CantDoWaterfall: ; 0xcb81 +.Text_CantDoWaterfall: ; Wow, it's a huge waterfall. text_jump UnknownText_0x1c06a3 db "@" -Script_AskWaterfall: ; 0xcb86 +Script_AskWaterfall: opentext writetext .AskUseWaterfall yesorno @@ -752,17 +750,17 @@ Script_AskWaterfall: ; 0xcb86 closetext end -.AskUseWaterfall: ; 0xcb90 +.AskUseWaterfall: ; Do you want to use WATERFALL? text_jump UnknownText_0x1c06bf db "@" -EscapeRopeFunction: ; cb95 +EscapeRopeFunction: call FieldMoveJumptableReset ld a, $1 jr dig_incave -DigFunction: ; cb9c +DigFunction: call FieldMoveJumptableReset ld a, $2 @@ -776,12 +774,12 @@ dig_incave ld [wFieldMoveSucceeded], a ret -.DigTable: ; cbb2 +.DigTable: dw .CheckCanDig dw .DoDig dw .FailDig -.CheckCanDig: ; cbb8 +.CheckCanDig: call GetMapEnvironment cp CAVE jr z, .incave @@ -805,7 +803,7 @@ dig_incave ld a, $1 ret -.DoDig: ; cbd8 +.DoDig: ld hl, wDigWarpNumber ld de, wNextWarp ld bc, 3 @@ -826,7 +824,7 @@ dig_incave ld a, $81 ret -.FailDig: ; cc06 +.FailDig: ld a, [wBuffer2] cp $2 jr nz, .failescaperope @@ -839,33 +837,33 @@ dig_incave ld a, $80 ret -.Text_UsedDig: ; 0xcc1c +.Text_UsedDig: ; used DIG! text_jump UnknownText_0x1c06de db "@" -.Text_UsedEscapeRope: ; 0xcc21 +.Text_UsedEscapeRope: ; used an ESCAPE ROPE. text_jump UnknownText_0x1c06ed db "@" -.Text_CantUseHere: ; 0xcc26 +.Text_CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c0705 db "@" -.UsedEscapeRopeScript: ; 0xcc2b +.UsedEscapeRopeScript: reloadmappart special UpdateTimePals writetext .Text_UsedEscapeRope jump .UsedDigOrEscapeRopeScript -.UsedDigScript: ; 0xcc35 +.UsedDigScript: reloadmappart special UpdateTimePals writetext .Text_UsedDig -.UsedDigOrEscapeRopeScript: ; 0xcc3c +.UsedDigOrEscapeRopeScript: waitbutton closetext playsound SFX_WARP_TO @@ -878,17 +876,17 @@ dig_incave applymovement PLAYER, .DigReturn end -.DigOut: ; 0xcc59 +.DigOut: step_dig 32 hide_object step_end -.DigReturn: ; 0xcc5d +.DigReturn: show_object return_dig 32 step_end -TeleportFunction: ; cc61 +TeleportFunction: call FieldMoveJumptableReset .loop ld hl, .Jumptable @@ -898,12 +896,12 @@ TeleportFunction: ; cc61 ld [wFieldMoveSucceeded], a ret -.Jumptable: ; cc72 +.Jumptable: dw .TryTeleport dw .DoTeleport dw .FailTeleport -.TryTeleport: ; cc78 +.TryTeleport: call GetMapEnvironment call CheckOutdoorMap jr z, .CheckIfSpawnPoint @@ -925,30 +923,30 @@ TeleportFunction: ; cc61 ld a, $2 ret -.DoTeleport: ; cc9c +.DoTeleport: call GetPartyNick ld hl, .TeleportScript call QueueScript ld a, $81 ret -.FailTeleport: ; cca8 +.FailTeleport: ld hl, .Text_CantUseHere call MenuTextBoxBackup ld a, $80 ret -.Text_ReturnToLastMonCenter: ; 0xccb1 +.Text_ReturnToLastMonCenter: ; Return to the last #MON CENTER. text_jump UnknownText_0x1c071a db "@" -.Text_CantUseHere: ; 0xccb6 +.Text_CantUseHere: ; Can't use that here. text_jump UnknownText_0x1c073b db "@" -.TeleportScript: ; 0xccbb +.TeleportScript: reloadmappart special UpdateTimePals writetext .Text_ReturnToLastMonCenter @@ -965,21 +963,21 @@ TeleportFunction: ; cc61 applymovement PLAYER, .TeleportTo end -.TeleportFrom: ; cce1 +.TeleportFrom: teleport_from step_end -.TeleportTo: ; cce3 +.TeleportTo: teleport_to step_end -StrengthFunction: ; cce5 +StrengthFunction: call .TryStrength and $7f ld [wFieldMoveSucceeded], a ret -.TryStrength: ; ccee +.TryStrength: ; Strength ld de, ENGINE_PLAINBADGE call CheckBadge @@ -992,21 +990,21 @@ StrengthFunction: ; cce5 ld a, $80 ret -.JumpText: ; 0xcd01 +.JumpText: text_jump UnknownText_0x1c0751 db "@" -.Failed: ; cd06 +.Failed: ld a, $80 ret -.UseStrength: ; cd09 +.UseStrength: ld hl, Script_StrengthFromMenu call QueueScript ld a, $81 ret -SetStrengthFlag: ; cd12 +SetStrengthFlag: ld hl, wBikeFlags set BIKEFLAGS_STRENGTH_ACTIVE_F, [hl] ld a, [wCurPartyMon] @@ -1019,11 +1017,11 @@ SetStrengthFlag: ; cd12 call GetPartyNick ret -Script_StrengthFromMenu: ; 0xcd29 +Script_StrengthFromMenu: reloadmappart special UpdateTimePals -Script_UsedStrength: ; 0xcd2d +Script_UsedStrength: callasm SetStrengthFlag writetext .UsedStrength copybytetovar wBuffer6 @@ -1033,11 +1031,11 @@ Script_UsedStrength: ; 0xcd2d closetext end -.UsedStrength: ; 0xcd41 +.UsedStrength: text_jump UnknownText_0x1c0774 db "@" -.StrengthAllowedItToMoveBoulders: ; 0xcd46 +.StrengthAllowedItToMoveBoulders: text_jump UnknownText_0x1c0788 db "@" @@ -1047,13 +1045,13 @@ AskStrengthScript: ifequal $1, .DontMeetRequirements jump .AlreadyUsedStrength -.DontMeetRequirements: ; 0xcd59 +.DontMeetRequirements: jumptext UnknownText_0xcd73 -.AlreadyUsedStrength: ; 0xcd5c +.AlreadyUsedStrength: jumptext UnknownText_0xcd6e -.AskStrength: ; 0xcd5f +.AskStrength: opentext writetext UnknownText_0xcd69 yesorno @@ -1061,22 +1059,22 @@ AskStrengthScript: closetext end -UnknownText_0xcd69: ; 0xcd69 +UnknownText_0xcd69: ; A #MON may be able to move this. Want to use STRENGTH? text_jump UnknownText_0x1c07a0 db "@" -UnknownText_0xcd6e: ; 0xcd6e +UnknownText_0xcd6e: ; Boulders may now be moved! text_jump UnknownText_0x1c07d8 db "@" -UnknownText_0xcd73: ; 0xcd73 +UnknownText_0xcd73: ; A #MON may be able to move this. text_jump UnknownText_0x1c07f4 db "@" -TryStrengthOW: ; cd78 +TryStrengthOW: ld d, STRENGTH call CheckPartyMove jr c, .nope @@ -1104,7 +1102,7 @@ TryStrengthOW: ; cd78 ld [wScriptVar], a ret -WhirlpoolFunction: ; cd9d +WhirlpoolFunction: call FieldMoveJumptableReset .loop ld hl, Jumptable_cdae @@ -1114,12 +1112,12 @@ WhirlpoolFunction: ; cd9d ld [wFieldMoveSucceeded], a ret -Jumptable_cdae: ; cdae +Jumptable_cdae: dw .TryWhirlpool dw .DoWhirlpool dw .FailWhirlpool -.TryWhirlpool: ; cdb4 +.TryWhirlpool: ld de, ENGINE_GLACIERBADGE call CheckBadge jr c, .noglacierbadge @@ -1136,23 +1134,23 @@ Jumptable_cdae: ; cdae ld a, $80 ret -.DoWhirlpool: ; cdca +.DoWhirlpool: ld hl, Script_WhirlpoolFromMenu call QueueScript ld a, $81 ret -.FailWhirlpool: ; cdd3 +.FailWhirlpool: call FieldMoveFailed ld a, $80 ret -Text_UsedWhirlpool: ; 0xcdd9 +Text_UsedWhirlpool: ; used WHIRLPOOL! text_jump UnknownText_0x1c0816 db "@" -TryWhirlpoolMenu: ; cdde +TryWhirlpoolMenu: call GetFacingTileCoord ld c, a push de @@ -1181,11 +1179,11 @@ TryWhirlpoolMenu: ; cdde scf ret -Script_WhirlpoolFromMenu: ; 0xce0b +Script_WhirlpoolFromMenu: reloadmappart special UpdateTimePals -Script_UsedWhirlpool: ; 0xce0f +Script_UsedWhirlpool: callasm GetPartyNick writetext Text_UsedWhirlpool reloadmappart @@ -1193,7 +1191,7 @@ Script_UsedWhirlpool: ; 0xce0f closetext end -DisappearWhirlpool: ; ce1d +DisappearWhirlpool: ld hl, wBuffer3 ld a, [hli] ld h, [hl] @@ -1210,7 +1208,7 @@ DisappearWhirlpool: ; ce1d call GetMovementPermissions ret -TryWhirlpoolOW:: ; ce3e +TryWhirlpoolOW:: ld d, WHIRLPOOL call CheckPartyMove jr c, .failed @@ -1232,14 +1230,14 @@ TryWhirlpoolOW:: ; ce3e scf ret -Script_MightyWhirlpool: ; 0xce66 +Script_MightyWhirlpool: jumptext .MightyWhirlpoolText -.MightyWhirlpoolText: ; 0xce69 +.MightyWhirlpoolText: text_jump UnknownText_0x1c082b db "@" -Script_AskWhirlpoolOW: ; 0xce6e +Script_AskWhirlpoolOW: opentext writetext UnknownText_0xce78 yesorno @@ -1247,17 +1245,17 @@ Script_AskWhirlpoolOW: ; 0xce6e closetext end -UnknownText_0xce78: ; 0xce78 +UnknownText_0xce78: text_jump UnknownText_0x1c0864 db "@" -HeadbuttFunction: ; ce7d +HeadbuttFunction: call TryHeadbuttFromMenu and $7f ld [wFieldMoveSucceeded], a ret -TryHeadbuttFromMenu: ; ce86 +TryHeadbuttFromMenu: call GetFacingTileCoord call CheckHeadbuttTreeTile jr nz, .no_tree @@ -1272,21 +1270,21 @@ TryHeadbuttFromMenu: ; ce86 ld a, $80 ret -UnknownText_0xce9d: ; 0xce9d +UnknownText_0xce9d: ; did a HEADBUTT! text_jump UnknownText_0x1c0897 db "@" -UnknownText_0xcea2: ; 0xcea2 +UnknownText_0xcea2: ; Nope. Nothing… text_jump UnknownText_0x1c08ac db "@" -HeadbuttFromMenuScript: ; 0xcea7 +HeadbuttFromMenuScript: reloadmappart special UpdateTimePals -HeadbuttScript: ; 0xceab +HeadbuttScript: callasm GetPartyNick writetext UnknownText_0xce9d @@ -1307,7 +1305,7 @@ HeadbuttScript: ; 0xceab closetext end -TryHeadbuttOW:: ; cec9 +TryHeadbuttOW:: ld d, HEADBUTT call CheckPartyMove jr c, .no @@ -1322,7 +1320,7 @@ TryHeadbuttOW:: ; cec9 xor a ret -AskHeadbuttScript: ; 0xcedc +AskHeadbuttScript: opentext writetext UnknownText_0xcee6 yesorno @@ -1330,18 +1328,18 @@ AskHeadbuttScript: ; 0xcedc closetext end -UnknownText_0xcee6: ; 0xcee6 +UnknownText_0xcee6: ; A #MON could be in this tree. Want to HEADBUTT it? text_jump UnknownText_0x1c08bc db "@" -RockSmashFunction: ; ceeb +RockSmashFunction: call TryRockSmashFromMenu and $7f ld [wFieldMoveSucceeded], a ret -TryRockSmashFromMenu: ; cef4 +TryRockSmashFromMenu: call GetFacingObject jr c, .no_rock ld a, d @@ -1358,7 +1356,7 @@ TryRockSmashFromMenu: ; cef4 ld a, $80 ret -GetFacingObject: ; cf0d +GetFacingObject: farcall CheckFacingObject jr nc, .fail @@ -1380,11 +1378,11 @@ GetFacingObject: ; cf0d scf ret -RockSmashFromMenuScript: ; 0xcf2e +RockSmashFromMenuScript: reloadmappart special UpdateTimePals -RockSmashScript: ; cf32 +RockSmashScript: callasm GetPartyNick writetext UnknownText_0xcf58 closetext @@ -1403,15 +1401,15 @@ RockSmashScript: ; cf32 .done end -MovementData_0xcf55: ; 0xcf55 +MovementData_0xcf55: rock_smash 10 step_end -UnknownText_0xcf58: ; 0xcf58 +UnknownText_0xcf58: text_jump UnknownText_0x1c08f0 db "@" -AskRockSmashScript: ; 0xcf5d +AskRockSmashScript: callasm HasRockSmash ifequal 1, .no @@ -1424,17 +1422,17 @@ AskRockSmashScript: ; 0xcf5d .no jumptext UnknownText_0xcf72 -UnknownText_0xcf72: ; 0xcf72 +UnknownText_0xcf72: ; Maybe a #MON can break this. text_jump UnknownText_0x1c0906 db "@" -UnknownText_0xcf77: ; 0xcf77 +UnknownText_0xcf77: ; This rock looks breakable. Want to use ROCK SMASH? text_jump UnknownText_0x1c0924 db "@" -HasRockSmash: ; cf7c +HasRockSmash: ld d, ROCK_SMASH call CheckPartyMove jr nc, .yes @@ -1448,7 +1446,7 @@ HasRockSmash: ; cf7c ld [wScriptVar], a ret -FishFunction: ; cf8e +FishFunction: ld a, e push af call FieldMoveJumptableReset @@ -1462,14 +1460,14 @@ FishFunction: ; cf8e ld [wFieldMoveSucceeded], a ret -.FishTable: ; cfa5 +.FishTable: dw .TryFish dw .FishNoBite dw .FishGotSomething dw .FailFish dw .FishNoFish -.TryFish: ; cfaf +.TryFish: ld a, [wPlayerState] cp PLAYER_SURF jr z, .fail @@ -1510,11 +1508,11 @@ FishFunction: ; cf8e ld a, $1 ret -.FailFish: ; cff1 +.FailFish: ld a, $80 ret -.FishGotSomething: ; cff4 +.FishGotSomething: ld a, $1 ld [wBuffer6], a ld hl, Script_GotABite @@ -1522,7 +1520,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoBite: ; d002 +.FishNoBite: ld a, $2 ld [wBuffer6], a ld hl, Script_NotEvenANibble @@ -1530,7 +1528,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FishNoFish: ; d010 +.FishNoFish: ld a, $0 ld [wBuffer6], a ld hl, Script_NotEvenANibble2 @@ -1538,32 +1536,32 @@ FishFunction: ; cf8e ld a, $81 ret -Script_NotEvenANibble: ; 0xd01e +Script_NotEvenANibble: scall Script_FishCastRod writetext UnknownText_0xd0a9 jump Script_NotEvenANibble_FallThrough -Script_NotEvenANibble2: ; 0xd027 +Script_NotEvenANibble2: scall Script_FishCastRod writetext UnknownText_0xd0a9 -Script_NotEvenANibble_FallThrough: ; 0xd02d +Script_NotEvenANibble_FallThrough: loademote EMOTE_SHADOW callasm PutTheRodAway closetext end -Script_GotABite: ; 0xd035 +Script_GotABite: scall Script_FishCastRod callasm Fishing_CheckFacingUp iffalse .NotFacingUp applymovement PLAYER, .Movement_FacingUp jump .FightTheHookedPokemon -.NotFacingUp: ; 0xd046 +.NotFacingUp: applymovement PLAYER, .Movement_NotFacingUp -.FightTheHookedPokemon: ; 0xd04a +.FightTheHookedPokemon: pause 40 applymovement PLAYER, .Movement_RestoreRod writetext UnknownText_0xd0a4 @@ -1574,7 +1572,7 @@ Script_GotABite: ; 0xd035 reloadmapafterbattle end -.Movement_NotFacingUp: ; d05c +.Movement_NotFacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1582,7 +1580,7 @@ Script_GotABite: ; 0xd035 show_emote step_end -.Movement_FacingUp: ; d062 +.Movement_FacingUp: fish_got_bite fish_got_bite fish_got_bite @@ -1591,12 +1589,12 @@ Script_GotABite: ; 0xd035 show_emote step_end -.Movement_RestoreRod: ; d069 +.Movement_RestoreRod: hide_emote fish_cast_rod step_end -Fishing_CheckFacingUp: ; d06c +Fishing_CheckFacingUp: ld a, [wPlayerDirection] and $c cp OW_UP @@ -1608,7 +1606,7 @@ Fishing_CheckFacingUp: ; d06c ld [wScriptVar], a ret -Script_FishCastRod: ; 0xd07c +Script_FishCastRod: reloadmappart loadvar hBGMapMode, $0 special UpdateTimePals @@ -1619,11 +1617,11 @@ Script_FishCastRod: ; 0xd07c pause 40 end -MovementData_0xd093: ; d093 +MovementData_0xd093: fish_cast_rod step_end -PutTheRodAway: ; d095 +PutTheRodAway: xor a ld [hBGMapMode], a ld a, $1 @@ -1632,12 +1630,12 @@ PutTheRodAway: ; d095 call ReplaceKrisSprite ret -UnknownText_0xd0a4: ; 0xd0a4 +UnknownText_0xd0a4: ; Oh! A bite! text_jump UnknownText_0x1c0958 db "@" -UnknownText_0xd0a9: ; 0xd0a9 +UnknownText_0xd0a9: ; Not even a nibble! text_jump UnknownText_0x1c0965 db "@" @@ -1647,13 +1645,13 @@ UnknownText_0xd0ae: ; unused text_jump UnknownText_0x1c0979 db "@" -BikeFunction: ; d0b3 +BikeFunction: call .TryBike and $7f ld [wFieldMoveSucceeded], a ret -.TryBike: ; d0bc +.TryBike: call .CheckEnvironment jr c, .CannotUseBike ld a, [wPlayerState] @@ -1704,7 +1702,7 @@ BikeFunction: ; d0b3 ld a, $1 ret -.CheckIfRegistered: ; d119 +.CheckIfRegistered: ld a, [wUsingItemWithSelect] and a ret z @@ -1712,7 +1710,7 @@ BikeFunction: ; d0b3 ld l, e ret -.CheckEnvironment: ; d121 +.CheckEnvironment: call GetMapEnvironment call CheckOutdoorMap jr z, .ok @@ -1733,7 +1731,7 @@ BikeFunction: ; d0b3 scf ret -Script_GetOnBike: ; 0xd13e +Script_GetOnBike: reloadmappart special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_BIKE @@ -1743,7 +1741,7 @@ Script_GetOnBike: ; 0xd13e special ReplaceKrisSprite end -Script_GetOnBike_Register: ; 0xd14e +Script_GetOnBike_Register: writecode VAR_MOVEMENT, PLAYER_BIKE closetext special ReplaceKrisSprite @@ -1753,7 +1751,7 @@ Script_GetOnBike_Register: ; 0xd14e nop ret -Script_GetOffBike: ; 0xd158 +Script_GetOffBike: reloadmappart special UpdateTimePals writecode VAR_MOVEMENT, PLAYER_NORMAL @@ -1766,32 +1764,32 @@ FinishGettingOffBike: special PlayMapMusic end -Script_GetOffBike_Register: ; 0xd16b +Script_GetOffBike_Register: writecode VAR_MOVEMENT, PLAYER_NORMAL jump FinishGettingOffBike -Script_CantGetOffBike: ; 0xd171 +Script_CantGetOffBike: writetext .CantGetOffBikeText waitbutton closetext end -.CantGetOffBikeText: ; 0xd177 +.CantGetOffBikeText: ; You can't get off here! text_jump UnknownText_0x1c099a db "@" -GotOnTheBikeText: ; 0xd17c +GotOnTheBikeText: ; got on the @ . text_jump UnknownText_0x1c09b2 db "@" -GotOffTheBikeText: ; 0xd181 +GotOffTheBikeText: ; got off the @ . text_jump UnknownText_0x1c09c7 db "@" -TryCutOW:: ; d186 +TryCutOW:: ld d, CUT call CheckPartyMove jr c, .cant_cut @@ -1813,7 +1811,7 @@ TryCutOW:: ; d186 scf ret -AskCutScript: ; 0xd1a9 +AskCutScript: opentext writetext UnknownText_0xd1c8 yesorno @@ -1824,7 +1822,7 @@ AskCutScript: ; 0xd1a9 closetext end -.CheckMap: ; d1ba +.CheckMap: xor a ld [wScriptVar], a call CheckMapForSomethingToCut @@ -1833,13 +1831,13 @@ AskCutScript: ; 0xd1a9 ld [wScriptVar], a ret -UnknownText_0xd1c8: ; 0xd1c8 +UnknownText_0xd1c8: text_jump UnknownText_0x1c09dd db "@" -CantCutScript: ; 0xd1cd +CantCutScript: jumptext UnknownText_0xd1d0 -UnknownText_0xd1d0: ; 0xd1d0 +UnknownText_0xd1d0: text_jump UnknownText_0x1c0a05 db "@" diff --git a/engine/events/play_slow_cry.asm b/engine/events/play_slow_cry.asm index 1f27a7ca4..6839b3960 100644 --- a/engine/events/play_slow_cry.asm +++ b/engine/events/play_slow_cry.asm @@ -1,4 +1,4 @@ -PlaySlowCry: ; fb841 +PlaySlowCry: ld a, [wScriptVar] call LoadCry jr c, .done @@ -28,4 +28,3 @@ PlaySlowCry: ; fb841 .done ret -; fb877 diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index 5ea094db9..c7ba7660f 100644 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -1,4 +1,4 @@ -DoPoisonStep:: ; 505da +DoPoisonStep:: ld a, [wPartyCount] and a jr z, .no_faint @@ -55,9 +55,8 @@ DoPoisonStep:: ; 505da .no_faint xor a ret -; 5062e -.DamageMonIfPoisoned: ; 5062e +.DamageMonIfPoisoned: ; check if mon is poisoned, return if not ld a, MON_STATUS call GetPartyParamLocation @@ -98,31 +97,27 @@ DoPoisonStep:: ; 505da ld c, %01 scf ret -; 50658 -.PlayPoisonSFX: ; 50658 +.PlayPoisonSFX: ld de, SFX_POISON call PlaySFX ld b, $2 predef LoadPoisonBGPals call DelayFrame ret -; 50669 -.Script_MonFaintedToPoison: ; 50669 +.Script_MonFaintedToPoison: callasm .PlayPoisonSFX opentext callasm .CheckWhitedOut iffalse .whiteout closetext end -; 50677 -.whiteout ; 50677 +.whiteout farjump Script_OverworldWhiteout -; 5067b -.CheckWhitedOut: ; 5067b +.CheckWhitedOut: xor a ld [wCurPartyMon], a ld de, wEngineBuffer2 @@ -149,14 +144,11 @@ DoPoisonStep:: ; 505da ld a, d ld [wScriptVar], a ret -; 506b2 -.PoisonFaintText: ; 506b2 +.PoisonFaintText: text_jump UnknownText_0x1c0acc db "@" -; 506b7 -.PoisonWhiteOutText: ; 506b7 +.PoisonWhiteOutText: text_jump UnknownText_0x1c0ada db "@" -; 506bc diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index c1bfa49f0..354aabb28 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -1,11 +1,11 @@ -LoadPoisonBGPals: ; cbcdd +LoadPoisonBGPals: call .LoadPals ld a, [hCGB] and a ret nz ret ; ???? -.LoadPals: ; cbce5 +.LoadPals: ld a, [hCGB] and a jr nz, .cgb diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index c79298dd0..dc99cb536 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -15,7 +15,7 @@ const SEERACTION_CANT_TELL_2 const SEERACTION_LEVEL_ONLY -PokeSeer: ; 4f0bc +PokeSeer: ld a, SEER_INTRO call PrintSeerText call JoyWaitAorB @@ -47,34 +47,29 @@ PokeSeer: ; 4f0bc ld a, SEER_EGG call PrintSeerText ret -; 4f0ee - -SeerAction: ; 4f0ee +SeerAction: ld a, [wSeerAction] ld hl, SeerActions rst JumpTable ret -; 4f0f6 -SeerActions: ; 4f0f6 +SeerActions: dw SeerAction0 dw SeerAction1 dw SeerAction2 dw SeerAction3 dw SeerAction4 -; 4f100 -SeerAction0: ; 4f100 +SeerAction0: ld a, SEER_MET_AT call PrintSeerText ld a, SEER_TIME_LEVEL call PrintSeerText call SeerAdvice ret -; 4f10e -SeerAction1: ; 4f10e +SeerAction1: call GetCaughtOT ld a, SEER_TRADED call PrintSeerText @@ -82,28 +77,24 @@ SeerAction1: ; 4f10e call PrintSeerText call SeerAdvice ret -; 4f11f -SeerAction2: ; 4f11f +SeerAction2: ld a, SEER_CANT_TELL call PrintSeerText ret -; 4f125 -SeerAction3: ; 4f125 +SeerAction3: ld a, SEER_CANT_TELL call PrintSeerText ret -; 4f12b -SeerAction4: ; 4f12b +SeerAction4: ld a, SEER_LEVEL_ONLY call PrintSeerText call SeerAdvice ret -; 4f134 -ReadCaughtData: ; 4f134 +ReadCaughtData: ld a, MON_CAUGHTDATA call GetPartyParamLocation ld a, [hli] @@ -143,9 +134,8 @@ ReadCaughtData: ; 4f134 ld a, SEERACTION_CANT_TELL_1 ld [wSeerAction], a ret -; 4f176 -GetCaughtName: ; 4f176 +GetCaughtName: ld a, [wCurPartyMon] ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH @@ -154,9 +144,8 @@ GetCaughtName: ; 4f176 ld bc, MON_NAME_LENGTH call CopyBytes ret -; 4f18c -GetCaughtLevel: ; 4f18c +GetCaughtLevel: ld a, "@" ld hl, wSeerCaughtLevelString ld bc, 4 @@ -185,13 +174,11 @@ GetCaughtLevel: ; 4f18c ld bc, 4 call CopyBytes ret -; 4f1c1 -.unknown_level ; 4f1c1 +.unknown_level db "???@" -; 4f1c5 -GetCaughtTime: ; 4f1c5 +GetCaughtTime: ld a, [wSeerCaughtData] and CAUGHT_TIME_MASK jr z, .none @@ -212,26 +199,22 @@ GetCaughtTime: ; 4f1c5 ld de, wSeerTimeOfDay call UnknownCaughtData ret -; 4f1e6 -.times ; 4f1e6 +.times db "Morning@" db "Day@" db "Night@" -; 4f1f8 -UnknownCaughtData: ; 4f1f8 +UnknownCaughtData: ld hl, .unknown ld bc, NAME_LENGTH call CopyBytes ret -; 4f202 -.unknown ; 4f202 +.unknown db "Unknown@" -; 4f20a -GetCaughtLocation: ; 4f20a +GetCaughtLocation: ld a, [wSeerCaughtGender] and CAUGHT_LOCATION_MASK jr z, .Unknown @@ -263,9 +246,8 @@ GetCaughtLocation: ; 4f20a ld [wSeerAction], a scf ret -; 4f242 -GetCaughtOT: ; 4f242 +GetCaughtOT: ld a, [wCurPartyMon] ld hl, wPartyMonOT ld bc, NAME_LENGTH @@ -286,15 +268,13 @@ GetCaughtOT: ; 4f242 ld a, "@" ld [de], a ret -; 4f26b -.male ; 4f26b +.male db "@" -.female ; 4f26c +.female db "@" -; 4f26d -PrintSeerText: ; 4f26d +PrintSeerText: ld e, a ld d, 0 ld hl, SeerTexts @@ -305,9 +285,8 @@ PrintSeerText: ; 4f26d ld l, a call PrintText ret -; 4f27c -SeerTexts: ; 4f27c +SeerTexts: dw SeerIntroText dw SeerCantTellText dw SeerMetAtText @@ -316,58 +295,48 @@ SeerTexts: ; 4f27c dw SeerCancelText dw SeerEggText dw SeerLevelOnlyText -; 4f28c -SeerIntroText: ; 0x4f28c +SeerIntroText: ; I see all. I know all… Certainly, I know of your #MON! text_jump UnknownText_0x1c475f db "@" -; 0x4f291 -SeerCantTellText: ; 0x4f291 +SeerCantTellText: ; Whaaaat? I can't tell a thing! How could I not know of this? text_jump UnknownText_0x1c4797 db "@" -; 0x4f296 -SeerMetAtText: ; 0x4f296 +SeerMetAtText: ; Hm… I see you met @ here: @ ! text_jump UnknownText_0x1c47d4 db "@" -; 0x4f29b -SeerTimeLevelText: ; 0x4f29b +SeerTimeLevelText: ; The time was @ ! Its level was @ ! Am I good or what? text_jump UnknownText_0x1c47fa db "@" -; 0x4f2a0 -SeerTradedText: ; 0x4f2a0 +SeerTradedText: ; Hm… @ came from @ in a trade? @ was where @ met @ ! text_jump UnknownText_0x1c4837 db "@" -; 0x4f2a5 -SeerLevelOnlyText: ; 0x4f2a5 +SeerLevelOnlyText: ; What!? Incredible! I don't understand how, but it is incredible! You are special. I can't tell where you met it, but it was at level @ . Am I good or what? text_jump UnknownText_0x1c487f db "@" -; 0x4f2aa -SeerEggText: ; 0x4f2aa +SeerEggText: ; Hey! That's an EGG! You can't say that you've met it yet… text_jump UnknownText_0x1c491d db "@" -; 0x4f2af -SeerCancelText: ; 0x4f2af +SeerCancelText: ; Fufufu! I saw that you'd do nothing! text_jump UnknownText_0x1c4955 db "@" -; 0x4f2b4 - -SeerAdvice: ; 4f2b4 +SeerAdvice: ld a, MON_LEVEL call GetPartyParamLocation ld a, [wSeerCaughtLevel] @@ -392,9 +361,8 @@ SeerAdvice: ; 4f2b4 ld l, a call PrintText ret -; 4f2d6 -SeerAdviceTexts: ; 4f2d6 +SeerAdviceTexts: ; level, text dbw 9, SeerAdvice1 dbw 29, SeerAdvice2 @@ -402,40 +370,33 @@ SeerAdviceTexts: ; 4f2d6 dbw 89, SeerAdvice4 dbw 100, SeerAdvice5 dbw 255, SeerAdvice1 -; 4f2e8 -SeerAdvice1: ; 0x4f2e8 +SeerAdvice1: ; Incidentally… It would be wise to raise your #MON with a little more care. text_jump UnknownText_0x1c497a db "@" -; 0x4f2ed -SeerAdvice2: ; 0x4f2ed +SeerAdvice2: ; Incidentally… It seems to have grown a little. @ seems to be becoming more confident. text_jump UnknownText_0x1c49c6 db "@" -; 0x4f2f2 -SeerAdvice3: ; 0x4f2f2 +SeerAdvice3: ; Incidentally… @ has grown. It's gained much strength. text_jump UnknownText_0x1c4a21 db "@" -; 0x4f2f7 -SeerAdvice4: ; 0x4f2f7 +SeerAdvice4: ; Incidentally… It certainly has grown mighty! This @ must have come through numerous #MON battles. It looks brimming with confidence. text_jump UnknownText_0x1c4a5b db "@" -; 0x4f2fc -SeerAdvice5: ; 0x4f2fc +SeerAdvice5: ; Incidentally… I'm impressed by your dedication. It's been a long time since I've seen a #MON as mighty as this @ . I'm sure that seeing @ in battle would excite anyone. text_jump UnknownText_0x1c4ae5 db "@" -; 0x4f301 - -GetCaughtGender: ; 4f301 +GetCaughtGender: ld hl, MON_CAUGHTGENDER add hl, bc @@ -458,4 +419,3 @@ GetCaughtGender: ; 4f301 .genderless ld c, CAUGHT_BY_UNKNOWN ret -; 4f31c diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 42284aeab..f1a593b5a 100644 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -1,4 +1,4 @@ -PokemonCenterPC: ; 1559a +PokemonCenterPC: call PC_CheckPartyForPokemon ret c call PC_PlayBootSound @@ -39,12 +39,19 @@ PokemonCenterPC: ; 1559a dw PlaceNthMenuStrings dw .JumpTable +PCPC_PLAYERS_PC EQU 0 +PCPC_BILLS_PC EQU 1 +PCPC_OAKS_PC EQU 2 +PCPC_HALL_OF_FAME EQU 3 +PCPC_TURN_OFF EQU 4 + .JumpTable: - dw PlayersPC, .String_PlayersPC - dw BillsPC, .String_BillsPC - dw OaksPC, .String_OaksPC +; entries correspond to PCPC_* constants + dw PlayersPC, .String_PlayersPC + dw BillsPC, .String_BillsPC + dw OaksPC, .String_OaksPC dw HallOfFamePC, .String_HallOfFame - dw TurnOffPC, .String_TurnOff + dw TurnOffPC, .String_TurnOff .String_PlayersPC: db "<PLAYER>'s PC@" .String_BillsPC: db "BILL's PC@" @@ -53,37 +60,45 @@ PokemonCenterPC: ; 1559a .String_TurnOff: db "TURN OFF@" .WhichPC: - ; before pokedex - db 3 ; items - db 1, 0, 4 ; bill's, player's, turn off - db -1 + ; before Pokédex + db 3 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_TURN_OFF + db -1 ; end ; before Hall Of Fame - db 4 ; items - db 1, 0, 2, 4 ; bill's, player's, oak's, turn off - db -1 + db 4 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_OAKS_PC + db PCPC_TURN_OFF + db -1 ; end ; postgame - db 5 ; items - db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off - db -1 + db 5 + db PCPC_BILLS_PC + db PCPC_PLAYERS_PC + db PCPC_OAKS_PC + db PCPC_HALL_OF_FAME + db PCPC_TURN_OFF + db -1 ; end .ChooseWhichPCListToUse: call CheckReceivedDex jr nz, .got_dex - ld a, $0 + ld a, 0 ; before Pokédex ret .got_dex ld a, [wHallOfFameCount] and a - ld a, $1 + ld a, 1 ; before Hall Of Fame ret z - ld a, $2 + ld a, 2 ; postgame ret -; 15650 -PC_CheckPartyForPokemon: ; 15650 +PC_CheckPartyForPokemon: ld a, [wPartyCount] and a ret nz @@ -98,18 +113,16 @@ PC_CheckPartyForPokemon: ; 15650 ; Bzzzzt! You must have a #MON to use this! text_jump UnknownText_0x1c1328 db "@" -; 0x15668 -BillsPC: ; 15668 +BillsPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedBillsPC call PC_DisplayText farcall _BillsPC and a ret -; 15679 (5:5679) -PlayersPC: ; 15679 +PlayersPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedOwnPC call PC_DisplayText @@ -117,61 +130,56 @@ PlayersPC: ; 15679 call _PlayersPC and a ret -; 15689 -OaksPC: ; 15689 +OaksPC: call PC_PlayChoosePCSound ld hl, PokecenterPCText_AccessedOaksPC call PC_DisplayText farcall ProfOaksPC and a ret -; 1569a -HallOfFamePC: ; 1569a +HallOfFamePC: call PC_PlayChoosePCSound call FadeToMenu farcall _HallOfFamePC call CloseSubmenu and a ret -; 156ab -TurnOffPC: ; 156ab +TurnOffPC: ld hl, PokecenterPCText_LinkClosed call PrintText scf ret -; 156b3 -PC_PlayBootSound: ; 156b3 +PC_PlayBootSound: ld de, SFX_BOOT_PC jr PC_WaitPlaySFX -PC_PlayShutdownSound: ; 156b8 +PC_PlayShutdownSound: ld de, SFX_SHUT_DOWN_PC call PC_WaitPlaySFX call WaitSFX ret -PC_PlayChoosePCSound: ; 156c2 +PC_PlayChoosePCSound: ld de, SFX_CHOOSE_PC_OPTION jr PC_WaitPlaySFX -PC_PlaySwapItemsSound: ; 156c7 +PC_PlaySwapItemsSound: ld de, SFX_SWITCH_POKEMON call PC_WaitPlaySFX ld de, SFX_SWITCH_POKEMON -PC_WaitPlaySFX: ; 156d0 +PC_WaitPlaySFX: push de call WaitSFX pop de call PlaySFX ret -; 156d9 -_PlayersHousePC: ; 156d9 +_PlayersHousePC: call PC_PlayBootSound ld hl, UnknownText_0x156ff call PC_DisplayText @@ -190,15 +198,13 @@ _PlayersHousePC: ; 156d9 call ClearBGPalettes ld c, $1 ret -; 156ff -UnknownText_0x156ff: ; 0x156ff +UnknownText_0x156ff: ; turned on the PC. text_jump UnknownText_0x1c1353 db "@" -; 0x15704 -_PlayersPC: ; 15704 +_PlayersPC: ld a, b ld [wWhichIndexSet], a ld hl, UnknownText_0x157cc @@ -206,9 +212,8 @@ _PlayersPC: ; 15704 call Function15715 call ExitMenu ret -; 15715 -Function15715: ; 15715 +Function15715: xor a ld [wPCItemsCursor], a ld [wPCItemsScrollPosition], a @@ -228,9 +233,8 @@ Function15715: ; 15715 .asm_15732 call ExitMenu ret -; 15736 -PlayersPCMenuData: ; 0x15736 +PlayersPCMenuData: db MENU_BACKUP_TILES ; flags db 0, 0 ; top left corner coords (y, x) db 12, 15 ; bottom right corner coords (y, x) @@ -244,7 +248,16 @@ PlayersPCMenuData: ; 0x15736 dw PlaceNthMenuStrings dw .PlayersPCMenuPointers -.PlayersPCMenuPointers: ; 0x15746 +PLAYERSPC_WITHDRAW_ITEM EQU 0 +PLAYERSPC_DEPOSIT_ITEM EQU 1 +PLAYERSPC_TOSS_ITEM EQU 2 +PLAYERSPC_MAIL_BOX EQU 3 +PLAYERSPC_DECORATION EQU 4 +PLAYERSPC_TURN_OFF EQU 5 +PLAYERSPC_LOG_OFF EQU 6 + +.PlayersPCMenuPointers: +; entries correspond to PLAYERSPC_* constants dw PlayerWithdrawItemMenu, .WithdrawItem dw PlayerDepositItemMenu, .DepositItem dw PlayerTossItemMenu, .TossItem @@ -261,34 +274,26 @@ PlayersPCMenuData: ; 0x15736 .TurnOff: db "TURN OFF@" .LogOff: db "LOG OFF@" -WITHDRAW_ITEM EQU 0 -DEPOSIT_ITEM EQU 1 -TOSS_ITEM EQU 2 -MAIL_BOX EQU 3 -DECORATION EQU 4 -TURN_OFF EQU 5 -LOG_OFF EQU 6 - .PlayersPCMenuList1: db 5 - db WITHDRAW_ITEM - db DEPOSIT_ITEM - db TOSS_ITEM - db MAIL_BOX - db TURN_OFF - db -1 + db PLAYERSPC_WITHDRAW_ITEM + db PLAYERSPC_DEPOSIT_ITEM + db PLAYERSPC_TOSS_ITEM + db PLAYERSPC_MAIL_BOX + db PLAYERSPC_TURN_OFF + db -1 ; end .PlayersPCMenuList2: db 6 - db WITHDRAW_ITEM - db DEPOSIT_ITEM - db TOSS_ITEM - db MAIL_BOX - db DECORATION - db LOG_OFF - db -1 - -PC_DisplayTextWaitMenu: ; 157bb + db PLAYERSPC_WITHDRAW_ITEM + db PLAYERSPC_DEPOSIT_ITEM + db PLAYERSPC_TOSS_ITEM + db PLAYERSPC_MAIL_BOX + db PLAYERSPC_DECORATION + db PLAYERSPC_LOG_OFF + db -1 ; end + +PC_DisplayTextWaitMenu: ld a, [wOptions] push af set NO_TEXT_SCROLL, a @@ -297,15 +302,13 @@ PC_DisplayTextWaitMenu: ; 157bb pop af ld [wOptions], a ret -; 157cc -UnknownText_0x157cc: ; 0x157cc +UnknownText_0x157cc: ; What do you want to do? text_jump UnknownText_0x1c1368 db "@" -; 0x157d1 -PlayerWithdrawItemMenu: ; 0x157d1 +PlayerWithdrawItemMenu: call LoadStandardMenuHeader farcall ClearPCItemScreen .loop @@ -369,19 +372,19 @@ PlayerWithdrawItemMenu: ; 0x157d1 .done ret -.HowManyText: ; 0x15850 +.HowManyText: text_jump _PlayersPCHowManyWithdrawText db "@" -.WithdrewText: ; 0x15855 +.WithdrewText: text_jump _PlayersPCWithdrewItemsText db "@" -.NoRoomText: ; 0x1585a +.NoRoomText: text_jump _PlayersPCNoRoomWithdrawText db "@" -PlayerTossItemMenu: ; 0x1585f +PlayerTossItemMenu: call LoadStandardMenuHeader farcall ClearPCItemScreen .loop @@ -395,24 +398,21 @@ PlayerTossItemMenu: ; 0x1585f call CloseSubmenu xor a ret -; 0x1587d -PlayerDecorationMenu: ; 0x1587d +PlayerDecorationMenu: farcall _PlayerDecorationMenu ld a, c and a ret z scf ret -; 0x15888 -PlayerLogOffMenu: ; 0x15888 +PlayerLogOffMenu: xor a scf ret -; 0x1588b -PlayerDepositItemMenu: ; 0x1588b +PlayerDepositItemMenu: call .CheckItemsInBag jr c, .nope call DisableSpriteUpdates @@ -461,13 +461,14 @@ PlayerDepositItemMenu: ; 0x1588b ret .dw - dw .tossable +; entries correspond to ITEMMENU_* constants + dw .tossable ; ITEMMENU_NOUSE dw .no_toss dw .no_toss dw .no_toss - dw .tossable - dw .tossable - dw .tossable + dw .tossable ; ITEMMENU_CURRENT + dw .tossable ; ITEMMENU_PARTY + dw .tossable ; ITEMMENU_CLOSE .no_toss ret @@ -531,25 +532,24 @@ PlayerDepositItemMenu: ; 0x1588b and a ret -.HowManyText: ; 0x1596e +.HowManyText: text_jump _PlayersPCHowManyDepositText db "@" -.DepositText: ; 0x15973 +.DepositText: text_jump _PlayersPCDepositItemsText db "@" -.NoRoomText: ; 0x15978 +.NoRoomText: text_jump _PlayersPCNoRoomDepositText db "@" -PlayerMailBoxMenu: ; 0x1597d +PlayerMailBoxMenu: farcall _PlayerMailBoxMenu xor a ret -; 0x15985 -PCItemsJoypad: ; 0x15985 +PCItemsJoypad: xor a ld [wSwitchItem], a .loop @@ -633,44 +633,37 @@ PCItemsJoypad: ; 0x15985 dba PlaceMenuItemQuantity dba UpdateItemDescription -PC_DisplayText: ; 15a20 +PC_DisplayText: call MenuTextBox call ExitMenu ret -; 15a27 -PokecenterPCText_BootedUpPC: ; 0x15a27 +PokecenterPCText_BootedUpPC: ; turned on the PC. text_jump UnknownText_0x1c144d db "@" -; 0x15a2c -PokecenterPCText_AccessWhosePC: ; 0x15a2c +PokecenterPCText_AccessWhosePC: ; Access whose PC? text_jump UnknownText_0x1c1462 db "@" -; 0x15a31 -PokecenterPCText_AccessedBillsPC: ; 0x15a31 +PokecenterPCText_AccessedBillsPC: ; BILL's PC accessed. #MON Storage System opened. text_jump UnknownText_0x1c1474 db "@" -; 0x15a36 -PokecenterPCText_AccessedOwnPC: ; 0x15a36 +PokecenterPCText_AccessedOwnPC: ; Accessed own PC. Item Storage System opened. text_jump UnknownText_0x1c14a4 db "@" -; 0x15a3b -PokecenterPCText_AccessedOaksPC: ; 0x15a3b +PokecenterPCText_AccessedOaksPC: ; PROF.OAK's PC accessed. #DEX Rating System opened. text_jump UnknownText_0x1c14d2 db "@" -; 0x15a40 -PokecenterPCText_LinkClosed: ; 0x15a40 +PokecenterPCText_LinkClosed: ; … Link closed… text_jump UnknownText_0x1c1505 db "@" -; 0x15a45 diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index e11c45f9b..10ca4280b 100644 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -1,4 +1,4 @@ -Pokepic:: ; 244e3 +Pokepic:: ld hl, PokepicMenuHeader call CopyMenuHeader call MenuBox @@ -27,7 +27,7 @@ Pokepic:: ; 244e3 call WaitBGMap ret -ClosePokepic:: ; 24528 +ClosePokepic:: ld hl, PokepicMenuHeader call CopyMenuHeader call ClearMenuBoxInterior @@ -41,7 +41,7 @@ ClosePokepic:: ; 24528 call LoadStandardFont ret -PokepicMenuHeader: ; 0x24547 +PokepicMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 4, 14, 13 dw NULL diff --git a/engine/events/pokerus/apply_pokerus_tick.asm b/engine/events/pokerus/apply_pokerus_tick.asm index e632fbfe4..223fe0147 100644 --- a/engine/events/pokerus/apply_pokerus_tick.asm +++ b/engine/events/pokerus/apply_pokerus_tick.asm @@ -1,4 +1,4 @@ -ApplyPokerusTick: ; 13988 +ApplyPokerusTick: ; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured. ld hl, wPartyMon1PokerusStatus ; wPartyMon1 + MON_PKRS ld a, [wPartyCount] diff --git a/engine/events/pokerus/check_pokerus.asm b/engine/events/pokerus/check_pokerus.asm index c739c59c5..201a37130 100644 --- a/engine/events/pokerus/check_pokerus.asm +++ b/engine/events/pokerus/check_pokerus.asm @@ -1,4 +1,4 @@ -_CheckPokerus: ; 4d860 +_CheckPokerus: ; Return carry if a monster in your party has Pokerus ; Get number of monsters to iterate over diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm index 5728cb181..a6764e3b5 100644 --- a/engine/events/pokerus/pokerus.asm +++ b/engine/events/pokerus/pokerus.asm @@ -1,4 +1,4 @@ -GivePokerusAndConvertBerries: ; 2ed44 +GivePokerusAndConvertBerries: call ConvertBerriesToBerryJuice ld hl, wPartyMon1PokerusStatus ld a, [wPartyCount] @@ -121,7 +121,7 @@ GivePokerusAndConvertBerries: ; 2ed44 ld [hl], a ret -ConvertBerriesToBerryJuice: ; 2ede6 +ConvertBerriesToBerryJuice: ; If we haven't been to Goldenrod City at least once, ; prevent Shuckle from turning held Berry into Berry Juice. ld hl, wStatusFlags2 diff --git a/engine/events/print_photo.asm b/engine/events/print_photo.asm index d8350a530..cb29693af 100644 --- a/engine/events/print_photo.asm +++ b/engine/events/print_photo.asm @@ -1,4 +1,4 @@ -PhotoStudio: ; 16dc7 +PhotoStudio: ld hl, .Text_AskWhichMon call PrintText farcall SelectMonFromParty @@ -28,34 +28,28 @@ PhotoStudio: ; 16dc7 .print_text call PrintText ret -; 16e04 -.Text_AskWhichMon: ; 0x16e04 +.Text_AskWhichMon: ; Which #MON should I photo- graph? text_jump UnknownText_0x1be024 db "@" -; 0x16e09 -.Text_HoldStill: ; 0x16e09 +.Text_HoldStill: ; All righty. Hold still for a bit. text_jump UnknownText_0x1be047 db "@" -; 0x16e0e -.Text_Presto: ; 0x16e0e +.Text_Presto: ; Presto! All done. Come again, OK? text_jump UnknownText_0x1be06a db "@" -; 0x16e13 -.Text_NoPicture: ; 0x16e13 +.Text_NoPicture: ; Oh, no picture? Come again, OK? text_jump UnknownText_0x1c0000 db "@" -; 0x16e18 -.Text_Egg: ; 0x16e18 +.Text_Egg: ; An EGG? My talent is worth more… text_jump UnknownText_0x1c0021 db "@" -; 0x16e1d diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index f8fa52af3..9e231f449 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -1,4 +1,7 @@ -_UnownPrinter: ; 16be4 +UNOWNSTAMP_BOLD_A EQUS "\"♂\"" ; $ef +UNOWNSTAMP_BOLD_B EQUS "\"♀\"" ; $f5 + +_UnownPrinter: ld a, [wUnownDex] and a ret z @@ -15,12 +18,12 @@ _UnownPrinter: ; 16be4 call ClearTileMap ld de, UnownDexATile - ld hl, vTiles1 tile $6f + ld hl, vTiles0 tile UNOWNSTAMP_BOLD_A lb bc, BANK(UnownDexBTile), 1 call Request1bpp ld de, UnownDexBTile - ld hl, vTiles1 tile $75 + ld hl, vTiles0 tile UNOWNSTAMP_BOLD_B lb bc, BANK(UnownDexBTile), 1 call Request1bpp @@ -94,9 +97,8 @@ _UnownPrinter: ; 16be4 ld [hInMenu], a call ReturnToMapFromSubmenu ret -; 16ca0 -.LeftRight: ; 16ca0 +.LeftRight: ld a, [hJoyLast] and D_RIGHT jr nz, .press_right @@ -127,9 +129,8 @@ _UnownPrinter: ; 16be4 .return call .UpdateUnownFrontpic ret -; 16cc8 -.UpdateUnownFrontpic: ; 16cc8 +.UpdateUnownFrontpic: ld a, [wJumptableIndex] cp 26 jr z, .vacant @@ -151,7 +152,7 @@ _UnownPrinter: ; 16be4 farcall RotateUnownFrontpic ret -.Load2bppToSRAM: ; 16cff +.Load2bppToSRAM: ld a, [rSVBK] push af ld a, BANK(wDecompressScratch) @@ -194,7 +195,6 @@ _UnownPrinter: ; 16be4 ld c, 20 call DelayFrames ret -; 16d57 AlphRuinsStampString: db " ALPH RUINS STAMP@" @@ -203,23 +203,21 @@ UnownDexDoWhatString: db "Do what?@" UnownDexMenuString: - db "♂ PRINT" - next "♀ CANCEL" + db UNOWNSTAMP_BOLD_A, " PRINT" + next UNOWNSTAMP_BOLD_B, " CANCEL" next "← PREVIOUS" next "→ NEXT" db "@" UnownDexVacantString: db "VACANT@" -; 16d9c -UnownDexATile: ; 16d9c +UnownDexATile: INCBIN "gfx/printer/bold_a.1bpp" -UnownDexBTile: ; 16da4 +UnownDexBTile: INCBIN "gfx/printer/bold_b.1bpp" -; 16dac -PlaceUnownPrinterFrontpic: ; 16dac +PlaceUnownPrinterFrontpic: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " @@ -230,4 +228,3 @@ PlaceUnownPrinterFrontpic: ; 16dac lb bc, 7, 7 predef PlaceGraphic ret -; 16dc7 diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index a2c1f47e3..02f3fadd9 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -1,4 +1,4 @@ -RotateUnownFrontpic: ; e0000 +RotateUnownFrontpic: ; something to do with Unown printer push de xor a ; sScratch @@ -43,7 +43,7 @@ RotateUnownFrontpic: ; e0000 call CloseSRAM ret -.Copy: ; e004e +.Copy: ld c, $10 .loop_copy ld a, [hli] @@ -53,7 +53,7 @@ RotateUnownFrontpic: ; e0000 jr nz, .loop_copy ret -.Rotate: ; e0057 +.Rotate: ld hl, wd012 ld e, %10000000 ld d, 8 @@ -75,7 +75,7 @@ RotateUnownFrontpic: ; e0000 jr nz, .loop_decompress ret -.CountSetBit: ; e0078 +.CountSetBit: ld b, 0 ld c, 8 .loop_count @@ -107,5 +107,5 @@ y = y + 1 endr ENDM -UnownPrinter_GBPrinterRectangle: ; e008b +UnownPrinter_GBPrinterRectangle: gbprinterrect 7, 7 diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index b80efe75b..df55394aa 100644 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -1,4 +1,4 @@ -ProfOaksPC: ; 0x265d3 +ProfOaksPC: ld hl, OakPCText1 call MenuTextBox call YesNoBox @@ -11,7 +11,7 @@ ProfOaksPC: ; 0x265d3 call ExitMenu ret -ProfOaksPCBoot ; 0x265ee +ProfOaksPCBoot: ld hl, OakPCText2 call PrintText call Rate @@ -20,7 +20,7 @@ ProfOaksPCBoot ; 0x265ee call WaitSFX ret -ProfOaksPCRating: ; 0x26601 +ProfOaksPCRating: call Rate push de ld de, MUSIC_NONE @@ -31,7 +31,7 @@ ProfOaksPCRating: ; 0x26601 call WaitSFX ret -Rate: ; 0x26616 +Rate: ; calculate Seen/Owned ld hl, wPokedexSeen ld b, wEndPokedexSeen - wPokedexSeen @@ -55,7 +55,7 @@ Rate: ; 0x26616 pop de ret -.UpdateRatingBuffers: ; 0x26647 +.UpdateRatingBuffers: ld hl, wStringBuffer3 ld de, wd002 call .UpdateRatingBuffer @@ -64,7 +64,7 @@ Rate: ; 0x26616 call .UpdateRatingBuffer ret -.UpdateRatingBuffer: ; 0x2665a +.UpdateRatingBuffer: push hl ld a, "@" ld bc, ITEM_NAME_LENGTH @@ -74,7 +74,7 @@ Rate: ; 0x26616 call PrintNum ret -FindOakRating: ; 0x2666b +FindOakRating: ; return sound effect in de ; return text pointer in hl nop @@ -100,15 +100,15 @@ endr INCLUDE "data/events/pokedex_ratings.asm" -OakPCText1: ; 0x266de +OakPCText1: text_jump _OakPCText1 db "@" -OakPCText2: ; 0x266e3 +OakPCText2: text_jump _OakPCText2 db "@" -OakPCText3: ; 0x266e8 +OakPCText3: text_jump _OakPCText3 db "@" @@ -188,6 +188,6 @@ OakRating19: text_jump _OakRating19 db "@" -OakPCText4: ; 0x2674c +OakPCText4: text_jump _OakPCText4 db "@" diff --git a/engine/events/sacred_ash.asm b/engine/events/sacred_ash.asm index 2cb5e37a1..32f24253c 100644 --- a/engine/events/sacred_ash.asm +++ b/engine/events/sacred_ash.asm @@ -1,5 +1,5 @@ -_SacredAsh: ; 507e6 +_SacredAsh: ld a, $0 ld [wItemEffectSucceeded], a call CheckAnyFaintedMon @@ -10,9 +10,8 @@ _SacredAsh: ; 507e6 ld a, $1 ld [wItemEffectSucceeded], a ret -; 507fb -CheckAnyFaintedMon: ; 507fb +CheckAnyFaintedMon: ld de, PARTYMON_STRUCT_LENGTH ld bc, wPartySpecies ld hl, wPartyMon1HP @@ -46,9 +45,8 @@ CheckAnyFaintedMon: ; 507fb pop af scf ret -; 50821 -SacredAshScript: ; 0x50821 +SacredAshScript: special HealParty reloadmappart playsound SFX_WARP_TO @@ -65,10 +63,8 @@ SacredAshScript: ; 0x50821 waitbutton closetext end -; 0x50845 -UnknownText_0x50845: ; 0x50845 +UnknownText_0x50845: ; 's #MON were all healed! text_jump UnknownText_0x1c0b65 db "@" -; 0x5084a diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index 99fcd7924..c6d909afe 100644 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -1,7 +1,6 @@ MANIA_OT_ID EQU 00518 -GiveShuckle: ; 7305 - +GiveShuckle: ; Adding to the party. xor a ld [wMonType], a @@ -71,7 +70,7 @@ SpecialShuckleOT: SpecialShuckleNick: db "SHUCKIE@" -ReturnShuckle: ; 737e +ReturnShuckle: farcall SelectMonFromParty jr c, .refused diff --git a/engine/events/specials.asm b/engine/events/specials.asm index acfc3c450..35d32dde6 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -1,4 +1,4 @@ -Special:: ; c01b +Special:: ; Run script special de. ld hl, SpecialsPointers add hl, de @@ -12,22 +12,19 @@ Special:: ; c01b ld a, b rst FarCall ret -; c029 INCLUDE "data/special_pointers.asm" -DummySpecial_c224: ; c224 +DummySpecial_c224: ret -; c225 -SetPlayerPalette: ; c225 +SetPlayerPalette: ld a, [wScriptVar] ld d, a farcall _SetPlayerPalette ret -; c230 -GameCornerPrizeMonCheckDex: ; c230 +GameCornerPrizeMonCheckDex: ld a, [wScriptVar] dec a call CheckCaughtMon @@ -41,104 +38,95 @@ GameCornerPrizeMonCheckDex: ; c230 farcall NewPokedexEntry call ExitAllMenus ret -; c252 -UnusedSetSeenMon: ; c252 +UnusedSetSeenMon: ld a, [wScriptVar] dec a call SetSeenMon ret -; c25a -FindPartyMonAboveLevel: ; c25a +FindPartyMonAboveLevel: ld a, [wScriptVar] ld b, a farcall _FindPartyMonAboveLevel jr z, FoundNone jr FoundOne -FindPartyMonAtLeastThatHappy: ; c268 +FindPartyMonAtLeastThatHappy: ld a, [wScriptVar] ld b, a farcall _FindPartyMonAtLeastThatHappy jr z, FoundNone jr FoundOne -FindPartyMonThatSpecies: ; c276 +FindPartyMonThatSpecies: ld a, [wScriptVar] ld b, a farcall _FindPartyMonThatSpecies jr z, FoundNone jr FoundOne -FindPartyMonThatSpeciesYourTrainerID: ; c284 +FindPartyMonThatSpeciesYourTrainerID: ld a, [wScriptVar] ld b, a farcall _FindPartyMonThatSpeciesYourTrainerID jr z, FoundNone jr FoundOne -FoundOne: ; c292 +FoundOne: ld a, TRUE ld [wScriptVar], a ret -FoundNone: ; c298 +FoundNone: xor a ld [wScriptVar], a ret -; c29d -NameRival: ; 0xc29d +NameRival: ld b, $2 ; rival ld de, wRivalName farcall _NamingScreen ; default to "SILVER" ld hl, wRivalName - ld de, DefaultRivalName + ld de, .default call InitName ret -; 0xc2b2 -DefaultRivalName: ; 0xc2b2 +.default db "SILVER@" -NameRater: ; c2b9 +NameRater: farcall _NameRater ret -; c2c0 -OverworldTownMap: ; c2c0 +OverworldTownMap: call FadeToMenu farcall _TownMap call ExitAllMenus ret -; c2cd -UnownPrinter: ; c2cd +UnownPrinter: call FadeToMenu farcall _UnownPrinter call ExitAllMenus ret -; c2da -DisplayLinkRecord: ; c2da +DisplayLinkRecord: call FadeToMenu farcall _DisplayLinkRecord call ExitAllMenus ret -; c2e7 -PlayersHousePC: ; c2e7 +PlayersHousePC: xor a ld [wScriptVar], a farcall _PlayersHousePC ld a, c ld [wScriptVar], a ret -; c2f6 -CheckMysteryGift: ; c2f6 +CheckMysteryGift: ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] @@ -150,9 +138,8 @@ CheckMysteryGift: ; c2f6 ld [wScriptVar], a call CloseSRAM ret -; c309 -GetMysteryGiftItem: ; c309 +GetMysteryGiftItem: ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] @@ -179,65 +166,57 @@ GetMysteryGiftItem: ; c309 xor a ld [wScriptVar], a ret -; c345 -.ReceiveItemText: ; 0xc345 +.ReceiveItemText: ; received item text_jump UnknownText_0x1bd3be db "@" -; 0xc34a -BugContestJudging: ; c34a +BugContestJudging: farcall _BugContestJudging ld a, b ld [wScriptVar], a ret -; c355 -MapRadio: ; c355 +MapRadio: ld a, [wScriptVar] ld e, a farcall PlayRadio ret -; c360 -UnownPuzzle: ; c360 +UnownPuzzle: call FadeToMenu farcall _UnownPuzzle ld a, [wSolvedUnownPuzzle] ld [wScriptVar], a call ExitAllMenus ret -; c373 -SlotMachine: ; c373 +SlotMachine: call CheckCoinsAndCoinCase ret c ld a, BANK(_SlotMachine) ld hl, _SlotMachine call StartGameCornerGame ret -; c380 -CardFlip: ; c380 +CardFlip: call CheckCoinsAndCoinCase ret c ld a, BANK(_CardFlip) ld hl, _CardFlip call StartGameCornerGame ret -; c38d -DummyNonfunctionalGameCornerGame: ; c38d +DummyNonfunctionalGameCornerGame: call CheckCoinsAndCoinCase ret c ld a, BANK(_DummyGame) ld hl, _DummyGame call StartGameCornerGame ret -; c39a -StartGameCornerGame: ; c39a +StartGameCornerGame: call FarQueueScript call FadeToMenu ld hl, wQueuedScriptBank @@ -250,9 +229,8 @@ StartGameCornerGame: ; c39a rst FarCall call ExitAllMenus ret -; c3ae -CheckCoinsAndCoinCase: ; c3ae +CheckCoinsAndCoinCase: ld hl, wCoins ld a, [hli] or [hl] @@ -276,27 +254,23 @@ CheckCoinsAndCoinCase: ; c3ae call PrintText scf ret -; c3d1 -.NoCoinsText: ; 0xc3d1 +.NoCoinsText: ; You have no coins. text_jump UnknownText_0x1bd3d7 db "@" -; 0xc3d6 -.NoCoinCaseText: ; 0xc3d6 +.NoCoinCaseText: ; You don't have a COIN CASE. text_jump UnknownText_0x1bd3eb db "@" -; 0xc3db -ClearBGPalettesBufferScreen: ; c3db +ClearBGPalettesBufferScreen: call ClearBGPalettes call BufferScreen ret -; c3e2 -ScriptReturnCarry: ; c3e2 +ScriptReturnCarry: jr c, .carry xor a ld [wScriptVar], a @@ -305,23 +279,19 @@ ScriptReturnCarry: ; c3e2 ld a, 1 ld [wScriptVar], a ret -; c3ef -UnusedCheckUnusedTwoDayTimer: ; c3ef +UnusedCheckUnusedTwoDayTimer: farcall CheckUnusedTwoDayTimer ld a, [wUnusedTwoDayTimer] ld [wScriptVar], a ret -; c3fc -ActivateFishingSwarm: ; c3fc +ActivateFishingSwarm: ld a, [wScriptVar] ld [wFishingSwarmFlag], a ret -; c403 - -StoreSwarmMapIndices:: ; c403 +StoreSwarmMapIndices:: ld a, c and a jr nz, .yanma @@ -338,29 +308,24 @@ StoreSwarmMapIndices:: ; c403 ld a, e ld [wYanmaMapNumber], a ret -; c419 - -CheckPokerus: ; c419 +CheckPokerus: ; Check if a monster in your party has Pokerus farcall _CheckPokerus jp ScriptReturnCarry -; c422 -ResetLuckyNumberShowFlag: ; c422 +ResetLuckyNumberShowFlag: farcall RestartLuckyNumberCountdown ld hl, wLuckyNumberShowFlag res LUCKYNUMBERSHOW_GAME_OVER_F, [hl] farcall LoadOrRegenerateLuckyIDNumber ret -; c434 -CheckLuckyNumberShowFlag: ; c434 +CheckLuckyNumberShowFlag: farcall _CheckLuckyNumberShowFlag jp ScriptReturnCarry -; c43d -SnorlaxAwake: ; 0xc43d +SnorlaxAwake: ; Check if the Poké Flute channel is playing, and if the player is standing ; next to Snorlax. @@ -410,14 +375,11 @@ SnorlaxAwake: ; 0xc43d db 36, 9 ; right db -1 - -PlayCurMonCry: ; c472 +PlayCurMonCry: ld a, [wCurPartySpecies] jp PlayMonCry -; c478 - -GameboyCheck: ; c478 +GameboyCheck: ld a, [hCGB] and a jr nz, .cgb @@ -438,8 +400,7 @@ GameboyCheck: ; c478 ld [wScriptVar], a ret - -FadeOutMusic: ; c48f +FadeOutMusic: ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) @@ -447,23 +408,20 @@ FadeOutMusic: ; c48f ld a, $2 ld [wMusicFade], a ret -; c49f -Diploma: ; c49f +Diploma: call FadeToMenu farcall _Diploma call ExitAllMenus ret -; c4ac -PrintDiploma: ; c4ac +PrintDiploma: call FadeToMenu farcall _PrintDiploma call ExitAllMenus ret -; c4b9 -TrainerHouse: ; 0xc4b9 +TrainerHouse: ld a, BANK(sMysteryGiftTrainerHouseFlag) call GetSRAMBank ld a, [sMysteryGiftTrainerHouseFlag] diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm index f6ab00951..74fd4d991 100644 --- a/engine/events/squirtbottle.asm +++ b/engine/events/squirtbottle.asm @@ -1,4 +1,4 @@ -_Squirtbottle: ; 50730 +_Squirtbottle: ld hl, .SquirtbottleScript call QueueScript ld a, $1 @@ -44,4 +44,3 @@ _Squirtbottle: ; 50730 xor a ld [wScriptVar], a ret -; 50779 diff --git a/engine/events/std_collision.asm b/engine/events/std_collision.asm index 775f7c10c..0e06b03c8 100644 --- a/engine/events/std_collision.asm +++ b/engine/events/std_collision.asm @@ -1,4 +1,4 @@ -CheckFacingTileForStdScript:: ; 1365b +CheckFacingTileForStdScript:: ; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry. ld a, c ld de, 3 @@ -25,5 +25,5 @@ CheckFacingTileForStdScript:: ; 1365b INCLUDE "data/events/collision_stdscripts.asm" -Script_JumpStdFromRAM: ; 0x1369a +Script_JumpStdFromRAM: jump wJumpStdScriptBuffer diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 6e873a7c7..28272405c 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -216,7 +216,7 @@ Radio2Script: closetext end -TrashCanScript: ; 0xbc1a5 +TrashCanScript: farjumptext TrashCanText PCScript: @@ -335,9 +335,8 @@ BugContestResults_DidNotWin: farwritetext ContestResults_DidNotWinText buttonsound jump BugContestResults_FinishUp -; 0xbc2b1 -BugContestResults_ReturnAfterWinnersPrize: ; 0xbc2b1 +BugContestResults_ReturnAfterWinnersPrize: farwritetext ContestResults_JoinUsNextTimeText buttonsound @@ -381,9 +380,8 @@ BugContestResults_CleanUp: setflag ENGINE_DAILY_BUG_CONTEST special PlayMapMusic end -; 0xbc31e -BugContestResults_FirstPlace: ; 0xbc31e +BugContestResults_FirstPlace: setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 itemtotext SUN_STONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText @@ -391,55 +389,48 @@ BugContestResults_FirstPlace: ; 0xbc31e verbosegiveitem SUN_STONE iffalse BugContestResults_NoRoomForSunStone jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc332 -BugContestResults_SecondPlace: ; 0xbc332 +BugContestResults_SecondPlace: itemtotext EVERSTONE, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem EVERSTONE iffalse BugContestResults_NoRoomForEverstone jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc343 -BugContestResults_ThirdPlace: ; 0xbc343 +BugContestResults_ThirdPlace: itemtotext GOLD_BERRY, MEM_BUFFER_1 farwritetext ContestResults_PlayerWonAPrizeText waitbutton verbosegiveitem GOLD_BERRY iffalse BugContestResults_NoRoomForGoldBerry jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc354 -BugContestResults_NoRoomForSunStone: ; 0xbc354 +BugContestResults_NoRoomForSunStone: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc35f -BugContestResults_NoRoomForEverstone: ; 0xbc35f +BugContestResults_NoRoomForEverstone: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc36a -BugContestResults_NoRoomForGoldBerry: ; 0xbc36a +BugContestResults_NoRoomForGoldBerry: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY jump BugContestResults_ReturnAfterWinnersPrize -; 0xbc375 -BugContestResults_NoRoomForBerry: ; 0xbc375 +BugContestResults_NoRoomForBerry: farwritetext BugContestPrizeNoRoomText buttonsound setevent EVENT_CONTEST_OFFICER_HAS_BERRY jump BugContestResults_DidNotWin -; 0xbc380 -BugContestResults_CopyContestantsToResults: ; 0xbc380 +BugContestResults_CopyContestantsToResults: checkevent EVENT_BUG_CATCHING_CONTESTANT_1A iftrue .skip1 clearevent EVENT_BUG_CATCHING_CONTESTANT_1B @@ -1489,7 +1480,7 @@ RegisteredNumberFScript: buttonsound end -NumberAcceptedFScript: ; 0xbcbd3 +NumberAcceptedFScript: checkcode VAR_CALLERID ifequal PHONE_POKEFAN_BEVERLY, .Beverly ifequal PHONE_COOLTRAINERF_BETH, .Beth @@ -1777,23 +1768,21 @@ GymStatue2Script: closetext end -ReceiveItemScript: ; 0xbcdb9 +ReceiveItemScript: waitsfx farwritetext ReceivedItemText playsound SFX_ITEM waitsfx end -; 0xbcdc3 -ReceiveTogepiEggScript: ; 0xbcdc3 +ReceiveTogepiEggScript: waitsfx farwritetext ReceivedItemText playsound SFX_GET_EGG_FROM_DAY_CARE_LADY waitsfx end -; 0xbcdcd -GameCornerCoinVendorScript: ; 0xbcdcd +GameCornerCoinVendorScript: faceplayer opentext farwritetext CoinVendor_WelcomeText @@ -1804,12 +1793,11 @@ GameCornerCoinVendorScript: ; 0xbcdcd waitbutton closetext end -; 0xbcde0 -CoinVendor_IntroScript: ; 0xbcde0 +CoinVendor_IntroScript: farwritetext CoinVendor_IntroText -.loop ; 0xbcde4 +.loop special DisplayMoneyAndCoinBalance loadmenu .MenuHeader verticalmenu @@ -1817,9 +1805,8 @@ CoinVendor_IntroScript: ; 0xbcde0 ifequal 1, .Buy50 ifequal 2, .Buy500 jump .Cancel -; 0xbcdf7 -.Buy50: ; 0xbcdf7 +.Buy50: checkcoins MAX_COINS - 50 ifequal HAVE_MORE, .CoinCaseFull checkmoney YOUR_MONEY, 1000 @@ -1831,9 +1818,8 @@ CoinVendor_IntroScript: ; 0xbcde0 farwritetext CoinVendor_Buy50CoinsText waitbutton jump .loop -; 0xbce1b -.Buy500: ; 0xbce1b +.Buy500: checkcoins MAX_COINS - 500 ifequal HAVE_MORE, .CoinCaseFull checkmoney YOUR_MONEY, 10000 @@ -1845,29 +1831,24 @@ CoinVendor_IntroScript: ; 0xbcde0 farwritetext CoinVendor_Buy500CoinsText waitbutton jump .loop -; 0xbce3f -.NotEnoughMoney: ; 0xbce3f +.NotEnoughMoney: farwritetext CoinVendor_NotEnoughMoneyText waitbutton closetext end -; 0xbce46 -.CoinCaseFull: ; 0xbce46 +.CoinCaseFull: farwritetext CoinVendor_CoinCaseFullText waitbutton closetext end -; 0xbce4d -.Cancel: ; 0xbce4d +.Cancel: farwritetext CoinVendor_CancelText waitbutton closetext end -; 0xbce54 - .MenuHeader: db MENU_BACKUP_TILES ; flags @@ -1881,8 +1862,6 @@ CoinVendor_IntroScript: ; 0xbcde0 db " 50 : ¥1000@" db "500 : ¥10000@" db "CANCEL@" -; 0xbce7f - HappinessCheckScript: faceplayer @@ -1907,9 +1886,8 @@ HappinessCheckScript: closetext end -Movement_ContestResults_WalkAfterWarp: ; bcea1 +Movement_ContestResults_WalkAfterWarp: step RIGHT step DOWN turn_head UP step_end -; bcea5 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index 509d9775d..1a378ede8 100644 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -1,12 +1,11 @@ -SweetScentFromMenu: ; 506bc +SweetScentFromMenu: ld hl, .SweetScent call QueueScript ld a, $1 ld [wFieldMoveSucceeded], a ret -; 506c8 -.SweetScent: ; 0x506c8 +.SweetScent: reloadmappart special UpdateTimePals callasm GetPartyNick @@ -20,20 +19,17 @@ SweetScentFromMenu: ; 506bc startbattle reloadmapafterbattle end -; 0x506e5 -.BugCatchingContest: ; 0x506e5 +.BugCatchingContest: farjump BugCatchingContestBattleScript -; 0x506e9 -SweetScentNothing: ; 0x506e9 +SweetScentNothing: writetext UnknownText_0x5072b waitbutton closetext end -; 0x506ef -SweetScentEncounter: ; 506ef +SweetScentEncounter: farcall CanUseSweetScent jr nc, .no_battle ld hl, wStatusFlags2 @@ -60,16 +56,13 @@ SweetScentEncounter: ; 506ef ld [wScriptVar], a ld [wBattleType], a ret -; 50726 -UnknownText_0x50726: ; 0x50726 +UnknownText_0x50726: ; used SWEET SCENT! text_jump UnknownText_0x1c0b03 db "@" -; 0x5072b -UnknownText_0x5072b: ; 0x5072b +UnknownText_0x5072b: ; Looks like there's nothing here… text_jump UnknownText_0x1c0b1a db "@" -; 0x50730 diff --git a/engine/events/trainer_scripts.asm b/engine/events/trainer_scripts.asm index abfcd8dee..6f0bb2d29 100644 --- a/engine/events/trainer_scripts.asm +++ b/engine/events/trainer_scripts.asm @@ -1,4 +1,4 @@ -TalkToTrainerScript:: ; 0xbe66a +TalkToTrainerScript:: faceplayer trainerflagaction CHECK_FLAG iftrue AlreadyBeatenTrainerScript @@ -6,7 +6,7 @@ TalkToTrainerScript:: ; 0xbe66a encountermusic jump StartBattleWithMapTrainerScript -SeenByTrainerScript:: ; 0xbe675 +SeenByTrainerScript:: loadmemtrainer encountermusic showemote EMOTE_SHOCK, LAST_TALKED, 30 @@ -16,7 +16,7 @@ SeenByTrainerScript:: ; 0xbe675 faceobject PLAYER, LAST_TALKED jump StartBattleWithMapTrainerScript -StartBattleWithMapTrainerScript: ; 0xbe68a +StartBattleWithMapTrainerScript: opentext trainertext $0 waitbutton diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm index 6d55004f4..cd78421d6 100644 --- a/engine/events/treemons.asm +++ b/engine/events/treemons.asm @@ -1,4 +1,4 @@ -TreeMonEncounter: ; b81ea +TreeMonEncounter: farcall StubbedTrainerRankings_TreeEncounters xor a @@ -25,10 +25,8 @@ TreeMonEncounter: ; b81ea xor a ld [wScriptVar], a ret -; b8219 - -RockMonEncounter: ; b8219 +RockMonEncounter: xor a ld [wTempWildMonSpecies], a ld [wCurPartyLevel], a @@ -54,11 +52,10 @@ RockMonEncounter: ; b8219 .no_battle xor a ret -; b823e db $05 ; ???? -GetTreeMonSet: ; b823f +GetTreeMonSet: ; Return carry and treemon set in a ; if the current map is in table hl. ld a, [wMapNumber] @@ -93,11 +90,10 @@ GetTreeMonSet: ; b823f ld a, [hl] scf ret -; b825e INCLUDE "data/wild/treemon_maps.asm" -GetTreeMons: ; b82d2 +GetTreeMons: ; Return the address of TreeMon table a in hl. ; Return nc if table a doesn't exist. @@ -123,11 +119,10 @@ GetTreeMons: ; b82d2 .quit xor a ret -; b82e8 INCLUDE "data/wild/treemons.asm" -GetTreeMon: ; b83e5 +GetTreeMon: push hl call GetTreeScore pop hl @@ -168,9 +163,8 @@ GetTreeMon: ; b83e5 jr nz, .skip call SelectTreeMon ret -; b841f -SelectTreeMon: ; b841f +SelectTreeMon: ; Read a TreeMons table and pick one monster at random. ld a, 100 @@ -195,14 +189,13 @@ SelectTreeMon: ; b841f scf ret -NoTreeMon: ; b843b +NoTreeMon: xor a ld [wTempWildMonSpecies], a ld [wCurPartyLevel], a ret -; b8443 -GetTreeScore: ; b8443 +GetTreeScore: call .CoordScore ld [wBuffer1], a call .OTIDScore @@ -228,9 +221,8 @@ GetTreeScore: ; b8443 .rare ld a, TREEMON_SCORE_RARE ret -; b8466 -.CoordScore: ; b8466 +.CoordScore: call GetFacingTileCoord ld hl, 0 ld c, e @@ -269,9 +261,8 @@ GetTreeScore: ; b8443 ld a, [hQuotient + 3] ret -; b849d -.OTIDScore: ; b849d +.OTIDScore: ld a, [wPlayerID] ld [hDividend], a ld a, [wPlayerID + 1] @@ -282,4 +273,3 @@ GetTreeScore: ; b8443 call Divide ld a, [hQuotient + 3] ret -; b84b3 diff --git a/engine/events/unown_walls.asm b/engine/events/unown_walls.asm index 64558167a..105337630 100644 --- a/engine/events/unown_walls.asm +++ b/engine/events/unown_walls.asm @@ -1,4 +1,4 @@ -HoOhChamber: ; 0x8addb +HoOhChamber: ld hl, wPartySpecies ld a, [hl] cp HO_OH ; is Ho-oh the first Pokémon in the party? @@ -9,9 +9,8 @@ HoOhChamber: ; 0x8addb call EventFlagAction .done ret -; 0x8adef -OmanyteChamber: ; 8adef +OmanyteChamber: call GetMapAttributesPointer ; pointless? ld de, EVENT_WALL_OPENED_IN_OMANYTE_CHAMBER ld b, CHECK_FLAG @@ -51,9 +50,8 @@ OmanyteChamber: ; 8adef .nope ret -; 8ae30 -SpecialAerodactylChamber: ; 8ae30 +SpecialAerodactylChamber: push de push bc @@ -79,9 +77,8 @@ SpecialAerodactylChamber: ; 8ae30 pop bc pop de ret -; 8ae4e -SpecialKabutoChamber: ; 8ae4e +SpecialKabutoChamber: push hl push de @@ -101,9 +98,8 @@ SpecialKabutoChamber: ; 8ae4e pop de pop hl ret -; 8ae68 -DisplayUnownWords: ; 8ae68 +DisplayUnownWords: ld a, [wScriptVar] ld hl, MenuHeaders_UnownWalls and a @@ -151,11 +147,10 @@ DisplayUnownWords: ; 8ae68 call PlayClickSFX call CloseWindow ret -; 8aebc INCLUDE "data/events/unown_walls.asm" -_DisplayUnownWords_FillAttr: ; 8aee9 +_DisplayUnownWords_FillAttr: ld a, [de] cp $ff ret z @@ -170,9 +165,8 @@ _DisplayUnownWords_FillAttr: ; 8aee9 inc hl inc de jr _DisplayUnownWords_FillAttr -; 8aefd -.PlaceSquare: ; 8aefd +.PlaceSquare: push hl ld [hli], a ld [hld], a @@ -183,9 +177,8 @@ _DisplayUnownWords_FillAttr: ; 8aee9 ld [hl], a pop hl ret -; 8af09 -_DisplayUnownWords_CopyWord: ; 8af09 +_DisplayUnownWords_CopyWord: push hl push de .word_loop @@ -203,9 +196,8 @@ _DisplayUnownWords_CopyWord: ; 8af09 pop de pop hl ret -; 8af1c -.ConvertChar: ; 8af1c +.ConvertChar: push hl ld a, c cp $60 @@ -264,4 +256,3 @@ _DisplayUnownWords_CopyWord: ; 8af09 ld [hl], $2 pop hl ret -; 8af6b diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index 4bf656055..82b7a4868 100644 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -1,13 +1,12 @@ -Script_BattleWhiteout:: ; 0x124c1 +Script_BattleWhiteout:: callasm BattleBGMap jump Script_Whiteout -; 0x124c8 -Script_OverworldWhiteout:: ; 0x124c8 +Script_OverworldWhiteout:: refreshscreen callasm OverworldBGMap -Script_Whiteout: ; 0x124ce +Script_Whiteout: writetext .WhitedOutText waitbutton special FadeOutPalettes @@ -24,31 +23,27 @@ Script_Whiteout: ; 0x124ce .bug_contest jumpstd bugcontestresultswarp -; 0x124f5 -.WhitedOutText: ; 0x124f5 +.WhitedOutText: ; is out of useable #MON! whited out! text_jump UnknownText_0x1c0a4e db "@" -; 0x124fa -OverworldBGMap: ; 124fa +OverworldBGMap: call ClearPalettes call ClearScreen call WaitBGMap2 call HideSprites call RotateThreePalettesLeft ret -; 1250a -BattleBGMap: ; 1250a +BattleBGMap: ld b, SCGB_BATTLE_GRAYSCALE call GetSGBLayout call SetPalettes ret -; 12513 -HalveMoney: ; 12513 +HalveMoney: farcall StubbedTrainerRankings_WhiteOuts ; Halve the player's money. @@ -63,10 +58,8 @@ HalveMoney: ; 12513 rra ld [hl], a ret -; 12527 - -GetWhiteoutSpawn: ; 12527 +GetWhiteoutSpawn: ld a, [wLastSpawnMapGroup] ld d, a ld a, [wLastSpawnMapNumber] @@ -79,4 +72,3 @@ GetWhiteoutSpawn: ; 12527 .yes ld [wDefaultSpawnpoint], a ret -; 1253d |