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

@@ -8,10 +8,10 @@ INCBIN "gfx/tilesets/forest-tree/4.2bpp"
CelebiShrineEvent:
call DelayFrame
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
call LoadCelebiGFX
depixel 0, 10, 7, 0
ld a, SPRITE_ANIM_OBJ_CELEBI
@@ -49,7 +49,7 @@ CelebiShrineEvent:
.done
pop af
ld [wVramState], a
ld [wStateFlags], a
call .RestorePlayerSprite_DespawnLeaves
call CelebiEvent_SetBattleType
ret

View File

@@ -298,10 +298,10 @@ Cut_Headbutt_GetPixelFacing:
FlyFromAnim:
call DelayFrame
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
call FlyFunction_InitGFX
depixel 10, 10, 4, 0
ld a, SPRITE_ANIM_OBJ_RED_WALK
@@ -327,15 +327,15 @@ FlyFromAnim:
.exit
pop af
ld [wVramState], a
ld [wStateFlags], a
ret
FlyToAnim:
call DelayFrame
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
call FlyFunction_InitGFX
depixel 31, 10, 4, 0
ld a, SPRITE_ANIM_OBJ_RED_WALK
@@ -364,7 +364,7 @@ FlyToAnim:
.exit
pop af
ld [wVramState], a
ld [wStateFlags], a
call .RestorePlayerSprite_DespawnLeaves
ret

View File

@@ -43,7 +43,7 @@ RedCredits::
ld [wMusicFade], a
farcall FadeOutToWhite
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh [hMapAnims], a
farcall InitDisplayForRedCredits
ld c, 8
@@ -65,7 +65,7 @@ HallOfFame_FadeOutMusic:
ld [wMusicFade], a
farcall FadeOutToWhite
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh [hMapAnims], a
farcall InitDisplayForHallOfFame
ld c, 100

View File

@@ -693,8 +693,8 @@ _ExitMenu::
ret
RestoreOverworldMapTiles: ; unreferenced
ld a, [wVramState]
bit 0, a
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a
ret z
xor a ; sScratch
call OpenSRAM

View File

@@ -9,10 +9,10 @@
const TRAINERCARDSTATE_QUIT ; 6
TrainerCard:
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
ld hl, wOptions
ld a, [hl]
push af
@@ -35,7 +35,7 @@ TrainerCard:
pop af
ld [wOptions], a
pop af
ld [wVramState], a
ld [wStateFlags], a
ret
.InitRAM:

View File

@@ -128,10 +128,10 @@ RunTradeAnimScript:
push af
xor a
ldh [hMapAnims], a
ld hl, wVramState
ld hl, wStateFlags
ld a, [hl]
push af
res 0, [hl]
res SPRITE_UPDATES_DISABLED_F, [hl]
ld hl, wOptions
ld a, [hl]
push af
@@ -148,7 +148,7 @@ RunTradeAnimScript:
pop af
ld [wOptions], a
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ldh [hMapAnims], a
ret

View File

@@ -17,8 +17,8 @@ ReanchorBGMap_NoOAMUpdate::
pop af
ldh [hOAMUpdate], a
ld hl, wVramState
set 6, [hl]
ld hl, wStateFlags
set TEXT_STATE_F, [hl]
ret
.ReanchorBGMap:

View File

@@ -2167,8 +2167,8 @@ CopyTempObjectData:
ret
UpdateAllObjectsFrozen::
ld a, [wVramState]
bit 0, a
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a
ret z
ld bc, wObjectStructs
xor a
@@ -2728,8 +2728,8 @@ ResetObject:
db SPRITEMOVEDATA_STANDING_RIGHT
_UpdateSprites::
ld a, [wVramState]
bit 0, a
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a
ret z
xor a
ldh [hUsedSpriteIndex], a
@@ -2744,8 +2744,8 @@ _UpdateSprites::
ret
.fill
ld a, [wVramState]
bit 1, a
ld a, [wStateFlags]
bit LAST_12_SPRITE_OAM_STRUCTS_RESERVED_F, a
ld b, NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH
jr z, .ok
ld b, (NUM_SPRITE_OAM_STRUCTS - 12) * SPRITEOAMSTRUCT_LENGTH

View File

@@ -205,8 +205,8 @@ Movement_step_end:
add hl, bc
ld [hl], $0
ld hl, wVramState
res 7, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ld hl, OBJECT_STEP_TYPE
add hl, bc
@@ -232,8 +232,8 @@ Movement_48:
add hl, bc
ld [hl], STEP_TYPE_SLEEP
ld hl, wVramState
res 7, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ret
Movement_remove_object:
@@ -245,8 +245,8 @@ Movement_remove_object:
ld [hl], -1
.not_leading
ld hl, wVramState
res 7, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ret
Movement_4b:
@@ -258,8 +258,8 @@ Movement_4b:
add hl, bc
ld [hl], STEP_TYPE_STANDING
ld hl, wVramState
res 7, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ret
Movement_step_sleep_1:

