shithub: pokecrystal

Download patch

ref: efe6981a0db99aa2deeb7fbea5a51c9e40dd4138
parent: 3a7f518de4bbced15cbf5bb877a988055de7d063
author: Rangi <[email protected]>
date: Mon Jan 22 10:59:24 EST 2018

Add daily+weekly bit flags (close issue #429)

--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -97,10 +97,10 @@
 ; wDailyFlags
 	const ENGINE_KURT_MAKING_BALLS ; 50
 	const ENGINE_DAILY_BUG_CONTEST
-	const ENGINE_SPECIAL_WILDDATA
+	const ENGINE_FISH_SWARM
 	const ENGINE_TIME_CAPSULE
 	const ENGINE_ALL_FRUIT_TREES
-	const ENGINE_SHUCKLE_GIVEN
+	const ENGINE_GOT_SHUCKIE_TODAY
 	const ENGINE_GOLDENROD_UNDERGROUND_MERCHANT_CLOSED
 	const ENGINE_FOUGHT_IN_TRAINER_HALL_TODAY
 ; wWeeklyFlags
@@ -107,8 +107,8 @@
 	const ENGINE_MT_MOON_SQUARE_CLEFAIRY
 	const ENGINE_UNION_CAVE_LAPRAS
 	const ENGINE_GOLDENROD_UNDERGROUND_GOT_HAIRCUT
-	const ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT
-	const ENGINE_TEA_IN_BLUES_HOUSE
+	const ENGINE_GOLDENROD_DEPT_STORE_TM27_RETURN
+	const ENGINE_DAISYS_GROOMING
 	const ENGINE_INDIGO_PLATEAU_RIVAL_FIGHT
 	const ENGINE_DAILY_MOVE_TUTOR
 	const ENGINE_BUENAS_PASSWORD
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -17,7 +17,6 @@
 	const WILDMON    ; 4
 
 ; Options:: ; cfcc
-
 const_value set 4
 	const NO_TEXT_SCROLL ; 4
 	const STEREO         ; 5
@@ -225,6 +224,28 @@
 	const BIKEFLAGS_STRENGTH_ACTIVE_F ; 0
 	const BIKEFLAGS_ALWAYS_ON_BIKE_F  ; 1
 	const BIKEFLAGS_DOWNHILL_F        ; 2
+
+; wDailyFlags:: ; dc1e
+	const_def
+	const DAILYFLAGS_KURT_MAKING_BALLS_F             ; 0
+	const DAILYFLAGS_BUG_CONTEST_F                   ; 1
+	const DAILYFLAGS_FISH_SWARM_F                    ; 2
+	const DAILYFLAGS_TIME_CAPSULE_F                  ; 3
+	const DAILYFLAGS_ALL_FRUIT_TREES_F               ; 4
+	const DAILYFLAGS_GOT_SHUCKIE_TODAY_F             ; 5
+	const DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F ; 6
+	const DAILYFLAGS_TRAINER_HOUSE_F                 ; 7
+
+; wWeeklyFlags:: ; dc1f
+	const_def
+	const WEEKLYFLAGS_MT_MOON_SQUARE_CLEFAIRY_F ; 0
+	const WEEKLYFLAGS_UNION_CAVE_LAPRAS_F ; 1
+	const WEEKLYFLAGS_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F ; 2
+	const WEEKLYFLAGS_GOLDENROD_DEPT_STORE_TM27_RETURN_F ; 3
+	const WEEKLYFLAGS_DAISYS_GROOMING_F ; 4
+	const WEEKLYFLAGS_INDIGO_PLATEAU_RIVAL_FIGHT_F ; 5
+	const WEEKLYFLAGS_DAILY_MOVE_TUTOR_F ; 6
+	const WEEKLYFLAGS_BUENAS_PASSWORD_F ; 7
 
 ; wSwarmFlags:: ; dc20
 	const_def
--- a/data/engine_flags.asm
+++ b/data/engine_flags.asm
@@ -104,23 +104,23 @@
 
 	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_F
 
-	engine_flag wDailyFlags, 0 ; kurt making balls ; $50
-	engine_flag wDailyFlags, 1 ; ????
-	engine_flag wDailyFlags, 2 ; special wilddata?
-	engine_flag wDailyFlags, 3 ; time capsule (24h wait)
-	engine_flag wDailyFlags, 4 ; all fruit trees
-	engine_flag wDailyFlags, 5 ; shuckle given
-	engine_flag wDailyFlags, 6 ; goldenrod underground merchant closed
-	engine_flag wDailyFlags, 7 ; fought in trainer hall today
+	engine_flag wDailyFlags, DAILYFLAGS_KURT_MAKING_BALLS_F ; $50
+	engine_flag wDailyFlags, DAILYFLAGS_BUG_CONTEST_F
+	engine_flag wDailyFlags, DAILYFLAGS_FISH_SWARM_F
+	engine_flag wDailyFlags, DAILYFLAGS_TIME_CAPSULE_F
+	engine_flag wDailyFlags, DAILYFLAGS_ALL_FRUIT_TREES_F
+	engine_flag wDailyFlags, DAILYFLAGS_GOT_SHUCKIE_TODAY_F
+	engine_flag wDailyFlags, DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F
+	engine_flag wDailyFlags, DAILYFLAGS_TRAINER_HOUSE_F
 
-	engine_flag wWeeklyFlags, 0 ; mt moon square clefairy ; $58
-	engine_flag wWeeklyFlags, 1 ; union cave lapras
-	engine_flag wWeeklyFlags, 2 ; goldenrod underground haircut used
-	engine_flag wWeeklyFlags, 3 ; goldenrod mall happiness event floor05 object07
-	engine_flag wWeeklyFlags, 4 ; tea in blues house
-	engine_flag wWeeklyFlags, 5 ; indigo plateau rival fight
-	engine_flag wWeeklyFlags, 6 ; move tutor
-	engine_flag wWeeklyFlags, 7 ; buenas password
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_MT_MOON_SQUARE_CLEFAIRY_F ; $58
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_UNION_CAVE_LAPRAS_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_GOLDENROD_DEPT_STORE_TM27_RETURN_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_DAISYS_GROOMING_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_INDIGO_PLATEAU_RIVAL_FIGHT_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_DAILY_MOVE_TUTOR_F
+	engine_flag wWeeklyFlags, WEEKLYFLAGS_BUENAS_PASSWORD_F
 
 	engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
 	engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
--- a/engine/events/fish.asm
+++ b/engine/events/fish.asm
@@ -98,7 +98,7 @@
 
 	push hl
 	ld hl, wDailyFlags
-	bit 2, [hl]
+	bit DAILYFLAGS_FISH_SWARM_F, [hl]
 	pop hl
 	jr z, .done
 
--- a/engine/events/fruit_trees.asm
+++ b/engine/events/fruit_trees.asm
@@ -44,7 +44,7 @@
 
 TryResetFruitTrees: ; 4404c
 	ld hl, wDailyFlags
-	bit 4, [hl]
+	bit DAILYFLAGS_ALL_FRUIT_TREES_F, [hl]
 	ret nz
 	jp ResetFruitTrees
 ; 44055
@@ -71,7 +71,7 @@
 	ld [hli], a
 	ld [hl], a
 	ld hl, wDailyFlags
-	set 4, [hl]
+	set DAILYFLAGS_ALL_FRUIT_TREES_F, [hl]
 	ret
 ; 44078
 
--- a/engine/events/special.asm
+++ b/engine/events/special.asm
@@ -56,7 +56,7 @@
 
 ; Engine flag for this event.
 	ld hl, wDailyFlags
-	set 5, [hl] ; ENGINE_SHUCKLE_GIVEN
+	set DAILYFLAGS_GOT_SHUCKIE_TODAY_F, [hl]
 	ld a, 1
 	ld [ScriptVar], a
 	ret
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -59,7 +59,7 @@
 	or [hl]
 	jr z, .skip_set
 	ld hl, wDailyFlags
-	set 6, [hl]
+	set DAILYFLAGS_GOLDENROD_UNDERGROUND_BARGAIN_F, [hl]
 
 .skip_set
 	ld hl, Text_BargainShop_ComeAgain
--- a/engine/phone/phone_scripts.asm
+++ b/engine/phone/phone_scripts.asm
@@ -788,7 +788,7 @@
 	checkmorn
 	iftrue Ralph_WednesdayMorning
 Ralph_CheckSwarm:
-	checkflag ENGINE_SPECIAL_WILDDATA
+	checkflag ENGINE_FISH_SWARM
 	iftrue Ralph_ReportSwarm
 	farjump UnknownScript_0xa0940
 
@@ -824,9 +824,9 @@
 	farjump PhoneScript_WantsToBattle_Male
 
 Ralph_SetUpSwarm:
-	checkflag ENGINE_SPECIAL_WILDDATA
+	checkflag ENGINE_FISH_SWARM
 	iftrue .Generic
-	setflag ENGINE_SPECIAL_WILDDATA
+	setflag ENGINE_FISH_SWARM
 	pokenamemem QWILFISH, MEM_BUFFER_1
 	landmarktotext ROUTE_32, MEM_BUFFER_2
 	writebyte FISHSWARM_QWILFISH
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -1560,7 +1560,7 @@
 	ld a, [wBuenasPassword]
 ; If we already generated the password today, we don't need to generate a new one.
 	ld hl, wWeeklyFlags
-	bit 7, [hl] ; ENGINE_BUENAS_PASSWORD
+	bit WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl]
 	jr nz, .AlreadyGotIt
 ; There are only 11 groups to choose from.
 .greater_than_11
