shithub: pokecrystal

Download patch

ref: 3a7f518de4bbced15cbf5bb877a988055de7d063
parent: 4d8528f90329e2ddfac16046ad8bf309ec1887f2
author: Rangi <[email protected]>
date: Mon Jan 22 10:40:43 EST 2018

wStatusFlags/2 bit constants

--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -19,7 +19,7 @@
 ; wStatusFlags
 	const ENGINE_POKEDEX
 	const ENGINE_UNOWN_DEX
-	const ENGINE_POKERUS
+	const ENGINE_CAUGHT_POKERUS
 	const ENGINE_ROCKET_SIGNAL_ON_CH20
 	const ENGINE_CREDITS_SKIP
 	const ENGINE_BUG_CONTEST_ON ; 10
@@ -28,8 +28,8 @@
 	const ENGINE_SAFARI_ZONE
 	const ENGINE_ROCKETS_IN_RADIO_TOWER
 	const ENGINE_BIKE_SHOP_CALL_ENABLED
-	const ENGINE_GIVE_POKERUS
-	const ENGINE_FLORIA
+	const ENGINE_CAN_USE_SWEET_SCENT
+	const ENGINE_REACHED_GOLDENROD
 	const ENGINE_ROCKETS_IN_MAHOGANY
 ; wBikeFlags
 	const ENGINE_STRENGTH_ACTIVE
@@ -58,10 +58,10 @@
 	const ENGINE_UNLOCKED_UNOWNS_L_TO_R
 	const ENGINE_UNLOCKED_UNOWNS_S_TO_W
 	const ENGINE_UNLOCKED_UNOWNS_X_TO_Z
-	const ENGINE_UNLOCKED_UNOWNS_UNUSED_5
-	const ENGINE_UNLOCKED_UNOWNS_UNUSED_6 ; 30
+	const ENGINE_UNLOCKED_UNOWNS_UNUSED_4
+	const ENGINE_UNLOCKED_UNOWNS_UNUSED_5 ; 30
+	const ENGINE_UNLOCKED_UNOWNS_UNUSED_6
 	const ENGINE_UNLOCKED_UNOWNS_UNUSED_7
-	const ENGINE_UNLOCKED_UNOWNS_UNUSED_8
 ; wVisitedSpawns
 	const ENGINE_FLYPOINT_KRISS_HOUSE
 	const ENGINE_FLYPOINT_VIRIDIAN_POKECENTER
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -142,6 +142,28 @@
 PLAYER_OBJECT EQU 0
 NUM_OBJECTS   EQU $10
 
+; wStatusFlags:: ; d84c
+	const_def
+	const STATUSFLAGS_POKEDEX_F            ; 0
+	const STATUSFLAGS_UNOWN_DEX_F          ; 1
+	const STATUSFLAGS_FLASH_F              ; 2
+	const STATUSFLAGS_CAUGHT_POKERUS_F     ; 3
+	const STATUSFLAGS_ROCKET_SIGNAL_F      ; 4
+	const STATUSFLAGS_NO_WILD_ENCOUNTERS_F ; 5
+	const STATUSFLAGS_HALL_OF_FAME_F       ; 6
+	const STATUSFLAGS_BUG_CONTEST_ON_F     ; 7
+
+; wStatusFlags2:: ; d84d
+	const_def
+	const STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F ; 0
+	const STATUSFLAGS2_SAFARI_GAME_F            ; 1
+	const STATUSFLAGS2_BUG_CONTEST_TIMER_F      ; 2
+	const STATUSFLAGS2_UNUSED_F                 ; 3
+	const STATUSFLAGS2_BIKE_SHOP_CALL_F         ; 4
+	const STATUSFLAGS2_CAN_USE_SWEET_SCENT_F    ; 5
+	const STATUSFLAGS2_REACHED_GOLDENROD_F      ; 6
+	const STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F    ; 7
+
 ; wMomSavingMoney:: ; d854
 MOM_SAVING_SOME_MONEY_F EQU 0
 MOM_SAVING_HALF_MONEY_F EQU 1
