From 132d0367522b7acce602b146ca69bfad87ef96c6 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 12 Aug 2015 22:14:31 -0700 Subject: [PATCH] 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(-) 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