From fc23e72a39eb9cb9ca0651ea805abb6f47ee458c Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:18:00 -0400 Subject: Identify some unused WRAM variables (#453) --- engine/overworld/movement.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld/movement.asm') diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index fd26f9cb..afcb5907 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -179,7 +179,7 @@ UpdateNPCSprite: res 0, [hl] xor a ld [wSimulatedJoypadStatesIndex], a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ret .next cp WALK -- cgit v1.3.1-sl0p 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: 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 +- engine/events/hidden_objects/bills_house_pc.asm | 8 +- engine/events/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 (limited to 'engine/overworld/movement.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!" -- cgit v1.3.1-sl0p From 8f1dcf07e598c6e3d34b5d255f04faff1667d83b Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:51:44 -0400 Subject: Identify more flag bits (#464) --- audio/engine_1.asm | 10 ++++---- audio/engine_2.asm | 16 ++++++------ audio/engine_3.asm | 10 ++++---- audio/low_health_alarm.asm | 14 +++++------ constants/audio_constants.asm | 8 ++++++ constants/battle_constants.asm | 4 +++ constants/gfx_constants.asm | 6 +++++ constants/map_object_constants.asm | 11 +++++++-- constants/menu_constants.asm | 3 +++ constants/oam_constants.asm | 24 +++++++++++------- constants/ram_constants.asm | 30 +++++++++++++++++++++++ data/sprites/facings.asm | 8 +++--- engine/battle/animations.asm | 6 ++--- engine/battle/battle_transitions.asm | 20 ++++++++++----- engine/battle/core.asm | 34 +++++++++++++------------- engine/battle/effects.asm | 2 +- engine/battle/experience.asm | 2 +- engine/battle/trainer_ai.asm | 8 +++--- engine/events/hidden_objects/pokecenter_pc.asm | 2 +- engine/events/poison.asm | 2 +- engine/gfx/hp_bar.asm | 2 +- engine/gfx/sprite_oam.asm | 4 +-- engine/items/item_effects.asm | 10 ++++---- engine/items/town_map.asm | 10 ++++---- engine/link/cable_club.asm | 14 +++++------ engine/menus/display_text_id_init.asm | 4 +-- engine/menus/league_pc.asm | 4 +-- engine/menus/party_menu.asm | 4 +-- engine/menus/players_pc.asm | 2 +- engine/menus/save.asm | 14 +++++------ engine/menus/text_box.asm | 4 +-- engine/overworld/map_sprites.asm | 6 ++--- engine/overworld/movement.asm | 8 +++--- engine/overworld/pathfinding.asm | 26 ++++++++++---------- engine/overworld/push_boulder.asm | 2 +- engine/overworld/special_warps.asm | 2 +- engine/pokemon/learn_move.asm | 8 +++--- engine/pokemon/status_screen.asm | 2 +- engine/slots/slot_machine.asm | 27 ++++++++++---------- home/map_objects.asm | 2 +- home/overworld.asm | 20 +++++++-------- home/predef_text.asm | 2 +- home/print_bcd.asm | 28 ++++++++++----------- home/reload_sprites.asm | 2 +- home/text.asm | 2 +- home/text_script.asm | 6 ++--- home/window.asm | 14 +++++------ ram/hram.asm | 1 + scripts/CeruleanBadgeHouse.asm | 2 +- scripts/Museum1F.asm | 2 +- scripts/OaksLab.asm | 2 +- scripts/PewterMart.asm | 2 +- scripts/SSAnne2FRooms.asm | 2 +- 53 files changed, 267 insertions(+), 193 deletions(-) (limited to 'engine/overworld/movement.asm') diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 99d47f37..e9642b32 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -15,9 +15,9 @@ Audio1_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio1_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio1_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio1_sound_ret Audio1_vibrato: diff --git a/audio/engine_2.asm b/audio/engine_2.asm index bcaab694..2f11c027 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -17,9 +17,9 @@ Audio2_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -163,8 +163,8 @@ Audio2_PlayNextNote: ld a, c cp CHAN5 jr nz, .beginChecks - ld a, [wLowHealthAlarm] ; low health alarm enabled? - bit 7, a + ld a, [wLowHealthAlarm] + bit BIT_LOW_HEALTH_ALARM, a ret nz .beginChecks ; --- @@ -208,7 +208,7 @@ Audio2_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -388,8 +388,8 @@ Audio2_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio2_sound_ret Audio2_vibrato: @@ -978,7 +978,7 @@ Audio2_ResetCryModifiers: cp CHAN5 jr nz, .skip ld a, [wLowHealthAlarm] - bit 7, a + bit BIT_LOW_HEALTH_ALARM, a jr z, .skip xor a ld [wFrequencyModifier], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index e5d285a3..f524875f 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -15,9 +15,9 @@ Audio3_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio3_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio3_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio3_sound_ret Audio3_vibrato: diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index 35fe1815..728f5f65 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -1,12 +1,12 @@ Music_DoLowHealthAlarm:: ld a, [wLowHealthAlarm] - cp $ff + cp DISABLE_LOW_HEALTH_ALARM jr z, .disableAlarm - bit 7, a ;alarm enabled? - ret z ;nope + bit BIT_LOW_HEALTH_ALARM, a + ret z - and $7f ;low 7 bits are the timer. + and LOW_HEALTH_TIMER_MASK jr nz, .notToneHi ;if timer > 0, play low tone. call .playToneHi @@ -19,15 +19,15 @@ Music_DoLowHealthAlarm:: call .playToneLo ;actually set the sound registers. .noTone - ld a, $86 + ld a, CRY_SFX_END ld [wChannelSoundIDs + CHAN5], a ;disable sound channel? ld a, [wLowHealthAlarm] - and $7f ;decrement alarm timer. + and LOW_HEALTH_TIMER_MASK dec a .resetTimer ; reset the timer and enable flag. - set 7, a + set BIT_LOW_HEALTH_ALARM, a ld [wLowHealthAlarm], a ret diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index a8903052..99b899d1 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -66,3 +66,11 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) ; wChannelFlags2 constant (only has one flag) DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music + +; wMuteAudioAndPauseMusic +DEF BIT_MUTE_AUDIO EQU 7 + +; wLowHealthAlarm +DEF BIT_LOW_HEALTH_ALARM EQU 7 +DEF LOW_HEALTH_TIMER_MASK EQU %01111111 +DEF DISABLE_LOW_HEALTH_ALARM EQU $ff diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 9349bb75..cde50b4d 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -72,6 +72,10 @@ DEF MAX_STAT_VALUE EQU 999 DEF ATKDEFDV_TRAINER EQU $98 DEF SPDSPCDV_TRAINER EQU $88 +; wDamageMultipliers +DEF BIT_STAB_DAMAGE EQU 7 +DEF EFFECTIVENESS_MASK EQU %01111111 + ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def const STORING_ENERGY ; 0 ; Bide diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index c6268208..79d9647f 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -29,6 +29,12 @@ DEF TRANSFERBOTTOM EQU 2 DEF REDRAW_COL EQU 1 DEF REDRAW_ROW EQU 2 +; hUILayoutFlags + const_def + const BIT_PARTY_MENU_HP_BAR ; 0 + const BIT_DOUBLE_SPACED_MENU ; 1 + const BIT_SINGLE_SPACED_LINES ; 2 + ; tile list ids ; TileIDListPointerTable indexes (see data/tilemaps.asm) const_def diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 377edcea..3b17c6ae 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -40,9 +40,16 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16 + const_def 6 + const BIT_TRAINER ; 6 + const BIT_ITEM ; 7 + ; different kinds of people events -DEF ITEM EQU $80 -DEF TRAINER EQU $40 +DEF TRAINER EQU 1 << BIT_TRAINER +DEF ITEM EQU 1 << BIT_ITEM + +; movement status +DEF BIT_FACE_PLAYER EQU 7 DEF WALK EQU $FE DEF STAY EQU $FF diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index f1f0d417..a6e035e7 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -44,6 +44,9 @@ DEF PC_ITEM_CAPACITY EQU 50 const NO_YES_MENU ; 7 DEF NUM_TWO_OPTION_MENUS EQU const_value +; wTwoOptionMenuID +DEF BIT_SECOND_MENU_OPTION_DEFAULT EQU 7 + ; menu exit method constants for list menus and the buy/sell/quit menu DEF CHOSE_MENU_ITEM EQU 1 ; pressed A DEF CANCELLED_MENU EQU 2 ; pressed B diff --git a/constants/oam_constants.asm b/constants/oam_constants.asm index 8c5e6be8..e87e54a0 100644 --- a/constants/oam_constants.asm +++ b/constants/oam_constants.asm @@ -1,14 +1,20 @@ -; OAM flags used by this game -DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic -DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic +; Pseudo-OAM flags used by game logic + const_def + const BIT_END_OF_OAM_DATA ; 0 + const BIT_SPRITE_UNDER_GRASS ; 1 + +; Used in SpriteFacingAndAnimationTable (see data/sprites/facings.asm) +DEF FACING_END EQU 1 << BIT_END_OF_OAM_DATA +DEF UNDER_GRASS EQU 1 << BIT_SPRITE_UNDER_GRASS ; OAM attribute flags -DEF OAM_PALETTE EQU %111 -DEF OAM_TILE_BANK EQU 3 -DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only -DEF OAM_X_FLIP EQU 5 -DEF OAM_Y_FLIP EQU 6 -DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +DEF OAM_PALETTE EQU %111 + const_def 3 + const OAM_TILE_BANK ; 3 + const OAM_OBP_NUM ; 4 ; Non CGB Mode Only + const OAM_X_FLIP ; 5 + const OAM_Y_FLIP ; 6 + const OAM_PRIORITY ; 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; OAM attribute masks DEF OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1 diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm index 42956cc6..8102cc7e 100644 --- a/constants/ram_constants.asm +++ b/constants/ram_constants.asm @@ -1,3 +1,8 @@ +; wSlotMachineFlags + const_def 6 + const BIT_SLOTS_CAN_WIN ; 6 + const BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR ; 7 + ; wMiscFlags const_def const BIT_SEEN_BY_TRAINER ; 0 @@ -9,6 +14,15 @@ const BIT_TRIED_PUSH_BOULDER ; 6 const BIT_PUSHED_BOULDER ; 7 +; wAutoTextBoxDrawingControl +DEF BIT_NO_AUTO_TEXT_BOX EQU 0 + +; wTextPredefFlag +DEF BIT_TEXT_PREDEF EQU 0 + +; wFontLoaded +DEF BIT_FONT_LOADED EQU 0 + ; wOptions DEF TEXT_DELAY_MASK EQU %111 const_def 6 @@ -24,6 +38,12 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5 const BIT_FAST_TEXT_DELAY ; 0 const BIT_TEXT_DELAY ; 1 +; wCurMapTileset +DEF BIT_NO_PREVIOUS_MAP EQU 7 + +; wCurrentBoxNum +DEF BIT_HAS_CHANGED_BOXES EQU 7 + ; wObtainedBadges, wBeatGymFlags const_def const BIT_BOULDERBADGE ; 0 @@ -117,3 +137,13 @@ DEF NUM_BADGES EQU const_value const_skip 3 ; 3-5 ; unused const BIT_LEDGE_OR_FISHING ; 6 const BIT_SPINNING ; 7 + +; hFindPathFlags + const_def + const BIT_PATH_FOUND_Y ; 0 + const BIT_PATH_FOUND_X ; 1 + +; hNPCPlayerRelativePosFlags + const_def + const BIT_PLAYER_LOWER_Y ; 0 + const BIT_PLAYER_LOWER_X ; 1 diff --git a/data/sprites/facings.asm b/data/sprites/facings.asm index eb583d53..54fd7ed0 100644 --- a/data/sprites/facings.asm +++ b/data/sprites/facings.asm @@ -48,12 +48,12 @@ SpriteFacingAndAnimationTable: ; y, x, attributes db 0, 0, $00 ; top left db 0, 8, $00 ; top right - db 8, 0, OAMFLAG_CANBEMASKED ; bottom left - db 8, 8, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 0, UNDER_GRASS ; bottom left + db 8, 8, UNDER_GRASS | FACING_END ; bottom right .FlippedOAM: ; y, x, attributes db 0, 8, OAM_HFLIP ; top left db 0, 0, OAM_HFLIP ; top right - db 8, 8, OAM_HFLIP | OAMFLAG_CANBEMASKED ; bottom left - db 8, 0, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 8, OAM_HFLIP | UNDER_GRASS ; bottom left + db 8, 0, OAM_HFLIP | UNDER_GRASS | FACING_END ; bottom right diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 3e077d2b..3ccbf7c4 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -114,13 +114,13 @@ DrawFrameBlock: ld [de], a ; store tile ID inc de ld a, [hli] - bit 5, a ; is horizontal flip enabled? + bit OAM_X_FLIP, a jr nz, .disableHorizontalFlip .enableHorizontalFlip - set 5, a + set OAM_X_FLIP, a jr .storeFlags2 .disableHorizontalFlip - res 5, a + res OAM_X_FLIP, a .storeFlags2 ld [de], a inc de diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 5956d875..85d2177e 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -64,6 +64,12 @@ BattleTransition: ld l, a jp hl + const_def + const BIT_TRAINER_BATTLE_TRANSITION ; 0 + const BIT_STRONGER_BATTLE_TRANSITION ; 1 + const BIT_DUNGEON_BATTLE_TRANSITION ; 2 +DEF NUM_BATTLE_TRANSITION_BITS EQU const_value + ; the three GetBattleTransitionID functions set the first ; three bits of c, which determines what transition animation ; to play at the beginning of a battle @@ -71,6 +77,7 @@ BattleTransition: ; bit 1: set if enemy is at least 3 levels higher than player ; bit 2: set if dungeon map BattleTransitions: + table_width 2, BattleTransitions dw BattleTransition_DoubleCircle ; %000 dw BattleTransition_Spiral ; %001 dw BattleTransition_Circle ; %010 @@ -79,15 +86,16 @@ BattleTransitions: dw BattleTransition_Shrink ; %101 dw BattleTransition_VerticalStripes ; %110 dw BattleTransition_Split ; %111 + assert_table_length 1 << NUM_BATTLE_TRANSITION_BITS GetBattleTransitionID_WildOrTrainer: ld a, [wCurOpponent] cp OPP_ID_OFFSET jr nc, .trainer - res 0, c + res BIT_TRAINER_BATTLE_TRANSITION, c ret .trainer - set 0, c + set BIT_TRAINER_BATTLE_TRANSITION, c ret GetBattleTransitionID_CompareLevels: @@ -108,12 +116,12 @@ GetBattleTransitionID_CompareLevels: ld a, [wCurEnemyLevel] sub e jr nc, .highLevelEnemy - res 1, c + res BIT_STRONGER_BATTLE_TRANSITION, c ld a, 1 ld [wBattleTransitionSpiralDirection], a ret .highLevelEnemy - set 1, c + set BIT_STRONGER_BATTLE_TRANSITION, c xor a ld [wBattleTransitionSpiralDirection], a ret @@ -129,7 +137,7 @@ GetBattleTransitionID_IsDungeonMap: cp e jr nz, .loop1 .match - set 2, c + set BIT_DUNGEON_BATTLE_TRANSITION, c ret .noMatch1 ld hl, DungeonMaps2 @@ -145,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap: cp d jr nc, .match .noMatch2 - res 2, c + res BIT_DUNGEON_BATTLE_TRANSITION, c ret INCLUDE "data/maps/dungeon_maps.asm" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 428bc78a..5e93393c 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1007,12 +1007,12 @@ RemoveFaintedPlayerMon: ld b, FLAG_RESET predef FlagActionPredef ; clear gain exp flag for fainted mon ld hl, wEnemyBattleStatus1 - res 2, [hl] ; reset "attacking multiple times" flag + res ATTACKING_MULTIPLE_TIMES, [hl] ld a, [wLowHealthAlarm] - bit 7, a ; skip sound flag (red bar (?)) + bit BIT_LOW_HEALTH_ALARM, a jr z, .skipWaitForSound - ld a, $ff - ld [wLowHealthAlarm], a ;disable low health alarm + ld a, DISABLE_LOW_HEALTH_ALARM + ld [wLowHealthAlarm], a call WaitForSoundToFinish .skipWaitForSound ; a is 0, so this zeroes the enemy's accumulated damage. @@ -1305,7 +1305,7 @@ EnemySendOutFirstMon: dec a ld [wAICount], a ld hl, wPlayerBattleStatus1 - res 5, [hl] + res USING_TRAPPING_MOVE, [hl] hlcoord 18, 0 ld a, 8 call SlideTrainerPicOffScreen @@ -1860,15 +1860,15 @@ DrawPlayerHUDAndHPBar: jr z, .setLowHealthAlarm .fainted ld hl, wLowHealthAlarm - bit 7, [hl] ;low health alarm enabled? - ld [hl], $0 + bit BIT_LOW_HEALTH_ALARM, [hl] + ld [hl], 0 ret z xor a ld [wChannelSoundIDs + CHAN5], a ret .setLowHealthAlarm ld hl, wLowHealthAlarm - set 7, [hl] ;enable low health alarm + set BIT_LOW_HEALTH_ALARM, [hl] ret DrawEnemyHUDAndHPBar: @@ -2121,7 +2121,7 @@ DisplayBattleMenu:: ld a, D_LEFT | A_BUTTON ld [hli], a ; wMenuWatchedKeys call HandleMenuInput - bit 5, a ; check if left was pressed + bit BIT_D_LEFT, a jr nz, .leftColumn ; if left was pressed, jump ld a, [wCurrentMenuItem] add $2 ; if we're in the right column, the actual id is +2 @@ -2473,11 +2473,11 @@ MoveSelectionMenu: .writemoves ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ret @@ -2604,10 +2604,10 @@ SelectMenuItem: ld [hl], "▷" .select ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_D_UP, a jp nz, SelectMenuItem_CursorUp bit BIT_D_DOWN, a @@ -2652,7 +2652,7 @@ SelectMenuItem: cp c jr z, .disabled ld a, [wPlayerBattleStatus3] - bit 3, a ; transformed + bit TRANSFORMED, a jr nz, .transformedMoveSelected .transformedMoveSelected ; pointless ; Allow moves copied by Transform to be used. @@ -3850,7 +3850,7 @@ PrintMoveFailureText: .playersTurn ld hl, DoesntAffectMonText ld a, [wDamageMultipliers] - and $7f + and EFFECTIVENESS_MASK jr z, .gotTextToPrint ld hl, AttackMissedText ld a, [wCriticalHitOrOHKO] @@ -5248,7 +5248,7 @@ AdjustDamageForMoveType: ld a, l ld [wDamage + 1], a ld hl, wDamageMultipliers - set 7, [hl] + set BIT_STAB_DAMAGE, [hl] .skipSameTypeAttackBonus ld a, [wMoveType] ld b, a @@ -5271,7 +5271,7 @@ AdjustDamageForMoveType: push bc inc hl ld a, [wDamageMultipliers] - and $80 + and 1 << BIT_STAB_DAMAGE ld b, a ld a, [hl] ; a = damage multiplier ldh [hMultiplier], a diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 6fba347f..95c8706f 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -194,7 +194,7 @@ ExplodeEffect: FreezeBurnParalyzeEffect: xor a ld [wAnimationType], a - call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] + call CheckTargetSubstitute ret nz ; return if they have a substitute, can't effect them ldh a, [hWhoseTurn] and a diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 57d37f01..a8ee6747 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -224,7 +224,7 @@ GainExperience: call CopyData pop hl ld a, [wPlayerBattleStatus3] - bit 3, a ; is the mon transformed? + bit TRANSFORMED, a jr nz, .recalcStatChanges ; the mon is not transformed, so update the unmodified stats ld de, wPlayerMonUnmodifiedLevel diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 5eed1ae5..ccd4e804 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -632,27 +632,27 @@ AICureStatus: ld [hl], a ; clear status in enemy team roster ld [wEnemyMonStatus], a ; clear status of active enemy ld hl, wEnemyBattleStatus3 - res 0, [hl] + res BADLY_POISONED, [hl] ret AIUseXAccuracy: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 0, [hl] + set USING_X_ACCURACY, [hl] ld a, X_ACCURACY jp AIPrintItemUse AIUseGuardSpec: call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 1, [hl] + set PROTECTED_BY_MIST, [hl] ld a, GUARD_SPEC jp AIPrintItemUse AIUseDireHit: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 2, [hl] + set GETTING_PUMPED, [hl] ld a, DIRE_HIT jp AIPrintItemUse diff --git a/engine/events/hidden_objects/pokecenter_pc.asm b/engine/events/hidden_objects/pokecenter_pc.asm index f20f40ed..59867d1a 100644 --- a/engine/events/hidden_objects/pokecenter_pc.asm +++ b/engine/events/hidden_objects/pokecenter_pc.asm @@ -3,7 +3,7 @@ OpenPokemonCenterPC: cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a tx_pre_jump PokemonCenterPCText diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 752899f7..5a7bed7c 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,7 +1,7 @@ ApplyOutOfBattlePoisonDamage: ld a, [wStatusFlags5] assert BIT_SCRIPTED_MOVEMENT_STATE == 7 - add a ; overflows bit 7 into carry flag + add a ; overflows scripted movement state bit into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wPartyCount] and a diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index d848a337..c1ae598e 100644 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -214,7 +214,7 @@ UpdateHPBar_PrintHPNumber: ld [wHPBarTempHP], a push hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .hpBelowBar ld de, $9 jr .next diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 3916c0db..737443a6 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -124,7 +124,7 @@ PrepareOAMData:: inc hl inc e ld a, [hl] - bit 1, a ; is the tile allowed to set the sprite priority bit? + bit BIT_SPRITE_UNDER_GRASS, a jr z, .skipPriority ldh a, [hSpritePriority] or [hl] @@ -132,7 +132,7 @@ PrepareOAMData:: inc hl ld [de], a inc e - bit 0, a ; OAMFLAG_ENDOFDATA + bit BIT_END_OF_OAM_DATA, a jr z, .tileLoop ld a, e diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 91462478..9643412c 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -691,7 +691,7 @@ ItemUseSurfboard: ldh [hSpriteIndex], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ldh a, [hSpriteIndex] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing @@ -1052,13 +1052,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a pop af ld b, a ; store heal amount (1/5 of max HP) @@ -1202,13 +1202,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index a9840268..6f2c050c 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -75,9 +75,9 @@ DisplayTownMap: jr z, .inputLoop ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown xor a ld [wTownMapSpriteBlinkingEnabled], a @@ -196,13 +196,13 @@ LoadTownMap_Fly:: pop hl and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - bit 0, b + bit BIT_A_BUTTON, b jr nz, .pressedA ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown jr .pressedB .pressedA diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index cbb8a358..8ae192b8 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -282,7 +282,7 @@ CableClub_DoBattleOrTradeAgain: call ClearScreen call Delay3 ld hl, wOptions - res 7, [hl] + res BIT_BATTLE_ANIMATION, [hl] predef InitOpponent predef HealParty jp ReturnToCableClubRoom @@ -342,10 +342,10 @@ TradeCenter_SelectMon: ld [wTopMenuItemX], a .enemyMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a jp z, .getNewInput bit BIT_A_BUTTON, a @@ -407,10 +407,10 @@ TradeCenter_SelectMon: call ClearScreenArea .playerMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed jp .getNewInput @@ -489,7 +489,7 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a call HandleMenuInput - bit 4, a ; Right pressed? + bit BIT_D_RIGHT, a jr nz, .selectTradeMenuItem bit BIT_B_BUTTON, a jr z, .displayPlayerMonStats @@ -585,7 +585,7 @@ ReturnToCableClubRoom: ld a, [hl] push af push hl - res 0, [hl] + res BIT_FONT_LOADED, [hl] xor a ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING dec a diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index a89696fb..2ef1cfb1 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -3,7 +3,7 @@ DisplayTextIDInit:: xor a ld [wListMenuID], a ld a, [wAutoTextBoxDrawingControl] - bit 0, a + bit BIT_NO_AUTO_TEXT_BOX, a jr nz, .skipDrawingTextBoxBorder ldh a, [hTextID] and a @@ -31,7 +31,7 @@ DisplayTextIDInit:: call TextBoxBorder .skipDrawingTextBoxBorder ld hl, wFontLoaded - set 0, [hl] + set BIT_FONT_LOADED, [hl] ld hl, wMiscFlags bit BIT_NO_SPRITE_UPDATES, [hl] res BIT_NO_SPRITE_UPDATES, [hl] diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 17d58c55..03b1de6d 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -44,7 +44,7 @@ PKMNLeaguePC: pop af ld [wUpdateSpritesEnabled], a pop hl - res 6, [hl] + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearScreen call RunDefaultPaletteCommand @@ -57,7 +57,7 @@ LeaguePCShowTeam: call LeaguePCShowMon call WaitForTextScrollButtonPress ldh a, [hJoyHeld] - bit 1, a + bit BIT_B_BUTTON, a jr nz, .exit ld hl, wHallOfFame + HOF_MON ld de, wHallOfFame diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 6c8cd6eb..e6388b5f 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -70,12 +70,12 @@ RedrawPartyMenu_:: push hl ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a add hl, bc predef DrawHP2 ; draw HP bar and prints current / max HP ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index 9e1553dd..402275b5 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -50,7 +50,7 @@ PlayerPCMenu: ld hl, WhatDoYouWantText call PrintText call HandleMenuInput - bit 1, a + bit BIT_B_BUTTON, a jp nz, ExitPlayerPC call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 2f61b678..eeb4b9e8 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -66,7 +66,7 @@ LoadSAV0: ld bc, wMainDataEnd - wMainDataStart call CopyData ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] ld hl, sSpriteData ld de, wSpriteDataStart ld bc, wSpriteDataEnd - wSpriteDataStart @@ -349,15 +349,15 @@ ChangeBox:: and a ret nz ; return if No was chosen ld hl, wCurrentBoxNum - bit 7, [hl] ; is it the first time player is changing the box? + bit BIT_HAS_CHANGED_BOXES, [hl] ; is it the first time player is changing the box? call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_B_BUTTON, a ret nz call GetBoxSRAMLocation @@ -366,7 +366,7 @@ ChangeBox:: ld hl, wBoxDataStart call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] - set 7, a + set BIT_HAS_CHANGED_BOXES, a ld [wCurrentBoxNum], a call GetBoxSRAMLocation ld de, wBoxDataStart @@ -448,12 +448,12 @@ DisplayChangeBoxMenu: ld c, 7 call TextBoxBorder ld hl, hUILayoutFlags - set 2, [hl] + set BIT_SINGLE_SPACED_LINES, [hl] ld de, BoxNames hlcoord 13, 1 call PlaceString ld hl, hUILayoutFlags - res 2, [hl] + res BIT_SINGLE_SPACED_LINES, [hl] ld a, [wCurrentBoxNum] and $7f cp 9 diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index 3c1b5233..1c078693 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -227,8 +227,8 @@ DisplayTwoOptionMenu: ld [wMenuWatchMovingOutOfBounds], a push hl ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] + bit BIT_SECOND_MENU_OPTION_DEFAULT, [hl] + res BIT_SECOND_MENU_OPTION_DEFAULT, [hl] jr z, .storeCurrentMenuItem inc a .storeCurrentMenuItem diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 8acbb04f..75c46474 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -162,7 +162,7 @@ LoadMapSpriteTilePatterns: pop de ld b, a ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .skipFirstLoad ; if so, skip loading data into the lower half ld a, b ld b, 0 @@ -183,7 +183,7 @@ LoadMapSpriteTilePatterns: inc d .noCarry3 ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadWhileLCDOn pop af pop hl @@ -268,7 +268,7 @@ InitOutsideMapSprites: call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b, a ; b = spriteSetID ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set ld a, [wSpriteSetID] cp b ; has the sprite set ID changed? diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 1ca24f6a..5f95cf6c 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -57,7 +57,7 @@ UpdatePlayerSprite: .next ld [wSpritePlayerStateData1FacingDirection], a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jr nz, .notMoving .moving ld a, [wMovementFlags] @@ -135,11 +135,11 @@ UpdateNPCSprite: ld l, a inc l ld a, [hl] ; x#SPRITESTATEDATA1_MOVEMENTSTATUS - bit 7, a ; is the face player flag set? + bit BIT_FACE_PLAYER, a jp nz, MakeNPCFacePlayer ld b, a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jp nz, notYetMoving ld a, b cp $2 @@ -412,7 +412,7 @@ MakeNPCFacePlayer: ld a, [wStatusFlags3] bit BIT_NO_NPC_FACE_PLAYER, a jr nz, notYetMoving - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a jr z, .notFacingDown diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index d067345e..58fa1da9 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -16,7 +16,7 @@ FindPathToPlayer: and a jr nz, .stillHasYProgress ldh a, [hFindPathFlags] - set 0, a ; current end of path matches the player's Y coordinate + set BIT_PATH_FOUND_Y, a ldh [hFindPathFlags], a .stillHasYProgress ldh a, [hFindPathXProgress] @@ -27,11 +27,11 @@ FindPathToPlayer: and a jr nz, .stillHasXProgress ldh a, [hFindPathFlags] - set 1, a ; current end of path matches the player's X coordinate + set BIT_PATH_FOUND_X, a ldh [hFindPathFlags], a .stillHasXProgress ldh a, [hFindPathFlags] - cp $3 ; has the end of the path reached the player's position? + cp (1 << BIT_PATH_FOUND_X) | (1 << BIT_PATH_FOUND_Y) jr z, .done ; Compare whether the X distance between the player and the current of the path ; is greater or if the Y distance is. Then, try to reduce whichever is greater. @@ -40,7 +40,7 @@ FindPathToPlayer: jr c, .yDistanceGreater ; x distance is greater ldh a, [hNPCPlayerRelativePosFlags] - bit 1, a + bit BIT_PLAYER_LOWER_X, a jr nz, .playerIsLeftOfNPC ld d, NPC_MOVEMENT_RIGHT jr .next1 @@ -53,7 +53,7 @@ FindPathToPlayer: jr .storeDirection .yDistanceGreater ldh a, [hNPCPlayerRelativePosFlags] - bit 0, a + bit BIT_PLAYER_LOWER_Y, a jr nz, .playerIsAboveNPC ld d, NPC_MOVEMENT_DOWN jr .next2 @@ -97,15 +97,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCNorthOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - set 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + set BIT_PLAYER_LOWER_Y, [hl] pop hl jr .divideYDistance .NPCSouthOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - res 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + res BIT_PLAYER_LOWER_Y, [hl] pop hl .divideYDistance push hl @@ -125,15 +125,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCWestOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - set 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + set BIT_PLAYER_LOWER_X, [hl] pop hl jr .divideXDistance .NPCEastOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - res 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + res BIT_PLAYER_LOWER_X, [hl] pop hl .divideXDistance ldh [hDividend2], a diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index ff481439..1773e818 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -18,7 +18,7 @@ TryPushingBoulder:: swap a ld e, a add hl, de - res 7, [hl] + res BIT_FACE_PLAYER, [hl] call GetSpriteMovementByte2Pointer ld a, [hl] cp BOULDER_MOVEMENT_BYTE_2 diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 303415c1..b20d490e 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -52,7 +52,7 @@ LoadSpecialWarpData: bit BIT_DEBUG_MODE, a ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug jr nz, .notNewGameWarp - bit 2, a + bit BIT_FLY_OR_DUNGEON_WARP, a jr nz, .notNewGameWarp ld hl, NewGameWarp .copyWarpData diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 2df9964e..819466a5 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -127,11 +127,11 @@ TryingToLearn: hlcoord 6, 8 ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ld hl, wTopMenuItemY ld a, 8 @@ -147,10 +147,10 @@ TryingToLearn: ld [hli], a ; wMenuWatchedKeys ld [hl], 0 ; wLastMenuItem ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] push af call LoadScreenTilesFromBuffer1 pop af diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 8d377f79..447db8fd 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -41,7 +41,7 @@ DrawHP_: call DrawHPBar pop hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar jr .printFraction diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 649f634c..1ed24a1a 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -1,8 +1,9 @@ PromptUserToPlaySlots: call SaveScreenTilesToBuffer2 - ld a, BANK(DisplayTextIDInit) ; TRUE - ld [wAutoTextBoxDrawingControl], a - ld b, a + ld a, BANK(DisplayTextIDInit) + assert BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX + ld [wAutoTextBoxDrawingControl], a ; 1 << BIT_NO_AUTO_TEXT_BOX + ld b, a ; BANK(DisplayTextIDInit) ld hl, DisplayTextIDInit call Bankswitch ld hl, PlaySlotMachineText @@ -173,7 +174,7 @@ OneMoreGoSlotMachineText: SlotMachine_SetFlags: ld hl, wSlotMachineFlags - bit 7, [hl] + bit BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret nz ld a, [wSlotMachineAllowMatchesCounter] and a @@ -191,14 +192,14 @@ SlotMachine_SetFlags: ld [hl], 0 ret .allowMatches - set 6, [hl] + set BIT_SLOTS_CAN_WIN, [hl] ret .setAllowMatchesCounter ld a, 60 ld [wSlotMachineAllowMatchesCounter], a ret .allowSevenAndBarMatches - set 7, [hl] + set BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret SlotMachine_SpinWheels: @@ -289,7 +290,7 @@ SlotMachine_StopWheel1Early: call SlotMachine_GetWheel1Tiles ld hl, wSlotMachineWheel1BottomTile ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if the middle symbol is not a cherry. inc hl @@ -317,7 +318,7 @@ SlotMachine_StopWheel1Early: SlotMachine_StopWheel2Early: call SlotMachine_GetWheel2Tiles ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if any symbols are lined up in the first two wheels. call SlotMachine_FindWheel1Wheel2Matches @@ -401,7 +402,7 @@ SlotMachine_CheckForMatches: call SlotMachine_CheckForMatch jr z, .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .noMatch ld hl, wSlotMachineRerollCounter dec [hl] @@ -421,9 +422,9 @@ SlotMachine_CheckForMatches: jp SlotMachine_CheckForMatches .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .acceptMatch ; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel ld a, [hl] @@ -599,7 +600,7 @@ SlotReward300Func: call PlaySound call Random cp $80 - ld a, $0 + ld a, 0 jr c, .skip ld [wSlotMachineFlags], a .skip @@ -654,7 +655,7 @@ SlotMachine_PrintPayoutCoins: jp PrintNumber SlotMachine_PayCoinsToPlayer: - ld a, $1 + ld a, TRUE ld [wMuteAudioAndPauseMusic], a call WaitForSoundToFinish diff --git a/home/map_objects.asm b/home/map_objects.asm index 342139dd..e200238a 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -227,7 +227,7 @@ SetSpriteMovementBytesToFF:: ; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl GetSpriteMovementByte1Pointer:: - ld h, $C2 + ld h, HIGH(wSpriteStateData2) ldh a, [hSpriteIndex] swap a add 6 diff --git a/home/overworld.asm b/home/overworld.asm index 1595fdf0..e43ebc81 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -121,7 +121,7 @@ OverworldLoopLessDelay:: ld a, [wCurMap] call SwitchToMapRomBank ; switch to the ROM bank of the current map ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] .changeMap jp EnterMap .checkForOpponent @@ -879,10 +879,10 @@ LoadTilesetTilePatternData:: ld a, [wTilesetBank] jp FarCopyData2 -; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 +; this loads the current map's complete tile map (which references blocks, not individual tiles) to wOverworldMap ; it can also load partial tile maps of connected maps into a border of length 3 around the current map LoadTileBlockMap:: -; fill C6E8-CBFB with the background tile +; fill wOverworldMap-wOverworldMapEnd with the background tile ld hl, wOverworldMap ld a, [wMapBackgroundTile] ld d, a @@ -1210,7 +1210,7 @@ IsSpriteInFrontOfPlayer2:: and $f0 inc a ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS - set 7, [hl] ; set flag to make the sprite face the player + set BIT_FACE_PLAYER, [hl] ld a, e ldh [hTextID], a ret @@ -1303,7 +1303,7 @@ CheckForTilePairCollisions:: ld a, [wTileInFrontOfPlayer] ld c, a .tilePairCollisionLoop - ld a, [wCurMapTileset] ; tileset number + ld a, [wCurMapTileset] ld b, a ld a, [hli] cp $ff @@ -1943,7 +1943,7 @@ CollisionCheckOnWater:: call PlayDefaultMusic jr .noCollision .checkIfVermilionDockTileset - ld a, [wCurMapTileset] ; tileset + ld a, [wCurMapTileset] cp SHIP_PORT ; Vermilion Dock tileset jr nz, .noCollision ; keep surfing if it's not the boarding platform tile jr .stopSurfing ; if it is the boarding platform tile, stop surfing @@ -2015,10 +2015,10 @@ LoadMapHeader:: call SwitchToMapRomBank ld a, [wCurMapTileset] ld b, a - res 7, a + res BIT_NO_PREVIOUS_MAP, a ld [wCurMapTileset], a ldh [hPreviousTileset], a - bit 7, b + bit BIT_NO_PREVIOUS_MAP, b ret nz ld hl, MapHeaderPointers ld a, [wCurMap] @@ -2203,9 +2203,9 @@ LoadMapHeader:: ld [hl], a ; store text ID in byte 1 of sprite entry pop hl ldh a, [hLoadSpriteTemp1] - bit 6, a + bit BIT_TRAINER, a jr nz, .trainerSprite - bit 7, a + bit BIT_ITEM, a jr nz, .itemBallSprite jr .regularSprite .trainerSprite diff --git a/home/predef_text.asm b/home/predef_text.asm index bdecd3cf..61e22fce 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -3,7 +3,7 @@ PrintPredefTextID:: ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag - set 0, [hl] + set BIT_TEXT_PREDEF, [hl] call DisplayTextID RestoreMapTextPointer:: diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 38aedd3c..57ec12a8 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -13,12 +13,12 @@ ; their meaning at the beginning of the functions's execution. PrintBCDNumber:: ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b + res BIT_LEADING_ZEROES, c + res BIT_LEFT_ALIGN, c + res BIT_MONEY_SIGN, c ; c now holds the length + bit BIT_MONEY_SIGN, b jr z, .loop - bit 7, b + bit BIT_LEADING_ZEROES, b jr nz, .loop ld [hl], "¥" inc hl @@ -31,14 +31,14 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit 7, b ; were any non-zero digits printed? + bit BIT_LEADING_ZEROES, b jr z, .done ; if so, we are done .numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space .skipRightAlignmentAdjustment - bit 5, b + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl @@ -54,24 +54,24 @@ PrintBCDDigit:: and a jr z, .zeroDigit .nonzeroDigit - bit 7, b ; have any non-space characters been printed? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl - res 5, b + res BIT_MONEY_SIGN, b .skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached + res BIT_LEADING_ZEROES, b .outputDigit add "0" ld [hli], a jp PrintLetterDelay .zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b ret nz inc hl ; if right-aligned, "print" a space by advancing the pointer ret diff --git a/home/reload_sprites.asm b/home/reload_sprites.asm index 8a08d64d..5cf5d458 100644 --- a/home/reload_sprites.asm +++ b/home/reload_sprites.asm @@ -4,7 +4,7 @@ ReloadMapSpriteTilePatterns:: ld hl, wFontLoaded ld a, [hl] push af - res 0, [hl] + res BIT_FONT_LOADED, [hl] push hl xor a ld [wSpriteSetID], a diff --git a/home/text.asm b/home/text.asm index dc78b982..da884125 100644 --- a/home/text.asm +++ b/home/text.asm @@ -63,7 +63,7 @@ PlaceNextChar:: jr nz, .NotNext ld bc, 2 * SCREEN_WIDTH ldh a, [hUILayoutFlags] - bit 2, a + bit BIT_SINGLE_SPACED_LINES, a jr z, .ok ld bc, SCREEN_WIDTH .ok diff --git a/home/text_script.asm b/home/text_script.asm index d367683d..c1606371 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -6,8 +6,8 @@ DisplayTextID:: push af farcall DisplayTextIDInit ; initialization ld hl, wTextPredefFlag - bit 0, [hl] - res 0, [hl] + bit BIT_TEXT_PREDEF, [hl] + res BIT_TEXT_PREDEF, [hl] jr nz, .skipSwitchToMapBank ld a, [wCurMap] call SwitchToMapRomBank @@ -128,7 +128,7 @@ CloseTextDisplay:: ld [MBC1RomBank], a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded - res 0, [hl] + res BIT_FONT_LOADED, [hl] ld a, [wStatusFlags6] bit BIT_FLY_WARP, a call z, LoadPlayerSpriteGraphics diff --git a/home/window.asm b/home/window.asm index 01b52d41..48ab1d0e 100644 --- a/home/window.asm +++ b/home/window.asm @@ -137,12 +137,12 @@ PlaceMenuCursor:: jr z, .checkForArrow1 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced1 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getOldMenuItemScreenPosition .doubleSpaced1 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getOldMenuItemScreenPosition pop af .oldMenuItemLoop @@ -163,12 +163,12 @@ PlaceMenuCursor:: jr z, .checkForArrow2 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced2 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getCurrentMenuItemScreenPosition .doubleSpaced2 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getCurrentMenuItemScreenPosition pop af .currentMenuItemLoop @@ -272,7 +272,7 @@ EnableAutoTextBoxDrawing:: jr AutoTextBoxDrawingCommon DisableAutoTextBoxDrawing:: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX AutoTextBoxDrawingCommon:: ld [wAutoTextBoxDrawingControl], a diff --git a/ram/hram.asm b/ram/hram.asm index e7c3ef3c..1be1dab6 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -388,6 +388,7 @@ hClearLetterPrintingDelayFlags:: db ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced +; bit 2: text is single spaced hUILayoutFlags:: db hFieldMoveMonMenuTopMenuItemX:: db diff --git a/scripts/CeruleanBadgeHouse.asm b/scripts/CeruleanBadgeHouse.asm index b1f6db7f..54186523 100644 --- a/scripts/CeruleanBadgeHouse.asm +++ b/scripts/CeruleanBadgeHouse.asm @@ -1,5 +1,5 @@ CeruleanBadgeHouse_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a dec a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 600c03c7..465c72f8 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -1,5 +1,5 @@ Museum1F_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 89d6ef80..71704c5b 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -1,7 +1,7 @@ OaksLab_Script: CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2 call nz, OaksLabLoadTextPointers2Script - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/PewterMart.asm b/scripts/PewterMart.asm index 0a5baac2..49a91977 100644 --- a/scripts/PewterMart.asm +++ b/scripts/PewterMart.asm @@ -1,6 +1,6 @@ PewterMart_Script: call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a ret diff --git a/scripts/SSAnne2FRooms.asm b/scripts/SSAnne2FRooms.asm index e7b88b3f..3358759d 100644 --- a/scripts/SSAnne2FRooms.asm +++ b/scripts/SSAnne2FRooms.asm @@ -1,5 +1,5 @@ SSAnne2FRooms_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a -- cgit v1.3.1-sl0p From b5d2540e7c56d7ae596ba49d105b1a01dd6ffd29 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 24 Sep 2024 09:33:33 -0400 Subject: Identify more bit flags (#465) * Identify more bit flags * Space --- .../events/hidden_objects/indigo_plateau_statues.asm | 2 +- engine/gfx/mon_icons.asm | 2 +- engine/gfx/screen_effects.asm | 2 +- engine/movie/oak_speech/oak_speech.asm | 4 ++-- engine/overworld/map_sprites.asm | 4 ++-- engine/overworld/movement.asm | 4 ++-- engine/overworld/player_state.asm | 20 ++++++++++++++------ engine/overworld/spinners.asm | 2 +- home/overworld.asm | 2 +- home/pokemon.asm | 2 +- home/serial.asm | 2 +- home/uncompress.asm | 19 ++++++++++++------- scripts/VictoryRoad2F.asm | 2 +- 13 files changed, 40 insertions(+), 27 deletions(-) (limited to 'engine/overworld/movement.asm') diff --git a/engine/events/hidden_objects/indigo_plateau_statues.asm b/engine/events/hidden_objects/indigo_plateau_statues.asm index 23e94fcf..f78a5a72 100644 --- a/engine/events/hidden_objects/indigo_plateau_statues.asm +++ b/engine/events/hidden_objects/indigo_plateau_statues.asm @@ -3,7 +3,7 @@ IndigoPlateauStatues:: ld hl, IndigoPlateauStatuesText1 call PrintText ld a, [wXCoord] - bit 0, a + bit 0, a ; even or odd? ld hl, IndigoPlateauStatuesText2 jr nz, .ok ld hl, IndigoPlateauStatuesText3 diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index e7016a1d..24e9446e 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -269,7 +269,7 @@ GetPartyMonSpriteID: ld d, 0 add hl, de ld a, [hl] - bit 0, c + bit 0, c ; even or odd? jr nz, .skipSwap swap a ; use lower nybble if pokedex num is even .skipSwap diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index c7a68734..7d0ccf7e 100644 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -61,7 +61,7 @@ PredefShakeScreenHorizontally: ldh a, [hMutateWX] xor b ldh [hMutateWX], a - bit 7, a + bit 7, a ; negative? jr z, .skipZeroing xor a ; zero a if it's negative .skipZeroing diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 44b236c8..5c364435 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -4,9 +4,9 @@ PrepareOakSpeech: ld a, [wOptions] push af ; Retrieve BIT_DEBUG_MODE set in DebugMenu for StartNewGameDebug. - ; BUG: StartNewGame carries over bit 5 from previous save files, + ; BUG: StartNewGame carries over BIT_ALWAYS_ON_BIKE from previous save files, ; which causes CheckForceBikeOrSurf to not return. - ; To fix this in debug builds, reset bit 5 here or in StartNewGame. + ; To fix this in debug builds, reset BIT_ALWAYS_ON_BIKE here or in StartNewGame. ; In non-debug builds, the instructions can be removed. ld a, [wStatusFlags6] push af diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 75c46474..57c2d4db 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -187,7 +187,7 @@ LoadMapSpriteTilePatterns: jr nz, .loadWhileLCDOn pop af pop hl - set 3, h ; add $80 tiles to hl + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) push hl ld h, d ld l, e @@ -200,7 +200,7 @@ LoadMapSpriteTilePatterns: .loadWhileLCDOn pop af pop hl - set 3, h ; add $80 tiles to hl + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) ld b, a swap c call CopyVideoData ; load tile pattern data for sprite when walking diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 5f95cf6c..cb65c997 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -641,7 +641,7 @@ CanWalkOntoTile: add SPRITESTATEDATA2_YDISPLACEMENT ld l, a ld a, [hli] ; x#SPRITESTATEDATA2_YDISPLACEMENT (initialized at $8, keep track of where a sprite did go) - bit 7, d ; check if going upwards (d=$ff) + bit 7, d ; check if going upwards (d == -1) jr nz, .upwards add d ; bug: these tests against $5 probably were supposed to prevent @@ -658,7 +658,7 @@ CanWalkOntoTile: .checkHorizontal ld d, a ld a, [hl] ; x#SPRITESTATEDATA2_XDISPLACEMENT (initialized at $8, keep track of where a sprite did go) - bit 7, e ; check if going left (e=$ff) + bit 7, e ; check if going left (e == -1) jr nz, .left add e cp $5 ; compare, but no conditional jump like in the vertical check above (bug?) diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 4711bb5c..4da437da 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -294,6 +294,13 @@ _GetTileAndCoordsInFrontOfPlayer: ld [wTileInFrontOfPlayer], a ret +; hPlayerFacing + const_def + const BIT_FACING_DOWN ; 0 + const BIT_FACING_UP ; 1 + const BIT_FACING_LEFT ; 2 + const BIT_FACING_RIGHT ; 3 + GetTileTwoStepsInFrontOfPlayer: xor a ldh [hPlayerFacing], a @@ -306,7 +313,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingDown ; facing down ld hl, hPlayerFacing - set 0, [hl] + set BIT_FACING_DOWN, [hl] lda_coord 8, 13 inc d jr .storeTile @@ -315,7 +322,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingUp ; facing up ld hl, hPlayerFacing - set 1, [hl] + set BIT_FACING_UP, [hl] lda_coord 8, 5 dec d jr .storeTile @@ -324,7 +331,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingLeft ; facing left ld hl, hPlayerFacing - set 2, [hl] + set BIT_FACING_LEFT, [hl] lda_coord 4, 9 dec e jr .storeTile @@ -333,7 +340,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .storeTile ; facing right ld hl, hPlayerFacing - set 3, [hl] + set BIT_FACING_RIGHT, [hl] lda_coord 12, 9 inc e .storeTile @@ -385,7 +392,7 @@ CheckForBoulderCollisionWithSprites: ld de, $f ld hl, wSprite01StateData2MapY ldh a, [hPlayerFacing] - and $3 ; facing up or down? + and (1 << BIT_FACING_UP) | (1 << BIT_FACING_DOWN) jr z, .pushingHorizontallyLoop .pushingVerticallyLoop inc hl @@ -396,6 +403,7 @@ CheckForBoulderCollisionWithSprites: ld a, [hli] ld b, a ldh a, [hPlayerFacing] + assert BIT_FACING_DOWN == 0 rrca jr c, .pushingDown ; pushing up @@ -421,7 +429,7 @@ CheckForBoulderCollisionWithSprites: jr nz, .nextSprite2 ld b, [hl] ldh a, [hPlayerFacing] - bit 2, a + bit BIT_FACING_LEFT, a jr nz, .pushingLeft ; pushing right ldh a, [hPlayerXCoord] diff --git a/engine/overworld/spinners.asm b/engine/overworld/spinners.asm index 98b478c4..261a939e 100644 --- a/engine/overworld/spinners.asm +++ b/engine/overworld/spinners.asm @@ -15,7 +15,7 @@ LoadSpinnerArrowTiles:: ld hl, GymSpinnerArrows .gotSpinnerArrows ld a, [wSimulatedJoypadStatesIndex] - bit 0, a + bit 0, a ; even or odd? jr nz, .alternateGraphics ld de, 6 * 4 add hl, de diff --git a/home/overworld.asm b/home/overworld.asm index e43ebc81..85969e46 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -2002,7 +2002,7 @@ LoadPlayerSpriteGraphicsCommon:: jr nc, .noCarry inc d .noCarry - set 3, h + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) lb bc, BANK(RedSprite), $0c jp CopyVideoData diff --git a/home/pokemon.asm b/home/pokemon.asm index 54d69bba..7cc5f2d1 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -252,7 +252,7 @@ HandlePartyMenuInput:: jp nz, .swappingPokemon pop af ldh [hTileAnimations], a - bit 1, b + bit BIT_B_BUTTON, b jr nz, .noPokemonChosen ld a, [wPartyCount] and a diff --git a/home/serial.asm b/home/serial.asm index f44772df..58111de6 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -30,7 +30,7 @@ Serial:: ldh [rDIV], a .waitLoop ldh a, [rDIV] - bit 7, a + bit 7, a ; wait until rDIV has incremented from $3 to $80 or more jr nz, .waitLoop ld a, START_TRANSFER_EXTERNAL_CLOCK ldh [rSC], a diff --git a/home/uncompress.asm b/home/uncompress.asm index 0e609f1c..9e434497 100644 --- a/home/uncompress.asm +++ b/home/uncompress.asm @@ -1,3 +1,8 @@ +; wSpriteLoadFlags bits, streamed from compressed sprite data + const_def + const BIT_USE_SPRITE_BUFFER_2 ; 0 + const BIT_LAST_SPRITE_CHUNK ; 1 + ; bankswitches and runs _UncompressSpriteData ; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr UncompressSpriteData:: @@ -47,7 +52,7 @@ _UncompressSpriteData:: add a ld [wSpriteWidth], a call ReadNextInputBit - ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit + ld [wSpriteLoadFlags], a ; initialize bit1 to 0 and bit0 to the first input bit ; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2 ; bit 0 decides in which one the first chunk is placed ; fall through @@ -58,13 +63,13 @@ _UncompressSpriteData:: UncompressSpriteDataLoop:: ld hl, sSpriteBuffer1 ld a, [wSpriteLoadFlags] - bit 0, a + bit BIT_USE_SPRITE_BUFFER_2, a jr z, .useSpriteBuffer1 ; check which buffer to use ld hl, sSpriteBuffer2 .useSpriteBuffer1 call StoreSpriteOutputPointer ld a, [wSpriteLoadFlags] - bit 1, a + bit BIT_LAST_SPRITE_CHUNK, a jr z, .startDecompression ; check if last iteration call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode and a @@ -196,10 +201,10 @@ MoveToNextBufferPosition:: xor a ld [wSpriteCurPosX], a ld a, [wSpriteLoadFlags] - bit 1, a + bit BIT_LAST_SPRITE_CHUNK, a jr nz, .done ; test if there is one more sprite to go - xor $1 - set 1, a + xor 1 << BIT_USE_SPRITE_BUFFER_2 + set BIT_LAST_SPRITE_CHUNK, a ld [wSpriteLoadFlags], a jp UncompressSpriteDataLoop .done @@ -540,7 +545,7 @@ ReverseNybble:: ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags ResetSpriteBufferPointers:: ld a, [wSpriteLoadFlags] - bit 0, a + bit BIT_USE_SPRITE_BUFFER_2, a jr nz, .buffer2Selected ld de, sSpriteBuffer1 ld hl, sSpriteBuffer2 diff --git a/scripts/VictoryRoad2F.asm b/scripts/VictoryRoad2F.asm index 347d16a5..5e31da7a 100644 --- a/scripts/VictoryRoad2F.asm +++ b/scripts/VictoryRoad2F.asm @@ -27,7 +27,7 @@ VictoryRoad2FCheckBoulderEventScript: call VictoryRoad2FReplaceTileBlockScript pop af .not_on_switch - bit 7, a + CheckEventReuseA EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ret z ld a, $1d lb bc, 7, 11 -- cgit v1.3.1-sl0p