@@ -203,6 +225,14 @@
 	const BIKEFLAGS_STRENGTH_ACTIVE_F ; 0
 	const BIKEFLAGS_ALWAYS_ON_BIKE_F  ; 1
 	const BIKEFLAGS_DOWNHILL_F        ; 2
+
+; wSwarmFlags:: ; dc20
+	const_def
+	const SWARMFLAGS_BUENAS_PASSWORD_F           ; 0
+	const SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F ; 1
+	const SWARMFLAGS_DUNSPARCE_SWARM_F           ; 2
+	const SWARMFLAGS_YANMA_SWARM_F               ; 3
+	const SWARMFLAGS_MOBILE_4_F                  ; 4
 
 ; wLuckyNumberShowFlag:: ; dc9d
 LUCKYNUMBERSHOW_GAME_OVER_F EQU 0
--- a/data/engine_flags.asm
+++ b/data/engine_flags.asm
@@ -24,20 +24,21 @@
 
 	engine_flag wUnusedTwoDayTimerOn, 0 ; unused, possibly related to a 2-day timer
 
-	engine_flag wStatusFlags, 0 ; pokedex
-	engine_flag wStatusFlags, 1 ; unown dex
-	engine_flag wStatusFlags, 3 ; pokerus
-	engine_flag wStatusFlags, 4 ; rocket signal on ch20
-	engine_flag wStatusFlags, 6 ; credits skip
-	engine_flag wStatusFlags, 7 ; bug contest on ; $10
-	engine_flag wStatusFlags2, 2 ; bug contest timer
-	engine_flag wStatusFlags2, 1 ; safari zone?
-	engine_flag wStatusFlags2, 0 ; rockets in radio tower
-	engine_flag wStatusFlags2, 4 ; bike shop call enabled (1024 bike steps reqd)
-	engine_flag wStatusFlags2, 5 ; give pokerus
-	engine_flag wStatusFlags2, 6 ; berry -> berry juice when trading?
-	engine_flag wStatusFlags2, 7 ; rockets in mahogany
+	engine_flag wStatusFlags, STATUSFLAGS_POKEDEX_F
+	engine_flag wStatusFlags, STATUSFLAGS_UNOWN_DEX_F
+	engine_flag wStatusFlags, STATUSFLAGS_CAUGHT_POKERUS_F
+	engine_flag wStatusFlags, STATUSFLAGS_ROCKET_SIGNAL_F
+	engine_flag wStatusFlags, STATUSFLAGS_HALL_OF_FAME_F
+	engine_flag wStatusFlags, STATUSFLAGS_BUG_CONTEST_ON_F
 
+	engine_flag wStatusFlags2, STATUSFLAGS2_BUG_CONTEST_TIMER_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_SAFARI_GAME_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_BIKE_SHOP_CALL_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_CAN_USE_SWEET_SCENT_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_REACHED_GOLDENROD_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F
+
 	engine_flag wBikeFlags, BIKEFLAGS_STRENGTH_ACTIVE_F ; $18
 	engine_flag wBikeFlags, BIKEFLAGS_ALWAYS_ON_BIKE_F
 	engine_flag wBikeFlags, BIKEFLAGS_DOWNHILL_F
@@ -100,8 +101,9 @@
 	engine_flag wVisitedSpawns, NUM_SPAWNS ; unused
 
 	engine_flag wLuckyNumberShowFlag, LUCKYNUMBERSHOW_GAME_OVER_F
-	engine_flag wStatusFlags2, 3 ; ????
 
+	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_F
+
 	engine_flag wDailyFlags, 0 ; kurt making balls ; $50
 	engine_flag wDailyFlags, 1 ; ????
 	engine_flag wDailyFlags, 2 ; special wilddata?
