From 86a32a48b3855373c774d64a1103bcafbb199b8d Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 24 Sep 2024 01:44:20 -0400 Subject: [PATCH 1/2] Identify `wCurrentMapScriptFlags` bits --- constants/ram_constants.asm | 6 ++++++ engine/events/card_key.asm | 2 +- engine/events/elevator.asm | 2 +- engine/events/hidden_objects/cinnabar_gym_quiz.asm | 2 +- engine/events/hidden_objects/vermilion_gym_trash.asm | 2 +- engine/menus/main_menu.asm | 2 +- home/overworld.asm | 8 ++++---- home/trainers.asm | 4 ++-- ram/wram.asm | 5 ++++- scripts/AgathasRoom.asm | 4 ++-- scripts/BrunosRoom.asm | 4 ++-- scripts/CeladonGym.asm | 4 ++-- scripts/CeladonMartElevator.asm | 8 ++++---- scripts/CeruleanGym.asm | 4 ++-- scripts/CinnabarGym.asm | 10 +++++----- scripts/CinnabarIsland.asm | 2 +- scripts/FuchsiaGym.asm | 4 ++-- scripts/GameCorner.asm | 12 ++++++------ scripts/IndigoPlateauLobby.asm | 4 ++-- scripts/LancesRoom.asm | 6 +++--- scripts/LoreleisRoom.asm | 4 ++-- scripts/PewterGym.asm | 4 ++-- scripts/PokemonMansion1F.asm | 6 +++--- scripts/PokemonMansion2F.asm | 6 +++--- scripts/PokemonMansion3F.asm | 4 ++-- scripts/PokemonMansionB1F.asm | 4 ++-- scripts/RocketHideoutB1F.asm | 4 ++-- scripts/RocketHideoutB4F.asm | 6 +++--- scripts/RocketHideoutElevator.asm | 8 ++++---- scripts/Route23.asm | 4 ++-- scripts/Route25.asm | 4 ++-- scripts/SaffronGym.asm | 4 ++-- scripts/SilphCo10F.asm | 4 ++-- scripts/SilphCo11F.asm | 4 ++-- scripts/SilphCo2F.asm | 4 ++-- scripts/SilphCo3F.asm | 4 ++-- scripts/SilphCo4F.asm | 4 ++-- scripts/SilphCo5F.asm | 4 ++-- scripts/SilphCo6F.asm | 4 ++-- scripts/SilphCo7F.asm | 4 ++-- scripts/SilphCo8F.asm | 4 ++-- scripts/SilphCo9F.asm | 4 ++-- scripts/SilphCoElevator.asm | 8 ++++---- scripts/VermilionCity.asm | 8 ++++---- scripts/VermilionGym.asm | 8 ++++---- scripts/VictoryRoad1F.asm | 6 +++--- scripts/VictoryRoad2F.asm | 10 +++++----- scripts/VictoryRoad3F.asm | 6 +++--- 48 files changed, 124 insertions(+), 115 deletions(-) diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm index 8102cc7e5d..756aaa68f5 100644 --- a/constants/ram_constants.asm +++ b/constants/ram_constants.asm @@ -23,6 +23,12 @@ DEF BIT_TEXT_PREDEF EQU 0 ; wFontLoaded DEF BIT_FONT_LOADED EQU 0 +; wCurrentMapScriptFlags + const_def 5 + const BIT_CUR_MAP_LOADED_1 ; 5 + const BIT_CUR_MAP_LOADED_2 ; 6 + const BIT_CUR_MAP_USED_ELEVATOR ; 7 + ; wOptions DEF TEXT_DELAY_MASK EQU %111 const_def 6 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index 1597e12be7..f3fa17fe0c 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -50,7 +50,7 @@ PrintCardKeyText: ld [wNewTileBlockID], a predef ReplaceTileBlock ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SFX_GO_INSIDE jp PlaySound .noCardKey diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 8e871456ed..9d9b712a9d 100644 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -20,7 +20,7 @@ DisplayElevatorFloorMenu: ld [wListScrollOffset], a ret c ld hl, wCurrentMapScriptFlags - set 7, [hl] + set BIT_CUR_MAP_USED_ELEVATOR, [hl] ld hl, wElevatorWarpMaps ld a, [wWhichPokemon] add a diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index 69f03f2c3b..a14bd19887 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -83,7 +83,7 @@ CinnabarGymQuiz_AskQuestion: cp c jr nz, .wrongAnswer ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ldh a, [hGymGateIndex] ldh [hBackupGymGateIndex], a ld hl, CinnabarGymQuizCorrectText diff --git a/engine/events/hidden_objects/vermilion_gym_trash.asm b/engine/events/hidden_objects/vermilion_gym_trash.asm index c2bfed0670..92fb1406bb 100644 --- a/engine/events/hidden_objects/vermilion_gym_trash.asm +++ b/engine/events/hidden_objects/vermilion_gym_trash.asm @@ -97,7 +97,7 @@ GymTrashScript: ; Completed the trash can puzzle. SetEvent EVENT_2ND_LOCK_OPENED ld hl, wCurrentMapScriptFlags - set 6, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] tx_pre_id VermilionGymTrashSuccessText3 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index df9f523fd6..8bd6f05ec4 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -91,7 +91,7 @@ MainMenu: .choseContinue call DisplayContinueGameInfo ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] .inputLoop xor a ldh [hJoyPressed], a diff --git a/home/overworld.asm b/home/overworld.asm index 85969e46e3..80638815ee 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -33,8 +33,8 @@ EnterMap:: res BIT_NO_NPC_FACE_PLAYER, [hl] call UpdateSprites ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] xor a ld [wJoyIgnore], a @@ -329,8 +329,8 @@ OverworldLoopLessDelay:: ld hl, wStatusFlags7 res BIT_TRAINER_BATTLE, [hl] ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] xor a ldh [hJoyHeld], a ld a, [wCurMap] diff --git a/home/trainers.asm b/home/trainers.asm index 0a466cc1e6..bcd158508d 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -184,8 +184,8 @@ StartTrainerBattle:: EndTrainerBattle:: ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] ld hl, wStatusFlags3 res BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, wMiscFlags diff --git a/ram/wram.asm b/ram/wram.asm index 48616226cb..510502e866 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1593,7 +1593,10 @@ wIsKeyItem:: db wTextBoxID:: db -wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value +; bit 5:set when maps first load; can be reset to re-run a script +; bit 6: set when maps first load; can be reset to re-run a script (used less often than bit 5) +; bit 7: set when using an elevator map's menu; sets of the shaking animation +wCurrentMapScriptFlags:: db wCurEnemyLevel:: db diff --git a/scripts/AgathasRoom.asm b/scripts/AgathasRoom.asm index 0f3acc18cd..2d0dca0823 100644 --- a/scripts/AgathasRoom.asm +++ b/scripts/AgathasRoom.asm @@ -11,8 +11,8 @@ AgathasRoom_Script: AgathaShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_BEAT_AGATHAS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom diff --git a/scripts/BrunosRoom.asm b/scripts/BrunosRoom.asm index 94ec7d17ec..6d7fde6e2a 100644 --- a/scripts/BrunosRoom.asm +++ b/scripts/BrunosRoom.asm @@ -11,8 +11,8 @@ BrunosRoom_Script: BrunoShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index ca7da4e504..f95d129a8e 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -1,7 +1,7 @@ CeladonGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, CeladonGymTrainerHeaders diff --git a/scripts/CeladonMartElevator.asm b/scripts/CeladonMartElevator.asm index 9a2842f320..69686fa8c3 100644 --- a/scripts/CeladonMartElevator.asm +++ b/scripts/CeladonMartElevator.asm @@ -1,12 +1,12 @@ CeladonMartElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, CeladonMartElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, CeladonMartElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 37d5e40599..e924907add 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -1,7 +1,7 @@ CeruleanGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, CeruleanGymTrainerHeaders diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index b7c9e1babd..efda64a5a1 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -7,13 +7,13 @@ CinnabarGym_Script: CinnabarGymSetMapAndTiles: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] push hl call nz, .LoadNames pop hl - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, UpdateCinnabarGymGateTileBlocks ResetEvent EVENT_2A7 ret @@ -170,7 +170,7 @@ CinnabarGymReceiveTM38: SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6 ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] jp CinnabarGymResetScripts diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index ed38f69022..f2a36afb3d 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -1,7 +1,7 @@ CinnabarIsland_Script: call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ResetEvent EVENT_MANSION_SWITCH_ON ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL ld hl, CinnabarIsland_ScriptPointers diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 8ccebe4093..c983c896d8 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -10,8 +10,8 @@ FuchsiaGym_Script: .LoadNames: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ld hl, .CityName ld de, .LeaderName diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 5d5236c5ff..cac3170c1b 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -8,8 +8,8 @@ GameCorner_Script: GameCornerSelectLuckySlotMachine: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z call Random ldh a, [hRandomAdd] @@ -25,8 +25,8 @@ GameCornerSelectLuckySlotMachine: GameCornerSetRocketHideoutDoorTile: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_FOUND_ROCKET_HIDEOUT ret nz @@ -111,8 +111,8 @@ GameCornerRocketExitScript: ld [wMissableObjectIndex], a predef HideObject ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] ld a, SCRIPT_GAMECORNER_DEFAULT ld [wGameCornerCurScript], a ret diff --git a/scripts/IndigoPlateauLobby.asm b/scripts/IndigoPlateauLobby.asm index fd8ecf3cc1..8ac87030fd 100644 --- a/scripts/IndigoPlateauLobby.asm +++ b/scripts/IndigoPlateauLobby.asm @@ -2,8 +2,8 @@ IndigoPlateauLobby_Script: call Serial_TryEstablishingExternallyClockedConnection call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ; Reset Elite Four events if the player started challenging them before diff --git a/scripts/LancesRoom.asm b/scripts/LancesRoom.asm index 31b0f24088..235deac1b7 100644 --- a/scripts/LancesRoom.asm +++ b/scripts/LancesRoom.asm @@ -10,8 +10,8 @@ LancesRoom_Script: LanceShowOrHideEntranceBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR jr nz, .closeEntrance @@ -71,7 +71,7 @@ LancesRoomDefaultScript: CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR ret nz ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SFX_GO_INSIDE call PlaySound jp LanceShowOrHideEntranceBlocks diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index ec88f73e41..455561b809 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -11,8 +11,8 @@ LoreleisRoom_Script: LoreleiShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, wElite4Flags set BIT_STARTED_ELITE_4, [hl] diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index 0029be19da..6c4c944312 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -1,7 +1,7 @@ PewterGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, PewterGymTrainerHeaders diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index a93bd33b30..d06a234a92 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -10,8 +10,8 @@ PokemonMansion1F_Script: Mansion1CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn @@ -103,7 +103,7 @@ PokemonMansion1FSwitchText: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld hl, .PressedText call PrintText ld a, SFX_GO_INSIDE diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index df424a1996..7da9e50f0b 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -10,8 +10,8 @@ PokemonMansion2F_Script: Mansion2CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn @@ -108,7 +108,7 @@ PokemonMansion2FSwitchText: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld hl, .PressedText call PrintText ld a, SFX_GO_INSIDE diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index f534744671..de8bd1dd4e 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -10,8 +10,8 @@ PokemonMansion3F_Script: Mansion3CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index e359621d61..e31bbd3eb7 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -10,8 +10,8 @@ PokemonMansionB1F_Script: MansionB1FCheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn diff --git a/scripts/RocketHideoutB1F.asm b/scripts/RocketHideoutB1F.asm index f6c64bdaff..9354a0c72e 100644 --- a/scripts/RocketHideoutB1F.asm +++ b/scripts/RocketHideoutB1F.asm @@ -10,8 +10,8 @@ RocketHideoutB1F_Script: RocketHideoutB1FDoorCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_677 jr nz, .door_open diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 920aa0898d..2c630067ff 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -10,8 +10,8 @@ RocketHideoutB4F_Script: RocketHideoutB4FDoorCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED jr nz, .door_already_unlocked @@ -67,7 +67,7 @@ RocketHideoutB4FBeatGiovanniScript: xor a ld [wJoyIgnore], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SCRIPT_ROCKETHIDEOUTB4F_DEFAULT ld [wRocketHideoutB4FCurScript], a ld [wCurMapScript], a diff --git a/scripts/RocketHideoutElevator.asm b/scripts/RocketHideoutElevator.asm index 71ff0758a0..bd6fb49879 100644 --- a/scripts/RocketHideoutElevator.asm +++ b/scripts/RocketHideoutElevator.asm @@ -1,12 +1,12 @@ RocketHideoutElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, RocketHideoutElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, RocketHideoutElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/Route23.asm b/scripts/Route23.asm index ffd968dfa1..ac4853d84d 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -7,8 +7,8 @@ Route23_Script: Route23SetVictoryRoadBoulders: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ResetEvents EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ResetEvents EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 diff --git a/scripts/Route25.asm b/scripts/Route25.asm index ef0e8fd2db..a85144a870 100644 --- a/scripts/Route25.asm +++ b/scripts/Route25.asm @@ -10,8 +10,8 @@ Route25_Script: Route25ShowHideBillScript: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z CheckEventHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ret nz diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 556cd4c572..4bfb7b2c7d 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -1,7 +1,7 @@ SaffronGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, SaffronGymTrainerHeaders diff --git a/scripts/SilphCo10F.asm b/scripts/SilphCo10F.asm index 7cc2c58e76..d9650bc82e 100644 --- a/scripts/SilphCo10F.asm +++ b/scripts/SilphCo10F.asm @@ -10,8 +10,8 @@ SilphCo10F_Script: SilphCo10FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index d5e4cb08d0..6953d37c99 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -10,8 +10,8 @@ SilphCo11F_Script: SilphCo11FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, SilphCo11GateCoords call SilphCo11F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo2F.asm b/scripts/SilphCo2F.asm index 52241b95f0..7ca57c4564 100644 --- a/scripts/SilphCo2F.asm +++ b/scripts/SilphCo2F.asm @@ -10,8 +10,8 @@ SilphCo2F_Script: SilphCo2FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo3F.asm b/scripts/SilphCo3F.asm index df9df9e8ce..146cbb0725 100644 --- a/scripts/SilphCo3F.asm +++ b/scripts/SilphCo3F.asm @@ -10,8 +10,8 @@ SilphCo3F_Script: SilphCo3FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo4F.asm b/scripts/SilphCo4F.asm index 91453d653c..f84ef9958e 100644 --- a/scripts/SilphCo4F.asm +++ b/scripts/SilphCo4F.asm @@ -10,8 +10,8 @@ SilphCo4F_Script: SilphCo4FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo5F.asm b/scripts/SilphCo5F.asm index 1834bfa846..599c17430a 100644 --- a/scripts/SilphCo5F.asm +++ b/scripts/SilphCo5F.asm @@ -10,8 +10,8 @@ SilphCo5F_Script: SilphCo5FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo6F.asm b/scripts/SilphCo6F.asm index 0626ffdbdc..ad8e83f43f 100644 --- a/scripts/SilphCo6F.asm +++ b/scripts/SilphCo6F.asm @@ -10,8 +10,8 @@ SilphCo6F_Script: SilphCo6F_GateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index 381eff7a35..bf517d29ce 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -10,8 +10,8 @@ SilphCo7F_Script: SilphCo7F_GateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo7F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo8F.asm b/scripts/SilphCo8F.asm index cdd7f486fe..dcba85c036 100644 --- a/scripts/SilphCo8F.asm +++ b/scripts/SilphCo8F.asm @@ -10,8 +10,8 @@ SilphCo8F_Script: SilphCo8FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo8F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo9F.asm b/scripts/SilphCo9F.asm index fe7f3da289..aec4dbf8fe 100644 --- a/scripts/SilphCo9F.asm +++ b/scripts/SilphCo9F.asm @@ -10,8 +10,8 @@ SilphCo9F_Script: SilphCo9FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo9F_SetCardKeyDoorYScript diff --git a/scripts/SilphCoElevator.asm b/scripts/SilphCoElevator.asm index a2ed009e62..ffdf101eea 100644 --- a/scripts/SilphCoElevator.asm +++ b/scripts/SilphCoElevator.asm @@ -1,12 +1,12 @@ SilphCoElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, SilphCoElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, SilphCoElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/VermilionCity.asm b/scripts/VermilionCity.asm index fd5905df3d..40a08dbca0 100644 --- a/scripts/VermilionCity.asm +++ b/scripts/VermilionCity.asm @@ -1,13 +1,13 @@ VermilionCity_Script: call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] push hl call nz, VermilionCityLeftSSAnneCallbackScript pop hl - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, .setFirstLockTrashCanIndex ld hl, VermilionCity_ScriptPointers ld a, [wVermilionCityCurScript] diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index d7828e4296..8d3a33b6cb 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -1,12 +1,12 @@ VermilionGym_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, .LoadNames pop hl - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, VermilionGymSetDoorTile call EnableAutoTextBoxDrawing ld hl, VermilionGymTrainerHeaders diff --git a/scripts/VictoryRoad1F.asm b/scripts/VictoryRoad1F.asm index e80e17d51e..554ae39fc1 100644 --- a/scripts/VictoryRoad1F.asm +++ b/scripts/VictoryRoad1F.asm @@ -1,7 +1,7 @@ VictoryRoad1F_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, .next call EnableAutoTextBoxDrawing ld hl, VictoryRoad1TrainerHeaders @@ -31,7 +31,7 @@ VictoryRoad1FDefaultScript: call CheckBoulderCoords jp nc, CheckFightingMapTrainers ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] SetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ret diff --git a/scripts/VictoryRoad2F.asm b/scripts/VictoryRoad2F.asm index 5e31da7ae9..8535624706 100644 --- a/scripts/VictoryRoad2F.asm +++ b/scripts/VictoryRoad2F.asm @@ -1,11 +1,11 @@ VictoryRoad2F_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, VictoryRoad2FResetBoulderEventScript ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, VictoryRoad2FCheckBoulderEventScript call EnableAutoTextBoxDrawing ld hl, VictoryRoad2TrainerHeaders @@ -60,7 +60,7 @@ VictoryRoad2FDefaultScript: ret nz .set_script_flag ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ret .SwitchCoords: diff --git a/scripts/VictoryRoad3F.asm b/scripts/VictoryRoad3F.asm index e9295a153d..2b1b11c02c 100644 --- a/scripts/VictoryRoad3F.asm +++ b/scripts/VictoryRoad3F.asm @@ -10,8 +10,8 @@ VictoryRoad3F_Script: VictoryRoad3FCheckBoulderEventScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEventHL EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ret z @@ -38,7 +38,7 @@ VictoryRoad3FDefaultScript: cp $1 jr nz, .handle_hole ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] SetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ret .handle_hole From 2aa9d4c70ed187b97a715effa7a17978be85848d Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 24 Sep 2024 11:33:47 -0400 Subject: [PATCH 2/2] Fix comment --- ram/wram.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index 510502e866..c94c682f93 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1593,9 +1593,9 @@ wIsKeyItem:: db wTextBoxID:: db -; bit 5:set when maps first load; can be reset to re-run a script +; bit 5: set when maps first load; can be reset to re-run a script ; bit 6: set when maps first load; can be reset to re-run a script (used less often than bit 5) -; bit 7: set when using an elevator map's menu; sets of the shaking animation +; bit 7: set when using an elevator map's menu; triggers the shaking animation wCurrentMapScriptFlags:: db wCurEnemyLevel:: db