diff options
-rw-r--r-- | constants/engine_flags.asm | 89 | ||||
-rwxr-xr-x | engine/engine_flags.asm | 197 | ||||
-rwxr-xr-x | event/happiness_egg.asm | 8 | ||||
-rwxr-xr-x | event/special.asm | 2 | ||||
-rw-r--r-- | home/audio.asm | 2 | ||||
-rw-r--r-- | home/map.asm | 4 | ||||
-rw-r--r-- | main.asm | 4 | ||||
-rw-r--r-- | wram.asm | 55 |
8 files changed, 231 insertions, 130 deletions
diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index 31a03819..4a7abeba 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -16,8 +16,7 @@ const ENGINE_POKERUS const ENGINE_ROCKET_SIGNAL_ON_CH20 const ENGINE_CREDITS_SKIP - const ENGINE_BUG_CONTEST_ON ; 10 - const ENGINE_BUG_CONTEST_TIMER + const ENGINE_BUG_CONTEST_TIMER ; 10 const ENGINE_SAFARI_ZONE const ENGINE_ROCKETS_IN_RADIO_TOWER const ENGINE_BIKE_SHOP_CALL_ENABLED @@ -32,8 +31,8 @@ const ENGINE_PLAINBADGE const ENGINE_FOGBADGE const ENGINE_MINERALBADGE - const ENGINE_STORMBADGE ; 20 - const ENGINE_GLACIERBADGE + const ENGINE_STORMBADGE + const ENGINE_GLACIERBADGE ; 20 const ENGINE_RISINGBADGE const ENGINE_BOULDERBADGE const ENGINE_CASCADEBADGE @@ -48,8 +47,8 @@ const ENGINE_UNLOCKED_UNOWNS_3 const ENGINE_UNLOCKED_UNOWNS_4 const ENGINE_UNLOCKED_UNOWNS_5 - const ENGINE_UNLOCKED_UNOWNS_6 ; 30 - const ENGINE_UNLOCKED_UNOWNS_7 + const ENGINE_UNLOCKED_UNOWNS_6 + const ENGINE_UNLOCKED_UNOWNS_7 ; 30 const ENGINE_UNLOCKED_UNOWNS_8 const ENGINE_FLYPOINT_KRISS_HOUSE const ENGINE_FLYPOINT_VIRIDIAN_POKECENTER @@ -64,8 +63,8 @@ const ENGINE_FLYPOINT_CELADON const ENGINE_FLYPOINT_FUCHSIA const ENGINE_FLYPOINT_CINNABAR - const ENGINE_FLYPOINT_INDIGO_PLATEAU ; 40 - const ENGINE_FLYPOINT_NEW_BARK + const ENGINE_FLYPOINT_INDIGO_PLATEAU + const ENGINE_FLYPOINT_NEW_BARK ; 40 const ENGINE_FLYPOINT_CHERRYGROVE const ENGINE_FLYPOINT_VIOLET const ENGINE_FLYPOINT_AZALEA @@ -79,9 +78,9 @@ const ENGINE_FLYPOINT_SILVER_CAVE const ENGINE_FLYPOINT_UNUSED const ENGINE_LUCKY_NUMBER_SHOW - const ENGINE_4F - const ENGINE_KURT_MAKING_BALLS ; 50 - const ENGINE_DAILY_BUG_CONTEST + const ENGINE_4E + const ENGINE_KURT_MAKING_BALLS + const ENGINE_DAILY_BUG_CONTEST ; 50 const ENGINE_SPECIAL_WILDDATA const ENGINE_TIME_CAPSULE const ENGINE_ALL_FRUIT_TREES @@ -94,72 +93,4 @@ const ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT const ENGINE_TEA_IN_BLUES_HOUSE const ENGINE_INDIGO_PLATEAU_RIVAL_FIGHT - const ENGINE_DAILY_MOVE_TUTOR - const ENGINE_BUENAS_PASSWORD - const ENGINE_BUENAS_PASSWORD_2 ; 60 - const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON - const ENGINE_62 - const ENGINE_PLAYER_IS_FEMALE - const ENGINE_HAVE_EXAMINED_GS_BALL - const ENGINE_JACK - const ENGINE_HUEY - const ENGINE_GAVEN - const ENGINE_BETH - const ENGINE_JOSE - const ENGINE_REENA - const ENGINE_JOEY - const ENGINE_WADE - const ENGINE_RALPH - const ENGINE_LIZ - const ENGINE_ANTHONY - const ENGINE_TODD ; 70 - const ENGINE_GINA - const ENGINE_ARNIE - const ENGINE_ALAN - const ENGINE_DANA - const ENGINE_CHAD - const ENGINE_TULLY - const ENGINE_BRENT - const ENGINE_TIFFANY - const ENGINE_VANCE - const ENGINE_WILTON - const ENGINE_PARRY - const ENGINE_ERIN - const ENGINE_BEVERLY_HAS_NUGGET - const ENGINE_JOSE_HAS_STAR_PIECE - const ENGINE_WADE_HAS_ITEM - const ENGINE_GINA_HAS_LEAF_STONE ; 80 - const ENGINE_ALAN_HAS_FIRE_STONE - const ENGINE_DANA_HAS_THUNDERSTONE - const ENGINE_DEREK_HAS_NUGGET - const ENGINE_TULLY_HAS_WATER_STONE - const ENGINE_TIFFANY_HAS_PINK_BOW - const ENGINE_WILTON_HAS_ITEM - const ENGINE_JACK_MONDAY_MORNING - const ENGINE_HUEY_WEDNESDAY_NIGHT - const ENGINE_GAVEN_THURSDAY_MORNING - const ENGINE_BETH_FRIDAY_AFTERNOON - const ENGINE_JOSE_SATURDAY_NIGHT - const ENGINE_REENA_SUNDAY_MORNING - const ENGINE_JOEY_MONDAY_AFTERNOON - const ENGINE_WADE_TUESDAY_NIGHT - const ENGINE_RALPH_WEDNESDAY_MORNING - const ENGINE_LIZ_THURSDAY_AFTERNOON ; 90 - const ENGINE_ANTHONY_FRIDAY_NIGHT - const ENGINE_TODD_SATURDAY_MORNING - const ENGINE_GINA_SUNDAY_AFTERNOON - const ENGINE_ARNIE_TUESDAY_MORNING - const ENGINE_ALAN_WEDNESDAY_AFTERNOON - const ENGINE_DANA_THURSDAY_NIGHT - const ENGINE_CHAD_FRIDAY_MORNING - const ENGINE_TULLY_SUNDAY_NIGHT - const ENGINE_BRENT_MONDAY_MORNING - const ENGINE_TIFFANY_TUESDAY_AFTERNOON - const ENGINE_VANCE_WEDNESDAY_NIGHT - const ENGINE_WILTON_THRUSDAY_MORNING - const ENGINE_PARRY_FRIDAY_AFTERNOON - const ENGINE_ERIN_SATURDAY_NIGHT - const ENGINE_KRIS_IN_CABLE_CLUB - const ENGINE_DUNSPARCE_SWARM ; a0 - const ENGINE_YANMA_SWARM NUM_ENGINE_FLAGS EQU const_value diff --git a/engine/engine_flags.asm b/engine/engine_flags.asm new file mode 100755 index 00000000..4f253336 --- /dev/null +++ b/engine/engine_flags.asm @@ -0,0 +1,197 @@ +EngineFlagAction:: ; c01b +; Do action b on engine flag de +; +; b = 0: reset flag +; = 1: set flag +; > 1: check flag, result in c +; +; Setting/resetting does not return a result. + + +; 16-bit flag ids are considered invalid, but it's nice +; to know that the infrastructure is there. + + ld a, d + cp 0 + jr z, .ceiling + jr c, .read ; cp 0 can't set carry! + jr .invalid + +; There are only $a2 engine flags, so +; anything beyond that is invalid too. + +.ceiling + ld a, e + cp NUM_ENGINE_FLAGS + jr c, .read + +; Invalid flags are treated as flag 00. + +.invalid + xor a + ld e, a + ld d, a + +; Get this flag's location. + +.read + ld hl, EngineFlags +; location + add hl, de + add hl, de +; bit + add hl, de + +; location + ld e, [hl] + inc hl + ld d, [hl] + inc hl +; bit + ld c, [hl] + +; What are we doing with this flag? + + ld a, b + cp 1 + jr c, .reset ; b = 0 + jr z, .set ; b = 1 + +; Return the given flag in c. +.check + ld a, [de] + and c + ld c, a + ret + +; Set the given flag. +.set + ld a, [de] + or c + ld [de], a + ret + +; Reset the given flag. +.reset + ld a, c + cpl ; AND all bits except the one in question + ld c, a + ld a, [de] + and c + ld [de], a + ret + +; 404d +EngineFlags: +; All locations are in WRAM bank 1. +engine_flag: MACRO + dwb \1, 1 << \2 +ENDM + ; location, bit + engine_flag wPokegearFlags, 1 ; radio card ; $0 + engine_flag wPokegearFlags, 0 ; map card + engine_flag wPokegearFlags, 2 ; phone card + engine_flag wPokegearFlags, 3 ; expn card + engine_flag wPokegearFlags, 7 ; on/off + + engine_flag wDayCareMan, 6 ; egg is ready + engine_flag wDayCareMan, 0 ; monster 1 in daycare + + engine_flag wDaycareLady, 0 ; monster 2 in daycare + + engine_flag wMomSavingMoney, 0 ; mom saving money ; $8 + engine_flag wMomSavingMoney, 7 ; dst + + engine_flag wUnusedTwoDayTimerOn, 0 ; unused + + 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 wStatusFlags2, 2 ; bug contest timer ; $10 + 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 wBikeFlags, 0 ; strength active + engine_flag wBikeFlags, 1 ; always on bike (cant surf) ; $18 + engine_flag wBikeFlags, 2 ; downhill (cycling road) + + engine_flag wJohtoBadges, 0 ; zephyrbadge + engine_flag wJohtoBadges, 1 ; hivebadge + engine_flag wJohtoBadges, 2 ; plainbadge + engine_flag wJohtoBadges, 3 ; fogbadge + engine_flag wJohtoBadges, 4 ; mineralbadge + engine_flag wJohtoBadges, 5 ; stormbadge + engine_flag wJohtoBadges, 6 ; glacierbadge ; $20 + engine_flag wJohtoBadges, 7 ; risingbadge + + engine_flag wKantoBadges, 0 ; boulderbadge + engine_flag wKantoBadges, 1 ; cascadebadge + engine_flag wKantoBadges, 2 ; thunderbadge + engine_flag wKantoBadges, 3 ; rainbowbadge + engine_flag wKantoBadges, 4 ; soulbadge + engine_flag wKantoBadges, 5 ; marshbadge + engine_flag wKantoBadges, 6 ; volcanobadge ; $28 + engine_flag wKantoBadges, 7 ; earthbadge + + engine_flag wUnlockedUnowns, 0 + engine_flag wUnlockedUnowns, 1 + engine_flag wUnlockedUnowns, 2 + engine_flag wUnlockedUnowns, 3 + engine_flag wUnlockedUnowns, 4 + engine_flag wUnlockedUnowns, 5 + engine_flag wUnlockedUnowns, 6 ; $30 + engine_flag wUnlockedUnowns, 7 + + engine_flag wVisitedSpawns, 0 ; your house + engine_flag wVisitedSpawns, 1 ; viridian pokecenter + engine_flag wVisitedSpawns, 2 ; pallet + engine_flag wVisitedSpawns, 3 ; viridian + engine_flag wVisitedSpawns, 4 ; pewter + engine_flag wVisitedSpawns, 5 ; cerulean + engine_flag wVisitedSpawns, 6 ; rock tunnel ; $38 + engine_flag wVisitedSpawns, 7 ; vermilion + engine_flag wVisitedSpawns + 1, 0 ; lavender + engine_flag wVisitedSpawns + 1, 1 ; saffron + engine_flag wVisitedSpawns + 1, 2 ; celadon + engine_flag wVisitedSpawns + 1, 3 ; fuchsia + engine_flag wVisitedSpawns + 1, 4 ; cinnabar + engine_flag wVisitedSpawns + 1, 5 ; indigo plateau + engine_flag wVisitedSpawns + 1, 6 ; new bark ; $40 + engine_flag wVisitedSpawns + 1, 7 ; cherrygrove + engine_flag wVisitedSpawns + 2, 0 ; violet + ; union cave + engine_flag wVisitedSpawns + 2, 2 ; azalea + engine_flag wVisitedSpawns + 2, 3 ; cianwood + engine_flag wVisitedSpawns + 2, 4 ; goldenrod + engine_flag wVisitedSpawns + 2, 5 ; olivine + engine_flag wVisitedSpawns + 2, 6 ; ecruteak + engine_flag wVisitedSpawns + 2, 7 ; mahogany ; $48 + engine_flag wVisitedSpawns + 3, 0 ; lake of rage + engine_flag wVisitedSpawns + 3, 1 ; blackthorn + engine_flag wVisitedSpawns + 3, 2 ; silver cave + ; fast ship + engine_flag wVisitedSpawns + 3, 4 ; unused + engine_flag wLuckyNumberShowFlag, 0 + engine_flag wStatusFlags2, 3 + + engine_flag wDailyFlags, 0 ; kurt making balls + engine_flag wDailyFlags, 1 ; did bug catching contest today ; $50 + 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 wWeeklyFlags, 0 ; mt moon square clefairy + engine_flag wWeeklyFlags, 1 ; union cave lapras ; $58 + engine_flag wWeeklyFlags, 2 ; goldenrod underground haircut used + engine_flag wWeeklyFlags, 3 ; goldenrod mall happiness event floor05 person07 + engine_flag wWeeklyFlags, 4 ; tea in blues house + engine_flag wWeeklyFlags, 5 ; indigo plateau rival fight diff --git a/event/happiness_egg.asm b/event/happiness_egg.asm index 8d738774..2d6c6f19 100755 --- a/event/happiness_egg.asm +++ b/event/happiness_egg.asm @@ -144,7 +144,7 @@ StepHappiness:: ret DaycareStep:: - ld a, [wdc40] + ld a, [wDayCareMan] bit 0, a jr z, .daycare_lady ld a, [wdc76] @@ -164,7 +164,7 @@ DaycareStep:: ld a, 5242880 / $10000 ld [hl], a .daycare_lady - ld a, [wdc77] + ld a, [wDaycareLady] bit 0, a jr z, .check_egg ld a, [wdcaf] @@ -184,7 +184,7 @@ DaycareStep:: ld a, 5242880 / $10000 ld [hl], a .check_egg - ld hl, wdc40 + ld hl, wDayCareMan bit 5, [hl] ret z ld hl, wdc78 @@ -210,7 +210,7 @@ DaycareStep:: call Random cp b ret nc - ld hl, wdc40 + ld hl, wDayCareMan res 5, [hl] set 6, [hl] ret diff --git a/event/special.asm b/event/special.asm index 3059d5cc..f0ce1564 100755 --- a/event/special.asm +++ b/event/special.asm @@ -34,7 +34,7 @@ Function73e1: call SkipNames ld de, ManiaName call CopyName2 - ld hl, wd968 + ld hl, wDailyFlags set 5, [hl] ld a, $1 ld [wd173], a diff --git a/home/audio.asm b/home/audio.asm index 0d0f1114..91c431d4 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -341,7 +341,7 @@ SpecialMapMusic:: ; 3f40 (0:3f40) jr z, .asm_3f59 cp $8 jr z, .asm_3f59 - ld a, [wd572] + ld a, [wStatusFlags2] bit 2, a jr nz, .asm_3f5e .asm_3f52 diff --git a/home/map.asm b/home/map.asm index 4b7fc2cd..ab040c6f 100644 --- a/home/map.asm +++ b/home/map.asm @@ -2358,7 +2358,7 @@ GetMapHeaderMusic:: ret .asm_2dad - ld a, [wd572] + ld a, [wStatusFlags2] bit 0, a jr z, .asm_2db9 ld de, $56 @@ -2372,7 +2372,7 @@ GetMapHeaderMusic:: jr .asm_2daa .asm_2dc1 - ld a, [wd572] + ld a, [wStatusFlags2] bit 7, a jr z, .asm_2dcd ld de, $48 @@ -252,9 +252,7 @@ TimeOfDayTable: ; c012 db NITE, 1 << NITE db -1 -EngineFlagAction:: ; c01b - dr $c01b, $c164 - +INCLUDE "engine/engine_flags.asm" INCLUDE "engine/variables.asm" IF DEF(GOLD) @@ -2894,12 +2894,12 @@ wd56e:: ds 1 ; d56e wd56f:: ds 1 ; d56f wd570:: ds 1 ; d570 wStatusFlags:: ds 1 ; d571 -wd572:: ds 1 ; d572 +wStatusFlags2:: ds 1 ; d572 wMoney:: ds 3 ; d573 wd576:: ds 1 ; d576 wd577:: ds 1 ; d577 wd578:: ds 1 ; d578 -wd579:: ds 1 ; d579 +wMomSavingMoney:: ds 1 ; d579 wCoins:: dw ; d57a @@ -3161,7 +3161,7 @@ wd678:: ds 1 ; d678 wd679:: ds 1 ; d679 wd67a:: ds 1 ; d67a wd67b:: ds 1 ; d67b -wd67c:: ds 1 ; d67c +wPokegearFlags:: ds 1 ; d67c wd67d:: ds 1 ; d67d wd67e:: ds 1 ; d67e wd67f:: ds 1 ; d67f @@ -3660,8 +3660,8 @@ wMomItemTriggerBalance:: ds 3 ; d963 wd966:: ds 1 ; d966 wd967:: ds 1 ; d967 -wd968:: ds 1 ; d968 -wd969:: ds 1 ; d969 +wDailyFlags:: ds 1 ; d968 +wWeeklyFlags:: ds 1 ; d969 wd96a:: ds 1 ; d96a wd96b:: ds 1 ; d96b wd96c:: ds 1 ; d96c @@ -3687,7 +3687,7 @@ wd97f:: ds 1 ; d97f wd980:: ds 1 ; d980 wd981:: ds 1 ; d981 wd982:: ds 1 ; d982 -wd983:: ds 1 ; d983 +wUnusedTwoDayTimerOn:: ds 1 ; d983 wd984:: ds 1 ; d984 wd985:: ds 1 ; d985 wd986:: ds 1 ; d986 @@ -3787,17 +3787,17 @@ wd9e3:: ds 1 ; d9e3 wd9e4:: ds 1 ; d9e4 wd9e5:: ds 1 ; d9e5 wd9e6:: ds 1 ; d9e6 -wd9e7:: ds 1 ; d9e7 +wLuckyNumberShowFlag:: ds 1 ; d9e7 wd9e8:: ds 1 ; d9e8 wd9e9:: ds 1 ; d9e9 wd9ea:: ds 1 ; d9ea wd9eb:: ds 1 ; d9eb wd9ec:: ds 1 ; d9ec wd9ed:: ds 1 ; d9ed -wd9ee:: ds 1 ; d9ee -wd9ef:: ds 1 ; d9ef -wd9f0:: ds 1 ; d9f0 -wd9f1:: ds 1 ; d9f1 + +wMapData:: +wVisitedSpawns:: ds 4 ; flag_array NUM_SPAWNS ; d9ee + wd9f2:: ds 1 ; d9f2 wd9f3:: ds 1 ; d9f3 wd9f4:: ds 1 ; d9f4 @@ -3905,35 +3905,10 @@ wdbe3:: ds 1 ; dbe3 wPokedexCaught:: flag_array NUM_POKEMON ; dbe4 wPokedexSeen:: flag_array NUM_POKEMON ; dc04 -wdc24:: ds 1 ; dc24 -wdc25:: ds 1 ; dc25 -wdc26:: ds 1 ; dc26 -wdc27:: ds 1 ; dc27 -wdc28:: ds 1 ; dc28 -wdc29:: ds 1 ; dc29 -wdc2a:: ds 1 ; dc2a -wdc2b:: ds 1 ; dc2b -wdc2c:: ds 1 ; dc2c -wdc2d:: ds 1 ; dc2d -wdc2e:: ds 1 ; dc2e -wdc2f:: ds 1 ; dc2f -wdc30:: ds 1 ; dc30 -wdc31:: ds 1 ; dc31 -wdc32:: ds 1 ; dc32 -wdc33:: ds 1 ; dc33 -wdc34:: ds 1 ; dc34 -wdc35:: ds 1 ; dc35 -wdc36:: ds 1 ; dc36 -wdc37:: ds 1 ; dc37 -wdc38:: ds 1 ; dc38 -wdc39:: ds 1 ; dc39 -wdc3a:: ds 1 ; dc3a -wdc3b:: ds 1 ; dc3b -wdc3c:: ds 1 ; dc3c -wdc3d:: ds 1 ; dc3d -wdc3e:: ds 1 ; dc3e +wUnownDex:: ds 26 ; dc24 +wUnlockedUnowns:: ds 1 ; dc3e wdc3f:: ds 1 ; dc3f -wdc40:: ds 1 ; dc40 +wDayCareMan:: ds 1 ; dc40 wdc41:: ds 1 ; dc41 wdc42:: ds 1 ; dc42 wdc43:: ds 1 ; dc43 @@ -3988,7 +3963,7 @@ wdc73:: ds 1 ; dc73 wdc74:: ds 1 ; dc74 wdc75:: ds 1 ; dc75 wdc76:: ds 1 ; dc76 -wdc77:: ds 1 ; dc77 +wDaycareLady:: ds 1 ; dc77 wdc78:: ds 1 ; dc78 wdc79:: ds 1 ; dc79 wdc7a:: ds 1 ; dc7a |