@@ -120,8 +122,8 @@
 	engine_flag wWeeklyFlags, 6 ; move tutor
 	engine_flag wWeeklyFlags, 7 ; buenas password
 
-	engine_flag wSwarmFlags, 0 ; buenas password 2
-	engine_flag wSwarmFlags, 1 ; goldenrod dept store sale is on
+	engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
+	engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
 
 	engine_flag wGameTimerPause, 7 ; $62
 
@@ -193,7 +195,7 @@
 
 	engine_flag wPlayerSpriteSetupFlags, PLAYERSPRITESETUP_FEMALE_TO_MALE_F
 
-	engine_flag wSwarmFlags, 2 ; dunsparce swarm ; $a0
-	engine_flag wSwarmFlags, 3 ; yanma swarm
+	engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F ; $a0
+	engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F
 
 ; 80648
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -493,7 +493,7 @@
 	jr nz, .nothing
 
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	jr z, .do_daily
 
 	farcall CheckBugContestTimer
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -9,7 +9,7 @@
 BlindingFlash: ; 8c7e1
 	farcall Special_FadeOutPalettes
 	ld hl, wStatusFlags
-	set 2, [hl] ; Flash
+	set STATUSFLAGS_FLASH_F, [hl]
 	farcall ReplaceTimeOfDayPals
 	farcall UpdateTimeOfDayPal
 	ld b, SCGB_MAPPALS
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -12,7 +12,7 @@
 
 	; Enable the Pokégear map to cycle through all of Kanto
 	ld hl, wStatusFlags
-	set 6, [hl] ; hall of fame
+	set STATUSFLAGS_HALL_OF_FAME_F, [hl]
 
 	farcall HallOfFame_InitSaveIfNeeded
 
--- a/engine/events/pokerus/pokerus.asm
+++ b/engine/events/pokerus/pokerus.asm
@@ -19,7 +19,7 @@
 ; If we haven't been to Goldenrod City at least once,
 ; prevent the contraction of Pokerus.
 	ld hl, wStatusFlags2
-	bit 6, [hl]
+	bit STATUSFLAGS2_REACHED_GOLDENROD_F, [hl]
 	ret z
 	call Random
 	ld a, [hRandomAdd]
@@ -61,7 +61,7 @@
 
 .TrySpreadPokerus:
 	call Random
-	cp 1 + 33 percent
+	cp 33 percent + 1
 	ret nc              ; 1/3 chance
 
 	ld a, [PartyCount]
@@ -74,7 +74,7 @@
 	jr c, .checkPreviousMonsLoop    ; no more mons after this one, go backwards
 
 	call Random
-	cp 1 + 50 percent
+	cp 50 percent + 1
 	jr c, .checkPreviousMonsLoop    ; 1/2 chance, go backwards
 .checkFollowingMonsLoop
 	add hl, de
@@ -121,14 +121,15 @@
 	ld [hl], a
 	ret
 
-; any berry held by a Shuckle may be converted to berry juice
 ConvertBerriesToBerryJuice: ; 2ede6
+; If we haven't been to Goldenrod City at least once,
+; prevent Shuckle from turning held Berry into Berry Juice.
 	ld hl, wStatusFlags2
-	bit 6, [hl]
+	bit STATUSFLAGS2_REACHED_GOLDENROD_F, [hl]
 	ret z
 	call Random
-	cp $10
-	ret nc              ; 1/16 chance
+	cp 6 percent + 1 ; 1/16 chance
+	ret nc
 	ld hl, PartyMons
 	ld a, [PartyCount]
 .partyMonLoop
--- a/engine/events/std_scripts.asm
+++ b/engine/events/std_scripts.asm
@@ -122,7 +122,7 @@
 
 	checkphonecall ; elm already called about pokerus
 	iftrue .no
-	checkflag ENGINE_POKERUS ; nurse already talked about pokerus
+	checkflag ENGINE_CAUGHT_POKERUS
 	iftrue .no
 	special Special_CheckPokerus
 	iftrue .pokerus
@@ -158,7 +158,7 @@
 	closetext
 
 .pokerus_done
-	setflag ENGINE_POKERUS
+	setflag ENGINE_CAUGHT_POKERUS
 	specialphonecall SPECIALCALL_POKERUS
 	end
 
--- a/engine/events/sweet_scent.asm
+++ b/engine/events/sweet_scent.asm
@@ -37,7 +37,7 @@
 	farcall CanUseSweetScent
 	jr nc, .no_battle
 	ld hl, wStatusFlags2
-	bit 2, [hl]
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	jr nz, .not_in_bug_contest
 	farcall GetMapEncounterRate
 	ld a, b
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -3,8 +3,8 @@
 
 Special_WarpToSpawnPoint:: ; 97c28
 	ld hl, wStatusFlags2
-	res 1, [hl] ; safari zone?
-	res 2, [hl] ; bug contest
+	res STATUSFLAGS2_SAFARI_GAME_F, [hl]
+	res STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	ret
 ; 97c30
 
@@ -109,7 +109,7 @@
 	call CanUseSweetScent
 	jr nc, .nope
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	jr nz, .bug_contest
 	farcall TryWildEncounter
 	jr nz, .nope
@@ -150,7 +150,7 @@
 
 CanUseSweetScent:: ; 97cfd
 	ld hl, wStatusFlags
-	bit 5, [hl]
+	bit STATUSFLAGS2_CAN_USE_SWEET_SCENT_F, [hl]
 	jr nz, .no
 	ld a, [wEnvironment]
 	cp CAVE
@@ -264,7 +264,7 @@
 	; if we've already gotten the call, we don't have to
 	; be here.
 	ld hl, wStatusFlags2
-	bit 4, [hl] ; bike shop call
+	bit STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl]
 	jr z, .NoCall
 
 	; If we're not on the bike, we don't have to be here.
@@ -315,7 +315,7 @@
 	xor a
 	ld [wSpecialPhoneCallID + 1], a
 	ld hl, wStatusFlags2
-	res 4, [hl] ; bike shop call
+	res STATUSFLAGS2_BIKE_SHOP_CALL_F, [hl]
 	scf
 	ret
 
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -541,7 +541,7 @@
 	ld [hBGMapMode], a
 	ld hl, .MenuDataHeader_Dex
 	ld a, [wStatusFlags]
-	bit 0, a ; pokedex
+	bit STATUSFLAGS_POKEDEX_F, a
 	jr nz, .show_menu
 	ld hl, .MenuDataHeader_NoDex
 
@@ -640,7 +640,7 @@
 
 Continue_DisplayPokedexNumCaught: ; 5f6b
 	ld a, [wStatusFlags]
-	bit 0, a ; Pokedex
+	bit STATUSFLAGS_POKEDEX_F, a
 	ret z
 	push hl
 	ld hl, PokedexCaught
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -166,8 +166,9 @@
 	cp -1
 	call CloseSRAM
 	jr nz, .mystery_gift
+	; This check makes no difference.
 	ld a, [wStatusFlags]
-	bit 7, a
+	bit STATUSFLAGS_BUG_CONTEST_ON_F, a
 	ld a, $1 ; Continue
 	jr z, .ok
 	jr .ok
@@ -180,8 +181,9 @@
 	ret
 
 .mystery_gift
+	; This check makes no difference.
 	ld a, [wStatusFlags]
-	bit 7, a
+	bit STATUSFLAGS_BUG_CONTEST_ON_F, a
 	jr z, .ok3
 	jr .ok3
 
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -82,7 +82,7 @@
 	ld b, BANK(RooftopSaleData1)
 	ld de, RooftopSaleData1
 	ld hl, wStatusFlags
