Separate disabling space events and tile events so they aren't mutually exclusive in the same step (#25)

This commit is contained in:
xCrystal 2023-10-17 16:24:04 +02:00
parent 7448da8380
commit a31c114382
2 changed files with 23 additions and 12 deletions

View File

@ -35,6 +35,16 @@ EnableEvents::
ld [wScriptFlags2], a ld [wScriptFlags2], a
ret ret
DisableTileEvents:
; DisableWarpsConnxns + DisableCoordEvents + DisableStepCount + DisableWildEncounters
push af
ld hl, wScriptFlags2
ld a, [hl]
and ~((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3))
ld [hl], a
pop af
ret
DisableWarpsConnxns: ; unreferenced DisableWarpsConnxns: ; unreferenced
ld hl, wScriptFlags2 ld hl, wScriptFlags2
res 2, [hl] res 2, [hl]
@ -52,12 +62,12 @@ DisableStepCount: ; unreferenced
DisableWildEncounters: ; unreferenced DisableWildEncounters: ; unreferenced
ld hl, wScriptFlags2 ld hl, wScriptFlags2
res 4, [hl] res 3, [hl]
ret ret
DisableSpaceEffects: ; unreferenced DisableSpaceEffects:
ld hl, wScriptFlags2 ld hl, wScriptFlags2
res 5, [hl] res 4, [hl]
ret ret
EnableWarpsConnxns: ; unreferenced EnableWarpsConnxns: ; unreferenced
@ -77,12 +87,12 @@ EnableStepCount: ; unreferenced
EnableWildEncounters: EnableWildEncounters:
ld hl, wScriptFlags2 ld hl, wScriptFlags2
set 4, [hl] set 3, [hl]
ret ret
EnableSpaceEffects: ; unreferenced EnableSpaceEffects: ; unreferenced
ld hl, wScriptFlags2 ld hl, wScriptFlags2
set 5, [hl] set 4, [hl]
ret ret
CheckWarpConnxnScriptFlag: CheckWarpConnxnScriptFlag:
@ -102,12 +112,12 @@ CheckStepCountScriptFlag:
CheckWildEncountersScriptFlag: CheckWildEncountersScriptFlag:
ld hl, wScriptFlags2 ld hl, wScriptFlags2
bit 4, [hl] bit 3, [hl]
ret ret
CheckSpaceEffects: CheckSpaceEffectsScriptFlag:
ld hl, wScriptFlags2 ld hl, wScriptFlags2
bit 5, [hl] bit 4, [hl]
ret ret
; on enter overworld loop ; on enter overworld loop
@ -187,7 +197,6 @@ MapEvents:
.events: .events:
call PlayerEvents call PlayerEvents
call DisableEvents
farcall ScriptEvents farcall ScriptEvents
ret ret
@ -264,12 +273,14 @@ PlayerEvents:
ret nz ret nz
call CheckBoardEvent call CheckBoardEvent
call DisableSpaceEffects ; doesn't alter f
jr c, .ok jr c, .ok
call CheckTrainerEvent call CheckTrainerEvent
jr c, .ok jr c, .ok
call CheckTileEvent call CheckTileEvent
call DisableTileEvents ; preserves f
jr c, .ok jr c, .ok
call RunMemScript call RunMemScript
@ -332,7 +343,7 @@ CheckBoardEvent:
ret ret
.board .board
call CheckSpaceEffects call CheckSpaceEffectsScriptFlag
jr z, .no_space_effect jr z, .no_space_effect
ld a, [wPlayerTile] ld a, [wPlayerTile]
and $f0 and $f0

View File

@ -2189,8 +2189,8 @@ wScriptFlags2::
; bit 0: count steps ; bit 0: count steps
; bit 1: coord events ; bit 1: coord events
; bit 2: warps and connections ; bit 2: warps and connections
; bit 4: wild encounters ; bit 3: wild encounters
; bit 5: space effects ; bit 4: space effects
db db
wScriptMode:: db wScriptMode:: db