@@ -1582,7 +1582,7 @@
 	ld [wBuenasPassword], a
 ; Set the flag so that we don't generate a new password this week.
 	ld hl, wWeeklyFlags
-	set 7, [hl] ; ENGINE_BUENAS_PASSWORD
+	set WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl]
 .AlreadyGotIt:
 	ld c, a
 	call GetBuenasPassword
@@ -1703,7 +1703,7 @@
 BuenasPasswordAfterMidnight:
 	push hl
 	ld hl, wWeeklyFlags
-	res 7, [hl] ; ENGINE_BUENAS_PASSWORD
+	res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl]
 	pop hl
 	ld a, BUENAS_PASSWORD_8
 	jp NextRadioLine
@@ -1710,7 +1710,7 @@
 
 BuenasPassword8:
 	ld hl, wWeeklyFlags
-	res 7, [hl] ; ENGINE_BUENAS_PASSWORD
+	res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl]
 	ld hl, BuenaRadioMidnightText10
 	ld a, BUENAS_PASSWORD_9
 	jp NextRadioLine
@@ -1778,7 +1778,7 @@
 	pop af
 	ld [hBGMapMode], a
 	ld hl, wWeeklyFlags
-	res 7, [hl]
+	res WEEKLYFLAGS_BUENAS_PASSWORD_F, [hl]
 	ld a, BUENAS_PASSWORD
 	ld [wCurrentRadioLine], a
 	xor a
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -102,10 +102,10 @@
 	ret nc
 	xor a
 	ld hl, wDailyFlags
