Rename wVramState to wStateFlags and use flag constants (#1078)

This commit is contained in:
xCrystal
2024-01-07 14:27:22 +01:00
parent 5be9856f3a
commit f72f078c0e
31 changed files with 125 additions and 120 deletions

View File

@@ -1941,7 +1941,7 @@ FinishExitMenu::
ReturnToMapWithSpeechTextbox::
push af
ld a, $1
ld a, TRUE
ld [wSpriteUpdatesEnabled], a
call ClearBGPalettes
call ClearSprites
@@ -1949,8 +1949,8 @@ ReturnToMapWithSpeechTextbox::
hlcoord 0, 12
lb bc, 4, 18
call Textbox
ld hl, wVramState
set 0, [hl]
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
call UpdateSprites
call WaitBGMap2
ld b, SCGB_MAPPALS

View File

@@ -412,8 +412,8 @@ LoadMovementDataPointer::
add hl, bc
ld [hl], STEP_TYPE_RESET
ld hl, wVramState
set 7, [hl]
ld hl, wStateFlags
set SCRIPTED_MOVEMENT_STATE_F, [hl]
and a
ret
@@ -574,19 +574,19 @@ _GetMovementIndex::
ld a, h
ret
SetVramState_Bit0:: ; unreferenced
ld hl, wVramState
set 0, [hl]
SetVramState_SpriteUpdatesDisabled:: ; unreferenced
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
ret
ResetVramState_Bit0:: ; unreferenced
ld hl, wVramState
res 0, [hl]
ResetVramState_SpriteUpdatesDisabled:: ; unreferenced
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
ret
UpdateSprites::
ld a, [wVramState]
bit 0, a
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a
ret z
farcall UpdateAllObjectsFrozen

View File

@@ -17,8 +17,8 @@ ScrollingMenu::
ret
.UpdatePalettes:
ld hl, wVramState
bit 0, [hl]
ld hl, wStateFlags
bit SPRITE_UPDATES_DISABLED_F, [hl]
jp nz, UpdateTimePals
jp SetDefaultBGPAndOBP

View File

@@ -1,19 +1,19 @@
DisableSpriteUpdates::
xor a
ldh [hMapAnims], a
ld a, [wVramState]
res 0, a
ld [wVramState], a
ld a, $0
ld a, [wStateFlags]
res SPRITE_UPDATES_DISABLED_F, a
ld [wStateFlags], a
ld a, FALSE
ld [wSpriteUpdatesEnabled], a
ret
EnableSpriteUpdates::
ld a, $1
ld a, TRUE
ld [wSpriteUpdatesEnabled], a
ld a, [wVramState]
set 0, a
ld [wVramState], a
ld a, $1
ld a, [wStateFlags]
set SPRITE_UPDATES_DISABLED_F, a
ld [wStateFlags], a
ld a, TRUE
ldh [hMapAnims], a
ret

View File

@@ -37,7 +37,7 @@ ApplyTilemap::
jr z, .dmg
ld a, [wSpriteUpdatesEnabled]
cp 0
cp FALSE
jr z, .dmg
ld a, 1

View File

@@ -3,14 +3,14 @@ UpdateTimeAndPals::
; rtc enabled?
ld a, [wSpriteUpdatesEnabled]
cp 0
cp FALSE
ret z
call UpdateTime
; obj update on?
ld a, [wVramState]
bit 0, a ; obj update
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a ; obj update
ret z
TimeOfDayPals::

View File

@@ -23,8 +23,8 @@ CloseText::
pop af
ldh [hOAMUpdate], a
ld hl, wVramState
res 6, [hl]
ld hl, wStateFlags
res TEXT_STATE_F, [hl]
ret
.CloseText: