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 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'constants') 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 -- 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 'constants') 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 'constants') 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 8bb03542bd0dd01b1e4fce990751edc0822a878f Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:46:28 +0100 Subject: Update `StatusScreen`, add `*_STATS_BOX` constants (#546) --- constants/menu_constants.asm | 5 +++ engine/battle/experience.asm | 2 +- engine/items/item_effects.asm | 22 ++++++------- engine/pokemon/status_screen.asm | 70 ++++++++++++++++++---------------------- home/pics.asm | 4 +-- 5 files changed, 51 insertions(+), 52 deletions(-) (limited to 'constants') diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index a6e035e7..c4476e03 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -90,3 +90,8 @@ DEF FIRST_PARTY_MENU_TEXT_ID EQU const_value const NAME_PLAYER_SCREEN ; 0 const NAME_RIVAL_SCREEN ; 1 const NAME_MON_SCREEN ; 2 + +; Stats box layout (see engine/pokemon/status_screen.asm) + const_def + const STATUS_SCREEN_STATS_BOX ; 0 + const LEVEL_UP_STATS_BOX ; 1 diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 4e44643c..f9f47f82 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -245,7 +245,7 @@ GainExperience: xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData - ld d, $1 + ld d, LEVEL_UP_STATS_BOX callfar PrintStatsBox call WaitForTextScrollButtonPress call LoadScreenTilesFromBuffer1 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index a716ebb7..90853bee 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1400,15 +1400,15 @@ ItemUseMedicine: xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData - ld d, $01 - callfar PrintStatsBox ; display new stats text box - call WaitForTextScrollButtonPress ; wait for button press + ld d, LEVEL_UP_STATS_BOX + callfar PrintStatsBox + call WaitForTextScrollButtonPress xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - predef LearnMoveFromLevelUp ; learn level up move, if any + predef LearnMoveFromLevelUp xor a ld [wForceEvolution], a - callfar TryEvolvingMon ; evolve pokemon, if appropriate + callfar TryEvolvingMon ld a, $01 ld [wUpdateSpritesEnabled], a pop af @@ -1433,11 +1433,11 @@ INCLUDE "data/battle/stat_names.asm" ItemUseBait: ld hl, ThrewBaitText call PrintText - ld hl, wEnemyMonActualCatchRate ; catch rate + ld hl, wEnemyMonActualCatchRate srl [hl] ; halve catch rate ld a, BAIT_ANIM - ld hl, wSafariBaitFactor ; bait factor - ld de, wSafariEscapeFactor ; escape factor + ld hl, wSafariBaitFactor + ld de, wSafariEscapeFactor jr BaitRockCommon ; for CASCADEBADGE when used from the @@ -1446,7 +1446,7 @@ ItemUseBait: ItemUseRock: ld hl, ThrewRockText call PrintText - ld hl, wEnemyMonActualCatchRate ; catch rate + ld hl, wEnemyMonActualCatchRate ld a, [hl] add a ; double catch rate jr nc, .noCarry @@ -1454,8 +1454,8 @@ ItemUseRock: .noCarry ld [hl], a ld a, ROCK_ANIM - ld hl, wSafariEscapeFactor ; escape factor - ld de, wSafariBaitFactor ; bait factor + ld hl, wSafariEscapeFactor + ld de, wSafariBaitFactor BaitRockCommon: ld [wAnimationID], a diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 9c708a22..84a56d5a 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -61,8 +61,6 @@ DrawHP_: pop de ret - -; Predef 0x37 StatusScreen: call LoadMonData ld a, [wMonDataLocation] @@ -75,7 +73,7 @@ StatusScreen: ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 - call CalcStats ; Recalculate stats + call CalcStats .DontRecalculate ld hl, wStatusFlags2 set BIT_NO_AUDIO_FADE_OUT, [hl] @@ -117,8 +115,8 @@ StatusScreen: lb bc, 8, 6 call DrawLineBox ; Draws the box around types, ID No. and OT hlcoord 10, 9 - ld de, Type1Text - call PlaceString ; "TYPE1/" + ld de, TypesIDNoOTText + call PlaceString hlcoord 11, 3 predef DrawHP ld hl, wStatusScreenHPBarColor @@ -137,7 +135,7 @@ StatusScreen: ld de, StatusText call PlaceString ; "STATUS/" hlcoord 14, 2 - call PrintLevel ; Pokémon level + call PrintLevel ld a, [wMonHIndex] ld [wPokedexNum], a ld [wCurSpecies], a @@ -164,7 +162,7 @@ StatusScreen: ld de, wLoadedMonOTID lb bc, LEADING_ZEROES | 2, 5 call PrintNumber ; ID Number - ld d, $0 + ld d, STATUS_SCREEN_STATS_BOX call PrintStatsBox call Delay3 call GBPalNormal @@ -204,20 +202,11 @@ NamePointers2: dw wBoxMonNicks dw wDayCareMonName -Type1Text: +TypesIDNoOTText: db "TYPE1/" - next "" - ; fallthrough -Type2Text: - db "TYPE2/" - next "" - ; fallthrough -IDNoText: - db "№/" - next "" - ; fallthrough -OTText: - db "OT/" + next "TYPE2/" + next "№/" + next "OT/" next "@" StatusText: @@ -248,40 +237,42 @@ PTile: INCBIN "gfx/font/P.1bpp" PrintStatsBox: ld a, d - and a ; a is 0 from the status screen - jr nz, .DifferentBox + ASSERT STATUS_SCREEN_STATS_BOX == 0 + and a + jr nz, .LevelUpStatsBox ; battle or Rare Candy hlcoord 0, 8 ld b, 8 ld c, 8 - call TextBoxBorder ; Draws the box - hlcoord 1, 9 ; Start printing stats from here - ld bc, $19 ; Number offset + call TextBoxBorder + hlcoord 1, 9 + ld bc, SCREEN_WIDTH + 5 ; one row down and 5 columns right jr .PrintStats -.DifferentBox +.LevelUpStatsBox hlcoord 9, 2 ld b, 8 ld c, 9 call TextBoxBorder hlcoord 11, 3 - ld bc, $18 + ld bc, SCREEN_WIDTH + 4 ; one row down and 4 columns right .PrintStats push bc push hl - ld de, StatsText + ld de, .StatsText call PlaceString pop hl pop bc add hl, bc ld de, wLoadedMonAttack lb bc, 2, 3 - call PrintStat + call .PrintStat ld de, wLoadedMonDefense - call PrintStat + call .PrintStat ld de, wLoadedMonSpeed - call PrintStat + call .PrintStat ld de, wLoadedMonSpecial jp PrintNumber -PrintStat: + +.PrintStat: push hl call PrintNumber pop hl @@ -289,7 +280,7 @@ PrintStat: add hl, de ret -StatsText: +.StatsText: db "ATTACK" next "DEFENSE" next "SPEED" @@ -323,10 +314,10 @@ StatusScreen2: call PlaceString ; Print moves ld a, [wNumMovesMinusOne] inc a - ld c, a - ld a, $4 + ld c, a ; number of known moves + ld a, NUM_MOVES sub c - ld b, a ; Number of moves ? + ld b, a ; number of blank moves hlcoord 11, 10 ld de, SCREEN_WIDTH * 2 ld a, '' @@ -386,7 +377,7 @@ StatusScreen2: pop bc inc b ld a, b - cp $4 + cp NUM_MOVES jr nz, .PrintPP .PPDone hlcoord 9, 3 @@ -415,8 +406,11 @@ StatusScreen2: hlcoord 7, 6 lb bc, 3, 7 call PrintNumber ; exp needed to level up + + ; unneeded, this clears the diacritic characters in JPN versions hlcoord 9, 0 call StatusScreen_ClearName + hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] @@ -468,7 +462,7 @@ StatusScreenExpText: next "LEVEL UP@" StatusScreen_ClearName: - ld bc, 10 + ld bc, NAME_LENGTH - 1 ld a, ' ' jp FillMemory diff --git a/home/pics.asm b/home/pics.asm index 475e834d..5ebb8f82 100644 --- a/home/pics.asm +++ b/home/pics.asm @@ -188,9 +188,9 @@ InterlaceMergeSpriteBuffers:: or c jr nz, .swapLoop .notFlipped - pop hl + pop hl ; hl = output address ld de, sSpriteBuffer1 - ld c, (2 * SPRITEBUFFERSIZE) / TILE_SIZE ; $31, number of 16 byte chunks to be copied + ld c, PIC_SIZE ; tiles ldh a, [hLoadedROMBank] ld b, a jp CopyVideoData -- cgit v1.3.1-sl0p From e1948fe4b3994be5e08d5abc39fdf326b5421eb8 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:02:37 -0500 Subject: Clarify how the order of map constants matters for the Town Map (#553) --- constants/map_constants.asm | 133 ++++++++++++++++++++++++++- data/maps/town_map_entries.asm | 204 +++++++++++++++++++++-------------------- 2 files changed, 235 insertions(+), 102 deletions(-) (limited to 'constants') diff --git a/constants/map_constants.asm b/constants/map_constants.asm index dad63579..7ae4af44 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -4,6 +4,13 @@ MACRO map_const DEF \1_HEIGHT EQU \3 ENDM +; "Indoor" maps are grouped sequentially (see data/maps/town_map_entries.asm) +DEF NUM_INDOOR_MAP_GROUPS EQU 0 +MACRO end_indoor_group + DEF INDOORGROUP_\1 EQU const_value + REDEF NUM_INDOOR_MAP_GROUPS EQU NUM_INDOOR_MAP_GROUPS + 1 +ENDM + ; map ids ; indexes for: ; - MapHeaderBanks (see data/maps/map_header_banks.asm) @@ -28,7 +35,9 @@ ENDM map_const INDIGO_PLATEAU, 10, 9 ; $09 map_const SAFFRON_CITY, 20, 18 ; $0A DEF NUM_CITY_MAPS EQU const_value + map_const UNUSED_MAP_0B, 0, 0 ; $0B + DEF FIRST_ROUTE_MAP EQU const_value map_const ROUTE_1, 10, 18 ; $0C map_const ROUTE_2, 10, 36 ; $0D @@ -55,22 +64,31 @@ DEF FIRST_ROUTE_MAP EQU const_value map_const ROUTE_23, 10, 72 ; $22 map_const ROUTE_24, 10, 18 ; $23 map_const ROUTE_25, 30, 9 ; $24 + DEF FIRST_INDOOR_MAP EQU const_value map_const REDS_HOUSE_1F, 4, 4 ; $25 map_const REDS_HOUSE_2F, 4, 4 ; $26 map_const BLUES_HOUSE, 4, 4 ; $27 map_const OAKS_LAB, 5, 6 ; $28 + end_indoor_group PALLET_TOWN + map_const VIRIDIAN_POKECENTER, 7, 4 ; $29 map_const VIRIDIAN_MART, 4, 4 ; $2A map_const VIRIDIAN_SCHOOL_HOUSE, 4, 4 ; $2B map_const VIRIDIAN_NICKNAME_HOUSE, 4, 4 ; $2C map_const VIRIDIAN_GYM, 10, 9 ; $2D + end_indoor_group VIRIDIAN_CITY + map_const DIGLETTS_CAVE_ROUTE_2, 4, 4 ; $2E map_const VIRIDIAN_FOREST_NORTH_GATE, 5, 4 ; $2F map_const ROUTE_2_TRADE_HOUSE, 4, 4 ; $30 map_const ROUTE_2_GATE, 5, 4 ; $31 map_const VIRIDIAN_FOREST_SOUTH_GATE, 5, 4 ; $32 + end_indoor_group ROUTE_2 + map_const VIRIDIAN_FOREST, 17, 24 ; $33 + end_indoor_group VIRIDIAN_FOREST + map_const MUSEUM_1F, 10, 4 ; $34 map_const MUSEUM_2F, 7, 4 ; $35 map_const PEWTER_GYM, 5, 7 ; $36 @@ -78,42 +96,72 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const PEWTER_MART, 4, 4 ; $38 map_const PEWTER_SPEECH_HOUSE, 4, 4 ; $39 map_const PEWTER_POKECENTER, 7, 4 ; $3A + end_indoor_group PEWTER_CITY + map_const MT_MOON_1F, 20, 18 ; $3B map_const MT_MOON_B1F, 14, 14 ; $3C map_const MT_MOON_B2F, 20, 18 ; $3D + end_indoor_group MT_MOON + map_const CERULEAN_TRASHED_HOUSE, 4, 4 ; $3E map_const CERULEAN_TRADE_HOUSE, 4, 4 ; $3F map_const CERULEAN_POKECENTER, 7, 4 ; $40 map_const CERULEAN_GYM, 5, 7 ; $41 map_const BIKE_SHOP, 4, 4 ; $42 map_const CERULEAN_MART, 4, 4 ; $43 + end_indoor_group CERULEAN_CITY + map_const MT_MOON_POKECENTER, 7, 4 ; $44 + end_indoor_group ROUTE_4 + map_const CERULEAN_TRASHED_HOUSE_COPY, 4, 4 ; $45 + end_indoor_group CERULEAN_CITY_2 + map_const ROUTE_5_GATE, 4, 3 ; $46 map_const UNDERGROUND_PATH_ROUTE_5, 4, 4 ; $47 map_const DAYCARE, 4, 4 ; $48 + end_indoor_group ROUTE_5 + map_const ROUTE_6_GATE, 4, 3 ; $49 map_const UNDERGROUND_PATH_ROUTE_6, 4, 4 ; $4A map_const UNDERGROUND_PATH_ROUTE_6_COPY, 4, 4 ; $4B + end_indoor_group ROUTE_6 + map_const ROUTE_7_GATE, 3, 4 ; $4C map_const UNDERGROUND_PATH_ROUTE_7, 4, 4 ; $4D map_const UNDERGROUND_PATH_ROUTE_7_COPY, 4, 4 ; $4E + end_indoor_group ROUTE_7 + map_const ROUTE_8_GATE, 3, 4 ; $4F map_const UNDERGROUND_PATH_ROUTE_8, 4, 4 ; $50 + end_indoor_group ROUTE_8 + map_const ROCK_TUNNEL_POKECENTER, 7, 4 ; $51 map_const ROCK_TUNNEL_1F, 20, 18 ; $52 + end_indoor_group ROCK_TUNNEL + map_const POWER_PLANT, 20, 18 ; $53 + end_indoor_group POWER_PLANT + map_const ROUTE_11_GATE_1F, 4, 5 ; $54 map_const DIGLETTS_CAVE_ROUTE_11, 4, 4 ; $55 map_const ROUTE_11_GATE_2F, 4, 4 ; $56 + end_indoor_group ROUTE_11 + map_const ROUTE_12_GATE_1F, 5, 4 ; $57 + end_indoor_group ROUTE_12 + map_const BILLS_HOUSE, 4, 4 ; $58 + end_indoor_group SEA_COTTAGE + map_const VERMILION_POKECENTER, 7, 4 ; $59 map_const POKEMON_FAN_CLUB, 4, 4 ; $5A map_const VERMILION_MART, 4, 4 ; $5B map_const VERMILION_GYM, 5, 9 ; $5C map_const VERMILION_PIDGEY_HOUSE, 4, 4 ; $5D map_const VERMILION_DOCK, 14, 6 ; $5E + end_indoor_group VERMILION_CITY + map_const SS_ANNE_1F, 20, 9 ; $5F map_const SS_ANNE_2F, 20, 9 ; $60 map_const SS_ANNE_3F, 10, 3 ; $61 @@ -124,10 +172,14 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const SS_ANNE_1F_ROOMS, 12, 8 ; $66 map_const SS_ANNE_2F_ROOMS, 12, 8 ; $67 map_const SS_ANNE_B1F_ROOMS, 12, 8 ; $68 + end_indoor_group SS_ANNE + map_const UNUSED_MAP_69, 0, 0 ; $69 map_const UNUSED_MAP_6A, 0, 0 ; $6A map_const UNUSED_MAP_6B, 0, 0 ; $6B map_const VICTORY_ROAD_1F, 10, 9 ; $6C + end_indoor_group VICTORY_ROAD + map_const UNUSED_MAP_6D, 0, 0 ; $6D map_const UNUSED_MAP_6E, 0, 0 ; $6E map_const UNUSED_MAP_6F, 0, 0 ; $6F @@ -138,9 +190,17 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const UNUSED_MAP_74, 0, 0 ; $74 map_const UNUSED_MAP_75, 0, 0 ; $75 map_const HALL_OF_FAME, 5, 4 ; $76 + end_indoor_group POKEMON_LEAGUE + map_const UNDERGROUND_PATH_NORTH_SOUTH, 4, 24 ; $77 ; UndergroundPathNorthSouth.blk is actually 4x23 + end_indoor_group UNDERGROUND_PATH + map_const CHAMPIONS_ROOM, 4, 4 ; $78 + end_indoor_group POKEMON_LEAGUE_2 + map_const UNDERGROUND_PATH_WEST_EAST, 25, 4 ; $79 + end_indoor_group UNDERGROUND_PATH_2 + map_const CELADON_MART_1F, 10, 4 ; $7A map_const CELADON_MART_2F, 10, 4 ; $7B map_const CELADON_MART_3F, 10, 4 ; $7C @@ -160,7 +220,11 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const CELADON_DINER, 5, 4 ; $8A map_const CELADON_CHIEF_HOUSE, 4, 4 ; $8B map_const CELADON_HOTEL, 7, 4 ; $8C + end_indoor_group CELADON_CITY + map_const LAVENDER_POKECENTER, 7, 4 ; $8D + end_indoor_group LAVENDER_TOWN + map_const POKEMON_TOWER_1F, 10, 9 ; $8E map_const POKEMON_TOWER_2F, 10, 9 ; $8F map_const POKEMON_TOWER_3F, 10, 9 ; $90 @@ -168,23 +232,41 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const POKEMON_TOWER_5F, 10, 9 ; $92 map_const POKEMON_TOWER_6F, 10, 9 ; $93 map_const POKEMON_TOWER_7F, 10, 9 ; $94 + end_indoor_group POKEMON_TOWER + map_const MR_FUJIS_HOUSE, 4, 4 ; $95 map_const LAVENDER_MART, 4, 4 ; $96 map_const LAVENDER_CUBONE_HOUSE, 4, 4 ; $97 + end_indoor_group LAVENDER_TOWN_2 + map_const FUCHSIA_MART, 4, 4 ; $98 map_const FUCHSIA_BILLS_GRANDPAS_HOUSE, 4, 4 ; $99 map_const FUCHSIA_POKECENTER, 7, 4 ; $9A map_const WARDENS_HOUSE, 5, 4 ; $9B + end_indoor_group FUCHSIA_CITY + map_const SAFARI_ZONE_GATE, 4, 3 ; $9C + end_indoor_group SAFARI_ZONE + map_const FUCHSIA_GYM, 5, 9 ; $9D map_const FUCHSIA_MEETING_ROOM, 7, 4 ; $9E + end_indoor_group FUCHSIA_CITY_2 + map_const SEAFOAM_ISLANDS_B1F, 15, 9 ; $9F map_const SEAFOAM_ISLANDS_B2F, 15, 9 ; $A0 map_const SEAFOAM_ISLANDS_B3F, 15, 9 ; $A1 map_const SEAFOAM_ISLANDS_B4F, 15, 9 ; $A2 + end_indoor_group SEAFOAM_ISLANDS + map_const VERMILION_OLD_ROD_HOUSE, 4, 4 ; $A3 + end_indoor_group VERMILION_CITY_2 + map_const FUCHSIA_GOOD_ROD_HOUSE, 4, 4 ; $A4 + end_indoor_group FUCHSIA_CITY_3 + map_const POKEMON_MANSION_1F, 15, 14 ; $A5 + end_indoor_group POKEMON_MANSION + map_const CINNABAR_GYM, 10, 9 ; $A6 map_const CINNABAR_LAB, 9, 4 ; $A7 map_const CINNABAR_LAB_TRADE_ROOM, 4, 4 ; $A8 @@ -193,7 +275,11 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const CINNABAR_POKECENTER, 7, 4 ; $AB map_const CINNABAR_MART, 4, 4 ; $AC map_const CINNABAR_MART_COPY, 4, 4 ; $AD + end_indoor_group CINNABAR_ISLAND + map_const INDIGO_PLATEAU_LOBBY, 8, 6 ; $AE + end_indoor_group INDIGO_PLATEAU + map_const COPYCATS_HOUSE_1F, 4, 4 ; $AF map_const COPYCATS_HOUSE_2F, 4, 4 ; $B0 map_const FIGHTING_DOJO, 5, 6 ; $B1 @@ -203,21 +289,45 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const SILPH_CO_1F, 15, 9 ; $B5 map_const SAFFRON_POKECENTER, 7, 4 ; $B6 map_const MR_PSYCHICS_HOUSE, 4, 4 ; $B7 + end_indoor_group SAFFRON_CITY + map_const ROUTE_15_GATE_1F, 4, 5 ; $B8 map_const ROUTE_15_GATE_2F, 4, 4 ; $B9 + end_indoor_group ROUTE_15 + map_const ROUTE_16_GATE_1F, 4, 7 ; $BA map_const ROUTE_16_GATE_2F, 4, 4 ; $BB map_const ROUTE_16_FLY_HOUSE, 4, 4 ; $BC + end_indoor_group ROUTE_16 + map_const ROUTE_12_SUPER_ROD_HOUSE, 4, 4 ; $BD + end_indoor_group ROUTE_12_2 + map_const ROUTE_18_GATE_1F, 4, 5 ; $BE map_const ROUTE_18_GATE_2F, 4, 4 ; $BF + end_indoor_group ROUTE_18 + map_const SEAFOAM_ISLANDS_1F, 15, 9 ; $C0 + end_indoor_group SEAFOAM_ISLANDS_2 + map_const ROUTE_22_GATE, 5, 4 ; $C1 + end_indoor_group ROUTE_22 + map_const VICTORY_ROAD_2F, 15, 9 ; $C2 + end_indoor_group VICTORY_ROAD_2 + map_const ROUTE_12_GATE_2F, 4, 4 ; $C3 + end_indoor_group ROUTE_12_3 + map_const VERMILION_TRADE_HOUSE, 4, 4 ; $C4 + end_indoor_group VERMILION_CITY_3 + map_const DIGLETTS_CAVE, 20, 18 ; $C5 + end_indoor_group DIGLETTS_CAVE + map_const VICTORY_ROAD_3F, 15, 9 ; $C6 + end_indoor_group VICTORY_ROAD_3 + map_const ROCKET_HIDEOUT_B1F, 15, 14 ; $C7 map_const ROCKET_HIDEOUT_B2F, 15, 14 ; $C8 map_const ROCKET_HIDEOUT_B3F, 15, 14 ; $C9 @@ -226,6 +336,8 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const UNUSED_MAP_CC, 0, 0 ; $CC map_const UNUSED_MAP_CD, 0, 0 ; $CD map_const UNUSED_MAP_CE, 0, 0 ; $CE + end_indoor_group ROCKET_HQ + map_const SILPH_CO_2F, 15, 9 ; $CF map_const SILPH_CO_3F, 15, 9 ; $D0 map_const SILPH_CO_4F, 15, 9 ; $D1 @@ -233,9 +345,13 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const SILPH_CO_6F, 13, 9 ; $D3 map_const SILPH_CO_7F, 13, 9 ; $D4 map_const SILPH_CO_8F, 13, 9 ; $D5 + end_indoor_group SILPH_CO + map_const POKEMON_MANSION_2F, 15, 14 ; $D6 map_const POKEMON_MANSION_3F, 15, 9 ; $D7 map_const POKEMON_MANSION_B1F, 15, 14 ; $D8 + end_indoor_group POKEMON_MANSION_2 + map_const SAFARI_ZONE_EAST, 15, 13 ; $D9 map_const SAFARI_ZONE_NORTH, 20, 18 ; $DA map_const SAFARI_ZONE_WEST, 15, 13 ; $DB @@ -245,17 +361,29 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const SAFARI_ZONE_WEST_REST_HOUSE, 4, 4 ; $DF map_const SAFARI_ZONE_EAST_REST_HOUSE, 4, 4 ; $E0 map_const SAFARI_ZONE_NORTH_REST_HOUSE, 4, 4 ; $E1 + end_indoor_group SAFARI_ZONE_2 + map_const CERULEAN_CAVE_2F, 15, 9 ; $E2 map_const CERULEAN_CAVE_B1F, 15, 9 ; $E3 map_const CERULEAN_CAVE_1F, 15, 9 ; $E4 + end_indoor_group CERULEAN_CAVE + map_const NAME_RATERS_HOUSE, 4, 4 ; $E5 + end_indoor_group LAVENDER_TOWN_3 + map_const CERULEAN_BADGE_HOUSE, 4, 4 ; $E6 + end_indoor_group CERULEAN_CITY_3 + map_const UNUSED_MAP_E7, 0, 0 ; $E7 map_const ROCK_TUNNEL_B1F, 20, 18 ; $E8 + end_indoor_group ROCK_TUNNEL_2 + map_const SILPH_CO_9F, 13, 9 ; $E9 map_const SILPH_CO_10F, 8, 9 ; $EA map_const SILPH_CO_11F, 9, 9 ; $EB map_const SILPH_CO_ELEVATOR, 2, 2 ; $EC + end_indoor_group SILPH_CO_2 + map_const UNUSED_MAP_ED, 0, 0 ; $ED map_const UNUSED_MAP_EE, 0, 0 ; $EE map_const TRADE_CENTER, 5, 4 ; $EF @@ -267,8 +395,11 @@ DEF FIRST_INDOOR_MAP EQU const_value map_const LORELEIS_ROOM, 5, 6 ; $F5 map_const BRUNOS_ROOM, 5, 6 ; $F6 map_const AGATHAS_ROOM, 5, 6 ; $F7 + end_indoor_group POKEMON_LEAGUE_3 DEF NUM_MAPS EQU const_value ; Indoor maps, such as houses, use this as the Map ID in their exit warps ; This map ID takes the player back to the last outdoor map they were on, stored in wLastMap -DEF LAST_MAP EQU -1 +DEF LAST_MAP EQU $ff + +ASSERT NUM_MAPS <= LAST_MAP, "map IDs overlap LAST_MAP" diff --git a/data/maps/town_map_entries.asm b/data/maps/town_map_entries.asm index c93ba57b..9b981b5f 100644 --- a/data/maps/town_map_entries.asm +++ b/data/maps/town_map_entries.asm @@ -1,4 +1,4 @@ -MACRO external_map +MACRO outdoor_map dn \2, \1 dw \3 ENDM @@ -7,113 +7,115 @@ ENDM ExternalMapEntries: table_width 3 ; x, y, name - external_map 2, 11, PalletTownName - external_map 2, 8, ViridianCityName - external_map 2, 3, PewterCityName - external_map 10, 2, CeruleanCityName - external_map 14, 5, LavenderTownName - external_map 10, 9, VermilionCityName - external_map 7, 5, CeladonCityName - external_map 8, 13, FuchsiaCityName - external_map 2, 15, CinnabarIslandName - external_map 0, 2, IndigoPlateauName - external_map 10, 5, SaffronCityName - external_map 0, 0, PalletTownName ; unused - external_map 2, 10, Route1Name - external_map 2, 6, Route2Name - external_map 4, 3, Route3Name - external_map 8, 2, Route4Name - external_map 10, 3, Route5Name - external_map 10, 8, Route6Name - external_map 8, 5, Route7Name - external_map 13, 5, Route8Name - external_map 13, 2, Route9Name - external_map 14, 4, Route10Name - external_map 12, 9, Route11Name - external_map 14, 9, Route12Name - external_map 13, 11, Route13Name - external_map 11, 12, Route14Name - external_map 10, 13, Route15Name - external_map 5, 5, Route16Name - external_map 4, 8, Route17Name - external_map 6, 13, Route18Name - external_map 6, 15, Route19Name - external_map 4, 15, Route20Name - external_map 2, 13, Route21Name - external_map 0, 8, Route22Name - external_map 0, 6, Route23Name - external_map 10, 1, Route24Name - external_map 11, 0, Route25Name + outdoor_map 2, 11, PalletTownName + outdoor_map 2, 8, ViridianCityName + outdoor_map 2, 3, PewterCityName + outdoor_map 10, 2, CeruleanCityName + outdoor_map 14, 5, LavenderTownName + outdoor_map 10, 9, VermilionCityName + outdoor_map 7, 5, CeladonCityName + outdoor_map 8, 13, FuchsiaCityName + outdoor_map 2, 15, CinnabarIslandName + outdoor_map 0, 2, IndigoPlateauName + outdoor_map 10, 5, SaffronCityName + outdoor_map 0, 0, PalletTownName ; unused + outdoor_map 2, 10, Route1Name + outdoor_map 2, 6, Route2Name + outdoor_map 4, 3, Route3Name + outdoor_map 8, 2, Route4Name + outdoor_map 10, 3, Route5Name + outdoor_map 10, 8, Route6Name + outdoor_map 8, 5, Route7Name + outdoor_map 13, 5, Route8Name + outdoor_map 13, 2, Route9Name + outdoor_map 14, 4, Route10Name + outdoor_map 12, 9, Route11Name + outdoor_map 14, 9, Route12Name + outdoor_map 13, 11, Route13Name + outdoor_map 11, 12, Route14Name + outdoor_map 10, 13, Route15Name + outdoor_map 5, 5, Route16Name + outdoor_map 4, 8, Route17Name + outdoor_map 6, 13, Route18Name + outdoor_map 6, 15, Route19Name + outdoor_map 4, 15, Route20Name + outdoor_map 2, 13, Route21Name + outdoor_map 0, 8, Route22Name + outdoor_map 0, 6, Route23Name + outdoor_map 10, 1, Route24Name + outdoor_map 11, 0, Route25Name assert_table_length FIRST_INDOOR_MAP -MACRO internal_map - db \1 + 1 +MACRO indoor_map + db INDOORGROUP_\1 dn \3, \2 dw \4 ENDM ; the appearance of buildings and dungeons in the town map InternalMapEntries: - ; maximum map id subject to this rule, x, y, name - internal_map OAKS_LAB, 2, 11, PalletTownName - internal_map VIRIDIAN_GYM, 2, 8, ViridianCityName - internal_map VIRIDIAN_FOREST_SOUTH_GATE, 2, 6, Route2Name - internal_map VIRIDIAN_FOREST, 2, 4, ViridianForestName - internal_map PEWTER_POKECENTER, 2, 3, PewterCityName - internal_map MT_MOON_B2F, 6, 2, MountMoonName - internal_map CERULEAN_MART, 10, 2, CeruleanCityName - internal_map MT_MOON_POKECENTER, 5, 2, Route4Name - internal_map CERULEAN_TRASHED_HOUSE_COPY, 10, 2, CeruleanCityName - internal_map DAYCARE, 10, 4, Route5Name - internal_map UNDERGROUND_PATH_ROUTE_6_COPY, 10, 6, Route6Name - internal_map UNDERGROUND_PATH_ROUTE_7_COPY, 9, 5, Route7Name - internal_map UNDERGROUND_PATH_ROUTE_8, 11, 5, Route8Name - internal_map ROCK_TUNNEL_1F, 14, 3, RockTunnelName - internal_map POWER_PLANT, 15, 4, PowerPlantName - internal_map ROUTE_11_GATE_2F, 13, 9, Route11Name - internal_map ROUTE_12_GATE_1F, 14, 7, Route12Name - internal_map BILLS_HOUSE, 12, 0, SeaCottageName - internal_map VERMILION_DOCK, 10, 9, VermilionCityName - internal_map SS_ANNE_B1F_ROOMS, 9, 10, SSAnneName - internal_map VICTORY_ROAD_1F, 0, 4, VictoryRoadName - internal_map HALL_OF_FAME, 0, 2, PokemonLeagueName - internal_map UNDERGROUND_PATH_NORTH_SOUTH, 10, 5, UndergroundPathName - internal_map CHAMPIONS_ROOM, 0, 2, PokemonLeagueName - internal_map UNDERGROUND_PATH_WEST_EAST, 10, 5, UndergroundPathName - internal_map CELADON_HOTEL, 7, 5, CeladonCityName - internal_map LAVENDER_POKECENTER, 14, 5, LavenderTownName - internal_map POKEMON_TOWER_7F, 15, 5, PokemonTowerName - internal_map LAVENDER_CUBONE_HOUSE, 14, 5, LavenderTownName - internal_map WARDENS_HOUSE, 8, 13, FuchsiaCityName - internal_map SAFARI_ZONE_GATE, 8, 12, SafariZoneName - internal_map FUCHSIA_MEETING_ROOM, 8, 13, FuchsiaCityName - internal_map SEAFOAM_ISLANDS_B4F, 5, 15, SeafoamIslandsName - internal_map VERMILION_OLD_ROD_HOUSE, 10, 9, VermilionCityName - internal_map FUCHSIA_GOOD_ROD_HOUSE, 8, 13, FuchsiaCityName - internal_map POKEMON_MANSION_1F, 2, 15, PokemonMansionName - internal_map CINNABAR_MART_COPY, 2, 15, CinnabarIslandName - internal_map INDIGO_PLATEAU_LOBBY, 0, 2, IndigoPlateauName - internal_map MR_PSYCHICS_HOUSE, 10, 5, SaffronCityName - internal_map ROUTE_15_GATE_2F, 9, 13, Route15Name - internal_map ROUTE_16_FLY_HOUSE, 4, 5, Route16Name - internal_map ROUTE_12_SUPER_ROD_HOUSE, 14, 10, Route12Name - internal_map ROUTE_18_GATE_2F, 7, 13, Route18Name - internal_map SEAFOAM_ISLANDS_1F, 5, 15, SeafoamIslandsName - internal_map ROUTE_22_GATE, 0, 7, Route22Name - internal_map VICTORY_ROAD_2F, 0, 4, VictoryRoadName - internal_map ROUTE_12_GATE_2F, 14, 7, Route12Name - internal_map VERMILION_TRADE_HOUSE, 10, 9, VermilionCityName - internal_map DIGLETTS_CAVE, 3, 4, DiglettsCaveName - internal_map VICTORY_ROAD_3F, 0, 4, VictoryRoadName - internal_map UNUSED_MAP_CE, 7, 5, RocketHQName - internal_map SILPH_CO_8F, 10, 5, SilphCoName - internal_map POKEMON_MANSION_B1F, 2, 15, PokemonMansionName - internal_map SAFARI_ZONE_NORTH_REST_HOUSE, 8, 12, SafariZoneName - internal_map CERULEAN_CAVE_1F, 9, 1, CeruleanCaveName - internal_map NAME_RATERS_HOUSE, 14, 5, LavenderTownName - internal_map CERULEAN_BADGE_HOUSE, 10, 2, CeruleanCityName - internal_map ROCK_TUNNEL_B1F, 14, 3, RockTunnelName - internal_map SILPH_CO_ELEVATOR, 10, 5, SilphCoName - internal_map AGATHAS_ROOM, 0, 2, PokemonLeagueName + table_width 4 + ; indoor map group, x, y, name + indoor_map PALLET_TOWN, 2, 11, PalletTownName + indoor_map VIRIDIAN_CITY, 2, 8, ViridianCityName + indoor_map ROUTE_2, 2, 6, Route2Name + indoor_map VIRIDIAN_FOREST, 2, 4, ViridianForestName + indoor_map PEWTER_CITY, 2, 3, PewterCityName + indoor_map MT_MOON, 6, 2, MountMoonName + indoor_map CERULEAN_CITY, 10, 2, CeruleanCityName + indoor_map ROUTE_4, 5, 2, Route4Name + indoor_map CERULEAN_CITY_2, 10, 2, CeruleanCityName + indoor_map ROUTE_5, 10, 4, Route5Name + indoor_map ROUTE_6, 10, 6, Route6Name + indoor_map ROUTE_7, 9, 5, Route7Name + indoor_map ROUTE_8, 11, 5, Route8Name + indoor_map ROCK_TUNNEL, 14, 3, RockTunnelName + indoor_map POWER_PLANT, 15, 4, PowerPlantName + indoor_map ROUTE_11, 13, 9, Route11Name + indoor_map ROUTE_12, 14, 7, Route12Name + indoor_map SEA_COTTAGE, 12, 0, SeaCottageName + indoor_map VERMILION_CITY, 10, 9, VermilionCityName + indoor_map SS_ANNE, 9, 10, SSAnneName + indoor_map VICTORY_ROAD, 0, 4, VictoryRoadName + indoor_map POKEMON_LEAGUE, 0, 2, PokemonLeagueName + indoor_map UNDERGROUND_PATH, 10, 5, UndergroundPathName + indoor_map POKEMON_LEAGUE_2, 0, 2, PokemonLeagueName + indoor_map UNDERGROUND_PATH_2, 10, 5, UndergroundPathName + indoor_map CELADON_CITY, 7, 5, CeladonCityName + indoor_map LAVENDER_TOWN, 14, 5, LavenderTownName + indoor_map POKEMON_TOWER, 15, 5, PokemonTowerName + indoor_map LAVENDER_TOWN_2, 14, 5, LavenderTownName + indoor_map FUCHSIA_CITY, 8, 13, FuchsiaCityName + indoor_map SAFARI_ZONE, 8, 12, SafariZoneName + indoor_map FUCHSIA_CITY_2, 8, 13, FuchsiaCityName + indoor_map SEAFOAM_ISLANDS, 5, 15, SeafoamIslandsName + indoor_map VERMILION_CITY_2, 10, 9, VermilionCityName + indoor_map FUCHSIA_CITY_3, 8, 13, FuchsiaCityName + indoor_map POKEMON_MANSION, 2, 15, PokemonMansionName + indoor_map CINNABAR_ISLAND, 2, 15, CinnabarIslandName + indoor_map INDIGO_PLATEAU, 0, 2, IndigoPlateauName + indoor_map SAFFRON_CITY, 10, 5, SaffronCityName + indoor_map ROUTE_15, 9, 13, Route15Name + indoor_map ROUTE_16, 4, 5, Route16Name + indoor_map ROUTE_12_2, 14, 10, Route12Name + indoor_map ROUTE_18, 7, 13, Route18Name + indoor_map SEAFOAM_ISLANDS_2, 5, 15, SeafoamIslandsName + indoor_map ROUTE_22, 0, 7, Route22Name + indoor_map VICTORY_ROAD_2, 0, 4, VictoryRoadName + indoor_map ROUTE_12_3, 14, 7, Route12Name + indoor_map VERMILION_CITY_3, 10, 9, VermilionCityName + indoor_map DIGLETTS_CAVE, 3, 4, DiglettsCaveName + indoor_map VICTORY_ROAD_3, 0, 4, VictoryRoadName + indoor_map ROCKET_HQ, 7, 5, RocketHQName + indoor_map SILPH_CO, 10, 5, SilphCoName + indoor_map POKEMON_MANSION_2, 2, 15, PokemonMansionName + indoor_map SAFARI_ZONE_2, 8, 12, SafariZoneName + indoor_map CERULEAN_CAVE, 9, 1, CeruleanCaveName + indoor_map LAVENDER_TOWN_3, 14, 5, LavenderTownName + indoor_map CERULEAN_CITY_3, 10, 2, CeruleanCityName + indoor_map ROCK_TUNNEL_2, 14, 3, RockTunnelName + indoor_map SILPH_CO_2, 10, 5, SilphCoName + indoor_map POKEMON_LEAGUE_3, 0, 2, PokemonLeagueName + assert_table_length NUM_INDOOR_MAP_GROUPS db -1 ; end -- cgit v1.3.1-sl0p From d79c578abd993f7eee4e85462a8cd5b7c4e14646 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:16:40 -0500 Subject: Specify a max item length for `list_start` (#552) --- constants/text_constants.asm | 14 ++++++++------ data/battle/stat_mod_names.asm | 2 +- data/battle/stat_names.asm | 2 +- data/items/names.asm | 2 +- data/moves/names.asm | 3 ++- data/player/names_list.asm | 4 ++-- data/trainers/move_choices.asm | 8 +++++--- data/trainers/names.asm | 2 +- engine/battle/effects.asm | 2 +- engine/battle/get_trainer_name.asm | 2 +- engine/items/item_effects.asm | 2 +- macros/asserts.asm | 18 ++++++++++++++---- 12 files changed, 38 insertions(+), 23 deletions(-) (limited to 'constants') diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 88a42bbe..f4587736 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,9 +1,11 @@ -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 +DEF PLAYER_NAME_LENGTH EQU 8 +DEF STAT_NAME_LENGTH EQU 10 +DEF NAME_LENGTH EQU 11 +DEF ITEM_NAME_LENGTH EQU 13 +DEF TRAINER_NAME_LENGTH EQU 13 +DEF MOVE_NAME_LENGTH EQU 14 +DEF GYM_CITY_LENGTH EQU 17 +DEF NAME_BUFFER_LENGTH EQU 20 ; PrintNumber, PrintBCDNumber const_def 5 diff --git a/data/battle/stat_mod_names.asm b/data/battle/stat_mod_names.asm index 63c956d7..6c68db4e 100644 --- a/data/battle/stat_mod_names.asm +++ b/data/battle/stat_mod_names.asm @@ -2,7 +2,7 @@ ; The relevant move effect IDs correspond to the stats StatModTextStrings: - list_start + list_start STAT_NAME_LENGTH - 1 li "ATTACK" li "DEFENSE" li "SPEED" diff --git a/data/battle/stat_names.asm b/data/battle/stat_names.asm index 30401a99..08685e83 100644 --- a/data/battle/stat_names.asm +++ b/data/battle/stat_names.asm @@ -1,7 +1,7 @@ ; Stats that vitamins can raise or lower VitaminStats: - list_start + list_start STAT_NAME_LENGTH - 1 li "HEALTH" li "ATTACK" li "DEFENSE" diff --git a/data/items/names.asm b/data/items/names.asm index bab26efc..f5c0f27e 100644 --- a/data/items/names.asm +++ b/data/items/names.asm @@ -1,5 +1,5 @@ ItemNames:: - list_start + list_start ITEM_NAME_LENGTH - 1 li "MASTER BALL" li "ULTRA BALL" li "GREAT BALL" diff --git a/data/moves/names.asm b/data/moves/names.asm index 025172d5..caecc06c 100644 --- a/data/moves/names.asm +++ b/data/moves/names.asm @@ -1,5 +1,6 @@ MoveNames:: - list_start + ; in-battle "used !" text can only fit 12 (MOVE_NAME_LENGTH - 2) characters + list_start MOVE_NAME_LENGTH - 2 li "POUND" li "KARATE CHOP" li "DOUBLESLAP" diff --git a/data/player/names_list.asm b/data/player/names_list.asm index 786c1229..44f3c7f1 100644 --- a/data/player/names_list.asm +++ b/data/player/names_list.asm @@ -2,7 +2,7 @@ DefaultNamesPlayerList: db "NEW NAME@" - list_start + list_start PLAYER_NAME_LENGTH - 1 FOR n, 1, NUM_PLAYER_NAMES + 1 li #PLAYERNAME{d:n} ENDR @@ -10,7 +10,7 @@ ENDR DefaultNamesRivalList: db "NEW NAME@" - list_start + list_start PLAYER_NAME_LENGTH - 1 FOR n, 1, NUM_PLAYER_NAMES + 1 li #RIVALNAME{d:n} ENDR diff --git a/data/trainers/move_choices.asm b/data/trainers/move_choices.asm index 1624b326..98c068a1 100644 --- a/data/trainers/move_choices.asm +++ b/data/trainers/move_choices.asm @@ -1,14 +1,15 @@ +DEF __move_choices__ = 0 + MACRO move_choices IF _NARG db \# ; all args ENDC db 0 ; end - DEF list_index += 1 + DEF __move_choices__ += 1 ENDM ; move choice modification methods that are applied for each trainer class TrainerClassMoveChoiceModifications: - list_start move_choices ; YOUNGSTER move_choices 1 ; BUG CATCHER move_choices 1 ; LASS @@ -56,4 +57,5 @@ TrainerClassMoveChoiceModifications: move_choices 1 ; CHANNELER move_choices 1 ; AGATHA move_choices 1, 3 ; LANCE - assert_list_length NUM_TRAINERS + assert __move_choices__ == NUM_TRAINERS, \ + "TrainerClassMoveChoiceModifications: expected {d:NUM_TRAINERS} entries, got {d:__move_choices__}" diff --git a/data/trainers/names.asm b/data/trainers/names.asm index d7c5677c..1b6f2382 100644 --- a/data/trainers/names.asm +++ b/data/trainers/names.asm @@ -1,5 +1,5 @@ TrainerNames:: - list_start + list_start TRAINER_NAME_LENGTH - 1 li "YOUNGSTER" li "BUG CATCHER" li "LASS" diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 22765140..394e07e5 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, NAME_LENGTH - 1 ; all StatModTextStrings are at most 10 bytes + ld bc, STAT_NAME_LENGTH jp CopyData INCLUDE "data/battle/stat_mod_names.asm" diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index a0e869fc..1983b08a 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -20,5 +20,5 @@ GetTrainerName_:: ld hl, wNameBuffer .foundName ld de, wTrainerName - ld bc, ITEM_NAME_LENGTH + ld bc, TRAINER_NAME_LENGTH jp CopyData diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 12b5bd00..c4ce13de 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1308,7 +1308,7 @@ ItemUseMedicine: jr .statNameLoop .gotStatName ld de, wStringBuffer - ld bc, NAME_LENGTH - 1 ; all VitaminStats are at most 10 bytes + ld bc, STAT_NAME_LENGTH call CopyData ; copy the stat's name to wStringBuffer ld a, SFX_HEAL_AILMENT call PlaySound diff --git a/macros/asserts.asm b/macros/asserts.asm index e2de1505..11e0ee99 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -4,8 +4,8 @@ MACRO? _redef_current_label IF DEF(\1) PURGE \1 ENDC - IF _NARG == 3 + (\3) - DEF \1 EQUS "\<_NARG>" + IF _NARG > 2 + DEF \1 EQUS "\3" ELIF STRLEN(#__SCOPE__) IF {{__SCOPE__}} - @ == 0 DEF \1 EQUS #{__SCOPE__} @@ -19,7 +19,8 @@ ENDM MACRO? table_width DEF CURRENT_TABLE_WIDTH = \1 - _redef_current_label CURRENT_TABLE_START, "._table_width\@", 2, \# + SHIFT + _redef_current_label CURRENT_TABLE_START, "._table_width\@", \# ENDM MACRO? assert_table_length @@ -40,11 +41,20 @@ ENDM MACRO? list_start DEF list_index = 0 - _redef_current_label CURRENT_LIST_START, "._list_start\@", 1, \# + DEF list_item_length = 0 + IF _NARG > 0 + DEF list_item_length = \1 + SHIFT + ENDC + _redef_current_label CURRENT_LIST_START, "._list_start\@", \# ENDM MACRO? li ASSERT STRFIND(\1, "@") == -1, "String terminator \"@\" in list entry: \1" + IF list_item_length + ASSERT CHARLEN(\1) <= list_item_length, \ + "List entry longer than {d:list_item_length} characters: \1" + ENDC db \1, "@" DEF list_index += 1 ENDM -- 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 'constants') 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 From 4c7ce815272c41c9cbfee8059f7f4d1418350e82 Mon Sep 17 00:00:00 2001 From: CreamElDudJafar Date: Sat, 17 Jan 2026 15:41:04 -0600 Subject: Document SFX event bug inside Rocket Hideout B1F (#566) --- constants/event_constants.asm | 2 +- scripts/RocketHideoutB1F.asm | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'constants') diff --git a/constants/event_constants.asm b/constants/event_constants.asm index 7bcef25c..7f4213f1 100644 --- a/constants/event_constants.asm +++ b/constants/event_constants.asm @@ -598,7 +598,7 @@ const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_3 const EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 const_skip - const EVENT_677 ; ??? + const EVENT_ENTERED_ROCKET_HIDEOUT const_skip 7 const EVENT_67F ; ??? const_skip diff --git a/scripts/RocketHideoutB1F.asm b/scripts/RocketHideoutB1F.asm index 9354a0c7..fc107001 100644 --- a/scripts/RocketHideoutB1F.asm +++ b/scripts/RocketHideoutB1F.asm @@ -13,7 +13,7 @@ RocketHideoutB1FDoorCallbackScript: bit BIT_CUR_MAP_LOADED_1, [hl] res BIT_CUR_MAP_LOADED_1, [hl] ret z - CheckEvent EVENT_677 + CheckEvent EVENT_ENTERED_ROCKET_HIDEOUT jr nz, .door_open CheckEventReuseA EVENT_BEAT_ROCKET_HIDEOUT_1_TRAINER_4 jr nz, .play_sound_door_open @@ -22,7 +22,8 @@ RocketHideoutB1FDoorCallbackScript: .play_sound_door_open ld a, SFX_GO_INSIDE call PlaySound - CheckEventHL EVENT_677 + ; BUG: should be SetEvent to avoid the SFX playing every time you enter the map + CheckEventHL EVENT_ENTERED_ROCKET_HIDEOUT .door_open ld a, $e ; Floor Block .set_door_block -- cgit v1.3.1-sl0p From 70f654bda79619bb7c1262f3fd111eeefd4c2645 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:42:34 +0100 Subject: Use map names with `ToggleData*` symbols (#563) --- constants/toggle_constants.asm | 3 ++- data/maps/toggleable_objects.asm | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'constants') diff --git a/constants/toggle_constants.asm b/constants/toggle_constants.asm index 701bc2b4..64712306 100644 --- a/constants/toggle_constants.asm +++ b/constants/toggle_constants.asm @@ -2,7 +2,8 @@ DEF OFF EQU $11 DEF ON EQU $15 MACRO toggle_consts_for - DEF TOGGLEMAP{\1} EQU const_value + DEF TOGGLEMAP{\1}_ID EQU const_value + DEF TOGGLEMAP{\1}_NAME EQUS "\1" ENDM ; ToggleableObjectStates indexes (see data/maps/toggleable_objects.asm) diff --git a/data/maps/toggleable_objects.asm b/data/maps/toggleable_objects.asm index d94002d9..90f9e689 100644 --- a/data/maps/toggleable_objects.asm +++ b/data/maps/toggleable_objects.asm @@ -4,8 +4,8 @@ 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} + IF DEF(TOGGLEMAP{n}_NAME) ; defined by `toggle_consts_for` + dw ToggleData_{TOGGLEMAP{n}_NAME} ELSE dw NoToggleData ENDC @@ -20,14 +20,14 @@ DEF toggles_ok = 1 MACRO? toggleable_objects_for DEF toggle_map_id = \1 ; map id - ToggleData{toggle_map_id}: + ToggleData_\1: IF toggles_ok - ASSERT DEF(TOGGLEMAP{toggle_map_id}), \ + ASSERT DEF(TOGGLEMAP{toggle_map_id}_ID), \ "`toggleable_objects_for \1` is not defined" - DEF toggles_ok &= DEF(TOGGLEMAP{toggle_map_id}) + DEF toggles_ok &= DEF(TOGGLEMAP{toggle_map_id}_ID) IF toggles_ok - assert_table_length TOGGLEMAP{toggle_map_id} - DEF toggles_ok &= TOGGLEMAP{toggle_map_id} * 3 == @ - ToggleableObjectStates + assert_table_length TOGGLEMAP{toggle_map_id}_ID + DEF toggles_ok &= TOGGLEMAP{toggle_map_id}_ID * 3 == @ - ToggleableObjectStates ENDC ENDC ENDM -- cgit v1.3.1-sl0p