ref: 4d8528f90329e2ddfac16046ad8bf309ec1887f2
parent: 125d51b3b2e91230b693406de153e172f752bf41
author: Rangi <[email protected]>
date: Mon Jan 22 09:34:55 EST 2018
More engine flag constants
--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -120,7 +120,7 @@
; wPlayerGender
const ENGINE_PLAYER_IS_FEMALE
; wCelebiEvent
- const ENGINE_HAVE_EXAMINED_GS_BALL
+ const ENGINE_FOREST_IS_RESTLESS
; wDailyRematchFlags
const ENGINE_JACK
const ENGINE_HUEY
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -105,6 +105,16 @@
ANYTIME EQU MORN | DAY | NITE
+; wPlayerSpriteSetupFlags:: ; d45b
+PLAYERSPRITESETUP_FACING_MASK EQU %11
+PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2
+PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5
+PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6
+PLAYERSPRITESETUP_RESET_ACTION_F EQU 7
+
+; wPlayerGender:: ; d472
+PLAYERGENDER_FEMALE_F EQU 0
+
; ScriptFlags:: ; d434
SCRIPT_RUNNING EQU 2
@@ -185,11 +195,17 @@
PLAYER_SURF EQU 4
PLAYER_SURF_PIKA EQU 8
+; wCelebiEvent:: ; dbf3
+CELEBIEVENT_FOREST_IS_RESTLESS_F EQU 2
+
; wBikeFlags:: ; dbf5
const_def
const BIKEFLAGS_STRENGTH_ACTIVE_F ; 0
const BIKEFLAGS_ALWAYS_ON_BIKE_F ; 1
const BIKEFLAGS_DOWNHILL_F ; 2
+
+; wLuckyNumberShowFlag:: ; dc9d
+LUCKYNUMBERSHOW_GAME_OVER_F EQU 0
; wDayCareMan:: ; def5
DAYCAREMAN_HAS_MON_F EQU 0
--- a/data/engine_flags.asm
+++ b/data/engine_flags.asm
@@ -99,7 +99,7 @@
engine_flag wVisitedSpawns, SPAWN_MT_SILVER
engine_flag wVisitedSpawns, NUM_SPAWNS ; unused
- engine_flag wLuckyNumberShowFlag, 0 ; lucky number show
+ engine_flag wLuckyNumberShowFlag, LUCKYNUMBERSHOW_GAME_OVER_F
engine_flag wStatusFlags2, 3 ; ????
engine_flag wDailyFlags, 0 ; kurt making balls ; $50
@@ -125,9 +125,9 @@
engine_flag wGameTimerPause, 7 ; $62
- engine_flag wPlayerGender, 0 ; player is female
+ engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
- engine_flag wCelebiEvent, 2 ; have gs ball after kurt examined it
+ engine_flag wCelebiEvent, CELEBIEVENT_FOREST_IS_RESTLESS_F
; rematches
engine_flag wDailyRematchFlags, 0 ; jack
@@ -191,7 +191,7 @@
engine_flag wDailyPhoneTimeOfDayFlags, 22 ; parry
engine_flag wDailyPhoneTimeOfDayFlags, 23 ; erin
- engine_flag wPlayerSpriteSetupFlags, 2 ; female player has been transformed into male
+ engine_flag wPlayerSpriteSetupFlags, PLAYERSPRITESETUP_FEMALE_TO_MALE_F
engine_flag wSwarmFlags, 2 ; dunsparce swarm ; $a0
engine_flag wSwarmFlags, 3 ; yanma swarm
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -9263,10 +9263,10 @@
; What gender are we?
ld a, [wPlayerSpriteSetupFlags]
- bit 2, a ; transformed to male
+ bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .Chris
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .Chris
; It's a girl.
--- a/engine/caught_data.asm
+++ b/engine/caught_data.asm
@@ -194,7 +194,7 @@
call GetWorldMapLocation
ld b, a
ld a, [wPlayerGender]
- rrca
+ rrca ; shift bit 0 (PLAYERGENDER_FEMALE_F) to bit 7 (CAUGHT_GENDER_MASK)
or b
ld [hl], a
ret
--- a/engine/cgb_layouts.asm
+++ b/engine/cgb_layouts.asm
@@ -184,7 +184,7 @@
_CGB_PokegearPals: ; 8eb9
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .male
ld hl, FemalePokegearPals
jr .got_pals
@@ -821,7 +821,7 @@
jr z, .tutorial_male
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .tutorial_male
ld hl, .KrisPackPals
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -707,7 +707,7 @@
and a
jp nz, GetMonNormalOrShinyPalettePointer
ld a, [wPlayerSpriteSetupFlags]
- bit 2, a ; transformed to male
+ bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .male
ld a, [wPlayerGender]
and a
--- a/engine/events/loadfishinggfx.asm
+++ b/engine/events/loadfishinggfx.asm
@@ -6,7 +6,7 @@
ld de, FishingGFX
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld de, KrisFishingGFX
.got_gender
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -327,7 +327,7 @@
ld a, BANK(wPlayerGender)
ld [rSVBK], a
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -812,7 +812,7 @@
ld hl, PlayerName
ld de, .Chris
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .Male
ld de, .Kris
.Male:
@@ -988,7 +988,7 @@
ld b, PAL_OW_RED
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .male
ld b, PAL_OW_BLUE
.male
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -2543,7 +2543,7 @@
.TryResetPlayerAction: ; 57bc
ld hl, wPlayerSpriteSetupFlags
- bit 7, [hl]
+ bit PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
jr nz, .ok
ret
@@ -2555,10 +2555,10 @@
.SpawnInCustomFacing: ; 57ca
ld hl, wPlayerSpriteSetupFlags
- bit 5, [hl]
+ bit PLAYERSPRITESETUP_CUSTOM_FACING_F, [hl]
ret z
ld a, [wPlayerSpriteSetupFlags]
- and 3
+ and PLAYERSPRITESETUP_FACING_MASK
add a
add a
jr ContinueSpawnFacing
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -143,13 +143,13 @@
DelayClearingOldSprites: ; 154eb
ld hl, wPlayerSpriteSetupFlags
- set 7, [hl]
+ set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
ret
; 154f1
DelayLoadingNewSprites: ; 154f1
ld hl, wPlayerSpriteSetupFlags
- set 6, [hl]
+ set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
ret
CheckReplaceKrisSprite: ; 154f7
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -62,10 +62,10 @@
; Get Chris or Kris's sprite.
ld hl, .Chris
ld a, [wPlayerSpriteSetupFlags]
- bit 2, a
+ bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .go
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .go
ld hl, .Kris
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1288,7 +1288,7 @@
cp BATTLETYPE_TUTORIAL
jr z, .male_dude
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr nz, .female
.male_dude
ld hl, PackGFXPointers
--- a/engine/player_gfx.asm
+++ b/engine/player_gfx.asm
@@ -1,7 +1,7 @@
Unreferenced_Function88248: ; 88248
ld c, CAL
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .okay
ld c, KAREN
@@ -58,7 +58,7 @@
ShowPlayerNamingChoices: ; 88297
ld hl, ChrisNameMenuDataHeader
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotGender
ld hl, KrisNameMenuDataHeader
.GotGender:
@@ -76,7 +76,7 @@
ld hl, PlayerName
ld de, MalePlayerNameArray
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .done
ld de, FemalePlayerNameArray
@@ -92,7 +92,7 @@
ld b, BANK(ChrisSpriteGFX)
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .done
; Female
@@ -105,7 +105,7 @@
GetCardPic: ; 8833e
ld hl, ChrisCardPic
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotClass
ld hl, KrisCardPic
.GotClass:
@@ -131,7 +131,7 @@
GetPlayerBackpic: ; 88825
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, GetChrisBackpic
call GetKrisBackpic
ret
@@ -150,7 +150,7 @@
ld [hBGMapMode], a
ld e, 0
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotClass
ld e, 1
@@ -159,7 +159,7 @@
ld [TrainerClass], a
ld de, ChrisPic
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotPic
ld de, KrisPic
@@ -179,7 +179,7 @@
; Get class
ld e, CHRIS
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotClass
ld e, KRIS
.GotClass:
@@ -189,7 +189,7 @@
; Load pic
ld de, ChrisPic
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .GotPic
ld de, KrisPic
.GotPic:
--- a/engine/player_object.asm
+++ b/engine/player_object.asm
@@ -31,10 +31,10 @@
add hl, bc
ln e, PAL_NPC_RED, OBJECTTYPE_SCRIPT
ld a, [wPlayerSpriteSetupFlags]
- bit 2, a
+ bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .ok
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .ok
ln e, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -687,7 +687,7 @@
depixel 0, 0
ld b, SPRITE_ANIM_INDEX_RED_WALK
ld a, [wPlayerGender]
- bit 0, a ; ENGINE_PLAYER_IS_FEMALE
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_BLUE_WALK
.got_gender
@@ -2690,7 +2690,7 @@
push bc
ld c, PAL_OW_RED
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .male
inc c ; PAL_OW_BLUE
.male
@@ -2917,7 +2917,7 @@
depixel 0, 0
ld b, SPRITE_ANIM_INDEX_RED_WALK ; Male
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_BLUE_WALK ; Female
.got_gender
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -2477,7 +2477,7 @@
maskbits NUM_DIRECTIONS
ld c, a
ld a, [wPlayerSpriteSetupFlags]
- set 5, a
+ set PLAYERSPRITESETUP_CUSTOM_FACING_F, a
or c
ld [wPlayerSpriteSetupFlags], a
; fall through
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -350,7 +350,7 @@
Special_ResetLuckyNumberShowFlag: ; c422
farcall RestartLuckyNumberCountdown
ld hl, wLuckyNumberShowFlag
- res 0, [hl]
+ res LUCKYNUMBERSHOW_GAME_OVER_F, [hl]
farcall LoadOrRegenerateLuckyIDNumber
ret
; c434
--- a/engine/tileset_anims.asm
+++ b/engine/tileset_anims.asm
@@ -502,7 +502,7 @@
; Only during the Celebi event.
ld a, [wCelebiEvent]
- bit 2, a
+ bit CELEBIEVENT_FOREST_IS_RESTLESS_F, a
jr nz, .asm_fc46c
ld hl, ForestTreeLeftFrames
jr .asm_fc47d
@@ -544,7 +544,7 @@
; Only during the Celebi event.
ld a, [wCelebiEvent]
- bit 2, a
+ bit CELEBIEVENT_FOREST_IS_RESTLESS_F, a
jr nz, .asm_fc4d4
ld hl, ForestTreeRightFrames
jr .asm_fc4eb
@@ -579,7 +579,7 @@
; Only during the Celebi event.
ld a, [wCelebiEvent]
- bit 2, a
+ bit CELEBIEVENT_FOREST_IS_RESTLESS_F, a
jr nz, .asm_fc502
ld hl, ForestTreeLeftFrames
jr .asm_fc515
@@ -611,7 +611,7 @@
; Only during the Celebi event.
ld a, [wCelebiEvent]
- bit 2, a
+ bit CELEBIEVENT_FOREST_IS_RESTLESS_F, a
jr nz, .asm_fc52c
ld hl, ForestTreeRightFrames
jr .asm_fc545
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -322,7 +322,7 @@
farcall RefreshPlayerSprite
farcall CheckReplaceKrisSprite
ld hl, wPlayerSpriteSetupFlags
- bit 6, [hl]
+ bit PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
jr nz, .skip
ld hl, VramState
set 0, [hl]
--- a/home/text.asm
+++ b/home/text.asm
@@ -399,7 +399,7 @@
ld h, b
ld l, c
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
ld de, KunSuffixText
jr z, PlaceCommandCharacter
ld de, ChanSuffixText
--- a/maps/AzaleaTown.asm
+++ b/maps/AzaleaTown.asm
@@ -167,7 +167,7 @@
waitbutton
verbosegiveitem GS_BALL
spriteface AZALEATOWN_KURT_OUTSIDE, LEFT
- setflag ENGINE_HAVE_EXAMINED_GS_BALL
+ setflag ENGINE_FOREST_IS_RESTLESS
clearevent EVENT_ILEX_FOREST_LASS
setevent EVENT_ROUTE_34_ILEX_FOREST_GATE_LASS
setscene 0
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -464,7 +464,7 @@
pause 30
spriteface PLAYER, DOWN
pause 20
- clearflag ENGINE_HAVE_EXAMINED_GS_BALL
+ clearflag ENGINE_FOREST_IS_RESTLESS
special Special_CelebiShrineEvent
loadwildmon CELEBI, 30
startbattle
--- a/mobile/mobile_12.asm
+++ b/mobile/mobile_12.asm
@@ -315,7 +315,7 @@
ld a, [hli]
cp $50
jr nz, .asm_482e1
- ld a, $1
+ ld a, 1 << PLAYERGENDER_FEMALE_F
ld [wPlayerGender], a
jr .asm_482f1
.asm_482ed
@@ -800,7 +800,7 @@
add B_BUTTON
ld [hli], a ; joypad filter
; ld a, [wPlayerGender]
- ; xor 1
+ ; xor 1 << PLAYERGENDER_FEMALE_F
; inc a
ld a, [wPlayerGender]
and a
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -619,7 +619,7 @@
Function89492: ; 89492 (22:5492)
ld d, 0
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
ret z
inc d
ret
@@ -1269,7 +1269,7 @@
Function89807: ; 89807 (22:5807)
ld hl, MobileAdapterGFX + $20 tiles
ld a, [wPlayerGender]
- bit 0, a
+ bit PLAYERGENDER_FEMALE_F, a
jr z, .asm_89814
ld hl, MobileAdapterGFX + $43 tiles
.asm_89814
--- a/wram.asm
+++ b/wram.asm
@@ -2285,7 +2285,9 @@
wBattleScriptFlags:: dw ; d459
wPlayerSpriteSetupFlags:: ; d45b
; bit 7: if set, cancel PlayerAction
+; bit 6: RefreshMapSprites doesn't reload player sprite
; bit 5: if set, set facing according to bits 0-1
+; bit 2: female player has been transformed into male
; bits 0-1: direction facing
db
wMapReentryScriptQueueFlag:: db ; d45c MemScriptFlag
@@ -2626,7 +2628,9 @@
; 8 chars + $50
wBoxNames:: ds BOX_NAME_LENGTH * NUM_BOXES ; db75
-wCelebiEvent:: db
+wCelebiEvent:: ; dbf3
+; bit 2: forest is restless
+ db
ds 1
@@ -2720,7 +2724,8 @@
; dc86
ds 23
-wLuckyNumberShowFlag:: dw ; dc9d
+wLuckyNumberShowFlag:: db ; dc9d
+ ds 1
wLuckyIDNumber:: dw ; dc9f
wRepelEffect:: db ; If a Repel is in use, it contains the nr of steps it's still active