From 8fafca714c07500d1d87bba224f12cf9cc2c8789 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:02:54 -0400 Subject: [PATCH] Identify various flag labels and bit constants (#454) --- constants/battle_constants.asm | 9 +- constants/input_constants.asm | 16 +- constants/misc_constants.asm | 12 -- constants/ram_constants.asm | 119 +++++++++++ constants/script_constants.asm | 13 -- data/predef_pointers.asm | 2 +- data/text/text_2.asm | 4 +- engine/battle/battle_transitions.asm | 2 +- engine/battle/core.asm | 36 ++-- engine/battle/effects.asm | 4 +- engine/battle/end_of_battle.asm | 4 +- engine/battle/experience.asm | 6 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/wild_encounters.asm | 8 +- engine/debug/debug_menu.asm | 6 +- engine/debug/debug_party.asm | 2 +- engine/events/black_out.asm | 12 +- engine/events/cinnabar_lab.asm | 8 +- engine/events/diploma.asm | 8 +- engine/events/display_pokedex.asm | 8 +- .../events/hidden_objects/bills_house_pc.asm | 8 +- .../hidden_objects/school_blackboard.asm | 24 +-- engine/events/hidden_objects/town_map.asm | 8 +- engine/events/in_game_trades.asm | 6 +- engine/events/poison.asm | 9 +- engine/events/pokecenter.asm | 8 +- engine/events/prize_menu.asm | 10 +- engine/events/vending_machine.asm | 8 +- engine/gfx/sprite_oam.asm | 4 +- engine/items/item_effects.asm | 32 +-- engine/items/town_map.asm | 7 +- engine/joypad.asm | 4 +- engine/link/cable_club.asm | 4 +- engine/link/cable_club_npc.asm | 4 +- engine/menus/display_text_id_init.asm | 6 +- engine/menus/draw_start_menu.asm | 12 +- engine/menus/league_pc.asm | 4 +- engine/menus/main_menu.asm | 86 ++++---- engine/menus/naming_screen.asm | 8 +- engine/menus/party_menu.asm | 4 +- engine/menus/pc.asm | 20 +- engine/menus/players_pc.asm | 24 +-- engine/menus/pokedex.asm | 8 +- engine/menus/save.asm | 9 +- engine/menus/start_sub_menus.asm | 36 ++-- engine/menus/text_box.asm | 50 ++--- engine/movie/oak_speech/oak_speech.asm | 10 +- engine/movie/title.asm | 6 +- engine/movie/trade.asm | 8 +- engine/overworld/auto_movement.asm | 76 +++---- engine/overworld/cut.asm | 8 +- engine/overworld/emotion_bubbles.asm | 4 +- engine/overworld/field_move_messages.asm | 24 +-- engine/overworld/hidden_objects.asm | 12 +- engine/overworld/ledges.asm | 8 +- engine/overworld/movement.asm | 22 +- engine/overworld/player_animations.asm | 32 +-- engine/overworld/player_state.asm | 27 ++- engine/overworld/push_boulder.asm | 38 ++-- engine/overworld/special_warps.asm | 30 +-- engine/overworld/trainer_sight.asm | 4 +- engine/play_time.asm | 16 +- engine/pokemon/add_mon.asm | 6 +- engine/pokemon/bills_pc.asm | 20 +- engine/pokemon/evos_moves.asm | 8 +- engine/pokemon/status_screen.asm | 10 +- engine/slots/slot_machine.asm | 8 +- home/audio.asm | 4 +- home/fade_audio.asm | 4 +- home/give.asm | 2 +- home/list_menu.asm | 12 +- home/map_objects.asm | 4 +- home/move_mon.asm | 4 +- home/npc_movement.asm | 16 +- home/overworld.asm | 197 +++++++++--------- home/pathfinding.asm | 4 +- home/pokemon.asm | 8 +- home/print_text.asm | 10 +- home/reload_tiles.asm | 4 +- home/text.asm | 2 +- home/text_script.asm | 10 +- home/trainers.asm | 58 +++--- home/window.asm | 4 +- includes.asm | 1 + ram/wram.asm | 140 ++----------- scripts/BikeShop.asm | 8 +- scripts/BillsHouse.asm | 8 +- scripts/CeladonGym.asm | 6 +- scripts/CeladonMartRoof.asm | 8 +- scripts/CeruleanCity.asm | 20 +- scripts/CeruleanGym.asm | 6 +- scripts/ChampionsRoom.asm | 16 +- scripts/CinnabarGym.asm | 10 +- scripts/FightingDojo.asm | 6 +- scripts/FuchsiaGoodRodHouse.asm | 8 +- scripts/FuchsiaGym.asm | 6 +- scripts/GameCorner.asm | 18 +- scripts/HallOfFame.asm | 7 +- scripts/IndigoPlateauLobby.asm | 8 +- scripts/LoreleisRoom.asm | 4 +- scripts/MtMoonB2F.asm | 18 +- scripts/OaksLab.asm | 56 ++--- scripts/PalletTown.asm | 4 +- scripts/PewterCity.asm | 16 +- scripts/PewterGym.asm | 6 +- scripts/PokemonMansion3F.asm | 12 +- scripts/PokemonTower2F.asm | 10 +- scripts/PokemonTower5F.asm | 8 +- scripts/PokemonTower6F.asm | 10 +- scripts/PokemonTower7F.asm | 12 +- scripts/RedsHouse1F.asm | 4 +- scripts/RocketHideoutB2F.asm | 8 +- scripts/RocketHideoutB3F.asm | 10 +- scripts/RocketHideoutB4F.asm | 6 +- scripts/Route12.asm | 2 +- scripts/Route12SuperRodHouse.asm | 8 +- scripts/Route16.asm | 2 +- scripts/Route16Gate1F.asm | 8 +- scripts/Route18Gate1F.asm | 8 +- scripts/Route22.asm | 28 +-- scripts/Route24.asm | 6 +- scripts/Route5Gate.asm | 16 +- scripts/Route6Gate.asm | 12 +- scripts/Route7Gate.asm | 12 +- scripts/Route8Gate.asm | 12 +- scripts/SSAnne2F.asm | 14 +- scripts/SSAnneCaptainsRoom.asm | 12 +- scripts/SaffronGym.asm | 6 +- scripts/SeafoamIslands1F.asm | 6 +- scripts/SeafoamIslandsB1F.asm | 6 +- scripts/SeafoamIslandsB2F.asm | 6 +- scripts/SeafoamIslandsB3F.asm | 22 +- scripts/SeafoamIslandsB4F.asm | 4 +- scripts/SilphCo11F.asm | 10 +- scripts/SilphCo7F.asm | 22 +- scripts/TradeCenter.asm | 6 +- scripts/VermilionDock.asm | 4 +- scripts/VermilionGym.asm | 6 +- scripts/VermilionOldRodHouse.asm | 8 +- scripts/VictoryRoad3F.asm | 18 +- scripts/ViridianCity.asm | 2 +- scripts/ViridianGym.asm | 14 +- text/RocketHideoutB3F.asm | 2 +- 143 files changed, 1071 insertions(+), 1081 deletions(-) create mode 100644 constants/ram_constants.asm diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 44a85e8d..9349bb75 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -37,9 +37,6 @@ DEF MOVE_ACC rb DEF MOVE_PP rb DEF MOVE_LENGTH EQU _RS -; D733 flags -DEF BIT_TEST_BATTLE EQU 0 - ; battle type constants (wBattleType values) const_def const BATTLE_TYPE_NORMAL ; 0 @@ -78,7 +75,7 @@ DEF SPDSPCDV_TRAINER EQU $88 ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def const STORING_ENERGY ; 0 ; Bide - const THRASHING_ABOUT ; 1 ; e.g. Thrash + const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack const FLINCHED ; 3 const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly @@ -95,11 +92,11 @@ DEF SPDSPCDV_TRAINER EQU $88 const HAS_SUBSTITUTE_UP ; 4 const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam const USING_RAGE ; 6 - const SEEDED ; 7 + const SEEDED ; 7 ; Leech Seed ; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags const_def - const BADLY_POISONED ; 0 + const BADLY_POISONED ; 0 ; Toxic const HAS_LIGHT_SCREEN_UP ; 1 const HAS_REFLECT_UP ; 2 const TRANSFORMED ; 3 diff --git a/constants/input_constants.asm b/constants/input_constants.asm index f9070cba..68233dea 100644 --- a/constants/input_constants.asm +++ b/constants/input_constants.asm @@ -1,13 +1,13 @@ ; joypad buttons const_def - const BIT_A_BUTTON - const BIT_B_BUTTON - const BIT_SELECT - const BIT_START - const BIT_D_RIGHT - const BIT_D_LEFT - const BIT_D_UP - const BIT_D_DOWN + const BIT_A_BUTTON ; 0 + const BIT_B_BUTTON ; 1 + const BIT_SELECT ; 2 + const BIT_START ; 3 + const BIT_D_RIGHT ; 4 + const BIT_D_LEFT ; 5 + const BIT_D_UP ; 6 + const BIT_D_DOWN ; 7 DEF NO_INPUT EQU 0 DEF A_BUTTON EQU 1 << BIT_A_BUTTON diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index a230b3d7..3562042b 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -7,15 +7,3 @@ DEF TRUE EQU 1 const FLAG_RESET ; 0 const FLAG_SET ; 1 const FLAG_TEST ; 2 - -; wOptions -DEF TEXT_DELAY_FAST EQU %001 ; 1 -DEF TEXT_DELAY_MEDIUM EQU %011 ; 3 -DEF TEXT_DELAY_SLOW EQU %101 ; 5 - - const_def 6 - const BIT_BATTLE_SHIFT ; 6 - const BIT_BATTLE_ANIMATION ; 7 - -; wd732 flags -DEF BIT_DEBUG_MODE EQU 1 diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm new file mode 100644 index 00000000..42956cc6 --- /dev/null +++ b/constants/ram_constants.asm @@ -0,0 +1,119 @@ +; wMiscFlags + const_def + const BIT_SEEN_BY_TRAINER ; 0 + const BIT_BOULDER_DUST ; 1 + const BIT_TURNING ; 2 + const BIT_USING_GENERIC_PC ; 3 + const BIT_NO_SPRITE_UPDATES ; 4 + const BIT_NO_MENU_BUTTON_SOUND ; 5 + const BIT_TRIED_PUSH_BOULDER ; 6 + const BIT_PUSHED_BOULDER ; 7 + +; wOptions +DEF TEXT_DELAY_MASK EQU %111 + const_def 6 + const BIT_BATTLE_SHIFT ; 6 + const BIT_BATTLE_ANIMATION ; 7 + +DEF TEXT_DELAY_FAST EQU %001 ; 1 +DEF TEXT_DELAY_MEDIUM EQU %011 ; 3 +DEF TEXT_DELAY_SLOW EQU %101 ; 5 + +; wLetterPrintingDelayFlags + const_def + const BIT_FAST_TEXT_DELAY ; 0 + const BIT_TEXT_DELAY ; 1 + +; wObtainedBadges, wBeatGymFlags + const_def + const BIT_BOULDERBADGE ; 0 + const BIT_CASCADEBADGE ; 1 + const BIT_THUNDERBADGE ; 2 + const BIT_RAINBOWBADGE ; 3 + const BIT_SOULBADGE ; 4 + const BIT_MARSHBADGE ; 5 + const BIT_VOLCANOBADGE ; 6 + const BIT_EARTHBADGE ; 7 +DEF NUM_BADGES EQU const_value + +; wStatusFlags1 + const_def + const BIT_STRENGTH_ACTIVE ; 0 + const BIT_SURF_ALLOWED ; 1 + const_skip ; 2 ; unused + const BIT_GOT_OLD_ROD ; 3 + const BIT_GOT_GOOD_ROD ; 4 + const BIT_GOT_SUPER_ROD ; 5 + const BIT_GAVE_SAFFRON_GUARDS_DRINK ; 6 + const BIT_UNUSED_CARD_KEY ; 7 + +; wStatusFlags2 + const_def + const BIT_WILD_ENCOUNTER_COOLDOWN ; 0 + const BIT_NO_AUDIO_FADE_OUT ; 1 + +; wStatusFlags3 + const_def + const BIT_INIT_TRADE_CENTER_FACING ; 0 + const_skip 2 ; 1-2 ; unused + const BIT_WARP_FROM_CUR_SCRIPT ; 3 + const BIT_ON_DUNGEON_WARP ; 4 + const BIT_NO_NPC_FACE_PLAYER ; 5 + const BIT_TALKED_TO_TRAINER ; 6 + const BIT_PRINT_END_BATTLE_TEXT ; 7 + +; wStatusFlags4 + const_def + const BIT_GOT_LAPRAS ; 0 + const BIT_UNKNOWN_4_1 ; 1 + const BIT_USED_POKECENTER ; 2 + const BIT_GOT_STARTER ; 3 + const BIT_NO_BATTLES ; 4 + const BIT_BATTLE_OVER_OR_BLACKOUT ; 5 + const BIT_LINK_CONNECTED ; 6 + const BIT_INIT_SCRIPTED_MOVEMENT ; 7 + +; wStatusFlags5 + const_def + const BIT_SCRIPTED_NPC_MOVEMENT ; 0 + const BIT_UNKNOWN_5_1 ; 1 + const BIT_UNKNOWN_5_2 ; 2 + const_skip ; 3 ; unused + const BIT_UNKNOWN_5_4 ; 4 + const BIT_DISABLE_JOYPAD ; 5 + const BIT_NO_TEXT_DELAY ; 6 + const BIT_SCRIPTED_MOVEMENT_STATE ; 7 + +; wStatusFlags6 + const_def + const BIT_GAME_TIMER_COUNTING ; 0 + const BIT_DEBUG_MODE ; 1 + const BIT_FLY_OR_DUNGEON_WARP ; 2 + const BIT_FLY_WARP ; 3 + const BIT_DUNGEON_WARP ; 4 + const BIT_ALWAYS_ON_BIKE ; 5 + const BIT_ESCAPE_WARP ; 6 + +; wStatusFlags7 + const_def + const BIT_TEST_BATTLE ; 0 + const BIT_NO_MAP_MUSIC ; 1 + const BIT_FORCED_WARP ; 2 + const BIT_TRAINER_BATTLE ; 3 + const BIT_USE_CUR_MAP_SCRIPT ; 4 + const_skip 2 ; 5-6 ; unused + const BIT_USED_FLY ; 7 + +; wElite4Flags + const_def + const BIT_UNUSED_BEAT_ELITE_4 ; 0 + const BIT_STARTED_ELITE_4 ; 1 + +; wMovementFlags + const_def + const BIT_STANDING_ON_DOOR ; 0 + const BIT_EXITING_DOOR ; 1 + const BIT_STANDING_ON_WARP ; 2 + const_skip 3 ; 3-5 ; unused + const BIT_LEDGE_OR_FISHING ; 6 + const BIT_SPINNING ; 7 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index afd1258b..24ad93f2 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -39,19 +39,6 @@ DEF NUM_NPC_TRADES EQU const_value const TRADE_DIALOGSET_EVOLUTION const TRADE_DIALOGSET_HAPPY -; badges -; wObtainedBadges and wBeatGymFlags bits - const_def - const BIT_BOULDERBADGE ; 0 - const BIT_CASCADEBADGE ; 1 - const BIT_THUNDERBADGE ; 2 - const BIT_RAINBOWBADGE ; 3 - const BIT_SOULBADGE ; 4 - const BIT_MARSHBADGE ; 5 - const BIT_VOLCANOBADGE ; 6 - const BIT_EARTHBADGE ; 7 -DEF NUM_BADGES EQU const_value - ; OaksAideScript results DEF OAKS_AIDE_BAG_FULL EQU $00 DEF OAKS_AIDE_GOT_ITEM EQU $01 diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index eaef75f6..e960d49b 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -101,7 +101,7 @@ PredefPointers:: add_predef EnterMapAnim, $1E ; wrong bank add_predef GetTileTwoStepsInFrontOfPlayer add_predef CheckForCollisionWhenPushingBoulder - add_predef PrintStrengthTxt + add_predef PrintStrengthText add_predef PickUpItem add_predef PrintMoveType add_predef LoadMovePPs diff --git a/data/text/text_2.asm b/data/text/text_2.asm index dcb67c67..d4b1b7db 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -1229,7 +1229,7 @@ _GrewLevelText:: text_ram wcd6d text " grew" line "to level @" - text_decimal wCurEnemyLVL, 1, 3 + text_decimal wCurEnemyLevel, 1, 3 text "!@" text_end @@ -1435,7 +1435,7 @@ _RareCandyText:: text_ram wcd6d text " grew" line "to level @" - text_decimal wCurEnemyLVL, 1, 3 + text_decimal wCurEnemyLevel, 1, 3 text "!@" text_end diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 363533ce..16311f48 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels: ld a, [hl] add $3 ld e, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] sub e jr nc, .highLevelEnemy res 1, c diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ca3294b8..ab4d1c56 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -844,7 +844,7 @@ FaintEnemyPokemon: ; the player has exp all ; now, set the gain exp flag for every party member ; half of the total stat exp and normal exp will divided evenly amongst every party member - ld a, $1 + ld a, TRUE ld [wBoostExpByExpAll], a ld a, [wPartyCount] ld b, 0 @@ -924,8 +924,8 @@ TrainerBattleVictory: cp RIVAL3 ; final battle against rival jr nz, .notrival ld b, MUSIC_DEFEATED_GYM_LEADER - ld hl, wFlags_D733 - set 1, [hl] + ld hl, wStatusFlags7 + set BIT_NO_MAP_MUSIC, [hl] .notrival ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -1157,9 +1157,9 @@ HandlePlayerBlackOut: ld hl, LinkBattleLostText .noLinkBattle call PrintText - ld a, [wd732] - res 5, a - ld [wd732], a + ld a, [wStatusFlags6] + res BIT_ALWAYS_ON_BIKE, a + ld [wStatusFlags6], a call ClearScreen scf ret @@ -1179,10 +1179,10 @@ LinkBattleLostText: ; slides pic of fainted mon downwards until it disappears ; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideDownFaintedMonPic: - ld a, [wd730] + ld a, [wStatusFlags5] push af - set 6, a - ld [wd730], a + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a ld b, 7 ; number of times to slide .slideStepLoop ; each iteration, the mon is slid down one row push bc @@ -1221,7 +1221,7 @@ SlideDownFaintedMonPic: dec b jr nz, .slideStepLoop pop af - ld [wd730], a + ld [wStatusFlags5], a ret SevenSpacesText: @@ -1344,7 +1344,7 @@ EnemySendOutFirstMon: ld bc, wEnemyMon2 - wEnemyMon1 call AddNTimes ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wWhichPokemon] inc a ld hl, wEnemyPartyCount @@ -2558,7 +2558,7 @@ MoveSelectionMenu: cp LINK_STATE_BATTLING jr z, .matchedkeyspicked ; Disable left, right, and START buttons in regular battles. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT jr z, .matchedkeyspicked @@ -2587,7 +2587,7 @@ SelectMenuItem: jr .select .battleselect ; Hide move swap cursor in TestBattle. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ; This causes PrintMenuItem to not run in TestBattle. ; MoveSelectionMenu still draws part of its window, an issue @@ -4404,7 +4404,7 @@ GetEnemyMonStat: ret .notLinkBattle ld a, [wEnemyMonLevel] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wEnemyMonSpecies] ld [wd0b5], a call GetMonHeader @@ -6092,7 +6092,7 @@ GetCurrentMove: .player ld de, wPlayerMoveNum ; Apply InitBattleVariables to TestBattle. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ld a, [wTestBattlePlayerSelectedMove] jr nz, .selected @@ -6143,7 +6143,7 @@ LoadEnemyMonData: ld [hli], a ld [hl], b ld de, wEnemyMonLevel - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld [de], a inc de ld b, $0 @@ -6776,7 +6776,7 @@ InitOpponent: jr InitBattleCommon DetermineWildOpponent: - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a jr z, .notDebugMode ldh a, [hJoyHeld] @@ -6794,7 +6794,7 @@ InitBattleCommon: ld hl, wLetterPrintingDelayFlags ld a, [hl] push af - res 1, [hl] + res BIT_TEXT_DELAY, [hl] ; no delay callfar InitBattleVariables ld a, [wEnemyMonSpecies2] sub OPP_ID_OFFSET diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index b94b12d2..643afeb2 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -812,7 +812,7 @@ SwitchAndTeleportEffect: ld a, [wIsInBattle] dec a jr nz, .notWildBattle1 - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a ld a, [wBattleMonLevel] cp b ; is the player's level greater than the enemy's level? @@ -856,7 +856,7 @@ SwitchAndTeleportEffect: jr nz, .notWildBattle2 ld a, [wBattleMonLevel] ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jr nc, .enemyMoveWasSuccessful add b diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index b9f9d537..80fdf002 100644 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -66,8 +66,8 @@ EndOfBattle: ld [hli], a dec b jr nz, .loop - ld hl, wd72c - set 0, [hl] + ld hl, wStatusFlags2 + set BIT_WILD_ENCOUNTER_COOLDOWN, [hl] call WaitForSoundToFinish call GBPalWhiteOut ld a, $ff diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 0eab6e08..798d7ce1 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -160,11 +160,11 @@ GainExperience: ld a, [hl] ; current level cp d jp z, .nextMon ; if level didn't change, go to next mon - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] push af push hl ld a, d - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc @@ -261,7 +261,7 @@ GainExperience: predef FlagActionPredef pop hl pop af - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a .nextMon ld a, [wPartyCount] diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a9e09a30..a88b0dfc 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -49,7 +49,7 @@ ReadTrainer: ld a, [hli] cp $FF ; is the trainer special? jr z, .SpecialTrainer ; if so, check for special moves - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a .LoopTrainerData ld a, [hli] and a ; have we reached the end of the trainer data? @@ -69,7 +69,7 @@ ReadTrainer: ld a, [hli] and a ; have we reached the end of the trainer data? jr z, .AddLoneMove - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [hli] ld [wcf91], a ld a, ENEMY_PARTY_DATA @@ -150,7 +150,7 @@ ReadTrainer: ld [de], a inc de ld [de], a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a .LastLoop ; update wAmountMoneyWon addresses (money to win) based on enemy's level @@ -162,5 +162,5 @@ ReadTrainer: inc de inc de dec b - jr nz, .LastLoop ; repeat wCurEnemyLVL times + jr nz, .LastLoop ; repeat wCurEnemyLevel times ret diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 8c9c1529..eede46ed 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -4,8 +4,8 @@ TryDoWildEncounter: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz - ld a, [wd736] - and a + ld a, [wMovementFlags] + and a ; is player exiting a door, jumping over a ledge, or fishing? ret nz callfar IsPlayerStandingOnDoorTileOrWarpTile jr nc, .notStandingOnDoorOrWarpTile @@ -74,7 +74,7 @@ TryDoWildEncounter: ld b, 0 add hl, bc ld a, [hli] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [hl] ld [wcf91], a ld [wEnemyMonSpecies2], a @@ -83,7 +83,7 @@ TryDoWildEncounter: jr z, .willEncounter ld a, [wPartyMon1Level] ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr .willEncounter diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index fbf136fe..06c2ace1 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -55,7 +55,7 @@ IF DEF(_DEBUG) jp z, TestBattle ; DEBUG - ld hl, wd732 + ld hl, wStatusFlags6 set BIT_DEBUG_MODE, [hl] jp StartNewGameDebug @@ -80,7 +80,7 @@ TestBattle: ; unreferenced except in _DEBUG ld a, 1 << BIT_EARTHBADGE ld [wObtainedBadges], a - ld hl, wFlags_D733 + ld hl, wStatusFlags7 set BIT_TEST_BATTLE, [hl] ; wNumBagItems and wBagItems are not initialized here, @@ -100,7 +100,7 @@ TestBattle: ; unreferenced except in _DEBUG ld a, RHYDON ld [wcf91], a ld a, 20 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a xor a ld [wMonDataLocation], a ld [wCurMap], a diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 0c76bde1..17d0f793 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -7,7 +7,7 @@ SetDebugNewGameParty: ; unreferenced except in _DEBUG ld [wcf91], a inc de ld a, [de] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a inc de call AddPartyMon jr .loop diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm index 16d2081f..5b0459e2 100644 --- a/engine/events/black_out.asm +++ b/engine/events/black_out.asm @@ -8,7 +8,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wNPCMovementScriptFunctionNum], a ldh [hJoyHeld], a ld [wNPCMovementScriptPointerTableNum], a - ld [wFlags_0xcd60], a + ld [wMiscFlags], a ldh [hMoney], a ldh [hMoney + 1], a @@ -37,10 +37,10 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wPlayerMoney + 2], a .lostmoney - ld hl, wd732 - set 2, [hl] - res 3, [hl] - set 6, [hl] - ld a, %11111111 + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a predef_jump HealParty diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 545baf13..eb82a5b1 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -1,6 +1,6 @@ GiveFossilToCinnabarLab:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wCurrentMenuItem], a ld a, A_BUTTON | B_BUTTON @@ -24,8 +24,8 @@ GiveFossilToCinnabarLab:: call TextBoxBorder call UpdateSprites call PrintFossilsInBag - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .cancelledGivingFossil diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index e08b1f24..900e3782 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -6,8 +6,8 @@ DisplayDiploma:: call ClearScreen xor a ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call DisableLCD ld hl, CircleTile ld de, vChars2 tile CIRCLE_TILE_ID @@ -65,8 +65,8 @@ DisplayDiploma:: ld a, $90 ldh [rOBP0], a call WaitForTextScrollButtonPress - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns call Delay3 diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index d657ea85..68d48bb3 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -1,9 +1,9 @@ _DisplayPokedex:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] predef ShowPokedexData - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call ReloadMapData ld c, 10 call DelayFrames diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index 6147387a..b4c0256d 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -82,8 +82,8 @@ BillsHousePokemonList:: ld a, 1 ld [wTopMenuItemX], a .billsPokemonLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 10 ld c, 9 @@ -113,8 +113,8 @@ BillsHousePokemonList:: call LoadScreenTilesFromBuffer2 jr .billsPokemonLoop .cancel - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer2 jp TextScriptEnd diff --git a/engine/events/hidden_objects/school_blackboard.asm b/engine/events/hidden_objects/school_blackboard.asm index fd3c0b8f..4839af37 100644 --- a/engine/events/hidden_objects/school_blackboard.asm +++ b/engine/events/hidden_objects/school_blackboard.asm @@ -24,8 +24,8 @@ LinkCableHelp:: ld a, 1 ld [wTopMenuItemX], a .linkHelpLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 8 ld c, 13 @@ -41,8 +41,8 @@ LinkCableHelp:: ld a, [wCurrentMenuItem] cp 3 ; pressed a on "STOP READING" jr z, .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, LinkCableInfoTexts add a ld d, 0 @@ -54,8 +54,8 @@ LinkCableHelp:: call PrintText jp .linkHelpLoop .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd @@ -108,8 +108,8 @@ ViridianSchoolBlackboard:: ld a, 1 ld [wTopMenuItemX], a .blackboardLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 lb bc, 6, 10 call TextBoxBorder @@ -158,8 +158,8 @@ ViridianSchoolBlackboard:: jr z, .exitBlackboard ; we must have pressed a on a status condition ; so print the text - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, ViridianBlackboardStatusPointers add a ld d, 0 @@ -171,8 +171,8 @@ ViridianSchoolBlackboard:: call PrintText jp .blackboardLoop .exitBlackboard - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd diff --git a/engine/events/hidden_objects/town_map.asm b/engine/events/hidden_objects/town_map.asm index 4284214f..11f7cbc7 100644 --- a/engine/events/hidden_objects/town_map.asm +++ b/engine/events/hidden_objects/town_map.asm @@ -4,8 +4,8 @@ TownMapText:: text_asm ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 xor a ldh [hWY], a @@ -13,8 +13,8 @@ TownMapText:: ldh [hAutoBGTransferEnabled], a call LoadFontTilePatterns farcall DisplayTownMap - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld de, TextScriptEnd push de ldh a, [hLoadedROMBank] diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index c6951615..54588e7d 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -108,7 +108,7 @@ InGameTrade_DoTrade: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld hl, wCompletedInGameTradeFlags ld a, [wWhichTrade] ld c, a @@ -118,13 +118,13 @@ InGameTrade_DoTrade: call PrintText ld a, [wWhichPokemon] push af - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] push af call LoadHpBarAndStatusTilePatterns call InGameTrade_PrepareTradeData predef InternalClockTradeAnim pop af - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop af ld [wWhichPokemon], a ld a, [wInGameTradeReceiveMonSpecies] diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 8bb756b5..513d08a7 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,6 +1,7 @@ ApplyOutOfBattlePoisonDamage: - ld a, [wd730] - add a + ld a, [wStatusFlags5] + assert BIT_SCRIPTED_MOVEMENT_STATE == 7 + add a ; overflows bit 7 into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wPartyCount] and a @@ -101,8 +102,8 @@ ApplyOutOfBattlePoisonDamage: ld a, TEXT_BLACKED_OUT ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72e - set 5, [hl] + ld hl, wStatusFlags4 + set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, $ff jr .done .noBlackOut diff --git a/engine/events/pokecenter.asm b/engine/events/pokecenter.asm index 97dbcd53..e52c8f5e 100644 --- a/engine/events/pokecenter.asm +++ b/engine/events/pokecenter.asm @@ -2,10 +2,10 @@ DisplayPokemonCenterDialogue_:: call SaveScreenTilesToBuffer1 ; save screen ld hl, PokemonCenterWelcomeText call PrintText - ld hl, wd72e - bit 2, [hl] - set 1, [hl] - set 2, [hl] + ld hl, wStatusFlags4 + bit BIT_USED_POKECENTER, [hl] + set BIT_UNKNOWN_4_1, [hl] + set BIT_USED_POKECENTER, [hl] jr nz, .skipShallWeHealYourPokemon ld hl, ShallWeHealYourPokemonText call PrintText diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index bc3aab9a..c1e93c36 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -5,8 +5,8 @@ CeladonPrizeMenu:: ld hl, RequireCoinCaseTextPtr jp PrintText .havingCoinCase - ld hl, wd730 - set 6, [hl] ; disable letter-printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld hl, ExchangeCoinsForPrizesTextPtr call PrintText ; the following are the menu settings @@ -38,8 +38,8 @@ CeladonPrizeMenu:: jr z, .noChoice call HandlePrizeChoice .noChoice - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret RequireCoinCaseTextPtr: @@ -298,7 +298,7 @@ GetPrizeMonLevel: jr .loop .matchFound ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ret INCLUDE "data/events/prize_mon_levels.asm" diff --git a/engine/events/vending_machine.asm b/engine/events/vending_machine.asm index 980a45c5..1530b994 100644 --- a/engine/events/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -15,8 +15,8 @@ VendingMachineMenu:: ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 3 ld b, 8 ld c, 12 @@ -28,8 +28,8 @@ VendingMachineMenu:: hlcoord 9, 6 ld de, DrinkPriceText call PlaceString - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .notThirsty diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 8704814f..3916c0db 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -150,8 +150,8 @@ PrepareOAMData:: ld h, HIGH(wShadowOAM) ld de, $4 ld b, $a0 - ld a, [wd736] - bit 6, a ; jumping down ledge or fishing animation? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ld a, $a0 jr z, .clear diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 8d21b964..e771504d 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -495,7 +495,7 @@ ItemUseBall: ld a, [wEnemyMonSpecies2] ld [wcf91], a ld a, [wEnemyMonLevel] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a callfar LoadEnemyMonData pop af ld [wcf91], a @@ -679,8 +679,8 @@ ItemUseSurfboard: jp c, SurfingAttemptFailed .surf call .makePlayerMoveForward - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, 2 ld [wWalkBikeSurfState], a ; change player state to surfing call PlayDefaultMusic ; play surfing music @@ -715,8 +715,8 @@ ItemUseSurfboard: jp PrintText .stopSurfing call .makePlayerMoveForward - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] xor a ld [wWalkBikeSurfState], a ; change player state to walking dec a @@ -1259,7 +1259,7 @@ ItemUseMedicine: ld bc, wPartyMon1Level - wPartyMon1 add hl, bc ; hl now points to level ld a, [hl] ; a = level - ld [wCurEnemyLVL], a ; store level + ld [wCurEnemyLevel], a ; store level call GetMonHeader push de ld a, d @@ -1338,7 +1338,7 @@ ItemUseMedicine: jr z, .vitaminNoEffect ; can't raise level above 100 inc a ld [hl], a ; store incremented level - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a push hl push de ld d, a @@ -1505,11 +1505,11 @@ ItemUseEscapeRope: jr z, .notUsable cp b jr nz, .loop - ld hl, wd732 - set 3, [hl] - set 6, [hl] - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ResetEvent EVENT_IN_SAFARI_ZONE xor a ld [wNumSafariBalls], a @@ -1597,8 +1597,8 @@ ItemUseCardKey: .done ld hl, ItemUseText00 call PrintText - ld hl, wd728 - set 7, [hl] + ld hl, wStatusFlags1 + set BIT_UNUSED_CARD_KEY, [hl] ; never checked ret INCLUDE "data/events/card_key_coords.asm" @@ -1872,7 +1872,7 @@ RodResponse: ld a, 1 ld [wMoveMissed], a ld a, b ; level - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, c ; species ld [wCurOpponent], a @@ -2774,7 +2774,7 @@ SendNewMonToBox: ld [de], a inc de push de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld d, a callfar CalcExperience pop de diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index d278d034..ccbe0225 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -208,10 +208,11 @@ LoadTownMap_Fly:: call PlaySound ld a, [hl] ld [wDestinationMap], a - ld hl, wd732 - set 3, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + assert wStatusFlags6 + 1 == wStatusFlags7 inc hl - set 7, [hl] + set BIT_USED_FLY, [hl] .pressedB xor a ld [wTownMapSpriteBlinkingEnabled], a diff --git a/engine/joypad.asm b/engine/joypad.asm index 87f92635..63b09a87 100644 --- a/engine/joypad.asm +++ b/engine/joypad.asm @@ -19,8 +19,8 @@ _Joypad:: ld a, b ldh [hJoyLast], a - ld a, [wd730] - bit 5, a + ld a, [wStatusFlags5] + bit BIT_DISABLE_JOYPAD, a jr nz, DiscardButtonPresses ldh a, [hJoyLast] diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index f10e1ada..e5796e53 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -587,7 +587,7 @@ ReturnToCableClubRoom: push hl res 0, [hl] xor a - ld [wd72d], a + ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING dec a ld [wDestinationWarpID], a call LoadMapData @@ -839,7 +839,7 @@ TradeCenter_Trade: call ClearScreen call LoadHpBarAndStatusTilePatterns xor a - ld [wUnusedCC5B], a + ld [wUnusedFlag], a ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .usingExternalClock diff --git a/engine/link/cable_club_npc.asm b/engine/link/cable_club_npc.asm index 41f56a21..d88538b0 100644 --- a/engine/link/cable_club_npc.asm +++ b/engine/link/cable_club_npc.asm @@ -110,8 +110,8 @@ CableClubNPC:: ld hl, wUnknownSerialCounter ld [hli], a ld [hl], a - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] xor a ld [wMenuJoypadPollCount], a ret diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index 6ce76e7f..7f2c1a59 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -32,9 +32,9 @@ DisplayTextIDInit:: .skipDrawingTextBoxBorder ld hl, wFontLoaded set 0, [hl] - ld hl, wFlags_0xcd60 - bit 4, [hl] - res 4, [hl] + ld hl, wMiscFlags + bit BIT_NO_SPRITE_UPDATES, [hl] + res BIT_NO_SPRITE_UPDATES, [hl] jr nz, .skipMovingSprites call UpdateSprites .skipMovingSprites diff --git a/engine/menus/draw_start_menu.asm b/engine/menus/draw_start_menu.asm index 00d385bc..c5b85952 100644 --- a/engine/menus/draw_start_menu.asm +++ b/engine/menus/draw_start_menu.asm @@ -23,8 +23,8 @@ DrawStartMenu:: ld [wLastMenuItem], a xor a ld [wMenuWatchMovingOutOfBounds], a - ld hl, wd730 - set 6, [hl] ; no pauses between printing each letter + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 12, 2 CheckEvent EVENT_GOT_POKEDEX ; case for not having pokedex @@ -42,8 +42,8 @@ DrawStartMenu:: call PrintStartMenuItem ld de, wPlayerName ; player's name call PrintStartMenuItem - ld a, [wd72e] - bit 6, a ; is the player using the link feature? + ld a, [wStatusFlags4] + bit BIT_LINK_CONNECTED, a ; case for not using link feature ld de, StartMenuSaveText jr z, .printSaveOrResetText @@ -55,8 +55,8 @@ DrawStartMenu:: call PrintStartMenuItem ld de, StartMenuExitText call PlaceString - ld hl, wd730 - res 6, [hl] ; turn pauses between printing letters back on + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret StartMenuPokedexText: diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 533454ad..08ff22e4 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -1,8 +1,8 @@ PKMNLeaguePC: ld hl, AccessedHoFPCText call PrintText - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] push hl ld a, [wUpdateSpritesEnabled] push af diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index e638b169..df9f523f 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -21,14 +21,14 @@ MainMenu: ld [hli], a ld [hl], a ld [wDefaultMap], a - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] call ClearScreen call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call LoadFontTilePatterns - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, [wSaveFileStatus] cp 1 jr z, .noSaveFile @@ -50,8 +50,8 @@ MainMenu: ld de, NewGameText call PlaceString .next2 - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call UpdateSprites xor a ld [wCurrentMenuItem], a @@ -85,7 +85,7 @@ MainMenu: cp 1 jp z, StartNewGame call DisplayOptionMenu - ld a, 1 + ld a, TRUE ld [wOptionsInitialized], a jp .mainMenuLoop .choseContinue @@ -99,10 +99,10 @@ MainMenu: ldh [hJoyHeld], a call Joypad ldh a, [hJoyHeld] - bit 0, a + bit BIT_A_BUTTON, a jr nz, .pressedA - bit 1, a - jp nz, .mainMenuLoop ; pressed B + bit BIT_B_BUTTON, a + jp nz, .mainMenuLoop jr .inputLoop .pressedA call GBPalWhiteOutWithDelay3 @@ -114,18 +114,18 @@ MainMenu: ld a, [wNumHoFTeams] and a jp z, SpecialEnterMap - ld a, [wCurMap] ; map ID + ld a, [wCurMap] cp HALL_OF_FAME jp nz, SpecialEnterMap xor a ld [wDestinationMap], a - ld hl, wd732 - set 2, [hl] ; fly warp or dungeon warp + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] call PrepareForSpecialWarp jp SpecialEnterMap InitOptions: - ld a, TEXT_DELAY_FAST + ld a, 1 << BIT_FAST_TEXT_DELAY ld [wLetterPrintingDelayFlags], a ld a, TEXT_DELAY_MEDIUM ld [wOptions], a @@ -134,8 +134,8 @@ InitOptions: LinkMenu: xor a ld [wLetterPrintingDelayFlags], a - ld hl, wd72e - set 6, [hl] + ld hl, wStatusFlags4 + set BIT_LINK_CONNECTED, [hl] ld hl, LinkMenuEmptyText call PrintText call SaveScreenTilesToBuffer1 @@ -151,20 +151,25 @@ LinkMenu: call PlaceString xor a ld [wUnusedLinkMenuByte], a - ld [wd72d], a + ld [wCableClubDestinationMap], a ld hl, wTopMenuItemY - ld a, $7 + ld a, 7 ld [hli], a - ld a, $6 + assert wTopMenuItemY + 1 == wTopMenuItemX + ld a, 6 ld [hli], a + assert wTopMenuItemX + 1 == wCurrentMenuItem xor a ld [hli], a inc hl - ld a, $2 + assert wCurrentMenuItem + 2 == wMaxMenuItem + ld a, 2 ld [hli], a + assert wMaxMenuItem + 1 == wMenuWatchedKeys + assert 2 + 1 == A_BUTTON | B_BUTTON inc a - ; ld a, A_BUTTON | B_BUTTON - ld [hli], a ; wMenuWatchedKeys + ld [hli], a + assert wMenuWatchedKeys + 1 == wLastMenuItem xor a ld [hl], a .waitForInputLoop @@ -262,12 +267,12 @@ LinkMenu: jr nz, .next ld a, TRADE_CENTER .next - ld [wd72d], a + ld [wCableClubDestinationMap], a ld hl, PleaseWaitText call PrintText ld c, 50 call DelayFrames - ld hl, wd732 + ld hl, wStatusFlags6 res BIT_DEBUG_MODE, [hl] ld a, [wDefaultMap] ld [wDestinationMap], a @@ -290,8 +295,8 @@ LinkMenu: ld hl, LinkCanceledText vc_hook Wireless_net_end call PrintText - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] ret WhereWouldYouLikeText: @@ -307,11 +312,9 @@ LinkCanceledText: text_end StartNewGame: - ld hl, wd732 - ; Ensure debug mode is not used when - ; starting a regular new game. - ; Debug mode persists in saved games for - ; both debug and non-debug builds, and is + ld hl, wStatusFlags6 + ; Ensure debug mode is not used when starting a regular new game. + ; Debug mode persists in saved games for both debug and non-debug builds, and is ; only reset here by the main menu. res BIT_DEBUG_MODE, [hl] ; fallthrough @@ -326,9 +329,9 @@ SpecialEnterMap:: ldh [hJoyPressed], a ldh [hJoyHeld], a ldh [hJoy5], a - ld [wd72d], a - ld hl, wd732 - set 0, [hl] ; count play time + ld [wCableClubDestinationMap], a + ld hl, wStatusFlags6 + set BIT_GAME_TIMER_COUNTING, [hl] call ResetPlayerSpriteData ld c, 20 call DelayFrames @@ -465,7 +468,8 @@ DisplayOptionMenu: xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - inc a + assert BIT_FAST_TEXT_DELAY == 0 + inc a ; 1 << BIT_FAST_TEXT_DELAY ld [wLetterPrintingDelayFlags], a ld [wOptionsCancelCursorX], a ld a, 3 ; text speed cursor Y coordinate @@ -556,12 +560,12 @@ DisplayOptionMenu: jp .loop .cursorInBattleAnimation ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate - xor $0b ; toggle between 1 and 10 + xor 1 ^ 10 ; toggle between 1 and 10 ld [wOptionsBattleAnimCursorX], a jp .eraseOldMenuCursor .cursorInBattleStyle ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate - xor $0b ; toggle between 1 and 10 + xor 1 ^ 10 ; toggle between 1 and 10 ld [wOptionsBattleStyleCursorX], a jp .eraseOldMenuCursor .pressedLeftInTextSpeed @@ -622,19 +626,19 @@ SetOptionsFromCursorPositions: dec a jr z, .battleAnimationOn .battleAnimationOff - set 7, d + set BIT_BATTLE_ANIMATION, d jr .checkBattleStyle .battleAnimationOn - res 7, d + res BIT_BATTLE_ANIMATION, d .checkBattleStyle ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a jr z, .battleStyleShift .battleStyleSet - set 6, d + set BIT_BATTLE_SHIFT, d jr .storeOptions .battleStyleShift - res 6, d + res BIT_BATTLE_SHIFT, d .storeOptions ld a, d ld [wOptions], a diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index c2e63aef..f5120518 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -83,8 +83,8 @@ DisplayNameRaterScreen:: DisplayNamingScreen: push hl - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites @@ -167,8 +167,8 @@ DisplayNamingScreen: call GBPalNormal xor a ld [wAnimCounter], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wIsInBattle] and a jp z, LoadTextBoxTilePatterns diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 46b828eb..50a9838c 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -172,11 +172,11 @@ RedrawPartyMenu_:: ld b, SET_PAL_PARTY_MENU call RunPaletteCommand .printMessage - ld hl, wd730 + ld hl, wStatusFlags5 ld a, [hl] push af push hl - set 6, [hl] ; turn off letter printing delay + set BIT_NO_TEXT_DELAY, [hl] ld a, [wPartyMenuTypeOrMessageID] ; message ID cp FIRST_PARTY_MENU_TEXT_ID jr nc, .printItemUseMessage diff --git a/engine/menus/pc.asm b/engine/menus/pc.asm index 6a15eaa5..33dd3c2c 100644 --- a/engine/menus/pc.asm +++ b/engine/menus/pc.asm @@ -5,14 +5,14 @@ ActivatePC:: ld hl, TurnedOnPC1Text call PrintText call WaitForSoundToFinish - ld hl, wFlags_0xcd60 - set 3, [hl] + ld hl, wMiscFlags + set BIT_USING_GENERIC_PC, [hl] call LoadScreenTilesFromBuffer2 call Delay3 PCMainMenu: farcall DisplayPCMainMenu - ld hl, wFlags_0xcd60 - set 5, [hl] + ld hl, wMiscFlags + set BIT_NO_MENU_BUTTON_SOUND, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jp nz, LogOff @@ -48,9 +48,9 @@ PCMainMenu: jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague jp LogOff ;otherwise, it's 4, and you're logging off .playersPC - ld hl, wFlags_0xcd60 - res 5, [hl] - set 3, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] + set BIT_USING_GENERIC_PC, [hl] ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish @@ -93,9 +93,9 @@ LogOff: ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish - ld hl, wFlags_0xcd60 - res 3, [hl] - res 5, [hl] + ld hl, wMiscFlags + res BIT_USING_GENERIC_PC, [hl] + res BIT_NO_MENU_BUTTON_SOUND, [hl] ret TurnedOnPC1Text: diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index 5461be51..e0a3a007 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -1,14 +1,14 @@ PlayerPC:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, ITEM_NAME ld [wNameListType], a call SaveScreenTilesToBuffer1 xor a ld [wBagSavedMenuItem], a ld [wParentMenuItem], a - ld a, [wFlags_0xcd60] - bit 3, a ; accessing player's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, PlayerPCMenu ; accessing it directly ld a, SFX_TURN_ON_PC @@ -19,8 +19,8 @@ PlayerPC:: PlayerPCMenu: ld a, [wParentMenuItem] ld [wCurrentMenuItem], a - ld hl, wFlags_0xcd60 - set 5, [hl] + ld hl, wMiscFlags + set BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 hlcoord 0, 0 ld b, $8 @@ -63,22 +63,22 @@ PlayerPCMenu: jp z, PlayerPCToss ExitPlayerPC: - ld a, [wFlags_0xcd60] - bit 3, a ; accessing player's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, .next ; accessing it directly ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish .next - ld hl, wFlags_0xcd60 - res 5, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 xor a ld [wListScrollOffset], a ld [wBagSavedMenuItem], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index df5d643e..c6fe37a0 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -397,8 +397,8 @@ ShowPokedexData: ; function to display pokedex data from inside the pokedex ShowPokedexDataInternal: - ld hl, wd72c - set 1, [hl] + ld hl, wStatusFlags2 + set BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $33 ; 3/7 volume ldh [rNR50], a call GBPalWhiteOut ; zero all palettes @@ -583,8 +583,8 @@ ShowPokedexDataInternal: call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call GBPalNormal - ld hl, wd72c - res 1, [hl] + ld hl, wStatusFlags2 + res BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $77 ; max volume ldh [rNR50], a ret diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 3269e7f2..2f61b678 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -1,6 +1,5 @@ LoadSAV: -;(if carry -> write -;"the file data is destroyed") +; if carry, write "the file data is destroyed" call ClearScreen call LoadFontTilePatterns call LoadTextBoxTilePatterns @@ -13,15 +12,15 @@ LoadSAV: ld a, $2 ; good checksum jr .goodsum .badsum - ld hl, wd730 + ld hl, wStatusFlags5 push hl - set 6, [hl] + set BIT_NO_TEXT_DELAY, [hl] ld hl, FileDataDestroyedText call PrintText ld c, 100 call DelayFrames pop hl - res 6, [hl] + res BIT_NO_TEXT_DELAY, [hl] ld a, $1 ; bad checksum .goodsum ld [wSaveFileStatus], a diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 7dfb7dc3..5f742e38 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -142,12 +142,12 @@ StartMenu_Pokemon:: jp .loop .canFly call ChooseFlyDestination - ld a, [wd732] - bit 3, a ; did the player decide to fly? + ld a, [wStatusFlags6] + bit BIT_FLY_WARP, a jp nz, .goBackToMap call LoadFontTilePatterns - ld hl, wd72e - set 1, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] jp StartMenu_Pokemon .cut bit BIT_CASCADEBADGE, a @@ -161,9 +161,9 @@ StartMenu_Pokemon:: bit BIT_SOULBADGE, a jp z, .newBadgeRequired farcall IsSurfingAllowed - ld hl, wd728 - bit 1, [hl] - res 1, [hl] + ld hl, wStatusFlags1 + bit BIT_SURF_ALLOWED, [hl] + res BIT_SURF_ALLOWED, [hl] jp z, .loop ld a, SURFBOARD ld [wcf91], a @@ -177,7 +177,7 @@ StartMenu_Pokemon:: .strength bit BIT_RAINBOWBADGE, a jp z, .newBadgeRequired - predef PrintStrengthTxt + predef PrintStrengthText call GBPalWhiteOutWithDelay3 jp .goBackToMap .flash @@ -214,12 +214,12 @@ StartMenu_Pokemon:: .canTeleport ld hl, .warpToLastPokemonCenterText call PrintText - ld hl, wd732 - set 3, [hl] - set 6, [hl] - ld hl, wd72e - set 1, [hl] - res 4, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] + res BIT_NO_BATTLES, [hl] ld c, 60 call DelayFrames call GBPalWhiteOutWithDelay3 @@ -371,8 +371,8 @@ StartMenu_Item:: ld a, [wcf91] cp BICYCLE jr nz, .notBicycle2 - ld a, [wd732] - bit 5, a + ld a, [wStatusFlags6] + bit BIT_ALWAYS_ON_BIKE, a jr z, .useItem_closeMenu ld hl, CannotGetOffHereText call PrintText @@ -639,8 +639,8 @@ TrainerInfo_DrawVerticalLine: ret StartMenu_SaveReset:: - ld a, [wd72e] - bit 6, a ; is the player using the link feature? + ld a, [wStatusFlags4] + bit BIT_LINK_CONNECTED, a jp nz, Init predef SaveSAV ; save the game call LoadScreenTilesFromBuffer2 ; restore saved screen diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index cdb8841d..3c1b5233 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -37,14 +37,14 @@ DisplayTextBoxID_:: call TextBoxBorder pop hl call GetTextBoxIDText - ld a, [wd730] + ld a, [wStatusFlags5] push af - ld a, [wd730] - set 6, a ; no pauses between printing each letter - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a call PlaceString pop af - ld [wd730], a + ld [wStatusFlags5], a call UpdateSprites ret @@ -128,8 +128,8 @@ GetAddressOfScreenCoords: INCLUDE "data/text_boxes.asm" DisplayMoneyBox: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, MONEY_BOX_TEMPLATE ld [wTextBoxID], a call DisplayTextBoxID @@ -141,17 +141,17 @@ DisplayMoneyBox: ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret CurrencyString: db " ¥@" DoBuySellQuitMenu: - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a xor a ld [wChosenMenuItem], a ld a, BUY_SELL_QUIT_MENU_TEMPLATE @@ -169,9 +169,9 @@ DoBuySellQuitMenu: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd730] - res 6, a ; turn on the printing delay - ld [wd730], a + ld a, [wStatusFlags5] + res BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a call HandleMenuInput call PlaceUnfilledArrowMenuCursor bit BIT_A_BUTTON, a @@ -205,9 +205,9 @@ DoBuySellQuitMenu: ; hl = address where the text box border should be drawn DisplayTwoOptionMenu: push hl - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a ; pointless because both values are overwritten before they are read xor a @@ -277,8 +277,8 @@ DisplayTwoOptionMenu: pop hl add hl, bc call PlaceString - ld hl, wd730 - res 6, [hl] ; turn on the printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wTwoOptionMenuID] cp NO_YES_MENU jr nz, .notNoYesMenu @@ -287,12 +287,12 @@ DisplayTwoOptionMenu: ; it only seems to be used when confirming the deletion of a save file xor a ld [wTwoOptionMenuID], a - ld a, [wFlags_0xcd60] + ld a, [wMiscFlags] push af push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] - set 5, [hl] ; don't play sound when A or B is pressed in menu + ld hl, wMiscFlags + bit BIT_NO_MENU_BUTTON_SOUND, [hl] + set BIT_NO_MENU_BUTTON_SOUND, [hl] pop hl .noYesMenuInputLoop call HandleMenuInput @@ -300,7 +300,7 @@ DisplayTwoOptionMenu: jr nz, .noYesMenuInputLoop ; try again if B was not pressed pop af pop hl - ld [wFlags_0xcd60], a + ld [wMiscFlags], a ld a, SFX_PRESS_AB call PlaySound jr .pressedAButton diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 3e339619..d0fc4ad8 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -8,7 +8,7 @@ PrepareOakSpeech: ; which causes CheckForceBikeOrSurf to not return. ; To fix this in debug builds, reset bit 5 here or in StartNewGame. ; In non-debug builds, the instructions can be removed. - ld a, [wd732] + ld a, [wStatusFlags6] push af ld hl, wPlayerName ld bc, wBoxDataEnd - wPlayerName @@ -19,7 +19,7 @@ PrepareOakSpeech: xor a call FillMemory pop af - ld [wd732], a + ld [wStatusFlags6], a pop af ld [wOptions], a pop af @@ -61,7 +61,7 @@ OakSpeech: call PrepareForSpecialWarp xor a ldh [hTileAnimations], a - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a jp nz, .skipSpeech ld de, ProfOakPic @@ -106,8 +106,8 @@ OakSpeech: lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call GBFadeInFromWhite - ld a, [wd72d] - and a + ld a, [wStatusFlags3] + and a ; ??? jr nz, .next ld hl, OakSpeechText3 call PrintText diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 36a28b0d..7edbbedf 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -15,9 +15,11 @@ PrepareTitleScreen:: xor a ldh [hWY], a ld [wLetterPrintingDelayFlags], a - ld hl, wd732 + ld hl, wStatusFlags6 ld [hli], a + assert wStatusFlags6 + 1 == wStatusFlags7 ld [hli], a + assert wStatusFlags7 + 1 == wElite4Flags ld [hl], a ld a, BANK(Music_TitleScreen) ld [wAudioROMBank], a @@ -218,7 +220,7 @@ ENDC ld [wNewSoundID], a call PlaySound xor a - ld [wUnusedCC5B], a + ld [wUnusedFlag], a ; Keep scrolling in new mons indefinitely until the user performs input. .awaitUserInterruptionLoop diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index def901ba..9d168cc7 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -173,8 +173,8 @@ LoadTradingGFXAndMonNames: call ClearSprites ld a, $ff ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] ; turn on instant text printing + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, [wOnSGB] and a ld a, $e4 ; non-SGB OBP0 @@ -218,8 +218,8 @@ Trade_SwapNames: Trade_Cleanup: xor a call LoadGBPal - ld hl, wd730 - res 6, [hl] ; turn off instant text printing + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret Trade_ShowPlayerMon: diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 53898371..8a45735f 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -1,12 +1,12 @@ PlayerStepOutFromDoor:: - ld hl, wd730 - res 1, [hl] + ld hl, wStatusFlags5 ; should this be wMovementFlags? + res BIT_EXITING_DOOR, [hl] call IsPlayerStandingOnDoorTile jr nc, .notStandingOnDoor ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd736 - set 1, [hl] + ld hl, wMovementFlags + set BIT_EXITING_DOOR, [hl] ld a, $1 ld [wSimulatedJoypadStatesIndex], a ld a, D_DOWN @@ -20,21 +20,21 @@ PlayerStepOutFromDoor:: ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a - ld hl, wd736 - res 0, [hl] - res 1, [hl] - ld hl, wd730 - res 7, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret _EndNPCMovementScript:: - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] - ld hl, wd736 - res 0, [hl] - res 1, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] xor a ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptPointerTableNum], a @@ -79,15 +79,15 @@ PalletMovementScript_OakMoveLeft: ld a, $3 ld [wNPCMovementScriptFunctionNum], a .done - ld hl, wFlags_D733 - set 1, [hl] + ld hl, wStatusFlags7 + set BIT_NO_MAP_MUSIC, [hl] ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ret PalletMovementScript_PlayerMoveLeft: - ld a, [wd730] - bit 0, a ; is an NPC being moved by a script? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ; return if Oak is still moving ld a, [wNumStepsToTake] ld [wSimulatedJoypadStatesIndex], a @@ -119,10 +119,10 @@ PalletMovementScript_WalkToLab: ld hl, wNPCMovementDirections2 ld de, RLEList_ProfOakWalkToLab call DecodeRLEList - ld hl, wd72e - res 7, [hl] - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, $4 ld [wNPCMovementScriptFunctionNum], a ret @@ -151,10 +151,10 @@ PalletMovementScript_Done: ld a, HS_PALLET_TOWN_OAK ld [wMissableObjectIndex], a predef HideObject - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp EndNPCMovementScript PewterMuseumGuyMovementScriptPointerTable:: @@ -183,8 +183,8 @@ PewterMovementScript_WalkToMuseum: ld hl, wNPCMovementDirections2 ld de, RLEList_PewterMuseumGuy call DecodeRLEList - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] ld a, $1 ld [wNPCMovementScriptFunctionNum], a ret @@ -207,10 +207,10 @@ PewterMovementScript_Done: ld a, [wSimulatedJoypadStatesIndex] and a ret nz - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp EndNPCMovementScript PewterGymGuyMovementScriptPointerTable:: @@ -240,10 +240,10 @@ PewterMovementScript_WalkToGym: ld hl, wNPCMovementDirections2 ld de, RLEList_PewterGymGuy call DecodeRLEList - ld hl, wd72e - res 7, [hl] - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, $1 ld [wNPCMovementScriptFunctionNum], a ret diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 8ae9ed65..3e514672 100644 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -32,8 +32,8 @@ UsedCut: ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearSprites call RestoreScreenTilesAndReloadTilePatterns @@ -49,8 +49,8 @@ UsedCut: ld hl, UsedCutText call PrintText call LoadScreenTilesFromBuffer2 - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, $ff ld [wUpdateSpritesEnabled], a call InitCutAnimOAM diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 84b13f17..d25d5ff1 100644 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -15,8 +15,8 @@ EmotionBubble: push af ld a, $ff ld [wUpdateSpritesEnabled], a - ld a, [wd736] - bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? ld hl, wShadowOAMSprite35Attributes ld de, wShadowOAMSprite39Attributes jr z, .next diff --git a/engine/overworld/field_move_messages.asm b/engine/overworld/field_move_messages.asm index d75ffc21..a9e29b63 100644 --- a/engine/overworld/field_move_messages.asm +++ b/engine/overworld/field_move_messages.asm @@ -1,6 +1,6 @@ -PrintStrengthTxt: - ld hl, wd728 - set 0, [hl] +PrintStrengthText: + ld hl, wStatusFlags1 + set BIT_STRENGTH_ACTIVE, [hl] ld hl, UsedStrengthText call PrintText ld hl, CanMoveBouldersText @@ -19,13 +19,13 @@ CanMoveBouldersText: text_end IsSurfingAllowed: -; Returns whether surfing is allowed in bit 1 of wd728. +; Returns whether surfing is allowed in BIT_SURF_ALLOWED of wStatusFlags1. ; Surfing isn't allowed on the Cycling Road or in the lowest level of the ; Seafoam Islands before the current has been slowed with boulders. - ld hl, wd728 - set 1, [hl] - ld a, [wd732] - bit 5, a + ld hl, wStatusFlags1 + set BIT_SURF_ALLOWED, [hl] + ld a, [wStatusFlags6] + bit BIT_ALWAYS_ON_BIKE, a jr nz, .forcedToRideBike ld a, [wCurMap] cp SEAFOAM_ISLANDS_B4F @@ -35,13 +35,13 @@ IsSurfingAllowed: ld hl, SeafoamIslandsB4FStairsCoords call ArePlayerCoordsInArray ret nc - ld hl, wd728 - res 1, [hl] + ld hl, wStatusFlags1 + res BIT_SURF_ALLOWED, [hl] ld hl, CurrentTooFastText jp PrintText .forcedToRideBike - ld hl, wd728 - res 1, [hl] + ld hl, wStatusFlags1 + res BIT_SURF_ALLOWED, [hl] ld hl, CyclingIsFunText jp PrintText diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index 855328e7..2798864a 100644 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -1,17 +1,17 @@ IsPlayerOnDungeonWarp:: xor a ld [wWhichDungeonWarp], a - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a ret nz call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] ld [wWhichDungeonWarp], a - ld hl, wd72d - set 4, [hl] - ld hl, wd732 - set 4, [hl] + ld hl, wStatusFlags3 + set BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + set BIT_DUNGEON_WARP, [hl] ret ; if a hidden object was found, stores $00 in [hDidntFindAnyHiddenObject], else stores $ff diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 89e4ef57..73733e15 100644 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -1,6 +1,6 @@ HandleLedges:: - ld a, [wd736] - bit 6, a ; already jumping down ledge + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ret nz ld a, [wCurMapTileset] and a ; OVERWORLD @@ -41,8 +41,8 @@ HandleLedges:: ret z ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd736 - set 6, [hl] ; jumping down ledge + ld hl, wMovementFlags + set BIT_LEDGE_OR_FISHING, [hl] call StartSimulatingJoypadStates ld a, e ld [wSimulatedJoypadStatesEnd], a diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index afcb5907..1ca24f6a 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -60,8 +60,8 @@ UpdatePlayerSprite: bit 0, a jr nz, .notMoving .moving - ld a, [wd736] - bit 7, a ; is the player sprite spinning due to a spin tile? + ld a, [wMovementFlags] + bit BIT_SPINNING, a jr nz, .skipSpriteAnim ldh a, [hCurrentSpriteOffset] add $7 @@ -175,8 +175,8 @@ UpdateNPCSprite: jr nz, .next ; reached end of wNPCMovementDirections list ld [hl], a ; store $ff in movement byte 1, disabling scripted movement - ld hl, wd730 - res 0, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_NPC_MOVEMENT, [hl] xor a ld [wSimulatedJoypadStatesIndex], a ld [wUnusedOverrideSimulatedJoypadStatesIndex], a @@ -409,8 +409,8 @@ MakeNPCFacePlayer: ; Check if the behaviour of the NPC facing the player when spoken to is ; disabled. This is only done when rubbing the S.S. Anne captain's back. - ld a, [wd72d] - bit 5, a + ld a, [wStatusFlags3] + bit BIT_NO_NPC_FACE_PLAYER, a jr nz, notYetMoving res 7, [hl] ld a, [wPlayerDirection] @@ -740,12 +740,12 @@ DoScriptedNPCMovement: ; a few times in the game. It is used when the NPC and player must walk together ; in sync, such as when the player is following the NPC somewhere. An NPC can't ; be moved in sync with the player using the other method. - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a ret z - ld hl, wd72e - bit 7, [hl] - set 7, [hl] + ld hl, wStatusFlags4 + bit BIT_INIT_SCRIPTED_MOVEMENT, [hl] + set BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp z, InitScriptedNPCMovement ld hl, wNPCMovementDirections2 ld a, [wNPCMovementDirections2Index] diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index bec59369..210599da 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -5,15 +5,15 @@ EnterMapAnim:: call Delay3 push hl call GBFadeInFromWhite - ld hl, wFlags_D733 - bit 7, [hl] ; used fly out of battle? - res 7, [hl] + ld hl, wStatusFlags7 + bit BIT_USED_FLY, [hl] + res BIT_USED_FLY, [hl] jr nz, .flyAnimation ld a, SFX_TELEPORT_ENTER_1 call PlaySound - ld hl, wd732 - bit 4, [hl] ; used dungeon warp? - res 4, [hl] + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] + res BIT_DUNGEON_WARP, [hl] pop hl jr nz, .dungeonWarpAnimation call PlayerSpinWhileMovingDown @@ -122,8 +122,8 @@ _LeaveMapAnim:: .playerNotStandingOnWarpPadOrHole ld a, $4 call StopMusic - ld a, [wd732] - bit 6, a ; is the last used pokemon center the destination? + ld a, [wStatusFlags6] + bit BIT_ESCAPE_WARP, a jr z, .flyAnimation ; if going to the last used pokemon center ld hl, wPlayerSpinInPlaceAnimFrameDelay @@ -378,8 +378,8 @@ INCLUDE "data/tilesets/warp_pad_hole_tile_ids.asm" FishingAnim: ld c, 10 call DelayFrames - ld hl, wd736 - set 6, [hl] ; reserve the last 4 OAM entries + ld hl, wMovementFlags + set BIT_LEDGE_OR_FISHING, [hl] ld de, RedSprite ld hl, vNPCSprites tile $00 lb bc, BANK(RedSprite), 12 @@ -445,8 +445,8 @@ FishingAnim: .done call PrintText - ld hl, wd736 - res 6, [hl] ; unreserve the last 4 OAM entries + ld hl, wMovementFlags + res BIT_LEDGE_OR_FISHING, [hl] call LoadFontTilePatterns ret @@ -512,10 +512,10 @@ _HandleMidJump:: ldh [hJoyPressed], a ldh [hJoyReleased], a ld [wPlayerJumpingYScreenCoordsIndex], a - ld hl, wd736 - res 6, [hl] ; not jumping down a ledge any more - ld hl, wd730 - res 7, [hl] ; not simulating joypad states any more + ld hl, wMovementFlags + res BIT_LEDGE_OR_FISHING, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] xor a ld [wJoyIgnore], a ret diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 80b132ac..4711bb5c 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -1,4 +1,4 @@ -; only used for setting bit 2 of wd736 upon entering a new map +; only used for setting BIT_STANDING_ON_WARP of wMovementFlags upon entering a new map IsPlayerStandingOnWarp:: ld a, [wNumberOfWarps] and a @@ -18,8 +18,8 @@ IsPlayerStandingOnWarp:: ld [wDestinationWarpID], a ld a, [hl] ; target map ldh [hWarpDestinationMap], a - ld hl, wd736 - set 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + set BIT_STANDING_ON_WARP, [hl] ret .nextWarp1 inc hl @@ -32,8 +32,8 @@ IsPlayerStandingOnWarp:: ret CheckForceBikeOrSurf:: - ld hl, wd732 - bit 5, [hl] + ld hl, wStatusFlags6 + bit BIT_ALWAYS_ON_BIKE, [hl] ret nz ld hl, ForcedBikeOrSurfMaps ld a, [wYCoord] @@ -45,14 +45,14 @@ CheckForceBikeOrSurf:: .loop ld a, [hli] cp $ff - ret z ;if we reach FF then it's not part of the list - cp d ;compare to current map + ret z ; if we reach FF then it's not part of the list + cp d ; compare to current map jr nz, .incorrectMap ld a, [hli] - cp b ;compare y-coord + cp b ; compare y-coord jr nz, .incorrectY ld a, [hli] - cp c ;compare x-coord + cp c ; compare x-coord jr nz, .loop ; incorrect x-coord, check next item ld a, [wCurMap] cp SEAFOAM_ISLANDS_B3F @@ -64,9 +64,8 @@ CheckForceBikeOrSurf:: ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT ld [wSeafoamIslandsB4FCurScript], a jr z, .forceSurfing - ;force bike riding - ld hl, wd732 - set 5, [hl] + ld hl, wStatusFlags6 + set BIT_ALWAYS_ON_BIKE, [hl] ld a, $1 ld [wWalkBikeSurfState], a ld [wWalkBikeSurfStateCopy], a @@ -207,8 +206,8 @@ IsPlayerStandingOnDoorTileOrWarpTile:: lda_coord 8, 9 call IsInArray jr nc, .done - ld hl, wd736 - res 2, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_WARP, [hl] .done pop bc pop de diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 96c506c0..7eee844c 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -1,9 +1,9 @@ TryPushingBoulder:: - ld a, [wd728] - bit 0, a ; using Strength? + ld a, [wStatusFlags1] + bit BIT_STRENGTH_ACTIVE, a ret z - ld a, [wFlags_0xcd60] - bit 1, a ; has boulder dust animation from previous push played yet? + ld a, [wMiscFlags] + bit BIT_BOULDER_DUST, a ret nz xor a ldh [hSpriteIndexOrTextID], a @@ -23,9 +23,9 @@ TryPushingBoulder:: ld a, [hl] cp BOULDER_MOVEMENT_BYTE_2 jp nz, ResetBoulderPushFlags - ld hl, wFlags_0xcd60 - bit 6, [hl] - set 6, [hl] ; indicate that the player has tried pushing + ld hl, wMiscFlags + bit BIT_TRIED_PUSH_BOULDER, [hl] + set BIT_TRIED_PUSH_BOULDER, [hl] ret z ; the player must try pushing twice before the boulder will move ldh a, [hJoyHeld] and D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -44,30 +44,30 @@ TryPushingBoulder:: cp SPRITE_FACING_RIGHT jr z, .pushBoulderRight .pushBoulderDown - bit 7, b + bit BIT_D_DOWN, b ret z ld de, PushBoulderDownMovementData jr .done .pushBoulderUp - bit 6, b + bit BIT_D_UP, b ret z ld de, PushBoulderUpMovementData jr .done .pushBoulderLeft - bit 5, b + bit BIT_D_LEFT, b ret z ld de, PushBoulderLeftMovementData jr .done .pushBoulderRight - bit 4, b + bit BIT_D_RIGHT, b ret z ld de, PushBoulderRightMovementData .done call MoveSprite ld a, SFX_PUSH_BOULDER call PlaySound - ld hl, wFlags_0xcd60 - set 1, [hl] + ld hl, wMiscFlags + set BIT_BOULDER_DUST, [hl] ret PushBoulderUpMovementData: @@ -87,14 +87,14 @@ PushBoulderRightMovementData: db -1 ; end DoBoulderDustAnimation:: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz callfar AnimateBoulderDust call DiscardButtonPresses ld [wJoyIgnore], a call ResetBoulderPushFlags - set 7, [hl] ; [wFlags_0xcd60] + set BIT_PUSHED_BOULDER, [hl] ld a, [wBoulderSpriteIndex] ldh [hSpriteIndex], a call GetSpriteMovementByte2Pointer @@ -103,7 +103,7 @@ DoBoulderDustAnimation:: jp PlaySound ResetBoulderPushFlags: - ld hl, wFlags_0xcd60 - res 1, [hl] - res 6, [hl] + ld hl, wMiscFlags + res BIT_BOULDER_DUST, [hl] + res BIT_TRIED_PUSH_BOULDER, [hl] ret diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 0cc2a474..303415c1 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -1,9 +1,9 @@ PrepareForSpecialWarp:: call LoadSpecialWarpData predef LoadTilesetHeader - ld hl, wd732 - bit 2, [hl] ; dungeon warp or fly warp? - res 2, [hl] + ld hl, wStatusFlags6 + bit BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_FLY_OR_DUNGEON_WARP, [hl] jr z, .debugNewGameWarp ld a, [wDestinationMap] jr .next @@ -17,19 +17,19 @@ PrepareForSpecialWarp:: ld a, PALLET_TOWN .next ld b, a - ld a, [wd72d] - and a + ld a, [wStatusFlags3] + and a ; ??? jr nz, .next2 ld a, b .next2 - ld hl, wd732 - bit 4, [hl] ; dungeon warp + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] ret nz ld [wLastMap], a ret LoadSpecialWarpData: - ld a, [wd72d] + ld a, [wCableClubDestinationMap] cp TRADE_CENTER jr nz, .notTradeCenter ld hl, TradeCenterPlayerWarp @@ -48,7 +48,7 @@ LoadSpecialWarpData: ld hl, ColosseumFriendWarp jr .copyWarpData .notColosseum - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug jr nz, .notNewGameWarp @@ -70,17 +70,17 @@ LoadSpecialWarpData: jr .done .notNewGameWarp ld a, [wLastMap] ; this value is overwritten before it's ever read - ld hl, wd732 - bit 4, [hl] ; dungeon warp + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] jr nz, .usedDungeonWarp - bit 6, [hl] ; blacked out - res 6, [hl] + bit BIT_ESCAPE_WARP, [hl] + res BIT_ESCAPE_WARP, [hl] jr z, .otherDestination ld a, [wLastBlackoutMap] jr .usedFlyWarp .usedDungeonWarp - ld hl, wd72d - res 4, [hl] + ld hl, wStatusFlags3 + res BIT_ON_DUNGEON_WARP, [hl] ld a, [wDungeonWarpDestinationMap] ld b, a ld [wCurMap], a diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index 816dea7f..f32b558a 100644 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -221,8 +221,8 @@ TrainerEngage: ld a, [wTrainerSpriteOffset] and a jr z, .noEngage - ld hl, wFlags_0xcd60 - set 0, [hl] + ld hl, wMiscFlags + set BIT_SEEN_BY_TRAINER, [hl] call EngageMapTrainer ld a, $ff .noEngage diff --git a/engine/play_time.asm b/engine/play_time.asm index dcba88c2..9b4491de 100644 --- a/engine/play_time.asm +++ b/engine/play_time.asm @@ -1,7 +1,7 @@ TrackPlayTime:: call CountDownIgnoreInputBitReset - ld a, [wd732] - bit 0, a + ld a, [wStatusFlags6] + bit BIT_GAME_TIMER_COUNTING, a ret z ld a, [wPlayTimeMaxed] and a @@ -48,12 +48,12 @@ CountDownIgnoreInputBitReset: ld [wIgnoreInputCounter], a and a ret nz - ld a, [wd730] - res 1, a - res 2, a - bit 5, a - res 5, a - ld [wd730], a + ld a, [wStatusFlags5] + res BIT_UNKNOWN_5_1, a + res BIT_UNKNOWN_5_2, a + bit BIT_DISABLE_JOYPAD, a + res BIT_DISABLE_JOYPAD, a + ld [wStatusFlags5], a ret z xor a ldh [hJoyPressed], a diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 6fb074ac..0b7fb96c 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -199,7 +199,7 @@ _AddPartyMon:: inc de ld [de], a push de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld d, a callfar CalcExperience pop de @@ -224,7 +224,7 @@ _AddPartyMon:: pop hl call AddPartyMon_WriteMovePP inc de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld [de], a inc de ld a, [wIsInBattle] @@ -500,7 +500,7 @@ _MoveMon:: call LoadMonData farcall CalcLevelFromExperience ld a, d - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 8684b761..59933762 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -93,8 +93,8 @@ PKMNLeaguePCText: db "LEAGUE@" LogOffPCText: db "LOG OFF@" BillsPC_:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wParentMenuItem], a inc a ; MONSTER_NAME @@ -102,8 +102,8 @@ BillsPC_:: call LoadHpBarAndStatusTilePatterns ld a, [wListScrollOffset] push af - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, BillsPCMenu ; accessing it directly ld a, SFX_TURN_ON_PC @@ -186,8 +186,8 @@ BillsPCMenu: jp z, BillsPCChangeBox ; change box ExitBillsPC: - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, .next ; accessing it directly call LoadTextBoxTilePatterns @@ -195,13 +195,13 @@ ExitBillsPC: call PlaySound call WaitForSoundToFinish .next - ld hl, wFlags_0xcd60 - res 5, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 pop af ld [wListScrollOffset], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret BillsPCDeposit: diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index d6b51ee5..fa6930c1 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -105,7 +105,7 @@ Evolution_PartyMonLoop: ; loop over party mons cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry .doEvolution - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, 1 ld [wEvolutionOccurred], a push hl @@ -340,7 +340,7 @@ LearnMoveFromLevelUp: and a ; have we reached the end of the learn set? jr z, .done ; if we've reached the end of the learn set, jump ld b, a ; level the move is learnt at - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b ; is the move learnt at the mon's current level? ld a, [hli] ; move ID jr nz, .learnSetLoop @@ -375,7 +375,7 @@ LearnMoveFromLevelUp: ld [wd11e], a ret -; writes the moves a mon has at level [wCurEnemyLVL] to [de] +; writes the moves a mon has at level [wCurEnemyLevel] to [de] ; move slots are being filled up sequentially and shifted if all slots are full WriteMonMoves: call GetPredefRegisters @@ -407,7 +407,7 @@ WriteMonMoves: and a jp z, .done ; end of list ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) ld a, [wLearningMovesFromDayCare] diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index ac03514a..d29c23fe 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -71,14 +71,14 @@ StatusScreen: ; mon is in a box or daycare ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 call CalcStats ; Recalculate stats .DontRecalculate - ld hl, wd72c - set 1, [hl] + ld hl, wStatusFlags2 + set BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $33 ldh [rNR50], a ; Reduce the volume call GBPalWhiteOutWithDelay3 @@ -430,8 +430,8 @@ StatusScreen2: call WaitForTextScrollButtonPress ; wait for button pop af ldh [hTileAnimations], a - ld hl, wd72c - res 1, [hl] + ld hl, wStatusFlags2 + res BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $77 ldh [rNR50], a call GBPalWhiteOut diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 6dd3b42d..649f634c 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -26,16 +26,16 @@ PromptUserToPlaySlots: call GBPalNormal ld a, $e4 ldh [rOBP0], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wSlotMachineAllowMatchesCounter], a ld hl, wStoppingWhichSlotMachineWheel ld bc, $14 call FillMemory call MainSlotMachineLoop - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] xor a ld [wSlotMachineAllowMatchesCounter], a call GBPalWhiteOutWithDelay3 diff --git a/home/audio.asm b/home/audio.asm index 1da6453c..c9d8b983 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -10,8 +10,8 @@ PlayDefaultMusicFadeOutCurrent:: ; Fade out the current music and then play the default music. ld c, 10 ld d, 0 - ld a, [wd72e] - bit 5, a ; has a battle just ended? + ld a, [wStatusFlags4] + bit BIT_BATTLE_OVER_OR_BLACKOUT, a jr z, PlayDefaultMusicCommon xor a ld [wLastMusicSoundID], a diff --git a/home/fade_audio.asm b/home/fade_audio.asm index 4ad2607d..b09d0036 100644 --- a/home/fade_audio.asm +++ b/home/fade_audio.asm @@ -2,8 +2,8 @@ FadeOutAudio:: ld a, [wAudioFadeOutControl] and a ; currently fading out audio? jr nz, .fadingOut - ld a, [wd72c] - bit 1, a + ld a, [wStatusFlags2] + bit BIT_NO_AUDIO_FADE_OUT, a ret nz ld a, $77 ldh [rNR50], a diff --git a/home/give.asm b/home/give.asm index f446cf36..128367ec 100644 --- a/home/give.asm +++ b/home/give.asm @@ -20,7 +20,7 @@ GivePokemon:: ld a, b ld [wcf91], a ld a, c - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a farjp _GivePokemon diff --git a/home/list_menu.asm b/home/list_menu.asm index 77e75012..1629b188 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -15,8 +15,8 @@ DisplayListMenuID:: ld a, BANK(DisplayBattleMenu) .bankswitch call BankswitchHome - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ld [wListCount], a @@ -164,8 +164,8 @@ DisplayListMenuIDLoop:: ld [wChosenMenuItem], a xor a ldh [hJoy7], a ; joypad state update flag - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] jp BankswitchBack .checkOtherKeys ; check B, SELECT, Up, and Down keys bit BIT_B_BUTTON, a @@ -325,8 +325,8 @@ ExitListMenu:: ld [wMenuWatchMovingOutOfBounds], a xor a ldh [hJoy7], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call BankswitchBack xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped diff --git a/home/map_objects.asm b/home/map_objects.asm index 27a69965..01dd8b6a 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -56,8 +56,8 @@ StartSimulatingJoypadStates:: xor a ld [wOverrideSimulatedJoypadStatesMask], a ld [wSpritePlayerStateData2MovementByte1], a - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret IsItemInBag:: diff --git a/home/move_mon.asm b/home/move_mon.asm index c766fbd5..45b10322 100644 --- a/home/move_mon.asm +++ b/home/move_mon.asm @@ -172,7 +172,7 @@ CalcStat:: ldh [hMultiplicand+1], a xor a ldh [hMultiplicand], a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ldh [hMultiplier], a call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level ldh a, [hMultiplicand] @@ -190,7 +190,7 @@ CalcStat:: cp $1 ld a, 5 ; + 5 for non-HP stat jr nz, .notHPStat - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a ldh a, [hMultiplicand+2] add b diff --git a/home/npc_movement.asm b/home/npc_movement.asm index 23a85427..96804fdf 100644 --- a/home/npc_movement.asm +++ b/home/npc_movement.asm @@ -4,17 +4,17 @@ IsPlayerCharacterBeingControlledByGame:: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz - ld a, [wd736] - bit 1, a ; currently stepping down from door bit + ld a, [wMovementFlags] + bit BIT_EXITING_DOOR, a ret nz - ld a, [wd730] - and $80 + ld a, [wStatusFlags5] + and 1 << BIT_SCRIPTED_MOVEMENT_STATE ret RunNPCMovementScript:: - ld hl, wd736 - bit 0, [hl] - res 0, [hl] + ld hl, wMovementFlags + bit BIT_STANDING_ON_DOOR, [hl] + res BIT_STANDING_ON_DOOR, [hl] jr nz, .playerStepOutFromDoor ld a, [wNPCMovementScriptPointerTableNum] and a @@ -54,7 +54,7 @@ DebugPressedOrHeldB:: ; dummy except in _DEBUG ; This is used to skip Trainer battles, the ; Safari Game step counter, and some NPC scripts. IF DEF(_DEBUG) - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a ret z ldh a, [hJoyHeld] diff --git a/home/overworld.asm b/home/overworld.asm index eda5428a..805a1b60 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -9,28 +9,28 @@ EnterMap:: ld [wJoyIgnore], a call LoadMapData farcall ClearVariablesOnEnterMap - ld hl, wd72c - bit 0, [hl] ; has the player already made 3 steps since the last battle? + ld hl, wStatusFlags2 + bit BIT_WILD_ENCOUNTER_COOLDOWN, [hl] jr z, .skipGivingThreeStepsOfNoRandomBattles ld a, 3 ; minimum number of steps between battles ld [wNumberOfNoRandomBattleStepsLeft], a .skipGivingThreeStepsOfNoRandomBattles - ld hl, wd72e - bit 5, [hl] ; did a battle happen immediately before this? - res 5, [hl] ; unset the "battle just happened" flag + ld hl, wStatusFlags4 + bit BIT_BATTLE_OVER_OR_BLACKOUT, [hl] + res BIT_BATTLE_OVER_OR_BLACKOUT, [hl] call z, ResetUsingStrengthOutOfBattleBit call nz, MapEntryAfterBattle - ld hl, wd732 + ld hl, wStatusFlags6 ld a, [hl] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jr z, .didNotEnterUsingFlyWarpOrDungeonWarp - res 3, [hl] + res BIT_FLY_WARP, [hl] farcall EnterMapAnim call UpdateSprites .didNotEnterUsingFlyWarpOrDungeonWarp farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road - ld hl, wd72d - res 5, [hl] + ld hl, wStatusFlags3 + res BIT_NO_NPC_FACE_PLAYER, [hl] call UpdateSprites ld hl, wCurrentMapScriptFlags set 5, [hl] @@ -43,8 +43,8 @@ OverworldLoop:: OverworldLoopLessDelay:: call DelayFrame call LoadGBPal - ld a, [wd736] - bit 6, a ; jumping down a ledge? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a call nz, HandleMidJump ld a, [wWalkCounter] and a @@ -54,18 +54,18 @@ OverworldLoopLessDelay:: ld a, [wSafariZoneGameOver] and a jp nz, WarpFound2 - ld hl, wd72d - bit 3, [hl] - res 3, [hl] + ld hl, wStatusFlags3 + bit BIT_WARP_FROM_CUR_SCRIPT, [hl] + res BIT_WARP_FROM_CUR_SCRIPT, [hl] jp nz, WarpFound2 - ld a, [wd732] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + ld a, [wStatusFlags6] + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jp nz, HandleFlyWarpOrDungeonWarp ld a, [wCurOpponent] and a jp nz, .newBattle - ld a, [wd730] - bit 7, a ; are we simulating button presses? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr z, .notSimulating ldh a, [hJoyHeld] jr .checkIfStartIsPressed @@ -82,8 +82,8 @@ OverworldLoopLessDelay:: bit BIT_A_BUTTON, a jp z, .checkIfDownButtonIsPressed ; if A is pressed - ld a, [wd730] - bit 2, a + ld a, [wStatusFlags5] + bit BIT_UNKNOWN_5_2, a jp nz, .noDirectionButtonsPressed call IsPlayerCharacterBeingControlledByGame jr nz, .checkForOpponent @@ -98,10 +98,10 @@ OverworldLoopLessDelay:: .displayDialogue predef GetTileAndCoordsInFrontOfPlayer call UpdateSprites - ld a, [wFlags_0xcd60] - bit 2, a + ld a, [wMiscFlags] + bit BIT_TURNING, a jr nz, .checkForOpponent - bit 0, a + bit BIT_SEEN_BY_TRAINER, a jr nz, .checkForOpponent lda_coord 8, 9 ld [wTilePlayerStandingOn], a ; checked when using Surf for forbidden tile pairs @@ -130,8 +130,8 @@ OverworldLoopLessDelay:: jp nz, .newBattle jp OverworldLoop .noDirectionButtonsPressed - ld hl, wFlags_0xcd60 - res 2, [hl] + ld hl, wMiscFlags + res BIT_TURNING, [hl] call UpdateSprites ld a, 1 ld [wCheckFor180DegreeTurn], a @@ -178,8 +178,8 @@ OverworldLoopLessDelay:: .handleDirectionButtonPress ld [wPlayerDirection], a ; new direction - ld a, [wd730] - bit 7, a ; are we simulating button presses? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr nz, .noDirectionChange ; ignore direction changes if we are ld a, [wCheckFor180DegreeTurn] and a @@ -222,8 +222,8 @@ OverworldLoopLessDelay:: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a .holdIntermediateDirectionLoop - ld hl, wFlags_0xcd60 - set 2, [hl] + ld hl, wMiscFlags + set BIT_TURNING, [hl] ld hl, wCheckFor180DegreeTurn dec [hl] jr nz, .holdIntermediateDirectionLoop @@ -245,8 +245,8 @@ OverworldLoopLessDelay:: jr nc, .noCollision ; collision occurred push hl - ld hl, wd736 - bit 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + bit BIT_STANDING_ON_WARP, [hl] pop hl jp z, OverworldLoop ; collision occurred while standing on a warp @@ -266,21 +266,21 @@ OverworldLoopLessDelay:: jr .moveAhead2 .moveAhead - ld a, [wd736] - bit 7, a + ld a, [wMovementFlags] + bit BIT_SPINNING, a jr z, .noSpinning farcall LoadSpinnerArrowTiles .noSpinning call UpdateSprites .moveAhead2 - ld hl, wFlags_0xcd60 - res 2, [hl] + ld hl, wMiscFlags + res BIT_TURNING, [hl] ld a, [wWalkBikeSurfState] dec a ; riding a bike? jr nz, .normalPlayerSpriteAdvancement - ld a, [wd736] - bit 6, a ; jumping a ledge? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a jr nz, .normalPlayerSpriteAdvancement call DoBikeSpeedup .normalPlayerSpriteAdvancement @@ -289,20 +289,20 @@ OverworldLoopLessDelay:: and a jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works) ; walking animation finished - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps ; step counting ld hl, wStepCounter dec [hl] - ld a, [wd72c] - bit 0, a + ld a, [wStatusFlags2] + bit BIT_WILD_ENCOUNTER_COOLDOWN, a jr z, .doneStepCounting ld hl, wNumberOfNoRandomBattleStepsLeft dec [hl] jr nz, .doneStepCounting - ld hl, wd72c - res 0, [hl] ; indicate that the player has stepped thrice since the last battle + ld hl, wStatusFlags2 + res BIT_WILD_ENCOUNTER_COOLDOWN, [hl] .doneStepCounting CheckEvent EVENT_IN_SAFARI_ZONE jr z, .notSafariZone @@ -320,14 +320,14 @@ OverworldLoopLessDelay:: jp nz, HandleBlackOut ; if all pokemon fainted .newBattle call NewBattle - ld hl, wd736 - res 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + res BIT_STANDING_ON_WARP, [hl] jp nc, CheckWarpsNoCollision ; check for warps if there was no battle .battleOccurred - ld hl, wd72d - res 6, [hl] - ld hl, wFlags_D733 - res 3, [hl] + ld hl, wStatusFlags3 + res BIT_TALKED_TO_TRAINER, [hl] + ld hl, wStatusFlags7 + res BIT_TRAINER_BATTLE, [hl] ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] @@ -338,8 +338,8 @@ OverworldLoopLessDelay:: jr nz, .notCinnabarGym SetEvent EVENT_2A7 .notCinnabarGym - ld hl, wd72e - set 5, [hl] + ld hl, wStatusFlags4 + set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, [wCurMap] cp OAKS_LAB jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab @@ -360,13 +360,13 @@ OverworldLoopLessDelay:: ; function to determine if there will be a battle and execute it (either a trainer battle or wild battle) ; sets carry if a battle occurred and unsets carry if not NewBattle:: - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a jr nz, .noBattle call IsPlayerCharacterBeingControlledByGame jr nz, .noBattle ; no battle if the player character is under the game's control - ld a, [wd72e] - bit 4, a + ld a, [wStatusFlags4] + bit BIT_NO_BATTLES, a jr nz, .noBattle farjp InitBattle .noBattle @@ -410,8 +410,8 @@ CheckWarpsNoCollisionLoop:: ; if a match was found push hl push bc - ld hl, wd736 - set 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + set BIT_STANDING_ON_WARP, [hl] farcall IsPlayerStandingOnDoorTileOrWarpTile pop bc pop hl @@ -423,8 +423,8 @@ CheckWarpsNoCollisionLoop:: pop hl jr nc, CheckWarpsNoCollisionRetry2 ; if the extra check passed - ld a, [wFlags_D733] - bit 2, a + ld a, [wStatusFlags7] + bit BIT_FORCED_WARP, a jr nz, WarpFound1 push de push bc @@ -516,16 +516,16 @@ WarpFound2:: dec a ; is the player on a warp pad? jr nz, .notWarpPad ; if the player is on a warp pad - ld hl, wd732 - set 3, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] call LeaveMapAnim jr .skipMapChangeSound .notWarpPad call PlayMapChangeSound .skipMapChangeSound - ld hl, wd736 - res 0, [hl] - res 1, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] jr .done .goBackOutside ld a, [wLastMap] @@ -534,8 +534,8 @@ WarpFound2:: xor a ld [wMapPalOffset], a .done - ld hl, wd736 - set 0, [hl] ; have the player's sprite step out from the door (if there is one) + ld hl, wMovementFlags + set BIT_STANDING_ON_DOOR, [hl] ; have the player's sprite step out from the door (if there is one) call IgnoreInputForHalfSecond jp EnterMap @@ -756,12 +756,11 @@ MapEntryAfterBattle:: HandleBlackOut:: ; For when all the player's pokemon faint. ; Does not print the "blacked out" message. - call GBFadeOutToBlack ld a, $08 call StopMusic - ld hl, wd72e - res 5, [hl] + ld hl, wStatusFlags4 + res BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap) ldh [hLoadedROMBank], a ld [MBC1RomBank], a @@ -789,9 +788,9 @@ HandleFlyWarpOrDungeonWarp:: ld [wWalkBikeSurfState], a ld [wIsInBattle], a ld [wMapPalOffset], a - ld hl, wd732 - set 2, [hl] ; fly warp or dungeon warp - res 5, [hl] ; forced to ride bike + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_ALWAYS_ON_BIKE, [hl] call LeaveMapAnim ld a, BANK(PrepareForSpecialWarp) ldh [hLoadedROMBank], a @@ -1219,8 +1218,8 @@ IsSpriteInFrontOfPlayer2:: ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) ; sets the carry flag if there is a collision, and unsets it if there isn't a collision CollisionCheckOnLand:: - ld a, [wd736] - bit 6, a ; is the player jumping? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a jr nz, .noCollision ; if not jumping a ledge ld a, [wSimulatedJoypadStatesIndex] @@ -1291,8 +1290,8 @@ CheckForJumpingAndTilePairCollisions:: pop de pop hl and a - ld a, [wd736] - bit 6, a ; is the player jumping? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ret nz ; if not jumping @@ -1826,8 +1825,8 @@ JoypadOverworld:: ld [wSpritePlayerStateData1XStepVector], a call RunMapScript call Joypad - ld a, [wFlags_D733] - bit 3, a ; check if a trainer wants a challenge + ld a, [wStatusFlags7] + bit BIT_TRAINER_BATTLE, a jr nz, .notForcedDownwards ld a, [wCurMap] cp ROUTE_17 ; Cycling Road @@ -1838,8 +1837,8 @@ JoypadOverworld:: ld a, D_DOWN ldh [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press .notForcedDownwards - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a ret z ; if simulating button presses ldh a, [hJoyHeld] @@ -1874,12 +1873,12 @@ JoypadOverworld:: ld [wSimulatedJoypadStatesEnd], a ld [wJoyIgnore], a ldh [hJoyHeld], a - ld hl, wd736 + ld hl, wMovementFlags ld a, [hl] - and $f8 + and (1 << BIT_SPINNING) | (1 << BIT_LEDGE_OR_FISHING) | (1 << 5) | (1 << 4) | (1 << 3) ld [hl], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret ; function to check the tile ahead to determine if the character should get on land or keep surfing @@ -1892,8 +1891,8 @@ JoypadOverworld:: ; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it ; is considered impassable and it is detected as a collision. CollisionCheckOnWater:: - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jp nz, .noCollision ; return and clear carry if button presses are being simulated ld a, [wPlayerDirection] ; the direction that the player is trying to go in ld d, a @@ -1955,8 +1954,8 @@ RunMapScript:: push de push bc farcall TryPushingBoulder - ld a, [wFlags_0xcd60] - bit 1, a ; play boulder dust animation + ld a, [wMiscFlags] + bit BIT_BOULDER_DUST, a jr z, .afterBoulderEffect farcall DoBoulderDustAnimation .afterBoulderEffect @@ -2137,8 +2136,8 @@ LoadMapHeader:: dec c jr nz, .signLoop .loadSpriteData - ld a, [wd72e] - bit 5, a ; did a battle happen immediately before this? + ld a, [wStatusFlags4] + bit BIT_BATTLE_OVER_OR_BLACKOUT, a jp nz, .finishUp ; if so, skip this because battles don't destroy this data ld a, [hli] ld [wNumSprites], a ; save the number of sprites @@ -2343,11 +2342,11 @@ LoadMapData:: ld b, SET_PAL_OVERWORLD call RunPaletteCommand call LoadPlayerSpriteGraphics - ld a, [wd732] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + ld a, [wStatusFlags6] + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jr nz, .restoreRomBank - ld a, [wFlags_D733] - bit 1, a + ld a, [wStatusFlags7] + bit BIT_NO_MAP_MUSIC, a jr nz, .restoreRomBank call UpdateMusic6Times call PlayDefaultMusicFadeOutCurrent @@ -2381,15 +2380,15 @@ SwitchToMapRomBank:: IgnoreInputForHalfSecond: ld a, 30 ld [wIgnoreInputCounter], a - ld hl, wd730 + ld hl, wStatusFlags5 ld a, [hl] - or %00100110 + or (1 << BIT_DISABLE_JOYPAD) | (1 << BIT_UNKNOWN_5_2) | (1 << BIT_UNKNOWN_5_1) ld [hl], a ; set ignore input bit ret ResetUsingStrengthOutOfBattleBit: - ld hl, wd728 - res 0, [hl] + ld hl, wStatusFlags1 + res BIT_STRENGTH_ACTIVE, [hl] ret ForceBikeOrSurf:: diff --git a/home/pathfinding.asm b/home/pathfinding.asm index 766e7b37..12128f68 100644 --- a/home/pathfinding.asm +++ b/home/pathfinding.asm @@ -32,8 +32,8 @@ MoveSprite_:: ld [wNPCNumScriptedSteps], a ; number of steps taken pop bc - ld hl, wd730 - set 0, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_NPC_MOVEMENT, [hl] pop hl xor a ld [wOverrideSimulatedJoypadStatesMask], a diff --git a/home/pokemon.asm b/home/pokemon.asm index 3e63de35..131fbd85 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -198,8 +198,8 @@ PartyMenuInit:: ld a, 1 ; hardcoded bank call BankswitchHome call LoadHpBarAndStatusTilePatterns - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ld [wMenuWatchMovingOutOfBounds], a @@ -245,8 +245,8 @@ HandlePartyMenuInput:: ld [wPartyMenuAnimMonEnabled], a ld a, [wCurrentMenuItem] ld [wPartyAndBillsPCSavedMenuItem], a - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wMenuItemToSwap] and a jp nz, .swappingPokemon diff --git a/home/print_text.asm b/home/print_text.asm index 962ae519..65d418a3 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -1,18 +1,18 @@ ; This function is used to wait a short period after printing a letter to the ; screen unless the player presses the A/B button or the delay is turned off -; through the [wd730] or [wLetterPrintingDelayFlags] flags. +; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags. PrintLetterDelay:: - ld a, [wd730] - bit 6, a + ld a, [wStatusFlags5] + bit BIT_NO_TEXT_DELAY, a ret nz ld a, [wLetterPrintingDelayFlags] - bit 1, a + bit BIT_TEXT_DELAY, a ret z push hl push de push bc ld a, [wLetterPrintingDelayFlags] - bit 0, a + bit BIT_FAST_TEXT_DELAY, a jr z, .waitOneFrame ld a, [wOptions] and $f diff --git a/home/reload_tiles.asm b/home/reload_tiles.asm index 6228395c..76110dbe 100644 --- a/home/reload_tiles.asm +++ b/home/reload_tiles.asm @@ -30,8 +30,8 @@ ReloadTilesetTilePatterns:: ; shows the town map and lets the player choose a destination to fly to ChooseFlyDestination:: - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] farjp LoadTownMap_Fly ; causes the text box to close without waiting for a button press after displaying text diff --git a/home/text.asm b/home/text.asm index 9462c749..e815fbf7 100644 --- a/home/text.asm +++ b/home/text.asm @@ -315,7 +315,7 @@ ProtectedDelay3:: TextCommandProcessor:: ld a, [wLetterPrintingDelayFlags] push af - set 1, a + set BIT_TEXT_DELAY, a ld e, a ldh a, [hClearLetterPrintingDelayFlags] xor e diff --git a/home/text_script.asm b/home/text_script.asm index ceae1a0a..5c90a981 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -128,8 +128,8 @@ CloseTextDisplay:: call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded res 0, [hl] - ld a, [wd732] - bit 3, a ; used fly warp + ld a, [wStatusFlags6] + bit BIT_FLY_WARP, a call z, LoadPlayerSpriteGraphics call LoadCurrentMapView pop af @@ -196,9 +196,9 @@ PokemonFaintedText:: DisplayPlayerBlackedOutText:: ld hl, PlayerBlackedOutText call PrintText - ld a, [wd732] - res 5, a ; reset forced to use bike bit - ld [wd732], a + ld a, [wStatusFlags6] + res BIT_ALWAYS_ON_BIKE, a + ld [wStatusFlags6], a jp HoldTextDisplayOpen PlayerBlackedOutText:: diff --git a/home/trainers.asm b/home/trainers.asm index 011c1d6d..0038d48c 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -16,9 +16,9 @@ ExecuteCurMapScriptInTable:: pop hl pop af push hl - ld hl, wFlags_D733 - bit 4, [hl] - res 4, [hl] + ld hl, wStatusFlags7 + bit BIT_USE_CUR_MAP_SCRIPT, [hl] + res BIT_USE_CUR_MAP_SCRIPT, [hl] jr z, .useProvidedIndex ; test if map script index was overridden manually ld a, [wCurMapScript] .useProvidedIndex @@ -114,10 +114,10 @@ TalkToTrainer:: call ReadTrainerHeaderInfo ; read end battle text pop de call SaveEndBattleTextPointers - ld hl, wFlags_D733 - set 4, [hl] ; activate map script index override (index is set below) - ld hl, wFlags_0xcd60 - bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) + ld hl, wStatusFlags7 + set BIT_USE_CUR_MAP_SCRIPT, [hl] ; activate map script index override (index is set below) + ld hl, wMiscFlags + bit BIT_SEEN_BY_TRAINER, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) ret nz ; if the player talked to the trainer of his own volition call EngageMapTrainer @@ -143,8 +143,8 @@ ENDC ld [wTrainerHeaderFlagBit], a ret .trainerEngaging - ld hl, wFlags_D733 - set 3, [hl] + ld hl, wStatusFlags7 + set BIT_TRAINER_BATTLE, [hl] ld [wEmotionBubbleSpriteIndex], a xor a ; EXCLAMATION_BUBBLE ld [wWhichEmotionBubble], a @@ -160,8 +160,8 @@ ENDC ; display the before battle text after the enemy trainer has walked up to the player's sprite DisplayEnemyTrainerTextAndStartBattle:: - ld a, [wd730] - and $1 + ld a, [wStatusFlags5] + and 1 << BIT_SCRIPTED_NPC_MOVEMENT ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite ld [wJoyIgnore], a ld a, [wSpriteIndex] @@ -173,11 +173,11 @@ StartTrainerBattle:: xor a ld [wJoyIgnore], a call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] - ld hl, wd72e - set 1, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] ld hl, wCurMapScript inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) ret @@ -186,10 +186,10 @@ EndTrainerBattle:: ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] - ld hl, wd72d - res 7, [hl] - ld hl, wFlags_0xcd60 - res 0, [hl] ; player is no longer engaged by any trainer + ld hl, wStatusFlags3 + res BIT_PRINT_END_BATTLE_TEXT, [hl] + ld hl, wMiscFlags + res BIT_SEEN_BY_TRAINER, [hl] ; player is no longer engaged by any trainer ld a, [wIsInBattle] cp $ff jp z, ResetButtonPressedAndMapScript @@ -211,9 +211,9 @@ EndTrainerBattle:: ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite - ld hl, wd730 - bit 4, [hl] - res 4, [hl] + ld hl, wStatusFlags5 + bit BIT_UNKNOWN_5_4, [hl] + res BIT_UNKNOWN_5_4, [hl] ret nz ResetButtonPressedAndMapScript:: @@ -240,7 +240,7 @@ InitBattleEnemyParameters:: ld [wTrainerNo], a ret .noTrainer - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ret GetSpritePosition1:: @@ -340,9 +340,9 @@ EngageMapTrainer:: PrintEndBattleText:: push hl - ld hl, wd72d - bit 7, [hl] - res 7, [hl] + ld hl, wStatusFlags3 + bit BIT_PRINT_END_BATTLE_TEXT, [hl] + res BIT_PRINT_END_BATTLE_TEXT, [hl] pop hl ret z ldh a, [hLoadedROMBank] @@ -389,8 +389,8 @@ TrainerEndBattleText:: ; engaged with another trainer ; XXX unused? CheckIfAlreadyEngaged:: - ld a, [wFlags_0xcd60] - bit 0, a + ld a, [wMiscFlags] + bit BIT_SEEN_BY_TRAINER, a ret nz call EngageMapTrainer xor a diff --git a/home/window.asm b/home/window.asm index 0abe366d..01b52d41 100644 --- a/home/window.asm +++ b/home/window.asm @@ -95,8 +95,8 @@ HandleMenuInput_:: jr z, .skipPlayingSound .AButtonOrBButtonPressed push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] + ld hl, wMiscFlags + bit BIT_NO_MENU_BUTTON_SOUND, [hl] pop hl jr nz, .skipPlayingSound ld a, SFX_PRESS_AB diff --git a/includes.asm b/includes.asm index 6253859b..8808e1d0 100644 --- a/includes.asm +++ b/includes.asm @@ -16,6 +16,7 @@ INCLUDE "macros/scripts/text.asm" INCLUDE "constants/charmap.asm" INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/oam_constants.asm" +INCLUDE "constants/ram_constants.asm" INCLUDE "constants/misc_constants.asm" INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/input_constants.asm" diff --git a/ram/wram.asm b/ram/wram.asm index 12a73403..4ff730dd 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -399,8 +399,8 @@ NEXTU wSimulatedJoypadStatesEnd:: NEXTU -wBoostExpByExpAll:: -wUnusedCC5B:: db +wUnusedFlag:: +wBoostExpByExpAll:: db ds 59 @@ -850,12 +850,7 @@ wLeftGBMonSpecies:: db ; in the trade animation, the mon that leaves the right gameboy wRightGBMonSpecies:: db -; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously) -; bit 1: boulder dust animation (from using Strength) pending -; bit 3: using generic PC -; bit 5: don't play sound when A or B is pressed in menu -; bit 6: tried pushing against boulder once (you need to push twice before it will move) -wFlags_0xcd60:: db +wMiscFlags:: db ds 9 @@ -1243,38 +1238,15 @@ wMoveMissed:: db ; always 0 wPlayerStatsToDouble:: db - ; always 0 wPlayerStatsToHalve:: db -; bit 0 - bide -; bit 1 - thrash / petal dance -; bit 2 - attacking multiple times (e.g. double kick) -; bit 3 - flinch -; bit 4 - charging up for attack -; bit 5 - using multi-turn move (e.g. wrap) -; bit 6 - invulnerable to normal attack (using fly/dig) -; bit 7 - confusion wPlayerBattleStatus1:: db - -; bit 0 - X Accuracy effect -; bit 1 - protected by "mist" -; bit 2 - focus energy effect -; bit 4 - has a substitute -; bit 5 - need to recharge -; bit 6 - rage -; bit 7 - leech seeded wPlayerBattleStatus2:: db - -; bit 0 - toxic -; bit 1 - light screen -; bit 2 - reflect -; bit 3 - transformed wPlayerBattleStatus3:: db ; always 0 wEnemyStatsToDouble:: db - ; always 0 wEnemyStatsToHalve:: db @@ -1602,7 +1574,7 @@ wTextBoxID:: db wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value -wCurEnemyLVL:: db +wCurEnemyLevel:: db ; pointer to list of items terminated by $FF wItemListPointer:: dw @@ -1648,7 +1620,7 @@ wSavedSpriteMapX:: db wWhichPrize:: db ; counts downward each frame -; when it hits 0, bit 5 (ignore input bit) of wd730 is reset +; when it hits 0, BIT_DISABLE_JOYPAD of wStatusFlags5 is reset wIgnoreInputCounter:: db ; counts down once every step @@ -1743,26 +1715,12 @@ wPlayerMoney:: ds 3 ; BCD wRivalName:: ds NAME_LENGTH -; bit 7 = battle animation -; 0: On -; 1: Off -; bit 6 = battle style -; 0: Shift -; 1: Set -; bits 0-3 = text speed (number of frames to delay after printing a letter) -; 1: Fast -; 3: Medium -; 5: Slow wOptions:: db wObtainedBadges:: flag_array NUM_BADGES ds 1 -; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if -; the delay has been disabled entirely through bit 1 of this variable -; or bit 6 of wd730. -; bit 1: If 0, no delay. wLetterPrintingDelayFlags:: db wPlayerID:: dw @@ -2097,88 +2055,22 @@ wUnusedCardKeyGateID:: db ds 8 -; bit 0: using Strength outside of battle -; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result -; bit 3: received Old Rod -; bit 4: received Good Rod -; bit 5: received Super Rod -; bit 6: gave one of the Saffron guards a drink -; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key -wd728:: db - +wStatusFlags1:: db ds 1 - -; redundant because it matches wObtainedBadges -; used to determine whether to show name on statue and in two NPC text scripts -wBeatGymFlags:: db - +wBeatGymFlags:: db ; redundant because it matches wObtainedBadges ds 1 - -; bit 0: if not set, the 3 minimum steps between random battles have passed -; bit 1: prevent audio fade out -wd72c:: db - -; This variable is used for temporary flags and as the destination map when -; warping to the Trade Center or Colosseum. -; bit 0: sprite facing directions have been initialised in the Trade Center -; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower) -; bit 4: on a dungeon warp -; bit 5: don't make NPCs face the player when spoken to -; Bits 6 and 7 are set by scripts when starting major battles in the storyline, -; but they do not appear to affect anything. Bit 6 is reset after all battles -; and bit 7 is reset after trainer battles (but it's only set before trainer -; battles anyway). -wd72d:: db - -; bit 0: the player has received Lapras in the Silph Co. building -; bit 1: set in various places, but doesn't appear to have an effect -; bit 2: the player has healed pokemon at a pokemon center at least once -; bit 3: the player has a received a pokemon from Prof. Oak -; bit 4: disable battles -; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison -; bit 6: using the link feature -; bit 7: set if scripted NPC movement has been initialised -wd72e:: db - +wStatusFlags2:: db +wCableClubDestinationMap:: +wStatusFlags3:: db +wStatusFlags4:: db ds 1 - -; bit 0: NPC sprite being moved by script -; bit 5: ignore joypad input -; bit 6: print text with no delay between each letter -; bit 7: set if joypad states are being simulated in the overworld or an NPC's movement is being scripted -wd730:: db - +wStatusFlags5:: db ds 1 - -; bit 0: play time being counted -; bit 1: debug mode (unused and incomplete in non-debug builds) -; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set) -; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp" -; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp" -; bit 5: currently being forced to ride bike (cycling road) -; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house) -wd732:: db - -; bit 0: running a test battle (unused in non-debug builds) -; bit 1: prevent music from changing when entering new map -; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands) -; bit 3: trainer wants to battle -; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers) -; bit 7: used fly out of battle -wFlags_D733:: db - -; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby -; the game uses this to tell when Elite 4 events need to be reset -wBeatLorelei:: db - +wStatusFlags6:: db +wStatusFlags7:: db +wElite4Flags:: db ds 1 - -; bit 0: check if the player is standing on a door and make him walk down a step if so -; bit 1: the player is currently stepping down from a door -; bit 2: standing on a warp -; bit 6: jumping down a ledge / fishing animation -; bit 7: player sprite spinning due to spin tiles (Rocket hideout / Viridian Gym) -wd736:: db +wMovementFlags:: db wCompletedInGameTradeFlags:: dw diff --git a/scripts/BikeShop.asm b/scripts/BikeShop.asm index 3321a23e..d8b82386 100644 --- a/scripts/BikeShop.asm +++ b/scripts/BikeShop.asm @@ -48,8 +48,8 @@ BikeShopClerkText: ld [wTopMenuItemY], a ld a, $1 ld [wTopMenuItemX], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 4 ld c, 15 @@ -66,8 +66,8 @@ BikeShopClerkText: call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .cancel - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wCurrentMenuItem] and a jr nz, .cancel diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index b6257d4f..cf87ea64 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -46,8 +46,8 @@ BillsHousePokemonWalkToMachineScript: db -1 ; end BillsHousePokemonEntersMachineScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_BILL_POKEMON ld [wMissableObjectIndex], a @@ -97,8 +97,8 @@ BillExitMachineMovement: db -1 ; end BillsHouseCleanupScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index 0195d0b9..ea1f5053 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -119,9 +119,9 @@ CeladonGymErikaText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedRainbowBadgeText ld de, .ReceivedRainbowBadgeText call SaveEndBattleTextPointers diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index 1edc39fa..73c12805 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -41,8 +41,8 @@ CeladonMartRoofDrinkList: db 0 ; end CeladonMartRoofScript_GiveDrinkToGirl: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText call PrintText xor a @@ -68,8 +68,8 @@ CeladonMartRoofScript_GiveDrinkToGirl: call TextBoxBorder call UpdateSprites call CeladonMartRoofScript_PrintDrinksInBag - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a ret nz diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 439c31ad..2ff5f3be 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -125,17 +125,17 @@ CeruleanCityFaceRivalScript: jp SetSpriteFacingDirectionAndDelay ; face object CeruleanCityRivalBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a ld a, TEXT_CERULEANCITY_RIVAL ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, CeruleanCityRivalDefeatedText ld de, CeruleanCityRivalVictoryText call SaveEndBattleTextPointers @@ -219,8 +219,8 @@ CeruleanCityMovement4: db -1 ; end CeruleanCityRivalCleanupScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_CERULEAN_RIVAL ld [wMissableObjectIndex], a @@ -289,9 +289,9 @@ CeruleanCityRocketText: jr nz, .beatRocketThief ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .IGiveUpText ld de, .IGiveUpText call SaveEndBattleTextPointers diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 8e6694ea..7795b70b 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -105,9 +105,9 @@ CeruleanGymMistyText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, CeruleanGymMistyReceivedCascadeBadgeText ld de, CeruleanGymMistyReceivedCascadeBadgeText call SaveEndBattleTextPointers diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index c6c7c1dd..f3c9818d 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -54,14 +54,14 @@ ChampionsRoomRivalReadyToBattleScript: xor a ld [wJoyIgnore], a ld hl, wOptions - res 7, [hl] ; Turn on battle animations to make the battle feel more epic. + res BIT_BATTLE_ANIMATION, [hl] ld a, TEXT_CHAMPIONSROOM_RIVAL ldh [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, RivalDefeatedText ld de, RivalVictoryText call SaveEndBattleTextPointers @@ -136,8 +136,8 @@ OakEntranceAfterVictoryMovement: db -1 ; end ChampionsRoomOakCongratulatesPlayerScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, PLAYER_DIR_LEFT ld [wPlayerMovingDirection], a @@ -194,8 +194,8 @@ OakExitChampionsRoomMovement: db -1 ; end ChampionsRoomOakExitsScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_CHAMPIONS_ROOM_OAK ld [wMissableObjectIndex], a diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index 17ac1ac1..a7608a4f 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -81,8 +81,8 @@ MovementNpcToLeft: db -1 ; end CinnabarGymGetOpponentTextScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -194,9 +194,9 @@ CinnabarGymStartBattleScript: ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld a, [wSpriteIndex] cp CINNABARGYM_BLAINE jr z, .blaine diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index d434f681..75427049 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -111,9 +111,9 @@ FightingDojoKarateMasterText: jp nz, .defeated_master ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers diff --git a/scripts/FuchsiaGoodRodHouse.asm b/scripts/FuchsiaGoodRodHouse.asm index 4bfd49ae..ee55938b 100644 --- a/scripts/FuchsiaGoodRodHouse.asm +++ b/scripts/FuchsiaGoodRodHouse.asm @@ -7,8 +7,8 @@ FuchsiaGoodRodHouse_TextPointers: FuchsiaGoodRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 4, a ; got good rod? + ld a, [wStatusFlags1] + bit BIT_GOT_GOOD_ROD, a jr nz, .got_item ld hl, .Text call PrintText @@ -19,8 +19,8 @@ FuchsiaGoodRodHouseFishingGuruText: lb bc, GOOD_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 4, [hl] ; got good rod + ld hl, wStatusFlags1 + set BIT_GOT_GOOD_ROD, [hl] ld hl, .ReceivedGoodRodText jr .done .bag_full diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 1c0f02df..d2f0ee40 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -119,9 +119,9 @@ FuchsiaGymKogaText: .beforeBeat ld hl, .BeforeBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedSoulBadgeText ld de, .ReceivedSoulBadgeText call SaveEndBattleTextPointers diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 68cdc333..b2ef1206 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -102,8 +102,8 @@ GameCornerMovement_Rocket_WalkDirect: db -1 ; end GameCornerRocketExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -422,9 +422,9 @@ GameCornerRocketText: text_asm ld hl, .ImGuardingThisPosterText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .BattleEndText ld de, .BattleEndText call SaveEndBattleTextPointers @@ -482,8 +482,8 @@ GameCornerOopsForgotCoinCaseText: text_end GameCornerDrawCoinBox: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 11, 0 ld b, 5 ld c, 7 @@ -513,8 +513,8 @@ GameCornerDrawCoinBox: ld de, wPlayerCoins ld c, $82 call PrintBCDNumber - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret GameCornerMoneyText: diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index d5102830..46298813 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -29,10 +29,11 @@ HallOfFameResetEventsAndSaveScript: predef HallOfFamePC pop af ld [wLetterPrintingDelayFlags], a - ld hl, wFlags_D733 - res 1, [hl] + ld hl, wStatusFlags7 + res BIT_NO_MAP_MUSIC, [hl] + assert wStatusFlags7 + 1 == wElite4Flags inc hl - set BIT_TEST_BATTLE, [hl] ; debug, unused? + set BIT_UNUSED_BEAT_ELITE_4, [hl] ; debug, unused? xor a ; SCRIPT_*_DEFAULT ld hl, wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript diff --git a/scripts/IndigoPlateauLobby.asm b/scripts/IndigoPlateauLobby.asm index 8f69fd58..fd8ecf3c 100644 --- a/scripts/IndigoPlateauLobby.asm +++ b/scripts/IndigoPlateauLobby.asm @@ -6,11 +6,11 @@ IndigoPlateauLobby_Script: res 6, [hl] ret z ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH - ld hl, wBeatLorelei - bit 1, [hl] - res 1, [hl] + ; Reset Elite Four events if the player started challenging them before + ld hl, wElite4Flags + bit BIT_STARTED_ELITE_4, [hl] + res BIT_STARTED_ELITE_4, [hl] ret z - ; Elite 4 events ResetEventRange INDIGO_PLATEAU_EVENTS_START, EVENT_LANCES_ROOM_LOCK_DOOR ret diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index c1cc2adb..52d79b15 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -14,8 +14,8 @@ LoreleiShowOrHideExitBlock: bit 5, [hl] res 5, [hl] ret z - ld hl, wBeatLorelei - set 1, [hl] + ld hl, wElite4Flags + set BIT_STARTED_ELITE_4, [hl] CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom ld a, $5 diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 89871e35..3afd14c8 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -10,12 +10,12 @@ MtMoonB2F_Script: ld hl, MtMoonB2FFossilAreaCoords call ArePlayerCoordsInArray jr nc, .enable_battles - ld hl, wd72e - set 4, [hl] + ld hl, wStatusFlags4 + set BIT_NO_BATTLES, [hl] ret .enable_battles - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ret MtMoonB2FFossilAreaCoords: @@ -129,8 +129,8 @@ MtMoon3FSuperNerdMoveUpMovementData: db -1 ; end MtMoonB2FSuperNerdTakesOtherFossilScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -193,9 +193,9 @@ MtMoonB2FSuperNerdText: .beat_super_nerd ld hl, MtMoonB2FSuperNerdTheyreBothMineText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, MtMoonB2FSuperNerdOkIllShareText ld de, MtMoonB2FSuperNerdOkIllShareText call SaveEndBattleTextPointers diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 9173dd94..dc9e56df 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -40,8 +40,8 @@ OaksLabDefaultScript: ld a, HS_OAKS_LAB_OAK_2 ld [wMissableObjectIndex], a predef ShowObject - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ld a, SCRIPT_OAKSLAB_OAK_ENTERS_LAB ld [wOaksLabCurScript], a @@ -64,8 +64,8 @@ OakEntryMovement: db -1 ; end OaksLabHideShowOaksScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_OAKS_LAB_OAK_2 ld [wMissableObjectIndex], a @@ -117,8 +117,8 @@ OaksLabFollowedOakScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay call UpdateSprites - ld hl, wFlags_D733 - res 1, [hl] + ld hl, wStatusFlags7 + res BIT_NO_MAP_MUSIC, [hl] call PlayDefaultMusic ld a, SCRIPT_OAKSLAB_OAK_CHOOSE_MON_SPEECH @@ -290,8 +290,8 @@ OaksLabChoseStarterScript: ret OaksLabRivalChoosesStarterScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -377,8 +377,8 @@ OaksLabRivalChallengesPlayerScript: ret OaksLabRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ; define which team rival uses, and fight it @@ -404,9 +404,9 @@ OaksLabRivalStartBattleScript: ld hl, OaksLabRivalIPickedTheWrongPokemonText ld de, OaksLabRivalAmIGreatOrWhatText call SaveEndBattleTextPointers - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] xor a ld [wJoyIgnore], a ld a, PLAYER_DIR_UP @@ -472,8 +472,8 @@ OaksLabRivalStartsExitScript: db -1 ; end OaksLabPlayerWatchRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a jr nz, .checkRivalPosition ld a, HS_OAKS_LAB_RIVAL ld [wMissableObjectIndex], a @@ -552,8 +552,8 @@ OaksLabRivalFaceUpOakFaceDownScript: jp SetSpriteFacingDirectionAndDelay OaksLabOakGivesPokedexScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call EnableAutoTextBoxDrawing call PlayDefaultMusic @@ -626,8 +626,8 @@ OaksLabOakGivesPokedexScript: ret OaksLabRivalLeavesWithPokedexScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call PlayDefaultMusic ld a, HS_OAKS_LAB_RIVAL @@ -853,11 +853,11 @@ OaksLabShowPokeBallPokemonScript: ldh [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld [hl], SPRITE_FACING_RIGHT - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] predef StarterDex - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call ReloadMapData ld c, 10 call DelayFrames @@ -925,12 +925,12 @@ OaksLabMonChoiceMenu: xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ld a, 5 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wcf91] ld [wd11e], a call AddPartyMon - ld hl, wd72e - set 3, [hl] + ld hl, wStatusFlags4 + set BIT_GOT_STARTER, [hl] ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, SCRIPT_OAKSLAB_CHOSE_STARTER_SCRIPT @@ -991,8 +991,8 @@ OaksLabOak1Text: jr nz, .mon_around_the_world CheckEventReuseA EVENT_BATTLED_RIVAL_IN_OAKS_LAB jr nz, .check_got_parcel - ld a, [wd72e] - bit 3, a + ld a, [wStatusFlags4] + bit BIT_GOT_STARTER, a jr nz, .already_got_pokemon ld hl, .WhichPokemonDoYouWantText call PrintText diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 4d5bebf0..a787fcc4 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -91,8 +91,8 @@ PalletTownOakWalksToPlayerScript: ret PalletTownOakNotSafeComeWithMeScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ; ld a, SPRITE_FACING_DOWN ld [wSpritePlayerStateData1FacingDirection], a diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index d1f77b76..07c143d3 100644 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -57,8 +57,8 @@ PewterCitySuperNerd1ShowsPlayerMuseumScript: ldh [hSpriteImageIndex], a call SetSpriteImageIndexAfterSettingFacingDirection call PlayDefaultMusic - ld hl, wFlags_0xcd60 - set 4, [hl] + ld hl, wMiscFlags + set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_SUPER_NERD1_ITS_RIGHT_HERE ldh [hSpriteIndexOrTextID], a call DisplayTextID @@ -89,8 +89,8 @@ MovementData_PewterMuseumGuyExit: db -1 ; end PewterCityHideSuperNerd1Script: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_MUSEUM_GUY ld [wMissableObjectIndex], a @@ -125,8 +125,8 @@ PewterCityYoungsterShowsPlayerGymScript: ldh [hSpriteImageIndex], a call SetSpriteImageIndexAfterSettingFacingDirection call PlayDefaultMusic - ld hl, wFlags_0xcd60 - set 4, [hl] + ld hl, wMiscFlags + set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_YOUNGSTER_GO_TAKE_ON_BROCK ldh [hSpriteIndexOrTextID], a call DisplayTextID @@ -158,8 +158,8 @@ MovementData_PewterGymGuyExit: db -1 ; end PewterCityHideYoungsterScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_GYM_GUY ld [wMissableObjectIndex], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index e653fc88..b5771026 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -111,9 +111,9 @@ PewterGymBrockText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, PewterGymBrockReceivedBoulderBadgeText ld de, PewterGymBrockReceivedBoulderBadgeText call SaveEndBattleTextPointers diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index f64357d5..fab06bbd 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -60,17 +60,17 @@ PokemonMansion3FDefaultScript: .isPlayerFallingDownHole: xor a ld [wWhichDungeonWarp], a - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a ret nz call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] ld [wWhichDungeonWarp], a - ld hl, wd72d - set 4, [hl] - ld hl, wd732 - set 4, [hl] + ld hl, wStatusFlags3 + set BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + set BIT_DUNGEON_WARP, [hl] ret Mansion3Script_Switches:: diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index e90fcdd0..00f83fc5 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -113,8 +113,8 @@ PokemonTower2FRivalDownThenRightMovement: db -1 ; end PokemonTower2FRivalExitsScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_POKEMON_TOWER_2F_RIVAL ld [wMissableObjectIndex], a @@ -142,9 +142,9 @@ PokemonTower2FRivalText: .do_battle ld hl, .WhatBringsYouHereText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .VictoryText call SaveEndBattleTextPointers diff --git a/scripts/PokemonTower5F.asm b/scripts/PokemonTower5F.asm index 6482993d..8e256b1e 100644 --- a/scripts/PokemonTower5F.asm +++ b/scripts/PokemonTower5F.asm @@ -17,8 +17,8 @@ PokemonTower5FDefaultScript: ld hl, PokemonTower5FPurifiedZoneCoords call ArePlayerCoordsInArray jr c, .in_purified_zone - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ResetEvent EVENT_IN_PURIFIED_ZONE jp CheckFightingMapTrainers .in_purified_zone @@ -28,8 +28,8 @@ PokemonTower5FDefaultScript: ldh [hJoyHeld], a ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd72e - set 4, [hl] + ld hl, wStatusFlags4 + set BIT_NO_BATTLES, [hl] predef HealParty call GBFadeOutToWhite call Delay3 diff --git a/scripts/PokemonTower6F.asm b/scripts/PokemonTower6F.asm index f2e99586..9e2f4118 100644 --- a/scripts/PokemonTower6F.asm +++ b/scripts/PokemonTower6F.asm @@ -36,7 +36,7 @@ PokemonTower6FDefaultScript: ld a, RESTLESS_SOUL ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, SCRIPT_POKEMONTOWER6F_MAROWAK_BATTLE ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a @@ -52,8 +52,8 @@ PokemonTower6FMarowakBattleScript: jp z, PokemonTower6FSetDefaultScript ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld a, [wd72d] - bit 6, a + ld a, [wStatusFlags3] + bit BIT_TALKED_TO_TRAINER, a ret nz call UpdateSprites ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -79,8 +79,8 @@ PokemonTower6FMarowakBattleScript: xor a ld [wSpritePlayerStateData2MovementByte1], a ld [wOverrideSimulatedJoypadStatesMask], a - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_POKEMONTOWER6F_PLAYER_MOVING ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index 85cc4309..be9aacd9 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -23,8 +23,8 @@ PokemonTower7F_ScriptPointers: dw_const PokemonTower7FWarpToMrFujiHouseScript, SCRIPT_POKEMONTOWER7F_WARP_TO_MR_FUJI_HOUSE PokemonTower7FEndBattleScript: - ld hl, wFlags_0xcd60 - res 0, [hl] + ld hl, wMiscFlags + res BIT_SEEN_BY_TRAINER, [hl] ld a, [wIsInBattle] cp $ff jp z, PokemonTower7FSetDefaultScript @@ -41,8 +41,8 @@ PokemonTower7FEndBattleScript: ret PokemonTower7FHideNPCScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld hl, wMissableObjectList ld a, [wSpriteIndex] @@ -78,8 +78,8 @@ PokemonTower7FWarpToMrFujiHouseScript: ld [wDestinationWarpID], a ld a, LAVENDER_TOWN ld [wLastMap], a - ld hl, wd72d - set 3, [hl] + ld hl, wStatusFlags3 + set BIT_WARP_FROM_CUR_SCRIPT, [hl] ld a, SCRIPT_POKEMONTOWER7F_DEFAULT ld [wPokemonTower7FCurScript], a ld [wCurMapScript], a diff --git a/scripts/RedsHouse1F.asm b/scripts/RedsHouse1F.asm index 0c5dbcf1..a91ede80 100644 --- a/scripts/RedsHouse1F.asm +++ b/scripts/RedsHouse1F.asm @@ -8,8 +8,8 @@ RedsHouse1F_TextPointers: RedsHouse1FMomText: text_asm - ld a, [wd72e] - bit 3, a ; received a Pokémon from Oak? + ld a, [wStatusFlags4] + bit BIT_GOT_STARTER, a jr nz, .heal ld hl, .WakeUpText call PrintText diff --git a/scripts/RocketHideoutB2F.asm b/scripts/RocketHideoutB2F.asm index 3a7ffa9b..7a5c2e4a 100644 --- a/scripts/RocketHideoutB2F.asm +++ b/scripts/RocketHideoutB2F.asm @@ -23,8 +23,8 @@ RocketHideoutB2FDefaultScript: call DecodeArrowMovementRLE cp $ff jp z, CheckFightingMapTrainers - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] call StartSimulatingJoypadStates ld a, SFX_ARROW_TILES call PlaySound @@ -262,8 +262,8 @@ RocketHideoutB2FPlayerSpinningScript: jr nz, LoadSpinnerArrowTiles xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_ROCKETHIDEOUTB2F_DEFAULT ld [wCurMapScript], a ret diff --git a/scripts/RocketHideoutB3F.asm b/scripts/RocketHideoutB3F.asm index 03681bef..0c0e02ea 100644 --- a/scripts/RocketHideoutB3F.asm +++ b/scripts/RocketHideoutB3F.asm @@ -23,8 +23,8 @@ RocketHideoutB3FDefaultScript: call DecodeArrowMovementRLE cp $ff jp z, CheckFightingMapTrainers - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] call StartSimulatingJoypadStates ld a, SFX_ARROW_TILES call PlaySound @@ -119,8 +119,8 @@ RocketHideoutB3FPlayerSpinningScript: jp nz, LoadSpinnerArrowTiles xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_ROCKETHIDEOUTB3F_DEFAULT ld [wCurMapScript], a ret @@ -165,7 +165,7 @@ RocketHideoutB3FRocket2Text: jp TextScriptEnd RocketHideoutB3FRocket2BattleText: - text_far _RocketHideout3BattleTxt + text_far _RocketHideout3BattleText text_end RocketHideoutB3FRocket2EndBattleText: diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 24bdd4a6..02ddcdd5 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -102,9 +102,9 @@ RocketHideoutB4FGiovanniText: jp nz, .beat_giovanni ld hl, .ImpressedYouGotHereText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .WhatCannotBeText ld de, .WhatCannotBeText call SaveEndBattleTextPointers diff --git a/scripts/Route12.asm b/scripts/Route12.asm index ea7b66ca..660b8a2d 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -33,7 +33,7 @@ Route12DefaultScript: ld a, SNORLAX ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, HS_ROUTE_12_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route12SuperRodHouse.asm b/scripts/Route12SuperRodHouse.asm index 551949d0..54867248 100644 --- a/scripts/Route12SuperRodHouse.asm +++ b/scripts/Route12SuperRodHouse.asm @@ -7,8 +7,8 @@ Route12SuperRodHouse_TextPointers: Route12SuperRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 5, a ; received super rod? + ld a, [wStatusFlags1] + bit BIT_GOT_SUPER_ROD, a jr nz, .got_item ld hl, .DoYouLikeToFishText call PrintText @@ -19,8 +19,8 @@ Route12SuperRodHouseFishingGuruText: lb bc, SUPER_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 5, [hl] ; received super rod + ld hl, wStatusFlags1 + set BIT_GOT_SUPER_ROD, [hl] ld hl, .ReceivedSuperRodText jr .done .bag_full diff --git a/scripts/Route16.asm b/scripts/Route16.asm index f51bd00e..ec33adf1 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -33,7 +33,7 @@ Route16DefaultScript: ld a, SNORLAX ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, HS_ROUTE_16_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route16Gate1F.asm b/scripts/Route16Gate1F.asm index 2d9777fc..d42a80d4 100644 --- a/scripts/Route16Gate1F.asm +++ b/scripts/Route16Gate1F.asm @@ -1,6 +1,6 @@ Route16Gate1F_Script: - ld hl, wd732 - res 5, [hl] + ld hl, wStatusFlags6 + res BIT_ALWAYS_ON_BIKE, [hl] call EnableAutoTextBoxDrawing ld a, [wRoute16Gate1FCurScript] ld hl, Route16Gate1F_ScriptPointers @@ -77,8 +77,8 @@ Route16Gate1FPlayerMovingRightScript: ret nz xor a ld [wJoyIgnore], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_ROUTE16GATE1F_DEFAULT ld [wRoute16Gate1FCurScript], a ret diff --git a/scripts/Route18Gate1F.asm b/scripts/Route18Gate1F.asm index 8f08638c..79d982d7 100644 --- a/scripts/Route18Gate1F.asm +++ b/scripts/Route18Gate1F.asm @@ -1,6 +1,6 @@ Route18Gate1F_Script: - ld hl, wd732 - res 5, [hl] + ld hl, wStatusFlags6 + res BIT_ALWAYS_ON_BIKE, [hl] call EnableAutoTextBoxDrawing ld a, [wRoute18Gate1FCurScript] ld hl, Route18Gate1F_ScriptPointers @@ -77,8 +77,8 @@ Route18Gate1FPlayerMovingRightScript: ret nz xor a ld [wJoyIgnore], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_ROUTE18GATE1F_DEFAULT ld [wRoute18Gate1FCurScript], a ret diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 1e575e43..ad02b4c7 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -104,8 +104,8 @@ Route22FirstRivalBattleScript: ret Route22Rival1StartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, [wSavedCoordIndex] cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords @@ -126,9 +126,9 @@ Route22Rival1StartBattleScript: ld a, TEXT_ROUTE22_RIVAL1 ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, Route22Rival1DefeatedText ld de, Route22Rival1VictoryText call SaveEndBattleTextPointers @@ -219,8 +219,8 @@ Route22Rival1ExitMovementData2: db -1 ; end Route22Rival1ExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -258,8 +258,8 @@ Route22SecondRivalBattleScript: ret Route22Rival2StartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, ROUTE22_RIVAL2 ldh [hSpriteIndex], a @@ -282,9 +282,9 @@ Route22Rival2StartBattleScript: ld a, TEXT_ROUTE22_RIVAL2 ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, Route22Rival2DefeatedText ld de, Route22Rival2VictoryText call SaveEndBattleTextPointers @@ -363,8 +363,8 @@ Route22Rival2ExitMovementData2: db -1 ; end Route22Rival2ExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a diff --git a/scripts/Route24.asm b/scripts/Route24.asm index 47d6eb9f..6f8f0250 100644 --- a/scripts/Route24.asm +++ b/scripts/Route24.asm @@ -119,9 +119,9 @@ Route24CooltrainerM1Text: call PrintText ld hl, .JoinTeamRocketText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers diff --git a/scripts/Route5Gate.asm b/scripts/Route5Gate.asm index d6e086ce..a0913c85 100644 --- a/scripts/Route5Gate.asm +++ b/scripts/Route5Gate.asm @@ -17,8 +17,8 @@ Route5GateMovePlayerUpScript: jp StartSimulatingJoypadStates Route5GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -42,8 +42,8 @@ Route5GateDefaultScript: ld a, TEXT_ROUTE5GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ret .PlayerInCoordsArray: @@ -69,8 +69,8 @@ Route5Gate_TextPointers: SaffronGateGuardText: text_asm - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a jr nz, .thanks_for_drink farcall RemoveGuardDrink ldh a, [hItemToRemoveID] @@ -86,8 +86,8 @@ SaffronGateGuardText: .have_drink ld hl, SaffronGateGuardGiveDrinkText call PrintText - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] jp TextScriptEnd .thanks_for_drink diff --git a/scripts/Route6Gate.asm b/scripts/Route6Gate.asm index db4cfcab..7afba23e 100644 --- a/scripts/Route6Gate.asm +++ b/scripts/Route6Gate.asm @@ -11,8 +11,8 @@ Route6Gate_ScriptPointers: dw_const Route6GatePlayerMovingScript, SCRIPT_ROUTE6GATE_PLAYER_MOVING Route6GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -33,8 +33,8 @@ Route6GateDefaultScript: ld [wRoute6GateCurScript], a ret .have_drink - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE6GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a jp DisplayTextID @@ -55,8 +55,8 @@ Route6GatePlayerMovingScript: ret Route6GateMovePlayerDownScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a ld a, $1 diff --git a/scripts/Route7Gate.asm b/scripts/Route7Gate.asm index 0260fb48..813fab21 100644 --- a/scripts/Route7Gate.asm +++ b/scripts/Route7Gate.asm @@ -11,8 +11,8 @@ Route7Gate_ScriptPointers: dw_const Route7PlayerMovingScript, SCRIPT_ROUTE7GATE_PLAYER_MOVING Route7GateMovePlayerLeftScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_LEFT ld [wSimulatedJoypadStatesEnd], a ld a, $1 @@ -23,8 +23,8 @@ Route7GateMovePlayerLeftScript: ret Route7DefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -48,8 +48,8 @@ Route7DefaultScript: ld a, TEXT_ROUTE7GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ret .PlayerInCoordsArray: diff --git a/scripts/Route8Gate.asm b/scripts/Route8Gate.asm index af4fe196..51dd6f1a 100644 --- a/scripts/Route8Gate.asm +++ b/scripts/Route8Gate.asm @@ -10,8 +10,8 @@ Route8Gate_ScriptPointers: dw_const Route8GatePlayerMovingScript, SCRIPT_ROUTE8GATE_PLAYER_MOVING Route8GateMovePlayerRightScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_RIGHT ld [wSimulatedJoypadStatesEnd], a ld a, $1 @@ -22,8 +22,8 @@ Route8GateMovePlayerRightScript: ret Route8GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -44,8 +44,8 @@ Route8GateDefaultScript: ld [wRoute8GateCurScript], a ret .have_drink - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a jp DisplayTextID diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 3d6be5d1..1c7c6b5b 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -87,8 +87,8 @@ SSAnne2FSetFacingDirectionScript: jp SetSpriteFacingDirectionAndDelay SSAnne2FRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call SSAnne2FSetFacingDirectionScript xor a @@ -164,8 +164,8 @@ SSAnne2FRivalAfterBattleScript: db -1 ; end SSAnne2FRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -191,9 +191,9 @@ SSAnne2FRivalText: text_asm ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SSAnne2FRivalDefeatedText ld de, SSAnne2FRivalVictoryText call SaveEndBattleTextPointers diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index da094261..bac424e8 100644 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -5,8 +5,8 @@ SSAnneCaptainsRoom_Script: SSAnneCaptainsRoomEventScript: CheckEvent EVENT_RUBBED_CAPTAINS_BACK ret nz - ld hl, wd72d - set 5, [hl] + ld hl, wStatusFlags3 + set BIT_NO_NPC_FACE_PLAYER, [hl] ret SSAnneCaptainsRoom_TextPointers: @@ -33,8 +33,8 @@ SSAnneCaptainsRoomCaptainText: .bag_full ld hl, SSAnneCaptainsRoomCaptainHM01NoRoomText call PrintText - ld hl, wd72d - set 5, [hl] + ld hl, wStatusFlags3 + set BIT_NO_NPC_FACE_PLAYER, [hl] jr .done .got_item ld hl, SSAnneCaptainsRoomCaptainNotSickAnymoreText @@ -64,8 +64,8 @@ SSAnneCaptainsRoomRubCaptainsBackText: jr z, .loop call PlayDefaultMusic SetEvent EVENT_RUBBED_CAPTAINS_BACK - ld hl, wd72d - res 5, [hl] + ld hl, wStatusFlags3 + res BIT_NO_NPC_FACE_PLAYER, [hl] jp TextScriptEnd SSAnneCaptainsRoomCaptainIFeelMuchBetterText: diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 96e453df..2de1081b 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -120,9 +120,9 @@ SaffronGymSabrinaText: .beforeBeat ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedMarshBadgeText ld de, .ReceivedMarshBadgeText call SaveEndBattleTextPointers diff --git a/scripts/SeafoamIslands1F.asm b/scripts/SeafoamIslands1F.asm index 27ddc276..a3ec3c99 100644 --- a/scripts/SeafoamIslands1F.asm +++ b/scripts/SeafoamIslands1F.asm @@ -1,9 +1,9 @@ SeafoamIslands1F_Script: call EnableAutoTextBoxDrawing SetEvent EVENT_IN_SEAFOAM_ISLANDS - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam1HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB1F.asm b/scripts/SeafoamIslandsB1F.asm index 271775ed..0bc2ee18 100644 --- a/scripts/SeafoamIslandsB1F.asm +++ b/scripts/SeafoamIslandsB1F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB1F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam2HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB2F.asm b/scripts/SeafoamIslandsB2F.asm index 71ae2e1a..48b7979d 100644 --- a/scripts/SeafoamIslandsB2F.asm +++ b/scripts/SeafoamIslandsB2F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB2F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam3HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB3F.asm b/scripts/SeafoamIslandsB3F.asm index 8c225dcc..23dfd050 100644 --- a/scripts/SeafoamIslandsB3F.asm +++ b/scripts/SeafoamIslandsB3F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB3F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam4HolesCoords call CheckBoulderCoords @@ -36,8 +36,8 @@ SeafoamIslandsB3F_Script: ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords call IsPlayerOnDungeonWarp - ld a, [wd732] - bit 4, a + ld a, [wStatusFlags6] + bit BIT_DUNGEON_WARP, a ret nz .runCurrentMapScript ld hl, SeafoamIslandsB3F_ScriptPointers @@ -72,8 +72,8 @@ SeafoamIslandsB3FDefaultScript: dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates - ld hl, wFlags_D733 - set 2, [hl] + ld hl, wStatusFlags7 + set BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING1 ld [wSeafoamIslandsB3FCurScript], a ret @@ -112,10 +112,10 @@ SeafoamIslandsB3FMoveObjectScript: ld [wSimulatedJoypadStatesIndex], a xor a ld [wSpritePlayerStateData2MovementByte1], a - ld hl, wd730 - set 7, [hl] - ld hl, wFlags_D733 - set 2, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags7 + set BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING2 .playerNotInStrongCurrent ld [wSeafoamIslandsB3FCurScript], a diff --git a/scripts/SeafoamIslandsB4F.asm b/scripts/SeafoamIslandsB4F.asm index bff27e9f..783b410d 100644 --- a/scripts/SeafoamIslandsB4F.asm +++ b/scripts/SeafoamIslandsB4F.asm @@ -48,8 +48,8 @@ SeafoamIslandsB4FDefaultScript: ld a, D_UP ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates - ld hl, wFlags_D733 - res 2, [hl] + ld hl, wStatusFlags7 + res BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING1 ld [wSeafoamIslandsB4FCurScript], a ret diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 778283c5..9caf2a70 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -236,8 +236,8 @@ SilphCo11FGiovanniAfterBattleScript: jp SilphCo11FSetCurScript SilphCo11FGiovanniBattleFacingScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, SILPHCO11F_GIOVANNI ldh [hSpriteIndex], a @@ -258,9 +258,9 @@ SilphCo11FGiovanniBattleFacingScript: jp SilphCo11FSetCurScript SilphCo11FGiovanniStartBattleScript: - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SilphCo10FGiovanniILostAgainText ld de, SilphCo10FGiovanniILostAgainText call SaveEndBattleTextPointers diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index bfa78847..de9e689d 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -169,8 +169,8 @@ SilphCo7FDefaultScript: db -1 ; end SilphCo7FRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -178,9 +178,9 @@ SilphCo7FRivalStartBattleScript: ldh [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SilphCo7FRivalDefeatedText ld de, SilphCo7FRivalVictoryText call SaveEndBattleTextPointers @@ -252,8 +252,8 @@ SilphCo7FRivalAfterBattleScript: db -1 ; end SilphCo7FRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_SILPH_CO_7F_RIVAL ld [wMissableObjectIndex], a @@ -296,8 +296,8 @@ SilphCo7TrainerHeader3: SilphCo7FSilphWorkerM1Text: ; lapras guy text_asm - ld a, [wd72e] - bit 0, a ; got lapras? + ld a, [wStatusFlags4] + bit BIT_GOT_LAPRAS, a jr z, .give_lapras CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI jr nz, .saved_silph @@ -316,8 +316,8 @@ SilphCo7FSilphWorkerM1Text: call EnableAutoTextBoxDrawing ld hl, .LaprasDescriptionText call PrintText - ld hl, wd72e - set 0, [hl] + ld hl, wStatusFlags4 + set BIT_GOT_LAPRAS, [hl] jr .done .saved_silph ld hl, .SavedText diff --git a/scripts/TradeCenter.asm b/scripts/TradeCenter.asm index d7e7c54c..c716484c 100644 --- a/scripts/TradeCenter.asm +++ b/scripts/TradeCenter.asm @@ -10,9 +10,9 @@ TradeCenter_Script: ld a, TRADECENTER_OPPONENT ldh [hSpriteIndex], a call SetSpriteFacingDirection - ld hl, wd72d - bit 0, [hl] - set 0, [hl] + ld hl, wStatusFlags3 + bit BIT_INIT_TRADE_CENTER_FACING, [hl] + set BIT_INIT_TRADE_CENTER_FACING, [hl] ret nz ld hl, wSprite01StateData2MapY ld a, 8 ; y diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 041bf5b4..11f9a09f 100644 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -11,8 +11,8 @@ VermilionDock_Script: jp z, VermilionDockSSAnneLeavesScript SetEventReuseHL EVENT_STARTED_WALKING_OUT_OF_DOCK call Delay3 - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index a4fab952..194fce94 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -127,9 +127,9 @@ VermilionGymLTSurgeText: .before_beat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, VermilionGymLTSurgeReceivedThunderBadgeText ld de, VermilionGymLTSurgeReceivedThunderBadgeText call SaveEndBattleTextPointers diff --git a/scripts/VermilionOldRodHouse.asm b/scripts/VermilionOldRodHouse.asm index f170bcaf..8663de69 100644 --- a/scripts/VermilionOldRodHouse.asm +++ b/scripts/VermilionOldRodHouse.asm @@ -7,8 +7,8 @@ VermilionOldRodHouse_TextPointers: VermilionOldRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 3, a ; got old rod? + ld a, [wStatusFlags1] + bit BIT_GOT_OLD_ROD, a jr nz, .got_old_rod ld hl, .DoYouLikeToFishText call PrintText @@ -19,8 +19,8 @@ VermilionOldRodHouseFishingGuruText: lb bc, OLD_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 3, [hl] ; got old rod + ld hl, wStatusFlags1 + set BIT_GOT_OLD_ROD, [hl] ld hl, .TakeThisText jr .print_text .bag_full diff --git a/scripts/VictoryRoad3F.asm b/scripts/VictoryRoad3F.asm index ce7e2175..e9295a15 100644 --- a/scripts/VictoryRoad3F.asm +++ b/scripts/VictoryRoad3F.asm @@ -27,9 +27,9 @@ VictoryRoad3F_ScriptPointers: dw_const EndTrainerBattle, SCRIPT_VICTORYROAD3F_END_BATTLE VictoryRoad3FDefaultScript: - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jp z, .check_switch_hole ld hl, .SwitchOrHoleCoords call CheckBoulderCoords @@ -64,14 +64,14 @@ VictoryRoad3FDefaultScript: ld a, [wCoordIndex] cp $1 jr nz, .hole - ld hl, wd72d - res 4, [hl] - ld hl, wd732 - res 4, [hl] + ld hl, wStatusFlags3 + res BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + res BIT_DUNGEON_WARP, [hl] ret .hole - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a jp z, CheckFightingMapTrainers ret diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm index efd2db21..0059bc60 100644 --- a/scripts/ViridianCity.asm +++ b/scripts/ViridianCity.asm @@ -75,7 +75,7 @@ ViridianCityOldManStartCatchTrainingScript: ld a, BATTLE_TYPE_OLD_MAN ld [wBattleType], a ld a, 5 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, WEEDLE ld [wCurOpponent], a ld a, SCRIPT_VIRIDIANCITY_OLD_MAN_END_CATCH_TRAINING diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index 5162d3bc..a6f27bdf 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -41,8 +41,8 @@ ViridianGymDefaultScript: cp $ff jp z, CheckFightingMapTrainers call StartSimulatingJoypadStates - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] ld a, SFX_ARROW_TILES call PlaySound ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -120,8 +120,8 @@ ViridianGymPlayerSpinningScript: jr nz, .ViridianGymLoadSpinnerArrow xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_VIRIDIANGYM_DEFAULT ld [wCurMapScript], a ret @@ -229,9 +229,9 @@ ViridianGymGiovanniText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedEarthBadgeText ld de, .ReceivedEarthBadgeText call SaveEndBattleTextPointers diff --git a/text/RocketHideoutB3F.asm b/text/RocketHideoutB3F.asm index b7ec9e1a..3d4af616 100644 --- a/text/RocketHideoutB3F.asm +++ b/text/RocketHideoutB3F.asm @@ -16,7 +16,7 @@ _RocketHideoutB3FRocket1AfterBattleText:: cont "here somewhere." done -_RocketHideout3BattleTxt:: +_RocketHideout3BattleText:: text "We got word from" line "upstairs that you" cont "were coming!"