-	bit 6, [hl] ; hall of fame
+	bit STATUSFLAGS_HALL_OF_FAME_F, [hl]
 	jr z, .ok
 	ld b, BANK(RooftopSaleData2)
 	ld de, RooftopSaleData2
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -108,7 +108,7 @@
 
 Pokedex_CheckUnlockedUnownMode: ; 400a2
 	ld a, [wStatusFlags]
-	bit 1, a
+	bit STATUSFLAGS_UNOWN_DEX_F, a
 	jr nz, .unlocked
 
 	xor a
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -764,7 +764,7 @@
 
 TownMap_GetKantoLandmarkLimits: ; 910e8
 	ld a, [wStatusFlags]
-	bit 6, a ; ENGINE_CREDITS_SKIP
+	bit STATUSFLAGS_HALL_OF_FAME_F, a
 	jr z, .not_hof
 	ld d, ROUTE_28
 	ld e, PALLET_TOWN
@@ -1613,7 +1613,7 @@
 .EvolutionRadio:
 ; This station airs in the Lake of Rage area when Rocket are still in Mahogany.
 	ld a, [wStatusFlags]
-	bit 4, a ; ENGINE_ROCKET_SIGNAL_ON_CH20
+	bit STATUSFLAGS_ROCKET_SIGNAL_F, a
 	jr z, .NoSignal
 	ld a, [wPokegearMapPlayerIconLandmark]
 	cp MAHOGANY_TOWN
@@ -1699,7 +1699,7 @@
 	call Radio_BackUpFarCallParams
 	ld de, NotBuenasPasswordName
 	ld a, [wStatusFlags2]
-	bit 0, a ; ENGINE_ROCKETS_IN_RADIO_TOWER
+	bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a
 	ret z
 	ld de, BuenasPasswordName
 	ret
@@ -2561,7 +2561,7 @@
 
 .right
 	ld a, [wStatusFlags]
-	bit 6, a ; ENGINE_CREDITS_SKIP
+	bit STATUSFLAGS_HALL_OF_FAME_F, a
 	ret z
 	ld a, [hWY]
 	and a
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -5,7 +5,7 @@
 	jr nc, .ok
 ; If Team Rocket is not occupying the radio tower, we don't need to be here.
 	ld a, [wStatusFlags2]
-	bit 0, a ; checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
+	bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a
 	jr z, .ok
 ; If we're in Kanto, we don't need to be here.
 	call IsInJohto
@@ -1171,7 +1171,7 @@
 	push af
 	ld hl, PnP_HiddenPeople
 	ld a, [wStatusFlags]
-	bit 6, a ; ENGINE_CREDITS_SKIP
+	bit STATUSFLAGS_HALL_OF_FAME_F, a
 	jr z, .ok
 	ld hl, PnP_HiddenPeople_BeatE4
 	ld a, [wKantoBadges]
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -2449,7 +2449,7 @@
 ; script command 0x38
 
 	ld hl, wStatusFlags
-	set 5, [hl]
+	set STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
 	ret
 
 Script_wildon:
@@ -2456,7 +2456,7 @@
 ; script command 0x37
 
 	ld hl, wStatusFlags
-	res 5, [hl]
+	res STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
 	ret
 
 Script_xycompare:
--- a/engine/start_menu.asm
+++ b/engine/start_menu.asm
@@ -21,7 +21,7 @@
 	farcall ReanchorBGMap_NoOAMUpdate
 
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug catching contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	ld hl, .MenuDataHeader
 	jr z, .GotMenuData
 	ld hl, .ContestMenuDataHeader
@@ -306,7 +306,7 @@
 	call .FillMenuList
 
 	ld hl, wStatusFlags
-	bit 0, [hl]
+	bit STATUSFLAGS_POKEDEX_F, [hl]
 	jr z, .no_pokedex
 	ld a, STARTMENUITEM_POKEDEX
 	call .AppendMenuList
