From cd649184f556db777d592671a7274bfa4a8423d7 Mon Sep 17 00:00:00 2001 From: "U-Daniel-PC\\Daniel" Date: Fri, 3 Jul 2015 14:37:53 -0500 Subject: Rename/organize part 1 of 4 rename functions, clean up address/wram comments, other misc only broken up so that all changes are viewable on github --- engine/save.asm | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/save.asm b/engine/save.asm index d3127f04..60af9a81 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -18,7 +18,7 @@ LoadSAV: ; 735e8 (1c:75e8) set 6, [hl] ld hl, FileDataDestroyedText call PrintText - ld c, $64 + ld c, 100 call DelayFrames pop hl res 6, [hl] @@ -54,7 +54,7 @@ LoadSAVCheckSum: ; 73623 (1c:7623) .Func_73652 ; 73652 (1c:7652) ld hl, $a598 - ld de, wPlayerName ; wd158 + ld de, wPlayerName ld bc, $b call CopyData ld hl, $a5a3 @@ -110,11 +110,11 @@ LoadSAVCheckSum2: ; 736bd (1c:76bd) cp c jp nz, SAVBadCheckSum ld hl, $af2c - ld de, wPartyCount ; wPartyCount + ld de, wPartyCount ld bc, $194 call CopyData ld hl, $a5a3 - ld de, wPokedexOwned ; wPokedexOwned + ld de, wPokedexOwned ld bc, wPokedexSeenEnd - wPokedexOwned call CopyData and a @@ -129,12 +129,12 @@ SAVGoodChecksum: ; 736f8 (1c:76f8) ld [MBC1SRamEnable], a ret -Func_73701: ; 0x73701 +Func_73701: ; 73701 (1c:7701) call LoadSAVCheckSum call LoadSAVCheckSum1 jp LoadSAVCheckSum2 -SaveSAV: ;$770a +SaveSAV: ; 7370a (1c:770a) callba PrintSaveScreenText ld hl,WouldYouLikeToSaveText call SaveSAVConfirm @@ -149,22 +149,22 @@ SaveSAV: ;$770a call SaveSAVConfirm and a ret nz -.save ;$772d - call SaveSAVtoSRAM ;$7848 +.save + call SaveSAVtoSRAM hlCoord 1, 13 ld bc,$0412 call ClearScreenArea ; clear area 4x12 starting at 13,1 hlCoord 1, 14 ld de,NowSavingString call PlaceString - ld c,$78 + ld c,120 call DelayFrames ld hl,GameSavedText call PrintText ld a, (SFX_02_5d - SFX_Headers_02) / 3 ;sound for saved game call PlaySoundWaitForCurrent call WaitForSoundToFinish - ld c,$1e + ld c,30 jp DelayFrames NowSavingString: @@ -308,7 +308,7 @@ Func_73863: ; 73863 (1c:7863) ret Func_7387b: ; 7387b (1c:787b) - ld hl, PointerTable_73895 ; $7895 + ld hl, PointerTable_73895 ld a, [wd5a0] and $7f cp $6 @@ -411,21 +411,21 @@ Func_7390e: ; 7390e (1c:790e) Func_7393f: ; 7393f (1c:793f) xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ld a, $3 - ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld [wMenuWatchedKeys], a ld a, $b - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a ld a, $1 - ld [wTopMenuItemY], a ; wTopMenuItemY + ld [wTopMenuItemY], a ld a, $c - ld [wTopMenuItemX], a ; wTopMenuItemX + ld [wTopMenuItemX], a xor a ld [wcc37], a ld a, [wd5a0] and $7f - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wLastMenuItem], a ; wLastMenuItem + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a ld hl, wTileMap ld b, $2 ld c, $9 @@ -438,7 +438,7 @@ Func_7393f: ; 7393f (1c:793f) call TextBoxBorder ld hl, hFlags_0xFFF6 set 2, [hl] - ld de, BoxNames ; $79d9 + ld de, BoxNames hlCoord 13, 1 call PlaceString ld hl, hFlags_0xFFF6 @@ -461,7 +461,7 @@ Func_7393f: ; 7393f (1c:793f) call PlaceString call Func_73a84 hlCoord 18, 1 - ld de, wWhichTrade ; wWhichTrade + ld de, wWhichTrade ld bc, $14 ld a, $c .asm_739c2 @@ -477,7 +477,7 @@ Func_7393f: ; 7393f (1c:793f) dec a jr nz, .asm_739c2 ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ret ChooseABoxText: ; 739d4 (1c:79d4) @@ -545,7 +545,7 @@ Func_73a7f: ; 73a7f (1c:7a7f) ret Func_73a84: ; 73a84 (1c:7a84) - ld hl, wWhichTrade ; wWhichTrade + ld hl, wWhichTrade push hl ld a, SRAM_ENABLE ld [MBC1SRamEnable], a @@ -566,7 +566,7 @@ Func_73a84: ; 73a84 (1c:7a84) ld c, a ld b, $0 add hl, bc - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] ld [hl], a ret @@ -585,7 +585,7 @@ Func_73ab8: ; 73ab8 (1c:7ab8) ld [hli], a ret -SAVCheckRandomID: ;$7ad1 +SAVCheckRandomID: ; 73ad1 (1c:7ad1) ;checks if Sav file is the same by checking player's name 1st letter ($a598) ; and the two random numbers generated at game beginning ;(which are stored at wPlayerID) @@ -646,7 +646,7 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) LoadHallOfFameTeams: ; 73b3f (1c:7b3f) ld hl, sHallOfFame ld bc, HOF_TEAM - ld a, [wWhichTrade] ; wWhichTrade + ld a, [wWhichTrade] call AddNTimes ld de, wcc5b ld bc, HOF_TEAM -- cgit v1.3.1-sl0p From 822bb2bd21110cc5dc7875d70f8c36c15d13cbaf Mon Sep 17 00:00:00 2001 From: dannye Date: Sun, 5 Jul 2015 04:07:09 -0500 Subject: Clean up sram --- engine/save.asm | 160 ++++++++++++++++++++++++++++---------------------------- sram.asm | 46 ++++++++-------- 2 files changed, 103 insertions(+), 103 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/save.asm b/engine/save.asm index 3cc7539a..cc5e6c4a 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -37,39 +37,39 @@ LoadSAVCheckSum: ; 73623 (1c:7623) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, S_SAVEDPLAYERNAME ; hero name located in SRAM - ld bc, $f8b ; but here checks the full SAV + ld hl, sPlayerName ; hero name located in SRAM + ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV call SAVCheckSum ld c, a - ld a, [S_SAVEDMAINDATACHECKSUM] ; SAV's checksum + ld a, [sMainDataCheckSum] ; SAV's checksum cp c jp z, .Func_73652 - ld hl, S_SAVEDPLAYERNAME - ld bc, $f8b + ld hl, sPlayerName + ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld c, a - ld a, [S_SAVEDMAINDATACHECKSUM] ; SAV's checksum + ld a, [sMainDataCheckSum] ; SAV's checksum cp c jp nz, SAVBadCheckSum .Func_73652 ; 73652 (1c:7652) - ld hl, S_SAVEDPLAYERNAME + ld hl, sPlayerName ld de, wPlayerName - ld bc, $b + ld bc, 11 call CopyData - ld hl, S_SAVEDMAINDATA + ld hl, sMainData ld de, wPokedexOwned - ld bc, $789 + ld bc, sSpriteData - sMainData call CopyData ld hl, W_CURMAPTILESET set 7, [hl] - ld hl, S_SAVEDSPRITEDATA + ld hl, sSpriteData ld de, wSpriteStateData1 - ld bc, $200 + ld bc, sPartyData - sSpriteData call CopyData - ld a, [S_SAVEDhTilesetType] + ld a, [sTilesetType] ld [hTilesetType], a - ld hl, S_SAVEDCURBOXDATA + ld hl, sCurBoxData ld de, W_NUMINBOX ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData @@ -82,14 +82,14 @@ LoadSAVCheckSum1: ; 73690 (1c:7690) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, S_SAVEDPLAYERNAME ; hero name located in SRAM - ld bc, $f8b ; but here checks the full SAV + ld hl, sPlayerName ; hero name located in SRAM + ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV call SAVCheckSum ld c, a - ld a, [S_SAVEDMAINDATACHECKSUM] ; SAV's checksum + ld a, [sMainDataCheckSum] ; SAV's checksum cp c jr nz, SAVBadCheckSum - ld hl, S_SAVEDCURBOXDATA + ld hl, sCurBoxData ld de, W_NUMINBOX ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData @@ -102,18 +102,18 @@ LoadSAVCheckSum2: ; 736bd (1c:76bd) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, S_SAVEDPLAYERNAME ; hero name located in SRAM - ld bc, $f8b ; but here checks the full SAV + ld hl, sPlayerName ; hero name located in SRAM + ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV call SAVCheckSum ld c, a - ld a, [S_SAVEDMAINDATACHECKSUM] ; SAV's checksum + ld a, [sMainDataCheckSum] ; SAV's checksum cp c jp nz, SAVBadCheckSum - ld hl, S_SAVEDPARTYDATA + ld hl, sPartyData ld de, wPartyCount ld bc, wPokedexOwned - wPartyCount call CopyData - ld hl, S_SAVEDMAINDATA + ld hl, sMainData ld de, wPokedexOwned ld bc, wPokedexSeenEnd - wPokedexOwned call CopyData @@ -199,27 +199,27 @@ SaveSAVtoSRAM0: ; 7378c (1c:778c) ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, wPlayerName - ld de, S_SAVEDPLAYERNAME - ld bc, $b + ld de, sPlayerName + ld bc, 11 call CopyData ld hl, wPokedexOwned - ld de, S_SAVEDMAINDATA + ld de, sMainData ld bc, W_NUMINBOX - wPokedexOwned call CopyData ld hl, wSpriteStateData1 - ld de, S_SAVEDSPRITEDATA - ld bc, $200 + ld de, sSpriteData + ld bc, sPartyData - sSpriteData call CopyData ld hl, W_NUMINBOX - ld de, S_SAVEDCURBOXDATA + ld de, sCurBoxData ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData ld a, [hTilesetType] - ld [S_SAVEDhTilesetType], a - ld hl, S_SAVEDPLAYERNAME - ld bc, $f8b + ld [sTilesetType], a + ld hl, sPlayerName + ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum - ld [S_SAVEDMAINDATACHECKSUM], a + ld [sMainDataCheckSum], a xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a @@ -233,13 +233,13 @@ SaveSAVtoSRAM1: ; 737e2 (1c:77e2) ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, W_NUMINBOX - ld de, S_SAVEDCURBOXDATA + ld de, sCurBoxData ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData - ld hl, S_SAVEDPLAYERNAME - ld bc, $f8b + ld hl, sPlayerName + ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum - ld [S_SAVEDMAINDATACHECKSUM], a + ld [sMainDataCheckSum], a xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a @@ -252,17 +252,17 @@ SaveSAVtoSRAM2: ; 7380f (1c:780f) ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a ld hl, wPartyCount - ld de, S_SAVEDPARTYDATA + ld de, sPartyData ld bc, wPokedexOwned - wPartyCount call CopyData ld hl, wPokedexOwned ; pokédex only - ld de, S_SAVEDMAINDATA + ld de, sMainData ld bc, wPokedexSeenEnd - wPokedexOwned call CopyData - ld hl, S_SAVEDPLAYERNAME - ld bc, $f8b + ld hl, sPlayerName + ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum - ld [S_SAVEDMAINDATACHECKSUM], a + ld [sMainDataCheckSum], a xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a @@ -291,13 +291,13 @@ SAVCheckSum: ; 73856 (1c:7856) ret Func_73863: ; 73863 (1c:7863) - ld hl, $a000 - ld de, S_SAVEDBOXES1CHECKSUM2 ; S_SAVEDBOXES2CHECKSUM2 - ld b, $6 + ld hl, sBox1 ; sBox7 + ld de, sBoxes1CheckSum2 ; sBoxes2CheckSum2 + ld b, NUM_BOXES / 2 .asm_7386b push bc push de - ld bc, $462 + ld bc, wBoxMonNicksEnd - W_NUMINBOX call SAVCheckSum pop de ld [de], a @@ -311,11 +311,11 @@ Func_7387b: ; 7387b (1c:787b) ld hl, PointerTable_73895 ld a, [wd5a0] and $7f - cp $6 + cp NUM_BOXES / 2 ld b, $2 jr c, .asm_7388c inc b - sub $6 + sub NUM_BOXES / 2 .asm_7388c ld e, a ld d, $0 @@ -327,12 +327,12 @@ Func_7387b: ; 7387b (1c:787b) ret PointerTable_73895: ; 73895 (1c:7895) - dw S_SAVEDBOX1 ; S_SAVEDBOX7 - dw S_SAVEDBOX2 ; S_SAVEDBOX8 - dw S_SAVEDBOX3 ; S_SAVEDBOX9 - dw S_SAVEDBOX4 ; S_SAVEDBOX10 - dw S_SAVEDBOX5 ; S_SAVEDBOX11 - dw S_SAVEDBOX6 ; S_SAVEDBOX12 + dw sBox1 ; sBox7 + dw sBox2 ; sBox8 + dw sBox3 ; sBox9 + dw sBox4 ; sBox10 + dw sBox5 ; sBox11 + dw sBox6 ; sBox12 ChangeBox:: ; 738a1 (1c:78a1) ld hl, WhenYouChangeBoxText @@ -392,17 +392,17 @@ Func_7390e: ; 7390e (1c:790e) ld [MBC1SRamBankingMode], a ld a, b ld [MBC1SRamBank], a - ld bc, $462 + ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData pop hl xor a ld [hli], a dec a ld [hl], a - ld hl, $a000 - ld bc, $1a4c + ld hl, sBox1 ; sBox7 + ld bc, sBoxes1CheckSum - sBox1 call SAVCheckSum - ld [S_SAVEDBOXES1CHECKSUM], a ; S_SAVEDBOXES2CHECKSUM + ld [sBoxes1CheckSum], a ; sBoxes2CheckSum call Func_73863 xor a ld [MBC1SRamBankingMode], a @@ -518,22 +518,22 @@ Func_73a29: ; 73a29 (1c:7a29) ret Func_73a4b: ; 73a4b (1c:7a4b) - ld hl, S_SAVEDBOX1 ; S_SAVEDBOX7 + ld hl, sBox1 ; sBox7 call Func_73a7f - ld hl, S_SAVEDBOX2 ; S_SAVEDBOX8 + ld hl, sBox2 ; sBox8 call Func_73a7f - ld hl, S_SAVEDBOX3 ; S_SAVEDBOX9 + ld hl, sBox3 ; sBox9 call Func_73a7f - ld hl, S_SAVEDBOX4 ; S_SAVEDBOX10 + ld hl, sBox4 ; sBox10 call Func_73a7f - ld hl, S_SAVEDBOX5 ; S_SAVEDBOX11 + ld hl, sBox5 ; sBox11 call Func_73a7f - ld hl, S_SAVEDBOX6 ; S_SAVEDBOX12 + ld hl, sBox6 ; sBox12 call Func_73a7f - ld hl, S_SAVEDBOX1 ; S_SAVEDBOX7 - ld bc, $6 * (S_SAVEDBOX2 - S_SAVEDBOX1) ; $1a4c + ld hl, sBox1 ; sBox7 + ld bc, sBoxes1CheckSum - sBox1 call SAVCheckSum - ld [S_SAVEDBOXES1CHECKSUM], a ; S_SAVEDBOXES2CHECKSUM + ld [sBoxes1CheckSum], a ; sBoxes2CheckSum call Func_73863 ret @@ -571,17 +571,17 @@ Func_73a84: ; 73a84 (1c:7a84) ret Func_73ab8: ; 73ab8 (1c:7ab8) - ld a, [S_SAVEDBOX1] ; S_SAVEDBOX7 + ld a, [sBox1] ; sBox7 ld [hli], a - ld a, [S_SAVEDBOX2] ; S_SAVEDBOX8 + ld a, [sBox2] ; sBox8 ld [hli], a - ld a, [S_SAVEDBOX3] ; S_SAVEDBOX9 + ld a, [sBox3] ; sBox9 ld [hli], a - ld a, [S_SAVEDBOX4] ; S_SAVEDBOX10 + ld a, [sBox4] ; sBox10 ld [hli], a - ld a, [S_SAVEDBOX5] ; S_SAVEDBOX11 + ld a, [sBox5] ; sBox11 ld [hli], a - ld a, [S_SAVEDBOX6] ; S_SAVEDBOX12 + ld a, [sBox6] ; sBox12 ld [hli], a ret @@ -590,21 +590,21 @@ SAVCheckRandomID: ; 73ad1 (1c:7ad1) ; and the two random numbers generated at game beginning ;(which are stored at wPlayerID)s ld a,$0a - ld [$0000],a + ld [MBC1SRamEnable],a ld a,$01 ld [MBC1SRamBankingMode],a ld [MBC1SRamBank],a - ld a,[S_SAVEDPLAYERNAME] + ld a,[sPlayerName] and a jr z,.next - ld hl,S_SAVEDPLAYERNAME - ld bc,$0f8b + ld hl,sPlayerName + ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum ld c,a - ld a,[S_SAVEDMAINDATACHECKSUM] + ld a,[sMainDataCheckSum] cp c jr nz,.next - ld hl,S_SAVEDMAINDATA + 98 ; player ID + ld hl,sMainData + 98 ; player ID ld a,[hli] ld h,[hl] ld l,a @@ -616,7 +616,7 @@ SAVCheckRandomID: ; 73ad1 (1c:7ad1) .next ld a,$00 ld [MBC1SRamBankingMode],a - ld [$0000],a + ld [MBC1SRamEnable],a ret SaveHallOfFameTeams: ; 73b0d (1c:7b0d) diff --git a/sram.asm b/sram.asm index 0528d80f..f20f8adf 100644 --- a/sram.asm +++ b/sram.asm @@ -12,34 +12,34 @@ sHallOfFame:: ds HOF_TEAM * NUM_HOF_TEAMS ; a598 SECTION "Save Data", SRAM, BANK[1] ds $598 -S_SAVEDPLAYERNAME:: ds 11 ; a598 -S_SAVEDMAINDATA:: ds W_NUMINBOX - wPokedexOwned ; a5a3 -S_SAVEDSPRITEDATA:: ds $200 ; wOAMBuffer - wSpriteStateData1 ; ad2c -S_SAVEDPARTYDATA:: ds wPokedexOwned - wPartyCount ; af2c -S_SAVEDCURBOXDATA:: ds wBoxMonNicksEnd - W_NUMINBOX ; b0c0 -S_SAVEDhTilesetType:: ds 1 ; b522 -S_SAVEDMAINDATACHECKSUM:: ds 1 ; b523 +sPlayerName:: ds 11 ; a598 +sMainData:: ds W_NUMINBOX - wPokedexOwned ; a5a3 +sSpriteData:: ds $200 ; wOAMBuffer - wSpriteStateData1 ; ad2c +sPartyData:: ds wPokedexOwned - wPartyCount ; af2c +sCurBoxData:: ds wBoxMonNicksEnd - W_NUMINBOX ; b0c0 +sTilesetType:: ds 1 ; b522 +sMainDataCheckSum:: ds 1 ; b523 SECTION "Saved Boxes 1", SRAM, BANK[2] -S_SAVEDBOX1:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -S_SAVEDBOX2:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -S_SAVEDBOX3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -S_SAVEDBOX4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -S_SAVEDBOX5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -S_SAVEDBOX6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea -S_SAVEDBOXES1CHECKSUM:: ds 1 ; ba4c -S_SAVEDBOXES1CHECKSUM2:: ds 6 ; ba4d +sBox1:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 +sBox2:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 +sBox3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 +sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 +sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 +sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBoxes1CheckSum:: ds 1 ; ba4c +sBoxes1CheckSum2:: ds 6 ; ba4d SECTION "Saved Boxes 2", SRAM, BANK[3] -S_SAVEDBOX7:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -S_SAVEDBOX8:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -S_SAVEDBOX9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -S_SAVEDBOX10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -S_SAVEDBOX11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -S_SAVEDBOX12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea -S_SAVEDBOXES2CHECKSUM:: ds 1 ; ba4c -S_SAVEDBOXES2CHECKSUM2:: ds 6 ; ba4d +sBox7:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 +sBox8:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 +sBox9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 +sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 +sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 +sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBoxes2CheckSum:: ds 1 ; ba4c +sBoxes2CheckSum2:: ds 6 ; ba4d -- cgit v1.3.1-sl0p From 95b1660e59283b6f76dca638985c76a7d81d026f Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 13 Jul 2015 00:32:03 -0700 Subject: menu wram variable names --- engine/battle/core.asm | 2 +- engine/cable_club.asm | 8 ++++---- engine/menu/pokedex.asm | 6 +++--- engine/save.asm | 2 +- engine/slot_machine.asm | 2 +- home.asm | 22 +++++++++++----------- main.asm | 10 +++++----- wram.asm | 11 +++++++++-- 8 files changed, 35 insertions(+), 28 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 95242f5d..f37da950 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2305,7 +2305,7 @@ DisplayBagMenu: ld a, [wCurrentMenuItem] ld [wcc2c], a ld a, $0 - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld [wMenuItemToSwap], a jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected diff --git a/engine/cable_club.asm b/engine/cable_club.asm index c115ed4a..13a95ed5 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -317,7 +317,7 @@ TradeCenter_SelectMon: ld [hli], a ld [hli], a ld [hl], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuJoypadPollCount], a @@ -326,7 +326,7 @@ TradeCenter_SelectMon: jp .playerMonMenu .enemyMonMenu xor a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a inc a ld [wWhichTradeMonSelectionMenu], a ld a, D_DOWN | D_LEFT | A_BUTTON @@ -390,7 +390,7 @@ TradeCenter_SelectMon: .playerMonMenu xor a ; player mon menu ld [wWhichTradeMonSelectionMenu], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld a, D_DOWN | D_RIGHT | A_BUTTON ld [wMenuWatchedKeys], a ld a, [wPartyCount] @@ -682,7 +682,7 @@ TradeCenter_Trade: xor a ld [wSerialExchangeNybbleSendData + 1], a ; unnecessary ld [wSerialExchangeNybbleReceiveData], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a hlCoord 0, 12 ld b, 4 diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index e2e53d45..b8686a07 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -22,7 +22,7 @@ ShowPokedexMenu: ; 40000 (10:4000) xor a ld [hli],a ; top menu item X inc a - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a inc hl inc hl ld a,6 @@ -32,7 +32,7 @@ ShowPokedexMenu: ; 40000 (10:4000) jr c,.goToSideMenu ; if the player chose a pokemon from the list .exitPokedex xor a - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a ld [wCurrentMenuItem],a ld [wLastMenuItem],a ld [hJoy7],a @@ -91,7 +91,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) ld [hli],a ; menu watched keys (A button and B button) xor a ld [hli],a ; old menu item ID - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a .handleMenuInput call HandleMenuInput bit 1,a ; was the B button pressed? diff --git a/engine/save.asm b/engine/save.asm index cc5e6c4a..2ef59263 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -421,7 +421,7 @@ Func_7393f: ; 7393f (1c:793f) ld a, $c ld [wTopMenuItemX], a xor a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld a, [wd5a0] and $7f ld [wCurrentMenuItem], a diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 0b9f8bc9..6dae7293 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -78,7 +78,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld hl, wTileMap + $ea ld b, $5 ld c, $4 diff --git a/home.asm b/home.asm index 51e10118..f6a1c914 100644 --- a/home.asm +++ b/home.asm @@ -378,7 +378,7 @@ PartyMenuInit:: ; 1420 (0:1420) set 6, [hl] ; turn off letter printing delay xor a ld [wcc49], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld hl, wTopMenuItemY inc a ld [hli], a ; top menu item Y @@ -1391,13 +1391,13 @@ DisplayListMenuID:: ; 2be6 (0:2be6) set 6,[hl] ; turn off letter printing delay xor a ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped - ld [wd12a],a + ld [wListCount],a ld a,[wList] ld l,a ld a,[wList + 1] ld h,a ; hl = address of the list - ld a,[hl] - ld [wd12a],a ; [wd12a] = number of list entries + ld a,[hl] ; the first byte is the number of entries in the list + ld [wListCount],a ld a,LIST_MENU_BOX ld [wTextBoxID],a call DisplayTextBoxID ; draw the menu text box @@ -1411,8 +1411,8 @@ DisplayListMenuID:: ; 2be6 (0:2be6) call UpdateSprites .skipMovingSprites ld a,1 ; max menu item ID is 1 if the list has less than 2 entries - ld [wcc37],a - ld a,[wd12a] + ld [wMenuWatchMovingOutOfBounds],a + ld a,[wListCount] cp a,2 ; does the list have less than 2 entries? jr c,.setMenuVariables ld a,2 ; max menu item ID is 2 if the list has at least 2 entries @@ -1468,13 +1468,13 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) ld [wChosenMenuItem],a xor a - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a ld a,[wCurrentMenuItem] ld c,a ld a,[wListScrollOffset] add c ld c,a - ld a,[wd12a] ; number of list entries + ld a,[wListCount] and a ; is the list empty? jp z,ExitListMenu ; if so, exit the menu dec a @@ -1552,7 +1552,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) ld a,[hl] add a,3 ld b,a - ld a,[wd12a] ; number of list entries + ld a,[wListCount] cp b ; will going down scroll past the Cancel button? jp c,DisplayListMenuIDLoop inc [hl] ; if not, go down @@ -1694,7 +1694,7 @@ ExitListMenu:: ; 2e3b (0:2e3b) ld [wChosenMenuItem],a ld a,CANCELLED_MENU ld [wMenuExitMethod],a - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a xor a ld [hJoy7],a ld hl,wd730 @@ -4026,7 +4026,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) ld a,[hJoy5] ret .noWrappingAround - ld a,[wcc37] + ld a,[wMenuWatchMovingOutOfBounds] and a ; should we return if the user tried to go past the top or bottom? jr z,.checkOtherKeys jr .checkIfAButtonOrBButtonPressed diff --git a/main.asm b/main.asm index 54440e60..3a1e0621 100755 --- a/main.asm +++ b/main.asm @@ -922,7 +922,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44) ld l,a dec [hl] ; decrease the number of items ld a,[hl] - ld [wd12a],a ; update number of items variable + ld [wListCount],a ; update number of items variable cp a,1 jr nz,.skipSettingMaxMenuItemID ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID @@ -1094,7 +1094,7 @@ DrawStartMenu: ; 710b (1:710b) ld [wCurrentMenuItem],a ld [wLastMenuItem],a xor a - ld [wcc37],a + ld [wMenuWatchMovingOutOfBounds],a ld hl,wd730 set 6,[hl] ; no pauses between printing each letter hlCoord 12, 2 @@ -1472,7 +1472,7 @@ DoBuySellQuitMenu: ; 74ea (1:74ea) xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a ld a, [wd730] res 6, a ; turn on the printing delay ld [wd730], a @@ -1528,7 +1528,7 @@ DisplayTwoOptionMenu: ; 7559 (1:7559) ld [wTopMenuItemX], a xor a ld [wLastMenuItem], a - ld [wcc37], a + ld [wMenuWatchMovingOutOfBounds], a push hl ld hl, wTwoOptionMenuID bit 7, [hl] ; select second menu item by default? @@ -2917,7 +2917,7 @@ RemoveItemFromInventory_: ; ce74 (3:4e74) ld a,[hl] ; a = number of items in inventory dec a ; decrement the number of items ld [hl],a ; store new number of items - ld [wd12a],a + ld [wListCount],a cp a,2 jr c,.done ld [wMaxMenuItem],a diff --git a/wram.asm b/wram.asm index c5f06e53..a1b9f1d3 100755 --- a/wram.asm +++ b/wram.asm @@ -266,7 +266,12 @@ wListScrollOffset:: ; cc36 ; keeps track of what section of the list is on screen ds 1 -wcc37:: ds 1 ; menu related thing, used in pokedex and dialog boxes +wMenuWatchMovingOutOfBounds:: ; cc37 +; If non-zero, then when wrapping is disabled and the player tries to go past +; the top or bottom of the menu, return from HandleMenuInput. This is useful for +; menus that have too many items to display at once on the screen because it +; allows the caller to scroll the entire menu up or down when this happens. + ds 1 wTradeCenterPointerTableIndex:: ; cc38 ds 1 @@ -1409,7 +1414,9 @@ wItemListPointer:: ; d128 ; pointer to list of items terminated by $FF ds 2 -wd12a:: ds 1 ; Number of list entries for displaying a list +wListCount:: +; number of entries in a list + ds 1 wLinkState:: ; d12b ds 1 -- cgit v1.3.1-sl0p From b509b48a7f5a9a80225b9c030d7334b26b521c62 Mon Sep 17 00:00:00 2001 From: dannye Date: Tue, 14 Jul 2015 00:21:03 -0500 Subject: Use more *Coord also town map code relabelling YamaArashi just did town map relabelling but oh well I aleady made the changes and don't feel like redoing it --- data/town_map_order.asm | 1 + engine/HoF_room_pc.asm | 23 ++--- engine/battle/animations.asm | 4 +- engine/battle/battle_transitions.asm | 10 +-- engine/battle/core.asm | 10 +-- engine/evos_moves.asm | 2 +- engine/hidden_object_functions17.asm | 10 +-- engine/hidden_object_functions3.asm | 2 +- engine/hidden_object_functions7.asm | 4 +- engine/intro.asm | 2 +- engine/menu/bills_pc.asm | 8 +- engine/menu/diploma.asm | 12 +-- engine/menu/main_menu.asm | 12 +-- engine/menu/naming_screen.asm | 2 +- engine/menu/players_pc.asm | 2 +- engine/menu/prize_menu.asm | 36 ++++---- engine/menu/start_sub_menus.asm | 2 +- engine/oak_speech2.asm | 4 +- engine/overworld/cinnabar_lab.asm | 2 +- engine/overworld/movement.asm | 2 +- engine/save.asm | 2 +- engine/slot_machine.asm | 4 +- engine/town_map.asm | 165 +++++++++++++++++------------------ engine/trade.asm | 2 +- home.asm | 10 +-- home/copy2.asm | 8 +- home/overworld.asm | 8 +- home/text.asm | 2 +- main.asm | 4 +- scripts/bikeshop.asm | 2 +- scripts/celadonmartroof.asm | 2 +- scripts/redshouse1f.asm | 2 +- 32 files changed, 182 insertions(+), 179 deletions(-) (limited to 'engine/save.asm') diff --git a/data/town_map_order.asm b/data/town_map_order.asm index 3bd8c223..4fb4f33b 100755 --- a/data/town_map_order.asm +++ b/data/town_map_order.asm @@ -46,3 +46,4 @@ TownMapOrder: ; 70f11 (1c:4f11) db VICTORY_ROAD_3 db INDIGO_PLATEAU db POWER_PLANT +TownMapOrderEnd: diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index c33e9141..de048ffe 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -14,10 +14,10 @@ HallOfFamePC: ; 7405c (1d:405c) ld bc, $10 ld a, $ff call FillMemory - ld hl, wTileMap - call Func_7417b + hlCoord 0, 0 + call FillFourRowsWithBlack hlCoord 0, 14 - call Func_7417b + call FillFourRowsWithBlack ld a, $c0 ld [rBGP], a call EnableLCD @@ -34,7 +34,7 @@ HallOfFamePC: ; 7405c (1d:405c) jp Credits Func_740ba: ; 740ba (1d:40ba) - ld hl, DataTable_74160 + ld hl, HoFGBPalettes ld b, $4 .asm_740bf ld a, [hli] @@ -123,8 +123,11 @@ Func_74152: ; 74152 (1d:4152) jr z, .asm_7415a ret -DataTable_74160: ; 74160 (1d:4160) - db $C0,$D0,$E0,$F0 +HoFGBPalettes: ; 74160 (1d:4160) + db %11000000 + db %11010000 + db %11100000 + db %11110000 Func_74164: ; 74164 (1d:4164) ld a, l @@ -145,14 +148,14 @@ Func_74171: ; 74171 (1d:4171) jr nz, Func_74171 ret -Func_7417b: ; 7417b (1d:417b) - ld bc, $50 +FillFourRowsWithBlack: ; 7417b (1d:417b) + ld bc, SCREEN_WIDTH * 4 ld a, $7e jp FillMemory FillMiddleOfScreenWithWhite: ; 74183 (1d:4183) hlCoord 0, 4 - ld bc, $c8 ; 10 rows of 20 tiles each + ld bc, SCREEN_WIDTH * 10 ld a, $7f ; blank white tile jp FillMemory @@ -254,5 +257,5 @@ INCLUDE "data/credits_order.asm" INCLUDE "text/credits_text.asm" -TheEndGfx: ; 7473e (1d:473e) ; 473E (473F on blue) +TheEndGfx: ; 7473e (1d:473e) (7473f on blue) INCBIN "gfx/theend.interleave.2bpp" diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index cdd28422..3321b738 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -2184,7 +2184,7 @@ Func_7980c: ; 7980c (1e:580c) push bc ld e, a ld d, $0 - ld hl, wTileMap + hlCoord 0, 0 add hl, de ld bc, $707 call ClearScreenArea @@ -2206,7 +2206,7 @@ GetMonSpriteTileMapPointerFromRowCount: ; 79820 (1e:5820) .enemyTurn ld a, 12 .next - ld hl, wTileMap + hlCoord 0, 0 ld e, a ld d, 0 add hl, de diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index b231459d..3315b36a 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -231,7 +231,7 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72) BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) ld a, $7 ld [wWhichTrade], a - ld hl, wTileMap + hlCoord 0, 0 ld c, $11 ld de, $14 call BattleTransition_InwardSpiral_ @@ -410,7 +410,7 @@ BattleTransition_Split: ; 70bca (1c:4bca) ld bc, $ffd8 call BattleTransition_CopyTiles1 hlCoord 0, 1 - ld de, wTileMap + deCoord 0, 0 ld bc, $28 call BattleTransition_CopyTiles1 hlCoord 18, 0 @@ -418,7 +418,7 @@ BattleTransition_Split: ; 70bca (1c:4bca) ld bc, $fffe call BattleTransition_CopyTiles2 hlCoord 1, 0 - ld de, wTileMap + deCoord 0, 0 ld bc, $2 call BattleTransition_CopyTiles2 call BattleTransition_TransferDelay3 @@ -514,7 +514,7 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ; used for high level wild dungeon battles BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) ld c, $12 - ld hl, wTileMap + hlCoord 0, 0 deCoord 1, 17 xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -553,7 +553,7 @@ BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ; used for low level wild dungeon battles BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) ld c, $14 - ld hl, wTileMap + hlCoord 0, 0 deCoord 19, 1 xor a ld [H_AUTOBGTRANSFERENABLED], a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ec67d094..52beca1a 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -117,7 +117,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) or c jr nz, .clearBackgroundLoop ; copy the work RAM tile map to VRAM - ld hl, wTileMap + hlCoord 0, 0 ld de, vBGMap0 ld b, 18 ; number of rows .copyRowLoop @@ -855,7 +855,7 @@ FaintEnemyPokemon: ; 0x3c567 hlCoord 12, 5 deCoord 12, 6 call SlideDownFaintedMonPic - ld hl, wTileMap + hlCoord 0, 0 ld bc, $40b call ClearScreenArea ld a, [W_ISINBATTLE] @@ -1214,7 +1214,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) ld a, [W_CUROPPONENT] cp $c8 + SONY1 jr nz, .notSony1Battle - ld hl, wTileMap ; sony 1 battle + hlCoord 0, 0 ; sony 1 battle ld bc, $815 call ClearScreenArea call ScrollTrainerPicAfterBattle @@ -1489,7 +1489,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) call LoadScreenTilesFromBuffer1 .next4 call ClearSprites - ld hl,wTileMap + hlCoord 0, 0 ld bc,$040B call ClearScreenArea ld b,1 @@ -1952,7 +1952,7 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) xor a ld [H_AUTOBGTRANSFERENABLED], a - ld hl, wTileMap + hlCoord 0, 0 ld bc, $40c call ClearScreenArea callab PlaceEnemyHUDTiles diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index bddaffe5..c4af3951 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -121,7 +121,7 @@ Evolution_PartyMonLoop: ; loop over party mons call DelayFrames xor a ld [H_AUTOBGTRANSFERENABLED], a - ld hl, wTileMap + hlCoord 0, 0 ld bc, $c14 call ClearScreenArea ld a, $1 diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 46140927..a8b4f812 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -109,11 +109,11 @@ LinkCableHelp: ; 5dc29 (17:5c29) .asm_5c51 ld hl, wd730 set 6, [hl] - ld hl, wTileMap + hlCoord 0, 0 ld b, $8 ld c, $d call TextBoxBorder - ld hl, wTileMap + $2a + hlCoord 2, 2 ld de, HowToLinkText call PlaceString ld hl, LinkCableHelpText2 @@ -193,13 +193,13 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) .asm_5dd15 ld hl, wd730 set 6, [hl] - ld hl, wTileMap + hlCoord 0, 0 ld bc, $060a call TextBoxBorder - ld hl, wTileMap + $29 + hlCoord 1, 2 ld de, StatusAilmentText1 call PlaceString - ld hl, wTileMap + $2e + hlCoord 6, 2 ld de, StatusAilmentText2 call PlaceString ld hl, ViridianSchoolBlackboardText2 diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index c40073cb..8502cea8 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -107,7 +107,7 @@ BookOrSculptureText: ; fbe8 (3:7be8) ld a, [W_CURMAPTILESET] cp MANSION ; Celadon Mansion tileset jr nz, .asm_fbfd - ld a, [wTileMap + $80] + aCoord 8, 6 cp $38 jr nz, .asm_fbfd ld hl, DiglettSculptureText diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index f29b0925..3c3b2fb0 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -401,11 +401,11 @@ BillsHousePokemonList: ; 1ec05 (7:6c05) .asm_1ec2d ld hl, wd730 set 6, [hl] - ld hl, wTileMap + hlCoord 0, 0 ld b, $a ld c, $9 call TextBoxBorder - ld hl, wTileMap + $2a + hlCoord 2, 2 ld de, BillsMonListText call PlaceString ld hl, BillsHousePokemonListText2 diff --git a/engine/intro.asm b/engine/intro.asm index 2043771d..c306555d 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -330,7 +330,7 @@ PlayShootingStar: ; 4188a (10:588a) Func_418e9: ; 418e9 (10:58e9) call Func_417f0 - ld hl, wTileMap + hlCoord 0, 0 ld c, $50 call Func_41807 hlCoord 0, 14 diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index c9dd41b1..b42a34f0 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -11,17 +11,17 @@ Func_213c8:: ; 213c8 (8:53c8) ld a, [wd5a2] and a jr nz, .asm_213f3 - ld hl, wTileMap + hlCoord 0, 0 ld b, $8 ld c, $e jr .asm_213fa .asm_213ea - ld hl, wTileMap + hlCoord 0, 0 ld b, $6 ld c, $e jr .asm_213fa .asm_213f3 - ld hl, wTileMap + hlCoord 0, 0 ld b, $a ld c, $e .asm_213fa @@ -122,7 +122,7 @@ BillsPCMenu: ld bc, (BANK(PokeballTileGraphics) << 8) + $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer - ld hl, wTileMap + hlCoord 0, 0 ld b, $a ld c, $c call TextBoxBorder diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm index 067cd7d2..a1a0e526 100755 --- a/engine/menu/diploma.asm +++ b/engine/menu/diploma.asm @@ -12,7 +12,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld bc, $0010 ld a, BANK(CircleTile) call FarCopyData2 - ld hl, wTileMap + hlCoord 0, 0 ld bc, $1012 predef Diploma_TextBoxBorder ld hl, DiplomaTextPointersAndCoords @@ -77,15 +77,15 @@ Func_56777: ; 56777 (15:6777) DiplomaTextPointersAndCoords: ; 56784 (15:6784) dw DiplomaText - dw wTileMap + $2d + dwCoord 5, 2 dw DiplomaPlayer - dw wTileMap + $53 + dwCoord 3, 4 dw DiplomaEmptyText - dw wTileMap + $5f + dwCoord 15, 4 dw DiplomaCongrats - dw wTileMap + $7a + dwCoord 2, 6 dw DiplomaGameFreak - dw wTileMap + $149 + dwCoord 9, 16 DiplomaText: db $70,"Diploma",$70,"@" diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index f0628367..f6d3e127 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -363,23 +363,23 @@ ContinueGame: ; 5db5 (1:5db5) PrintSaveScreenText: ; 5def (1:5def) xor a ld [H_AUTOBGTRANSFERENABLED], a - ld hl, wTileMap + $4 + hlCoord 4, 0 ld b, $8 ld c, $e call TextBoxBorder call LoadTextBoxTilePatterns call UpdateSprites - ld hl, wTileMap + $2d + hlCoord 5, 2 ld de, SaveScreenInfoText call PlaceString - ld hl, wTileMap + $34 + hlCoord 12, 2 ld de, wPlayerName call PlaceString - ld hl, wTileMap + $61 + hlCoord 17, 4 call Func_5e2f - ld hl, wTileMap + $88 + hlCoord 16, 6 call Func_5e42 - ld hl, wTileMap + $ad + hlCoord 13, 8 call Func_5e55 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index bd1c39dd..a5a71b73 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -4,7 +4,7 @@ AskName: ; 64eb (1:64eb) push hl ld a, [W_ISINBATTLE] dec a - ld hl, wTileMap + hlCoord 0, 0 ld b, $4 ld c, $b call z, ClearScreenArea ; only if in wild batle diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index 147a27a4..e4973dd4 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -21,7 +21,7 @@ Func_790c: ; 790c (1:790c) ld hl, wFlags_0xcd60 set 5, [hl] call LoadScreenTilesFromBuffer2 - ld hl, wTileMap + hlCoord 0, 0 ld b, $8 ld c, $e call TextBoxBorder diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index d12308f8..acc18633 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -21,12 +21,12 @@ CeladonPrizeMenu: ; 5271b (14:671b) ld [wTopMenuItemY],a ld a,$01 ld [wTopMenuItemX],a - call PrintPrizePrice ; 687A + call PrintPrizePrice hlCoord 0, 2 ld b,$08 ld c,$10 call TextBoxBorder - call GetPrizeMenuId ;678E + call GetPrizeMenuId call UpdateSprites ld hl,WhichPrizeTextPtr call PrintText @@ -36,7 +36,7 @@ CeladonPrizeMenu: ; 5271b (14:671b) ld a,[wCurrentMenuItem] cp a,$03 ; "NO,THANKS" choice jr z,.NoChoice - call HandlePrizeChoice ; 14:68C6 + call HandlePrizeChoice .NoChoice ld hl,wd730 res 6,[hl] @@ -106,7 +106,7 @@ GetPrizeMenuId: ; 5278e (14:678e) hlCoord 2, 8 call PlaceString jr .putNoThanksText -.putMonName ; 14:67EC +.putMonName ld a,[W_PRIZE1] ld [wd11e],a call GetMonName @@ -122,7 +122,7 @@ GetPrizeMenuId: ; 5278e (14:678e) call GetMonName hlCoord 2, 8 call PlaceString -.putNoThanksText ; 14:6819 +.putNoThanksText hlCoord 2, 10 ld de,NoThanksText call PlaceString @@ -135,7 +135,7 @@ GetPrizeMenuId: ; 5278e (14:678e) ld c,(1 << 7 | 2) ; Function $15CD displays BCD value (same routine ; used by text-command $02) - call PrintBCDNumber ; Print_BCD + call PrintBCDNumber ld de,wd143 hlCoord 13, 7 ld c,(%1 << 7 | 2) @@ -165,10 +165,10 @@ PrintPrizePrice: ; 5287a (14:687a) call PrintBCDNumber ret -.CoinText ; 14:68A5 +.CoinText db "COIN@" -.SixSpacesText ; 14:68AA +.SixSpacesText db " @" LoadCoinsToSubtract: ; 528b1 (14:68b1) @@ -200,9 +200,9 @@ HandlePrizeChoice: ; 528c6 (14:68c6) jr nz,.GetMonName call GetItemName jr .GivePrize -.GetMonName ; 14:68E3 +.GetMonName call GetMonName -.GivePrize ; 14:68E6 +.GivePrize ld hl,SoYouWantPrizeTextPtr call PrintText call YesNoChoice ; yes/no textbox @@ -219,14 +219,14 @@ HandlePrizeChoice: ; 528c6 (14:68c6) ld b,a ld a,1 ld c,a - call GiveItem ; GiveItem + call GiveItem jr nc,.BagFull jr .SubtractCoins -.GiveMon ; 14:6912 +.GiveMon ld a,[wd11e] ld [wcf91],a push af - call GetPrizeMonLevel ; 14:6977 + call GetPrizeMonLevel ld c,a pop af ld b,a @@ -237,7 +237,7 @@ HandlePrizeChoice: ; 528c6 (14:68c6) call z,WaitForTextScrollButtonPress pop af ret nc -.SubtractCoins ; 14:692C +.SubtractCoins call LoadCoinsToSubtract ld hl,$FFA1 ld de,wPlayerCoins + 1 @@ -247,10 +247,10 @@ HandlePrizeChoice: ; 528c6 (14:68c6) .BagFull ld hl,PrizeRoomBagIsFullTextPtr jp PrintText -.NotEnoughCoins ; 14:6945 +.NotEnoughCoins ld hl,SorryNeedMoreCoinsText jp PrintText -.PrintOhFineThen ; 14:694B +.PrintOhFineThen ld hl,OhFineThenTextPtr jp PrintText @@ -286,13 +286,13 @@ GetPrizeMonLevel: ; 52977 (14:6977) ld a,[wcf91] ld b,a ld hl,PrizeMonLevelDictionary -.loop ; 14:697E +.loop ld a,[hli] cp b jr z,.matchFound inc hl jr .loop -.matchFound ; 14:6985 +.matchFound ld a,[hl] ld [W_CURENEMYLVL],a ret diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index b84657d5..487daa2d 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -713,7 +713,7 @@ SwitchPartyMon: ; 13613 (4:7613) SwitchPartyMon_OAM: ; 13625 (4:7625) push af - ld hl, wTileMap + hlCoord 0, 0 ld bc, $28 call AddNTimes ld c, $28 diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index d8043484..179de389 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -66,7 +66,7 @@ HisNameIsText: ; 69e7 (1:69e7) Func_69ec: ; 69ec (1:69ec) push de - ld hl, wTileMap + hlCoord 0, 0 ld bc, $c0b call ClearScreenArea ld c, 10 @@ -155,7 +155,7 @@ asm_6a19: ; 6a19 (1:6a19) DisplayIntroNameTextBox: ; 6a6c (1:6a6c) push de - ld hl, wTileMap + hlCoord 0, 0 ld b, $a ld c, $9 call TextBoxBorder diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index a23348db..e9bde496 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -20,7 +20,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) dec l ld b, l ld c, $d - ld hl, wTileMap + hlCoord 0, 0 call TextBoxBorder call UpdateSprites call Func_610c2 diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index dac03f3a..9854df61 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -694,7 +694,7 @@ getTileSpriteStandsOn: ; 5207 (1:5207) add $14 ; screen X tile + 20 ld d, $0 ld e, a - ld hl, wTileMap + hlCoord 0, 0 add hl, bc add hl, bc add hl, bc diff --git a/engine/save.asm b/engine/save.asm index cc5e6c4a..b4e343e3 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -426,7 +426,7 @@ Func_7393f: ; 7393f (1c:793f) and $7f ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld hl, wTileMap + hlCoord 0, 0 ld b, $2 ld c, $9 call TextBoxBorder diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 0b9f8bc9..c95e9d20 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -133,7 +133,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) .skip2 ld hl, OneMoreGoSlotMachineText call PrintText - ld hl, wTileMap + $fe + hlCoord 14, 12 ld bc, $0d0f xor a ; YES_NO_MENU ld [wTwoOptionMenuID], a @@ -836,7 +836,7 @@ LoadSlotMachineTiles: ; 378a8 (d:78a8) ld a, BANK(SlotMachineTiles2) call FarCopyData2 ld hl, SlotMachineMap - ld de, wTileMap + deCoord 0, 0 ld bc, $00f0 call CopyData call EnableLCD diff --git a/engine/town_map.asm b/engine/town_map.asm index 0dd84226..2e0921a8 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -25,10 +25,10 @@ DisplayTownMap: ; 70e3e (1c:4e3e) xor a ld [wWhichTrade], a pop af - jr Func_70e92 + jr .enterLoop -Func_70e7e: ; 70e7e (1c:4e7e) - ld hl, wTileMap +.townMapLoop + hlCoord 0, 0 ld bc, $114 call ClearScreenArea ld hl, TownMapOrder @@ -37,13 +37,12 @@ Func_70e7e: ; 70e7e (1c:4e7e) ld b, $0 add hl, bc ld a, [hl] - -Func_70e92: ; 70e92 (1c:4e92) +.enterLoop ld de, wHPBarMaxHP - call Func_712f1 + call FindTownMapCoords ld a, [de] push hl - call Func_71258 + call SetTownMapOAMCoords ld a, $4 ld [wcd5b], a ld hl, wOAMBuffer + $10 @@ -63,46 +62,46 @@ Func_70e92: ; 70e92 (1c:4e92) ld de, wTileMapBackup + 16 ld bc, $10 call CopyData -.asm_70ec8 +.inputLoop call TownMapSpriteBlinkingAnimation call JoypadLowSensitivity ld a, [hJoy5] ld b, a - and $c3 - jr z, .asm_70ec8 + and A_BUTTON | B_BUTTON | D_UP | D_DOWN + jr z, .inputLoop ld a, (SFX_02_3c - SFX_Headers_02) / 3 call PlaySound bit 6, b - jr nz, .asm_70ef2 + jr nz, .upPressed bit 7, b - jr nz, .asm_70f01 + jr nz, .downPressed xor a ld [wTownMapSpriteBlinkingEnabled], a ld [hJoy7], a ld [wTownMapSpriteBlinkingCounter], a - call Func_711ab + call ExitTownMap pop hl pop af ld [hl], a ret -.asm_70ef2 +.upPressed ld a, [wWhichTrade] inc a - cp $2f - jr nz, .asm_70efb + cp TownMapOrderEnd - TownMapOrder ; number of list items + 1 + jr nz, .noOverflow xor a -.asm_70efb +.noOverflow ld [wWhichTrade], a - jp Func_70e7e -.asm_70f01 + jp .townMapLoop +.downPressed ld a, [wWhichTrade] dec a cp $ff - jr nz, .asm_70f0b - ld a, $2e -.asm_70f0b + jr nz, .noUnderflow + ld a, TownMapOrderEnd - TownMapOrder - 1 ; number of list items +.noUnderflow ld [wWhichTrade], a - jp Func_70e7e + jp .townMapLoop INCLUDE "data/town_map_order.asm" @@ -116,7 +115,7 @@ LoadTownMap_Nest: ; 70f60 (1c:4f60) push af ld [hl], $ff push hl - call Func_711ef + call DisplayWildLocations call GetMonName hlCoord 1, 0 call PlaceString @@ -125,7 +124,7 @@ LoadTownMap_Nest: ; 70f60 (1c:4f60) ld de, MonsNestText call PlaceString call WaitForTextScrollButtonPress - call Func_711ab + call ExitTownMap pop hl pop af ld [hl], a @@ -147,13 +146,13 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld hl, vChars1 + $6d0 ld bc, (BANK(TownMapUpArrow) << 8) + $01 call CopyVideoDataDouble - call Func_71070 + call SetupVisitedTownsList ld hl, wUpdateSpritesEnabled ld a, [hl] push af ld [hl], $ff push hl - ld hl, wTileMap + hlCoord 0, 0 ld de, ToText call PlaceString ld a, [W_CURMAP] @@ -184,25 +183,25 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) hlCoord 19, 0 ld [hl], $ee pop hl -.asm_71004 +.inputLoop push hl call DelayFrame call JoypadLowSensitivity ld a, [hJoy5] ld b, a pop hl - and $c3 - jr z, .asm_71004 + and A_BUTTON | B_BUTTON | D_UP | D_DOWN + jr z, .inputLoop bit 0, b - jr nz, .asm_71026 + jr nz, .aButtonPressed ld a, (SFX_02_3c - SFX_Headers_02) / 3 call PlaySound bit 6, b - jr nz, .asm_71042 + jr nz, .upPressed bit 7, b - jr nz, .asm_71058 - jr .asm_71037 -.asm_71026 + jr nz, .downPressed + jr .bButtonPressed +.aButtonPressed ld a, (SFX_02_3e - SFX_Headers_02) / 3 call PlaySound ld a, [hl] @@ -211,7 +210,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) set 3, [hl] inc hl set 7, [hl] -.asm_71037 +.bButtonPressed xor a ld [wTownMapSpriteBlinkingEnabled], a call GBPalWhiteOutWithDelay3 @@ -219,35 +218,35 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) pop af ld [hl], a ret -.asm_71042 +.upPressed deCoord 18, 0 inc hl ld a, [hl] cp $ff jr z, .asm_71052 cp $fe - jr z, .asm_71042 + jr z, .upPressed jp .townMapFlyLoop .asm_71052 ld hl, wTrainerEngageDistance jp .townMapFlyLoop -.asm_71058 +.downPressed deCoord 19, 0 dec hl ld a, [hl] cp $ff jr z, .asm_71068 cp $fe - jr z, .asm_71058 + jr z, .downPressed jp .townMapFlyLoop .asm_71068 ld hl, wcd49 - jr .asm_71058 + jr .downPressed ToText: ; 7106d (1c:506d) db "To@" -Func_71070: ; 71070 (1c:5070) +SetupVisitedTownsList: ; 71070 (1c:5070) ld hl, wWhichTrade ld [hl], $ff inc hl @@ -255,19 +254,19 @@ Func_71070: ; 71070 (1c:5070) ld e, a ld a, [W_TOWNVISITEDFLAG + 1] ld d, a - ld bc, $b -.asm_71081 + ld bc, SAFFRON_CITY + 1 +.loop srl d rr e ld a, $fe - jr nc, .asm_7108a + jr nc, .notVisited ld a, b -.asm_7108a +.notVisited ld [hl], a inc hl inc b dec c - jr nz, .asm_71081 + jr nz, .loop ld [hl], $ff ret @@ -278,7 +277,7 @@ LoadTownMap: ; 7109b (1c:509b) call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites - ld hl, wTileMap + hlCoord 0, 0 ld b, $12 ld c, $12 call TextBoxBorder @@ -293,12 +292,12 @@ LoadTownMap: ; 7109b (1c:509b) ld bc, $8 ld a, BANK(MonNestIcon) call FarCopyDataDouble - ld hl, wTileMap + hlCoord 0, 0 ld de, CompressedMap -.asm_710d3 +.nextTile ld a, [de] and a - jr z, .asm_710e9 + jr z, .done ld b, a and $f ld c, a @@ -306,13 +305,13 @@ LoadTownMap: ; 7109b (1c:509b) swap a and $f add $60 -.asm_710e2 +.uncompressTile ld [hli], a dec c - jr nz, .asm_710e2 + jr nz, .uncompressTile inc de - jr .asm_710d3 -.asm_710e9 + jr .nextTile +.done call EnableLCD ld b, $2 call GoPAL_SET @@ -328,7 +327,7 @@ CompressedMap: ; 71100 (1c:5100) ; you can decompress this file with the redrle program in the extras/ dir INCBIN "gfx/town_map.rle" -Func_711ab: ; 711ab (1c:51ab) +ExitTownMap: ; 711ab (1c:51ab) xor a ld [wTownMapSpriteBlinkingEnabled], a call GBPalWhiteOut @@ -345,10 +344,10 @@ Func_711c4: ; 711c4 (1c:51c4) ld [wcd5b], a pop af ld de, wHPBarMaxHP - call Func_712f1 + call FindTownMapCoords ld a, [de] push hl - call Func_71258 + call SetTownMapOAMCoords call Func_7126d pop hl ld de, wcd6d @@ -363,35 +362,35 @@ Func_711c4: ; 711c4 (1c:51c4) ld bc, $a0 jp CopyData -Func_711ef: ; 711ef (1c:51ef) +DisplayWildLocations: ; 711ef (1c:51ef) callba FindWildLocationsOfMon call Func_712d9 ld hl, wOAMBuffer ld de, wBuffer -.asm_71200 +.loop ld a, [de] cp $ff - jr z, .asm_7121d + jr z, .exitLoop and a - jr z, .asm_7121a + jr z, .next push hl - call Func_712f1 + call FindTownMapCoords pop hl ld a, [de] cp $19 - jr z, .asm_7121a - call Func_71258 - ld a, $4 + jr z, .next + call SetTownMapOAMCoords + ld a, $4 ; nest icon tile no. ld [hli], a xor a ld [hli], a -.asm_7121a +.next inc de - jr .asm_71200 -.asm_7121d + jr .loop +.exitLoop ld a, l and a - jr nz, .asm_71236 + jr nz, .locationKnown hlCoord 1, 7 ld b, $2 ld c, $f @@ -399,12 +398,12 @@ Func_711ef: ; 711ef (1c:51ef) hlCoord 2, 9 ld de, AreaUnknownText call PlaceString - jr .asm_7123e -.asm_71236 + jr .done +.locationKnown ld a, [W_CURMAP] ld b, $0 call Func_711c4 -.asm_7123e +.done ld hl, wOAMBuffer ld de, wTileMapBackup ld bc, $a0 @@ -413,7 +412,7 @@ Func_711ef: ; 711ef (1c:51ef) AreaUnknownText: ; 7124a (1c:524a) db " AREA UNKNOWN@" -Func_71258: ; 71258 (1c:5258) +SetTownMapOAMCoords: ; 71258 (1c:5258) push af and $f0 srl a @@ -541,27 +540,27 @@ Func_712d9: ; 712d9 (1c:52d9) inc hl jr .asm_712e4 -Func_712f1: ; 712f1 (1c:52f1) +FindTownMapCoords: ; 712f1 (1c:52f1) cp REDS_HOUSE_1F - jr c, .asm_71304 + jr c, .townOrRoute ld bc, $4 ld hl, InternalMapEntries -.asm_712fb +.loop cp [hl] - jr c, .asm_71301 + jr c, .match add hl, bc - jr .asm_712fb -.asm_71301 + jr .loop +.match inc hl - jr .asm_7130d -.asm_71304 + jr .done +.townOrRoute ld hl, ExternalMapEntries ld c, a ld b, $0 add hl, bc add hl, bc add hl, bc -.asm_7130d +.done ld a, [hli] ld [de], a ld a, [hli] diff --git a/engine/trade.asm b/engine/trade.asm index 6309e8d5..adf3d417 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -148,7 +148,7 @@ Trade_Delay80: ; 41191 (10:5191) jp DelayFrames Trade_ClearTileMap: ; 41196 (10:5196) - ld hl, wTileMap + hlCoord 0, 0 ld bc, 20 * 18 ld a, " " jp FillMemory diff --git a/home.asm b/home.asm index 06a0aec3..03e3842f 100644 --- a/home.asm +++ b/home.asm @@ -3171,7 +3171,7 @@ UncompressSpriteFromDE:: ; 36eb (0:36eb) SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4) - ld hl, wTileMap + hlCoord 0, 0 ld de, wTileMapBackup2 ld bc, $168 call CopyData @@ -3188,13 +3188,13 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3709 (0:3709) xor a ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup2 - ld de, wTileMap + deCoord 0, 0 ld bc, $168 call CopyData ret SaveScreenTilesToBuffer1:: ; 3719 (0:3719) - ld hl, wTileMap + hlCoord 0, 0 ld de, wTileMapBackup ld bc, $168 jp CopyData @@ -3203,7 +3203,7 @@ LoadScreenTilesFromBuffer1:: ; 3725 (0:3725) xor a ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup - ld de, wTileMap + deCoord 0, 0 ld bc, $168 call CopyData ld a, $1 @@ -4032,7 +4032,7 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c) ld a,[wTopMenuItemY] and a ; is the y coordinate 0? jr z,.adjustForXCoord - ld hl,wTileMap + hlCoord 0, 0 ld bc,SCREEN_WIDTH .topMenuItemLoop add hl,bc diff --git a/home/copy2.asm b/home/copy2.asm index 7b407cdc..e5f28383 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -184,17 +184,17 @@ CopyScreenTileBufferToVRAM:: ld c, 6 ld hl, $600 * 0 - ld de, wTileMap + 20 * 6 * 0 + deCoord 0, 6 * 0 call .setup call DelayFrame ld hl, $600 * 1 - ld de, wTileMap + 20 * 6 * 1 + deCoord 0, 6 * 1 call .setup call DelayFrame ld hl, $600 * 2 - ld de, wTileMap + 20 * 6 * 2 + deCoord 0, 6 * 2 call .setup jp DelayFrame @@ -217,7 +217,7 @@ ClearScreen:: ; for the bg map to update. ld bc, 20 * 18 inc b - ld hl, wTileMap + hlCoord 0, 0 ld a, $7f .loop ld [hli], a diff --git a/home/overworld.asm b/home/overworld.asm index 0e62a932..4197e2a3 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1420,10 +1420,10 @@ LoadCurrentMapView:: ; 0caa (0:0caa) ld bc,$0002 add hl,bc .copyToVisibleAreaBuffer - ld de,wTileMap ; base address for the tiles that are directly transfered to VRAM during V-blank - ld b,$12 + deCoord 0, 0 ; base address for the tiles that are directly transfered to VRAM during V-blank + ld b, SCREEN_HEIGHT .rowLoop2 - ld c,$14 + ld c, SCREEN_WIDTH .rowInnerLoop2 ld a,[hli] ld [de],a @@ -2323,7 +2323,7 @@ LoadMapData:: ; 1241 (0:1241) call LoadTilesetTilePatternData call LoadCurrentMapView ; copy current map view to VRAM - ld hl,wTileMap + hlCoord 0, 0 ld de,vBGMap0 ld b,18 .vramCopyLoop diff --git a/home/text.asm b/home/text.asm index fabcd843..172a4eb2 100644 --- a/home/text.asm +++ b/home/text.asm @@ -207,7 +207,7 @@ MonsterNameCharsCommon:: ; 1a37 (0:1a37) ld de,wBattleMonNick ; player active monster name jr FinishDTE -.Enemy ; 1A40 +.Enemy ; print “Enemy ” ld de,Char5AText call PlaceString diff --git a/main.asm b/main.asm index 7372381a..c7a21243 100755 --- a/main.asm +++ b/main.asm @@ -1276,7 +1276,7 @@ GetTextBoxIDText: ; 7367 (1:7367) ; hl = address of upper left corner of text box GetAddressOfScreenCoords: ; 7375 (1:7375) push bc - ld hl,wTileMap + hlCoord 0, 0 ld bc,20 .loop ; loop to add d rows to the base address ld a,d @@ -2298,7 +2298,7 @@ PrintSafariZoneSteps: ; c52f (3:452f) ret c cp UNKNOWN_DUNGEON_2 ret nc - ld hl, wTileMap + hlCoord 0, 0 ld b, $3 ld c, $7 call TextBoxBorder diff --git a/scripts/bikeshop.asm b/scripts/bikeshop.asm index 4a8183ec..55ceb5cc 100755 --- a/scripts/bikeshop.asm +++ b/scripts/bikeshop.asm @@ -51,7 +51,7 @@ BikeShopText1: ; 1d745 (7:5745) ld [wTopMenuItemX], a ld hl, wd730 set 6, [hl] - ld hl, wTileMap + hlCoord 0, 0 ld b, $4 ld c, $f call TextBoxBorder diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 07b26788..953b1583 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -63,7 +63,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) dec l ld b, l ld c, $c - ld hl, wTileMap + hlCoord 0, 0 call TextBoxBorder call UpdateSprites call CeladonMartRoofScript_48532 diff --git a/scripts/redshouse1f.asm b/scripts/redshouse1f.asm index 0f5251b8..09ce97dc 100755 --- a/scripts/redshouse1f.asm +++ b/scripts/redshouse1f.asm @@ -5,7 +5,7 @@ RedsHouse1FTextPointers: ; 4816b (12:416b) dw RedsHouse1FText1 dw RedsHouse1FText2 -RedsHouse1FText1: ; 4816f (12:416f) ; 416F Mom +RedsHouse1FText1: ; 4816f (12:416f) Mom TX_ASM ld a, [wd72e] bit 3, a -- cgit v1.3.1-sl0p From ef9e59101e10aed82184bd2fd063b1109e2e4f6a Mon Sep 17 00:00:00 2001 From: dannye Date: Tue, 14 Jul 2015 02:16:19 -0500 Subject: Use more screen dimension constants --- engine/HoF_room_pc.asm | 2 +- engine/battle/animations.asm | 4 +- engine/battle/battle_transitions.asm | 68 ++++++++++++++++----------------- engine/battle/core.asm | 2 +- engine/battle/draw_hud_pokeball_gfx.asm | 2 +- engine/menu/start_sub_menus.asm | 6 +-- engine/menu/status_screen.asm | 27 ++++++------- engine/oak_speech2.asm | 1 + engine/oam_dma.asm | 3 +- engine/overworld/cinnabar_lab.asm | 2 +- engine/overworld/movement.asm | 4 +- engine/save.asm | 2 +- engine/titlescreen.asm | 2 +- home.asm | 6 +-- home/overworld.asm | 2 +- home/text.asm | 26 ++++++------- main.asm | 12 +++--- scripts/celadonmartroof.asm | 2 +- 18 files changed, 88 insertions(+), 85 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index a3459f9d..98c77903 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -202,7 +202,7 @@ Credits: ; 7418e (1d:418e) add hl, bc call PlaceString pop hl - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 add hl, bc pop de jr .asm_7419b diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 6c98cc91..32f98f19 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1712,9 +1712,9 @@ _AnimationSquishMonPic: ; 794d4 (1e:54d4) call Func_79862 inc hl .asm_794eb - ld [hl], $7f + ld [hl], " " pop hl - ld de, $14 + ld de, SCREEN_WIDTH add hl, de pop bc dec c diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 3315b36a..8613560a 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -233,12 +233,12 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) ld [wWhichTrade], a hlCoord 0, 0 ld c, $11 - ld de, $14 + ld de, SCREEN_WIDTH call BattleTransition_InwardSpiral_ inc c jr .skip .loop - ld de, $14 + ld de, SCREEN_WIDTH call BattleTransition_InwardSpiral_ .skip inc c @@ -246,10 +246,10 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) call BattleTransition_InwardSpiral_ dec c dec c - ld de, $ffec + ld de, -SCREEN_WIDTH call BattleTransition_InwardSpiral_ inc c - ld de, rIE + ld de, -1 call BattleTransition_InwardSpiral_ dec c dec c @@ -278,8 +278,8 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0) ret BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9) - ld bc, $ffec - ld de, $14 + ld bc, -SCREEN_WIDTH + ld de, SCREEN_WIDTH ld a, [wd09b] ld l, a ld a, [wd09a] @@ -366,22 +366,22 @@ BattleTransition_FlashScreenPalettes: ; 70b72 (1c:4b72) ; used for low level trainer dungeon battles BattleTransition_Shrink: ; 70b7f (1c:4b7f) - ld c, $9 + ld c, SCREEN_HEIGHT / 2 .loop push bc xor a ld [H_AUTOBGTRANSFERENABLED], a hlCoord 0, 7 deCoord 0, 8 - ld bc, $ffd8 + ld bc, -SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 hlCoord 0, 10 deCoord 0, 9 - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 hlCoord 8, 0 deCoord 9, 0 - ld bc, $fffe + ld bc, -2 call BattleTransition_CopyTiles2 hlCoord 11, 0 deCoord 10, 0 @@ -400,22 +400,22 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f) ; used for high level trainer dungeon battles BattleTransition_Split: ; 70bca (1c:4bca) - ld c, $9 + ld c, SCREEN_HEIGHT / 2 xor a ld [H_AUTOBGTRANSFERENABLED], a .loop push bc hlCoord 0, 16 deCoord 0, 17 - ld bc, $ffd8 + ld bc, -SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 hlCoord 0, 1 deCoord 0, 0 - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 hlCoord 18, 0 deCoord 19, 0 - ld bc, $fffe + ld bc, -2 call BattleTransition_CopyTiles2 hlCoord 1, 0 deCoord 0, 0 @@ -440,7 +440,7 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) push bc push hl push de - ld bc, $14 + ld bc, SCREEN_WIDTH call CopyData pop hl pop de @@ -455,7 +455,7 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) ld l, e ld h, d ld a, $ff - ld c, $14 + ld c, SCREEN_WIDTH .loop2 ld [hli], a dec c @@ -467,23 +467,23 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ld [wWhichTrade], a ld a, b ld [wTrainerEngageDistance], a - ld c, $9 + ld c, SCREEN_HEIGHT / 2 .loop1 push bc push hl push de - ld c, $12 + ld c, SCREEN_HEIGHT .loop2 ld a, [hl] ld [de], a ld a, e - add $14 + add SCREEN_WIDTH jr nc, .noCarry1 inc d .noCarry1 ld e, a ld a, l - add $14 + add SCREEN_WIDTH jr nc, .noCarry2 inc h .noCarry2 @@ -502,8 +502,8 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) jr nz, .loop1 ld l, e ld h, d - ld de, $14 - ld c, $12 + ld de, SCREEN_WIDTH + ld c, SCREEN_HEIGHT .loop3 ld [hl], $ff add hl, de @@ -513,7 +513,7 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ; used for high level wild dungeon battles BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) - ld c, $12 + ld c, SCREEN_HEIGHT hlCoord 0, 0 deCoord 1, 17 xor a @@ -528,12 +528,12 @@ BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) call BattleTransition_VerticalStripes_ call BattleTransition_TransferDelay3 pop hl - ld bc, $ffec + ld bc, -SCREEN_WIDTH add hl, bc ld e, l ld d, h pop hl - ld bc, $14 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec c @@ -541,7 +541,7 @@ BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) jp BattleTransition_BlackScreen BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) - ld c, $a + ld c, SCREEN_WIDTH / 2 .loop ld [hl], $ff inc hl @@ -552,7 +552,7 @@ BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ; used for low level wild dungeon battles BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) - ld c, $14 + ld c, SCREEN_WIDTH hlCoord 0, 0 deCoord 19, 1 xor a @@ -576,8 +576,8 @@ BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) jp BattleTransition_BlackScreen BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) - ld c, $9 - ld de, $28 + ld c, SCREEN_HEIGHT / 2 + ld de, SCREEN_WIDTH * 2 .loop ld [hl], $ff add hl, de @@ -590,10 +590,10 @@ BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) ; by animating each half circle one at a time BattleTransition_Circle: ; 70ce4 (1c:4ce4) call BattleTransition_FlashScreen - ld bc, $000a + ld bc, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 call BattleTransition_Circle_Sub1 - ld c, $a + ld c, SCREEN_WIDTH / 2 ld b, $1 ld hl, BattleTransition_HalfCircle2 call BattleTransition_Circle_Sub1 @@ -633,7 +633,7 @@ BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) ; by animating both half circles at the same time BattleTransition_DoubleCircle: ; 70d24 (1c:4d24) call BattleTransition_FlashScreen - ld c, $a + ld c, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 ld de, BattleTransition_HalfCircle2 .loop @@ -774,9 +774,9 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5) pop hl ld a, [wWhichTrade] and a - ld bc, $14 + ld bc, SCREEN_WIDTH jr z, .skip3 - ld bc, $ffec + ld bc, -SCREEN_WIDTH .skip3 add hl, bc ld a, [de] diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 1825e61e..5ef94998 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -7047,7 +7047,7 @@ CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6) ld a, [$ffe1] CopyUncompressedPicToHL: ; 3f0d0 (f:70d0) ld bc, $707 - ld de, $14 + ld de, SCREEN_WIDTH push af ld a, [W_SPRITEFLIPPED] and a diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index ba47d8f3..06280a15 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -148,7 +148,7 @@ EnemyBattleHUDGraphicsTiles: ; 3a92d (e:692d) PlaceHUDTiles: ; 3a930 (e:6930) ld [hl], $73 - ld bc, $14 + ld bc, SCREEN_WIDTH add hl, bc ld a, [wTrainerScreenY] ld [hl], a diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 48a85081..825360a6 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -714,10 +714,10 @@ SwitchPartyMon: ; 13613 (4:7613) SwitchPartyMon_OAM: ; 13625 (4:7625) push af hlCoord 0, 0 - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 call AddNTimes - ld c, $28 - ld a, $7f + ld c, SCREEN_WIDTH * 2 + ld a, " " .asm_13633 ld [hli], a dec c diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index c9261804..7b3674e6 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -280,7 +280,7 @@ PrintStat push hl call PrintNumber pop hl - ld de, $0028 + ld de, SCREEN_WIDTH * 2 add hl, de ret @@ -323,15 +323,15 @@ StatusScreen2: ; 12b57 (4:6b57) sub c ld b, a ; Number of moves ? hlCoord 11, 10 - ld de, $0028 - ld a, $72 - call Func_12ccb ; Print "PP" + ld de, SCREEN_WIDTH * 2 + ld a, $72 ; special P tile id + call StatusScreen_PrintPP ; Print "PP" ld a, b and a jr z, .InitPP ld c, a ld a, "-" - call Func_12ccb ; Fill the rest with -- + call StatusScreen_PrintPP ; Fill the rest with -- .InitPP ; 12bbb ld hl, wLoadedMonMoves deCoord 14, 10 @@ -373,7 +373,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld bc, $0102 call PrintNumber pop hl - ld de, $0028 + ld de, SCREEN_WIDTH * 2 add hl, de ld d, h ld e, l @@ -411,9 +411,9 @@ StatusScreen2: ; 12b57 (4:6b57) ld bc, $0307 call PrintNumber hlCoord 9, 0 - call Func_12cc3 + call StatusScreen_ClearName hlCoord 9, 1 - call Func_12cc3 + call StatusScreen_ClearName ld a, [W_MONHDEXNUM] ld [wd11e], a call GetMonName @@ -463,15 +463,16 @@ EXPPointsText: ; 12caf (4:6caf) LevelUpText: ; 12cba (4:6cba) db "LEVEL UP@" -Func_12cc3: ; 12cc3 (4:6cc3) - ld bc, $a - ld a, $7f +StatusScreen_ClearName: ; 12cc3 (4:6cc3) + ld bc, 10 + ld a, " " jp FillMemory -Func_12ccb: ; 12ccb (4:6ccb) +StatusScreen_PrintPP: ; 12ccb (4:6ccb) +; print PP or -- c times, going down two rows each time ld [hli], a ld [hld], a add hl, de dec c - jr nz, Func_12ccb + jr nz, StatusScreen_PrintPP ret diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index dcf0b6c5..b27a6987 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -250,6 +250,7 @@ Func_6ad6: ; 6ad6 (1:6ad6) ld de, wcd6d ld bc, $14 jp CopyData + IF DEF(_RED) DefaultNamesPlayerList: ; 6af2 (1:6af2) db "NEW NAME@RED@ASH@JACK@" diff --git a/engine/oam_dma.asm b/engine/oam_dma.asm index 3de4d773..bd89677a 100644 --- a/engine/oam_dma.asm +++ b/engine/oam_dma.asm @@ -19,7 +19,8 @@ DMARoutine: ; wait for DMA to finish ld a, $28 -.wait dec a +.wait + dec a jr nz, .wait ret DMARoutineEnd: diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index e9bde496..3d39ad6b 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -103,7 +103,7 @@ Func_610c2: ; 610c2 (18:50c2) call GetItemName hlCoord 2, 2 ld a, [$ffdb] - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 call AddNTimes ld de, wcd6d call PlaceString diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 9854df61..0cbb7f1c 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -690,8 +690,8 @@ getTileSpriteStandsOn: ; 5207 (1:5207) ld a, [hl] ; c1x6: screen Y position srl a srl a - srl a ; screen X tile - add $14 ; screen X tile + 20 + srl a ; screen X tile + add SCREEN_WIDTH ; screen X tile + 20 ld d, $0 ld e, a hlCoord 0, 0 diff --git a/engine/save.asm b/engine/save.asm index 60fc800a..4849c53e 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -462,7 +462,7 @@ Func_7393f: ; 7393f (1c:793f) call Func_73a84 hlCoord 18, 1 ld de, wWhichTrade - ld bc, $14 + ld bc, SCREEN_WIDTH ld a, $c .asm_739c2 push af diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 1d640909..69a3a20e 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -70,7 +70,7 @@ ENDC call Func_4519 hlCoord 2, 1 ld a, $80 - ld de, $14 + ld de, SCREEN_WIDTH ld c, $6 .asm_434d ld b, $10 diff --git a/home.asm b/home.asm index 04c65290..b00881e1 100644 --- a/home.asm +++ b/home.asm @@ -3176,7 +3176,7 @@ UncompressSpriteFromDE:: ; 36eb (0:36eb) SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4) hlCoord 0, 0 ld de, wTileMapBackup2 - ld bc, $168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData ret @@ -3199,7 +3199,7 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3709 (0:3709) SaveScreenTilesToBuffer1:: ; 3719 (0:3719) hlCoord 0, 0 ld de, wTileMapBackup - ld bc, $168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT jp CopyData LoadScreenTilesFromBuffer1:: ; 3725 (0:3725) @@ -3207,7 +3207,7 @@ LoadScreenTilesFromBuffer1:: ; 3725 (0:3725) ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup deCoord 0, 0 - ld bc, $168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a diff --git a/home/overworld.asm b/home/overworld.asm index f0cde773..bb5ae234 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1753,7 +1753,7 @@ ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3) ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2) ld de,wScreenEdgeTiles - ld c,$12 + ld c,SCREEN_HEIGHT .loop ld a,[hli] ld [de],a diff --git a/home/text.asm b/home/text.asm index 172a4eb2..11303659 100644 --- a/home/text.asm +++ b/home/text.asm @@ -61,16 +61,16 @@ PlaceNextChar:: ; 1956 (0:1956) .PlaceText cp $4E jr nz,.next - ld bc,$0028 + ld bc,SCREEN_WIDTH * 2 ld a,[hFlags_0xFFF6] bit 2,a jr z,.next2 - ld bc,$14 + ld bc,SCREEN_WIDTH .next2 pop hl add hl,bc push hl - jp Next19E8 + jp PlaceNextChar_inc .next cp $4F @@ -78,7 +78,7 @@ PlaceNextChar:: ; 1956 (0:1956) pop hl hlCoord 1, 16 push hl - jp Next19E8 + jp PlaceNextChar_inc .next3 ; Check against a dictionary and a @@ -123,7 +123,7 @@ PlaceNextChar:: ; 1956 (0:1956) jp z,Char5A ld [hli],a call PrintLetterDelay -Next19E8:: ; 19e8 (0:19e8) +PlaceNextChar_inc:: ; 19e8 (0:19e8) inc de jp PlaceNextChar @@ -273,7 +273,7 @@ Char58:: ; 1a95 (0:1a95) Next1AA2:: ; 1aa2 (0:1aa2) call ProtectedDelay3 call ManualTextScroll - ld a,$7F + ld a, " " Coorda 18, 16 Char57:: ; 1aad (0:1aad) pop hl @@ -297,7 +297,7 @@ Char51:: ; 1ab4 (0:1ab4) call DelayFrames pop de hlCoord 1, 14 - jp Next19E8 + jp PlaceNextChar_inc Char49:: ; 1ad5 (0:1ad5) push de @@ -314,7 +314,7 @@ Char49:: ; 1ad5 (0:1ad5) pop hl hlCoord 1, 11 push hl - jp Next19E8 + jp PlaceNextChar_inc Char4B:: ; 1af8 (0:1af8) ld a,$EE @@ -323,7 +323,7 @@ Char4B:: ; 1af8 (0:1af8) push de call ManualTextScroll pop de - ld a,$7F + ld a, " " Coorda 18, 16 ;fall through Char4C:: ; 1b0a (0:1b0a) @@ -332,12 +332,12 @@ Char4C:: ; 1b0a (0:1b0a) call Next1B18 hlCoord 1, 16 pop de - jp Next19E8 + jp PlaceNextChar_inc Next1B18:: ; 1b18 (0:1b18) hlCoord 0, 14 deCoord 0, 13 - ld b,$3C + ld b,60 .next ld a,[hli] ld [de],a @@ -345,8 +345,8 @@ Next1B18:: ; 1b18 (0:1b18) dec b jr nz,.next hlCoord 1, 16 - ld a,$7F - ld b,$12 + ld a, " " + ld b,SCREEN_WIDTH - 2 .next2 ld [hli],a dec b diff --git a/main.asm b/main.asm index 29cf2496..ac45994b 100755 --- a/main.asm +++ b/main.asm @@ -1157,7 +1157,7 @@ PrintStartMenuItem: ; 71bb (1:71bb) push hl call PlaceString pop hl - ld de,$28 + ld de,SCREEN_WIDTH * 2 add hl,de ret @@ -1755,14 +1755,14 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:36e1) sub e ld c, a pop af - ld de, $ffd8 + ld de, -SCREEN_WIDTH * 2 .asm_7725 add hl, de inc b inc b dec a jr nz, .asm_7725 - ld de, $ffec + ld de, -SCREEN_WIDTH add hl, de inc b call TextBoxBorder @@ -1773,7 +1773,7 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:36e1) ld e, a ld d, $0 add hl, de - ld de, $ffd8 + ld de, -SCREEN_WIDTH * 2 ld a, [wTrainerScreenX] .asm_7747 add hl, de @@ -1806,7 +1806,7 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:36e1) ld d, b ld e, c call PlaceString - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 add hl, bc pop de jr .asm_7752 @@ -4031,7 +4031,7 @@ _MoveMon: ; f51e (3:751e) ld [hli], a ld d, h ld e, l - ld bc, $ffee + ld bc, -18 add hl, bc ld b, $1 call CalcStats diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 953b1583..8b6ff60f 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -202,7 +202,7 @@ CeladonMartRoofScript_48532: ; 48532 (12:4532) call GetItemName hlCoord 2, 2 ld a, [$ffdb] - ld bc, $28 + ld bc, SCREEN_WIDTH * 2 call AddNTimes ld de, wcd6d call PlaceString -- cgit v1.3.1-sl0p From 07dd7056372288de7bb5b64f9416d741adb3b499 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 19:46:52 -0700 Subject: hall of fame / credits --- constants/misc_constants.asm | 2 +- engine/HoF_room_pc.asm | 124 +++++++++++++++++++++++-------------------- engine/battle/animations.asm | 2 +- engine/battle/core.asm | 4 +- engine/hall_of_fame.asm | 118 ++++++++++++++++++++-------------------- engine/menu/bills_pc.asm | 6 +-- engine/menu/league_pc.asm | 44 +++++++-------- engine/menu/main_menu.asm | 8 +-- engine/oak_speech.asm | 10 ++-- engine/overworld/cut.asm | 4 +- engine/overworld/cut2.asm | 2 +- engine/save.asm | 8 +-- engine/titlescreen.asm | 6 +-- engine/titlescreen2.asm | 4 +- home.asm | 6 +-- home/init.asm | 2 +- home/text.asm | 6 +-- scripts/halloffameroom.asm | 4 +- scripts/vermiliondock.asm | 4 +- sram.asm | 2 +- wram.asm | 34 ++++++++++-- 21 files changed, 221 insertions(+), 179 deletions(-) (limited to 'engine/save.asm') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index eca97408..2495f17f 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -8,7 +8,7 @@ NUM_BOXES EQU 12 HOF_MON EQU $10 HOF_TEAM EQU PARTY_LENGTH * HOF_MON -NUM_HOF_TEAMS EQU 50 +HOF_TEAM_CAPACITY EQU 50 A_BUTTON EQU %00000001 diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 98c77903..77a07ea3 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -6,10 +6,10 @@ HallOfFamePC: ; 7405c (1d:405c) call DisableLCD ld hl, vFont ld bc, $800 / 2 - call Func_74171 + call ZeroMemory ld hl, vChars2 + $600 ld bc, $200 / 2 - call Func_74171 + call ZeroMemory ld hl, vChars2 + $7e0 ld bc, $10 ld a, $ff @@ -30,12 +30,12 @@ HallOfFamePC: ; 7405c (1d:405c) call DelayFrames xor a ld [wWhichTrade], a - ld [wTrainerEngageDistance], a + ld [wNumCreditsMonsDisplayed], a jp Credits -Func_740ba: ; 740ba (1d:40ba) +FadeInCreditsText: ; 740ba (1d:40ba) ld hl, HoFGBPalettes - ld b, $4 + ld b, 4 .asm_740bf ld a, [hli] ld [rBGP], a @@ -52,7 +52,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb) call FillMiddleOfScreenWithWhite ; display the next monster from CreditsMons - ld hl,wTrainerEngageDistance + ld hl,wNumCreditsMonsDisplayed ld c,[hl] ; how many monsters have we displayed so far? inc [hl] ld b,0 @@ -65,62 +65,69 @@ DisplayCreditsMon: ; 740cb (1d:40cb) call GetMonHeader call LoadFrontSpriteByMonIndex ld hl,vBGMap0 + $c - call Func_74164 + call CopyTileMapToVRAM xor a ld [H_AUTOBGTRANSFERENABLED],a call LoadScreenTilesFromBuffer1 ld hl,vBGMap0 - call Func_74164 + call CopyTileMapToVRAM ld a,$A7 - ld [$FF4B],a + ld [rWX],a ld hl,vBGMap1 - call Func_74164 + call CopyTileMapToVRAM call FillMiddleOfScreenWithWhite - ld a,$FC + ld a,%11111100 ; make the mon a black silhouette ld [rBGP],a + +; scroll the mon left by one tile 7 times ld bc,7 -.next - call Func_74140 +.scrollLoop1 + call ScrollCreditsMonLeft dec c - jr nz,.next - ld c,$14 -.next2 - call Func_74140 - ld a,[$FF4B] + jr nz,.scrollLoop1 + +; scroll the mon left by one tile 20 times +; This time, we have to move the window left too in order to hide the text that +; is wrapping around to the right side of the screen. + ld c,20 +.scrollLoop2 + call ScrollCreditsMonLeft + ld a,[rWX] sub 8 - ld [$FF4B],a + ld [rWX],a dec c - jr nz,.next2 + jr nz,.scrollLoop2 + xor a ld [hWY],a - ld a,$C0 + ld a,%11000000 ld [rBGP],a ret INCLUDE "data/credit_mons.asm" -Func_74140: ; 74140 (1d:4140) +ScrollCreditsMonLeft: ; 74140 (1d:4140) ld h, b ld l, $20 - call Func_74152 + call ScrollCreditsMonLeft_SetSCX ld h, $0 ld l, $70 - call Func_74152 + call ScrollCreditsMonLeft_SetSCX ld a, b add $8 ld b, a ret -Func_74152: ; 74152 (1d:4152) - ld a, [$ff44] +ScrollCreditsMonLeft_SetSCX: ; 74152 (1d:4152) + ld a, [rLY] cp l - jr nz, Func_74152 + jr nz, ScrollCreditsMonLeft_SetSCX ld a, h ld [rSCX], a -.asm_7415a - ld a, [$ff44] +.loop + ld a, [rLY] cp h - jr z, .asm_7415a + jr z, .loop ret HoFGBPalettes: ; 74160 (1d:4160) @@ -129,7 +136,7 @@ HoFGBPalettes: ; 74160 (1d:4160) db %11100000 db %11110000 -Func_74164: ; 74164 (1d:4164) +CopyTileMapToVRAM: ; 74164 (1d:4164) ld a, l ld [H_AUTOBGTRANSFERDEST], a ld a, h @@ -138,14 +145,15 @@ Func_74164: ; 74164 (1d:4164) ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 -Func_74171: ; 74171 (1d:4171) - ld [hl], $0 +ZeroMemory: ; 74171 (1d:4171) +; zero bc bytes at hl + ld [hl], 0 inc hl inc hl dec bc ld a, b or c - jr nz, Func_74171 + jr nz, ZeroMemory ret FillFourRowsWithBlack: ; 7417b (1d:417b) @@ -162,26 +170,26 @@ FillMiddleOfScreenWithWhite: ; 74183 (1d:4183) Credits: ; 7418e (1d:418e) ld de, CreditsOrder push de -.asm_74192 +.nextCreditsScreen pop de hlCoord 9, 6 push hl call FillMiddleOfScreenWithWhite pop hl -.asm_7419b +.nextCreditsCommand ld a, [de] inc de push de cp $ff - jr z, .asm_741d5 + jr z, .fadeInTextAndShowMon cp $fe - jr z, .asm_741dc + jr z, .showTextAndShowMon cp $fd - jr z, .asm_741e6 + jr z, .fadeInText cp $fc - jr z, .asm_741ed + jr z, .showText cp $fb - jr z, .asm_741f4 + jr z, .showCopyrightText cp $fa jr z, .showTheEnd push hl @@ -189,7 +197,7 @@ Credits: ; 7418e (1d:418e) ld hl, CreditsTextPointers add a ld c, a - ld b, $0 + ld b, 0 add hl, bc ld e, [hl] inc hl @@ -205,32 +213,32 @@ Credits: ; 7418e (1d:418e) ld bc, SCREEN_WIDTH * 2 add hl, bc pop de - jr .asm_7419b -.asm_741d5 - call Func_740ba + jr .nextCreditsCommand +.fadeInTextAndShowMon + call FadeInCreditsText ld c, 90 - jr .asm_741de -.asm_741dc + jr .next1 +.showTextAndShowMon ld c, 110 -.asm_741de +.next1 call DelayFrames call DisplayCreditsMon - jr .asm_74192 -.asm_741e6 - call Func_740ba + jr .nextCreditsScreen +.fadeInText + call FadeInCreditsText ld c, 120 - jr .asm_741ef -.asm_741ed + jr .next2 +.showText ld c, 140 -.asm_741ef +.next2 call DelayFrames - jr .asm_74192 -.asm_741f4 + jr .nextCreditsScreen +.showCopyrightText push de callba LoadCopyrightTiles pop de pop de - jr .asm_7419b + jr .nextCreditsCommand .showTheEnd ld c, 16 call DelayFrames @@ -246,7 +254,7 @@ Credits: ; 7418e (1d:418e) hlCoord 4, 9 inc de call PlaceString - jp Func_740ba + jp FadeInCreditsText TheEndTextString: ; 74229 (1d:4229) ; "T H E E N D" diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 32f98f19..9f725cc9 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1973,7 +1973,7 @@ AnimationWavyScreen: ; 79666 (1e:5666) push hl .asm_79680 call Func_796ae - ld a, [$ff44] + ld a, [rLY] cp e jr nz, .asm_79680 pop hl diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5ef94998..9535a8c5 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6856,7 +6856,7 @@ DetermineWildOpponent: ; 3ef23 (f:6f23) InitBattleCommon: ; 3ef3d (f:6f3d) ld a, [wMapPalOffset] push af - ld hl, wd358 + ld hl, wLetterPrintingDelayFlags ld a, [hl] push af res 1, [hl] @@ -6963,7 +6963,7 @@ InitBattle_Common: ; 3efeb (f:6feb) call StartBattle callab EndOfBattle pop af - ld [wd358], a + ld [wLetterPrintingDelayFlags], a pop af ld [wMapPalOffset], a ld a, [wd0d4] diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 7882a226..81ccffdc 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -1,5 +1,5 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) - call Func_70423 + call HoFFadeOutScreenAndMusic call ClearScreen ld c, 100 call DelayFrames @@ -21,16 +21,16 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld [wUpdateSpritesEnabled], a ld [hTilesetType], a ld [W_SPRITEFLIPPED], a - ld [wd358], a - ld [wTrainerScreenY], a + ld [wLetterPrintingDelayFlags], a ; no delay + ld [wHoFMonOrPlayer], a ; mon inc a ld [H_AUTOBGTRANSFERENABLED], a - ld hl, wd5a2 + ld hl, wNumHoFTeams ld a, [hl] inc a - jr z, .asm_701eb + jr z, .skipInc ; don't wrap around to 0 inc [hl] -.asm_701eb +.skipInc ld a, $90 ld [hWY], a ld c, BANK(Music_HallOfFame) @@ -38,23 +38,23 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) call PlayMusic ld hl, wPartySpecies ld c, $ff -.asm_701fb +.partyMonLoop ld a, [hli] cp $ff - jr z, .asm_70241 + jr z, .doneShowingParty inc c push hl push bc - ld [wWhichTrade], a + ld [wHoFMonSpecies], a ld a, c - ld [wTrainerEngageDistance], a + ld [wHoFPartyMonIndex], a ld hl, wPartyMon1Level ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hl] - ld [wTrainerFacingDirection], a - call Func_70278 - call Func_702e1 + ld [wHoFMonLevel], a + call HoFShowMonOrPlayer + call HoFDisplayAndRecordMonInfo ld c, 80 call DelayFrames hlCoord 2, 13 @@ -69,8 +69,8 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) call GBFadeOutToWhite pop bc pop hl - jr .asm_701fb -.asm_70241 + jr .partyMonLoop +.doneShowingParty ld a, c inc a ld hl, wHallOfFame @@ -79,12 +79,12 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) ld [hl], $ff call SaveHallOfFameTeams xor a - ld [wWhichTrade], a + ld [wHoFMonSpecies], a inc a - ld [wTrainerScreenY], a - call Func_70278 + ld [wHoFMonOrPlayer], a ; player + call HoFShowMonOrPlayer call HoFDisplayPlayerStats - call Func_70423 + call HoFFadeOutScreenAndMusic xor a ld [hWY], a ld hl, rLCDC @@ -94,69 +94,72 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) HallOfFameText: ; 7026b (1c:426b) db "HALL OF FAME@" -Func_70278: ; 70278 (1c:4278) +HoFShowMonOrPlayer: ; 70278 (1c:4278) call ClearScreen ld a, $d0 ld [hSCY], a ld a, $c0 ld [hSCX], a - ld a, [wWhichTrade] + ld a, [wHoFMonSpecies] ld [wcf91], a ld [wd0b5], a ld [wBattleMonSpecies2], a ld [wcf1d], a - ld a, [wTrainerScreenY] + ld a, [wHoFMonOrPlayer] and a - jr z, .asm_7029d + jr z, .showMon +; show player call HoFLoadPlayerPics - jr .asm_702ab -.asm_7029d + jr .next1 +.showMon hlCoord 12, 5 call GetMonHeader call LoadFrontSpriteByMonIndex predef LoadMonBackPic -.asm_702ab +.next1 ld b, $b ld c, $0 call GoPAL_SET - ld a, $e4 + ld a, %11100100 ld [rBGP], a - ld c, $31 - call Func_7036d + ld c, $31 ; back pic + call HoFLoadMonPlayerPicTileIDs ld d, $a0 - ld e, $4 + ld e, 4 ld a, [wOnSGB] and a - jr z, .asm_702c7 - sla e -.asm_702c7 - call .asm_702d5 + jr z, .next2 + sla e ; scroll more slowly on SGB +.next2 + call .ScrollPic ; scroll back pic left xor a ld [hSCY], a - ld c, a - call Func_7036d - ld d, $0 - ld e, $fc -.asm_702d5 + ld c, a ; front pic + call HoFLoadMonPlayerPicTileIDs + ld d, 0 + ld e, -4 +; scroll front pic right + +.ScrollPic call DelayFrame ld a, [hSCX] add e ld [hSCX], a cp d - jr nz, .asm_702d5 + jr nz, .ScrollPic ret -Func_702e1: ; 702e1 (1c:42e1) - ld a, [wTrainerEngageDistance] +HoFDisplayAndRecordMonInfo: ; 702e1 (1c:42e1) + ld a, [wHoFPartyMonIndex] ld hl, wPartyMonNicks call GetPartyMonName - call Func_702f0 - jp Func_70404 + call HoFDisplayMonInfo + jp HoFRecordMonInfo -Func_702f0: ; 702f0 (1c:42f0) +HoFDisplayMonInfo: ; 702f0 (1c:42f0) hlCoord 0, 2 - ld b, $9 - ld c, $a + ld b, 9 + ld c, 10 call TextBoxBorder hlCoord 2, 6 ld de, HoFMonInfoText @@ -164,14 +167,14 @@ Func_702f0: ; 702f0 (1c:42f0) hlCoord 1, 4 ld de, wcd6d call PlaceString - ld a, [wTrainerFacingDirection] + ld a, [wHoFMonLevel] hlCoord 8, 7 call PrintLevelCommon - ld a, [wWhichTrade] + ld a, [wHoFMonSpecies] ld [wd0b5], a hlCoord 3, 9 predef PrintMonType - ld a, [wWhichTrade] + ld a, [wHoFMonSpecies] jp PlayCry HoFMonInfoText: ; 70329 (1c:4329) @@ -197,8 +200,9 @@ HoFLoadPlayerPics: ; 7033e (1c:433e) call InterlaceMergeSpriteBuffers ld c, $1 -Func_7036d: ; 7036d (1c:436d) - ld b, $0 +HoFLoadMonPlayerPicTileIDs: ; 7036d (1c:436d) +; c = base tile ID + ld b, 0 hlCoord 12, 5 predef_jump CopyTileIDsFromList @@ -261,14 +265,14 @@ DexRatingText: ; 703ff (1c:43ff) TX_FAR _DexRatingText db "@" -Func_70404: ; 70404 (1c:4404) +HoFRecordMonInfo: ; 70404 (1c:4404) ld hl, wHallOfFame ld bc, HOF_MON - ld a, [wTrainerEngageDistance] + ld a, [wHoFPartyMonIndex] call AddNTimes - ld a, [wWhichTrade] + ld a, [wHoFMonSpecies] ld [hli], a - ld a, [wTrainerFacingDirection] + ld a, [wHoFMonLevel] ld [hli], a ld e, l ld d, h @@ -276,7 +280,7 @@ Func_70404: ; 70404 (1c:4404) ld bc, $b jp CopyData -Func_70423: ; 70423 (1c:4423) +HoFFadeOutScreenAndMusic: ; 70423 (1c:4423) ld a, $a ld [wcfc8], a ld [wcfc9], a diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index fcc51af1..ec7d728a 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -2,13 +2,13 @@ Func_213c8:: ; 213c8 (8:53c8) xor a ld [H_AUTOBGTRANSFERENABLED], a call SaveScreenTilesToBuffer2 - ld a, [wd5a2] + ld a, [wNumHoFTeams] and a jr nz, .asm_213f3 ld a, [wd74b] bit 5, a jr z, .asm_213ea - ld a, [wd5a2] + ld a, [wNumHoFTeams] and a jr nz, .asm_213f3 hlCoord 0, 0 @@ -53,7 +53,7 @@ Func_213c8:: ; 213c8 (8:53c8) hlCoord 2, 6 ld de, OaksPCText call PlaceString - ld a, [wd5a2] + ld a, [wNumHoFTeams] and a jr z, .asm_2145a ld a, $4 diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index a6dd7021..c38ab86b 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -13,30 +13,32 @@ PKMNLeaguePC: ; 0x7657e ld [W_SPRITEFLIPPED], a ld [wUpdateSpritesEnabled], a ld [wTrainerScreenX], a - ld [wcd42], a - ld a, [wd5a2] + ld [wHoFTeamNo], a + ld a, [wNumHoFTeams] ld b, a - cp NUM_HOF_TEAMS + 1 - jr c, .first - ld b, NUM_HOF_TEAMS + cp HOF_TEAM_CAPACITY + 1 + jr c, .loop +; If the total number of hall of fame teams is greater than the storage +; capacity, then calculate the number of the first team that is still recorded. + ld b, HOF_TEAM_CAPACITY sub b - ld [wcd42], a -.first - ld hl, wcd42 + ld [wHoFTeamNo], a +.loop + ld hl, wHoFTeamNo inc [hl] push bc ld a, [wTrainerScreenX] - ld [wWhichTrade], a + ld [wHoFMonSpecies], a callba LoadHallOfFameTeams - call Func_765e5 + call LeaguePCShowTeam pop bc - jr c, .second + jr c, .doneShowingTeams ld hl, wTrainerScreenX inc [hl] ld a, [hl] cp b - jr nz, .first -.second + jr nz, .loop +.doneShowingTeams pop af ld [hTilesetType], a pop af @@ -48,11 +50,11 @@ PKMNLeaguePC: ; 0x7657e call GoPAL_SET_CF1C jp GBPalNormal -Func_765e5: ; 765e5 (1d:65e5) +LeaguePCShowTeam: ; 765e5 (1d:65e5) ld c, PARTY_LENGTH .loop push bc - call Func_76610 + call LeaguePCShowMon call WaitForTextScrollButtonPress ld a, [hJoyHeld] bit 1, a @@ -75,18 +77,18 @@ Func_765e5: ; 765e5 (1d:65e5) scf ret -Func_76610: ; 76610 (1d:6610) +LeaguePCShowMon: ; 76610 (1d:6610) call GBPalWhiteOutWithDelay3 call ClearScreen ld hl, wHallOfFame ld a, [hli] - ld [wWhichTrade], a + ld [wHoFMonSpecies], a ld [wcf91], a ld [wd0b5], a ld [wBattleMonSpecies2], a ld [wcf1d], a ld a, [hli] - ld [wTrainerFacingDirection], a + ld [wHoFMonLevel], a ld de, wcd6d ld bc, $000B call CopyData @@ -105,11 +107,11 @@ Func_76610: ; 76610 (1d:6610) ld de, HallOfFameNoText call PlaceString hlCoord 16, 15 - ld de, wcd42 + ld de, wHoFTeamNo ld bc, $0103 call PrintNumber - ld b, BANK(Func_702f0) - ld hl, Func_702f0 + ld b, BANK(HoFDisplayMonInfo) + ld hl, HoFDisplayMonInfo jp Bankswitch HallOfFameNoText: ; 76670 (1d:6670) diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 0856352c..55c559f5 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -109,7 +109,7 @@ MainMenu: ; 5af2 (1:5af2) ld [wd52a],a ld c,10 call DelayFrames - ld a,[wd5a2] + ld a,[wNumHoFTeams] and a jp z,SpecialEnterMap ld a,[W_CURMAP] ; map ID @@ -124,14 +124,14 @@ MainMenu: ; 5af2 (1:5af2) Func_5bff: ; 5bff (1:5bff) ld a,1 - ld [wd358],a + ld [wLetterPrintingDelayFlags],a ld a,3 ld [W_OPTIONS],a ret LinkMenu: ; 5c0a (1:5c0a) xor a - ld [wd358], a + ld [wLetterPrintingDelayFlags], a ld hl, wd72e set 6, [hl] ld hl, TextTerminator_6b20 @@ -452,7 +452,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) ld [wCurrentMenuItem],a ld [wLastMenuItem],a inc a - ld [wd358],a + ld [wLetterPrintingDelayFlags],a ld [wTrainerScreenY],a ld a,3 ; text speed cursor Y coordinate ld [wTopMenuItemY],a diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index f333586d..df092d4c 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -1,5 +1,5 @@ SetDefaultNames: ; 60ca (1:60ca) - ld a, [wd358] + ld a, [wLetterPrintingDelayFlags] push af ld a, [W_OPTIONS] push af @@ -18,7 +18,7 @@ SetDefaultNames: ; 60ca (1:60ca) pop af ld [W_OPTIONS], a pop af - ld [wd358], a + ld [wLetterPrintingDelayFlags], a ld a, [wd08a] and a call z, Func_5bff @@ -193,18 +193,18 @@ IntroFadePalettes: ; 6282 (1:6282) MovePicLeft: ; 6288 (1:6288) ld a,119 - ld [$FF4B],a + ld [rWX],a call DelayFrame ld a,$E4 ld [rBGP],a .next call DelayFrame - ld a,[$FF4B] + ld a,[rWX] sub 8 cp $FF ret z - ld [$FF4B],a + ld [rWX],a jr .next Predef3B: ; 62a1 (1:62a1) diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 163b32e7..8f171545 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -26,7 +26,7 @@ UsedCut: ; ef54 (3:6f54) db "@" .asm_ef82 - ld [wcd4d], a + ld [wCutTile], a ld a, $1 ld [wcd6a], a ld a, [wWhichPokemon] @@ -76,7 +76,7 @@ AnimateCutTree: ; eff7 (3:6ff7) ld [wWhichAnimationOffsets], a ld a, $e4 ld [rOBP1], a - ld a, [wcd4d] + ld a, [wCutTile] cp $52 jr z, .asm_f020 ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index 9cb011b4..3194b39b 100755 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -1,5 +1,5 @@ Func_79e96: ; 79e96 (1e:5e96) - ld a, [wcd4d] + ld a, [wCutTile] cp $52 jr z, .asm_79ec8 ld c, $8 diff --git a/engine/save.asm b/engine/save.asm index 4849c53e..ac97e6ba 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -620,9 +620,9 @@ SAVCheckRandomID: ; 73ad1 (1c:7ad1) ret SaveHallOfFameTeams: ; 73b0d (1c:7b0d) - ld a, [wd5a2] + ld a, [wNumHoFTeams] dec a - cp NUM_HOF_TEAMS + cp HOF_TEAM_CAPACITY jr nc, .asm_73b28 ld hl, sHallOfFame ld bc, HOF_TEAM @@ -636,10 +636,10 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) .asm_73b28 ld hl, sHallOfFame + HOF_TEAM ld de, sHallOfFame - ld bc, HOF_TEAM * (NUM_HOF_TEAMS - 1) + ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1) call HallOfFame_Copy ld hl, wcc5b - ld de, sHallOfFame + HOF_TEAM * (NUM_HOF_TEAMS - 1) + ld de, sHallOfFame + HOF_TEAM * (HOF_TEAM_CAPACITY - 1) ld bc, HOF_TEAM jr HallOfFame_Copy diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 69a3a20e..7230f08f 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -12,7 +12,7 @@ SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) call CopyFixedLengthText xor a ld [hWY], a - ld [wd358], a + ld [wLetterPrintingDelayFlags], a ld hl, wd732 ld [hli], a ld [hli], a @@ -284,7 +284,7 @@ Func_44c1: ; 44c1 (1:44c1) Func_44cf: ; 44cf (1:44cf) .wait - ld a, [$ff44] ; rLY + ld a, [rLY] cp l jr nz, .wait @@ -292,7 +292,7 @@ Func_44cf: ; 44cf (1:44cf) ld [rSCX], a .wait2 - ld a, [$ff44] ; rLY + ld a, [rLY] cp h jr z, .wait2 ret diff --git a/engine/titlescreen2.asm b/engine/titlescreen2.asm index 57e5c3d5..61b97edc 100755 --- a/engine/titlescreen2.asm +++ b/engine/titlescreen2.asm @@ -69,7 +69,7 @@ _TitleScroll: ; 3726a (d:726a) .ScrollBetween ; 37292 (d:7292) .wait - ld a, [$ff44] ; rLY + ld a, [rLY] ; rLY cp l jr nz, .wait @@ -77,7 +77,7 @@ _TitleScroll: ; 3726a (d:726a) ld [rSCX], a .wait2 - ld a, [$ff44] ; rLY + ld a, [rLY] ; rLY cp h jr z, .wait2 ret diff --git a/home.asm b/home.asm index bf5ed9c3..7f1a790e 100644 --- a/home.asm +++ b/home.asm @@ -3538,18 +3538,18 @@ Divide:: ; 38b9 (0:38b9) ; This function is used to wait a short period after printing a letter to the ; screen unless the player presses the A/B button or the delay is turned off -; through the [wd730] or [wd358] flags. +; through the [wd730] or [wLetterPrintingDelayFlags] flags. PrintLetterDelay:: ; 38d3 (0:38d3) ld a,[wd730] bit 6,a ret nz - ld a,[wd358] + ld a,[wLetterPrintingDelayFlags] bit 1,a ret z push hl push de push bc - ld a,[wd358] + ld a,[wLetterPrintingDelayFlags] bit 0,a jr z,.waitOneFrame ld a,[W_OPTIONS] diff --git a/home/init.asm b/home/init.asm index b3f31944..932797ac 100644 --- a/home/init.asm +++ b/home/init.asm @@ -27,7 +27,7 @@ rLCDC_DEFAULT EQU %11100011 ld [$ff42], a ld [rSB], a ld [rSC], a - ld [$ff4b], a + ld [rWX], a ld [$ff4a], a ld [$ff06], a ld [$ff07], a diff --git a/home/text.asm b/home/text.asm index b77e1930..ebdc83f4 100644 --- a/home/text.asm +++ b/home/text.asm @@ -368,13 +368,13 @@ ProtectedDelay3:: ; 1b3a (0:1b3a) ret TextCommandProcessor:: ; 1b40 (0:1b40) - ld a,[wd358] + ld a,[wLetterPrintingDelayFlags] push af set 1,a ld e,a ld a,[$fff4] xor e - ld [wd358],a + ld [wLetterPrintingDelayFlags],a ld a,c ld [wcc3a],a ld a,b @@ -385,7 +385,7 @@ NextTextCommand:: ; 1b55 (0:1b55) cp a, "@" ; terminator jr nz,.doTextCommand pop af - ld [wd358],a + ld [wLetterPrintingDelayFlags],a ret .doTextCommand push hl diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index 1d522e60..afdd4e0c 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -21,13 +21,13 @@ HallofFameRoomScript3: ; 5a4ba (16:64ba) HallofFameRoomScript2: ; 5a4bb (16:64bb) call Delay3 - ld a, [wd358] + ld a, [wLetterPrintingDelayFlags] push af xor a ld [wJoyIgnore], a predef HallOfFamePC pop af - ld [wd358], a + ld [wLetterPrintingDelayFlags], a ld hl, W_FLAGS_D733 res 1, [hl] inc hl diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index f070d377..361f4997 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -167,13 +167,13 @@ VermilionDock_1dc7c: ; 1dc7c (7:5c7c) ld h, $0 ld l, $80 .asm_1dc86 - ld a, [$ff44] + ld a, [rLY] cp l jr nz, .asm_1dc86 ld a, h ld [$ff43], a .asm_1dc8e - ld a, [$ff44] + ld a, [rLY] cp h jr z, .asm_1dc8e ret diff --git a/sram.asm b/sram.asm index f20f8adf..9d498df9 100644 --- a/sram.asm +++ b/sram.asm @@ -6,7 +6,7 @@ S_SPRITEBUFFER2:: ds SPRITEBUFFERSIZE ; a310 ds $100 -sHallOfFame:: ds HOF_TEAM * NUM_HOF_TEAMS ; a598 +sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY ; a598 SECTION "Save Data", SRAM, BANK[1] diff --git a/wram.asm b/wram.asm index c150b6c6..61dba700 100755 --- a/wram.asm +++ b/wram.asm @@ -601,6 +601,8 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b ds 1 +wHoFMonSpecies:: ; cd3d + wFieldMoves:: ; cd3d ; 4 bytes ; the current mon's field moves @@ -642,6 +644,11 @@ wWhichTrade:: ; cd3d wTrainerSpriteOffset:: ; cd3d ds 1 +wHoFPartyMonIndex:: ; cd3e + +wNumCreditsMonsDisplayed:: ; cd3e +; the number of credits mons that have been displayed so far + wBadgeNameTile:: ; cd3e ; first tile ID of the name being drawn @@ -665,6 +672,8 @@ wHiddenObjectFunctionRomBank:: ; cd3e wTrainerEngageDistance:: ; cd3e ds 1 +wHoFMonLevel:: ; cd3f + wBadgeOrFaceTiles:: ; cd3f ; 8 bytes ; a list of the first tile IDs of each badge or face (depending on whether the @@ -686,6 +695,11 @@ wTrainerFacingDirection:: ; cd3f wcd3f:: ; used with daycare text for money amount ds 1 +wHoFMonOrPlayer:: ; cd40 +; show mon or show player? +; 0 = mon +; 1 = player + wSlotMachineWheel3Offset:: ; cd40 wPlayerSpinInPlaceAnimSoundID:: ; cd40 @@ -710,6 +724,8 @@ wTrainerScreenX:: ; cd41 ds 1 ; a lot of the uses for these values use more than the said address +wHoFTeamNo:: ; cd42 + wSlotMachineWheel1MiddleTile:: ; cd42 wFieldMovesLeftmostXCoord:: ; cd42 @@ -776,7 +792,10 @@ wSlotMachineFlags:: ; cd4c wSlotMachineWheel1SlipCounter:: ; cd4d ; wheel 1 can "slip" while this is non-zero -wcd4d:: ds 1 ; used with cut and slot machine +wCutTile:: ; cd4d +; $3d = tree tile +; $52 = grass tile + ds 1 wSlotMachineWheel2SlipCounter:: ; cd4e ; wheel 2 can "slip" while this is non-zero @@ -1695,7 +1714,12 @@ W_OBTAINEDBADGES:: ; d356 ds 1 -wd358:: ds 1 ; bit 0 set = no delay when printing text (W_OPTIONS is still checked though) +wLetterPrintingDelayFlags:: ; d358 +; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if +; the delay has been disabled entirely through bit 1 of this variable +; or bit 6 of wd730. +; bit 1: If 0, no delay. + ds 1 wPlayerID:: ; d359 ds 2 @@ -1904,7 +1928,11 @@ wBoxItems:: ; d53b ds 1 ; end wd5a0:: ds 2 ; current box number -wd5a2:: ds 1 ; number of HOF teams + +wNumHoFTeams:: ; d5a2 +; number of HOF teams + ds 1 + wd5a3:: ds 1 ; unused? (written to when loading map data) wPlayerCoins:: ; d5a4 -- cgit v1.3.1-sl0p From bd7d9815936decc5b636f4235c0ee745812dcb48 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 15 Jul 2015 20:04:58 -0700 Subject: menu stuff --- constants/misc_constants.asm | 8 + engine/battle/bank_e_misc.asm | 4 +- engine/battle/core.asm | 22 +-- engine/battle/end_of_battle.asm | 2 +- engine/battle/experience.asm | 12 +- engine/battle/init_battle_variables.asm | 2 +- engine/battle/read_trainer_party.asm | 8 +- engine/evos_moves.asm | 15 +- engine/give_pokemon.asm | 2 +- engine/in_game_trades.asm | 6 +- engine/items/items.asm | 22 +-- engine/menu/bills_pc.asm | 309 ++++++++++++++++---------------- engine/menu/main_menu.asm | 34 ++-- engine/menu/pc.asm | 2 +- engine/menu/players_pc.asm | 140 ++++++++------- engine/menu/start_menu.asm | 2 +- engine/menu/start_sub_menus.asm | 93 +++++----- engine/menu/status_screen.asm | 20 ++- engine/save.asm | 12 +- home.asm | 30 ++-- hram.asm | 5 + main.asm | 97 +++++----- scripts/daycarem.asm | 8 +- scripts/oakslab.asm | 6 +- text.asm | 2 +- wram.asm | 63 ++++++- 26 files changed, 506 insertions(+), 420 deletions(-) (limited to 'engine/save.asm') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 2495f17f..a0cc1d0a 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -109,6 +109,14 @@ NAME_PLAYER_SCREEN EQU 0 NAME_RIVAL_SCREEN EQU 1 NAME_MON_SCREEN EQU 2 +; mon data locations +; Note that some values are not supported by all functions that use these values. +PLAYER_PARTY_DATA EQU 0 +ENEMY_PARTY_DATA EQU 1 +BOX_DATA EQU 2 +DAYCARE_DATA EQU 3 +BATTLE_MON_DATA EQU 4 + ; serial ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm index 47242057..f47087d8 100755 --- a/engine/battle/bank_e_misc.asm +++ b/engine/battle/bank_e_misc.asm @@ -102,10 +102,10 @@ InitList: ; 39bd5 (e:5bd5) ld [wItemPrices + 1], a ret -; get species of mon e in list [wcc49] for LoadMonData +; get species of mon e in list [wMonDataLocation] for LoadMonData GetMonSpecies: ; 39c37 (e:5c37) ld hl, wPartySpecies - ld a, [wcc49] + ld a, [wMonDataLocation] and a jr z, .getSpecies dec a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 7b87be0e..bdb20bb0 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1809,7 +1809,7 @@ SendOutMon: ; 3cc91 (f:4c91) predef LoadMonBackPic xor a ld [$ffe1], a - ld hl, wcc2d + ld hl, wBattleAndStartSavedMenuItem ld [hli], a ld [hl], a ld [wBoostExpByExpAll], a @@ -2123,7 +2123,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) .oldManName db "OLD MAN@" .handleBattleMenuInput - ld a, [wcc2d] + ld a, [wBattleAndStartSavedMenuItem] ld [wCurrentMenuItem], a ld [wLastMenuItem], a sub 2 ; check if the cursor is in the left column @@ -2206,7 +2206,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ld a, [W_BATTLETYPE] cp $2 ; is it a Safari battle? ld a, [wCurrentMenuItem] - ld [wcc2d], a + ld [wBattleAndStartSavedMenuItem], a jr z, .handleMenuSelection ; not Safari battle ; swap the IDs of the item menu and party menu (this is probably because they swapped the positions @@ -2299,11 +2299,11 @@ DisplayBagMenu: ld [wPrintItemPrices], a ld a, ITEMLISTMENU ld [wListMenuID], a - ld a, [wcc2c] + ld a, [wBagSavedMenuItem] ld [wCurrentMenuItem], a call DisplayListMenuID ld a, [wCurrentMenuItem] - ld [wcc2c], a + ld [wBagSavedMenuItem], a ld a, $0 ld [wMenuWatchMovingOutOfBounds], a ld [wMenuItemToSwap], a @@ -2435,8 +2435,8 @@ PartyMenuOrRockOrRun: and a ; was Switch selected? jr z, .switchMon ; if so, jump ; Stats was selected - xor a - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a ld hl, wPartyMon1 call ClearSprites ; display the two status screens @@ -2935,8 +2935,8 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ; isn't actually selected (just pointed to by the cursor) ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - ld a, $4 - ld [wcc49], a + ld a, BATTLE_MON_DATA + ld [wMonDataLocation], a callab GetMaxPP ld hl, wCurrentMenuItem ld c, [hl] @@ -8243,14 +8243,14 @@ ChargeEffect: ; 3f88c (f:788c) ld a, b call PlayBattleAnimation ld a, [de] - ld [wWhichTrade], a + ld [wChargeMoveNum], a ld hl, ChargeMoveEffectText jp PrintText ChargeMoveEffectText: ; 3f8c8 (f:78c8) TX_FAR _ChargeMoveEffectText TX_ASM - ld a, [wWhichTrade] + ld a, [wChargeMoveNum] cp RAZOR_WIND ld hl, MadeWhirlwindText jr z, .asm_3f8f8 diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 0ca4b886..075cbeb1 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -54,7 +54,7 @@ EndOfBattle: ; 137aa (4:77aa) ld [wd11f], a ld [wNumRunAttempts], a ld [wEscapedFromBattle], a - ld hl, wcc2b + ld hl, wPartyAndBillsPCSavedMenuItem ld [hli], a ld [hli], a ld [hli], a diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 4e4d0f3c..11a1e87c 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -148,8 +148,8 @@ GainExperience: ; 5524f (15:524f) call GetPartyMonName ld hl, GainedText call PrintText - xor a ; party mon data - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a call LoadMonData pop hl ld bc, wPartyMon1Level - wPartyMon1Exp @@ -242,15 +242,15 @@ GainExperience: ; 5524f (15:524f) .printGrewLevelText ld hl, GrewLevelText call PrintText - xor a ; party mon data - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a call LoadMonData ld d, $1 callab PrintStatsBox call WaitForTextScrollButtonPress call LoadScreenTilesFromBuffer1 - xor a - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a ld a, [wd0b5] ld [wd11e], a predef LearnMoveFromLevelUp diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 5f953046..74df62aa 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -4,7 +4,7 @@ InitBattleVariables: ; 525af (14:65af) xor a ld [wActionResultOrTookBattleTurn], a ld [wBattleResult], a - ld hl, wcc2b + ld hl, wPartyAndBillsPCSavedMenuItem ld [hli], a ld [hli], a ld [hli], a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index e373ef93..4f72aea1 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -55,8 +55,8 @@ ReadTrainer: ; 39c53 (e:5c53) and a ; have we reached the end of the trainer data? jr z,.FinishUp ld [wcf91],a ; write species somewhere (XXX why?) - ld a,1 - ld [wcc49],a + ld a,ENEMY_PARTY_DATA + ld [wMonDataLocation],a push hl call AddPartyMon pop hl @@ -72,8 +72,8 @@ ReadTrainer: ; 39c53 (e:5c53) ld [W_CURENEMYLVL],a ld a,[hli] ld [wcf91],a - ld a,1 - ld [wcc49],a + ld a,ENEMY_PARTY_DATA + ld [wMonDataLocation],a push hl call AddPartyMon pop hl diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index b43fdcae..2b54108d 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -55,8 +55,8 @@ Evolution_PartyMonLoop: ; loop over party mons push hl ld a, [wcf91] push af - xor a - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a call LoadMonData pop af ld [wcf91], a @@ -206,7 +206,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [wd0b5] ld [wd11e], a xor a - ld [wcc49], a + ld [wMonDataLocation], a call LearnMoveFromLevelUp pop hl predef SetPartyMonTypes @@ -345,12 +345,13 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ld a, [hli] ; move ID jr nz, .learnSetLoop ld d, a ; ID of move to learn - ld a, [wcc49] + ld a, [wMonDataLocation] and a jr nz, .next -; if [wcc49] is 0, get the address of the mon's current moves -; there is no reason to make this conditional because the code wouldn't work properly without doing this -; every call to this function sets [wcc49] to 0 +; If [wMonDataLocation] is 0 (PLAYER_PARTY_DATA), get the address of the mon's +; current moves in party data. Every call to this function sets +; [wMonDataLocation] to 0 because other data locations are not supported. +; If it is not 0, this function will not work properly. ld hl, wPartyMon1Moves ld a, [wWhichPokemon] ld bc, wPartyMon2 - wPartyMon1 diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 0d451bf6..45e88b9c 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -16,7 +16,7 @@ _GivePokemon: ; 4fda5 (13:7da5) call SetPokedexOwnedFlag callab SendNewMonToBox ld hl, wcf4b - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f cp 9 jr c, .asm_4fdec diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index fb263995..6f1167d0 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -130,11 +130,11 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07) ld a,[wInGameTradeReceiveMonSpecies] ld [wcf91],a xor a - ld [wcc49],a + ld [wMonDataLocation],a ; not used ld [wRemoveMonFromBox],a call RemovePokemon - ld a,$80 - ld [wcc49],a + ld a,$80 ; prevent the player from naming the mon + ld [wMonDataLocation],a call AddPartyMon call InGameTrade_CopyDataToReceivedMon callab EvolveTradeMon diff --git a/engine/items/items.asm b/engine/items/items.asm index 6ae4e228..b65e8f1e 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -423,8 +423,8 @@ ItemUseBall: ; d687 (3:5687) ld a,[wPartyCount] cp a,PARTY_LENGTH ;is party full? jr z,.sendToBox - xor a - ld [wcc49],a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call ClearSprites call AddPartyMon ;add mon to Party jr .End @@ -1265,14 +1265,14 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wWhichPokemon],a ld a,e ld [wd11e],a - xor a - ld [wcc49],a ; load from player's party + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call LoadMonData ld d,$01 callab PrintStatsBox ; display new stats text box call WaitForTextScrollButtonPress ; wait for button press - xor a - ld [wcc49],a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a predef LearnMoveFromLevelUp ; learn level up move, if any xor a ld [wForceEvolution],a @@ -1963,8 +1963,8 @@ ItemUsePPRestore: ; e31e (3:631e) ; unsets zero flag if PP was restored, sets zero flag if not ; however, this is bugged for Max Ethers and Max Elixirs (see below) .restorePP - xor a - ld [wcc49],a ; party pokemon + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a call GetMaxPP ld hl,wPartyMon1Moves ld bc,44 @@ -2379,7 +2379,7 @@ AddBonusPP: ; e642 (3:6642) ; gets max PP of a pokemon's move (including PP from PP Ups) ; INPUT: ; [wWhichPokemon] = index of pokemon within party/box -; [wcc49] = pokemon source +; [wMonDataLocation] = pokemon source ; 00: player's party ; 01: enemy's party ; 02: current box @@ -2389,7 +2389,7 @@ AddBonusPP: ; e642 (3:6642) ; OUTPUT: ; [wd11e] = max PP GetMaxPP: ; e677 (3:6677) - ld a,[wcc49] + ld a,[wMonDataLocation] and a ld hl,wPartyMon1Moves ld bc,wPartyMon2 - wPartyMon1 @@ -2426,7 +2426,7 @@ GetMaxPP: ; e677 (3:6677) pop hl push bc ld bc,21 ; PP offset if not player's in-battle pokemon data - ld a,[wcc49] + ld a,[wMonDataLocation] cp a,4 ; player's in-battle pokemon? jr nz,.addPPOffset ld bc,17 ; PP offset if player's in-battle pokemon data diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 74d2fa82..e0b405e8 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -1,44 +1,44 @@ -Func_213c8:: ; 213c8 (8:53c8) +DisplayPCMainMenu:: ; 213c8 (8:53c8) xor a ld [H_AUTOBGTRANSFERENABLED], a call SaveScreenTilesToBuffer2 ld a, [wNumHoFTeams] and a - jr nz, .asm_213f3 + jr nz, .leaguePCAvailable ld a, [wd74b] - bit 5, a - jr z, .asm_213ea + bit 5, a ; received pokedex? + jr z, .noOaksPC ld a, [wNumHoFTeams] and a - jr nz, .asm_213f3 + jr nz, .leaguePCAvailable hlCoord 0, 0 - ld b, $8 - ld c, $e - jr .asm_213fa -.asm_213ea + ld b, 8 + ld c, 14 + jr .next +.noOaksPC hlCoord 0, 0 - ld b, $6 - ld c, $e - jr .asm_213fa -.asm_213f3 + ld b, 6 + ld c, 14 + jr .next +.leaguePCAvailable hlCoord 0, 0 - ld b, $a - ld c, $e -.asm_213fa + ld b, 10 + ld c, 14 +.next call TextBoxBorder call UpdateSprites - ld a, $3 + ld a, 3 ld [wMaxMenuItem], a ld a, [wd7f1] bit 0, a - jr nz, .asm_21414 + jr nz, .metBill hlCoord 2, 2 ld de, SomeonesPCText - jr .asm_2141a -.asm_21414 + jr .next2 +.metBill hlCoord 2, 2 ld de, BillsPCText -.asm_2141a +.next2 call PlaceString hlCoord 2, 4 ld de, wPlayerName @@ -48,43 +48,43 @@ Func_213c8:: ; 213c8 (8:53c8) ld de, PlayersPCText call PlaceString ld a, [wd74b] - bit 5, a - jr z, .asm_21462 + bit 5, a ; received pokedex? + jr z, .noOaksPC2 hlCoord 2, 6 ld de, OaksPCText call PlaceString ld a, [wNumHoFTeams] and a - jr z, .asm_2145a - ld a, $4 + jr z, .noLeaguePC + ld a, 4 ld [wMaxMenuItem], a hlCoord 2, 8 ld de, PKMNLeaguePCText call PlaceString hlCoord 2, 10 ld de, LogOffPCText - jr .asm_2146d -.asm_2145a + jr .next3 +.noLeaguePC hlCoord 2, 8 ld de, LogOffPCText - jr .asm_2146d -.asm_21462 + jr .next3 +.noOaksPC2 ld a, $2 ld [wMaxMenuItem], a hlCoord 2, 6 ld de, LogOffPCText -.asm_2146d +.next3 call PlaceString - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, $2 + ld a, 2 ld [wTopMenuItemY], a - ld a, $1 + ld a, 1 ld [wTopMenuItemX], a xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld a, $1 + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a ret @@ -99,23 +99,23 @@ BillsPC_:: ; 0x214c2 ld hl, wd730 set 6, [hl] xor a - ld [wccd3], a + ld [wParentMenuItem], a inc a ; MONSTER_NAME ld [wNameListType], a call LoadHpBarAndStatusTilePatterns ld a, [wListScrollOffset] push af ld a, [wFlags_0xcd60] - bit 3, a + bit 3, a ; accessing Bill's PC through another PC? jr nz, BillsPCMenu +; accessing it directly ld a, $99 call PlaySound ld hl, SwitchOnText call PrintText -Func_214e8: ; 214e8 (8:54e8) -BillsPCMenu: - ld a, [wccd3] +BillsPCMenu: ; 214e8 (8:54e8) + ld a, [wParentMenuItem] ld [wCurrentMenuItem], a ld hl, vChars2 + $780 ld de, PokeballTileGraphics @@ -123,79 +123,81 @@ BillsPCMenu: call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer hlCoord 0, 0 - ld b, $a - ld c, $c + ld b, 10 + ld c, 12 call TextBoxBorder hlCoord 2, 2 ld de, BillsPCMenuText call PlaceString ld hl, wTopMenuItemY - ld a, $2 - ld [hli], a + ld a, 2 + ld [hli], a ; wTopMenuItemY dec a - ld [hli], a + ld [hli], a ; wTopMenuItemX inc hl inc hl - ld a, $4 - ld [hli], a - ld a, $3 - ld [hli], a + ld a, 4 + ld [hli], a ; wMaxMenuItem + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; wMenuWatchedKeys xor a - ld [hli], a - ld [hli], a + ld [hli], a ; wLastMenuItem + ld [hli], a ; wPartyAndBillsPCSavedMenuItem ld hl, wListScrollOffset - ld [hli], a - ld [hl], a + ld [hli], a ; wListScrollOffset + ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a ld hl, WhatText call PrintText hlCoord 9, 14 - ld b, $2 - ld c, $9 + ld b, 2 + ld c, 9 call TextBoxBorder - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f cp 9 - jr c, .asm_2154f + jr c, .singleDigitBoxNum +; two digit box num sub 9 hlCoord 17, 16 ld [hl], "1" add "0" - jr .asm_21551 -.asm_2154f + jr .next +.singleDigitBoxNum add "1" -.asm_21551 +.next Coorda 18, 16 hlCoord 10, 16 ld de, BoxNoPCText call PlaceString - ld a, $1 + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 call HandleMenuInput bit 1, a - jp nz, Func_21588 ; b button + jp nz, ExitBillsPC ; b button call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] - ld [wccd3], a + ld [wParentMenuItem], a and a - jp z, Func_21618 ; withdraw + jp z, BillsPCWithdraw ; withdraw cp $1 - jp z, Func_215ac ; deposit + jp z, BillsPCDeposit ; deposit cp $2 - jp z, Func_21673 ; release + jp z, BillsPCRelease ; release cp $3 - jp z, Func_216b3 ; change box + jp z, BillsPCChangeBox ; change box -Func_21588: ; 21588 (8:5588) +ExitBillsPC: ; 21588 (8:5588) ld a, [wFlags_0xcd60] - bit 3, a - jr nz, .asm_2159a + bit 3, a ; accessing Bill's PC through another PC? + jr nz, .next +; accessing it directly call LoadTextBoxTilePatterns ld a, $9a call PlaySound call WaitForSoundToFinish -.asm_2159a +.next ld hl, wFlags_0xcd60 res 5, [hl] call LoadScreenTilesFromBuffer2 @@ -205,26 +207,25 @@ Func_21588: ; 21588 (8:5588) res 6, [hl] ret -Func_215ac: ; 215ac (8:55ac) -BillsPCDeposit: +BillsPCDeposit: ; 215ac (8:55ac) ld a, [wPartyCount] dec a - jr nz, .asm_215bb + jr nz, .partyLargeEnough ld hl, CantDepositLastMonText call PrintText jp BillsPCMenu -.asm_215bb +.partyLargeEnough ld a, [W_NUMINBOX] cp MONS_PER_BOX - jr nz, .asm_215cb + jr nz, .boxNotFull ld hl, BoxFullText call PrintText jp BillsPCMenu -.asm_215cb +.boxNotFull ld hl, wPartyCount - call Func_216be + call DisplayMonListMenu jp c, BillsPCMenu - call Func_2174b + call DisplayDepositWithdrawMenu jp nc, BillsPCMenu ld a, [wcf91] call GetCryData @@ -236,45 +237,45 @@ BillsPCDeposit: ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish - ld hl, wWhichTrade - ld a, [wd5a0] + ld hl, wBoxNumString + ld a, [wCurrentBoxNum] and $7f cp 9 - jr c, .asm_2160a + jr c, .singleDigitBoxNum sub 9 ld [hl], "1" inc hl add "0" - jr .asm_2160c -.asm_2160a + jr .next +.singleDigitBoxNum add "1" -.asm_2160c +.next ld [hli], a ld [hl], $50 ld hl, MonWasStoredText call PrintText jp BillsPCMenu -Func_21618: ; 21618 (8:5618) +BillsPCWithdraw: ; 21618 (8:5618) ld a, [W_NUMINBOX] and a - jr nz, .asm_21627 + jr nz, .boxNotEmpty ld hl, NoMonText call PrintText - jp Func_214e8 -.asm_21627 + jp BillsPCMenu +.boxNotEmpty ld a, [wPartyCount] cp PARTY_LENGTH - jr nz, .asm_21637 + jr nz, .partyNotFull ld hl, CantTakeMonText call PrintText - jp Func_214e8 -.asm_21637 + jp BillsPCMenu +.partyNotFull ld hl, W_NUMINBOX - call Func_216be - jp c, Func_214e8 - call Func_2174b - jp nc, Func_214e8 + call DisplayMonListMenu + jp c, BillsPCMenu + call DisplayDepositWithdrawMenu + jp nc, BillsPCMenu ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName @@ -290,25 +291,25 @@ Func_21618: ; 21618 (8:5618) call WaitForSoundToFinish ld hl, MonIsTakenOutText call PrintText - jp Func_214e8 + jp BillsPCMenu -Func_21673: ; 21673 (8:5673) +BillsPCRelease: ; 21673 (8:5673) ld a, [W_NUMINBOX] and a - jr nz, .asm_21682 + jr nz, .loop ld hl, NoMonText call PrintText - jp Func_214e8 -.asm_21682 + jp BillsPCMenu +.loop ld hl, W_NUMINBOX - call Func_216be - jp c, Func_214e8 + call DisplayMonListMenu + jp c, BillsPCMenu ld hl, OnceReleasedText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_21682 + jr nz, .loop inc a ld [wRemoveMonFromBox], a call RemovePokemon @@ -317,13 +318,13 @@ Func_21673: ; 21673 (8:5673) call PlayCry ld hl, MonWasReleasedText call PrintText - jp Func_214e8 + jp BillsPCMenu -Func_216b3: ; 216b3 (8:56b3) +BillsPCChangeBox: ; 216b3 (8:56b3) callba ChangeBox - jp Func_214e8 + jp BillsPCMenu -Func_216be: ; 216be (8:56be) +DisplayMonListMenu: ; 216be (8:56be) ld a, l ld [wListPointer], a ld a, h @@ -333,11 +334,11 @@ Func_216be: ; 216be (8:56be) ld [wListMenuID], a inc a ; MONSTER_NAME ld [wNameListType], a - ld a, [wcc2b] + ld a, [wPartyAndBillsPCSavedMenuItem] ld [wCurrentMenuItem], a call DisplayListMenuID ld a, [wCurrentMenuItem] - ld [wcc2b], a + ld [wPartyAndBillsPCSavedMenuItem], a ret BillsPCMenuText: ; 216e1 (8:56e1) @@ -354,17 +355,19 @@ ENDC BoxNoPCText: ; 21713 (8:5713) db "BOX No.@" -Func_2171b:: ; 2171b (8:571b) +KnowsHMMove:: ; 2171b (8:571b) +; returns whether mon with party index [wWhichPokemon] knows an HM move ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 - jr .asm_21729 + jr .next +; unreachable ld hl, wBoxMon1Moves ld bc, wBoxMon2 - wBoxMon1 -.asm_21729 +.next ld a, [wWhichPokemon] call AddNTimes ld b, NUM_MOVES -.asm_21731 +.loop ld a, [hli] push hl push bc @@ -375,7 +378,7 @@ Func_2171b:: ; 2171b (8:571b) pop hl ret c dec b - jr nz, .asm_21731 + jr nz, .loop and a ret @@ -387,72 +390,72 @@ HMMoveArray: ; 21745 (8:5745) db FLASH db -1 -Func_2174b: ; 2174b (8:574b) +DisplayDepositWithdrawMenu: ; 2174b (8:574b) hlCoord 9, 10 - ld b, $6 - ld c, $9 + ld b, 6 + ld c, 9 call TextBoxBorder - ld a, [wccd3] - and a + ld a, [wParentMenuItem] + and a ; was the Deposit or Withdraw item selected in the parent menu? ld de, DepositPCText - jr nz, .asm_21761 + jr nz, .next ld de, WithdrawPCText -.asm_21761 +.next hlCoord 11, 12 call PlaceString hlCoord 11, 14 ld de, StatsCancelPCText call PlaceString ld hl, wTopMenuItemY - ld a, $c - ld [hli], a - ld a, $a - ld [hli], a + ld a, 12 + ld [hli], a ; wTopMenuItemY + ld a, 10 + ld [hli], a ; wTopMenuItemX xor a - ld [hli], a + ld [hli], a ; wCurrentMenuItem inc hl - ld a, $2 - ld [hli], a - ld a, $3 - ld [hli], a + ld a, 2 + ld [hli], a ; wMaxMenuItem + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; wMenuWatchedKeys xor a - ld [hl], a + ld [hl], a ; wLastMenuItem ld hl, wListScrollOffset - ld [hli], a - ld [hl], a + ld [hli], a ; wListScrollOffset + ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a - ld [wcc2b], a -.asm_2178f + ld [wPartyAndBillsPCSavedMenuItem], a +.loop call HandleMenuInput - bit 1, a - jr nz, .asm_2179f + bit 1, a ; pressed B? + jr nz, .exit ld a, [wCurrentMenuItem] and a - jr z, .asm_217a1 + jr z, .choseDepositWithdraw dec a - jr z, .asm_217a3 -.asm_2179f + jr z, .viewStats +.exit and a ret -.asm_217a1 +.choseDepositWithdraw scf ret -.asm_217a3 +.viewStats call SaveScreenTilesToBuffer1 - ld a, [wccd3] + ld a, [wParentMenuItem] and a - ld a, $0 - jr nz, .asm_217b0 - ld a, $2 -.asm_217b0 - ld [wcc49], a + ld a, PLAYER_PARTY_DATA + jr nz, .next2 + ld a, BOX_DATA +.next2 + ld [wMonDataLocation], a predef StatusScreen predef StatusScreen2 call LoadScreenTilesFromBuffer1 call ReloadTilesetTilePatterns call GoPAL_SET_CF1C call LoadGBPal - jr .asm_2178f + jr .loop DepositPCText: db "DEPOSIT@" WithdrawPCText: db "WITHDRAW@" @@ -518,9 +521,9 @@ CableClubLeftGameboy:: ; 5824 (8:5825) ld a, [W_CURMAP] cp BATTLE_CENTER ld a, LINK_STATE_START_TRADE - jr z, .asm_2183a + jr z, .next inc a ; LINK_STATE_START_BATTLE -.asm_2183a +.next ld [wLinkState], a call EnableAutoTextBoxDrawing tx_pre_jump JustAMomentText @@ -535,9 +538,9 @@ CableClubRightGameboy:: ; 5845 (8:5845) ld a, [W_CURMAP] cp BATTLE_CENTER ld a, LINK_STATE_START_TRADE - jr z, .asm_2185a + jr z, .next inc a ; LINK_STATE_START_BATTLE -.asm_2185a +.next ld [wLinkState], a call EnableAutoTextBoxDrawing tx_pre_jump JustAMomentText diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 55c559f5..14480b0a 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -16,7 +16,7 @@ MainMenu: ; 5af2 (1:5af2) call DelayFrames xor a ; LINK_STATE_NONE ld [wLinkState],a - ld hl,wcc2b + ld hl,wPartyAndBillsPCSavedMenuItem ld [hli],a ld [hli],a ld [hli],a @@ -457,7 +457,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) ld a,3 ; text speed cursor Y coordinate ld [wTopMenuItemY],a call SetCursorPositionsFromOptions - ld a,[wWhichTrade] ; text speed cursor X coordinate + ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate ld [wTopMenuItemX],a ld a,$01 ld [H_AUTOBGTRANSFERENABLED],a ; enable auto background transfer @@ -507,7 +507,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) .downPressed cp a,16 ld b,-13 - ld hl,wWhichTrade + ld hl,wOptionsTextSpeedCursorX jr z,.updateMenuVariables ld b,5 cp a,3 @@ -522,7 +522,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) .upPressed cp a,8 ld b,-5 - ld hl,wWhichTrade + ld hl,wOptionsTextSpeedCursorX jr z,.updateMenuVariables cp a,13 inc hl @@ -541,17 +541,17 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) call PlaceUnfilledArrowMenuCursor jp .loop .cursorInBattleAnimation - ld a,[wTrainerEngageDistance] ; battle animation cursor X coordinate + ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate xor a,$0b ; toggle between 1 and 10 - ld [wTrainerEngageDistance],a + ld [wOptionsBattleAnimCursorX],a jp .eraseOldMenuCursor .cursorInBattleStyle - ld a,[wTrainerFacingDirection] ; battle style cursor X coordinate + ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate xor a,$0b ; toggle between 1 and 10 - ld [wTrainerFacingDirection],a + ld [wOptionsBattleStyleCursorX],a jp .eraseOldMenuCursor .pressedLeftInTextSpeed - ld a,[wWhichTrade] ; text speed cursor X coordinate + ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate cp a,1 jr z,.updateTextSpeedXCoord cp a,7 @@ -562,7 +562,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) sub a,7 jr .updateTextSpeedXCoord .pressedRightInTextSpeed - ld a,[wWhichTrade] ; text speed cursor X coordinate + ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate cp a,14 jr z,.updateTextSpeedXCoord cp a,7 @@ -572,7 +572,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) .fromFastToMedium add a,6 .updateTextSpeedXCoord - ld [wWhichTrade],a ; text speed cursor X coordinate + ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate jp .eraseOldMenuCursor TextSpeedOptionText: ; 5fc0 (1:5fc0) @@ -593,7 +593,7 @@ OptionMenuCancelText: ; 6018 (1:6018) ; sets the options variable according to the current placement of the menu cursors in the options menu SetOptionsFromCursorPositions: ; 601f (1:601f) ld hl,TextSpeedOptionData - ld a,[wWhichTrade] ; text speed cursor X coordinate + ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate ld c,a .loop ld a,[hli] @@ -604,7 +604,7 @@ SetOptionsFromCursorPositions: ; 601f (1:601f) .textSpeedMatchFound ld a,[hl] ld d,a - ld a,[wTrainerEngageDistance] ; battle animation cursor X coordinate + ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate dec a jr z,.battleAnimationOn .battleAnimationOff @@ -613,7 +613,7 @@ SetOptionsFromCursorPositions: ; 601f (1:601f) .battleAnimationOn res 7,d .checkBattleStyle - ld a,[wTrainerFacingDirection] ; battle style cursor X coordinate + ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a jr z,.battleStyleShift .battleStyleSet @@ -638,7 +638,7 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) pop bc dec hl ld a,[hl] - ld [wWhichTrade],a ; text speed cursor X coordinate + ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate hlCoord 0, 3 call .placeUnfilledRightArrow sla c @@ -646,7 +646,7 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) jr nc,.storeBattleAnimationCursorX ld a,10 ; Off .storeBattleAnimationCursorX - ld [wTrainerEngageDistance],a ; battle animation cursor X coordinate + ld [wOptionsBattleAnimCursorX],a ; battle animation cursor X coordinate hlCoord 0, 8 call .placeUnfilledRightArrow sla c @@ -654,7 +654,7 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) jr nc,.storeBattleStyleCursorX ld a,10 .storeBattleStyleCursorX - ld [wTrainerFacingDirection],a ; battle style cursor X coordinate + ld [wOptionsBattleStyleCursorX],a ; battle style cursor X coordinate hlCoord 0, 13 call .placeUnfilledRightArrow ; cursor in front of Cancel diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index 2b8b9e92..8ee40c7c 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -10,7 +10,7 @@ ActivatePC: ; 17e2c (5:7e2c) call LoadScreenTilesFromBuffer2 call Delay3 PCMainMenu: ; 17e48 (5:7e48) - callba Func_213c8 + callba DisplayPCMainMenu ld hl, wFlags_0xcd60 set 5, [hl] call HandleMenuInput diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index b78ba5fb..f436ae24 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -5,18 +5,19 @@ PlayerPC: ; 78e6 (1:78e6) ld [wNameListType], a call SaveScreenTilesToBuffer1 xor a - ld [wcc2c], a - ld [wccd3], a + ld [wBagSavedMenuItem], a + ld [wParentMenuItem], a ld a, [wFlags_0xcd60] - bit 3, a - jr nz, Func_790c + bit 3, a ; accessing player's PC through another PC? + jr nz, PlayerPCMenu +; accessing it directly ld a, (SFX_02_45 - SFX_Headers_02) / 3 call PlaySound ld hl, TurnedOnPC2Text call PrintText -Func_790c: ; 790c (1:790c) - ld a, [wccd3] +PlayerPCMenu: ; 790c (1:790c) + ld a, [wParentMenuItem] ld [wCurrentMenuItem], a ld hl, wFlags_0xcd60 set 5, [hl] @@ -30,69 +31,69 @@ Func_790c: ; 790c (1:790c) ld de, PlayersPCMenuEntries call PlaceString ld hl, wTopMenuItemY - ld a, $2 - ld [hli], a + ld a, 2 + ld [hli], a ; wTopMenuItemY dec a - ld [hli], a + ld [hli], a ; wTopMenuItemX inc hl inc hl - ld a, $3 - ld [hli], a - ld a, $3 - ld [hli], a + ld a, 3 + ld [hli], a ; wMaxMenuItem + ld a, A_BUTTON | B_BUTTON + ld [hli], a ; wMenuWatchedKeys xor a ld [hl], a ld hl, wListScrollOffset - ld [hli], a - ld [hl], a + ld [hli], a ; wListScrollOffset + ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a ld hl, WhatDoYouWantText call PrintText call HandleMenuInput bit 1, a - jp nz, Func_796d + jp nz, ExitPlayerPC call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] - ld [wccd3], a + ld [wParentMenuItem], a and a - jp z, Func_7a12 + jp z, PlayerPCWithdraw dec a - jp z, Func_7995 + jp z, PlayerPCDeposit dec a - jp z, Func_7a8f + jp z, PlayerPCToss -Func_796d: ; 796d (1:796d) +ExitPlayerPC: ; 796d (1:796d) ld a, [wFlags_0xcd60] - bit 3, a - jr nz, .asm_797c + bit 3, a ; accessing player's PC through another PC? + jr nz, .next +; accessing it directly ld a, (SFX_02_46 - SFX_Headers_02) / 3 call PlaySound call WaitForSoundToFinish -.asm_797c +.next ld hl, wFlags_0xcd60 res 5, [hl] call LoadScreenTilesFromBuffer2 xor a ld [wListScrollOffset], a - ld [wcc2c], a + ld [wBagSavedMenuItem], a ld hl, wd730 res 6, [hl] xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret -Func_7995: ; 7995 (1:7995) +PlayerPCDeposit: ; 7995 (1:7995) xor a ld [wCurrentMenuItem], a ld [wListScrollOffset], a ld a, [wNumBagItems] and a - jr nz, Func_79ab + jr nz, .loop ld hl, NothingToDepositText call PrintText - jp Func_790c - -Func_79ab: ; 79ab (1:79ab) + jp PlayerPCMenu +.loop ld hl, WhatToDepositText call PrintText ld hl, wNumBagItems @@ -102,29 +103,30 @@ Func_79ab: ; 79ab (1:79ab) ld [wListPointer + 1], a xor a ld [wPrintItemPrices], a - ld a, $3 + ld a, ITEMLISTMENU ld [wListMenuID], a call DisplayListMenuID - jp c, Func_790c + jp c, PlayerPCMenu call IsKeyItem - ld a, $1 + ld a, 1 ld [wItemQuantity], a ld a, [wIsKeyItem] and a - jr nz, .asm_79e7 + jr nz, .next +; if it's not a key item, there can be more than one of the item ld hl, DepositHowManyText call PrintText call DisplayChooseQuantityMenu cp $ff - jp z, Func_79ab -.asm_79e7 + jp z, .loop +.next ld hl, wNumBoxItems call AddItemToInventory - jr c, .asm_79f8 + jr c, .roomAvailable ld hl, NoRoomToStoreText call PrintText - jp Func_79ab -.asm_79f8 + jp .loop +.roomAvailable ld hl, wNumBagItems call RemoveItemFromInventory call WaitForSoundToFinish @@ -133,20 +135,19 @@ Func_79ab: ; 79ab (1:79ab) call WaitForSoundToFinish ld hl, ItemWasStoredText call PrintText - jp Func_79ab + jp .loop -Func_7a12: ; 7a12 (1:7a12) +PlayerPCWithdraw: ; 7a12 (1:7a12) xor a ld [wCurrentMenuItem], a ld [wListScrollOffset], a ld a, [wNumBoxItems] and a - jr nz, Func_7a28 + jr nz, .loop ld hl, NothingStoredText call PrintText - jp Func_790c - -Func_7a28: ; 7a28 (1:7a28) + jp PlayerPCMenu +.loop ld hl, WhatToWithdrawText call PrintText ld hl, wNumBoxItems @@ -156,29 +157,30 @@ Func_7a28: ; 7a28 (1:7a28) ld [wListPointer + 1], a xor a ld [wPrintItemPrices], a - ld a, $3 + ld a, ITEMLISTMENU ld [wListMenuID], a call DisplayListMenuID - jp c, Func_790c + jp c, PlayerPCMenu call IsKeyItem - ld a, $1 + ld a, 1 ld [wItemQuantity], a ld a, [wIsKeyItem] and a - jr nz, .asm_7a64 + jr nz, .next +; if it's not a key item, there can be more than one of the item ld hl, WithdrawHowManyText call PrintText call DisplayChooseQuantityMenu cp $ff - jp z, Func_7a28 -.asm_7a64 + jp z, .loop +.next ld hl, wNumBagItems call AddItemToInventory - jr c, .asm_7a75 + jr c, .roomAvailable ld hl, CantCarryMoreText call PrintText - jp Func_7a28 -.asm_7a75 + jp .loop +.roomAvailable ld hl, wNumBoxItems call RemoveItemFromInventory call WaitForSoundToFinish @@ -187,20 +189,19 @@ Func_7a28: ; 7a28 (1:7a28) call WaitForSoundToFinish ld hl, WithdrewItemText call PrintText - jp Func_7a28 + jp .loop -Func_7a8f: ; 7a8f (1:7a8f) +PlayerPCToss: ; 7a8f (1:7a8f) xor a ld [wCurrentMenuItem], a ld [wListScrollOffset], a ld a, [wNumBoxItems] and a - jr nz, Func_7aa5 + jr nz, .loop ld hl, NothingStoredText call PrintText - jp Func_790c - -Func_7aa5: ; 7aa5 (1:7aa5) + jp PlayerPCMenu +.loop ld hl, WhatToTossText call PrintText ld hl, wNumBoxItems @@ -210,33 +211,34 @@ Func_7aa5: ; 7aa5 (1:7aa5) ld [wListPointer + 1], a xor a ld [wPrintItemPrices], a - ld a, $3 + ld a, ITEMLISTMENU ld [wListMenuID], a push hl call DisplayListMenuID pop hl - jp c, Func_790c + jp c, PlayerPCMenu push hl call IsKeyItem pop hl - ld a, $1 + ld a, 1 ld [wItemQuantity], a ld a, [wIsKeyItem] and a - jr nz, .asm_7aef + jr nz, .next ld a, [wcf91] call IsItemHM - jr c, .asm_7aef + jr c, .next +; if it's not a key item, there can be more than one of the item push hl ld hl, TossHowManyText call PrintText call DisplayChooseQuantityMenu pop hl cp $ff - jp z, Func_7aa5 -.asm_7aef - call TossItem - jp Func_7aa5 + jp z, .loop +.next + call TossItem ; disallows tossing key items + jp .loop PlayersPCMenuEntries: ; 7af5 (1:7af5) db "WITHDRAW ITEM" diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 0db0d052..7aa09df7 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -54,7 +54,7 @@ RedisplayStartMenu:: ; 2adf (0:2adf) .buttonPressed ; A, B, or Start button pressed call PlaceUnfilledArrowMenuCursor ld a,[wCurrentMenuItem] - ld [wcc2d],a ; save current menu item ID + ld [wBattleAndStartSavedMenuItem],a ; save current menu selection ld a,b and a,%00001010 ; was the Start button or B button pressed? jp nz,CloseStartMenu diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 762a3de1..11b7fa90 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -81,22 +81,22 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) jp z,.choseStats ld c,a ld b,0 - ld hl,wWhichTrade + ld hl,wFieldMoves add hl,bc jp .choseOutOfBattleMove .choseSwitch ld a,[wPartyCount] cp a,2 ; is there more than one pokemon in the party? jp c,StartMenu_Pokemon ; if not, no switching - call SwitchPartyMon_Stats + call SwitchPartyMon_InitVarOrSwapData ; init [wMenuItemToSwap] ld a,SWAP_MONS_PARTY_MENU ld [wPartyMenuTypeOrMessageID],a call GoBackToPartyMenu jp .checkIfPokemonChosen .choseStats call ClearSprites - xor a - ld [wcc49],a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation],a predef StatusScreen predef StatusScreen2 call ReloadMapData @@ -256,14 +256,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ld a,[H_QUOTIENT + 2] sbc b jp nc,.notHealthyEnough - ld a,[wcc2b] + ld a,[wPartyAndBillsPCSavedMenuItem] push af ld a,POTION ld [wcf91],a ld [wd152],a call UseItem pop af - ld [wcc2b],a + ld [wPartyAndBillsPCSavedMenuItem],a jp .loop .notHealthyEnough ; if current HP is less than 1/5 of max HP ld hl,.notHealthyEnoughText @@ -316,11 +316,11 @@ StartMenu_Item: ; 13302 (4:7302) ld [wPrintItemPrices],a ld a,ITEMLISTMENU ld [wListMenuID],a - ld a,[wcc2c] + ld a,[wBagSavedMenuItem] ld [wCurrentMenuItem],a call DisplayListMenuID ld a,[wCurrentMenuItem] - ld [wcc2c],a + ld [wBagSavedMenuItem],a jr nc,.choseItem .exitMenu call LoadScreenTilesFromBuffer2 ; restore saved screen @@ -566,7 +566,7 @@ DrawTrainerInfo: ; 1349a (4:749a) ld de,vChars1 + $570 call TrainerInfo_FarCopyData call EnableLCD - ld hl,wWhichTrade + ld hl,wTrainerInfoTextBoxWidthPlus1 ld a,18 + 1 ld [hli],a dec a @@ -574,7 +574,7 @@ DrawTrainerInfo: ; 1349a (4:749a) ld [hl],1 hlCoord 0, 0 call TrainerInfo_DrawTextBox - ld hl,wWhichTrade + ld hl,wTrainerInfoTextBoxWidthPlus1 ld a,16 + 1 ld [hli],a dec a @@ -627,15 +627,15 @@ TrainerInfo_BadgesText: ; 13597 (4:7597) ; height is always 6 ; INPUT: ; hl = destination address -; [wWhichTrade] = width + 1 -; [wTrainerEngageDistance] = width -; [wTrainerFacingDirection] = distance from the end of a text box row to the start of the next +; [wTrainerInfoTextBoxWidthPlus1] = width +; [wTrainerInfoTextBoxWidth] = width - 1 +; [wTrainerInfoTextBoxNextRowOffset] = distance from the end of a text box row to the start of the next TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) ld a,$79 ; upper left corner tile ID ld de,$7a7b ; top edge and upper right corner tile ID's call TrainerInfo_DrawHorizontalEdge ; draw top edge call TrainerInfo_NextTextBoxRow - ld a,[wWhichTrade] ; width of the text box plus one + ld a,[wTrainerInfoTextBoxWidthPlus1] ld e,a ld d,0 ld c,6 ; height of the text box @@ -651,7 +651,7 @@ TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3) ld [hli],a ; place left corner tile - ld a,[wTrainerEngageDistance] ; width of the text box + ld a,[wTrainerInfoTextBoxWidth] ld c,a ld a,d .loop @@ -663,7 +663,7 @@ TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3) ret TrainerInfo_NextTextBoxRow: ; 135d0 (4:75d0) - ld a,[wTrainerFacingDirection] ; distance to the start of the next row + ld a,[wTrainerInfoTextBoxNextRowOffset] ; distance to the start of the next row .loop inc hl dec a @@ -704,62 +704,65 @@ StartMenu_Option: ; 135f6 (4:75f6) jp RedisplayStartMenu SwitchPartyMon: ; 13613 (4:7613) - call SwitchPartyMon_Stats - ld a, [wWhichTrade] - call SwitchPartyMon_OAM + call SwitchPartyMon_InitVarOrSwapData ; swap data + ld a, [wSwappedMenuItem] + call SwitchPartyMon_ClearGfx ld a, [wCurrentMenuItem] - call SwitchPartyMon_OAM + call SwitchPartyMon_ClearGfx jp RedrawPartyMenu_ -SwitchPartyMon_OAM: ; 13625 (4:7625) +SwitchPartyMon_ClearGfx: ; 13625 (4:7625) push af hlCoord 0, 0 ld bc, SCREEN_WIDTH * 2 call AddNTimes ld c, SCREEN_WIDTH * 2 ld a, " " -.asm_13633 +.clearMonBGLoop ; clear the mon's row in the party menu ld [hli], a dec c - jr nz, .asm_13633 + jr nz, .clearMonBGLoop pop af ld hl, wOAMBuffer ld bc, $10 call AddNTimes ld de, $4 ld c, e -.asm_13645 +.clearMonOAMLoop ld [hl], $a0 add hl, de dec c - jr nz, .asm_13645 + jr nz, .clearMonOAMLoop call WaitForSoundToFinish ld a, (SFX_02_58 - SFX_Headers_02) / 3 jp PlaySound -SwitchPartyMon_Stats: ; 13653 (4:7653) +SwitchPartyMon_InitVarOrSwapData: ; 13653 (4:7653) +; This is used to initialise [wMenuItemToSwap] and to actually swap the data. ld a, [wMenuItemToSwap] - and a - jr nz, .asm_13661 + and a ; has [wMenuItemToSwap] been initialised yet? + jr nz, .pickedMonsToSwap +; If not, initialise [wMenuItemToSwap] so that it matches the current mon. ld a, [wWhichPokemon] - inc a + inc a ; [wMenuItemToSwap] counts from 1 ld [wMenuItemToSwap], a ret -.asm_13661 +.pickedMonsToSwap xor a ld [wPartyMenuTypeOrMessageID], a ld a, [wMenuItemToSwap] dec a ld b, a ld a, [wCurrentMenuItem] - ld [wWhichTrade], a - cp b - jr nz, .asm_1367b + ld [wSwappedMenuItem], a + cp b ; swapping a mon with itself? + jr nz, .swappingDifferentMons +; can't swap a mon with itself xor a ld [wMenuItemToSwap], a ld [wPartyMenuTypeOrMessageID], a ret -.asm_1367b +.swappingDifferentMons ld a, b ld [wMenuItemToSwap], a push hl @@ -770,20 +773,20 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld a, [wCurrentMenuItem] add l ld l, a - jr nc, .asm_1368e + jr nc, .noCarry inc h -.asm_1368e +.noCarry ld a, [wMenuItemToSwap] add e ld e, a - jr nc, .asm_13696 + jr nc, .noCarry2 inc d -.asm_13696 +.noCarry2 ld a, [hl] - ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld [hSwapTemp], a ld a, [de] ld [hl], a - ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT) + ld a, [hSwapTemp] ld [de], a ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 @@ -791,19 +794,19 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) call AddNTimes push hl ld de, wSwitchPartyMonTempBuffer - ld bc, $2c + ld bc, wPartyMon2 - wPartyMon1 call CopyData ld hl, wPartyMons - ld bc, $2c + ld bc, wPartyMon2 - wPartyMon1 ld a, [wMenuItemToSwap] call AddNTimes pop de push hl - ld bc, $2c + ld bc, wPartyMon2 - wPartyMon1 call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, $2c + ld bc, wPartyMon2 - wPartyMon1 call CopyData ld hl, wPartyMonOT ld a, [wCurrentMenuItem] @@ -842,7 +845,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653) ld bc, $b call CopyData ld a, [wMenuItemToSwap] - ld [wWhichTrade], a + ld [wSwappedMenuItem], a xor a ld [wMenuItemToSwap], a ld [wPartyMenuTypeOrMessageID], a diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 32cbf519..3f73a84f 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -65,9 +65,10 @@ DrawHP_: ; 128fb (4:68fb) ; Predef 0x37 StatusScreen: ; 12953 (4:6953) call LoadMonData - ld a, [wcc49] - cp $2 ; 2 means we're in a PC box + ld a, [wMonDataLocation] + cp BOX_DATA jr c, .DontRecalculate +; mon is in a box or daycare ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a ld [W_CURENEMYLVL], a @@ -148,13 +149,13 @@ StatusScreen: ; 12953 (4:6953) hlCoord 11, 10 predef PrintMonType ld hl, NamePointers2 - call .asm_12a7e + call .GetStringPointer ld d, h ld e, l hlCoord 9, 1 call PlaceString ; Pokémon name ld hl, OTPointers - call .asm_12a7e + call .GetStringPointer ld d, h ld e, l hlCoord 12, 16 @@ -175,17 +176,18 @@ StatusScreen: ; 12953 (4:6953) pop af ld [hTilesetType], a ret -.asm_12a7e ; I don't know what this does, iterates over pointers? - ld a, [wcc49] + +.GetStringPointer + ld a, [wMonDataLocation] add a ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hli] ld h, [hl] ld l, a - ld a, [wcc49] - cp $3 + ld a, [wMonDataLocation] + cp DAYCARE_DATA ret z ld a, [wWhichPokemon] jp SkipFixedLengthTextEntries diff --git a/engine/save.asm b/engine/save.asm index ac97e6ba..6dc1a46c 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -309,7 +309,7 @@ Func_73863: ; 73863 (1c:7863) Func_7387b: ; 7387b (1c:787b) ld hl, PointerTable_73895 - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f cp NUM_BOXES / 2 ld b, $2 @@ -341,7 +341,7 @@ ChangeBox:: ; 738a1 (1c:78a1) ld a, [wCurrentMenuItem] and a ret nz ; return if No was chosen - ld hl, wd5a0 + ld hl, wCurrentBoxNum bit 7, [hl] call z, Func_73a29 call Func_7393f @@ -360,7 +360,7 @@ ChangeBox:: ; 738a1 (1c:78a1) call Func_7390e ld a, [wCurrentMenuItem] set 7, a - ld [wd5a0], a + ld [wCurrentBoxNum], a call Func_7387b ld de, W_NUMINBOX call Func_7390e @@ -422,7 +422,7 @@ Func_7393f: ; 7393f (1c:793f) ld [wTopMenuItemX], a xor a ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f ld [wCurrentMenuItem], a ld [wLastMenuItem], a @@ -443,7 +443,7 @@ Func_7393f: ; 7393f (1c:793f) call PlaceString ld hl, hFlags_0xFFF6 res 2, [hl] - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f cp 9 jr c, .asm_739a6 @@ -561,7 +561,7 @@ Func_73a84: ; 73a84 (1c:7a84) ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a pop hl - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f ld c, a ld b, $0 diff --git a/home.asm b/home.asm index f2226eea..1230f07f 100644 --- a/home.asm +++ b/home.asm @@ -243,7 +243,7 @@ DrawHPBar:: ; 1336 (0:1336) ; loads base stats to W_MONHDEXNUM ; INPUT: ; [wWhichPokemon] = index of pokemon within party/box -; [wcc49] = source +; [wMonDataLocation] = source ; 00: player's party ; 01: enemy's party ; 02: current box @@ -376,15 +376,15 @@ PartyMenuInit:: ; 1420 (0:1420) call LoadHpBarAndStatusTilePatterns ld hl, wd730 set 6, [hl] ; turn off letter printing delay - xor a - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a ld [wMenuWatchMovingOutOfBounds], a ld hl, wTopMenuItemY inc a ld [hli], a ; top menu item Y xor a ld [hli], a ; top menu item X - ld a, [wcc2b] + ld a, [wPartyAndBillsPCSavedMenuItem] push af ld [hli], a ; current menu item ID inc hl @@ -420,7 +420,7 @@ HandlePartyMenuInput:: ; 145a (0:145a) xor a ld [wd09b],a ld a,[wCurrentMenuItem] - ld [wcc2b],a + ld [wPartyAndBillsPCSavedMenuItem],a ld hl,wd730 res 6,[hl] ; turn on letter printing delay ld a,[wMenuItemToSwap] @@ -1803,11 +1803,11 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld hl,wPartyCount ld a,[wListPointer] cp l ; is it a list of party pokemon or box pokemon? - ld a,$00 + ld a,PLAYER_PARTY_DATA jr z,.next - ld a,$02 + ld a,BOX_DATA .next - ld [wcc49],a + ld [wMonDataLocation],a ld hl,wWhichPokemon ld a,[hl] ld b,a @@ -1818,7 +1818,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) add b ld [hl],a call LoadMonData ; load pokemon info - ld a,[wcc49] + ld a,[wMonDataLocation] and a ; is it a list of party pokemon or box pokemon? jr z,.skipCopyingLevel .copyLevel @@ -2751,7 +2751,7 @@ SetSpriteImageIndexAfterSettingFacingDirection:: ; 34b9 (0:34b9) ; INPUT: ; hl = address of array ; OUTPUT: -; [wWhichTrade] = if there is match, the matching array index +; [wCoordIndex] = if there is match, the matching array index ; sets carry if the coordinates are in the array, clears carry if not ArePlayerCoordsInArray:: ; 34bf (0:34bf) ld a,[W_YCOORD] @@ -2762,13 +2762,13 @@ ArePlayerCoordsInArray:: ; 34bf (0:34bf) CheckCoords:: ; 34c7 (0:34c7) xor a - ld [wWhichTrade],a + ld [wCoordIndex],a .loop ld a,[hli] cp a,$ff ; reached terminator? jr z,.notInArray push hl - ld hl,wWhichTrade + ld hl,wCoordIndex inc [hl] pop hl .compareYCoord @@ -2792,7 +2792,7 @@ CheckCoords:: ; 34c7 (0:34c7) ; hl = address of array ; [H_SPRITEINDEX] = index of boulder sprite ; OUTPUT: -; [wWhichTrade] = if there is match, the matching array index +; [wCoordIndex] = if there is match, the matching array index ; sets carry if the coordinates are in the array, clears carry if not CheckBoulderCoords:: ; 34e4 (0:34e4) push hl @@ -4586,8 +4586,8 @@ GivePokemon:: ld [wcf91], a ld a, c ld [W_CURENEMYLVL], a - xor a - ld [wcc49], a + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a ld b, BANK(_GivePokemon) ld hl, _GivePokemon jp Bankswitch diff --git a/hram.asm b/hram.asm index f3bacee1..acc66a65 100644 --- a/hram.asm +++ b/hram.asm @@ -44,6 +44,9 @@ hNPCMovementDirections2Index EQU $FF95 ; CalcPositionOfPlayerRelativeToNPC hNPCSpriteOffset EQU $FF95 +; temp value used when swapping bytes +hSwapTemp EQU $FF95 + ; Multiplcation and division variables are meant ; to overlap for back-to-back usage. Big endian. @@ -198,6 +201,8 @@ hTilesetType EQU $FFD7 H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 +hNewPartyLength EQU $FFE4 + hDividend2 EQU $FFE5 hDivisor2 EQU $FFE6 hQuotient2 EQU $FFE7 diff --git a/main.asm b/main.asm index 4558f319..e982f72b 100755 --- a/main.asm +++ b/main.asm @@ -80,7 +80,7 @@ SonyText: db "SONY@" LoadMonData_: -; Load monster [wWhichPokemon] from list [wcc49]: +; Load monster [wWhichPokemon] from list [wMonDataLocation]: ; 0: partymon ; 1: enemymon ; 2: boxmon @@ -90,8 +90,8 @@ LoadMonData_: ld a, [wDayCareMonSpecies] ld [wcf91], a - ld a, [wcc49] - cp 3 + ld a, [wMonDataLocation] + cp DAYCARE_DATA jr z, .GetMonHeader ld a, [wWhichPokemon] @@ -105,8 +105,8 @@ LoadMonData_: ld hl, wPartyMons ld bc, wPartyMon2 - wPartyMon1 - ld a, [wcc49] - cp 1 + ld a, [wMonDataLocation] + cp ENEMY_PARTY_DATA jr c, .getMonEntry ld hl, wEnemyMons @@ -564,7 +564,7 @@ TestBattle: ld a, 20 ld [W_CURENEMYLVL], a xor a - ld [wcc49], a + ld [wMonDataLocation], a ld [W_CURMAP], a call AddPartyMon @@ -1090,7 +1090,7 @@ DrawStartMenu: ; 710b (1:710b) ld [wTopMenuItemY],a ; Y position of first menu choice ld a,$0b ld [wTopMenuItemX],a ; X position of first menu choice - ld a,[wcc2d] ; remembered menu selection from last time + ld a,[wBattleAndStartSavedMenuItem] ; remembered menu selection from last time ld [wCurrentMenuItem],a ld [wLastMenuItem],a xor a @@ -2926,7 +2926,7 @@ RemoveItemFromInventory_: ; ce74 (3:4e74) xor a ld [wListScrollOffset],a ld [wCurrentMenuItem],a - ld [wcc2c],a + ld [wBagSavedMenuItem],a ld [wSavedListScrollOffset],a pop hl ld a,[hl] ; a = number of items in inventory @@ -3553,36 +3553,40 @@ ResetBoulderPushFlags: ; f2dd (3:72dd) ret _AddPartyMon: ; f2e5 (3:72e5) +; Adds a new mon to the player's or enemy's party. +; [wMonDataLocation] is used in an unusual way in this function. +; If the lower nybble is 0, the mon is added to the player's party, else the enemy's. +; If the entire value is 0, then the player is allowed to name the mon. ld de, wPartyCount - ld a, [wcc49] + ld a, [wMonDataLocation] and $f - jr z, .asm_f2f2 + jr z, .next ld de, wEnemyPartyCount -.asm_f2f2 +.next ld a, [de] inc a cp PARTY_LENGTH + 1 - ret nc + ret nc ; return if the party is already full ld [de], a ld a, [de] - ld [$ffe4], a + ld [hNewPartyLength], a add e ld e, a - jr nc, .asm_f300 + jr nc, .noCarry inc d -.asm_f300 +.noCarry ld a, [wcf91] - ld [de], a + ld [de], a ; write species of new mon in party list inc de - ld a, $ff + ld a, $ff ; terminator ld [de], a ld hl, wPartyMonOT - ld a, [wcc49] + ld a, [wMonDataLocation] and $f - jr z, .asm_f315 + jr z, .next2 ld hl, wEnemyMonOT -.asm_f315 - ld a, [$ffe4] +.next2 + ld a, [hNewPartyLength] dec a call SkipFixedLengthTextEntries ld d, h @@ -3590,24 +3594,24 @@ _AddPartyMon: ; f2e5 (3:72e5) ld hl, wPlayerName ld bc, $b call CopyData - ld a, [wcc49] + ld a, [wMonDataLocation] and a - jr nz, .asm_f33f + jr nz, .skipNaming ld hl, wPartyMonNicks - ld a, [$ffe4] + ld a, [hNewPartyLength] dec a call SkipFixedLengthTextEntries ld a, NAME_MON_SCREEN ld [wNamingScreenType], a predef AskName -.asm_f33f +.skipNaming ld hl, wPartyMons - ld a, [wcc49] + ld a, [wMonDataLocation] and $f - jr z, .asm_f34c + jr z, .next3 ld hl, wEnemyMons -.asm_f34c - ld a, [$ffe4] +.next3 + ld a, [hNewPartyLength] dec a ld bc, wPartyMon2 - wPartyMon1 call AddNTimes @@ -3619,15 +3623,17 @@ _AddPartyMon: ; f2e5 (3:72e5) call GetMonHeader ld hl, W_MONHEADER ld a, [hli] - ld [de], a + ld [de], a ; species inc de pop hl push hl - ld a, [wcc49] + ld a, [wMonDataLocation] and $f ld a, $98 ; set enemy trainer mon IVs to fixed average values ld b, $88 - jr nz, .writeFreshMonData + jr nz, .next4 + +; If the mon is being added to the player's party, update the pokedex. ld a, [wcf91] ld [wd11e], a push de @@ -3650,24 +3656,29 @@ _AddPartyMon: ; f2e5 (3:72e5) pop bc ld hl, wPokedexSeen call FlagAction + pop hl push hl + ld a, [W_ISINBATTLE] - and a + and a ; is this a wild mon caught in battle? jr nz, .copyEnemyMonData + +; Not wild. call Random ; generate random IVs ld b, a call Random -.writeFreshMonData ; f3b3 + +.next4 push bc - ld bc, $1b + ld bc, wPartyMon1DVs - wPartyMon1 add hl, bc pop bc ld [hli], a ld [hl], b ; write IVs - ld bc, $fff4 + ld bc, (wPartyMon1HPExp - 1) - (wPartyMon1DVs + 1) add hl, bc - ld a, $1 + ld a, 1 ld c, a xor a ld b, a @@ -3679,13 +3690,13 @@ _AddPartyMon: ; f2e5 (3:72e5) ld [de], a inc de xor a - ld [de], a ; level (?) + ld [de], a ; box level inc de ld [de], a ; status ailments inc de jr .copyMonTypesAndMoves .copyEnemyMonData - ld bc, $1b + ld bc, wPartyMon1DVs - wPartyMon1 add hl, bc ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon ld [hli], a @@ -3698,7 +3709,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld [de], a inc de xor a - ld [de], a ; level (?) + ld [de], a ; box level inc de ld a, [wEnemyMonStatus] ; copy status ailments from cur enemy mon ld [de], a @@ -3711,7 +3722,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld a, [hli] ; type 2 ld [de], a inc de - ld a, [hli] ; unused (?) + ld a, [hli] ; catch rate (held item in gen 2) ld [de], a ld hl, W_MONHMOVES ld a, [hli] @@ -4035,7 +4046,7 @@ _MoveMon: ; f51e (3:751e) push hl srl a add $2 - ld [wcc49], a + ld [wMonDataLocation], a call LoadMonData callba CalcLevelFromExperience ld a, d @@ -4477,7 +4488,7 @@ START_MONEY EQU $3000 inc hl ld [hl], a - ld [wcc49], a + ld [wMonDataLocation], a ld hl, W_OBTAINEDBADGES ld [hli], a diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 5e80a10f..2196e021 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -35,11 +35,11 @@ DayCareMText1: ; 56254 (15:6254) pop af ld hl, DayCareMText_56437 jp c, DayCareMScript_56409 - callab Func_2171b + callab KnowsHMMove ld hl, DayCareMText_5644a jp c, DayCareMScript_56409 xor a - ld [wcc2b], a + ld [wPartyAndBillsPCSavedMenuItem], a ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName @@ -62,8 +62,8 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) xor a ld hl, W_DAYCAREMONNAME call GetPartyMonName - ld a, $3 - ld [wcc49], a + ld a, DAYCARE_DATA + ld [wMonDataLocation], a call LoadMonData callab CalcLevelFromExperience ld a, d diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index b32647b5..73ad345d 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -898,9 +898,9 @@ OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3) call PrintText ld hl, OaksLabReceivedMonText call PrintText - xor a - ld [wcc49], a - ld a, $5 + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a + ld a, 5 ld [W_CURENEMYLVL], a ld a, [wcf91] ld [wd11e], a diff --git a/text.asm b/text.asm index 17067e57..28e4d400 100644 --- a/text.asm +++ b/text.asm @@ -1816,7 +1816,7 @@ _MonWasStoredText:: ; 0x8a159 TX_RAM wcf4b text " was" line "stored in Box @" - TX_RAM wWhichTrade + TX_RAM wBoxNumString text "." prompt diff --git a/wram.asm b/wram.asm index fa9305ef..18d16cc1 100755 --- a/wram.asm +++ b/wram.asm @@ -236,15 +236,32 @@ wLastMenuItem:: ; cc2a ; id of previously selected menu item ds 1 -; group these 3 addresses together because of an ld a,[hli] -wcc2b:: ds 1 ; used in party menu -wcc2c:: ds 1 ; used in item related menus (inventory, pc) -wcc2d:: ds 1 ; also used in inventory, supposed to save an item id +wPartyAndBillsPCSavedMenuItem:: ; cc2b +; It is mainly used by the party menu to remember the cursor position while the +; menu isn't active. +; It is also used to remember the cursor position of mon lists (for the +; withdraw/deposit/release actions) in Bill's PC so that it doesn't get lost +; when you choose a mon from the list and a sub-menu is shown. It's reset when +; you return to the main Bill's PC menu. + ds 1 + +wBagSavedMenuItem:: ; cc2c +; It is used by the bag list to remember the cursor position while the menu +; isn't active. + ds 1 + +wBattleAndStartSavedMenuItem:: ; cc2d +; It is used by the start menu to remember the cursor position while the menu +; isn't active. +; The battle menu uses it so that the cursor position doesn't get lost when +; a sub-menu is shown. It's reset at the start of each battle. + ds 1 wPlayerMoveListIndex:: ; cc2e ds 1 wPlayerMonNumber:: ; cc2f +; index in party of currently battling mon ds 1 wMenuCursorLocation:: ; cc30 @@ -326,7 +343,17 @@ wWhichTradeMonSelectionMenu:: ; cc49 ; $00 = player mons ; $01 = enemy mons -wcc49:: ds 1 ; used in some pokemon related stuff (some kind of species storage byte) +wMonDataLocation:: ; cc49 +; 0 = player's party +; 1 = enemy party +; 2 = current box +; 3 = daycare +; 4 = in-battle mon +; +; AddPartyMon uses it slightly differently. +; If the lower nybble is 0, the mon is added to the player's party, else the enemy's. +; If the entire value is 0, then the player is allowed to name the mon. + ds 1 wMenuWrappingEnabled:: ; cc4a ; set to 1 if you can go from the bottom to the top or top to bottom of a menu @@ -402,6 +429,8 @@ wSimulatedJoypadStatesEnd:: ; ccd3 ; the list starts above this address and extends downwards in memory until here ; overloaded with below labels +wParentMenuItem:: ; ccd3 + wccd3:: ds 1 ; used in battle, pokemon, PC and game corner stuff wForceEvolution:: wccd4:: ds 1 ; has a direct reference for simulated joypad stuff in vermillion and seafoam @@ -605,6 +634,18 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b ds 1 +wChargeMoveNum:: ; cd3d + +wCoordIndex:: ; cd3d + +wOptionsTextSpeedCursorX:: ; cd3d + +wBoxNumString:: ; cd3d + +wTrainerInfoTextBoxWidthPlus1:: ; cd3d + +wSwappedMenuItem:: ; cd3d + wHoFMonSpecies:: ; cd3d wFieldMoves:: ; cd3d @@ -648,6 +689,10 @@ wWhichTrade:: ; cd3d wTrainerSpriteOffset:: ; cd3d ds 1 +wOptionsBattleAnimCursorX:: ; cd3e + +wTrainerInfoTextBoxWidth:: ; cd3e + wHoFPartyMonIndex:: ; cd3e wNumCreditsMonsDisplayed:: ; cd3e @@ -676,6 +721,10 @@ wHiddenObjectFunctionRomBank:: ; cd3e wTrainerEngageDistance:: ; cd3e ds 1 +wOptionsBattleStyleCursorX:: ; cd3f + +wTrainerInfoTextBoxNextRowOffset:: ; cd3f + wHoFMonLevel:: ; cd3f wBadgeOrFaceTiles:: ; cd3f @@ -850,6 +899,7 @@ wRightGBMonSpecies:: ; cd5f wFlags_0xcd60:: ; cd60 ; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously) ; bit 1: boulder dust animation (from using Strength) pending +; bit 3: using generic PC ; bit 5: don't play sound when A or B is pressed in menu ; bit 6: tried pushing against boulder once (you need to push twice before it will move) ds 1 @@ -1976,7 +2026,8 @@ wBoxItems:: ; d53b ds 50 * 2 ds 1 ; end -wd5a0:: ds 2 ; current box number +wCurrentBoxNum:: ; d5a0 + ds 2 wNumHoFTeams:: ; d5a2 ; number of HOF teams -- cgit v1.3.1-sl0p From 148d3f3cf28f9c270e3d5043af0692d95bc731c5 Mon Sep 17 00:00:00 2001 From: dannye Date: Sat, 18 Jul 2015 15:52:03 -0500 Subject: Consolidate coord macros --- engine/HoF_room_pc.asm | 14 +-- engine/battle/animations.asm | 46 +++++----- engine/battle/battle_transitions.asm | 44 ++++----- engine/battle/core.asm | 126 +++++++++++++------------- engine/battle/draw_hud_pokeball_gfx.asm | 4 +- engine/battle/end_of_battle.asm | 2 +- engine/battle/ghost_marowak_anim.asm | 2 +- engine/battle/link_battle_versus_text.asm | 8 +- engine/battle/moveEffects/drain_hp_effect.asm | 4 +- engine/battle/moveEffects/heal_effect.asm | 4 +- engine/battle/moveEffects/recoil_effect.asm | 4 +- engine/battle/scroll_draw_trainer_pic.asm | 2 +- engine/battle/trainer_ai.asm | 2 +- engine/battle/wild_encounters.asm | 2 +- engine/cable_club.asm | 48 +++++----- engine/clear_save.asm | 2 +- engine/evolution.asm | 4 +- engine/evos_moves.asm | 2 +- engine/hall_of_fame.asm | 32 +++---- engine/hidden_object_functions17.asm | 12 +-- engine/hidden_object_functions7.asm | 4 +- engine/intro.asm | 8 +- engine/items/items.asm | 6 +- engine/learn_move.asm | 8 +- engine/menu/bills_pc.asm | 38 ++++---- engine/menu/diploma.asm | 4 +- engine/menu/league_pc.asm | 8 +- engine/menu/main_menu.asm | 58 ++++++------ engine/menu/naming_screen.asm | 22 ++--- engine/menu/party_menu.asm | 2 +- engine/menu/players_pc.asm | 4 +- engine/menu/pokedex.asm | 58 ++++++------ engine/menu/prize_menu.asm | 30 +++--- engine/menu/start_sub_menus.asm | 26 +++--- engine/menu/status_screen.asm | 62 ++++++------- engine/menu/vending_machine.asm | 6 +- engine/oak_speech.asm | 8 +- engine/oak_speech2.asm | 12 +-- engine/overworld/cinnabar_lab.asm | 4 +- engine/overworld/movement.asm | 2 +- engine/overworld/pokemart.asm | 4 +- engine/save.asm | 18 ++-- engine/slot_machine.asm | 26 +++--- engine/titlescreen.asm | 12 +-- engine/town_map.asm | 32 +++---- engine/trade.asm | 32 +++---- engine/trade2.asm | 20 ++-- home.asm | 44 ++++----- home/copy2.asm | 8 +- home/overworld.asm | 12 +-- home/text.asm | 22 ++--- home/vcopy.asm | 6 +- macros.asm | 21 +---- main.asm | 48 +++++----- scripts/bikeshop.asm | 6 +- scripts/celadongamecorner.asm | 16 ++-- scripts/celadonmartroof.asm | 4 +- scripts/vermiliondock.asm | 2 +- 58 files changed, 528 insertions(+), 539 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 77a07ea3..dc05814a 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -14,9 +14,9 @@ HallOfFamePC: ; 7405c (1d:405c) ld bc, $10 ld a, $ff call FillMemory - hlCoord 0, 0 + coord hl, 0, 0 call FillFourRowsWithBlack - hlCoord 0, 14 + coord hl, 0, 14 call FillFourRowsWithBlack ld a, $c0 ld [rBGP], a @@ -61,7 +61,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb) ld a,[hl] ld [wcf91],a ld [wd0b5],a - hlCoord 8, 6 + coord hl, 8, 6 call GetMonHeader call LoadFrontSpriteByMonIndex ld hl,vBGMap0 + $c @@ -162,7 +162,7 @@ FillFourRowsWithBlack: ; 7417b (1d:417b) jp FillMemory FillMiddleOfScreenWithWhite: ; 74183 (1d:4183) - hlCoord 0, 4 + coord hl, 0, 4 ld bc, SCREEN_WIDTH * 10 ld a, $7f ; blank white tile jp FillMemory @@ -172,7 +172,7 @@ Credits: ; 7418e (1d:418e) push de .nextCreditsScreen pop de - hlCoord 9, 6 + coord hl, 9, 6 push hl call FillMiddleOfScreenWithWhite pop hl @@ -248,10 +248,10 @@ Credits: ; 7418e (1d:418e) ld hl, vChars2 + $600 ld bc, (BANK(TheEndGfx) << 8) + $0a call CopyVideoData - hlCoord 4, 8 + coord hl, 4, 8 ld de, TheEndTextString call PlaceString - hlCoord 4, 9 + coord hl, 4, 9 inc de call PlaceString jp FadeInCreditsText diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 7764603d..6803c38b 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -759,7 +759,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) cp a,1 ret nz .moveGhostMarowakLeft - hlCoord 17, 0 + coord hl, 17, 0 ld de,20 ld bc,$0707 ; 7 rows and 7 columns .loop @@ -858,7 +858,7 @@ DoExplodeSpecialEffects: ; 79009 (1e:5009) cp a,1 ; is it the end of the subanimation? jr nz,FlashScreenEveryFourFrameBlocks ; if it's the end of the subanimation, make the attacking pokemon disappear - hlCoord 1, 5 + coord hl, 1, 5 jp AnimationHideMonPic ; make pokemon disappear ; flashes the screen when subanimation counter is 1 modulo 4 @@ -1292,12 +1292,12 @@ AnimationSlideMonUp: ; 7927a (1e:527a) ld c, $7 ld a, [H_WHOSETURN] and a - hlCoord 1, 6 - deCoord 1, 5 + coord hl, 1, 6 + coord de, 1, 5 ld a, $30 jr z, .asm_79291 - hlCoord 12, 1 - deCoord 12, 0 + coord hl, 12, 1 + coord de, 12, 0 ld a, $ff .asm_79291 ld [wd09f], a @@ -1352,9 +1352,9 @@ _AnimationSlideMonUp: ; 792bf (1e:52bf) jr nz, .asm_792c4 ld a, [H_WHOSETURN] and a - hlCoord 1, 11 + coord hl, 1, 11 jr z, .asm_792e2 - hlCoord 12, 6 + coord hl, 12, 6 .asm_792e2 ld a, [wd09f] inc a @@ -1513,11 +1513,11 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1) ; The mon's sprite disappears after this animation. ld a, [H_WHOSETURN] and a - hlCoord 0, 5 - deCoord 2, 5 + coord hl, 0, 5 + coord de, 2, 5 jr z, .asm_793c2 - hlCoord 11, 0 - deCoord 13, 0 + coord hl, 11, 0 + coord de, 13, 0 .asm_793c2 xor a @@ -1561,9 +1561,9 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9) call AnimationHideMonPic ld a, [H_WHOSETURN] and a - hlCoord 2, 5 + coord hl, 2, 5 jr z, .asm_79407 - hlCoord 11, 0 + coord hl, 11, 0 .asm_79407 xor a push hl @@ -1674,12 +1674,12 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1) ld a, [H_WHOSETURN] and a jr z, .asm_794b1 - hlCoord 16, 0 - deCoord 14, 0 + coord hl, 16, 0 + coord de, 14, 0 jr .asm_794b7 .asm_794b1 - hlCoord 5, 5 - deCoord 3, 5 + coord hl, 5, 5 + coord de, 3, 5 .asm_794b7 push de xor a @@ -1883,10 +1883,10 @@ AnimationSlideMonLeft: ; 795f8 (1e:55f8) ld a, [H_WHOSETURN] and a jr z, .asm_79602 - hlCoord 12, 0 + coord hl, 12, 0 jr .asm_79605 .asm_79602 - hlCoord 0, 5 + coord hl, 0, 5 .asm_79605 ld d, $8 .asm_79607 @@ -2121,7 +2121,7 @@ Func_79793: ; 79793 (1e:5793) xor a ld [W_SPRITEFLIPPED], a call GetMonHeader - hlCoord 12, 0 + coord hl, 12, 0 call LoadFrontSpriteByMonIndex jr .asm_797d3 .asm_797b0 @@ -2185,7 +2185,7 @@ Func_7980c: ; 7980c (1e:580c) push bc ld e, a ld d, $0 - hlCoord 0, 0 + coord hl, 0, 0 add hl, de ld bc, $707 call ClearScreenArea @@ -2207,7 +2207,7 @@ GetMonSpriteTileMapPointerFromRowCount: ; 79820 (1e:5820) .enemyTurn ld a, 12 .next - hlCoord 0, 0 + coord hl, 0, 0 ld e, a ld d, 0 add hl, de diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 997f23ef..4f605b52 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -202,7 +202,7 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72) call BattleTransition_InwardSpiral jr .done .outwardSpiral - hlCoord 10, 10 + coord hl, 10, 10 ld a, $3 ld [wd09f], a ld a, l @@ -231,7 +231,7 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72) BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) ld a, $7 ld [wWhichTrade], a - hlCoord 0, 0 + coord hl, 0, 0 ld c, $11 ld de, SCREEN_WIDTH call BattleTransition_InwardSpiral_ @@ -371,20 +371,20 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f) push bc xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 0, 7 - deCoord 0, 8 + coord hl, 0, 7 + coord de, 0, 8 ld bc, -SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 - hlCoord 0, 10 - deCoord 0, 9 + coord hl, 0, 10 + coord de, 0, 9 ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 - hlCoord 8, 0 - deCoord 9, 0 + coord hl, 8, 0 + coord de, 9, 0 ld bc, -2 call BattleTransition_CopyTiles2 - hlCoord 11, 0 - deCoord 10, 0 + coord hl, 11, 0 + coord de, 10, 0 ld bc, $2 call BattleTransition_CopyTiles2 ld a, $1 @@ -405,20 +405,20 @@ BattleTransition_Split: ; 70bca (1c:4bca) ld [H_AUTOBGTRANSFERENABLED], a .loop push bc - hlCoord 0, 16 - deCoord 0, 17 + coord hl, 0, 16 + coord de, 0, 17 ld bc, -SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 - hlCoord 0, 1 - deCoord 0, 0 + coord hl, 0, 1 + coord de, 0, 0 ld bc, SCREEN_WIDTH * 2 call BattleTransition_CopyTiles1 - hlCoord 18, 0 - deCoord 19, 0 + coord hl, 18, 0 + coord de, 19, 0 ld bc, -2 call BattleTransition_CopyTiles2 - hlCoord 1, 0 - deCoord 0, 0 + coord hl, 1, 0 + coord de, 0, 0 ld bc, $2 call BattleTransition_CopyTiles2 call BattleTransition_TransferDelay3 @@ -514,8 +514,8 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ; used for high level wild dungeon battles BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) ld c, SCREEN_HEIGHT - hlCoord 0, 0 - deCoord 1, 17 + coord hl, 0, 0 + coord de, 1, 17 xor a ld [H_AUTOBGTRANSFERENABLED], a .loop @@ -553,8 +553,8 @@ BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ; used for low level wild dungeon battles BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) ld c, SCREEN_WIDTH - hlCoord 0, 0 - deCoord 19, 1 + coord hl, 0, 0 + coord de, 19, 1 xor a ld [H_AUTOBGTRANSFERENABLED], a .loop diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 2f407290..5deeb4dc 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -101,7 +101,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ld a, MESSAGE_BOX ; the usual text box at the bottom of the screen ld [wTextBoxID], a call DisplayTextBoxID - hlCoord 1, 5 + coord hl, 1, 5 ld bc, $307 call ClearScreenArea call DisableLCD @@ -117,7 +117,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) or c jr nz, .clearBackgroundLoop ; copy the work RAM tile map to VRAM - hlCoord 0, 0 + coord hl, 0, 0 ld de, vBGMap0 ld b, 18 ; number of rows .copyRowLoop @@ -176,7 +176,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ld [H_AUTOBGTRANSFERENABLED], a ld a, $31 ld [$ffe1], a - hlCoord 1, 5 + coord hl, 1, 5 predef CopyUncompressedPicToTilemap xor a ld [hWY], a @@ -324,7 +324,7 @@ StartBattle: ; 3c11e (f:411e) ld [wcf91], a ld [wBattleMonSpecies2], a call LoadScreenTilesFromBuffer1 - hlCoord 1, 5 + coord hl, 1, 5 ld a, $9 call SlideTrainerPicOffScreen call SaveScreenTilesToBuffer1 @@ -760,12 +760,12 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3) ret UpdateCurMonHPBar: ; 3c4f6 (f:44f6) - hlCoord 10, 9 ; tile pointer to player HP bar + coord hl, 10, 9 ; tile pointer to player HP bar ld a, [H_WHOSETURN] and a ld a, $1 jr z, .playersTurn - hlCoord 2, 2 ; tile pointer to enemy HP bar + coord hl, 2, 2 ; tile pointer to enemy HP bar xor a .playersTurn push bc @@ -852,10 +852,10 @@ FaintEnemyPokemon: ; 0x3c567 ld hl, wPlayerUsedMove ld [hli], a ld [hl], a - hlCoord 12, 5 - deCoord 12, 6 + coord hl, 12, 5 + coord de, 12, 6 call SlideDownFaintedMonPic - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $40b call ClearScreenArea ld a, [W_ISINBATTLE] @@ -1105,11 +1105,11 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741) ld [hl], a ld [wBattleMonStatus], a call ReadPlayerMonCurHPAndStatus - hlCoord 9, 7 + coord hl, 9, 7 ld bc, $50b call ClearScreenArea - hlCoord 1, 10 - deCoord 1, 11 + coord hl, 1, 10 + coord de, 1, 11 call SlideDownFaintedMonPic ld a, $1 ld [wBattleResult], a @@ -1137,7 +1137,7 @@ DoUseNextMonDialogue: ; 3c79b (f:479b) ld hl, UseNextMonText call PrintText .displayYesNoBox - hlCoord 13, 9 + coord hl, 13, 9 ld bc, $a0e ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -1214,7 +1214,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) ld a, [W_CUROPPONENT] cp $c8 + SONY1 jr nz, .notSony1Battle - hlCoord 0, 0 ; sony 1 battle + coord hl, 0, 0 ; sony 1 battle ld bc, $815 call ClearScreenArea call ScrollTrainerPicAfterBattle @@ -1384,7 +1384,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld [wAICount],a ld hl,W_PLAYERBATTSTATUS1 res 5,[hl] - hlCoord 18, 0 + coord hl, 18, 0 ld a,8 call SlideTrainerPicOffScreen call PrintEmptyString @@ -1454,7 +1454,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) jr nz,.next4 ld hl, TrainerAboutToUseText call PrintText - hlCoord 0, 7 + coord hl, 0, 7 ld bc,$0801 ld a,TWO_OPTION_MENU ld [wTextBoxID],a @@ -1489,7 +1489,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) call LoadScreenTilesFromBuffer1 .next4 call ClearSprites - hlCoord 0, 0 + coord hl, 0, 0 ld bc,$040B call ClearScreenArea ld b,1 @@ -1505,7 +1505,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) call LoadMonFrontSprite ld a,$CF ld [$FFE1],a - hlCoord 15, 6 + coord hl, 15, 6 predef AnimateSendingOutMon ld a,[wEnemyMonSpecies2] call PlayCry @@ -1835,7 +1835,7 @@ SendOutMon: ; 3cc91 (f:4c91) ld [H_WHOSETURN], a ld a, POOF_ANIM call PlayMoveAnimation - hlCoord 4, 11 + coord hl, 4, 11 predef AnimateSendingOutMon ld a, [wcf91] call PlayCry @@ -1844,10 +1844,10 @@ SendOutMon: ; 3cc91 (f:4c91) ; show 2 stages of the player mon getting smaller before disappearing AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) - hlCoord 1, 5 + coord hl, 1, 5 ld bc, $707 call ClearScreenArea - hlCoord 3, 7 + coord hl, 3, 7 ld bc, $505 xor a ld [wDownscaledMonSize], a @@ -1856,7 +1856,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) ld c, 4 call DelayFrames call .clearScreenArea - hlCoord 4, 9 + coord hl, 4, 9 ld bc, $303 ld a, $1 ld [wDownscaledMonSize], a @@ -1868,7 +1868,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) ld a, $4c Coorda 5, 11 .clearScreenArea - hlCoord 1, 5 + coord hl, 1, 5 ld bc, $707 jp ClearScreenArea @@ -1891,14 +1891,14 @@ DrawHUDsAndHPBars: ; 3cd5a (f:4d5a) DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 9, 7 + coord hl, 9, 7 ld bc, $50b call ClearScreenArea callab PlacePlayerHUDTiles - hlCoord 18, 9 + coord hl, 18, 9 ld [hl], $73 ld de, wBattleMonNick - hlCoord 10, 7 + coord hl, 10, 7 call CenterMonName call PlaceString ld hl, wBattleMonSpecies @@ -1909,7 +1909,7 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) ld de, wLoadedMonLevel ld bc, $b call CopyData - hlCoord 14, 8 + coord hl, 14, 8 push hl inc hl ld de, wLoadedMonStatus @@ -1920,7 +1920,7 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) .asm_3cdae ld a, [wLoadedMonSpecies] ld [wcf91], a - hlCoord 10, 9 + coord hl, 10, 9 predef DrawHP ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -1952,15 +1952,15 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $40c call ClearScreenArea callab PlaceEnemyHUDTiles ld de, wEnemyMonNick - hlCoord 1, 0 + coord hl, 1, 0 call CenterMonName call PlaceString - hlCoord 4, 1 + coord hl, 4, 1 push hl inc hl ld de, wEnemyMonStatus @@ -2033,7 +2033,7 @@ DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) .drawHPBar xor a ld [wHPBarType], a - hlCoord 2, 2 + coord hl, 2, 2 call DrawHPBar ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -2108,12 +2108,12 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ld bc, $b call CopyData ; the following simulates the keystrokes by drawing menus on screen - hlCoord 9, 14 + coord hl, 9, 14 ld [hl], "▶" ld c, 80 call DelayFrames ld [hl], $7f - hlCoord 9, 16 + coord hl, 9, 16 ld [hl], "▶" ld c, 50 call DelayFrames @@ -2145,7 +2145,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) .safariLeftColumn Coorda 13, 14 Coorda 13, 16 - hlCoord 7, 14 + coord hl, 7, 14 ld de, W_NUMSAFARIBALLS ld bc, $102 call PrintNumber @@ -2178,7 +2178,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) .safariRightColumn Coorda 1, 14 ; clear upper cursor position in left column Coorda 1, 16 ; clear lower cursor position in left column - hlCoord 7, 14 + coord hl, 7, 14 ld de, W_NUMSAFARIBALLS ld bc, $102 call PrintNumber @@ -2399,7 +2399,7 @@ PartyMenuOrRockOrRun: call GBPalNormal jp DisplayBattleMenu .partyMonDeselected - hlCoord 11, 11 + coord hl, 11, 11 ld bc, $81 ld a, $7f call FillMemory @@ -2561,17 +2561,17 @@ MoveSelectionMenu: ; 3d219 (f:5219) ret z ld hl, wBattleMonMoves call .loadmoves - hlCoord 4, 12 + coord hl, 4, 12 ld b, $4 ld c, $e di call TextBoxBorder - hlCoord 4, 12 + coord hl, 4, 12 ld [hl], $7a - hlCoord 10, 12 + coord hl, 10, 12 ld [hl], $7e ei - hlCoord 6, 13 + coord hl, 6, 13 call .writemoves ld b, $5 ld a, $c @@ -2579,11 +2579,11 @@ MoveSelectionMenu: ; 3d219 (f:5219) .mimicmenu ld hl, wEnemyMonMoves call .loadmoves - hlCoord 0, 7 + coord hl, 0, 7 ld b, $4 ld c, $e call TextBoxBorder - hlCoord 2, 8 + coord hl, 2, 8 call .writemoves ld b, $1 ld a, $7 @@ -2594,11 +2594,11 @@ MoveSelectionMenu: ; 3d219 (f:5219) ld bc, $2c call AddNTimes call .loadmoves - hlCoord 4, 7 + coord hl, 4, 7 ld b, $4 ld c, $e call TextBoxBorder - hlCoord 6, 8 + coord hl, 6, 8 call .writemoves ld b, $5 ld a, $7 @@ -2654,7 +2654,7 @@ SelectMenuItem: ; 3d2fe (f:52fe) jr z, .battleselect dec a jr nz, .select - hlCoord 1, 14 + coord hl, 1, 14 ld de, WhichTechniqueString call PlaceString jr .select @@ -2666,7 +2666,7 @@ SelectMenuItem: ; 3d2fe (f:52fe) ld a, [wMenuItemToSwap] and a jr z, .select - hlCoord 5, 13 + coord hl, 5, 13 dec a ld bc, $14 call AddNTimes @@ -2903,7 +2903,7 @@ SwapMovesInMenu: ; 3d435 (f:5435) PrintMenuItem: ; 3d4b6 (f:54b6) xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 0, 8 + coord hl, 0, 8 ld b, $3 ld c, $9 call TextBoxBorder @@ -2916,7 +2916,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ld a, [wCurrentMenuItem] cp b jr nz, .notDisabled - hlCoord 1, 10 + coord hl, 1, 10 ld de, DisabledText call PlaceString jr .moveDisabled @@ -2948,23 +2948,23 @@ PrintMenuItem: ; 3d4b6 (f:54b6) and $3f ld [wcd6d], a ; print TYPE/ and / - hlCoord 1, 9 + coord hl, 1, 9 ld de, TypeText call PlaceString - hlCoord 7, 11 + coord hl, 7, 11 ld [hl], "/" - hlCoord 5, 9 + coord hl, 5, 9 ld [hl], "/" - hlCoord 5, 11 + coord hl, 5, 11 ld de, wcd6d ld bc, $102 call PrintNumber - hlCoord 8, 11 + coord hl, 8, 11 ld de, wd11e ld bc, $102 call PrintNumber call GetCurrentMove - hlCoord 2, 10 + coord hl, 2, 10 predef PrintMoveType .moveDisabled ld a, $1 @@ -4924,7 +4924,7 @@ ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) ld [wHPBarNewHP+1],a ld a,[hl] ld [wHPBarNewHP],a - hlCoord 2, 2 + coord hl, 2, 2 xor a ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening @@ -5042,7 +5042,7 @@ ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) ld [wHPBarMaxHP+1],a ld a,[hl] ld [wHPBarMaxHP],a - hlCoord 10, 9 + coord hl, 10, 9 ld a,$01 ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening @@ -6456,7 +6456,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92) ld [$0], a ld a, $31 ld [$ffe1], a - hlCoord 1, 5 + coord hl, 1, 5 predef_jump CopyUncompressedPicToTilemap ; does nothing since no stats are ever selected (barring glitches) @@ -6875,7 +6875,7 @@ InitBattleCommon: ; 3ef3d (f:6f3d) ld [$ffe1], a dec a ld [wAICount], a - hlCoord 12, 0 + coord hl, 12, 0 predef CopyUncompressedPicToTilemap ld a, $ff ld [wEnemyMonPartyPos], a @@ -6929,7 +6929,7 @@ InitWildBattle: ; 3ef8b (f:6f8b) xor a ld [W_TRAINERCLASS], a ld [$ffe1], a - hlCoord 12, 0 + coord hl, 12, 0 predef CopyUncompressedPicToTilemap ; common code that executes after init battle code specific to trainer or wild battles @@ -6951,10 +6951,10 @@ InitBattle_Common: ; 3efeb (f:6feb) ld a, $9c ld [H_AUTOBGTRANSFERDEST + 1], a call LoadScreenTilesFromBuffer1 - hlCoord 9, 7 + coord hl, 9, 7 ld bc, $50a call ClearScreenArea - hlCoord 1, 0 + coord hl, 1, 0 ld bc, $40a call ClearScreenArea call ClearSprites @@ -7098,7 +7098,7 @@ LoadMonBackPic: ; 3f103 (f:7103) ; been loaded with GetMonHeader. ld a, [wBattleMonSpecies2] ld [wcf91], a - hlCoord 1, 5 + coord hl, 1, 5 ld b, $7 ld c, $8 call ClearScreenArea diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 06280a15..e9be0da5 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -121,7 +121,7 @@ PlacePlayerHUDTiles: ; 3a902 (e:6902) ld de, wTrainerFacingDirection ld bc, $3 call CopyData - hlCoord 18, 10 + coord hl, 18, 10 ld de, rIE jr PlaceHUDTiles @@ -136,7 +136,7 @@ PlaceEnemyHUDTiles: ; 3a919 (e:6919) ld de, wTrainerFacingDirection ld bc, $3 call CopyData - hlCoord 1, 2 + coord hl, 1, 2 ld de, $1 jr PlaceHUDTiles diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 075cbeb1..8264e49c 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -19,7 +19,7 @@ EndOfBattle: ; 137aa (4:77aa) jr z, .placeWinOrLoseString ld de, DrawText .placeWinOrLoseString - hlCoord 6, 8 + coord hl, 6, 8 call PlaceString ld c, 200 call DelayFrames diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 73d3bcc2..e3b3f42c 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -4,7 +4,7 @@ MarowakAnim: ; 708ca (1c:48ca) ld [rOBP1], a call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap - hlCoord 12, 0 + coord hl, 12, 0 ld bc, $707 call ClearScreenArea call Delay3 diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index 7320da29..dfb2fe35 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -1,18 +1,18 @@ ; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names DisplayLinkBattleVersusTextBox: ; 372d6 (d:72d6) call LoadTextBoxTilePatterns - hlCoord 3, 4 + coord hl, 3, 4 ld b, $7 ld c, $c call TextBoxBorder - hlCoord 4, 5 + coord hl, 4, 5 ld de, wPlayerName call PlaceString - hlCoord 4, 10 + coord hl, 4, 10 ld de, wLinkEnemyTrainerName call PlaceString ; place bold "VS" tiles between the names - hlCoord 9, 8 + coord hl, 9, 8 ld a, $69 ld [hli], a ld [hl], $6a diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm index be52e76d..1096794f 100644 --- a/engine/battle/moveEffects/drain_hp_effect.asm +++ b/engine/battle/moveEffects/drain_hp_effect.asm @@ -71,10 +71,10 @@ DrainHPEffect_: ; 783f (1:783f) .next ld a, [H_WHOSETURN] and a - hlCoord 10, 9 + coord hl, 10, 9 ld a, $1 jr z, .next2 - hlCoord 2, 2 + coord hl, 2, 2 xor a .next2 ld [wHPBarType], a diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm index d9729747..cea63a1f 100644 --- a/engine/battle/moveEffects/heal_effect.asm +++ b/engine/battle/moveEffects/heal_effect.asm @@ -89,10 +89,10 @@ HealEffect_: ; 3b9ec (e:79ec) call BankswitchEtoF ld a, [H_WHOSETURN] and a - hlCoord 10, 9 + coord hl, 10, 9 ld a, $1 jr z, .updateHPBar - hlCoord 2, 2 + coord hl, 2, 2 xor a .updateHPBar ld [wHPBarType], a diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm index 95b54922..51232af6 100644 --- a/engine/battle/moveEffects/recoil_effect.asm +++ b/engine/battle/moveEffects/recoil_effect.asm @@ -53,12 +53,12 @@ RecoilEffect_: ; 1392c (4:792c) ld [hli], a ld [hl], a .getHPBarCoords - hlCoord 10, 9 + coord hl, 10, 9 ld a, [H_WHOSETURN] and a ld a, $1 jr z, .updateHPBar - hlCoord 2, 2 + coord hl, 2, 2 xor a .updateHPBar ld [wHPBarType], a diff --git a/engine/battle/scroll_draw_trainer_pic.asm b/engine/battle/scroll_draw_trainer_pic.asm index 18df86e0..b32650e3 100644 --- a/engine/battle/scroll_draw_trainer_pic.asm +++ b/engine/battle/scroll_draw_trainer_pic.asm @@ -6,7 +6,7 @@ _ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) ld b, $1 call GoPAL_SET callab _LoadTrainerPic - hlCoord 19, 0 + coord hl, 19, 0 ld c, $0 .scrollLoop inc c diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 55314ea9..a53f00f6 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -641,7 +641,7 @@ AIRecoverHP: ; 3a6da (e:66da) AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) call AIPrintItemUse_ - hlCoord 2, 2 + coord hl, 2, 2 xor a ld [wHPBarType],a predef UpdateHPBar2 diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 03dc6fb6..5964f996 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -25,7 +25,7 @@ TryDoWildEncounter: ; 13870 (4:7870) .asm_1389e ; determine if wild pokemon can appear in the half-block we're standing in ; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? - hlCoord 9, 9 + coord hl, 9, 9 ld c, [hl] ld a, [W_GRASSTILE] cp c diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 87f7b34c..fbdb6260 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -9,11 +9,11 @@ CableClub_DoBattleOrTrade: ; 5317 (1:5317) call LoadFontTilePatterns call LoadHpBarAndStatusTilePatterns call LoadTrainerInfoTextBoxTiles - hlCoord 3, 8 + coord hl, 3, 8 ld b, 2 ld c, 12 call CableClub_TextBoxBorder - hlCoord 4, 10 + coord hl, 4, 10 ld de, PleaseWaitString call PlaceString ld hl, wPlayerNumHits @@ -399,7 +399,7 @@ TradeCenter_SelectMon: ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a - hlCoord 1, 1 + coord hl, 1, 1 ld bc, $0601 call ClearScreenArea .playerMonMenu_HandleInput @@ -464,11 +464,11 @@ TradeCenter_SelectMon: dec a .displayStatsTradeMenu push af - hlCoord 0, 14 + coord hl, 0, 14 ld b, 2 ld c, 18 call CableClub_TextBoxBorder - hlCoord 2, 16 + coord hl, 2, 16 ld de, .statsTrade call PlaceString xor a @@ -596,15 +596,15 @@ ReturnToCableClubRoom: ; 577d (1:577d) ret TradeCenter_DrawCancelBox: - hlCoord 11, 15 + coord hl, 11, 15 ld a, $7e ld bc, 2 * 20 + 9 call FillMemory - hlCoord 0, 15 + coord hl, 0, 15 ld b, 1 ld c, 9 call CableClub_TextBoxBorder - hlCoord 2, 16 + coord hl, 2, 16 ld de, CancelTextString jp PlaceString @@ -613,7 +613,7 @@ CancelTextString: TradeCenter_PlaceSelectedEnemyMonMenuCursor: ld a, [wSerialSyncAndExchangeNybbleReceiveData] - hlCoord 1, 9 + coord hl, 1, 9 ld bc, 20 call AddNTimes ld [hl], $ec ; cursor @@ -630,24 +630,24 @@ TradeCenter_DisplayStats: jp TradeCenter_DrawCancelBox TradeCenter_DrawPartyLists: - hlCoord 0, 0 + coord hl, 0, 0 ld b, 6 ld c, 18 call CableClub_TextBoxBorder - hlCoord 0, 8 + coord hl, 0, 8 ld b, 6 ld c, 18 call CableClub_TextBoxBorder - hlCoord 5, 0 + coord hl, 5, 0 ld de, wPlayerName call PlaceString - hlCoord 5, 8 + coord hl, 5, 8 ld de, wLinkEnemyTrainerName call PlaceString - hlCoord 2, 1 + coord hl, 2, 1 ld de, wPartySpecies call TradeCenter_PrintPartyListNames - hlCoord 2, 9 + coord hl, 2, 9 ld de, wEnemyPartyMons ; fall through @@ -684,7 +684,7 @@ TradeCenter_Trade: ld [wSerialExchangeNybbleReceiveData], a ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a - hlCoord 0, 12 + coord hl, 0, 12 ld b, 4 ld c, 18 call CableClub_TextBoxBorder @@ -709,10 +709,10 @@ TradeCenter_Trade: ld [wd11e], a call GetMonName ld hl, WillBeTradedText - bcCoord 1, 14 + coord bc, 1, 14 call TextCommandProcessor call SaveScreenTilesToBuffer1 - hlCoord 10, 7 + coord hl, 10, 7 ld bc, $080b ld a, TRADE_CANCEL_MENU ld [wTwoOptionMenuID], a @@ -726,11 +726,11 @@ TradeCenter_Trade: ; if trade cancelled ld a, $1 ld [wSerialExchangeNybbleSendData], a - hlCoord 0, 12 + coord hl, 0, 12 ld b, 4 ld c, 18 call CableClub_TextBoxBorder - hlCoord 1, 14 + coord hl, 1, 14 ld de, TradeCanceled call PlaceString call Serial_PrintWaitingTextAndSyncAndExchangeNybble @@ -743,11 +743,11 @@ TradeCenter_Trade: dec a ; did the other person cancel? jr nz, .doTrade ; if the other person cancelled - hlCoord 0, 12 + coord hl, 0, 12 ld b, 4 ld c, 18 call CableClub_TextBoxBorder - hlCoord 1, 14 + coord hl, 1, 14 ld de, TradeCanceled call PlaceString jp .tradeCancelled @@ -851,11 +851,11 @@ TradeCenter_Trade: call Serial_PrintWaitingTextAndSyncAndExchangeNybble ld c, 40 call DelayFrames - hlCoord 0, 12 + coord hl, 0, 12 ld b, 4 ld c, 18 call CableClub_TextBoxBorder - hlCoord 1, 14 + coord hl, 1, 14 ld de, TradeCompleted call PlaceString predef SaveSAVtoSRAM2 diff --git a/engine/clear_save.asm b/engine/clear_save.asm index 66d7e920..2febb123 100755 --- a/engine/clear_save.asm +++ b/engine/clear_save.asm @@ -5,7 +5,7 @@ DoClearSaveDialogue: ; 1c98a (7:498a) call LoadTextBoxTilePatterns ld hl, ClearSaveDataText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc, $80f ld a, NO_YES_MENU ld [wTwoOptionMenuID], a diff --git a/engine/evolution.asm b/engine/evolution.asm index 4776b3b6..9ed38c21 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -99,7 +99,7 @@ EvolutionSetWholeScreenPalette: ; 7beb4 (1e:7eb4) Evolution_LoadPic: ; 7beb9 (1e:7eb9) call GetMonHeader - hlCoord 7, 2 + coord hl, 7, 2 jp LoadFlippedFrontSpriteByMonIndex Func_7bec2: ; 7bec2 (1e:7ec2) @@ -117,7 +117,7 @@ Func_7bed6: ; 7bed6 (1e:7ed6) push bc xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 7, 2 + coord hl, 7, 2 ld bc, $707 ld de, $d .asm_7bee3 diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 2b54108d..4a253c68 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -121,7 +121,7 @@ Evolution_PartyMonLoop: ; loop over party mons call DelayFrames xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $c14 call ClearScreenArea ld a, $1 diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 81ccffdc..0d933571 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -57,11 +57,11 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) call HoFDisplayAndRecordMonInfo ld c, 80 call DelayFrames - hlCoord 2, 13 + coord hl, 2, 13 ld b, $3 ld c, $e call TextBoxBorder - hlCoord 4, 15 + coord hl, 4, 15 ld de, HallOfFameText call PlaceString ld c, 180 @@ -112,7 +112,7 @@ HoFShowMonOrPlayer: ; 70278 (1c:4278) call HoFLoadPlayerPics jr .next1 .showMon - hlCoord 12, 5 + coord hl, 12, 5 call GetMonHeader call LoadFrontSpriteByMonIndex predef LoadMonBackPic @@ -157,22 +157,22 @@ HoFDisplayAndRecordMonInfo: ; 702e1 (1c:42e1) jp HoFRecordMonInfo HoFDisplayMonInfo: ; 702f0 (1c:42f0) - hlCoord 0, 2 + coord hl, 0, 2 ld b, 9 ld c, 10 call TextBoxBorder - hlCoord 2, 6 + coord hl, 2, 6 ld de, HoFMonInfoText call PlaceString - hlCoord 1, 4 + coord hl, 1, 4 ld de, wcd6d call PlaceString ld a, [wHoFMonLevel] - hlCoord 8, 7 + coord hl, 8, 7 call PrintLevelCommon ld a, [wHoFMonSpecies] ld [wd0b5], a - hlCoord 3, 9 + coord hl, 3, 9 predef PrintMonType ld a, [wHoFMonSpecies] jp PlayCry @@ -203,28 +203,28 @@ HoFLoadPlayerPics: ; 7033e (1c:433e) HoFLoadMonPlayerPicTileIDs: ; 7036d (1c:436d) ; c = base tile ID ld b, 0 - hlCoord 12, 5 + coord hl, 12, 5 predef_jump CopyTileIDsFromList HoFDisplayPlayerStats: ; 70377 (1c:4377) ld hl, wd747 set 3, [hl] predef DisplayDexRating - hlCoord 0, 4 + coord hl, 0, 4 ld b, $6 ld c, $a call TextBoxBorder - hlCoord 5, 0 + coord hl, 5, 0 ld b, $2 ld c, $9 call TextBoxBorder - hlCoord 7, 2 + coord hl, 7, 2 ld de, wPlayerName call PlaceString - hlCoord 1, 6 + coord hl, 1, 6 ld de, HoFPlayTimeText call PlaceString - hlCoord 5, 7 + coord hl, 5, 7 ld de, W_PLAYTIMEHOURS + 1 ld bc, $103 call PrintNumber @@ -233,10 +233,10 @@ HoFDisplayPlayerStats: ; 70377 (1c:4377) ld de, W_PLAYTIMEMINUTES + 1 ld bc, $8102 call PrintNumber - hlCoord 1, 9 + coord hl, 1, 9 ld de, HoFMoneyText call PlaceString - hlCoord 4, 10 + coord hl, 4, 10 ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index a8b4f812..841929b8 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -72,7 +72,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9) call LoadMonFrontSprite ld a, $80 ld [$ffe1], a - hlCoord 10, 11 + coord hl, 10, 11 predef AnimateSendingOutMon call WaitForTextScrollButtonPress call LoadScreenTilesFromBuffer1 @@ -109,11 +109,11 @@ LinkCableHelp: ; 5dc29 (17:5c29) .asm_5c51 ld hl, wd730 set 6, [hl] - hlCoord 0, 0 + coord hl, 0, 0 ld b, $8 ld c, $d call TextBoxBorder - hlCoord 2, 2 + coord hl, 2, 2 ld de, HowToLinkText call PlaceString ld hl, LinkCableHelpText2 @@ -193,13 +193,13 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) .asm_5dd15 ld hl, wd730 set 6, [hl] - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $060a call TextBoxBorder - hlCoord 1, 2 + coord hl, 1, 2 ld de, StatusAilmentText1 call PlaceString - hlCoord 6, 2 + coord hl, 6, 2 ld de, StatusAilmentText2 call PlaceString ld hl, ViridianSchoolBlackboardText2 diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index c835775e..810d9bfe 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -402,11 +402,11 @@ BillsHousePokemonList: ; 1ec05 (7:6c05) .asm_1ec2d ld hl, wd730 set 6, [hl] - hlCoord 0, 0 + coord hl, 0, 0 ld b, $a ld c, $9 call TextBoxBorder - hlCoord 2, 2 + coord hl, 2, 2 ld de, BillsMonListText call PlaceString ld hl, BillsHousePokemonListText2 diff --git a/engine/intro.asm b/engine/intro.asm index bbe47cdb..79cc2101 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -205,7 +205,7 @@ IntroClearScreen: ; 417f0 (10:57f0) IntroClearMiddleOfScreen: ; 417f8 (10:57f8) ; clear the area of the tile map between the black bars on the top and bottom - hlCoord 0, 4 + coord hl, 0, 4 ld bc, SCREEN_WIDTH * 10 IntroClearCommon: ; 417fe (10:57fe) @@ -263,7 +263,7 @@ IntroMoveMon: ; 4180e (10:580e) ret IntroCopyTiles: ; 4183f (10:583f) - hlCoord 13, 7 + coord hl, 13, 7 CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842) ld c, 0 @@ -337,10 +337,10 @@ PlayShootingStar: ; 4188a (10:588a) IntroDrawBlackBars: ; 418e9 (10:58e9) ; clear the screen and draw black bars on the top and bottom call IntroClearScreen - hlCoord 0, 0 + coord hl, 0, 0 ld c, SCREEN_WIDTH * 4 call IntroPlaceBlackTiles - hlCoord 0, 14 + coord hl, 0, 14 ld c, SCREEN_WIDTH * 4 call IntroPlaceBlackTiles ld hl, vBGMap1 diff --git a/engine/items/items.asm b/engine/items/items.asm index 7617ba6c..bd19c152 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -913,7 +913,7 @@ ItemUseMedicine: ; dabb (3:5abb) sbc b ld [hl],a ld [wHPBarNewHP+1],a - hlCoord 4, 1 + coord hl, 4, 1 ld a,[wWhichPokemon] ld bc,2 * 20 call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled @@ -2095,7 +2095,7 @@ ItemUseTMHM: ; e479 (3:6479) call PrintText ld hl,TeachMachineMoveText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a @@ -2486,7 +2486,7 @@ TossItem_: ; e6f1 (3:66f1) call CopyStringToCF4B ; copy name to wcf4b ld hl,IsItOKToTossItemText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a diff --git a/engine/learn_move.asm b/engine/learn_move.asm index cb5bdbd7..1c0e038c 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -76,7 +76,7 @@ DontAbandonLearning: ; 6e5b (1:6e5b) AbandonLearning: ; 6eda (1:6eda) ld hl, AbandonLearningText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc, $80f ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -99,7 +99,7 @@ TryingToLearn: ; 6f07 (1:6f07) push hl ld hl, TryingToLearnText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc, $80f ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -120,11 +120,11 @@ TryingToLearn: ; 6f07 (1:6f07) push hl ld hl, WhichMoveToForgetText call PrintText - hlCoord 4, 7 + coord hl, 4, 7 ld b, $4 ld c, $e call TextBoxBorder - hlCoord 6, 8 + coord hl, 6, 8 ld de, wMovesString ld a, [hFlags_0xFFF6] set 2, a diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 59da2774..d491cd38 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -11,17 +11,17 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8) ld a, [wNumHoFTeams] and a jr nz, .leaguePCAvailable - hlCoord 0, 0 + coord hl, 0, 0 ld b, 8 ld c, 14 jr .next .noOaksPC - hlCoord 0, 0 + coord hl, 0, 0 ld b, 6 ld c, 14 jr .next .leaguePCAvailable - hlCoord 0, 0 + coord hl, 0, 0 ld b, 10 ld c, 14 .next @@ -32,15 +32,15 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8) ld a, [wd7f1] bit 0, a jr nz, .metBill - hlCoord 2, 2 + coord hl, 2, 2 ld de, SomeonesPCText jr .next2 .metBill - hlCoord 2, 2 + coord hl, 2, 2 ld de, BillsPCText .next2 call PlaceString - hlCoord 2, 4 + coord hl, 2, 4 ld de, wPlayerName call PlaceString ld l, c @@ -50,7 +50,7 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8) ld a, [wd74b] bit 5, a ; received pokedex? jr z, .noOaksPC2 - hlCoord 2, 6 + coord hl, 2, 6 ld de, OaksPCText call PlaceString ld a, [wNumHoFTeams] @@ -58,20 +58,20 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8) jr z, .noLeaguePC ld a, 4 ld [wMaxMenuItem], a - hlCoord 2, 8 + coord hl, 2, 8 ld de, PKMNLeaguePCText call PlaceString - hlCoord 2, 10 + coord hl, 2, 10 ld de, LogOffPCText jr .next3 .noLeaguePC - hlCoord 2, 8 + coord hl, 2, 8 ld de, LogOffPCText jr .next3 .noOaksPC2 ld a, $2 ld [wMaxMenuItem], a - hlCoord 2, 6 + coord hl, 2, 6 ld de, LogOffPCText .next3 call PlaceString @@ -122,11 +122,11 @@ BillsPCMenu: ; 214e8 (8:54e8) ld bc, (BANK(PokeballTileGraphics) << 8) + $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer - hlCoord 0, 0 + coord hl, 0, 0 ld b, 10 ld c, 12 call TextBoxBorder - hlCoord 2, 2 + coord hl, 2, 2 ld de, BillsPCMenuText call PlaceString ld hl, wTopMenuItemY @@ -149,7 +149,7 @@ BillsPCMenu: ; 214e8 (8:54e8) ld [wPlayerMonNumber], a ld hl, WhatText call PrintText - hlCoord 9, 14 + coord hl, 9, 14 ld b, 2 ld c, 9 call TextBoxBorder @@ -159,7 +159,7 @@ BillsPCMenu: ; 214e8 (8:54e8) jr c, .singleDigitBoxNum ; two digit box num sub 9 - hlCoord 17, 16 + coord hl, 17, 16 ld [hl], "1" add "0" jr .next @@ -167,7 +167,7 @@ BillsPCMenu: ; 214e8 (8:54e8) add "1" .next Coorda 18, 16 - hlCoord 10, 16 + coord hl, 10, 16 ld de, BoxNoPCText call PlaceString ld a, 1 @@ -391,7 +391,7 @@ HMMoveArray: ; 21745 (8:5745) db -1 DisplayDepositWithdrawMenu: ; 2174b (8:574b) - hlCoord 9, 10 + coord hl, 9, 10 ld b, 6 ld c, 9 call TextBoxBorder @@ -401,9 +401,9 @@ DisplayDepositWithdrawMenu: ; 2174b (8:574b) jr nz, .next ld de, WithdrawPCText .next - hlCoord 11, 12 + coord hl, 11, 12 call PlaceString - hlCoord 11, 14 + coord hl, 11, 14 ld de, StatsCancelPCText call PlaceString ld hl, wTopMenuItemY diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm index 33453a53..56373dd3 100755 --- a/engine/menu/diploma.asm +++ b/engine/menu/diploma.asm @@ -12,7 +12,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld bc, $0010 ld a, BANK(CircleTile) call FarCopyData2 - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $1012 predef Diploma_TextBoxBorder ld hl, DiplomaTextPointersAndCoords @@ -33,7 +33,7 @@ DisplayDiploma: ; 566e2 (15:66e2) pop bc dec c jr nz, .asm_56715 - hlCoord 10, 4 + coord hl, 10, 4 ld de, wPlayerName call PlaceString callba DrawPlayerCharacter diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index c38ab86b..560ed421 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -95,18 +95,18 @@ LeaguePCShowMon: ; 76610 (1d:6610) ld b, $0B ld c, 0 call GoPAL_SET - hlCoord 12, 5 + coord hl, 12, 5 call GetMonHeader call LoadFrontSpriteByMonIndex call GBPalNormal - hlCoord 0, 13 + coord hl, 0, 13 ld b, 2 ld c, $12 call TextBoxBorder - hlCoord 1, 15 + coord hl, 1, 15 ld de, HallOfFameNoText call PlaceString - hlCoord 16, 15 + coord hl, 16, 15 ld de, wHoFTeamNo ld bc, $0103 call PrintNumber diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 10ad7a2d..9e160f81 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -33,20 +33,20 @@ MainMenu: ; 5af2 (1:5af2) ld a,[wd088] cp a,1 jr z,.next1 - hlCoord 0, 0 + coord hl, 0, 0 ld b,6 ld c,13 call TextBoxBorder - hlCoord 2, 2 + coord hl, 2, 2 ld de,ContinueText call PlaceString jr .next2 .next1 - hlCoord 0, 0 + coord hl, 0, 0 ld b,4 ld c,13 call TextBoxBorder - hlCoord 2, 2 + coord hl, 2, 2 ld de,NewGameText call PlaceString .next2 @@ -139,12 +139,12 @@ LinkMenu: ; 5c0a (1:5c0a) call SaveScreenTilesToBuffer1 ld hl, WhereWouldYouLikeText call PrintText - hlCoord 5, 5 + coord hl, 5, 5 ld b, $6 ld c, $d call TextBoxBorder call UpdateSprites - hlCoord 7, 7 + coord hl, 7, 7 ld de, CableClubOptionsText call PlaceString xor a @@ -340,21 +340,21 @@ CableClubOptionsText: ; 5d97 (1:5d97) ContinueGame: ; 5db5 (1:5db5) xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 4, 7 + coord hl, 4, 7 ld b, $8 ld c, $e call TextBoxBorder - hlCoord 5, 9 + coord hl, 5, 9 ld de, SaveScreenInfoText call PlaceString - hlCoord 12, 9 + coord hl, 12, 9 ld de, wPlayerName call PlaceString - hlCoord 17, 11 + coord hl, 17, 11 call Func_5e2f - hlCoord 16, 13 + coord hl, 16, 13 call Func_5e42 - hlCoord 13, 15 + coord hl, 13, 15 call Func_5e55 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -364,23 +364,23 @@ ContinueGame: ; 5db5 (1:5db5) PrintSaveScreenText: ; 5def (1:5def) xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 4, 0 + coord hl, 4, 0 ld b, $8 ld c, $e call TextBoxBorder call LoadTextBoxTilePatterns call UpdateSprites - hlCoord 5, 2 + coord hl, 5, 2 ld de, SaveScreenInfoText call PlaceString - hlCoord 12, 2 + coord hl, 12, 2 ld de, wPlayerName call PlaceString - hlCoord 17, 4 + coord hl, 17, 4 call Func_5e2f - hlCoord 16, 6 + coord hl, 16, 6 call Func_5e42 - hlCoord 13, 8 + coord hl, 13, 8 call Func_5e55 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -424,28 +424,28 @@ SaveScreenInfoText: ; 5e6a (1:5e6a) next "TIME@" DisplayOptionMenu: ; 5e8a (1:5e8a) - hlCoord 0, 0 + coord hl, 0, 0 ld b,3 ld c,18 call TextBoxBorder - hlCoord 0, 5 + coord hl, 0, 5 ld b,3 ld c,18 call TextBoxBorder - hlCoord 0, 10 + coord hl, 0, 10 ld b,3 ld c,18 call TextBoxBorder - hlCoord 1, 1 + coord hl, 1, 1 ld de,TextSpeedOptionText call PlaceString - hlCoord 1, 6 + coord hl, 1, 6 ld de,BattleAnimationOptionText call PlaceString - hlCoord 1, 11 + coord hl, 1, 11 ld de,BattleStyleOptionText call PlaceString - hlCoord 2, 16 + coord hl, 2, 16 ld de,OptionMenuCancelText call PlaceString xor a @@ -639,7 +639,7 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) dec hl ld a,[hl] ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate - hlCoord 0, 3 + coord hl, 0, 3 call .placeUnfilledRightArrow sla c ld a,1 ; On @@ -647,7 +647,7 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) ld a,10 ; Off .storeBattleAnimationCursorX ld [wOptionsBattleAnimCursorX],a ; battle animation cursor X coordinate - hlCoord 0, 8 + coord hl, 0, 8 call .placeUnfilledRightArrow sla c ld a,1 @@ -655,10 +655,10 @@ SetCursorPositionsFromOptions: ; 604c (1:604c) ld a,10 .storeBattleStyleCursorX ld [wOptionsBattleStyleCursorX],a ; battle style cursor X coordinate - hlCoord 0, 13 + coord hl, 0, 13 call .placeUnfilledRightArrow ; cursor in front of Cancel - hlCoord 0, 16 + coord hl, 0, 16 ld a,1 .placeUnfilledRightArrow ld e,a diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 2416f0da..20deb834 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -4,7 +4,7 @@ AskName: ; 64eb (1:64eb) push hl ld a, [W_ISINBATTLE] dec a - hlCoord 0, 0 + coord hl, 0, 0 ld b, $4 ld c, $b call z, ClearScreenArea ; only if in wild batle @@ -13,7 +13,7 @@ AskName: ; 64eb (1:64eb) call GetMonName ld hl, DoYouWantToNicknameText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc, $80f ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -93,7 +93,7 @@ DisplayNamingScreen: ; 6596 (1:6596) call LoadHpBarAndStatusTilePatterns call LoadEDTile callba LoadMonPartySpriteGfx - hlCoord 0, 4 + coord hl, 0, 4 ld b, $9 ld c, $12 call TextBoxBorder @@ -343,7 +343,7 @@ PrintAlphabet: ; 676f (1:676f) jr nz, .lowercase ld de, UpperCaseAlphabet .lowercase - hlCoord 2, 5 + coord hl, 2, 5 ld bc, $509 ; 5 rows, 9 columns .outerLoop push bc @@ -374,13 +374,13 @@ PrintNicknameAndUnderscores: ; 680e (1:680e) call CalcStringLength ld a, c ld [wHPBarMaxHP], a - hlCoord 10, 2 + coord hl, 10, 2 ld bc, $10a call ClearScreenArea - hlCoord 10, 2 + coord hl, 10, 2 ld de, wcf4b call PlaceString - hlCoord 10, 3 + coord hl, 10, 3 ld a, [wNamingScreenType] cp NAME_MON_SCREEN jr nc, .pokemon1 @@ -419,7 +419,7 @@ PrintNicknameAndUnderscores: ; 680e (1:680e) .emptySpacesRemaining ld c, a ld b, $0 - hlCoord 10, 3 + coord hl, 10, 3 add hl, bc ld [hl], $77 ; raised underscore tile id ret @@ -467,7 +467,7 @@ CalcStringLength: ; 68eb (1:68eb) jr .loop PrintNamingText: ; 68f8 (1:68f8) - hlCoord 0, 1 + coord hl, 0, 1 ld a, [wNamingScreenType] ld de, YourTextString and a @@ -482,12 +482,12 @@ PrintNamingText: ; 68f8 (1:68f8) pop af ld [wd11e], a call GetMonName - hlCoord 4, 1 + coord hl, 4, 1 call PlaceString ld hl, $1 add hl, bc ld [hl], $c9 - hlCoord 1, 3 + coord hl, 1, 3 ld de, NicknameTextString jr .placeString .notNickname diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index fcdd5c50..00ae3912 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -30,7 +30,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) jp z,.printMessage call ErasePartyMenuCursors callba SendBlkPacket_PartyMenu - hlCoord 3, 0 + coord hl, 3, 0 ld de,wPartySpecies xor a ld c,a diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index f436ae24..89974dd0 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -22,12 +22,12 @@ PlayerPCMenu: ; 790c (1:790c) ld hl, wFlags_0xcd60 set 5, [hl] call LoadScreenTilesFromBuffer2 - hlCoord 0, 0 + coord hl, 0, 0 ld b, $8 ld c, $e call TextBoxBorder call UpdateSprites - hlCoord 2, 2 + coord hl, 2, 2 ld de, PlayersPCMenuEntries call PlaceString ld hl, wTopMenuItemY diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 80eedecd..08ce0da9 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -118,7 +118,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) pop af ld [wCurrentMenuItem],a push bc - hlCoord 0, 3 + coord hl, 0, 3 ld de,20 ld bc,$7f0d ; 13 blank tiles call DrawTileLine ; cover up the menu cursor in the pokemon list @@ -126,7 +126,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) ret .buttonBPressed push bc - hlCoord 15, 10 + coord hl, 15, 10 ld de,20 ld bc,$7f07 ; 7 blank tiles call DrawTileLine ; cover up the menu cursor in the side menu @@ -153,43 +153,43 @@ HandlePokedexListMenu: ; 40111 (10:4111) xor a ld [H_AUTOBGTRANSFERENABLED],a ; draw the horizontal line separating the seen and owned amounts from the menu - hlCoord 15, 8 + coord hl, 15, 8 ld a,$7a ; horizontal line tile ld [hli],a ld [hli],a ld [hli],a ld [hli],a ld [hli],a - hlCoord 14, 0 + coord hl, 14, 0 ld [hl],$71 ; vertical line tile - hlCoord 14, 1 + coord hl, 14, 1 call DrawPokedexVerticalLine - hlCoord 14, 9 + coord hl, 14, 9 call DrawPokedexVerticalLine ld hl,wPokedexSeen ld b,wPokedexSeenEnd - wPokedexSeen call CountSetBits ld de,wd11e - hlCoord 16, 3 + coord hl, 16, 3 ld bc,$0103 call PrintNumber ; print number of seen pokemon ld hl,wPokedexOwned ld b,wPokedexOwnedEnd - wPokedexOwned call CountSetBits ld de,wd11e - hlCoord 16, 6 + coord hl, 16, 6 ld bc,$0103 call PrintNumber ; print number of owned pokemon - hlCoord 16, 2 + coord hl, 16, 2 ld de,PokedexSeenText call PlaceString - hlCoord 16, 5 + coord hl, 16, 5 ld de,PokedexOwnText call PlaceString - hlCoord 1, 1 + coord hl, 1, 1 ld de,PokedexContentsText call PlaceString - hlCoord 16, 10 + coord hl, 16, 10 ld de,PokedexMenuItemsText call PlaceString ; find the highest pokedex number among the pokemon the player has seen @@ -211,10 +211,10 @@ HandlePokedexListMenu: ; 40111 (10:4111) .loop xor a ld [H_AUTOBGTRANSFERENABLED],a - hlCoord 4, 2 + coord hl, 4, 2 ld bc,$0e0a call ClearScreenArea - hlCoord 1, 3 + coord hl, 1, 3 ld a,[wListScrollOffset] ld [wd11e],a ld d,7 @@ -411,18 +411,18 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) push af xor a ld [hTilesetType],a - hlCoord 0, 0 + coord hl, 0, 0 ld de,1 ld bc,$6414 call DrawTileLine ; draw top border - hlCoord 0, 17 + coord hl, 0, 17 ld b,$6f call DrawTileLine ; draw bottom border - hlCoord 0, 1 + coord hl, 0, 1 ld de,20 ld bc,$6610 call DrawTileLine ; draw left border - hlCoord 19, 1 + coord hl, 19, 1 ld b,$67 call DrawTileLine ; draw right border ld a,$63 ; upper left corner tile @@ -433,14 +433,14 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) Coorda 0, 17 ld a,$6e ; lower right corner tile Coorda 19, 17 - hlCoord 0, 9 + coord hl, 0, 9 ld de,PokedexDataDividerLine call PlaceString ; draw horizontal divider line - hlCoord 9, 6 + coord hl, 9, 6 ld de,HeightWeightText call PlaceString call GetMonName - hlCoord 9, 2 + coord hl, 9, 2 call PlaceString ld hl,PokedexEntryPointers ld a,[wd11e] @@ -452,7 +452,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld a,[hli] ld e,a ld d,[hl] ; de = address of pokedex entry - hlCoord 9, 4 + coord hl, 9, 4 call PlaceString ; print species name ld h,b ld l,c @@ -460,7 +460,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld a,[wd11e] push af call IndexToPokedex - hlCoord 2, 8 + coord hl, 2, 8 ld a, "№" ld [hli],a ld a,$f2 @@ -482,7 +482,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) call Delay3 call GBPalNormal call GetMonHeader ; load pokemon picture location - hlCoord 1, 1 + coord hl, 1, 1 call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture ld a,[wcf91] call PlayCry ; play pokemon cry @@ -495,14 +495,14 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description inc de ; de = address of feet (height) ld a,[de] ; reads feet, but a is overwritten without being used - hlCoord 12, 6 + coord hl, 12, 6 ld bc,$0102 call PrintNumber ; print feet (height) ld a,$60 ; feet symbol tile (one tick) ld [hl],a inc de inc de ; de = address of inches (height) - hlCoord 15, 6 + coord hl, 15, 6 ld bc,$8102 call PrintNumber ; print inches (height) ld a,$61 ; inches symbol tile (two ticks) @@ -524,10 +524,10 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld a,[de] ; a = lower byte of weight ld [hl],a ; store lower byte of weight in [hDexWeight + 1] ld de,hDexWeight - hlCoord 11, 8 + coord hl, 11, 8 ld bc,$0205 ; no leading zeroes, right-aligned, 2 bytes, 5 digits call PrintNumber ; print weight - hlCoord 14, 8 + coord hl, 14, 8 ld a,[hDexWeight + 1] sub a,10 ld a,[hDexWeight] @@ -545,7 +545,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld [hDexWeight],a ; restore original value of [hDexWeight] pop hl inc hl ; hl = address of pokedex description text - bcCoord 1, 11 + coord bc, 1, 11 ld a,2 ld [$fff4],a call TextCommandProcessor ; print pokedex description text diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index f7206a7f..d1fa0c72 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -22,7 +22,7 @@ CeladonPrizeMenu: ; 5271b (14:671b) ld a,$01 ld [wTopMenuItemX],a call PrintPrizePrice - hlCoord 0, 2 + coord hl, 0, 2 ld b,$08 ld c,$10 call TextBoxBorder @@ -93,42 +93,42 @@ GetPrizeMenuId: ; 5278e (14:678e) ld a,[W_PRIZE1] ld [wd11e],a call GetItemName - hlCoord 2, 4 + coord hl, 2, 4 call PlaceString ld a,[W_PRIZE2] ld [wd11e],a call GetItemName - hlCoord 2, 6 + coord hl, 2, 6 call PlaceString ld a,[W_PRIZE3] ld [wd11e],a call GetItemName - hlCoord 2, 8 + coord hl, 2, 8 call PlaceString jr .putNoThanksText .putMonName ld a,[W_PRIZE1] ld [wd11e],a call GetMonName - hlCoord 2, 4 + coord hl, 2, 4 call PlaceString ld a,[W_PRIZE2] ld [wd11e],a call GetMonName - hlCoord 2, 6 + coord hl, 2, 6 call PlaceString ld a,[W_PRIZE3] ld [wd11e],a call GetMonName - hlCoord 2, 8 + coord hl, 2, 8 call PlaceString .putNoThanksText - hlCoord 2, 10 + coord hl, 2, 10 ld de,NoThanksText call PlaceString ; put prices on the right side of the textbox ld de,wd141 - hlCoord 13, 5 + coord hl, 13, 5 ; reg. c: ; [low nybble] number of bytes ; [bit 765 = %100] space-padding (not zero-padding) @@ -137,29 +137,29 @@ GetPrizeMenuId: ; 5278e (14:678e) ; used by text-command $02) call PrintBCDNumber ld de,wd143 - hlCoord 13, 7 + coord hl, 13, 7 ld c,(%1 << 7 | 2) call PrintBCDNumber ld de,wd145 - hlCoord 13, 9 + coord hl, 13, 9 ld c,(1 << 7 | 2) jp PrintBCDNumber INCLUDE "data/prizes.asm" PrintPrizePrice: ; 5287a (14:687a) - hlCoord 11, 0 + coord hl, 11, 0 ld b,$01 ld c,$07 call TextBoxBorder call UpdateSprites - hlCoord 12, 0 + coord hl, 12, 0 ld de,.CoinText call PlaceString - hlCoord 13, 1 + coord hl, 13, 1 ld de,.SixSpacesText call PlaceString - hlCoord 13, 1 + coord hl, 13, 1 ld de,wPlayerCoins ld c,%10000010 call PrintBCDNumber diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 2804ef7b..0036d66e 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -285,7 +285,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ; writes a blank tile to all possible menu cursor positions on the party menu ErasePartyMenuCursors: ; 132ed (4:72ed) - hlCoord 0, 1 + coord hl, 0, 1 ld bc,2 * 20 ; menu cursor positions are 2 rows apart ld a,6 ; 6 menu cursor positions .loop @@ -526,10 +526,10 @@ DrawTrainerInfo: ; 1349a (4:749a) ld bc,(BANK(RedPicFront) << 8) | $01 predef DisplayPicCenteredOrUpperRight call DisableLCD - hlCoord 0, 2 + coord hl, 0, 2 ld a," " call TrainerInfo_DrawVerticalLine - hlCoord 1, 2 + coord hl, 1, 2 call TrainerInfo_DrawVerticalLine ld hl,vChars2 + $70 ld de,vChars2 @@ -572,7 +572,7 @@ DrawTrainerInfo: ; 1349a (4:749a) dec a ld [hli],a ld [hl],1 - hlCoord 0, 0 + coord hl, 0, 0 call TrainerInfo_DrawTextBox ld hl,wTrainerInfoTextBoxWidthPlus1 ld a,16 + 1 @@ -580,27 +580,27 @@ DrawTrainerInfo: ; 1349a (4:749a) dec a ld [hli],a ld [hl],3 - hlCoord 1, 10 + coord hl, 1, 10 call TrainerInfo_DrawTextBox - hlCoord 0, 10 + coord hl, 0, 10 ld a,$d7 call TrainerInfo_DrawVerticalLine - hlCoord 19, 10 + coord hl, 19, 10 call TrainerInfo_DrawVerticalLine - hlCoord 6, 9 + coord hl, 6, 9 ld de,TrainerInfo_BadgesText call PlaceString - hlCoord 2, 2 + coord hl, 2, 2 ld de,TrainerInfo_NameMoneyTimeText call PlaceString - hlCoord 7, 2 + coord hl, 7, 2 ld de,wPlayerName call PlaceString - hlCoord 8, 4 + coord hl, 8, 4 ld de,wPlayerMoney ld c,$e3 call PrintBCDNumber - hlCoord 9, 6 + coord hl, 9, 6 ld de,W_PLAYTIMEHOURS + 1 ; hours ld bc,$4103 call PrintNumber @@ -713,7 +713,7 @@ SwitchPartyMon: ; 13613 (4:7613) SwitchPartyMon_ClearGfx: ; 13625 (4:7625) push af - hlCoord 0, 0 + coord hl, 0, 0 ld bc, SCREEN_WIDTH * 2 call AddNTimes ld c, SCREEN_WIDTH * 2 diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 3f73a84f..75de182b 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -105,7 +105,7 @@ StatusScreen: ; 12953 (4:6953) push af xor a ld [hTilesetType], a - hlCoord 19, 1 + coord hl, 19, 1 ld bc, $060a call DrawLineBox ; Draws the box around name, HP and status ld de, $fffa @@ -113,54 +113,54 @@ StatusScreen: ; 12953 (4:6953) ld [hl], $f2 ; . after No ("." is a different one) dec hl ld [hl], "№" - hlCoord 19, 9 + coord hl, 19, 9 ld bc, $0806 call DrawLineBox ; Draws the box around types, ID No. and OT - hlCoord 10, 9 + coord hl, 10, 9 ld de, Type1Text call PlaceString ; "TYPE1/" - hlCoord 11, 3 + coord hl, 11, 3 predef DrawHP ld hl, wcf25 call GetHealthBarColor ld b, $3 call GoPAL_SET ; SGB palette - hlCoord 16, 6 + coord hl, 16, 6 ld de, wLoadedMonStatus call PrintStatusCondition jr nz, .StatusWritten - hlCoord 16, 6 + coord hl, 16, 6 ld de, OKText call PlaceString ; "OK" .StatusWritten - hlCoord 9, 6 + coord hl, 9, 6 ld de, StatusText call PlaceString ; "STATUS/" - hlCoord 14, 2 + coord hl, 14, 2 call PrintLevel ; Pokémon level ld a, [W_MONHDEXNUM] ld [wd11e], a ld [wd0b5], a predef IndexToPokedex - hlCoord 3, 7 + coord hl, 3, 7 ld de, wd11e ld bc, $8103 ; Zero-padded, 3 call PrintNumber ; Pokémon no. - hlCoord 11, 10 + coord hl, 11, 10 predef PrintMonType ld hl, NamePointers2 call .GetStringPointer ld d, h ld e, l - hlCoord 9, 1 + coord hl, 9, 1 call PlaceString ; Pokémon name ld hl, OTPointers call .GetStringPointer ld d, h ld e, l - hlCoord 12, 16 + coord hl, 12, 16 call PlaceString ; OT - hlCoord 12, 14 + coord hl, 12, 14 ld de, wLoadedMonOTID ld bc, $8205 ; 5 call PrintNumber ; ID Number @@ -168,7 +168,7 @@ StatusScreen: ; 12953 (4:6953) call PrintStatsBox call Delay3 call GBPalNormal - hlCoord 1, 0 + coord hl, 1, 0 call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture ld a, [wcf91] call PlayCry ; play Pokémon cry @@ -247,19 +247,19 @@ PrintStatsBox: ; 12ae4 (4:6ae4) ld a, d and a ; a is 0 from the status screen jr nz, .DifferentBox - hlCoord 0, 8 + coord hl, 0, 8 ld b, $8 ld c, $8 call TextBoxBorder ; Draws the box - hlCoord 1, 9 ; Start printing stats from here + coord hl, 1, 9 ; Start printing stats from here ld bc, $0019 ; Number offset jr .PrintStats .DifferentBox - hlCoord 9, 2 + coord hl, 9, 2 ld b, $8 ld c, $9 call TextBoxBorder - hlCoord 11, 3 + coord hl, 11, 3 ld bc, $0018 .PrintStats push bc @@ -306,16 +306,16 @@ StatusScreen2: ; 12b57 (4:6b57) ld bc, NUM_MOVES call CopyData callab FormatMovesString - hlCoord 9, 2 + coord hl, 9, 2 ld bc, $050a call ClearScreenArea ; Clear under name - hlCoord 19, 3 + coord hl, 19, 3 ld [hl], $78 - hlCoord 0, 8 + coord hl, 0, 8 ld b, $8 ld c, $12 call TextBoxBorder ; Draw move container - hlCoord 2, 9 + coord hl, 2, 9 ld de, wMovesString call PlaceString ; Print moves ld a, [wNumMovesMinusOne] @@ -324,7 +324,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld a, $4 sub c ld b, a ; Number of moves ? - hlCoord 11, 10 + coord hl, 11, 10 ld de, SCREEN_WIDTH * 2 ld a, $72 ; special P tile id call StatusScreen_PrintPP ; Print "PP" @@ -336,7 +336,7 @@ StatusScreen2: ; 12b57 (4:6b57) call StatusScreen_PrintPP ; Fill the rest with -- .InitPP ; 12bbb ld hl, wLoadedMonMoves - deCoord 14, 10 + coord de, 14, 10 ld b, 0 .PrintPP ; 12bc3 ld a, [hli] @@ -386,7 +386,7 @@ StatusScreen2: ; 12b57 (4:6b57) cp $4 jr nz, .PrintPP .PPDone - hlCoord 9, 3 + coord hl, 9, 3 ld de, EXPPointsText call PlaceString ld a, [wLoadedMonLevel] ; level @@ -396,7 +396,7 @@ StatusScreen2: ; 12b57 (4:6b57) inc a ld [wLoadedMonLevel], a ; Increase temporarily if not 100 .Level100 - hlCoord 14, 6 + coord hl, 14, 6 ld [hl], $70 ; 1-tile "to" inc hl inc hl @@ -404,22 +404,22 @@ StatusScreen2: ; 12b57 (4:6b57) pop af ld [wLoadedMonLevel], a ld de, wLoadedMonExp - hlCoord 12, 4 + coord hl, 12, 4 ld bc, $0307 call PrintNumber ; exp call .asm_12c86 ld de, wLoadedMonExp - hlCoord 7, 6 + coord hl, 7, 6 ld bc, $0307 call PrintNumber - hlCoord 9, 0 + coord hl, 9, 0 call StatusScreen_ClearName - hlCoord 9, 1 + coord hl, 9, 1 call StatusScreen_ClearName ld a, [W_MONHDEXNUM] ld [wd11e], a call GetMonName - hlCoord 9, 1 + coord hl, 9, 1 call PlaceString ld a, $1 ld [$ffba], a diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 07cf8854..0f6c6a13 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -17,15 +17,15 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld [wTopMenuItemX], a ld hl, wd730 set 6, [hl] - hlCoord 0, 3 + coord hl, 0, 3 ld b, 8 ld c, 12 call TextBoxBorder call UpdateSprites - hlCoord 2, 5 + coord hl, 2, 5 ld de, DrinkText call PlaceString - hlCoord 9, 6 + coord hl, 9, 6 ld de, DrinkPriceText call PlaceString ld hl, wd730 diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index bd7f672e..c7b2f4d6 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -68,7 +68,7 @@ OakSpeech: ; 6115 (1:6115) ld [wd0b5],a ld [wcf91],a call GetMonHeader - hlCoord 6, 4 + coord hl, 6, 4 call LoadFlippedFrontSpriteByMonIndex call MovePicLeft ld hl,OakSpeechText2 @@ -141,7 +141,7 @@ OakSpeech: ; 6115 (1:6115) ld [MBC1RomBank],a ld c,20 call DelayFrames - hlCoord 6, 5 + coord hl, 6, 5 ld b,7 ld c,7 call ClearScreenArea @@ -224,9 +224,9 @@ IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4) pop bc ld a,c and a - hlCoord 15, 1 + coord hl, 15, 1 jr nz,.next - hlCoord 6, 4 + coord hl, 6, 4 .next xor a ld [$FFE1],a diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index f881b43b..bdc4d38f 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -66,7 +66,7 @@ HisNameIsText: ; 69e7 (1:69e7) OakSpeechSlidePicLeft: ; 69ec (1:69ec) push de - hlCoord 0, 0 + coord hl, 0, 0 lb bc, 12, 11 call ClearScreenArea ; clear the name list text box ld c, 10 @@ -76,13 +76,13 @@ OakSpeechSlidePicLeft: ; 69ec (1:69ec) ld bc, $b call CopyData call Delay3 - hlCoord 12, 4 + coord hl, 12, 4 lb de, 6, 6 * SCREEN_WIDTH + 5 ld a, $ff jr OakSpeechSlidePicCommon OakSpeechSlidePicRight: ; 6a12 (1:6a12) - hlCoord 5, 4 + coord hl, 5, 4 lb de, 6, 6 * SCREEN_WIDTH + 5 xor a @@ -161,15 +161,15 @@ OakSpeechSlidePicCommon: ; 6a19 (1:6a19) DisplayIntroNameTextBox: ; 6a6c (1:6a6c) push de - hlCoord 0, 0 + coord hl, 0, 0 ld b, $a ld c, $9 call TextBoxBorder - hlCoord 3, 0 + coord hl, 3, 0 ld de, .namestring call PlaceString pop de - hlCoord 2, 2 + coord hl, 2, 2 call PlaceString call UpdateSprites xor a diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index 3d39ad6b..18ce23ed 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -20,7 +20,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) dec l ld b, l ld c, $d - hlCoord 0, 0 + coord hl, 0, 0 call TextBoxBorder call UpdateSprites call Func_610c2 @@ -101,7 +101,7 @@ Func_610c2: ; 610c2 (18:50c2) push hl ld [wd11e], a call GetItemName - hlCoord 2, 2 + coord hl, 2, 2 ld a, [$ffdb] ld bc, SCREEN_WIDTH * 2 call AddNTimes diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index c85a4174..89b09bba 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -704,7 +704,7 @@ GetTileSpriteStandsOn: ; 5207 (1:5207) add SCREEN_WIDTH ; screen X tile + 20 ld d, $0 ld e, a - hlCoord 0, 0 + coord hl, 0, 0 add hl, bc add hl, bc add hl, bc diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index e6fdfc92..ebc99eed 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -84,7 +84,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld hl,PokemartTellSellPriceText ld bc,$0e01 call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a @@ -162,7 +162,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call CopyStringToCF4B ; copy name to wcf4b ld hl,PokemartTellBuyPriceText call PrintText - hlCoord 14, 7 + coord hl, 14, 7 ld bc,$080f ld a,TWO_OPTION_MENU ld [wTextBoxID],a diff --git a/engine/save.asm b/engine/save.asm index 6dc1a46c..56468595 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -151,10 +151,10 @@ SaveSAV: ; 7370a (1c:770a) ret nz .save call SaveSAVtoSRAM - hlCoord 1, 13 + coord hl, 1, 13 ld bc,$0412 call ClearScreenArea ; clear area 4x12 starting at 13,1 - hlCoord 1, 14 + coord hl, 1, 14 ld de,NowSavingString call PlaceString ld c,120 @@ -172,7 +172,7 @@ NowSavingString: SaveSAVConfirm: ; 73768 (1c:7768) call PrintText - hlCoord 0, 7 + coord hl, 0, 7 ld bc,$0801 ld a,TWO_OPTION_MENU ld [wTextBoxID],a @@ -426,20 +426,20 @@ Func_7393f: ; 7393f (1c:793f) and $7f ld [wCurrentMenuItem], a ld [wLastMenuItem], a - hlCoord 0, 0 + coord hl, 0, 0 ld b, $2 ld c, $9 call TextBoxBorder ld hl, ChooseABoxText call PrintText - hlCoord 11, 0 + coord hl, 11, 0 ld b, $c ld c, $7 call TextBoxBorder ld hl, hFlags_0xFFF6 set 2, [hl] ld de, BoxNames - hlCoord 13, 1 + coord hl, 13, 1 call PlaceString ld hl, hFlags_0xFFF6 res 2, [hl] @@ -448,7 +448,7 @@ Func_7393f: ; 7393f (1c:793f) cp 9 jr c, .asm_739a6 sub 9 - hlCoord 8, 2 + coord hl, 8, 2 ld [hl], "1" add "0" jr .asm_739a8 @@ -456,11 +456,11 @@ Func_7393f: ; 7393f (1c:793f) add "1" .asm_739a8 Coorda 9, 2 - hlCoord 1, 2 + coord hl, 1, 2 ld de, BoxNoText call PlaceString call Func_73a84 - hlCoord 18, 1 + coord hl, 18, 1 ld de, wWhichTrade ld bc, SCREEN_WIDTH ld a, $c diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 9a4c85da..ea1eb315 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -79,11 +79,11 @@ MainSlotMachineLoop: ; 37395 (d:7395) ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a - hlCoord 14, 11 + coord hl, 14, 11 ld b, 5 ld c, 4 call TextBoxBorder - hlCoord 16, 12 + coord hl, 16, 12 ld de, CoinMultiplierSlotMachineText call PlaceString call HandleMenuInput @@ -133,7 +133,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) .skip2 ld hl, OneMoreGoSlotMachineText call PrintText - hlCoord 14, 12 + coord hl, 14, 12 ld bc, $0d0f xor a ; YES_NO_MENU ld [wTwoOptionMenuID], a @@ -614,7 +614,7 @@ YeahText: ; 37722 (d:7722) SlotMachine_PrintWinningSymbol: ; 37728 (d:7728) ; prints winning symbol and down arrow in text box - hlCoord 2, 14 + coord hl, 2, 14 ld a, [wSlotMachineWinningSymbol] add $25 ld [hli], a @@ -626,7 +626,7 @@ SlotMachine_PrintWinningSymbol: ; 37728 (d:7728) ld [hli], a inc a ld [hl], a - hlCoord 18, 16 + coord hl, 18, 16 ld [hl], $ee ; down arrow ret @@ -641,13 +641,13 @@ SlotMachine_SubtractBetFromPlayerCoins: ; 37741 (d:7741) predef SubBCDPredef SlotMachine_PrintCreditCoins: ; 37754 (d:7754) - hlCoord 5, 1 + coord hl, 5, 1 ld de, wPlayerCoins ld c, $2 jp PrintBCDNumber SlotMachine_PrintPayoutCoins: ; 3775f (d:775f) - hlCoord 11, 1 + coord hl, 11, 1 ld de, wPayoutCoins ld bc, $8204 ; 2 bytes, 4 digits, leading zeroes jp PrintNumber @@ -724,19 +724,19 @@ SlotMachine_LightBalls: ; 377d5 (d:77d5) jr z, SlotMachine_UpdateTwoCoinBallTiles SlotMachine_UpdateThreeCoinBallTiles: ; 377e3 (d:77e3) - hlCoord 3, 2 + coord hl, 3, 2 call SlotMachine_UpdateBallTiles - hlCoord 3, 10 + coord hl, 3, 10 call SlotMachine_UpdateBallTiles SlotMachine_UpdateTwoCoinBallTiles: ; 377ef (d:77ef) - hlCoord 3, 4 + coord hl, 3, 4 call SlotMachine_UpdateBallTiles - hlCoord 3, 8 + coord hl, 3, 8 call SlotMachine_UpdateBallTiles SlotMachine_UpdateOneCoinBallTiles: ; 377fb (d:77fb) - hlCoord 3, 6 + coord hl, 3, 6 SlotMachine_UpdateBallTiles: ; 377fe (d:77fe) ld a, [wd08a] @@ -863,7 +863,7 @@ LoadSlotMachineTiles: ; 378a8 (d:78a8) ld a, BANK(SlotMachineTiles2) call FarCopyData2 ld hl, SlotMachineMap - deCoord 0, 0 + coord de, 0, 0 ld bc, $00f0 call CopyData call EnableLCD diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 74f7ad61..3a4e2e4c 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -70,7 +70,7 @@ ENDC call ClearBothBGMaps ; place tiles for pokemon logo (except for the last row) - hlCoord 2, 1 + coord hl, 2, 1 ld a, $80 ld de, SCREEN_WIDTH ld c, 6 @@ -88,7 +88,7 @@ ENDC jr nz, .pokemonLogoTileLoop ; place tiles for the last row of the pokemon logo - hlCoord 2, 7 + coord hl, 2, 7 ld a, $31 ld b, $10 .pokemonLogoLastTileRowLoop @@ -105,7 +105,7 @@ ENDC ld [hl], a ; place tiles for title screen copyright - hlCoord 2, 17 + coord hl, 2, 17 ld de, .tileScreenCopyrightTiles ld b, $10 .tileScreenCopyrightTilesLoop @@ -362,7 +362,7 @@ ClearBothBGMaps: ; 4519 (1:4519) LoadTitleMonSprite: ; 4524 (1:4524) ld [wcf91], a ld [wd0b5], a - hlCoord 5, 10 + coord hl, 5, 10 call GetMonHeader jp LoadFrontSpriteByMonIndex @@ -381,7 +381,7 @@ LoadCopyrightTiles: ; 4541 (1:4541) ld hl, vChars2 + $600 ld bc, (BANK(NintendoCopyrightLogoGraphics) << 8) + $1c call CopyVideoData - hlCoord 2, 7 + coord hl, 2, 7 ld de, CopyrightTextString jp PlaceString @@ -395,7 +395,7 @@ INCLUDE "data/title_mons.asm" ; prints version text (red, blue) PrintGameVersionOnTitleScreen: ; 4598 (1:4598) - hlCoord 7, 8 + coord hl, 7, 8 ld de, VersionOnTitleScreenText jp PlaceString diff --git a/engine/town_map.asm b/engine/town_map.asm index a92f49e4..302efa0f 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -11,7 +11,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) push af ld b, $0 call DrawPlayerOrBirdSprite ; player sprite - hlCoord 1, 0 + coord hl, 1, 0 ld de, wcd6d call PlaceString ld hl, wOAMBuffer @@ -28,7 +28,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) jr .enterLoop .townMapLoop - hlCoord 0, 0 + coord hl, 0, 0 ld bc, $114 call ClearScreenArea ld hl, TownMapOrder @@ -55,7 +55,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) inc de cp $50 jr nz, .copyMapName - hlCoord 1, 0 + coord hl, 1, 0 ld de, wcd6d call PlaceString ld hl, wOAMBuffer + $10 @@ -117,7 +117,7 @@ LoadTownMap_Nest: ; 70f60 (1c:4f60) push hl call DisplayWildLocations call GetMonName - hlCoord 1, 0 + coord hl, 1, 0 call PlaceString ld h, b ld l, c @@ -152,34 +152,34 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) push af ld [hl], $ff push hl - hlCoord 0, 0 + coord hl, 0, 0 ld de, ToText call PlaceString ld a, [W_CURMAP] ld b, $0 call DrawPlayerOrBirdSprite ld hl, wFlyLocationsList - deCoord 18, 0 + coord de, 18, 0 .townMapFlyLoop ld a, $7f ld [de], a push hl push hl - hlCoord 3, 0 + coord hl, 3, 0 ld bc, $10f call ClearScreenArea pop hl ld a, [hl] ld b, $4 call DrawPlayerOrBirdSprite ; draw bird sprite - hlCoord 3, 0 + coord hl, 3, 0 ld de, wcd6d call PlaceString ld c, 15 call DelayFrames - hlCoord 18, 0 + coord hl, 18, 0 ld [hl], $ed - hlCoord 19, 0 + coord hl, 19, 0 ld [hl], $ee pop hl .inputLoop @@ -218,7 +218,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld [hl], a ret .pressedUp - deCoord 18, 0 + coord de, 18, 0 inc hl ld a, [hl] cp $ff @@ -230,7 +230,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld hl, wFlyLocationsList jp .townMapFlyLoop .pressedDown - deCoord 19, 0 + coord de, 19, 0 dec hl ld a, [hl] cp $ff @@ -276,7 +276,7 @@ LoadTownMap: ; 7109b (1c:509b) call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites - hlCoord 0, 0 + coord hl, 0, 0 ld b, $12 ld c, $12 call TextBoxBorder @@ -291,7 +291,7 @@ LoadTownMap: ; 7109b (1c:509b) ld bc, $8 ld a, BANK(MonNestIcon) call FarCopyDataDouble - hlCoord 0, 0 + coord hl, 0, 0 ld de, CompressedMap .nextTile ld a, [de] @@ -394,11 +394,11 @@ DisplayWildLocations: ; 711ef (1c:51ef) and a ; were any OAM entries written? jr nz, .drawPlayerSprite ; if no OAM entries were written, print area unknown text - hlCoord 1, 7 + coord hl, 1, 7 ld b, $2 ld c, $f call TextBoxBorder - hlCoord 2, 9 + coord hl, 2, 9 ld de, AreaUnknownText call PlaceString jr .done diff --git a/engine/trade.asm b/engine/trade.asm index 37ff5c05..531085b9 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -148,7 +148,7 @@ Trade_Delay80: ; 41191 (10:5191) jp DelayFrames Trade_ClearTileMap: ; 41196 (10:5196) - hlCoord 0, 0 + coord hl, 0, 0 ld bc, 20 * 18 ld a, " " jp FillMemory @@ -234,7 +234,7 @@ Trade_ShowPlayerMon: ; 41245 (10:5245) ld [hSCX], a xor a ld [H_AUTOBGTRANSFERENABLED], a - hlCoord 4, 0 + coord hl, 4, 0 ld b, 6 ld c, 10 call TextBoxBorder @@ -283,7 +283,7 @@ Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298) call DelayFrame ld a, %10001011 ld [rLCDC], a - hlCoord 6, 2 + coord hl, 6, 2 ld b, $7 ; open end of link cable tile ID list index call CopyTileIDsFromList_ZeroBaseTileID call Trade_CopyTileMapToVRAM @@ -355,7 +355,7 @@ Trade_ShowEnemyMon: ; 41336 (10:5336) ld a, TRADE_BALL_TILT_ANIM call Trade_ShowAnimation call Trade_ShowClearedWindow - hlCoord 4, 10 + coord hl, 4, 10 ld b, 6 ld c, 10 call TextBoxBorder @@ -372,7 +372,7 @@ Trade_ShowEnemyMon: ; 41336 (10:5336) ld a, [wTradedEnemyMonSpecies] call PlayCry call Trade_Delay100 - hlCoord 4, 10 + coord hl, 4, 10 ld bc, $80c call ClearScreenArea jp PrintTradeTakeCareText @@ -464,7 +464,7 @@ Trade_DrawLeftGameboy: ; 4142d (10:542d) call Trade_ClearTileMap ; draw link cable - hlCoord 11, 4 + coord hl, 11, 4 ld a, $5d ld [hli], a ld a, $5e @@ -475,16 +475,16 @@ Trade_DrawLeftGameboy: ; 4142d (10:542d) jr nz, .loop ; draw gameboy pic - hlCoord 5, 3 + coord hl, 5, 3 ld b, $6 call CopyTileIDsFromList_ZeroBaseTileID ; draw text box with player name below gameboy pic - hlCoord 4, 12 + coord hl, 4, 12 ld b, 2 ld c, 7 call TextBoxBorder - hlCoord 5, 14 + coord hl, 5, 14 ld de, wPlayerName call PlaceString @@ -494,7 +494,7 @@ Trade_DrawRightGameboy: ; 4145c (10:545c) call Trade_ClearTileMap ; draw horizontal segment of link cable - hlCoord 0, 4 + coord hl, 0, 4 ld a, $5e ld c, $e .loop @@ -522,16 +522,16 @@ Trade_DrawRightGameboy: ; 4145c (10:545c) ld [hl], a ; draw gameboy pic - hlCoord 7, 8 + coord hl, 7, 8 ld b, $6 call CopyTileIDsFromList_ZeroBaseTileID ; draw text box with enemy name above link cable - hlCoord 6, 0 + coord hl, 6, 0 ld b, $2 ld c, $7 call TextBoxBorder - hlCoord 7, 2 + coord hl, 7, 2 ld de, wLinkEnemyTrainerName call PlaceString @@ -540,7 +540,7 @@ Trade_DrawRightGameboy: ; 4145c (10:545c) Trade_DrawCableAcrossScreen: ; 4149f (10:549f) ; Draws the link cable across the screen. call Trade_ClearTileMap - hlCoord 0, 4 + coord hl, 0, 4 ld a, $5e ld c, SCREEN_WIDTH .loop @@ -553,7 +553,7 @@ Trade_CopyCableTilesOffScreen: ; 414ae (10:54ae) ; This is used to copy the link cable tiles off screen so that the cable ; continues when the screen is scrolled. push hl - hlCoord 0, 4 + coord hl, 0, 4 call CopyToScreenEdgeTiles pop hl ld a, h @@ -737,7 +737,7 @@ Trade_LoadMonSprite: ; 415a4 (10:55a4) xor $1 ld [H_AUTOBGTRANSFERENABLED], a call GetMonHeader - hlCoord 7, 2 + coord hl, 7, 2 call LoadFlippedFrontSpriteByMonIndex ld c, 10 jp DelayFrames diff --git a/engine/trade2.asm b/engine/trade2.asm index da199e77..d7a16716 100755 --- a/engine/trade2.asm +++ b/engine/trade2.asm @@ -1,43 +1,43 @@ Trade_PrintPlayerMonInfoText: ; 42769 (10:6769) - hlCoord 5, 0 + coord hl, 5, 0 ld de,Trade_MonInfoText call PlaceString ld a,[wTradedPlayerMonSpecies] ld [wd11e],a predef IndexToPokedex - hlCoord 9, 0 + coord hl, 9, 0 ld de,wd11e ld bc,$8103 call PrintNumber - hlCoord 5, 2 + coord hl, 5, 2 ld de,wcf4b call PlaceString - hlCoord 8, 4 + coord hl, 8, 4 ld de,wTradedPlayerMonOT call PlaceString - hlCoord 8, 6 + coord hl, 8, 6 ld de,wTradedPlayerMonOTID ld bc,$8205 jp PrintNumber Trade_PrintEnemyMonInfoText: ; 427a7 (10:67a7) - hlCoord 5, 10 + coord hl, 5, 10 ld de,Trade_MonInfoText call PlaceString ld a,[wTradedEnemyMonSpecies] ld [wd11e],a predef IndexToPokedex - hlCoord 9, 10 + coord hl, 9, 10 ld de,wd11e ld bc,$8103 call PrintNumber - hlCoord 5, 12 + coord hl, 5, 12 ld de,wcd6d call PlaceString - hlCoord 8, 14 + coord hl, 8, 14 ld de,wTradedEnemyMonOT call PlaceString - hlCoord 8, 16 + coord hl, 8, 16 ld de,wTradedEnemyMonOTID ld bc,$8205 jp PrintNumber diff --git a/home.asm b/home.asm index f9004e7e..1b910054 100644 --- a/home.asm +++ b/home.asm @@ -1405,7 +1405,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6) call DisplayTextBoxID ; draw the menu text box call UpdateSprites ; disable sprites behind the text box ; the code up to .skipMovingSprites appears to be useless - hlCoord 4, 2 ; coordinates of upper left corner of menu text box + coord hl, 4, 2 ; coordinates of upper left corner of menu text box ld de,$090e ; height and width of menu text box ld a,[wListMenuID] and a ; is it a PC pokemon list? @@ -1446,7 +1446,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) call DelayFrames xor a ld [wCurrentMenuItem],a - hlCoord 5, 4 + coord hl, 5, 4 ld a,l ld [wMenuCursorLocation],a ld a,h @@ -1568,23 +1568,23 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) DisplayChooseQuantityMenu:: ; 2d57 (0:2d57) ; text box dimensions/coordinates for just quantity - hlCoord 15, 9 + coord hl, 15, 9 ld b,1 ; height ld c,3 ; width ld a,[wListMenuID] cp a,PRICEDITEMLISTMENU jr nz,.drawTextBox ; text box dimensions/coordinates for quantity and price - hlCoord 7, 9 + coord hl, 7, 9 ld b,1 ; height ld c,11 ; width .drawTextBox call TextBoxBorder - hlCoord 16, 10 + coord hl, 16, 10 ld a,[wListMenuID] cp a,PRICEDITEMLISTMENU jr nz,.printInitialQuantity - hlCoord 8, 10 + coord hl, 8, 10 .printInitialQuantity ld de,InitialQuantityText call PlaceString @@ -1624,7 +1624,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57) ld a,[wMaxItemQuantity] ld [hl],a .handleNewQuantity - hlCoord 17, 10 + coord hl, 17, 10 ld a,[wListMenuID] cp a,PRICEDITEMLISTMENU jr nz,.printQuantity @@ -1663,13 +1663,13 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57) ld a,[hDivideBCDQuotient + 2] ld [hMoney + 2],a .skipHalvingPrice - hlCoord 12, 10 + coord hl, 12, 10 ld de,SpacesBetweenQuantityAndPriceText call PlaceString ld de,hMoney ; total price ld c,$a3 call PrintBCDNumber - hlCoord 9, 10 + coord hl, 9, 10 .printQuantity ld de,wItemQuantity ; current quantity ld bc,$8102 ; print leading zeroes, 1 byte, 2 digits @@ -1708,7 +1708,7 @@ ExitListMenu:: ; 2e3b (0:2e3b) ret PrintListMenuEntries:: ; 2e5a (0:2e5a) - hlCoord 5, 3 + coord hl, 5, 3 ld b,$09 ld c,$0e call ClearScreenArea @@ -1733,7 +1733,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) jr nc,.noCarry inc d .noCarry - hlCoord 6, 4 ; coordinates of first list entry name + coord hl, 6, 4 ; coordinates of first list entry name ld b,4 ; print 4 names .loop ld a,b @@ -3011,7 +3011,7 @@ Func_35f4:: ; 35f4 (0:35f4) InitYesNoTextBoxParameters:: ; 35ff (0:35ff) xor a ; YES_NO_MENU ld [wTwoOptionMenuID], a - hlCoord 14, 7 + coord hl, 14, 7 ld bc, $80f ret @@ -3019,7 +3019,7 @@ YesNoChoicePokeCenter:: ; 360a (0:360a) call SaveScreenTilesToBuffer1 ld a, HEAL_CANCEL_MENU ld [wTwoOptionMenuID], a - hlCoord 11, 6 + coord hl, 11, 6 ld bc, $80c jr DisplayYesNoChoice @@ -3027,7 +3027,7 @@ Func_361a:: ; 361a (0:361a) call SaveScreenTilesToBuffer1 ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a - hlCoord 12, 7 + coord hl, 12, 7 ld bc, $080d DisplayYesNoChoice:: ; 3628 (0:3628) ld a, TWO_OPTION_MENU @@ -3176,7 +3176,7 @@ UncompressSpriteFromDE:: ; 36eb (0:36eb) SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4) - hlCoord 0, 0 + coord hl, 0, 0 ld de, wTileMapBackup2 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData @@ -3193,13 +3193,13 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3709 (0:3709) xor a ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup2 - deCoord 0, 0 + coord de, 0, 0 ld bc, $168 call CopyData ret SaveScreenTilesToBuffer1:: ; 3719 (0:3719) - hlCoord 0, 0 + coord hl, 0, 0 ld de, wTileMapBackup ld bc, SCREEN_WIDTH * SCREEN_HEIGHT jp CopyData @@ -3208,7 +3208,7 @@ LoadScreenTilesFromBuffer1:: ; 3725 (0:3725) xor a ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup - deCoord 0, 0 + coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData ld a, $1 @@ -3470,7 +3470,7 @@ WaitForTextScrollButtonPress:: ; 3865 (0:3865) jr z, .skipAnimation call TownMapSpriteBlinkingAnimation .skipAnimation - hlCoord 18, 16 + coord hl, 18, 16 call HandleDownArrowBlinkTiming pop hl call JoypadLowSensitivity @@ -3946,7 +3946,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) and a ; was a key pressed? jr nz,.keyPressed push hl - hlCoord 18, 11 ; coordinates of blinking down arrow in some menus + coord hl, 18, 11 ; coordinates of blinking down arrow in some menus call HandleDownArrowBlinkTiming ; blink down arrow (if any) pop hl ld a,[wMenuJoypadPollCount] @@ -4037,7 +4037,7 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c) ld a,[wTopMenuItemY] and a ; is the y coordinate 0? jr z,.adjustForXCoord - hlCoord 0, 0 + coord hl, 0, 0 ld bc,SCREEN_WIDTH .topMenuItemLoop add hl,bc @@ -4207,7 +4207,7 @@ PrintText:: ; 3c49 (0:3c49) call Delay3 pop hl Func_3c59:: ; 3c59 (0:3c59) - bcCoord 1, 14 + coord bc, 1, 14 jp TextCommandProcessor diff --git a/home/copy2.asm b/home/copy2.asm index f872ebbc..3f7a4400 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -184,17 +184,17 @@ CopyScreenTileBufferToVRAM:: ld c, 6 ld hl, $600 * 0 - deCoord 0, 6 * 0 + coord de, 0, 6 * 0 call .setup call DelayFrame ld hl, $600 * 1 - deCoord 0, 6 * 1 + coord de, 0, 6 * 1 call .setup call DelayFrame ld hl, $600 * 2 - deCoord 0, 6 * 2 + coord de, 0, 6 * 2 call .setup jp DelayFrame @@ -217,7 +217,7 @@ ClearScreen:: ; for the bg map to update. ld bc, 20 * 18 inc b - hlCoord 0, 0 + coord hl, 0, 0 ld a, $7f .loop ld [hli], a diff --git a/home/overworld.asm b/home/overworld.asm index da514763..0485335a 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1420,7 +1420,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa) ld bc,$0002 add hl,bc .copyToVisibleAreaBuffer - deCoord 0, 0 ; base address for the tiles that are directly transfered to VRAM during V-blank + coord de, 0, 0 ; base address for the tiles that are directly transfered to VRAM during V-blank ld b, SCREEN_HEIGHT .rowLoop2 ld c, SCREEN_WIDTH @@ -1693,7 +1693,7 @@ MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85) ; the portion of the map that was newly exposed due to the player's movement ScheduleNorthRowRedraw:: ; 0e91 (0:0e91) - hlCoord 0, 0 + coord hl, 0, 0 call CopyToScreenEdgeTiles ld a,[wMapViewVRAMPointer] ld [H_SCREENEDGEREDRAWADDR],a @@ -1715,7 +1715,7 @@ CopyToScreenEdgeTiles:: ; 0ea6 (0:0ea6) ret ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2) - hlCoord 0, 16 + coord hl, 0, 16 call CopyToScreenEdgeTiles ld a,[wMapViewVRAMPointer] ld l,a @@ -1734,7 +1734,7 @@ ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2) ret ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3) - hlCoord 18, 0 + coord hl, 18, 0 call ScheduleColumnRedrawHelper ld a,[wMapViewVRAMPointer] ld c,a @@ -1772,7 +1772,7 @@ ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2) ret ScheduleWestColumnRedraw:: ; 0f08 (0:0f08) - hlCoord 0, 0 + coord hl, 0, 0 call ScheduleColumnRedrawHelper ld a,[wMapViewVRAMPointer] ld [H_SCREENEDGEREDRAWADDR],a @@ -2323,7 +2323,7 @@ LoadMapData:: ; 1241 (0:1241) call LoadTilesetTilePatternData call LoadCurrentMapView ; copy current map view to VRAM - hlCoord 0, 0 + coord hl, 0, 0 ld de,vBGMap0 ld b,18 .vramCopyLoop diff --git a/home/text.asm b/home/text.asm index ebdc83f4..7eb5148b 100644 --- a/home/text.asm +++ b/home/text.asm @@ -76,7 +76,7 @@ PlaceNextChar:: ; 1956 (0:1956) cp $4F jr nz,.next3 pop hl - hlCoord 1, 16 + coord hl, 1, 16 push hl jp PlaceNextChar_inc @@ -290,13 +290,13 @@ Char51:: ; 1ab4 (0:1ab4) Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll - hlCoord 1, 13 + coord hl, 1, 13 ld bc,$0412 call ClearScreenArea ld c,20 call DelayFrames pop de - hlCoord 1, 14 + coord hl, 1, 14 jp PlaceNextChar_inc Char49:: ; 1ad5 (0:1ad5) @@ -305,14 +305,14 @@ Char49:: ; 1ad5 (0:1ad5) Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll - hlCoord 1, 10 + coord hl, 1, 10 ld bc,$0712 call ClearScreenArea ld c,20 call DelayFrames pop de pop hl - hlCoord 1, 11 + coord hl, 1, 11 push hl jp PlaceNextChar_inc @@ -330,13 +330,13 @@ Char4C:: ; 1b0a (0:1b0a) push de call Next1B18 call Next1B18 - hlCoord 1, 16 + coord hl, 1, 16 pop de jp PlaceNextChar_inc Next1B18:: ; 1b18 (0:1b18) - hlCoord 0, 14 - deCoord 0, 13 + coord hl, 0, 14 + coord de, 0, 13 ld b,60 .next ld a,[hli] @@ -344,7 +344,7 @@ Next1B18:: ; 1b18 (0:1b18) inc de dec b jr nz,.next - hlCoord 1, 16 + coord hl, 1, 16 ld a, " " ld b,SCREEN_WIDTH - 2 .next2 @@ -499,7 +499,7 @@ TextCommand03:: ; 1bb7 (0:1bb7) ; (no arguments) TextCommand05:: ; 1bc5 (0:1bc5) pop hl - bcCoord 1, 16 ; address of second line of dialogue text box + coord bc, 1, 16 ; address of second line of dialogue text box jp NextTextCommand ; blink arrow and wait for A or B to be pressed @@ -528,7 +528,7 @@ TextCommand07:: ; 1be7 (0:1be7) call Next1B18 ; scroll up text call Next1B18 pop hl - bcCoord 1, 16 ; address of second line of dialogue text box + coord bc, 1, 16 ; address of second line of dialogue text box jp NextTextCommand ; execute asm inline diff --git a/home/vcopy.asm b/home/vcopy.asm index d42293d9..e90accb5 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -130,7 +130,7 @@ AutoBgMapTransfer:: ; 1d57 (0:1d57) dec a jr z,.transferMiddleThird .transferBottomThird - hlCoord 0, 12 + coord hl, 0, 12 ld sp,hl ld a,[H_AUTOBGTRANSFERDEST + 1] ld h,a @@ -141,7 +141,7 @@ AutoBgMapTransfer:: ; 1d57 (0:1d57) xor a ; TRANSFERTOP jr .doTransfer .transferTopThird - hlCoord 0, 0 + coord hl, 0, 0 ld sp,hl ld a,[H_AUTOBGTRANSFERDEST + 1] ld h,a @@ -150,7 +150,7 @@ AutoBgMapTransfer:: ; 1d57 (0:1d57) ld a,TRANSFERMIDDLE jr .doTransfer .transferMiddleThird - hlCoord 0, 6 + coord hl, 0, 6 ld sp,hl ld a,[H_AUTOBGTRANSFERDEST + 1] ld h,a diff --git a/macros.asm b/macros.asm index a25c0006..10317246 100644 --- a/macros.asm +++ b/macros.asm @@ -67,22 +67,11 @@ bcd3: MACRO coins equs "bcd2" money equs "bcd3" -;\1 = X -;\2 = Y -hlCoord: MACRO - ld hl, wTileMap + 20 * \2 + \1 - ENDM - -;\1 = X -;\2 = Y -deCoord: MACRO - ld de, wTileMap + 20 * \2 + \1 - ENDM - -;\1 = X -;\2 = Y -bcCoord: MACRO - ld bc, wTileMap + 20 * \2 + \1 +;\1 = r +;\2 = X +;\3 = Y +coord: MACRO + ld \1, wTileMap + 20 * \3 + \2 ENDM ;\1 = X diff --git a/main.asm b/main.asm index 9ceb5f81..08747a5a 100755 --- a/main.asm +++ b/main.asm @@ -158,7 +158,7 @@ INCLUDE "engine/overworld/oam.asm" INCLUDE "engine/oam_dma.asm" PrintWaitingText: - hlCoord 3, 10 + coord hl, 3, 10 ld b, $1 ld c, $b ld a, [W_ISINBATTLE] @@ -169,7 +169,7 @@ PrintWaitingText: .asm_4c17 call CableClub_TextBoxBorder .asm_4c1a - hlCoord 4, 11 + coord hl, 4, 11 ld de, WaitingText call PlaceString ld c, 50 @@ -1005,18 +1005,18 @@ DisplayTextIDInit: ; 7096 (1:7096) ld a,[wd74b] bit 5,a ; does the player have the pokedex? ; start menu with pokedex - hlCoord 10, 0 + coord hl, 10, 0 ld b,$0e ld c,$08 jr nz,.drawTextBoxBorder ; start menu without pokedex - hlCoord 10, 0 + coord hl, 10, 0 ld b,$0c ld c,$08 jr .drawTextBoxBorder ; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box .notStartMenu - hlCoord 0, 12 + coord hl, 0, 12 ld b,$04 ld c,$12 .drawTextBoxBorder @@ -1074,12 +1074,12 @@ DrawStartMenu: ; 710b (1:710b) ld a,[wd74b] bit 5,a ; does the player have the pokedex? ; menu with pokedex - hlCoord 10, 0 + coord hl, 10, 0 ld b,$0e ld c,$08 jr nz,.drawTextBoxBorder ; shorter menu if the player doesn't have the pokedex - hlCoord 10, 0 + coord hl, 10, 0 ld b,$0c ld c,$08 .drawTextBoxBorder @@ -1097,7 +1097,7 @@ DrawStartMenu: ; 710b (1:710b) ld [wMenuWatchMovingOutOfBounds],a ld hl,wd730 set 6,[hl] ; no pauses between printing each letter - hlCoord 12, 2 + coord hl, 12, 2 ld a,[wd74b] bit 5,a ; does the player have the pokedex? ; case for not having pokdex @@ -1276,7 +1276,7 @@ GetTextBoxIDText: ; 7367 (1:7367) ; hl = address of upper left corner of text box GetAddressOfScreenCoords: ; 7375 (1:7375) push bc - hlCoord 0, 0 + coord hl, 0, 0 ld bc,20 .loop ; loop to add d rows to the base address ld a,d @@ -1437,11 +1437,11 @@ DisplayMoneyBox: ; 74ba (1:74ba) ld a, MONEY_BOX_TEMPLATE ld [wTextBoxID], a call DisplayTextBoxID - hlCoord 13, 1 + coord hl, 13, 1 ld b, $1 ld c, $6 call ClearScreenArea - hlCoord 12, 1 + coord hl, 12, 1 ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber @@ -1734,14 +1734,14 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:76e1) jr nz, .fieldMovesExist ; no field moves - hlCoord 11, 11 + coord hl, 11, 11 ld b, 5 ld c, 7 call TextBoxBorder call UpdateSprites ld a, 12 ld [hFieldMoveMonMenuTopMenuItemX], a - hlCoord 13, 12 + coord hl, 13, 12 ld de, PokemonMenuEntries jp PlaceString @@ -1750,7 +1750,7 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:76e1) ; Calculate the text box position and dimensions based on the leftmost X coord ; of the field move names before adjusting for the number of field moves. - hlCoord 0, 11 + coord hl, 0, 11 ld a, [wFieldMovesLeftmostXCoord] dec a ld e, a @@ -1781,7 +1781,7 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:76e1) call UpdateSprites ; Calculate the position of the first field move name to print. - hlCoord 0, 12 + coord hl, 0, 12 ld a, [wFieldMovesLeftmostXCoord] inc a ld e, a @@ -1830,7 +1830,7 @@ DisplayFieldMoveMonMenu: ; 76e1 (1:76e1) pop hl ld a, [wFieldMovesLeftmostXCoord] ld [hFieldMoveMonMenuTopMenuItemX], a - hlCoord 0, 12 + coord hl, 0, 12 ld a, [wFieldMovesLeftmostXCoord] inc a ld e, a @@ -2316,28 +2316,28 @@ PrintSafariZoneSteps: ; c52f (3:452f) ret c cp UNKNOWN_DUNGEON_2 ret nc - hlCoord 0, 0 + coord hl, 0, 0 ld b, $3 ld c, $7 call TextBoxBorder - hlCoord 1, 1 + coord hl, 1, 1 ld de, wSafariSteps ld bc, $203 call PrintNumber - hlCoord 4, 1 + coord hl, 4, 1 ld de, SafariSteps call PlaceString - hlCoord 1, 3 + coord hl, 1, 3 ld de, SafariBallText call PlaceString ld a, [W_NUMSAFARIBALLS] cp $a jr nc, .asm_c56d - hlCoord 5, 3 + coord hl, 5, 3 ld a, $7f ld [hl], a .asm_c56d - hlCoord 6, 3 + coord hl, 6, 3 ld de, W_NUMSAFARIBALLS ld bc, $102 jp PrintNumber @@ -3025,11 +3025,11 @@ DrawBadges: ; ea03 (3:6a03) ld [hli], a ld [hl], $60 ; First name - hlCoord 2, 11 + coord hl, 2, 11 ld de, wTempObtainedBadgesBooleans call .DrawBadgeRow - hlCoord 2, 14 + coord hl, 2, 14 ld de, wTempObtainedBadgesBooleans + 4 ; call .DrawBadgeRow ; ret diff --git a/scripts/bikeshop.asm b/scripts/bikeshop.asm index 55ceb5cc..6779d9f6 100755 --- a/scripts/bikeshop.asm +++ b/scripts/bikeshop.asm @@ -51,15 +51,15 @@ BikeShopText1: ; 1d745 (7:5745) ld [wTopMenuItemX], a ld hl, wd730 set 6, [hl] - hlCoord 0, 0 + coord hl, 0, 0 ld b, $4 ld c, $f call TextBoxBorder call UpdateSprites - hlCoord 2, 2 + coord hl, 2, 2 ld de, BikeShopMenuText call PlaceString - hlCoord 8, 3 + coord hl, 8, 3 ld de, BikeShopMenuPrice call PlaceString ld hl, BikeShopText_1d815 diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index b9c006d1..519c0c67 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -480,32 +480,32 @@ CeladonGameCornerText_48f19: ; 48f19 (12:4f19) CeladonGameCornerScript_48f1e: ; 48f1e (12:4f1e) ld hl, wd730 set 6, [hl] - hlCoord 11, 0 + coord hl, 11, 0 ld b, $5 ld c, $7 call TextBoxBorder call UpdateSprites - hlCoord 12, 1 + coord hl, 12, 1 ld b, $4 ld c, $7 call ClearScreenArea - hlCoord 12, 2 + coord hl, 12, 2 ld de, GameCornerMoneyText call PlaceString - hlCoord 12, 3 + coord hl, 12, 3 ld de, GameCornerBlankText1 call PlaceString - hlCoord 12, 3 + coord hl, 12, 3 ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber - hlCoord 12, 4 + coord hl, 12, 4 ld de, GameCornerCoinText call PlaceString - hlCoord 12, 5 + coord hl, 12, 5 ld de, GameCornerBlankText2 call PlaceString - hlCoord 15, 5 + coord hl, 15, 5 ld de, wPlayerCoins ld c, $82 call PrintBCDNumber diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 8b6ff60f..b0afbee0 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -63,7 +63,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) dec l ld b, l ld c, $c - hlCoord 0, 0 + coord hl, 0, 0 call TextBoxBorder call UpdateSprites call CeladonMartRoofScript_48532 @@ -200,7 +200,7 @@ CeladonMartRoofScript_48532: ; 48532 (12:4532) push hl ld [wd11e], a call GetItemName - hlCoord 2, 2 + coord hl, 2, 2 ld a, [$ffdb] ld bc, SCREEN_WIDTH * 2 call AddNTimes diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index 361f4997..a8cf3b8d 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -53,7 +53,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) call DelayFrames ld b, $9c call CopyScreenTileBufferToVRAM - hlCoord 0, 10 + coord hl, 0, 10 ld bc, $0078 ld a, $14 call FillMemory -- cgit v1.3.1-sl0p From c169073eed4f0362ef42170098a141a2fcbd71d0 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 18 Jul 2015 20:49:52 -0700 Subject: misc --- constants/misc_constants.asm | 1 - engine/HoF_room_pc.asm | 2 +- engine/battle/animations.asm | 10 +- engine/battle/core.asm | 2 +- engine/battle/experience.asm | 2 +- engine/battle/init_battle_variables.asm | 2 +- engine/cable_club.asm | 2 +- engine/evolution.asm | 67 ++++++------ engine/evos_moves.asm | 68 +++++++----- engine/experience.asm | 84 ++++++++------- engine/game_corner_slots.asm | 2 +- engine/game_corner_slots2.asm | 4 +- engine/give_pokemon.asm | 25 +++-- engine/hidden_object_functions17.asm | 6 +- engine/hidden_object_functions7.asm | 2 +- engine/items/itemfinder.asm | 32 +++--- engine/items/items.asm | 36 +++---- engine/menu/league_pc.asm | 8 +- engine/menu/main_menu.asm | 120 +++++++++++---------- engine/menu/pokedex.asm | 18 ++-- engine/menu/prize_menu.asm | 10 +- engine/menu/status_screen.asm | 43 ++++---- engine/oak_speech.asm | 4 +- engine/oam_dma.asm | 2 +- engine/overworld/hidden_items.asm | 44 ++++---- engine/overworld/hidden_objects.asm | 10 +- engine/overworld/movement.asm | 17 ++- engine/palettes.asm | 46 ++++---- engine/predefs.asm | 8 +- engine/save.asm | 181 +++++++++++++++++--------------- engine/slot_machine.asm | 2 +- engine/titlescreen.asm | 2 +- home/init.asm | 16 +-- hram.asm | 4 + macros.asm | 2 +- main.asm | 8 +- scripts/agatha.asm | 2 +- scripts/bruno.asm | 2 +- scripts/ceruleancity.asm | 2 +- scripts/daycarem.asm | 144 +++++++++++++------------ scripts/lance.asm | 2 +- scripts/lorelei.asm | 2 +- scripts/mansion3.asm | 2 +- scripts/mtmoonpokecenter.asm | 36 +++---- scripts/museum1f.asm | 8 +- scripts/oakslab.asm | 20 ++-- scripts/pewterpokecenter.asm | 34 +++--- scripts/safarizoneentrance.asm | 2 +- scripts/seafoamislands1.asm | 4 +- scripts/seafoamislands2.asm | 4 +- scripts/seafoamislands3.asm | 4 +- scripts/seafoamislands4.asm | 4 +- scripts/seafoamislands5.asm | 4 +- scripts/silphco7.asm | 2 +- scripts/vermiliondock.asm | 47 +++++---- scripts/victoryroad2.asm | 2 +- scripts/victoryroad3.asm | 8 +- sram.asm | 8 +- text/maps/daycare_1.asm | 20 ++-- text/maps/daycare_2.asm | 14 +-- wram.asm | 86 +++++++++++++-- 61 files changed, 743 insertions(+), 612 deletions(-) (limited to 'engine/save.asm') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 5eecb38f..c06e7a65 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -10,7 +10,6 @@ HOF_MON EQU $10 HOF_TEAM EQU PARTY_LENGTH * HOF_MON HOF_TEAM_CAPACITY EQU 50 - A_BUTTON EQU %00000001 B_BUTTON EQU %00000010 SELECT EQU %00000100 diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index dc05814a..06c926db 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -29,7 +29,7 @@ HallOfFamePC: ; 7405c (1d:405c) ld c, 128 call DelayFrames xor a - ld [wWhichTrade], a + ld [wNumCreditsMonsDisplayed - 1], a ; not read ld [wNumCreditsMonsDisplayed], a jp Credits diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 6803c38b..d21e07e5 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -796,9 +796,9 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) dec a ret nz ; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation - ld a,[wWhichTrade] ; number of shakes + ld a,[wNumShakes] ; number of shakes dec a ; decrement number of shakes - ld [wWhichTrade],a + ld [wNumShakes],a ret z ; if there are shakes left, restart the subanimation ld a,[W_SUBANIMSUBENTRYADDR] @@ -1998,11 +1998,11 @@ AnimationWavyScreen: ; 79666 (1e:5666) ret Func_796ae: ; 796ae (1e:56ae) - ld a, [$ff41] + ld a, [rSTAT] and $3 jr nz, Func_796ae ld a, [hl] - ld [$ff43], a + ld [rSCX], a inc hl ld a, [hl] cp d @@ -2895,7 +2895,7 @@ TossBallAnimation: ; 79e16 (1e:5e16) ; store these for later ld a,b and a,$F - ld [wWhichTrade],a + ld [wNumShakes],a ld hl,.PokeBallAnimations ; choose which toss animation to use diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5deeb4dc..3cf3c9e9 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6298,7 +6298,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) dec de dec de xor a - ld [wHPBarMaxHP], a + ld [wLearningMovesFromDayCare], a predef WriteMonMoves ; get moves based on current level .loadMovePPs ld hl, wEnemyMonMoves diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 11a1e87c..6ec8c463 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -254,7 +254,7 @@ GainExperience: ; 5524f (15:524f) ld a, [wd0b5] ld [wd11e], a predef LearnMoveFromLevelUp - ld hl, wccd3 + ld hl, wCanEvolveFlags ld a, [wWhichPokemon] ld c, a ld b, $1 diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 74df62aa..f10e9f5e 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -19,7 +19,7 @@ InitBattleVariables: ; 525af (14:65af) ld hl, wcf1d ld [hli], a ld [hl], a - ld hl, wccd3 + ld hl, wCanEvolveFlags ld b, $3c .loop ld [hli], a diff --git a/engine/cable_club.asm b/engine/cable_club.asm index fbdb6260..9ccffdbb 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -297,7 +297,7 @@ CallCurrentTradeCenterFunction: ld b, 0 ld a, [wTradeCenterPointerTableIndex] cp $ff - jp z, LoadTitlescreenGraphics + jp z, DisplayTitleScreen add a ld c, a add hl, bc diff --git a/engine/evolution.asm b/engine/evolution.asm index 9ed38c21..d110110a 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -20,11 +20,11 @@ EvolveMon: ; 7bde9 (1e:7de9) xor a ld [H_AUTOBGTRANSFERENABLED], a ld [hTilesetType], a - ld a, [wHPBarMaxHP] + ld a, [wEvoOldSpecies] ld [wcf1d], a ld c, $0 call EvolutionSetWholeScreenPalette - ld a, [wHPBarMaxHP + 1] + ld a, [wEvoNewSpecies] ld [wcf91], a ld [wd0b5], a call Evolution_LoadPic @@ -32,13 +32,13 @@ EvolveMon: ; 7bde9 (1e:7de9) ld hl, vBackPic ld bc, 7 * 7 call CopyVideoData - ld a, [wHPBarMaxHP] + ld a, [wEvoOldSpecies] ld [wcf91], a ld [wd0b5], a call Evolution_LoadPic ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a - ld a, [wHPBarMaxHP] + ld a, [wEvoOldSpecies] call PlayCry call WaitForSoundToFinish ld c, BANK(Music_SafariZone) @@ -49,23 +49,23 @@ EvolveMon: ; 7bde9 (1e:7de9) ld c, $1 call EvolutionSetWholeScreenPalette ld bc, $110 -.asm_7be63 +.animLoop push bc call Evolution_CheckForCancel jr c, .evolutionCancelled - call Func_7bec2 + call Evolution_BackAndForthAnim pop bc inc b dec c dec c - jr nz, .asm_7be63 + jr nz, .animLoop xor a - ld [wHPBarOldHP + 1], a + ld [wEvoCancelled], a ld a, $31 - ld [wHPBarOldHP], a - call Func_7bed6 - ld a, [wHPBarMaxHP + 1] -.afterCancellation + ld [wEvoMonTileOffset], a + call Evolution_ChangeMonPic ; show the new species pic + ld a, [wEvoNewSpecies] +.done ld [wcf1d], a ld a, $ff ld [wc0ee], a @@ -81,17 +81,17 @@ EvolveMon: ; 7bde9 (1e:7de9) pop bc pop de pop hl - ld a, [wHPBarOldHP + 1] + ld a, [wEvoCancelled] and a ret z scf ret .evolutionCancelled pop bc - ld a, $1 - ld [wHPBarOldHP + 1], a - ld a, [wHPBarMaxHP] - jr .afterCancellation + ld a, 1 + ld [wEvoCancelled], a + ld a, [wEvoOldSpecies] + jr .done EvolutionSetWholeScreenPalette: ; 7beb4 (1e:7eb4) ld b, $b @@ -102,37 +102,38 @@ Evolution_LoadPic: ; 7beb9 (1e:7eb9) coord hl, 7, 2 jp LoadFlippedFrontSpriteByMonIndex -Func_7bec2: ; 7bec2 (1e:7ec2) +Evolution_BackAndForthAnim: ; 7bec2 (1e:7ec2) +; show the mon change back and forth between the new and old species b times ld a, $31 - ld [wHPBarOldHP], a - call Func_7bed6 - ld a, $cf - ld [wHPBarOldHP], a - call Func_7bed6 + ld [wEvoMonTileOffset], a + call Evolution_ChangeMonPic + ld a, -$31 + ld [wEvoMonTileOffset], a + call Evolution_ChangeMonPic dec b - jr nz, Func_7bec2 + jr nz, Evolution_BackAndForthAnim ret -Func_7bed6: ; 7bed6 (1e:7ed6) +Evolution_ChangeMonPic: ; 7bed6 (1e:7ed6) push bc xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 7, 2 - ld bc, $707 - ld de, $d -.asm_7bee3 + lb bc, 7, 7 + ld de, SCREEN_WIDTH - 7 +.loop push bc -.asm_7bee4 - ld a, [wHPBarOldHP] +.innerLoop + ld a, [wEvoMonTileOffset] add [hl] ld [hli], a dec c - jr nz, .asm_7bee4 + jr nz, .innerLoop pop bc add hl, de dec b - jr nz, .asm_7bee3 - ld a, $1 + jr nz, .loop + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 pop bc diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 4a253c68..9a0f2d84 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -1,6 +1,6 @@ ; try to evolve the mon in [wWhichPokemon] TryEvolvingMon: ; 3ad0e (e:6d0e) - ld hl, wccd3 + ld hl, wCanEvolveFlags xor a ld [hl], a ld a, [wWhichPokemon] @@ -31,17 +31,17 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [hl] cp $ff ; have we reached the end of the party? jp z, .done - ld [wHPBarMaxHP], a + ld [wEvoOldSpecies], a push hl ld a, [wWhichPokemon] ld c, a - ld hl, wccd3 + ld hl, wCanEvolveFlags ld b, $2 call Evolution_FlagAction ld a, c and a ; is the mon's bit set? jp z, Evolution_PartyMonLoop ; if not, go to the next mon - ld a, [wHPBarMaxHP] + ld a, [wEvoOldSpecies] dec a ld b, 0 ld hl, EvosMovesPointerTable @@ -110,7 +110,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld [wd121], a push hl ld a, [hl] - ld [wHPBarMaxHP + 1], a + ld [wEvoNewSpecies], a ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName @@ -122,7 +122,7 @@ Evolution_PartyMonLoop: ; loop over party mons xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 0 - ld bc, $c14 + lb bc, 12, 20 call ClearScreenArea ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -137,7 +137,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [hl] ld [wd0b5], a ld [wLoadedMonSpecies], a - ld [wHPBarMaxHP + 1], a + ld [wEvoNewSpecies], a ld a, MONSTER_NAME ld [wNameListType], a ld a, BANK(TrainerNames) ; bank is not used for monster names @@ -357,7 +357,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ld bc, wPartyMon2 - wPartyMon1 call AddNTimes .next - ld b, $4 + ld b, NUM_MOVES .checkCurrentMovesLoop ; check if the move to learn is already known ld a, [hli] cp d @@ -377,14 +377,13 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ; writes the moves a mon has at level [W_CURENEMYLVL] to [de] ; move slots are being filled up sequentially and shifted if all slots are full -; [wHPBarMaxHP]: (?) WriteMonMoves: ; 3afb8 (e:6fb8) call GetPredefRegisters push hl push de push bc ld hl, EvosMovesPointerTable - ld b, $0 + ld b, 0 ld a, [wcf91] ; cur mon ID dec a add a @@ -411,25 +410,30 @@ WriteMonMoves: ; 3afb8 (e:6fb8) ld a, [W_CURENEMYLVL] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .skipMinLevelCheck - ld a, [wWhichTrade] ; min move level) + ld a, [wDayCareStartLevel] cp b jr nc, .nextMove2 ; min level >= move level + .skipMinLevelCheck + +; check if the move is already known push de - ld c, $4 -.moveAlreadyLearnedCheckLoop + ld c, NUM_MOVES +.alreadyKnowsCheckLoop ld a, [de] inc de cp [hl] jr z, .nextMove dec c - jr nz, .moveAlreadyLearnedCheckLoop + jr nz, .alreadyKnowsCheckLoop + +; try to find an empty move slot pop de push de - ld c, $4 + ld c, NUM_MOVES .findEmptySlotLoop ld a, [de] and a @@ -437,47 +441,55 @@ WriteMonMoves: ; 3afb8 (e:6fb8) inc de dec c jr nz, .findEmptySlotLoop - pop de ; no empty move slots found + +; no empty move slots found + pop de push de push hl ld h, d ld l, e call WriteMonMoves_ShiftMoveData ; shift all moves one up (deleting move 1) - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .writeMoveToSlot + +; shift PP as well if learning moves from day care push de - ld bc, $12 + ld bc, wPartyMon1PP - (wPartyMon1Moves + 3) add hl, bc ld d, h ld e, l call WriteMonMoves_ShiftMoveData ; shift all move PP data one up pop de + .writeMoveToSlot pop hl .writeMoveToSlot2 ld a, [hl] ld [de], a - ld a, [wHPBarMaxHP] + ld a, [wLearningMovesFromDayCare] and a jr z, .nextMove - push hl ; write move PP value + +; write move PP value if learning moves from day care + push hl ld a, [hl] - ld hl, $15 + ld hl, wPartyMon1PP - wPartyMon1Moves add hl, de push hl dec a ld hl, Moves - ld bc, $6 + ld bc, 6 call AddNTimes - ld de, wHPBarMaxHP + ld de, wBuffer ld a, BANK(Moves) call FarCopyData - ld a, [wHPBarNewHP + 1] + ld a, [wBuffer + 5] pop hl ld [hl], a pop hl jr .nextMove + .done pop bc pop de @@ -486,13 +498,13 @@ WriteMonMoves: ; 3afb8 (e:6fb8) ; shifts all move data one up (freeing 4th move slot) WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e) - ld c, $3 -.asm_3b050 + ld c, NUM_MOVES - 1 +.loop inc de ld a, [de] ld [hli], a dec c - jr nz, .asm_3b050 + jr nz, .loop ret Evolution_FlagAction: ; 3b057 (e:7057) diff --git a/engine/experience.asm b/engine/experience.asm index 752536cf..b43fbcf9 100755 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -10,15 +10,15 @@ CalcLevelFromExperience: ; 58f43 (16:4f43) push hl ld hl, wLoadedMonExp + 2 ; current exp ; compare exp needed for level d with current exp - ld a, [H_MULTIPLICAND + 2] + ld a, [hExperience + 2] ld c, a ld a, [hld] sub c - ld a, [H_MULTIPLICAND + 1] + ld a, [hExperience + 1] ld c, a ld a, [hld] sbc c - ld a, [H_MULTIPLICAND] + ld a, [hExperience] ld c, a ld a, [hl] sbc c @@ -33,7 +33,7 @@ CalcExperience: ; 58f6a (16:4f6a) add a add a ld c, a - ld b, $0 + ld b, 0 ld hl, GrowthRateTable add hl, bc call CalcDSquared @@ -50,96 +50,100 @@ CalcExperience: ; 58f6a (16:4f6a) ld [H_DIVISOR], a ld b, $4 call Divide - ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT) + ld a, [H_QUOTIENT + 1] push af - ld a, [H_MULTIPLICAND+1] + ld a, [H_QUOTIENT + 2] push af - ld a, [H_MULTIPLICAND+2] + ld a, [H_QUOTIENT + 3] push af call CalcDSquared ld a, [hl] and $7f ld [H_MULTIPLIER], a call Multiply - ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT) + ld a, [H_PRODUCT + 1] push af - ld a, [H_MULTIPLICAND+1] + ld a, [H_PRODUCT + 2] push af - ld a, [H_MULTIPLICAND+2] + ld a, [H_PRODUCT + 3] push af ld a, [hli] push af xor a ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND+1], a + ld [H_MULTIPLICAND + 1], a ld a, d - ld [H_MULTIPLICAND+2], a + ld [H_MULTIPLICAND + 2], a ld a, [hli] ld [H_MULTIPLIER], a call Multiply ld b, [hl] - ld a, [H_MULTIPLICAND+2] + ld a, [H_PRODUCT + 3] sub b - ld [H_MULTIPLICAND+2], a + ld [H_PRODUCT + 3], a ld b, $0 - ld a, [H_MULTIPLICAND+1] + ld a, [H_PRODUCT + 2] sbc b - ld [H_MULTIPLICAND+1], a - ld a, [H_MULTIPLICAND] + ld [H_PRODUCT + 2], a + ld a, [H_PRODUCT + 1] sbc b - ld [H_MULTIPLICAND], a + ld [H_PRODUCT + 1], a +; The difference of the linear term and the constant term consists of 3 bytes +; starting at H_PRODUCT + 1. Below, hExperience (an alias of that address) will +; be used instead for the further work of adding or subtracting the squared +; term and adding the cubed term. pop af and $80 jr nz, .subtractSquaredTerm ; check sign pop bc - ld a, [H_MULTIPLICAND+2] + ld a, [hExperience + 2] add b - ld [H_MULTIPLICAND+2], a + ld [hExperience + 2], a pop bc - ld a, [H_MULTIPLICAND+1] + ld a, [hExperience + 1] adc b - ld [H_MULTIPLICAND+1], a + ld [hExperience + 1], a pop bc - ld a, [H_MULTIPLICAND] + ld a, [hExperience] adc b - ld [H_MULTIPLICAND], a + ld [hExperience], a jr .addCubedTerm .subtractSquaredTerm pop bc - ld a, [H_MULTIPLICAND+2] + ld a, [hExperience + 2] sub b - ld [H_MULTIPLICAND+2], a + ld [hExperience + 2], a pop bc - ld a, [H_MULTIPLICAND+1] + ld a, [hExperience + 1] sbc b - ld [H_MULTIPLICAND+1], a + ld [hExperience + 1], a pop bc - ld a, [H_MULTIPLICAND] + ld a, [hExperience] sbc b - ld [H_MULTIPLICAND], a + ld [hExperience], a .addCubedTerm pop bc - ld a, [H_MULTIPLICAND+2] + ld a, [hExperience + 2] add b - ld [H_MULTIPLICAND+2], a + ld [hExperience + 2], a pop bc - ld a, [H_MULTIPLICAND+1] + ld a, [hExperience + 1] adc b - ld [H_MULTIPLICAND+1], a + ld [hExperience + 1], a pop bc - ld a, [H_MULTIPLICAND] + ld a, [hExperience] adc b - ld [H_MULTIPLICAND], a + ld [hExperience], a ret ; calculates d*d CalcDSquared: ; 59010 (16:5010) xor a - ld [H_MULTIPLICAND], a ; (aliases: H_NUMTOPRINT) - ld [H_MULTIPLICAND+1], a + ld [H_MULTIPLICAND], a + ld [H_MULTIPLICAND + 1], a ld a, d - ld [H_MULTIPLICAND+2], a - ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_REMAINDER, H_POWEROFTEN) + ld [H_MULTIPLICAND + 2], a + ld [H_MULTIPLIER], a jp Multiply ; each entry has the following scheme: diff --git a/engine/game_corner_slots.asm b/engine/game_corner_slots.asm index b3b2490c..ff17d4d3 100755 --- a/engine/game_corner_slots.asm +++ b/engine/game_corner_slots.asm @@ -7,7 +7,7 @@ StartSlotMachine: ; 37e2d (d:7e2d) cp $ff jr z, .printSomeonesKeys callba AbleToPlaySlotsCheck - ld a, [wHiddenObjectFunctionArgument] + ld a, [wCanPlaySlots] and a ret z ld a, [wLuckySlotHiddenObjectIndex] diff --git a/engine/game_corner_slots2.asm b/engine/game_corner_slots2.asm index 850b1f99..643536ea 100755 --- a/engine/game_corner_slots2.asm +++ b/engine/game_corner_slots2.asm @@ -1,4 +1,4 @@ -AbleToPlaySlotsCheck ; 2ff09 (b:7f09) +AbleToPlaySlotsCheck: ; 2ff09 (b:7f09) ld a, [wSpriteStateData1 + 2] and $8 jr z, .done ; not able @@ -19,7 +19,7 @@ AbleToPlaySlotsCheck ; 2ff09 (b:7f09) call PrintPredefTextID xor a .done - ld [wWhichTrade], a + ld [wCanPlaySlots], a ret GameCornerCoinCaseText: ; 2ff32 (b:7f32) diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 45e88b9c..4b45631d 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -1,13 +1,16 @@ _GivePokemon: ; 4fda5 (13:7da5) +; returns success in carry +; and whether the mon was added to the party in [wAddedToParty] call EnableAutoTextBoxDrawing xor a - ld [wccd3], a + ld [wAddedToParty], a ld a, [wPartyCount] cp PARTY_LENGTH - jr c, .asm_4fe01 + jr c, .addToParty ld a, [W_NUMINBOX] cp MONS_PER_BOX - jr nc, .asm_4fdf9 + jr nc, .boxFull +; add to box xor a ld [W_ENEMYBATTSTATUS3], a ld a, [wcf91] @@ -19,32 +22,32 @@ _GivePokemon: ; 4fda5 (13:7da5) ld a, [wCurrentBoxNum] and $7f cp 9 - jr c, .asm_4fdec + jr c, .singleDigitBoxNum sub 9 ld [hl], "1" inc hl add "0" - jr .asm_4fdee -.asm_4fdec + jr .next +.singleDigitBoxNum add "1" -.asm_4fdee +.next ld [hli], a ld [hl], "@" ld hl, SetToBoxText call PrintText scf ret -.asm_4fdf9 +.boxFull ld hl, BoxIsFullText call PrintText and a ret -.asm_4fe01 +.addToParty call SetPokedexOwnedFlag call AddPartyMon - ld a, $1 + ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld [wccd3], a + ld [wAddedToParty], a scf ret diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 841929b8..44941d36 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -55,7 +55,7 @@ KabutopsFossilText: ; 5dbd4 (17:5bd4) DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9) ; Displays a pokemon's front sprite in a pop-up window. ; [wcf91] = pokemon interal id number - ld a, $1 + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a @@ -85,7 +85,7 @@ PrintBlackboardLinkCableText: ; 5dc1a (17:5c1a) call EnableAutoTextBoxDrawing ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld a, [wWhichTrade] + ld a, [wHiddenObjectFunctionArgument] call PrintPredefTextID ret @@ -310,7 +310,7 @@ VermilionGymTrashText: ; 5ddf7 (17:5df7) GymTrashScript: ; 5ddfc (17:5dfc) call EnableAutoTextBoxDrawing - ld a, [wWhichTrade] + ld a, [wHiddenObjectFunctionArgument] ld [wcd5b], a ; Don't do the trash can puzzle if it's already been done. diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 31ae17a4..8e8b27b1 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -128,7 +128,7 @@ CinnabarGymQuiz: ; 1ea25 (7:6a25) TX_ASM xor a ld [wda38], a - ld a, [wWhichTrade] + ld a, [wHiddenObjectFunctionArgument] push af and $f ld [$ffdb], a diff --git a/engine/items/itemfinder.asm b/engine/items/itemfinder.asm index 96abecd3..51277632 100755 --- a/engine/items/itemfinder.asm +++ b/engine/items/itemfinder.asm @@ -1,14 +1,14 @@ HiddenItemNear: ; 7481f (1d:481f) ld hl, HiddenItemCoords - ld b, $0 -.asm_74824 - ld de, $0003 + ld b, 0 +.loop + ld de, 3 ld a, [W_CURMAP] call IsInRestOfArray ret nc ; return if current map has no hidden items push bc push hl - ld hl, wd6f0 + ld hl, wObtainedHiddenItemsFlags ld c, b ld b, $2 predef FlagActionPredef @@ -22,28 +22,30 @@ HiddenItemNear: ; 7481f (1d:481f) inc hl ld e, [hl] inc hl - jr nz, .asm_74824 + jr nz, .loop ; if the item has already been obtained +; check if the item is within 4-5 tiles (depending on the direction of item) ld a, [W_YCOORD] - call Func_7486b + call Sub5ClampTo0 cp d - jr nc, .asm_74824 + jr nc, .loop ld a, [W_YCOORD] - add $4 + add 4 cp d - jr c, .asm_74824 + jr c, .loop ld a, [W_XCOORD] - call Func_7486b + call Sub5ClampTo0 cp e - jr nc, .asm_74824 + jr nc, .loop ld a, [W_XCOORD] - add $5 + add 5 cp e - jr c, .asm_74824 + jr c, .loop scf ret -Func_7486b: ; 7486b (1d:486b) - sub $5 +Sub5ClampTo0: ; 7486b (1d:486b) +; subtract 5 but clamp to 0 + sub 5 cp $f0 ret c xor a diff --git a/engine/items/items.asm b/engine/items/items.asm index fe2d71c8..bc8d16fa 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1216,11 +1216,11 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,-19 add hl,bc ; hl now points to experience ; update experience to minimum for new level - ld a,[$ff96] + ld a,[hExperience] ld [hli],a - ld a,[$ff97] + ld a,[hExperience + 1] ld [hli],a - ld a,[$ff98] + ld a,[hExperience + 2] ld [hl],a pop hl ld a,[wWhichPokemon] @@ -1618,8 +1618,8 @@ ItemUsePokeflute: ; e140 (3:6140) jp PrintText .inBattle xor a - ld [wWhichTrade],a ; initialize variable that indicates if any pokemon were woken up to zero - ld b,~SLP & $FF + ld [wWereAnyMonsAsleep],a + ld b,~SLP & $ff ld hl,wPartyMon1Status call WakeUpEntireParty ld a,[W_ISINBATTLE] @@ -1638,7 +1638,7 @@ ItemUsePokeflute: ; e140 (3:6140) and b ; remove Sleep status ld [hl],a call LoadScreenTilesFromBuffer2 ; restore saved screen - ld a,[wWhichTrade] + ld a,[wWereAnyMonsAsleep] and a ; were any pokemon asleep before playing the flute? ld hl,PlayedFluteNoEffectText jp z,PrintText ; if no pokemon were asleep @@ -1662,9 +1662,9 @@ ItemUsePokeflute: ; e140 (3:6140) ; INPUT: ; hl must point to status of first pokemon in party (player's or enemy's) ; b must equal ~SLP -; [wWhichTrade] should be initialized to 0 +; [wWereAnyMonsAsleep] should be initialized to 0 ; OUTPUT: -; [wWhichTrade]: set to 1 if any pokemon were asleep +; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep WakeUpEntireParty: ; e1e5 (3:61e5) ld de,44 ld c,6 @@ -1674,7 +1674,7 @@ WakeUpEntireParty: ; e1e5 (3:61e5) and a,SLP ; is pokemon asleep? jr z,.notAsleep ld a,1 - ld [wWhichTrade],a ; indicate that a pokemon had to be woken up + ld [wWereAnyMonsAsleep],a ; indicate that a pokemon had to be woken up .notAsleep pop af and b ; remove Sleep status @@ -1874,7 +1874,7 @@ ItemUsePPRestore: ; e31e (3:631e) ld a,[wWhichPokemon] push af ld a,[wcf91] - ld [wWhichTrade],a + ld [wPPRestoreItem],a .chooseMon xor a ld [wUpdateSpritesEnabled],a @@ -1884,13 +1884,13 @@ ItemUsePPRestore: ; e31e (3:631e) jr nc,.chooseMove jp .itemNotUsed .chooseMove - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ELIXER jp nc,.useElixir ; if Elixir or Max Elixir ld a,$02 ld [wMoveMenuType],a ld hl,RaisePPWhichTechniqueText - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ETHER ; is it a PP Up? jr c,.printWhichTechniqueMessage ; if so, print the raise PP message ld hl,RestorePPWhichTechniqueText ; otherwise, print the restore PP message @@ -1911,7 +1911,7 @@ ItemUsePPRestore: ; e31e (3:631e) call GetMoveName call CopyStringToCF4B ; copy name to wcf4b pop hl - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,ETHER jr nc,.useEther ; if Ether or Max Ether .usePPUp @@ -1973,7 +1973,7 @@ ItemUsePPRestore: ; e31e (3:631e) add hl,bc ; hl now points to move's PP ld a,[wd11e] ld b,a ; b = max PP - ld a,[wWhichTrade] + ld a,[wPPRestoreItem] cp a,MAX_ETHER jr z,.fullyRestorePP ld a,[hl] ; move PP @@ -2005,7 +2005,7 @@ ItemUsePPRestore: ; e31e (3:631e) jr .storeNewAmount .useElixir ; decrement the item ID so that ELIXER becomes ETHER and MAX_ELIXER becomes MAX_ETHER - ld hl,wWhichTrade + ld hl,wPPRestoreItem dec [hl] dec [hl] xor a @@ -2701,13 +2701,13 @@ SendNewMonToBox: ; e7a4 (3:67a4) ld d, a callab CalcExperience pop de - ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) + ld a, [hExperience] ld [de], a inc de - ld a, [$ff97] + ld a, [hExperience + 1] ld [de], a inc de - ld a, [$ff98] + ld a, [hExperience + 2] ld [de], a inc de xor a diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index 560ed421..06a7894c 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -12,7 +12,7 @@ PKMNLeaguePC: ; 0x7657e ld [hTilesetType], a ld [W_SPRITEFLIPPED], a ld [wUpdateSpritesEnabled], a - ld [wTrainerScreenX], a + ld [wHoFTeamIndex2], a ld [wHoFTeamNo], a ld a, [wNumHoFTeams] ld b, a @@ -27,13 +27,13 @@ PKMNLeaguePC: ; 0x7657e ld hl, wHoFTeamNo inc [hl] push bc - ld a, [wTrainerScreenX] - ld [wHoFMonSpecies], a + ld a, [wHoFTeamIndex2] + ld [wHoFTeamIndex], a callba LoadHallOfFameTeams call LeaguePCShowTeam pop bc jr c, .doneShowingTeams - ld hl, wTrainerScreenX + ld hl, wHoFTeamIndex2 inc [hl] ld a, [hl] cp b diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 9e160f81..5dc6e61f 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -1,17 +1,16 @@ MainMenu: ; 5af2 (1:5af2) ; Check save file - call Func_5bff + call InitOptions xor a - ld [wd08a],a + ld [wOptionsInitialized],a inc a - ld [wd088],a - call Func_609e - jr nc,.next0 + ld [wSaveFileStatus],a + call CheckForPlayerNameInSRAM + jr nc,.mainMenuLoop - ; Predef 52 loads the save from SRAM to RAM predef LoadSAV -.next0 +.mainMenuLoop ld c,20 call DelayFrames xor a ; LINK_STATE_NONE @@ -30,9 +29,10 @@ MainMenu: ; 5af2 (1:5af2) call LoadFontTilePatterns ld hl,wd730 set 6,[hl] - ld a,[wd088] + ld a,[wSaveFileStatus] cp a,1 - jr z,.next1 + jr z,.noSaveFile +; there's a save file coord hl, 0, 0 ld b,6 ld c,13 @@ -41,7 +41,7 @@ MainMenu: ; 5af2 (1:5af2) ld de,ContinueText call PlaceString jr .next2 -.next1 +.noSaveFile coord hl, 0, 0 ld b,4 ld c,13 @@ -63,31 +63,33 @@ MainMenu: ; 5af2 (1:5af2) ld [wTopMenuItemY],a ld a,$B ld [wMenuWatchedKeys],a - ld a,[wd088] + ld a,[wSaveFileStatus] ld [wMaxMenuItem],a call HandleMenuInput - bit 1,a - jp nz,LoadTitlescreenGraphics ; load title screen (gfx and arrangement) + bit 1,a ; pressed B? + jp nz,DisplayTitleScreen ; if so, go back to the title screen ld c,20 call DelayFrames ld a,[wCurrentMenuItem] ld b,a - ld a,[wd088] + ld a,[wSaveFileStatus] cp a,2 - jp z,.next3 - inc b ; adjust MenuArrow_Counter -.next3 + jp z,.skipInc +; If there's no save file, increment the current menu item so that the numbers +; are the same whether or not there's a save file. + inc b +.skipInc ld a,b and a - jr z,.next4 ; if press_A on Continue + jr z,.choseContinue cp a,1 - jp z,Func_5d52 ; if press_A on NewGame - call DisplayOptionMenu ; if press_a on Options + jp z,StartNewGame + call DisplayOptionMenu ld a,1 - ld [wd08a],a - jp .next0 -.next4 - call ContinueGame + ld [wOptionsInitialized],a + jp .mainMenuLoop +.choseContinue + call DisplayContinueGameInfo ld hl,wd126 set 5,[hl] .inputLoop @@ -100,7 +102,7 @@ MainMenu: ; 5af2 (1:5af2) bit 0,a jr nz,.pressedA bit 1,a - jp nz,.next0 ; pressedB + jp nz,.mainMenuLoop ; pressed B jr .inputLoop .pressedA call GBPalWhiteOutWithDelay3 @@ -122,10 +124,10 @@ MainMenu: ; 5af2 (1:5af2) call SpecialWarpIn jp SpecialEnterMap -Func_5bff: ; 5bff (1:5bff) - ld a,1 +InitOptions: ; 5bff (1:5bff) + ld a,1 ; no delay ld [wLetterPrintingDelayFlags],a - ld a,3 + ld a,3 ; medium speed ld [W_OPTIONS],a ret @@ -301,7 +303,7 @@ LinkCanceledText: ; 5d4d (1:5d4d) TX_FAR _LinkCanceledText db "@" -Func_5d52: ; 5d52 (1:5d52) +StartNewGame: ; 5d52 (1:5d52) ld hl, wd732 res 1, [hl] call OakSpeech @@ -337,12 +339,12 @@ CableClubOptionsText: ; 5d97 (1:5d97) db "COLOSSEUM", $4e db "CANCEL@" -ContinueGame: ; 5db5 (1:5db5) +DisplayContinueGameInfo: ; 5db5 (1:5db5) xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 4, 7 - ld b, $8 - ld c, $e + ld b, 8 + ld c, 14 call TextBoxBorder coord hl, 5, 9 ld de, SaveScreenInfoText @@ -351,12 +353,12 @@ ContinueGame: ; 5db5 (1:5db5) ld de, wPlayerName call PlaceString coord hl, 17, 11 - call Func_5e2f + call PrintNumBadges coord hl, 16, 13 - call Func_5e42 + call PrintNumOwnedMons coord hl, 13, 15 - call Func_5e55 - ld a, $1 + call PrintPlayTime + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a ld c, 30 jp DelayFrames @@ -377,17 +379,17 @@ PrintSaveScreenText: ; 5def (1:5def) ld de, wPlayerName call PlaceString coord hl, 17, 4 - call Func_5e2f + call PrintNumBadges coord hl, 16, 6 - call Func_5e42 + call PrintNumOwnedMons coord hl, 13, 8 - call Func_5e55 + call PrintPlayTime ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a ld c, 30 jp DelayFrames -Func_5e2f: ; 5e2f (1:5e2f) +PrintNumBadges: ; 5e2f (1:5e2f) push hl ld hl, W_OBTAINEDBADGES ld b, $1 @@ -397,7 +399,7 @@ Func_5e2f: ; 5e2f (1:5e2f) ld bc, $102 jp PrintNumber -Func_5e42: ; 5e42 (1:5e42) +PrintNumOwnedMons: ; 5e42 (1:5e42) push hl ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned @@ -407,7 +409,7 @@ Func_5e42: ; 5e42 (1:5e42) ld bc, $103 jp PrintNumber -Func_5e55: ; 5e55 (1:5e55) +PrintPlayTime: ; 5e55 (1:5e55) ld de, W_PLAYTIMEHOURS + 1 ld bc, $103 call PrintNumber @@ -678,28 +680,32 @@ TextSpeedOptionData: ; 6096 (1:6096) db 7 ; default X coordinate (Medium) db $ff ; terminator -Func_609e: ; 609e (1:609e) - ld a, $a - ld [$0], a +CheckForPlayerNameInSRAM: ; 609e (1:609e) +; Check if the player name data in SRAM has a string terminator character +; (indicating that a name may have been saved there) and return whether it does +; in carry. + ld a, SRAM_ENABLE + ld [MBC1SRamEnable], a ld a, $1 - ld [$6000], a - ld [$4000], a + ld [MBC1SRamBankingMode], a + ld [MBC1SRamBank], a ld b, $b - ld hl, $a598 -.asm_60b0 + ld hl, sPlayerName +.loop ld a, [hli] - cp $50 - jr z, .asm_60c1 + cp "@" + jr z, .found dec b - jr nz, .asm_60b0 + jr nz, .loop +; not found xor a - ld [$0], a - ld [$6000], a + ld [MBC1SRamEnable], a + ld [MBC1SRamBankingMode], a and a ret -.asm_60c1 +.found xor a - ld [$0], a - ld [$6000], a + ld [MBC1SRamEnable], a + ld [MBC1SRamBankingMode], a scf ret diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 08ce0da9..4e173bc0 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -71,8 +71,8 @@ HandlePokedexSideMenu: ; 4006d (10:406d) ld [wd11e],a ld a,[wd11e] push af - ld a,[wWhichTrade] - push af + ld a,[wDexMaxSeenMon] + push af ; this doesn't need to be preserved ld hl,wPokedexSeen call IsPokemonBitSet ld b,2 @@ -108,7 +108,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) ld b,1 .exitSideMenu pop af - ld [wWhichTrade],a + ld [wDexMaxSeenMon],a pop af ld [wd11e],a pop af @@ -207,7 +207,7 @@ HandlePokedexListMenu: ; 40111 (10:4111) jr .maxSeenPokemonLoop .storeMaxSeenPokemon ld a,b - ld [wWhichTrade],a ; max seen pokemon + ld [wDexMaxSeenMon],a .loop xor a ld [H_AUTOBGTRANSFERENABLED],a @@ -218,7 +218,7 @@ HandlePokedexListMenu: ; 40111 (10:4111) ld a,[wListScrollOffset] ld [wd11e],a ld d,7 - ld a,[wWhichTrade] + ld a,[wDexMaxSeenMon] cp a,7 jr nc,.printPokemonLoop ld d,a @@ -294,9 +294,9 @@ HandlePokedexListMenu: ; 40111 (10:4111) bit 7,a ; was Down pressed? jr z,.checkIfRightPressed .downPressed ; scroll down one row - ld a,[wWhichTrade] + ld a,[wDexMaxSeenMon] cp a,7 - jp c,.loop + jp c,.loop ; can't if the list is shorter than 7 sub a,7 ld b,a ld a,[wListScrollOffset] @@ -309,9 +309,9 @@ HandlePokedexListMenu: ; 40111 (10:4111) bit 4,a ; was Right pressed? jr z,.checkIfLeftPressed .rightPressed ; scroll down 7 rows - ld a,[wWhichTrade] + ld a,[wDexMaxSeenMon] cp a,7 - jp c,.loop + jp c,.loop ; can't if the list is shorter than 7 sub a,6 ld b,a ld a,[wListScrollOffset] diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index d1fa0c72..b1b751b9 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -231,18 +231,24 @@ HandlePrizeChoice: ; 528c6 (14:68c6) pop af ld b,a call GivePokemon + +; If either the party or box was full, wait after displaying message. push af - ld a,[wccd3] ; XXX is there room? + ld a,[wAddedToParty] and a call z,WaitForTextScrollButtonPress pop af + +; If the mon couldn't be given to the player (because both the party and box +; were full), return without subtracting coins. ret nc + .SubtractCoins call LoadCoinsToSubtract ld hl,hCoins + 1 ld de,wPlayerCoins + 1 ld c,$02 ; how many bytes - predef SubBCDPredef ; subtract coins (BCD daa operations) + predef SubBCDPredef jp PrintPrizePrice .BagFull ld hl,PrizeRoomBagIsFullTextPtr diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 75de182b..3bf3464a 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -297,8 +297,8 @@ StatusScreen2: ; 12b57 (4:6b57) push af xor a ld [hTilesetType], a - ld [$ffba], a - ld bc, $0005 + ld [H_AUTOBGTRANSFERENABLED], a + ld bc, NUM_MOVES + 1 ld hl, wMoves call FillMemory ld hl, wLoadedMonMoves @@ -307,13 +307,13 @@ StatusScreen2: ; 12b57 (4:6b57) call CopyData callab FormatMovesString coord hl, 9, 2 - ld bc, $050a + lb bc, 5, 10 call ClearScreenArea ; Clear under name coord hl, 19, 3 ld [hl], $78 coord hl, 0, 8 - ld b, $8 - ld c, $12 + ld b, 8 + ld c, 18 call TextBoxBorder ; Draw move container coord hl, 2, 9 ld de, wMovesString @@ -387,9 +387,9 @@ StatusScreen2: ; 12b57 (4:6b57) jr nz, .PrintPP .PPDone coord hl, 9, 3 - ld de, EXPPointsText + ld de, StatusScreenExpText call PlaceString - ld a, [wLoadedMonLevel] ; level + ld a, [wLoadedMonLevel] push af cp MAX_LEVEL jr z, .Level100 @@ -407,11 +407,11 @@ StatusScreen2: ; 12b57 (4:6b57) coord hl, 12, 4 ld bc, $0307 call PrintNumber ; exp - call .asm_12c86 + call CalcExpToLevelUp ld de, wLoadedMonExp coord hl, 7, 6 ld bc, $0307 - call PrintNumber + call PrintNumber ; exp needed to level up coord hl, 9, 0 call StatusScreen_ClearName coord hl, 9, 1 @@ -422,7 +422,7 @@ StatusScreen2: ; 12b57 (4:6b57) coord hl, 9, 1 call PlaceString ld a, $1 - ld [$ffba], a + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 call WaitForTextScrollButtonPress ; wait for button pop af @@ -433,25 +433,26 @@ StatusScreen2: ; 12b57 (4:6b57) ld [$ff24], a call GBPalWhiteOut jp ClearScreen -.asm_12c86 ; This does some magic with lvl/exp? - ld a, [wLoadedMonLevel] ; Load level + +CalcExpToLevelUp: ; 12c86 (4:6c86) + ld a, [wLoadedMonLevel] cp MAX_LEVEL - jr z, .asm_12ca7 ; If 100 + jr z, .atMaxLevel inc a ld d, a callab CalcExperience ld hl, wLoadedMonExp + 2 - ld a, [$ff98] + ld a, [hExperience + 2] sub [hl] ld [hld], a - ld a, [$ff97] + ld a, [hExperience + 1] sbc [hl] ld [hld], a - ld a, [$ff96] + ld a, [hExperience] sbc [hl] ld [hld], a ret -.asm_12ca7 +.atMaxLevel ld hl, wLoadedMonExp xor a ld [hli], a @@ -459,11 +460,9 @@ StatusScreen2: ; 12b57 (4:6b57) ld [hl], a ret -EXPPointsText: ; 12caf (4:6caf) - db "EXP POINTS", $4e - -LevelUpText: ; 12cba (4:6cba) - db "LEVEL UP@" +StatusScreenExpText: ; 12caf (4:6caf) + db "EXP POINTS" + next "LEVEL UP@" StatusScreen_ClearName: ; 12cc3 (4:6cc3) ld bc, 10 diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index c7b2f4d6..9b9b1c7e 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -19,9 +19,9 @@ SetDefaultNames: ; 60ca (1:60ca) ld [W_OPTIONS], a pop af ld [wLetterPrintingDelayFlags], a - ld a, [wd08a] + ld a, [wOptionsInitialized] and a - call z, Func_5bff + call z, InitOptions ld hl, NintenText ld de, wPlayerName ld bc, $b diff --git a/engine/oam_dma.asm b/engine/oam_dma.asm index bd89677a..7326445e 100644 --- a/engine/oam_dma.asm +++ b/engine/oam_dma.asm @@ -15,7 +15,7 @@ WriteDMACodeToHRAM: DMARoutine: ; initiate DMA ld a, wOAMBuffer / $100 - ld [$ff46], a + ld [rDMA], a ; wait for DMA to finish ld a, $28 diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 910fcf04..3fb4ffca 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -1,9 +1,9 @@ HiddenItems: ; 76688 (1d:6688) ld hl, HiddenItemCoords - call Func_76857 - ld [wTrainerScreenX], a - ld hl, wd6f0 - ld a, [wTrainerScreenX] + call FindHiddenItemOrCoinsIndex + ld [wHiddenItemOrCoinsIndex], a + ld hl, wObtainedHiddenItemsFlags + ld a, [wHiddenItemOrCoinsIndex] ld c, a ld b, $2 predef FlagActionPredef @@ -11,9 +11,9 @@ HiddenItems: ; 76688 (1d:6688) and a ret nz call EnableAutoTextBoxDrawing - ld a, $1 + ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld a, [wWhichTrade] ; item ID + ld a, [wHiddenObjectFunctionArgument] ; item ID ld [wd11e], a call GetItemName tx_pre_jump FoundHiddenItemText @@ -23,12 +23,12 @@ INCLUDE "data/hidden_item_coords.asm" FoundHiddenItemText: ; 7675b (1d:675b) TX_FAR _FoundHiddenItemText TX_ASM - ld a, [wWhichTrade] ; item ID + ld a, [wHiddenObjectFunctionArgument] ; item ID ld b, a ld c, 1 call GiveItem jr nc, .BagFull - ld hl, wd6f0 + ld hl, wObtainedHiddenItemsFlags ld a, [wTrainerScreenX] ld c, a ld b, $1 @@ -56,10 +56,10 @@ HiddenCoins: ; 76799 (1d:6799) and a ret z ld hl, HiddenCoinCoords - call Func_76857 - ld [wTrainerScreenX], a - ld hl, wd6fe - ld a, [wTrainerScreenX] + call FindHiddenItemOrCoinsIndex + ld [wHiddenItemOrCoinsIndex], a + ld hl, wObtainedHiddenCoinsFlags + ld a, [wHiddenItemOrCoinsIndex] ld c, a ld b, $2 predef FlagActionPredef @@ -70,7 +70,7 @@ HiddenCoins: ; 76799 (1d:6799) ld [hCoins - 1], a ld [hCoins], a ld [hCoins + 1], a - ld a, [wWhichTrade] + ld a, [wHiddenObjectFunctionArgument] sub COIN cp 10 jr z, .bcd10 @@ -99,7 +99,7 @@ HiddenCoins: ; 76799 (1d:6799) ld hl, hCoins + 1 ld c, $2 predef AddBCDPredef - ld hl, wd6fe + ld hl, wObtainedHiddenCoinsFlags ld a, [wTrainerScreenX] ld c, a ld b, $1 @@ -130,31 +130,31 @@ DroppedHiddenCoinsText: ; 7684d (1d:684d) TX_FAR _DroppedHiddenCoinsText db "@" -Func_76857: ; 76857 (1d:6857) - ld a, [wTrainerScreenY] +FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857) + ld a, [wHiddenObjectY] ld d, a - ld a, [wTrainerScreenX] + ld a, [wHiddenObjectX] ld e, a ld a, [W_CURMAP] ld b, a - ld c, $ff + ld c, -1 .loop inc c ld a, [hli] cp $ff ; end of the list? ret z ; if so, we're done here cp b - jr nz, .asm_76877 + jr nz, .next1 ld a, [hli] cp d - jr nz, .asm_76878 + jr nz, .next2 ld a, [hli] cp e jr nz, .loop ld a, c ret -.asm_76877 +.next1 inc hl -.asm_76878 +.next2 inc hl jr .loop diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index ae67aeed..cabfc093 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -1,4 +1,4 @@ -Func_46981: ; 46981 (11:6981) +IsPlayerOnDungeonWarp: ; 46981 (11:6981) xor a ld [wWhichDungeonWarp], a ld a, [wd72d] @@ -6,7 +6,7 @@ Func_46981: ; 46981 (11:6981) ret nz call ArePlayerCoordsInArray ret nc - ld a, [wWhichTrade] + ld a, [wCoordIndex] ld [wWhichDungeonWarp], a ld hl, wd72d set 4, [hl] @@ -58,7 +58,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0) ld [wHiddenObjectX], a ld c, a call CheckIfCoordsInFrontOfPlayerMatch - ld a, [$ffea] + ld a, [hCoordsInFrontOfPlayerMatch] and a jr z, .foundMatchingObject inc hl @@ -85,7 +85,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0) ret ; checks if the coordinates in front of the player's sprite match Y in b and X in c -; [$ffea] = $00 if they match, $ff if they don't match +; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01) ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction cp SPRITE_FACING_UP @@ -127,7 +127,7 @@ CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01) .didNotMatch ld a, $ff .done - ld [$ffea], a + ld [hCoordsInFrontOfPlayerMatch], a ret INCLUDE "data/hidden_objects.asm" diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 89b09bba..f618261e 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -210,9 +210,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) .moveDown ld de, 2*SCREEN_WIDTH add hl, de ; move tile pointer two rows down - ld de, $100 - - ld bc, $400 + lb de, 1, 0 + lb bc, 4, SPRITE_FACING_DOWN jr TryWalking .notDown cp $80 ; $40 <= a < $80: up (or right) @@ -223,8 +222,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) .moveUp ld de, -2*SCREEN_WIDTH add hl, de ; move tile pointer two rows up - ld de, $ff00 - ld bc, $804 + lb de, -1, 0 + lb bc, 8, SPRITE_FACING_UP jr TryWalking .notUp cp $c0 ; $80 <= a < $c0: left (or up) @@ -235,8 +234,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) .moveLeft dec hl dec hl ; move tile pointer two columns left - ld de, $ff - ld bc, $208 + lb de, 0, -1 + lb bc, 2, SPRITE_FACING_LEFT jr TryWalking .notLeft ; $c0 <= a: right (or down) ld a, [wCurSpriteMovement2] @@ -245,8 +244,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) .moveRight inc hl inc hl ; move tile pointer two columns right - ld de, $1 - ld bc, $10c + lb de, 0, 1 + lb bc, 1, SPRITE_FACING_RIGHT jr TryWalking ; changes facing direction by zeroing the movement delta and calling TryWalking diff --git a/engine/palettes.asm b/engine/palettes.asm index a9160d21..a325e0a3 100755 --- a/engine/palettes.asm +++ b/engine/palettes.asm @@ -328,10 +328,10 @@ SendSGBPacket: ; 71feb (1c:5feb) ld [$fff9],a ; send RESET signal (P14=LOW, P15=LOW) xor a - ld [$ff00],a + ld [rJOYP],a ; set P14=HIGH, P15=HIGH ld a,$30 - ld [$ff00],a + ld [rJOYP],a ;load length of packets (16 bytes) ld b,$10 .nextByte @@ -348,10 +348,10 @@ SendSGBPacket: ; 71feb (1c:5feb) ; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0) ld a,$20 .next0 - ld [$ff00],a + ld [rJOYP],a ; must set P14=HIGH,P15=HIGH between each "pulse" ld a,$30 - ld [$ff00],a + ld [rJOYP],a ; rotation will put next bit in 0th position (so we can always use command ; "bit 0,d" to fetch the bit that has to be sent) rr d @@ -362,10 +362,10 @@ SendSGBPacket: ; 71feb (1c:5feb) jr nz,.nextByte ; send bit 1 as a "stop bit" (end of parameter data) ld a,$20 - ld [$ff00],a + ld [rJOYP],a ; set P14=HIGH,P15=HIGH ld a,$30 - ld [$ff00],a + ld [rJOYP],a xor a ld [$fff9],a ; wait for about 70000 cycles @@ -448,38 +448,38 @@ CheckSGB: ; 7209b (1c:609b) ld [$fff9], a ei call Wait7000 - ld a, [rJOYP] ; $ff0 + ld a, [rJOYP] and $3 cp $3 jr nz, .asm_720fd ld a, $20 - ld [rJOYP], a ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 + ld [rJOYP], a + ld a, [rJOYP] + ld a, [rJOYP] call Wait7000 call Wait7000 ld a, $30 - ld [rJOYP], a ; $ff0 + ld [rJOYP], a call Wait7000 call Wait7000 ld a, $10 - ld [rJOYP], a ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 + ld [rJOYP], a + ld a, [rJOYP] + ld a, [rJOYP] + ld a, [rJOYP] + ld a, [rJOYP] + ld a, [rJOYP] + ld a, [rJOYP] call Wait7000 call Wait7000 ld a, $30 - ld [rJOYP], a ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 - ld a, [rJOYP] ; $ff0 + ld [rJOYP], a + ld a, [rJOYP] + ld a, [rJOYP] + ld a, [rJOYP] call Wait7000 call Wait7000 - ld a, [rJOYP] ; $ff0 + ld a, [rJOYP] and $3 cp $3 jr nz, .asm_720fd diff --git a/engine/predefs.asm b/engine/predefs.asm index 17f94b73..73a22ad9 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -111,7 +111,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef InternalClockTradeAnim add_predef TrainerEngage add_predef IndexToPokedex - add_predef DisplayPicCenteredOrUpperRight; 3B display pic? + add_predef DisplayPicCenteredOrUpperRight add_predef UsedCut add_predef ShowPokedexData add_predef WriteMonMoves @@ -128,15 +128,15 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef DrawEnemyHUDAndHPBar add_predef LoadTownMap_Nest add_predef PrintMonType - add_predef EmotionBubble; 4C player exclamation + add_predef EmotionBubble add_predef EmptyFunc3; return immediately add_predef AskName add_predef PewterGuys add_predef SaveSAVtoSRAM2 - add_predef LoadSAVCheckSum2 + add_predef LoadSAV2 add_predef LoadSAV add_predef SaveSAVtoSRAM1 - add_predef DoInGameTradeDialogue ; 54 initiate trade + add_predef DoInGameTradeDialogue add_predef HallOfFamePC add_predef DisplayDexRating dbw $1E, _LeaveMapAnim ; wrong bank diff --git a/engine/save.asm b/engine/save.asm index 56468595..7265fa3c 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -4,11 +4,11 @@ LoadSAV: ; 735e8 (1c:75e8) call ClearScreen call LoadFontTilePatterns call LoadTextBoxTilePatterns - call LoadSAVCheckSum + call LoadSAV0 jr c, .badsum - call LoadSAVCheckSum1 + call LoadSAV1 jr c, .badsum - call LoadSAVCheckSum2 + call LoadSAV2 jr c, .badsum ld a, $2 ; good checksum jr .goodsum @@ -24,14 +24,14 @@ LoadSAV: ; 735e8 (1c:75e8) res 6, [hl] ld a, $1 ; bad checksum .goodsum - ld [wd088], a ; checksum flag + ld [wSaveFileStatus], a ret FileDataDestroyedText: ; 7361e (1c:761e) TX_FAR _FileDataDestroyedText db "@" -LoadSAVCheckSum: ; 73623 (1c:7623) +LoadSAV0: ; 73623 (1c:7623) ld a, SRAM_ENABLE ld [MBC1SRamEnable], a ld a, $1 @@ -43,7 +43,9 @@ LoadSAVCheckSum: ; 73623 (1c:7623) ld c, a ld a, [sMainDataCheckSum] ; SAV's checksum cp c - jp z, .Func_73652 + jp z, .checkSumsMatched + +; If the computed checksum didn't match the saved on, try again. ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum @@ -52,7 +54,7 @@ LoadSAVCheckSum: ; 73623 (1c:7623) cp c jp nz, SAVBadCheckSum -.Func_73652 ; 73652 (1c:7652) +.checkSumsMatched ld hl, sPlayerName ld de, wPlayerName ld bc, 11 @@ -76,7 +78,7 @@ LoadSAVCheckSum: ; 73623 (1c:7623) and a jp SAVGoodChecksum -LoadSAVCheckSum1: ; 73690 (1c:7690) +LoadSAV1: ; 73690 (1c:7690) ld a, SRAM_ENABLE ld [MBC1SRamEnable], a ld a, $1 @@ -96,7 +98,7 @@ LoadSAVCheckSum1: ; 73690 (1c:7690) and a jp SAVGoodChecksum -LoadSAVCheckSum2: ; 736bd (1c:76bd) +LoadSAV2: ; 736bd (1c:76bd) ld a, SRAM_ENABLE ld [MBC1SRamEnable], a ld a, $1 @@ -129,10 +131,11 @@ SAVGoodChecksum: ; 736f8 (1c:76f8) ld [MBC1SRamEnable], a ret -Func_73701: ; 73701 (1c:7701) - call LoadSAVCheckSum - call LoadSAVCheckSum1 - jp LoadSAVCheckSum2 +LoadSAVIgnoreBadCheckSum: ; 73701 (1c:7701) +; unused function that loads save data and ignores bad checksums + call LoadSAV0 + call LoadSAV1 + jp LoadSAV2 SaveSAV: ; 7370a (1c:770a) callba PrintSaveScreenText @@ -140,7 +143,7 @@ SaveSAV: ; 7370a (1c:770a) call SaveSAVConfirm and a ;|0 = Yes|1 = No| ret nz - ld a,[wd088] + ld a,[wSaveFileStatus] dec a jr z,.save call SAVCheckRandomID @@ -270,14 +273,14 @@ SaveSAVtoSRAM2: ; 7380f (1c:780f) SaveSAVtoSRAM: ; 73848 (1c:7848) ld a, $2 - ld [wd088], a + ld [wSaveFileStatus], a call SaveSAVtoSRAM0 call SaveSAVtoSRAM1 jp SaveSAVtoSRAM2 SAVCheckSum: ; 73856 (1c:7856) ;Check Sum (result[1 byte] is complemented) - ld d, $0 + ld d, 0 .loop ld a, [hli] add d @@ -290,11 +293,11 @@ SAVCheckSum: ; 73856 (1c:7856) cpl ret -Func_73863: ; 73863 (1c:7863) +CalcIndividualBoxCheckSums: ; 73863 (1c:7863) ld hl, sBox1 ; sBox7 - ld de, sBoxes1CheckSum2 ; sBoxes2CheckSum2 + ld de, sBank2IndividualBoxChecksums ; sBank3IndividualBoxChecksums ld b, NUM_BOXES / 2 -.asm_7386b +.loop push bc push de ld bc, wBoxMonNicksEnd - W_NUMINBOX @@ -304,21 +307,23 @@ Func_73863: ; 73863 (1c:7863) inc de pop bc dec b - jr nz, .asm_7386b + jr nz, .loop ret -Func_7387b: ; 7387b (1c:787b) - ld hl, PointerTable_73895 +GetBoxSRAMLocation: ; 7387b (1c:787b) +; in: a = box num +; out: b = box SRAM bank, hl = pointer to start of box + ld hl, BoxSRAMPointerTable ld a, [wCurrentBoxNum] and $7f cp NUM_BOXES / 2 - ld b, $2 - jr c, .asm_7388c + ld b, 2 + jr c, .next inc b sub NUM_BOXES / 2 -.asm_7388c +.next ld e, a - ld d, $0 + ld d, 0 add hl, de add hl, de ld a, [hli] @@ -326,7 +331,7 @@ Func_7387b: ; 7387b (1c:787b) ld l, a ret -PointerTable_73895: ; 73895 (1c:7895) +BoxSRAMPointerTable: ; 73895 (1c:7895) dw sBox1 ; sBox7 dw sBox2 ; sBox8 dw sBox3 ; sBox9 @@ -342,9 +347,9 @@ ChangeBox:: ; 738a1 (1c:78a1) and a ret nz ; return if No was chosen ld hl, wCurrentBoxNum - bit 7, [hl] - call z, Func_73a29 - call Func_7393f + bit 7, [hl] ; is it the first time player is changing the box? + call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM + call DisplayChangeBoxMenu call UpdateSprites ld hl, hFlags_0xFFF6 set 1, [hl] @@ -353,17 +358,17 @@ ChangeBox:: ; 738a1 (1c:78a1) res 1, [hl] bit 1, a ret nz - call Func_7387b + call GetBoxSRAMLocation ld e, l ld d, h ld hl, W_NUMINBOX - call Func_7390e + call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] set 7, a ld [wCurrentBoxNum], a - call Func_7387b + call GetBoxSRAMLocation ld de, W_NUMINBOX - call Func_7390e + call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM ld hl, W_MAPTEXTPTR ld de, wChangeBoxSavedMapTextPointer ld a, [hli] @@ -384,7 +389,8 @@ WhenYouChangeBoxText: ; 73909 (1c:7909) TX_FAR _WhenYouChangeBoxText db "@" -Func_7390e: ; 7390e (1c:790e) +CopyBoxToOrFromSRAM: ; 7390e (1c:790e) +; copy an entire box from hl to de with b as the SRAM bank push hl ld a, SRAM_ENABLE ld [MBC1SRamEnable], a @@ -395,30 +401,33 @@ Func_7390e: ; 7390e (1c:790e) ld bc, wBoxMonNicksEnd - W_NUMINBOX call CopyData pop hl + +; mark the memory that the box was copied from as am empty box xor a ld [hli], a dec a ld [hl], a + ld hl, sBox1 ; sBox7 - ld bc, sBoxes1CheckSum - sBox1 + ld bc, sBank2AllBoxesChecksum - sBox1 call SAVCheckSum - ld [sBoxes1CheckSum], a ; sBoxes2CheckSum - call Func_73863 + ld [sBank2AllBoxesChecksum], a ; sBank3AllBoxesChecksum + call CalcIndividualBoxCheckSums xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a ret -Func_7393f: ; 7393f (1c:793f) +DisplayChangeBoxMenu: ; 7393f (1c:793f) xor a ld [H_AUTOBGTRANSFERENABLED], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, $b + ld a, 11 ld [wMaxMenuItem], a - ld a, $1 + ld a, 1 ld [wTopMenuItemY], a - ld a, $c + ld a, 12 ld [wTopMenuItemX], a xor a ld [wMenuWatchMovingOutOfBounds], a @@ -427,14 +436,14 @@ Func_7393f: ; 7393f (1c:793f) ld [wCurrentMenuItem], a ld [wLastMenuItem], a coord hl, 0, 0 - ld b, $2 - ld c, $9 + ld b, 2 + ld c, 9 call TextBoxBorder ld hl, ChooseABoxText call PrintText coord hl, 11, 0 - ld b, $c - ld c, $7 + ld b, 12 + ld c, 7 call TextBoxBorder ld hl, hFlags_0xFFF6 set 2, [hl] @@ -446,37 +455,37 @@ Func_7393f: ; 7393f (1c:793f) ld a, [wCurrentBoxNum] and $7f cp 9 - jr c, .asm_739a6 + jr c, .singleDigitBoxNum sub 9 coord hl, 8, 2 ld [hl], "1" add "0" - jr .asm_739a8 -.asm_739a6 + jr .next +.singleDigitBoxNum add "1" -.asm_739a8 +.next Coorda 9, 2 coord hl, 1, 2 ld de, BoxNoText call PlaceString - call Func_73a84 + call GetMonCountsForAllBoxes coord hl, 18, 1 - ld de, wWhichTrade + ld de, wBoxMonCounts ld bc, SCREEN_WIDTH ld a, $c -.asm_739c2 +.loop push af ld a, [de] - and a - jr z, .asm_739c9 - ld [hl], $78 -.asm_739c9 + and a ; is the box empty? + jr z, .skipPlacingPokeball + ld [hl], $78 ; place pokeball tile next to box name if box not empty +.skipPlacingPokeball add hl, bc inc de pop af dec a - jr nz, .asm_739c2 - ld a, $1 + jr nz, .loop + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a ret @@ -501,51 +510,54 @@ BoxNames: ; 739d9 (1c:79d9) BoxNoText: ; 73a21 (1c:7a21) db "BOX No.@" -Func_73a29: ; 73a29 (1c:7a29) +EmptyAllSRAMBoxes: ; 73a29 (1c:7a29) +; marks all boxes in SRAM as empty (initialisation for the first time the +; player changes the box) ld a, SRAM_ENABLE ld [MBC1SRamEnable], a ld a, $1 ld [MBC1SRamBankingMode], a - ld a, $2 + ld a, 2 ld [MBC1SRamBank], a - call Func_73a4b - ld a, $3 + call EmptySRAMBoxesInBank + ld a, 3 ld [MBC1SRamBank], a - call Func_73a4b + call EmptySRAMBoxesInBank xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a ret -Func_73a4b: ; 73a4b (1c:7a4b) +EmptySRAMBoxesInBank: ; 73a4b (1c:7a4b) +; marks every box in the current SRAM bank as empty ld hl, sBox1 ; sBox7 - call Func_73a7f + call EmptySRAMBox ld hl, sBox2 ; sBox8 - call Func_73a7f + call EmptySRAMBox ld hl, sBox3 ; sBox9 - call Func_73a7f + call EmptySRAMBox ld hl, sBox4 ; sBox10 - call Func_73a7f + call EmptySRAMBox ld hl, sBox5 ; sBox11 - call Func_73a7f + call EmptySRAMBox ld hl, sBox6 ; sBox12 - call Func_73a7f + call EmptySRAMBox ld hl, sBox1 ; sBox7 - ld bc, sBoxes1CheckSum - sBox1 + ld bc, sBank2AllBoxesChecksum - sBox1 call SAVCheckSum - ld [sBoxes1CheckSum], a ; sBoxes2CheckSum - call Func_73863 + ld [sBank2AllBoxesChecksum], a ; sBank3AllBoxesChecksum + call CalcIndividualBoxCheckSums ret -Func_73a7f: ; 73a7f (1c:7a7f) +EmptySRAMBox: ; 73a7f (1c:7a7f) xor a ld [hli], a dec a ld [hl], a ret -Func_73a84: ; 73a84 (1c:7a84) - ld hl, wWhichTrade +GetMonCountsForAllBoxes: ; 73a84 (1c:7a84) + ld hl, wBoxMonCounts push hl ld a, SRAM_ENABLE ld [MBC1SRamEnable], a @@ -553,24 +565,27 @@ Func_73a84: ; 73a84 (1c:7a84) ld [MBC1SRamBankingMode], a ld a, $2 ld [MBC1SRamBank], a - call Func_73ab8 + call GetMonCountsForBoxesInBank ld a, $3 ld [MBC1SRamBank], a - call Func_73ab8 + call GetMonCountsForBoxesInBank xor a ld [MBC1SRamBankingMode], a ld [MBC1SRamEnable], a pop hl + +; copy the count for the current box from WRAM ld a, [wCurrentBoxNum] and $7f ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [W_NUMINBOX] ld [hl], a + ret -Func_73ab8: ; 73ab8 (1c:7ab8) +GetMonCountsForBoxesInBank: ; 73ab8 (1c:7ab8) ld a, [sBox1] ; sBox7 ld [hli], a ld a, [sBox2] ; sBox8 @@ -646,7 +661,7 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) LoadHallOfFameTeams: ; 73b3f (1c:7b3f) ld hl, sHallOfFame ld bc, HOF_TEAM - ld a, [wWhichTrade] + ld a, [wHoFTeamIndex] call AddNTimes ld de, wcc5b ld bc, HOF_TEAM diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index ea1eb315..cf6ad3d5 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -867,7 +867,7 @@ LoadSlotMachineTiles: ; 378a8 (d:78a8) ld bc, $00f0 call CopyData call EnableLCD - ld hl, wTrainerEngageDistance + ld hl, wSlotMachineWheel1Offset ld a, $1c ld [hli], a ld [hli], a diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 3a4e2e4c..5acdd2c9 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -21,7 +21,7 @@ SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) ld [wc0ef], a ld [wc0f0], a -LoadTitlescreenGraphics: ; 42dd (1:42dd) +DisplayTitleScreen: ; 42dd (1:42dd) call GBPalWhiteOut ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a diff --git a/home/init.asm b/home/init.asm index 932797ac..3e8d1d2b 100644 --- a/home/init.asm +++ b/home/init.asm @@ -23,17 +23,17 @@ rLCDC_DEFAULT EQU %11100011 xor a ld [rIF], a ld [rIE], a - ld [$ff43], a - ld [$ff42], a + ld [rSCX], a + ld [rSCY], a ld [rSB], a ld [rSC], a ld [rWX], a - ld [$ff4a], a - ld [$ff06], a - ld [$ff07], a + ld [rWY], a + ld [rTMA], a + ld [rTAC], a ld [rBGP], a ld [rOBP0], a - ld [$ff49], a + ld [rOBP1], a ld a, rLCDC_ENABLE_MASK ld [rLCDC], a @@ -66,10 +66,10 @@ rLCDC_DEFAULT EQU %11100011 xor a ld [hTilesetType], a - ld [$ff41], a + ld [rSTAT], a ld [hSCX], a ld [hSCY], a - ld [$ff0f], a + ld [rIF], a ld a, 1 << VBLANK + 1 << TIMER + 1 << SERIAL ld [rIE], a diff --git a/hram.asm b/hram.asm index a05f3d18..8bbf7150 100644 --- a/hram.asm +++ b/hram.asm @@ -90,6 +90,8 @@ hNPCSpriteOffset EQU $FF95 ; temp value used when swapping bytes hSwapTemp EQU $FF95 +hExperience EQU $FF96 ; 3 bytes, big endian + ; Multiplcation and division variables are meant ; to overlap for back-to-back usage. Big endian. @@ -261,6 +263,8 @@ hQuotient2 EQU $FFE7 hSpriteVRAMSlotAndFacing EQU $FFE9 +hCoordsInFrontOfPlayerMatch EQU $FFEA + hSpriteAnimFrameCounter EQU $FFEA H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn diff --git a/macros.asm b/macros.asm index 5f1deaf6..ba83e73a 100644 --- a/macros.asm +++ b/macros.asm @@ -14,7 +14,7 @@ dex EQUS "db $5f, $50" ; End a Pokedex entry. percent EQUS "* $ff / 100" lb: MACRO ; r, hi, lo - ld \1, (\2) << 8 + (\3) + ld \1, (\2) << 8 + ((\3) & $ff) ENDM diff --git a/main.asm b/main.asm index 08747a5a..c90f5436 100755 --- a/main.asm +++ b/main.asm @@ -3743,7 +3743,7 @@ _AddPartyMon: ; f2e5 (3:72e5) dec de dec de xor a - ld [wHPBarMaxHP], a + ld [wLearningMovesFromDayCare], a predef WriteMonMoves pop de ld a, [wPlayerID] ; set trainer ID to player ID @@ -3758,13 +3758,13 @@ _AddPartyMon: ; f2e5 (3:72e5) callab CalcExperience pop de inc de - ld a, [H_MULTIPLICAND] ; write experience + ld a, [hExperience] ; write experience ld [de], a inc de - ld a, [H_MULTIPLICAND+1] + ld a, [hExperience + 1] ld [de], a inc de - ld a, [H_MULTIPLICAND+2] + ld a, [hExperience + 2] ld [de], a xor a ld b, $a diff --git a/scripts/agatha.asm b/scripts/agatha.asm index e65b1fa2..850cc0bb 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -67,7 +67,7 @@ AgathaScript0: ; 76490 (1d:6490) ld [hJoyHeld], a ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $3 jr c, .asm_764b4 ld hl, wd865 diff --git a/scripts/bruno.asm b/scripts/bruno.asm index bd28917c..76a5919a 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -67,7 +67,7 @@ BrunoScript0: ; 76339 (1d:6339) ld [hJoyHeld], a ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $3 jr c, .asm_7635d ld hl, wd864 diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 20873a81..2c7bd449 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -42,7 +42,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8) ld hl, CeruleanCityCoords1 call ArePlayerCoordsInArray jr nc, .asm_194f7 - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 ld a, $8 ld b, SPRITE_FACING_DOWN diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 330f2234..794d681e 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -9,19 +9,19 @@ DayCareMText1: ; 56254 (15:6254) call SaveScreenTilesToBuffer2 ld a, [W_DAYCARE_IN_USE] and a - jp nz, DayCareMScript_562e1 - ld hl, DayCareMText_5640f + jp nz, .daycareInUse + ld hl, DayCareIntroText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - ld hl, DayCareMText_5643b - jp nz, DayCareMScript_56409 + ld hl, DayCareComeAgainText + jp nz, .done ld a, [wPartyCount] dec a - ld hl, DayCareMText_56445 - jp z, DayCareMScript_56409 - ld hl, DayCareMText_56414 + ld hl, DayCareOnlyHaveOneMonText + jp z, .done + ld hl, DayCareWhichMonText call PrintText xor a ld [wUpdateSpritesEnabled], a @@ -33,17 +33,17 @@ DayCareMText1: ; 56254 (15:6254) call RestoreScreenTilesAndReloadTilePatterns call LoadGBPal pop af - ld hl, DayCareMText_56437 - jp c, DayCareMScript_56409 + ld hl, DayCareAllRightThenText + jp c, .done callab KnowsHMMove - ld hl, DayCareMText_5644a - jp c, DayCareMScript_56409 + ld hl, DayCareCantAcceptMonWithHMText + jp c, .done xor a ld [wPartyAndBillsPCSavedMenuItem], a ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName - ld hl, DayCareMText_56419 + ld hl, DayCareWillLookAfterMonText call PrintText ld a, 1 ld [W_DAYCARE_IN_USE], a @@ -55,10 +55,10 @@ DayCareMText1: ; 56254 (15:6254) call RemovePokemon ld a, [wcf91] call PlayCry - ld hl, DayCareMText_5641e - jp DayCareMScript_56409 + ld hl, DayCareComeSeeMeInAWhileText + jp .done -DayCareMScript_562e1: ; 562e1 (15:62e1) +.daycareInUse xor a ld hl, W_DAYCAREMONNAME call GetPartyMonName @@ -68,40 +68,41 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) callab CalcLevelFromExperience ld a, d cp MAX_LEVEL - jr c, .asm_56315 + jr c, .skipCalcExp + ld d, MAX_LEVEL callab CalcExperience ld hl, wDayCareMonExp - ld a, [H_NUMTOPRINT] + ld a, [hExperience] ld [hli], a - ld a, [$ff97] + ld a, [hExperience + 1] ld [hli], a - ld a, [$ff98] + ld a, [hExperience + 2] ld [hl], a ld d, MAX_LEVEL -.asm_56315 +.skipCalcExp xor a - ld [wTrainerEngageDistance], a + ld [wDayCareNumLevelsGrown], a ld hl, wDayCareMonBoxLevel ld a, [hl] - ld [wTrainerSpriteOffset], a + ld [wDayCareStartLevel], a cp d ld [hl], d - ld hl, DayCareMText_56432 - jr z, .asm_56333 - ld a, [wTrainerSpriteOffset] + ld hl, DayCareMonNeedsMoreTimeText + jr z, .next + ld a, [wDayCareStartLevel] ld b, a ld a, d sub b - ld [wTrainerEngageDistance], a - ld hl, DayCareMText_56423 + ld [wDayCareNumLevelsGrown], a + ld hl, DayCareMonHasGrownText -.asm_56333 +.next call PrintText ld a, [wPartyCount] cp PARTY_LENGTH - ld hl, DayCareMText_56440 + ld hl, DayCareNoRoomForMonText jp z, .asm_56403 ld de, wTrainerFacingDirection xor a @@ -112,7 +113,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld a, $1 ld [hli], a ld [hl], $0 - ld a, [wTrainerEngageDistance] + ld a, [wDayCareNumLevelsGrown] inc a ld b, a ld c, $2 @@ -126,13 +127,13 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) pop hl dec b jr nz, .asm_56357 - ld hl, DayCareMText_56428 + ld hl, DayCareOweMoneyText call PrintText ld a, $13 ld [wTextBoxID], a call DisplayTextBoxID call YesNoChoice - ld hl, DayCareMText_56437 + ld hl, DayCareAllRightThenText ld a, [wCurrentMenuItem] and a jp nz, .asm_56403 @@ -144,13 +145,13 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld [hMoney + 2], a call HasEnoughMoney jr nc, .asm_56396 - ld hl, DayCareMText_56454 + ld hl, DayCareNotEnoughMoneyText jp .asm_56403 .asm_56396 xor a ld [W_DAYCARE_IN_USE], a - ld hl, wTrainerEngageDistance + ld hl, wDayCareNumLevelsGrown ld [hli], a inc hl ld de, wPlayerMoney + 2 @@ -161,7 +162,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID - ld hl, DayCareMText_5644f + ld hl, DayCareHeresYourMonText call PrintText ld a, DAYCARE_TO_PARTY ld [wMoveMonType], a @@ -178,10 +179,12 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld d, h ld e, l ld a, 1 - ld [wHPBarMaxHP], a + ld [wLearningMovesFromDayCare], a predef WriteMonMoves pop bc pop af + +; set mon's HP to max ld hl, wPartyMon1HP call AddNTimes ld d, h @@ -193,73 +196,74 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) inc de ld a, [hl] ld [de], a + ld a, [wcf91] call PlayCry - ld hl, DayCareMText_5642d - jr DayCareMScript_56409 + ld hl, DayCareGotMonBackText + jr .done .asm_56403 - ld a, [wTrainerSpriteOffset] + ld a, [wDayCareStartLevel] ld [wDayCareMonBoxLevel], a -DayCareMScript_56409: ; 56409 (15:6409) +.done call PrintText jp TextScriptEnd -DayCareMText_5640f: ; 5640f (15:640f) - TX_FAR _DayCareMText_5640f +DayCareIntroText: ; 5640f (15:640f) + TX_FAR _DayCareIntroText db "@" -DayCareMText_56414: ; 56414 (15:6414) - TX_FAR _DayCareMText_56414 +DayCareWhichMonText: ; 56414 (15:6414) + TX_FAR _DayCareWhichMonText db "@" -DayCareMText_56419: ; 56419 (15:6419) - TX_FAR _DayCareMText_56419 +DayCareWillLookAfterMonText: ; 56419 (15:6419) + TX_FAR _DayCareWillLookAfterMonText db "@" -DayCareMText_5641e: ; 5641e (15:641e) - TX_FAR _DayCareMText_5641e +DayCareComeSeeMeInAWhileText: ; 5641e (15:641e) + TX_FAR _DayCareComeSeeMeInAWhileText db "@" -DayCareMText_56423: ; 56423 (15:6423) - TX_FAR _DayCareMText_56423 +DayCareMonHasGrownText: ; 56423 (15:6423) + TX_FAR _DayCareMonHasGrownText db "@" -DayCareMText_56428: ; 56428 (15:6428) - TX_FAR _DayCareMText_56428 +DayCareOweMoneyText: ; 56428 (15:6428) + TX_FAR _DayCareOweMoneyText db "@" -DayCareMText_5642d: ; 5642d (15:642d) - TX_FAR _DayCareMText_5642d +DayCareGotMonBackText: ; 5642d (15:642d) + TX_FAR _DayCareGotMonBackText db "@" -DayCareMText_56432: ; 56432 (15:6432) - TX_FAR _DayCareMText_56432 +DayCareMonNeedsMoreTimeText: ; 56432 (15:6432) + TX_FAR _DayCareMonNeedsMoreTimeText db "@" -DayCareMText_56437: ; 56437 (15:6437) - TX_FAR _DayCareMText_56437 -DayCareMText_5643b: ; 5643b (15:643b) - TX_FAR _DayCareMText_5643b +DayCareAllRightThenText: ; 56437 (15:6437) + TX_FAR _DayCareAllRightThenText +DayCareComeAgainText: ; 5643b (15:643b) + TX_FAR _DayCareComeAgainText db "@" -DayCareMText_56440: ; 56440 (15:6440) - TX_FAR _DayCareMText_56440 +DayCareNoRoomForMonText: ; 56440 (15:6440) + TX_FAR _DayCareNoRoomForMonText db "@" -DayCareMText_56445: ; 56445 (15:6445) - TX_FAR _DayCareMText_56445 +DayCareOnlyHaveOneMonText: ; 56445 (15:6445) + TX_FAR _DayCareOnlyHaveOneMonText db "@" -DayCareMText_5644a: ; 5644a (15:644a) - TX_FAR _DayCareMText_5644a +DayCareCantAcceptMonWithHMText: ; 5644a (15:644a) + TX_FAR _DayCareCantAcceptMonWithHMText db "@" -DayCareMText_5644f: ; 5644f (15:644f) - TX_FAR _DayCareMText_5644f +DayCareHeresYourMonText: ; 5644f (15:644f) + TX_FAR _DayCareHeresYourMonText db "@" -DayCareMText_56454: ; 56454 (15:6454) - TX_FAR _DayCareMText_56454 +DayCareNotEnoughMoneyText: ; 56454 (15:6454) + TX_FAR _DayCareNotEnoughMoneyText db "@" diff --git a/scripts/lance.asm b/scripts/lance.asm index e335914b..a4089be4 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -60,7 +60,7 @@ LanceScript0: ; 5a305 (16:6305) jp nc, CheckFightingMapTrainers xor a ld [hJoyHeld], a - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $3 jr nc, .asm_5a325 ld a, $1 diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index 1f1fcde0..eb6c3e7d 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -68,7 +68,7 @@ LoreleiScript0: ; 761e2 (1d:61e2) ld [hJoyHeld], a ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $3 jr c, .asm_76206 ld hl, wd863 diff --git a/scripts/mansion3.asm b/scripts/mansion3.asm index fa31718f..c22bf761 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -65,7 +65,7 @@ Mansion3Script_5225b: ; 5225b (14:625b) ret nz call ArePlayerCoordsInArray ret nc - ld a, [wWhichTrade] + ld a, [wCoordIndex] ld [wWhichDungeonWarp], a ld hl, wd72d set 4, [hl] diff --git a/scripts/mtmoonpokecenter.asm b/scripts/mtmoonpokecenter.asm index bba73dbd..d4996b4b 100755 --- a/scripts/mtmoonpokecenter.asm +++ b/scripts/mtmoonpokecenter.asm @@ -25,51 +25,51 @@ MtMoonPokecenterText4: ; 492ec (12:52ec) TX_ASM ld a, [wd7c6] add a - jp c, .asm_49353 + jp c, .alreadyBoughtMagikarp ld hl, MtMoonPokecenterText_4935c call PrintText - ld a, $13 + ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID call YesNoChoice ld a, [wCurrentMenuItem] and a - jp nz, .asm_4934e + jp nz, .choseNo ld [hMoney], a ld [hMoney + 2], a ld a, $5 ld [hMoney + 1], a call HasEnoughMoney - jr nc, .asm_faa09 + jr nc, .enoughMoney ld hl, MtMoonPokecenterText_49366 - jr .asm_49356 -.asm_faa09 + jr .printText +.enoughMoney ld bc,(MAGIKARP << 8) | 5 call GivePokemon - jr nc, .asm_49359 + jr nc, .done xor a - ld [wWhichTrade], a - ld [wTrainerFacingDirection], a + ld [wPriceTemp], a + ld [wPriceTemp + 2], a ld a, $5 - ld [wTrainerEngageDistance], a - ld hl, wTrainerFacingDirection + ld [wPriceTemp + 1], a + ld hl, wPriceTemp + 2 ld de, wPlayerMoney + 2 ld c, $3 predef SubBCDPredef - ld a, $13 + ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID ld hl, wd7c6 set 7, [hl] - jr .asm_49359 -.asm_4934e + jr .done +.choseNo ld hl, MtMoonPokecenterText_49361 - jr .asm_49356 -.asm_49353 + jr .printText +.alreadyBoughtMagikarp ld hl, MtMoonPokecenterText_4936b -.asm_49356 +.printText call PrintText -.asm_49359 +.done jp TextScriptEnd MtMoonPokecenterText_4935c: ; 4935c (12:535c) diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 38c3f717..f4d7de10 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -96,11 +96,11 @@ Museum1FText1: ; 5c135 (17:4135) ld hl, wd754 set 0, [hl] xor a - ld [wMuseumPriceTemp], a - ld [wMuseumPriceTemp + 1], a + ld [wPriceTemp], a + ld [wPriceTemp + 1], a ld a, $50 - ld [wMuseumPriceTemp + 2], a - ld hl, wMuseumPriceTemp + 2 + ld [wPriceTemp + 2], a + ld hl, wPriceTemp + 2 ld de, wPlayerMoney + 2 ld c, $3 predef SubBCDPredef diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 5463b879..226c2d2d 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -307,7 +307,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) ld a, $d ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, [wTrainerEngageDistance] + ld a, [wRivalStarterBallSpriteIndex] cp $2 jr nz, .asm_1cd28 ld a, HS_STARTER_BALL_1 @@ -323,7 +323,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) ld [wcc4d], a predef HideObject call Delay3 - ld a, [wWhichTrade] + ld a, [wRivalStarterTemp] ld [W_RIVALSTARTER], a ld [wcf91], a ld [wd11e], a @@ -806,9 +806,9 @@ OaksLabText29: ; 1d102 (7:5102) OaksLabText2: ; 1d102 (7:5102) TX_ASM ld a, STARTER2 - ld [wWhichTrade], a + ld [wRivalStarterTemp], a ld a, $3 - ld [wTrainerEngageDistance], a + ld [wRivalStarterBallSpriteIndex], a ld a, STARTER1 ld b, $2 jr OaksLabScript_1d133 @@ -817,9 +817,9 @@ OaksLabText30: ; 1d113 (7:5113) OaksLabText3: ; 1d113 (7:5113) TX_ASM ld a, STARTER3 - ld [wWhichTrade], a + ld [wRivalStarterTemp], a ld a, $4 - ld [wTrainerEngageDistance], a + ld [wRivalStarterBallSpriteIndex], a ld a, STARTER2 ld b, $3 jr OaksLabScript_1d133 @@ -828,9 +828,9 @@ OaksLabText31: ; 1d124 (7:5124) OaksLabText4: ; 1d124 (7:5124) TX_ASM ld a, STARTER1 - ld [wWhichTrade], a + ld [wRivalStarterTemp], a ld a, $2 - ld [wTrainerEngageDistance], a + ld [wRivalStarterBallSpriteIndex], a ld a, STARTER3 ld b, $4 @@ -858,13 +858,13 @@ OaksLabScript_1d157: ; 1d157 (7:5157) ld a, $9 ld [H_SPRITEDATAOFFSET], a call GetPointerWithinSpriteStateData1 - ld [hl], $0 + ld [hl], SPRITE_FACING_DOWN ld a, $1 ld [H_SPRITEINDEX], a ld a, $9 ld [H_SPRITEDATAOFFSET], a call GetPointerWithinSpriteStateData1 - ld [hl], $c + ld [hl], SPRITE_FACING_RIGHT ld hl, wd730 set 6, [hl] predef StarterDex ; StarterDex diff --git a/scripts/pewterpokecenter.asm b/scripts/pewterpokecenter.asm index 42bc3086..584878eb 100755 --- a/scripts/pewterpokecenter.asm +++ b/scripts/pewterpokecenter.asm @@ -26,39 +26,45 @@ PewterPokecenterText3: ; 5c59b (17:459b) ld c, 32 call DelayFrames ld hl, JigglypuffFacingDirections - ld de, wTrainerFacingDirection - ld bc, $0004 + ld de, wJigglypuffFacingDirections + ld bc, 4 call CopyData - ld a, [wSpriteStateData1 + $32] - ld hl, wTrainerFacingDirection -.asm_5c5c3 + + ld a, [wSpriteStateData1 + 3 * $10 + $2] + ld hl, wJigglypuffFacingDirections +.findMatchingFacingDirectionLoop cp [hl] inc hl - jr nz, .asm_5c5c3 + jr nz, .findMatchingFacingDirectionLoop dec hl push hl ld c, BANK(Music_JigglypuffSong) ld a, MUSIC_JIGGLYPUFF_SONG call PlayMusic pop hl -.asm_5c5d1 +.loop ld a, [hl] - ld [wSpriteStateData1 + $32], a + ld [wSpriteStateData1 + 3 * $10 + $2], a + +; rotate the array push hl - ld hl, wTrainerFacingDirection - ld de, wTrainerEngageDistance - ld bc, $0004 + ld hl, wJigglypuffFacingDirections + ld de, wJigglypuffFacingDirections - 1 + ld bc, 4 call CopyData - ld a, [wTrainerEngageDistance] - ld [wcd42], a + ld a, [wJigglypuffFacingDirections - 1] + ld [wJigglypuffFacingDirections + 3], a pop hl + ld c, 24 call DelayFrames + ld a, [wc026] ld b, a ld a, [wc027] or b - jr nz, .asm_5c5d1 + jr nz, .loop + ld c, 48 call DelayFrames call PlayDefaultMusic diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm index e89630fc..2e5b55f7 100755 --- a/scripts/safarizoneentrance.asm +++ b/scripts/safarizoneentrance.asm @@ -26,7 +26,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9) ld [hJoyHeld], a ld a, SPRITE_FACING_RIGHT ld [wSpriteStateData1 + 9], a - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr z, .asm_7520f ld a, $2 diff --git a/scripts/seafoamislands1.asm b/scripts/seafoamislands1.asm index 6a8b23ea..f71fc648 100755 --- a/scripts/seafoamislands1.asm +++ b/scripts/seafoamislands1.asm @@ -10,7 +10,7 @@ SeafoamIslands1Script: ; 447e9 (11:47e9) call CheckBoulderCoords ret nc ld hl, wd7e8 - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_44819 set 6, [hl] @@ -36,7 +36,7 @@ SeafoamIslands1Script: ; 447e9 (11:47e9) ld a, $9f ld [wDungeonWarpDestinationMap], a ld hl, Seafoam1HolesCoords - jp Func_46981 + jp IsPlayerOnDungeonWarp Seafoam1HolesCoords: ; 44846 (11:4846) db $06,$11 diff --git a/scripts/seafoamislands2.asm b/scripts/seafoamislands2.asm index 44e92bd0..a62d6bda 100755 --- a/scripts/seafoamislands2.asm +++ b/scripts/seafoamislands2.asm @@ -8,7 +8,7 @@ SeafoamIslands2Script: ; 46315 (11:6315) call CheckBoulderCoords ret nc ld hl, wd87f - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_46340 set 0, [hl] @@ -34,7 +34,7 @@ SeafoamIslands2Script: ; 46315 (11:6315) ld a, $a0 ld [wDungeonWarpDestinationMap], a ld hl, Seafoam2HolesCoords - jp Func_46981 + jp IsPlayerOnDungeonWarp Seafoam2HolesCoords: ; 4636d (11:636d) db $06,$12 diff --git a/scripts/seafoamislands3.asm b/scripts/seafoamislands3.asm index 882553ab..0b650135 100755 --- a/scripts/seafoamislands3.asm +++ b/scripts/seafoamislands3.asm @@ -8,7 +8,7 @@ SeafoamIslands3Script: ; 46451 (11:6451) call CheckBoulderCoords ret nc ld hl, wd880 - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_4647c set 0, [hl] @@ -34,7 +34,7 @@ SeafoamIslands3Script: ; 46451 (11:6451) ld a, $a1 ld [wDungeonWarpDestinationMap], a ld hl, Seafoam3HolesCoords - jp Func_46981 + jp IsPlayerOnDungeonWarp Seafoam3HolesCoords: ; 464a9 (11:64a9) db $06,$13 diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index 8009e221..f16ab2c6 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -8,7 +8,7 @@ SeafoamIslands4Script: ; 4658d (11:658d) call CheckBoulderCoords ret nc ld hl, wd881 - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_465b8 set 0, [hl] @@ -35,7 +35,7 @@ SeafoamIslands4Script: ; 4658d (11:658d) ld a, $a2 ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords - call Func_46981 + call IsPlayerOnDungeonWarp ld a, [wd732] bit 4, a ret nz diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index 47583600..ab303728 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -34,7 +34,7 @@ SeafoamIslands5Script0: ; 467c7 (11:67c7) ld hl, CoordsData_467fe call ArePlayerCoordsInArray ret nc - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $3 jr nc, .asm_467e6 ld a, $40 @@ -81,7 +81,7 @@ SeafoamIslands5Script2: ; 46816 (11:6816) call ArePlayerCoordsInArray ld a, $0 jr nc, .asm_46849 - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_46837 ld de, RLEMovementData_46859 diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 8538d37f..5043b947 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -142,7 +142,7 @@ SilphCo7Script0: ; 51c23 (14:5c23) ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF ld de, MovementData_51c7d - ld a, [wWhichTrade] + ld a, [wCoordIndex] ld [wcf0d], a cp $1 jr z, .asm_51c6c diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index a8cf3b8d..adae2e91 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -57,15 +57,15 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) ld bc, $0078 ld a, $14 call FillMemory - ld a, $1 - ld [$ffba], a + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 xor a - ld [$ffba], a - ld [wWhichTrade], a - ld [$ff49], a - ld a, $58 - ld [wTrainerEngageDistance], a + ld [H_AUTOBGTRANSFERENABLED], a + ld [wSSAnneSmokeDriftAmount], a + ld [rOBP1], a + ld a, 88 + ld [wSSAnneSmokeX], a ld hl, wMapViewVRAMPointer ld c, [hl] inc hl @@ -88,11 +88,11 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) push hl push de call ScheduleEastColumnRedraw - call VermilionDock_1dc59 + call VermilionDock_EmitSmokePuff pop de ld b, $10 .asm_1dc11 - call VermilionDock_1dc42 + call VermilionDock_AnimSmokePuffDriftRight ld c, $8 .asm_1dc16 call VermilionDock_1dc7c @@ -105,7 +105,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) dec e jr nz, .asm_1dbfa xor a - ld [$ff4a], a + ld [rWY], a ld [hWY], a call VermilionDock_1dc94 ld a, $90 @@ -122,33 +122,34 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) dec [hl] ret -VermilionDock_1dc42: ; 1dc42 (7:5c42) +VermilionDock_AnimSmokePuffDriftRight: ; 1dc42 (7:5c42) push bc push de ld hl, wOAMBuffer + $11 - ld a, [wWhichTrade] + ld a, [wSSAnneSmokeDriftAmount] swap a ld c, a - ld de, $0004 -.asm_1dc50 + ld de, 4 +.loop inc [hl] inc [hl] add hl, de dec c - jr nz, .asm_1dc50 + jr nz, .loop pop de pop bc ret -VermilionDock_1dc59: ; 1dc59 (7:5c59) - ld a, [wTrainerEngageDistance] - sub $10 - ld [wTrainerEngageDistance], a +VermilionDock_EmitSmokePuff: ; 1dc59 (7:5c59) +; new smoke puff above the S.S. Anne's front smokestack + ld a, [wSSAnneSmokeX] + sub 16 + ld [wSSAnneSmokeX], a ld c, a - ld b, $64 - ld a, [wWhichTrade] + ld b, 100 ; Y + ld a, [wSSAnneSmokeDriftAmount] inc a - ld [wWhichTrade], a + ld [wSSAnneSmokeDriftAmount], a ld a, $1 ld de, VermilionDockOAMBlock call WriteOAMBlock @@ -171,7 +172,7 @@ VermilionDock_1dc7c: ; 1dc7c (7:5c7c) cp l jr nz, .asm_1dc86 ld a, h - ld [$ff43], a + ld [rSCX], a .asm_1dc8e ld a, [rLY] cp h diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index 51346032..fd095638 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -49,7 +49,7 @@ VictoryRoad2Script0: ; 517f1 (14:57f1) call CheckBoulderCoords jp nc, CheckFightingMapTrainers ld hl, wd7ee - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $2 jr z, .asm_5180b bit 0, [hl] diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index 9aeb1d18..14b6895d 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -34,7 +34,7 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) ld hl, .coordsData_449f9 call CheckBoulderCoords jp nc, .asm_449fe - ld a, [wWhichTrade] + ld a, [wCoordIndex] cp $1 jr nz, .asm_449dc ld hl, wd126 @@ -60,11 +60,11 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) db $FF .asm_449fe - ld a, $c2 + ld a, VICTORY_ROAD_2 ld [wDungeonWarpDestinationMap], a ld hl, .coordsData_449f9 - call Func_46981 - ld a, [wWhichTrade] + call IsPlayerOnDungeonWarp + ld a, [wCoordIndex] cp $1 jr nz, .asm_44a1b ld hl, wd72d diff --git a/sram.asm b/sram.asm index 9d498df9..f0cf6fac 100644 --- a/sram.asm +++ b/sram.asm @@ -29,8 +29,8 @@ sBox3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea -sBoxes1CheckSum:: ds 1 ; ba4c -sBoxes1CheckSum2:: ds 6 ; ba4d +sBank2AllBoxesChecksum:: ds 1 ; ba4c +sBank2IndividualBoxChecksums:: ds 6 ; ba4d SECTION "Saved Boxes 2", SRAM, BANK[3] @@ -41,5 +41,5 @@ sBox9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea -sBoxes2CheckSum:: ds 1 ; ba4c -sBoxes2CheckSum2:: ds 6 ; ba4d +sBank3AllBoxesChecksum:: ds 1 ; ba4c +sBank3IndividualBoxChecksums:: ds 6 ; ba4d diff --git a/text/maps/daycare_1.asm b/text/maps/daycare_1.asm index a4182351..a42e3cf2 100644 --- a/text/maps/daycare_1.asm +++ b/text/maps/daycare_1.asm @@ -1,16 +1,16 @@ -_DayCareMText_5640f:: ; 8ab95 (22:6b95) +_DayCareIntroText:: ; 8ab95 (22:6b95) text "I run a DAYCARE." line "Would you like me" cont "to raise one of" cont "your #MON?" done -_DayCareMText_56414:: ; 8abd4 (22:6bd4) +_DayCareWhichMonText:: ; 8abd4 (22:6bd4) text "Which #MON" line "should I raise?" prompt -_DayCareMText_56419:: ; 8abf0 (22:6bf0) +_DayCareWillLookAfterMonText:: ; 8abf0 (22:6bf0) text "Fine, I'll look" line "after @" TX_RAM wcd6d @@ -18,12 +18,12 @@ _DayCareMText_56419:: ; 8abf0 (22:6bf0) cont "for a while." prompt -_DayCareMText_5641e:: ; 8ac19 (22:6c19) +_DayCareComeSeeMeInAWhileText:: ; 8ac19 (22:6c19) text "Come see me in" line "a while." done -_DayCareMText_56423:: ; 8ac32 (22:6c32) +_DayCareMonHasGrownText:: ; 8ac32 (22:6c32) text "Your @" TX_RAM wcd6d db $0 @@ -31,15 +31,13 @@ _DayCareMText_56423:: ; 8ac32 (22:6c32) para "By level, it's" line "grown by @" - -DayCareMText_8ac67:: ; 8ac67 (22:6c67) - TX_NUM wTrainerEngageDistance,$1,$3 + TX_NUM wDayCareNumLevelsGrown,$1,$3 text "!" para "Aren't I great?" prompt -_DayCareMText_56428:: ; 8ac7d (22:6c7d) +_DayCareOweMoneyText:: ; 8ac7d (22:6c7d) text "You owe me ¥@" TX_BCD wcd3f, $c2 db $0 @@ -47,14 +45,14 @@ _DayCareMText_56428:: ; 8ac7d (22:6c7d) cont "of this #MON." done -_DayCareMText_5642d:: ; 8acae (22:6cae) +_DayCareGotMonBackText:: ; 8acae (22:6cae) text $52, " got" line "@" TX_RAM W_DAYCAREMONNAME text " back!" done -_DayCareMText_56432:: ; 8acc1 (22:6cc1) +_DayCareMonNeedsMoreTimeText:: ; 8acc1 (22:6cc1) text "Back already?" line "Your @" TX_RAM wcd6d diff --git a/text/maps/daycare_2.asm b/text/maps/daycare_2.asm index c6478a76..b5104e60 100644 --- a/text/maps/daycare_2.asm +++ b/text/maps/daycare_2.asm @@ -1,8 +1,8 @@ -_DayCareMText_56437:: ; 8c000 (23:4000) +_DayCareAllRightThenText:: ; 8c000 (23:4000) text "All right then," line "@@" -_DayCareMText_5643b:: ; 8c013 (23:4013) +_DayCareComeAgainText:: ; 8c013 (23:4013) IF DEF(_YELLOW) text "Come again." ELSE @@ -10,28 +10,28 @@ ELSE ENDC done -_DayCareMText_56440:: ; 8c020 (23:4020) +_DayCareNoRoomForMonText:: ; 8c020 (23:4020) text "You have no room" line "for this #MON!" done -_DayCareMText_56445:: ; 8c041 (23:4041) +_DayCareOnlyHaveOneMonText:: ; 8c041 (23:4041) text "You only have one" line "#MON with you." done -_DayCareMText_5644a:: ; 8c063 (23:4063) +_DayCareCantAcceptMonWithHMText:: ; 8c063 (23:4063) text "I can't accept a" line "#MON that" cont "knows an HM move." done -_DayCareMText_5644f:: ; 8c090 (23:4090) +_DayCareHeresYourMonText:: ; 8c090 (23:4090) text "Thank you! Here's" line "your #MON!" prompt -_DayCareMText_56454:: ; 8c0ad (23:40ad) +_DayCareNotEnoughMoneyText:: ; 8c0ad (23:40ad) text "Hey, you don't" line "have enough ¥!" done diff --git a/wram.asm b/wram.asm index 8633e732..f089352b 100755 --- a/wram.asm +++ b/wram.asm @@ -424,6 +424,10 @@ wNumStepsToTake:: ; cca1 wRLEByteCount:: ; ccd2 ds 1 +wAddedToParty:: ; ccd3 +; 0 = not added +; 1 = added + wSimulatedJoypadStatesEnd:: ; ccd3 ; this is the end of the joypad states ; the list starts above this address and extends downwards in memory until here @@ -431,7 +435,13 @@ wSimulatedJoypadStatesEnd:: ; ccd3 wParentMenuItem:: ; ccd3 -wccd3:: ds 1 ; used in battle, pokemon, PC and game corner stuff +wCanEvolveFlags:: ; ccd3 +; 1 flag for each party member indicating whether it can evolve +; The purpose of these flags is to track which mons levelled up during the +; current battle at the end of the battle when evolution occurs. +; Other methods of evolution simply set it by calling TryEvolvingMon. + ds 1 + wForceEvolution:: wccd4:: ds 1 ; has a direct reference for simulated joypad stuff in vermillion and seafoam @@ -634,9 +644,33 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b ds 1 +wHoFTeamIndex:: ; cd3d + +wSSAnneSmokeDriftAmount:: ; cd3d +; multiplied by 16 to get the number of times to go right by 2 pixels + +wRivalStarterTemp:: ; cd3d + +wBoxMonCounts:: ; cd3d +; 12 bytes +; array of the number of mons in each box + +wDexMaxSeenMon:: ; cd3d + +wPPRestoreItem:: ; cd3d + +wWereAnyMonsAsleep:: ; cd3d + +wCanPlaySlots:: ; cd3d + +wNumShakes:: ; cd3d + +wDayCareStartLevel:: ; cd3d +; the level of the mon at the time it entered day care + wWhichBadge:: ; cd3d -wMuseumPriceTemp:: ; cd3d +wPriceTemp:: ; cd3d ; 3-byte BCD number wTitleMonSpecies:: ; cd3d @@ -701,6 +735,12 @@ wWhichTrade:: ; cd3d wTrainerSpriteOffset:: ; cd3d ds 1 +wSSAnneSmokeX:: ; cd3e + +wRivalStarterBallSpriteIndex:: ; cd3e + +wDayCareNumLevelsGrown:: ; cd3e + wOptionsBattleAnimCursorX:: ; cd3e wTrainerInfoTextBoxWidth:: ; cd3e @@ -733,6 +773,8 @@ wHiddenObjectFunctionRomBank:: ; cd3e wTrainerEngageDistance:: ; cd3e ds 1 +wJigglypuffFacingDirections:: ; cd3f + wOptionsBattleStyleCursorX:: ; cd3f wTrainerInfoTextBoxNextRowOffset:: ; cd3f @@ -774,6 +816,10 @@ wHiddenObjectY:: ; cd40 wTrainerScreenY:: ; cd40 ds 1 +wHoFTeamIndex2:: ; cd41 + +wHiddenItemOrCoinsIndex:: ; cd41 + wTradedPlayerMonOT:: ; cd41 wHiddenObjectX:: ; cd41 @@ -962,16 +1008,32 @@ wTileMapBackup2:: ; cd81 ; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top) ds 20 * 18 +wEvoOldSpecies:: ; cee9 + wBuffer:: ; cee9 ; Temporary storage area of 30 bytes. wTownMapCoords:: ; cee9 ; lower nybble is x, upper nybble is y +wLearningMovesFromDayCare:: ; cee9 +; whether WriteMonMoves is being used to make a mon learn moves from day care +; non-zero if so + wHPBarMaxHP:: ; cee9 - ds 2 + ds 1 + +wEvoNewSpecies:: ; ceea + ds 1 + +wEvoMonTileOffset:: ; ceeb + wHPBarOldHP:: ; ceeb - ds 2 + ds 1 + +wEvoCancelled:: ; ceec + ds 1 + wHPBarNewHP:: ; ceed ds 2 wHPBarDelta:: ; ceef @@ -1453,7 +1515,10 @@ W_SUBANIMCOUNTER:: ; d087 ; counts the number of subentries left in the current subanimation ds 1 -wd088:: ds 1 ; savefile checksum (if file is corrupted) +wSaveFileStatus:: +; 1 = no save file or save file is corrupted +; 2 = save file exists and no corruption has been detected + ds 1 W_NUMFBTILES:: ; d089 ; number of tiles in current battle animation frame block @@ -1462,6 +1527,8 @@ W_NUMFBTILES:: ; d089 wTradedMonMovingRight:: ; d08a ; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa +wOptionsInitialized:: ; d08a + wd08a:: ds 1 ; used with sprites and displaying the option menu on the main menu screen? wAnimCounter:: ; d08b @@ -2079,6 +2146,8 @@ wBoxItems:: ; d53b ds 1 ; end wCurrentBoxNum:: ; d5a0 +; bits 0-6: box number +; bit 7: whether the player has changed boxes before ds 2 wNumHoFTeams:: ; d5a2 @@ -2319,8 +2388,11 @@ W_ROUTE18GATECURSCRIPT:: ; d669 ds 134 -wd6f0:: ds 14 ; flags for hidden items? -wd6fe:: ds 2 ; flags for hidden coins? +wObtainedHiddenItemsFlags:: + ds 14 + +wObtainedHiddenCoinsFlags:: + ds 2 wWalkBikeSurfState:: ; d700 ; $00 = walking -- cgit v1.3.1-sl0p From ea9cc86949cecc3508aeac06b807372b6b0134d8 Mon Sep 17 00:00:00 2001 From: dannye Date: Sun, 19 Jul 2015 03:46:12 -0500 Subject: Name sound effects --- audio.asm | 16 +- constants/music_constants.asm | 176 +++++++++++++++++ engine/battle/animations.asm | 350 ++++++++++++++++----------------- engine/battle/common_text.asm | 2 +- engine/battle/core.asm | 10 +- engine/battle/trainer_ai.asm | 2 +- engine/evolution.asm | 2 +- engine/evos_moves.asm | 2 +- engine/gamefreak.asm | 2 +- engine/hidden_object_functions17.asm | 8 +- engine/hidden_object_functions7.asm | 16 +- engine/intro.asm | 20 +- engine/items/items.asm | 24 +-- engine/learn_move.asm | 2 +- engine/menu/main_menu.asm | 2 +- engine/menu/naming_screen.asm | 2 +- engine/menu/pc.asm | 12 +- engine/menu/players_pc.asm | 8 +- engine/menu/start_menu.asm | 2 +- engine/menu/start_sub_menus.asm | 2 +- engine/menu/vending_machine.asm | 2 +- engine/oak_speech.asm | 2 +- engine/overworld/cable_club_npc.asm | 2 +- engine/overworld/card_key.asm | 2 +- engine/overworld/cut.asm | 2 +- engine/overworld/elevator.asm | 4 +- engine/overworld/healing_machine.asm | 2 +- engine/overworld/hidden_items.asm | 2 +- engine/overworld/ledges.asm | 2 +- engine/overworld/player_animations.asm | 12 +- engine/overworld/pokemart.asm | 2 +- engine/save.asm | 4 +- engine/slot_machine.asm | 10 +- engine/titlescreen.asm | 4 +- engine/town_map.asm | 6 +- engine/trade.asm | 4 +- home.asm | 6 +- home/overworld.asm | 12 +- home/text.asm | 14 +- main.asm | 8 +- scripts/celadongamecorner.asm | 4 +- scripts/cinnabargym.asm | 2 +- scripts/daycarem.asm | 2 +- scripts/lance.asm | 2 +- scripts/mansion1.asm | 2 +- scripts/mansion2.asm | 2 +- scripts/museum1f.asm | 2 +- scripts/rockethideout1.asm | 2 +- scripts/rockethideout2.asm | 2 +- scripts/rockethideout3.asm | 2 +- scripts/rockethideout4.asm | 2 +- scripts/route22gate.asm | 2 +- scripts/route23.asm | 2 +- scripts/vermiliondock.asm | 4 +- scripts/vermiliongym.asm | 2 +- scripts/viridiangym.asm | 2 +- 56 files changed, 487 insertions(+), 311 deletions(-) (limited to 'engine/save.asm') diff --git a/audio.asm b/audio.asm index aaf4f8ed..27570b93 100644 --- a/audio.asm +++ b/audio.asm @@ -538,7 +538,7 @@ INCLUDE "audio/engine_2.asm" Music_PokeFluteInBattle:: ; 22306 (8:6306) - ld a, (SFX_08_46 - SFX_Headers_08) / 3 ; PokeFlute outside of battle + ld a, SFX_BATTLE_06 ; PokeFlute outside of battle call PlaySoundWaitForCurrent ld hl, wc00e ld de, SFX_08_PokeFlute_Ch1 @@ -583,13 +583,13 @@ PlayPokedexRatingSfx:: ; 7d13b (1f:513b) jp PlayDefaultMusic PokedexRatingSfxPointers: ; 7d162 (1f:5162) - db (SFX_1f_51 - SFX_Headers_1f) / 3, BANK(SFX_1f_51) - db (SFX_02_41 - SFX_Headers_02) / 3, BANK(SFX_02_41) - db (SFX_02_3a - SFX_Headers_02) / 3, BANK(SFX_02_3a) - db (SFX_08_46 - SFX_Headers_08) / 3, BANK(SFX_08_46) - db (SFX_08_3a - SFX_Headers_08) / 3, BANK(SFX_08_3a) - db (SFX_02_42 - SFX_Headers_02) / 3, BANK(SFX_02_42) - db (SFX_02_3b - SFX_Headers_02) / 3, BANK(SFX_02_3b) + db SFX_DENIED, BANK(SFX_1f_51) + db SFX_POKEDEX_RATING, BANK(SFX_02_41) + db SFX_GET_ITEM_1, BANK(SFX_02_3a) + db SFX_BATTLE_06, BANK(SFX_08_46) + db SFX_LEVEL_UP, BANK(SFX_08_3a) + db SFX_GET_KEY_ITEM, BANK(SFX_02_42) + db SFX_GET_ITEM_2, BANK(SFX_02_3b) OwnedMonValues: ; 7d170 (1f:5170) db 10, 40, 60, 90, 120, 150, $ff diff --git a/constants/music_constants.asm b/constants/music_constants.asm index 30d11543..260ccd39 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -4,6 +4,7 @@ music_const: MACRO \1 EQUS "((\2 - SFX_Headers_02) / 3)" ENDM + ; AUDIO_1 music_const MUSIC_PALLET_TOWN, Music_PalletTown music_const MUSIC_POKECENTER, Music_Pokecenter music_const MUSIC_GYM, Music_Gym @@ -25,6 +26,7 @@ ENDM music_const MUSIC_ROUTES4, Music_Routes4 music_const MUSIC_INDIGO_PLATEAU, Music_IndigoPlateau + ; AUDIO_2 music_const MUSIC_GYM_LEADER_BATTLE, Music_GymLeaderBattle music_const MUSIC_TRAINER_BATTLE, Music_TrainerBattle music_const MUSIC_WILD_BATTLE, Music_WildBattle @@ -33,6 +35,7 @@ ENDM music_const MUSIC_DEFEATED_WILD_MON, Music_DefeatedWildMon music_const MUSIC_DEFEATED_GYM_LEADER, Music_DefeatedGymLeader + ; AUDIO_3 music_const MUSIC_TITLE_SCREEN, Music_TitleScreen music_const MUSIC_CREDITS, Music_Credits music_const MUSIC_HALL_OF_FAME, Music_HallOfFame @@ -52,3 +55,176 @@ ENDM music_const MUSIC_MEET_FEMALE_TRAINER, Music_MeetFemaleTrainer music_const MUSIC_MEET_MALE_TRAINER, Music_MeetMaleTrainer + ; AUDIO_1 AUDIO_2 AUDIO_3 + music_const SFX_SNARE_1, SFX_02_01 + music_const SFX_SNARE_2, SFX_02_02 + music_const SFX_SNARE_3, SFX_02_03 + music_const SFX_SNARE_4, SFX_02_04 + music_const SFX_SNARE_5, SFX_02_05 + music_const SFX_TRIANGLE_1, SFX_02_06 + music_const SFX_TRIANGLE_2, SFX_02_07 + music_const SFX_SNARE_6, SFX_02_08 + music_const SFX_SNARE_7, SFX_02_09 + music_const SFX_SNARE_8, SFX_02_0a + music_const SFX_SNARE_9, SFX_02_0b + music_const SFX_CYMBAL_1, SFX_02_0c + music_const SFX_CYMBAL_2, SFX_02_0d + music_const SFX_CYMBAL_3, SFX_02_0e + music_const SFX_MUTED_SNARE_1, SFX_02_0f + music_const SFX_TRIANGLE_3, SFX_02_10 + music_const SFX_MUTED_SNARE_2, SFX_02_11 + music_const SFX_MUTED_SNARE_3, SFX_02_12 + music_const SFX_MUTED_SNARE_4, SFX_02_13 + music_const SFX_CRY_00, SFX_02_14 + music_const SFX_CRY_01, SFX_02_15 + music_const SFX_CRY_02, SFX_02_16 + music_const SFX_CRY_03, SFX_02_17 + music_const SFX_CRY_04, SFX_02_18 + music_const SFX_CRY_05, SFX_02_19 + music_const SFX_CRY_06, SFX_02_1a + music_const SFX_CRY_07, SFX_02_1b + music_const SFX_CRY_08, SFX_02_1c + music_const SFX_CRY_09, SFX_02_1d + music_const SFX_CRY_0A, SFX_02_1e + music_const SFX_CRY_0B, SFX_02_1f + music_const SFX_CRY_0C, SFX_02_20 + music_const SFX_CRY_0D, SFX_02_21 + music_const SFX_CRY_0E, SFX_02_22 + music_const SFX_CRY_0F, SFX_02_23 + music_const SFX_CRY_10, SFX_02_24 + music_const SFX_CRY_11, SFX_02_25 + music_const SFX_CRY_12, SFX_02_26 + music_const SFX_CRY_13, SFX_02_27 + music_const SFX_CRY_14, SFX_02_28 + music_const SFX_CRY_15, SFX_02_29 + music_const SFX_CRY_16, SFX_02_2a + music_const SFX_CRY_17, SFX_02_2b + music_const SFX_CRY_18, SFX_02_2c + music_const SFX_CRY_19, SFX_02_2d + music_const SFX_CRY_1A, SFX_02_2e + music_const SFX_CRY_1B, SFX_02_2f + music_const SFX_CRY_1C, SFX_02_30 + music_const SFX_CRY_1D, SFX_02_31 + music_const SFX_CRY_1E, SFX_02_32 + music_const SFX_CRY_1F, SFX_02_33 + music_const SFX_CRY_20, SFX_02_34 + music_const SFX_CRY_21, SFX_02_35 + music_const SFX_CRY_22, SFX_02_36 + music_const SFX_CRY_23, SFX_02_37 + music_const SFX_CRY_24, SFX_02_38 + music_const SFX_CRY_25, SFX_02_39 + + music_const SFX_GET_ITEM_2, SFX_02_3b + music_const SFX_TINK, SFX_02_3c + music_const SFX_HEAL_HP, SFX_02_3d + music_const SFX_HEAL_AILMENT, SFX_02_3e + music_const SFX_START_MENU, SFX_02_3f + music_const SFX_PRESS_AB, SFX_02_40 + + ; AUDIO_1 AUDIO_3 + music_const SFX_GET_ITEM_1, SFX_02_3a + + music_const SFX_POKEDEX_RATING, SFX_02_41 + music_const SFX_GET_KEY_ITEM, SFX_02_42 + music_const SFX_POISONED, SFX_02_43 + music_const SFX_TRADE_MACHINE, SFX_02_44 + music_const SFX_TURN_ON_PC, SFX_02_45 + music_const SFX_TURN_OFF_PC, SFX_02_46 + music_const SFX_ENTER_PC, SFX_02_47 + music_const SFX_SHRINK, SFX_02_48 + music_const SFX_SWITCH, SFX_02_49 + music_const SFX_HEALING_MACHINE, SFX_02_4a + music_const SFX_TELEPORT_1, SFX_02_4b + music_const SFX_TELEPORT_2, SFX_02_4c + music_const SFX_TELEPORT_3, SFX_02_4d + music_const SFX_LEDGE, SFX_02_4e + music_const SFX_FLY_1, SFX_02_4f + music_const SFX_FLY_2, SFX_02_50 + music_const SFX_DENIED, SFX_02_51 + music_const SFX_ARROW_TILES, SFX_02_52 + music_const SFX_PUSH_BOULDER, SFX_02_53 + music_const SFX_SS_ANNE_HORN, SFX_02_54 + music_const SFX_WITHDRAW_DEPOSIT, SFX_02_55 + music_const SFX_CUT, SFX_02_56 + music_const SFX_GO_INSIDE, SFX_02_57 + music_const SFX_SWAP, SFX_02_58 + music_const SFX_59, SFX_02_59 ; unused, sounds similar to SFX_SLOTS_STOP_WHEEL + music_const SFX_PURCHASE, SFX_02_5a + music_const SFX_COLLISION, SFX_02_5b + music_const SFX_GO_OUTSIDE, SFX_02_5c + music_const SFX_SAVE, SFX_02_5d + + ; AUDIO_1 + music_const SFX_POKEFLUE, SFX_02_5e + music_const SFX_SAFARI_ZONE_PA, SFX_02_5f + + ; AUDIO_2 + music_const SFX_LEVEL_UP, SFX_08_3a + + music_const SFX_BATTLE_01, SFX_08_41 + music_const SFX_BATTLE_02, SFX_08_42 + music_const SFX_BATTLE_03, SFX_08_43 + music_const SFX_BATTLE_04, SFX_08_44 + music_const SFX_BATTLE_05, SFX_08_45 + music_const SFX_BATTLE_06, SFX_08_46 + music_const SFX_BATTLE_07, SFX_08_47 + music_const SFX_BATTLE_08, SFX_08_48 + music_const SFX_BATTLE_09, SFX_08_49 + music_const SFX_BATTLE_0A, SFX_08_4a + music_const SFX_BATTLE_0B, SFX_08_4b + music_const SFX_BATTLE_0C, SFX_08_4c + music_const SFX_BATTLE_0D, SFX_08_4d + music_const SFX_BATTLE_0E, SFX_08_4e + music_const SFX_BATTLE_0F, SFX_08_4f + music_const SFX_BATTLE_10, SFX_08_50 + music_const SFX_BATTLE_11, SFX_08_51 + music_const SFX_BATTLE_12, SFX_08_52 + music_const SFX_BATTLE_13, SFX_08_53 + music_const SFX_BATTLE_14, SFX_08_54 + music_const SFX_BATTLE_15, SFX_08_55 + music_const SFX_BATTLE_16, SFX_08_56 ; unused? + music_const SFX_BATTLE_17, SFX_08_57 + music_const SFX_BATTLE_18, SFX_08_58 + music_const SFX_BATTLE_19, SFX_08_59 + music_const SFX_BATTLE_1A, SFX_08_5a + music_const SFX_BATTLE_1B, SFX_08_5b + music_const SFX_BATTLE_1C, SFX_08_5c + music_const SFX_BATTLE_1D, SFX_08_5d + music_const SFX_BATTLE_1E, SFX_08_5e + music_const SFX_BATTLE_1F, SFX_08_5f + music_const SFX_BATTLE_20, SFX_08_60 + music_const SFX_BATTLE_21, SFX_08_61 + music_const SFX_BATTLE_22, SFX_08_62 + music_const SFX_BATTLE_23, SFX_08_63 + music_const SFX_BATTLE_24, SFX_08_64 + music_const SFX_BATTLE_25, SFX_08_65 + music_const SFX_BATTLE_26, SFX_08_66 + music_const SFX_BATTLE_27, SFX_08_67 + music_const SFX_BATTLE_28, SFX_08_68 + music_const SFX_BATTLE_29, SFX_08_69 + music_const SFX_BATTLE_2A, SFX_08_6a + music_const SFX_BATTLE_2B, SFX_08_6b + music_const SFX_BATTLE_2C, SFX_08_6c + music_const SFX_BATTLE_2D, SFX_08_6d + music_const SFX_BATTLE_2E, SFX_08_6e + music_const SFX_BATTLE_2F, SFX_08_6f + music_const SFX_BATTLE_30, SFX_08_70 + music_const SFX_BATTLE_31, SFX_08_71 + music_const SFX_BATTLE_32, SFX_08_72 + music_const SFX_BATTLE_33, SFX_08_73 + music_const SFX_BATTLE_34, SFX_08_74 + music_const SFX_BATTLE_35, SFX_08_75 + music_const SFX_BATTLE_36, SFX_08_76 + music_const SFX_BATTLE_37, SFX_08_77 + + ; AUDIO_3 + music_const SFX_INTRO_LUNGE, SFX_1f_5e + music_const SFX_INTRO_HIP, SFX_1f_5f + music_const SFX_INTRO_HOP, SFX_1f_60 + music_const SFX_INTRO_RAISE, SFX_1f_61 + music_const SFX_INTRO_CRASH, SFX_1f_62 + music_const SFX_INTRO_WHOOSH, SFX_1f_63 + music_const SFX_SLOTS_STOP_WHEEL, SFX_1f_64 + music_const SFX_SLOTS_REWARD, SFX_1f_65 + music_const SFX_SLOTS_NEW_SPIN, SFX_1f_66 + music_const SFX_SHOOTING_STAR, SFX_1f_67 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 6803c38b..19625b15 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -741,7 +741,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) cp a,11 ; is it the beginning of the subanimation? jr nz,.skipPlayingSound ; if it is the beginning of the subanimation, play a sound - ld a,(SFX_08_41 - SFX_Headers_08) / 3 + ld a,SFX_BATTLE_01 call PlaySound .skipPlayingSound ld a,[W_ISINBATTLE] @@ -787,7 +787,7 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) cp a,4 ; is it the beginning of a shake? jr nz,.skipPlayingSound ; if it is the beginning of a shake, play a sound and wait 2/3 of a second - ld a,(SFX_08_3c - SFX_Headers_08) / 3 + ld a,SFX_TINK call PlaySound ld c,40 call DelayFrames @@ -820,7 +820,7 @@ DoPoofSpecialEffects: ; 78fce (1e:4fce) ld a,[W_SUBANIMCOUNTER] cp a,5 ret nz - ld a,(SFX_08_42 - SFX_Headers_08) / 3 + ld a,SFX_BATTLE_02 jp PlaySound DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9) @@ -921,7 +921,7 @@ TradeShakePokeball: ; 7904c (1e:504c) jr .loop .done call AnimationCleanOAM - ld a,(SFX_02_44 - SFX_Headers_02) / 3 + ld a,SFX_TRADE_MACHINE jp PlaySound BallMoveDistances1: ; 79078 (1e:5078) @@ -952,7 +952,7 @@ TradeJumpPokeball: ; 507C cp a,$ff jr nz,.skipPlayingSound .playSound ; play sound if next move distance is 12 or this is the last one - ld a,(SFX_08_58 - SFX_Headers_08) / 3 + ld a,SFX_BATTLE_18 call PlaySound .skipPlayingSound push bc @@ -2329,172 +2329,172 @@ IsCryMove: ; 798ad (1e:58ad) ret MoveSoundTable: ; 798bc (1e:58bc) - db (SFX_08_4a - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4c - SFX_Headers_08) / 3,$10,$80 - db (SFX_08_5d - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4b - SFX_Headers_08) / 3,$01,$80 - db (SFX_08_4d - SFX_Headers_08) / 3,$00,$40 - db (SFX_08_77 - SFX_Headers_08) / 3,$00,$ff - db (SFX_08_4d - SFX_Headers_08) / 3,$10,$60 - db (SFX_08_4d - SFX_Headers_08) / 3,$20,$80 - db (SFX_08_4d - SFX_Headers_08) / 3,$00,$a0 - db (SFX_08_50 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4f - SFX_Headers_08) / 3,$20,$40 - db (SFX_08_4f - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4e - SFX_Headers_08) / 3,$00,$a0 - db (SFX_08_51 - SFX_Headers_08) / 3,$10,$c0 - db (SFX_08_51 - SFX_Headers_08) / 3,$00,$a0 - db (SFX_08_52 - SFX_Headers_08) / 3,$00,$c0 - db (SFX_08_52 - SFX_Headers_08) / 3,$10,$a0 - db (SFX_08_53 - SFX_Headers_08) / 3,$00,$e0 - db (SFX_08_51 - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_54 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_62 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_55 - SFX_Headers_08) / 3,$01,$80 - db (SFX_08_60 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_57 - SFX_Headers_08) / 3,$f0,$40 - db (SFX_08_5a - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_57 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_61 - SFX_Headers_08) / 3,$10,$80 - db (SFX_08_5b - SFX_Headers_08) / 3,$01,$a0 - db (SFX_08_58 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5e - SFX_Headers_08) / 3,$00,$60 - db (SFX_08_5e - SFX_Headers_08) / 3,$01,$40 - db (SFX_08_5f - SFX_Headers_08) / 3,$00,$a0 - db (SFX_08_5a - SFX_Headers_08) / 3,$10,$a0 - db (SFX_08_60 - SFX_Headers_08) / 3,$00,$c0 - db (SFX_08_54 - SFX_Headers_08) / 3,$10,$60 - db (SFX_08_5a - SFX_Headers_08) / 3,$00,$a0 - db (SFX_08_62 - SFX_Headers_08) / 3,$11,$c0 - db (SFX_08_5a - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_61 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5b - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5b - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_59 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_71 - SFX_Headers_08) / 3,$ff,$40 - db (SFX_08_5e - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4b - SFX_Headers_08) / 3,$00,$c0 - db (SFX_08_4b - SFX_Headers_08) / 3,$00,$40 - db (SFX_08_75 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_67 - SFX_Headers_08) / 3,$40,$60 - db (SFX_08_67 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_67 - SFX_Headers_08) / 3,$ff,$40 - db (SFX_08_6a - SFX_Headers_08) / 3,$80,$c0 - db (SFX_08_59 - SFX_Headers_08) / 3,$10,$a0 - db (SFX_08_59 - SFX_Headers_08) / 3,$21,$e0 - db (SFX_08_69 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_64 - SFX_Headers_08) / 3,$20,$60 - db (SFX_08_6a - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_6c - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_68 - SFX_Headers_08) / 3,$40,$80 - db (SFX_08_69 - SFX_Headers_08) / 3,$f0,$e0 - db (SFX_08_6d - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_6a - SFX_Headers_08) / 3,$f0,$60 - db (SFX_08_68 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_76 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_47 - SFX_Headers_08) / 3,$01,$a0 - db (SFX_08_53 - SFX_Headers_08) / 3,$f0,$20 - db (SFX_08_63 - SFX_Headers_08) / 3,$01,$c0 - db (SFX_08_63 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5a - SFX_Headers_08) / 3,$00,$e0 - db (SFX_08_66 - SFX_Headers_08) / 3,$01,$60 - db (SFX_08_66 - SFX_Headers_08) / 3,$20,$40 - db (SFX_08_64 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_64 - SFX_Headers_08) / 3,$40,$c0 - db (SFX_08_5b - SFX_Headers_08) / 3,$03,$60 - db (SFX_08_65 - SFX_Headers_08) / 3,$11,$e0 - db (SFX_08_52 - SFX_Headers_08) / 3,$20,$e0 - db (SFX_08_6e - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5c - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_5c - SFX_Headers_08) / 3,$11,$a0 - db (SFX_08_5c - SFX_Headers_08) / 3,$01,$c0 - db (SFX_08_53 - SFX_Headers_08) / 3,$14,$c0 - db (SFX_08_5b - SFX_Headers_08) / 3,$02,$a0 - db (SFX_08_69 - SFX_Headers_08) / 3,$f0,$80 - db (SFX_08_69 - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_6f - SFX_Headers_08) / 3,$00,$20 - db (SFX_08_6f - SFX_Headers_08) / 3,$20,$80 - db (SFX_08_6e - SFX_Headers_08) / 3,$12,$60 - db (SFX_08_66 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_54 - SFX_Headers_08) / 3,$01,$e0 - db (SFX_08_69 - SFX_Headers_08) / 3,$0f,$e0 - db (SFX_08_69 - SFX_Headers_08) / 3,$11,$20 - db (SFX_08_50 - SFX_Headers_08) / 3,$10,$40 - db (SFX_08_4f - SFX_Headers_08) / 3,$10,$c0 - db (SFX_08_54 - SFX_Headers_08) / 3,$00,$20 - db (SFX_08_70 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_75 - SFX_Headers_08) / 3,$11,$18 - db (SFX_08_49 - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_48 - SFX_Headers_08) / 3,$20,$c0 - db (SFX_08_65 - SFX_Headers_08) / 3,$00,$10 - db (SFX_08_66 - SFX_Headers_08) / 3,$f0,$20 - db (SFX_08_73 - SFX_Headers_08) / 3,$f0,$c0 - db (SFX_08_51 - SFX_Headers_08) / 3,$f0,$e0 - db (SFX_08_49 - SFX_Headers_08) / 3,$f0,$40 - db (SFX_08_71 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_73 - SFX_Headers_08) / 3,$80,$40 - db (SFX_08_73 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_54 - SFX_Headers_08) / 3,$11,$20 - db (SFX_08_54 - SFX_Headers_08) / 3,$22,$10 - db (SFX_08_5b - SFX_Headers_08) / 3,$f1,$ff - db (SFX_08_53 - SFX_Headers_08) / 3,$f1,$ff - db (SFX_08_54 - SFX_Headers_08) / 3,$33,$30 - db (SFX_08_72 - SFX_Headers_08) / 3,$40,$c0 - db (SFX_08_4e - SFX_Headers_08) / 3,$20,$20 - db (SFX_08_4e - SFX_Headers_08) / 3,$f0,$10 - db (SFX_08_4f - SFX_Headers_08) / 3,$f8,$10 - db (SFX_08_51 - SFX_Headers_08) / 3,$f0,$10 - db (SFX_08_65 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_58 - SFX_Headers_08) / 3,$00,$c0 - db (SFX_08_72 - SFX_Headers_08) / 3,$c0,$ff - db (SFX_08_49 - SFX_Headers_08) / 3,$f2,$20 - db (SFX_08_74 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_74 - SFX_Headers_08) / 3,$00,$40 - db (SFX_08_49 - SFX_Headers_08) / 3,$00,$40 - db (SFX_08_51 - SFX_Headers_08) / 3,$10,$ff - db (SFX_08_6a - SFX_Headers_08) / 3,$20,$20 - db (SFX_08_72 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_69 - SFX_Headers_08) / 3,$1f,$20 - db (SFX_08_65 - SFX_Headers_08) / 3,$2f,$80 - db (SFX_08_4f - SFX_Headers_08) / 3,$1f,$ff - db (SFX_08_6b - SFX_Headers_08) / 3,$1f,$60 - db (SFX_08_66 - SFX_Headers_08) / 3,$1e,$20 - db (SFX_08_66 - SFX_Headers_08) / 3,$1f,$18 - db (SFX_08_54 - SFX_Headers_08) / 3,$0f,$80 - db (SFX_08_49 - SFX_Headers_08) / 3,$f8,$10 - db (SFX_08_48 - SFX_Headers_08) / 3,$18,$20 - db (SFX_08_72 - SFX_Headers_08) / 3,$08,$40 - db (SFX_08_57 - SFX_Headers_08) / 3,$01,$e0 - db (SFX_08_51 - SFX_Headers_08) / 3,$09,$ff - db (SFX_08_75 - SFX_Headers_08) / 3,$42,$01 - db (SFX_08_5c - SFX_Headers_08) / 3,$00,$ff - db (SFX_08_72 - SFX_Headers_08) / 3,$08,$e0 - db (SFX_08_64 - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_49 - SFX_Headers_08) / 3,$88,$10 - db (SFX_08_65 - SFX_Headers_08) / 3,$48,$ff - db (SFX_08_48 - SFX_Headers_08) / 3,$ff,$ff - db (SFX_08_64 - SFX_Headers_08) / 3,$ff,$10 - db (SFX_08_48 - SFX_Headers_08) / 3,$ff,$04 - db (SFX_08_5c - SFX_Headers_08) / 3,$01,$ff - db (SFX_08_53 - SFX_Headers_08) / 3,$f8,$ff - db (SFX_08_4c - SFX_Headers_08) / 3,$f0,$f0 - db (SFX_08_4f - SFX_Headers_08) / 3,$08,$10 - db (SFX_08_4d - SFX_Headers_08) / 3,$f0,$ff - db (SFX_08_5a - SFX_Headers_08) / 3,$f0,$ff - db (SFX_08_74 - SFX_Headers_08) / 3,$10,$ff - db (SFX_08_4e - SFX_Headers_08) / 3,$f0,$20 - db (SFX_08_6b - SFX_Headers_08) / 3,$f0,$60 - db (SFX_08_61 - SFX_Headers_08) / 3,$12,$10 - db (SFX_08_76 - SFX_Headers_08) / 3,$f0,$20 - db (SFX_08_5e - SFX_Headers_08) / 3,$12,$ff - db (SFX_08_71 - SFX_Headers_08) / 3,$80,$04 - db (SFX_08_73 - SFX_Headers_08) / 3,$f0,$10 - db (SFX_08_69 - SFX_Headers_08) / 3,$f8,$ff - db (SFX_08_66 - SFX_Headers_08) / 3,$f0,$ff - db (SFX_08_51 - SFX_Headers_08) / 3,$01,$ff - db (SFX_08_6c - SFX_Headers_08) / 3,$d8,$04 - db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80 - db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80 + db SFX_BATTLE_0A,$00,$80 + db SFX_BATTLE_0C,$10,$80 + db SFX_BATTLE_1D,$00,$80 + db SFX_BATTLE_0B,$01,$80 + db SFX_BATTLE_0D,$00,$40 + db SFX_BATTLE_37,$00,$ff + db SFX_BATTLE_0D,$10,$60 + db SFX_BATTLE_0D,$20,$80 + db SFX_BATTLE_0D,$00,$a0 + db SFX_BATTLE_10,$00,$80 + db SFX_BATTLE_0F,$20,$40 + db SFX_BATTLE_0F,$00,$80 + db SFX_BATTLE_0E,$00,$a0 + db SFX_BATTLE_11,$10,$c0 + db SFX_BATTLE_11,$00,$a0 + db SFX_BATTLE_12,$00,$c0 + db SFX_BATTLE_12,$10,$a0 + db SFX_BATTLE_13,$00,$e0 + db SFX_BATTLE_11,$20,$c0 + db SFX_BATTLE_14,$00,$80 + db SFX_BATTLE_22,$00,$80 + db SFX_BATTLE_15,$01,$80 + db SFX_BATTLE_20,$00,$80 + db SFX_BATTLE_17,$f0,$40 + db SFX_BATTLE_1A,$00,$80 + db SFX_BATTLE_17,$00,$80 + db SFX_BATTLE_21,$10,$80 + db SFX_BATTLE_1B,$01,$a0 + db SFX_BATTLE_18,$00,$80 + db SFX_BATTLE_1E,$00,$60 + db SFX_BATTLE_1E,$01,$40 + db SFX_BATTLE_1F,$00,$a0 + db SFX_BATTLE_1A,$10,$a0 + db SFX_BATTLE_20,$00,$c0 + db SFX_BATTLE_14,$10,$60 + db SFX_BATTLE_1A,$00,$a0 + db SFX_BATTLE_22,$11,$c0 + db SFX_BATTLE_1A,$20,$c0 + db SFX_BATTLE_21,$00,$80 + db SFX_BATTLE_1B,$00,$80 + db SFX_BATTLE_1B,$20,$c0 + db SFX_BATTLE_19,$00,$80 + db SFX_BATTLE_31,$ff,$40 + db SFX_BATTLE_1E,$00,$80 + db SFX_BATTLE_0B,$00,$c0 + db SFX_BATTLE_0B,$00,$40 + db SFX_BATTLE_35,$00,$80 + db SFX_BATTLE_27,$40,$60 + db SFX_BATTLE_27,$00,$80 + db SFX_BATTLE_27,$ff,$40 + db SFX_BATTLE_2A,$80,$c0 + db SFX_BATTLE_19,$10,$a0 + db SFX_BATTLE_19,$21,$e0 + db SFX_BATTLE_29,$00,$80 + db SFX_BATTLE_24,$20,$60 + db SFX_BATTLE_2A,$00,$80 + db SFX_BATTLE_2C,$00,$80 + db SFX_BATTLE_28,$40,$80 + db SFX_BATTLE_29,$f0,$e0 + db SFX_BATTLE_2D,$00,$80 + db SFX_BATTLE_2A,$f0,$60 + db SFX_BATTLE_28,$00,$80 + db SFX_BATTLE_36,$00,$80 + db SFX_BATTLE_07,$01,$a0 + db SFX_BATTLE_13,$f0,$20 + db SFX_BATTLE_23,$01,$c0 + db SFX_BATTLE_23,$00,$80 + db SFX_BATTLE_1A,$00,$e0 + db SFX_BATTLE_26,$01,$60 + db SFX_BATTLE_26,$20,$40 + db SFX_BATTLE_24,$00,$80 + db SFX_BATTLE_24,$40,$c0 + db SFX_BATTLE_1B,$03,$60 + db SFX_BATTLE_25,$11,$e0 + db SFX_BATTLE_12,$20,$e0 + db SFX_BATTLE_2E,$00,$80 + db SFX_BATTLE_1C,$00,$80 + db SFX_BATTLE_1C,$11,$a0 + db SFX_BATTLE_1C,$01,$c0 + db SFX_BATTLE_13,$14,$c0 + db SFX_BATTLE_1B,$02,$a0 + db SFX_BATTLE_29,$f0,$80 + db SFX_BATTLE_29,$20,$c0 + db SFX_BATTLE_2F,$00,$20 + db SFX_BATTLE_2F,$20,$80 + db SFX_BATTLE_2E,$12,$60 + db SFX_BATTLE_26,$00,$80 + db SFX_BATTLE_14,$01,$e0 + db SFX_BATTLE_29,$0f,$e0 + db SFX_BATTLE_29,$11,$20 + db SFX_BATTLE_10,$10,$40 + db SFX_BATTLE_0F,$10,$c0 + db SFX_BATTLE_14,$00,$20 + db SFX_BATTLE_30,$00,$80 + db SFX_BATTLE_35,$11,$18 + db SFX_BATTLE_09,$20,$c0 + db SFX_BATTLE_08,$20,$c0 + db SFX_BATTLE_25,$00,$10 + db SFX_BATTLE_26,$f0,$20 + db SFX_BATTLE_33,$f0,$c0 + db SFX_BATTLE_11,$f0,$e0 + db SFX_BATTLE_09,$f0,$40 + db SFX_BATTLE_31,$00,$80 + db SFX_BATTLE_33,$80,$40 + db SFX_BATTLE_33,$00,$80 + db SFX_BATTLE_14,$11,$20 + db SFX_BATTLE_14,$22,$10 + db SFX_BATTLE_1B,$f1,$ff + db SFX_BATTLE_13,$f1,$ff + db SFX_BATTLE_14,$33,$30 + db SFX_BATTLE_32,$40,$c0 + db SFX_BATTLE_0E,$20,$20 + db SFX_BATTLE_0E,$f0,$10 + db SFX_BATTLE_0F,$f8,$10 + db SFX_BATTLE_11,$f0,$10 + db SFX_BATTLE_25,$00,$80 + db SFX_BATTLE_18,$00,$c0 + db SFX_BATTLE_32,$c0,$ff + db SFX_BATTLE_09,$f2,$20 + db SFX_BATTLE_34,$00,$80 + db SFX_BATTLE_34,$00,$40 + db SFX_BATTLE_09,$00,$40 + db SFX_BATTLE_11,$10,$ff + db SFX_BATTLE_2A,$20,$20 + db SFX_BATTLE_32,$00,$80 + db SFX_BATTLE_29,$1f,$20 + db SFX_BATTLE_25,$2f,$80 + db SFX_BATTLE_0F,$1f,$ff + db SFX_BATTLE_2B,$1f,$60 + db SFX_BATTLE_26,$1e,$20 + db SFX_BATTLE_26,$1f,$18 + db SFX_BATTLE_14,$0f,$80 + db SFX_BATTLE_09,$f8,$10 + db SFX_BATTLE_08,$18,$20 + db SFX_BATTLE_32,$08,$40 + db SFX_BATTLE_17,$01,$e0 + db SFX_BATTLE_11,$09,$ff + db SFX_BATTLE_35,$42,$01 + db SFX_BATTLE_1C,$00,$ff + db SFX_BATTLE_32,$08,$e0 + db SFX_BATTLE_24,$00,$80 + db SFX_BATTLE_09,$88,$10 + db SFX_BATTLE_25,$48,$ff + db SFX_BATTLE_08,$ff,$ff + db SFX_BATTLE_24,$ff,$10 + db SFX_BATTLE_08,$ff,$04 + db SFX_BATTLE_1C,$01,$ff + db SFX_BATTLE_13,$f8,$ff + db SFX_BATTLE_0C,$f0,$f0 + db SFX_BATTLE_0F,$08,$10 + db SFX_BATTLE_0D,$f0,$ff + db SFX_BATTLE_1A,$f0,$ff + db SFX_BATTLE_34,$10,$ff + db SFX_BATTLE_0E,$f0,$20 + db SFX_BATTLE_2B,$f0,$60 + db SFX_BATTLE_21,$12,$10 + db SFX_BATTLE_36,$f0,$20 + db SFX_BATTLE_1E,$12,$ff + db SFX_BATTLE_31,$80,$04 + db SFX_BATTLE_33,$f0,$10 + db SFX_BATTLE_29,$f8,$ff + db SFX_BATTLE_26,$f0,$ff + db SFX_BATTLE_11,$01,$ff + db SFX_BATTLE_2C,$d8,$04 + db SFX_BATTLE_0B,$00,$80 + db SFX_BATTLE_0B,$00,$80 CopyPicTiles: ; 79aae (1e:5aae) ld a, [H_WHOSETURN] @@ -2929,7 +2929,7 @@ TossBallAnimation: ; 79e16 (1e:5e16) ld a,TOSS_ANIM ld [W_ANIMATIONID],a call PlayAnimation - ld a,(SFX_08_43 - SFX_Headers_08) / 3 + ld a,SFX_BATTLE_03 call PlaySound ld a,BLOCKBALL_ANIM ld [W_ANIMATIONID],a @@ -2945,15 +2945,15 @@ PlayApplyingAttackSound: ; 79e6a (1e:5e6a) cp $a ld a, $20 ld b, $30 - ld c, (SFX_08_50 - SFX_Headers_08) / 3 + ld c, SFX_BATTLE_10 jr z, .asm_79e8b ld a, $e0 ld b, $ff - ld c, (SFX_08_5a - SFX_Headers_08) / 3 + ld c, SFX_BATTLE_1A jr nc, .asm_79e8b ld a, $50 ld b, $1 - ld c, (SFX_08_51 - SFX_Headers_08) / 3 + ld c, SFX_BATTLE_11 .asm_79e8b ld [wc0f1], a ld a, b diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 11309a86..41e402f3 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -64,7 +64,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) ld [wc0f1], a ld a, $80 ld [wc0f2], a - ld a, (SFX_08_77 - SFX_Headers_08) / 3 + ld a, SFX_BATTLE_37 call PlaySound jp WaitForSoundToFinish .done diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5deeb4dc..30b62dea 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -355,7 +355,7 @@ EnemyRan: ; 3c202 (f:4202) ld hl, EnemyRanText .printText call PrintText - ld a, (SFX_08_44 - SFX_Headers_08) / 3 + ld a, SFX_BATTLE_04 call PlaySoundWaitForCurrent xor a ld [H_WHOSETURN], a @@ -864,13 +864,13 @@ FaintEnemyPokemon: ; 0x3c567 xor a ld [wc0f1], a ld [wc0f2], a - ld a, (SFX_08_48 - SFX_Headers_08) / 3 ; SFX_FALL? + ld a, SFX_BATTLE_08 ; SFX_FALL? call PlaySoundWaitForCurrent .sfxwait ld a, [wc02a] - cp (SFX_08_48 - SFX_Headers_08) / 3 + cp SFX_BATTLE_08 jr z, .sfxwait - ld a, (SFX_08_43 - SFX_Headers_08) / 3 ; SFX_DROP + ld a, SFX_BATTLE_03 ; SFX_DROP call PlaySound call WaitForSoundToFinish jr .sfxplayed @@ -1678,7 +1678,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9) dec a .playSound ld [wBattleResult], a - ld a, (SFX_08_44 - SFX_Headers_08) / 3 + ld a, SFX_BATTLE_04 call PlaySoundWaitForCurrent ld hl, GotAwayText call PrintText diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index a53f00f6..c803a870 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -553,7 +553,7 @@ DecrementAICount: ; 3a695 (e:6695) ret AIPlayRestoringSFX: ; 3a69b (e:669b) - ld a,(SFX_08_3e - SFX_Headers_08) / 3 + ld a,SFX_HEAL_AILMENT jp PlaySoundWaitForCurrent AIUseFullRestore: ; 3a6a0 (e:66a0) diff --git a/engine/evolution.asm b/engine/evolution.asm index 9ed38c21..0f3a0d00 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -14,7 +14,7 @@ EvolveMon: ; 7bde9 (1e:7de9) call PlaySound ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a - ld a, (SFX_08_3c - SFX_Headers_08) / 3 + ld a, SFX_TINK call PlaySound call Delay3 xor a diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 4a253c68..9cdc617c 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -146,7 +146,7 @@ Evolution_PartyMonLoop: ; loop over party mons push hl ld hl, IntoText call Func_3c59 - ld a, (SFX_02_3b - SFX_Headers_02) / 3 + ld a, SFX_GET_ITEM_2 call PlaySoundWaitForCurrent call WaitForSoundToFinish ld c, 40 diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index 38c66793..49c938f7 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -26,7 +26,7 @@ LoadShootingStarGraphics: ; 70000 (1c:4000) AnimateShootingStar: ; 70044 (1c:4044) call LoadShootingStarGraphics - ld a, (SFX_1f_67 - SFX_Headers_1f) / 3 + ld a, SFX_SHOOTING_STAR call PlaySound ; Move the big star down and left across the screen. diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 841929b8..b65ee2c8 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -423,7 +423,7 @@ VermilionGymTrashSuccesText1: ; 5dec8 (17:5ec8) TX_FAR _VermilionGymTrashSuccesText1 TX_ASM call WaitForSoundToFinish - ld a, (SFX_02_49 - SFX_Headers_02) / 3 + ld a, SFX_SWITCH call PlaySound call WaitForSoundToFinish jp TextScriptEnd @@ -437,7 +437,7 @@ VermilionGymTrashSuccesText2: ; 5dedb (17:5edb) VermilionGymTrashSuccesPlaySfx: ; 5dee0 (17:5ee0) TX_ASM call WaitForSoundToFinish - ld a, (SFX_02_49 - SFX_Headers_02) / 3 + ld a, SFX_SWITCH call PlaySound call WaitForSoundToFinish jp TextScriptEnd @@ -446,7 +446,7 @@ VermilionGymTrashSuccesText3: ; 5deef (17:5eef) TX_FAR _VermilionGymTrashSuccesText3 TX_ASM call WaitForSoundToFinish - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish jp TextScriptEnd @@ -455,7 +455,7 @@ VermilionGymTrashFailText: ; 5df02 (17:5f02) TX_FAR _VermilionGymTrashFailText TX_ASM call WaitForSoundToFinish - ld a, (SFX_02_51 - SFX_Headers_02) / 3 + ld a, SFX_DENIED call PlaySound call WaitForSoundToFinish jp TextScriptEnd diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 31ae17a4..4c2ea816 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -68,7 +68,7 @@ SafariZoneGameOver: ; 1e9b0 (7:69b0) dec a call PlaySound ld c, BANK(SFX_02_5f) - ld a, (SFX_02_5f - SFX_Headers_02) / 3 + ld a, SFX_SAFARI_ZONE_PA call PlayMusic .asm_1e9c2 ld a, [wc02a] @@ -214,7 +214,7 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92) jp CinnabarGymQuiz_1eb0a .asm_1eab8 call WaitForSoundToFinish - ld a, (SFX_02_51 - SFX_Headers_02) / 3 + ld a, SFX_DENIED call PlaySound call WaitForSoundToFinish ld hl, CinnabarGymQuizIncorrectText @@ -247,7 +247,7 @@ CinnabarGymQuizCorrectText: ; 1eae3 (7:6ae3) and a jp nz, TextScriptEnd call WaitForSoundToFinish - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish jp TextScriptEnd @@ -335,22 +335,22 @@ BillsHousePC: ; 1eb6e (7:6b6e) tx_pre BillsHouseInitiatedText ld c, 32 call DelayFrames - ld a, (SFX_02_3c - SFX_Headers_02) / 3 + ld a, SFX_TINK call PlaySound call WaitForSoundToFinish ld c, 80 call DelayFrames - ld a, (SFX_02_48 - SFX_Headers_02) / 3 + ld a, SFX_SHRINK call PlaySound call WaitForSoundToFinish ld c, 48 call DelayFrames - ld a, (SFX_02_3c - SFX_Headers_02) / 3 + ld a, SFX_TINK call PlaySound call WaitForSoundToFinish ld c, 32 call DelayFrames - ld a, (SFX_02_3a - SFX_Headers_02) / 3 + ld a, SFX_GET_ITEM_1 call PlaySound call WaitForSoundToFinish call PlayDefaultMusic @@ -376,7 +376,7 @@ BillsHouseInitiatedText: ; 1ebe2 (7:6be2) call PlaySound ld c, 16 call DelayFrames - ld a, (SFX_02_49 - SFX_Headers_02) / 3 + ld a, SFX_SWITCH call PlaySound call WaitForSoundToFinish ld c, 60 diff --git a/engine/intro.asm b/engine/intro.asm index 79cc2101..6b5c46c9 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -35,14 +35,14 @@ PlayIntroScene: ; 4169d (10:569d) ret c ; hip - ld a, (SFX_1f_5f - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HIP call PlaySound xor a ld [wd09f], a ld de, IntroNidorinoAnimation1 call AnimateIntroNidorino ; hop - ld a, (SFX_1f_60 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HOP call PlaySound ld de, IntroNidorinoAnimation2 call AnimateIntroNidorino @@ -51,12 +51,12 @@ PlayIntroScene: ; 4169d (10:569d) ret c ; hip - ld a, (SFX_1f_5f - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HIP call PlaySound ld de, IntroNidorinoAnimation1 call AnimateIntroNidorino ; hop - ld a, (SFX_1f_60 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HOP call PlaySound ld de, IntroNidorinoAnimation2 call AnimateIntroNidorino @@ -67,7 +67,7 @@ PlayIntroScene: ; 4169d (10:569d) ; raise ld b, $4 call IntroCopyTiles - ld a, (SFX_1f_61 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_RAISE call PlaySound ld de, $401 ; move Gengar left by 8 pixels call IntroMoveMon @@ -78,12 +78,12 @@ PlayIntroScene: ; 4169d (10:569d) ; slash ld b, $5 call IntroCopyTiles - ld a, (SFX_1f_62 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_CRASH call PlaySound ld de, $800 ; move Gengar right by 16 pixels call IntroMoveMon ; hip - ld a, (SFX_1f_5f - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HIP call PlaySound ld a, $24 ld [wd09f], a @@ -102,14 +102,14 @@ PlayIntroScene: ; 4169d (10:569d) ret c ; hip - ld a, (SFX_1f_5f - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HIP call PlaySound xor a ld [wd09f], a ld de, IntroNidorinoAnimation4 call AnimateIntroNidorino ; hop - ld a, (SFX_1f_60 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_HOP call PlaySound ld de, IntroNidorinoAnimation5 call AnimateIntroNidorino @@ -126,7 +126,7 @@ PlayIntroScene: ; 4169d (10:569d) ret c ; lunge - ld a, (SFX_1f_5e - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_LUNGE call PlaySound ld a, $48 ld [wd09f], a diff --git a/engine/items/items.asm b/engine/items/items.asm index fe2d71c8..69e8b4bf 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -644,7 +644,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) ld [wcf91],a ld a,$01 ld [wForceEvolution],a - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySoundWaitForCurrent call WaitForSoundToFinish callab TryEvolvingMon ; try to evolve pokemon @@ -917,7 +917,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[wWhichPokemon] ld bc,2 * 20 call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled - ld a,(SFX_02_3d - SFX_Headers_02) / 3 + ld a,SFX_HEAL_HP call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a @@ -1067,7 +1067,7 @@ ItemUseMedicine: ; dabb (3:5abb) jr c,.playStatusAilmentCuringSound cp a,FULL_HEAL jr z,.playStatusAilmentCuringSound - ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound + ld a,SFX_HEAL_HP call PlaySoundWaitForCurrent ld a,[hFlags_0xFFF6] set 0,a @@ -1089,7 +1089,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [wPartyMenuTypeOrMessageID],a jr .showHealingItemMessage .playStatusAilmentCuringSound - ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound + ld a,SFX_HEAL_AILMENT call PlaySoundWaitForCurrent .showHealingItemMessage xor a @@ -1178,7 +1178,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld de,wcf4b ld bc,10 call CopyData ; copy the stat's name to wcf4b - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld hl,VitaminStatRoseText call PrintText @@ -1720,7 +1720,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215) ; play out-of-battle pokeflute music ld a,$ff call PlaySound ; turn off music - ld a, (SFX_02_5e - SFX_Headers_02) / 3 + ld a, SFX_POKEFLUE ld c, BANK(SFX_02_5e) call PlayMusic .musicWaitLoop ; wait for music to finish playing @@ -1824,7 +1824,7 @@ FishingInit: ; e2b4 (3:62b4) call ItemUseReloadOverworldData ld hl,ItemUseText00 call PrintText - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld c,80 call DelayFrames @@ -1847,9 +1847,9 @@ ItemUseItemfinder: ; e2e1 (3:62e1) jr nc,.printText ; if no hidden items ld c,4 .loop - ld a,(SFX_02_4a - SFX_Headers_02) / 3 + ld a,SFX_HEALING_MACHINE call PlaySoundWaitForCurrent - ld a,(SFX_02_5a - SFX_Headers_02) / 3 + ld a,SFX_PURCHASE call PlaySoundWaitForCurrent dec c jr nz,.loop @@ -1951,7 +1951,7 @@ ItemUsePPRestore: ; e31e (3:631e) ld bc,4 call CopyData ; copy party data to in-battle data .skipUpdatingInBattleData - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound ld hl,PPRestoredText call PrintText @@ -2146,7 +2146,7 @@ ItemUseTMHM: ; e479 (3:6479) and a ; can the pokemon learn the move? jr nz,.checkIfAlreadyLearnedMove ; if the pokemon can't learn the move - ld a,(SFX_02_51 - SFX_Headers_02) / 3 + ld a,SFX_DENIED call PlaySoundWaitForCurrent ld hl,MonCannotLearnMachineMoveText call PrintText @@ -2186,7 +2186,7 @@ MonCannotLearnMachineMoveText: ; e55e (3:655e) PrintItemUseTextAndRemoveItem: ; e563 (3:6563) ld hl,ItemUseText00 call PrintText - ld a,(SFX_02_3e - SFX_Headers_02) / 3 + ld a,SFX_HEAL_AILMENT call PlaySound call WaitForTextScrollButtonPress ; wait for button press diff --git a/engine/learn_move.asm b/engine/learn_move.asm index 1c0e038c..abc3b7d4 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -207,7 +207,7 @@ OneTwoAndText: ; 6fc8 (1:6fc8) TX_FAR _OneTwoAndText db $a TX_ASM - ld a, (SFX_02_58 - SFX_Headers_02) / 3 + ld a, SFX_SWAP call PlaySoundWaitForCurrent ld hl, PoofText ret diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 9e160f81..dc936c97 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -481,7 +481,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) cp a,16 ; is the cursor on Cancel? jr nz,.loop .exitMenu - ld a,(SFX_02_40 - SFX_Headers_02) / 3 + ld a,SFX_PRESS_AB call PlaySound ret .eraseOldMenuCursor diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 20deb834..9a608491 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -262,7 +262,7 @@ DisplayNamingScreen: ; 6596 (1:6596) ld a, [wHPBarNewHP] ld [hli], a ld [hl], $50 - ld a, (SFX_02_40 - SFX_Headers_02) / 3 + ld a, SFX_PRESS_AB call PlaySound ret .pressedB diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index 8ee40c7c..b5281964 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -1,6 +1,6 @@ ActivatePC: ; 17e2c (5:7e2c) call SaveScreenTilesToBuffer2 - ld a, (SFX_02_45 - SFX_Headers_02) / 3 + ld a, SFX_TURN_ON_PC call PlaySound ld hl, TurnedOnPC1Text call PrintText @@ -51,7 +51,7 @@ PCMainMenu: ; 17e48 (5:7e48) ld hl, wFlags_0xcd60 res 5, [hl] set 3, [hl] - ld a, (SFX_02_47 - SFX_Headers_02) / 3 + ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish ld hl, AccessedMyPCText @@ -59,19 +59,19 @@ PCMainMenu: ; 17e48 (5:7e48) callba PlayerPC jr ReloadMainMenu OaksPC: ; 17ec0 (5:7ec0) - ld a, (SFX_02_47 - SFX_Headers_02) / 3 + ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish callba OpenOaksPC jr ReloadMainMenu PKMNLeague: ; 17ed2 (5:7ed2) - ld a, (SFX_02_47 - SFX_Headers_02) / 3 + ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish callba PKMNLeaguePC jr ReloadMainMenu BillsPC: ; 17ee4 (5:7ee4) - ld a, (SFX_02_47 - SFX_Headers_02) / 3 + ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish ld a, [wd7f1] ;has to do with having met Bill @@ -91,7 +91,7 @@ ReloadMainMenu: ; 17f06 (5:7f06) call UpdateSprites jp PCMainMenu LogOff: ; 17f13 (5:7f13) - ld a, (SFX_02_46 - SFX_Headers_02) / 3 + ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish ld hl, wFlags_0xcd60 diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index 89974dd0..00889e93 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -11,7 +11,7 @@ PlayerPC: ; 78e6 (1:78e6) bit 3, a ; accessing player's PC through another PC? jr nz, PlayerPCMenu ; accessing it directly - ld a, (SFX_02_45 - SFX_Headers_02) / 3 + ld a, SFX_TURN_ON_PC call PlaySound ld hl, TurnedOnPC2Text call PrintText @@ -67,7 +67,7 @@ ExitPlayerPC: ; 796d (1:796d) bit 3, a ; accessing player's PC through another PC? jr nz, .next ; accessing it directly - ld a, (SFX_02_46 - SFX_Headers_02) / 3 + ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish .next @@ -130,7 +130,7 @@ PlayerPCDeposit: ; 7995 (1:7995) ld hl, wNumBagItems call RemoveItemFromInventory call WaitForSoundToFinish - ld a, (SFX_02_55 - SFX_Headers_02) / 3 + ld a, SFX_WITHDRAW_DEPOSIT call PlaySound call WaitForSoundToFinish ld hl, ItemWasStoredText @@ -184,7 +184,7 @@ PlayerPCWithdraw: ; 7a12 (1:7a12) ld hl, wNumBoxItems call RemoveItemFromInventory call WaitForSoundToFinish - ld a, (SFX_02_55 - SFX_Headers_02) / 3 + ld a, SFX_WITHDRAW_DEPOSIT call PlaySound call WaitForSoundToFinish ld hl, WithdrewItemText diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 7aa09df7..bd876f5b 100755 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -4,7 +4,7 @@ DisplayStartMenu:: ; 2acd (0:2acd) ld [MBC1RomBank],a ld a,[wWalkBikeSurfState] ; walking/biking/surfing ld [wWalkBikeSurfStateCopy],a - ld a, (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound + ld a, SFX_START_MENU call PlaySound RedisplayStartMenu:: ; 2adf (0:2adf) diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 0036d66e..481c0fbe 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -734,7 +734,7 @@ SwitchPartyMon_ClearGfx: ; 13625 (4:7625) dec c jr nz, .clearMonOAMLoop call WaitForSoundToFinish - ld a, (SFX_02_58 - SFX_Headers_02) / 3 + ld a, SFX_SWAP jp PlaySound SwitchPartyMon_InitVarOrSwapData: ; 13653 (4:7653) diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 0f6c6a13..8460889f 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -58,7 +58,7 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld c, 2 call DelayFrames push bc - ld a, (SFX_02_53 - SFX_Headers_02) / 3 + ld a, SFX_PUSH_BOULDER call PlaySound pop bc dec b diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index c7b2f4d6..62b054df 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -106,7 +106,7 @@ OakSpeech: ; 6115 (1:6115) .next ld a,[H_LOADEDROMBANK] push af - ld a,(SFX_02_48 - SFX_Headers_02) / 3 + ld a,SFX_SHRINK call PlaySound pop af ld [H_LOADEDROMBANK],a diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm index 86a7ab7d..b9e3102a 100755 --- a/engine/overworld/cable_club_npc.asm +++ b/engine/overworld/cable_club_npc.asm @@ -57,7 +57,7 @@ CableClubNPC: ; 71c5 (1:71c5) jr nz, .choseNo callab SaveSAVtoSRAM call WaitForSoundToFinish - ld a, (SFX_02_5d - SFX_Headers_02) / 3 + ld a, SFX_SAVE call PlaySoundWaitForCurrent ld hl, CableClubNPCPleaseWaitText call PrintText diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 94c1868c..746ea326 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -51,7 +51,7 @@ PrintCardKeyText: ; 52673 (14:6673) predef ReplaceTileBlock ld hl, wd126 set 5, [hl] - ld a, (SFX_1f_57 - SFX_Headers_1f) / 3 + ld a, SFX_GO_INSIDE jp PlaySound .noCardKey tx_pre_id CardKeyFailText diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index f7be269c..293daee7 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -60,7 +60,7 @@ UsedCut: ; ef54 (3:6f54) callba Func_79e96 ld a, $1 ld [wUpdateSpritesEnabled], a - ld a, (SFX_02_56 - SFX_Headers_02) / 3 + ld a, SFX_CUT call PlaySound ld a, $90 ld [hWY], a diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index f5b1d14c..0c30ee59 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -19,7 +19,7 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld [hSCY], a push bc ld c, BANK(SFX_02_5b) - ld a, (SFX_02_5b - SFX_Headers_02) / 3 + ld a, SFX_COLLISION call PlayMusic pop bc ld c, 2 @@ -31,7 +31,7 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld a, $ff call PlaySound ld c, BANK(SFX_02_5f) - ld a, (SFX_02_5f - SFX_Headers_02) / 3 + ld a, SFX_SAFARI_ZONE_PA call PlayMusic .asm_7bf57 ld a, [wc02a] diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index d00bbc05..fce797d0 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -28,7 +28,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld b, a .asm_7046e call Func_70503 - ld a, (SFX_02_4a - SFX_Headers_02) / 3 + ld a, SFX_HEALING_MACHINE call PlaySound ld c, 30 call DelayFrames diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 910fcf04..94f20439 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -33,7 +33,7 @@ FoundHiddenItemText: ; 7675b (1d:675b) ld c, a ld b, $1 predef FlagActionPredef - ld a, (SFX_02_3b - SFX_Headers_02) / 3 + ld a, SFX_GET_ITEM_2 call PlaySoundWaitForCurrent call WaitForSoundToFinish jp TextScriptEnd diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 3a183c0f..51819802 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -50,7 +50,7 @@ HandleLedges: ; 1a672 (6:6672) ld a, $2 ld [wSimulatedJoypadStatesIndex], a call LoadHoppingShadowOAM - ld a, (SFX_02_4e - SFX_Headers_02) / 3 + ld a, SFX_LEDGE call PlaySound ret diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 98ea466d..5ce2b2a6 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -9,7 +9,7 @@ EnterMapAnim: ; 70510 (1c:4510) bit 7, [hl] ; used fly out of battle? res 7, [hl] jr nz, .flyAnimation - ld a, (SFX_02_4c - SFX_Headers_02) / 3 + ld a, SFX_TELEPORT_2 call PlaySound ld hl, wd732 bit 4, [hl] ; used dungeon warp? @@ -17,7 +17,7 @@ EnterMapAnim: ; 70510 (1c:4510) pop hl jr nz, .dungeonWarpAnimation call PlayerSpinWhileMovingDown - ld a, (SFX_02_4f - SFX_Headers_02) / 3 + ld a, SFX_FLY_1 call PlaySound call IsPlayerStandingOnWarpPadOrHole ld a, b @@ -50,7 +50,7 @@ EnterMapAnim: ; 70510 (1c:4510) ld bc, (BANK(BirdSprite) << 8) + $0c call CopyVideoData call LoadBirdSpriteGraphics - ld a, (SFX_02_50 - SFX_Headers_02) / 3 + ld a, SFX_FLY_2 call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list @@ -99,7 +99,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) dec a jp nz, LeaveMapThroughHoleAnim .spinWhileMovingUp - ld a, (SFX_02_4b - SFX_Headers_02) / 3 + ld a, SFX_TELEPORT_1 call PlaySound ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY ld a, -$10 @@ -133,7 +133,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta xor a ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue - ld [hl], (SFX_02_4d - SFX_Headers_02) / 3 ; wPlayerSpinInPlaceAnimSoundID + ld [hl], SFX_TELEPORT_3 ; wPlayerSpinInPlaceAnimSoundID ld hl, wFacingDirectionList call PlayerSpinInPlace jr .spinWhileMovingUp @@ -146,7 +146,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba) ld [hli], a ; wFlyAnimCounter ld [hl], $c ; wFlyAnimBirdSpriteImageIndex call DoFlyAnimation - ld a, (SFX_02_50 - SFX_Headers_02) / 3 + ld a, SFX_FLY_2 call PlaySound ld hl, wFlyAnimUsingCoordList xor a ; is using coord list diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index ebc99eed..d59b2dc7 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -190,7 +190,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld a,1 ld [wBoughtOrSoldItemInMart],a .skipSettingFlag2 - ld a,(SFX_02_5a - SFX_Headers_02) / 3 + ld a,SFX_PURCHASE call PlaySoundWaitForCurrent call WaitForSoundToFinish ld hl,PokemartBoughtItemText diff --git a/engine/save.asm b/engine/save.asm index 56468595..d13a2aa7 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -161,7 +161,7 @@ SaveSAV: ; 7370a (1c:770a) call DelayFrames ld hl,GameSavedText call PrintText - ld a, (SFX_02_5d - SFX_Headers_02) / 3 ;sound for saved game + ld a, SFX_SAVE call PlaySoundWaitForCurrent call WaitForSoundToFinish ld c,30 @@ -375,7 +375,7 @@ ChangeBox:: ; 738a1 (1c:78a1) call SaveSAVtoSRAM ld hl, wChangeBoxSavedMapTextPointer call SetMapTextPointer - ld a, (SFX_02_5d - SFX_Headers_02) / 3 + ld a, SFX_SAVE call PlaySoundWaitForCurrent call WaitForSoundToFinish ret diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index ea1eb315..c7968c10 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -116,7 +116,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) ld [hli], a ld [hl], a call WaitForSoundToFinish - ld a, (SFX_1f_66 - SFX_Headers_1f) / 3 + ld a, SFX_SLOTS_NEW_SPIN call PlaySound ld hl, StartSlotMachineText call PrintText @@ -584,7 +584,7 @@ SlotReward15Func: ; 376e5 (d:76e5) ret SlotReward100Func: ; 376f3 (d:76f3) - ld a, (SFX_1f_42 - SFX_Headers_1f) / 3 + ld a, SFX_GET_KEY_ITEM call PlaySound xor a ld [wSlotMachineFlags], a @@ -595,7 +595,7 @@ SlotReward100Func: ; 376f3 (d:76f3) SlotReward300Func: ; 37702 (d:7702) ld hl, YeahText call PrintText - ld a, (SFX_1f_3b - SFX_Headers_1f) / 3 + ld a, SFX_GET_ITEM_2 call PlaySound call Random cp $80 @@ -689,7 +689,7 @@ SlotMachine_PayCoinsToPlayer: ; 3776b (d:776b) predef AddBCDPredef call SlotMachine_PrintCreditCoins call SlotMachine_PrintPayoutCoins - ld a, (SFX_1f_65 - SFX_Headers_1f) / 3 + ld a, SFX_SLOTS_REWARD call PlaySound ld a, [wAnimCounter] dec a @@ -837,7 +837,7 @@ SlotMachine_HandleInputWhileWheelsSpin: ; 37882 (d:7882) jr z, .skip .loop inc [hl] - ld a, (SFX_1f_64 - SFX_Headers_1f) / 3 + ld a, SFX_SLOTS_STOP_WHEEL jp PlaySound .skip ld a, [de] diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 3a4e2e4c..c5f72aee 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -157,7 +157,7 @@ ENDC ld d, a cp -3 jr nz, .skipPlayingSound - ld a, (SFX_1f_62 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_CRASH call PlaySound .skipPlayingSound ld a, [hli] @@ -191,7 +191,7 @@ ENDC call LoadScreenTilesFromBuffer1 ld c, 36 call DelayFrames - ld a, (SFX_1f_63 - SFX_Headers_1f) / 3 + ld a, SFX_INTRO_WHOOSH call PlaySound ; scroll game version in from the right diff --git a/engine/town_map.asm b/engine/town_map.asm index 302efa0f..a90aa331 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -69,7 +69,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld b, a and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - ld a, (SFX_02_3c - SFX_Headers_02) / 3 + ld a, SFX_TINK call PlaySound bit 6, b jr nz, .pressedUp @@ -193,7 +193,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) jr z, .inputLoop bit 0, b jr nz, .pressedA - ld a, (SFX_02_3c - SFX_Headers_02) / 3 + ld a, SFX_TINK call PlaySound bit 6, b jr nz, .pressedUp @@ -201,7 +201,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) jr nz, .pressedDown jr .pressedB .pressedA - ld a, (SFX_02_3e - SFX_Headers_02) / 3 + ld a, SFX_HEAL_AILMENT call PlaySound ld a, [hl] ld [wDestinationMap], a diff --git a/engine/trade.asm b/engine/trade.asm index 531085b9..68baaa16 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -287,7 +287,7 @@ Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298) ld b, $7 ; open end of link cable tile ID list index call CopyTileIDsFromList_ZeroBaseTileID call Trade_CopyTileMapToVRAM - ld a, (SFX_02_3d - SFX_Headers_02) / 3 + ld a, SFX_HEAL_HP call PlaySound ld c, 20 .loop @@ -332,7 +332,7 @@ Trade_AnimateBallEnteringLinkCable: ; 412d2 (10:52d2) ld c, a cp $a0 jr nc, .ballSpriteReachedEdgeOfScreen - ld a, (SFX_02_3c - SFX_Headers_02) / 3 + ld a, SFX_TINK call PlaySound jr .moveBallInsideLinkCableLoop .ballSpriteReachedEdgeOfScreen diff --git a/home.asm b/home.asm index 1b910054..cb4f7ad2 100644 --- a/home.asm +++ b/home.asm @@ -1330,7 +1330,7 @@ AddAmountSoldToMoney:: ; 2b9e (0:2b9e) ld a,MONEY_BOX ld [wTextBoxID],a call DisplayTextBoxID ; redraw money text box - ld a, (SFX_02_5a - SFX_Headers_02) / 3 + ld a, SFX_PURCHASE call PlaySoundWaitForCurrent jp WaitForSoundToFinish @@ -3490,7 +3490,7 @@ ManualTextScroll:: ; 3898 (0:3898) cp LINK_STATE_BATTLING jr z, .inLinkBattle call WaitForTextScrollButtonPress - ld a, (SFX_02_40 - SFX_Headers_02) / 3 + ld a, SFX_PRESS_AB jp PlaySound .inLinkBattle ld c, 65 @@ -4016,7 +4016,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) bit 5,[hl] pop hl jr nz,.skipPlayingSound - ld a,(SFX_02_40 - SFX_Headers_02) / 3 + ld a,SFX_PRESS_AB call PlaySound .skipPlayingSound pop af diff --git a/home/overworld.asm b/home/overworld.asm index 0485335a..814e8c54 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -674,10 +674,10 @@ PlayMapChangeSound:: ; 08c9 (0:08c9) aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on cp a,$0b ; door tile in tileset 0 jr nz,.didNotGoThroughDoor - ld a,(SFX_02_57 - SFX_Headers_02) / 3 + ld a,SFX_GO_INSIDE jr .playSound .didNotGoThroughDoor - ld a,(SFX_02_5c - SFX_Headers_02) / 3 + ld a,SFX_GO_OUTSIDE .playSound call PlaySound ld a,[wMapPalOffset] @@ -1227,9 +1227,9 @@ CollisionCheckOnLand:: ; 0bd1 (0:0bd1) jr nc,.noCollision .collision ld a,[wc02a] - cp a,(SFX_02_5b - SFX_Headers_02) / 3 ; check if collision sound is already playing + cp a,SFX_COLLISION ; check if collision sound is already playing jr z,.setCarry - ld a,(SFX_02_5b - SFX_Headers_02) / 3 + ld a,SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf @@ -1930,9 +1930,9 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7) jr .loop .collision ld a,[wc02a] - cp a,(SFX_02_5b - SFX_Headers_02) / 3 ; check if collision sound is already playing + cp a,SFX_COLLISION ; check if collision sound is already playing jr z,.setCarry - ld a,(SFX_02_5b - SFX_Headers_02) / 3 + ld a,SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf diff --git a/home/text.asm b/home/text.asm index 7eb5148b..89708306 100644 --- a/home/text.asm +++ b/home/text.asm @@ -626,13 +626,13 @@ TextCommand0B:: ; 1c31 (0:1c31) ; format: text command ID, sound ID or cry ID TextCommandSounds:: ; 1c64 (0:1c64) - db $0B,(SFX_02_3a - SFX_Headers_02) / 3 - db $12,(SFX_08_46 - SFX_Headers_08) / 3 - db $0E,(SFX_02_41 - SFX_Headers_02) / 3 - db $0F,(SFX_02_3a - SFX_Headers_02) / 3 - db $10,(SFX_02_3b - SFX_Headers_02) / 3 - db $11,(SFX_02_42 - SFX_Headers_02) / 3 - db $13,(SFX_08_45 - SFX_Headers_08) / 3 + db $0B,SFX_GET_ITEM_1 + db $12,SFX_BATTLE_06 + db $0E,SFX_POKEDEX_RATING + db $0F,SFX_GET_ITEM_1 + db $10,SFX_GET_ITEM_2 + db $11,SFX_GET_KEY_ITEM + db $13,SFX_BATTLE_05 db $14,NIDORINA ; used in OakSpeech db $15,PIDGEOT ; used in SaffronCityText12 db $16,DEWGONG ; unused? diff --git a/main.asm b/main.asm index 08747a5a..a81e7d98 100755 --- a/main.asm +++ b/main.asm @@ -1605,7 +1605,7 @@ DisplayTwoOptionMenu: ; 7559 (1:7559) pop af pop hl ld [wFlags_0xcd60], a - ld a, (SFX_02_40 - SFX_Headers_02) / 3 + ld a, SFX_PRESS_AB call PlaySound jr .pressedAButton .notNoYesMenu @@ -2631,7 +2631,7 @@ ApplyOutOfBattlePoisonDamage: ; c69c (3:469c) jr z, .skipPoisonEffectAndSound ld b, $2 predef ChangeBGPalColor0_4Frames ; change BG white to dark grey for 4 frames - ld a, (SFX_02_43 - SFX_Headers_02) / 3 + ld a, SFX_POISONED call PlaySound .skipPoisonEffectAndSound predef AnyPartyAlive @@ -3512,7 +3512,7 @@ TryPushingBoulder: ; f225 (3:7225) ld de, PushBoulderRightMovementData .done call MoveSprite - ld a, (SFX_02_53 - SFX_Headers_02) / 3 + ld a, SFX_PUSH_BOULDER call PlaySound ld hl, wFlags_0xcd60 set 1, [hl] @@ -3543,7 +3543,7 @@ DoBoulderDustAnimation: ; f2b5 (3:72b5) ld [H_SPRITEINDEX], a call GetSpriteMovementByte2Pointer ld [hl], $10 - ld a, (SFX_02_56 - SFX_Headers_02) / 3 + ld a, SFX_CUT jp PlaySound ResetBoulderPushFlags: ; f2dd (3:72dd) diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 519c0c67..53e55872 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -454,7 +454,7 @@ CeladonGameCornerText12: ; 48edd (12:4edd) ld hl, CeladonGameCornerText_48f09 call PrintText call WaitForSoundToFinish - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish ld hl, wd77e @@ -468,7 +468,7 @@ CeladonGameCornerText12: ; 48edd (12:4edd) CeladonGameCornerText_48f09: ; 48f09 (12:4f09) TX_FAR _CeladonGameCornerText_48f09 TX_ASM - ld a, (SFX_02_49 - SFX_Headers_02) / 3 + ld a, SFX_SWITCH call PlaySound call WaitForSoundToFinish jp TextScriptEnd diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index dbede0d3..9b308bd3 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -106,7 +106,7 @@ CinnabarGymScript2: ; 757f6 (1d:57f6) and a jr nz, .asm_7581b call WaitForSoundToFinish - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish .asm_7581b diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 330f2234..a9798f19 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -156,7 +156,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld de, wPlayerMoney + 2 ld c, $3 predef SubBCDPredef - ld a, (SFX_02_5a - SFX_Headers_02) / 3 + ld a, SFX_PURCHASE call PlaySoundWaitForCurrent ld a, MONEY_BOX ld [wTextBoxID], a diff --git a/scripts/lance.asm b/scripts/lance.asm index e335914b..f5095a69 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -75,7 +75,7 @@ LanceScript0: ; 5a305 (16:6305) ret nz ld hl, wd126 set 5, [hl] - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound jp LanceScript_5a2c4 diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index 6673e03b..a9e2616a 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -111,7 +111,7 @@ Mansion1Text4: ; 4435a (11:435a) set 5, [hl] ld hl, MansionSwitchPressedText call PrintText - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound ld hl, wd796 bit 0, [hl] diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index 27ccbdfb..1cacae02 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -117,7 +117,7 @@ Mansion2Text5: ; 52087 (14:6087) set 5, [hl] ld hl, Mansion2Text_520c7 call PrintText - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound ld hl, wd796 bit 0, [hl] diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 38c3f717..f41f05ff 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -107,7 +107,7 @@ Museum1FText1: ; 5c135 (17:4135) ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID - ld a, (SFX_02_5a - SFX_Headers_02) / 3 + ld a, SFX_PURCHASE call PlaySoundWaitForCurrent call WaitForSoundToFinish jr .asm_0b094 diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index 967ab77b..b798744d 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -21,7 +21,7 @@ RocketHideout1Script_44be0: ; 44be0 (11:4be0) ld a, $54 jr .asm_44c03 .asm_44bf7 - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound ld hl, wd815 bit 7, [hl] diff --git a/scripts/rockethideout2.asm b/scripts/rockethideout2.asm index c2184bdb..ead69458 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -25,7 +25,7 @@ RocketHideout2Script0: ; 44e42 (11:4e42) ld hl, wd736 set 7, [hl] call StartSimulatingJoypadStates - ld a, (SFX_02_52 - SFX_Headers_02) / 3 + ld a, SFX_ARROW_TILES call PlaySound ld a, $ff ld [wJoyIgnore], a diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index b025acd0..2060c26c 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -25,7 +25,7 @@ RocketHideout3Script0: ; 45240 (11:5240) ld hl, wd736 set 7, [hl] call StartSimulatingJoypadStates - ld a, (SFX_02_52 - SFX_Headers_02) / 3 + ld a, SFX_ARROW_TILES call PlaySound ld a, $ff ld [wJoyIgnore], a diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 635c6095..44536279 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -22,7 +22,7 @@ RocketHideout4Script_45473: ; 45473 (11:5473) ld a, $2d jr .asm_45498 .asm_4548c - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound ld hl, wd81b set 5, [hl] diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index 8b24c820..95546a99 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -77,7 +77,7 @@ Route22GateText1: ; 1e6e1 (7:66e1) Route22GateText_1e704: ; 1e704 (7:6704) TX_FAR _Route22GateText_1e704 TX_ASM - ld a, (SFX_02_51 - SFX_Headers_02) / 3 + ld a, SFX_DENIED call PlaySoundWaitForCurrent call WaitForSoundToFinish ld hl, Route22GateText_1e715 diff --git a/scripts/route23.asm b/scripts/route23.asm index eeaf2a2b..a258b88a 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -224,7 +224,7 @@ Route23Script_51388: ; 51388 (14:5388) VictoryRoadGuardText1: ; 5138e (14:538e) TX_FAR _VictoryRoadGuardText1 TX_ASM - ld a, (SFX_02_51 - SFX_Headers_02) / 3 + ld a, SFX_DENIED call PlaySoundWaitForCurrent call WaitForSoundToFinish jp TextScriptEnd diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index a8cf3b8d..c65c7aea 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -72,7 +72,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) ld b, [hl] push bc push hl - ld a, (SFX_02_54 - SFX_Headers_02) / 3 + ld a, SFX_SS_ANNE_HORN call PlaySoundWaitForCurrent ld a, $ff ld [wUpdateSpritesEnabled], a @@ -193,7 +193,7 @@ VermilionDock_1dc94: ; 1dc94 (7:5c94) ld [hli], a ld [hli], a ld [hl], a - ld a, (SFX_02_54 - SFX_Headers_02) / 3 + ld a, SFX_SS_ANNE_HORN call PlaySound ld c, 120 call DelayFrames diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index 193b3a06..614e0b4d 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -34,7 +34,7 @@ VermilionGymScript_5ca6d: ; 5ca6d (17:4a6d) ld a, $24 jr .asm_5ca7f .asm_5ca78 - ld a, (SFX_02_57 - SFX_Headers_02) / 3 + ld a, SFX_GO_INSIDE call PlaySound ld a, $5 .asm_5ca7f diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 9a0ce855..7a577095 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -41,7 +41,7 @@ ViridianGymScript0: ; 748eb (1d:48eb) call StartSimulatingJoypadStates ld hl, wd736 set 7, [hl] - ld a, (SFX_02_52 - SFX_Headers_02) / 3 + ld a, SFX_ARROW_TILES call PlaySound ld a, $ff ld [wJoyIgnore], a -- cgit v1.3.1-sl0p From f8a9c37a0019eb085c22c6e3ae53b16ff0cd4f6a Mon Sep 17 00:00:00 2001 From: dannye Date: Wed, 5 Aug 2015 16:20:29 -0500 Subject: Use more lb and other clean up --- engine/HoF_room_pc.asm | 4 +-- engine/battle/battle_transitions.asm | 2 +- engine/battle/core.asm | 58 ++++++++++++++++----------------- engine/battle/draw_hud_pokeball_gfx.asm | 2 +- engine/battle/ghost_marowak_anim.asm | 4 +-- engine/battle/trainer_ai.asm | 2 +- engine/cable_club.asm | 6 ++-- engine/clear_save.asm | 2 +- engine/evolution.asm | 2 +- engine/evos_moves.asm | 2 +- engine/gamefreak.asm | 8 ++--- engine/hall_of_fame.asm | 4 +-- engine/hidden_object_functions17.asm | 2 +- engine/hp_bar.asm | 2 +- engine/in_game_trades.asm | 18 +++++----- engine/intro.asm | 2 +- engine/items/items.asm | 32 +++++++++--------- engine/learn_move.asm | 6 ++-- engine/load_pokedex_tiles.asm | 4 +-- engine/menu/bills_pc.asm | 2 +- engine/menu/diploma.asm | 4 +-- engine/menu/league_pc.asm | 2 +- engine/menu/naming_screen.asm | 18 +++++----- engine/menu/pokedex.asm | 12 +++---- engine/menu/start_sub_menus.asm | 20 ++++++------ engine/menu/status_screen.asm | 16 ++++----- engine/oak_speech.asm | 18 +++++----- engine/oak_speech2.asm | 2 +- engine/overworld/cut.asm | 6 ++-- engine/overworld/emotion_bubbles.asm | 2 +- engine/overworld/healing_machine.asm | 2 +- engine/overworld/ledges.asm | 4 +-- engine/overworld/player_animations.asm | 8 ++--- engine/overworld/pokemart.asm | 6 ++-- engine/overworld/ssanne.asm | 2 +- engine/save.asm | 6 ++-- engine/slot_machine.asm | 2 +- engine/titlescreen.asm | 4 +-- engine/town_map.asm | 18 +++++----- engine/trade.asm | 10 +++--- home.asm | 41 +++++++++++------------ home/copy2.asm | 4 +-- home/overworld.asm | 4 +-- home/text.asm | 4 +-- main.asm | 22 ++++++------- scripts/agatha.asm | 2 +- scripts/bikeshop.asm | 2 +- scripts/billshouse.asm | 2 +- scripts/blueshouse.asm | 2 +- scripts/bruno.asm | 2 +- scripts/celadoncity.asm | 2 +- scripts/celadondiner.asm | 2 +- scripts/celadongamecorner.asm | 8 ++--- scripts/celadongym.asm | 2 +- scripts/celadonmansion5.asm | 2 +- scripts/celadonmart3.asm | 2 +- scripts/celadonmartroof.asm | 6 ++-- scripts/ceruleancity.asm | 2 +- scripts/ceruleangym.asm | 2 +- scripts/cinnabargym.asm | 2 +- scripts/copycatshouse2f.asm | 2 +- scripts/fanclub.asm | 2 +- scripts/fuchsiagym.asm | 2 +- scripts/fuchsiahouse2.asm | 2 +- scripts/fuchsiahouse3.asm | 2 +- scripts/lab3.asm | 2 +- scripts/lance.asm | 4 +-- scripts/lavenderhouse1.asm | 2 +- scripts/lorelei.asm | 2 +- scripts/mansion1.asm | 16 ++++----- scripts/mansion2.asm | 12 +++---- scripts/mtmoon3.asm | 4 +-- scripts/mtmoonpokecenter.asm | 2 +- scripts/museum1f.asm | 2 +- scripts/oakslab.asm | 2 +- scripts/pewtergym.asm | 2 +- scripts/rockethideout1.asm | 2 +- scripts/rockethideout4.asm | 2 +- scripts/route1.asm | 2 +- scripts/route12gateupstairs.asm | 2 +- scripts/route12house.asm | 2 +- scripts/route16house.asm | 2 +- scripts/route24.asm | 2 +- scripts/safarizoneentrance-yellow.asm | 2 +- scripts/safarizonesecrethouse.asm | 2 +- scripts/saffrongym.asm | 2 +- scripts/saffronhouse2.asm | 2 +- scripts/silphco10.asm | 9 ++--- scripts/silphco11.asm | 11 ++++--- scripts/silphco2.asm | 14 ++++---- scripts/silphco3.asm | 12 ++++--- scripts/silphco4.asm | 12 ++++--- scripts/silphco5.asm | 15 +++++---- scripts/silphco6.asm | 10 +++--- scripts/silphco7.asm | 17 ++++++---- scripts/silphco8.asm | 9 ++--- scripts/silphco9.asm | 18 ++++++---- scripts/ssanne7.asm | 2 +- scripts/vermiliongym.asm | 4 +-- scripts/vermilionhouse2.asm | 2 +- scripts/victoryroad1.asm | 2 +- scripts/victoryroad2.asm | 4 +-- scripts/victoryroad3.asm | 2 +- scripts/viridiancity.asm | 2 +- scripts/viridiangym.asm | 2 +- scripts/viridianmart.asm | 2 +- 106 files changed, 346 insertions(+), 326 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 15ea1524..704fea16 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -164,7 +164,7 @@ FillFourRowsWithBlack: ; 7417b (1d:417b) FillMiddleOfScreenWithWhite: ; 74183 (1d:4183) coord hl, 0, 4 ld bc, SCREEN_WIDTH * 10 - ld a, $7f ; blank white tile + ld a, " " jp FillMemory Credits: ; 7418e (1d:418e) @@ -246,7 +246,7 @@ Credits: ; 7418e (1d:418e) pop de ld de, TheEndGfx ld hl, vChars2 + $600 - ld bc, (BANK(TheEndGfx) << 8) + $0a + lb bc, BANK(TheEndGfx), $0a call CopyVideoData coord hl, 4, 8 ld de, TheEndTextString diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index e64cbabb..e9e247f9 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -184,7 +184,7 @@ DungeonMaps2: ; 70a44 (1c:4a44) LoadBattleTransitionTile: ; 70a4d (1c:4a4d) ld hl, vChars1 + $7f0 ld de, BattleTransitionTile - ld bc, (BANK(BattleTransitionTile) << 8) + $01 + lb bc, BANK(BattleTransitionTile), $01 jp CopyVideoData BattleTransitionTile: ; 70a59 (1c:4a59) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index fe7066e2..65549f7b 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -102,7 +102,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ld [wTextBoxID], a call DisplayTextBoxID coord hl, 1, 5 - ld bc, $307 + lb bc, 3, 7 call ClearScreenArea call DisableLCD call LoadFontTilePatterns @@ -110,7 +110,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ld hl, vBGMap0 ld bc, $400 .clearBackgroundLoop - ld a, $7f + ld a, " " ld [hli], a dec bc ld a, b @@ -717,8 +717,8 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3) ld [wHPBarMaxHP+1], a ld a, [hl] ld [wHPBarMaxHP], a - ld de, $fff2 - add hl, de ; skip back fomr max hp to current hp + ld de, wBattleMonHP - wBattleMonMaxHP + add hl, de ; skip back from max hp to current hp ld a, [hl] ld [wHPBarOldHP], a ; add bc to current HP add c @@ -852,7 +852,7 @@ FaintEnemyPokemon: ; 0x3c567 coord de, 12, 6 call SlideDownFaintedMonPic coord hl, 0, 0 - ld bc, $40b + lb bc, 4, 11 call ClearScreenArea ld a, [W_ISINBATTLE] dec a @@ -1100,7 +1100,7 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741) ld [wBattleMonStatus], a call ReadPlayerMonCurHPAndStatus coord hl, 9, 7 - ld bc, $50b + lb bc, 5, 11 call ClearScreenArea coord hl, 1, 10 coord de, 1, 11 @@ -1132,7 +1132,7 @@ DoUseNextMonDialogue: ; 3c79b (f:479b) call PrintText .displayYesNoBox coord hl, 13, 9 - ld bc, $a0e + lb bc, 10, 14 ld a, TWO_OPTION_MENU ld [wTextBoxID], a call DisplayTextBoxID @@ -1209,7 +1209,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) cp $c8 + SONY1 jr nz, .notSony1Battle coord hl, 0, 0 ; sony 1 battle - ld bc, $815 + lb bc, 8, 21 call ClearScreenArea call ScrollTrainerPicAfterBattle ld c, 40 @@ -1449,7 +1449,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld hl, TrainerAboutToUseText call PrintText coord hl, 0, 7 - ld bc,$0801 + lb bc, 8, 1 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID @@ -1484,7 +1484,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) .next4 call ClearSprites coord hl, 0, 0 - ld bc,$040B + lb bc, 4, 11 call ClearScreenArea ld b,1 call GoPAL_SET @@ -1886,7 +1886,7 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 9, 7 - ld bc, $50b + lb bc, 5, 11 call ClearScreenArea callab PlacePlayerHUDTiles coord hl, 18, 9 @@ -1947,7 +1947,7 @@ DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 0 - ld bc, $40c + lb bc, 4, 12 call ClearScreenArea callab PlaceEnemyHUDTiles ld de, wEnemyMonNick @@ -2055,11 +2055,11 @@ CenterMonName: ; 3ce9c (f:4e9c) .loop inc de ld a, [de] - cp $50 + cp "@" jr z, .done inc de ld a, [de] - cp $50 + cp "@" jr z, .done dec hl dec b @@ -2091,7 +2091,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; the following happens for the old man tutorial ld hl, wPlayerName ld de, W_GRASSRATE - ld bc, $b + ld bc, 11 call CopyData ; temporarily save the player name in unused space, ; which is supposed to get overwritten when entering a ; map with wild Pokémon. Due to an oversight, the data @@ -2099,14 +2099,14 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; Missingno. glitch can show up. ld hl, .oldManName ld de, wPlayerName - ld bc, $b + ld bc, 11 call CopyData ; the following simulates the keystrokes by drawing menus on screen coord hl, 9, 14 ld [hl], "▶" ld c, 80 call DelayFrames - ld [hl], $7f + ld [hl], " " coord hl, 9, 16 ld [hl], "▶" ld c, 50 @@ -2395,7 +2395,7 @@ PartyMenuOrRockOrRun: .partyMonDeselected coord hl, 11, 11 ld bc, $81 - ld a, $7f + ld a, " " call FillMemory xor a ; NORMAL_PARTY_MENU ld [wPartyMenuTypeOrMessageID], a @@ -2585,7 +2585,7 @@ MoveSelectionMenu: ; 3d219 (f:5219) .relearnmenu ld a, [wWhichPokemon] ld hl, wPartyMon1Moves - ld bc, $2c + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes call .loadmoves coord hl, 4, 7 @@ -2662,7 +2662,7 @@ SelectMenuItem: ; 3d2fe (f:52fe) jr z, .select coord hl, 5, 13 dec a - ld bc, $14 + ld bc, SCREEN_WIDTH call AddNTimes ld [hl], $ec .select @@ -2862,7 +2862,7 @@ SwapMovesInMenu: ; 3d435 (f:5435) push hl call .swapBytes ; swap moves pop hl - ld bc, $15 + ld bc, wPartyMon1PP - wPartyMon1Moves add hl, bc call .swapBytes ; swap move PP xor a @@ -6318,7 +6318,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) call GetMonName ld hl, wcd6d ld de, wEnemyMonNick - ld bc, $b + ld bc, 11 call CopyData ld a, [wEnemyMonSpecies2] ld [wd11e], a @@ -6718,11 +6718,11 @@ LoadHudTilePatterns: ; 3ee5b (f:6e5b) .lcdEnabled ld de, BattleHudTiles1 ld hl, vChars2 + $6d0 - ld bc, (BANK(BattleHudTiles1) << 8) + $03 + lb bc, BANK(BattleHudTiles1), $03 call CopyVideoDataDouble ld de, BattleHudTiles2 ld hl, vChars2 + $730 - ld bc, (BANK(BattleHudTiles2) << 8) + $06 + lb bc, BANK(BattleHudTiles2), $06 jp CopyVideoDataDouble PrintEmptyString: ; 3ee94 (f:6e94) @@ -6942,10 +6942,10 @@ InitBattle_Common: ; 3efeb (f:6feb) ld [H_AUTOBGTRANSFERDEST + 1], a call LoadScreenTilesFromBuffer1 coord hl, 9, 7 - ld bc, $50a + lb bc, 5, 10 call ClearScreenArea coord hl, 1, 0 - ld bc, $40a + lb bc, 4, 10 call ClearScreenArea call ClearSprites ld a, [W_ISINBATTLE] @@ -7089,8 +7089,8 @@ LoadMonBackPic: ; 3f103 (f:7103) ld a, [wBattleMonSpecies2] ld [wcf91], a coord hl, 1, 5 - ld b, $7 - ld c, $8 + ld b, 7 + ld c, 8 call ClearScreenArea ld hl, W_MONHBACKSPRITE - W_MONHEADER call UncompressMonSprite @@ -7928,7 +7928,7 @@ FellText: ; 3f683 (f:7683) PrintStatText: ; 3f688 (f:7688) ld hl, StatsTextStrings - ld c, $50 + ld c, "@" .asm_3f68d dec b jr z, .asm_3f696 diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 1e229b1c..7198d984 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -13,7 +13,7 @@ DrawEnemyPokeballs: ; 3a857 (e:6857) LoadPartyPokeballGfx: ; 3a85d (e:685d) ld de, PokeballTileGraphics ld hl, vSprites + $310 - ld bc, (BANK(PokeballTileGraphics) << 8) + $04 + lb bc, BANK(PokeballTileGraphics), $04 jp CopyVideoData SetupOwnPartyPokeballs: ; 3a869 (e:6869) diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 96e65f70..d76f3f41 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -5,7 +5,7 @@ MarowakAnim: ; 708ca (1c:48ca) call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap coord hl, 12, 0 - ld bc, $707 + lb bc, 7, 7 call ClearScreenArea call Delay3 xor a @@ -59,7 +59,7 @@ CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) ld a, $70 ld [W_BASECOORDX], a ld hl, wOAMBuffer - ld bc, $606 + lb bc, 6, 6 ld d, $8 .oamLoop push bc diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index fb932035..9102b2d8 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -665,7 +665,7 @@ AISwitchIfEnoughMons: ; 3a72a (e:672a) inc d .Fainted push bc - ld bc,$2C + ld bc, wEnemyMon2 - wEnemyMon1 add hl,bc pop bc dec c diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 9ccffdbb..07284d13 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -96,7 +96,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345 ld a, SERIAL_PATCH_LIST_PART_TERMINATOR ld [de], a ; end of part 1 inc de - ld bc, $100 + lb bc, 1, 0 jr .patchPartyMonsLoop .finishedPatchingPlayerData ld a, SERIAL_PATCH_LIST_PART_TERMINATOR @@ -400,7 +400,7 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a coord hl, 1, 1 - ld bc, $0601 + lb bc, 6, 1 call ClearScreenArea .playerMonMenu_HandleInput ld hl, hFlags_0xFFF6 @@ -713,7 +713,7 @@ TradeCenter_Trade: call TextCommandProcessor call SaveScreenTilesToBuffer1 coord hl, 10, 7 - ld bc, $080b + lb bc, 8, 11 ld a, TRADE_CANCEL_MENU ld [wTwoOptionMenuID], a ld a, TWO_OPTION_MENU diff --git a/engine/clear_save.asm b/engine/clear_save.asm index 2febb123..d4f05071 100755 --- a/engine/clear_save.asm +++ b/engine/clear_save.asm @@ -6,7 +6,7 @@ DoClearSaveDialogue: ; 1c98a (7:498a) ld hl, ClearSaveDataText call PrintText coord hl, 14, 7 - ld bc, $80f + lb bc, 8, 15 ld a, NO_YES_MENU ld [wTwoOptionMenuID], a ld a, TWO_OPTION_MENU diff --git a/engine/evolution.asm b/engine/evolution.asm index a39f5a97..720e77cd 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -48,7 +48,7 @@ EvolveMon: ; 7bde9 (1e:7de9) call DelayFrames ld c, $1 call EvolutionSetWholeScreenPalette - ld bc, $110 + lb bc, $1, $10 .animLoop push bc call Evolution_CheckForCancel diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 137b75e0..16e893e5 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -278,7 +278,7 @@ RenameEvolvedMon: ; 3aef7 (e:6ef7) cp $50 jr nz, .compareNamesLoop ld a, [wWhichPokemon] - ld bc, $b + ld bc, 11 ld hl, wPartyMonNicks call AddNTimes push hl diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index 49c938f7..73e4f074 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -5,15 +5,15 @@ LoadShootingStarGraphics: ; 70000 (1c:4000) ld [rOBP1], a ld de, AnimationTileset2 + $30 ; star tile (top left quadrant) ld hl, vChars1 + $200 - ld bc, (BANK(AnimationTileset2) << 8) + $01 + lb bc, BANK(AnimationTileset2), $01 call CopyVideoData ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant) ld hl, vChars1 + $210 - ld bc, (BANK(AnimationTileset2) << 8) + $01 + lb bc, BANK(AnimationTileset2), $01 call CopyVideoData ld de, FallingStar ld hl, vChars1 + $220 - ld bc, (BANK(FallingStar) << 8) + $01 + lb bc, BANK(FallingStar), $01 call CopyVideoData ld hl, GameFreakLogoOAMData ld de, wOAMBuffer + $60 @@ -31,7 +31,7 @@ AnimateShootingStar: ; 70044 (1c:4044) ; Move the big star down and left across the screen. ld hl, wOAMBuffer - ld bc, $a004 + lb bc, $a0, $4 .bigStarLoop push hl push bc diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 28f03bf5..ce1430e3 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -8,7 +8,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0) call DisableLCD ld hl,vBGMap0 ld bc, $800 - ld a, $7f + ld a, " " call FillMemory call EnableLCD ld hl, rLCDC @@ -187,7 +187,7 @@ HoFLoadPlayerPics: ; 7033e (1c:433e) ld a, BANK(RedPicFront) call UncompressSpriteFromDE ld hl, S_SPRITEBUFFER1 - ld de, $a000 + ld de, S_SPRITEBUFFER0 ld bc, $310 call CopyData ld de, vFrontPic diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index aad8c468..a2167b54 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -194,7 +194,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld hl, wd730 set 6, [hl] coord hl, 0, 0 - ld bc, $060a + lb bc, 6, 10 call TextBoxBorder coord hl, 1, 2 ld de, StatusAilmentText1 diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 112e65a3..792661ab 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -222,7 +222,7 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5) .next add hl, de push hl - ld a, $7f + ld a, " " ld [hli], a ld [hli], a ld [hli], a diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index 96c37ab0..b4a73e59 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -17,7 +17,7 @@ DoInGameTradeDialogue: ; 71ad9 (1c:5ad9) ld a,[hli] push af ld de,wInGameTradeMonNick - ld bc,$000b + ld bc, 11 call CopyData pop af ld l,a @@ -81,7 +81,7 @@ InGameTrade_GetMonName: ; 71b6a (1c:5b6a) call GetMonName ld hl,wcd6d pop de - ld bc,$b + ld bc, 11 jp CopyData INCLUDE "data/trades.asm" @@ -105,7 +105,7 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07) jr nz,.tradeFailed ; jump if the selected mon's species is not the required one ld a,[wWhichPokemon] ld hl,wPartyMon1Level - ld bc,$002c + ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a,[hl] ld [W_CURENEMYLVL],a @@ -168,11 +168,11 @@ InGameTrade_PrepareTradeData: ; 71cc1 (1c:5cc1) ld a, [wInGameTradeReceiveMonSpecies] ld [hl], a ; wTradedEnemyMonSpecies ld hl, wPartyMonOT - ld bc, $b + ld bc, 11 ld a, [wWhichPokemon] call AddNTimes ld de, wTradedPlayerMonOT - ld bc, $b + ld bc, 11 call InGameTrade_CopyData ld hl, InGameTrade_TrainerString ld de, wTradedEnemyMonOT @@ -201,16 +201,16 @@ InGameTrade_CopyData: ; 71d11 (1c:5d11) InGameTrade_CopyDataToReceivedMon: ; 71d19 (1c:5d19) ld hl, wPartyMonNicks - ld bc, $b + ld bc, 11 call InGameTrade_GetReceivedMonPointer ld hl, wInGameTradeMonNick - ld bc, $b + ld bc, 11 call CopyData ld hl, wPartyMonOT - ld bc, $b + ld bc, 11 call InGameTrade_GetReceivedMonPointer ld hl, InGameTrade_TrainerString - ld bc, $b + ld bc, 11 call CopyData ld hl, wPartyMon1OTID ld bc, wPartyMon2 - wPartyMon1 diff --git a/engine/intro.asm b/engine/intro.asm index c7c4a04d..154c41fd 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -28,7 +28,7 @@ PlayIntroScene: ; 4169d (10:569d) ld [W_BASECOORDX], a ld a, 80 ld [W_BASECOORDY], a - ld bc, $606 + lb bc, 6, 6 call InitIntroNidorinoOAM ld de, $28ff ; move Nidorino right by 80 pixels call IntroMoveMon diff --git a/engine/items/items.asm b/engine/items/items.asm index 2cbe6a02..364570da 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -734,22 +734,22 @@ ItemUseMedicine: ; dabb (3:5abb) ld bc,4 add hl,bc ; hl now points to status ld a,[wcf91] - ld bc, (ANTIDOTE_MSG << 8) | (1 << PSN) + lb bc, ANTIDOTE_MSG, 1 << PSN cp a,ANTIDOTE jr z,.checkMonStatus - ld bc, (BURN_HEAL_MSG << 8) | (1 << BRN) + lb bc, BURN_HEAL_MSG, 1 << BRN cp a,BURN_HEAL jr z,.checkMonStatus - ld bc, (ICE_HEAL_MSG << 8) | (1 << FRZ) + lb bc, ICE_HEAL_MSG, 1 << FRZ cp a,ICE_HEAL jr z,.checkMonStatus - ld bc, (AWAKENING_MSG << 8) | SLP + lb bc, AWAKENING_MSG, SLP cp a,AWAKENING jr z,.checkMonStatus - ld bc, (PARALYZ_HEAL_MSG << 8) | (1 << PAR) + lb bc, PARALYZ_HEAL_MSG, 1 << PAR cp a,PARLYZ_HEAL jr z,.checkMonStatus - ld bc, (FULL_HEAL_MSG << 8) | $ff ; Full Heal + lb bc, FULL_HEAL_MSG, $ff ; Full Heal .checkMonStatus ld a,[hl] ; pokemon's status and c ; does the pokemon have a status ailment the item can cure? @@ -1737,7 +1737,7 @@ CoinCaseNumCoinsText: ; e247 (3:6247) ItemUseOldRod: ; e24c (3:624c) call FishingInit jp c, ItemUseNotTime - ld bc, (5 << 8) | MAGIKARP + lb bc, 5, MAGIKARP ld a, $1 ; set bite jr RodResponse @@ -2088,7 +2088,7 @@ ItemUseTMHM: ; e479 (3:6479) ld hl,TeachMachineMoveText call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu @@ -2479,7 +2479,7 @@ TossItem_: ; e6f1 (3:66f1) ld hl,IsItOKToTossItemText call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu @@ -2578,14 +2578,14 @@ SendNewMonToBox: ; e7a4 (3:67a4) jr nz, .asm_e7b1 call GetMonHeader ld hl, wBoxMonOT - ld bc, $b + ld bc, 11 ld a, [W_NUMINBOX] dec a jr z, .asm_e7ee dec a call AddNTimes push hl - ld bc, $b + ld bc, 11 add hl, bc ld d, h ld e, l @@ -2596,7 +2596,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7db push bc push hl - ld bc, $b + ld bc, 11 call CopyData pop hl ld d, h @@ -2609,17 +2609,17 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7ee ld hl, wPlayerName ld de, wBoxMonOT - ld bc, $b + ld bc, 11 call CopyData ld a, [W_NUMINBOX] dec a jr z, .asm_e82a ld hl, wBoxMonNicks - ld bc, $b + ld bc, 11 dec a call AddNTimes push hl - ld bc, $b + ld bc, 11 add hl, bc ld d, h ld e, l @@ -2630,7 +2630,7 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e817 push bc push hl - ld bc, $b + ld bc, 11 call CopyData pop hl ld d, h diff --git a/engine/learn_move.asm b/engine/learn_move.asm index 66d27a40..88dedd3d 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -5,7 +5,7 @@ LearnMove: ; 6e43 (1:6e43) call GetPartyMonName ld hl, wcd6d ld de, wd036 - ld bc, $b + ld bc, 11 call CopyData DontAbandonLearning: ; 6e5b (1:6e5b) @@ -77,7 +77,7 @@ AbandonLearning: ; 6eda (1:6eda) ld hl, AbandonLearningText call PrintText coord hl, 14, 7 - ld bc, $80f + lb bc, 8, 15 ld a, TWO_OPTION_MENU ld [wTextBoxID], a call DisplayTextBoxID ; yes/no menu @@ -100,7 +100,7 @@ TryingToLearn: ; 6f07 (1:6f07) ld hl, TryingToLearnText call PrintText coord hl, 14, 7 - ld bc, $80f + lb bc, 8, 15 ld a, TWO_OPTION_MENU ld [wTextBoxID], a call DisplayTextBoxID ; yes/no menu diff --git a/engine/load_pokedex_tiles.asm b/engine/load_pokedex_tiles.asm index 5c1f1c93..f4e45247 100755 --- a/engine/load_pokedex_tiles.asm +++ b/engine/load_pokedex_tiles.asm @@ -3,9 +3,9 @@ LoadPokedexTilePatterns: ; 17840 (5:7840) call LoadHpBarAndStatusTilePatterns ld de,PokedexTileGraphics ld hl,vChars2 + $600 - ld bc,(BANK(PokedexTileGraphics) << 8) + $12 + lb bc, BANK(PokedexTileGraphics), $12 call CopyVideoData ld de,PokeballTileGraphics ld hl,vChars2 + $720 - ld bc,(BANK(PokeballTileGraphics) << 8) + $01 + lb bc, BANK(PokeballTileGraphics), $01 jp CopyVideoData ; load pokeball tile for marking caught mons diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index a810afd2..072a19d3 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -116,7 +116,7 @@ BillsPCMenu: ; 214e8 (8:54e8) ld [wCurrentMenuItem], a ld hl, vChars2 + $780 ld de, PokeballTileGraphics - ld bc, (BANK(PokeballTileGraphics) << 8) + $01 + lb bc, BANK(PokeballTileGraphics), $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer coord hl, 0, 0 diff --git a/engine/menu/diploma.asm b/engine/menu/diploma.asm index 56373dd3..3e28bc93 100755 --- a/engine/menu/diploma.asm +++ b/engine/menu/diploma.asm @@ -13,7 +13,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ld a, BANK(CircleTile) call FarCopyData2 coord hl, 0, 0 - ld bc, $1012 + lb bc, 16, 18 predef Diploma_TextBoxBorder ld hl, DiplomaTextPointersAndCoords ld c, $5 @@ -41,7 +41,7 @@ DisplayDiploma: ; 566e2 (15:66e2) ; Move the player 33 pixels right and set the priority bit so he appears ; behind the background layer. ld hl, wOAMBuffer + $01 - ld bc, $8028 + lb bc, $80, $28 .adjustPlayerGfxLoop ld a, [hl] ; X add 33 diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index b4c7f774..21c3f9e7 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -90,7 +90,7 @@ LeaguePCShowMon: ; 76610 (1d:6610) ld a, [hli] ld [wHoFMonLevel], a ld de, wcd6d - ld bc, $000B + ld bc, 11 call CopyData ld b, $0B ld c, 0 diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 20745c58..967f11e8 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -5,8 +5,8 @@ AskName: ; 64eb (1:64eb) ld a, [W_ISINBATTLE] dec a coord hl, 0, 0 - ld b, $4 - ld c, $b + ld b, 4 + ld c, 11 call z, ClearScreenArea ; only if in wild batle ld a, [wcf91] ld [wd11e], a @@ -14,7 +14,7 @@ AskName: ; 64eb (1:64eb) ld hl, DoYouWantToNicknameText call PrintText coord hl, 14, 7 - ld bc, $80f + lb bc, 8, 15 ld a, TWO_OPTION_MENU ld [wTextBoxID], a call DisplayTextBoxID @@ -64,10 +64,10 @@ DisplayNameRaterScreen: ; 655c (1:655c) call RestoreScreenTilesAndReloadTilePatterns call LoadGBPal ld a, [wcf4b] - cp $50 + cp "@" jr z, .playerCancelled ld hl, wPartyMonNicks - ld bc, $b + ld bc, 11 ld a, [wWhichPokemon] call AddNTimes ld e, l @@ -269,7 +269,7 @@ DisplayNamingScreen: ; 6596 (1:6596) ret z call CalcStringLength dec hl - ld [hl], $50 + ld [hl], "@" ret .pressedRight ld a, [wCurrentMenuItem] @@ -342,7 +342,7 @@ PrintAlphabet: ; 676f (1:676f) ld de, UpperCaseAlphabet .lowercase coord hl, 2, 5 - ld bc, $509 ; 5 rows, 9 columns + lb bc, 5, 9 ; 5 rows, 9 columns .outerLoop push bc .innerLoop @@ -373,7 +373,7 @@ PrintNicknameAndUnderscores: ; 680e (1:680e) ld a, c ld [wNamingScreenNameLength], a coord hl, 10, 2 - ld bc, $10a + lb bc, 1, 10 call ClearScreenArea coord hl, 10, 2 ld de, wcf4b @@ -458,7 +458,7 @@ CalcStringLength: ; 68eb (1:68eb) ld c, $0 .loop ld a, [hl] - cp $50 + cp "@" ret z inc hl inc c diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 4b350379..ead2c359 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -120,7 +120,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) push bc coord hl, 0, 3 ld de,20 - ld bc,$7f0d ; 13 blank tiles + lb bc, " ", 13 call DrawTileLine ; cover up the menu cursor in the pokemon list pop bc ret @@ -128,7 +128,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) push bc coord hl, 15, 10 ld de,20 - ld bc,$7f07 ; 7 blank tiles + lb bc, " ", 7 call DrawTileLine ; cover up the menu cursor in the side menu pop bc jr .exitSideMenu @@ -212,7 +212,7 @@ HandlePokedexListMenu: ; 40111 (10:4111) xor a ld [H_AUTOBGTRANSFERENABLED],a coord hl, 4, 2 - ld bc,$0e0a + lb bc, 14, 10 call ClearScreenArea coord hl, 1, 3 ld a,[wListScrollOffset] @@ -413,14 +413,14 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld [hTilesetType],a coord hl, 0, 0 ld de,1 - ld bc,$6414 + lb bc, $64, SCREEN_WIDTH call DrawTileLine ; draw top border coord hl, 0, 17 - ld b,$6f + ld b, $6f call DrawTileLine ; draw bottom border coord hl, 0, 1 ld de,20 - ld bc,$6610 + lb bc, $66, $10 call DrawTileLine ; draw left border coord hl, 19, 1 ld b,$67 diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 683930d1..f061fbf6 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -34,7 +34,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) ld [wTextBoxID],a call DisplayTextBoxID ; display pokemon menu options ld hl,wFieldMoves - ld bc,$020c ; max menu item ID, top menu item Y + lb bc, $02, $0c ; max menu item ID, top menu item Y ld e,5 .adjustMenuVariablesLoop dec e @@ -523,7 +523,7 @@ StartMenu_TrainerInfo: ; 13460 (4:7460) ; loads tile patterns and draws everything except for gym leader faces / badges DrawTrainerInfo: ; 1349a (4:749a) ld de,RedPicFront - ld bc,(BANK(RedPicFront) << 8) | $01 + lb bc, BANK(RedPicFront), $01 predef DisplayPicCenteredOrUpperRight call DisableLCD coord hl, 0, 2 @@ -632,7 +632,7 @@ TrainerInfo_BadgesText: ; 13597 (4:7597) ; [wTrainerInfoTextBoxNextRowOffset] = distance from the end of a text box row to the start of the next TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) ld a,$79 ; upper left corner tile ID - ld de,$7a7b ; top edge and upper right corner tile ID's + lb de, $7a, $7b ; top edge and upper right corner tile ID's call TrainerInfo_DrawHorizontalEdge ; draw top edge call TrainerInfo_NextTextBoxRow ld a,[wTrainerInfoTextBoxWidthPlus1] @@ -647,7 +647,7 @@ TrainerInfo_DrawTextBox: ; 135a0 (4:75a0) dec c jr nz,.loop ld a,$7d ; lower left corner tile ID - ld de,$777e ; bottom edge and lower right corner tile ID's + lb de,$77, $7e ; bottom edge and lower right corner tile ID's TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3) ld [hli],a ; place left corner tile @@ -813,36 +813,36 @@ SwitchPartyMon_InitVarOrSwapData: ; 13653 (4:7653) call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer - ld bc, $b + ld bc, 11 call CopyData ld hl, wPartyMonOT ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de push hl - ld bc, $b + ld bc, 11 call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, $b + ld bc, 11 call CopyData ld hl, wPartyMonNicks ld a, [wCurrentMenuItem] call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer - ld bc, $b + ld bc, 11 call CopyData ld hl, wPartyMonNicks ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de push hl - ld bc, $b + ld bc, 11 call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, $b + ld bc, 11 call CopyData ld a, [wMenuItemToSwap] ld [wSwappedMenuItem], a diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index c6550217..d8a504bb 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -87,34 +87,34 @@ StatusScreen: ; 12953 (4:6953) call LoadHpBarAndStatusTilePatterns ld de, BattleHudTiles1 ; source ld hl, vChars2 + $6d0 ; dest - ld bc, (BANK(BattleHudTiles1) << 8) + $03 ; bank bytes/8 + lb bc, BANK(BattleHudTiles1), $03 call CopyVideoDataDouble ; ·│ :L and halfarrow line end ld de, BattleHudTiles2 ld hl, vChars2 + $780 - ld bc, (BANK(BattleHudTiles2) << 8) + $01 + lb bc, BANK(BattleHudTiles2), $01 call CopyVideoDataDouble ; │ ld de, BattleHudTiles3 ld hl, vChars2 + $760 - ld bc, (BANK(BattleHudTiles3) << 8) + $02 + lb bc, BANK(BattleHudTiles3), $02 call CopyVideoDataDouble ; ─┘ ld de, PTile ld hl, vChars2 + $720 - ld bc,(BANK(PTile) << 8 | $01) + lb bc, BANK(PTile), $01 call CopyVideoDataDouble ; P (for PP), inline ld a, [hTilesetType] push af xor a ld [hTilesetType], a coord hl, 19, 1 - ld bc, $060a + lb bc, 6, 10 call DrawLineBox ; Draws the box around name, HP and status - ld de, $fffa + ld de, -6 add hl, de ld [hl], $f2 ; . after No ("." is a different one) dec hl ld [hl], "№" coord hl, 19, 9 - ld bc, $0806 + lb bc, 8, 6 call DrawLineBox ; Draws the box around types, ID No. and OT coord hl, 10, 9 ld de, Type1Text @@ -224,7 +224,7 @@ OKText: ; 12ac4 (4:6ac4) ; Draws a line starting from hl high b and wide c DrawLineBox: ; 0x12ac7 - ld de, $0014 ; New line + ld de, SCREEN_WIDTH ; New line .PrintVerticalLine ld [hl], $78 ; │ add hl, de diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 5b6c29e1..98499d7f 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -24,11 +24,11 @@ SetDefaultNames: ; 60ca (1:60ca) call z, InitOptions ld hl, NintenText ld de, wPlayerName - ld bc, $b + ld bc, 11 call CopyData ld hl, SonyText ld de, W_RIVALNAME - ld bc, $b + ld bc, 11 jp CopyData OakSpeech: ; 6115 (1:6115) @@ -57,7 +57,7 @@ OakSpeech: ; 6115 (1:6115) bit 1,a ; possibly a debug mode bit jp nz,.skipChoosingNames ld de,ProfOakPic - ld bc, (Bank(ProfOakPic) << 8) | $00 + lb bc, Bank(ProfOakPic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl,OakSpeechText1 @@ -76,7 +76,7 @@ OakSpeech: ; 6115 (1:6115) call GBFadeOutToWhite call ClearScreen ld de,RedPicFront - ld bc,(Bank(RedPicFront) << 8) | $00 + lb bc, Bank(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call MovePicLeft ld hl,IntroducePlayerText @@ -85,7 +85,7 @@ OakSpeech: ; 6115 (1:6115) call GBFadeOutToWhite call ClearScreen ld de,Rival1Pic - ld bc,(Bank(Rival1Pic) << 8) | $00 + lb bc, Bank(Rival1Pic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl,IntroduceRivalText @@ -95,7 +95,7 @@ OakSpeech: ; 6115 (1:6115) call GBFadeOutToWhite call ClearScreen ld de,RedPicFront - ld bc,(Bank(RedPicFront) << 8) | $00 + lb bc, Bank(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call GBFadeInFromWhite ld a,[wd72d] @@ -115,15 +115,15 @@ OakSpeech: ; 6115 (1:6115) call DelayFrames ld de,RedSprite ld hl,vSprites - ld bc,(BANK(RedSprite) << 8) | $0C + lb bc, BANK(RedSprite), $0C call CopyVideoData ld de,ShrinkPic1 - ld bc,(BANK(ShrinkPic1) << 8) | $00 + lb bc, BANK(ShrinkPic1), $00 call IntroDisplayPicCenteredOrUpperRight ld c,4 call DelayFrames ld de,ShrinkPic2 - ld bc,(BANK(ShrinkPic2) << 8) | $00 + lb bc, BANK(ShrinkPic2), $00 call IntroDisplayPicCenteredOrUpperRight call ResetPlayerSpriteData ld a,[H_LOADEDROMBANK] diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index bdc4d38f..50e3708c 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -73,7 +73,7 @@ OakSpeechSlidePicLeft: ; 69ec (1:69ec) call DelayFrames pop de ld hl, wcd6d - ld bc, $b + ld bc, 11 call CopyData call Delay3 coord hl, 12, 4 diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 2056bbb0..30aedbc1 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -82,11 +82,11 @@ InitCutAnimOAM: ; eff7 (3:6ff7) ; tree ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row ld hl, vChars1 + $7c0 - ld bc, (BANK(Overworld_GFX) << 8) + $02 + lb bc, BANK(Overworld_GFX), $02 call CopyVideoData ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row ld hl, vChars1 + $7e0 - ld bc, (BANK(Overworld_GFX) << 8) + $02 + lb bc, BANK(Overworld_GFX), $02 call CopyVideoData jr WriteCutOrBoulderDustAnimationOAMBlock .grass @@ -113,7 +113,7 @@ InitCutAnimOAM: ; eff7 (3:6ff7) LoadCutGrassAnimationTilePattern: ; f04c (3:704c) ld de, AnimationTileset2 + $60 ; tile depicting a leaf - ld bc, (BANK(AnimationTileset2) << 8) + $01 + lb bc, BANK(AnimationTileset2), $01 jp CopyVideoData WriteCutOrBoulderDustAnimationOAMBlock: ; f055 (3:7055) diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 22dfb24f..ebd441aa 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -9,7 +9,7 @@ EmotionBubble: ; 17c47 (5:7c47) inc hl ld d, [hl] ld hl, vChars1 + $780 - ld bc, (BANK(EmotionBubblesPointerTable) << 8) + $04 + lb bc, BANK(EmotionBubblesPointerTable), $04 call CopyVideoData ld a, [wUpdateSpritesEnabled] push af diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index b123f33f..d3513b0d 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -1,7 +1,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld de, PokeCenterFlashingMonitorAndHealBall ld hl, vChars0 + $7c0 - ld bc, (BANK(PokeCenterFlashingMonitorAndHealBall) << 8) + $03 + lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 call CopyVideoData ld hl, wUpdateSpritesEnabled ld a, [hl] diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 51819802..5a3bfbe0 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -69,10 +69,10 @@ LedgeTiles: ; 1a6cf (6:66cf) LoadHoppingShadowOAM: ; 1a6f0 (6:66f0) ld hl, vChars1 + $7f0 ld de, LedgeHoppingShadow - ld bc, (BANK(LedgeHoppingShadow) << 8) + $01 + lb bc, BANK(LedgeHoppingShadow), $01 call CopyVideoDataDouble ld a, $9 - ld bc, $5448 ; b, c = y, x coordinates of shadow + lb bc, $54, $48 ; b, c = y, x coordinates of shadow ld de, LedgeHoppingShadowOAM call WriteOAMBlock ret diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 1a3d374f..74762b00 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -47,7 +47,7 @@ EnterMapAnim: ; 70510 (1c:4510) pop hl ld de, BirdSprite ld hl, vNPCSprites - ld bc, (BANK(BirdSprite) << 8) + $0c + lb bc, BANK(BirdSprite), $0c call CopyVideoData call LoadBirdSpriteGraphics ld a, SFX_FLY @@ -250,11 +250,11 @@ DoFlyAnimation: ; 706ae (1c:46ae) LoadBirdSpriteGraphics: ; 706d7 (1c:46d7) ld de, BirdSprite ld hl, vNPCSprites - ld bc, (BANK(BirdSprite) << 8) + $0c + lb bc, BANK(BirdSprite), $0c call CopyVideoData ld de, BirdSprite + $c0 ; moving animation sprite ld hl, vNPCSprites2 - ld bc, (BANK(BirdSprite) << 8) + $0c + lb bc, BANK(BirdSprite), $0c jp CopyVideoData InitFacingDirectionList: ; 706ef (1c:46ef) @@ -388,7 +388,7 @@ FishingAnim: ; 707b6 (1c:47b6) set 6, [hl] ; reserve the last 4 OAM entries ld de, RedSprite ld hl, vNPCSprites - ld bc, (BANK(RedSprite) << 8) + $0c + lb bc, BANK(RedSprite), $0c call CopyVideoData ld a, $4 ld hl, RedFishingTiles diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index d59b2dc7..ae96c4a9 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -82,10 +82,10 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) inc a jr z,.sellMenuLoop ; if the player closed the choose quantity menu with the B button ld hl,PokemartTellSellPriceText - ld bc,$0e01 + lb bc, 14, 1 ; location that PrintText always prints to, this is useless call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 08, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu @@ -163,7 +163,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld hl,PokemartTellBuyPriceText call PrintText coord hl, 14, 7 - ld bc,$080f + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index 8c5485e2..1dccd026 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -85,7 +85,7 @@ LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0) LoadSmokeTile: ; 79fd4 (1e:5fd4) ld de, SSAnneSmokePuffTile - ld bc, (BANK(SSAnneSmokePuffTile) << 8) + $01 + lb bc, BANK(SSAnneSmokePuffTile), $01 jp CopyVideoData SSAnneSmokePuffTile: ; 79fdd (1e:5fdd) diff --git a/engine/save.asm b/engine/save.asm index 70295044..dfc50616 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -155,8 +155,8 @@ SaveSAV: ; 7370a (1c:770a) .save call SaveSAVtoSRAM coord hl, 1, 13 - ld bc,$0412 - call ClearScreenArea ; clear area 4x12 starting at 13,1 + lb bc, 4, 18 + call ClearScreenArea coord hl, 1, 14 ld de,NowSavingString call PlaceString @@ -176,7 +176,7 @@ NowSavingString: SaveSAVConfirm: ; 73768 (1c:7768) call PrintText coord hl, 0, 7 - ld bc,$0801 + lb bc, 8, 1 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 3345a9dc..3b392dde 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -134,7 +134,7 @@ MainSlotMachineLoop: ; 37395 (d:7395) ld hl, OneMoreGoSlotMachineText call PrintText coord hl, 14, 12 - ld bc, $0d0f + lb bc, 13, 15 xor a ; YES_NO_MENU ld [wTwoOptionMenuID], a ld a, TWO_OPTION_MENU diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 84c0cdf7..df47275b 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -1,6 +1,6 @@ ; copy text of fixed length $b (like player name, rival name, mon names, ...) CopyFixedLengthText: ; 42b1 (1:42b1) - ld bc, $b + ld bc, 11 jp CopyData SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) @@ -377,7 +377,7 @@ LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538) LoadCopyrightTiles: ; 4541 (1:4541) ld de, NintendoCopyrightLogoGraphics ld hl, vChars2 + $600 - ld bc, (BANK(NintendoCopyrightLogoGraphics) << 8) + $1c + lb bc, BANK(NintendoCopyrightLogoGraphics), $1c call CopyVideoData coord hl, 2, 7 ld de, CopyrightTextString diff --git a/engine/town_map.asm b/engine/town_map.asm index f5a047c3..037a59fa 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -20,7 +20,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) call CopyData ld hl, vSprites + $40 ld de, TownMapCursor - ld bc, (BANK(TownMapCursor) << 8) + $04 + lb bc, BANK(TownMapCursor), $04 call CopyVideoDataDouble xor a ld [wWhichTownMapLocation], a @@ -29,7 +29,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) .townMapLoop coord hl, 0, 0 - ld bc, $114 + lb bc, 1, 20 call ClearScreenArea ld hl, TownMapOrder ld a, [wWhichTownMapLocation] @@ -140,11 +140,11 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) call LoadFontTilePatterns ld de, BirdSprite ld hl, vSprites + $40 - ld bc, (BANK(BirdSprite) << 8) + $0c + lb bc, BANK(BirdSprite), $0c call CopyVideoData ld de, TownMapUpArrow ld hl, vChars1 + $6d0 - ld bc, (BANK(TownMapUpArrow) << 8) + $01 + lb bc, BANK(TownMapUpArrow), $01 call CopyVideoDataDouble call BuildFlyLocationsList ld hl, wUpdateSpritesEnabled @@ -161,12 +161,12 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) ld hl, wFlyLocationsList coord de, 18, 0 .townMapFlyLoop - ld a, $7f + ld a, " " ld [de], a push hl push hl coord hl, 3, 0 - ld bc, $10f + lb bc, 1, 15 call ClearScreenArea pop hl ld a, [hl] @@ -442,8 +442,8 @@ WritePlayerOrBirdSpriteOAM: ; 7126d (1c:526d) WriteTownMapSpriteOAM: ; 71279 (1c:5279) push hl - ld hl, $fcfc - add hl, bc ; subtract 4 from c (X coord) and 3 from b (Y coord) + lb hl, -4, -4 + add hl, bc ; subtract 4 from c (X coord) and 4 from b (Y coord) ld b, h ld c, l pop hl @@ -451,7 +451,7 @@ WriteTownMapSpriteOAM: ; 71279 (1c:5279) WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281) ; Writes 4 OAM blocks for a helix mon party sprite, since it does not have ; a vertical line of symmetry. - ld de, $202 + lb de, 2, 2 .loop push de push bc diff --git a/engine/trade.asm b/engine/trade.asm index 74fd3434..1a0e5f61 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -371,7 +371,7 @@ Trade_ShowEnemyMon: ; 41336 (10:5336) call PlayCry call Trade_Delay100 coord hl, 4, 10 - ld bc, $80c + lb bc, 8, 12 call ClearScreenArea jp PrintTradeTakeCareText @@ -647,14 +647,14 @@ Trade_AnimMonMoveVertical: ; 41525 (10:5525) and a jr z, .movingLeft ; moving right - ld bc, $400 ; move right + lb bc, 4, 0 ; move right call .doAnim - ld bc, $a ; move down + lb bc, 0, 10 ; move down jr .doAnim .movingLeft - ld bc, $f6 ; move up + lb bc, 0, -10 ; move up call .doAnim - ld bc, $fc00 ; move left + lb bc, -4, 0 ; move left .doAnim ld a, b ld [W_BASECOORDX], a diff --git a/home.asm b/home.asm index 449666df..2753307b 100644 --- a/home.asm +++ b/home.asm @@ -1402,7 +1402,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6) call UpdateSprites ; disable sprites behind the text box ; the code up to .skipMovingSprites appears to be useless coord hl, 4, 2 ; coordinates of upper left corner of menu text box - ld de,$090e ; height and width of menu text box + lb de, 9, 14 ; height and width of menu text box ld a,[wListMenuID] and a ; is it a PC pokemon list? jr nz,.skipMovingSprites @@ -1668,7 +1668,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57) coord hl, 9, 10 .printQuantity ld de,wItemQuantity ; current quantity - lb bc,LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits + lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits call PrintNumber jp .waitForKeyPressLoop .buttonAPressed ; the player chose to make the transaction @@ -1705,8 +1705,8 @@ ExitListMenu:: ; 2e3b (0:2e3b) PrintListMenuEntries:: ; 2e5a (0:2e5a) coord hl, 5, 3 - ld b,$09 - ld c,$0e + ld b,9 + ld c,14 call ClearScreenArea ld a,[wListPointer] ld e,a @@ -1786,7 +1786,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld [wcf91],a call GetItemPrice ; get price pop hl - ld bc,20 + 5 ; 1 row down and 5 columns right + ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right add hl,bc ld c,$a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes call PrintBCDNumber @@ -1815,7 +1815,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld a,[wListScrollOffset] add b ld [hl],a - call LoadMonData ; load pokemon info + call LoadMonData ld a,[wMonDataLocation] and a ; is it a list of party pokemon or box pokemon? jr z,.skipCopyingLevel @@ -1826,7 +1826,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) pop hl ld bc,$001c add hl,bc - call PrintLevel ; print level + call PrintLevel pop af ld [wd11e],a .skipPrintingPokemonLevel @@ -1844,7 +1844,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) and a ; is the item unsellable? jr nz,.skipPrintingItemQuantity ; if so, don't print the quantity push hl - ld bc,20 + 8 ; 1 row down and 8 columns right + ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right add hl,bc ld a,"×" ld [hli],a @@ -1877,7 +1877,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld a,$ec ; unfilled right arrow menu cursor to indicate an item being swapped ld [hli],a .nextListEntry - ld bc,2 * 20 ; 2 rows + ld bc,2 * SCREEN_WIDTH ; 2 rows add hl,bc pop bc inc c @@ -1899,12 +1899,12 @@ GetMonName:: ; 2f9e (0:2f9e) push hl ld a,[H_LOADEDROMBANK] push af - ld a,BANK(MonsterNames) ; 07 + ld a,BANK(MonsterNames) ld [H_LOADEDROMBANK],a ld [MBC1RomBank],a ld a,[wd11e] dec a - ld hl,MonsterNames ; 421E + ld hl,MonsterNames ld c,10 ld b,0 call AddNTimes @@ -1972,7 +1972,7 @@ GetMachineName:: ; 2ff3 (0:2ff3) ; now get the machine number and convert it to text ld a,[wd11e] sub TM_01 - 1 - ld b,$F6 ; "0" + ld b, "0" .FirstDigit sub 10 jr c,.SecondDigit @@ -1985,7 +1985,7 @@ GetMachineName:: ; 2ff3 (0:2ff3) ld [de],a inc de pop af - ld b,$F6 ; "0" + ld b, "0" add b ld [de],a inc de @@ -2134,6 +2134,7 @@ IsKeyItem:: ; 30d9 (0:30d9) ; function to draw various text boxes ; INPUT: ; [wTextBoxID] = text box ID +; b, c = y, x cursor position (TWO_OPTION_MENU only) DisplayTextBoxID:: ; 30e8 (0:30e8) ld a,[H_LOADEDROMBANK] push af @@ -3002,7 +3003,7 @@ YesNoChoicePokeCenter:: ; 360a (0:360a) ld a, HEAL_CANCEL_MENU ld [wTwoOptionMenuID], a coord hl, 11, 6 - ld bc, $80c + lb bc, 8, 12 jr DisplayYesNoChoice Func_361a:: ; 361a (0:361a) @@ -3010,7 +3011,7 @@ Func_361a:: ; 361a (0:361a) ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a coord hl, 12, 7 - ld bc, $080d + lb bc, 8, 13 DisplayYesNoChoice:: ; 3628 (0:3628) ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -3097,7 +3098,7 @@ LoadFontTilePatterns:: .on ld de, FontGraphics ld hl, vFont - ld bc, BANK(FontGraphics) << 8 | $80 + lb bc, BANK(FontGraphics), $80 jp CopyVideoDataDouble ; if LCD is on, transfer during V-blank LoadTextBoxTilePatterns:: @@ -3113,7 +3114,7 @@ LoadTextBoxTilePatterns:: .on ld de, TextBoxGraphics ld hl, vChars2 + $600 - ld bc, BANK(TextBoxGraphics) << 8 | $20 + lb bc, BANK(TextBoxGraphics), $20 jp CopyVideoData ; if LCD is on, transfer during V-blank LoadHpBarAndStatusTilePatterns:: @@ -3129,7 +3130,7 @@ LoadHpBarAndStatusTilePatterns:: .on ld de, HpBarAndStatusGraphics ld hl, vChars2 + $620 - ld bc, BANK(HpBarAndStatusGraphics) << 8 | $1e + lb bc, BANK(HpBarAndStatusGraphics), $1e jp CopyVideoData ; if LCD is on, transfer during V-blank @@ -3824,12 +3825,12 @@ MoveMon:: ; 3a68 (0:3a68) ld [MBC1RomBank], a ret -; skips a text entries, each of size $b (like trainer name, OT name, rival name, ...) +; skips a text entries, each of size 11 (like trainer name, OT name, rival name, ...) ; hl: base pointer, will be incremented by $b * a SkipFixedLengthTextEntries:: ; 3a7d (0:3a7d) and a ret z - ld bc, $b + ld bc, 11 .skipLoop add hl, bc dec a diff --git a/home/copy2.asm b/home/copy2.asm index 3f7a4400..830440b0 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -161,7 +161,7 @@ CopyVideoDataDouble:: ClearScreenArea:: ; Clear tilemap area cxb at hl. - ld a, $7f ; blank tile + ld a, " " ; blank tile ld de, 20 ; screen width .y push hl @@ -218,7 +218,7 @@ ClearScreen:: ld bc, 20 * 18 inc b coord hl, 0, 0 - ld a, $7f + ld a, " " .loop ld [hli], a dec c diff --git a/home/overworld.asm b/home/overworld.asm index 3675eca8..f8d6e7e1 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1995,7 +1995,7 @@ LoadBikePlayerSpriteGraphics:: ; 105d (0:105d) LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063) push de push hl - ld bc,(BANK(RedSprite) << 8) + $0c + lb bc, BANK(RedSprite), $0c call CopyVideoData pop hl pop de @@ -2006,7 +2006,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063) inc d .noCarry set 3,h - ld bc,$050c + lb bc, BANK(RedSprite), $0c jp CopyVideoData ; function to load data from the map header diff --git a/home/text.asm b/home/text.asm index 97ff2859..238af447 100644 --- a/home/text.asm +++ b/home/text.asm @@ -291,7 +291,7 @@ Char51:: ; 1ab4 (0:1ab4) call ProtectedDelay3 call ManualTextScroll coord hl, 1, 13 - ld bc,$0412 + lb bc, 4, 18 call ClearScreenArea ld c,20 call DelayFrames @@ -306,7 +306,7 @@ Char49:: ; 1ad5 (0:1ad5) call ProtectedDelay3 call ManualTextScroll coord hl, 1, 10 - ld bc,$0712 + lb bc, 7, 18 call ClearScreenArea ld c,20 call DelayFrames diff --git a/main.asm b/main.asm index 10317d4f..8def2f85 100755 --- a/main.asm +++ b/main.asm @@ -590,7 +590,7 @@ INCLUDE "engine/cable_club.asm" LoadTrainerInfoTextBoxTiles: ; 5ae6 (1:5ae6) ld de, TrainerInfoTextBoxTileGraphics ld hl, vChars2 + $760 - ld bc, (BANK(TrainerInfoTextBoxTileGraphics) << 8) +$09 + lb bc, BANK(TrainerInfoTextBoxTileGraphics), $09 jp CopyVideoData INCLUDE "engine/menu/main_menu.asm" @@ -1435,8 +1435,8 @@ DisplayMoneyBox: ; 74ba (1:74ba) ld [wTextBoxID], a call DisplayTextBoxID coord hl, 13, 1 - ld b, $1 - ld c, $6 + ld b, 1 + ld c, 6 call ClearScreenArea coord hl, 12, 1 ld de, wPlayerMoney @@ -1967,7 +1967,7 @@ _RemovePokemon: ; 7b68 (1:7b68) .asm_7ba6 ld d, h ld e, l - ld bc, $b + ld bc, 11 add hl, bc ld bc, wPartyMonNicks ld a, [wRemoveMonFromBox] @@ -2007,12 +2007,12 @@ _RemovePokemon: ; 7b68 (1:7b68) jr z, .asm_7bfa ld hl, wBoxMonNicks .asm_7bfa - ld bc, $b + ld bc, 11 ld a, [wWhichPokemon] call AddNTimes ld d, h ld e, l - ld bc, $b + ld bc, 11 add hl, bc ld bc, wPokedexOwned ld a, [wRemoveMonFromBox] @@ -3587,7 +3587,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld d, h ld e, l ld hl, wPlayerName - ld bc, $b + ld bc, 11 call CopyData ld a, [wMonDataLocation] and a @@ -3858,7 +3858,7 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) ld hl, wEnemyMonOT ld a, [wWhichPokemon] call SkipFixedLengthTextEntries - ld bc, $000b + ld bc, 11 call CopyData ; write new mon's OT name (from an enemy mon) ld hl, wPartyMonNicks ld a, [wPartyCount] @@ -3869,7 +3869,7 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) ld hl, wEnemyMonNicks ld a, [wWhichPokemon] call SkipFixedLengthTextEntries - ld bc, $000b + ld bc, 11 call CopyData ; write new mon's nickname (from an enemy mon) ld a, [wcf91] ld [wd11e], a @@ -4000,7 +4000,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wWhichPokemon] call SkipFixedLengthTextEntries .asm_f5ec - ld bc, $b + ld bc, 11 call CopyData ld a, [wMoveMonType] cp PARTY_TO_DAYCARE @@ -4030,7 +4030,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wWhichPokemon] call SkipFixedLengthTextEntries .asm_f62a - ld bc, $b + ld bc, 11 call CopyData pop hl ld a, [wMoveMonType] diff --git a/scripts/agatha.asm b/scripts/agatha.asm index 60ddf606..1e34c99c 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -22,7 +22,7 @@ AgathaScript_76443: ; 76443 (1d:6443) AgathaScript_76459: ; 76459 (1d:6459) ld [wNewTileBlockID], a - ld bc, $2 + lb bc, 0, 2 predef_jump ReplaceTileBlock AgathaScript_76464: ; 76464 (1d:6464) diff --git a/scripts/bikeshop.asm b/scripts/bikeshop.asm index f0bdf615..cf717b43 100755 --- a/scripts/bikeshop.asm +++ b/scripts/bikeshop.asm @@ -19,7 +19,7 @@ BikeShopText1: ; 1d745 (7:5745) jr z, .asm_41190 ld hl, BikeShopText_1d81f call PrintText - ld bc, (BICYCLE << 8) | 1 + lb bc, BICYCLE, 1 call GiveItem jr nc, .BagFull ld a, BIKE_VOUCHER diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index e4cfc031..08ac98d6 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -163,7 +163,7 @@ BillsHouseText2: ; 1e874 (7:6874) jr nz, .asm_1e8a9 ld hl, BillThankYouText call PrintText - ld bc, (S_S__TICKET << 8) | 1 + lb bc, S_S__TICKET, 1 call GiveItem jr nc, .BagFull ld hl, SSTicketReceivedText diff --git a/scripts/blueshouse.asm b/scripts/blueshouse.asm index 0e29d64c..6aa2eaec 100755 --- a/scripts/blueshouse.asm +++ b/scripts/blueshouse.asm @@ -36,7 +36,7 @@ BluesHouseText1: ; 19b5d (6:5b5d) .GiveMap ld hl,DaisyOfferMapText call PrintText - ld bc,(TOWN_MAP << 8) | 1 + lb bc, TOWN_MAP, 1 call GiveItem jr nc, .BagFull ld a,HS_TOWN_MAP diff --git a/scripts/bruno.asm b/scripts/bruno.asm index c39656b9..bdfd7e24 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -22,7 +22,7 @@ BrunoScript_762ec: ; 762ec (1d:62ec) BrunoScript_76302: ; 76302 (1d:6302) ld [wNewTileBlockID], a - ld bc, $2 + lb bc, 0, 2 predef_jump ReplaceTileBlock BrunoScript_7630d: ; 7630d (1d:630d) diff --git a/scripts/celadoncity.asm b/scripts/celadoncity.asm index ce0c4731..cfc8f197 100755 --- a/scripts/celadoncity.asm +++ b/scripts/celadoncity.asm @@ -46,7 +46,7 @@ CeladonCityText5: ; 1999e (6:599e) jr nz, .asm_7053f ld hl, TM41PreText call PrintText - ld bc, (TM_41 << 8) | 1 + lb bc, TM_41, 1 call GiveItem jr c, .Success ld hl, TM41NoRoomText diff --git a/scripts/celadondiner.asm b/scripts/celadondiner.asm index a37bc558..be1ed4c8 100755 --- a/scripts/celadondiner.asm +++ b/scripts/celadondiner.asm @@ -31,7 +31,7 @@ CeladonDinerText5: ; 49173 (12:5173) jr nz, .asm_eb14d ld hl, CeladonDinerText_491a7 call PrintText - ld bc, (COIN_CASE << 8) | 1 + lb bc, COIN_CASE, 1 call GiveItem jr nc, .BagFull SetEvent EVENT_GOT_COIN_CASE diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index e8917434..787a2f3d 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -32,7 +32,7 @@ CeladonGameCornerScript_48bec: ; 48bec (12:4bec) ret nz ld a, $2a ld [wNewTileBlockID], a - ld bc, $0208 + lb bc, 2, 8 predef_jump ReplaceTileBlock CeladonGameCornerScript_48c07: ; 48c07 (12:4c07) @@ -452,7 +452,7 @@ CeladonGameCornerText12: ; 48edd (12:4edd) SetEvent EVENT_FOUND_ROCKET_HIDEOUT ld a, $43 ld [wNewTileBlockID], a - ld bc, $0208 + lb bc, 2, 8 predef ReplaceTileBlock jp TextScriptEnd @@ -477,8 +477,8 @@ CeladonGameCornerScript_48f1e: ; 48f1e (12:4f1e) call TextBoxBorder call UpdateSprites coord hl, 12, 1 - ld b, $4 - ld c, $7 + ld b, 4 + ld c, 7 call ClearScreenArea coord hl, 12, 2 ld de, GameCornerMoneyText diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 5dc328c7..64e85ff7 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -47,7 +47,7 @@ CeladonGymText_48963: ; 48963 (12:4963) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_ERIKA - ld bc, (TM_21 << 8) | 1 + lb bc, TM_21, 1 call GiveItem jr nc, .BagFull ld a, $a diff --git a/scripts/celadonmansion5.asm b/scripts/celadonmansion5.asm index 60d2cc92..6d979e04 100755 --- a/scripts/celadonmansion5.asm +++ b/scripts/celadonmansion5.asm @@ -11,7 +11,7 @@ CeladonMansion5Text1: ; 1dd41 (7:5d41) CeladonMansion5Text2: ; 1dd46 (7:5d46) TX_ASM - ld bc,(EEVEE << 8) | 25 + lb bc, EEVEE, 25 call GivePokemon jr nc, .asm_24365 ld a, HS_CELADON_MANSION_5_GIFT diff --git a/scripts/celadonmart3.asm b/scripts/celadonmart3.asm index f525d0af..c6c6ecc7 100755 --- a/scripts/celadonmart3.asm +++ b/scripts/celadonmart3.asm @@ -26,7 +26,7 @@ CeladonMart3Text1: ; 4824a (12:424a) jr nz, .asm_a5463 ld hl, TM18PreReceiveText call PrintText - ld bc, (TM_18 << 8) | 1 + lb bc, TM_18, 1 call GiveItem jr nc, .BagFull SetEvent EVENT_GOT_TM18 diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 113044cd..8eeb5d2b 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -88,7 +88,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) ld hl, CeladonMartRoofText_48515 call PrintText call RemoveItemByIDBank12 - ld bc, (TM_49 << 8) | 1 + lb bc, TM_49, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM49Text @@ -101,7 +101,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) ld hl, CeladonMartRoofText_48504 call PrintText call RemoveItemByIDBank12 - ld bc, (TM_48 << 8) | 1 + lb bc, TM_48, 1 call GiveItem jr nc, .BagFull ld hl, CeladonMartRoofText_4850a @@ -114,7 +114,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) ld hl, CeladonMartRoofText_484f3 call PrintText call RemoveItemByIDBank12 - ld bc, (TM_13 << 8) | 1 + lb bc, TM_13, 1 call GiveItem jr nc, .BagFull ld hl, CeladonMartRoofText_484f9 diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index c13e66e2..158a683d 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -299,7 +299,7 @@ CeruleanCityText2: ; 1967c (6:567c) .asm_4ca20 ld hl, CeruleanCityText_196f3 call PrintText - ld bc, (TM_28 << 8) + 1 + lb bc, TM_28, 1 call GiveItem jr c, .Success ld hl, TM28NoRoomText diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index a7845c68..ca1c2c7d 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -47,7 +47,7 @@ CeruleanGymScript_5c70d: ; 5c70d (17:470d) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_MISTY - ld bc, (TM_11 << 8) | 1 + lb bc, TM_11, 1 call GiveItem jr nc, .BagFull ld a, $6 diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index 60df9338..5bbb94a9 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -144,7 +144,7 @@ CinnabarGymScript3_75857: ; 75857 (1d:5857) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_BLAINE - ld bc, (TM_38 << 8) | 1 + lb bc, TM_38, 1 call GiveItem jr nc, .BagFull ld a, $b diff --git a/scripts/copycatshouse2f.asm b/scripts/copycatshouse2f.asm index 953c7126..74dbb1c5 100755 --- a/scripts/copycatshouse2f.asm +++ b/scripts/copycatshouse2f.asm @@ -23,7 +23,7 @@ CopycatsHouse2FText1: ; 5cc82 (17:4c82) jr z, .asm_62ecd ld hl, TM31PreReceiveText call PrintText - ld bc, (TM_31 << 8) | 1 + lb bc, TM_31, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM31Text diff --git a/scripts/fanclub.asm b/scripts/fanclub.asm index adde809f..cbafc034 100755 --- a/scripts/fanclub.asm +++ b/scripts/fanclub.asm @@ -113,7 +113,7 @@ FanClubText5: ; tell the story ld hl, .storytext call PrintText - ld bc, (BIKE_VOUCHER << 8) | 1 + lb bc, BIKE_VOUCHER, 1 call GiveItem jr nc, .BagFull ld hl, .receivedvouchertext diff --git a/scripts/fuchsiagym.asm b/scripts/fuchsiagym.asm index 9bbc38a8..3ec89256 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -47,7 +47,7 @@ FuchsiaGymScript3_75497: ; 75497 (1d:5497) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_KOGA - ld bc, (TM_06 << 8) | 1 + lb bc, TM_06, 1 call GiveItem jr nc, .BagFull ld a, $a diff --git a/scripts/fuchsiahouse2.asm b/scripts/fuchsiahouse2.asm index 37aebd23..76b5e91f 100755 --- a/scripts/fuchsiahouse2.asm +++ b/scripts/fuchsiahouse2.asm @@ -38,7 +38,7 @@ FuchsiaHouse2Text1: ; 750c2 (1d:50c2) .asm_60cba ld hl, WardenThankYouText call PrintText - ld bc,(HM_04 << 8) | 1 + lb bc, HM_04, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedHM04Text diff --git a/scripts/fuchsiahouse3.asm b/scripts/fuchsiahouse3.asm index 8c83b779..2aabb9c2 100755 --- a/scripts/fuchsiahouse3.asm +++ b/scripts/fuchsiahouse3.asm @@ -18,7 +18,7 @@ FuchsiaHouse3Text1: ; 56181 (15:6181) and a jr nz, .refused - ld bc, (GOOD_ROD << 8) | 1 + lb bc, GOOD_ROD, 1 call GiveItem jr nc, .full diff --git a/scripts/lab3.asm b/scripts/lab3.asm index 59b04b8c..cbb5f53f 100755 --- a/scripts/lab3.asm +++ b/scripts/lab3.asm @@ -14,7 +14,7 @@ Lab3Text1: ; 75c94 (1d:5c94) jr nz, .asm_e551a ld hl, TM35PreReceiveText call PrintText - ld bc, (TM_35 << 8) | 1 + lb bc, TM_35, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM35Text diff --git a/scripts/lance.asm b/scripts/lance.asm index 9fa621da..e2c43614 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -25,12 +25,12 @@ LanceScript_5a2c4: ; 5a2c4 (16:62c4) LanceScript_5a2de: ; 5a2de (16:62de) push bc ld [wNewTileBlockID], a - ld bc, $602 + lb bc, 6, 2 call LanceScript_5a2f0 pop bc ld a, b ld [wNewTileBlockID], a - ld bc, $603 + lb bc, 6, 3 LanceScript_5a2f0: ; 5a2f0 (16:62f0) predef_jump ReplaceTileBlock diff --git a/scripts/lavenderhouse1.asm b/scripts/lavenderhouse1.asm index 556e94a3..ccf9cef1 100755 --- a/scripts/lavenderhouse1.asm +++ b/scripts/lavenderhouse1.asm @@ -72,7 +72,7 @@ LavenderHouse1Text5: ; 1d918 (7:5918) jr nz, .asm_15ac2 ld hl, LavenderHouse1Text_1d94c call PrintText - ld bc, (POKE_FLUTE << 8) | 1 + lb bc, POKE_FLUTE, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedFluteText diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index 3c639d1e..43eee966 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -23,7 +23,7 @@ LoreleiScript_76191: ; 76191 (1d:6191) ld a, $24 .asm_761ab ld [wNewTileBlockID], a - ld bc, $2 + lb bc, 0, 2 predef_jump ReplaceTileBlock LoreleiScript_761b6: ; 761b6 (1d:61b6) diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index 88bdd3ed..bbfb0a0b 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -15,22 +15,22 @@ Mansion1Subscript1: ; 442c5 (11:42c5) ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .asm_442ec - ld bc, $060c + lb bc, 6, 12 call Mansion1Script_4430b - ld bc, $0308 + lb bc, 3, 8 call Mansion1Script_44304 - ld bc, $080a + lb bc, 8, 10 call Mansion1Script_44304 - ld bc, $0d0d + lb bc, 13, 13 jp Mansion1Script_44304 .asm_442ec - ld bc, $060c + lb bc, 6, 12 call Mansion1Script_44304 - ld bc, $0308 + lb bc, 3, 8 call Mansion1Script_4430b - ld bc, $080a + lb bc, 8, 10 call Mansion1Script_4430b - ld bc, $0d0d + lb bc, 13, 13 jp Mansion1Script_4430b Mansion1Script_44304: ; 44304 (11:4304) diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index cb697b94..22bc2b12 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -16,24 +16,24 @@ Mansion2Script_51fee: ; 51fee (14:5fee) CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .asm_52016 ld a, $e - ld bc, $204 + lb bc, 2, 4 call Mansion2Script_5202f ld a, $54 - ld bc, $409 + lb bc, 4, 9 call Mansion2Script_5202f ld a, $5f - ld bc, $b03 + lb bc, 11, 3 call Mansion2Script_5202f ret .asm_52016 ld a, $5f - ld bc, $204 + lb bc, 2, 4 call Mansion2Script_5202f ld a, $e - ld bc, $409 + lb bc, 4, 9 call Mansion2Script_5202f ld a, $e - ld bc, $b03 + lb bc, 11, 3 call Mansion2Script_5202f ret diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 21c959aa..84c00981 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -271,7 +271,7 @@ MtMoon3Text6: ; 49ee9 (12:5ee9) ld a, [wCurrentMenuItem] and a jr nz, .asm_49f21 - ld bc,(DOME_FOSSIL << 8) | 1 + lb bc, DOME_FOSSIL, 1 call GiveItem jp nc, MtMoon3Script_49f76 call MtMoon3Script_49f69 @@ -299,7 +299,7 @@ MtMoon3Text7: ; 49f29 (12:5f29) ld a, [wCurrentMenuItem] and a jr nz, .asm_49f61 - ld bc, (HELIX_FOSSIL << 8) | 1 + lb bc, HELIX_FOSSIL, 1 call GiveItem jp nc, MtMoon3Script_49f76 call MtMoon3Script_49f69 diff --git a/scripts/mtmoonpokecenter.asm b/scripts/mtmoonpokecenter.asm index 63cc06e4..fd3e4e53 100755 --- a/scripts/mtmoonpokecenter.asm +++ b/scripts/mtmoonpokecenter.asm @@ -43,7 +43,7 @@ MtMoonPokecenterText4: ; 492ec (12:52ec) ld hl, MtMoonPokecenterText_49366 jr .printText .enoughMoney - ld bc,(MAGIKARP << 8) | 5 + lb bc, MAGIKARP, 5 call GivePokemon jr nc, .done xor a diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 4c209eb8..ac552c6d 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -191,7 +191,7 @@ Museum1FText3: ; 5c256 (17:4256) jr nz, .asm_5c285 ld hl, Museum1FText_5c28e call PrintText - ld bc, (OLD_AMBER << 8) | 1 + lb bc, OLD_AMBER, 1 call GiveItem jr nc, .BagFull SetEvent EVENT_GOT_OLD_AMBER diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 93f87657..996ab754 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -1022,7 +1022,7 @@ OaksLabText5: ; 1d248 (7:5248) .asm_1d2d0 CheckAndSetEvent EVENT_GOT_POKEBALLS_FROM_OAK jr nz, .asm_1d2e7 - ld bc, (POKE_BALL << 8) | 5 + lb bc, POKE_BALL, 5 call GiveItem ld hl, OaksLabGivePokeballsText call PrintText diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 81fcb600..831403bb 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -47,7 +47,7 @@ PewterGymScript_5c3df: ; 5c3df (17:43df) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_BROCK - ld bc, (TM_34 << 8) | 1 + lb bc, TM_34, 1 call GiveItem jr nc, .BagFull ld a, $5 diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index c658596e..82561577 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -27,7 +27,7 @@ RocketHideout1Script_44be0: ; 44be0 (11:4be0) ld a, $e .asm_44c03 ld [wNewTileBlockID], a - ld bc, $080c + lb bc, 8, 12 predef_jump ReplaceTileBlock RocketHideout1ScriptPointers: ; 44c0e (11:4c0e) diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 62d6f6bb..a71e444c 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -27,7 +27,7 @@ RocketHideout4Script_45473: ; 45473 (11:5473) ld a, $e .asm_45498 ld [wNewTileBlockID], a - ld bc, $050c + lb bc, 5, 12 predef_jump ReplaceTileBlock RocketHideout4Script_454a3: ; 454a3 (11:54a3) diff --git a/scripts/route1.asm b/scripts/route1.asm index 6c00e555..926ffd20 100755 --- a/scripts/route1.asm +++ b/scripts/route1.asm @@ -12,7 +12,7 @@ Route1Text1: ; 1cab8 (7:4ab8) jr nz, .asm_1cada ld hl, Route1ViridianMartSampleText call PrintText - ld bc, (POTION << 8) | 1 + lb bc, POTION, 1 call GiveItem jr nc, .BagFull ld hl, Route1Text_1cae8 diff --git a/scripts/route12gateupstairs.asm b/scripts/route12gateupstairs.asm index f651d373..e7ad5cbf 100755 --- a/scripts/route12gateupstairs.asm +++ b/scripts/route12gateupstairs.asm @@ -12,7 +12,7 @@ Route12GateUpstairsText1: ; 49569 (12:5569) jr c, .asm_0ad3c ld hl, TM39PreReceiveText call PrintText - ld bc, (TM_39 << 8) | 1 + lb bc, TM_39, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM39Text diff --git a/scripts/route12house.asm b/scripts/route12house.asm index 6b3e17fc..bb065f1c 100755 --- a/scripts/route12house.asm +++ b/scripts/route12house.asm @@ -15,7 +15,7 @@ Route12HouseText1: ; 56484 (15:6484) ld a, [wCurrentMenuItem] and a jr nz, .asm_a2d76 - ld bc, (SUPER_ROD << 8) | 1 + lb bc, SUPER_ROD, 1 call GiveItem jr nc, .BagFull ld hl, wd728 diff --git a/scripts/route16house.asm b/scripts/route16house.asm index 4a0ac0c3..ee23fd89 100755 --- a/scripts/route16house.asm +++ b/scripts/route16house.asm @@ -12,7 +12,7 @@ Route16HouseText1: ; 1e5ff (7:65ff) jr nz, .asm_13616 ld hl, Route16HouseText3 call PrintText - ld bc, (HM_02 << 8) | 1 + lb bc, HM_02, 1 call GiveItem jr nc, .BagFull SetEvent EVENT_GOT_HM02 diff --git a/scripts/route24.asm b/scripts/route24.asm index 4e83a5cd..6eba1d35 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -149,7 +149,7 @@ Route24Text1: ; 514a4 (14:54a4) jr nz, .asm_514f9 ld hl, Route24Text_51510 call PrintText - ld bc, (NUGGET << 8) | 1 + lb bc, NUGGET, 1 call GiveItem jr nc, .BagFull SetEvent EVENT_GOT_NUGGET diff --git a/scripts/safarizoneentrance-yellow.asm b/scripts/safarizoneentrance-yellow.asm index 9d354cff..4a37f0e6 100644 --- a/scripts/safarizoneentrance-yellow.asm +++ b/scripts/safarizoneentrance-yellow.asm @@ -54,7 +54,7 @@ ld hl,.MakePaymentText call PrintText ld a,30 - ld hl,(502 / $100) << 8 | (502 % $100) + lb hl, (502 / $100), (502 % $100) .xf1ff2 ld [W_NUMSAFARIBALLS],a ld a,h diff --git a/scripts/safarizonesecrethouse.asm b/scripts/safarizonesecrethouse.asm index 6cf17b9d..8881472b 100755 --- a/scripts/safarizonesecrethouse.asm +++ b/scripts/safarizonesecrethouse.asm @@ -10,7 +10,7 @@ SafariZoneSecretHouseText1: ; 4a31c (12:631c) jr nz, .asm_20a9b ld hl, SafariZoneSecretHouseText_4a350 call PrintText - ld bc, (HM_03 << 8) | 1 + lb bc, HM_03, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedHM03Text diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index 9ee632f7..140b1130 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -47,7 +47,7 @@ SaffronGymText_5d068: ; 5d068 (17:5068) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_SABRINA - ld bc, (TM_46 << 8) | 1 + lb bc, TM_46, 1 call GiveItem jr nc, .BagFull ld a, $b diff --git a/scripts/saffronhouse2.asm b/scripts/saffronhouse2.asm index f3ec4c99..2c159190 100755 --- a/scripts/saffronhouse2.asm +++ b/scripts/saffronhouse2.asm @@ -10,7 +10,7 @@ SaffronHouse2Text1: ; 1de41 (7:5e41) jr nz, .asm_9e72b ld hl, TM29PreReceiveText call PrintText - ld bc,(TM_29 << 8) | 1 + lb bc, TM_29, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM29Text diff --git a/scripts/silphco10.asm b/scripts/silphco10.asm index fb419a22..a6f2f860 100755 --- a/scripts/silphco10.asm +++ b/scripts/silphco10.asm @@ -13,18 +13,19 @@ SilphCo10Script_5a14f: ; 5a14f (16:614f) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_5a173 + ld hl, SilphCo10GateCoords call SilphCo2Script_59d43 call SilphCo10Text_5a176 CheckEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR ret nz ld a, $54 ld [wNewTileBlockID], a - ld bc, $405 + lb bc, 4, 5 predef_jump ReplaceTileBlock -DataTable_5a173: ; 5a173 (16:6173) - db $04,$05,$FF +SilphCo10GateCoords: ; 5a173 (16:6173) + db $04,$05 + db $FF SilphCo10Text_5a176: ; 5a176 (16:6176) ld a, [$ffe0] diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 9cdf2891..4c83c20d 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -13,18 +13,19 @@ SilphCo11Script_62110: ; 62110 (18:6110) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_62134 + ld hl, SilphCo11GateCoords call SilphCo11Script_62137 call SilphCo11Script_62163 CheckEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR ret nz ld a, $20 ld [wNewTileBlockID], a - ld bc, $603 + lb bc, 6, 3 predef_jump ReplaceTileBlock -DataTable_62134: ; 62134 (18:6134) - db $06,$03,$FF +SilphCo11GateCoords: ; 62134 (18:6134) + db $06,$03 + db $FF SilphCo11Script_62137: ; 62137 (18:6137) push hl @@ -306,7 +307,7 @@ SilphCo11Text1: ; 622dc (18:62dc) jp nz, .asm_62308 ld hl, SilphCoPresidentText call PrintText - ld bc, (MASTER_BALL << 8) | 1 + lb bc, MASTER_BALL, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedSilphCoMasterBallText diff --git a/scripts/silphco2.asm b/scripts/silphco2.asm index b758455e..ecb3b5a5 100755 --- a/scripts/silphco2.asm +++ b/scripts/silphco2.asm @@ -13,7 +13,7 @@ SilphCo2Script_59d07: ; 59d07 (16:5d07) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_59d3e + ld hl, SilphCo2GateCoords call SilphCo2Script_59d43 call SilphCo2Script_59d6f CheckEvent EVENT_SILPH_CO_2_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo2Script_59d07: ; 59d07 (16:5d07) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $0202 + lb bc, 2, 2 predef ReplaceTileBlock pop af .asm_59d2e @@ -29,11 +29,13 @@ SilphCo2Script_59d07: ; 59d07 (16:5d07) ret nz ld a, $54 ld [wNewTileBlockID], a - ld bc, $0502 + lb bc, 5, 2 predef_jump ReplaceTileBlock -DataTable_59d3e: ; 59d3e (16:5d3e) - db $02,$02,$05,$02,$FF +SilphCo2GateCoords: ; 59d3e (16:5d3e) + db $02,$02 + db $05,$02 + db $FF SilphCo2Script_59d43: ; 59d43 (16:5d43) push hl @@ -141,7 +143,7 @@ SilphCo2Text1: ; 59dc1 (16:5dc1) jr nz, .asm_59de4 ld hl, SilphCo2Text_59ded call PrintText - ld bc, (TM_36 << 8) | 1 + lb bc, TM_36, 1 call GiveItem ld hl, TM36NoRoomText jr nc, .asm_59de7 diff --git a/scripts/silphco3.asm b/scripts/silphco3.asm index f693ea33..bdaac452 100755 --- a/scripts/silphco3.asm +++ b/scripts/silphco3.asm @@ -13,7 +13,7 @@ SilphCo3Script_59f71: ; 59f71 (16:5f71) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_59fa8 + ld hl, SilphCo3GateCoords call SilphCo2Script_59d43 call SilphCo3Script_59fad CheckEvent EVENT_SILPH_CO_3_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo3Script_59f71: ; 59f71 (16:5f71) push af ld a, $5f ld [wNewTileBlockID], a - ld bc, $404 + lb bc, 4, 4 predef ReplaceTileBlock pop af .asm_59f98 @@ -29,11 +29,13 @@ SilphCo3Script_59f71: ; 59f71 (16:5f71) ret nz ld a, $5f ld [wNewTileBlockID], a - ld bc, $408 + lb bc, 4, 8 predef_jump ReplaceTileBlock -DataTable_59fa8: ; 59fa8 (16:5fa8) - db $04,$04,$04,$08,$FF +SilphCo3GateCoords: ; 59fa8 (16:5fa8) + db $04,$04 + db $04,$08 + db $FF SilphCo3Script_59fad: ; 59fad (16:5fad) EventFlagAddress hl, EVENT_SILPH_CO_3_UNLOCKED_DOOR1 diff --git a/scripts/silphco4.asm b/scripts/silphco4.asm index 0ea2c8c8..0dad6f6b 100755 --- a/scripts/silphco4.asm +++ b/scripts/silphco4.asm @@ -13,7 +13,7 @@ SilphCo4Script_19d21: ; 19d21 (6:5d21) bit 5, [hl] res 5, [hl] ret z - ld hl, SilphCo4Data19d58 + ld hl, SilphCo4GateCoords call SilphCo4Script_19d5d call SilphCo4Script_19d89 CheckEvent EVENT_SILPH_CO_4_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo4Script_19d21: ; 19d21 (6:5d21) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $0602 + lb bc, 6, 2 predef ReplaceTileBlock pop af .asm_19d48 @@ -29,11 +29,13 @@ SilphCo4Script_19d21: ; 19d21 (6:5d21) ret nz ld a, $54 ld [wNewTileBlockID], a - ld bc, $0406 + lb bc, 4, 6 predef_jump ReplaceTileBlock -SilphCo4Data19d58: ; 19d58 (6:5d58) - db $06, $02, $04, $06, $ff +SilphCo4GateCoords: ; 19d58 (6:5d58) + db $06,$02 + db $04,$06 + db $FF SilphCo4Script_19d5d: ; 19d5d (6:5d5d) push hl diff --git a/scripts/silphco5.asm b/scripts/silphco5.asm index d6f35993..7380f98f 100755 --- a/scripts/silphco5.asm +++ b/scripts/silphco5.asm @@ -13,7 +13,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d) bit 5, [hl] res 5, [hl] ret z - ld hl, SilphCo5Coords + ld hl, SilphCo5GateCoords call SilphCo4Script_19d5d call SilphCo5Script_19f9e CheckEvent EVENT_SILPH_CO_5_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d) push af ld a, $5f ld [wNewTileBlockID], a - ld bc, $0203 + lb bc, 2, 3 predef ReplaceTileBlock pop af .asm_19f74 @@ -30,7 +30,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d) push af ld a, $5f ld [wNewTileBlockID], a - ld bc, $0603 + lb bc, 6, 3 predef ReplaceTileBlock pop af .asm_19f87 @@ -38,11 +38,14 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d) ret nz ld a, $5f ld [wNewTileBlockID], a - ld bc, $0507 + lb bc, 5, 7 predef_jump ReplaceTileBlock -SilphCo5Coords: ; 19f97 (6:5f97) - db $02, $03, $06, $03, $05, $07, $ff +SilphCo5GateCoords: ; 19f97 (6:5f97) + db $02,$03 + db $06,$03 + db $05,$07 + db $FF SilphCo5Script_19f9e: ; 19f9e (6:5f9e) EventFlagAddress hl, EVENT_SILPH_CO_5_UNLOCKED_DOOR1 diff --git a/scripts/silphco6.asm b/scripts/silphco6.asm index 25fbcef9..fa199069 100755 --- a/scripts/silphco6.asm +++ b/scripts/silphco6.asm @@ -13,19 +13,19 @@ SilphCo6Script_1a1bf: ; 1a1bf (6:61bf) bit 5, [hl] res 5, [hl] ret z - ld hl, SilphCo6Coords1 + ld hl, SilphCo6GateCoords call SilphCo4Script_19d5d call SilphCo6Script_1a1e6 CheckEvent EVENT_SILPH_CO_6_UNLOCKED_DOOR ret nz ld a, $5f ld [wNewTileBlockID], a - ld bc, $0602 + lb bc, 6, 2 predef_jump ReplaceTileBlock -SilphCo6Coords1: ; 1a1e3 (6:61e3) - db $06, $02 - db $ff +SilphCo6GateCoords: ; 1a1e3 (6:61e3) + db $06,$02 + db $FF SilphCo6Script_1a1e6: ; 1a1e6 (6:61e6) ld a, [$ffe0] diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 44e92475..525405c7 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -13,7 +13,7 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_51bc1 + ld hl, SilphCo7GateCoords call SilphCo7Text_51bc8 call SilphCo7Text_51bf4 CheckEvent EVENT_SILPH_CO_7_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $305 + lb bc, 3, 5 predef ReplaceTileBlock pop af .asm_51b9e @@ -30,7 +30,7 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $20a + lb bc, 2, 10 predef ReplaceTileBlock pop af .asm_51bb1 @@ -38,11 +38,14 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77) ret nz ld a, $54 ld [wNewTileBlockID], a - ld bc, $60a + lb bc, 6, 10 predef_jump ReplaceTileBlock -DataTable_51bc1: ; 51bc1 (14:5bc1) - db $03,$05,$02,$0A,$06,$0A,$FF +SilphCo7GateCoords: ; 51bc1 (14:5bc1) + db $03,$05 + db $02,$0A + db $06,$0A + db $FF SilphCo7Text_51bc8: ; 51bc8 (14:5bc8) push hl @@ -329,7 +332,7 @@ SilphCo7Text1: .givelapras ld hl, .MeetLaprasGuyText call PrintText - ld bc, (LAPRAS << 8) | 15 + lb bc, LAPRAS, 15 call GivePokemon jr nc, .done ld a, [wSimulatedJoypadStatesEnd] diff --git a/scripts/silphco8.asm b/scripts/silphco8.asm index 7545f359..9ea985a8 100755 --- a/scripts/silphco8.asm +++ b/scripts/silphco8.asm @@ -13,18 +13,19 @@ SilphCo8Script_5651a: ; 5651a (15:651a) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_5653e + ld hl, SilphCo8GateCoords call SilphCo8Script_56541 call SilphCo8Script_5656d CheckEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR ret nz ld a, $5f ld [wNewTileBlockID], a - ld bc, $403 + lb bc, 4, 3 predef_jump ReplaceTileBlock -DataTable_5653e: ; 5653e (15:653e) - db $04,$03,$FF +SilphCo8GateCoords: ; 5653e (15:653e) + db $04,$03 + db $FF SilphCo8Script_56541: ; 56541 (15:6541) push hl diff --git a/scripts/silphco9.asm b/scripts/silphco9.asm index 557ce1f1..02638459 100755 --- a/scripts/silphco9.asm +++ b/scripts/silphco9.asm @@ -13,7 +13,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1) bit 5, [hl] res 5, [hl] ret z - ld hl, DataTable_5d82e + ld hl, SilphCo9GateCoords call SilphCo9Script_5d837 call SilphCo9Script_5d863 CheckEvent EVENT_SILPH_CO_9_UNLOCKED_DOOR1 @@ -21,7 +21,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1) push af ld a, $5f ld [wNewTileBlockID], a - ld bc, $401 + lb bc, 4, 1 predef ReplaceTileBlock pop af .asm_5d7f8 @@ -30,7 +30,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $209 + lb bc, 2, 9 predef ReplaceTileBlock pop af .asm_5d80b @@ -39,7 +39,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1) push af ld a, $54 ld [wNewTileBlockID], a - ld bc, $509 + lb bc, 5, 9 predef ReplaceTileBlock pop af .asm_5d81e @@ -47,11 +47,15 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1) ret nz ld a, $5f ld [wNewTileBlockID], a - ld bc, $605 + lb bc, 6, 5 predef_jump ReplaceTileBlock -DataTable_5d82e: ; 5d82e (17:582e) - db $04,$01,$02,$09,$05,$09,$06,$05,$FF +SilphCo9GateCoords: ; 5d82e (17:582e) + db $04,$01 + db $02,$09 + db $05,$09 + db $06,$05 + db $FF SilphCo9Script_5d837: ; 5d837 (17:5837) push hl diff --git a/scripts/ssanne7.asm b/scripts/ssanne7.asm index 9bb4aac6..b99f5bb2 100755 --- a/scripts/ssanne7.asm +++ b/scripts/ssanne7.asm @@ -22,7 +22,7 @@ SSAnne7Text1: ; 618ad (18:58ad) call PrintText ld hl, ReceivingHM01Text call PrintText - ld bc, (HM_01 << 8) | 1 + lb bc, HM_01, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedHM01Text diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index 5c504335..78a38aec 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -38,7 +38,7 @@ VermilionGymScript_5ca6d: ; 5ca6d (17:4a6d) ld a, $5 .asm_5ca7f ld [wNewTileBlockID], a - ld bc, $202 + lb bc, 2, 2 predef_jump ReplaceTileBlock VermilionGymScript_5ca8a: ; 5ca8a (17:4a8a) @@ -66,7 +66,7 @@ VermilionGymScript_5caaa: ; 5caaa (17:4aaa) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_LT_SURGE - ld bc, (TM_24 << 8) | 1 + lb bc, TM_24, 1 call GiveItem jr nc, .BagFull ld a, $7 diff --git a/scripts/vermilionhouse2.asm b/scripts/vermilionhouse2.asm index 775c32bb..f166ebb8 100755 --- a/scripts/vermilionhouse2.asm +++ b/scripts/vermilionhouse2.asm @@ -15,7 +15,7 @@ VermilionHouse2Text1: ; 56075 (15:6075) ld a, [wCurrentMenuItem] and a jr nz, .asm_eb1b7 - ld bc, (OLD_ROD << 8) | 1 + lb bc, OLD_ROD, 1 call GiveItem jr nc, .BagFull ld hl, wd728 diff --git a/scripts/victoryroad1.asm b/scripts/victoryroad1.asm index dbb69a64..11f5d5db 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -15,7 +15,7 @@ VictoryRoad1Script: ; 5da0a (17:5a0a) ret z ld a, $1d ld [wNewTileBlockID], a - ld bc, $604 + lb bc, 6, 4 predef_jump ReplaceTileBlock VictoryRoad1ScriptPointers: ; 5da3a (17:5a3a) diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index 41fe0212..cb956b1c 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -23,14 +23,14 @@ VictoryRoad2Script_517c9: ; 517c9 (14:57c9) jr z, .asm_517da push af ld a, $15 - ld bc, $403 + lb bc, 4, 3 call VictoryRoad2Script_517e2 pop af .asm_517da bit 7, a ret z ld a, $1d - ld bc, $70b + lb bc, 7, 11 VictoryRoad2Script_517e2: ; 517e2 (14:57e2) ld [wNewTileBlockID], a diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index c5aaef50..22e6813a 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -17,7 +17,7 @@ VictoryRoad3Script_44996: ; 44996 (11:4996) ret z ld a, $1d ld [wNewTileBlockID], a - ld bc, $503 + lb bc, 5, 3 predef_jump ReplaceTileBlock VictoryRoad3ScriptPointers: ; 449b1 (11:49b1) diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index 7cdf5ad8..79ad444f 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -235,7 +235,7 @@ ViridianCityText6: ; 19196 (6:5196) jr nz, .asm_4e5a0 ld hl, ViridianCityText_191ca call PrintText - ld bc, (TM_42 << 8) | 1 + lb bc, TM_42, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedTM42Text diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 8e012040..6cded55d 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -141,7 +141,7 @@ ViridianGymScript3_74995: ; 74995 (1d:4995) ld [hSpriteIndexOrTextID], a call DisplayTextID SetEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI - ld bc, (TM_27 << 8) | 1 + lb bc, TM_27, 1 call GiveItem jr nc, .BagFull ld a, $d diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm index 986ac8f1..5cb6eaea 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -52,7 +52,7 @@ ViridianMartScript1: ; 1d4c0 (7:54c0) ld a, $5 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld bc, (OAKS_PARCEL << 8) + 1 + lb bc, OAKS_PARCEL, 1 call GiveItem SetEvent EVENT_GOT_OAKS_PARCEL ld a, $2 -- cgit v1.3.1-sl0p From 1df1e9181e2f3d95f57c98e0ea6e38ce4261fb2a Mon Sep 17 00:00:00 2001 From: dannye Date: Mon, 10 Aug 2015 23:03:31 -0500 Subject: Use better wram labels in sram this way, sram doesn't have to refer to the actual content of wram --- engine/save.asm | 48 ++++++++++++++++++++++++------------------------ sram.asm | 32 ++++++++++++++++---------------- wram.asm | 19 ++++++++++++++++++- 3 files changed, 58 insertions(+), 41 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/save.asm b/engine/save.asm index dfc50616..717b316a 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -60,20 +60,20 @@ LoadSAV0: ; 73623 (1c:7623) ld bc, 11 call CopyData ld hl, sMainData - ld de, wPokedexOwned - ld bc, sSpriteData - sMainData + ld de, wMainDataStart + ld bc, wMainDataEnd - wMainDataStart call CopyData ld hl, W_CURMAPTILESET set 7, [hl] ld hl, sSpriteData - ld de, wSpriteStateData1 - ld bc, sPartyData - sSpriteData + ld de, wSpriteDataStart + ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData ld a, [sTilesetType] ld [hTilesetType], a ld hl, sCurBoxData - ld de, W_NUMINBOX - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld de, wBoxDataStart + ld bc, wBoxDataEnd - wBoxDataStart call CopyData and a jp SAVGoodChecksum @@ -92,8 +92,8 @@ LoadSAV1: ; 73690 (1c:7690) cp c jr nz, SAVBadCheckSum ld hl, sCurBoxData - ld de, W_NUMINBOX - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld de, wBoxDataStart + ld bc, wBoxDataEnd - wBoxDataStart call CopyData and a jp SAVGoodChecksum @@ -112,8 +112,8 @@ LoadSAV2: ; 736bd (1c:76bd) cp c jp nz, SAVBadCheckSum ld hl, sPartyData - ld de, wPartyCount - ld bc, wPokedexOwned - wPartyCount + ld de, wPartyDataStart + ld bc, wPartyDataEnd - wPartyDataStart call CopyData ld hl, sMainData ld de, wPokedexOwned @@ -205,17 +205,17 @@ SaveSAVtoSRAM0: ; 7378c (1c:778c) ld de, sPlayerName ld bc, 11 call CopyData - ld hl, wPokedexOwned + ld hl, wMainDataStart ld de, sMainData - ld bc, W_NUMINBOX - wPokedexOwned + ld bc, wMainDataEnd - wMainDataStart call CopyData - ld hl, wSpriteStateData1 + ld hl, wSpriteDataStart ld de, sSpriteData - ld bc, sPartyData - sSpriteData + ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData - ld hl, W_NUMINBOX + ld hl, wBoxDataStart ld de, sCurBoxData - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData ld a, [hTilesetType] ld [sTilesetType], a @@ -235,9 +235,9 @@ SaveSAVtoSRAM1: ; 737e2 (1c:77e2) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, W_NUMINBOX + ld hl, wBoxDataStart ld de, sCurBoxData - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName @@ -254,9 +254,9 @@ SaveSAVtoSRAM2: ; 7380f (1c:780f) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, wPartyCount + ld hl, wPartyDataStart ld de, sPartyData - ld bc, wPokedexOwned - wPartyCount + ld bc, wPartyDataEnd - wPartyDataStart call CopyData ld hl, wPokedexOwned ; pokédex only ld de, sMainData @@ -300,7 +300,7 @@ CalcIndividualBoxCheckSums: ; 73863 (1c:7863) .loop push bc push de - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call SAVCheckSum pop de ld [de], a @@ -361,13 +361,13 @@ ChangeBox:: ; 738a1 (1c:78a1) call GetBoxSRAMLocation ld e, l ld d, h - ld hl, W_NUMINBOX + ld hl, wBoxDataStart call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] set 7, a ld [wCurrentBoxNum], a call GetBoxSRAMLocation - ld de, W_NUMINBOX + ld de, wBoxDataStart call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM ld hl, W_MAPTEXTPTR ld de, wChangeBoxSavedMapTextPointer @@ -398,7 +398,7 @@ CopyBoxToOrFromSRAM: ; 7390e (1c:790e) ld [MBC1SRamBankingMode], a ld a, b ld [MBC1SRamBank], a - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData pop hl diff --git a/sram.asm b/sram.asm index f0cf6fac..40312413 100644 --- a/sram.asm +++ b/sram.asm @@ -13,33 +13,33 @@ SECTION "Save Data", SRAM, BANK[1] ds $598 sPlayerName:: ds 11 ; a598 -sMainData:: ds W_NUMINBOX - wPokedexOwned ; a5a3 -sSpriteData:: ds $200 ; wOAMBuffer - wSpriteStateData1 ; ad2c -sPartyData:: ds wPokedexOwned - wPartyCount ; af2c -sCurBoxData:: ds wBoxMonNicksEnd - W_NUMINBOX ; b0c0 +sMainData:: ds wMainDataEnd - wMainDataStart ; a5a3 +sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart ; ad2c +sPartyData:: ds wPartyDataEnd - wPartyDataStart ; af2c +sCurBoxData:: ds wBoxDataEnd - wBoxDataStart ; b0c0 sTilesetType:: ds 1 ; b522 sMainDataCheckSum:: ds 1 ; b523 SECTION "Saved Boxes 1", SRAM, BANK[2] -sBox1:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -sBox2:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -sBox3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBox1:: ds wBoxDataEnd - wBoxDataStart ; a000 +sBox2:: ds wBoxDataEnd - wBoxDataStart ; a462 +sBox3:: ds wBoxDataEnd - wBoxDataStart ; a8c4 +sBox4:: ds wBoxDataEnd - wBoxDataStart ; ad26 +sBox5:: ds wBoxDataEnd - wBoxDataStart ; b188 +sBox6:: ds wBoxDataEnd - wBoxDataStart ; b5ea sBank2AllBoxesChecksum:: ds 1 ; ba4c sBank2IndividualBoxChecksums:: ds 6 ; ba4d SECTION "Saved Boxes 2", SRAM, BANK[3] -sBox7:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -sBox8:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -sBox9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBox7:: ds wBoxDataEnd - wBoxDataStart ; a000 +sBox8:: ds wBoxDataEnd - wBoxDataStart ; a462 +sBox9:: ds wBoxDataEnd - wBoxDataStart ; a8c4 +sBox10:: ds wBoxDataEnd - wBoxDataStart ; ad26 +sBox11:: ds wBoxDataEnd - wBoxDataStart ; b188 +sBox12:: ds wBoxDataEnd - wBoxDataStart ; b5ea sBank3AllBoxesChecksum:: ds 1 ; ba4c sBank3IndividualBoxChecksums:: ds 6 ; ba4d diff --git a/wram.asm b/wram.asm index c88ba8e0..901f42d4 100755 --- a/wram.asm +++ b/wram.asm @@ -205,6 +205,8 @@ wTempoModifier:: ; c0f2 SECTION "Sprite State Data", WRAM0[$c100] +wSpriteDataStart:: + wSpriteStateData1:: ; c100 ; data for all sprites on the current map ; holds info for 16 sprites with $10 bytes each @@ -228,7 +230,7 @@ wSpriteStateData1:: ; c100 ds $10 * $10 -SECTION "Sprite State Data 2", WRAM0[$c200] +;SECTION "Sprite State Data 2", WRAM0[$c200] wSpriteStateData2:: ; c200 ; more data for all sprites on the current map @@ -252,6 +254,8 @@ wSpriteStateData2:: ; c200 ; C2xF ds $10 * $10 +wSpriteDataEnd:: + SECTION "OAM Buffer", WRAM0[$c300] @@ -2162,6 +2166,9 @@ wSavedNPCMovementDirections2Index:: ; d157 wPlayerName:: ; d158 ds 11 + +wPartyDataStart:: + wPartyCount:: ds 1 ; d163 wPartySpecies:: ds PARTY_LENGTH ; d164 wPartyEnd:: ds 1 ; d16a @@ -2177,6 +2184,10 @@ wPartyMon6:: party_struct wPartyMon6 ; d247 wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273 wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5 +wPartyDataEnd:: + + +wMainDataStart:: wPokedexOwned:: ; d2f7 flag_array NUM_POKEMON @@ -3000,6 +3011,10 @@ W_DAYCAREMONOT:: ds 11 ; da54 wDayCareMon:: box_struct wDayCareMon ; da5f +wMainDataEnd:: + + +wBoxDataStart:: W_NUMINBOX:: ds 1 ; da80 wBoxSpecies:: ds MONS_PER_BOX + 1 @@ -3012,6 +3027,8 @@ wBoxMonOT:: ds 11 * MONS_PER_BOX ; dd2a wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06 wBoxMonNicksEnd:: ; dee2 +wBoxDataEnd:: + SECTION "Stack", WRAMX[$dfff], BANK[1] wStack:: ; dfff -- cgit v1.3.1-sl0p From 4aedff021786dd5c0b81d3a35f505b7aa42adddc Mon Sep 17 00:00:00 2001 From: dannye Date: Mon, 10 Aug 2015 23:51:20 -0500 Subject: Replace hardcoded name lengths with NAME_LENGTH --- constants/misc_constants.asm | 2 ++ engine/battle/core.asm | 10 +++++----- engine/cable_club.asm | 8 ++++---- engine/evos_moves.asm | 2 +- engine/hall_of_fame.asm | 2 +- engine/in_game_trades.asm | 16 ++++++++-------- engine/items/items.asm | 20 ++++++++++---------- engine/learn_move.asm | 2 +- engine/menu/league_pc.asm | 2 +- engine/menu/main_menu.asm | 2 +- engine/menu/naming_screen.asm | 8 ++++---- engine/menu/start_sub_menus.asm | 12 ++++++------ engine/oak_speech.asm | 4 ++-- engine/oak_speech2.asm | 2 +- engine/save.asm | 4 ++-- engine/titlescreen.asm | 4 ++-- engine/trade.asm | 8 ++++---- home.asm | 14 +++++++------- main.asm | 16 ++++++++-------- scripts/namerater.asm | 4 ++-- sram.asm | 2 +- wram.asm | 26 +++++++++++++------------- 22 files changed, 86 insertions(+), 84 deletions(-) (limited to 'engine/save.asm') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index ef9e6ba3..00afa755 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -14,6 +14,8 @@ HOF_MON EQU $10 HOF_TEAM EQU PARTY_LENGTH * HOF_MON HOF_TEAM_CAPACITY EQU 50 +NAME_LENGTH EQU 11 + A_BUTTON EQU %00000001 B_BUTTON EQU %00000010 SELECT EQU %00000100 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index feadcd82..9dbcf179 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1728,7 +1728,7 @@ LoadBattleMonFromParty: ; 3cba6 (f:4ba6) ld a, [wPlayerMonNumber] call SkipFixedLengthTextEntries ld de, wBattleMonNick - ld bc, $b + ld bc, NAME_LENGTH call CopyData ld hl, wBattleMonLevel ld de, wPlayerMonUnmodifiedLevel ; block of memory used for unmodified stats @@ -1772,7 +1772,7 @@ LoadEnemyMonFromParty: ; 3cc13 (f:4c13) ld a, [wWhichPokemon] call SkipFixedLengthTextEntries ld de, wEnemyMonNick - ld bc, $b + ld bc, NAME_LENGTH call CopyData ld hl, wEnemyMonLevel ld de, wEnemyMonUnmodifiedLevel ; block of memory used for unmodified stats @@ -2099,7 +2099,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; the following happens for the old man tutorial ld hl, wPlayerName ld de, W_GRASSRATE - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ; temporarily save the player name in unused space, ; which is supposed to get overwritten when entering a ; map with wild Pokémon. Due to an oversight, the data @@ -2107,7 +2107,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; Missingno. glitch can show up. ld hl, .oldManName ld de, wPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ; the following simulates the keystrokes by drawing menus on screen coord hl, 9, 14 @@ -6326,7 +6326,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) call GetMonName ld hl, wcd6d ld de, wEnemyMonNick - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wEnemyMonSpecies2] ld [wd11e], a diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 503f3062..0759bd11 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -176,7 +176,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345 jr z, .findStartOfEnemyNameLoop dec hl ld de, wLinkEnemyTrainerName - ld c, 11 + ld c, NAME_LENGTH .copyEnemyNameLoop ld a, [hli] cp SERIAL_NO_DATA_BYTE @@ -698,7 +698,7 @@ TradeCenter_Trade: call GetMonName ld hl, wcd6d ld de, wNameOfPlayerMonToBeTraded - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wTradingWhichEnemyMon] ld hl, wEnemyPartyMons @@ -756,7 +756,7 @@ TradeCenter_Trade: ld hl, wPartyMonOT call SkipFixedLengthTextEntries ld de, wTradedPlayerMonOT - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMon1Species ld a, [wTradingWhichPlayerMon] @@ -772,7 +772,7 @@ TradeCenter_Trade: ld hl, wEnemyMonOT call SkipFixedLengthTextEntries ld de, wTradedEnemyMonOT - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wEnemyMons ld a, [wTradingWhichEnemyMon] diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index e2b1172a..056c125e 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -278,7 +278,7 @@ RenameEvolvedMon: ; 3aef7 (e:6ef7) cp "@" jr nz, .compareNamesLoop ld a, [wWhichPokemon] - ld bc, 11 + ld bc, NAME_LENGTH ld hl, wPartyMonNicks call AddNTimes push hl diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 293c756f..062950cf 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -276,7 +276,7 @@ HoFRecordMonInfo: ; 70404 (1c:4404) ld e, l ld d, h ld hl, wcd6d - ld bc, $b + ld bc, NAME_LENGTH jp CopyData HoFFadeOutScreenAndMusic: ; 70423 (1c:4423) diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index b4a73e59..4229afd8 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -17,7 +17,7 @@ DoInGameTradeDialogue: ; 71ad9 (1c:5ad9) ld a,[hli] push af ld de,wInGameTradeMonNick - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop af ld l,a @@ -81,7 +81,7 @@ InGameTrade_GetMonName: ; 71b6a (1c:5b6a) call GetMonName ld hl,wcd6d pop de - ld bc, 11 + ld bc, NAME_LENGTH jp CopyData INCLUDE "data/trades.asm" @@ -168,11 +168,11 @@ InGameTrade_PrepareTradeData: ; 71cc1 (1c:5cc1) ld a, [wInGameTradeReceiveMonSpecies] ld [hl], a ; wTradedEnemyMonSpecies ld hl, wPartyMonOT - ld bc, 11 + ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes ld de, wTradedPlayerMonOT - ld bc, 11 + ld bc, NAME_LENGTH call InGameTrade_CopyData ld hl, InGameTrade_TrainerString ld de, wTradedEnemyMonOT @@ -201,16 +201,16 @@ InGameTrade_CopyData: ; 71d11 (1c:5d11) InGameTrade_CopyDataToReceivedMon: ; 71d19 (1c:5d19) ld hl, wPartyMonNicks - ld bc, 11 + ld bc, NAME_LENGTH call InGameTrade_GetReceivedMonPointer ld hl, wInGameTradeMonNick - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMonOT - ld bc, 11 + ld bc, NAME_LENGTH call InGameTrade_GetReceivedMonPointer ld hl, InGameTrade_TrainerString - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMon1OTID ld bc, wPartyMon2 - wPartyMon1 diff --git a/engine/items/items.asm b/engine/items/items.asm index fe53082b..4ba3c706 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -142,7 +142,7 @@ ItemUseBall: ; d687 (3:5687) .oldManBattle ld hl,W_GRASSRATE ld de,wPlayerName - ld bc,11 + ld bc,NAME_LENGTH call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno glitch) jp .BallSuccess .notOldManBattle @@ -2573,14 +2573,14 @@ SendNewMonToBox: ; e7a4 (3:67a4) jr nz, .asm_e7b1 call GetMonHeader ld hl, wBoxMonOT - ld bc, 11 + ld bc, NAME_LENGTH ld a, [W_NUMINBOX] dec a jr z, .asm_e7ee dec a call AddNTimes push hl - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld d, h ld e, l @@ -2591,12 +2591,12 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7db push bc push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop hl ld d, h ld e, l - ld bc, -$b + ld bc, -NAME_LENGTH add hl, bc pop bc dec b @@ -2604,17 +2604,17 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e7ee ld hl, wPlayerName ld de, wBoxMonOT - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [W_NUMINBOX] dec a jr z, .asm_e82a ld hl, wBoxMonNicks - ld bc, 11 + ld bc, NAME_LENGTH dec a call AddNTimes push hl - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld d, h ld e, l @@ -2625,12 +2625,12 @@ SendNewMonToBox: ; e7a4 (3:67a4) .asm_e817 push bc push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop hl ld d, h ld e, l - ld bc, -$b + ld bc, -NAME_LENGTH add hl, bc pop bc dec b diff --git a/engine/learn_move.asm b/engine/learn_move.asm index 02459b20..aeb7d23d 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -5,7 +5,7 @@ LearnMove: ; 6e43 (1:6e43) call GetPartyMonName ld hl, wcd6d ld de, wd036 - ld bc, 11 + ld bc, NAME_LENGTH call CopyData DontAbandonLearning: ; 6e5b (1:6e5b) diff --git a/engine/menu/league_pc.asm b/engine/menu/league_pc.asm index 21c3f9e7..e2dce785 100755 --- a/engine/menu/league_pc.asm +++ b/engine/menu/league_pc.asm @@ -90,7 +90,7 @@ LeaguePCShowMon: ; 76610 (1d:6610) ld a, [hli] ld [wHoFMonLevel], a ld de, wcd6d - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld b, $0B ld c, 0 diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index b8896d79..5e853aae 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -689,7 +689,7 @@ CheckForPlayerNameInSRAM: ; 609e (1:609e) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld b, $b + ld b, NAME_LENGTH ld hl, sPlayerName .loop ld a, [hli] diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index e64a4bee..85111cd6 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -46,7 +46,7 @@ AskName: ; 64eb (1:64eb) ld d, h ld e, l ld hl, wcd6d - ld bc, 11 + ld bc, NAME_LENGTH jp CopyData DoYouWantToNicknameText: ; 0x6557 @@ -67,13 +67,13 @@ DisplayNameRaterScreen: ; 655c (1:655c) cp "@" jr z, .playerCancelled ld hl, wPartyMonNicks - ld bc, 11 + ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes ld e, l ld d, h ld hl, wBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData and a ret @@ -158,7 +158,7 @@ DisplayNamingScreen: ; 6596 (1:6596) .submitNickname pop de ld hl, wcf4b - ld bc, 11 + ld bc, NAME_LENGTH call CopyData call GBPalWhiteOutWithDelay3 call ClearScreen diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 110da50d..4dc84d06 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -813,36 +813,36 @@ SwitchPartyMon_InitVarOrSwapData: ; 13653 (4:7653) call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMonOT ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMonNicks ld a, [wCurrentMenuItem] call SkipFixedLengthTextEntries push hl ld de, wSwitchPartyMonTempBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wPartyMonNicks ld a, [wMenuItemToSwap] call SkipFixedLengthTextEntries pop de push hl - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wMenuItemToSwap] ld [wSwappedMenuItem], a diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 566bd880..0de7ffad 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -24,11 +24,11 @@ SetDefaultNames: ; 60ca (1:60ca) call z, InitOptions ld hl, NintenText ld de, wPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, SonyText ld de, W_RIVALNAME - ld bc, 11 + ld bc, NAME_LENGTH jp CopyData OakSpeech: ; 6115 (1:6115) diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 50e3708c..23f39fd5 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -73,7 +73,7 @@ OakSpeechSlidePicLeft: ; 69ec (1:69ec) call DelayFrames pop de ld hl, wcd6d - ld bc, 11 + ld bc, NAME_LENGTH call CopyData call Delay3 coord hl, 12, 4 diff --git a/engine/save.asm b/engine/save.asm index 717b316a..26f9507f 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -57,7 +57,7 @@ LoadSAV0: ; 73623 (1c:7623) .checkSumsMatched ld hl, sPlayerName ld de, wPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, sMainData ld de, wMainDataStart @@ -203,7 +203,7 @@ SaveSAVtoSRAM0: ; 7378c (1c:778c) ld [MBC1SRamBank], a ld hl, wPlayerName ld de, sPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wMainDataStart ld de, sMainData diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 10c3f2a0..0dbe4a4c 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -1,6 +1,6 @@ -; copy text of fixed length $b (like player name, rival name, mon names, ...) +; copy text of fixed length NAME_LENGTH (like player name, rival name, mon names, ...) CopyFixedLengthText: ; 42b1 (1:42b1) - ld bc, 11 + ld bc, NAME_LENGTH jp CopyData SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7) diff --git a/engine/trade.asm b/engine/trade.asm index 6e825fe5..b7c72520 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -190,7 +190,7 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1) call GetMonName ld hl, wcd6d ld de, wcf4b - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wTradedEnemyMonSpecies] ld [wd11e], a @@ -204,15 +204,15 @@ Trade_LoadMonPartySpriteGfx: ; 4120b (10:520b) Trade_SwapNames: ; 41217 (10:5217) ld hl, wPlayerName ld de, wBuffer - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wLinkEnemyTrainerName ld de, wPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld hl, wBuffer ld de, wLinkEnemyTrainerName - ld bc, 11 + ld bc, NAME_LENGTH jp CopyData Trade_Cleanup: ; 4123b (10:523b) diff --git a/home.asm b/home.asm index 2d64833f..e1fbc0f2 100644 --- a/home.asm +++ b/home.asm @@ -626,10 +626,10 @@ GetPartyMonName2:: ; 15b4 (0:15b4) GetPartyMonName:: ; 15ba (0:15ba) push hl push bc - call SkipFixedLengthTextEntries ; add 11 to hl, a times + call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times ld de,wcd6d push de - ld bc,11 + ld bc,NAME_LENGTH call CopyData pop de pop bc @@ -2238,7 +2238,7 @@ LoadGymLeaderAndCityName:: ; 317f (0:317f) call CopyData ; load city name pop hl ld de, wGymLeaderName - ld bc, $b + ld bc, NAME_LENGTH jp CopyData ; load gym leader name ; reads specific information from trainer header (pointed to at W_TRAINERHEADERPTR) @@ -3264,7 +3264,7 @@ GetName:: ; 376b (0:376b) jr nz,.otherEntries ;1 = MON_NAMES call GetMonName - ld hl,11 + ld hl,NAME_LENGTH add hl,de ld e,l ld d,h @@ -3825,12 +3825,12 @@ MoveMon:: ; 3a68 (0:3a68) ld [MBC1RomBank], a ret -; skips a text entries, each of size 11 (like trainer name, OT name, rival name, ...) -; hl: base pointer, will be incremented by $b * a +; skips a text entries, each of size NAME_LENGTH (like trainer name, OT name, rival name, ...) +; hl: base pointer, will be incremented by NAME_LENGTH * a SkipFixedLengthTextEntries:: ; 3a7d (0:3a7d) and a ret z - ld bc, 11 + ld bc, NAME_LENGTH .skipLoop add hl, bc dec a diff --git a/main.asm b/main.asm index 507d5c46..7c047dbd 100755 --- a/main.asm +++ b/main.asm @@ -1967,7 +1967,7 @@ _RemovePokemon: ; 7b68 (1:7b68) .asm_7ba6 ld d, h ld e, l - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld bc, wPartyMonNicks ld a, [wRemoveMonFromBox] @@ -2007,12 +2007,12 @@ _RemovePokemon: ; 7b68 (1:7b68) jr z, .asm_7bfa ld hl, wBoxMonNicks .asm_7bfa - ld bc, 11 + ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes ld d, h ld e, l - ld bc, 11 + ld bc, NAME_LENGTH add hl, bc ld bc, wPokedexOwned ld a, [wRemoveMonFromBox] @@ -3587,7 +3587,7 @@ _AddPartyMon: ; f2e5 (3:72e5) ld d, h ld e, l ld hl, wPlayerName - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wMonDataLocation] and a @@ -3858,7 +3858,7 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) ld hl, wEnemyMonOT ld a, [wWhichPokemon] call SkipFixedLengthTextEntries - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ; write new mon's OT name (from an enemy mon) ld hl, wPartyMonNicks ld a, [wPartyCount] @@ -3869,7 +3869,7 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) ld hl, wEnemyMonNicks ld a, [wWhichPokemon] call SkipFixedLengthTextEntries - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) ld a, [wcf91] ld [wd11e], a @@ -4000,7 +4000,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wWhichPokemon] call SkipFixedLengthTextEntries .asm_f5ec - ld bc, 11 + ld bc, NAME_LENGTH call CopyData ld a, [wMoveMonType] cp PARTY_TO_DAYCARE @@ -4030,7 +4030,7 @@ _MoveMon: ; f51e (3:751e) ld a, [wWhichPokemon] call SkipFixedLengthTextEntries .asm_f62a - ld bc, 11 + ld bc, NAME_LENGTH call CopyData pop hl ld a, [wMoveMonType] diff --git a/scripts/namerater.asm b/scripts/namerater.asm index 0222d596..42b82b62 100755 --- a/scripts/namerater.asm +++ b/scripts/namerater.asm @@ -10,11 +10,11 @@ NameRaterScript_1da15: ; 1da15 (7:5a15) NameRaterScript_1da20: ; 1da20 (7:5a20) ld hl, wPartyMonOT - ld bc, 11 + ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes ld de, wPlayerName - ld c, 11 + ld c, NAME_LENGTH call .asm_1da47 jr c, .asm_1da52 ld hl, wPartyMon1OTID diff --git a/sram.asm b/sram.asm index 40312413..9f49d9ca 100644 --- a/sram.asm +++ b/sram.asm @@ -12,7 +12,7 @@ sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY ; a598 SECTION "Save Data", SRAM, BANK[1] ds $598 -sPlayerName:: ds 11 ; a598 +sPlayerName:: ds NAME_LENGTH ; a598 sMainData:: ds wMainDataEnd - wMainDataStart ; a5a3 sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart ; ad2c sPartyData:: ds wPartyDataEnd - wPartyDataStart ; af2c diff --git a/wram.asm b/wram.asm index 901f42d4..47074b55 100755 --- a/wram.asm +++ b/wram.asm @@ -1302,7 +1302,7 @@ wGymCityName:: ; cf5f ds 17 wGymLeaderName:: ; cf70 - ds 11 + ds NAME_LENGTH wItemList:: ; cf7b ds 16 @@ -1441,7 +1441,7 @@ wEnemyMonSpecies2:: ; cfd8 wBattleMonSpecies2:: ; cfd9 ds 1 -wEnemyMonNick:: ds 11 ; cfda +wEnemyMonNick:: ds NAME_LENGTH ; cfda wEnemyMon:: ; cfe5 ; The wEnemyMon struct reaches past 0xcfff, @@ -1479,7 +1479,7 @@ wEnemyMonBaseStats:: ds 5 wEnemyMonCatchRate:: ds 1 wEnemyMonBaseExp:: ds 1 -wBattleMonNick:: ds 11 ; d009 +wBattleMonNick:: ds NAME_LENGTH ; d009 wBattleMon:: battle_struct wBattleMon ; d014 @@ -2164,7 +2164,7 @@ wSavedNPCMovementDirections2Index:: ; d157 ds 1 wPlayerName:: ; d158 - ds 11 + ds NAME_LENGTH wPartyDataStart:: @@ -2181,8 +2181,8 @@ wPartyMon4:: party_struct wPartyMon4 ; d1ef wPartyMon5:: party_struct wPartyMon5 ; d21b wPartyMon6:: party_struct wPartyMon6 ; d247 -wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273 -wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5 +wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d273 +wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d2b5 wPartyDataEnd:: @@ -2209,7 +2209,7 @@ wPlayerMoney:: ; d347 ds 3 ; BCD W_RIVALNAME:: ; d34a - ds 11 + ds NAME_LENGTH W_OPTIONS:: ; d355 ; bit 7 = battle animation @@ -2962,8 +2962,8 @@ wEnemyMon4:: party_struct wEnemyMon4 wEnemyMon5:: party_struct wEnemyMon5 wEnemyMon6:: party_struct wEnemyMon6 -wEnemyMonOT:: ds 11 * PARTY_LENGTH ; d9ac -wEnemyMonNicks:: ds 11 * PARTY_LENGTH ; d9ee +wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ac +wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ee W_TRAINERHEADERPTR:: ; da30 @@ -3006,8 +3006,8 @@ W_DAYCARE_IN_USE:: ; da48 ; 1 if pokemon is in the daycare ds 1 -W_DAYCAREMONNAME:: ds 11 ; da49 -W_DAYCAREMONOT:: ds 11 ; da54 +W_DAYCAREMONNAME:: ds NAME_LENGTH ; da49 +W_DAYCAREMONOT:: ds NAME_LENGTH ; da54 wDayCareMon:: box_struct wDayCareMon ; da5f @@ -3023,8 +3023,8 @@ wBoxMons:: wBoxMon1:: box_struct wBoxMon1 ; da96 wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) ; dab7 -wBoxMonOT:: ds 11 * MONS_PER_BOX ; dd2a -wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06 +wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX ; dd2a +wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX ; de06 wBoxMonNicksEnd:: ; dee2 wBoxDataEnd:: -- cgit v1.3.1-sl0p From fb0a630c062cbb18026abe2792339dea27fac4d8 Mon Sep 17 00:00:00 2001 From: dannye Date: Tue, 11 Aug 2015 00:34:32 -0500 Subject: More joypad constants --- engine/hidden_object_functions17.asm | 48 +++++++++++++++++++----------------- engine/hidden_object_functions7.asm | 24 +++++++++--------- engine/learn_move.asm | 14 +++++------ engine/menu/main_menu.asm | 5 ++-- engine/menu/pokedex.asm | 3 ++- engine/menu/prize_menu.asm | 2 +- engine/menu/start_sub_menus.asm | 4 +-- engine/oak_speech2.asm | 2 +- engine/save.asm | 2 +- main.asm | 2 +- scripts/bikeshop.asm | 20 +++++++-------- scripts/celadonmartroof.asm | 4 +-- text/maps/bike_shop.asm | 4 +-- 13 files changed, 70 insertions(+), 64 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index a2167b54..77f3eeb9 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -98,7 +98,7 @@ LinkCableHelp: ; 5dc29 (17:5c29) ld [W_ANIMATIONID], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, $3 ld [wMaxMenuItem], a @@ -106,7 +106,7 @@ LinkCableHelp: ; 5dc29 (17:5c29) ld [wTopMenuItemY], a ld a, $1 ld [wTopMenuItemX], a -.asm_5c51 +.linkHelpLoop ld hl, wd730 set 6, [hl] coord hl, 0, 0 @@ -119,11 +119,11 @@ LinkCableHelp: ; 5dc29 (17:5c29) ld hl, LinkCableHelpText2 call PrintText call HandleMenuInput - bit 1, a - jr nz, .asm_5dc93 + bit 1, a ; pressed b + jr nz, .exit ld a, [wCurrentMenuItem] - cp $3 - jr z, .asm_5dc93 + cp $3 ; pressed a on "STOP READING" + jr z, .exit ld hl, wd730 res 6, [hl] ld hl, LinkCableInfoTexts @@ -135,8 +135,8 @@ LinkCableHelp: ; 5dc29 (17:5c29) ld h, [hl] ld l, a call PrintText - jp .asm_5c51 -.asm_5dc93 + jp .linkHelpLoop +.exit ld hl, wd730 res 6, [hl] call LoadScreenTilesFromBuffer1 @@ -182,7 +182,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld [W_ANIMATIONID], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld a, $33 + ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, $2 ld [wMaxMenuItem], a @@ -190,7 +190,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld [wTopMenuItemY], a ld a, $1 ld [wTopMenuItemX], a -.asm_5dd15 +.blackboardLoop ld hl, wd730 set 6, [hl] coord hl, 0, 0 @@ -204,11 +204,12 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) call PlaceString ld hl, ViridianSchoolBlackboardText2 call PrintText - call HandleMenuInput - bit 1, a + call HandleMenuInput ; pressing up and down is handled in here + bit 1, a ; pressed b jr nz, .exitBlackboard - bit 4, a - jr z, .asm_5dd5c + bit 4, a ; pressed right + jr z, .didNotPressRight + ; move cursor to right column ld a, $2 ld [wMaxMenuItem], a ld a, $2 @@ -217,10 +218,11 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld [wTopMenuItemX], a ld a, $3 ld [W_ANIMATIONID], a - jr .asm_5dd15 -.asm_5dd5c - bit 5, a - jr z, .asm_5dd75 + jr .blackboardLoop +.didNotPressRight + bit 5, a ; pressed left + jr z, .didNotPressLeftOrRight + ; move cursor to left column ld a, $2 ld [wMaxMenuItem], a ld a, $2 @@ -229,14 +231,16 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld [wTopMenuItemX], a xor a ld [W_ANIMATIONID], a - jr .asm_5dd15 -.asm_5dd75 + jr .blackboardLoop +.didNotPressLeftOrRight ld a, [wCurrentMenuItem] ld b, a ld a, [W_ANIMATIONID] add b - cp $5 + cp $5 ; cursor is pointing to "QUIT" jr z, .exitBlackboard + ; we must have pressed a on a status condition + ; so print the text ld hl, wd730 res 6, [hl] ld hl, ViridianBlackboardStatusPointers @@ -248,7 +252,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld h, [hl] ld l, a call PrintText - jp .asm_5dd15 + jp .blackboardLoop .exitBlackboard ld hl, wd730 res 6, [hl] diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 67e75301..02d3928a 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -394,7 +394,7 @@ BillsHousePokemonList: ; 1ec05 (7:6c05) ld [W_ANIMATIONID], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, $4 ld [wMaxMenuItem], a @@ -402,7 +402,7 @@ BillsHousePokemonList: ; 1ec05 (7:6c05) ld [wTopMenuItemY], a ld a, $1 ld [wTopMenuItemX], a -.asm_1ec2d +.billsPokemonLoop ld hl, wd730 set 6, [hl] coord hl, 0, 0 @@ -416,24 +416,24 @@ BillsHousePokemonList: ; 1ec05 (7:6c05) call PrintText call SaveScreenTilesToBuffer2 call HandleMenuInput - bit 1, a - jr nz, .asm_1ec74 + bit 1, a ; pressed b + jr nz, .cancel ld a, [wCurrentMenuItem] add EEVEE cp EEVEE - jr z, .asm_1ec6c + jr z, .displayPokedex cp FLAREON - jr z, .asm_1ec6c + jr z, .displayPokedex cp JOLTEON - jr z, .asm_1ec6c + jr z, .displayPokedex cp VAPOREON - jr z, .asm_1ec6c - jr .asm_1ec74 -.asm_1ec6c + jr z, .displayPokedex + jr .cancel +.displayPokedex call DisplayPokedex call LoadScreenTilesFromBuffer2 - jr .asm_1ec2d -.asm_1ec74 + jr .billsPokemonLoop +.cancel ld hl, wd730 res 6, [hl] call LoadScreenTilesFromBuffer2 diff --git a/engine/learn_move.asm b/engine/learn_move.asm index aeb7d23d..46d30bd9 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -116,7 +116,7 @@ TryingToLearn: ; 6f07 (1:6f07) call CopyData callab FormatMovesString pop hl -.asm_6f39 +.loop push hl ld hl, WhichMoveToForgetText call PrintText @@ -155,8 +155,8 @@ TryingToLearn: ; 6f07 (1:6f07) call LoadScreenTilesFromBuffer1 pop af pop hl - bit 1, a - jr nz, .asm_6fab + bit 1, a ; pressed b + jr nz, .cancel push hl ld a, [wCurrentMenuItem] ld c, a @@ -169,17 +169,17 @@ TryingToLearn: ; 6f07 (1:6f07) pop bc pop de ld a, d - jr c, .asm_6fa2 + jr c, .hm pop hl add hl, bc and a ret -.asm_6fa2 +.hm ld hl, HMCantDeleteText call PrintText pop hl - jr .asm_6f39 -.asm_6fab + jr .loop +.cancel scf ret diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 5e853aae..24302c46 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -61,7 +61,7 @@ MainMenu: ; 5af2 (1:5af2) ld [wTopMenuItemX],a inc a ld [wTopMenuItemY],a - ld a,$B + ld a,A_BUTTON | B_BUTTON | START ld [wMenuWatchedKeys],a ld a,[wSaveFileStatus] ld [wMaxMenuItem],a @@ -163,7 +163,8 @@ LinkMenu: ; 5c0a (1:5c0a) ld a, $2 ld [hli], a inc a - ld [hli], a + ; ld a, A_BUTTON | B_BUTTON + ld [hli], a ; wMenuWatchedKeys xor a ld [hl], a .waitForInputLoop diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index fd8a928d..8e69329a 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -27,7 +27,7 @@ ShowPokedexMenu: ; 40000 (10:4000) inc hl ld a,6 ld [hli],a ; max menu item ID - ld [hl],%00110011 ; menu watched keys (Left, Right, B button, A button) + ld [hl],D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON call HandlePokedexListMenu jr c,.goToSideMenu ; if the player chose a pokemon from the list .exitPokedex @@ -88,6 +88,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d) inc hl ld a,3 ld [hli],a ; max menu item ID + ;ld a, A_BUTTON | B_BUTTON ld [hli],a ; menu watched keys (A button and B button) xor a ld [hli],a ; old menu item ID diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index 2bf932ba..409f0bdb 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -13,7 +13,7 @@ CeladonPrizeMenu: ; 5271b (14:671b) xor a ld [wCurrentMenuItem],a ld [wLastMenuItem],a - ld a,$03 + ld a,A_BUTTON | B_BUTTON ld [wMenuWatchedKeys],a ld a,$03 ld [wMaxMenuItem],a diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 4dc84d06..f726f128 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -57,7 +57,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9) inc hl ld a,b ld [hli],a ; max menu item ID - ld a,%00000011 ; A button, B button + ld a,A_BUTTON | B_BUTTON ld [hli],a ; menu watched keys xor a ld [hl],a @@ -354,7 +354,7 @@ StartMenu_Item: ; 13302 (4:7302) inc hl inc a ; a = 1 ld [hli],a ; max menu item ID - ld a,%00000011 ; A button, B button + ld a,A_BUTTON | B_BUTTON ld [hli],a ; menu watched keys xor a ld [hl],a ; old menu item id diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index 23f39fd5..673c13ad 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -177,7 +177,7 @@ DisplayIntroNameTextBox: ; 6a6c (1:6a6c) ld [wLastMenuItem], a inc a ld [wTopMenuItemX], a - ld [wMenuWatchedKeys], a + ld [wMenuWatchedKeys], a ; A_BUTTON inc a ld [wTopMenuItemY], a inc a diff --git a/engine/save.asm b/engine/save.asm index 26f9507f..ae895d96 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -356,7 +356,7 @@ ChangeBox:: ; 738a1 (1c:78a1) call HandleMenuInput ld hl, hFlags_0xFFF6 res 1, [hl] - bit 1, a + bit 1, a ; pressed b ret nz call GetBoxSRAMLocation ld e, l diff --git a/main.asm b/main.asm index 7c047dbd..8e41af64 100755 --- a/main.asm +++ b/main.asm @@ -1082,7 +1082,7 @@ DrawStartMenu: ; 710b (1:710b) ld c,$08 .drawTextBoxBorder call TextBoxBorder - ld a,%11001011 ; bit mask for down, up, start, B, and A buttons + ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON ld [wMenuWatchedKeys],a ld a,$02 ld [wTopMenuItemY],a ; Y position of first menu choice diff --git a/scripts/bikeshop.asm b/scripts/bikeshop.asm index cf717b43..e639caf9 100755 --- a/scripts/bikeshop.asm +++ b/scripts/bikeshop.asm @@ -39,7 +39,7 @@ BikeShopText1: ; 1d745 (7:5745) xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, $1 ld [wMaxMenuItem], a @@ -64,16 +64,16 @@ BikeShopText1: ; 1d745 (7:5745) call PrintText call HandleMenuInput bit 1, a - jr nz, .asm_b7579 + jr nz, .cancel ld hl, wd730 res 6, [hl] ld a, [wCurrentMenuItem] and a - jr nz, .asm_b7579 - ld hl, BikeShopText_1d81a + jr nz, .cancel + ld hl, BikeShopCantAffordText call PrintText -.asm_b7579 - ld hl, BikeShopText_1d82a +.cancel + ld hl, BikeShopComeAgainText call PrintText .Done jp TextScriptEnd @@ -93,8 +93,8 @@ BikeShopText_1d815: ; 1d815 (7:5815) TX_FAR _BikeShopText_1d815 db "@" -BikeShopText_1d81a: ; 1d81a (7:581a) - TX_FAR _BikeShopText_1d81a +BikeShopCantAffordText: ; 1d81a (7:581a) + TX_FAR _BikeShopCantAffordText db "@" BikeShopText_1d81f: ; 1d81f (7:581f) @@ -105,8 +105,8 @@ BikeShopText_1d824: ; 1d824 (7:5824) TX_FAR _BikeShopText_1d824 db $11, "@" -BikeShopText_1d82a: ; 1d82a (7:582a) - TX_FAR _BikeShopText_1d82a +BikeShopComeAgainText: ; 1d82a (7:582a) + TX_FAR _BikeShopComeAgainText db "@" BikeShopText_1d82f: ; 1d82f (7:582f) diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 8eeb5d2b..4a90535a 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -46,7 +46,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) call PrintText xor a ld [wCurrentMenuItem], a - ld a, $3 + ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, [wcd37] dec a @@ -70,7 +70,7 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) ld hl, wd730 res 6, [hl] call HandleMenuInput - bit 1, a + bit 1, a ; pressed b ret nz ld hl, wcc5b ld a, [wCurrentMenuItem] diff --git a/text/maps/bike_shop.asm b/text/maps/bike_shop.asm index 5f2c3f45..45341c66 100644 --- a/text/maps/bike_shop.asm +++ b/text/maps/bike_shop.asm @@ -11,7 +11,7 @@ _BikeShopText_1d815:: ; 98e45 (26:4e45) line "Do you want it?" done -_BikeShopText_1d81a:: ; 98e67 (26:4e67) +_BikeShopCantAffordText:: ; 98e67 (26:4e67) text "Sorry! You can't" line "afford it!" prompt @@ -29,7 +29,7 @@ _BikeShopText_1d824:: ; 98eb2 (26:4eb2) line "the BIKE VOUCHER" cont "for a BICYCLE.@@" -_BikeShopText_1d82a:: ; 98ee0 (26:4ee0) +_BikeShopComeAgainText:: ; 98ee0 (26:4ee0) text "Come back again" line "some time!" done -- cgit v1.3.1-sl0p From 132d0367522b7acce602b146ca69bfad87ef96c6 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 12 Aug 2015 22:14:31 -0700 Subject: named more variables --- engine/battle/experience.asm | 8 +-- engine/cable_club.asm | 2 +- engine/game_corner_slots2.asm | 2 +- engine/hall_of_fame.asm | 2 +- engine/items/items.asm | 2 +- engine/menu/main_menu.asm | 2 +- engine/mon_party_sprites.asm | 10 ++-- engine/overworld/cinnabar_lab.asm | 16 +++--- engine/overworld/hidden_items.asm | 2 +- engine/overworld/oaks_aide.asm | 2 +- engine/pokedex_rating.asm | 2 +- engine/predefs.asm | 2 +- engine/predefs7.asm | 2 +- engine/save.asm | 6 +-- engine/titlescreen.asm | 2 +- engine/trade.asm | 2 +- home.asm | 2 +- hram.asm | 4 +- main.asm | 14 +++--- scripts/celadonmartelevator.asm | 2 +- scripts/celadonmartroof.asm | 102 +++++++++++++++++++------------------- scripts/ceruleanhousetrashed.asm | 2 +- scripts/lab4.asm | 15 +++--- scripts/oakslab.asm | 16 +++--- scripts/rockethideoutelevator.asm | 2 +- scripts/route11gateupstairs.asm | 4 +- scripts/route15gateupstairs.asm | 4 +- scripts/route2gate.asm | 4 +- scripts/silphcoelevator.asm | 2 +- scripts/vermilioncity.asm | 4 +- scripts/vermiliondock.asm | 26 ++++++---- text.asm | 16 +++--- wram.asm | 44 +++++++++++++--- 33 files changed, 185 insertions(+), 142 deletions(-) (limited to 'engine/save.asm') diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 433588e3..ab3e3c19 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -76,11 +76,11 @@ GainExperience: ; 5524f (15:524f) ld b, [hl] ld a, [wPlayerID + 1] cp b - ld a, $0 + ld a, 0 jr z, .next .tradedMon call BoostExp ; traded mon exp boost - ld a, $1 + ld a, 1 .next ld [wGainBoostedExp], a ld a, [W_ISINBATTLE] @@ -92,12 +92,12 @@ GainExperience: ; 5524f (15:524f) ; add the gained exp to the party mon's exp ld b, [hl] ld a, [H_QUOTIENT + 3] - ld [wcf4c], a + ld [wExpAmountGained + 1], a add b ld [hld], a ld b, [hl] ld a, [H_QUOTIENT + 2] - ld [wcf4b], a + ld [wExpAmountGained], a adc b ld [hl], a jr nc, .noCarry diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 0759bd11..465561ca 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -836,7 +836,7 @@ TradeCenter_Trade: call ClearScreen call LoadHpBarAndStatusTilePatterns xor a - ld [wcc5b], a + ld [wUnusedCC5B], a ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .usingExternalClock diff --git a/engine/game_corner_slots2.asm b/engine/game_corner_slots2.asm index 643536ea..58386ba1 100755 --- a/engine/game_corner_slots2.asm +++ b/engine/game_corner_slots2.asm @@ -3,7 +3,7 @@ AbleToPlaySlotsCheck: ; 2ff09 (b:7f09) and $8 jr z, .done ; not able ld b, COIN_CASE - predef IsItemInBag_ ; IsItemInBag_ + predef GetQuantityOfItemInBag ld a, b and a ld b, (GameCornerCoinCaseText_id - TextPredefs) / 2 + 1 diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index c329c1a9..d95c01c5 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -243,7 +243,7 @@ HoFDisplayPlayerStats: ; 70377 (1c:4377) call HoFPrintTextAndDelay ld hl, DexRatingText call HoFPrintTextAndDelay - ld hl, wcc5d + ld hl, wDexRatingText HoFPrintTextAndDelay: ; 703e2 (1c:43e2) call PrintText diff --git a/engine/items/items.asm b/engine/items/items.asm index 418b21da..1a342d97 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -1324,7 +1324,7 @@ ItemUseRock: ; df67 (3:5f67) BaitRockCommon: ; df7f (3:5f7f) ld [W_ANIMATIONID],a xor a - ld [wcc5b],a + ld [wAnimationType],a ld [H_WHOSETURN],a ld [de],a ; zero escape factor (for bait), zero bait factor (for rock) .randomLoop ; loop until a random number less than 5 is generated diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index bff0fbe7..6c109cec 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -150,7 +150,7 @@ LinkMenu: ; 5c0a (1:5c0a) ld de, CableClubOptionsText call PlaceString xor a - ld [wcd37], a + ld [wUnusedCD37], a ld [wd72d], a ld hl, wTopMenuItemY ld a, $7 diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm index c0163b1e..185151cb 100755 --- a/engine/mon_party_sprites.asm +++ b/engine/mon_party_sprites.asm @@ -13,7 +13,7 @@ AnimatePartyMon: ; 716ff (1c:56ff) ld hl, wPartyMenuHPBarColors ld a, [wCurrentMenuItem] ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] @@ -42,7 +42,7 @@ GetAnimationSpeed: ; 7170a (1c:570a) jp DelayFrame .resetSprites push bc - ld hl, wcc5b + ld hl, wMonPartySpritesSavedOAM ld de, wOAMBuffer ld bc, $60 call CopyData @@ -86,7 +86,7 @@ GetAnimationSpeed: ; 7170a (1c:570a) ; that each frame lasts for green HP, yellow HP, and red HP in order. ; On the naming screen, the yellow HP speed is always used. PartyMonSpeeds: ; 71769 (1c:5769) - db $05,$10,$20 + db 5, 16, 32 LoadMonPartySpriteGfx: ; 7176c (1c:576c) ; Load mon party sprite tile patterns into VRAM during V-blank. @@ -372,7 +372,7 @@ UnusedPartyMonSpriteFunction: ; 71890 (1c:5890) WriteMonPartySpriteOAM: ; 718c3 (1c:58c3) ; Write the OAM blocks for the first animation frame into the OAM buffer and -; make a copy at wcc5b. +; make a copy at wMonPartySpritesSavedOAM. push af ld c, $10 ld h, wOAMBuffer / $100 @@ -392,7 +392,7 @@ WriteMonPartySpriteOAM: ; 718c3 (1c:58c3) ; we can flip back to it from the second frame by copying it back. .makeCopy ld hl, wOAMBuffer - ld de, wcc5b + ld de, wMonPartySpritesSavedOAM ld bc, $60 jp CopyData diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index 5337255c..f81324e0 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -5,14 +5,14 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) ld [wCurrentMenuItem], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, [wcd37] + ld a, [wFilteredBagItemsCount] dec a ld [wMaxMenuItem], a ld a, 2 ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a - ld a, [wcd37] + ld a, [wFilteredBagItemsCount] dec a ld bc, 2 ld hl, 3 @@ -29,9 +29,9 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) call HandleMenuInput bit 1, a ; pressed B? jr nz, .cancelledGivingFossil - ld hl, wcc5b + ld hl, wFilteredBagItems ld a, [wCurrentMenuItem] - ld d, $0 + ld d, 0 ld e, a add hl, de ld a, [hl] @@ -90,9 +90,9 @@ LabFossil_610bd: ; 610bd (18:50bd) PrintFossilsInBag: ; 610c2 (18:50c2) ; Prints each fossil in the player's bag on a separate line in the menu. - ld hl, wcc5b + ld hl, wFilteredBagItems xor a - ld [hFossilCounter], a + ld [hItemCounter], a .loop ld a, [hli] cp $ff @@ -101,12 +101,12 @@ PrintFossilsInBag: ; 610c2 (18:50c2) ld [wd11e], a call GetItemName coord hl, 2, 2 - ld a, [hFossilCounter] + ld a, [hItemCounter] ld bc, SCREEN_WIDTH * 2 call AddNTimes ld de, wcd6d call PlaceString - ld hl, hFossilCounter + ld hl, hItemCounter inc [hl] pop hl jr .loop diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 1203dd2a..28528116 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -51,7 +51,7 @@ HiddenItemBagFullText: ; 76794 (1d:6794) HiddenCoins: ; 76799 (1d:6799) ld b, COIN_CASE - predef IsItemInBag_ + predef GetQuantityOfItemInBag ld a, b and a ret z diff --git a/engine/overworld/oaks_aide.asm b/engine/overworld/oaks_aide.asm index 31832315..8ac456d2 100755 --- a/engine/overworld/oaks_aide.asm +++ b/engine/overworld/oaks_aide.asm @@ -18,7 +18,7 @@ OaksAideScript: ; 0x59035 .giveItem ld hl, OaksAideHereYouGoText call PrintText - ld a, [hOaksAideItemReward] + ld a, [hOaksAideRewardItem] ld b, a ld c, 1 call GiveItem diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm index 265eff40..73025f0a 100755 --- a/engine/pokedex_rating.asm +++ b/engine/pokedex_rating.asm @@ -33,7 +33,7 @@ DisplayDexRating: ; 44169 (11:4169) callba PlayPokedexRatingSfx jp WaitForTextScrollButtonPress .hallOfFame - ld de, wcc5b + ld de, wDexRatingNumMonsSeen ld a, [hDexRatingNumMonsSeen] ld [de], a inc de diff --git a/engine/predefs.asm b/engine/predefs.asm index 0abdb5b3..16533751 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -80,7 +80,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef LoadTilesetHeader add_predef LearnMoveFromLevelUp add_predef LearnMove - add_predef IsItemInBag_ + add_predef GetQuantityOfItemInBag dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 dbw $03,GiveItem add_predef ChangeBGPalColor0_4Frames diff --git a/engine/predefs7.asm b/engine/predefs7.asm index bf31772c..a2c08171 100755 --- a/engine/predefs7.asm +++ b/engine/predefs7.asm @@ -21,7 +21,7 @@ DisplayElevatorFloorMenu: ; 1c9c6 (7:49c6) ret c ld hl, wd126 set 7, [hl] - ld hl, wcc5b + ld hl, wElevatorWarpMaps ld a, [wWhichPokemon] add a ld d, 0 diff --git a/engine/save.asm b/engine/save.asm index ae895d96..a7b2a7c0 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -644,7 +644,7 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) call AddNTimes ld e, l ld d, h - ld hl, wcc5b + ld hl, wHallOfFame ld bc, HOF_TEAM jr HallOfFame_Copy @@ -653,7 +653,7 @@ SaveHallOfFameTeams: ; 73b0d (1c:7b0d) ld de, sHallOfFame ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1) call HallOfFame_Copy - ld hl, wcc5b + ld hl, wHallOfFame ld de, sHallOfFame + HOF_TEAM * (HOF_TEAM_CAPACITY - 1) ld bc, HOF_TEAM jr HallOfFame_Copy @@ -663,7 +663,7 @@ LoadHallOfFameTeams: ; 73b3f (1c:7b3f) ld bc, HOF_TEAM ld a, [wHoFTeamIndex] call AddNTimes - ld de, wcc5b + ld de, wHallOfFame ld bc, HOF_TEAM ; fallthrough diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index a75d3dcf..b0bf0fb6 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -215,7 +215,7 @@ ENDC ld [wNewSoundID], a call PlaySound xor a - ld [wcc5b], a + ld [wUnusedCC5B], a ; Keep scrolling in new mons indefinitely until the user performs input. .awaitUserInterruptionLoop diff --git a/engine/trade.asm b/engine/trade.asm index 16a3d6a9..0e816e05 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -849,5 +849,5 @@ TradeforText: ; 41671 (10:5671) Trade_ShowAnimation: ; 41676 (10:5676) ld [W_ANIMATIONID], a xor a - ld [wcc5b], a + ld [wAnimationType], a predef_jump MoveAnimation diff --git a/home.asm b/home.asm index 3206a7ad..0d7c5271 100644 --- a/home.asm +++ b/home.asm @@ -2706,7 +2706,7 @@ IsItemInBag:: ; 3493 (0:3493) ; set zero flag if item isn't in player's bag ; else reset zero flag ; related to Pokémon Tower and ghosts - predef IsItemInBag_ + predef GetQuantityOfItemInBag ld a,b and a ret diff --git a/hram.asm b/hram.asm index 77fb7c1e..c1fb4c4c 100644 --- a/hram.asm +++ b/hram.asm @@ -269,7 +269,7 @@ hMovingBGTilesCounter1 EQU $FFD8 H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 -hFossilCounter EQU $FFDB +hItemCounter EQU $FFDB hGymGateIndex EQU $FFDB @@ -285,7 +285,7 @@ hDexRatingNumMonsOwned EQU $FFDC hOaksAideResult EQU $FFDB hOaksAideRequirement EQU $FFDB ; required number of owned mons -hOaksAideItemReward EQU $FFDC +hOaksAideRewardItem EQU $FFDC hOaksAideNumMonsOwned EQU $FFDD hItemToRemoveID EQU $FFDB diff --git a/main.asm b/main.asm index a61c433b..6db76b46 100755 --- a/main.asm +++ b/main.asm @@ -4508,21 +4508,23 @@ InitializeEmptyList: ret -IsItemInBag_: ; f8a5 (3:78a5) +GetQuantityOfItemInBag: ; f8a5 (3:78a5) +; In: b = item ID +; Out: b = how many of that item are in the bag call GetPredefRegisters ld hl, wNumBagItems -.asm_f8ab +.loop inc hl ld a, [hli] cp $ff - jr z, .asm_f8b7 + jr z, .notInBag cp b - jr nz, .asm_f8ab + jr nz, .loop ld a, [hl] ld b, a ret -.asm_f8b7 - ld b, $0 +.notInBag + ld b, 0 ret FindPathToPlayer: ; f8ba (3:78ba) diff --git a/scripts/celadonmartelevator.asm b/scripts/celadonmartelevator.asm index 9295d8e6..6d901613 100755 --- a/scripts/celadonmartelevator.asm +++ b/scripts/celadonmartelevator.asm @@ -35,7 +35,7 @@ CeladonMartElevatorScript_48631: ; 48631 (12:4631) ld hl, CeladonMartElavatorFloors call LoadItemList ld hl, CeldaonMartElevatorWarpMaps - ld de, wcc5b + ld de, wElevatorWarpMaps ld bc, CeldaonMartElevatorWarpMapsEnd - CeldaonMartElevatorWarpMaps jp CopyData diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 4a90535a..439ab62e 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -1,34 +1,35 @@ CeladonMartRoofScript: ; 483d5 (12:43d5) jp EnableAutoTextBoxDrawing -CeladonMartRoofScript_483d8: ; 483d8 (12:43d8) +CeladonMartRoofScript_GetDrinksInBag: ; 483d8 (12:43d8) +; construct a list of all drinks in the player's bag xor a - ld [wcd37], a - ld de, wcc5b + ld [wFilteredBagItemsCount], a + ld de, wFilteredBagItems ld hl, CeladonMartRoofDrinkList -.asm_483e2 +.loop ld a, [hli] and a - jr z, .asm_48404 + jr z, .done push hl push de ld [wd11e], a ld b, a - predef IsItemInBag_ + predef GetQuantityOfItemInBag pop de pop hl ld a, b and a - jr z, .asm_483e2 + jr z, .loop ; if the item isn't in the bag ld a, [wd11e] ld [de], a inc de push hl - ld hl, wcd37 + ld hl, wFilteredBagItemsCount inc [hl] pop hl - jr .asm_483e2 -.asm_48404 + jr .loop +.done ld a, $ff ld [de], a ret @@ -39,7 +40,7 @@ CeladonMartRoofDrinkList: ; 48408 (12:4408) db LEMONADE db $00 -CeladonMartRoofScript_4840c: ; 4840c (12:440c) +CeladonMartRoofScript_GiveDrinkToGirl: ; 4840c (12:440c) ld hl, wd730 set 6, [hl] ld hl, CeladonMartRoofText_484ee @@ -48,83 +49,84 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c) ld [wCurrentMenuItem], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a - ld a, [wcd37] + ld a, [wFilteredBagItemsCount] dec a ld [wMaxMenuItem], a - ld a, $2 + ld a, 2 ld [wTopMenuItemY], a - ld a, $1 + ld a, 1 ld [wTopMenuItemX], a - ld a, [wcd37] + ld a, [wFilteredBagItemsCount] dec a - ld bc, $2 - ld hl, $3 + ld bc, 2 + ld hl, 3 call AddNTimes dec l ld b, l - ld c, $c + ld c, 12 coord hl, 0, 0 call TextBoxBorder call UpdateSprites - call CeladonMartRoofScript_48532 + call CeladonMartRoofScript_PrintDrinksInBag ld hl, wd730 res 6, [hl] call HandleMenuInput bit 1, a ; pressed b ret nz - ld hl, wcc5b + ld hl, wFilteredBagItems ld a, [wCurrentMenuItem] - ld d, $0 + ld d, 0 ld e, a add hl, de ld a, [hl] - ld [$ffdb], a + ld [hItemToRemoveID], a cp FRESH_WATER - jr z, .asm_484b6 + jr z, .gaveFreshWater cp SODA_POP - jr z, .asm_48492 + jr z, .gaveSodaPop +; gave Lemonade CheckEvent EVENT_GOT_TM49 - jr nz, .asm_484e0 + jr nz, .alreadyGaveDrink ld hl, CeladonMartRoofText_48515 call PrintText call RemoveItemByIDBank12 lb bc, TM_49, 1 call GiveItem - jr nc, .BagFull + jr nc, .bagFull ld hl, ReceivedTM49Text call PrintText SetEvent EVENT_GOT_TM49 ret -.asm_48492 +.gaveSodaPop CheckEvent EVENT_GOT_TM48 - jr nz, .asm_484e0 + jr nz, .alreadyGaveDrink ld hl, CeladonMartRoofText_48504 call PrintText call RemoveItemByIDBank12 lb bc, TM_48, 1 call GiveItem - jr nc, .BagFull + jr nc, .bagFull ld hl, CeladonMartRoofText_4850a call PrintText SetEvent EVENT_GOT_TM48 ret -.asm_484b6 +.gaveFreshWater CheckEvent EVENT_GOT_TM13 - jr nz, .asm_484e0 + jr nz, .alreadyGaveDrink ld hl, CeladonMartRoofText_484f3 call PrintText call RemoveItemByIDBank12 lb bc, TM_13, 1 call GiveItem - jr nc, .BagFull + jr nc, .bagFull ld hl, CeladonMartRoofText_484f9 call PrintText SetEvent EVENT_GOT_TM13 ret -.BagFull +.bagFull ld hl, CeladonMartRoofText_48526 jp PrintText -.asm_484e0 +.alreadyGaveDrink ld hl, CeladonMartRoofText_4852c jp PrintText @@ -181,11 +183,11 @@ CeladonMartRoofText_4852c: ; 4852c (12:452c) db $0d db "@" -CeladonMartRoofScript_48532: ; 48532 (12:4532) - ld hl, wcc5b +CeladonMartRoofScript_PrintDrinksInBag: ; 48532 (12:4532) + ld hl, wFilteredBagItems xor a - ld [$ffdb], a -.asm_48538 + ld [hItemCounter], a +.loop ld a, [hli] cp $ff ret z @@ -193,15 +195,15 @@ CeladonMartRoofScript_48532: ; 48532 (12:4532) ld [wd11e], a call GetItemName coord hl, 2, 2 - ld a, [$ffdb] + ld a, [hItemCounter] ld bc, SCREEN_WIDTH * 2 call AddNTimes ld de, wcd6d call PlaceString - ld hl, $ffdb + ld hl, hItemCounter inc [hl] pop hl - jr .asm_48538 + jr .loop CeladonMartRoofTextPointers: ; 4855b (12:455b) dw CeladonMartRoofText1 @@ -217,24 +219,24 @@ CeladonMartRoofText1: ; 48567 (12:4567) CeladonMartRoofText2: ; 4856c (12:456c) TX_ASM - call CeladonMartRoofScript_483d8 - ld a, [wcd37] + call CeladonMartRoofScript_GetDrinksInBag + ld a, [wFilteredBagItemsCount] and a - jr z, .asm_4858f - ld a, $1 + jr z, .noDrinksInBag + ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, CeladonMartRoofText4 call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_48595 - call CeladonMartRoofScript_4840c - jr .asm_48595 -.asm_4858f + jr nz, .done + call CeladonMartRoofScript_GiveDrinkToGirl + jr .done +.noDrinksInBag ld hl, CeladonMartRoofText3 call PrintText -.asm_48595 +.done jp TextScriptEnd CeladonMartRoofText3: ; 48598 (12:4598) diff --git a/scripts/ceruleanhousetrashed.asm b/scripts/ceruleanhousetrashed.asm index e0a194fe..a1f58684 100755 --- a/scripts/ceruleanhousetrashed.asm +++ b/scripts/ceruleanhousetrashed.asm @@ -10,7 +10,7 @@ CeruleanHouseTrashedTextPointers: ; 1d689 (7:5689) CeruleanHouseTrashedText1: ; 1d68f (7:568f) TX_ASM ld b, $e4 - predef IsItemInBag_ + predef GetQuantityOfItemInBag and b jr z, .asm_f8734 ld hl, CeruleanHouseTrashedText_1d6b0 diff --git a/scripts/lab4.asm b/scripts/lab4.asm index f2c4d8d7..dab07824 100755 --- a/scripts/lab4.asm +++ b/scripts/lab4.asm @@ -5,12 +5,11 @@ Lab4TextPointers: ; 75d34 (1d:5d34) dw Lab4Text1 dw Lab4Text2 -Lab4Script_75d38: ; 75d38 (1d:5d38) +Lab4Script_GetFossilsInBag: ; 75d38 (1d:5d38) ; construct a list of all fossils in the player's bag - xor a - ld [wcd37], a - ld de, wcc5b + ld [wFilteredBagItemsCount], a + ld de, wFilteredBagItems ld hl, FossilsList .loop ld a, [hli] @@ -20,7 +19,7 @@ Lab4Script_75d38: ; 75d38 (1d:5d38) push de ld [wd11e], a ld b, a - predef IsItemInBag_ + predef GetQuantityOfItemInBag pop de pop hl ld a, b @@ -32,7 +31,7 @@ Lab4Script_75d38: ; 75d38 (1d:5d38) ld [de], a inc de push hl - ld hl, wcd37 + ld hl, wFilteredBagItemsCount inc [hl] pop hl jr .loop @@ -53,8 +52,8 @@ Lab4Text1: ; 75d6c (1d:5d6c) jr nz, .asm_75d96 ld hl, Lab4Text_75dc6 call PrintText - call Lab4Script_75d38 - ld a, [wcd37] + call Lab4Script_GetFossilsInBag + ld a, [wFilteredBagItemsCount] and a jr z, .asm_75d8d callba GiveFossilToCinnabarLab diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 9d3cd7b1..c5ca2e6e 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -449,13 +449,13 @@ OaksLabScript13: ; 1ce32 (7:4e32) ld a, [W_XCOORD] cp $4 ; move left or right depending on where the player is standing - jr nz, .asm_1ce5b - ld a, $c0 - jr .asm_1ce5d -.asm_1ce5b - ld a, $80 -.asm_1ce5d - ld [wcc5b], a + jr nz, .moveLeft + ld a, NPC_MOVEMENT_RIGHT + jr .next +.moveLeft + ld a, NPC_MOVEMENT_LEFT +.next + ld [wNPCMovementDirections], a ld a, $e ld [W_OAKSLABCURSCRIPT], a @@ -855,7 +855,7 @@ OaksLabScript_1d157: ; 1d157 (7:5157) ld [hl], SPRITE_FACING_RIGHT ld hl, wd730 set 6, [hl] - predef StarterDex ; StarterDex + predef StarterDex ld hl, wd730 res 6, [hl] call ReloadMapData diff --git a/scripts/rockethideoutelevator.asm b/scripts/rockethideoutelevator.asm index 21a543e9..8a0ca049 100755 --- a/scripts/rockethideoutelevator.asm +++ b/scripts/rockethideoutelevator.asm @@ -35,7 +35,7 @@ RocketHideoutElevatorScript_45741: ; 45741 (11:5741) ld hl, RocketHideoutElavatorFloors call LoadItemList ld hl, RocketHideoutElevatorWarpMaps - ld de, wcc5b + ld de, wElevatorWarpMaps ld bc, RocketHideoutElevatorWarpMapsEnd - RocketHideoutElevatorWarpMaps call CopyData ret diff --git a/scripts/route11gateupstairs.asm b/scripts/route11gateupstairs.asm index a1906c5d..05ea2a95 100755 --- a/scripts/route11gateupstairs.asm +++ b/scripts/route11gateupstairs.asm @@ -22,12 +22,12 @@ Route11GateUpstairsText2: ; 4946c (12:546c) ld a, 30 ; pokemon needed ld [hOaksAideRequirement], a ld a, ITEMFINDER ; oak's aide reward - ld [hOaksAideItemReward], a + ld [hOaksAideRewardItem], a ld [wd11e], a call GetItemName ld h, d ld l, e - ld de, wcc5b + ld de, wOaksAideRewardItemName ld bc, $000d call CopyData predef OaksAideScript diff --git a/scripts/route15gateupstairs.asm b/scripts/route15gateupstairs.asm index 0fc806da..5cfb8903 100755 --- a/scripts/route15gateupstairs.asm +++ b/scripts/route15gateupstairs.asm @@ -12,11 +12,11 @@ Route15GateUpstairsText1: ; 49651 (12:5651) ld a, 50 ; pokemon needed ld [hOaksAideRequirement], a ld a, EXP__ALL ; oak's aide reward - ld [hOaksAideItemReward], a + ld [hOaksAideRewardItem], a ld [wd11e], a call GetItemName ld hl, wcd6d - ld de, wcc5b + ld de, wOaksAideRewardItemName ld bc, $000d call CopyData predef OaksAideScript diff --git a/scripts/route2gate.asm b/scripts/route2gate.asm index 65d53bc7..1bd82c04 100755 --- a/scripts/route2gate.asm +++ b/scripts/route2gate.asm @@ -12,11 +12,11 @@ Route2GateText1: ; 5d5db (17:55db) ld a, 10 ; pokemon needed ld [hOaksAideRequirement], a ld a, HM_05 ; oak's aide reward - ld [hOaksAideItemReward], a + ld [hOaksAideRewardItem], a ld [wd11e], a call GetItemName ld hl, wcd6d - ld de, wcc5b + ld de, wOaksAideRewardItemName ld bc, $000d call CopyData predef OaksAideScript diff --git a/scripts/silphcoelevator.asm b/scripts/silphcoelevator.asm index 3e36214e..d080cfef 100755 --- a/scripts/silphcoelevator.asm +++ b/scripts/silphcoelevator.asm @@ -35,7 +35,7 @@ SilphCoElevatorScript_457f1: ; 457f1 (11:57f1) ld hl, SilphCoElavatorFloors call LoadItemList ld hl, SilphCoElevatorWarpMaps - ld de, wcc5b + ld de, wElevatorWarpMaps ld bc, SilphCoElevatorWarpMapsEnd - SilphCoElevatorWarpMaps call CopyData ret diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index de721a2f..a203323f 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -53,7 +53,7 @@ VermilionCityScript0: ; 197e6 (6:57e6) CheckEvent EVENT_SS_ANNE_LEFT jr nz, .asm_19810 ld b, S_S__TICKET - predef IsItemInBag_ + predef GetQuantityOfItemInBag ld a, b and a ret nz @@ -171,7 +171,7 @@ VermilionCityText3: ; 198b1 (6:58b1) ld hl, SSAnneWelcomeText9 call PrintText ld b, S_S__TICKET - predef IsItemInBag_ + predef GetQuantityOfItemInBag ld a, b and a jr nz, .asm_198e9 diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index 62323fd8..d3c7e31a 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -106,7 +106,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b) xor a ld [rWY], a ld [hWY], a - call VermilionDock_1dc94 + call VermilionDock_EraseSSAnne ld a, $90 ld [hWY], a ld a, $1 @@ -178,21 +178,29 @@ VermilionDock_1dc7c: ; 1dc7c (7:5c7c) jr z, .asm_1dc8e ret -VermilionDock_1dc94: ; 1dc94 (7:5c94) - ld hl, wcc5b - ld bc, SCREEN_WIDTH * 9 - ld a, $14 +VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94) +; Fill the area the S.S. Anne occupies in BG map 0 with water tiles. + ld hl, wVermilionDockTileMapBuffer + ld bc, (5 * 32) + SCREEN_WIDTH + ld a, $14 ; water tile call FillMemory ld hl, vBGMap0 + 10 * 32 - ld de, wcc5b - ld bc, $000c + ld de, wVermilionDockTileMapBuffer + ld bc, (6 * 32) / 16 call CopyVideoData - ld hl, wOverworldMap + 10 + 7 * VERMILION_DOCK_WIDTH ; 10, 7 - ld a, $d + +; Replace the blocks of the lower half of the ship with water blocks. This +; leaves the upper half alone, but that doesn't matter because replacing any of +; the blocks is unnecessary because the blocks the ship occupies are south of +; the player and won't be redrawn when the player automatically walks north and +; exits the map. This code could be removed without affecting anything. + ld hl, wOverworldMap + (5 + 3) + (2 + 3) * (VERMILION_DOCK_WIDTH + 6) ; (5, 2) + ld a, $d ; water block ld [hli], a ld [hli], a ld [hli], a ld [hl], a + ld a, SFX_SS_ANNE_HORN call PlaySound ld c, 120 diff --git a/text.asm b/text.asm index 8b0482f3..9bbbb819 100644 --- a/text.asm +++ b/text.asm @@ -100,7 +100,7 @@ _OaksAideHiText:: ; 80143 (20:4143) cont "I'm supposed to" cont "give you an" cont "@" - TX_RAM wcc5b + TX_RAM wOaksAideRewardItemName text "!" para "So, ", $52, "! Have" @@ -124,7 +124,7 @@ _OaksAideUhOhText:: ; 801e4 (20:41e4) text " kinds" line "if you want the" cont "@" - TX_RAM wcc5b + TX_RAM wOaksAideRewardItemName text "." done @@ -136,7 +136,7 @@ _OaksAideComeBackText:: ; 80250 (20:4250) db $0 line "kinds, come back" cont "for @" - TX_RAM wcc5b + TX_RAM wOaksAideRewardItemName text "." done @@ -154,7 +154,7 @@ _OaksAideHereYouGoText:: ; 8028c (20:428c) _OaksAideGotItemText:: ; 802d9 (20:42d9) text $52, " got the" line "@" - TX_RAM wcc5b + TX_RAM wOaksAideRewardItemName text "!@@" _OaksAideNoRoomText:: ; 802ec (20:42ec) @@ -162,7 +162,7 @@ _OaksAideNoRoomText:: ; 802ec (20:42ec) line "don't have any" cont "room for the" cont "@" - TX_RAM wcc5b + TX_RAM wOaksAideRewardItemName text "." done @@ -363,10 +363,10 @@ _YeahText:: ; 88236 (22:4236) _DexSeenOwnedText:: ; 8823e (22:423e) text "#DEX Seen:@" - TX_NUM wcc5b, 1, 3 + TX_NUM wDexRatingNumMonsSeen, 1, 3 db $0 line " Owned:@" - TX_NUM wcc5c, 1, 3 + TX_NUM wDexRatingNumMonsOwned, 1, 3 db "@" _DexRatingText:: ; 88267 (22:4267) @@ -1467,7 +1467,7 @@ _BoostedText:: ; 89be1 (22:5be1) text "a boosted" cont "@@" _ExpPointsText:: ; 89bee (22:5bee) - TX_NUM wcf4b, 2, 4 + TX_NUM wExpAmountGained, 2, 4 text " EXP. Points!" prompt diff --git a/wram.asm b/wram.asm index 67cdd5fa..e529049e 100755 --- a/wram.asm +++ b/wram.asm @@ -477,6 +477,26 @@ wNPCMovementScriptBank:: ; cc58 ds 2 +wUnusedCC5B:: ; cc5b + +wVermilionDockTileMapBuffer:: ; cc5b +; 180 bytes + +wOaksAideRewardItemName:: ; cc5b + +wDexRatingNumMonsSeen:: ; cc5b + +wFilteredBagItems:: ; cc5b +; List of bag items that has been filtered to a certain type of items, +; such as drinks or fossils. + +wElevatorWarpMaps:: ; cc5b + +wMonPartySpritesSavedOAM:: ; cc5b +; Saved copy of OAM for the first frame of the animation to make it easy to +; flip back from the second frame. +; $60 bytes + wTrainerCardBlkPacket:: ; cc5b ; $40 bytes @@ -493,10 +513,13 @@ wAnimationType:: ; cc5b ; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... wNPCMovementDirections:: ; cc5b + ds 1 -wcc5b:: ds 1 ; these upcoming values below are miscellaneous storage values -wcc5c:: ds 1 ; used in pokedex evaluation as well -wcc5d:: ds 1 ; used in pokedex evaluation +wDexRatingNumMonsOwned:: ; cc5c + ds 1 + +wDexRatingText:: ; cc5d + ds 1 wSlotMachineSavedROMBank:: ; cc5e ; ROM back to return to when the player is done with the slot machine @@ -723,7 +746,11 @@ wInGameTradeReceiveMonSpecies:: wNPCMovementDirections2Index:: ; cd37 -wcd37:: ds 1 ; used in list menus, like the fossil lab menu or drink girl menu. Also used in link menu. +wUnusedCD37:: ; cd37 + +wFilteredBagItemsCount:: ; cd37 +; number of items in wFilteredBagItems list + ds 1 wSimulatedJoypadStatesIndex:: ; cd38 ; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1 @@ -1320,10 +1347,15 @@ wPartyMenuBlkPacket:: ; cf2e ; $30 bytes ds 29 -wcf4b:: ds 1 ; storage buffer for various strings -wcf4c:: ds 1 ; used with displaying EXP value, probably also overflowed with wcf4b +wExpAmountGained:: ; cf4b +; 2-byte big-endian number +; the total amount of exp a mon gained + +wcf4b:: ds 2 ; storage buffer for various strings + wGainBoostedExp:: ; cf4d ds 1 + ds 17 wGymCityName:: ; cf5f -- cgit v1.3.1-sl0p