From f3326786259f4e53c06b7565369add7605bea8ba Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:17:31 +0100 Subject: Use more hardware and graphics constants (#532) - Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc. - `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS` and `TILE_1BPP_SIZE` are used in some places. - Highlight an oversight in `OakSpeech` where several direct MBC bank switches are requested. - Remove redundant comments in home/overworld.asm. - Add unreferenced `FillBgMap` function to avoid a byte of dead code. - Some constants added in wram.asm. - Correctly separate the commented code in `SaveMainData`. --- engine/movie/credits.asm | 4 ++-- engine/movie/intro.asm | 4 ++-- engine/movie/oak_speech/oak_speech.asm | 11 ++++++++++- engine/movie/splash.asm | 8 ++++---- engine/movie/title.asm | 5 +++-- engine/movie/trade.asm | 4 ++-- 6 files changed, 23 insertions(+), 13 deletions(-) (limited to 'engine/movie') diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 1a68a7b5..b1ca7c91 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -11,7 +11,7 @@ HallOfFamePC: ld bc, ($20 tiles) / 2 call ZeroMemory ld hl, vChars2 tile $7e - ld bc, 1 tiles + ld bc, TILE_SIZE ld a, $ff ; solid black call FillMemory hlcoord 0, 0 @@ -246,7 +246,7 @@ Credits: pop de ld de, TheEndGfx ld hl, vChars2 tile $60 - lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10 + lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / TILE_SIZE call CopyVideoData hlcoord 4, 8 ld de, TheEndTextString diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 00316018..2fa442f9 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -439,12 +439,12 @@ IntroNidorinoAnimation7: GameFreakIntro: INCBIN "gfx/splash/gamefreak_presents.2bpp" INCBIN "gfx/splash/gamefreak_logo.2bpp" - ds 16, $00 ; blank tile + ds TILE_SIZE, $00 ; blank tile GameFreakIntroEnd: FightIntroBackMon: INCBIN "gfx/intro/gengar.2bpp" - ds 16, $00 ; blank tile + ds TILE_SIZE, $00 ; blank tile FightIntroBackMonEnd: IF DEF(_RED) diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 02826b98..a5f13def 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -117,6 +117,9 @@ OakSpeech: ld a, SFX_SHRINK call PlaySound pop af +; bug: switching ROM Bank should not happen outside of Home Bank +; This code does nothing, as PlaySound does all necessary Bank switch +; It looks like a leftover from an early development stage ldh [hLoadedROMBank], a ld [rROMB], a ld c, 4 @@ -145,6 +148,7 @@ OakSpeech: ld [wNewSoundID], a call PlaySound pop af +; bug: switching ROM Bank should not happen outside of Home Bank ldh [hLoadedROMBank], a ld [rROMB], a ld c, 20 @@ -160,21 +164,26 @@ OakSpeech: call DelayFrames call GBFadeOutToWhite jp ClearScreen + OakSpeechText1: text_far _OakSpeechText1 text_end + OakSpeechText2: text_far _OakSpeechText2A ; BUG: The cry played does not match the sprite displayed. sound_cry_nidorina text_far _OakSpeechText2B text_end + IntroducePlayerText: text_far _IntroducePlayerText text_end + IntroduceRivalText: text_far _IntroduceRivalText text_end + OakSpeechText3: text_far _OakSpeechText3 text_end @@ -226,7 +235,7 @@ IntroDisplayPicCenteredOrUpperRight: call UncompressSpriteFromDE ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 - ld bc, $310 + ld bc, 2 * SPRITEBUFFERSIZE call CopyData ld de, vFrontPic call InterlaceMergeSpriteBuffers diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index da3fec0d..7f06c68b 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -13,7 +13,7 @@ LoadShootingStarGraphics: call CopyVideoData ld de, FallingStar ld hl, vChars1 tile $22 - lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10 + lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / TILE_SIZE call CopyVideoData ld hl, GameFreakLogoOAMData ld de, wShadowOAMSprite24 @@ -60,11 +60,11 @@ AnimateShootingStar: jr nz, .bigStarLoop ; Clear big star OAM. - ld hl, wShadowOAM + ld hl, wShadowOAMSprite00YCoord ld c, 4 - ld de, 4 + ld de, OBJ_SIZE .clearOAMLoop - ld [hl], 160 + ld [hl], SCREEN_HEIGHT_PX + OAM_Y_OFS add hl, de dec c jr nz, .clearOAMLoop diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 698dd5e0..c9ea4b47 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -104,7 +104,7 @@ DisplayTitleScreen: ; place tiles for title screen copyright hlcoord 2, 17 ld de, .tileScreenCopyrightTiles - ld b, $10 + ld b, .tileScreenCopyrightTilesEnd - .tileScreenCopyrightTiles .tileScreenCopyrightTilesLoop ld a, [de] ld [hli], a @@ -116,6 +116,7 @@ DisplayTitleScreen: .tileScreenCopyrightTiles db $41,$42,$43,$42,$44,$42,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E ; ©'95.'96.'98 GAME FREAK inc. +.tileScreenCopyrightTilesEnd .next call SaveScreenTilesToBuffer2 @@ -380,7 +381,7 @@ LoadCopyrightAndTextBoxTiles: LoadCopyrightTiles: ld de, NintendoCopyrightLogoGraphics ld hl, vChars2 tile $60 - lb bc, BANK(NintendoCopyrightLogoGraphics), (GameFreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10 + lb bc, BANK(NintendoCopyrightLogoGraphics), (GameFreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / TILE_SIZE call CopyVideoData hlcoord 2, 7 ld de, CopyrightTextString diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index bf77f21e..292f47cd 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -316,7 +316,7 @@ Trade_AnimateBallEnteringLinkCable: ld [wLinkCableAnimBulgeToggle], a add $7e ld hl, wShadowOAMSprite00TileID - ld de, 4 + ld de, OBJ_SIZE ld c, e .cycleLinkCableBulgeTile ld [hl], a @@ -602,7 +602,7 @@ Trade_AnimCircledMon: xor $3c ; make link cable flash ldh [rBGP], a ld hl, wShadowOAMSprite00TileID - ld de, $4 + ld de, OBJ_SIZE ld c, $14 .loop ld a, [hl] -- cgit v1.3.1-sl0p From e92d1af478c8381fde30f709c2619abe90104d3a Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:53:29 -0500 Subject: Avoid magic numbers for most `CopyData` calls (#542) --- constants/gfx_constants.asm | 6 +++++- constants/text_constants.asm | 1 + engine/battle/animations.asm | 20 ++++++++++---------- engine/battle/core.asm | 21 +++++++++++---------- engine/battle/draw_hud_pokeball_gfx.asm | 8 ++++---- engine/battle/effects.asm | 2 +- engine/battle/ghost_marowak_anim.asm | 2 +- engine/battle/move_effects/transform.asm | 9 +++++---- engine/battle/trainer_ai.asm | 4 ++-- engine/events/in_game_trades.asm | 2 +- engine/items/item_effects.asm | 6 +++--- engine/items/town_map.asm | 4 ++-- engine/movie/evolution.asm | 2 +- engine/movie/hall_of_fame.asm | 2 +- engine/movie/splash.asm | 2 +- engine/overworld/cut2.asm | 6 +++--- engine/overworld/player_animations.asm | 6 +++--- engine/pokemon/add_mon.asm | 2 +- engine/slots/slot_machine.asm | 2 +- home/trainers.asm | 2 +- ram/vram.asm | 6 +++--- ram/wram.asm | 10 +++++++--- 22 files changed, 68 insertions(+), 57 deletions(-) (limited to 'engine/movie') diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 1a06238c..c3f29ca5 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -7,7 +7,11 @@ DEF SCREEN_BLOCK_HEIGHT EQU 5 ; blocks DEF SURROUNDING_WIDTH EQU SCREEN_BLOCK_WIDTH * BLOCK_WIDTH ; tiles DEF SURROUNDING_HEIGHT EQU SCREEN_BLOCK_HEIGHT * BLOCK_HEIGHT ; tiles -DEF SPRITEBUFFERSIZE EQU 7 * 7 * TILE_1BPP_SIZE +DEF PIC_WIDTH EQU 7 ; tiles +DEF PIC_HEIGHT EQU PIC_WIDTH ; tiles +DEF PIC_SIZE EQU PIC_WIDTH * PIC_HEIGHT ; tiles + +DEF SPRITEBUFFERSIZE EQU PIC_WIDTH * PIC_HEIGHT * TILE_1BPP_SIZE ; HP bar DEF HP_BAR_GREEN EQU 0 diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 4dbdf666..ed195172 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,6 +1,7 @@ DEF NAME_LENGTH EQU 11 DEF ITEM_NAME_LENGTH EQU 13 DEF NAME_BUFFER_LENGTH EQU 20 +DEF GYM_CITY_LENGTH EQU 17 ; PrintNumber, PrintBCDNumber const_def 5 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 711ebda4..f66be640 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1213,12 +1213,12 @@ _AnimationSlideMonUp: push bc ; In each iteration, slide up all rows but the top one (which is overwritten). - ld b, 6 + ld b, PIC_HEIGHT - 1 .slideLoop push bc push de push hl - ld bc, 7 + ld bc, PIC_WIDTH call CopyData ; Note that de and hl are popped in the same order they are pushed, swapping ; their values. When CopyData is called, hl points to a tile 1 row below @@ -1242,10 +1242,10 @@ _AnimationSlideMonUp: ld a, [wSlideMonUpBottomRowLeftTile] inc a ld [wSlideMonUpBottomRowLeftTile], a - ld c, 7 + ld c, PIC_WIDTH .fillBottomRowLoop ld [hli], a - add 7 + add PIC_WIDTH dec c jr nz, .fillBottomRowLoop @@ -1723,10 +1723,10 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, (7 * 7) tiles + ld bc, PIC_SIZE tiles call FillMemory pop hl - ld de, (7 * 3 + 4) tiles + TILE_SIZE / 4 + ld de, (PIC_WIDTH * 3 + 4) tiles + TILE_SIZE / 4 add hl, de ld de, MinimizedMonSprite ld c, MinimizedMonSpriteEnd - MinimizedMonSprite @@ -1774,7 +1774,7 @@ AnimationSlideMonDownAndHide: jr nz, .loop call AnimationHideMonPic ld hl, wTempPic - ld bc, 7 * 7 tiles + ld bc, PIC_SIZE tiles xor a call FillMemory jp CopyTempPicToMonPic @@ -1867,7 +1867,7 @@ CopyTempPicToMonPic: ld hl, vFrontPic ; enemy turn .next ld de, wTempPic - ld bc, 7 * 7 + ld bc, PIC_SIZE jp CopyVideoData AnimationWavyScreen: @@ -1935,7 +1935,7 @@ AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a - ld bc, 7 * 7 tiles + ld bc, PIC_SIZE tiles call FillMemory ldh a, [hWhoseTurn] and a @@ -2473,7 +2473,7 @@ AnimationShakeEnemyHUD: ; Make a copy of the back pic's tile patterns in sprite tile pattern VRAM. ld de, vBackPic ld hl, vSprites - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData xor a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 672bd416..4c25373a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1183,17 +1183,17 @@ SlideDownFaintedMonPic: push af set BIT_NO_TEXT_DELAY, a ld [wStatusFlags5], a - ld b, 7 ; number of times to slide + ld b, PIC_HEIGHT ; number of times to slide .slideStepLoop ; each iteration, the mon is slid down one row push bc push de push hl - ld b, 6 ; number of rows + ld b, PIC_HEIGHT - 1 ; number of rows .rowLoop push bc push hl push de - ld bc, $7 + ld bc, PIC_WIDTH call CopyData pop de pop hl @@ -1225,7 +1225,8 @@ SlideDownFaintedMonPic: ret SevenSpacesText: - db " @" + ds PIC_WIDTH, ' ' + db "@" ; slides the player or enemy trainer off screen ; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer) @@ -1237,7 +1238,7 @@ SlideTrainerPicOffScreen: .slideStepLoop ; each iteration, the trainer pic is slid one tile left/right push bc push hl - ld b, 7 ; number of rows + ld b, PIC_HEIGHT ; number of rows .rowLoop push hl ldh a, [hSlideAmount] @@ -1794,7 +1795,7 @@ AnimateRetreatingPlayerMon: lb bc, 7, 7 jp ClearScreenArea -; Copies player's current pokemon's current HP and status into the party +; Copies player's current pokemon's current HP, party pos, and status into the party ; struct data so it stays after battle or switching ReadPlayerMonCurHPAndStatus: ld a, [wPlayerMonNumber] @@ -1804,7 +1805,7 @@ ReadPlayerMonCurHPAndStatus: ld d, h ld e, l ld hl, wBattleMonHP - ld bc, $4 ; 2 bytes HP, 1 byte unknown (unused?), 1 byte status + ld bc, MON_STATUS + 1 - MON_HP ; also copies party pos in-between HP and status jp CopyData DrawHUDsAndHPBars: @@ -6352,7 +6353,7 @@ LoadPlayerBackPic: ld [hl], d ; OAM Y inc hl ld [hl], e ; OAM X - ld a, $8 ; height of tile + ld a, TILE_HEIGHT add d ; increase Y by height of tile ld d, a inc hl @@ -6366,7 +6367,7 @@ LoadPlayerBackPic: ldh a, [hOAMTile] add $4 ; increase tile number by 4 ldh [hOAMTile], a - ld a, $8 ; width of tile + ld a, TILE_WIDTH add e ; increase X by width of tile ld e, a dec b @@ -6381,7 +6382,7 @@ LoadPlayerBackPic: ld de, sSpriteBuffer1 ldh a, [hLoadedROMBank] ld b, a - ld c, 7 * 7 + ld c, PIC_SIZE call CopyVideoData xor a ld [rRAMG], a diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 983e7cdf..011b4b33 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -119,7 +119,7 @@ WritePokeballOAMData: PlacePlayerHUDTiles: ld hl, PlayerBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles - ld bc, $3 + ld bc, wHUDGraphicsTilesEnd - wHUDGraphicsTiles call CopyData hlcoord 18, 10 ld de, -1 @@ -134,7 +134,7 @@ PlayerBattleHUDGraphicsTiles: PlaceEnemyHUDTiles: ld hl, EnemyBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles - ld bc, $3 + ld bc, wHUDGraphicsTilesEnd - wHUDGraphicsTiles call CopyData hlcoord 1, 2 ld de, $1 @@ -150,7 +150,7 @@ PlaceHUDTiles: ld [hl], $73 ld bc, SCREEN_WIDTH add hl, bc - ld a, [wHUDGraphicsTiles + 1] ; leftmost tile + ld a, [wHUDCornerTile] ; leftmost tile ld [hl], a ld a, 8 .loop @@ -159,7 +159,7 @@ PlaceHUDTiles: dec a jr nz, .loop add hl, de - ld a, [wHUDGraphicsTiles + 2] ; rightmost tile + ld a, [wHUDTriangleTile] ; rightmost tile ld [hl], a ret diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index e107853c..003592aa 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -754,7 +754,7 @@ PrintStatText: jr .findStatName_inner .foundStatName ld de, wStringBuffer - ld bc, $a + ld bc, NAME_LENGTH - 1 ; all StatModTextStrings are at most 10 bytes jp CopyData INCLUDE "data/battle/stat_mod_names.asm" diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 4b1eb452..1040f85f 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -52,7 +52,7 @@ MarowakAnim: CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData ld a, $10 ld [wBaseCoordY], a diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 6f2e705c..343fa3ca 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -82,14 +82,15 @@ TransformEffect_: ld a, [hli] ld [de], a inc de -; Attack, Defense, Speed, and Special stats +; Skip level and max HP inc hl inc hl inc hl inc de inc de inc de - ld bc, $8 +; Attack, Defense, Speed, and Special stats + ld bc, (NUM_STATS - 1) * 2 call CopyData ld bc, wBattleMonMoves - wBattleMonPP add hl, bc ; ld hl, wBattleMonMoves @@ -99,7 +100,7 @@ TransformEffect_: ld a, [hli] and a jr z, .lessThanFourMoves - ld a, $5 + ld a, 5 ld [de], a inc de dec b @@ -136,7 +137,7 @@ TransformEffect_: ld l, e pop de .gotStatsOrModsToCopy - ld bc, $8 + ld bc, (NUM_STATS - 1) * 2 jp CopyData .failed diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 4134047f..546dd60e 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -583,7 +583,7 @@ AISwitchIfEnoughMons: SwitchEnemyMon: -; prepare to withdraw the active monster: copy hp, number, and status to roster +; prepare to withdraw the active monster: copy HP, party pos, and status to roster ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1HP @@ -592,7 +592,7 @@ SwitchEnemyMon: ld d, h ld e, l ld hl, wEnemyMonHP - ld bc, 4 + ld bc, MON_STATUS + 1 - MON_HP ; also copies party pos in-between HP and status call CopyData ld hl, AIBattleWithdrawText diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 4c6041b0..5cc251f4 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -226,7 +226,7 @@ InGameTrade_CopyDataToReceivedMon: ld bc, wPartyMon2 - wPartyMon1 call InGameTrade_GetReceivedMonPointer ld hl, wTradedEnemyMonOTID - ld bc, $2 + ld bc, 2 jp CopyData ; the received mon's index is (partyCount - 1), diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1b68e47a..7fffae59 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1302,13 +1302,13 @@ ItemUseMedicine: .statNameInnerLoop ld a, [hli] ld b, a - ld a, $50 + ld a, '@' cp b jr nz, .statNameInnerLoop jr .statNameLoop .gotStatName ld de, wStringBuffer - ld bc, 10 + ld bc, NAME_LENGTH - 1 ; all VitaminStats are at most 10 bytes call CopyData ; copy the stat's name to wStringBuffer ld a, SFX_HEAL_AILMENT call PlaySound @@ -2029,7 +2029,7 @@ ItemUsePPRestore: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld de, wBattleMonPP - ld bc, 4 + ld bc, NUM_MOVES call CopyData ; copy party data to in-battle data .skipUpdatingInBattleData ld a, SFX_HEAL_AILMENT diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 573ba581..35acaa29 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -20,7 +20,7 @@ DisplayTownMap: call PlaceString ld hl, wShadowOAMSprite00 ld de, wShadowOAMBackupSprite00 - ld bc, 4 * 4 + ld bc, OBJ_SIZE * 4 call CopyData ld hl, vSprites tile BIRD_BASE_TILE ld de, TownMapCursor @@ -64,7 +64,7 @@ DisplayTownMap: call PlaceString ld hl, wShadowOAMSprite04 ld de, wShadowOAMBackupSprite04 - ld bc, 4 * 4 + ld bc, OBJ_SIZE * 4 call CopyData .inputLoop call TownMapSpriteBlinkingAnimation diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index 4258b94d..b6e541c5 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -30,7 +30,7 @@ EvolveMon: call Evolution_LoadPic ld de, vFrontPic ld hl, vBackPic - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData ld a, [wEvoOldSpecies] ld [wCurPartySpecies], a diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index b2c0de42..88e777af 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -188,7 +188,7 @@ HoFLoadPlayerPics: call UncompressSpriteFromDE ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 - ld bc, $310 + ld bc, 2 * SPRITEBUFFERSIZE call CopyData ld de, vFrontPic call InterlaceMergeSpriteBuffers diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index 7f06c68b..cc5526ae 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -133,7 +133,7 @@ AnimateShootingStar: ; shift the existing OAM entries down to make room for the next wave ld hl, wShadowOAMSprite04 ld de, wShadowOAM - ld bc, $50 + ld bc, OBJ_SIZE * 20 call CopyData pop af diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index 69c8cb13..7697d430 100644 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -77,13 +77,13 @@ AnimCutGrass_UpdateOAMEntries: AnimCutGrass_SwapOAMEntries: ld hl, wShadowOAMSprite36 ld de, wBuffer - ld bc, $8 + ld bc, 2 * OBJ_SIZE call CopyData ld hl, wShadowOAMSprite38 ld de, wShadowOAMSprite36 - ld bc, $8 + ld bc, 2 * OBJ_SIZE call CopyData ld hl, wBuffer ld de, wShadowOAMSprite38 - ld bc, $8 + ld bc, 2 * OBJ_SIZE jp CopyData diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 4ed1f49f..657c001e 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -264,7 +264,7 @@ InitFacingDirectionList: ld [wSavedPlayerScreenY], a ld hl, PlayerSpinningFacingOrder ld de, wFacingDirectionList - ld bc, 4 + ld bc, OBJ_SIZE call CopyData ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images) ld hl, wFacingDirectionList @@ -288,7 +288,7 @@ SpinPlayerSprite: push hl ld hl, wFacingDirectionList ld de, wFacingDirectionList - 1 - ld bc, 4 + ld bc, OBJ_SIZE call CopyData ld a, [wFacingDirectionList - 1] ld [wFacingDirectionList + 3], a @@ -393,7 +393,7 @@ FishingAnim: ld hl, FishingRodOAM add hl, bc ld de, wShadowOAMSprite39 - ld bc, $4 + ld bc, OBJ_SIZE call CopyData ld c, 100 call DelayFrames diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 7eaca222..a7c201ea 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -231,7 +231,7 @@ _AddPartyMon:: dec a jr nz, .calcFreshStats ld hl, wEnemyMonMaxHP - ld bc, $a + ld bc, NUM_STATS * 2 call CopyData ; copy stats of cur enemy mon pop hl jr .done diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 147519c7..2e02caf3 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -447,7 +447,7 @@ SlotMachine_CheckForMatches: ld h, [hl] ld l, a ld de, wStringBuffer - ld bc, 4 + ld bc, 4 ; every SlotReward*Text is at most 4 bytes call CopyData pop hl ld de, .flashScreenLoop diff --git a/home/trainers.asm b/home/trainers.asm index ab8d5fff..f00c4df9 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -31,7 +31,7 @@ ExecuteCurMapScriptInTable:: LoadGymLeaderAndCityName:: push de ld de, wGymCityName - ld bc, $11 + ld bc, GYM_CITY_LENGTH call CopyData ; load city name pop hl ld de, wGymLeaderName diff --git a/ram/vram.asm b/ram/vram.asm index fafb5d8e..0819fe0a 100644 --- a/ram/vram.asm +++ b/ram/vram.asm @@ -12,8 +12,8 @@ NEXTU ; battle/menu vSprites:: ds $80 tiles vFont:: ds $80 tiles -vFrontPic:: ds 7 * 7 tiles -vBackPic:: ds 7 * 7 tiles +vFrontPic:: ds PIC_SIZE tiles +vBackPic:: ds PIC_SIZE tiles NEXTU ; overworld @@ -25,7 +25,7 @@ NEXTU ; title ds $80 tiles vTitleLogo:: ds $80 tiles - ds 7 * 7 tiles + ds PIC_SIZE tiles vTitleLogo2:: ds 30 tiles ENDU diff --git a/ram/wram.asm b/ram/wram.asm index ff7d10ae..0b00d272 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -191,7 +191,7 @@ wOverworldMap:: ds 1300 wOverworldMapEnd:: NEXTU -wTempPic:: ds 7 * 7 tiles +wTempPic:: ds PIC_SIZE tiles ENDU @@ -688,7 +688,11 @@ NEXTU ds 1 ; difference in X between the next ball and the current one wHUDPokeballGfxOffsetX:: db -wHUDGraphicsTiles:: ds 3 +wHUDGraphicsTiles:: +wHUDUnusedTopTile:: db +wHUDCornerTile:: db +wHUDTriangleTile:: db +wHUDGraphicsTilesEnd:: NEXTU ; the level of the mon at the time it entered day care @@ -1079,7 +1083,7 @@ wExpAmountGained:: dw wGainBoostedExp:: db ENDU -wGymCityName:: ds 17 +wGymCityName:: ds GYM_CITY_LENGTH wGymLeaderName:: ds NAME_LENGTH -- cgit v1.3.1-sl0p From 3a4382c6055e21da72357dd18638947a2acbbda9 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:39:25 +0100 Subject: Use more Pokemon data constants, create MOVE_NAME_LENGTH (#543) --- constants/pokemon_data_constants.asm | 4 +- constants/text_constants.asm | 2 + engine/battle/battle_transitions.asm | 4 +- engine/battle/core.asm | 52 +++++++------- engine/battle/decrement_pp.asm | 2 +- engine/battle/draw_hud_pokeball_gfx.asm | 2 +- engine/battle/effects.asm | 4 +- engine/battle/end_of_battle.asm | 6 +- engine/battle/experience.asm | 26 +++---- engine/battle/read_trainer_party.asm | 2 +- engine/battle/trainer_ai.asm | 6 +- engine/events/heal_party.asm | 10 +-- engine/events/in_game_trades.asm | 6 +- engine/events/poison.asm | 4 +- engine/items/item_effects.asm | 124 +++++++++++++++++--------------- engine/items/tmhm.asm | 2 +- engine/link/cable_club.asm | 12 ++-- engine/menus/naming_screen.asm | 4 +- engine/menus/start_sub_menus.asm | 14 ++-- engine/menus/text_box.asm | 2 +- engine/movie/hall_of_fame.asm | 2 +- engine/pokemon/add_mon.asm | 33 ++++----- engine/pokemon/bills_pc.asm | 4 +- engine/pokemon/evos_moves.asm | 10 +-- engine/pokemon/learn_move.asm | 6 +- engine/pokemon/load_mon_data.asm | 6 +- engine/pokemon/remove_mon.asm | 70 ++++++++++-------- engine/pokemon/set_types.asm | 2 +- engine/pokemon/status_screen.asm | 2 +- home/list_menu.asm | 2 +- home/move_mon.asm | 2 +- macros/ram.asm | 2 - ram/wram.asm | 7 +- scripts/Daycare.asm | 4 +- scripts/NameRatersHouse.asm | 2 +- 35 files changed, 235 insertions(+), 207 deletions(-) (limited to 'engine/movie') diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 1234acab..16d21f54 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -44,7 +44,7 @@ DEF MON_SPD_EXP rw DEF MON_SPC_EXP rw DEF MON_DVS rw DEF MON_PP rb NUM_MOVES -DEF BOXMON_STRUCT_LENGTH EQU _RS +DEF BOXMON_STRUCT_LENGTH EQU _RS ; $21 DEF MON_LEVEL rb DEF MON_STATS rw NUM_STATS rsset MON_STATS @@ -53,7 +53,7 @@ DEF MON_ATK rw DEF MON_DEF rw DEF MON_SPD rw DEF MON_SPC rw -DEF PARTYMON_STRUCT_LENGTH EQU _RS +DEF PARTYMON_STRUCT_LENGTH EQU _RS ; $2c DEF PARTY_LENGTH EQU 6 diff --git a/constants/text_constants.asm b/constants/text_constants.asm index ed195172..88a42bbe 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,5 +1,7 @@ +DEF PLAYER_NAME_LENGTH EQU 8 DEF NAME_LENGTH EQU 11 DEF ITEM_NAME_LENGTH EQU 13 +DEF MOVE_NAME_LENGTH EQU 14 DEF NAME_BUFFER_LENGTH EQU 20 DEF GYM_CITY_LENGTH EQU 17 diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 3670cddc..a37a5054 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -104,11 +104,11 @@ GetBattleTransitionID_CompareLevels: ld a, [hli] or [hl] jr nz, .notFainted - ld de, wPartyMon2 - (wPartyMon1 + 1) + ld de, PARTYMON_STRUCT_LENGTH - 1 add hl, de jr .faintedLoop .notFainted - ld de, wPartyMon1Level - (wPartyMon1HP + 1) + ld de, MON_LEVEL - (MON_HP + 1) add hl, de ld a, [hl] add $3 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4c25373a..44fd9a70 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -137,7 +137,7 @@ StartBattle: inc a ld [wFirstMonsNotOutYet], a ld hl, wEnemyMon1HP - ld bc, wEnemyMon2 - wEnemyMon1 - 1 + ld bc, PARTYMON_STRUCT_LENGTH - 1 ld d, $3 .findFirstAliveEnemyMonLoop inc d @@ -736,7 +736,7 @@ FaintEnemyPokemon: jr z, .wild ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1HP - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a ld [hli], a @@ -876,7 +876,7 @@ AnyEnemyPokemonAliveCheck: ld b, a xor a ld hl, wEnemyMon1HP - ld de, wEnemyMon2 - wEnemyMon1 + ld de, PARTYMON_STRUCT_LENGTH .nextPokemon or [hl] inc hl @@ -1330,7 +1330,7 @@ EnemySendOutFirstMon: ld a, b ld [wWhichPokemon], a push bc - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc inc hl @@ -1342,7 +1342,7 @@ EnemySendOutFirstMon: .next3 ld a, [wWhichPokemon] ld hl, wEnemyMon1Level - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] ld [wCurEnemyLevel], a @@ -1457,7 +1457,7 @@ AnyPartyAlive:: ld e, a xor a ld hl, wPartyMon1HP - ld bc, wPartyMon2 - wPartyMon1 - 1 + ld bc, PARTYMON_STRUCT_LENGTH - 1 .partyMonsLoop or [hl] inc hl @@ -1473,7 +1473,7 @@ AnyPartyAlive:: HasMonFainted: ld a, [wWhichPokemon] ld hl, wPartyMon1HP - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] or [hl] @@ -1625,16 +1625,16 @@ GotAwayText: ; copies from party data to battle mon data when sending out a new player mon LoadBattleMonFromParty: ld a, [wWhichPokemon] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld hl, wPartyMon1Species call AddNTimes ld de, wBattleMonSpecies ld bc, wBattleMonDVs - wBattleMonSpecies call CopyData - ld bc, wPartyMon1DVs - wPartyMon1OTID + ld bc, MON_DVS - MON_OTID add hl, bc ld de, wBattleMonDVs - ld bc, wPartyMon1PP - wPartyMon1DVs + ld bc, MON_PP - MON_DVS call CopyData ld de, wBattleMonPP ld bc, NUM_MOVES @@ -1669,16 +1669,16 @@ LoadBattleMonFromParty: ; copies from enemy party data to current enemy mon data when sending out a new enemy mon LoadEnemyMonFromParty: ld a, [wWhichPokemon] - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld hl, wEnemyMons call AddNTimes ld de, wEnemyMonSpecies ld bc, wEnemyMonDVs - wEnemyMonSpecies call CopyData - ld bc, wEnemyMon1DVs - wEnemyMon1OTID + ld bc, MON_DVS - MON_OTID add hl, bc ld de, wEnemyMonDVs - ld bc, wEnemyMon1PP - wEnemyMon1DVs + ld bc, MON_PP - MON_DVS call CopyData ld de, wEnemyMonPP ld bc, NUM_MOVES @@ -1800,7 +1800,7 @@ AnimateRetreatingPlayerMon: ReadPlayerMonCurHPAndStatus: ld a, [wPlayerMonNumber] ld hl, wPartyMon1HP - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h ld e, l @@ -2520,7 +2520,7 @@ MoveSelectionMenu: .relearnmenu ld a, [wWhichPokemon] ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes call .loadmoves hlcoord 4, 7 @@ -2798,12 +2798,12 @@ SwapMovesInMenu: .swapMovesInPartyMon ld hl, wPartyMon1Moves ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes push hl call .swapBytes ; swap moves pop hl - ld bc, wPartyMon1PP - wPartyMon1Moves + ld bc, MON_PP - MON_MOVES add hl, bc call .swapBytes ; swap move PP xor a @@ -3451,7 +3451,7 @@ CheckPlayerStatusConditions: bit PAR, [hl] jr z, .BideCheck call BattleRandom - cp $3F ; 25% to be fully paralyzed + cp 25 percent ; chance to be fully paralyzed jr nc, .BideCheck ld hl, FullyParalyzedText call PrintText @@ -3970,7 +3970,7 @@ CheckForDisobedience: ; compare the mon's original trainer ID with the player's ID to see if it was traded .checkIfMonIsTraded ld hl, wPartyMon1OTID - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wPlayerMonNumber] call AddNTimes ld a, [wPlayerID] @@ -4197,7 +4197,7 @@ GetDamageVarsForPlayerAttack: push bc ld hl, wPartyMon1Attack ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc jr .scaleStats @@ -4229,7 +4229,7 @@ GetDamageVarsForPlayerAttack: push bc ld hl, wPartyMon1Special ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc ; if either the offensive or defensive stat is too large to store in a byte, scale both stats by dividing them by 4 @@ -4303,7 +4303,7 @@ GetDamageVarsForEnemyAttack: ; in the case of a critical hit, reset the player's defense and the enemy's attack to their base values ld hl, wPartyMon1Defense ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] ld b, a @@ -4335,7 +4335,7 @@ GetDamageVarsForEnemyAttack: ; in the case of a critical hit, reset the player's and enemy's specials to their base values ld hl, wPartyMon1Special ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] ld b, a @@ -4398,7 +4398,7 @@ GetEnemyMonStat: ld b, $0 add hl, bc ld a, [wEnemyMonPartyPos] - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] ldh [hMultiplicand + 1], a @@ -5197,7 +5197,7 @@ IncrementMovePP: jr z, .updatePP ld a, [wEnemyMonPartyPos] ; value for enemy turn .updatePP - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes inc [hl] ; increment PP in the party memory location ret @@ -6206,7 +6206,7 @@ LoadEnemyMonData: ; if it's a trainer battle, copy moves from enemy party data ld hl, wEnemyMon1Moves ld a, [wWhichPokemon] - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld bc, NUM_MOVES call CopyData diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index 441bbb81..93515224 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -31,7 +31,7 @@ DecrementPP: ld hl, wPartyMon1PP ; PP of first move (in party) ld a, [wPlayerMonNumber] ; which mon in party is active - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ; calculate address of the mon to modify .DecrementPP: ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 011b4b33..768a6e20 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -90,7 +90,7 @@ PickPokeball: .done ld a, b ld [de], a - ld bc, wPartyMon2 - wPartyMon1Status + ld bc, PARTYMON_STRUCT_LENGTH - MON_STATUS add hl, bc ; next mon struct ret diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 003592aa..2cef2521 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -323,7 +323,7 @@ CheckDefrost: ld [wEnemyMonStatus], a ; set opponent status to 00 ["defrost" a frozen monster] ld hl, wEnemyMon1Status ld a, [wEnemyMonPartyPos] - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a ld [hl], a ; clear status in roster @@ -336,7 +336,7 @@ CheckDefrost: ld [wBattleMonStatus], a ld hl, wPartyMon1Status ld a, [wPlayerMonNumber] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a ld [hl], a diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 80fdf002..2feb50bd 100644 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -5,7 +5,7 @@ EndOfBattle: ; link battle ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1Status - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [wEnemyMonStatus] ld [hl], a @@ -60,8 +60,8 @@ EndOfBattle: ld [hli], a ld [hl], a ld [wListScrollOffset], a - ld hl, wPlayerStatsToDouble - ld b, $18 + ld hl, wBattleStatusData + ld b, wBattleStatusDataEnd - wBattleStatusData .loop ld [hli], a dec b diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index a8ee6747..4e44643c 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -21,7 +21,7 @@ GainExperience: and a ; is mon's gain exp flag set? pop hl jp z, .nextMon ; if mon's gain exp flag not set, go to next mon - ld de, (wPartyMon1HPExp + 1) - (wPartyMon1HP + 1) + ld de, (MON_HP_EXP + 1) - (MON_HP + 1) add hl, de ld d, h ld e, l @@ -66,9 +66,9 @@ GainExperience: ldh [hDivisor], a ld b, 4 call Divide - ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1) + ld hl, MON_OTID - (MON_DVS - 1) add hl, de - ld b, [hl] ; party mon OTID + ld b, [hl] ; wPartyMon*OTID inc hl ld a, [wPlayerID] cp b @@ -152,7 +152,7 @@ GainExperience: ld [wMonDataLocation], a call LoadMonData pop hl - ld bc, wPartyMon1Level - wPartyMon1Exp + ld bc, MON_LEVEL - MON_EXP add hl, bc push hl farcall CalcLevelFromExperience @@ -166,13 +166,13 @@ GainExperience: ld a, d ld [wCurEnemyLevel], a ld [hl], a - ld bc, wPartyMon1Species - wPartyMon1Level + ld bc, MON_SPECIES - MON_LEVEL add hl, bc ld a, [hl] ld [wCurSpecies], a ld [wPokedexNum], a call GetMonHeader - ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species + ld bc, (MON_MAXHP + 1) - MON_SPECIES add hl, bc push hl ld a, [hld] @@ -181,7 +181,7 @@ GainExperience: push bc ; push max HP (from before levelling up) ld d, h ld e, l - ld bc, (wPartyMon1HPExp - 1) - wPartyMon1MaxHP + ld bc, (MON_HP_EXP - 1) - MON_MAXHP add hl, bc ld b, $1 ; consider stat exp when calculating stats call CalcStats @@ -193,15 +193,15 @@ GainExperience: ld a, [hl] sbc b ld b, a ; bc = difference between old max HP and new max HP after levelling - ld de, (wPartyMon1HP + 1) - wPartyMon1MaxHP + ld de, (MON_HP + 1) - MON_MAXHP add hl, de ; add to the current HP the amount of max HP gained when levelling - ld a, [hl] ; wPartyMon1HP + 1 + ld a, [hl] ; wPartyMon*HP + 1 add c ld [hld], a - ld a, [hl] ; wPartyMon1HP + 1 + ld a, [hl] ; wPartyMon*HP + 1 adc b - ld [hl], a ; wPartyMon1HP + ld [hl], a ; wPartyMon*HP ld a, [wPlayerMonNumber] ld b, a ld a, [wWhichPokemon] @@ -216,7 +216,7 @@ GainExperience: ld a, [hl] ld [de], a ; copy other stats from party mon to battle mon - ld bc, wPartyMon1Level - (wPartyMon1HP + 1) + ld bc, MON_LEVEL - (MON_HP + 1) add hl, bc push hl ld de, wBattleMonLevel @@ -271,7 +271,7 @@ GainExperience: cp b jr z, .done ld [wWhichPokemon], a - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld hl, wPartyMon1 call AddNTimes jp .partyMonLoop diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index df1132ea..1e173690 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -92,7 +92,7 @@ ReadTrainer: ld a, [hli] ld d, [hl] ld hl, wEnemyMon1Moves + 2 - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld [hl], d jr .FinishUp diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 546dd60e..b9447779 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -569,7 +569,7 @@ AISwitchIfEnoughMons: inc d .Fainted push bc - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH add hl, bc pop bc dec c @@ -587,7 +587,7 @@ SwitchEnemyMon: ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1HP - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h ld e, l @@ -626,7 +626,7 @@ AICureStatus: ; cures the status of enemy's active pokemon ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1Status - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a ld [hl], a ; clear status in enemy team roster diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm index e6551bcd..5532fd92 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -11,7 +11,7 @@ HealParty: push hl push de - ld hl, wPartyMon1Status - wPartyMon1HP + ld hl, MON_STATUS - MON_HP add hl, de xor a ld [hl], a @@ -19,7 +19,7 @@ HealParty: push de ld b, NUM_MOVES ; A Pokémon has 4 moves .pp - ld hl, wPartyMon1Moves - wPartyMon1HP + ld hl, MON_MOVES - MON_HP add hl, de ld a, [hl] @@ -27,7 +27,7 @@ HealParty: jr z, .nextmove dec a - ld hl, wPartyMon1PP - wPartyMon1HP + ld hl, MON_PP - MON_HP add hl, de push hl @@ -60,7 +60,7 @@ HealParty: jr nz, .pp pop de - ld hl, wPartyMon1MaxHP - wPartyMon1HP + ld hl, MON_MAXHP - MON_HP add hl, de ld a, [hli] ld [de], a @@ -72,7 +72,7 @@ HealParty: pop hl push hl - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld h, d ld l, e add hl, bc diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 5cc251f4..3107550f 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -115,7 +115,7 @@ InGameTrade_DoTrade: jr nz, .tradeFailed ; jump if the selected mon's species is not the required one ld a, [wWhichPokemon] ld hl, wPartyMon1Level - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] ld [wCurEnemyLevel], a @@ -190,7 +190,7 @@ InGameTrade_PrepareTradeData: ld de, wLinkEnemyTrainerName call InGameTrade_CopyData ld hl, wPartyMon1OTID - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wWhichPokemon] call AddNTimes ld de, wTradedPlayerMonOTID @@ -223,7 +223,7 @@ InGameTrade_CopyDataToReceivedMon: ld bc, NAME_LENGTH call CopyData ld hl, wPartyMon1OTID - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call InGameTrade_GetReceivedMonPointer ld hl, wTradedEnemyMonOTID ld bc, 2 diff --git a/engine/events/poison.asm b/engine/events/poison.asm index beb1a312..8c3dc8b3 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -65,7 +65,7 @@ ApplyOutOfBattlePoisonDamage: ld a, [de] inc a jr z, .applyDamageLoopDone - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH add hl, bc push hl ld hl, wWhichPokemon @@ -82,7 +82,7 @@ ApplyOutOfBattlePoisonDamage: and 1 << PSN or e ld e, a - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH add hl, bc dec d jr nz, .countPoisonedLoop diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 7fffae59..a716ebb7 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -834,7 +834,7 @@ ItemUseMedicine: .getPartyMonDataAddress jp c, .canceledItemUse ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wWhichPokemon] call AddNTimes ld a, [wWhichPokemon] @@ -866,7 +866,7 @@ ItemUseMedicine: jr nc, .healHP ; if it's a Full Restore or one of the potions ; fall through if it's one of the status-specific healing items .cureStatusAilment - ld bc, wPartyMon1Status - wPartyMon1 + ld bc, MON_STATUS add hl, bc ; hl now points to status ld a, [wCurItem] lb bc, ANTIDOTE_MSG, 1 << PSN @@ -904,7 +904,7 @@ ItemUseMedicine: ld hl, wPlayerBattleStatus3 res BADLY_POISONED, [hl] ; heal Toxic status pop hl - ld bc, wPartyMon1Stats - wPartyMon1Status + ld bc, MON_STATS - MON_STATUS add hl, bc ; hl now points to party stats ld de, wBattleMonStats ld bc, NUM_STATS * 2 @@ -962,7 +962,7 @@ ItemUseMedicine: .compareCurrentHPToMaxHP push hl push bc - ld bc, wPartyMon1MaxHP - (wPartyMon1HP + 1) + ld bc, MON_MAXHP - (MON_HP + 1) add hl, bc ; hl now points to max HP pop bc ld a, [hli] @@ -994,7 +994,7 @@ ItemUseMedicine: ld [wChannelSoundIDs + CHAN5], a push hl push de - ld bc, wPartyMon1MaxHP - (wPartyMon1HP + 1) + ld bc, MON_MAXHP - (MON_HP + 1) add hl, bc ; hl now points to max HP ld a, [hli] ld [wHPBarMaxHP+1], a @@ -1015,7 +1015,7 @@ ItemUseMedicine: push af ld hl, wPartyMon1MaxHP ld a, [wWhichPokemon] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] ld [wHPBarMaxHP + 1], a @@ -1027,7 +1027,7 @@ ItemUseMedicine: ldh [hDivisor], a ld b, 2 ; number of bytes call Divide ; get 1/5 of max HP of pokemon that used Softboiled - ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) + ld bc, (MON_HP + 1) - (MON_MAXHP + 1) add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled ldh a, [hQuotient + 3] @@ -1106,7 +1106,7 @@ ItemUseMedicine: inc hl ld d, h ld e, l ; de now points to current HP - ld hl, (wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1) + ld hl, (MON_MAXHP + 1) - (MON_HP + 1) add hl, de ; hl now points to max HP ld a, [wCurItem] cp REVIVE @@ -1153,7 +1153,7 @@ ItemUseMedicine: ld a, [wCurItem] cp FULL_RESTORE jr nz, .updateInBattleData - ld bc, wPartyMon1Status - (wPartyMon1MaxHP + 1) + ld bc, MON_STATUS - (MON_MAXHP + 1) add hl, bc xor a ld [hl], a ; remove the status ailment in the party data @@ -1256,7 +1256,7 @@ ItemUseMedicine: ld a, [hl] ld [wCurSpecies], a ld [wPokedexNum], a - ld bc, wPartyMon1Level - wPartyMon1 + ld bc, MON_LEVEL add hl, bc ; hl now points to level ld a, [hl] ; a = level ld [wCurEnemyLevel], a ; store level @@ -1273,7 +1273,7 @@ ItemUseMedicine: push hl sub HP_UP add a - ld bc, wPartyMon1HPExp - wPartyMon1 + ld bc, MON_HP_EXP add hl, bc add l ld l, a @@ -1321,17 +1321,17 @@ ItemUseMedicine: call PrintText jp GBPalWhiteOut .recalculateStats - ld bc, wPartyMon1Stats - wPartyMon1 + ld bc, MON_STATS add hl, bc ld d, h ld e, l ; de now points to stats - ld bc, (wPartyMon1Exp + 2) - wPartyMon1Stats + ld bc, (MON_EXP + 2) - MON_STATS add hl, bc ; hl now points to LSB of experience ld b, 1 jp CalcStats ; recalculate stats .useRareCandy push hl - ld bc, wPartyMon1Level - wPartyMon1 + ld bc, MON_LEVEL add hl, bc ; hl now points to level ld a, [hl] ; a = level cp MAX_LEVEL @@ -1345,7 +1345,7 @@ ItemUseMedicine: callfar CalcExperience ; calculate experience for next level and store it at hExperience pop de pop hl - ld bc, wPartyMon1Exp - wPartyMon1Level + ld bc, MON_EXP - MON_LEVEL add hl, bc ; hl now points to MSB of experience ; update experience to minimum for new level ldh a, [hExperience] @@ -1361,7 +1361,7 @@ ItemUseMedicine: push af push de push hl - ld bc, wPartyMon1MaxHP - wPartyMon1 + ld bc, MON_MAXHP add hl, bc ; hl now points to MSB of max HP ld a, [hli] ld b, a @@ -1371,7 +1371,7 @@ ItemUseMedicine: push hl call .recalculateStats pop hl - ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1 + ld bc, (MON_MAXHP + 1) add hl, bc ; hl now points to LSB of max HP pop bc ld a, [hld] @@ -1381,7 +1381,7 @@ ItemUseMedicine: sbc b ld b, a ; bc = the amount of max HP gained from leveling up ; add the amount gained to the current HP - ld de, (wPartyMon1HP + 1) - wPartyMon1MaxHP + ld de, (MON_HP + 1) - MON_MAXHP add hl, de ; hl now points to LSB of current HP ld a, [hl] add c @@ -1984,7 +1984,7 @@ ItemUsePPRestore: ld [wPlayerMoveListIndex], a jr nz, .chooseMon ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call GetSelectedMoveOffset push hl ld a, [hl] @@ -1996,7 +1996,7 @@ ItemUsePPRestore: cp ETHER jr nc, .useEther ; if Ether or Max Ether .usePPUp - ld bc, wPartyMon1PP - wPartyMon1Moves + ld bc, MON_PP - MON_MOVES add hl, bc ld a, [hl] ; move PP cp 3 << 6 ; have 3 PP Ups already been used? @@ -2026,7 +2026,7 @@ ItemUsePPRestore: cp b ; is the pokemon whose PP was restored active in battle? jr nz, .skipUpdatingInBattleData ld hl, wPartyMon1PP - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld de, wBattleMonPP ld bc, NUM_MOVES @@ -2048,9 +2048,9 @@ ItemUsePPRestore: ld [wMonDataLocation], a call GetMaxPP ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call GetSelectedMoveOffset - ld bc, wPartyMon1PP - wPartyMon1Moves + ld bc, MON_PP - MON_MOVES add hl, bc ; hl now points to move's PP ld a, [wMaxPP] ld b, a @@ -2098,7 +2098,7 @@ ItemUsePPRestore: .elixirLoop push bc ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call GetSelectedMoveOffset ld a, [hl] and a ; does the current slot have a move? @@ -2195,7 +2195,7 @@ ItemUseTMHM: .chooseMon ld hl, wStringBuffer ld de, wTempMoveNameBuffer - ld bc, ITEM_NAME_LENGTH + 1 + ld bc, MOVE_NAME_LENGTH call CopyData ; save the move name because DisplayPartyMenu will overwrite it ld a, $ff ld [wUpdateSpritesEnabled], a @@ -2205,7 +2205,7 @@ ItemUseTMHM: push af ld hl, wTempMoveNameBuffer ld de, wStringBuffer - ld bc, ITEM_NAME_LENGTH + 1 + ld bc, MOVE_NAME_LENGTH call CopyData pop af jr nc, .checkIfAbleToLearnMove @@ -2375,14 +2375,14 @@ GotOffBicycleText: ; [wCurrentMenuItem] = index of move (when using a PP Up) RestoreBonusPP: ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wWhichPokemon] call AddNTimes push hl ld de, wNormalMaxPPList - 1 predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList pop hl - ld c, wPartyMon1PP - wPartyMon1Moves + ld c, MON_PP - MON_MOVES ld b, 0 add hl, bc ; hl now points to move 1 PP ld de, wNormalMaxPPList @@ -2468,13 +2468,13 @@ GetMaxPP: ld a, [wMonDataLocation] and a ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH jr z, .sourceWithMultipleMon ld hl, wEnemyMon1Moves dec a jr z, .sourceWithMultipleMon ld hl, wBoxMon1Moves - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH dec a jr z, .sourceWithMultipleMon ld hl, wDayCareMonMoves @@ -2501,7 +2501,7 @@ GetMaxPP: ld b, a ; b = normal max PP pop hl push bc - ld bc, wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data + ld bc, MON_PP - MON_MOVES ; PP offset if not player's in-battle pokemon data ld a, [wMonDataLocation] cp 4 ; player's in-battle pokemon? jr nz, .addPPOffset @@ -2645,29 +2645,33 @@ IsKeyItem_:: INCLUDE "data/items/key_items.asm" +; store the new mon in the first slot, shifting all existing box data down SendNewMonToBox: ld de, wBoxCount ld a, [de] inc a ld [de], a + ld a, [wCurPartySpecies] ld [wCurSpecies], a ld c, a -.loop +.shiftSpeciesLoop inc de ld a, [de] ld b, a ld a, c ld c, b ld [de], a - cp $ff - jr nz, .loop + cp -1 + jr nz, .shiftSpeciesLoop + call GetMonHeader ld hl, wBoxMonOT ld bc, NAME_LENGTH ld a, [wBoxCount] dec a - jr z, .skip + jr z, .skipOTshift ; if the box was empty, there is nothing to shift + dec a call AddNTimes push hl @@ -2679,7 +2683,7 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.loop2 +.shiftMonOTLoop push bc push hl ld bc, NAME_LENGTH @@ -2691,15 +2695,18 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .loop2 -.skip + jr nz, .shiftMonOTLoop + +.skipOTshift ld hl, wPlayerName - ld de, wBoxMonOT + ld de, wBoxMon1OT ld bc, NAME_LENGTH call CopyData + ld a, [wBoxCount] dec a - jr z, .skip2 + jr z, .skipNickShift + ld hl, wBoxMonNicks ld bc, NAME_LENGTH dec a @@ -2713,7 +2720,7 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.loop3 +.shiftNickLoop push bc push hl ld bc, NAME_LENGTH @@ -2725,21 +2732,24 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .loop3 -.skip2 - ld hl, wBoxMonNicks + jr nz, .shiftNickLoop + +.skipNickShift + ld hl, wBoxMon1Nick ld a, NAME_MON_SCREEN ld [wNamingScreenType], a predef AskName + ld a, [wBoxCount] dec a - jr z, .skip3 + jr z, .skipMonDataShift + ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH dec a call AddNTimes push hl - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH add hl, bc ld d, h ld e, l @@ -2747,20 +2757,21 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.loop4 +.shiftMonDataLoop push bc push hl - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH call CopyData pop hl ld d, h ld e, l - ld bc, wBoxMon1 - wBoxMon2 + ld bc, -BOXMON_STRUCT_LENGTH add hl, bc pop bc dec b - jr nz, .loop4 -.skip3 + jr nz, .shiftMonDataLoop + +.skipMonDataShift ld a, [wEnemyMonLevel] ld [wEnemyMonBoxLevel], a ld hl, wEnemyMon @@ -2790,11 +2801,12 @@ SendNewMonToBox: inc de xor a ld b, NUM_STATS * 2 -.loop5 +.statLoop ld [de], a inc de dec b - jr nz, .loop5 + jr nz, .statLoop + ld hl, wEnemyMonDVs ld a, [hli] ld [de], a @@ -2803,12 +2815,12 @@ SendNewMonToBox: ld [de], a ld hl, wEnemyMonPP ld b, NUM_MOVES -.loop6 +.movePPLoop ld a, [hli] inc de ld [de], a dec b - jr nz, .loop6 + jr nz, .movePPLoop ret ; checks if the tile in front of the player is a shore or water tile diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index a11cd736..bac92f5d 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -2,7 +2,7 @@ CheckIfMoveIsKnown: ld a, [wWhichPokemon] ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [wMoveNum] ld b, a diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index ea39b938..4a300164 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -763,9 +763,9 @@ TradeCenter_Trade: call CopyData ld hl, wPartyMon1Species ld a, [wTradingWhichPlayerMon] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - ld bc, wPartyMon1OTID - wPartyMon1 + ld bc, MON_OTID add hl, bc ld a, [hli] ld [wTradedPlayerMonOTID], a @@ -779,9 +779,9 @@ TradeCenter_Trade: call CopyData ld hl, wEnemyMons ld a, [wTradingWhichEnemyMon] - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - ld bc, wEnemyMon1OTID - wEnemyMon1 + ld bc, MON_OTID add hl, bc ld a, [hli] ld [wTradedEnemyMonOTID], a @@ -809,10 +809,10 @@ TradeCenter_Trade: ld [wCurPartySpecies], a ld hl, wEnemyMons ld a, c - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld de, wLoadedMon - ld bc, wEnemyMon2 - wEnemyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call CopyData call AddEnemyMonToPlayerParty ld a, [wPartyCount] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 9c0cd0a8..24b172f0 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -241,11 +241,11 @@ DisplayNamingScreen: cp NAME_MON_SCREEN jr nc, .checkMonNameLength ld a, [wNamingScreenNameLength] - cp $7 ; max length of player/rival names + cp PLAYER_NAME_LENGTH - 1 jr .checkNameLength .checkMonNameLength ld a, [wNamingScreenNameLength] - cp $a ; max length of pokemon nicknames + cp NAME_LENGTH - 1 .checkNameLength jr c, .addLetter ret diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index c27e58a9..ec10dd11 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -236,7 +236,7 @@ StartMenu_Pokemon:: .softboiled ld hl, wPartyMon1MaxHP ld a, [wWhichPokemon] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] ldh [hDividend], a @@ -246,7 +246,7 @@ StartMenu_Pokemon:: ldh [hDivisor], a ld b, 2 ; number of bytes call Divide - ld bc, wPartyMon1HP - wPartyMon1MaxHP + ld bc, MON_HP - MON_MAXHP add hl, bc ld a, [hld] ld b, a @@ -743,24 +743,24 @@ SwitchPartyMon_InitVarOrSwapData: ldh a, [hSwapTemp] ld [de], a ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wCurrentMenuItem] call AddNTimes push hl ld de, wSwitchPartyMonTempBuffer - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call CopyData ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wMenuItemToSwap] call AddNTimes pop de push hl - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call CopyData pop de ld hl, wSwitchPartyMonTempBuffer - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call CopyData ld hl, wPartyMonOT ld a, [wCurrentMenuItem] diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index 94c432c7..e618b1d0 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -509,7 +509,7 @@ PokemonMenuEntries: GetMonFieldMoves: ld a, [wWhichPokemon] ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h ld e, l diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 88e777af..ec457141 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -49,7 +49,7 @@ AnimateHallOfFame: ld a, c ld [wHoFPartyMonIndex], a ld hl, wPartyMon1Level - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] ld [wHoFMonLevel], a diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index a7c201ea..455221ce 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -59,7 +59,7 @@ _AddPartyMon:: .next3 ldh a, [hNewPartyLength] dec a - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld e, l ld d, h @@ -117,12 +117,12 @@ _AddPartyMon:: .next4 push bc - ld bc, wPartyMon1DVs - wPartyMon1 + ld bc, MON_DVS add hl, bc pop bc ld [hli], a ld [hl], b ; write IVs - ld bc, (wPartyMon1HPExp - 1) - (wPartyMon1DVs + 1) + ld bc, (MON_HP_EXP - 1) - (MON_DVS + 1) add hl, bc ld a, 1 ld c, a @@ -142,7 +142,7 @@ _AddPartyMon:: inc de jr .copyMonTypesAndMoves .copyEnemyMonData - ld bc, wEnemyMon1DVs - wEnemyMon1 + ld bc, MON_DVS add hl, bc ld a, [wEnemyMonDVs] ; copy IVs from cur enemy mon ld [hli], a @@ -237,7 +237,7 @@ _AddPartyMon:: jr .done .calcFreshStats pop hl - ld bc, wPartyMon1HPExp - 1 - wPartyMon1 + ld bc, MON_HP_EXP - 1 add hl, bc ld b, $0 call CalcStats ; calculate fresh set of stats @@ -294,7 +294,7 @@ _AddEnemyMonToPlayerParty:: ld hl, wPartyMons ld a, [wPartyCount] dec a - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld e, l ld d, h @@ -379,12 +379,12 @@ _MoveMon:: ld a, [wMoveMonType] dec a ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wPartyCount] jr nz, .addMonOffset ; if it's PARTY_TO_BOX ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 + ld bc, BOXMON_STRUCT_LENGTH ld a, [wBoxCount] .addMonOffset dec a @@ -396,20 +396,20 @@ _MoveMon:: ld a, [wMoveMonType] and a ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 ; $21 + ld bc, BOXMON_STRUCT_LENGTH jr z, .addMonOffset2 cp DAYCARE_TO_PARTY ld hl, wDayCareMon jr z, .copyMonData ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 ; $2c + ld bc, PARTYMON_STRUCT_LENGTH .addMonOffset2 ld a, [wWhichPokemon] call AddNTimes .copyMonData push hl push de - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH call CopyData pop de pop hl @@ -418,7 +418,7 @@ _MoveMon:: jr z, .findOTdest cp DAYCARE_TO_PARTY jr z, .findOTdest - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH add hl, bc ld a, [hl] ; hl = Level inc de @@ -493,6 +493,7 @@ _MoveMon:: jr z, .done cp PARTY_TO_DAYCARE jr z, .done + ; returning mon to party, compute level and stats push hl srl a add $2 @@ -502,13 +503,13 @@ _MoveMon:: ld a, d ld [wCurEnemyLevel], a pop hl - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc + ld bc, BOXMON_STRUCT_LENGTH + add hl, bc ; hl = wPartyMon*Level ld [hli], a ld d, h ld e, l - ld bc, -18 - add hl, bc + ld bc, (MON_HP_EXP - 1) - MON_STATS + add hl, bc ; hl = wPartyMon*HPExp - 1 ld b, $1 call CalcStats .done diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 0fcdedc6..09adfa37 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -352,11 +352,11 @@ BoxNoPCText: KnowsHMMove:: ; returns whether mon with party index [wWhichPokemon] knows an HM move ld hl, wPartyMon1Moves - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH jr .next ; unreachable ld hl, wBoxMon1Moves - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH .next ld a, [wWhichPokemon] call AddNTimes diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 1b92a093..794cb164 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -177,13 +177,13 @@ Evolution_PartyMonLoop: ; loop over party mons call CalcStats ld a, [wWhichPokemon] ld hl, wPartyMon1 - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld e, l ld d, h push hl push bc - ld bc, wPartyMon1MaxHP - wPartyMon1 + ld bc, MON_MAXHP add hl, bc ld a, [hli] ld b, a @@ -357,7 +357,7 @@ LearnMoveFromLevelUp: ; If it is not 0, this function will not work properly. ld hl, wPartyMon1Moves ld a, [wWhichPokemon] - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes .next ld b, NUM_MOVES @@ -458,7 +458,7 @@ WriteMonMoves: ; shift PP as well if learning moves from day care push de - ld bc, wPartyMon1PP - (wPartyMon1Moves + 3) + ld bc, MON_PP - (MON_MOVES + 3) add hl, bc ld d, h ld e, l @@ -477,7 +477,7 @@ WriteMonMoves: ; write move PP value if learning moves from day care push hl ld a, [hl] - ld hl, wPartyMon1PP - wPartyMon1Moves + ld hl, MON_PP - MON_MOVES add hl, de push hl dec a diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 62ffeefd..b57fedcd 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -10,7 +10,7 @@ LearnMove: DontAbandonLearning: ld hl, wPartyMon1Moves - ld bc, wPartyMon2Moves - wPartyMon1Moves + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wWhichPokemon] call AddNTimes ld d, h @@ -38,7 +38,7 @@ DontAbandonLearning: .next ld a, [wMoveNum] ld [hl], a - ld bc, wPartyMon1PP - wPartyMon1Moves + ld bc, MON_PP - MON_MOVES add hl, bc push hl push de @@ -66,7 +66,7 @@ DontAbandonLearning: ld de, wBattleMonMoves ld bc, NUM_MOVES call CopyData - ld bc, wPartyMon1PP - wPartyMon1OTID + ld bc, MON_PP - MON_OTID add hl, bc ld de, wBattleMonPP ld bc, NUM_MOVES diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index 7a39f083..d90b9cd8 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -23,7 +23,7 @@ LoadMonData_:: call GetMonHeader ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wMonDataLocation] cp ENEMY_PARTY_DATA jr c, .getMonEntry @@ -33,7 +33,7 @@ LoadMonData_:: cp 2 ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 + ld bc, BOXMON_STRUCT_LENGTH jr z, .getMonEntry ld hl, wDayCareMon @@ -45,5 +45,5 @@ LoadMonData_:: .copyMonData ld de, wLoadedMon - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH jp CopyData diff --git a/engine/pokemon/remove_mon.asm b/engine/pokemon/remove_mon.asm index 60ec8c27..ee47f0c8 100644 --- a/engine/pokemon/remove_mon.asm +++ b/engine/pokemon/remove_mon.asm @@ -2,15 +2,16 @@ _RemovePokemon:: ld hl, wPartyCount ld a, [wRemoveMonFromBox] and a - jr z, .usePartyCount + jr z, .gotCount ld hl, wBoxCount -.usePartyCount +.gotCount ld a, [hl] dec a ld [hli], a + ld a, [wWhichPokemon] ld c, a - ld b, $0 + ld b, 0 add hl, bc ld e, l ld d, h @@ -21,21 +22,27 @@ _RemovePokemon:: ld [hli], a inc a ; reached terminator? jr nz, .shiftMonSpeciesLoop ; if not, continue shifting species + ld hl, wPartyMonOT ld d, PARTY_LENGTH - 1 ; max number of pokemon to shift ld a, [wRemoveMonFromBox] and a - jr z, .usePartyMonOTs + jr z, .gotOTsPointer ld hl, wBoxMonOT ld d, MONS_PER_BOX - 1 -.usePartyMonOTs +.gotOTsPointer ld a, [wWhichPokemon] call SkipFixedLengthTextEntries ld a, [wWhichPokemon] cp d ; are we removing the last pokemon? jr nz, .notRemovingLastMon ; if not, shift the pokemon below - ld [hl], $ff ; else, write the terminator and return + + ; bug: to erase a string, this should be ld [hl], '@' + ; This is not needed, as wBoxSpecies/wPartySpecies determine if a slot is used. + ; Besides, existing mon nick is left untouched + ld [hl], $ff ret + .notRemovingLastMon ld d, h ld e, l @@ -44,44 +51,49 @@ _RemovePokemon:: ld bc, wPartyMonNicks ld a, [wRemoveMonFromBox] and a - jr z, .usePartyMonNicks + jr z, .gotNicksPointer ld bc, wBoxMonNicks -.usePartyMonNicks +.gotNicksPointer call CopyDataUntil + ld hl, wPartyMons - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wRemoveMonFromBox] and a - jr z, .usePartyMonStructs + jr z, .gotMonStructs ld hl, wBoxMons - ld bc, wBoxMon2 - wBoxMon1 -.usePartyMonStructs + ld bc, BOXMON_STRUCT_LENGTH +.gotMonStructs ld a, [wWhichPokemon] call AddNTimes ; get address of the pokemon removed - ld d, h ; store in de for CopyDataUntil + + ld d, h ; de = start address for CopyDataUntil ld e, l ld a, [wRemoveMonFromBox] and a - jr z, .copyUntilPartyMonOTs - ld bc, wBoxMon2 - wBoxMon1 - add hl, bc ; get address of pokemon after the pokemon removed - ld bc, wBoxMonOT ; address of when to stop copying - jr .continue -.copyUntilPartyMonOTs - ld bc, wPartyMon2 - wPartyMon1 - add hl, bc ; get address of pokemon after the pokemon removed - ld bc, wPartyMonOT ; address of when to stop copying -.continue - call CopyDataUntil ; shift all pokemon data after the removed mon to the removed mon's location + jr z, .copyUntilPartyMonOT +; copy until wBoxMonOT + ld bc, BOXMON_STRUCT_LENGTH + add hl, bc ; get address of next slot + ld bc, wBoxMonOT + jr .shiftOTs +.copyUntilPartyMonOT + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc ; get address of next slot + ld bc, wPartyMonOT +.shiftOTs + call CopyDataUntil ; shift all pokemon data up one slot + ld hl, wPartyMonNicks ld a, [wRemoveMonFromBox] and a - jr z, .usePartyMonNicks2 + jr z, .gotNicksPointer2 ld hl, wBoxMonNicks -.usePartyMonNicks2 +.gotNicksPointer2 ld bc, NAME_LENGTH ld a, [wWhichPokemon] call AddNTimes + ld d, h ld e, l ld bc, NAME_LENGTH @@ -89,7 +101,7 @@ _RemovePokemon:: ld bc, wPartyMonNicksEnd ld a, [wRemoveMonFromBox] and a - jr z, .copyUntilPartyMonNicksEnd + jr z, .shiftMonNicks ld bc, wBoxMonNicksEnd -.copyUntilPartyMonNicksEnd - jp CopyDataUntil +.shiftMonNicks + jp CopyDataUntil ; shift all pokemon nicknames up one slot diff --git a/engine/pokemon/set_types.asm b/engine/pokemon/set_types.asm index 2cf8f14c..d42c3cf3 100644 --- a/engine/pokemon/set_types.asm +++ b/engine/pokemon/set_types.asm @@ -1,7 +1,7 @@ ; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in [wPokedexNum] SetPartyMonTypes: call GetPredefRegisters - ld bc, wPartyMon1Type - wPartyMon1 ; $5 + ld bc, MON_TYPE add hl, bc ld a, [wPokedexNum] ld [wCurSpecies], a diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 80cdfb17..9c708a22 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -361,7 +361,7 @@ StatusScreen2: pop de pop hl push hl - ld bc, wPartyMon1PP - wPartyMon1Moves - 1 + ld bc, MON_PP - MON_MOVES - 1 add hl, bc ld a, [hl] and PP_MASK diff --git a/home/list_menu.asm b/home/list_menu.asm index 00b5704a..d0d3f732 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -456,7 +456,7 @@ PrintListMenuEntries:: ld [wLoadedMonLevel], a .skipCopyingLevel pop hl - ld bc, $1c + ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right add hl, bc call PrintLevel pop af diff --git a/home/move_mon.asm b/home/move_mon.asm index 45b10322..cb19d0e3 100644 --- a/home/move_mon.asm +++ b/home/move_mon.asm @@ -94,7 +94,7 @@ CalcStat:: srl c pop hl push bc - ld bc, wPartyMon1DVs - (wPartyMon1HPExp - 1) ; also wEnemyMonDVs - wEnemyMonHP + ld bc, MON_DVS - (MON_HP_EXP - 1) add hl, bc pop bc ld a, c diff --git a/macros/ram.asm b/macros/ram.asm index 61358434..5f7c5228 100644 --- a/macros/ram.asm +++ b/macros/ram.asm @@ -4,8 +4,6 @@ MACRO? flag_array ds ((\1) + 7) / 8 ENDM -DEF BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 - MACRO box_struct \1Species:: db \1HP:: dw diff --git a/ram/wram.asm b/ram/wram.asm index 0b00d272..fff7f703 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1212,7 +1212,7 @@ wTrainerPicPointer:: dw ds 1 UNION -wTempMoveNameBuffer:: ds ITEM_NAME_LENGTH + 1 +wTempMoveNameBuffer:: ds MOVE_NAME_LENGTH NEXTU ; The name of the mon that is learning a move. @@ -1274,6 +1274,7 @@ wCriticalHitOrOHKO:: db wMoveMissed:: db +wBattleStatusData:: ; always 0 wPlayerStatsToDouble:: db ; always 0 @@ -1331,6 +1332,7 @@ wPlayerNumHits:: db ENDU ds 2 +wBattleStatusDataEnd:: ; non-zero when an item or move that allows escape from battle was used wEscapedFromBattle:: db @@ -1560,7 +1562,8 @@ wMoves:: ds NUM_MOVES wMoveNum:: db -wMovesString:: ds 56 +; concatenated move name list where intermediate '@' are replaced with '' +wMovesString:: ds NUM_MOVES * MOVE_NAME_LENGTH wUnusedCurMapTilesetCopy:: db diff --git a/scripts/Daycare.asm b/scripts/Daycare.asm index 05b69935..f7354e37 100644 --- a/scripts/Daycare.asm +++ b/scripts/Daycare.asm @@ -173,7 +173,7 @@ DaycareGentlemanText: ld a, [wPartyCount] dec a push af - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH push bc ld hl, wPartyMon1Moves call AddNTimes @@ -190,7 +190,7 @@ DaycareGentlemanText: call AddNTimes ld d, h ld e, l - ld bc, wPartyMon1MaxHP - wPartyMon1HP + ld bc, MON_MAXHP - MON_HP add hl, bc ld a, [hli] ld [de], a diff --git a/scripts/NameRatersHouse.asm b/scripts/NameRatersHouse.asm index 61b10a3e..b1e3bf95 100644 --- a/scripts/NameRatersHouse.asm +++ b/scripts/NameRatersHouse.asm @@ -19,7 +19,7 @@ NameRatersHouseCheckMonOTScript: call .check_match_loop jr c, .no_match ld hl, wPartyMon1OTID - ld bc, wPartyMon2 - wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH ld a, [wWhichPokemon] call AddNTimes ld de, wPlayerID -- cgit v1.3.1-sl0p From 9a6bb3ed0c44155a711d66df4d8996d9396ebd6a Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:00:56 -0500 Subject: Define player and rival names once, to be used in two places (#545) --- constants/player_constants.asm | 21 +++++++++++++++++++++ data/player/names.asm | 15 +++++++++++++++ data/player/names_list.asm | 17 +++++++++++++++++ data/player_names.asm | 31 ------------------------------- data/player_names_list.asm | 27 --------------------------- engine/movie/oak_speech/oak_speech2.asm | 4 ++-- includes.asm | 1 + 7 files changed, 56 insertions(+), 60 deletions(-) create mode 100644 constants/player_constants.asm create mode 100644 data/player/names.asm create mode 100644 data/player/names_list.asm delete mode 100644 data/player_names.asm delete mode 100644 data/player_names_list.asm (limited to 'engine/movie') diff --git a/constants/player_constants.asm b/constants/player_constants.asm new file mode 100644 index 00000000..666ccf99 --- /dev/null +++ b/constants/player_constants.asm @@ -0,0 +1,21 @@ +DEF NUM_PLAYER_NAMES EQU 3 + +IF DEF(_RED) +DEF PLAYERNAME1 EQUS "RED" +DEF PLAYERNAME2 EQUS "ASH" +DEF PLAYERNAME3 EQUS "JACK" + +DEF RIVALNAME1 EQUS "BLUE" +DEF RIVALNAME2 EQUS "GARY" +DEF RIVALNAME3 EQUS "JOHN" +ENDC + +IF DEF(_BLUE) +DEF PLAYERNAME1 EQUS "BLUE" +DEF PLAYERNAME2 EQUS "GARY" +DEF PLAYERNAME3 EQUS "JOHN" + +DEF RIVALNAME1 EQUS "RED" +DEF RIVALNAME2 EQUS "ASH" +DEF RIVALNAME3 EQUS "JACK" +ENDC diff --git a/data/player/names.asm b/data/player/names.asm new file mode 100644 index 00000000..67f2df36 --- /dev/null +++ b/data/player/names.asm @@ -0,0 +1,15 @@ +; see constants/player_constants.asm + +DefaultNamesPlayer: + db "NEW NAME" +FOR n, 1, NUM_PLAYER_NAMES + 1 + next #PLAYERNAME{d:n} +ENDR + db "@" + +DefaultNamesRival: + db "NEW NAME" +FOR n, 1, NUM_PLAYER_NAMES + 1 + next #RIVALNAME{d:n} +ENDR + db "@" diff --git a/data/player/names_list.asm b/data/player/names_list.asm new file mode 100644 index 00000000..786c1229 --- /dev/null +++ b/data/player/names_list.asm @@ -0,0 +1,17 @@ +; see constants/player_constants.asm + +DefaultNamesPlayerList: + db "NEW NAME@" + list_start +FOR n, 1, NUM_PLAYER_NAMES + 1 + li #PLAYERNAME{d:n} +ENDR + assert_list_length NUM_PLAYER_NAMES + +DefaultNamesRivalList: + db "NEW NAME@" + list_start +FOR n, 1, NUM_PLAYER_NAMES + 1 + li #RIVALNAME{d:n} +ENDR + assert_list_length NUM_PLAYER_NAMES diff --git a/data/player_names.asm b/data/player_names.asm deleted file mode 100644 index f57c9877..00000000 --- a/data/player_names.asm +++ /dev/null @@ -1,31 +0,0 @@ -IF DEF(_RED) -DefaultNamesPlayer: - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" - -DefaultNamesRival: - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" -ENDC - -IF DEF(_BLUE) -DefaultNamesPlayer: - db "NEW NAME" - next "BLUE" - next "GARY" - next "JOHN" - db "@" - -DefaultNamesRival: - db "NEW NAME" - next "RED" - next "ASH" - next "JACK" - db "@" -ENDC diff --git a/data/player_names_list.asm b/data/player_names_list.asm deleted file mode 100644 index 56075df0..00000000 --- a/data/player_names_list.asm +++ /dev/null @@ -1,27 +0,0 @@ -IF DEF(_RED) -DefaultNamesPlayerList: - db "NEW NAME@" - db "RED@" - db "ASH@" - db "JACK@" - -DefaultNamesRivalList: - db "NEW NAME@" - db "BLUE@" - db "GARY@" - db "JOHN@" -ENDC - -IF DEF(_BLUE) -DefaultNamesPlayerList: - db "NEW NAME@" - db "BLUE@" - db "GARY@" - db "JOHN@" - -DefaultNamesRivalList: - db "NEW NAME@" - db "RED@" - db "ASH@" - db "JACK@" -ENDC diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm index df05091a..bff12f62 100644 --- a/engine/movie/oak_speech/oak_speech2.asm +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -187,7 +187,7 @@ DisplayIntroNameTextBox: .namestring db "NAME@" -INCLUDE "data/player_names.asm" +INCLUDE "data/player/names.asm" GetDefaultName: ; a = name index @@ -213,7 +213,7 @@ GetDefaultName: ld bc, NAME_BUFFER_LENGTH jp CopyData -INCLUDE "data/player_names_list.asm" +INCLUDE "data/player/names_list.asm" LinkMenuEmptyText: text_end diff --git a/includes.asm b/includes.asm index 5087809c..781bb0b1 100644 --- a/includes.asm +++ b/includes.asm @@ -31,6 +31,7 @@ INCLUDE "constants/item_constants.asm" INCLUDE "constants/pokemon_constants.asm" INCLUDE "constants/pokedex_constants.asm" INCLUDE "constants/pokemon_data_constants.asm" +INCLUDE "constants/player_constants.asm" INCLUDE "constants/trainer_constants.asm" INCLUDE "constants/icon_constants.asm" INCLUDE "constants/sprite_constants.asm" -- cgit v1.3.1-sl0p From e9d3324bc06faa7de3b7a35d1f9429e610e8a761 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Mon, 15 Dec 2025 21:14:17 +0100 Subject: Comment more unreferenced local labels (#550) --- engine/battle/animations.asm | 18 +++++++------- engine/battle/core.asm | 39 ++++++++++++++++--------------- engine/battle/draw_hud_pokeball_gfx.asm | 2 +- engine/battle/effects.asm | 12 ++++++---- engine/battle/ghost_marowak_anim.asm | 2 +- engine/battle/move_effects/substitute.asm | 4 ++-- engine/battle/move_effects/transform.asm | 5 ++++ engine/events/diploma.asm | 4 ++-- engine/events/pokemart.asm | 4 ++-- engine/events/prize_menu.asm | 14 +++++------ engine/flag_action.asm | 4 ++-- engine/items/inventory.asm | 1 - engine/items/item_effects.asm | 18 +++++++------- engine/link/cable_club.asm | 2 +- engine/menus/main_menu.asm | 7 +++--- engine/menus/naming_screen.asm | 36 ++++++++++++++-------------- engine/menus/party_menu.asm | 4 ++-- engine/menus/pokedex.asm | 14 +++++------ engine/menus/start_sub_menus.asm | 6 ++--- engine/menus/swap_items.asm | 2 +- engine/movie/credits.asm | 21 ++++++++++------- engine/overworld/auto_movement.asm | 4 ++-- engine/overworld/missable_objects.asm | 4 ++-- engine/overworld/movement.asm | 11 +++++---- engine/overworld/pathfinding.asm | 4 ++-- engine/overworld/push_boulder.asm | 2 +- engine/pokemon/add_mon.asm | 4 ++-- engine/pokemon/load_mon_data.asm | 2 +- home/joypad2.asm | 4 ++-- home/list_menu.asm | 14 +++++------ home/load_font.asm | 6 ++--- home/map_objects.asm | 4 ++-- home/move_mon.asm | 2 +- home/overworld.asm | 9 ++++--- home/print_bcd.asm | 4 ++-- home/print_num.asm | 17 +++++++++----- home/print_text.asm | 2 +- home/start_menu.asm | 2 +- home/trainers.asm | 24 +++++++++---------- home/window.asm | 12 +++++----- macros/scripts/events.asm | 2 +- scripts/BillsHouse.asm | 4 ++-- scripts/Colosseum.asm | 1 + 43 files changed, 189 insertions(+), 168 deletions(-) (limited to 'engine/movie') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index f66be640..eac4115a 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -22,7 +22,7 @@ DrawFrameBlock: jp z, .flipHorizontalTranslateDown ; SUBANIMTYPE_HFLIP dec a jr z, .flipBaseCoords ; SUBANIMTYPE_COORDFLIP -.noTransformation +; no transformation ld a, [wBaseCoordY] add [hl] ld [de], a ; store Y @@ -130,7 +130,7 @@ DrawFrameBlock: ld a, [wNumFBTiles] cp c jp nz, .loop ; go back up if there are more tiles to draw -.afterDrawingTiles +; after drawing tiles ld a, [wFBMode] cp FRAMEBLOCKMODE_02 jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer @@ -185,7 +185,7 @@ PlayAnimation: jr z, .AnimationOver cp FIRST_SE_ID ; is this subanimation or a special effect? jr c, .playSubanimation -.doSpecialEffect +; do Special Effect ld c, a ld de, SpecialEffectPointers .searchSpecialEffectTableLoop @@ -295,11 +295,11 @@ LoadSubanimation: and %11100000 cp SUBANIMTYPE_ENEMY << 5 vc_hook_blue Reduce_move_anim_flashing_Blizzard - jr nz, .isNotType5 -.isType5 + jr nz, .isNotTypeEnemy +; subanim type enemy call GetSubanimationTransform2 jr .saveTransformation -.isNotType5 +.isNotTypeEnemy vc_hook Reduce_move_anim_flashing_Hyper_Beam call GetSubanimationTransform1 .saveTransformation @@ -427,11 +427,11 @@ MoveAnimation: call PlayAnimation vc_hook_red Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick vc_hook_blue Stop_reducing_move_anim_flashing_Spore - jr .next4 + jr .next .animationsDisabled ld c, 30 call DelayFrames -.next4 +.next vc_hook_red Stop_reducing_move_anim_flashing vc_hook_blue Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) @@ -1097,6 +1097,8 @@ SetAnimationBGPalette: ldh [rBGP], a ret +AnimationUnusedShakeScreen: ; unreferenced +; Shakes the screen for a while. ld b, $5 AnimationShakeScreenVertically: diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 44fd9a70..dd9fbc71 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1247,7 +1247,7 @@ SlideTrainerPicOffScreen: ldh a, [hSlideAmount] cp 8 jr z, .slideRight -.slideLeft ; slide player sprite off screen +; slide player sprite left off screen ld a, [hld] ld [hli], a inc hl @@ -3557,11 +3557,12 @@ CheckPlayerStatusConditions: ld hl, AttackContinuesText call PrintText ld a, [wPlayerNumAttacksLeft] - dec a ; did multi-turn move end? + dec a ld [wPlayerNumAttacksLeft], a - ld hl, GetPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), - ; DecrementPP and MoveHitTest - jp nz, .returnToHL + ld hl, GetPlayerAnimationType ; skip damage calculation (deal damage equal to last hit), + ; DecrementPP and MoveHitTest + jp nz, .returnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .returnToHL .RageCheck @@ -3626,7 +3627,7 @@ ConfusedNoMoreText: text_far _ConfusedNoMoreText text_end -SavingEnergyText: +SavingEnergyText: ; unreferenced text_far _SavingEnergyText text_end @@ -4171,7 +4172,7 @@ GetDamageVarsForPlayerAttack: ld a, [hl] ; a = [wPlayerMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wEnemyMonDefense ld a, [hli] ld b, a @@ -4284,7 +4285,7 @@ GetDamageVarsForEnemyAttack: ld a, [hl] ; a = [wEnemyMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wBattleMonDefense ld a, [hli] ld b, a @@ -5301,7 +5302,6 @@ AdjustDamageForMoveType: ld [hl], a or b ; is damage 0? jr nz, .skipTypeImmunity -.typeImmunity ; if damage is 0, make the move miss ; this only occurs if a move that would do 2 or 3 damage is 0.25x effective against the target inc a @@ -5394,7 +5394,7 @@ MoveHitTest: ldh a, [hWhoseTurn] and a jr nz, .enemyTurn -.playerTurn +; player's turn ; this checks if the move effect is disallowed by mist ld a, [wPlayerMoveEffect] cp ATTACK_DOWN1_EFFECT @@ -5466,12 +5466,12 @@ MoveHitTest: ld [wMoveMissed], a ldh a, [hWhoseTurn] and a - jr z, .playerTurn2 -.enemyTurn2 + jr z, .playerTurn +; enemy's turn ld hl, wEnemyBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret -.playerTurn2 +.playerTurn ld hl, wPlayerBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret @@ -6063,10 +6063,11 @@ CheckEnemyStatusConditions: ld hl, AttackContinuesText call PrintText ld hl, wEnemyNumAttacksLeft - dec [hl] ; did multi-turn move end? - ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), + dec [hl] + ld hl, GetEnemyAnimationType ; skip damage calculation (deal damage equal to last hit), ; DecrementPP and MoveHitTest - jp nz, .enemyReturnToHL + jp nz, .enemyReturnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .enemyReturnToHL .checkIfUsingRage ld a, [wEnemyBattleStatus2] @@ -6415,7 +6416,7 @@ QuarterSpeedDueToParalysis: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; quarter the player's speed +; enemy's turn, quarter the player's speed ld a, [wBattleMonStatus] and 1 << PAR ret z ; return if player not paralysed @@ -6458,7 +6459,7 @@ HalveAttackDueToBurn: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; halve the player's attack +; enemy's turn, halve the player's attack ld a, [wBattleMonStatus] and 1 << BRN ret z ; return if player not burnt @@ -6642,7 +6643,7 @@ LoadHudTilePatterns: ldh a, [rLCDC] add a ; is LCD disabled? jr c, .lcdEnabled -.lcdDisabled +; LCD disabled ld hl, BattleHudTiles1 ld de, vChars2 tile $6d ld bc, BattleHudTiles1End - BattleHudTiles1 diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 768a6e20..adeaaf62 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -18,7 +18,7 @@ LoadPartyPokeballGfx: SetupOwnPartyPokeballs: call PlacePlayerHUDTiles - ld hl, wPartyMon1 + ld hl, wPartyMons ld de, wPartyCount call SetupPokeballs ld a, $60 diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 2cef2521..22765140 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -230,7 +230,7 @@ FreezeBurnParalyzeEffect: jr z, .burn1 cp FREEZE_SIDE_EFFECT1 jr z, .freeze1 -; .paralyze1 +; paralyze1 ld a, 1 << PAR ld [wEnemyMonStatus], a call QuarterSpeedDueToParalysis ; quarter speed of affected mon @@ -283,7 +283,7 @@ FreezeBurnParalyzeEffect: jr z, .burn2 cp FREEZE_SIDE_EFFECT1 jr z, .freeze2 -; .paralyze2 +; paralyze2 ld a, 1 << PAR ld [wBattleMonStatus], a call QuarterSpeedDueToParalysis @@ -593,7 +593,7 @@ StatModifierDownEffect: ld a, [de] cp ATTACK_DOWN2_EFFECT - $16 ; $24 jr c, .ok - cp EVASION_DOWN2_EFFECT + $5 ; $44 + cp ATTACK_DOWN_SIDE_EFFECT ; move side effects, stat mod decrease is always 1 jr nc, .ok dec b ; stat down 2 effects only (dec mod again) jr nz, .ok @@ -711,7 +711,7 @@ CantLowerAnymore: MoveMissed: ld a, [de] - cp $44 + cp ATTACK_DOWN_SIDE_EFFECT ret nc jp ConditionalPrintButItFailed @@ -1321,7 +1321,7 @@ DisableEffect: cp LINK_STATE_BATTLING pop hl ; wEnemyMonMoves jr nz, .playerTurnNotLinkBattle -; .playerTurnLinkBattle +; player's turn, Link Battle push hl ld hl, wEnemyMonPP .enemyTurn @@ -1456,6 +1456,7 @@ PlayCurrentMoveAnimation2: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation2: ; play animation ID at a and animation type 6 or 3 @@ -1482,6 +1483,7 @@ PlayCurrentMoveAnimation: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation: ; play animation ID at a and predefined animation type diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 1040f85f..efda9f8f 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -48,7 +48,7 @@ MarowakAnim: call Delay3 jp ClearSprites -; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM +; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index e4311209..01d5a8a3 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -37,8 +37,8 @@ SubstituteEffect_: sbc 0 pop bc jr c, .notEnoughHP ; underflow means user would be left with negative health - ; bug: since it only branches on carry, it will possibly leave user with 0 HP -.userHasZeroOrMoreHP + ; bug: since it only branches on carry, it will possibly leave user with 0 HP +; user has 0 or more HP ld [hli], a ; save resulting HP after subtraction into current HP ld [hl], d ld h, b diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 343fa3ca..95e17833 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -2,17 +2,22 @@ TransformEffect_: ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies ld bc, wEnemyBattleStatus3 + ; bug: on enemy's turn, a is overloaded with hWhoseTurn, + ; before the check for INVULNERABLE ld a, [wEnemyBattleStatus1] ldh a, [hWhoseTurn] and a jr nz, .hitTest +; player's turn ld hl, wEnemyMonSpecies ld de, wBattleMonSpecies ld bc, wPlayerBattleStatus3 ld [wPlayerMoveListIndex], a + ; bug: this should be target's BattleStatus1 (i.e. wEnemyBattleStatus1) ld a, [wPlayerBattleStatus1] .hitTest bit INVULNERABLE, a ; is mon invulnerable to typical attacks? (fly/dig) + ; this check doesn't work due to above bugs jp nz, .failed push hl push de diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 3d181210..e2a34a3b 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -73,8 +73,8 @@ DisplayDiploma:: jp GBPalNormal UnusedPlayerNameLengthFunc: -; Unused function that does a calculation involving the length of the player's -; name. +; Unused function that performs bc = -(player name's length) +; leftover from the JPN versions ld hl, wPlayerName lb bc, $ff, $00 .loop diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index b280c711..cb25ab4c 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -99,7 +99,7 @@ DisplayPokemartDialogue_:: dec a jr z, .sellMenuLoop -.sellItem +; sell item ld a, [wBoughtOrSoldItemInMart] and a jr nz, .skipSettingFlag1 @@ -177,7 +177,7 @@ DisplayPokemartDialogue_:: dec a jr z, .buyMenuLoop -.buyItem +; buy item call .isThereEnoughMoney jr c, .notEnoughMoney ld hl, wNumBagItems diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index 15b991ed..1f71af42 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -195,7 +195,7 @@ HandlePrizeChoice: .getMonName call GetMonName .givePrize - ld hl, SoYouWantPrizeTextPtr + ld hl, SoYouWantPrizeText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] ; yes/no answer (Y=0, N=1) @@ -243,25 +243,25 @@ HandlePrizeChoice: predef SubBCDPredef jp PrintPrizePrice .bagFull - ld hl, PrizeRoomBagIsFullTextPtr + ld hl, PrizeRoomBagIsFullText jp PrintText .notEnoughCoins ld hl, SorryNeedMoreCoinsText jp PrintText .printOhFineThen - ld hl, OhFineThenTextPtr + ld hl, OhFineThenText jp PrintText UnknownPrizeData: ; XXX what's this? db $00,$01,$00,$01,$00,$01,$00,$00,$01 -HereYouGoTextPtr: +HereYouGoText: ; unreferenced text_far _HereYouGoText text_waitbutton text_end -SoYouWantPrizeTextPtr: +SoYouWantPrizeText: text_far _SoYouWantPrizeText text_end @@ -270,12 +270,12 @@ SorryNeedMoreCoinsText: text_waitbutton text_end -PrizeRoomBagIsFullTextPtr: +PrizeRoomBagIsFullText: text_far _OopsYouDontHaveEnoughRoomText text_waitbutton text_end -OhFineThenTextPtr: +OhFineThenText: text_far _OhFineThenText text_waitbutton text_end diff --git a/engine/flag_action.asm b/engine/flag_action.asm index dc516887..150bebab 100644 --- a/engine/flag_action.asm +++ b/engine/flag_action.asm @@ -43,10 +43,10 @@ FlagAction: ld a, b and a jr z, .reset - cp 2 + cp FLAG_TEST jr z, .read -.set +; set ld b, [hl] ld a, d or b diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 6ac75ec7..84950a4e 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -118,7 +118,6 @@ RemoveItemFromInventory_:: jr nz, .skipMovingUpSlots ; if the remaining quantity is 0, ; remove the emptied item slot and move up all the following item slots -.moveSlotsUp ld e, l ld d, h inc de diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 90853bee..12b5bd00 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -156,7 +156,7 @@ ItemUseBall: dec a jr nz, .notOldManBattle -.oldManBattle +; Old Man battle ld hl, wGrassRate ld de, wPlayerName ld bc, NAME_LENGTH @@ -645,7 +645,7 @@ ItemUseBicycle: jp z, ItemUseNotTime dec a ; is player already bicycling? jr nz, .tryToGetOnBike -.getOffBike +; get off bike call ItemUseReloadOverworldData xor a ld [wWalkBikeSurfState], a ; change player state to walking @@ -671,13 +671,13 @@ ItemUseSurfboard: ld [wWalkBikeSurfStateCopy], a cp 2 ; is the player already surfing? jr z, .tryToStopSurfing -.tryToSurf +; try to Surf call IsNextTileShoreOrWater jp c, SurfingAttemptFailed ld hl, TilePairCollisionsWater call CheckForTilePairCollisions jp c, SurfingAttemptFailed -.surf +; surfing call .makePlayerMoveForward ld hl, wStatusFlags5 set BIT_SCRIPTED_MOVEMENT_STATE, [hl] @@ -921,7 +921,7 @@ ItemUseMedicine: ld [wHPBarOldHP], a ; current HP stored at wHPBarOldHP (2 bytes, big-endian) or b jr nz, .notFainted -.fainted +; fainted ld a, [wCurItem] cp REVIVE jr z, .updateInBattleFaintedData @@ -973,7 +973,7 @@ ItemUseMedicine: .skipComparingLSB pop hl jr nz, .notFullHP -.fullHP ; if the pokemon's current HP equals its max HP +; if the pokemon's current HP equals its max HP ld a, [wCurItem] cp FULL_RESTORE jp nz, .healingItemNoEffect @@ -1753,8 +1753,8 @@ ItemUsePokeFlute: ; OUTPUT: ; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep WakeUpEntireParty: - ld de, 44 - ld c, 6 + ld de, PARTYMON_STRUCT_LENGTH + ld c, PARTY_LENGTH .loop ld a, [hl] push af @@ -1995,7 +1995,7 @@ ItemUsePPRestore: ld a, [wPPRestoreItem] cp ETHER jr nc, .useEther ; if Ether or Max Ether -.usePPUp +; use PP Up ld bc, MON_PP - MON_MOVES add hl, bc ld a, [hl] ; move PP diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 4a300164..6ffb2aea 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -673,7 +673,7 @@ TradeCenter_PrintPartyListNames: pop de inc de pop hl - ld bc, 20 + ld bc, SCREEN_WIDTH add hl, bc pop bc inc c diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index f4d8ec03..84af085f 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -495,6 +495,7 @@ DisplayOptionMenu: jr nz, .exitMenu bit B_PAD_A, b jr z, .checkDirectionKeys +; A was pressed ld a, [wTopMenuItemY] cp 16 ; is the cursor on Cancel? jr nz, .loop @@ -518,7 +519,7 @@ DisplayOptionMenu: jr z, .cursorInBattleStyle cp 16 ; cursor on Cancel? jr z, .loop -.cursorInTextSpeed +; cursor in Text Speed bit B_PAD_LEFT, b jp nz, .pressedLeftInTextSpeed jp .pressedRightInTextSpeed @@ -625,7 +626,7 @@ SetOptionsFromCursorPositions: ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate dec a jr z, .battleAnimationOn -.battleAnimationOff +; battle animation Off set BIT_BATTLE_ANIMATION, d jr .checkBattleStyle .battleAnimationOn @@ -634,7 +635,7 @@ SetOptionsFromCursorPositions: ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a jr z, .battleStyleShift -.battleStyleSet +; battle style Set set BIT_BATTLE_SHIFT, d jr .storeOptions .battleStyleShift diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 24b172f0..9356cc66 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -379,12 +379,13 @@ PrintNicknameAndUnderscores: hlcoord 10, 3 ld a, [wNamingScreenType] cp NAME_MON_SCREEN - jr nc, .pokemon1 - ld b, 7 ; player or rival max name length - jr .playerOrRival1 -.pokemon1 - ld b, 10 ; pokemon max name length -.playerOrRival1 + jr nc, .pokemon +; player or rival + ld b, PLAYER_NAME_LENGTH - 1 + jr .gotUnderscoreCount +.pokemon + ld b, NAME_LENGTH - 1 +.gotUnderscoreCount ld a, $76 ; underscore tile id .placeUnderscoreLoop ld [hli], a @@ -394,13 +395,15 @@ PrintNicknameAndUnderscores: cp NAME_MON_SCREEN ld a, [wNamingScreenNameLength] jr nc, .pokemon2 - cp 7 ; player or rival max name length - jr .playerOrRival2 +; player or rival + cp PLAYER_NAME_LENGTH - 1 + jr .checkEmptySpaces .pokemon2 - cp 10 ; pokemon max name length -.playerOrRival2 - jr nz, .emptySpacesRemaining - ; when all spaces are filled, force the cursor onto the ED tile + cp NAME_LENGTH - 1 +.checkEmptySpaces + jr nz, .placeRaisedUnderscore ; jump if empty spaces remain + ; when all spaces are filled, force the cursor onto the ED tile, + ; and keep the last underscore raised call EraseMenuCursor ld a, $11 ; "ED" x coord ld [wTopMenuItemX], a @@ -408,11 +411,10 @@ PrintNicknameAndUnderscores: ld [wCurrentMenuItem], a ld a, [wNamingScreenType] cp NAME_MON_SCREEN - ld a, 9 ; keep the last underscore raised - jr nc, .pokemon3 - ld a, 6 ; keep the last underscore raised -.pokemon3 -.emptySpacesRemaining + ld a, NAME_LENGTH - 2 + jr nc, .placeRaisedUnderscore + ld a, PLAYER_NAME_LENGTH - 2 +.placeRaisedUnderscore ld c, a ld b, $0 hlcoord 10, 3 diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index f2688b52..15fd62be 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -90,7 +90,7 @@ RedrawPartyMenu_:: jr nz, .placeMoveLearnabilityString ld de, .notAbleToLearnMoveText .placeMoveLearnabilityString - ld bc, 20 + 9 ; down 1 row and right 9 columns + ld bc, SCREEN_WIDTH + 9 ; 1 row down and 9 columns right push hl add hl, bc call PlaceString @@ -102,7 +102,7 @@ RedrawPartyMenu_:: pop hl pop de inc de - ld bc, 2 * 20 + ld bc, 2 * SCREEN_WIDTH add hl, bc pop bc inc c diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 3e4096bc..3d2fcbca 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -105,7 +105,7 @@ HandlePokedexSideMenu: jr z, .choseCry dec a jr z, .choseArea -.choseQuit +; chose Quit ld b, 1 .exitSideMenu pop af @@ -286,7 +286,7 @@ HandlePokedexListMenu: call HandleMenuInput bit B_PAD_B, a jp nz, .buttonBPressed -.checkIfUpPressed +; check if Up pressed bit B_PAD_UP, a jr z, .checkIfDownPressed .upPressed ; scroll up one row @@ -299,7 +299,7 @@ HandlePokedexListMenu: .checkIfDownPressed bit B_PAD_DOWN, a jr z, .checkIfRightPressed -.downPressed ; scroll down one row +; Down pressed, scroll down one row ld a, [wDexMaxSeenMon] cp 7 jp c, .loop ; can't if the list is shorter than 7 @@ -314,7 +314,7 @@ HandlePokedexListMenu: .checkIfRightPressed bit B_PAD_RIGHT, a jr z, .checkIfLeftPressed -.rightPressed ; scroll down 7 rows +; Right pressed, scroll down 7 rows ld a, [wDexMaxSeenMon] cp 7 jp c, .loop ; can't if the list is shorter than 7 @@ -332,7 +332,7 @@ HandlePokedexListMenu: .checkIfLeftPressed ; scroll up 7 rows bit B_PAD_LEFT, a jr z, .buttonAPressed -.leftPressed +; Left pressed ld a, [wListScrollOffset] sub 7 ld [wListScrollOffset], a @@ -593,8 +593,8 @@ HeightWeightText: db "HT ?′??″" next "WT ???lb@" -; XXX does anything point to this? -PokeText: +; leftover from JPN Pokedex, where species have the suffix "Pokemon" +PokeText: ; unreferenced db "#@" ; horizontal line that divides the pokedex text description from the rest of the data diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index ec10dd11..817dceb8 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -340,7 +340,7 @@ StartMenu_Item:: ld a, [wCurItem] cp BICYCLE jp z, .useOrTossItem -.notBicycle1 +; not Bicycle ld a, USE_TOSS_MENU_TEMPLATE ld [wTextBoxID], a call DisplayTextBoxID @@ -370,14 +370,14 @@ StartMenu_Item:: call CopyToStringBuffer ld a, [wCurItem] cp BICYCLE - jr nz, .notBicycle2 + jr nz, .notBicycle ld a, [wStatusFlags6] bit BIT_ALWAYS_ON_BIKE, a jr z, .useItem_closeMenu ld hl, CannotGetOffHereText call PrintText jp ItemMenuLoop -.notBicycle2 +.notBicycle ld a, [wCurrentMenuItem] and a jr nz, .tossItem diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm index 2d506ce2..dc54b645 100644 --- a/engine/menus/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -76,7 +76,7 @@ HandleItemListSwapping:: ld a, [hli] cp b jr z, .swapSameItemType -.swapDifferentItems +; swap different items ldh [hSwapItemID], a ; save second item ID ld a, [hld] ldh [hSwapItemQuantity], a ; save second item quantity diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index b1ca7c91..77484a80 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -6,10 +6,10 @@ HallOfFamePC: call DisableLCD ld hl, vFont ld bc, ($80 tiles) / 2 - call ZeroMemory + call ShiftFontColorIndex ld hl, vChars2 tile $60 ld bc, ($20 tiles) / 2 - call ZeroMemory + call ShiftFontColorIndex ld hl, vChars2 tile $7e ld bc, TILE_SIZE ld a, $ff ; solid black @@ -33,7 +33,7 @@ HallOfFamePC: ld [wNumCreditsMonsDisplayed], a jp Credits -FadeInCreditsText: +FadeInCredits: ld hl, HoFGBPalettes ld b, 4 .loop @@ -145,15 +145,18 @@ CreditsCopyTileMapToVRAM: ldh [hAutoBGTransferEnabled], a jp Delay3 -ZeroMemory: -; zero bc bytes at hl +ShiftFontColorIndex: +; Zero every second byte at hl, writing a total of bc bytes. +; When used on VRAM font characters that contain only black and white shades, +; it shifts the color index: black -> light gray, allowing palette-controlled +; text fade-in during the Credits roll, while the black bars remain solid. ld [hl], 0 inc hl inc hl dec bc ld a, b or c - jr nz, ZeroMemory + jr nz, ShiftFontColorIndex ret FillFourRowsWithBlack: @@ -215,7 +218,7 @@ Credits: pop de jr .nextCreditsCommand .fadeInTextAndShowMon - call FadeInCreditsText + call FadeInCredits ld c, 90 jr .next1 .showTextAndShowMon @@ -225,7 +228,7 @@ Credits: call DisplayCreditsMon jr .nextCreditsScreen .fadeInText - call FadeInCreditsText + call FadeInCredits ld c, 120 jr .next2 .showText @@ -254,7 +257,7 @@ Credits: hlcoord 4, 9 inc de call PlaceString - jp FadeInCreditsText + jp FadeInCredits TheEndTextString: ; "T H E E N D" diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index bed2ffb9..13d30cca 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -1,6 +1,6 @@ PlayerStepOutFromDoor:: - ld hl, wStatusFlags5 ; should this be wMovementFlags? - res BIT_EXITING_DOOR, [hl] + ld hl, wStatusFlags5 + res BIT_UNKNOWN_5_1, [hl] call IsPlayerStandingOnDoorTile jr nc, .notStandingOnDoor ld a, PAD_SELECT | PAD_START | PAD_CTRL_PAD diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 1660a894..8ea79980 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -178,10 +178,10 @@ MissableObjectFlagAction: ld a, b and a jr z, .reset - cp 2 + cp FLAG_TEST jr z, .read -.set +; set ld a, [hl] ld b, a ld a, d diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 8d02f0fe..a353c4f1 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -140,7 +140,7 @@ UpdateNPCSprite: ld b, a ld a, [wFontLoaded] bit BIT_FONT_LOADED, a - jp nz, notYetMoving + jp nz, NotYetMoving ld a, b cp $2 jp z, UpdateSpriteMovementDelay ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] == 2 @@ -389,14 +389,15 @@ UpdateSpriteMovementDelay: jr .moving .tickMoveCounter dec [hl] ; x#SPRITESTATEDATA2_MOVEMENTDELAY - jr nz, notYetMoving + jr nz, NotYetMoving .moving dec h ldh a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $1 ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] = 1 (mark as ready to move) -notYetMoving: + ; fallthrough +NotYetMoving: ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add SPRITESTATEDATA1_ANIMFRAMECOUNTER @@ -411,7 +412,7 @@ MakeNPCFacePlayer: ; disabled. This is only done when rubbing the S.S. Anne captain's back. ld a, [wStatusFlags3] bit BIT_NO_NPC_FACE_PLAYER, a - jr nz, notYetMoving + jr nz, NotYetMoving res BIT_FACE_PLAYER, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a @@ -435,7 +436,7 @@ MakeNPCFacePlayer: add $9 ld l, a ld [hl], c ; [x#SPRITESTATEDATA1_FACINGDIRECTION]: set facing direction - jr notYetMoving + jr NotYetMoving InitializeSpriteStatus: ld [hl], $1 ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] = ready diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index 878ca07d..d6e0d009 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -94,7 +94,7 @@ CalcPositionOfPlayerRelativeToNPC: ld a, [hli] ; NPC sprite screen Y position in pixels call CalcDifference jr nc, .NPCSouthOfOrAlignedWithPlayer -.NPCNorthOfPlayer +; NPC north of player push hl ld hl, hNPCPlayerRelativePosFlags bit BIT_PLAYER_LOWER_Y, [hl] @@ -122,7 +122,7 @@ CalcPositionOfPlayerRelativeToNPC: ld a, [hl] ; NPC sprite screen X position in pixels call CalcDifference jr nc, .NPCEastOfOrAlignedWithPlayer -.NPCWestOfPlayer +; NPC west of player push hl ld hl, hNPCPlayerRelativePosFlags bit BIT_PLAYER_LOWER_X, [hl] diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 2328b07a..5e7393d2 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -43,7 +43,7 @@ TryPushingBoulder:: jr z, .pushBoulderLeft cp SPRITE_FACING_RIGHT jr z, .pushBoulderRight -.pushBoulderDown +; push boulder down bit B_PAD_DOWN, b ret z ld de, PushBoulderDownMovementData diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 455221ce..c92acfcb 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -375,7 +375,7 @@ _MoveMon:: .copySpecies ld [hli], a ; write new mon ID ld [hl], $ff ; write new sentinel -.findMonDataDest +; find mon data dest ld a, [wMoveMonType] dec a ld hl, wPartyMons @@ -457,7 +457,7 @@ _MoveMon:: ld bc, NAME_LENGTH call CopyData ld a, [wMoveMonType] -.findNickDest +; find nick dest cp PARTY_TO_DAYCARE ld de, wDayCareMonName jr z, .findNickSrc diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index d90b9cd8..87a2be8b 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -31,7 +31,7 @@ LoadMonData_:: ld hl, wEnemyMons jr z, .getMonEntry - cp 2 + cp BOX_DATA ld hl, wBoxMons ld bc, BOXMON_STRUCT_LENGTH jr z, .getMonEntry diff --git a/home/joypad2.asm b/home/joypad2.asm index a07b9ee4..11ef9a99 100644 --- a/home/joypad2.asm +++ b/home/joypad2.asm @@ -25,7 +25,7 @@ JoypadLowSensitivity:: ldh a, [hJoyPressed] ; newly pressed buttons and a ; have any buttons been newly pressed since last check? jr z, .noNewlyPressedButtons -.newlyPressedButtons +; newly pressed buttons ld a, 30 ; half a second delay ldh [hFrameCounter], a ret @@ -33,7 +33,7 @@ JoypadLowSensitivity:: ldh a, [hFrameCounter] and a ; is the delay over? jr z, .delayOver -.delayNotOver +; delay not over xor a ldh [hJoy5], a ; report no buttons as pressed ret diff --git a/home/list_menu.asm b/home/list_menu.asm index d0d3f732..bd1197bb 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -65,7 +65,7 @@ DisplayListMenuIDLoop:: ld a, [wBattleType] and a ; is it the Old Man battle? jr z, .notOldManBattle -.oldManBattle +; Old Man battle ld a, '▶' ldcoord_a 5, 4 ; place menu cursor in front of first menu entry ld c, 80 @@ -178,7 +178,7 @@ DisplayListMenuIDLoop:: bit B_PAD_DOWN, b ld hl, wListScrollOffset jr z, .upPressed -.downPressed +; Down pressed ld a, [hl] add 3 ld b, a @@ -380,7 +380,7 @@ PrintListMenuEntries:: jr z, .pokemonPCMenu cp MOVESLISTMENU jr z, .movesMenu -.itemMenu +; item menu call GetItemName jr .placeNameString .pokemonPCMenu @@ -411,7 +411,7 @@ PrintListMenuEntries:: ld a, [wPrintItemPrices] and a ; should prices be printed? jr z, .skipPrintingItemPrice -.printItemPrice +; print item price push hl ld a, [de] ld de, ItemPrices @@ -426,7 +426,7 @@ PrintListMenuEntries:: ld a, [wListMenuID] and a ; PCPOKEMONLISTMENU? jr nz, .skipPrintingPokemonLevel -.printPokemonLevel +; print Pokemon level ld a, [wNamedObjectIndex] push af push hl @@ -451,7 +451,7 @@ PrintListMenuEntries:: ld a, [wMonDataLocation] and a ; is it a list of party pokemon or box pokemon? jr z, .skipCopyingLevel -.copyLevel +; copy level ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a .skipCopyingLevel @@ -468,7 +468,7 @@ PrintListMenuEntries:: ld a, [wListMenuID] cp ITEMLISTMENU jr nz, .nextListEntry -.printItemQuantity +; print item quantity ld a, [wNamedObjectIndex] ld [wCurItem], a call IsKeyItem ; check if item is unsellable diff --git a/home/load_font.asm b/home/load_font.asm index 47ad60f1..e6e04113 100644 --- a/home/load_font.asm +++ b/home/load_font.asm @@ -2,7 +2,7 @@ LoadFontTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, FontGraphics ld de, vFont ld bc, FontGraphicsEnd - FontGraphics @@ -18,7 +18,7 @@ LoadTextBoxTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, TextBoxGraphics ld de, vChars2 tile $60 ld bc, TextBoxGraphicsEnd - TextBoxGraphics @@ -34,7 +34,7 @@ LoadHpBarAndStatusTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, HpBarAndStatusGraphics ld de, vChars2 tile $62 ld bc, HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics diff --git a/home/map_objects.asm b/home/map_objects.asm index 44b012e6..57364518 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -115,7 +115,7 @@ CheckCoords:: ld hl, wCoordIndex inc [hl] pop hl -.compareYCoord +; compare Y coord cp b jr z, .compareXCoord inc hl @@ -124,7 +124,7 @@ CheckCoords:: ld a, [hli] cp c jr nz, .loop -.inArray +; in array scf ret .notInArray diff --git a/home/move_mon.asm b/home/move_mon.asm index cb19d0e3..def60bc1 100644 --- a/home/move_mon.asm +++ b/home/move_mon.asm @@ -106,7 +106,7 @@ CalcStat:: jr z, .getSpeedIV cp $5 jr z, .getSpecialIV -.getHpIV +; get HP IV push bc ld a, [hl] ; Atk IV swap a diff --git a/home/overworld.asm b/home/overworld.asm index f837815b..e994f694 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -546,7 +546,7 @@ ContinueCheckWarpsNoCollisionLoop:: ; if no matching warp was found CheckMapConnections:: -.checkWestMap +; check west map ld a, [wXCoord] cp $ff jr nz, .checkEastMap @@ -1097,8 +1097,7 @@ IsSpriteOrSignInFrontOfPlayer:: ld a, [hli] ; sign X cp e jr nz, .retry -.xCoordMatched -; found sign +; X coord matched: found sign push hl push bc ld hl, wSignTextIDs @@ -2047,7 +2046,7 @@ LoadMapHeader:: ; copy connection data (if any) to WRAM ld a, [wCurMapConnections] ld b, a -.checkNorth +; check north bit NORTH_F, b jr z, .checkSouth ld de, wNorthConnectionHeader @@ -2080,7 +2079,7 @@ LoadMapHeader:: ld de, wMapBackgroundTile ld a, [hli] ld [de], a -.loadWarpData +; load warp data ld a, [hli] ld [wNumberOfWarps], a and a diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 2e501be5..cac6aba3 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -31,9 +31,9 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit BIT_LEADING_ZEROES, b + bit BIT_LEADING_ZEROES, b ; were any non-zero digits printed? jr z, .done ; if so, we are done -.numberEqualsZero ; if every digit of the BCD number is zero +; if every digit of the BCD number is zero, print the last 0 bit BIT_LEFT_ALIGN, b jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space diff --git a/home/print_num.asm b/home/print_num.asm index 32fae363..8027a764 100644 --- a/home/print_num.asm +++ b/home/print_num.asm @@ -82,11 +82,16 @@ MACRO print_digit call .NextDigit ENDM -.millions print_digit 1000000 -.hundred_thousands print_digit 100000 -.ten_thousands print_digit 10000 -.thousands print_digit 1000 -.hundreds print_digit 100 +; millions + print_digit 1000000 +.hundred_thousands + print_digit 100000 +.ten_thousands + print_digit 10000 +.thousands + print_digit 1000 +.hundreds + print_digit 100 .tens ld c, 0 @@ -113,7 +118,7 @@ ENDM .next call .NextDigit -.ones +; ones ld a, '0' add b ld [hli], a diff --git a/home/print_text.asm b/home/print_text.asm index fe784350..8e351ba3 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -24,7 +24,7 @@ PrintLetterDelay:: .checkButtons call Joypad ldh a, [hJoyHeld] -.checkAButton +; check A button bit B_PAD_A, a jr z, .checkBButton jr .endWait diff --git a/home/start_menu.asm b/home/start_menu.asm index 6de15182..9504d536 100644 --- a/home/start_menu.asm +++ b/home/start_menu.asm @@ -14,7 +14,7 @@ RedisplayStartMenu:: .loop call HandleMenuInput ld b, a -.checkIfUpPressed +; check if Up pressed bit B_PAD_UP, a jr z, .checkIfDownPressed ld a, [wCurrentMenuItem] ; menu selection diff --git a/home/trainers.asm b/home/trainers.asm index f00c4df9..8d2cceaf 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -19,7 +19,7 @@ ExecuteCurMapScriptInTable:: ld hl, wStatusFlags7 bit BIT_USE_CUR_MAP_SCRIPT, [hl] res BIT_USE_CUR_MAP_SCRIPT, [hl] - jr z, .useProvidedIndex ; test if map script index was overridden manually + jr z, .useProvidedIndex ; test if map script index was overridden manually ld a, [wCurMapScript] .useProvidedIndex pop hl @@ -32,11 +32,11 @@ LoadGymLeaderAndCityName:: push de ld de, wGymCityName ld bc, GYM_CITY_LENGTH - call CopyData ; load city name + call CopyData ; load city name pop hl ld de, wGymLeaderName ld bc, NAME_LENGTH - jp CopyData ; load gym leader name + jp CopyData ; load gym leader name ; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) ; a: offset in header data @@ -155,7 +155,7 @@ ENDC ldh [hJoyHeld], a call TrainerWalkUpToPlayer_Bank0 ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) + inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) ret ; display the before battle text after the enemy trainer has walked up to the player's sprite @@ -179,7 +179,7 @@ StartTrainerBattle:: ld hl, wStatusFlags4 set BIT_UNKNOWN_4_1, [hl] ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) + inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) ret EndTrainerBattle:: @@ -201,14 +201,14 @@ EndTrainerBattle:: call TrainerFlagAction ; flag trainer as fought ld a, [wEnemyMonOrTrainerClass] cp OPP_ID_OFFSET - jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) ld hl, wMissableObjectList ld de, $2 ld a, [wSpriteIndex] - call IsInArray ; search for sprite ID + call IsInArray ; search for sprite ID inc hl ld a, [hl] - ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it + ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite ld hl, wStatusFlags5 @@ -269,7 +269,7 @@ CheckForEngagingTrainers:: .trainerLoop call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer ld a, [de] - ld [wSpriteIndex], a ; store trainer flag's bit + ld [wSpriteIndex], a ; store trainer flag's bit ld [wTrainerHeaderFlagBit], a cp -1 ret z @@ -278,7 +278,7 @@ CheckForEngagingTrainers:: ld b, FLAG_TEST ld a, [wTrainerHeaderFlagBit] ld c, a - call TrainerFlagAction ; read trainer flag + call TrainerFlagAction ; read trainer flag ld a, c and a ; has the trainer already been defeated? jr nz, .continue @@ -299,7 +299,7 @@ CheckForEngagingTrainers:: pop hl ld a, [wTrainerSpriteOffset] and a - ret nz ; break if the trainer is engaging + ret nz ; break if the trainer is engaging .continue ld hl, $c add hl, de @@ -364,8 +364,8 @@ PrintEndBattleText:: GetSavedEndBattleTextPointer:: ld a, [wBattleResult] and a -; won battle jr nz, .lostBattle +; won battle ld a, [wEndBattleWinTextPointer] ld h, a ld a, [wEndBattleWinTextPointer + 1] diff --git a/home/window.asm b/home/window.asm index 6885a138..2f2609d7 100644 --- a/home/window.asm +++ b/home/window.asm @@ -52,11 +52,11 @@ HandleMenuInput_:: ld b, a bit B_PAD_UP, a jr z, .checkIfDownPressed -.upPressed +; Up pressed ld a, [wCurrentMenuItem] ; selected menu item and a ; already at the top of the menu? jr z, .alreadyAtTop -.notAtTop +; not at top dec a ld [wCurrentMenuItem], a ; move selected menu item up one space jr .checkOtherKeys @@ -70,14 +70,14 @@ HandleMenuInput_:: .checkIfDownPressed bit B_PAD_DOWN, a jr z, .checkOtherKeys -.downPressed +; Down pressed ld a, [wCurrentMenuItem] inc a ld c, a ld a, [wMaxMenuItem] cp c jr nc, .notAtBottom -.alreadyAtBottom +; already at bottom ld a, [wMenuWrappingEnabled] and a ; is wrapping around enabled? jr z, .noWrappingAround @@ -93,7 +93,7 @@ HandleMenuInput_:: ldh a, [hJoy5] and PAD_A | PAD_B jr z, .skipPlayingSound -.AButtonOrBButtonPressed +; A or B pressed push hl ld hl, wMiscFlags bit BIT_NO_MENU_BUTTON_SOUND, [hl] @@ -153,7 +153,7 @@ PlaceMenuCursor:: ld a, [hl] cp '▶' ; was an arrow next to the previously selected menu item? jr nz, .skipClearingArrow -.clearArrow +; clear arrow ld a, [wTileBehindCursor] ld [hl], a .skipClearingArrow diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index b07a38f3..740184dd 100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -343,7 +343,7 @@ MACRO ResetEventRange IF event_fill_count > 1 ld hl, wEventFlags + event_fill_start - ; force xor a if we just to wrote to it above + ; force xor a if we just wrote to it above IF (_NARG < 3) || (((\1) % 8) != 0) xor a ENDC diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index 6b65aa38..d43ae546 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -82,13 +82,13 @@ BillsHouseBillExitsMachineScript: call DelayFrames ld a, BILLSHOUSE_BILL1 ldh [hSpriteIndex], a - ld de, BillExitMachineMovement + ld de, .BillExitMachineMovement call MoveSprite ld a, SCRIPT_BILLSHOUSE_CLEANUP ld [wBillsHouseCurScript], a ret -BillExitMachineMovement: +.BillExitMachineMovement: db NPC_MOVEMENT_DOWN db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT diff --git a/scripts/Colosseum.asm b/scripts/Colosseum.asm index 4aaa4236..1489fd2c 100644 --- a/scripts/Colosseum.asm +++ b/scripts/Colosseum.asm @@ -1,4 +1,5 @@ Colosseum_Script: + ASSERT TRADECENTER_OPPONENT == COLOSSEUM_OPPONENT jp TradeCenter_Script Colosseum_TextPointers: -- cgit v1.3.1-sl0p From fe1e76466b293c83e6cd3a7d4639fb3c49da26ad Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:05:20 -0500 Subject: Use macros to enforce "missable/hide/show object" constraints, and rename them to "toggleable objects" (#557) --- constants/hide_show_constants.asm | 240 ----------- constants/map_constants.asm | 2 +- constants/toggle_constants.asm | 393 ++++++++++++++++++ data/maps/hide_show_data.asm | 568 --------------------------- data/maps/objects/SilphCo7F.asm | 2 +- data/maps/toggleable_objects.asm | 423 ++++++++++++++++++++ data/predef_pointers.asm | 4 +- engine/events/pick_up_item.asm | 16 +- engine/movie/oak_speech/init_player_data.asm | 2 +- engine/overworld/auto_movement.asm | 4 +- engine/overworld/missable_objects.asm | 212 ---------- engine/overworld/movement.asm | 2 +- engine/overworld/toggleable_objects.asm | 213 ++++++++++ home/overworld.asm | 2 +- home/trainers.asm | 4 +- includes.asm | 2 +- main.asm | 4 +- ram/hram.asm | 4 +- ram/wram.asm | 14 +- scripts/BillsHouse.asm | 16 +- scripts/BluesHouse.asm | 4 +- scripts/CeladonMansionRoofHouse.asm | 4 +- scripts/CeruleanCity.asm | 12 +- scripts/CeruleanCity_2.asm | 12 +- scripts/ChampionsRoom.asm | 8 +- scripts/FightingDojo.asm | 8 +- scripts/GameCorner.asm | 4 +- scripts/HallOfFame.asm | 4 +- scripts/MtMoonB2F.asm | 14 +- scripts/Museum1F.asm | 4 +- scripts/OaksLab.asm | 66 ++-- scripts/PalletTown.asm | 12 +- scripts/PewterCity.asm | 16 +- scripts/PewterGym.asm | 8 +- scripts/PokemonTower2F.asm | 4 +- scripts/PokemonTower7F.asm | 26 +- scripts/RocketHideoutB4F.asm | 12 +- scripts/Route12.asm | 4 +- scripts/Route16.asm | 4 +- scripts/Route20.asm | 38 +- scripts/Route22.asm | 8 +- scripts/Route23.asm | 8 +- scripts/Route25.asm | 20 +- scripts/SSAnne2F.asm | 8 +- scripts/SeafoamIslands1F.asm | 12 +- scripts/SeafoamIslandsB1F.asm | 12 +- scripts/SeafoamIslandsB2F.asm | 12 +- scripts/SeafoamIslandsB3F.asm | 12 +- scripts/SilphCo11F.asm | 104 ++--- scripts/SilphCo1F.asm | 4 +- scripts/SilphCo7F.asm | 4 +- scripts/VictoryRoad3F.asm | 8 +- scripts/ViridianGym.asm | 8 +- 53 files changed, 1310 insertions(+), 1301 deletions(-) delete mode 100644 constants/hide_show_constants.asm create mode 100644 constants/toggle_constants.asm delete mode 100644 data/maps/hide_show_data.asm create mode 100644 data/maps/toggleable_objects.asm delete mode 100644 engine/overworld/missable_objects.asm create mode 100644 engine/overworld/toggleable_objects.asm (limited to 'engine/movie') diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm deleted file mode 100644 index b73271e8..00000000 --- a/constants/hide_show_constants.asm +++ /dev/null @@ -1,240 +0,0 @@ -DEF HIDE EQU $11 -DEF SHOW EQU $15 - -; MissableObjects indexes (see data/maps/hide_show_data.asm) -; this is a list of the sprites that can be enabled/disabled during the game -; sprites marked with an X are constants that are never used -; because those sprites are not (de)activated in a map's script -; (they are either items or sprites that deactivate after battle -; and are detected in wMissableObjectList) - - const_def - const HS_PALLET_TOWN_OAK ; 00 - const HS_LYING_OLD_MAN ; 01 - const HS_OLD_MAN ; 02 - const HS_MUSEUM_GUY ; 03 - const HS_GYM_GUY ; 04 - const HS_CERULEAN_RIVAL ; 05 - const HS_CERULEAN_ROCKET ; 06 - const HS_CERULEAN_GUARD_1 ; 07 - const HS_CERULEAN_CAVE_GUY ; 08 - const HS_CERULEAN_GUARD_2 ; 09 - const HS_SAFFRON_CITY_1 ; 0A - const HS_SAFFRON_CITY_2 ; 0B - const HS_SAFFRON_CITY_3 ; 0C - const HS_SAFFRON_CITY_4 ; 0D - const HS_SAFFRON_CITY_5 ; 0E - const HS_SAFFRON_CITY_6 ; 0F - const HS_SAFFRON_CITY_7 ; 10 - const HS_SAFFRON_CITY_8 ; 11 - const HS_SAFFRON_CITY_9 ; 12 - const HS_SAFFRON_CITY_A ; 13 - const HS_SAFFRON_CITY_B ; 14 - const HS_SAFFRON_CITY_C ; 15 - const HS_SAFFRON_CITY_D ; 16 - const HS_SAFFRON_CITY_E ; 17 - const HS_SAFFRON_CITY_F ; 18 - const HS_ROUTE_2_ITEM_1 ; 19 X - const HS_ROUTE_2_ITEM_2 ; 1A X - const HS_ROUTE_4_ITEM ; 1B X - const HS_ROUTE_9_ITEM ; 1C X - const HS_ROUTE_12_SNORLAX ; 1D - const HS_ROUTE_12_ITEM_1 ; 1E X - const HS_ROUTE_12_ITEM_2 ; 1F X - const HS_ROUTE_15_ITEM ; 20 X - const HS_ROUTE_16_SNORLAX ; 21 - const HS_ROUTE_22_RIVAL_1 ; 22 - const HS_ROUTE_22_RIVAL_2 ; 23 - const HS_NUGGET_BRIDGE_GUY ; 24 - const HS_ROUTE_24_ITEM ; 25 X - const HS_ROUTE_25_ITEM ; 26 X - const HS_DAISY_SITTING ; 27 - const HS_DAISY_WALKING ; 28 - const HS_TOWN_MAP ; 29 - const HS_OAKS_LAB_RIVAL ; 2A - const HS_STARTER_BALL_1 ; 2B - const HS_STARTER_BALL_2 ; 2C - const HS_STARTER_BALL_3 ; 2D - const HS_OAKS_LAB_OAK_1 ; 2E - const HS_POKEDEX_1 ; 2F - const HS_POKEDEX_2 ; 30 - const HS_OAKS_LAB_OAK_2 ; 31 - const HS_VIRIDIAN_GYM_GIOVANNI ; 32 - const HS_VIRIDIAN_GYM_ITEM ; 33 X - const HS_OLD_AMBER ; 34 - const HS_CERULEAN_CAVE_1F_ITEM_1 ; 35 X - const HS_CERULEAN_CAVE_1F_ITEM_2 ; 36 X - const HS_CERULEAN_CAVE_1F_ITEM_3 ; 37 X - const HS_POKEMON_TOWER_2F_RIVAL ; 38 - const HS_POKEMON_TOWER_3F_ITEM ; 39 X - const HS_POKEMON_TOWER_4F_ITEM_1 ; 3A X - const HS_POKEMON_TOWER_4F_ITEM_2 ; 3B X - const HS_POKEMON_TOWER_4F_ITEM_3 ; 3C X - const HS_POKEMON_TOWER_5F_ITEM ; 3D X - const HS_POKEMON_TOWER_6F_ITEM_1 ; 3E X - const HS_POKEMON_TOWER_6F_ITEM_2 ; 3F X - const HS_POKEMON_TOWER_7F_ROCKET_1 ; 40 X - const HS_POKEMON_TOWER_7F_ROCKET_2 ; 41 X - const HS_POKEMON_TOWER_7F_ROCKET_3 ; 42 X - const HS_POKEMON_TOWER_7F_MR_FUJI ; 43 - const HS_MR_FUJIS_HOUSE_MR_FUJI ; 44 - const HS_CELADON_MANSION_EEVEE_GIFT ; 45 - const HS_GAME_CORNER_ROCKET ; 46 - const HS_WARDENS_HOUSE_ITEM ; 47 X - const HS_POKEMON_MANSION_1F_ITEM_1 ; 48 X - const HS_POKEMON_MANSION_1F_ITEM_2 ; 49 X - const HS_FIGHTING_DOJO_GIFT_1 ; 4A - const HS_FIGHTING_DOJO_GIFT_2 ; 4B - const HS_SILPH_CO_1F_RECEPTIONIST ; 4C - const HS_VOLTORB_1 ; 4D X - const HS_VOLTORB_2 ; 4E X - const HS_VOLTORB_3 ; 4F X - const HS_ELECTRODE_1 ; 50 X - const HS_VOLTORB_4 ; 51 X - const HS_VOLTORB_5 ; 52 X - const HS_ELECTRODE_2 ; 53 X - const HS_VOLTORB_6 ; 54 X - const HS_ZAPDOS ; 55 X - const HS_POWER_PLANT_ITEM_1 ; 56 X - const HS_POWER_PLANT_ITEM_2 ; 57 X - const HS_POWER_PLANT_ITEM_3 ; 58 X - const HS_POWER_PLANT_ITEM_4 ; 59 X - const HS_POWER_PLANT_ITEM_5 ; 5A X - const HS_MOLTRES ; 5B X - const HS_VICTORY_ROAD_2F_ITEM_1 ; 5C X - const HS_VICTORY_ROAD_2F_ITEM_2 ; 5D X - const HS_VICTORY_ROAD_2F_ITEM_3 ; 5E X - const HS_VICTORY_ROAD_2F_ITEM_4 ; 5F X - const HS_VICTORY_ROAD_2F_BOULDER ; 60 - const HS_BILL_POKEMON ; 61 - const HS_BILL_1 ; 62 - const HS_BILL_2 ; 63 - const HS_VIRIDIAN_FOREST_ITEM_1 ; 64 X - const HS_VIRIDIAN_FOREST_ITEM_2 ; 65 X - const HS_VIRIDIAN_FOREST_ITEM_3 ; 66 X - const HS_MT_MOON_1F_ITEM_1 ; 67 X - const HS_MT_MOON_1F_ITEM_2 ; 68 X - const HS_MT_MOON_1F_ITEM_3 ; 69 X - const HS_MT_MOON_1F_ITEM_4 ; 6A X - const HS_MT_MOON_1F_ITEM_5 ; 6B X - const HS_MT_MOON_1F_ITEM_6 ; 6C X - const HS_MT_MOON_B2F_FOSSIL_1 ; 6D - const HS_MT_MOON_B2F_FOSSIL_2 ; 6E - const HS_MT_MOON_B2F_ITEM_1 ; 6F X - const HS_MT_MOON_B2F_ITEM_2 ; 70 X - const HS_SS_ANNE_2F_RIVAL ; 71 - const HS_SS_ANNE_1F_ROOMS_ITEM ; 72 X - const HS_SS_ANNE_2F_ROOMS_ITEM_1 ; 73 X - const HS_SS_ANNE_2F_ROOMS_ITEM_2 ; 74 X - const HS_SS_ANNE_B1F_ROOMS_ITEM_1 ; 75 X - const HS_SS_ANNE_B1F_ROOMS_ITEM_2 ; 76 X - const HS_SS_ANNE_B1F_ROOMS_ITEM_3 ; 77 X - const HS_VICTORY_ROAD_3F_ITEM_1 ; 78 X - const HS_VICTORY_ROAD_3F_ITEM_2 ; 79 X - const HS_VICTORY_ROAD_3F_BOULDER ; 7A - const HS_ROCKET_HIDEOUT_B1F_ITEM_1 ; 7B X - const HS_ROCKET_HIDEOUT_B1F_ITEM_2 ; 7C X - const HS_ROCKET_HIDEOUT_B2F_ITEM_1 ; 7D X - const HS_ROCKET_HIDEOUT_B2F_ITEM_2 ; 7E X - const HS_ROCKET_HIDEOUT_B2F_ITEM_3 ; 7F X - const HS_ROCKET_HIDEOUT_B2F_ITEM_4 ; 80 X - const HS_ROCKET_HIDEOUT_B3F_ITEM_1 ; 81 X - const HS_ROCKET_HIDEOUT_B3F_ITEM_2 ; 82 X - const HS_ROCKET_HIDEOUT_B4F_GIOVANNI ; 83 - const HS_ROCKET_HIDEOUT_B4F_ITEM_1 ; 84 X - const HS_ROCKET_HIDEOUT_B4F_ITEM_2 ; 85 X - const HS_ROCKET_HIDEOUT_B4F_ITEM_3 ; 86 X - const HS_ROCKET_HIDEOUT_B4F_ITEM_4 ; 87 - const HS_ROCKET_HIDEOUT_B4F_ITEM_5 ; 88 - const HS_SILPH_CO_2F_1 ; 89 XXX never (de)activated? - const HS_SILPH_CO_2F_2 ; 8A - const HS_SILPH_CO_2F_3 ; 8B - const HS_SILPH_CO_2F_4 ; 8C - const HS_SILPH_CO_2F_5 ; 8D - const HS_SILPH_CO_3F_1 ; 8E - const HS_SILPH_CO_3F_2 ; 8F - const HS_SILPH_CO_3F_ITEM ; 90 X - const HS_SILPH_CO_4F_1 ; 91 - const HS_SILPH_CO_4F_2 ; 92 - const HS_SILPH_CO_4F_3 ; 93 - const HS_SILPH_CO_4F_ITEM_1 ; 94 X - const HS_SILPH_CO_4F_ITEM_2 ; 95 X - const HS_SILPH_CO_4F_ITEM_3 ; 96 X - const HS_SILPH_CO_5F_1 ; 97 - const HS_SILPH_CO_5F_2 ; 98 - const HS_SILPH_CO_5F_3 ; 99 - const HS_SILPH_CO_5F_4 ; 9A - const HS_SILPH_CO_5F_ITEM_1 ; 9B X - const HS_SILPH_CO_5F_ITEM_2 ; 9C X - const HS_SILPH_CO_5F_ITEM_3 ; 9D X - const HS_SILPH_CO_6F_1 ; 9E - const HS_SILPH_CO_6F_2 ; 9F - const HS_SILPH_CO_6F_3 ; A0 - const HS_SILPH_CO_6F_ITEM_1 ; A1 X - const HS_SILPH_CO_6F_ITEM_2 ; A2 X - const HS_SILPH_CO_7F_1 ; A3 - const HS_SILPH_CO_7F_2 ; A4 - const HS_SILPH_CO_7F_3 ; A5 - const HS_SILPH_CO_7F_4 ; A6 - const HS_SILPH_CO_7F_RIVAL ; A7 - const HS_SILPH_CO_7F_ITEM_1 ; A8 X - const HS_SILPH_CO_7F_ITEM_2 ; A9 X - const HS_SILPH_CO_7F_8 ; AA XXX sprite doesn't exist - const HS_SILPH_CO_8F_1 ; AB - const HS_SILPH_CO_8F_2 ; AC - const HS_SILPH_CO_8F_3 ; AD - const HS_SILPH_CO_9F_1 ; AE - const HS_SILPH_CO_9F_2 ; AF - const HS_SILPH_CO_9F_3 ; B0 - const HS_SILPH_CO_10F_1 ; B1 - const HS_SILPH_CO_10F_2 ; B2 - const HS_SILPH_CO_10F_3 ; B3 XXX never (de)activated? - const HS_SILPH_CO_10F_ITEM_1 ; B4 X - const HS_SILPH_CO_10F_ITEM_2 ; B5 X - const HS_SILPH_CO_10F_ITEM_3 ; B6 X - const HS_SILPH_CO_11F_1 ; B7 - const HS_SILPH_CO_11F_2 ; B8 - const HS_SILPH_CO_11F_3 ; B9 - const HS_UNUSED_MAP_F4_1 ; BA XXX sprite doesn't exist - const HS_POKEMON_MANSION_2F_ITEM ; BB X - const HS_POKEMON_MANSION_3F_ITEM_1 ; BC X - const HS_POKEMON_MANSION_3F_ITEM_2 ; BD X - const HS_POKEMON_MANSION_B1F_ITEM_1 ; BE X - const HS_POKEMON_MANSION_B1F_ITEM_2 ; BF X - const HS_POKEMON_MANSION_B1F_ITEM_3 ; C0 X - const HS_POKEMON_MANSION_B1F_ITEM_4 ; C1 X - const HS_POKEMON_MANSION_B1F_ITEM_5 ; C2 X - const HS_SAFARI_ZONE_EAST_ITEM_1 ; C3 X - const HS_SAFARI_ZONE_EAST_ITEM_2 ; C4 X - const HS_SAFARI_ZONE_EAST_ITEM_3 ; C5 X - const HS_SAFARI_ZONE_EAST_ITEM_4 ; C6 X - const HS_SAFARI_ZONE_NORTH_ITEM_1 ; C7 X - const HS_SAFARI_ZONE_NORTH_ITEM_2 ; C8 X - const HS_SAFARI_ZONE_WEST_ITEM_1 ; C9 X - const HS_SAFARI_ZONE_WEST_ITEM_2 ; CA X - const HS_SAFARI_ZONE_WEST_ITEM_3 ; CB X - const HS_SAFARI_ZONE_WEST_ITEM_4 ; CC X - const HS_SAFARI_ZONE_CENTER_ITEM ; CD X - const HS_CERULEAN_CAVE_2F_ITEM_1 ; CE X - const HS_CERULEAN_CAVE_2F_ITEM_2 ; CF X - const HS_CERULEAN_CAVE_2F_ITEM_3 ; D0 X - const HS_MEWTWO ; D1 X - const HS_CERULEAN_CAVE_B1F_ITEM_1 ; D2 X - const HS_CERULEAN_CAVE_B1F_ITEM_2 ; D3 X - const HS_VICTORY_ROAD_1F_ITEM_1 ; D4 X - const HS_VICTORY_ROAD_1F_ITEM_2 ; D5 X - const HS_CHAMPIONS_ROOM_OAK ; D6 - const HS_SEAFOAM_ISLANDS_1F_BOULDER_1 ; D7 - const HS_SEAFOAM_ISLANDS_1F_BOULDER_2 ; D8 - const HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ; D9 - const HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ; DA - const HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ; DB - const HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ; DC - const HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 ; DD - const HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 ; DE - const HS_SEAFOAM_ISLANDS_B3F_BOULDER_3 ; DF - const HS_SEAFOAM_ISLANDS_B3F_BOULDER_4 ; E0 - const HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 ; E1 - const HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 ; E2 - const HS_ARTICUNO ; E3 X -DEF NUM_HS_OBJECTS EQU const_value diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 7ae4af44..fe0bd9f5 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -16,7 +16,7 @@ ENDM ; - MapHeaderBanks (see data/maps/map_header_banks.asm) ; - MapHeaderPointers (see data/maps/map_header_pointers.asm) ; - MapSongBanks (see data/maps/songs.asm) -; - MapHSPointers (see data/maps/hide_show_data.asm) +; - ToggleableObjectMapPointers (see data/maps/toggleable_objects.asm) ; - MapSpriteSets (see data/maps/sprite_sets.asm) ; - ExternalMapEntries (see data/maps/town_map_entries.asm) ; - WildDataPointers (see data/wild/grass_water.asm) diff --git a/constants/toggle_constants.asm b/constants/toggle_constants.asm new file mode 100644 index 00000000..701bc2b4 --- /dev/null +++ b/constants/toggle_constants.asm @@ -0,0 +1,393 @@ +DEF OFF EQU $11 +DEF ON EQU $15 + +MACRO toggle_consts_for + DEF TOGGLEMAP{\1} EQU const_value +ENDM + +; ToggleableObjectStates indexes (see data/maps/toggleable_objects.asm) +; This lists the object_events that can be toggled by ShowObject/HideObject. +; The constants marked with an X are never used, because those object_events +; are not toggled on/off in any map's script. +; (The X-ed ones are either items or static Pokemon encounters that deactivate +; after battle and are detected in wToggleableObjectList.) + + const_def + + toggle_consts_for PALLET_TOWN + const TOGGLE_PALLET_TOWN_OAK ; 00 + + toggle_consts_for VIRIDIAN_CITY + const TOGGLE_LYING_OLD_MAN ; 01 + const TOGGLE_OLD_MAN ; 02 + + toggle_consts_for PEWTER_CITY + const TOGGLE_MUSEUM_GUY ; 03 + const TOGGLE_GYM_GUY ; 04 + + toggle_consts_for CERULEAN_CITY + const TOGGLE_CERULEAN_RIVAL ; 05 + const TOGGLE_CERULEAN_ROCKET ; 06 + const TOGGLE_CERULEAN_GUARD_1 ; 07 + const TOGGLE_CERULEAN_CAVE_GUY ; 08 + const TOGGLE_CERULEAN_GUARD_2 ; 09 + + toggle_consts_for SAFFRON_CITY + const TOGGLE_SAFFRON_CITY_1 ; 0A + const TOGGLE_SAFFRON_CITY_2 ; 0B + const TOGGLE_SAFFRON_CITY_3 ; 0C + const TOGGLE_SAFFRON_CITY_4 ; 0D + const TOGGLE_SAFFRON_CITY_5 ; 0E + const TOGGLE_SAFFRON_CITY_6 ; 0F + const TOGGLE_SAFFRON_CITY_7 ; 10 + const TOGGLE_SAFFRON_CITY_8 ; 11 + const TOGGLE_SAFFRON_CITY_9 ; 12 + const TOGGLE_SAFFRON_CITY_A ; 13 + const TOGGLE_SAFFRON_CITY_B ; 14 + const TOGGLE_SAFFRON_CITY_C ; 15 + const TOGGLE_SAFFRON_CITY_D ; 16 + const TOGGLE_SAFFRON_CITY_E ; 17 + const TOGGLE_SAFFRON_CITY_F ; 18 + + toggle_consts_for ROUTE_2 + const TOGGLE_ROUTE_2_ITEM_1 ; 19 X + const TOGGLE_ROUTE_2_ITEM_2 ; 1A X + + toggle_consts_for ROUTE_4 + const TOGGLE_ROUTE_4_ITEM ; 1B X + + toggle_consts_for ROUTE_9 + const TOGGLE_ROUTE_9_ITEM ; 1C X + + toggle_consts_for ROUTE_12 + const TOGGLE_ROUTE_12_SNORLAX ; 1D + const TOGGLE_ROUTE_12_ITEM_1 ; 1E X + const TOGGLE_ROUTE_12_ITEM_2 ; 1F X + + toggle_consts_for ROUTE_15 + const TOGGLE_ROUTE_15_ITEM ; 20 X + + toggle_consts_for ROUTE_16 + const TOGGLE_ROUTE_16_SNORLAX ; 21 + + toggle_consts_for ROUTE_22 + const TOGGLE_ROUTE_22_RIVAL_1 ; 22 + const TOGGLE_ROUTE_22_RIVAL_2 ; 23 + + toggle_consts_for ROUTE_24 + const TOGGLE_NUGGET_BRIDGE_GUY ; 24 + const TOGGLE_ROUTE_24_ITEM ; 25 X + + toggle_consts_for ROUTE_25 + const TOGGLE_ROUTE_25_ITEM ; 26 X + + toggle_consts_for BLUES_HOUSE + const TOGGLE_DAISY_SITTING ; 27 + const TOGGLE_DAISY_WALKING ; 28 + const TOGGLE_TOWN_MAP ; 29 + + toggle_consts_for OAKS_LAB + const TOGGLE_OAKS_LAB_RIVAL ; 2A + const TOGGLE_STARTER_BALL_1 ; 2B + const TOGGLE_STARTER_BALL_2 ; 2C + const TOGGLE_STARTER_BALL_3 ; 2D + const TOGGLE_OAKS_LAB_OAK_1 ; 2E + const TOGGLE_POKEDEX_1 ; 2F + const TOGGLE_POKEDEX_2 ; 30 + const TOGGLE_OAKS_LAB_OAK_2 ; 31 + + toggle_consts_for VIRIDIAN_GYM + const TOGGLE_VIRIDIAN_GYM_GIOVANNI ; 32 + const TOGGLE_VIRIDIAN_GYM_ITEM ; 33 X + + toggle_consts_for MUSEUM_1F + const TOGGLE_OLD_AMBER ; 34 + + toggle_consts_for CERULEAN_CAVE_1F + const TOGGLE_CERULEAN_CAVE_1F_ITEM_1 ; 35 X + const TOGGLE_CERULEAN_CAVE_1F_ITEM_2 ; 36 X + const TOGGLE_CERULEAN_CAVE_1F_ITEM_3 ; 37 X + + toggle_consts_for POKEMON_TOWER_2F + const TOGGLE_POKEMON_TOWER_2F_RIVAL ; 38 + + toggle_consts_for POKEMON_TOWER_3F + const TOGGLE_POKEMON_TOWER_3F_ITEM ; 39 X + + toggle_consts_for POKEMON_TOWER_4F + const TOGGLE_POKEMON_TOWER_4F_ITEM_1 ; 3A X + const TOGGLE_POKEMON_TOWER_4F_ITEM_2 ; 3B X + const TOGGLE_POKEMON_TOWER_4F_ITEM_3 ; 3C X + + toggle_consts_for POKEMON_TOWER_5F + const TOGGLE_POKEMON_TOWER_5F_ITEM ; 3D X + + toggle_consts_for POKEMON_TOWER_6F + const TOGGLE_POKEMON_TOWER_6F_ITEM_1 ; 3E X + const TOGGLE_POKEMON_TOWER_6F_ITEM_2 ; 3F X + + toggle_consts_for POKEMON_TOWER_7F + const TOGGLE_POKEMON_TOWER_7F_ROCKET_1 ; 40 X + const TOGGLE_POKEMON_TOWER_7F_ROCKET_2 ; 41 X + const TOGGLE_POKEMON_TOWER_7F_ROCKET_3 ; 42 X + const TOGGLE_POKEMON_TOWER_7F_MR_FUJI ; 43 + + toggle_consts_for MR_FUJIS_HOUSE + const TOGGLE_MR_FUJIS_HOUSE_MR_FUJI ; 44 + + toggle_consts_for CELADON_MANSION_ROOF_HOUSE + const TOGGLE_CELADON_MANSION_EEVEE_GIFT ; 45 + + toggle_consts_for GAME_CORNER + const TOGGLE_GAME_CORNER_ROCKET ; 46 + + toggle_consts_for WARDENS_HOUSE + const TOGGLE_WARDENS_HOUSE_ITEM ; 47 X + + toggle_consts_for POKEMON_MANSION_1F + const TOGGLE_POKEMON_MANSION_1F_ITEM_1 ; 48 X + const TOGGLE_POKEMON_MANSION_1F_ITEM_2 ; 49 X + + toggle_consts_for FIGHTING_DOJO + const TOGGLE_FIGHTING_DOJO_GIFT_1 ; 4A + const TOGGLE_FIGHTING_DOJO_GIFT_2 ; 4B + + toggle_consts_for SILPH_CO_1F + const TOGGLE_SILPH_CO_1F_RECEPTIONIST ; 4C + + toggle_consts_for POWER_PLANT + const TOGGLE_VOLTORB_1 ; 4D X + const TOGGLE_VOLTORB_2 ; 4E X + const TOGGLE_VOLTORB_3 ; 4F X + const TOGGLE_ELECTRODE_1 ; 50 X + const TOGGLE_VOLTORB_4 ; 51 X + const TOGGLE_VOLTORB_5 ; 52 X + const TOGGLE_ELECTRODE_2 ; 53 X + const TOGGLE_VOLTORB_6 ; 54 X + const TOGGLE_ZAPDOS ; 55 X + const TOGGLE_POWER_PLANT_ITEM_1 ; 56 X + const TOGGLE_POWER_PLANT_ITEM_2 ; 57 X + const TOGGLE_POWER_PLANT_ITEM_3 ; 58 X + const TOGGLE_POWER_PLANT_ITEM_4 ; 59 X + const TOGGLE_POWER_PLANT_ITEM_5 ; 5A X + + toggle_consts_for VICTORY_ROAD_2F + const TOGGLE_MOLTRES ; 5B X + const TOGGLE_VICTORY_ROAD_2F_ITEM_1 ; 5C X + const TOGGLE_VICTORY_ROAD_2F_ITEM_2 ; 5D X + const TOGGLE_VICTORY_ROAD_2F_ITEM_3 ; 5E X + const TOGGLE_VICTORY_ROAD_2F_ITEM_4 ; 5F X + const TOGGLE_VICTORY_ROAD_2F_BOULDER ; 60 + + toggle_consts_for BILLS_HOUSE + const TOGGLE_BILL_POKEMON ; 61 + const TOGGLE_BILL_1 ; 62 + const TOGGLE_BILL_2 ; 63 + + toggle_consts_for VIRIDIAN_FOREST + const TOGGLE_VIRIDIAN_FOREST_ITEM_1 ; 64 X + const TOGGLE_VIRIDIAN_FOREST_ITEM_2 ; 65 X + const TOGGLE_VIRIDIAN_FOREST_ITEM_3 ; 66 X + + toggle_consts_for MT_MOON_1F + const TOGGLE_MT_MOON_1F_ITEM_1 ; 67 X + const TOGGLE_MT_MOON_1F_ITEM_2 ; 68 X + const TOGGLE_MT_MOON_1F_ITEM_3 ; 69 X + const TOGGLE_MT_MOON_1F_ITEM_4 ; 6A X + const TOGGLE_MT_MOON_1F_ITEM_5 ; 6B X + const TOGGLE_MT_MOON_1F_ITEM_6 ; 6C X + + toggle_consts_for MT_MOON_B2F + const TOGGLE_MT_MOON_B2F_FOSSIL_1 ; 6D + const TOGGLE_MT_MOON_B2F_FOSSIL_2 ; 6E + const TOGGLE_MT_MOON_B2F_ITEM_1 ; 6F X + const TOGGLE_MT_MOON_B2F_ITEM_2 ; 70 X + + toggle_consts_for SS_ANNE_2F + const TOGGLE_SS_ANNE_2F_RIVAL ; 71 + + toggle_consts_for SS_ANNE_1F_ROOMS + const TOGGLE_SS_ANNE_1F_ROOMS_ITEM ; 72 X + + toggle_consts_for SS_ANNE_2F_ROOMS + const TOGGLE_SS_ANNE_2F_ROOMS_ITEM_1 ; 73 X + const TOGGLE_SS_ANNE_2F_ROOMS_ITEM_2 ; 74 X + + toggle_consts_for SS_ANNE_B1F_ROOMS + const TOGGLE_SS_ANNE_B1F_ROOMS_ITEM_1 ; 75 X + const TOGGLE_SS_ANNE_B1F_ROOMS_ITEM_2 ; 76 X + const TOGGLE_SS_ANNE_B1F_ROOMS_ITEM_3 ; 77 X + + toggle_consts_for VICTORY_ROAD_3F + const TOGGLE_VICTORY_ROAD_3F_ITEM_1 ; 78 X + const TOGGLE_VICTORY_ROAD_3F_ITEM_2 ; 79 X + const TOGGLE_VICTORY_ROAD_3F_BOULDER ; 7A + + toggle_consts_for ROCKET_HIDEOUT_B1F + const TOGGLE_ROCKET_HIDEOUT_B1F_ITEM_1 ; 7B X + const TOGGLE_ROCKET_HIDEOUT_B1F_ITEM_2 ; 7C X + + toggle_consts_for ROCKET_HIDEOUT_B2F + const TOGGLE_ROCKET_HIDEOUT_B2F_ITEM_1 ; 7D X + const TOGGLE_ROCKET_HIDEOUT_B2F_ITEM_2 ; 7E X + const TOGGLE_ROCKET_HIDEOUT_B2F_ITEM_3 ; 7F X + const TOGGLE_ROCKET_HIDEOUT_B2F_ITEM_4 ; 80 X + + toggle_consts_for ROCKET_HIDEOUT_B3F + const TOGGLE_ROCKET_HIDEOUT_B3F_ITEM_1 ; 81 X + const TOGGLE_ROCKET_HIDEOUT_B3F_ITEM_2 ; 82 X + + toggle_consts_for ROCKET_HIDEOUT_B4F + const TOGGLE_ROCKET_HIDEOUT_B4F_GIOVANNI ; 83 + const TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_1 ; 84 X + const TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_2 ; 85 X + const TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_3 ; 86 X + const TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_4 ; 87 + const TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_5 ; 88 + + toggle_consts_for SILPH_CO_2F + const TOGGLE_SILPH_CO_2F_1 ; 89 XXX never (de)activated? + const TOGGLE_SILPH_CO_2F_2 ; 8A + const TOGGLE_SILPH_CO_2F_3 ; 8B + const TOGGLE_SILPH_CO_2F_4 ; 8C + const TOGGLE_SILPH_CO_2F_5 ; 8D + + toggle_consts_for SILPH_CO_3F + const TOGGLE_SILPH_CO_3F_1 ; 8E + const TOGGLE_SILPH_CO_3F_2 ; 8F + const TOGGLE_SILPH_CO_3F_ITEM ; 90 X + + toggle_consts_for SILPH_CO_4F + const TOGGLE_SILPH_CO_4F_1 ; 91 + const TOGGLE_SILPH_CO_4F_2 ; 92 + const TOGGLE_SILPH_CO_4F_3 ; 93 + const TOGGLE_SILPH_CO_4F_ITEM_1 ; 94 X + const TOGGLE_SILPH_CO_4F_ITEM_2 ; 95 X + const TOGGLE_SILPH_CO_4F_ITEM_3 ; 96 X + + toggle_consts_for SILPH_CO_5F + const TOGGLE_SILPH_CO_5F_1 ; 97 + const TOGGLE_SILPH_CO_5F_2 ; 98 + const TOGGLE_SILPH_CO_5F_3 ; 99 + const TOGGLE_SILPH_CO_5F_4 ; 9A + const TOGGLE_SILPH_CO_5F_ITEM_1 ; 9B X + const TOGGLE_SILPH_CO_5F_ITEM_2 ; 9C X + const TOGGLE_SILPH_CO_5F_ITEM_3 ; 9D X + + toggle_consts_for SILPH_CO_6F + const TOGGLE_SILPH_CO_6F_1 ; 9E + const TOGGLE_SILPH_CO_6F_2 ; 9F + const TOGGLE_SILPH_CO_6F_3 ; A0 + const TOGGLE_SILPH_CO_6F_ITEM_1 ; A1 X + const TOGGLE_SILPH_CO_6F_ITEM_2 ; A2 X + + toggle_consts_for SILPH_CO_7F + const TOGGLE_SILPH_CO_7F_1 ; A3 + const TOGGLE_SILPH_CO_7F_2 ; A4 + const TOGGLE_SILPH_CO_7F_3 ; A5 + const TOGGLE_SILPH_CO_7F_4 ; A6 + const TOGGLE_SILPH_CO_7F_RIVAL ; A7 + const TOGGLE_SILPH_CO_7F_ITEM_1 ; A8 X + const TOGGLE_SILPH_CO_7F_ITEM_2 ; A9 X + const TOGGLE_SILPH_CO_7F_8 ; AA XXX sprite doesn't exist + + toggle_consts_for SILPH_CO_8F + const TOGGLE_SILPH_CO_8F_1 ; AB + const TOGGLE_SILPH_CO_8F_2 ; AC + const TOGGLE_SILPH_CO_8F_3 ; AD + + toggle_consts_for SILPH_CO_9F + const TOGGLE_SILPH_CO_9F_1 ; AE + const TOGGLE_SILPH_CO_9F_2 ; AF + const TOGGLE_SILPH_CO_9F_3 ; B0 + + toggle_consts_for SILPH_CO_10F + const TOGGLE_SILPH_CO_10F_1 ; B1 + const TOGGLE_SILPH_CO_10F_2 ; B2 + const TOGGLE_SILPH_CO_10F_3 ; B3 XXX never (de)activated? + const TOGGLE_SILPH_CO_10F_ITEM_1 ; B4 X + const TOGGLE_SILPH_CO_10F_ITEM_2 ; B5 X + const TOGGLE_SILPH_CO_10F_ITEM_3 ; B6 X + + toggle_consts_for SILPH_CO_11F + const TOGGLE_SILPH_CO_11F_1 ; B7 + const TOGGLE_SILPH_CO_11F_2 ; B8 + const TOGGLE_SILPH_CO_11F_3 ; B9 + + toggle_consts_for UNUSED_MAP_F4 + const TOGGLE_UNUSED_MAP_F4_1 ; BA XXX sprite doesn't exist + + toggle_consts_for POKEMON_MANSION_2F + const TOGGLE_POKEMON_MANSION_2F_ITEM ; BB X + + toggle_consts_for POKEMON_MANSION_3F + const TOGGLE_POKEMON_MANSION_3F_ITEM_1 ; BC X + const TOGGLE_POKEMON_MANSION_3F_ITEM_2 ; BD X + + toggle_consts_for POKEMON_MANSION_B1F + const TOGGLE_POKEMON_MANSION_B1F_ITEM_1 ; BE X + const TOGGLE_POKEMON_MANSION_B1F_ITEM_2 ; BF X + const TOGGLE_POKEMON_MANSION_B1F_ITEM_3 ; C0 X + const TOGGLE_POKEMON_MANSION_B1F_ITEM_4 ; C1 X + const TOGGLE_POKEMON_MANSION_B1F_ITEM_5 ; C2 X + + toggle_consts_for SAFARI_ZONE_EAST + const TOGGLE_SAFARI_ZONE_EAST_ITEM_1 ; C3 X + const TOGGLE_SAFARI_ZONE_EAST_ITEM_2 ; C4 X + const TOGGLE_SAFARI_ZONE_EAST_ITEM_3 ; C5 X + const TOGGLE_SAFARI_ZONE_EAST_ITEM_4 ; C6 X + + toggle_consts_for SAFARI_ZONE_NORTH + const TOGGLE_SAFARI_ZONE_NORTH_ITEM_1 ; C7 X + const TOGGLE_SAFARI_ZONE_NORTH_ITEM_2 ; C8 X + + toggle_consts_for SAFARI_ZONE_WEST + const TOGGLE_SAFARI_ZONE_WEST_ITEM_1 ; C9 X + const TOGGLE_SAFARI_ZONE_WEST_ITEM_2 ; CA X + const TOGGLE_SAFARI_ZONE_WEST_ITEM_3 ; CB X + const TOGGLE_SAFARI_ZONE_WEST_ITEM_4 ; CC X + + toggle_consts_for SAFARI_ZONE_CENTER + const TOGGLE_SAFARI_ZONE_CENTER_ITEM ; CD X + + toggle_consts_for CERULEAN_CAVE_2F + const TOGGLE_CERULEAN_CAVE_2F_ITEM_1 ; CE X + const TOGGLE_CERULEAN_CAVE_2F_ITEM_2 ; CF X + const TOGGLE_CERULEAN_CAVE_2F_ITEM_3 ; D0 X + + toggle_consts_for CERULEAN_CAVE_B1F + const TOGGLE_MEWTWO ; D1 X + const TOGGLE_CERULEAN_CAVE_B1F_ITEM_1 ; D2 X + const TOGGLE_CERULEAN_CAVE_B1F_ITEM_2 ; D3 X + + toggle_consts_for VICTORY_ROAD_1F + const TOGGLE_VICTORY_ROAD_1F_ITEM_1 ; D4 X + const TOGGLE_VICTORY_ROAD_1F_ITEM_2 ; D5 X + + toggle_consts_for CHAMPIONS_ROOM + const TOGGLE_CHAMPIONS_ROOM_OAK ; D6 + + toggle_consts_for SEAFOAM_ISLANDS_1F + const TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_1 ; D7 + const TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_2 ; D8 + + toggle_consts_for SEAFOAM_ISLANDS_B1F + const TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_1 ; D9 + const TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_2 ; DA + + toggle_consts_for SEAFOAM_ISLANDS_B2F + const TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_1 ; DB + const TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_2 ; DC + + toggle_consts_for SEAFOAM_ISLANDS_B3F + const TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_1 ; DD + const TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_2 ; DE + const TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_3 ; DF + const TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_4 ; E0 + + toggle_consts_for SEAFOAM_ISLANDS_B4F + const TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_1 ; E1 + const TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_2 ; E2 + const TOGGLE_ARTICUNO ; E3 X + +DEF NUM_TOGGLEABLE_OBJECTS EQU const_value diff --git a/data/maps/hide_show_data.asm b/data/maps/hide_show_data.asm deleted file mode 100644 index bc68c90f..00000000 --- a/data/maps/hide_show_data.asm +++ /dev/null @@ -1,568 +0,0 @@ -; default hidden/shown objects for each map - -MapHSPointers: -; entries correspond to map ids - table_width 2 - dw PalletTownHS - dw ViridianCityHS - dw PewterCityHS - dw CeruleanCityHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SaffronCityHS - dw NoHS - dw NoHS - dw Route2HS - dw NoHS - dw Route4HS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw Route9HS - dw NoHS - dw NoHS - dw Route12HS - dw NoHS - dw NoHS - dw Route15HS - dw Route16HS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw Route22HS - dw NoHS - dw Route24HS - dw Route25HS - dw NoHS - dw NoHS - dw BluesHouseHS - dw OaksLabHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw ViridianGymHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw ViridianForestHS - dw Museum1FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw MtMoon1FHS - dw NoHS - dw MtMoonB2FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw PowerPlantHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw BillsHouseHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SSAnne2FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SSAnne1FRoomsHS - dw SSAnne2FRoomsHS - dw SSAnneB1FRoomsHS - dw NoHS - dw NoHS - dw NoHS - dw VictoryRoad1FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw ChampionsRoomHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw CeladonMansionRoofHouseHS - dw NoHS - dw NoHS - dw GameCornerHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw PokemonTower2FHS - dw PokemonTower3FHS - dw PokemonTower4FHS - dw PokemonTower5FHS - dw PokemonTower6FHS - dw PokemonTower7FHS - dw MrFujisHouseHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw WardensHouseHS - dw NoHS - dw NoHS - dw NoHS - dw SeafoamIslandsB1FHS - dw SeafoamIslandsB2FHS - dw SeafoamIslandsB3FHS - dw SeafoamIslandsB4FHS - dw NoHS - dw NoHS - dw PokemonMansion1FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw FightingDojoHS - dw NoHS - dw NoHS - dw NoHS - dw SilphCo1FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SeafoamIslands1FHS - dw NoHS - dw VictoryRoad2FHS - dw NoHS - dw NoHS - dw NoHS - dw VictoryRoad3FHS - dw RocketHideoutB1FHS - dw RocketHideoutB2FHS - dw RocketHideoutB3FHS - dw RocketHideoutB4FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SilphCo2FHS - dw SilphCo3FHS - dw SilphCo4FHS - dw SilphCo5FHS - dw SilphCo6FHS - dw SilphCo7FHS - dw SilphCo8FHS - dw PokemonMansion2FHS - dw PokemonMansion3FHS - dw PokemonMansionB1FHS - dw SafariZoneEastHS - dw SafariZoneNorthHS - dw SafariZoneWestHS - dw SafariZoneCenterHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw CeruleanCave2FHS - dw CeruleanCaveB1FHS - dw CeruleanCaveHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw SilphCo9FHS - dw SilphCo10FHS - dw SilphCo11FHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw NoHS - dw UnusedMapF4HS - dw NoHS - dw NoHS - dw NoHS - assert_table_length NUM_MAPS - dw -1 ; end - -NoHS: - db -1, -1, -1 ; end - -MissableObjects: -; entries correspond to HS_* constants (see constants/hide_show_constants) - table_width 3 -; format: map id, object id, HIDE/SHOW - -PalletTownHS: - db PALLET_TOWN, PALLETTOWN_OAK, HIDE -ViridianCityHS: - db VIRIDIAN_CITY, VIRIDIANCITY_OLD_MAN_SLEEPY, SHOW - db VIRIDIAN_CITY, VIRIDIANCITY_OLD_MAN, HIDE -PewterCityHS: - db PEWTER_CITY, PEWTERCITY_SUPER_NERD1, SHOW - db PEWTER_CITY, PEWTERCITY_YOUNGSTER, SHOW -CeruleanCityHS: - db CERULEAN_CITY, CERULEANCITY_RIVAL, HIDE - db CERULEAN_CITY, CERULEANCITY_ROCKET, SHOW - db CERULEAN_CITY, CERULEANCITY_GUARD1, HIDE - db CERULEAN_CITY, CERULEANCITY_SUPER_NERD3, SHOW - db CERULEAN_CITY, CERULEANCITY_GUARD2, SHOW -SaffronCityHS: - db SAFFRON_CITY, SAFFRONCITY_ROCKET1, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET2, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET3, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET4, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET5, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET6, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET7, SHOW - db SAFFRON_CITY, SAFFRONCITY_SCIENTIST, HIDE - db SAFFRON_CITY, SAFFRONCITY_SILPH_WORKER_M, HIDE - db SAFFRON_CITY, SAFFRONCITY_SILPH_WORKER_F, HIDE - db SAFFRON_CITY, SAFFRONCITY_GENTLEMAN, HIDE - db SAFFRON_CITY, SAFFRONCITY_PIDGEOT, HIDE - db SAFFRON_CITY, SAFFRONCITY_ROCKER, HIDE - db SAFFRON_CITY, SAFFRONCITY_ROCKET8, SHOW - db SAFFRON_CITY, SAFFRONCITY_ROCKET9, HIDE -Route2HS: - db ROUTE_2, ROUTE2_MOON_STONE, SHOW - db ROUTE_2, ROUTE2_HP_UP, SHOW -Route4HS: - db ROUTE_4, ROUTE4_TM_WHIRLWIND, SHOW -Route9HS: - db ROUTE_9, ROUTE9_TM_TELEPORT, SHOW -Route12HS: - db ROUTE_12, ROUTE12_SNORLAX, SHOW - db ROUTE_12, ROUTE12_TM_PAY_DAY, SHOW - db ROUTE_12, ROUTE12_IRON, SHOW -Route15HS: - db ROUTE_15, ROUTE15_TM_RAGE, SHOW -Route16HS: - db ROUTE_16, ROUTE16_SNORLAX, SHOW -Route22HS: - db ROUTE_22, ROUTE22_RIVAL1, HIDE - db ROUTE_22, ROUTE22_RIVAL2, HIDE -Route24HS: - db ROUTE_24, ROUTE24_COOLTRAINER_M1, SHOW - db ROUTE_24, ROUTE24_TM_THUNDER_WAVE, SHOW -Route25HS: - db ROUTE_25, ROUTE25_TM_SEISMIC_TOSS, SHOW -BluesHouseHS: - db BLUES_HOUSE, BLUESHOUSE_DAISY1, SHOW - db BLUES_HOUSE, BLUESHOUSE_DAISY2, HIDE - db BLUES_HOUSE, BLUESHOUSE_TOWN_MAP, SHOW -OaksLabHS: - db OAKS_LAB, OAKSLAB_RIVAL, SHOW - db OAKS_LAB, OAKSLAB_CHARMANDER_POKE_BALL, SHOW - db OAKS_LAB, OAKSLAB_SQUIRTLE_POKE_BALL, SHOW - db OAKS_LAB, OAKSLAB_BULBASAUR_POKE_BALL, SHOW - db OAKS_LAB, OAKSLAB_OAK1, HIDE - db OAKS_LAB, OAKSLAB_POKEDEX1, SHOW - db OAKS_LAB, OAKSLAB_POKEDEX2, SHOW - db OAKS_LAB, OAKSLAB_OAK2, HIDE -ViridianGymHS: - db VIRIDIAN_GYM, VIRIDIANGYM_GIOVANNI, SHOW - db VIRIDIAN_GYM, VIRIDIANGYM_REVIVE, SHOW -Museum1FHS: - db MUSEUM_1F, MUSEUM1F_OLD_AMBER, SHOW -CeruleanCaveHS: - db CERULEAN_CAVE_1F, CERULEANCAVE1F_FULL_RESTORE, SHOW - db CERULEAN_CAVE_1F, CERULEANCAVE1F_MAX_ELIXER, SHOW - db CERULEAN_CAVE_1F, CERULEANCAVE1F_NUGGET, SHOW -PokemonTower2FHS: - db POKEMON_TOWER_2F, POKEMONTOWER2F_RIVAL, SHOW -PokemonTower3FHS: - db POKEMON_TOWER_3F, POKEMONTOWER3F_ESCAPE_ROPE, SHOW -PokemonTower4FHS: - db POKEMON_TOWER_4F, POKEMONTOWER4F_ELIXER, SHOW - db POKEMON_TOWER_4F, POKEMONTOWER4F_AWAKENING, SHOW - db POKEMON_TOWER_4F, POKEMONTOWER4F_HP_UP, SHOW -PokemonTower5FHS: - db POKEMON_TOWER_5F, POKEMONTOWER5F_NUGGET, SHOW -PokemonTower6FHS: - db POKEMON_TOWER_6F, POKEMONTOWER6F_RARE_CANDY, SHOW - db POKEMON_TOWER_6F, POKEMONTOWER6F_X_ACCURACY, SHOW -PokemonTower7FHS: - db POKEMON_TOWER_7F, POKEMONTOWER7F_ROCKET1, SHOW - db POKEMON_TOWER_7F, POKEMONTOWER7F_ROCKET2, SHOW - db POKEMON_TOWER_7F, POKEMONTOWER7F_ROCKET3, SHOW - db POKEMON_TOWER_7F, POKEMONTOWER7F_MR_FUJI, SHOW -MrFujisHouseHS: - db MR_FUJIS_HOUSE, MRFUJISHOUSE_MR_FUJI, HIDE -CeladonMansionRoofHouseHS: - db CELADON_MANSION_ROOF_HOUSE, CELADONMANSION_ROOF_HOUSE_EEVEE_POKEBALL, SHOW -GameCornerHS: - db GAME_CORNER, GAMECORNER_ROCKET, SHOW -WardensHouseHS: - db WARDENS_HOUSE, WARDENSHOUSE_RARE_CANDY, SHOW -PokemonMansion1FHS: - db POKEMON_MANSION_1F, POKEMONMANSION1F_ESCAPE_ROPE, SHOW - db POKEMON_MANSION_1F, POKEMONMANSION1F_CARBOS, SHOW -FightingDojoHS: - db FIGHTING_DOJO, FIGHTINGDOJO_HITMONLEE_POKE_BALL, SHOW - db FIGHTING_DOJO, FIGHTINGDOJO_HITMONCHAN_POKE_BALL, SHOW -SilphCo1FHS: - db SILPH_CO_1F, SILPHCO1F_LINK_RECEPTIONIST, HIDE -PowerPlantHS: - db POWER_PLANT, POWERPLANT_VOLTORB1, SHOW - db POWER_PLANT, POWERPLANT_VOLTORB2, SHOW - db POWER_PLANT, POWERPLANT_VOLTORB3, SHOW - db POWER_PLANT, POWERPLANT_ELECTRODE1, SHOW - db POWER_PLANT, POWERPLANT_VOLTORB4, SHOW - db POWER_PLANT, POWERPLANT_VOLTORB5, SHOW - db POWER_PLANT, POWERPLANT_ELECTRODE2, SHOW - db POWER_PLANT, POWERPLANT_VOLTORB6, SHOW - db POWER_PLANT, POWERPLANT_ZAPDOS, SHOW - db POWER_PLANT, POWERPLANT_CARBOS, SHOW - db POWER_PLANT, POWERPLANT_HP_UP, SHOW - db POWER_PLANT, POWERPLANT_RARE_CANDY, SHOW - db POWER_PLANT, POWERPLANT_TM_THUNDER, SHOW - db POWER_PLANT, POWERPLANT_TM_REFLECT, SHOW -VictoryRoad2FHS: - db VICTORY_ROAD_2F, VICTORYROAD2F_MOLTRES, SHOW - db VICTORY_ROAD_2F, VICTORYROAD2F_TM_SUBMISSION, SHOW - db VICTORY_ROAD_2F, VICTORYROAD2F_FULL_HEAL, SHOW - db VICTORY_ROAD_2F, VICTORYROAD2F_TM_MEGA_KICK, SHOW - db VICTORY_ROAD_2F, VICTORYROAD2F_GUARD_SPEC, SHOW - db VICTORY_ROAD_2F, VICTORYROAD2F_BOULDER3, SHOW -BillsHouseHS: - db BILLS_HOUSE, BILLSHOUSE_BILL_POKEMON, SHOW - db BILLS_HOUSE, BILLSHOUSE_BILL1, HIDE - db BILLS_HOUSE, BILLSHOUSE_BILL2, HIDE -ViridianForestHS: - db VIRIDIAN_FOREST, VIRIDIANFOREST_ANTIDOTE, SHOW - db VIRIDIAN_FOREST, VIRIDIANFOREST_POTION, SHOW - db VIRIDIAN_FOREST, VIRIDIANFOREST_POKE_BALL, SHOW -MtMoon1FHS: - db MT_MOON_1F, MTMOON1F_POTION1, SHOW - db MT_MOON_1F, MTMOON1F_MOON_STONE, SHOW - db MT_MOON_1F, MTMOON1F_RARE_CANDY, SHOW - db MT_MOON_1F, MTMOON1F_ESCAPE_ROPE, SHOW - db MT_MOON_1F, MTMOON1F_POTION2, SHOW - db MT_MOON_1F, MTMOON1F_TM_WATER_GUN, SHOW -MtMoonB2FHS: - db MT_MOON_B2F, MTMOONB2F_DOME_FOSSIL, SHOW - db MT_MOON_B2F, MTMOONB2F_HELIX_FOSSIL, SHOW - db MT_MOON_B2F, MTMOONB2F_HP_UP, SHOW - db MT_MOON_B2F, MTMOONB2F_TM_MEGA_PUNCH, SHOW -SSAnne2FHS: - db SS_ANNE_2F, SSANNE2F_RIVAL, HIDE -SSAnne1FRoomsHS: - db SS_ANNE_1F_ROOMS, SSANNE1FROOMS_TM_BODY_SLAM, SHOW -SSAnne2FRoomsHS: - db SS_ANNE_2F_ROOMS, SSANNE2FROOMS_MAX_ETHER, SHOW - db SS_ANNE_2F_ROOMS, SSANNE2FROOMS_RARE_CANDY, SHOW -SSAnneB1FRoomsHS: - db SS_ANNE_B1F_ROOMS, SSANNEB1FROOMS_ETHER, SHOW - db SS_ANNE_B1F_ROOMS, SSANNEB1FROOMS_TM_REST, SHOW - db SS_ANNE_B1F_ROOMS, SSANNEB1FROOMS_MAX_POTION, SHOW -VictoryRoad3FHS: - db VICTORY_ROAD_3F, VICTORYROAD3F_MAX_REVIVE, SHOW - db VICTORY_ROAD_3F, VICTORYROAD3F_TM_EXPLOSION, SHOW - db VICTORY_ROAD_3F, VICTORYROAD3F_BOULDER4, SHOW -RocketHideoutB1FHS: - db ROCKET_HIDEOUT_B1F, ROCKETHIDEOUTB1F_ESCAPE_ROPE, SHOW - db ROCKET_HIDEOUT_B1F, ROCKETHIDEOUTB1F_HYPER_POTION, SHOW -RocketHideoutB2FHS: - db ROCKET_HIDEOUT_B2F, ROCKETHIDEOUTB2F_MOON_STONE, SHOW - db ROCKET_HIDEOUT_B2F, ROCKETHIDEOUTB2F_NUGGET, SHOW - db ROCKET_HIDEOUT_B2F, ROCKETHIDEOUTB2F_TM_HORN_DRILL, SHOW - db ROCKET_HIDEOUT_B2F, ROCKETHIDEOUTB2F_SUPER_POTION, SHOW -RocketHideoutB3FHS: - db ROCKET_HIDEOUT_B3F, ROCKETHIDEOUTB3F_TM_DOUBLE_EDGE, SHOW - db ROCKET_HIDEOUT_B3F, ROCKETHIDEOUTB3F_RARE_CANDY, SHOW -RocketHideoutB4FHS: - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_GIOVANNI, SHOW - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_HP_UP, SHOW - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_TM_RAZOR_WIND, SHOW - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_IRON, SHOW - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_SILPH_SCOPE, HIDE - db ROCKET_HIDEOUT_B4F, ROCKETHIDEOUTB4F_LIFT_KEY, HIDE -SilphCo2FHS: - db SILPH_CO_2F, SILPHCO2F_SILPH_WORKER_F, SHOW - db SILPH_CO_2F, SILPHCO2F_SCIENTIST1, SHOW - db SILPH_CO_2F, SILPHCO2F_SCIENTIST2, SHOW - db SILPH_CO_2F, SILPHCO2F_ROCKET1, SHOW - db SILPH_CO_2F, SILPHCO2F_ROCKET2, SHOW -SilphCo3FHS: - db SILPH_CO_3F, SILPHCO3F_ROCKET, SHOW - db SILPH_CO_3F, SILPHCO3F_SCIENTIST, SHOW - db SILPH_CO_3F, SILPHCO3F_HYPER_POTION, SHOW -SilphCo4FHS: - db SILPH_CO_4F, SILPHCO4F_ROCKET1, SHOW - db SILPH_CO_4F, SILPHCO4F_SCIENTIST, SHOW - db SILPH_CO_4F, SILPHCO4F_ROCKET2, SHOW - db SILPH_CO_4F, SILPHCO4F_FULL_HEAL, SHOW - db SILPH_CO_4F, SILPHCO4F_MAX_REVIVE, SHOW - db SILPH_CO_4F, SILPHCO4F_ESCAPE_ROPE, SHOW -SilphCo5FHS: - db SILPH_CO_5F, SILPHCO5F_ROCKET1, SHOW - db SILPH_CO_5F, SILPHCO5F_SCIENTIST, SHOW - db SILPH_CO_5F, SILPHCO5F_ROCKER, SHOW - db SILPH_CO_5F, SILPHCO5F_ROCKET2, SHOW - db SILPH_CO_5F, SILPHCO5F_TM_TAKE_DOWN, SHOW - db SILPH_CO_5F, SILPHCO5F_PROTEIN, SHOW - db SILPH_CO_5F, SILPHCO5F_CARD_KEY, SHOW -SilphCo6FHS: - db SILPH_CO_6F, SILPHCO6F_ROCKET1, SHOW - db SILPH_CO_6F, SILPHCO6F_SCIENTIST, SHOW - db SILPH_CO_6F, SILPHCO6F_ROCKET2, SHOW - db SILPH_CO_6F, SILPHCO6F_HP_UP, SHOW - db SILPH_CO_6F, SILPHCO6F_X_ACCURACY, SHOW -SilphCo7FHS: - db SILPH_CO_7F, SILPHCO7F_ROCKET1, SHOW - db SILPH_CO_7F, SILPHCO7F_SCIENTIST, SHOW - db SILPH_CO_7F, SILPHCO7F_ROCKET2, SHOW - db SILPH_CO_7F, SILPHCO7F_ROCKET3, SHOW - db SILPH_CO_7F, SILPHCO7F_RIVAL, SHOW - db SILPH_CO_7F, SILPHCO7F_CALCIUM, SHOW - db SILPH_CO_7F, SILPHCO7F_TM_SWORDS_DANCE, SHOW - db SILPH_CO_7F, SILPHCO7F_UNUSED, SHOW -SilphCo8FHS: - db SILPH_CO_8F, SILPHCO8F_ROCKET1, SHOW - db SILPH_CO_8F, SILPHCO8F_SCIENTIST, SHOW - db SILPH_CO_8F, SILPHCO8F_ROCKET2, SHOW -SilphCo9FHS: - db SILPH_CO_9F, SILPHCO9F_ROCKET1, SHOW - db SILPH_CO_9F, SILPHCO9F_SCIENTIST, SHOW - db SILPH_CO_9F, SILPHCO9F_ROCKET2, SHOW -SilphCo10FHS: - db SILPH_CO_10F, SILPHCO10F_ROCKET, SHOW - db SILPH_CO_10F, SILPHCO10F_SCIENTIST, SHOW - db SILPH_CO_10F, SILPHCO10F_SILPH_WORKER_F, SHOW - db SILPH_CO_10F, SILPHCO10F_TM_EARTHQUAKE, SHOW - db SILPH_CO_10F, SILPHCO10F_RARE_CANDY, SHOW - db SILPH_CO_10F, SILPHCO10F_CARBOS, SHOW -SilphCo11FHS: - db SILPH_CO_11F, SILPHCO11F_GIOVANNI, SHOW - db SILPH_CO_11F, SILPHCO11F_ROCKET1, SHOW - db SILPH_CO_11F, SILPHCO11F_ROCKET2, SHOW -UnusedMapF4HS: - db UNUSED_MAP_F4, $02, SHOW ; unused -PokemonMansion2FHS: - db POKEMON_MANSION_2F, POKEMONMANSION2F_CALCIUM, SHOW -PokemonMansion3FHS: - db POKEMON_MANSION_3F, POKEMONMANSION3F_MAX_POTION, SHOW - db POKEMON_MANSION_3F, POKEMONMANSION3F_IRON, SHOW -PokemonMansionB1FHS: - db POKEMON_MANSION_B1F, POKEMONMANSIONB1F_RARE_CANDY, SHOW - db POKEMON_MANSION_B1F, POKEMONMANSIONB1F_FULL_RESTORE, SHOW - db POKEMON_MANSION_B1F, POKEMONMANSIONB1F_TM_BLIZZARD, SHOW - db POKEMON_MANSION_B1F, POKEMONMANSIONB1F_TM_SOLARBEAM, SHOW - db POKEMON_MANSION_B1F, POKEMONMANSIONB1F_SECRET_KEY, SHOW -SafariZoneEastHS: - db SAFARI_ZONE_EAST, SAFARIZONEEAST_FULL_RESTORE, SHOW - db SAFARI_ZONE_EAST, SAFARIZONEEAST_MAX_RESTORE, SHOW - db SAFARI_ZONE_EAST, SAFARIZONEEAST_CARBOS, SHOW - db SAFARI_ZONE_EAST, SAFARIZONEEAST_TM_EGG_BOMB, SHOW -SafariZoneNorthHS: - db SAFARI_ZONE_NORTH, SAFARIZONENORTH_PROTEIN, SHOW - db SAFARI_ZONE_NORTH, SAFARIZONENORTH_TM_SKULL_BASH, SHOW -SafariZoneWestHS: - db SAFARI_ZONE_WEST, SAFARIZONEWEST_MAX_POTION, SHOW - db SAFARI_ZONE_WEST, SAFARIZONEWEST_TM_DOUBLE_TEAM, SHOW - db SAFARI_ZONE_WEST, SAFARIZONEWEST_MAX_REVIVE, SHOW - db SAFARI_ZONE_WEST, SAFARIZONEWEST_GOLD_TEETH, SHOW -SafariZoneCenterHS: - db SAFARI_ZONE_CENTER, SAFARIZONECENTER_NUGGET, SHOW -CeruleanCave2FHS: - db CERULEAN_CAVE_2F, CERULEANCAVE2F_PP_UP, SHOW - db CERULEAN_CAVE_2F, CERULEANCAVE2F_ULTRA_BALL, SHOW - db CERULEAN_CAVE_2F, CERULEANCAVE2F_FULL_RESTORE, SHOW -CeruleanCaveB1FHS: - db CERULEAN_CAVE_B1F, CERULEANCAVEB1F_MEWTWO, SHOW - db CERULEAN_CAVE_B1F, CERULEANCAVEB1F_ULTRA_BALL, SHOW - db CERULEAN_CAVE_B1F, CERULEANCAVEB1F_MAX_REVIVE, SHOW -VictoryRoad1FHS: - db VICTORY_ROAD_1F, VICTORYROAD1F_TM_SKY_ATTACK, SHOW - db VICTORY_ROAD_1F, VICTORYROAD1F_RARE_CANDY, SHOW -ChampionsRoomHS: - db CHAMPIONS_ROOM, CHAMPIONSROOM_OAK, HIDE -SeafoamIslands1FHS: - db SEAFOAM_ISLANDS_1F, SEAFOAMISLANDS1F_BOULDER1, SHOW - db SEAFOAM_ISLANDS_1F, SEAFOAMISLANDS1F_BOULDER2, SHOW -SeafoamIslandsB1FHS: - db SEAFOAM_ISLANDS_B1F, SEAFOAMISLANDSB1F_BOULDER1, HIDE - db SEAFOAM_ISLANDS_B1F, SEAFOAMISLANDSB1F_BOULDER2, HIDE -SeafoamIslandsB2FHS: - db SEAFOAM_ISLANDS_B2F, SEAFOAMISLANDSB2F_BOULDER1, HIDE - db SEAFOAM_ISLANDS_B2F, SEAFOAMISLANDSB2F_BOULDER2, HIDE -SeafoamIslandsB3FHS: - db SEAFOAM_ISLANDS_B3F, SEAFOAMISLANDSB3F_BOULDER2, SHOW - db SEAFOAM_ISLANDS_B3F, SEAFOAMISLANDSB3F_BOULDER3, SHOW - db SEAFOAM_ISLANDS_B3F, SEAFOAMISLANDSB3F_BOULDER5, HIDE - db SEAFOAM_ISLANDS_B3F, SEAFOAMISLANDSB3F_BOULDER6, HIDE -SeafoamIslandsB4FHS: - db SEAFOAM_ISLANDS_B4F, SEAFOAMISLANDSB4F_BOULDER1, HIDE - db SEAFOAM_ISLANDS_B4F, SEAFOAMISLANDSB4F_BOULDER2, HIDE - db SEAFOAM_ISLANDS_B4F, SEAFOAMISLANDSB4F_ARTICUNO, SHOW - assert_table_length NUM_HS_OBJECTS - db -1, 1, SHOW ; end diff --git a/data/maps/objects/SilphCo7F.asm b/data/maps/objects/SilphCo7F.asm index 6f2ca90d..0dbe2c7f 100644 --- a/data/maps/objects/SilphCo7F.asm +++ b/data/maps/objects/SilphCo7F.asm @@ -10,7 +10,7 @@ const_export SILPHCO7F_RIVAL const_export SILPHCO7F_CALCIUM const_export SILPHCO7F_TM_SWORDS_DANCE - const_export SILPHCO7F_UNUSED ; referenced in data/maps/hide_show_data.asm, no corresponding object_event + const_export SILPHCO7F_UNUSED ; referenced in data/maps/toggleable_objects.asm, no corresponding object_event SilphCo7F_Object: db $2e ; border block diff --git a/data/maps/toggleable_objects.asm b/data/maps/toggleable_objects.asm new file mode 100644 index 00000000..d94002d9 --- /dev/null +++ b/data/maps/toggleable_objects.asm @@ -0,0 +1,423 @@ +; toggleable objects for each map + +ToggleableObjectMapPointers: +; entries correspond to map ids + table_width 2 +FOR n, NUM_MAPS + IF DEF(TOGGLEMAP{n}) ; defined by `toggle_consts_for` + dw ToggleData{n} + ELSE + dw NoToggleData + ENDC +ENDR + assert_table_length NUM_MAPS + dw -1 ; end + +NoToggleData: + db -1, -1, -1 ; end + +DEF toggles_ok = 1 + +MACRO? toggleable_objects_for + DEF toggle_map_id = \1 ; map id + ToggleData{toggle_map_id}: + IF toggles_ok + ASSERT DEF(TOGGLEMAP{toggle_map_id}), \ + "`toggleable_objects_for \1` is not defined" + DEF toggles_ok &= DEF(TOGGLEMAP{toggle_map_id}) + IF toggles_ok + assert_table_length TOGGLEMAP{toggle_map_id} + DEF toggles_ok &= TOGGLEMAP{toggle_map_id} * 3 == @ - ToggleableObjectStates + ENDC + ENDC +ENDM + +MACRO toggle_object_state + db toggle_map_id ; from previous `toggleable_objects_for` + db \1 ; object id + db \2 ; OFF/ON +ENDM + +ToggleableObjectStates: +; entries correspond to TOGGLE_* constants (see constants/toggle_constants.asm) + table_width 3 + + toggleable_objects_for PALLET_TOWN + toggle_object_state PALLETTOWN_OAK, OFF + + toggleable_objects_for VIRIDIAN_CITY + toggle_object_state VIRIDIANCITY_OLD_MAN_SLEEPY, ON + toggle_object_state VIRIDIANCITY_OLD_MAN, OFF + + toggleable_objects_for PEWTER_CITY + toggle_object_state PEWTERCITY_SUPER_NERD1, ON + toggle_object_state PEWTERCITY_YOUNGSTER, ON + + toggleable_objects_for CERULEAN_CITY + toggle_object_state CERULEANCITY_RIVAL, OFF + toggle_object_state CERULEANCITY_ROCKET, ON + toggle_object_state CERULEANCITY_GUARD1, OFF + toggle_object_state CERULEANCITY_SUPER_NERD3, ON + toggle_object_state CERULEANCITY_GUARD2, ON + + toggleable_objects_for SAFFRON_CITY + toggle_object_state SAFFRONCITY_ROCKET1, ON + toggle_object_state SAFFRONCITY_ROCKET2, ON + toggle_object_state SAFFRONCITY_ROCKET3, ON + toggle_object_state SAFFRONCITY_ROCKET4, ON + toggle_object_state SAFFRONCITY_ROCKET5, ON + toggle_object_state SAFFRONCITY_ROCKET6, ON + toggle_object_state SAFFRONCITY_ROCKET7, ON + toggle_object_state SAFFRONCITY_SCIENTIST, OFF + toggle_object_state SAFFRONCITY_SILPH_WORKER_M, OFF + toggle_object_state SAFFRONCITY_SILPH_WORKER_F, OFF + toggle_object_state SAFFRONCITY_GENTLEMAN, OFF + toggle_object_state SAFFRONCITY_PIDGEOT, OFF + toggle_object_state SAFFRONCITY_ROCKER, OFF + toggle_object_state SAFFRONCITY_ROCKET8, ON + toggle_object_state SAFFRONCITY_ROCKET9, OFF + + toggleable_objects_for ROUTE_2 + toggle_object_state ROUTE2_MOON_STONE, ON + toggle_object_state ROUTE2_HP_UP, ON + + toggleable_objects_for ROUTE_4 + toggle_object_state ROUTE4_TM_WHIRLWIND, ON + + toggleable_objects_for ROUTE_9 + toggle_object_state ROUTE9_TM_TELEPORT, ON + + toggleable_objects_for ROUTE_12 + toggle_object_state ROUTE12_SNORLAX, ON + toggle_object_state ROUTE12_TM_PAY_DAY, ON + toggle_object_state ROUTE12_IRON, ON + + toggleable_objects_for ROUTE_15 + toggle_object_state ROUTE15_TM_RAGE, ON + + toggleable_objects_for ROUTE_16 + toggle_object_state ROUTE16_SNORLAX, ON + + toggleable_objects_for ROUTE_22 + toggle_object_state ROUTE22_RIVAL1, OFF + toggle_object_state ROUTE22_RIVAL2, OFF + + toggleable_objects_for ROUTE_24 + toggle_object_state ROUTE24_COOLTRAINER_M1, ON + toggle_object_state ROUTE24_TM_THUNDER_WAVE, ON + + toggleable_objects_for ROUTE_25 + toggle_object_state ROUTE25_TM_SEISMIC_TOSS, ON + + toggleable_objects_for BLUES_HOUSE + toggle_object_state BLUESHOUSE_DAISY1, ON + toggle_object_state BLUESHOUSE_DAISY2, OFF + toggle_object_state BLUESHOUSE_TOWN_MAP, ON + + toggleable_objects_for OAKS_LAB + toggle_object_state OAKSLAB_RIVAL, ON + toggle_object_state OAKSLAB_CHARMANDER_POKE_BALL, ON + toggle_object_state OAKSLAB_SQUIRTLE_POKE_BALL, ON + toggle_object_state OAKSLAB_BULBASAUR_POKE_BALL, ON + toggle_object_state OAKSLAB_OAK1, OFF + toggle_object_state OAKSLAB_POKEDEX1, ON + toggle_object_state OAKSLAB_POKEDEX2, ON + toggle_object_state OAKSLAB_OAK2, OFF + + toggleable_objects_for VIRIDIAN_GYM + toggle_object_state VIRIDIANGYM_GIOVANNI, ON + toggle_object_state VIRIDIANGYM_REVIVE, ON + + toggleable_objects_for MUSEUM_1F + toggle_object_state MUSEUM1F_OLD_AMBER, ON + + toggleable_objects_for CERULEAN_CAVE_1F + toggle_object_state CERULEANCAVE1F_FULL_RESTORE, ON + toggle_object_state CERULEANCAVE1F_MAX_ELIXER, ON + toggle_object_state CERULEANCAVE1F_NUGGET, ON + + toggleable_objects_for POKEMON_TOWER_2F + toggle_object_state POKEMONTOWER2F_RIVAL, ON + + toggleable_objects_for POKEMON_TOWER_3F + toggle_object_state POKEMONTOWER3F_ESCAPE_ROPE, ON + + toggleable_objects_for POKEMON_TOWER_4F + toggle_object_state POKEMONTOWER4F_ELIXER, ON + toggle_object_state POKEMONTOWER4F_AWAKENING, ON + toggle_object_state POKEMONTOWER4F_HP_UP, ON + + toggleable_objects_for POKEMON_TOWER_5F + toggle_object_state POKEMONTOWER5F_NUGGET, ON + + toggleable_objects_for POKEMON_TOWER_6F + toggle_object_state POKEMONTOWER6F_RARE_CANDY, ON + toggle_object_state POKEMONTOWER6F_X_ACCURACY, ON + + toggleable_objects_for POKEMON_TOWER_7F + toggle_object_state POKEMONTOWER7F_ROCKET1, ON + toggle_object_state POKEMONTOWER7F_ROCKET2, ON + toggle_object_state POKEMONTOWER7F_ROCKET3, ON + toggle_object_state POKEMONTOWER7F_MR_FUJI, ON + + toggleable_objects_for MR_FUJIS_HOUSE + toggle_object_state MRFUJISHOUSE_MR_FUJI, OFF + + toggleable_objects_for CELADON_MANSION_ROOF_HOUSE + toggle_object_state CELADONMANSION_ROOF_HOUSE_EEVEE_POKEBALL, ON + + toggleable_objects_for GAME_CORNER + toggle_object_state GAMECORNER_ROCKET, ON + + toggleable_objects_for WARDENS_HOUSE + toggle_object_state WARDENSHOUSE_RARE_CANDY, ON + + toggleable_objects_for POKEMON_MANSION_1F + toggle_object_state POKEMONMANSION1F_ESCAPE_ROPE, ON + toggle_object_state POKEMONMANSION1F_CARBOS, ON + + toggleable_objects_for FIGHTING_DOJO + toggle_object_state FIGHTINGDOJO_HITMONLEE_POKE_BALL, ON + toggle_object_state FIGHTINGDOJO_HITMONCHAN_POKE_BALL, ON + + toggleable_objects_for SILPH_CO_1F + toggle_object_state SILPHCO1F_LINK_RECEPTIONIST, OFF + + toggleable_objects_for POWER_PLANT + toggle_object_state POWERPLANT_VOLTORB1, ON + toggle_object_state POWERPLANT_VOLTORB2, ON + toggle_object_state POWERPLANT_VOLTORB3, ON + toggle_object_state POWERPLANT_ELECTRODE1, ON + toggle_object_state POWERPLANT_VOLTORB4, ON + toggle_object_state POWERPLANT_VOLTORB5, ON + toggle_object_state POWERPLANT_ELECTRODE2, ON + toggle_object_state POWERPLANT_VOLTORB6, ON + toggle_object_state POWERPLANT_ZAPDOS, ON + toggle_object_state POWERPLANT_CARBOS, ON + toggle_object_state POWERPLANT_HP_UP, ON + toggle_object_state POWERPLANT_RARE_CANDY, ON + toggle_object_state POWERPLANT_TM_THUNDER, ON + toggle_object_state POWERPLANT_TM_REFLECT, ON + + toggleable_objects_for VICTORY_ROAD_2F + toggle_object_state VICTORYROAD2F_MOLTRES, ON + toggle_object_state VICTORYROAD2F_TM_SUBMISSION, ON + toggle_object_state VICTORYROAD2F_FULL_HEAL, ON + toggle_object_state VICTORYROAD2F_TM_MEGA_KICK, ON + toggle_object_state VICTORYROAD2F_GUARD_SPEC, ON + toggle_object_state VICTORYROAD2F_BOULDER3, ON + + toggleable_objects_for BILLS_HOUSE + toggle_object_state BILLSHOUSE_BILL_POKEMON, ON + toggle_object_state BILLSHOUSE_BILL1, OFF + toggle_object_state BILLSHOUSE_BILL2, OFF + + toggleable_objects_for VIRIDIAN_FOREST + toggle_object_state VIRIDIANFOREST_ANTIDOTE, ON + toggle_object_state VIRIDIANFOREST_POTION, ON + toggle_object_state VIRIDIANFOREST_POKE_BALL, ON + + toggleable_objects_for MT_MOON_1F + toggle_object_state MTMOON1F_POTION1, ON + toggle_object_state MTMOON1F_MOON_STONE, ON + toggle_object_state MTMOON1F_RARE_CANDY, ON + toggle_object_state MTMOON1F_ESCAPE_ROPE, ON + toggle_object_state MTMOON1F_POTION2, ON + toggle_object_state MTMOON1F_TM_WATER_GUN, ON + + toggleable_objects_for MT_MOON_B2F + toggle_object_state MTMOONB2F_DOME_FOSSIL, ON + toggle_object_state MTMOONB2F_HELIX_FOSSIL, ON + toggle_object_state MTMOONB2F_HP_UP, ON + toggle_object_state MTMOONB2F_TM_MEGA_PUNCH, ON + + toggleable_objects_for SS_ANNE_2F + toggle_object_state SSANNE2F_RIVAL, OFF + + toggleable_objects_for SS_ANNE_1F_ROOMS + toggle_object_state SSANNE1FROOMS_TM_BODY_SLAM, ON + + toggleable_objects_for SS_ANNE_2F_ROOMS + toggle_object_state SSANNE2FROOMS_MAX_ETHER, ON + toggle_object_state SSANNE2FROOMS_RARE_CANDY, ON + + toggleable_objects_for SS_ANNE_B1F_ROOMS + toggle_object_state SSANNEB1FROOMS_ETHER, ON + toggle_object_state SSANNEB1FROOMS_TM_REST, ON + toggle_object_state SSANNEB1FROOMS_MAX_POTION, ON + + toggleable_objects_for VICTORY_ROAD_3F + toggle_object_state VICTORYROAD3F_MAX_REVIVE, ON + toggle_object_state VICTORYROAD3F_TM_EXPLOSION, ON + toggle_object_state VICTORYROAD3F_BOULDER4, ON + + toggleable_objects_for ROCKET_HIDEOUT_B1F + toggle_object_state ROCKETHIDEOUTB1F_ESCAPE_ROPE, ON + toggle_object_state ROCKETHIDEOUTB1F_HYPER_POTION, ON + + toggleable_objects_for ROCKET_HIDEOUT_B2F + toggle_object_state ROCKETHIDEOUTB2F_MOON_STONE, ON + toggle_object_state ROCKETHIDEOUTB2F_NUGGET, ON + toggle_object_state ROCKETHIDEOUTB2F_TM_HORN_DRILL, ON + toggle_object_state ROCKETHIDEOUTB2F_SUPER_POTION, ON + + toggleable_objects_for ROCKET_HIDEOUT_B3F + toggle_object_state ROCKETHIDEOUTB3F_TM_DOUBLE_EDGE, ON + toggle_object_state ROCKETHIDEOUTB3F_RARE_CANDY, ON + + toggleable_objects_for ROCKET_HIDEOUT_B4F + toggle_object_state ROCKETHIDEOUTB4F_GIOVANNI, ON + toggle_object_state ROCKETHIDEOUTB4F_HP_UP, ON + toggle_object_state ROCKETHIDEOUTB4F_TM_RAZOR_WIND, ON + toggle_object_state ROCKETHIDEOUTB4F_IRON, ON + toggle_object_state ROCKETHIDEOUTB4F_SILPH_SCOPE, OFF + toggle_object_state ROCKETHIDEOUTB4F_LIFT_KEY, OFF + + toggleable_objects_for SILPH_CO_2F + toggle_object_state SILPHCO2F_SILPH_WORKER_F, ON + toggle_object_state SILPHCO2F_SCIENTIST1, ON + toggle_object_state SILPHCO2F_SCIENTIST2, ON + toggle_object_state SILPHCO2F_ROCKET1, ON + toggle_object_state SILPHCO2F_ROCKET2, ON + + toggleable_objects_for SILPH_CO_3F + toggle_object_state SILPHCO3F_ROCKET, ON + toggle_object_state SILPHCO3F_SCIENTIST, ON + toggle_object_state SILPHCO3F_HYPER_POTION, ON + + toggleable_objects_for SILPH_CO_4F + toggle_object_state SILPHCO4F_ROCKET1, ON + toggle_object_state SILPHCO4F_SCIENTIST, ON + toggle_object_state SILPHCO4F_ROCKET2, ON + toggle_object_state SILPHCO4F_FULL_HEAL, ON + toggle_object_state SILPHCO4F_MAX_REVIVE, ON + toggle_object_state SILPHCO4F_ESCAPE_ROPE, ON + + toggleable_objects_for SILPH_CO_5F + toggle_object_state SILPHCO5F_ROCKET1, ON + toggle_object_state SILPHCO5F_SCIENTIST, ON + toggle_object_state SILPHCO5F_ROCKER, ON + toggle_object_state SILPHCO5F_ROCKET2, ON + toggle_object_state SILPHCO5F_TM_TAKE_DOWN, ON + toggle_object_state SILPHCO5F_PROTEIN, ON + toggle_object_state SILPHCO5F_CARD_KEY, ON + + toggleable_objects_for SILPH_CO_6F + toggle_object_state SILPHCO6F_ROCKET1, ON + toggle_object_state SILPHCO6F_SCIENTIST, ON + toggle_object_state SILPHCO6F_ROCKET2, ON + toggle_object_state SILPHCO6F_HP_UP, ON + toggle_object_state SILPHCO6F_X_ACCURACY, ON + + toggleable_objects_for SILPH_CO_7F + toggle_object_state SILPHCO7F_ROCKET1, ON + toggle_object_state SILPHCO7F_SCIENTIST, ON + toggle_object_state SILPHCO7F_ROCKET2, ON + toggle_object_state SILPHCO7F_ROCKET3, ON + toggle_object_state SILPHCO7F_RIVAL, ON + toggle_object_state SILPHCO7F_CALCIUM, ON + toggle_object_state SILPHCO7F_TM_SWORDS_DANCE, ON + toggle_object_state SILPHCO7F_UNUSED, ON + + toggleable_objects_for SILPH_CO_8F + toggle_object_state SILPHCO8F_ROCKET1, ON + toggle_object_state SILPHCO8F_SCIENTIST, ON + toggle_object_state SILPHCO8F_ROCKET2, ON + + toggleable_objects_for SILPH_CO_9F + toggle_object_state SILPHCO9F_ROCKET1, ON + toggle_object_state SILPHCO9F_SCIENTIST, ON + toggle_object_state SILPHCO9F_ROCKET2, ON + + toggleable_objects_for SILPH_CO_10F + toggle_object_state SILPHCO10F_ROCKET, ON + toggle_object_state SILPHCO10F_SCIENTIST, ON + toggle_object_state SILPHCO10F_SILPH_WORKER_F, ON + toggle_object_state SILPHCO10F_TM_EARTHQUAKE, ON + toggle_object_state SILPHCO10F_RARE_CANDY, ON + toggle_object_state SILPHCO10F_CARBOS, ON + + toggleable_objects_for SILPH_CO_11F + toggle_object_state SILPHCO11F_GIOVANNI, ON + toggle_object_state SILPHCO11F_ROCKET1, ON + toggle_object_state SILPHCO11F_ROCKET2, ON + + toggleable_objects_for UNUSED_MAP_F4 + toggle_object_state $02, ON ; unused + + toggleable_objects_for POKEMON_MANSION_2F + toggle_object_state POKEMONMANSION2F_CALCIUM, ON + + toggleable_objects_for POKEMON_MANSION_3F + toggle_object_state POKEMONMANSION3F_MAX_POTION, ON + toggle_object_state POKEMONMANSION3F_IRON, ON + + toggleable_objects_for POKEMON_MANSION_B1F + toggle_object_state POKEMONMANSIONB1F_RARE_CANDY, ON + toggle_object_state POKEMONMANSIONB1F_FULL_RESTORE, ON + toggle_object_state POKEMONMANSIONB1F_TM_BLIZZARD, ON + toggle_object_state POKEMONMANSIONB1F_TM_SOLARBEAM, ON + toggle_object_state POKEMONMANSIONB1F_SECRET_KEY, ON + + toggleable_objects_for SAFARI_ZONE_EAST + toggle_object_state SAFARIZONEEAST_FULL_RESTORE, ON + toggle_object_state SAFARIZONEEAST_MAX_RESTORE, ON + toggle_object_state SAFARIZONEEAST_CARBOS, ON + toggle_object_state SAFARIZONEEAST_TM_EGG_BOMB, ON + + toggleable_objects_for SAFARI_ZONE_NORTH + toggle_object_state SAFARIZONENORTH_PROTEIN, ON + toggle_object_state SAFARIZONENORTH_TM_SKULL_BASH, ON + + toggleable_objects_for SAFARI_ZONE_WEST + toggle_object_state SAFARIZONEWEST_MAX_POTION, ON + toggle_object_state SAFARIZONEWEST_TM_DOUBLE_TEAM, ON + toggle_object_state SAFARIZONEWEST_MAX_REVIVE, ON + toggle_object_state SAFARIZONEWEST_GOLD_TEETH, ON + + toggleable_objects_for SAFARI_ZONE_CENTER + toggle_object_state SAFARIZONECENTER_NUGGET, ON + + toggleable_objects_for CERULEAN_CAVE_2F + toggle_object_state CERULEANCAVE2F_PP_UP, ON + toggle_object_state CERULEANCAVE2F_ULTRA_BALL, ON + toggle_object_state CERULEANCAVE2F_FULL_RESTORE, ON + + toggleable_objects_for CERULEAN_CAVE_B1F + toggle_object_state CERULEANCAVEB1F_MEWTWO, ON + toggle_object_state CERULEANCAVEB1F_ULTRA_BALL, ON + toggle_object_state CERULEANCAVEB1F_MAX_REVIVE, ON + + toggleable_objects_for VICTORY_ROAD_1F + toggle_object_state VICTORYROAD1F_TM_SKY_ATTACK, ON + toggle_object_state VICTORYROAD1F_RARE_CANDY, ON + + toggleable_objects_for CHAMPIONS_ROOM + toggle_object_state CHAMPIONSROOM_OAK, OFF + + toggleable_objects_for SEAFOAM_ISLANDS_1F + toggle_object_state SEAFOAMISLANDS1F_BOULDER1, ON + toggle_object_state SEAFOAMISLANDS1F_BOULDER2, ON + + toggleable_objects_for SEAFOAM_ISLANDS_B1F + toggle_object_state SEAFOAMISLANDSB1F_BOULDER1, OFF + toggle_object_state SEAFOAMISLANDSB1F_BOULDER2, OFF + + toggleable_objects_for SEAFOAM_ISLANDS_B2F + toggle_object_state SEAFOAMISLANDSB2F_BOULDER1, OFF + toggle_object_state SEAFOAMISLANDSB2F_BOULDER2, OFF + + toggleable_objects_for SEAFOAM_ISLANDS_B3F + toggle_object_state SEAFOAMISLANDSB3F_BOULDER2, ON + toggle_object_state SEAFOAMISLANDSB3F_BOULDER3, ON + toggle_object_state SEAFOAMISLANDSB3F_BOULDER5, OFF + toggle_object_state SEAFOAMISLANDSB3F_BOULDER6, OFF + + toggleable_objects_for SEAFOAM_ISLANDS_B4F + toggle_object_state SEAFOAMISLANDSB4F_BOULDER1, OFF + toggle_object_state SEAFOAMISLANDSB4F_BOULDER2, OFF + toggle_object_state SEAFOAMISLANDSB4F_ARTICUNO, ON + + assert_table_length NUM_TOGGLEABLE_OBJECTS + + db -1, 1, ON ; end diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index e6968c46..19c3ea8f 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -32,7 +32,7 @@ PredefPointers:: add_predef ApplyOutOfBattlePoisonDamage add_predef AnyPartyAlive add_predef ShowObject - add_predef ShowObject2 + add_predef ShowObject2 ; identical to ShowObject add_predef ReplaceTileBlock add_predef InitPlayerData2 add_predef LoadTilesetHeader @@ -75,7 +75,7 @@ PredefPointers:: add_predef WriteMonMoves add_predef SaveMenu add_predef LoadSGB - add_predef MarkTownVisitedAndLoadMissableObjects + add_predef MarkTownVisitedAndLoadToggleableObjects add_predef SetPartyMonTypes add_predef CanLearnTM add_predef TMToMove diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 8fbdcfa2..a55c604a 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -3,19 +3,19 @@ PickUpItem: ldh a, [hSpriteIndex] ld b, a - ld hl, wMissableObjectList -.missableObjectsListLoop + ld hl, wToggleableObjectList +.toggleableObjectsListLoop ld a, [hli] cp $ff ret z cp b - jr z, .isMissable + jr z, .isToggleable inc hl - jr .missableObjectsListLoop + jr .toggleableObjectsListLoop -.isMissable +.isToggleable ld a, [hl] - ldh [hMissableObjectIndex], a + ldh [hToggleableObjectIndex], a ld hl, wMapSpriteExtraData ldh a, [hSpriteIndex] @@ -30,8 +30,8 @@ PickUpItem: call GiveItem jr nc, .BagFull - ldh a, [hMissableObjectIndex] - ld [wMissableObjectIndex], a + ldh a, [hToggleableObjectIndex] + ld [wToggleableObjectIndex], a predef HideObject ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm index 843eb96e..bd4f86a4 100644 --- a/engine/movie/oak_speech/init_player_data.asm +++ b/engine/movie/oak_speech/init_player_data.asm @@ -45,7 +45,7 @@ DEF START_MONEY EQU $3000 ld bc, wGameProgressFlagsEnd - wGameProgressFlags call FillMemory ; clear all game progress flags - jp InitializeMissableObjectsFlags + jp InitializeToggleableObjectsFlags InitializeEmptyList: xor a ; count diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 13d30cca..dc5fc385 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -148,8 +148,8 @@ PalletMovementScript_Done: ld a, [wSimulatedJoypadStatesIndex] and a ret nz - ld a, HS_PALLET_TOWN_OAK - ld [wMissableObjectIndex], a + ld a, TOGGLE_PALLET_TOWN_OAK + ld [wToggleableObjectIndex], a predef HideObject ld hl, wStatusFlags5 res BIT_SCRIPTED_MOVEMENT_STATE, [hl] diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm deleted file mode 100644 index 8ea79980..00000000 --- a/engine/overworld/missable_objects.asm +++ /dev/null @@ -1,212 +0,0 @@ -MarkTownVisitedAndLoadMissableObjects:: - ld a, [wCurMap] - cp FIRST_ROUTE_MAP - jr nc, .notInTown - ld c, a - ld b, FLAG_SET - ld hl, wTownVisitedFlag ; mark town as visited (for flying) - predef FlagActionPredef -.notInTown - ld hl, MapHSPointers - ld a, [wCurMap] - ld b, $0 - ld c, a - add hl, bc - add hl, bc - ld a, [hli] ; load missable objects pointer in hl - ld h, [hl] - ld l, a - push hl - ld de, MissableObjects ; calculate difference between out pointer and the base pointer - ld a, l - sub e - jr nc, .noCarry - dec h -.noCarry - ld l, a - ld a, h - sub d - ld h, a - ld a, h - ldh [hDividend], a - ld a, l - ldh [hDividend+1], a - xor a - ldh [hDividend+2], a - ldh [hDividend+3], a - ld a, $3 - ldh [hDivisor], a - ld b, $2 - call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [wCurMap] - ld b, a - ldh a, [hDividend+3] - ld c, a ; store global offset in c - ld de, wMissableObjectList - pop hl -.writeMissableObjectsListLoop - ld a, [hli] - cp -1 - jr z, .done ; end of list - cp b - jr nz, .done ; not for current map anymore - ld a, [hli] - inc hl - ld [de], a ; write (map-local) sprite ID - inc de - ld a, c - inc c - ld [de], a ; write (global) missable object index - inc de - jr .writeMissableObjectsListLoop -.done - ld a, -1 - ld [de], a ; write sentinel - ret - -InitializeMissableObjectsFlags: - ld hl, wMissableObjectFlags - ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags - xor a - call FillMemory ; clear missable objects flags - ld hl, MissableObjects - xor a - ld [wMissableObjectCounter], a -.missableObjectsLoop - ld a, [hli] - cp -1 ; end of list - ret z - push hl - inc hl - ld a, [hl] - cp HIDE - jr nz, .skip - ld hl, wMissableObjectFlags - ld a, [wMissableObjectCounter] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set flag if Item is hidden -.skip - ld hl, wMissableObjectCounter - inc [hl] - pop hl - inc hl - inc hl - jr .missableObjectsLoop - -; tests if current sprite is a missable object that is hidden/has been removed -IsObjectHidden: - ldh a, [hCurrentSpriteOffset] - swap a - ld b, a - ld hl, wMissableObjectList -.loop - ld a, [hli] - cp -1 - jr z, .notHidden ; not missable -> not hidden - cp b - ld a, [hli] - jr nz, .loop - ld c, a - ld b, FLAG_TEST - ld hl, wMissableObjectFlags - call MissableObjectFlagAction - ld a, c - and a - jr nz, .hidden -.notHidden - xor a -.hidden - ldh [hIsHiddenMissableObject], a - ret - -; adds missable object (items, leg. pokemon, etc.) to the map -; [wMissableObjectIndex]: index of the missable object to be added (global index) -ShowObject: -ShowObject2: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_RESET - call MissableObjectFlagAction ; reset "removed" flag - jp UpdateSprites - -; removes missable object (items, leg. pokemon, etc.) from the map -; [wMissableObjectIndex]: index of the missable object to be removed (global index) -HideObject: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_SET - call MissableObjectFlagAction ; set "removed" flag - jp UpdateSprites - -MissableObjectFlagAction: -; identical to FlagAction - - push hl - push de - push bc - - ; bit - ld a, c - ld d, a - and 7 - ld e, a - - ; byte - ld a, d - srl a - srl a - srl a - add l - ld l, a - jr nc, .ok - inc h -.ok - - ; d = 1 << e (bitmask) - inc e - ld d, 1 -.shift - dec e - jr z, .shifted - sla d - jr .shift -.shifted - - ld a, b - and a - jr z, .reset - cp FLAG_TEST - jr z, .read - -; set - ld a, [hl] - ld b, a - ld a, d - or b - ld [hl], a - jr .done - -.reset - ld a, [hl] - ld b, a - ld a, d - xor $ff - and b - ld [hl], a - jr .done - -.read - ld a, [hl] - ld b, a - ld a, d - and b - -.done - pop bc - pop de - pop hl - ld c, a - ret diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index a353c4f1..be8d6f62 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -478,7 +478,7 @@ InitializeSpriteScreenPosition: ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: predef IsObjectHidden - ldh a, [hIsHiddenMissableObject] + ldh a, [hIsToggleableObjectOff] and a jp nz, .spriteInvisible ld h, HIGH(wSpriteStateData2) diff --git a/engine/overworld/toggleable_objects.asm b/engine/overworld/toggleable_objects.asm new file mode 100644 index 00000000..bfb3576c --- /dev/null +++ b/engine/overworld/toggleable_objects.asm @@ -0,0 +1,213 @@ +MarkTownVisitedAndLoadToggleableObjects:: + ld a, [wCurMap] + cp FIRST_ROUTE_MAP + jr nc, .notInTown + ld c, a + ld b, FLAG_SET + ld hl, wTownVisitedFlag ; mark town as visited (for flying) + predef FlagActionPredef +.notInTown + ld hl, ToggleableObjectMapPointers + ld a, [wCurMap] + ld b, $0 + ld c, a + add hl, bc + add hl, bc + ld a, [hli] ; load toggleable objects pointer in hl + ld h, [hl] + ld l, a + push hl + ld de, ToggleableObjectStates ; calculate difference between out pointer and the base pointer + ld a, l + sub e + jr nc, .noCarry + dec h +.noCarry + ld l, a + ld a, h + sub d + ld h, a + ; divide difference by 3, resulting in the global offset (number of toggleable items before ours) + ld a, h + ldh [hDividend], a + ld a, l + ldh [hDividend+1], a + xor a + ldh [hDividend+2], a + ldh [hDividend+3], a + ld a, $3 + ldh [hDivisor], a + ld b, $2 + call Divide + ld a, [wCurMap] + ld b, a + ldh a, [hDividend+3] + ld c, a ; store global offset in c + ld de, wToggleableObjectList + pop hl +.writeToggleableObjectsListLoop + ld a, [hli] + cp -1 + jr z, .done ; end of list + cp b + jr nz, .done ; not for current map anymore + ld a, [hli] + inc hl + ld [de], a ; write (map-local) sprite ID + inc de + ld a, c + inc c + ld [de], a ; write (global) toggleable object index + inc de + jr .writeToggleableObjectsListLoop +.done + ld a, -1 + ld [de], a ; write sentinel + ret + +InitializeToggleableObjectsFlags: + ld hl, wToggleableObjectFlags + ld bc, wToggleableObjectFlagsEnd - wToggleableObjectFlags + xor a + call FillMemory ; clear toggleable objects flags + ld hl, ToggleableObjectStates + xor a + ld [wToggleableObjectCounter], a +.toggleableObjectsLoop + ld a, [hli] + cp -1 ; end of list + ret z + push hl + inc hl + ld a, [hl] + cp OFF + jr nz, .skip + ld hl, wToggleableObjectFlags + ld a, [wToggleableObjectCounter] + ld c, a + ld b, FLAG_SET + call ToggleableObjectFlagAction ; set flag if object is toggled off +.skip + ld hl, wToggleableObjectCounter + inc [hl] + pop hl + inc hl + inc hl + jr .toggleableObjectsLoop + +; tests if current object is toggled off/has been hidden +IsObjectHidden: + ldh a, [hCurrentSpriteOffset] + swap a + ld b, a + ld hl, wToggleableObjectList +.loop + ld a, [hli] + cp -1 + jr z, .notHidden ; not toggleable -> not hidden + cp b + ld a, [hli] + jr nz, .loop + ld c, a + ld b, FLAG_TEST + ld hl, wToggleableObjectFlags + call ToggleableObjectFlagAction + ld a, c + and a + jr nz, .hidden +.notHidden + xor a +.hidden + ldh [hIsToggleableObjectOff], a + ret + +; adds toggleable object (items, leg. pokemon, etc.) to the map +; [wToggleableObjectIndex]: index of the toggleable object to be added (global index) +ShowObject: +ShowObject2: + ld hl, wToggleableObjectFlags + ld a, [wToggleableObjectIndex] + ld c, a + ld b, FLAG_RESET + call ToggleableObjectFlagAction ; reset "removed" flag + jp UpdateSprites + +; removes toggleable object (items, leg. pokemon, etc.) from the map +; [wToggleableObjectIndex]: index of the toggleable object to be removed (global index) +HideObject: + ld hl, wToggleableObjectFlags + ld a, [wToggleableObjectIndex] + ld c, a + ld b, FLAG_SET + call ToggleableObjectFlagAction ; set "removed" flag + jp UpdateSprites + +ToggleableObjectFlagAction: +; identical to FlagAction + + push hl + push de + push bc + + ; bit + ld a, c + ld d, a + and 7 + ld e, a + + ; byte + ld a, d + srl a + srl a + srl a + add l + ld l, a + jr nc, .ok + inc h +.ok + + ; d = 1 << e (bitmask) + inc e + ld d, 1 +.shift + dec e + jr z, .shifted + sla d + jr .shift +.shifted + + ld a, b + and a + jr z, .reset + cp FLAG_TEST + jr z, .read + +; set + ld a, [hl] + ld b, a + ld a, d + or b + ld [hl], a + jr .done + +.reset + ld a, [hl] + ld b, a + ld a, d + xor $ff + and b + ld [hl], a + jr .done + +.read + ld a, [hl] + ld b, a + ld a, d + and b + +.done + pop bc + pop de + pop hl + ld c, a + ret diff --git a/home/overworld.asm b/home/overworld.asm index e994f694..58550167 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -2003,7 +2003,7 @@ LoadPlayerSpriteGraphicsCommon:: ; function to load data from the map header LoadMapHeader:: - farcall MarkTownVisitedAndLoadMissableObjects + farcall MarkTownVisitedAndLoadToggleableObjects ld a, [wCurMapTileset] ld [wUnusedCurMapTilesetCopy], a ld a, [wCurMap] diff --git a/home/trainers.asm b/home/trainers.asm index 8d2cceaf..87bc7d69 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -202,13 +202,13 @@ EndTrainerBattle:: ld a, [wEnemyMonOrTrainerClass] cp OPP_ID_OFFSET jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) - ld hl, wMissableObjectList + ld hl, wToggleableObjectList ld de, $2 ld a, [wSpriteIndex] call IsInArray ; search for sprite ID inc hl ld a, [hl] - ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it + ld [wToggleableObjectIndex], a ; load corresponding toggleable object index and remove it predef HideObject .skipRemoveSprite ld hl, wStatusFlags5 diff --git a/includes.asm b/includes.asm index 781bb0b1..ea6f1a8e 100644 --- a/includes.asm +++ b/includes.asm @@ -41,7 +41,7 @@ INCLUDE "constants/list_constants.asm" INCLUDE "constants/map_constants.asm" INCLUDE "constants/map_data_constants.asm" INCLUDE "constants/map_object_constants.asm" -INCLUDE "constants/hide_show_constants.asm" +INCLUDE "constants/toggle_constants.asm" INCLUDE "constants/sprite_set_constants.asm" INCLUDE "constants/credits_constants.asm" INCLUDE "constants/audio_constants.asm" diff --git a/main.asm b/main.asm index 11ee2fa9..313bd448 100644 --- a/main.asm +++ b/main.asm @@ -49,7 +49,7 @@ INCLUDE "engine/overworld/player_state.asm" INCLUDE "engine/events/poison.asm" INCLUDE "engine/overworld/tilesets.asm" INCLUDE "engine/overworld/daycare_exp.asm" -INCLUDE "data/maps/hide_show_data.asm" +INCLUDE "data/maps/toggleable_objects.asm" INCLUDE "engine/overworld/field_move_messages.asm" INCLUDE "engine/items/inventory.asm" INCLUDE "engine/overworld/wild_mons.asm" @@ -57,7 +57,7 @@ INCLUDE "engine/items/item_effects.asm" INCLUDE "engine/menus/draw_badges.asm" INCLUDE "engine/overworld/update_map.asm" INCLUDE "engine/overworld/cut.asm" -INCLUDE "engine/overworld/missable_objects.asm" +INCLUDE "engine/overworld/toggleable_objects.asm" INCLUDE "engine/overworld/push_boulder.asm" INCLUDE "engine/pokemon/add_mon.asm" INCLUDE "engine/flag_action.asm" diff --git a/ram/hram.asm b/ram/hram.asm index 1be1dab6..9cfb5327 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -325,7 +325,7 @@ hItemToRemoveIndex:: db NEXTU hItemCounter:: hSavedCoordIndex:: -hMissableObjectIndex:: +hToggleableObjectIndex:: hGymTrashCanRandNumMask:: hInteractedWithBookshelf:: db @@ -350,7 +350,7 @@ hDivisor2:: db hQuotient2:: db NEXTU -hIsHiddenMissableObject:: db +hIsToggleableObjectOff:: db ENDU hMapROMBank:: db diff --git a/ram/wram.asm b/ram/wram.asm index fff7f703..5eefaf06 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -324,7 +324,7 @@ wCheckFor180DegreeTurn:: db ds 1 -wMissableObjectIndex:: db +wToggleableObjectIndex:: db wPredefID:: db wPredefHL:: dw @@ -1224,7 +1224,7 @@ ENDU ; money received after battle = base money × level of last enemy mon wTrainerBaseMoney:: dw ; BCD -wMissableObjectCounter:: db +wToggleableObjectCounter:: db ds 1 @@ -1909,9 +1909,9 @@ wUnusedMapVariable:: db wPlayerCoins:: dw ; BCD -; bit array of missable objects. set = removed -wMissableObjectFlags:: flag_array $100 -wMissableObjectFlagsEnd:: +; bit array of toggleable objects; bit set = toggled off +wToggleableObjectFlags:: flag_array $100 +wToggleableObjectFlagsEnd:: ds 7 @@ -1920,9 +1920,9 @@ wSavedSpriteImageIndex:: db ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) -; * the missable object index (global, used for wMissableObjectFlags) +; * the toggleable object index (global, used for wToggleableObjectFlags) ; terminated with $FF -wMissableObjectList:: ds 16 * 2 + 1 +wToggleableObjectList:: ds 16 * 2 + 1 ds 1 diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index d43ae546..8ecebd20 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -49,8 +49,8 @@ BillsHousePokemonEntersMachineScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_BILL_POKEMON - ld [wMissableObjectIndex], a + ld a, TOGGLE_BILL_POKEMON + ld [wToggleableObjectIndex], a predef HideObject SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR xor a @@ -75,8 +75,8 @@ BillsHouseBillExitsMachineScript: ld a, 5 ldh [hSpriteMapXCoord], a call SetSpritePosition1 - ld a, HS_BILL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_BILL_1 + ld [wToggleableObjectIndex], a predef ShowObject ld c, 8 call DelayFrames @@ -171,11 +171,11 @@ BillsHouseBillSSTicketText: ld hl, .SSTicketReceivedText call PrintText SetEvent EVENT_GOT_SS_TICKET - ld a, HS_CERULEAN_GUARD_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_GUARD_1 + ld [wToggleableObjectIndex], a predef ShowObject - ld a, HS_CERULEAN_GUARD_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_GUARD_2 + ld [wToggleableObjectIndex], a predef HideObject .got_ss_ticket ld hl, .WhyDontYouGoInsteadOfMeText diff --git a/scripts/BluesHouse.asm b/scripts/BluesHouse.asm index 0a16abbf..b85b6d21 100644 --- a/scripts/BluesHouse.asm +++ b/scripts/BluesHouse.asm @@ -40,8 +40,8 @@ BluesHouseDaisySittingText: lb bc, TOWN_MAP, 1 call GiveItem jr nc, .bag_full - ld a, HS_TOWN_MAP - ld [wMissableObjectIndex], a + ld a, TOGGLE_TOWN_MAP + ld [wToggleableObjectIndex], a predef HideObject ld hl, GotMapText call PrintText diff --git a/scripts/CeladonMansionRoofHouse.asm b/scripts/CeladonMansionRoofHouse.asm index d3c03290..12eff10c 100644 --- a/scripts/CeladonMansionRoofHouse.asm +++ b/scripts/CeladonMansionRoofHouse.asm @@ -15,8 +15,8 @@ CeladonMansionRoofHouseEeveePokeballText: lb bc, EEVEE, 25 call GivePokemon jr nc, .party_full - ld a, HS_CELADON_MANSION_EEVEE_GIFT - ld [wMissableObjectIndex], a + ld a, TOGGLE_CELADON_MANSION_EEVEE_GIFT + ld [wToggleableObjectIndex], a predef HideObject .party_full jp TextScriptEnd diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 4412b49c..cbd60936 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -8,8 +8,8 @@ CeruleanCityClearScripts: xor a ; SCRIPT_CERULEANCITY_DEFAULT ld [wJoyIgnore], a ld [wCeruleanCityCurScript], a - ld a, HS_CERULEAN_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_RIVAL + ld [wToggleableObjectIndex], a predef_jump HideObject CeruleanCity_ScriptPointers: @@ -90,8 +90,8 @@ ENDC call GetPointerWithinSpriteStateData2 ld [hl], 25 .playerOnRightSideOfBridge - ld a, HS_CERULEAN_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_RIVAL + ld [wToggleableObjectIndex], a predef ShowObject ld de, CeruleanCityMovement1 ld a, CERULEANCITY_RIVAL @@ -222,8 +222,8 @@ CeruleanCityRivalCleanupScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_CERULEAN_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_RIVAL + ld [wToggleableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a diff --git a/scripts/CeruleanCity_2.asm b/scripts/CeruleanCity_2.asm index 53ace5c8..85986a7a 100644 --- a/scripts/CeruleanCity_2.asm +++ b/scripts/CeruleanCity_2.asm @@ -3,14 +3,14 @@ CeruleanHideRocket: ; one is called after you beat the Rocket that gives you TM28 DIG. ; the screen then fades out, he disappears, and fades back in call GBFadeOutToBlack - ld a, HS_CERULEAN_GUARD_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_GUARD_1 + ld [wToggleableObjectIndex], a predef ShowObject - ld a, HS_CERULEAN_GUARD_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_GUARD_2 + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_CERULEAN_ROCKET - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_ROCKET + ld [wToggleableObjectIndex], a predef HideObject call GBFadeInFromBlack ret diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index 68448b3d..752a0a31 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -120,8 +120,8 @@ ChampionsRoomOakArrivesScript: ld a, CHAMPIONSROOM_OAK ldh [hSpriteIndex], a call MoveSprite - ld a, HS_CHAMPIONS_ROOM_OAK - ld [wMissableObjectIndex], a + ld a, TOGGLE_CHAMPIONS_ROOM_OAK + ld [wToggleableObjectIndex], a predef ShowObject ld a, SCRIPT_CHAMPIONSROOM_OAK_CONGRATULATES_PLAYER ld [wChampionsRoomCurScript], a @@ -197,8 +197,8 @@ ChampionsRoomOakExitsScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_CHAMPIONS_ROOM_OAK - ld [wMissableObjectIndex], a + ld a, TOGGLE_CHAMPIONS_ROOM_OAK + ld [wToggleableObjectIndex], a predef HideObject ld a, SCRIPT_CHAMPIONSROOM_PLAYER_FOLLOWS_OAK ld [wChampionsRoomCurScript], a diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index 04b35e82..cf822d1f 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -246,8 +246,8 @@ FightingDojoHitmonleePokeBallText: jr nc, .done ; once Poké Ball is taken, hide sprite - ld a, HS_FIGHTING_DOJO_GIFT_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_FIGHTING_DOJO_GIFT_1 + ld [wToggleableObjectIndex], a predef HideObject SetEvents EVENT_GOT_HITMONLEE, EVENT_DEFEATED_FIGHTING_DOJO .done @@ -281,8 +281,8 @@ FightingDojoHitmonchanPokeBallText: SetEvents EVENT_GOT_HITMONCHAN, EVENT_DEFEATED_FIGHTING_DOJO ; once Poké Ball is taken, hide sprite - ld a, HS_FIGHTING_DOJO_GIFT_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_FIGHTING_DOJO_GIFT_2 + ld [wToggleableObjectIndex], a predef HideObject .done jp TextScriptEnd diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 028b5c88..0ead1947 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -107,8 +107,8 @@ GameCornerRocketExitScript: ret nz xor a ld [wJoyIgnore], a - ld a, HS_GAME_CORNER_ROCKET - ld [wMissableObjectIndex], a + ld a, TOGGLE_GAME_CORNER_ROCKET + ld [wToggleableObjectIndex], a predef HideObject ld hl, wCurrentMapScriptFlags set BIT_CUR_MAP_LOADED_1, [hl] diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index 31d56022..8e4f1275 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -96,8 +96,8 @@ HallOfFameOakCongratulationsScript: call DisplayTextID ld a, PAD_BUTTONS | PAD_CTRL_PAD ld [wJoyIgnore], a - ld a, HS_CERULEAN_CAVE_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_CERULEAN_CAVE_GUY + ld [wToggleableObjectIndex], a predef HideObject ld a, SCRIPT_HALLOFFAME_RESET_EVENTS_AND_SAVE ld [wHallOfFameCurScript], a diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 34f11d99..d3c7e57a 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -141,12 +141,12 @@ MtMoonB2FSuperNerdTakesOtherFossilScript: call DisplayTextID CheckEvent EVENT_GOT_DOME_FOSSIL jr z, .got_dome_fossil - ld a, HS_MT_MOON_B2F_FOSSIL_2 + ld a, TOGGLE_MT_MOON_B2F_FOSSIL_2 jr .continue .got_dome_fossil - ld a, HS_MT_MOON_B2F_FOSSIL_1 + ld a, TOGGLE_MT_MOON_B2F_FOSSIL_1 .continue - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a @@ -250,8 +250,8 @@ MtMoonB2FDomeFossilText: call GiveItem jp nc, MtMoonB2FYouHaveNoRoomText call MtMoonB2FReceivedFossilText - ld a, HS_MT_MOON_B2F_FOSSIL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_MT_MOON_B2F_FOSSIL_1 + ld [wToggleableObjectIndex], a predef HideObject SetEvent EVENT_GOT_DOME_FOSSIL ld a, SCRIPT_MTMOONB2F_MOVE_SUPER_NERD @@ -278,8 +278,8 @@ MtMoonB2FHelixFossilText: call GiveItem jp nc, MtMoonB2FYouHaveNoRoomText call MtMoonB2FReceivedFossilText - ld a, HS_MT_MOON_B2F_FOSSIL_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_MT_MOON_B2F_FOSSIL_2 + ld [wToggleableObjectIndex], a predef HideObject SetEvent EVENT_GOT_HELIX_FOSSIL ld a, SCRIPT_MTMOONB2F_MOVE_SUPER_NERD diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 6cb6889a..e56a5c11 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -197,8 +197,8 @@ Museum1FScientist2Text: call GiveItem jr nc, .bag_full SetEvent EVENT_GOT_OLD_AMBER - ld a, HS_OLD_AMBER - ld [wMissableObjectIndex], a + ld a, TOGGLE_OLD_AMBER + ld [wToggleableObjectIndex], a predef HideObject ld hl, .ReceivedOldAmberText jr .done diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 9695b99e..12b58c3f 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -13,7 +13,7 @@ OaksLab_ScriptPointers: def_script_pointers dw_const OaksLabDefaultScript, SCRIPT_OAKSLAB_DEFAULT dw_const OaksLabOakEntersLabScript, SCRIPT_OAKSLAB_OAK_ENTERS_LAB - dw_const OaksLabHideShowOaksScript, SCRIPT_OAKSLAB_HIDE_SHOW_OAKS + dw_const OaksLabToggleOaksScript, SCRIPT_OAKSLAB_TOGGLE_OAKS dw_const OaksLabPlayerEntersLabScript, SCRIPT_OAKSLAB_PLAYER_ENTERS_LAB dw_const OaksLabFollowedOakScript, SCRIPT_OAKSLAB_FOLLOWED_OAK dw_const OaksLabOakChooseMonSpeechScript, SCRIPT_OAKSLAB_OAK_CHOOSE_MON_SPEECH @@ -37,8 +37,8 @@ OaksLabDefaultScript: ld a, [wNPCMovementScriptFunctionNum] and a ret nz - ld a, HS_OAKS_LAB_OAK_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_OAK_2 + ld [wToggleableObjectIndex], a predef ShowObject ld hl, wStatusFlags4 res BIT_NO_BATTLES, [hl] @@ -53,7 +53,7 @@ OaksLabOakEntersLabScript: ld de, OakEntryMovement call MoveSprite - ld a, SCRIPT_OAKSLAB_HIDE_SHOW_OAKS + ld a, SCRIPT_OAKSLAB_TOGGLE_OAKS ld [wOaksLabCurScript], a ret @@ -63,15 +63,15 @@ OakEntryMovement: db NPC_MOVEMENT_UP db -1 ; end -OaksLabHideShowOaksScript: +OaksLabToggleOaksScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_OAKS_LAB_OAK_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_OAK_2 + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_OAKS_LAB_OAK_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_OAK_1 + ld [wToggleableObjectIndex], a predef ShowObject ld a, SCRIPT_OAKSLAB_PLAYER_ENTERS_LAB @@ -306,17 +306,17 @@ OaksLabRivalChoosesStarterScript: ld a, [wRivalStarterBallSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL jr nz, .not_charmander - ld a, HS_STARTER_BALL_1 + ld a, TOGGLE_STARTER_BALL_1 jr .hideBallAndContinue .not_charmander cp OAKSLAB_SQUIRTLE_POKE_BALL jr nz, .not_squirtle - ld a, HS_STARTER_BALL_2 + ld a, TOGGLE_STARTER_BALL_2 jr .hideBallAndContinue .not_squirtle - ld a, HS_STARTER_BALL_3 + ld a, TOGGLE_STARTER_BALL_3 .hideBallAndContinue - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject call Delay3 ld a, [wRivalStarterTemp] @@ -475,8 +475,8 @@ OaksLabPlayerWatchRivalExitScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a jr nz, .checkRivalPosition - ld a, HS_OAKS_LAB_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_RIVAL + ld [wToggleableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a @@ -519,8 +519,8 @@ OaksLabRivalArrivesAtOaksRequestScript: ldh [hTextID], a call DisplayTextID call OaksLabCalcRivalMovementScript - ld a, HS_OAKS_LAB_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_RIVAL + ld [wToggleableObjectIndex], a predef ShowObject ld a, [wNPCMovementDirections2Index] ld [wSavedNPCMovementDirections2Index], a @@ -578,11 +578,11 @@ OaksLabOakGivesPokedexScript: ldh [hTextID], a call DisplayTextID call Delay3 - ld a, HS_POKEDEX_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_POKEDEX_1 + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_POKEDEX_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_POKEDEX_2 + ld [wToggleableObjectIndex], a predef HideObject call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_THAT_WAS_MY_DREAM @@ -599,11 +599,11 @@ OaksLabOakGivesPokedexScript: call DisplayTextID SetEvent EVENT_GOT_POKEDEX SetEvent EVENT_OAK_GOT_PARCEL - ld a, HS_LYING_OLD_MAN - ld [wMissableObjectIndex], a + ld a, TOGGLE_LYING_OLD_MAN + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_OLD_MAN - ld [wMissableObjectIndex], a + ld a, TOGGLE_OLD_MAN + ld [wToggleableObjectIndex], a predef ShowObject ld a, [wSavedNPCMovementDirections2Index] ld b, 0 @@ -630,14 +630,14 @@ OaksLabRivalLeavesWithPokedexScript: bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call PlayDefaultMusic - ld a, HS_OAKS_LAB_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_OAKS_LAB_RIVAL + ld [wToggleableObjectIndex], a predef HideObject SetEvent EVENT_1ST_ROUTE22_RIVAL_BATTLE ResetEventReuseHL EVENT_2ND_ROUTE22_RIVAL_BATTLE SetEventReuseHL EVENT_ROUTE22_RIVAL_WANTS_BATTLE - ld a, HS_ROUTE_22_RIVAL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_22_RIVAL_1 + ld [wToggleableObjectIndex], a predef ShowObject ld a, SCRIPT_PALLETTOWN_DAISY ld [wPalletTownCurScript], a @@ -904,17 +904,17 @@ OaksLabMonChoiceMenu: ld a, [wSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL jr nz, .not_charmander - ld a, HS_STARTER_BALL_1 + ld a, TOGGLE_STARTER_BALL_1 jr .continue .not_charmander cp OAKSLAB_SQUIRTLE_POKE_BALL jr nz, .not_squirtle - ld a, HS_STARTER_BALL_2 + ld a, TOGGLE_STARTER_BALL_2 jr .continue .not_squirtle - ld a, HS_STARTER_BALL_3 + ld a, TOGGLE_STARTER_BALL_3 .continue - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 57c231fa..de88945f 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -51,8 +51,8 @@ PalletTownOakHeyWaitScript: call DisplayTextID ld a, PAD_BUTTONS | PAD_CTRL_PAD ld [wJoyIgnore], a - ld a, HS_PALLET_TOWN_OAK - ld [wMissableObjectIndex], a + ld a, TOGGLE_PALLET_TOWN_OAK + ld [wToggleableObjectIndex], a predef ShowObject ; trigger the next script @@ -136,11 +136,11 @@ PalletTownDaisyScript: CheckBothEventsSet EVENT_GOT_TOWN_MAP, EVENT_ENTERED_BLUES_HOUSE, 1 jr nz, .next SetEvent EVENT_DAISY_WALKING - ld a, HS_DAISY_SITTING - ld [wMissableObjectIndex], a + ld a, TOGGLE_DAISY_SITTING + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_DAISY_WALKING - ld [wMissableObjectIndex], a + ld a, TOGGLE_DAISY_WALKING + ld [wToggleableObjectIndex], a predef_jump ShowObject .next CheckEvent EVENT_GOT_POKEBALLS_FROM_OAK diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index 9693b88f..549a1cad 100644 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -92,8 +92,8 @@ PewterCityHideSuperNerd1Script: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_MUSEUM_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_MUSEUM_GUY + ld [wToggleableObjectIndex], a predef HideObject ld a, SCRIPT_PEWTERCITY_RESET_SUPER_NERD1 ld [wPewterCityCurScript], a @@ -103,8 +103,8 @@ PewterCityResetSuperNerd1Script: ld a, PEWTERCITY_SUPER_NERD1 ld [wSpriteIndex], a call SetSpritePosition2 - ld a, HS_MUSEUM_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_MUSEUM_GUY + ld [wToggleableObjectIndex], a predef ShowObject xor a ld [wJoyIgnore], a @@ -161,8 +161,8 @@ PewterCityHideYoungsterScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_GYM_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_GYM_GUY + ld [wToggleableObjectIndex], a predef HideObject ld a, SCRIPT_PEWTERCITY_RESET_YOUNGSTER ld [wPewterCityCurScript], a @@ -172,8 +172,8 @@ PewterCityResetYoungsterScript: ld a, PEWTERCITY_YOUNGSTER ld [wSpriteIndex], a call SetSpritePosition2 - ld a, HS_GYM_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_GYM_GUY + ld [wToggleableObjectIndex], a predef ShowObject xor a ld [wJoyIgnore], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index 0f4b9ebe..40a04d73 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -66,11 +66,11 @@ PewterGymScriptReceiveTM34: ld hl, wBeatGymFlags set BIT_BOULDERBADGE, [hl] - ld a, HS_GYM_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_GYM_GUY + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_ROUTE_22_RIVAL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_22_RIVAL_1 + ld [wToggleableObjectIndex], a predef HideObject ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index d3b6c9a4..1888e511 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -116,8 +116,8 @@ PokemonTower2FRivalExitsScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_POKEMON_TOWER_2F_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_POKEMON_TOWER_2F_RIVAL + ld [wToggleableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index 3d8cd636..908e089e 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -44,15 +44,15 @@ PokemonTower7FHideNPCScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld hl, wMissableObjectList + ld hl, wToggleableObjectList ld a, [wSpriteIndex] ld b, a -.missableObjectsListLoop +.toggleableObjectsListLoop ld a, [hli] - cp b ; search for sprite ID in missing objects list + cp b ; search for sprite ID in toggleable objects list ld a, [hli] - jr nz, .missableObjectsListLoop - ld [wMissableObjectIndex], a ; remove missable object + jr nz, .toggleableObjectsListLoop + ld [wToggleableObjectIndex], a ; remove toggleable object predef HideObject xor a ld [wJoyIgnore], a @@ -67,8 +67,8 @@ PokemonTower7FHideNPCScript: PokemonTower7FWarpToMrFujiHouseScript: ld a, PAD_BUTTONS | PAD_CTRL_PAD ld [wJoyIgnore], a - ld a, HS_POKEMON_TOWER_7F_MR_FUJI - ld [wMissableObjectIndex], a + ld a, TOGGLE_POKEMON_TOWER_7F_MR_FUJI + ld [wToggleableObjectIndex], a predef HideObject ld a, SPRITE_FACING_UP ld [wSpritePlayerStateData1FacingDirection], a @@ -228,14 +228,14 @@ PokemonTower7FMrFujiText: call PrintText SetEvent EVENT_RESCUED_MR_FUJI SetEvent EVENT_RESCUED_MR_FUJI_2 - ld a, HS_MR_FUJIS_HOUSE_MR_FUJI - ld [wMissableObjectIndex], a + ld a, TOGGLE_MR_FUJIS_HOUSE_MR_FUJI + ld [wToggleableObjectIndex], a predef ShowObject - ld a, HS_SAFFRON_CITY_E - ld [wMissableObjectIndex], a + ld a, TOGGLE_SAFFRON_CITY_E + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_SAFFRON_CITY_F - ld [wMissableObjectIndex], a + ld a, TOGGLE_SAFFRON_CITY_F + ld [wToggleableObjectIndex], a predef ShowObject ld a, SCRIPT_POKEMONTOWER7F_WARP_TO_MR_FUJI_HOUSE ld [wPokemonTower7FCurScript], a diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index edc51351..7bc3ec31 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -56,11 +56,11 @@ RocketHideoutB4FBeatGiovanniScript: ldh [hTextID], a call DisplayTextID call GBFadeOutToBlack - ld a, HS_ROCKET_HIDEOUT_B4F_GIOVANNI - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROCKET_HIDEOUT_B4F_GIOVANNI + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_ROCKET_HIDEOUT_B4F_ITEM_4 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_4 + ld [wToggleableObjectIndex], a predef ShowObject call UpdateSprites call GBFadeInFromBlack @@ -192,8 +192,8 @@ RocketHideoutB4FRocket3AfterBattleText: call PrintText CheckAndSetEvent EVENT_ROCKET_DROPPED_LIFT_KEY jr nz, .done - ld a, HS_ROCKET_HIDEOUT_B4F_ITEM_5 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROCKET_HIDEOUT_B4F_ITEM_5 + ld [wToggleableObjectIndex], a predef ShowObject .done jp TextScriptEnd diff --git a/scripts/Route12.asm b/scripts/Route12.asm index ea9fc567..a6984f87 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -34,8 +34,8 @@ Route12DefaultScript: ld [wCurOpponent], a ld a, 30 ld [wCurEnemyLevel], a - ld a, HS_ROUTE_12_SNORLAX - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_12_SNORLAX + ld [wToggleableObjectIndex], a predef HideObject ld a, SCRIPT_ROUTE12_SNORLAX_POST_BATTLE ld [wRoute12CurScript], a diff --git a/scripts/Route16.asm b/scripts/Route16.asm index 6e3da97c..a1eb6e85 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -34,8 +34,8 @@ Route16DefaultScript: ld [wCurOpponent], a ld a, 30 ld [wCurEnemyLevel], a - ld a, HS_ROUTE_16_SNORLAX - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_16_SNORLAX + ld [wToggleableObjectIndex], a predef HideObject call UpdateSprites ld a, SCRIPT_ROUTE16_SNORLAX_POST_BATTLE diff --git a/scripts/Route20.asm b/scripts/Route20.asm index 5230858e..3c528b09 100644 --- a/scripts/Route20.asm +++ b/scripts/Route20.asm @@ -12,48 +12,48 @@ Route20_Script: Route20BoulderScript: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE jr z, .next_boulder_check - ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_1 call Route20ShowObjectScript - ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_2 call Route20ShowObjectScript - ld hl, .MissableObjectIDs -.hide_missable_objects + ld hl, .ToggleableObjectIDs +.hide_toggleable_objects ld a, [hli] cp $ff jr z, .next_boulder_check push hl call Route20HideObjectScript pop hl - jr .hide_missable_objects - -.MissableObjectIDs: - db HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 - db HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 - db HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 - db HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 - db HS_SEAFOAM_ISLANDS_B3F_BOULDER_3 - db HS_SEAFOAM_ISLANDS_B3F_BOULDER_4 + jr .hide_toggleable_objects + +.ToggleableObjectIDs: + db TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_1 + db TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_2 + db TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_1 + db TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_2 + db TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_3 + db TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_4 db -1 ; end .next_boulder_check CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ret z - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_1 call Route20ShowObjectScript - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_2 call Route20ShowObjectScript - ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_1 call Route20HideObjectScript - ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_2 call Route20HideObjectScript ret Route20ShowObjectScript: - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef_jump ShowObject Route20HideObjectScript: - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef_jump HideObject Route20_ScriptPointers: diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 80f54290..bef22665 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -224,8 +224,8 @@ Route22Rival1ExitScript: ret nz xor a ld [wJoyIgnore], a - ld a, HS_ROUTE_22_RIVAL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_22_RIVAL_1 + ld [wToggleableObjectIndex], a predef HideObject call PlayDefaultMusic ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE @@ -368,8 +368,8 @@ Route22Rival2ExitScript: ret nz xor a ld [wJoyIgnore], a - ld a, HS_ROUTE_22_RIVAL_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_22_RIVAL_2 + ld [wToggleableObjectIndex], a predef HideObject call PlayDefaultMusic ResetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE diff --git a/scripts/Route23.asm b/scripts/Route23.asm index 911a2ef3..07558996 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -12,11 +12,11 @@ Route23SetVictoryRoadBoulders: ret z ResetEvents EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ResetEvents EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 - ld a, HS_VICTORY_ROAD_3F_BOULDER - ld [wMissableObjectIndex], a + ld a, TOGGLE_VICTORY_ROAD_3F_BOULDER + ld [wToggleableObjectIndex], a predef ShowObject - ld a, HS_VICTORY_ROAD_2F_BOULDER - ld [wMissableObjectIndex], a + ld a, TOGGLE_VICTORY_ROAD_2F_BOULDER + ld [wToggleableObjectIndex], a predef_jump HideObject Route23_ScriptPointers: diff --git a/scripts/Route25.asm b/scripts/Route25.asm index a85144a8..a4210cc5 100644 --- a/scripts/Route25.asm +++ b/scripts/Route25.asm @@ -1,5 +1,5 @@ Route25_Script: - call Route25ShowHideBillScript + call Route25ToggleBillsScript call EnableAutoTextBoxDrawing ld hl, Route25TrainerHeaders ld de, Route25_ScriptPointers @@ -8,7 +8,7 @@ Route25_Script: ld [wRoute25CurScript], a ret -Route25ShowHideBillScript: +Route25ToggleBillsScript: ld hl, wCurrentMapScriptFlags bit BIT_CUR_MAP_LOADED_2, [hl] res BIT_CUR_MAP_LOADED_2, [hl] @@ -18,21 +18,21 @@ Route25ShowHideBillScript: CheckEventReuseHL EVENT_MET_BILL_2 jr nz, .met_bill ResetEventReuseHL EVENT_BILL_SAID_USE_CELL_SEPARATOR - ld a, HS_BILL_POKEMON - ld [wMissableObjectIndex], a + ld a, TOGGLE_BILL_POKEMON + ld [wToggleableObjectIndex], a predef_jump ShowObject .met_bill CheckEventAfterBranchReuseHL EVENT_GOT_SS_TICKET, EVENT_MET_BILL_2 ret z SetEventReuseHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING - ld a, HS_NUGGET_BRIDGE_GUY - ld [wMissableObjectIndex], a + ld a, TOGGLE_NUGGET_BRIDGE_GUY + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_BILL_1 - ld [wMissableObjectIndex], a + ld a, TOGGLE_BILL_1 + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_BILL_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_BILL_2 + ld [wToggleableObjectIndex], a predef_jump ShowObject Route25_ScriptPointers: diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index ee860fd9..32ea70d1 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -33,8 +33,8 @@ SSAnne2FDefaultScript: call PlayMusic ld a, [wCoordIndex] ldh [hSavedCoordIndex], a - ld a, HS_SS_ANNE_2F_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_SS_ANNE_2F_RIVAL + ld [wToggleableObjectIndex], a predef ShowObject call Delay3 ld a, SSANNE2F_RIVAL @@ -169,8 +169,8 @@ SSAnne2FRivalExitScript: ret nz xor a ld [wJoyIgnore], a - ld a, HS_SS_ANNE_2F_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_SS_ANNE_2F_RIVAL + ld [wToggleableObjectIndex], a predef HideObject call PlayDefaultMusic ld a, SCRIPT_SSANNE2F_NOOP diff --git a/scripts/SeafoamIslands1F.asm b/scripts/SeafoamIslands1F.asm index a3ec3c99..1e099f76 100644 --- a/scripts/SeafoamIslands1F.asm +++ b/scripts/SeafoamIslands1F.asm @@ -13,23 +13,23 @@ SeafoamIslands1F_Script: cp $1 jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_1 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToShow], a jr .hideAndShowBoulderObjects .boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM1_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_1F_BOULDER_2 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToShow], a .hideAndShowBoulderObjects ld a, [wObjectToHide] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject ld a, [wObjectToShow] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef_jump ShowObject .noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B1F diff --git a/scripts/SeafoamIslandsB1F.asm b/scripts/SeafoamIslandsB1F.asm index 0bc2ee18..7558e95b 100644 --- a/scripts/SeafoamIslandsB1F.asm +++ b/scripts/SeafoamIslandsB1F.asm @@ -12,23 +12,23 @@ SeafoamIslandsB1F_Script: cp $1 jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToShow], a jr .hideAndShowBoulderObjects .boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToShow], a .hideAndShowBoulderObjects ld a, [wObjectToHide] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject ld a, [wObjectToShow] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef_jump ShowObject .noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B2F diff --git a/scripts/SeafoamIslandsB2F.asm b/scripts/SeafoamIslandsB2F.asm index 48b7979d..2cdb705e 100644 --- a/scripts/SeafoamIslandsB2F.asm +++ b/scripts/SeafoamIslandsB2F.asm @@ -12,23 +12,23 @@ SeafoamIslandsB2F_Script: cp $1 jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_3 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_3 ld [wObjectToShow], a jr .hideAndShowBoulderObjects .boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_4 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_4 ld [wObjectToShow], a .hideAndShowBoulderObjects ld a, [wObjectToHide] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject ld a, [wObjectToShow] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef_jump ShowObject .noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B3F diff --git a/scripts/SeafoamIslandsB3F.asm b/scripts/SeafoamIslandsB3F.asm index 671d7719..d8e253b6 100644 --- a/scripts/SeafoamIslandsB3F.asm +++ b/scripts/SeafoamIslandsB3F.asm @@ -12,23 +12,23 @@ SeafoamIslandsB3F_Script: cp $1 jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_1 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 + ld a, TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_1 ld [wObjectToShow], a jr .hideAndShowBoulderObjects .boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE - ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B3F_BOULDER_2 ld [wObjectToHide], a - ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 + ld a, TOGGLE_SEAFOAM_ISLANDS_B4F_BOULDER_2 ld [wObjectToShow], a .hideAndShowBoulderObjects ld a, [wObjectToHide] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject ld a, [wObjectToShow] - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef ShowObject jr .runCurrentMapScript .noBoulderWasPushed diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 75c545e3..a804ce6d 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -71,78 +71,78 @@ SilphCo11FSetUnlockedDoorEventScript: ret SilphCo11FTeamRocketLeavesScript: - ld hl, .HideMissableObjectIDs + ld hl, .HideToggleableObjectIDs .hide_loop ld a, [hli] cp $ff jr z, .done_hiding push hl - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef HideObject pop hl jr .hide_loop .done_hiding - ld hl, .ShowMissableObjectIDs + ld hl, .ShowToggleableObjectIDs .show_loop ld a, [hli] cp -1 ret z push hl - ld [wMissableObjectIndex], a + ld [wToggleableObjectIndex], a predef ShowObject pop hl jr .show_loop -.ShowMissableObjectIDs: - db HS_SAFFRON_CITY_8 - db HS_SAFFRON_CITY_9 - db HS_SAFFRON_CITY_A - db HS_SAFFRON_CITY_B - db HS_SAFFRON_CITY_C - db HS_SAFFRON_CITY_D +.ShowToggleableObjectIDs: + db TOGGLE_SAFFRON_CITY_8 + db TOGGLE_SAFFRON_CITY_9 + db TOGGLE_SAFFRON_CITY_A + db TOGGLE_SAFFRON_CITY_B + db TOGGLE_SAFFRON_CITY_C + db TOGGLE_SAFFRON_CITY_D db -1 ; end -.HideMissableObjectIDs: - db HS_SAFFRON_CITY_1 - db HS_SAFFRON_CITY_2 - db HS_SAFFRON_CITY_3 - db HS_SAFFRON_CITY_4 - db HS_SAFFRON_CITY_5 - db HS_SAFFRON_CITY_6 - db HS_SAFFRON_CITY_7 - db HS_SAFFRON_CITY_E - db HS_SAFFRON_CITY_F - db HS_SILPH_CO_2F_2 - db HS_SILPH_CO_2F_3 - db HS_SILPH_CO_2F_4 - db HS_SILPH_CO_2F_5 - db HS_SILPH_CO_3F_1 - db HS_SILPH_CO_3F_2 - db HS_SILPH_CO_4F_1 - db HS_SILPH_CO_4F_2 - db HS_SILPH_CO_4F_3 - db HS_SILPH_CO_5F_1 - db HS_SILPH_CO_5F_2 - db HS_SILPH_CO_5F_3 - db HS_SILPH_CO_5F_4 - db HS_SILPH_CO_6F_1 - db HS_SILPH_CO_6F_2 - db HS_SILPH_CO_6F_3 - db HS_SILPH_CO_7F_1 - db HS_SILPH_CO_7F_2 - db HS_SILPH_CO_7F_3 - db HS_SILPH_CO_7F_4 - db HS_SILPH_CO_8F_1 - db HS_SILPH_CO_8F_2 - db HS_SILPH_CO_8F_3 - db HS_SILPH_CO_9F_1 - db HS_SILPH_CO_9F_2 - db HS_SILPH_CO_9F_3 - db HS_SILPH_CO_10F_1 - db HS_SILPH_CO_10F_2 - db HS_SILPH_CO_11F_1 - db HS_SILPH_CO_11F_2 - db HS_SILPH_CO_11F_3 +.HideToggleableObjectIDs: + db TOGGLE_SAFFRON_CITY_1 + db TOGGLE_SAFFRON_CITY_2 + db TOGGLE_SAFFRON_CITY_3 + db TOGGLE_SAFFRON_CITY_4 + db TOGGLE_SAFFRON_CITY_5 + db TOGGLE_SAFFRON_CITY_6 + db TOGGLE_SAFFRON_CITY_7 + db TOGGLE_SAFFRON_CITY_E + db TOGGLE_SAFFRON_CITY_F + db TOGGLE_SILPH_CO_2F_2 + db TOGGLE_SILPH_CO_2F_3 + db TOGGLE_SILPH_CO_2F_4 + db TOGGLE_SILPH_CO_2F_5 + db TOGGLE_SILPH_CO_3F_1 + db TOGGLE_SILPH_CO_3F_2 + db TOGGLE_SILPH_CO_4F_1 + db TOGGLE_SILPH_CO_4F_2 + db TOGGLE_SILPH_CO_4F_3 + db TOGGLE_SILPH_CO_5F_1 + db TOGGLE_SILPH_CO_5F_2 + db TOGGLE_SILPH_CO_5F_3 + db TOGGLE_SILPH_CO_5F_4 + db TOGGLE_SILPH_CO_6F_1 + db TOGGLE_SILPH_CO_6F_2 + db TOGGLE_SILPH_CO_6F_3 + db TOGGLE_SILPH_CO_7F_1 + db TOGGLE_SILPH_CO_7F_2 + db TOGGLE_SILPH_CO_7F_3 + db TOGGLE_SILPH_CO_7F_4 + db TOGGLE_SILPH_CO_8F_1 + db TOGGLE_SILPH_CO_8F_2 + db TOGGLE_SILPH_CO_8F_3 + db TOGGLE_SILPH_CO_9F_1 + db TOGGLE_SILPH_CO_9F_2 + db TOGGLE_SILPH_CO_9F_3 + db TOGGLE_SILPH_CO_10F_1 + db TOGGLE_SILPH_CO_10F_2 + db TOGGLE_SILPH_CO_11F_1 + db TOGGLE_SILPH_CO_11F_2 + db TOGGLE_SILPH_CO_11F_3 db -1 ; end SilphCo11FResetCurScript: diff --git a/scripts/SilphCo1F.asm b/scripts/SilphCo1F.asm index fbc70d77..acb506fc 100644 --- a/scripts/SilphCo1F.asm +++ b/scripts/SilphCo1F.asm @@ -4,8 +4,8 @@ SilphCo1F_Script: ret z CheckAndSetEvent EVENT_SILPH_CO_RECEPTIONIST_AT_DESK ret nz - ld a, HS_SILPH_CO_1F_RECEPTIONIST - ld [wMissableObjectIndex], a + ld a, TOGGLE_SILPH_CO_1F_RECEPTIONIST + ld [wToggleableObjectIndex], a predef_jump ShowObject SilphCo1F_TextPointers: diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index 29e5fdd3..6b640fd4 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -255,8 +255,8 @@ SilphCo7FRivalExitScript: ld a, [wStatusFlags5] bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz - ld a, HS_SILPH_CO_7F_RIVAL - ld [wMissableObjectIndex], a + ld a, TOGGLE_SILPH_CO_7F_RIVAL + ld [wToggleableObjectIndex], a predef HideObject call PlayDefaultMusic xor a diff --git a/scripts/VictoryRoad3F.asm b/scripts/VictoryRoad3F.asm index 2b1b11c0..4a082be5 100644 --- a/scripts/VictoryRoad3F.asm +++ b/scripts/VictoryRoad3F.asm @@ -44,11 +44,11 @@ VictoryRoad3FDefaultScript: .handle_hole CheckAndSetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 jr nz, .check_switch_hole - ld a, HS_VICTORY_ROAD_3F_BOULDER - ld [wMissableObjectIndex], a + ld a, TOGGLE_VICTORY_ROAD_3F_BOULDER + ld [wToggleableObjectIndex], a predef HideObject - ld a, HS_VICTORY_ROAD_2F_BOULDER - ld [wMissableObjectIndex], a + ld a, TOGGLE_VICTORY_ROAD_2F_BOULDER + ld [wToggleableObjectIndex], a predef_jump ShowObject .SwitchOrHoleCoords: diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index 6f195037..c2b8c362 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -161,8 +161,8 @@ ViridianGymReceiveTM27: ; deactivate gym trainers SetEventRange EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0, EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7 - ld a, HS_ROUTE_22_RIVAL_2 - ld [wMissableObjectIndex], a + ld a, TOGGLE_ROUTE_22_RIVAL_2 + ld [wToggleableObjectIndex], a predef ShowObject SetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE jp ViridianGymResetScripts @@ -219,8 +219,8 @@ ViridianGymGiovanniText: ld hl, .PostBattleAdviceText call PrintText call GBFadeOutToBlack - ld a, HS_VIRIDIAN_GYM_GIOVANNI - ld [wMissableObjectIndex], a + ld a, TOGGLE_VIRIDIAN_GYM_GIOVANNI + ld [wToggleableObjectIndex], a predef HideObject call UpdateSprites call Delay3 -- cgit v1.3.1-sl0p