@@ -323,7 +323,7 @@
 	and a
 	jr nz, .no_pack
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug catching contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	jr nz, .no_pack
 	ld a, STARTMENUITEM_PACK
 	call .AppendMenuList
@@ -336,7 +336,7 @@
 	call .AppendMenuList
 .no_pokegear
 
-	ld a, 3 ; status
+	ld a, STARTMENUITEM_STATUS
 	call .AppendMenuList
 
 	ld a, [wLinkMode]
@@ -343,7 +343,7 @@
 	and a
 	jr nz, .no_save
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug catching contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	ld a, STARTMENUITEM_QUIT
 	jr nz, .write
 	ld a, STARTMENUITEM_SAVE
@@ -412,7 +412,7 @@
 
 .DrawBugContestStatusBox: ; 128d1
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug catching contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	ret z
 	farcall StartMenu_DrawBugContestStatusBox
 	ret
@@ -420,7 +420,7 @@
 
 .DrawBugContestStatus: ; 128de
 	ld hl, wStatusFlags2
-	bit 2, [hl] ; bug catching contest
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
 	jr nz, .contest
 	ret
 .contest
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -216,7 +216,7 @@
 
 .DarkCave:
 	ld a, [wStatusFlags]
-	bit 2, a ; Flash
+	bit STATUSFLAGS_FLASH_F, a
 	jr nz, .UsedFlash
 	ld a, %11111111 ; 3, 3, 3, 3
 	ld [wTimeOfDayPalset], a
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -290,7 +290,7 @@
 	ld de, .StatusTilemap
 	call TrainerCardSetup_PlaceTilemapString
 	ld a, [wStatusFlags]
-	bit 0, a ; ENGINE_POKEDEX
+	bit STATUSFLAGS_POKEDEX_F, a
 	ret nz
 	hlcoord 1, 9
 	lb bc, 2, 17
--- a/engine/wildmons.asm
+++ b/engine/wildmons.asm
@@ -429,7 +429,7 @@
 	call CopyCurrMapDE
 	push hl
 	ld hl, wSwarmFlags
-	bit 2, [hl]
+	bit SWARMFLAGS_DUNSPARCE_SWARM_F, [hl]
 	pop hl
 	jr z, .CheckYanma
 	ld a, [wDunsparceMapGroup]
@@ -446,7 +446,7 @@
 .CheckYanma:
 	push hl
 	ld hl, wSwarmFlags
-	bit 3, [hl]
+	bit SWARMFLAGS_YANMA_SWARM_F, [hl]
 	pop hl
 	jr z, _NoSwarmWildmon
 	ld a, [wYanmaMapGroup]
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -462,7 +462,7 @@
 	jr z, .surf
 
 	ld a, [wStatusFlags2]
-	bit 2, a
+	bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, a
 	jr nz, .contest
 
 .no
--- a/home/flag.asm
+++ b/home/flag.asm
@@ -15,15 +15,15 @@
 
 ResetFlashIfOutOfCave:: ; 2e5d
 	ld a, [wEnvironment]
-	cp $2
-	jr z, .asm_2e69
-	cp $1
-	jr z, .asm_2e69
+	cp ROUTE
+	jr z, .outdoors
+	cp TOWN
+	jr z, .outdoors
 	ret
 
-.asm_2e69
+.outdoors
 	ld hl, wStatusFlags
-	res 2, [hl]
+	res STATUSFLAGS_FLASH_F, [hl]
 	ret
 ; 2e6f
 
--- a/home/map.asm
+++ b/home/map.asm
@@ -2306,7 +2306,7 @@
 
 .radiotower
 	ld a, [wStatusFlags2]
-	bit 0, a
+	bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a
 	jr z, .clearedradiotower
 	ld de, MUSIC_ROCKET_OVERTURE
 	jr .done
@@ -2321,7 +2321,7 @@
 
 .mahoganymart
 	ld a, [wStatusFlags2]
