diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 7d48938a2..fd9494050 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -22,8 +22,8 @@ DEF AUTO_INPUT EQU $ff const WILDMON ; 4 ; wGameTimerPaused:: -DEF GAME_TIMER_PAUSED_F EQU 0 -DEF GAME_TIMER_MOBILE_F EQU 7 +DEF GAME_TIMER_COUNTING_F EQU 0 +DEF GAME_TIMER_MOBILE_F EQU 7 ; wJoypadDisable:: DEF JOYPAD_DISABLE_MON_FAINT_F EQU 6 diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index c8408ba23..7d6e4a0de 100644 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -20,7 +20,7 @@ MomTriesToBuySomething:: ret nc ld b, BANK(.Script) ld de, .Script - farcall LoadScriptBDE + farcall LoadMemScript scf ret diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index a5b309b39..ac9e6cdf4 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -1366,7 +1366,7 @@ RockSmashScript: playsound SFX_STRENGTH earthquake 84 applymovementlasttalked MovementData_RockSmash - disappear -2 + disappear LAST_TALKED callasm RockMonEncounter readmem wTempWildMonSpecies diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index a20de6e03..617d6542a 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -462,7 +462,7 @@ FinishContinueFunction: ld [wDontPlayMapMusicOnReload], a ld [wLinkMode], a ld hl, wGameTimerPaused - set GAME_TIMER_PAUSED_F, [hl] + set GAME_TIMER_COUNTING_F, [hl] res GAME_TIMER_MOBILE_F, [hl] ld hl, wEnteredMapFromContinue set 1, [hl] diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 2db699761..15c73d852 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -32,7 +32,7 @@ MainMenu: call GetSGBLayout call SetDefaultBGPAndOBP ld hl, wGameTimerPaused - res GAME_TIMER_PAUSED_F, [hl] + res GAME_TIMER_COUNTING_F, [hl] call MainMenu_GetWhichMenu ld [wWhichIndexSet], a call MainMenu_PrintCurrentTimeAndDay diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index fecb94945..4505adf30 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -22,76 +22,76 @@ OverworldLoop:: DisableEvents: xor a - ld [wScriptFlags2], a + ld [wEnabledPlayerEvents], a ret EnableEvents:: ld a, $ff - ld [wScriptFlags2], a + ld [wEnabledPlayerEvents], a ret -CheckBit5_ScriptFlags2: - ld hl, wScriptFlags2 +CheckEnabledMapEventsBit5: + ld hl, wEnabledPlayerEvents bit 5, [hl] ret -DisableWarpsConnxns: ; unreferenced - ld hl, wScriptFlags2 +DisableWarpsConnections: ; unreferenced + ld hl, wEnabledPlayerEvents res 2, [hl] ret DisableCoordEvents: ; unreferenced - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents res 1, [hl] ret DisableStepCount: ; unreferenced - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents res 0, [hl] ret DisableWildEncounters: ; unreferenced - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents res 4, [hl] ret -EnableWarpsConnxns: ; unreferenced - ld hl, wScriptFlags2 +EnableWarpsConnections: ; unreferenced + ld hl, wEnabledPlayerEvents set 2, [hl] ret EnableCoordEvents: ; unreferenced - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents set 1, [hl] ret EnableStepCount: ; unreferenced - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents set 0, [hl] ret EnableWildEncounters: - ld hl, wScriptFlags2 + ld hl, wEnabledPlayerEvents set 4, [hl] ret -CheckWarpConnxnScriptFlag: - ld hl, wScriptFlags2 +CheckWarpConnectionsEnabled: + ld hl, wEnabledPlayerEvents bit 2, [hl] ret -CheckCoordEventScriptFlag: - ld hl, wScriptFlags2 +CheckCoordEventsEnabled: + ld hl, wEnabledPlayerEvents bit 1, [hl] ret -CheckStepCountScriptFlag: - ld hl, wScriptFlags2 +CheckStepCountEnabled: + ld hl, wEnabledPlayerEvents bit 0, [hl] ret -CheckWildEncountersScriptFlag: - ld hl, wScriptFlags2 +CheckWildEncountersEnabled: + ld hl, wEnabledPlayerEvents bit 4, [hl] ret @@ -245,9 +245,9 @@ PlayerEvents: and a ret nz - call Dummy_CheckScriptFlags2Bit5 ; This is a waste of time + call Dummy_CheckEnabledMapEventsBit5 ; This is a waste of time - call CheckTrainerBattle_GetPlayerEvent + call CheckTrainerEvent jr c, .ok call CheckTileEvent @@ -288,7 +288,7 @@ PlayerEvents: scf ret -CheckTrainerBattle_GetPlayerEvent: +CheckTrainerEvent: nop nop call CheckTrainerBattle @@ -305,7 +305,7 @@ CheckTrainerBattle_GetPlayerEvent: CheckTileEvent: ; Check for warps, coord events, or wild battles. - call CheckWarpConnxnScriptFlag + call CheckWarpConnectionsEnabled jr z, .connections_disabled farcall CheckMovingOffEdgeOfMap @@ -315,21 +315,21 @@ CheckTileEvent: jr c, .warp_tile .connections_disabled - call CheckCoordEventScriptFlag + call CheckCoordEventsEnabled jr z, .coord_events_disabled call CheckCurrentMapCoordEvents jr c, .coord_event .coord_events_disabled - call CheckStepCountScriptFlag + call CheckStepCountEnabled jr z, .step_count_disabled call CountStep ret c .step_count_disabled - call CheckWildEncountersScriptFlag + call CheckWildEncountersEnabled jr z, .ok call RandomEncounter @@ -392,8 +392,8 @@ SetMinTwoStepWildEncounterCooldown: ld [wWildEncounterCooldown], a ret -Dummy_CheckScriptFlags2Bit5: - call CheckBit5_ScriptFlags2 +Dummy_CheckEnabledMapEventsBit5: + call CheckEnabledMapEventsBit5 ret z call SetXYCompareFlags ret @@ -1059,7 +1059,7 @@ RunMemScript:: pop af ret -LoadScriptBDE:: +LoadMemScript:: ; If there's already a script here, don't overwrite. ld hl, wMapReentryScriptQueueFlag ld a, [hl] @@ -1126,7 +1126,7 @@ TryTileCollisionEvent:: .done call PlayClickSFX - ld a, $ff + ld a, PLAYEREVENT_MAPSCRIPT scf ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 9219d50dc..c927eb6b0 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1195,7 +1195,7 @@ Script_reloadmapafterbattle: jr z, .done ld b, BANK(Script_SpecialBillCall) ld de, Script_SpecialBillCall - farcall LoadScriptBDE + farcall LoadMemScript .done jp Script_reloadmap @@ -2316,12 +2316,12 @@ Script_endall: Script_halloffame: ld hl, wGameTimerPaused - res GAME_TIMER_PAUSED_F, [hl] + res GAME_TIMER_COUNTING_F, [hl] farcall StubbedTrainerRankings_HallOfFame farcall StubbedTrainerRankings_HallOfFame2 farcall HallOfFame ld hl, wGameTimerPaused - set GAME_TIMER_PAUSED_F, [hl] + set GAME_TIMER_COUNTING_F, [hl] jr ReturnFromCredits Script_credits: diff --git a/home/game_time.asm b/home/game_time.asm index 5a6732414..749c0c6a5 100644 --- a/home/game_time.asm +++ b/home/game_time.asm @@ -33,7 +33,7 @@ GameTimer:: ; Is the timer paused? ld hl, wGameTimerPaused - bit GAME_TIMER_PAUSED_F, [hl] + bit GAME_TIMER_COUNTING_F, [hl] ret z ; Is the timer already capped? diff --git a/home/map.asm b/home/map.asm index d4f2fc047..cd6c66d14 100644 --- a/home/map.asm +++ b/home/map.asm @@ -252,12 +252,12 @@ GetDestinationWarpNumber:: ld a, [wPlayerMapX] sub 4 ld d, a - ld a, [wCurMapWarpCount] + ld a, [wCurMapWarpEventCount] and a ret z ld c, a - ld hl, wCurMapWarpsPointer + ld hl, wCurMapWarpEventsPointer ld a, [hli] ld h, [hl] ld l, a @@ -290,7 +290,7 @@ GetDestinationWarpNumber:: call .IncreaseHLTwice ret nc ; never encountered - ld a, [wCurMapWarpCount] + ld a, [wCurMapWarpEventCount] inc a sub c ld c, a @@ -317,7 +317,7 @@ CopyWarpData:: .CopyWarpData: push bc - ld hl, wCurMapWarpsPointer + ld hl, wCurMapWarpEventsPointer ld a, [hli] ld h, [hl] ld l, a @@ -406,7 +406,7 @@ ReadMapEvents:: ld l, a inc hl inc hl - call ReadWarps + call ReadWarpEvents call ReadCoordEvents call ReadBGEvents @@ -516,14 +516,14 @@ ReadMapCallbacks:: call AddNTimes ret -ReadWarps:: +ReadWarpEvents:: ld a, [hli] ld c, a - ld [wCurMapWarpCount], a + ld [wCurMapWarpEventCount], a ld a, l - ld [wCurMapWarpsPointer], a + ld [wCurMapWarpEventsPointer], a ld a, h - ld [wCurMapWarpsPointer + 1], a + ld [wCurMapWarpEventsPointer + 1], a ld a, c and a ret z diff --git a/home/stone_queue.asm b/home/stone_queue.asm index cb4c652c6..81b4a13f7 100644 --- a/home/stone_queue.asm +++ b/home/stone_queue.asm @@ -56,11 +56,11 @@ HandleStoneQueue:: ret .check_on_warp - ld hl, wCurMapWarpsPointer + ld hl, wCurMapWarpEventsPointer ld a, [hli] ld h, [hl] ld l, a - ld a, [wCurMapWarpCount] + ld a, [wCurMapWarpEventCount] and a jr z, .nope2 @@ -94,7 +94,7 @@ HandleStoneQueue:: .found_warp pop af ld d, a - ld a, [wCurMapWarpCount] + ld a, [wCurMapWarpEventCount] sub d inc a scf diff --git a/ram/wram.asm b/ram/wram.asm index 80f91fcbe..f72c70657 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2807,7 +2807,7 @@ wScriptFlags:: ; bit 3: run deferred script db ds 1 -wScriptFlags2:: +wEnabledPlayerEvents:: ; bit 0: count steps ; bit 1: coord events ; bit 2: warps and connections @@ -3179,8 +3179,8 @@ wBikeFlags:: wCurMapSceneScriptPointer:: dw wCurCaller:: dw -wCurMapWarpCount:: db -wCurMapWarpsPointer:: dw +wCurMapWarpEventCount:: db +wCurMapWarpEventsPointer:: dw wCurMapCoordEventCount:: db wCurMapCoordEventsPointer:: dw wCurMapBGEventCount:: db