View File

@@ -153,8 +153,8 @@ CopyObjectStruct::
ld d, h
ld e, l
call CopyMapObjectToObjectStruct
ld hl, wVramState
bit 7, [hl]
ld hl, wStateFlags
bit SCRIPTED_MOVEMENT_STATE_F, [hl]
ret z
ld hl, OBJECT_FLAGS2

View File

@@ -44,8 +44,8 @@ WaitScript:
WaitScriptMovement:
call StopScript
ld hl, wVramState
bit 7, [hl]
ld hl, wStateFlags
bit SCRIPTED_MOVEMENT_STATE_F, [hl]
ret nz
farcall UnfreezeAllObjects
@@ -925,8 +925,8 @@ ApplyObjectFacing:
pop de
ld a, e
call SetSpriteDirection
ld hl, wVramState
bit 6, [hl]
ld hl, wStateFlags
bit TEXT_STATE_F, [hl]
jr nz, .text_state
call .DisableTextTiles
.text_state

View File

@@ -226,9 +226,9 @@ EnterMapWarp:
ret
LoadMapTimeOfDay:
ld hl, wVramState
res 6, [hl]
ld a, $1
ld hl, wStateFlags
res TEXT_STATE_F, [hl]
ld a, TRUE
ld [wSpriteUpdatesEnabled], a
farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal
@@ -321,8 +321,8 @@ RefreshMapSprites:
ld hl, wPlayerSpriteSetupFlags
bit PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
jr nz, .skip
ld hl, wVramState
set 0, [hl]
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
call SafeUpdateSprites
.skip
ld a, [wPlayerSpriteSetupFlags]

View File

@@ -3,7 +3,7 @@ PhoneRing_CopyTilemapAtOnce:
and a
jp z, WaitBGMap
ld a, [wSpriteUpdatesEnabled]
cp $0
cp FALSE
jp z, WaitBGMap
; The following is a modified version of _CopyTilemapAtOnce

View File

@@ -30,10 +30,10 @@ Pokedex:
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh a, [hInMenu]
push af
ld a, $1
@@ -64,7 +64,7 @@ Pokedex:
pop af
ldh [hInMenu], a
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ld [wOptions], a
pop af

View File

@@ -33,10 +33,10 @@ PokeGear:
push af
ld a, $1
ldh [hInMenu], a
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
call .InitTilemap
call DelayFrame
.loop
@@ -55,7 +55,7 @@ PokeGear:
call PlaySFX
call WaitSFX
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ldh [hInMenu], a
pop af
@@ -1764,10 +1764,10 @@ _TownMap:
ld a, $1
ldh [hInMenu], a
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
call ClearBGPalettes
call ClearTilemap
@@ -1819,7 +1819,7 @@ _TownMap:
.resume
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ldh [hInMenu], a
pop af

View File

@@ -3,10 +3,10 @@ _DepositPKMN:
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh a, [hInMenu]
push af
ld a, $1
@@ -30,7 +30,7 @@ _DepositPKMN:
pop af
ldh [hInMenu], a
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ld [wOptions], a
ret
@@ -259,10 +259,10 @@ _WithdrawPKMN:
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh a, [hInMenu]
push af
ld a, $1
@@ -286,7 +286,7 @@ _WithdrawPKMN:
pop af
ldh [hInMenu], a
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ld [wOptions], a
ret
@@ -497,10 +497,10 @@ _MovePKMNWithoutMail:
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [wVramState]
ld a, [wStateFlags]
push af
xor a
ld [wVramState], a
ld [wStateFlags], a
ldh a, [hInMenu]
push af
ld a, $1
@@ -527,7 +527,7 @@ _MovePKMNWithoutMail:
pop af
ldh [hInMenu], a
pop af
ld [wVramState], a
ld [wStateFlags], a
pop af
ld [wOptions], a
ret

View File

@@ -358,8 +358,8 @@ HatchEggs:
; Huh? @ @
text_far Text_BreedHuh
text_asm
ld hl, wVramState
res 0, [hl]
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
push hl
push de
push bc

View File

@@ -8,7 +8,7 @@ InitClock:
ld a, $1
ldh [hInMenu], a
ld a, $0
ld a, FALSE
ld [wSpriteUpdatesEnabled], a
ld a, $10
ld [wMusicFade], a