-	bit 7, a
+	bit STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F, a
 	jr z, .clearedmahogany
 	ld de, MUSIC_ROCKET_HIDEOUT
 	jr .done
--- a/maps/GoldenrodCity.asm
+++ b/maps/GoldenrodCity.asm
@@ -26,7 +26,7 @@
 
 .FlyPointAndFloria:
 	setflag ENGINE_FLYPOINT_GOLDENROD
-	setflag ENGINE_FLORIA
+	setflag ENGINE_REACHED_GOLDENROD
 	checkevent EVENT_MET_FLORIA
 	iftrue .FloriaDone
 	clearevent EVENT_FLORIA_AT_SUDOWOODO
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -7894,7 +7894,7 @@
 Function103700: ; 103700
 	ld c, $0a
 	ld hl, wSwarmFlags
-	bit 4, [hl]
+	bit SWARMFLAGS_MOBILE_4_F, [hl]
 	jr z, .asm_10370f
 	farcall Function1008a6
 
@@ -7991,11 +7991,11 @@
 Function10378c: ; 10378c
 	ld c, 0
 	ld hl, wSwarmFlags
-	bit 4, [hl]
+	bit SWARMFLAGS_MOBILE_4_F, [hl]
 	jr nz, .already_set
-	ld c, $01
+	ld c, 1
 	ld hl, wSwarmFlags
-	set 4, [hl]
+	set SWARMFLAGS_MOBILE_4_F, [hl]
 
 .already_set
 	push bc
@@ -8002,7 +8002,7 @@
 	farcall Link_SaveGame
 	pop bc
 	jr c, .failed_to_save
-	ld a, $01
+	ld a, 1
 	ld [ScriptVar], a
 	ld a, c
 	and a
@@ -8017,7 +8017,7 @@
 	and a
 	ret z
 	ld hl, wSwarmFlags
-	res 4, [hl]
+	res SWARMFLAGS_MOBILE_4_F, [hl]
 	ret
 ; 1037c2
 
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -1199,15 +1199,15 @@
 	ld a, $1
 	ld [rSVBK], a
 	ld a, [wStatusFlags]
-	bit 6, a ; Hall Of Fame
+	bit STATUSFLAGS_HALL_OF_FAME_F, a
 	jr nz, .asm_11896b
-	ld hl, Strings_Ll0ToL40		; Address to list of strings with the choosable levels
-	ld a, 5						; 4 levels to choose from, including 'Cancel'-option
+	ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels
+	ld a, 5                 ; 4 levels to choose from, including 'Cancel'-option
 	jr .asm_118970
 
 .asm_11896b
-	ld hl, Strings_L10ToL100	; Address to list of strings with the choosable levels
-	ld a, 11					; 10 levels to choose from, including 'Cancel'-option
+	ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels
+	ld a, 11                 ; 10 levels to choose from, including 'Cancel'-option
 
 .asm_118970
 	ld [wcd4a], a
--- a/wram.asm
+++ b/wram.asm
@@ -2420,8 +2420,8 @@
 wStatusFlags:: ; d84c
 ; bit 0: pokedex
 ; bit 1: unown dex
-; bit 2: unused
-; bit 3: pokerus
+; bit 2: flash
+; bit 3: caught pokerus
 ; bit 4: rocket signal
 ; bit 5: wild encounters on/off
 ; bit 6: hall of fame
@@ -2430,12 +2430,12 @@
 
 wStatusFlags2:: ; d84d
 ; bit 0: rockets
-; bit 1: unused
+; bit 1: safari game (unused)
 ; bit 2: bug contest timer
 ; bit 3: unused
 ; bit 4: bike shop call
-; bit 5: pokerus
-; bit 6: berry juice
+; bit 5: can use sweet scent
+; bit 6: reached goldenrod
 ; bit 7: rockets in mahogany
 	db