-	ld [hli], a
-	ld [hli], a
-	ld [hli], a
-	ld [hl], a
+	ld [hli], a ; wDailyFlags
+	ld [hli], a ; wWeeklyFlags
+	ld [hli], a ; wSwarmFlags
+	ld [hl], a  ; wSwarmFlags + 1
 	ld hl, wDailyRematchFlags
 rept 4
 	ld [hli], a
@@ -227,7 +227,7 @@
 
 ; unused
 	ld hl, wDailyFlags
-	set 2, [hl]
+	set DAILYFLAGS_FISH_SWARM_F, [hl]
 	ret
 ; 11522
 
@@ -234,7 +234,7 @@
 ; unused
 	and a
 	ld hl, wDailyFlags
-	bit 2, [hl]
+	bit DAILYFLAGS_FISH_SWARM_F, [hl]
 	ret nz
 	scf
 	ret
--- a/maps/BluesHouse.asm
+++ b/maps/BluesHouse.asm
@@ -19,7 +19,7 @@
 	end
 
 .ThreePM:
-	checkflag ENGINE_TEA_IN_BLUES_HOUSE
+	checkflag ENGINE_DAISYS_GROOMING
 	iftrue .AlreadyGroomedMon
 	writetext DaisyOfferGroomingText
 	yesorno
@@ -29,7 +29,7 @@
 	special Special_DaisyMassage
 	if_equal $0, .Refused
 	if_equal $1, .CantGroomEgg
-	setflag ENGINE_TEA_IN_BLUES_HOUSE
+	setflag ENGINE_DAISYS_GROOMING
 	writetext DaisyAlrightText
 	waitbutton
 	closetext
--- a/maps/GoldenrodDeptStore5F.asm
+++ b/maps/GoldenrodDeptStore5F.asm
@@ -63,7 +63,7 @@
 	opentext
 	checkcode VAR_WEEKDAY
 	if_not_equal SUNDAY, .EventIsOver
-	checkflag ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT
+	checkflag ENGINE_GOLDENROD_DEPT_STORE_TM27_RETURN
 	iftrue .EventIsOver
 	special Special_GetFirstPokemonHappiness
 	writetext UnknownText_0x56143
@@ -77,7 +77,7 @@
 	buttonsound
 	verbosegiveitem TM_RETURN
 	iffalse .Done
-	setflag ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT
+	setflag ENGINE_GOLDENROD_DEPT_STORE_TM27_RETURN
 	closetext
 	end
 
@@ -92,7 +92,7 @@
 	buttonsound
 	verbosegiveitem TM_FRUSTRATION
 	iffalse .Done
-	setflag ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT
+	setflag ENGINE_GOLDENROD_DEPT_STORE_TM27_RETURN
 	closetext
 	end
 
--- a/maps/ManiasHouse.asm
+++ b/maps/ManiasHouse.asm
@@ -31,7 +31,7 @@
 	end
 
 .alreadyhaveshuckie
-	checkflag ENGINE_SHUCKLE_GIVEN
+	checkflag ENGINE_GOT_SHUCKIE_TODAY
 	iffalse .returnshuckie
 	writetext ManiaText_TakeCareOfShuckle
 	waitbutton
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -174,7 +174,7 @@
 	opentext
 	checkflag ENGINE_RALPH
 	iftrue .Rematch
-	checkflag ENGINE_SPECIAL_WILDDATA
+	checkflag ENGINE_FISH_SWARM
 	iftrue .Swarm
 	checkcellnum PHONE_FISHER_RALPH
 	iftrue .NumberAccepted