From ba4368d0e8ebaeabf57cd5ae0105afb4f4eee6f8 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sat, 5 Nov 2022 15:48:36 -0300 Subject: [PATCH] Macros for `weekEventReg` and `eventInf` (#984) * make macros * script * Use the script on the whole codebase * fix script * Rename GET to CHECk * More replacements * Update weekeventflags on schedule scripts * eventinf defines * eventinfconvert * run the scripts on the codebase * format * RACE_FLAGS * format * remove redundant parenthesis * format * add macros to permuter_settings * comments on WEEKEVENTREG_ * format * CHECK_WEEKEVENTREG_ALT * don't automatically generate the macros on the script to allow naming them * format D_801C66D0 a bit * add TODOs * Update src/overlays/actors/ovl_Boss_03/z_boss_03.c Co-authored-by: Derek Hensley * Update src/overlays/actors/ovl_En_Baisen/z_en_baisen.c Co-authored-by: Derek Hensley * Update src/overlays/actors/ovl_Boss_06/z_boss_06.c Co-authored-by: Derek Hensley * Update src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c Co-authored-by: Derek Hensley * Update src/overlays/actors/ovl_En_Raf/z_en_raf.c Co-authored-by: Derek Hensley * review Co-authored-by: Derek Hensley * new files * format * weekeventreg * review Co-authored-by: Derek Hensley * review Co-authored-by: EllipticEllipsis * update * format * review Co-authored-by: EllipticEllipsis * flags * a * eventinf stuff * format * EnGakufu * flags * run the script * format * whoops * cleanup * fix * update weekeventregs * format * format * review * format Co-authored-by: Derek Hensley Co-authored-by: EllipticEllipsis --- include/z64ocarina.h | 2 +- include/z64save.h | 1007 +++++++++++++++++ include/z64schedule.h | 8 +- src/code/z_actor.c | 6 +- src/code/z_demo.c | 9 +- src/code/z_elf_message.c | 24 +- src/code/z_game_over.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_message.c | 11 +- src/code/z_parameter.c | 50 +- src/code/z_schedule.c | 8 +- src/code/z_sram_NES.c | 172 ++- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 10 +- .../ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c | 6 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c | 16 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 43 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c | 4 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c | 18 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 12 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 20 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 8 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 12 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 4 +- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 2 +- .../actors/ovl_Dm_Char01/z_dm_char01.c | 16 +- .../actors/ovl_Dm_Char06/z_dm_char06.c | 2 +- .../actors/ovl_Dm_Char08/z_dm_char08.c | 16 +- .../actors/ovl_Dm_Ravine/z_dm_ravine.c | 2 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 6 +- src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 20 +- src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c | 52 +- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 2 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 72 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 12 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 5 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 54 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 92 +- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 34 +- .../actors/ovl_En_Baisen/z_en_baisen.c | 8 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 6 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 76 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 16 +- src/overlays/actors/ovl_En_Bjt/z_en_bjt.c | 4 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 22 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 14 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 50 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 7 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 58 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 44 +- src/overlays/actors/ovl_En_Cha/z_en_cha.c | 10 +- .../actors/ovl_En_Col_Man/z_en_col_man.c | 8 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 10 +- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 10 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 3 +- .../actors/ovl_En_Daiku2/z_en_daiku2.c | 8 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 2 + src/overlays/actors/ovl_En_Dno/z_en_dno.c | 16 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 16 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 10 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 22 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 18 +- .../actors/ovl_En_Dragon/z_en_dragon.c | 18 +- src/overlays/actors/ovl_En_Drs/z_en_drs.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- .../actors/ovl_En_Elfgrp/z_en_elfgrp.c | 8 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 4 +- .../actors/ovl_En_Encount4/z_en_encount4.c | 2 +- src/overlays/actors/ovl_En_Fall/z_en_fall.c | 12 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 36 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 25 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 54 +- .../actors/ovl_En_Gakufu/z_en_gakufu.c | 24 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 62 +- src/overlays/actors/ovl_En_Geg/z_en_geg.c | 10 +- src/overlays/actors/ovl_En_Gg/z_en_gg.c | 28 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 62 +- src/overlays/actors/ovl_En_Giant/z_en_giant.c | 2 +- .../actors/ovl_En_Ginko_Man/z_en_ginko_man.c | 26 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 4 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 52 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 18 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 26 +- .../ovl_En_Grasshopper/z_en_grasshopper.c | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 16 +- .../ovl_En_Guard_Nuts/z_en_guard_nuts.c | 10 +- .../actors/ovl_En_Guruguru/z_en_guruguru.c | 20 +- .../actors/ovl_En_Heishi/z_en_heishi.c | 6 +- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 9 +- src/overlays/actors/ovl_En_Hgo/z_en_hgo.c | 7 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 +- .../z_en_horse_game_check.c | 20 +- .../z_en_horse_game_check.h | 16 - .../z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 4 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 6 +- src/overlays/actors/ovl_En_In/z_en_in.c | 126 ++- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 31 +- .../actors/ovl_En_Jc_Mato/z_en_jc_mato.c | 2 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 18 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 12 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 6 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 16 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 16 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 10 +- .../actors/ovl_En_Kujiya/z_en_kujiya.c | 18 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c | 33 +- .../actors/ovl_En_Look_Nuts/z_en_look_nuts.c | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 2 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 28 +- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 78 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 28 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 37 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 54 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 4 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 18 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 46 +- src/overlays/actors/ovl_En_Muto/z_en_muto.c | 12 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 2 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 3 +- src/overlays/actors/ovl_En_Osn/z_en_osn.c | 16 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 24 +- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 36 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 8 +- .../actors/ovl_En_Pamera/z_en_pamera.c | 46 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 13 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 64 +- src/overlays/actors/ovl_En_Pst/z_en_pst.c | 28 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 + src/overlays/actors/ovl_En_Raf/z_en_raf.c | 6 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 2 +- .../actors/ovl_En_Recepgirl/z_en_recepgirl.c | 4 +- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 6 +- src/overlays/actors/ovl_En_Rz/z_en_rz.c | 20 +- .../actors/ovl_En_S_Goro/z_en_s_goro.c | 68 +- .../actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c | 24 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.c | 54 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 15 +- .../actors/ovl_En_Sekihi/z_en_sekihi.c | 7 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 26 +- src/overlays/actors/ovl_En_Shn/z_en_shn.c | 10 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 2 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 74 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 4 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 44 +- .../ovl_En_Stone_heishi/z_en_stone_heishi.c | 16 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 42 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 76 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 3 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 17 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 14 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 4 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.c | 12 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 12 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 22 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 50 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 32 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 20 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 12 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 34 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 6 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 2 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 5 +- src/overlays/actors/ovl_En_Zob/z_en_zob.c | 30 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 14 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 12 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 44 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 118 +- src/overlays/actors/ovl_En_Zov/z_en_zov.c | 10 +- src/overlays/actors/ovl_En_Zow/z_en_zow.c | 24 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 4 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 4 +- .../actors/ovl_Obj_Dinner/z_obj_dinner.c | 2 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 10 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c | 2 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 2 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 2 +- .../actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c | 6 +- .../ovl_Obj_Moon_Stone/z_obj_moon_stone.c | 10 +- .../actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c | 2 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.c | 10 +- .../actors/ovl_Obj_Purify/z_obj_purify.c | 9 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 12 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 78 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 2 +- tools/eventinfconvert.py | 91 ++ tools/overlayhelpers/scheduledis.py | 6 +- tools/permuter_settings.toml | 10 + tools/weekeventregconvert.py | 889 +++++++++++++++ 191 files changed, 3964 insertions(+), 1907 deletions(-) create mode 100755 tools/eventinfconvert.py create mode 100755 tools/weekeventregconvert.py diff --git a/include/z64ocarina.h b/include/z64ocarina.h index 597580388c..3bb99cd628 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -82,7 +82,7 @@ typedef enum { /* 13 */ OCARINA_INSTRUMENT_PIANO, /* 14 */ OCARINA_INSTRUMENT_BASS_GUITAR, /* 15 */ OCARINA_INSTRUMENT_BABY_SINGING, - /* 16 */ OCARINA_INSTRUMENT_AMPLIFIED_GUITAR // Related to (gSaveContext.weekEventReg[41] & 0x20) + /* 16 */ OCARINA_INSTRUMENT_AMPLIFIED_GUITAR // Related to WEEKEVENTREG_41_20 } OcarinaInstrumentId; typedef enum { diff --git a/include/z64save.h b/include/z64save.h index fa65031eb0..009e201906 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -462,6 +462,1013 @@ typedef enum SunsSongState { #define SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = (gSaveContext.save.shootingGalleryHighScores & 0xFFFF0000) | ((u16)(score))) #define SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = ((gSaveContext.save.shootingGalleryHighScores) & 0xFFFF) | ((u16)(score) << 0x10)) +/** + * gSaveContext.save.weekEventReg + */ + +#define PACK_WEEKEVENTREG_FLAG(index, mask) (((index) << 8) | (mask)) + +#define WEEKEVENTREG_00_01 PACK_WEEKEVENTREG_FLAG(0, 0x01) +#define WEEKEVENTREG_00_02 PACK_WEEKEVENTREG_FLAG(0, 0x02) +#define WEEKEVENTREG_00_04 PACK_WEEKEVENTREG_FLAG(0, 0x04) +#define WEEKEVENTREG_00_08 PACK_WEEKEVENTREG_FLAG(0, 0x08) +#define WEEKEVENTREG_00_10 PACK_WEEKEVENTREG_FLAG(0, 0x10) +#define WEEKEVENTREG_00_20 PACK_WEEKEVENTREG_FLAG(0, 0x20) +#define WEEKEVENTREG_00_40 PACK_WEEKEVENTREG_FLAG(0, 0x40) +#define WEEKEVENTREG_00_80 PACK_WEEKEVENTREG_FLAG(0, 0x80) +#define WEEKEVENTREG_01_01 PACK_WEEKEVENTREG_FLAG(1, 0x01) +#define WEEKEVENTREG_01_02 PACK_WEEKEVENTREG_FLAG(1, 0x02) +#define WEEKEVENTREG_01_04 PACK_WEEKEVENTREG_FLAG(1, 0x04) +#define WEEKEVENTREG_01_08 PACK_WEEKEVENTREG_FLAG(1, 0x08) +#define WEEKEVENTREG_01_10 PACK_WEEKEVENTREG_FLAG(1, 0x10) +#define WEEKEVENTREG_01_20 PACK_WEEKEVENTREG_FLAG(1, 0x20) +#define WEEKEVENTREG_01_40 PACK_WEEKEVENTREG_FLAG(1, 0x40) +#define WEEKEVENTREG_01_80 PACK_WEEKEVENTREG_FLAG(1, 0x80) +#define WEEKEVENTREG_02_01 PACK_WEEKEVENTREG_FLAG(2, 0x01) +#define WEEKEVENTREG_02_02 PACK_WEEKEVENTREG_FLAG(2, 0x02) +#define WEEKEVENTREG_02_04 PACK_WEEKEVENTREG_FLAG(2, 0x04) +#define WEEKEVENTREG_02_08 PACK_WEEKEVENTREG_FLAG(2, 0x08) +#define WEEKEVENTREG_02_10 PACK_WEEKEVENTREG_FLAG(2, 0x10) +#define WEEKEVENTREG_02_20 PACK_WEEKEVENTREG_FLAG(2, 0x20) +#define WEEKEVENTREG_02_40 PACK_WEEKEVENTREG_FLAG(2, 0x40) +#define WEEKEVENTREG_02_80 PACK_WEEKEVENTREG_FLAG(2, 0x80) +#define WEEKEVENTREG_03_01 PACK_WEEKEVENTREG_FLAG(3, 0x01) +#define WEEKEVENTREG_03_02 PACK_WEEKEVENTREG_FLAG(3, 0x02) +#define WEEKEVENTREG_03_04 PACK_WEEKEVENTREG_FLAG(3, 0x04) +#define WEEKEVENTREG_03_08 PACK_WEEKEVENTREG_FLAG(3, 0x08) +#define WEEKEVENTREG_03_10 PACK_WEEKEVENTREG_FLAG(3, 0x10) +#define WEEKEVENTREG_03_20 PACK_WEEKEVENTREG_FLAG(3, 0x20) +#define WEEKEVENTREG_03_40 PACK_WEEKEVENTREG_FLAG(3, 0x40) +#define WEEKEVENTREG_03_80 PACK_WEEKEVENTREG_FLAG(3, 0x80) +#define WEEKEVENTREG_04_01 PACK_WEEKEVENTREG_FLAG(4, 0x01) +#define WEEKEVENTREG_04_02 PACK_WEEKEVENTREG_FLAG(4, 0x02) +#define WEEKEVENTREG_04_04 PACK_WEEKEVENTREG_FLAG(4, 0x04) +#define WEEKEVENTREG_04_08 PACK_WEEKEVENTREG_FLAG(4, 0x08) +#define WEEKEVENTREG_04_10 PACK_WEEKEVENTREG_FLAG(4, 0x10) +#define WEEKEVENTREG_04_20 PACK_WEEKEVENTREG_FLAG(4, 0x20) +#define WEEKEVENTREG_04_40 PACK_WEEKEVENTREG_FLAG(4, 0x40) +#define WEEKEVENTREG_04_80 PACK_WEEKEVENTREG_FLAG(4, 0x80) +#define WEEKEVENTREG_05_01 PACK_WEEKEVENTREG_FLAG(5, 0x01) +#define WEEKEVENTREG_05_02 PACK_WEEKEVENTREG_FLAG(5, 0x02) +#define WEEKEVENTREG_05_04 PACK_WEEKEVENTREG_FLAG(5, 0x04) +#define WEEKEVENTREG_05_08 PACK_WEEKEVENTREG_FLAG(5, 0x08) +#define WEEKEVENTREG_05_10 PACK_WEEKEVENTREG_FLAG(5, 0x10) +#define WEEKEVENTREG_05_20 PACK_WEEKEVENTREG_FLAG(5, 0x20) +#define WEEKEVENTREG_05_40 PACK_WEEKEVENTREG_FLAG(5, 0x40) +#define WEEKEVENTREG_05_80 PACK_WEEKEVENTREG_FLAG(5, 0x80) +#define WEEKEVENTREG_06_01 PACK_WEEKEVENTREG_FLAG(6, 0x01) +#define WEEKEVENTREG_06_02 PACK_WEEKEVENTREG_FLAG(6, 0x02) +#define WEEKEVENTREG_06_04 PACK_WEEKEVENTREG_FLAG(6, 0x04) +#define WEEKEVENTREG_06_08 PACK_WEEKEVENTREG_FLAG(6, 0x08) +#define WEEKEVENTREG_06_10 PACK_WEEKEVENTREG_FLAG(6, 0x10) +#define WEEKEVENTREG_06_20 PACK_WEEKEVENTREG_FLAG(6, 0x20) +#define WEEKEVENTREG_06_40 PACK_WEEKEVENTREG_FLAG(6, 0x40) +#define WEEKEVENTREG_06_80 PACK_WEEKEVENTREG_FLAG(6, 0x80) +#define WEEKEVENTREG_07_01 PACK_WEEKEVENTREG_FLAG(7, 0x01) +#define WEEKEVENTREG_07_02 PACK_WEEKEVENTREG_FLAG(7, 0x02) +#define WEEKEVENTREG_07_04 PACK_WEEKEVENTREG_FLAG(7, 0x04) +#define WEEKEVENTREG_07_08 PACK_WEEKEVENTREG_FLAG(7, 0x08) +#define WEEKEVENTREG_07_10 PACK_WEEKEVENTREG_FLAG(7, 0x10) +#define WEEKEVENTREG_07_20 PACK_WEEKEVENTREG_FLAG(7, 0x20) +#define WEEKEVENTREG_07_40 PACK_WEEKEVENTREG_FLAG(7, 0x40) +#define WEEKEVENTREG_07_80 PACK_WEEKEVENTREG_FLAG(7, 0x80) +#define WEEKEVENTREG_08_01 PACK_WEEKEVENTREG_FLAG(8, 0x01) +#define WEEKEVENTREG_08_02 PACK_WEEKEVENTREG_FLAG(8, 0x02) +#define WEEKEVENTREG_08_04 PACK_WEEKEVENTREG_FLAG(8, 0x04) +#define WEEKEVENTREG_08_08 PACK_WEEKEVENTREG_FLAG(8, 0x08) +#define WEEKEVENTREG_08_10 PACK_WEEKEVENTREG_FLAG(8, 0x10) +#define WEEKEVENTREG_08_20 PACK_WEEKEVENTREG_FLAG(8, 0x20) +#define WEEKEVENTREG_08_40 PACK_WEEKEVENTREG_FLAG(8, 0x40) +#define WEEKEVENTREG_08_80 PACK_WEEKEVENTREG_FLAG(8, 0x80) +#define WEEKEVENTREG_09_01 PACK_WEEKEVENTREG_FLAG(9, 0x01) +#define WEEKEVENTREG_09_02 PACK_WEEKEVENTREG_FLAG(9, 0x02) +#define WEEKEVENTREG_09_04 PACK_WEEKEVENTREG_FLAG(9, 0x04) +#define WEEKEVENTREG_09_08 PACK_WEEKEVENTREG_FLAG(9, 0x08) +#define WEEKEVENTREG_09_10 PACK_WEEKEVENTREG_FLAG(9, 0x10) +#define WEEKEVENTREG_09_20 PACK_WEEKEVENTREG_FLAG(9, 0x20) +#define WEEKEVENTREG_09_40 PACK_WEEKEVENTREG_FLAG(9, 0x40) +#define WEEKEVENTREG_09_80 PACK_WEEKEVENTREG_FLAG(9, 0x80) +#define WEEKEVENTREG_10_01 PACK_WEEKEVENTREG_FLAG(10, 0x01) +#define WEEKEVENTREG_10_02 PACK_WEEKEVENTREG_FLAG(10, 0x02) +#define WEEKEVENTREG_10_04 PACK_WEEKEVENTREG_FLAG(10, 0x04) +#define WEEKEVENTREG_10_08 PACK_WEEKEVENTREG_FLAG(10, 0x08) +#define WEEKEVENTREG_10_10 PACK_WEEKEVENTREG_FLAG(10, 0x10) +#define WEEKEVENTREG_10_20 PACK_WEEKEVENTREG_FLAG(10, 0x20) +#define WEEKEVENTREG_10_40 PACK_WEEKEVENTREG_FLAG(10, 0x40) +#define WEEKEVENTREG_10_80 PACK_WEEKEVENTREG_FLAG(10, 0x80) +#define WEEKEVENTREG_11_01 PACK_WEEKEVENTREG_FLAG(11, 0x01) +#define WEEKEVENTREG_11_02 PACK_WEEKEVENTREG_FLAG(11, 0x02) +#define WEEKEVENTREG_11_04 PACK_WEEKEVENTREG_FLAG(11, 0x04) +#define WEEKEVENTREG_11_08 PACK_WEEKEVENTREG_FLAG(11, 0x08) +#define WEEKEVENTREG_11_10 PACK_WEEKEVENTREG_FLAG(11, 0x10) +#define WEEKEVENTREG_11_20 PACK_WEEKEVENTREG_FLAG(11, 0x20) +#define WEEKEVENTREG_11_40 PACK_WEEKEVENTREG_FLAG(11, 0x40) +#define WEEKEVENTREG_11_80 PACK_WEEKEVENTREG_FLAG(11, 0x80) + +// woodfall temple wood flower opened +#define WEEKEVENTREG_12_01 PACK_WEEKEVENTREG_FLAG(12, 0x01) + +#define WEEKEVENTREG_12_02 PACK_WEEKEVENTREG_FLAG(12, 0x02) +#define WEEKEVENTREG_12_04 PACK_WEEKEVENTREG_FLAG(12, 0x04) +#define WEEKEVENTREG_12_08 PACK_WEEKEVENTREG_FLAG(12, 0x08) +#define WEEKEVENTREG_12_10 PACK_WEEKEVENTREG_FLAG(12, 0x10) +#define WEEKEVENTREG_12_20 PACK_WEEKEVENTREG_FLAG(12, 0x20) +#define WEEKEVENTREG_12_40 PACK_WEEKEVENTREG_FLAG(12, 0x40) +#define WEEKEVENTREG_12_80 PACK_WEEKEVENTREG_FLAG(12, 0x80) +#define WEEKEVENTREG_13_01 PACK_WEEKEVENTREG_FLAG(13, 0x01) +#define WEEKEVENTREG_13_02 PACK_WEEKEVENTREG_FLAG(13, 0x02) +#define WEEKEVENTREG_13_04 PACK_WEEKEVENTREG_FLAG(13, 0x04) +#define WEEKEVENTREG_13_08 PACK_WEEKEVENTREG_FLAG(13, 0x08) +#define WEEKEVENTREG_13_10 PACK_WEEKEVENTREG_FLAG(13, 0x10) +#define WEEKEVENTREG_13_20 PACK_WEEKEVENTREG_FLAG(13, 0x20) +#define WEEKEVENTREG_13_40 PACK_WEEKEVENTREG_FLAG(13, 0x40) +#define WEEKEVENTREG_13_80 PACK_WEEKEVENTREG_FLAG(13, 0x80) + +// PlayedMilkMinigame +// Attempted Cremia Cart Ride +#define WEEKEVENTREG_14_01 PACK_WEEKEVENTREG_FLAG(14, 0x01) + +#define WEEKEVENTREG_14_02 PACK_WEEKEVENTREG_FLAG(14, 0x02) +#define WEEKEVENTREG_14_04 PACK_WEEKEVENTREG_FLAG(14, 0x04) +#define WEEKEVENTREG_14_08 PACK_WEEKEVENTREG_FLAG(14, 0x08) +#define WEEKEVENTREG_14_10 PACK_WEEKEVENTREG_FLAG(14, 0x10) +#define WEEKEVENTREG_14_20 PACK_WEEKEVENTREG_FLAG(14, 0x20) +#define WEEKEVENTREG_14_40 PACK_WEEKEVENTREG_FLAG(14, 0x40) +#define WEEKEVENTREG_14_80 PACK_WEEKEVENTREG_FLAG(14, 0x80) +#define WEEKEVENTREG_15_01 PACK_WEEKEVENTREG_FLAG(15, 0x01) +#define WEEKEVENTREG_15_02 PACK_WEEKEVENTREG_FLAG(15, 0x02) +#define WEEKEVENTREG_15_04 PACK_WEEKEVENTREG_FLAG(15, 0x04) +#define WEEKEVENTREG_15_08 PACK_WEEKEVENTREG_FLAG(15, 0x08) +#define WEEKEVENTREG_15_10 PACK_WEEKEVENTREG_FLAG(15, 0x10) +#define WEEKEVENTREG_15_20 PACK_WEEKEVENTREG_FLAG(15, 0x20) +#define WEEKEVENTREG_15_40 PACK_WEEKEVENTREG_FLAG(15, 0x40) +#define WEEKEVENTREG_15_80 PACK_WEEKEVENTREG_FLAG(15, 0x80) +#define WEEKEVENTREG_16_01 PACK_WEEKEVENTREG_FLAG(16, 0x01) +#define WEEKEVENTREG_16_02 PACK_WEEKEVENTREG_FLAG(16, 0x02) +#define WEEKEVENTREG_16_04 PACK_WEEKEVENTREG_FLAG(16, 0x04) +#define WEEKEVENTREG_16_08 PACK_WEEKEVENTREG_FLAG(16, 0x08) +#define WEEKEVENTREG_16_10 PACK_WEEKEVENTREG_FLAG(16, 0x10) +#define WEEKEVENTREG_16_20 PACK_WEEKEVENTREG_FLAG(16, 0x20) +#define WEEKEVENTREG_16_40 PACK_WEEKEVENTREG_FLAG(16, 0x40) +#define WEEKEVENTREG_16_80 PACK_WEEKEVENTREG_FLAG(16, 0x80) +#define WEEKEVENTREG_17_01 PACK_WEEKEVENTREG_FLAG(17, 0x01) +#define WEEKEVENTREG_17_02 PACK_WEEKEVENTREG_FLAG(17, 0x02) +#define WEEKEVENTREG_17_04 PACK_WEEKEVENTREG_FLAG(17, 0x04) +#define WEEKEVENTREG_17_08 PACK_WEEKEVENTREG_FLAG(17, 0x08) +#define WEEKEVENTREG_17_10 PACK_WEEKEVENTREG_FLAG(17, 0x10) +#define WEEKEVENTREG_17_20 PACK_WEEKEVENTREG_FLAG(17, 0x20) +#define WEEKEVENTREG_17_40 PACK_WEEKEVENTREG_FLAG(17, 0x40) +#define WEEKEVENTREG_17_80 PACK_WEEKEVENTREG_FLAG(17, 0x80) +#define WEEKEVENTREG_18_01 PACK_WEEKEVENTREG_FLAG(18, 0x01) +#define WEEKEVENTREG_18_02 PACK_WEEKEVENTREG_FLAG(18, 0x02) +#define WEEKEVENTREG_18_04 PACK_WEEKEVENTREG_FLAG(18, 0x04) +#define WEEKEVENTREG_18_08 PACK_WEEKEVENTREG_FLAG(18, 0x08) +#define WEEKEVENTREG_18_10 PACK_WEEKEVENTREG_FLAG(18, 0x10) +#define WEEKEVENTREG_18_20 PACK_WEEKEVENTREG_FLAG(18, 0x20) +#define WEEKEVENTREG_18_40 PACK_WEEKEVENTREG_FLAG(18, 0x40) +#define WEEKEVENTREG_18_80 PACK_WEEKEVENTREG_FLAG(18, 0x80) +#define WEEKEVENTREG_19_01 PACK_WEEKEVENTREG_FLAG(19, 0x01) +#define WEEKEVENTREG_19_02 PACK_WEEKEVENTREG_FLAG(19, 0x02) +#define WEEKEVENTREG_19_04 PACK_WEEKEVENTREG_FLAG(19, 0x04) +#define WEEKEVENTREG_19_08 PACK_WEEKEVENTREG_FLAG(19, 0x08) +#define WEEKEVENTREG_19_10 PACK_WEEKEVENTREG_FLAG(19, 0x10) +#define WEEKEVENTREG_19_20 PACK_WEEKEVENTREG_FLAG(19, 0x20) +#define WEEKEVENTREG_19_40 PACK_WEEKEVENTREG_FLAG(19, 0x40) +#define WEEKEVENTREG_19_80 PACK_WEEKEVENTREG_FLAG(19, 0x80) +#define WEEKEVENTREG_20_01 PACK_WEEKEVENTREG_FLAG(20, 0x01) + +// woodfall temple purification cutscene watched +#define WEEKEVENTREG_20_02 PACK_WEEKEVENTREG_FLAG(20, 0x02) + +#define WEEKEVENTREG_20_04 PACK_WEEKEVENTREG_FLAG(20, 0x04) +#define WEEKEVENTREG_20_08 PACK_WEEKEVENTREG_FLAG(20, 0x08) +#define WEEKEVENTREG_20_10 PACK_WEEKEVENTREG_FLAG(20, 0x10) +#define WEEKEVENTREG_20_20 PACK_WEEKEVENTREG_FLAG(20, 0x20) +#define WEEKEVENTREG_20_40 PACK_WEEKEVENTREG_FLAG(20, 0x40) +#define WEEKEVENTREG_20_80 PACK_WEEKEVENTREG_FLAG(20, 0x80) +#define WEEKEVENTREG_21_01 PACK_WEEKEVENTREG_FLAG(21, 0x01) +#define WEEKEVENTREG_21_02 PACK_WEEKEVENTREG_FLAG(21, 0x02) +#define WEEKEVENTREG_21_04 PACK_WEEKEVENTREG_FLAG(21, 0x04) +#define WEEKEVENTREG_21_08 PACK_WEEKEVENTREG_FLAG(21, 0x08) +#define WEEKEVENTREG_21_10 PACK_WEEKEVENTREG_FLAG(21, 0x10) +#define WEEKEVENTREG_21_20 PACK_WEEKEVENTREG_FLAG(21, 0x20) +#define WEEKEVENTREG_21_40 PACK_WEEKEVENTREG_FLAG(21, 0x40) +#define WEEKEVENTREG_21_80 PACK_WEEKEVENTREG_FLAG(21, 0x80) + +// Aliens defeated +// "Winning" the alien invasion +#define WEEKEVENTREG_22_01 PACK_WEEKEVENTREG_FLAG(22, 0x01) + +#define WEEKEVENTREG_22_02 PACK_WEEKEVENTREG_FLAG(22, 0x02) +#define WEEKEVENTREG_22_04 PACK_WEEKEVENTREG_FLAG(22, 0x04) +#define WEEKEVENTREG_22_08 PACK_WEEKEVENTREG_FLAG(22, 0x08) +#define WEEKEVENTREG_22_10 PACK_WEEKEVENTREG_FLAG(22, 0x10) +#define WEEKEVENTREG_22_20 PACK_WEEKEVENTREG_FLAG(22, 0x20) +#define WEEKEVENTREG_22_40 PACK_WEEKEVENTREG_FLAG(22, 0x40) +#define WEEKEVENTREG_22_80 PACK_WEEKEVENTREG_FLAG(22, 0x80) +#define WEEKEVENTREG_23_01 PACK_WEEKEVENTREG_FLAG(23, 0x01) +#define WEEKEVENTREG_23_02 PACK_WEEKEVENTREG_FLAG(23, 0x02) +#define WEEKEVENTREG_23_04 PACK_WEEKEVENTREG_FLAG(23, 0x04) +#define WEEKEVENTREG_23_08 PACK_WEEKEVENTREG_FLAG(23, 0x08) +#define WEEKEVENTREG_23_10 PACK_WEEKEVENTREG_FLAG(23, 0x10) +#define WEEKEVENTREG_23_20 PACK_WEEKEVENTREG_FLAG(23, 0x20) +#define WEEKEVENTREG_23_40 PACK_WEEKEVENTREG_FLAG(23, 0x40) +#define WEEKEVENTREG_23_80 PACK_WEEKEVENTREG_FLAG(23, 0x80) +#define WEEKEVENTREG_24_01 PACK_WEEKEVENTREG_FLAG(24, 0x01) +#define WEEKEVENTREG_24_02 PACK_WEEKEVENTREG_FLAG(24, 0x02) +#define WEEKEVENTREG_24_04 PACK_WEEKEVENTREG_FLAG(24, 0x04) +#define WEEKEVENTREG_24_08 PACK_WEEKEVENTREG_FLAG(24, 0x08) + +// The player has already talked as a Goron at least once to Goron elder +#define WEEKEVENTREG_24_10 PACK_WEEKEVENTREG_FLAG(24, 0x10) + +// The player has already talked as a non-Goron at least once +#define WEEKEVENTREG_24_20 PACK_WEEKEVENTREG_FLAG(24, 0x20) + +#define WEEKEVENTREG_24_40 PACK_WEEKEVENTREG_FLAG(24, 0x40) + +// The player has talked to the Goron Child at least once +#define WEEKEVENTREG_24_80 PACK_WEEKEVENTREG_FLAG(24, 0x80) + +#define WEEKEVENTREG_25_01 PACK_WEEKEVENTREG_FLAG(25, 0x01) +#define WEEKEVENTREG_25_02 PACK_WEEKEVENTREG_FLAG(25, 0x02) +#define WEEKEVENTREG_25_04 PACK_WEEKEVENTREG_FLAG(25, 0x04) + +// breman mask was already used +#define WEEKEVENTREG_25_08 PACK_WEEKEVENTREG_FLAG(25, 0x08) + +#define WEEKEVENTREG_25_10 PACK_WEEKEVENTREG_FLAG(25, 0x10) +#define WEEKEVENTREG_25_20 PACK_WEEKEVENTREG_FLAG(25, 0x20) +#define WEEKEVENTREG_25_40 PACK_WEEKEVENTREG_FLAG(25, 0x40) +#define WEEKEVENTREG_25_80 PACK_WEEKEVENTREG_FLAG(25, 0x80) +#define WEEKEVENTREG_26_01 PACK_WEEKEVENTREG_FLAG(26, 0x01) +#define WEEKEVENTREG_26_02 PACK_WEEKEVENTREG_FLAG(26, 0x02) +#define WEEKEVENTREG_26_04 PACK_WEEKEVENTREG_FLAG(26, 0x04) +#define WEEKEVENTREG_26_08 PACK_WEEKEVENTREG_FLAG(26, 0x08) +#define WEEKEVENTREG_26_10 PACK_WEEKEVENTREG_FLAG(26, 0x10) +#define WEEKEVENTREG_26_20 PACK_WEEKEVENTREG_FLAG(26, 0x20) +#define WEEKEVENTREG_26_40 PACK_WEEKEVENTREG_FLAG(26, 0x40) +#define WEEKEVENTREG_26_80 PACK_WEEKEVENTREG_FLAG(26, 0x80) +#define WEEKEVENTREG_27_01 PACK_WEEKEVENTREG_FLAG(27, 0x01) +#define WEEKEVENTREG_27_02 PACK_WEEKEVENTREG_FLAG(27, 0x02) +#define WEEKEVENTREG_27_04 PACK_WEEKEVENTREG_FLAG(27, 0x04) +#define WEEKEVENTREG_27_08 PACK_WEEKEVENTREG_FLAG(27, 0x08) +#define WEEKEVENTREG_27_10 PACK_WEEKEVENTREG_FLAG(27, 0x10) +#define WEEKEVENTREG_27_20 PACK_WEEKEVENTREG_FLAG(27, 0x20) +#define WEEKEVENTREG_27_40 PACK_WEEKEVENTREG_FLAG(27, 0x40) +#define WEEKEVENTREG_27_80 PACK_WEEKEVENTREG_FLAG(27, 0x80) +#define WEEKEVENTREG_28_01 PACK_WEEKEVENTREG_FLAG(28, 0x01) +#define WEEKEVENTREG_28_02 PACK_WEEKEVENTREG_FLAG(28, 0x02) +#define WEEKEVENTREG_28_04 PACK_WEEKEVENTREG_FLAG(28, 0x04) +#define WEEKEVENTREG_28_08 PACK_WEEKEVENTREG_FLAG(28, 0x08) +#define WEEKEVENTREG_28_10 PACK_WEEKEVENTREG_FLAG(28, 0x10) +#define WEEKEVENTREG_28_20 PACK_WEEKEVENTREG_FLAG(28, 0x20) +#define WEEKEVENTREG_28_40 PACK_WEEKEVENTREG_FLAG(28, 0x40) +#define WEEKEVENTREG_28_80 PACK_WEEKEVENTREG_FLAG(28, 0x80) +#define WEEKEVENTREG_29_01 PACK_WEEKEVENTREG_FLAG(29, 0x01) +#define WEEKEVENTREG_29_02 PACK_WEEKEVENTREG_FLAG(29, 0x02) +#define WEEKEVENTREG_29_04 PACK_WEEKEVENTREG_FLAG(29, 0x04) +#define WEEKEVENTREG_29_08 PACK_WEEKEVENTREG_FLAG(29, 0x08) +#define WEEKEVENTREG_29_10 PACK_WEEKEVENTREG_FLAG(29, 0x10) +#define WEEKEVENTREG_29_20 PACK_WEEKEVENTREG_FLAG(29, 0x20) +#define WEEKEVENTREG_29_40 PACK_WEEKEVENTREG_FLAG(29, 0x40) +#define WEEKEVENTREG_29_80 PACK_WEEKEVENTREG_FLAG(29, 0x80) +#define WEEKEVENTREG_30_01 PACK_WEEKEVENTREG_FLAG(30, 0x01) +#define WEEKEVENTREG_30_02 PACK_WEEKEVENTREG_FLAG(30, 0x02) +#define WEEKEVENTREG_30_04 PACK_WEEKEVENTREG_FLAG(30, 0x04) +#define WEEKEVENTREG_30_08 PACK_WEEKEVENTREG_FLAG(30, 0x08) +#define WEEKEVENTREG_30_10 PACK_WEEKEVENTREG_FLAG(30, 0x10) +#define WEEKEVENTREG_30_20 PACK_WEEKEVENTREG_FLAG(30, 0x20) +#define WEEKEVENTREG_30_40 PACK_WEEKEVENTREG_FLAG(30, 0x40) +#define WEEKEVENTREG_30_80 PACK_WEEKEVENTREG_FLAG(30, 0x80) +#define WEEKEVENTREG_31_01 PACK_WEEKEVENTREG_FLAG(31, 0x01) +#define WEEKEVENTREG_31_02 PACK_WEEKEVENTREG_FLAG(31, 0x02) + +// Unconfirmed: "Tatl's Second Cycle Text?" +#define WEEKEVENTREG_31_04 PACK_WEEKEVENTREG_FLAG(31, 0x04) + +#define WEEKEVENTREG_31_08 PACK_WEEKEVENTREG_FLAG(31, 0x08) +#define WEEKEVENTREG_31_10 PACK_WEEKEVENTREG_FLAG(31, 0x10) +#define WEEKEVENTREG_31_20 PACK_WEEKEVENTREG_FLAG(31, 0x20) + +// Cremia asked the player to accompany her to town +#define WEEKEVENTREG_31_40 PACK_WEEKEVENTREG_FLAG(31, 0x40) +// Player is playing the Milk Run +#define WEEKEVENTREG_31_80 PACK_WEEKEVENTREG_FLAG(31, 0x80) + +#define WEEKEVENTREG_32_01 PACK_WEEKEVENTREG_FLAG(32, 0x01) +#define WEEKEVENTREG_32_02 PACK_WEEKEVENTREG_FLAG(32, 0x02) +#define WEEKEVENTREG_32_04 PACK_WEEKEVENTREG_FLAG(32, 0x04) +#define WEEKEVENTREG_32_08 PACK_WEEKEVENTREG_FLAG(32, 0x08) +#define WEEKEVENTREG_32_10 PACK_WEEKEVENTREG_FLAG(32, 0x10) +#define WEEKEVENTREG_32_20 PACK_WEEKEVENTREG_FLAG(32, 0x20) + +// Woodfall Temple Frog Returned +#define WEEKEVENTREG_32_40 PACK_WEEKEVENTREG_FLAG(32, 0x40) +// Great Bay Temple Frog Returned +#define WEEKEVENTREG_32_80 PACK_WEEKEVENTREG_FLAG(32, 0x80) +// Southern Swamp Frog Returned +#define WEEKEVENTREG_33_01 PACK_WEEKEVENTREG_FLAG(33, 0x01) +// Laundry Pool Frog Returned +#define WEEKEVENTREG_33_02 PACK_WEEKEVENTREG_FLAG(33, 0x02) + +#define WEEKEVENTREG_33_04 PACK_WEEKEVENTREG_FLAG(33, 0x04) +#define WEEKEVENTREG_33_08 PACK_WEEKEVENTREG_FLAG(33, 0x08) +#define WEEKEVENTREG_33_10 PACK_WEEKEVENTREG_FLAG(33, 0x10) +#define WEEKEVENTREG_33_20 PACK_WEEKEVENTREG_FLAG(33, 0x20) +#define WEEKEVENTREG_33_40 PACK_WEEKEVENTREG_FLAG(33, 0x40) + +// Mountain village is unfrozen +#define WEEKEVENTREG_33_80 PACK_WEEKEVENTREG_FLAG(33, 0x80) +// Spoken to MINIFROG_YELLOW +#define WEEKEVENTREG_34_01 PACK_WEEKEVENTREG_FLAG(34, 0x01) + +#define WEEKEVENTREG_34_02 PACK_WEEKEVENTREG_FLAG(34, 0x02) +#define WEEKEVENTREG_34_04 PACK_WEEKEVENTREG_FLAG(34, 0x04) +#define WEEKEVENTREG_34_08 PACK_WEEKEVENTREG_FLAG(34, 0x08) +#define WEEKEVENTREG_34_10 PACK_WEEKEVENTREG_FLAG(34, 0x10) +#define WEEKEVENTREG_34_20 PACK_WEEKEVENTREG_FLAG(34, 0x20) +#define WEEKEVENTREG_34_40 PACK_WEEKEVENTREG_FLAG(34, 0x40) + +// Cremia did Milk Run alone. Player didn't interact or didn't accept the ride +#define WEEKEVENTREG_34_80 PACK_WEEKEVENTREG_FLAG(34, 0x80) + +#define WEEKEVENTREG_35_01 PACK_WEEKEVENTREG_FLAG(35, 0x01) +#define WEEKEVENTREG_35_02 PACK_WEEKEVENTREG_FLAG(35, 0x02) +#define WEEKEVENTREG_35_04 PACK_WEEKEVENTREG_FLAG(35, 0x04) +#define WEEKEVENTREG_35_08 PACK_WEEKEVENTREG_FLAG(35, 0x08) +#define WEEKEVENTREG_35_10 PACK_WEEKEVENTREG_FLAG(35, 0x10) +#define WEEKEVENTREG_35_20 PACK_WEEKEVENTREG_FLAG(35, 0x20) +#define WEEKEVENTREG_35_40 PACK_WEEKEVENTREG_FLAG(35, 0x40) + +// Obtained Heart Piece from Five Frogs of the Frog Choir +#define WEEKEVENTREG_35_80 PACK_WEEKEVENTREG_FLAG(35, 0x80) + +#define WEEKEVENTREG_36_01 PACK_WEEKEVENTREG_FLAG(36, 0x01) +#define WEEKEVENTREG_36_02 PACK_WEEKEVENTREG_FLAG(36, 0x02) +#define WEEKEVENTREG_36_04 PACK_WEEKEVENTREG_FLAG(36, 0x04) +#define WEEKEVENTREG_36_08 PACK_WEEKEVENTREG_FLAG(36, 0x08) +#define WEEKEVENTREG_36_10 PACK_WEEKEVENTREG_FLAG(36, 0x10) +#define WEEKEVENTREG_36_20 PACK_WEEKEVENTREG_FLAG(36, 0x20) +#define WEEKEVENTREG_36_40 PACK_WEEKEVENTREG_FLAG(36, 0x40) +#define WEEKEVENTREG_36_80 PACK_WEEKEVENTREG_FLAG(36, 0x80) +#define WEEKEVENTREG_37_01 PACK_WEEKEVENTREG_FLAG(37, 0x01) +#define WEEKEVENTREG_37_02 PACK_WEEKEVENTREG_FLAG(37, 0x02) +#define WEEKEVENTREG_37_04 PACK_WEEKEVENTREG_FLAG(37, 0x04) +#define WEEKEVENTREG_37_08 PACK_WEEKEVENTREG_FLAG(37, 0x08) +#define WEEKEVENTREG_37_10 PACK_WEEKEVENTREG_FLAG(37, 0x10) +#define WEEKEVENTREG_37_20 PACK_WEEKEVENTREG_FLAG(37, 0x20) +#define WEEKEVENTREG_37_40 PACK_WEEKEVENTREG_FLAG(37, 0x40) +#define WEEKEVENTREG_37_80 PACK_WEEKEVENTREG_FLAG(37, 0x80) +#define WEEKEVENTREG_38_01 PACK_WEEKEVENTREG_FLAG(38, 0x01) +#define WEEKEVENTREG_38_02 PACK_WEEKEVENTREG_FLAG(38, 0x02) +#define WEEKEVENTREG_38_04 PACK_WEEKEVENTREG_FLAG(38, 0x04) +#define WEEKEVENTREG_38_08 PACK_WEEKEVENTREG_FLAG(38, 0x08) +#define WEEKEVENTREG_38_10 PACK_WEEKEVENTREG_FLAG(38, 0x10) +#define WEEKEVENTREG_38_20 PACK_WEEKEVENTREG_FLAG(38, 0x20) +#define WEEKEVENTREG_38_40 PACK_WEEKEVENTREG_FLAG(38, 0x40) +#define WEEKEVENTREG_38_80 PACK_WEEKEVENTREG_FLAG(38, 0x80) +#define WEEKEVENTREG_39_01 PACK_WEEKEVENTREG_FLAG(39, 0x01) +#define WEEKEVENTREG_39_02 PACK_WEEKEVENTREG_FLAG(39, 0x02) +#define WEEKEVENTREG_39_04 PACK_WEEKEVENTREG_FLAG(39, 0x04) +#define WEEKEVENTREG_39_08 PACK_WEEKEVENTREG_FLAG(39, 0x08) +#define WEEKEVENTREG_39_10 PACK_WEEKEVENTREG_FLAG(39, 0x10) +#define WEEKEVENTREG_39_20 PACK_WEEKEVENTREG_FLAG(39, 0x20) +#define WEEKEVENTREG_39_40 PACK_WEEKEVENTREG_FLAG(39, 0x40) +#define WEEKEVENTREG_39_80 PACK_WEEKEVENTREG_FLAG(39, 0x80) +#define WEEKEVENTREG_40_01 PACK_WEEKEVENTREG_FLAG(40, 0x01) +#define WEEKEVENTREG_40_02 PACK_WEEKEVENTREG_FLAG(40, 0x02) +#define WEEKEVENTREG_40_04 PACK_WEEKEVENTREG_FLAG(40, 0x04) +#define WEEKEVENTREG_40_08 PACK_WEEKEVENTREG_FLAG(40, 0x08) +#define WEEKEVENTREG_40_10 PACK_WEEKEVENTREG_FLAG(40, 0x10) +#define WEEKEVENTREG_40_20 PACK_WEEKEVENTREG_FLAG(40, 0x20) +#define WEEKEVENTREG_40_40 PACK_WEEKEVENTREG_FLAG(40, 0x40) +#define WEEKEVENTREG_40_80 PACK_WEEKEVENTREG_FLAG(40, 0x80) +#define WEEKEVENTREG_41_01 PACK_WEEKEVENTREG_FLAG(41, 0x01) +#define WEEKEVENTREG_41_02 PACK_WEEKEVENTREG_FLAG(41, 0x02) +#define WEEKEVENTREG_41_04 PACK_WEEKEVENTREG_FLAG(41, 0x04) +#define WEEKEVENTREG_41_08 PACK_WEEKEVENTREG_FLAG(41, 0x08) +#define WEEKEVENTREG_41_10 PACK_WEEKEVENTREG_FLAG(41, 0x10) +#define WEEKEVENTREG_41_20 PACK_WEEKEVENTREG_FLAG(41, 0x20) +#define WEEKEVENTREG_41_40 PACK_WEEKEVENTREG_FLAG(41, 0x40) +#define WEEKEVENTREG_41_80 PACK_WEEKEVENTREG_FLAG(41, 0x80) +#define WEEKEVENTREG_42_01 PACK_WEEKEVENTREG_FLAG(42, 0x01) +#define WEEKEVENTREG_42_02 PACK_WEEKEVENTREG_FLAG(42, 0x02) +#define WEEKEVENTREG_42_04 PACK_WEEKEVENTREG_FLAG(42, 0x04) +#define WEEKEVENTREG_42_08 PACK_WEEKEVENTREG_FLAG(42, 0x08) +#define WEEKEVENTREG_42_10 PACK_WEEKEVENTREG_FLAG(42, 0x10) +#define WEEKEVENTREG_42_20 PACK_WEEKEVENTREG_FLAG(42, 0x20) +#define WEEKEVENTREG_42_40 PACK_WEEKEVENTREG_FLAG(42, 0x40) +#define WEEKEVENTREG_42_80 PACK_WEEKEVENTREG_FLAG(42, 0x80) +#define WEEKEVENTREG_43_01 PACK_WEEKEVENTREG_FLAG(43, 0x01) +#define WEEKEVENTREG_43_02 PACK_WEEKEVENTREG_FLAG(43, 0x02) +#define WEEKEVENTREG_43_04 PACK_WEEKEVENTREG_FLAG(43, 0x04) +#define WEEKEVENTREG_43_08 PACK_WEEKEVENTREG_FLAG(43, 0x08) +#define WEEKEVENTREG_43_10 PACK_WEEKEVENTREG_FLAG(43, 0x10) +#define WEEKEVENTREG_43_20 PACK_WEEKEVENTREG_FLAG(43, 0x20) +#define WEEKEVENTREG_43_40 PACK_WEEKEVENTREG_FLAG(43, 0x40) +#define WEEKEVENTREG_43_80 PACK_WEEKEVENTREG_FLAG(43, 0x80) +#define WEEKEVENTREG_44_01 PACK_WEEKEVENTREG_FLAG(44, 0x01) +#define WEEKEVENTREG_44_02 PACK_WEEKEVENTREG_FLAG(44, 0x02) +#define WEEKEVENTREG_44_04 PACK_WEEKEVENTREG_FLAG(44, 0x04) +#define WEEKEVENTREG_44_08 PACK_WEEKEVENTREG_FLAG(44, 0x08) +#define WEEKEVENTREG_44_10 PACK_WEEKEVENTREG_FLAG(44, 0x10) +#define WEEKEVENTREG_44_20 PACK_WEEKEVENTREG_FLAG(44, 0x20) +#define WEEKEVENTREG_44_40 PACK_WEEKEVENTREG_FLAG(44, 0x40) +#define WEEKEVENTREG_44_80 PACK_WEEKEVENTREG_FLAG(44, 0x80) +#define WEEKEVENTREG_45_01 PACK_WEEKEVENTREG_FLAG(45, 0x01) +#define WEEKEVENTREG_45_02 PACK_WEEKEVENTREG_FLAG(45, 0x02) +#define WEEKEVENTREG_45_04 PACK_WEEKEVENTREG_FLAG(45, 0x04) +#define WEEKEVENTREG_45_08 PACK_WEEKEVENTREG_FLAG(45, 0x08) +#define WEEKEVENTREG_45_10 PACK_WEEKEVENTREG_FLAG(45, 0x10) +#define WEEKEVENTREG_45_20 PACK_WEEKEVENTREG_FLAG(45, 0x20) +#define WEEKEVENTREG_45_40 PACK_WEEKEVENTREG_FLAG(45, 0x40) +#define WEEKEVENTREG_45_80 PACK_WEEKEVENTREG_FLAG(45, 0x80) +#define WEEKEVENTREG_46_01 PACK_WEEKEVENTREG_FLAG(46, 0x01) +#define WEEKEVENTREG_46_02 PACK_WEEKEVENTREG_FLAG(46, 0x02) +#define WEEKEVENTREG_46_04 PACK_WEEKEVENTREG_FLAG(46, 0x04) +#define WEEKEVENTREG_46_08 PACK_WEEKEVENTREG_FLAG(46, 0x08) +#define WEEKEVENTREG_46_10 PACK_WEEKEVENTREG_FLAG(46, 0x10) +#define WEEKEVENTREG_46_20 PACK_WEEKEVENTREG_FLAG(46, 0x20) +#define WEEKEVENTREG_46_40 PACK_WEEKEVENTREG_FLAG(46, 0x40) +#define WEEKEVENTREG_46_80 PACK_WEEKEVENTREG_FLAG(46, 0x80) +#define WEEKEVENTREG_47_01 PACK_WEEKEVENTREG_FLAG(47, 0x01) +#define WEEKEVENTREG_47_02 PACK_WEEKEVENTREG_FLAG(47, 0x02) +#define WEEKEVENTREG_47_04 PACK_WEEKEVENTREG_FLAG(47, 0x04) +#define WEEKEVENTREG_47_08 PACK_WEEKEVENTREG_FLAG(47, 0x08) +#define WEEKEVENTREG_47_10 PACK_WEEKEVENTREG_FLAG(47, 0x10) +#define WEEKEVENTREG_47_20 PACK_WEEKEVENTREG_FLAG(47, 0x20) +#define WEEKEVENTREG_47_40 PACK_WEEKEVENTREG_FLAG(47, 0x40) +#define WEEKEVENTREG_47_80 PACK_WEEKEVENTREG_FLAG(47, 0x80) +#define WEEKEVENTREG_48_01 PACK_WEEKEVENTREG_FLAG(48, 0x01) +#define WEEKEVENTREG_48_02 PACK_WEEKEVENTREG_FLAG(48, 0x02) +#define WEEKEVENTREG_48_04 PACK_WEEKEVENTREG_FLAG(48, 0x04) +#define WEEKEVENTREG_48_08 PACK_WEEKEVENTREG_FLAG(48, 0x08) +#define WEEKEVENTREG_48_10 PACK_WEEKEVENTREG_FLAG(48, 0x10) +#define WEEKEVENTREG_48_20 PACK_WEEKEVENTREG_FLAG(48, 0x20) +#define WEEKEVENTREG_48_40 PACK_WEEKEVENTREG_FLAG(48, 0x40) +#define WEEKEVENTREG_48_80 PACK_WEEKEVENTREG_FLAG(48, 0x80) +#define WEEKEVENTREG_49_01 PACK_WEEKEVENTREG_FLAG(49, 0x01) +#define WEEKEVENTREG_49_02 PACK_WEEKEVENTREG_FLAG(49, 0x02) +#define WEEKEVENTREG_49_04 PACK_WEEKEVENTREG_FLAG(49, 0x04) +#define WEEKEVENTREG_49_08 PACK_WEEKEVENTREG_FLAG(49, 0x08) +#define WEEKEVENTREG_49_10 PACK_WEEKEVENTREG_FLAG(49, 0x10) +#define WEEKEVENTREG_49_20 PACK_WEEKEVENTREG_FLAG(49, 0x20) +#define WEEKEVENTREG_49_40 PACK_WEEKEVENTREG_FLAG(49, 0x40) +#define WEEKEVENTREG_49_80 PACK_WEEKEVENTREG_FLAG(49, 0x80) +#define WEEKEVENTREG_50_01 PACK_WEEKEVENTREG_FLAG(50, 0x01) +#define WEEKEVENTREG_50_02 PACK_WEEKEVENTREG_FLAG(50, 0x02) +#define WEEKEVENTREG_50_04 PACK_WEEKEVENTREG_FLAG(50, 0x04) +#define WEEKEVENTREG_50_08 PACK_WEEKEVENTREG_FLAG(50, 0x08) +#define WEEKEVENTREG_50_10 PACK_WEEKEVENTREG_FLAG(50, 0x10) +#define WEEKEVENTREG_50_20 PACK_WEEKEVENTREG_FLAG(50, 0x20) +#define WEEKEVENTREG_50_40 PACK_WEEKEVENTREG_FLAG(50, 0x40) +#define WEEKEVENTREG_50_80 PACK_WEEKEVENTREG_FLAG(50, 0x80) +#define WEEKEVENTREG_51_01 PACK_WEEKEVENTREG_FLAG(51, 0x01) +#define WEEKEVENTREG_51_02 PACK_WEEKEVENTREG_FLAG(51, 0x02) +#define WEEKEVENTREG_51_04 PACK_WEEKEVENTREG_FLAG(51, 0x04) +#define WEEKEVENTREG_51_08 PACK_WEEKEVENTREG_FLAG(51, 0x08) +#define WEEKEVENTREG_51_10 PACK_WEEKEVENTREG_FLAG(51, 0x10) +#define WEEKEVENTREG_51_20 PACK_WEEKEVENTREG_FLAG(51, 0x20) +#define WEEKEVENTREG_51_40 PACK_WEEKEVENTREG_FLAG(51, 0x40) +#define WEEKEVENTREG_51_80 PACK_WEEKEVENTREG_FLAG(51, 0x80) + +// ProtectedCremia +#define WEEKEVENTREG_52_01 PACK_WEEKEVENTREG_FLAG(52, 0x01) +// Lose Milk Run minigame +#define WEEKEVENTREG_52_02 PACK_WEEKEVENTREG_FLAG(52, 0x02) + +#define WEEKEVENTREG_52_04 PACK_WEEKEVENTREG_FLAG(52, 0x04) +#define WEEKEVENTREG_52_08 PACK_WEEKEVENTREG_FLAG(52, 0x08) +#define WEEKEVENTREG_52_10 PACK_WEEKEVENTREG_FLAG(52, 0x10) + +// cleared Stone Tower Temple +#define WEEKEVENTREG_52_20 PACK_WEEKEVENTREG_FLAG(52, 0x20) + +#define WEEKEVENTREG_52_40 PACK_WEEKEVENTREG_FLAG(52, 0x40) +#define WEEKEVENTREG_52_80 PACK_WEEKEVENTREG_FLAG(52, 0x80) +#define WEEKEVENTREG_53_01 PACK_WEEKEVENTREG_FLAG(53, 0x01) +#define WEEKEVENTREG_53_02 PACK_WEEKEVENTREG_FLAG(53, 0x02) +#define WEEKEVENTREG_53_04 PACK_WEEKEVENTREG_FLAG(53, 0x04) +#define WEEKEVENTREG_53_08 PACK_WEEKEVENTREG_FLAG(53, 0x08) +#define WEEKEVENTREG_53_10 PACK_WEEKEVENTREG_FLAG(53, 0x10) +#define WEEKEVENTREG_53_20 PACK_WEEKEVENTREG_FLAG(53, 0x20) +#define WEEKEVENTREG_53_40 PACK_WEEKEVENTREG_FLAG(53, 0x40) +#define WEEKEVENTREG_53_80 PACK_WEEKEVENTREG_FLAG(53, 0x80) +#define WEEKEVENTREG_54_01 PACK_WEEKEVENTREG_FLAG(54, 0x01) +#define WEEKEVENTREG_54_02 PACK_WEEKEVENTREG_FLAG(54, 0x02) +#define WEEKEVENTREG_54_04 PACK_WEEKEVENTREG_FLAG(54, 0x04) +#define WEEKEVENTREG_54_08 PACK_WEEKEVENTREG_FLAG(54, 0x08) +#define WEEKEVENTREG_54_10 PACK_WEEKEVENTREG_FLAG(54, 0x10) +#define WEEKEVENTREG_54_20 PACK_WEEKEVENTREG_FLAG(54, 0x20) +#define WEEKEVENTREG_54_40 PACK_WEEKEVENTREG_FLAG(54, 0x40) +#define WEEKEVENTREG_54_80 PACK_WEEKEVENTREG_FLAG(54, 0x80) +#define WEEKEVENTREG_55_01 PACK_WEEKEVENTREG_FLAG(55, 0x01) + +// Unconfirmed: "Link the Goron Claims His Reservation: 4:30 PM" +#define WEEKEVENTREG_55_02 PACK_WEEKEVENTREG_FLAG(55, 0x02) + +#define WEEKEVENTREG_55_04 PACK_WEEKEVENTREG_FLAG(55, 0x04) +#define WEEKEVENTREG_55_08 PACK_WEEKEVENTREG_FLAG(55, 0x08) +#define WEEKEVENTREG_55_10 PACK_WEEKEVENTREG_FLAG(55, 0x10) +#define WEEKEVENTREG_55_20 PACK_WEEKEVENTREG_FLAG(55, 0x20) +#define WEEKEVENTREG_55_40 PACK_WEEKEVENTREG_FLAG(55, 0x40) + +// Gyorg has been defeated +#define WEEKEVENTREG_55_80 PACK_WEEKEVENTREG_FLAG(55, 0x80) + +#define WEEKEVENTREG_56_01 PACK_WEEKEVENTREG_FLAG(56, 0x01) +#define WEEKEVENTREG_56_02 PACK_WEEKEVENTREG_FLAG(56, 0x02) +#define WEEKEVENTREG_56_04 PACK_WEEKEVENTREG_FLAG(56, 0x04) +#define WEEKEVENTREG_56_08 PACK_WEEKEVENTREG_FLAG(56, 0x08) +#define WEEKEVENTREG_56_10 PACK_WEEKEVENTREG_FLAG(56, 0x10) +#define WEEKEVENTREG_56_20 PACK_WEEKEVENTREG_FLAG(56, 0x20) +#define WEEKEVENTREG_56_40 PACK_WEEKEVENTREG_FLAG(56, 0x40) +#define WEEKEVENTREG_56_80 PACK_WEEKEVENTREG_FLAG(56, 0x80) +#define WEEKEVENTREG_57_01 PACK_WEEKEVENTREG_FLAG(57, 0x01) +#define WEEKEVENTREG_57_02 PACK_WEEKEVENTREG_FLAG(57, 0x02) +#define WEEKEVENTREG_57_04 PACK_WEEKEVENTREG_FLAG(57, 0x04) +#define WEEKEVENTREG_57_08 PACK_WEEKEVENTREG_FLAG(57, 0x08) +#define WEEKEVENTREG_57_10 PACK_WEEKEVENTREG_FLAG(57, 0x10) +#define WEEKEVENTREG_57_20 PACK_WEEKEVENTREG_FLAG(57, 0x20) +#define WEEKEVENTREG_57_40 PACK_WEEKEVENTREG_FLAG(57, 0x40) +#define WEEKEVENTREG_57_80 PACK_WEEKEVENTREG_FLAG(57, 0x80) +#define WEEKEVENTREG_58_01 PACK_WEEKEVENTREG_FLAG(58, 0x01) +#define WEEKEVENTREG_58_02 PACK_WEEKEVENTREG_FLAG(58, 0x02) +#define WEEKEVENTREG_58_04 PACK_WEEKEVENTREG_FLAG(58, 0x04) +#define WEEKEVENTREG_58_08 PACK_WEEKEVENTREG_FLAG(58, 0x08) +#define WEEKEVENTREG_58_10 PACK_WEEKEVENTREG_FLAG(58, 0x10) +#define WEEKEVENTREG_58_20 PACK_WEEKEVENTREG_FLAG(58, 0x20) +#define WEEKEVENTREG_58_40 PACK_WEEKEVENTREG_FLAG(58, 0x40) +#define WEEKEVENTREG_58_80 PACK_WEEKEVENTREG_FLAG(58, 0x80) +#define WEEKEVENTREG_59_01 PACK_WEEKEVENTREG_FLAG(59, 0x01) +#define WEEKEVENTREG_59_02 PACK_WEEKEVENTREG_FLAG(59, 0x02) + +// Unconfirmed: "Entered South Clock Town" +#define WEEKEVENTREG_59_04 PACK_WEEKEVENTREG_FLAG(59, 0x04) + +#define WEEKEVENTREG_59_08 PACK_WEEKEVENTREG_FLAG(59, 0x08) +#define WEEKEVENTREG_59_10 PACK_WEEKEVENTREG_FLAG(59, 0x10) +#define WEEKEVENTREG_59_20 PACK_WEEKEVENTREG_FLAG(59, 0x20) +#define WEEKEVENTREG_59_40 PACK_WEEKEVENTREG_FLAG(59, 0x40) +#define WEEKEVENTREG_59_80 PACK_WEEKEVENTREG_FLAG(59, 0x80) +#define WEEKEVENTREG_60_01 PACK_WEEKEVENTREG_FLAG(60, 0x01) +#define WEEKEVENTREG_60_02 PACK_WEEKEVENTREG_FLAG(60, 0x02) +#define WEEKEVENTREG_60_04 PACK_WEEKEVENTREG_FLAG(60, 0x04) +#define WEEKEVENTREG_60_08 PACK_WEEKEVENTREG_FLAG(60, 0x08) +#define WEEKEVENTREG_60_10 PACK_WEEKEVENTREG_FLAG(60, 0x10) +#define WEEKEVENTREG_60_20 PACK_WEEKEVENTREG_FLAG(60, 0x20) +#define WEEKEVENTREG_60_40 PACK_WEEKEVENTREG_FLAG(60, 0x40) +#define WEEKEVENTREG_60_80 PACK_WEEKEVENTREG_FLAG(60, 0x80) +#define WEEKEVENTREG_61_01 PACK_WEEKEVENTREG_FLAG(61, 0x01) +#define WEEKEVENTREG_61_02 PACK_WEEKEVENTREG_FLAG(61, 0x02) +#define WEEKEVENTREG_61_04 PACK_WEEKEVENTREG_FLAG(61, 0x04) +#define WEEKEVENTREG_61_08 PACK_WEEKEVENTREG_FLAG(61, 0x08) +#define WEEKEVENTREG_61_10 PACK_WEEKEVENTREG_FLAG(61, 0x10) +#define WEEKEVENTREG_61_20 PACK_WEEKEVENTREG_FLAG(61, 0x20) +#define WEEKEVENTREG_61_40 PACK_WEEKEVENTREG_FLAG(61, 0x40) +#define WEEKEVENTREG_61_80 PACK_WEEKEVENTREG_FLAG(61, 0x80) +#define WEEKEVENTREG_62_01 PACK_WEEKEVENTREG_FLAG(62, 0x01) +#define WEEKEVENTREG_62_02 PACK_WEEKEVENTREG_FLAG(62, 0x02) +#define WEEKEVENTREG_62_04 PACK_WEEKEVENTREG_FLAG(62, 0x04) +#define WEEKEVENTREG_62_08 PACK_WEEKEVENTREG_FLAG(62, 0x08) +#define WEEKEVENTREG_62_10 PACK_WEEKEVENTREG_FLAG(62, 0x10) +#define WEEKEVENTREG_62_20 PACK_WEEKEVENTREG_FLAG(62, 0x20) +#define WEEKEVENTREG_62_40 PACK_WEEKEVENTREG_FLAG(62, 0x40) +#define WEEKEVENTREG_62_80 PACK_WEEKEVENTREG_FLAG(62, 0x80) +#define WEEKEVENTREG_63_01 PACK_WEEKEVENTREG_FLAG(63, 0x01) +#define WEEKEVENTREG_63_02 PACK_WEEKEVENTREG_FLAG(63, 0x02) +#define WEEKEVENTREG_63_04 PACK_WEEKEVENTREG_FLAG(63, 0x04) +#define WEEKEVENTREG_63_08 PACK_WEEKEVENTREG_FLAG(63, 0x08) +#define WEEKEVENTREG_63_10 PACK_WEEKEVENTREG_FLAG(63, 0x10) +#define WEEKEVENTREG_63_20 PACK_WEEKEVENTREG_FLAG(63, 0x20) +#define WEEKEVENTREG_63_40 PACK_WEEKEVENTREG_FLAG(63, 0x40) + +// showed Couple's Mask to meeting +#define WEEKEVENTREG_63_80 PACK_WEEKEVENTREG_FLAG(63, 0x80) + +#define WEEKEVENTREG_64_01 PACK_WEEKEVENTREG_FLAG(64, 0x01) +#define WEEKEVENTREG_64_02 PACK_WEEKEVENTREG_FLAG(64, 0x02) +#define WEEKEVENTREG_64_04 PACK_WEEKEVENTREG_FLAG(64, 0x04) +#define WEEKEVENTREG_64_08 PACK_WEEKEVENTREG_FLAG(64, 0x08) +#define WEEKEVENTREG_64_10 PACK_WEEKEVENTREG_FLAG(64, 0x10) +#define WEEKEVENTREG_64_20 PACK_WEEKEVENTREG_FLAG(64, 0x20) +#define WEEKEVENTREG_64_40 PACK_WEEKEVENTREG_FLAG(64, 0x40) +#define WEEKEVENTREG_64_80 PACK_WEEKEVENTREG_FLAG(64, 0x80) +#define WEEKEVENTREG_65_01 PACK_WEEKEVENTREG_FLAG(65, 0x01) +#define WEEKEVENTREG_65_02 PACK_WEEKEVENTREG_FLAG(65, 0x02) +#define WEEKEVENTREG_65_04 PACK_WEEKEVENTREG_FLAG(65, 0x04) +#define WEEKEVENTREG_65_08 PACK_WEEKEVENTREG_FLAG(65, 0x08) +#define WEEKEVENTREG_65_10 PACK_WEEKEVENTREG_FLAG(65, 0x10) +#define WEEKEVENTREG_65_20 PACK_WEEKEVENTREG_FLAG(65, 0x20) +#define WEEKEVENTREG_65_40 PACK_WEEKEVENTREG_FLAG(65, 0x40) +#define WEEKEVENTREG_65_80 PACK_WEEKEVENTREG_FLAG(65, 0x80) +#define WEEKEVENTREG_66_01 PACK_WEEKEVENTREG_FLAG(66, 0x01) +#define WEEKEVENTREG_66_02 PACK_WEEKEVENTREG_FLAG(66, 0x02) +#define WEEKEVENTREG_66_04 PACK_WEEKEVENTREG_FLAG(66, 0x04) +#define WEEKEVENTREG_66_08 PACK_WEEKEVENTREG_FLAG(66, 0x08) +#define WEEKEVENTREG_66_10 PACK_WEEKEVENTREG_FLAG(66, 0x10) +#define WEEKEVENTREG_66_20 PACK_WEEKEVENTREG_FLAG(66, 0x20) +#define WEEKEVENTREG_66_40 PACK_WEEKEVENTREG_FLAG(66, 0x40) +#define WEEKEVENTREG_66_80 PACK_WEEKEVENTREG_FLAG(66, 0x80) +#define WEEKEVENTREG_67_01 PACK_WEEKEVENTREG_FLAG(67, 0x01) +#define WEEKEVENTREG_67_02 PACK_WEEKEVENTREG_FLAG(67, 0x02) +#define WEEKEVENTREG_67_04 PACK_WEEKEVENTREG_FLAG(67, 0x04) +#define WEEKEVENTREG_67_08 PACK_WEEKEVENTREG_FLAG(67, 0x08) +#define WEEKEVENTREG_67_10 PACK_WEEKEVENTREG_FLAG(67, 0x10) +#define WEEKEVENTREG_67_20 PACK_WEEKEVENTREG_FLAG(67, 0x20) +#define WEEKEVENTREG_67_40 PACK_WEEKEVENTREG_FLAG(67, 0x40) +#define WEEKEVENTREG_67_80 PACK_WEEKEVENTREG_FLAG(67, 0x80) +#define WEEKEVENTREG_68_01 PACK_WEEKEVENTREG_FLAG(68, 0x01) +#define WEEKEVENTREG_68_02 PACK_WEEKEVENTREG_FLAG(68, 0x02) +#define WEEKEVENTREG_68_04 PACK_WEEKEVENTREG_FLAG(68, 0x04) +#define WEEKEVENTREG_68_08 PACK_WEEKEVENTREG_FLAG(68, 0x08) +#define WEEKEVENTREG_68_10 PACK_WEEKEVENTREG_FLAG(68, 0x10) +#define WEEKEVENTREG_68_20 PACK_WEEKEVENTREG_FLAG(68, 0x20) +#define WEEKEVENTREG_68_40 PACK_WEEKEVENTREG_FLAG(68, 0x40) +#define WEEKEVENTREG_68_80 PACK_WEEKEVENTREG_FLAG(68, 0x80) +#define WEEKEVENTREG_69_01 PACK_WEEKEVENTREG_FLAG(69, 0x01) +#define WEEKEVENTREG_69_02 PACK_WEEKEVENTREG_FLAG(69, 0x02) +#define WEEKEVENTREG_69_04 PACK_WEEKEVENTREG_FLAG(69, 0x04) +#define WEEKEVENTREG_69_08 PACK_WEEKEVENTREG_FLAG(69, 0x08) +#define WEEKEVENTREG_69_10 PACK_WEEKEVENTREG_FLAG(69, 0x10) +#define WEEKEVENTREG_69_20 PACK_WEEKEVENTREG_FLAG(69, 0x20) +#define WEEKEVENTREG_69_40 PACK_WEEKEVENTREG_FLAG(69, 0x40) +#define WEEKEVENTREG_69_80 PACK_WEEKEVENTREG_FLAG(69, 0x80) +#define WEEKEVENTREG_70_01 PACK_WEEKEVENTREG_FLAG(70, 0x01) +#define WEEKEVENTREG_70_02 PACK_WEEKEVENTREG_FLAG(70, 0x02) +#define WEEKEVENTREG_70_04 PACK_WEEKEVENTREG_FLAG(70, 0x04) +#define WEEKEVENTREG_70_08 PACK_WEEKEVENTREG_FLAG(70, 0x08) +#define WEEKEVENTREG_70_10 PACK_WEEKEVENTREG_FLAG(70, 0x10) +#define WEEKEVENTREG_70_20 PACK_WEEKEVENTREG_FLAG(70, 0x20) +#define WEEKEVENTREG_70_40 PACK_WEEKEVENTREG_FLAG(70, 0x40) +#define WEEKEVENTREG_70_80 PACK_WEEKEVENTREG_FLAG(70, 0x80) +#define WEEKEVENTREG_71_01 PACK_WEEKEVENTREG_FLAG(71, 0x01) +#define WEEKEVENTREG_71_02 PACK_WEEKEVENTREG_FLAG(71, 0x02) +#define WEEKEVENTREG_71_04 PACK_WEEKEVENTREG_FLAG(71, 0x04) +#define WEEKEVENTREG_71_08 PACK_WEEKEVENTREG_FLAG(71, 0x08) +#define WEEKEVENTREG_71_10 PACK_WEEKEVENTREG_FLAG(71, 0x10) +#define WEEKEVENTREG_71_20 PACK_WEEKEVENTREG_FLAG(71, 0x20) +#define WEEKEVENTREG_71_40 PACK_WEEKEVENTREG_FLAG(71, 0x40) +#define WEEKEVENTREG_71_80 PACK_WEEKEVENTREG_FLAG(71, 0x80) +#define WEEKEVENTREG_72_01 PACK_WEEKEVENTREG_FLAG(72, 0x01) +#define WEEKEVENTREG_72_02 PACK_WEEKEVENTREG_FLAG(72, 0x02) +#define WEEKEVENTREG_72_04 PACK_WEEKEVENTREG_FLAG(72, 0x04) +#define WEEKEVENTREG_72_08 PACK_WEEKEVENTREG_FLAG(72, 0x08) +#define WEEKEVENTREG_72_10 PACK_WEEKEVENTREG_FLAG(72, 0x10) +#define WEEKEVENTREG_72_20 PACK_WEEKEVENTREG_FLAG(72, 0x20) +#define WEEKEVENTREG_72_40 PACK_WEEKEVENTREG_FLAG(72, 0x40) +#define WEEKEVENTREG_72_80 PACK_WEEKEVENTREG_FLAG(72, 0x80) +#define WEEKEVENTREG_73_01 PACK_WEEKEVENTREG_FLAG(73, 0x01) +#define WEEKEVENTREG_73_02 PACK_WEEKEVENTREG_FLAG(73, 0x02) +#define WEEKEVENTREG_73_04 PACK_WEEKEVENTREG_FLAG(73, 0x04) +#define WEEKEVENTREG_73_08 PACK_WEEKEVENTREG_FLAG(73, 0x08) + +// Unconfirmed: "Bombers Hide & Seek started on Day 1?" +#define WEEKEVENTREG_73_10 PACK_WEEKEVENTREG_FLAG(73, 0x10) + +#define WEEKEVENTREG_73_20 PACK_WEEKEVENTREG_FLAG(73, 0x20) +#define WEEKEVENTREG_73_40 PACK_WEEKEVENTREG_FLAG(73, 0x40) +#define WEEKEVENTREG_73_80 PACK_WEEKEVENTREG_FLAG(73, 0x80) +#define WEEKEVENTREG_74_01 PACK_WEEKEVENTREG_FLAG(74, 0x01) +#define WEEKEVENTREG_74_02 PACK_WEEKEVENTREG_FLAG(74, 0x02) +#define WEEKEVENTREG_74_04 PACK_WEEKEVENTREG_FLAG(74, 0x04) +#define WEEKEVENTREG_74_08 PACK_WEEKEVENTREG_FLAG(74, 0x08) +#define WEEKEVENTREG_74_10 PACK_WEEKEVENTREG_FLAG(74, 0x10) +#define WEEKEVENTREG_74_20 PACK_WEEKEVENTREG_FLAG(74, 0x20) +#define WEEKEVENTREG_74_40 PACK_WEEKEVENTREG_FLAG(74, 0x40) +#define WEEKEVENTREG_74_80 PACK_WEEKEVENTREG_FLAG(74, 0x80) +#define WEEKEVENTREG_75_01 PACK_WEEKEVENTREG_FLAG(75, 0x01) +#define WEEKEVENTREG_75_02 PACK_WEEKEVENTREG_FLAG(75, 0x02) +#define WEEKEVENTREG_75_04 PACK_WEEKEVENTREG_FLAG(75, 0x04) +#define WEEKEVENTREG_75_08 PACK_WEEKEVENTREG_FLAG(75, 0x08) +#define WEEKEVENTREG_75_10 PACK_WEEKEVENTREG_FLAG(75, 0x10) +#define WEEKEVENTREG_75_20 PACK_WEEKEVENTREG_FLAG(75, 0x20) +#define WEEKEVENTREG_75_40 PACK_WEEKEVENTREG_FLAG(75, 0x40) +#define WEEKEVENTREG_75_80 PACK_WEEKEVENTREG_FLAG(75, 0x80) +#define WEEKEVENTREG_76_01 PACK_WEEKEVENTREG_FLAG(76, 0x01) +#define WEEKEVENTREG_76_02 PACK_WEEKEVENTREG_FLAG(76, 0x02) +#define WEEKEVENTREG_76_04 PACK_WEEKEVENTREG_FLAG(76, 0x04) +#define WEEKEVENTREG_76_08 PACK_WEEKEVENTREG_FLAG(76, 0x08) +#define WEEKEVENTREG_76_10 PACK_WEEKEVENTREG_FLAG(76, 0x10) +#define WEEKEVENTREG_76_20 PACK_WEEKEVENTREG_FLAG(76, 0x20) +#define WEEKEVENTREG_76_40 PACK_WEEKEVENTREG_FLAG(76, 0x40) +#define WEEKEVENTREG_76_80 PACK_WEEKEVENTREG_FLAG(76, 0x80) +#define WEEKEVENTREG_77_01 PACK_WEEKEVENTREG_FLAG(77, 0x01) +#define WEEKEVENTREG_77_02 PACK_WEEKEVENTREG_FLAG(77, 0x02) +#define WEEKEVENTREG_77_04 PACK_WEEKEVENTREG_FLAG(77, 0x04) +#define WEEKEVENTREG_77_08 PACK_WEEKEVENTREG_FLAG(77, 0x08) +#define WEEKEVENTREG_77_10 PACK_WEEKEVENTREG_FLAG(77, 0x10) +#define WEEKEVENTREG_77_20 PACK_WEEKEVENTREG_FLAG(77, 0x20) +#define WEEKEVENTREG_77_40 PACK_WEEKEVENTREG_FLAG(77, 0x40) + +// The player has heard the Goron Shrine cheer as a Goron at least once. +#define WEEKEVENTREG_77_80 PACK_WEEKEVENTREG_FLAG(77, 0x80) + +#define WEEKEVENTREG_78_01 PACK_WEEKEVENTREG_FLAG(78, 0x01) +#define WEEKEVENTREG_78_02 PACK_WEEKEVENTREG_FLAG(78, 0x02) +#define WEEKEVENTREG_78_04 PACK_WEEKEVENTREG_FLAG(78, 0x04) +#define WEEKEVENTREG_78_08 PACK_WEEKEVENTREG_FLAG(78, 0x08) +#define WEEKEVENTREG_78_10 PACK_WEEKEVENTREG_FLAG(78, 0x10) +#define WEEKEVENTREG_78_20 PACK_WEEKEVENTREG_FLAG(78, 0x20) +#define WEEKEVENTREG_78_40 PACK_WEEKEVENTREG_FLAG(78, 0x40) +#define WEEKEVENTREG_78_80 PACK_WEEKEVENTREG_FLAG(78, 0x80) +#define WEEKEVENTREG_79_01 PACK_WEEKEVENTREG_FLAG(79, 0x01) +#define WEEKEVENTREG_79_02 PACK_WEEKEVENTREG_FLAG(79, 0x02) +#define WEEKEVENTREG_79_04 PACK_WEEKEVENTREG_FLAG(79, 0x04) +#define WEEKEVENTREG_79_08 PACK_WEEKEVENTREG_FLAG(79, 0x08) +#define WEEKEVENTREG_79_10 PACK_WEEKEVENTREG_FLAG(79, 0x10) +#define WEEKEVENTREG_79_20 PACK_WEEKEVENTREG_FLAG(79, 0x20) +#define WEEKEVENTREG_79_40 PACK_WEEKEVENTREG_FLAG(79, 0x40) +#define WEEKEVENTREG_79_80 PACK_WEEKEVENTREG_FLAG(79, 0x80) +#define WEEKEVENTREG_80_01 PACK_WEEKEVENTREG_FLAG(80, 0x01) +#define WEEKEVENTREG_80_02 PACK_WEEKEVENTREG_FLAG(80, 0x02) +#define WEEKEVENTREG_80_04 PACK_WEEKEVENTREG_FLAG(80, 0x04) +#define WEEKEVENTREG_80_08 PACK_WEEKEVENTREG_FLAG(80, 0x08) +#define WEEKEVENTREG_80_10 PACK_WEEKEVENTREG_FLAG(80, 0x10) +#define WEEKEVENTREG_80_20 PACK_WEEKEVENTREG_FLAG(80, 0x20) +#define WEEKEVENTREG_80_40 PACK_WEEKEVENTREG_FLAG(80, 0x40) +#define WEEKEVENTREG_80_80 PACK_WEEKEVENTREG_FLAG(80, 0x80) +#define WEEKEVENTREG_81_01 PACK_WEEKEVENTREG_FLAG(81, 0x01) +#define WEEKEVENTREG_81_02 PACK_WEEKEVENTREG_FLAG(81, 0x02) +#define WEEKEVENTREG_81_04 PACK_WEEKEVENTREG_FLAG(81, 0x04) +#define WEEKEVENTREG_81_08 PACK_WEEKEVENTREG_FLAG(81, 0x08) +#define WEEKEVENTREG_81_10 PACK_WEEKEVENTREG_FLAG(81, 0x10) +#define WEEKEVENTREG_81_20 PACK_WEEKEVENTREG_FLAG(81, 0x20) +#define WEEKEVENTREG_81_40 PACK_WEEKEVENTREG_FLAG(81, 0x40) +#define WEEKEVENTREG_81_80 PACK_WEEKEVENTREG_FLAG(81, 0x80) +#define WEEKEVENTREG_82_01 PACK_WEEKEVENTREG_FLAG(82, 0x01) +#define WEEKEVENTREG_82_02 PACK_WEEKEVENTREG_FLAG(82, 0x02) + +// check if already healed Kamaro the Dancing Ghost +#define WEEKEVENTREG_82_04 PACK_WEEKEVENTREG_FLAG(82, 0x04) + +#define WEEKEVENTREG_82_08 PACK_WEEKEVENTREG_FLAG(82, 0x08) +#define WEEKEVENTREG_82_10 PACK_WEEKEVENTREG_FLAG(82, 0x10) +#define WEEKEVENTREG_82_20 PACK_WEEKEVENTREG_FLAG(82, 0x20) +#define WEEKEVENTREG_82_40 PACK_WEEKEVENTREG_FLAG(82, 0x40) +#define WEEKEVENTREG_82_80 PACK_WEEKEVENTREG_FLAG(82, 0x80) +#define WEEKEVENTREG_83_01 PACK_WEEKEVENTREG_FLAG(83, 0x01) +#define WEEKEVENTREG_83_02 PACK_WEEKEVENTREG_FLAG(83, 0x02) +#define WEEKEVENTREG_83_04 PACK_WEEKEVENTREG_FLAG(83, 0x04) +#define WEEKEVENTREG_83_08 PACK_WEEKEVENTREG_FLAG(83, 0x08) +#define WEEKEVENTREG_83_10 PACK_WEEKEVENTREG_FLAG(83, 0x10) +#define WEEKEVENTREG_83_20 PACK_WEEKEVENTREG_FLAG(83, 0x20) +#define WEEKEVENTREG_83_40 PACK_WEEKEVENTREG_FLAG(83, 0x40) +#define WEEKEVENTREG_83_80 PACK_WEEKEVENTREG_FLAG(83, 0x80) +#define WEEKEVENTREG_84_01 PACK_WEEKEVENTREG_FLAG(84, 0x01) +#define WEEKEVENTREG_84_02 PACK_WEEKEVENTREG_FLAG(84, 0x02) +#define WEEKEVENTREG_84_04 PACK_WEEKEVENTREG_FLAG(84, 0x04) +#define WEEKEVENTREG_84_08 PACK_WEEKEVENTREG_FLAG(84, 0x08) +#define WEEKEVENTREG_84_10 PACK_WEEKEVENTREG_FLAG(84, 0x10) + +// Unconfirmed: "Obtained Fierce Deity's Mask?" +#define WEEKEVENTREG_84_20 PACK_WEEKEVENTREG_FLAG(84, 0x20) + +#define WEEKEVENTREG_84_40 PACK_WEEKEVENTREG_FLAG(84, 0x40) +#define WEEKEVENTREG_84_80 PACK_WEEKEVENTREG_FLAG(84, 0x80) +#define WEEKEVENTREG_85_01 PACK_WEEKEVENTREG_FLAG(85, 0x01) + +// Unconfirmed: "Bombers Hide & Seek in Progress" +#define WEEKEVENTREG_85_02 PACK_WEEKEVENTREG_FLAG(85, 0x02) + +#define WEEKEVENTREG_85_04 PACK_WEEKEVENTREG_FLAG(85, 0x04) +#define WEEKEVENTREG_85_08 PACK_WEEKEVENTREG_FLAG(85, 0x08) +#define WEEKEVENTREG_85_10 PACK_WEEKEVENTREG_FLAG(85, 0x10) +#define WEEKEVENTREG_85_20 PACK_WEEKEVENTREG_FLAG(85, 0x20) +#define WEEKEVENTREG_85_40 PACK_WEEKEVENTREG_FLAG(85, 0x40) + +// Unconfirmed: "Postman showing priority mail to Madame" +#define WEEKEVENTREG_85_80 PACK_WEEKEVENTREG_FLAG(85, 0x80) + +#define WEEKEVENTREG_86_01 PACK_WEEKEVENTREG_FLAG(86, 0x01) +#define WEEKEVENTREG_86_02 PACK_WEEKEVENTREG_FLAG(86, 0x02) +#define WEEKEVENTREG_86_04 PACK_WEEKEVENTREG_FLAG(86, 0x04) +#define WEEKEVENTREG_86_08 PACK_WEEKEVENTREG_FLAG(86, 0x08) +#define WEEKEVENTREG_86_10 PACK_WEEKEVENTREG_FLAG(86, 0x10) +#define WEEKEVENTREG_86_20 PACK_WEEKEVENTREG_FLAG(86, 0x20) +#define WEEKEVENTREG_86_40 PACK_WEEKEVENTREG_FLAG(86, 0x40) +#define WEEKEVENTREG_86_80 PACK_WEEKEVENTREG_FLAG(86, 0x80) +#define WEEKEVENTREG_87_01 PACK_WEEKEVENTREG_FLAG(87, 0x01) +#define WEEKEVENTREG_87_02 PACK_WEEKEVENTREG_FLAG(87, 0x02) +#define WEEKEVENTREG_87_04 PACK_WEEKEVENTREG_FLAG(87, 0x04) +#define WEEKEVENTREG_87_08 PACK_WEEKEVENTREG_FLAG(87, 0x08) +#define WEEKEVENTREG_87_10 PACK_WEEKEVENTREG_FLAG(87, 0x10) +#define WEEKEVENTREG_87_20 PACK_WEEKEVENTREG_FLAG(87, 0x20) +#define WEEKEVENTREG_87_40 PACK_WEEKEVENTREG_FLAG(87, 0x40) +#define WEEKEVENTREG_87_80 PACK_WEEKEVENTREG_FLAG(87, 0x80) +#define WEEKEVENTREG_88_01 PACK_WEEKEVENTREG_FLAG(88, 0x01) +#define WEEKEVENTREG_88_02 PACK_WEEKEVENTREG_FLAG(88, 0x02) +#define WEEKEVENTREG_88_04 PACK_WEEKEVENTREG_FLAG(88, 0x04) +#define WEEKEVENTREG_88_08 PACK_WEEKEVENTREG_FLAG(88, 0x08) +#define WEEKEVENTREG_88_10 PACK_WEEKEVENTREG_FLAG(88, 0x10) +#define WEEKEVENTREG_88_20 PACK_WEEKEVENTREG_FLAG(88, 0x20) +#define WEEKEVENTREG_88_40 PACK_WEEKEVENTREG_FLAG(88, 0x40) +#define WEEKEVENTREG_88_80 PACK_WEEKEVENTREG_FLAG(88, 0x80) +#define WEEKEVENTREG_89_01 PACK_WEEKEVENTREG_FLAG(89, 0x01) +#define WEEKEVENTREG_89_02 PACK_WEEKEVENTREG_FLAG(89, 0x02) +#define WEEKEVENTREG_89_04 PACK_WEEKEVENTREG_FLAG(89, 0x04) + +// Unconfirmed: "Postman has delivered priority mail" +#define WEEKEVENTREG_89_08 PACK_WEEKEVENTREG_FLAG(89, 0x08) + +#define WEEKEVENTREG_89_10 PACK_WEEKEVENTREG_FLAG(89, 0x10) +#define WEEKEVENTREG_89_20 PACK_WEEKEVENTREG_FLAG(89, 0x20) + +// Unconfirmed: "Postman is about to flee" +#define WEEKEVENTREG_89_40 PACK_WEEKEVENTREG_FLAG(89, 0x40) + +#define WEEKEVENTREG_89_80 PACK_WEEKEVENTREG_FLAG(89, 0x80) + +// Unconfirmed: "Postman fleeing town" +#define WEEKEVENTREG_90_01 PACK_WEEKEVENTREG_FLAG(90, 0x01) + +#define WEEKEVENTREG_90_02 PACK_WEEKEVENTREG_FLAG(90, 0x02) +#define WEEKEVENTREG_90_04 PACK_WEEKEVENTREG_FLAG(90, 0x04) +#define WEEKEVENTREG_90_08 PACK_WEEKEVENTREG_FLAG(90, 0x08) +#define WEEKEVENTREG_90_10 PACK_WEEKEVENTREG_FLAG(90, 0x10) +#define WEEKEVENTREG_90_20 PACK_WEEKEVENTREG_FLAG(90, 0x20) +#define WEEKEVENTREG_90_40 PACK_WEEKEVENTREG_FLAG(90, 0x40) +#define WEEKEVENTREG_90_80 PACK_WEEKEVENTREG_FLAG(90, 0x80) +#define WEEKEVENTREG_91_01 PACK_WEEKEVENTREG_FLAG(91, 0x01) +#define WEEKEVENTREG_91_02 PACK_WEEKEVENTREG_FLAG(91, 0x02) +#define WEEKEVENTREG_91_04 PACK_WEEKEVENTREG_FLAG(91, 0x04) +#define WEEKEVENTREG_91_08 PACK_WEEKEVENTREG_FLAG(91, 0x08) +#define WEEKEVENTREG_91_10 PACK_WEEKEVENTREG_FLAG(91, 0x10) +#define WEEKEVENTREG_91_20 PACK_WEEKEVENTREG_FLAG(91, 0x20) +#define WEEKEVENTREG_91_40 PACK_WEEKEVENTREG_FLAG(91, 0x40) +#define WEEKEVENTREG_91_80 PACK_WEEKEVENTREG_FLAG(91, 0x80) + +// RACE_FLAGS +//#define WEEKEVENTREG_92_01 PACK_WEEKEVENTREG_FLAG(92, 0x01) +//#define WEEKEVENTREG_92_02 PACK_WEEKEVENTREG_FLAG(92, 0x02) +//#define WEEKEVENTREG_92_04 PACK_WEEKEVENTREG_FLAG(92, 0x04) + +#define WEEKEVENTREG_92_08 PACK_WEEKEVENTREG_FLAG(92, 0x08) +#define WEEKEVENTREG_92_10 PACK_WEEKEVENTREG_FLAG(92, 0x10) +#define WEEKEVENTREG_92_20 PACK_WEEKEVENTREG_FLAG(92, 0x20) +#define WEEKEVENTREG_92_40 PACK_WEEKEVENTREG_FLAG(92, 0x40) +#define WEEKEVENTREG_92_80 PACK_WEEKEVENTREG_FLAG(92, 0x80) +#define WEEKEVENTREG_93_01 PACK_WEEKEVENTREG_FLAG(93, 0x01) +#define WEEKEVENTREG_93_02 PACK_WEEKEVENTREG_FLAG(93, 0x02) +#define WEEKEVENTREG_93_04 PACK_WEEKEVENTREG_FLAG(93, 0x04) +#define WEEKEVENTREG_93_08 PACK_WEEKEVENTREG_FLAG(93, 0x08) +#define WEEKEVENTREG_93_10 PACK_WEEKEVENTREG_FLAG(93, 0x10) +#define WEEKEVENTREG_93_20 PACK_WEEKEVENTREG_FLAG(93, 0x20) +#define WEEKEVENTREG_93_40 PACK_WEEKEVENTREG_FLAG(93, 0x40) +#define WEEKEVENTREG_93_80 PACK_WEEKEVENTREG_FLAG(93, 0x80) +#define WEEKEVENTREG_94_01 PACK_WEEKEVENTREG_FLAG(94, 0x01) +#define WEEKEVENTREG_94_02 PACK_WEEKEVENTREG_FLAG(94, 0x02) +#define WEEKEVENTREG_94_04 PACK_WEEKEVENTREG_FLAG(94, 0x04) +#define WEEKEVENTREG_94_08 PACK_WEEKEVENTREG_FLAG(94, 0x08) +#define WEEKEVENTREG_94_10 PACK_WEEKEVENTREG_FLAG(94, 0x10) +#define WEEKEVENTREG_94_20 PACK_WEEKEVENTREG_FLAG(94, 0x20) +#define WEEKEVENTREG_94_40 PACK_WEEKEVENTREG_FLAG(94, 0x40) +#define WEEKEVENTREG_94_80 PACK_WEEKEVENTREG_FLAG(94, 0x80) +#define WEEKEVENTREG_95_01 PACK_WEEKEVENTREG_FLAG(95, 0x01) +#define WEEKEVENTREG_95_02 PACK_WEEKEVENTREG_FLAG(95, 0x02) +#define WEEKEVENTREG_95_04 PACK_WEEKEVENTREG_FLAG(95, 0x04) +#define WEEKEVENTREG_95_08 PACK_WEEKEVENTREG_FLAG(95, 0x08) +#define WEEKEVENTREG_95_10 PACK_WEEKEVENTREG_FLAG(95, 0x10) +#define WEEKEVENTREG_95_20 PACK_WEEKEVENTREG_FLAG(95, 0x20) +#define WEEKEVENTREG_95_40 PACK_WEEKEVENTREG_FLAG(95, 0x40) +#define WEEKEVENTREG_95_80 PACK_WEEKEVENTREG_FLAG(95, 0x80) +#define WEEKEVENTREG_96_01 PACK_WEEKEVENTREG_FLAG(96, 0x01) +#define WEEKEVENTREG_96_02 PACK_WEEKEVENTREG_FLAG(96, 0x02) +#define WEEKEVENTREG_96_04 PACK_WEEKEVENTREG_FLAG(96, 0x04) +#define WEEKEVENTREG_96_08 PACK_WEEKEVENTREG_FLAG(96, 0x08) +#define WEEKEVENTREG_96_10 PACK_WEEKEVENTREG_FLAG(96, 0x10) +#define WEEKEVENTREG_96_20 PACK_WEEKEVENTREG_FLAG(96, 0x20) +#define WEEKEVENTREG_96_40 PACK_WEEKEVENTREG_FLAG(96, 0x40) +#define WEEKEVENTREG_96_80 PACK_WEEKEVENTREG_FLAG(96, 0x80) +#define WEEKEVENTREG_97_01 PACK_WEEKEVENTREG_FLAG(97, 0x01) +#define WEEKEVENTREG_97_02 PACK_WEEKEVENTREG_FLAG(97, 0x02) +#define WEEKEVENTREG_97_04 PACK_WEEKEVENTREG_FLAG(97, 0x04) +#define WEEKEVENTREG_97_08 PACK_WEEKEVENTREG_FLAG(97, 0x08) +#define WEEKEVENTREG_97_10 PACK_WEEKEVENTREG_FLAG(97, 0x10) +#define WEEKEVENTREG_97_20 PACK_WEEKEVENTREG_FLAG(97, 0x20) +#define WEEKEVENTREG_97_40 PACK_WEEKEVENTREG_FLAG(97, 0x40) +#define WEEKEVENTREG_97_80 PACK_WEEKEVENTREG_FLAG(97, 0x80) +#define WEEKEVENTREG_98_01 PACK_WEEKEVENTREG_FLAG(98, 0x01) +#define WEEKEVENTREG_98_02 PACK_WEEKEVENTREG_FLAG(98, 0x02) +#define WEEKEVENTREG_98_04 PACK_WEEKEVENTREG_FLAG(98, 0x04) +#define WEEKEVENTREG_98_08 PACK_WEEKEVENTREG_FLAG(98, 0x08) +#define WEEKEVENTREG_98_10 PACK_WEEKEVENTREG_FLAG(98, 0x10) +#define WEEKEVENTREG_98_20 PACK_WEEKEVENTREG_FLAG(98, 0x20) +#define WEEKEVENTREG_98_40 PACK_WEEKEVENTREG_FLAG(98, 0x40) +#define WEEKEVENTREG_98_80 PACK_WEEKEVENTREG_FLAG(98, 0x80) +#define WEEKEVENTREG_99_01 PACK_WEEKEVENTREG_FLAG(99, 0x01) +#define WEEKEVENTREG_99_02 PACK_WEEKEVENTREG_FLAG(99, 0x02) +#define WEEKEVENTREG_99_04 PACK_WEEKEVENTREG_FLAG(99, 0x04) +#define WEEKEVENTREG_99_08 PACK_WEEKEVENTREG_FLAG(99, 0x08) +#define WEEKEVENTREG_99_10 PACK_WEEKEVENTREG_FLAG(99, 0x10) +#define WEEKEVENTREG_99_20 PACK_WEEKEVENTREG_FLAG(99, 0x20) +#define WEEKEVENTREG_99_40 PACK_WEEKEVENTREG_FLAG(99, 0x40) +#define WEEKEVENTREG_99_80 PACK_WEEKEVENTREG_FLAG(99, 0x80) + +#define WEEKEVENTREG(index) (gSaveContext.save.weekEventReg[(index)]) +#define GET_WEEKEVENTREG(index) ((void)0, WEEKEVENTREG(index)) + +#define CHECK_WEEKEVENTREG(flag) (WEEKEVENTREG((flag) >> 8) & ((flag) & 0xFF)) +#define CHECK_WEEKEVENTREG_ALT(flag) (GET_WEEKEVENTREG((flag) >> 8) & ((flag) & 0xFF)) +#define SET_WEEKEVENTREG(flag) (WEEKEVENTREG((flag) >> 8) = GET_WEEKEVENTREG((flag) >> 8) | ((flag) & 0xFF)) +#define CLEAR_WEEKEVENTREG(flag) (WEEKEVENTREG((flag) >> 8) = GET_WEEKEVENTREG((flag) >> 8) & (u8)~((flag) & 0xFF)) + +#define WEEKEVENTREG_RACE_FLAG_END 0 +#define WEEKEVENTREG_RACE_FLAG_START 1 +#define WEEKEVENTREG_RACE_FLAG_2 2 +#define WEEKEVENTREG_RACE_FLAG_3 3 +#define WEEKEVENTREG_RACE_FLAG_4 4 +#define WEEKEVENTREG_RACE_FLAGS 7 + +#define GET_WEEKEVENTREG_RACE_FLAGS (WEEKEVENTREG(92) & WEEKEVENTREG_RACE_FLAGS) + +#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ + WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ + WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)) + +/** + * gSaveContext.eventInf + */ + +#define EVENTINF_00 0x00 +#define EVENTINF_01 0x01 +#define EVENTINF_02 0x02 +#define EVENTINF_03 0x03 +#define EVENTINF_04 0x04 +#define EVENTINF_05 0x05 +#define EVENTINF_06 0x06 +#define EVENTINF_07 0x07 +#define EVENTINF_10 0x10 +#define EVENTINF_11 0x11 +#define EVENTINF_12 0x12 +#define EVENTINF_13 0x13 +#define EVENTINF_14 0x14 +#define EVENTINF_15 0x15 +#define EVENTINF_16 0x16 +#define EVENTINF_17 0x17 +#define EVENTINF_20 0x20 +#define EVENTINF_21 0x21 +#define EVENTINF_22 0x22 +#define EVENTINF_23 0x23 +#define EVENTINF_24 0x24 +#define EVENTINF_25 0x25 +#define EVENTINF_26 0x26 +#define EVENTINF_27 0x27 +#define EVENTINF_30 0x30 + +// EVENTINF_31 is used to track if Player is within range of EnGakufu (2D Song Buttons Appearing on Wall) +#define EVENTINF_31 0x31 +// EVENTINF_32 is used to track if Player has played the notes of EnGakufu (2D Song Buttons Appearing on Wall) +#define EVENTINF_32 0x32 + +#define EVENTINF_33 0x33 +#define EVENTINF_34 0x34 +#define EVENTINF_35 0x35 +#define EVENTINF_36 0x36 +#define EVENTINF_37 0x37 +#define EVENTINF_40 0x40 +#define EVENTINF_41 0x41 +#define EVENTINF_42 0x42 +#define EVENTINF_43 0x43 +#define EVENTINF_44 0x44 +#define EVENTINF_45 0x45 +#define EVENTINF_46 0x46 +#define EVENTINF_47 0x47 +#define EVENTINF_50 0x50 +#define EVENTINF_51 0x51 +#define EVENTINF_52 0x52 +#define EVENTINF_53 0x53 +#define EVENTINF_54 0x54 +#define EVENTINF_55 0x55 + +// Enabled when Gyorg's intro cutscene has been watched +#define EVENTINF_56 0x56 + +#define EVENTINF_57 0x57 +#define EVENTINF_60 0x60 +#define EVENTINF_61 0x61 +#define EVENTINF_62 0x62 +#define EVENTINF_63 0x63 +#define EVENTINF_64 0x64 +#define EVENTINF_65 0x65 +#define EVENTINF_66 0x66 +#define EVENTINF_67 0x67 +#define EVENTINF_70 0x70 +#define EVENTINF_71 0x71 +#define EVENTINF_72 0x72 +#define EVENTINF_73 0x73 +#define EVENTINF_74 0x74 +#define EVENTINF_75 0x75 +#define EVENTINF_76 0x76 +#define EVENTINF_77 0x77 + +#define CHECK_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] & (1 << ((flag) & 0xF))) +#define SET_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] |= (1 << ((flag) & 0xF))) +#define CLEAR_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] &= (u8)~(1 << ((flag) & 0xF))) +#define CLEAR_EVENTINF_ALT(flag) (gSaveContext.eventInf[(flag) >> 4] &= ~(1 << ((flag) & 0xF))) + + typedef enum { /* 0 */ DUNGEON_INDEX_WOODFALL_TEMPLE, /* 1 */ DUNGEON_INDEX_SNOWHEAD_TEMPLE, diff --git a/include/z64schedule.h b/include/z64schedule.h index 69906e584c..9f48a8762d 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -196,11 +196,11 @@ typedef struct { #define SCHEDULE_PACK_S16(val) \ ((val) >> 8) & 0xFF, (val) & 0xFF -#define SCHEDULE_CMD_CHECK_FLAG_S(index, mask, offset) \ - SCHEDULE_CMD_ID_CHECK_FLAG_S, (index), (mask), (offset) +#define SCHEDULE_CMD_CHECK_FLAG_S(flag, offset) \ + SCHEDULE_CMD_ID_CHECK_FLAG_S, SCHEDULE_PACK_S16(flag), (offset) -#define SCHEDULE_CMD_CHECK_FLAG_L(index, mask, offset) \ - SCHEDULE_CMD_ID_CHECK_FLAG_L, (index), (mask), SCHEDULE_PACK_S16(offset) +#define SCHEDULE_CMD_CHECK_FLAG_L(flag, offset) \ + SCHEDULE_CMD_ID_CHECK_FLAG_L, SCHEDULE_PACK_S16(flag), SCHEDULE_PACK_S16(offset) #define SCHEDULE_CMD_CHECK_TIME_RANGE_S(startHr, startMin, endHr, endMin, offset) \ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, (startHr), (startMin), (endHr), (endMin), (offset) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ced233c54c..a5d72e4a18 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2237,7 +2237,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto CycleSceneFlags* cycleFlags; s32 i; - gSaveContext.save.weekEventReg[92] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_92_80); cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneId(play->sceneId)]; bzero(actorCtx, sizeof(ActorContext)); @@ -2297,7 +2297,7 @@ void Actor_SpawnSetupActors(PlayState* play, ActorContext* actorCtx) { } if (!(phi_v0 & temp_fp) && (phi_v0 & actorCtx->unkC) && - (!(gSaveContext.eventInf[1] & 0x80) || !(phi_v0 & temp_s1) || !(actorEntry->id & 0x800))) { + (!CHECK_EVENTINF(EVENTINF_17) || !(phi_v0 & temp_s1) || !(actorEntry->id & 0x800))) { Actor_SpawnEntry(&play->actorCtx, actorEntry, play); } actorEntry++; @@ -4230,7 +4230,7 @@ s16 func_800BDB6C(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { Player* player = GET_PLAYER(play); f32 phi_f2; - if ((play->csCtx.state != 0) || gDbgCamEnabled) { + if ((play->csCtx.state != CS_STATE_0) || gDbgCamEnabled) { phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 646b915228..6473540280 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -598,7 +598,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB switch (D_801F4DE2) { case 0x1F: - if (gSaveContext.save.weekEventReg[20] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -611,7 +611,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB break; case 0x44: - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -624,7 +624,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB break; case 0x5F: - gSaveContext.save.weekEventReg[55] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_55_80); play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -632,7 +632,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB break; case 0x36: - gSaveContext.save.weekEventReg[52] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_52_20); play->nextEntrance = ENTRANCE(IKANA_CANYON, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1482,6 +1482,7 @@ void func_800EDBE0(PlayState* play) { } else if (!(((void)0, gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)))) { + // TODO: macros for this kind of weekEventReg access gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = ((void)0, gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)); diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index a5a4890a79..8308240244 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -21,20 +21,20 @@ u16 QuestHint_GetTatlTextId(PlayState* play) { return 0; } - if (gSaveContext.save.weekEventReg[88] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_20)) { return 0; } - if (gSaveContext.save.weekEventReg[79] & 0x10) { - if (gSaveContext.save.weekEventReg[8] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { return 0; } return 0x224; } - if (!(gSaveContext.save.weekEventReg[8] & 0x80)) { - if (gSaveContext.save.weekEventReg[9] & 1) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_08_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_01)) { return 0x21E; } @@ -58,34 +58,34 @@ u16 QuestHint_GetTatlTextId(PlayState* play) { } if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_MOON_TEAR) { - if (gSaveContext.save.weekEventReg[86] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_04)) { return 0x242; } return 0x243; } - if (gSaveContext.save.weekEventReg[74] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20)) { return 0x223; } - if (gSaveContext.save.weekEventReg[73] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80)) { return 0x222; } - if (gSaveContext.save.weekEventReg[73] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_20)) { return 0x221; } - if (gSaveContext.save.weekEventReg[77] & 2) { - if (gSaveContext.save.weekEventReg[73] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10)) { return 0x240; } return 0x241; } - if ((gSaveContext.save.weekEventReg[86] & 2) || (gSaveContext.save.weekEventReg[73] & 0x40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_02) || CHECK_WEEKEVENTREG(WEEKEVENTREG_73_40)) { return 0x23F; } diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 857250eecf..5609a47273 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -29,7 +29,7 @@ void GameOver_Update(PlayState* play) { gSaveContext.timerStates[timerId] = TIMER_STATE_OFF; } - gSaveContext.eventInf[1] &= ~1; + CLEAR_EVENTINF_ALT(EVENTINF_10); if (CUR_FORM == 0) { if (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI && diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 475de9819b..7120964468 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -96,7 +96,7 @@ void KaleidoSetup_Update(PlayState* play) { if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) { if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { - if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & PLAYER_STATE1_20)) { + if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && !(play->actorCtx.flags & ACTORCTX_FLAG_2)) { if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 5b35986171..44fff9f9f3 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -370,12 +370,12 @@ void func_80151BB4(PlayState* play, u8 arg1) { u8 temp = arg1; if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if ((gSaveContext.save.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { + if (!CHECK_WEEKEVENTREG(D_801C6B28[arg1])) { msgCtx->unk120B2[msgCtx->unk120B1] = temp; msgCtx->unk120B1++; } } else if (arg1 >= 20) { - if ((gSaveContext.save.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { + if (!CHECK_WEEKEVENTREG(D_801C6B28[arg1])) { msgCtx->unk120B2[msgCtx->unk120B1] = temp; msgCtx->unk120B1++; } @@ -391,11 +391,8 @@ u32 func_80151C9C(PlayState* play) { } msgCtx->unk120B1--; - if ((gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] & - (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]) == 0) { - gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] = - ((void)0, gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8]) | - (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]; + if (!CHECK_WEEKEVENTREG(D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]])) { + SET_WEEKEVENTREG(D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]); if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { func_80151938(play, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index a49844e5b2..db3cce0bb5 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -322,7 +322,7 @@ void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState) { void Interface_StartGoronRaceTimer(s32 arg0) { if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] != TIMER_STATE_OFF) { // Goron race started - if (gSaveContext.eventInf[1] & 1) { + if (CHECK_EVENTINF(EVENTINF_10)) { gSaveContext.timerCurTimes[TIMER_ID_GORON_RACE_UNUSED] = SECONDS_TO_TIMER_PRECISE(2, 39); } else { gSaveContext.timerCurTimes[TIMER_ID_GORON_RACE_UNUSED] = SECONDS_TO_TIMER_PRECISE(0, 1); @@ -1457,16 +1457,16 @@ u8 Item_Give(PlayState* play, u8 item) { } else if (item == ITEM_MAGIC_SMALL) { Magic_Add(play, MAGIC_NORMAL_METER / 2); - if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { - gSaveContext.save.weekEventReg[12] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_12_80); return ITEM_NONE; } return item; } else if (item == ITEM_MAGIC_LARGE) { Magic_Add(play, MAGIC_NORMAL_METER); - if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { - gSaveContext.save.weekEventReg[12] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_12_80); return ITEM_NONE; } return item; @@ -1676,7 +1676,7 @@ u8 Item_CheckObtainabilityImpl(u8 item) { return ITEM_RECOVERY_HEART; } else if ((item == ITEM_MAGIC_SMALL) || (item == ITEM_MAGIC_LARGE)) { - if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_80)) { return ITEM_NONE; } return item; @@ -2047,7 +2047,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { play->actorCtx.lensActive = false; } - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Drank Chateau Romani magicToConsume = 0; } @@ -2067,7 +2067,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { play->actorCtx.lensActive = false; } - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Drank Chateau Romani magicToConsume = 0; } @@ -2144,7 +2144,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { play->actorCtx.lensActive = false; } - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Drank Chateau Romani magicToConsume = 0; } @@ -2233,7 +2233,7 @@ void Magic_Update(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s16 magicCapacityTarget; - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Drank Chateau Romani Magic_FlashMeterBorder(); } @@ -2284,7 +2284,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME: // Consume magic until target is reached or no more magic is available - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { gSaveContext.save.playerData.magic = ((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume); if (gSaveContext.save.playerData.magic <= 0) { @@ -2297,7 +2297,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_METER_FLASH_1: case MAGIC_STATE_METER_FLASH_2: case MAGIC_STATE_METER_FLASH_3: - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { Magic_FlashMeterBorder(); } break; @@ -2331,19 +2331,19 @@ void Magic_Update(PlayState* play) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { gSaveContext.save.playerData.magic--; } interfaceCtx->magicConsumptionTimer = 80; } } - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { Magic_FlashMeterBorder(); } break; case MAGIC_STATE_CONSUME_GORON_ZORA_SETUP: - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { gSaveContext.save.playerData.magic -= 2; } if (gSaveContext.save.playerData.magic <= 0) { @@ -2358,7 +2358,7 @@ void Magic_Update(PlayState* play) { if (!Play_InCsMode(play)) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { gSaveContext.save.playerData.magic--; } if (gSaveContext.save.playerData.magic <= 0) { @@ -2368,7 +2368,7 @@ void Magic_Update(PlayState* play) { } } } - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { Magic_FlashMeterBorder(); } break; @@ -2380,7 +2380,7 @@ void Magic_Update(PlayState* play) { if (!Play_InCsMode(play)) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { gSaveContext.save.playerData.magic--; } if (gSaveContext.save.playerData.magic <= 0) { @@ -2390,7 +2390,7 @@ void Magic_Update(PlayState* play) { } } } - if (!(gSaveContext.save.weekEventReg[14] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { Magic_FlashMeterBorder(); } break; @@ -2446,7 +2446,7 @@ void Magic_DrawMeter(PlayState* play) { // Fill the rest of the meter with the normal magic color gDPPipeSync(OVERLAY_DISP++); - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Blue magic (drank Chateau Romani) gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha); } else { @@ -2460,7 +2460,7 @@ void Magic_DrawMeter(PlayState* play) { (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } else { // Fill the whole meter with the normal magic color - if (gSaveContext.save.weekEventReg[14] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_08)) { // Blue magic (drank Chateau Romani) gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha); } else { @@ -2894,7 +2894,7 @@ void Interface_DrawTimers(PlayState* play) { gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(120); gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && + } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES) && (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120))) { gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } @@ -3003,7 +3003,7 @@ void Interface_DrawTimers(PlayState* play) { if (osTime >= SECONDS_TO_TIMER(120)) { osTime = SECONDS_TO_TIMER(120); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && + } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES) && (osTime >= SECONDS_TO_TIMER(120))) { osTime = SECONDS_TO_TIMER(120); } @@ -3020,7 +3020,7 @@ void Interface_DrawTimers(PlayState* play) { play_sound(NA_SE_SY_WARNING_COUNT_E); sTimerBeepSfxSeconds = sTimerDigits[4]; } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { + } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES)) { if ((((void)0, gSaveContext.timerCurTimes[sTimerId]) > (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - SECONDS_TO_TIMER(9))) && (sTimerBeepSfxSeconds != sTimerDigits[4])) { @@ -3058,7 +3058,7 @@ void Interface_DrawTimers(PlayState* play) { } else { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { + } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES)) { if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c index 6a24926316..fdefb0f426 100644 --- a/src/code/z_schedule.c +++ b/src/code/z_schedule.c @@ -8,9 +8,9 @@ s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckFlagS* cmd = (ScheduleCmdCheckFlagS*)*script; - u16 flag = (cmd->flagByte << 8) | cmd->flagMask; + u16 flag = PACK_WEEKEVENTREG_FLAG(cmd->flagByte, cmd->flagMask); - if (gSaveContext.save.weekEventReg[flag >> 8] & (flag & 0xFF)) { + if (CHECK_WEEKEVENTREG(flag)) { *script += cmd->offset; } @@ -19,9 +19,9 @@ s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleOutput* output) { s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckFlagL* cmd = (ScheduleCmdCheckFlagL*)*script; - u16 flag = (cmd->flagByte << 8) | cmd->flagMask; + u16 flag = PACK_WEEKEVENTREG_FLAG(cmd->flagByte, cmd->flagMask); - if (gSaveContext.save.weekEventReg[flag >> 8] & (flag & 0xFF)) { + if (CHECK_WEEKEVENTREG(flag)) { *script += (s16)((cmd->offsetH << 8) | cmd->offsetL); } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 6f90061461..e027c115ff 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -131,16 +131,109 @@ u32 D_801C5FC0[SCENE_MAX][4] = { { 0, 0, 1, 0 }, // SCENE_ALLEY }; -// Related to weekEventReg +// TODO: figure out a way to use the WEEKEVENTREG defines here +// weekEventReg flags which will be not be cleared on a cycle reset u16 D_801C66D0[ARRAY_COUNT(gSaveContext.save.weekEventReg)] = { - 0xFFFC, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0, 0xC000, 0xC00, 0, 0xC0, 0, 0x300, - 0x3000, 0xC000, 0xC00, 0, 0, 0, 0, 0, 0, 0xC00C, 0xC00C, 0xC008, 3, - 0x3000, 0, 0, 0, 0xFF00, 0xC3F, 0x3F, 0, 0, 0xCFFF, 0, 0, 0xC00, - 0xC00, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3C, 0x20, - 0, 0x300C, 0x3000, 0, 0xC, 0xC0, 0, 0xFF0, 0x300, 0, 0, 0xC00, 0, - 0, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC0, 0, 0xC000, 0, 3, - 0, 0xC000, 0, 0xC0, 0x300, 0, 0, 0, 0xC000, 0xFFF0, 0, 0, 0x300, - 0, 0xC000, 0xF0, 0, 0, 0, 0, 0, 0, + /* 0 */ 0xFFFC, + /* 1 */ 0xFFFF, + /* 2 */ 0xFFFF, + /* 3 */ 0xFFFF, + /* 4 */ 0, + /* 5 */ 0, + /* 6 */ 0, + /* 7 */ 0xC000, + /* 8 */ 0xC00, + /* 9 */ 0, + /* 10 */ 0xC0, + /* 11 */ 0, + /* 12 */ 0x300, + /* 13 */ 0x3000, + /* 14 */ 0xC000, + /* 15 */ 0xC00, + /* 16 */ 0, + /* 17 */ 0, + /* 18 */ 0, + /* 19 */ 0, + /* 20 */ 0, + /* 21 */ 0, + /* 22 */ 0xC00C, + /* 23 */ 0xC00C, + /* 24 */ 0xC008, + /* 25 */ 3, + /* 26 */ 0x3000, + /* 27 */ 0, + /* 28 */ 0, + /* 29 */ 0, + /* 30 */ 0xFF00, + /* 31 */ 0xC3F, + /* 32 */ 0x3F, + /* 33 */ 0, + /* 34 */ 0, + /* 35 */ 0xCFFF, + /* 36 */ 0, + /* 37 */ 0, + /* 38 */ 0xC00, + /* 39 */ 0xC00, + /* 40 */ 0, + /* 41 */ 0xC0, + /* 42 */ 0, + /* 43 */ 0, + /* 44 */ 0, + /* 45 */ 0, + /* 46 */ 0, + /* 47 */ 0, + /* 48 */ 0, + /* 49 */ 0, + /* 50 */ 0x3C, + /* 51 */ 0x20, + /* 52 */ 0, + /* 53 */ 0x300C, + /* 54 */ 0x3000, + /* 55 */ 0, + /* 56 */ 0xC, + /* 57 */ 0xC0, + /* 58 */ 0, + /* 59 */ 0xFF0, + /* 60 */ 0x300, + /* 61 */ 0, + /* 62 */ 0, + /* 63 */ 0xC00, + /* 64 */ 0, + /* 65 */ 0, + /* 66 */ 0xFFFF, + /* 67 */ 0xFFFF, + /* 68 */ 0xFFFF, + /* 69 */ 0xFFFF, + /* 70 */ 0xFFFF, + /* 71 */ 0xFFFF, + /* 72 */ 0xFFFF, + /* 73 */ 0xC0, + /* 74 */ 0, + /* 75 */ 0xC000, + /* 76 */ 0, + /* 77 */ 3, + /* 78 */ 0, + /* 79 */ 0xC000, + /* 80 */ 0, + /* 81 */ 0xC0, + /* 82 */ 0x300, + /* 83 */ 0, + /* 84 */ 0, + /* 85 */ 0, + /* 86 */ 0xC000, + /* 87 */ 0xFFF0, + /* 88 */ 0, + /* 89 */ 0, + /* 90 */ 0x300, + /* 91 */ 0, + /* 92 */ 0xC000, + /* 93 */ 0xF0, + /* 94 */ 0, + /* 95 */ 0, + /* 96 */ 0, + /* 97 */ 0, + /* 98 */ 0, + /* 99 */ 0, }; // used in other files @@ -232,16 +325,11 @@ void Sram_ClearHighscores(void) { * Clears specific weekEventReg flags. Used by the "Dawn of the First Day" message */ void Sram_ClearFlagsAtDawnOfTheFirstDay(void) { - // Unconfirmed: "Link the Goron Claims His Reservation: 4:30 PM" - gSaveContext.save.weekEventReg[55] &= (u8)~2; - // Unconfirmed: "Postman fleeing town" - gSaveContext.save.weekEventReg[90] &= (u8)~1; - // Unconfirmed: "Postman is about to flee" - gSaveContext.save.weekEventReg[89] &= (u8)~0x40; - // Unconfirmed: "Postman has delivered priority mail" - gSaveContext.save.weekEventReg[89] &= (u8)~8; - // Unconfirmed: "Postman showing priority mail to Madame" - gSaveContext.save.weekEventReg[85] &= (u8)~0x80; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_55_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_89_40); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_89_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_85_80); } /** @@ -296,7 +384,7 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.masksGivenOnMoon[i] = 0; } - if (gSaveContext.save.weekEventReg[84] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_20)) { Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY)); } @@ -316,38 +404,38 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.eventInf[i] = 0; } - gSaveContext.eventInf[7] &= (u8)~1; - gSaveContext.eventInf[7] &= (u8)~2; - gSaveContext.eventInf[7] &= (u8)~4; - gSaveContext.eventInf[7] &= (u8)~8; - gSaveContext.eventInf[7] &= (u8)~0x10; + CLEAR_EVENTINF(EVENTINF_70); + CLEAR_EVENTINF(EVENTINF_71); + CLEAR_EVENTINF(EVENTINF_72); + CLEAR_EVENTINF(EVENTINF_73); + CLEAR_EVENTINF(EVENTINF_74); if (gSaveContext.save.playerData.rupees != 0) { - gSaveContext.eventInf[7] |= 1; + SET_EVENTINF(EVENTINF_70); } if (INV_CONTENT(ITEM_BOMB) == ITEM_BOMB) { item = INV_CONTENT(ITEM_BOMB); if (AMMO(item) != 0) { - gSaveContext.eventInf[7] |= 2; + SET_EVENTINF(EVENTINF_71); } } if (INV_CONTENT(ITEM_NUT) == ITEM_NUT) { item = INV_CONTENT(ITEM_NUT); if (AMMO(item) != 0) { - gSaveContext.eventInf[7] |= 4; + SET_EVENTINF(EVENTINF_72); } } if (INV_CONTENT(ITEM_STICK) == ITEM_STICK) { item = INV_CONTENT(ITEM_STICK); if (AMMO(item) != 0) { - gSaveContext.eventInf[7] |= 8; + SET_EVENTINF(EVENTINF_73); } } if (INV_CONTENT(ITEM_BOW) == ITEM_BOW) { item = INV_CONTENT(ITEM_BOW); if (AMMO(item) != 0) { - gSaveContext.eventInf[7] |= 0x10; + SET_EVENTINF(EVENTINF_74); } } @@ -482,10 +570,8 @@ void Sram_IncrementDay(void) { gSaveContext.save.bombersCaughtOrder[3] = 0; gSaveContext.save.bombersCaughtOrder[4] = 0; - // Unconfirmed: "Bombers Hide & Seek started on Day 1???" - gSaveContext.save.weekEventReg[73] &= (u8)~0x10; - // Unconfirmed: "Bombers Hide & Seek in Progress" - gSaveContext.save.weekEventReg[85] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_73_10); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_85_02); } u16 Sram_CalcChecksum(void* data, size_t count) { @@ -848,12 +934,9 @@ void Sram_InitDebugSave(void) { gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.isFirstCycle = true; - // - gSaveContext.save.weekEventReg[0x0F] |= 0x20; - // Unconfirmed: "Entered South Clock Town" - gSaveContext.save.weekEventReg[0x3B] |= 0x04; - // Unconfirmed: "Tatl's Second Cycle Text?" - gSaveContext.save.weekEventReg[0x1F] |= 0x04; + SET_WEEKEVENTREG(WEEKEVENTREG_15_20); + SET_WEEKEVENTREG(WEEKEVENTREG_59_04); + SET_WEEKEVENTREG(WEEKEVENTREG_31_04); gSaveContext.cycleSceneFlags[SCENE_INSIDETOWER].switch0 = 1; gSaveContext.save.permanentSceneFlags[SCENE_INSIDETOWER].switch0 = 1; @@ -990,12 +1073,10 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { } else { gSaveContext.save.entrance = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && - (gSaveContext.save.weekEventReg[20] & 2)) { - // Unconfirmed weekEventReg: "Woodfall Temple Prison Entrance raised / Water cleansed" + CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { gSaveContext.save.entrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); } else if ((gSaveContext.save.entrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && - (gSaveContext.save.weekEventReg[33] & 0x80)) { - // Unconfirmed weekEventReg: "Mountain Village Unfrozen" + CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { gSaveContext.save.entrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } @@ -1561,8 +1642,7 @@ void Sram_SaveSpecialNewDay(PlayState* play) { day = gSaveContext.save.day; - // Unconfirmed: "Obtained Fierce Deity Mask?" - gSaveContext.save.weekEventReg[84] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_84_20); Sram_SaveEndOfCycle(play); func_8014546C(&play->sramCtx); diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 25f6d0a885..4c73987ecc 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -146,14 +146,14 @@ s32 func_808B736C(BgBreakwall* this, PlayState* play) { } s32 func_808B7380(BgBreakwall* this, PlayState* play) { - if ((gSaveContext.save.day >= 2) && !(gSaveContext.save.weekEventReg[22] & 1)) { + if ((gSaveContext.save.day >= 2) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } return true; } s32 func_808B73C4(BgBreakwall* this, PlayState* play) { - return (gSaveContext.save.weekEventReg[33] & 0x80) || (gSaveContext.save.weekEventReg[21] & 1); + return CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_21_01); } s32 func_808B73FC(BgBreakwall* this, PlayState* play) { @@ -176,14 +176,14 @@ s32 func_808B7460(BgBreakwall* this, PlayState* play) { } s32 func_808B74A8(BgBreakwall* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { return false; } return true; } s32 func_808B74D8(BgBreakwall* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[9] & 0x80) || (gSaveContext.save.weekEventReg[23] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { return false; } return true; @@ -285,7 +285,7 @@ void func_808B782C(BgBreakwall* this, PlayState* play) { } void func_808B78A4(BgBreakwall* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c index 9d11c6a6fc..9cbfaec61b 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c @@ -53,7 +53,7 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BD71BC; this->csAction = 0x204; this->unk_160 = 1.0f; - if ((gSaveContext.save.weekEventReg[14] & 4) || (gSaveContext.save.weekEventReg[52] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { this->dyna.actor.draw = func_80BD7768; this->actionFunc = func_80BD73D0; play->envCtx.lightSettingOverride = 25; @@ -69,7 +69,7 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_012788, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (!(gSaveContext.save.weekEventReg[14] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { Actor_Kill(&this->dyna.actor); } break; @@ -80,7 +80,7 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_0117C8, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { this->unk_160 = 1.0f; this->dyna.actor.world.pos.y += 68.0f; } else { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 4add85012a..ba65baca42 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -84,7 +84,7 @@ void BgIknvObj_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - gSaveContext.save.weekEventReg[51] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_51_10); Actor_SetFocus(&this->dyna.actor, IREG(88)); break; default: @@ -98,7 +98,7 @@ void BgIknvObj_Destroy(Actor* thisx, PlayState* play) { if (IKNV_OBJ_TYPE(this) != IKNV_OBJ_RAISED_DOOR) { if (IKNV_OBJ_TYPE(this) == IKNV_OBJ_SAKON_DOOR) { Collider_DestroyCylinder(play, &this->collider); - gSaveContext.save.weekEventReg[51] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_51_10); } else { return; } @@ -125,7 +125,7 @@ s32 func_80BD7CEC(BgIknvObj* this) { } void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { this->dyna.actor.shape.rot.z -= 0x64; func_800B9098(&this->dyna.actor); func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); @@ -156,7 +156,7 @@ s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, PlayState* play) { void func_80BD7ED8(BgIknvObj* this, PlayState* play) { if (func_80BD7E0C(this, this->dyna.actor.home.rot.y, play)) { this->actionFunc = BgIknvObj_UpdateSakonDoor; - gSaveContext.save.weekEventReg[51] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_51_10); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -165,7 +165,7 @@ void func_80BD7F4C(BgIknvObj* this, PlayState* play) { if (gSaveContext.save.time > CLOCK_TIME(19, 30)) { this->actionFunc = func_80BD7ED8; } - if ((this->dyna.actor.home.rot.x == 1) && !(gSaveContext.save.weekEventReg[58] & 0x80)) { + if ((this->dyna.actor.home.rot.x == 1) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_58_80)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->dyna.actor.home.rot.x = 0; } @@ -175,7 +175,7 @@ void func_80BD7F4C(BgIknvObj* this, PlayState* play) { void func_80BD7FDC(BgIknvObj* this, PlayState* play) { if (func_80BD7E0C(this, this->dyna.actor.home.rot.y + 0x4000, play)) { this->actionFunc = func_80BD7F4C; - gSaveContext.save.weekEventReg[51] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_51_10); this->dyna.actor.home.rot.x = 1; } } @@ -188,9 +188,9 @@ void func_80BD8040(BgIknvObj* this, PlayState* play) { } void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[58] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_80)) { this->actionFunc = func_80BD8040; - gSaveContext.save.weekEventReg[89] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_89_80); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 911eb92435..499dc69952 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -72,7 +72,7 @@ Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCat, s16 acto void func_80953B40(BgIngate* this) { s32 temp; - if (!(gSaveContext.eventInf[3] & 0x20)) { + if (!CHECK_EVENTINF(EVENTINF_35)) { this->timePathTotalTime = 4 * 1000; this->timePathTimeSpeed = 4; } else { @@ -125,10 +125,10 @@ s32 func_80953BEC(BgIngate* this) { s32 func_80953DA8(BgIngate* this, PlayState* play) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - if (gSaveContext.eventInf[3] & 0x20) { + if (CHECK_EVENTINF(EVENTINF_35)) { func_800B7298(play, &this->dyna.actor, 7); } else { - gSaveContext.eventInf[4] |= 2; + SET_EVENTINF(EVENTINF_41); } Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE); play->unk_1887C = 0x63; @@ -139,8 +139,8 @@ s32 func_80953DA8(BgIngate* this, PlayState* play) { void func_80953E38(PlayState* play) { Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_NORMAL0); - if (!(gSaveContext.eventInf[3] & 0x20)) { - gSaveContext.eventInf[4] &= (u8)~2; + if (!CHECK_EVENTINF(EVENTINF_35)) { + CLEAR_EVENTINF(EVENTINF_41); } play->unk_1887C = -1; @@ -180,9 +180,9 @@ void func_80953F9C(BgIngate* this, PlayState* play) { Player* player = GET_PLAYER(play); Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - if (!(gSaveContext.eventInf[4] & 1)) { + if (!CHECK_EVENTINF(EVENTINF_40)) { - if (!(gSaveContext.eventInf[3] & 0x20) && (this->unk160 & 0x10) && (this->unk16C == 0)) { + if (!CHECK_EVENTINF(EVENTINF_35) && (this->unk160 & 0x10) && (this->unk16C == 0)) { this->dyna.actor.textId = 0x9E3; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk160 &= ~0x10; @@ -196,14 +196,13 @@ void func_80953F9C(BgIngate* this, PlayState* play) { this->dyna.actor.textId = 0x9E4; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk16C += 1; - gSaveContext.save.weekEventReg[90] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_90_40); this->actionFunc = func_809543D4; } else { - - if (!(gSaveContext.eventInf[3] & 0x20)) { - gSaveContext.eventInf[4] &= (u8)~2; + if (!CHECK_EVENTINF(EVENTINF_35)) { + CLEAR_EVENTINF(EVENTINF_41); } else { - gSaveContext.eventInf[4] |= 1; + SET_EVENTINF(EVENTINF_40); } this->actionFunc = func_809542A0; } @@ -244,9 +243,9 @@ void func_809541B8(BgIngate* this, PlayState* play) { } void func_809542A0(BgIngate* this, PlayState* play) { - if (gSaveContext.eventInf[5] & 1) { + if (CHECK_EVENTINF(EVENTINF_50)) { play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 2); - gSaveContext.eventInf[5] &= (u8)~1; + CLEAR_EVENTINF(EVENTINF_50); } else { play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 1); } @@ -255,7 +254,7 @@ void func_809542A0(BgIngate* this, PlayState* play) { play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; this->actionFunc = func_80953F8C; - gSaveContext.save.weekEventReg[90] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_800FE498(); } @@ -291,7 +290,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { this->timePath = &play->setupPathList[this->timePath->unk1]; } func_80953F14(this, play); - gSaveContext.save.weekEventReg[90] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_8019F230(); } func_801477B4(play); @@ -299,7 +298,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { case 0x9E6: if (play->msgCtx.choiceIndex == 0) { func_80953EA4(this, play); - gSaveContext.save.weekEventReg[90] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_8019F208(); } else { func_800B7298(play, &this->dyna.actor, 6); @@ -331,10 +330,10 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->dyna.actor, 1.0f); this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); this->dyna.actor.room = -1; - if (gSaveContext.save.weekEventReg[20] & 2) { - gSaveContext.save.weekEventReg[90] &= (u8)~0x40; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); } - if (!(gSaveContext.eventInf[3] & 0x20) && (gSaveContext.save.weekEventReg[90] & 0x40)) { + if (!CHECK_EVENTINF(EVENTINF_35) && CHECK_WEEKEVENTREG(WEEKEVENTREG_90_40)) { phi_a2 = 1; this->unk16C = 1; this->actionFunc = func_809541B8; @@ -342,10 +341,10 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { phi_a2 = 0; if (play->curSpawn == 6) { func_80953F14(this, play); - if (gSaveContext.eventInf[3] & 0x20) { + if (CHECK_EVENTINF(EVENTINF_35)) { func_80112AFC(play); } else { - gSaveContext.eventInf[4] |= 2; + SET_EVENTINF(EVENTINF_41); } } else { this->actionFunc = func_80953F8C; diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index 2a5d449296..497ed10abc 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -161,7 +161,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play) { return; } - if (gSaveContext.save.weekEventReg[12] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; @@ -219,7 +219,7 @@ void BgNumaHana_ClosedIdle(BgNumaHana* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - gSaveContext.save.weekEventReg[12] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_12_01); Flags_SetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupUnfoldInnerPetals(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c index 8edd322baa..2ec37cb7e0 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c @@ -67,7 +67,7 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { this->pythonIndex = sCurrentPythonIndex; sCurrentPythonIndex++; - if (!(gSaveContext.save.weekEventReg[13] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_13_01)) { this->deepPython = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_DRAGON, pos.x, pos.y, pos.z, 0, this->dyna.actor.world.rot.y, 1, this->dyna.actor.params); @@ -82,14 +82,14 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { } } else { shouldSpawnSeahorse = false; - if (((this->dyna.actor.params == 0) && (gSaveContext.save.weekEventReg[83] & 0x10)) || - ((this->dyna.actor.params == 1) && (gSaveContext.save.weekEventReg[83] & 0x20)) || - ((this->dyna.actor.params == 2) && (gSaveContext.save.weekEventReg[83] & 0x40)) || - ((this->dyna.actor.params == 3) && (gSaveContext.save.weekEventReg[83] & 0x80)) || - ((this->dyna.actor.params == 4) && (gSaveContext.save.weekEventReg[84] & 1)) || - ((this->dyna.actor.params == 5) && (gSaveContext.save.weekEventReg[84] & 2)) || - ((this->dyna.actor.params == 6) && (gSaveContext.save.weekEventReg[84] & 4)) || - ((this->dyna.actor.params == 7) && (gSaveContext.save.weekEventReg[84] & 8))) { + if (((this->dyna.actor.params == 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_10)) || + ((this->dyna.actor.params == 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_20)) || + ((this->dyna.actor.params == 2) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_40)) || + ((this->dyna.actor.params == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_80)) || + ((this->dyna.actor.params == 4) && CHECK_WEEKEVENTREG(WEEKEVENTREG_84_01)) || + ((this->dyna.actor.params == 5) && CHECK_WEEKEVENTREG(WEEKEVENTREG_84_02)) || + ((this->dyna.actor.params == 6) && CHECK_WEEKEVENTREG(WEEKEVENTREG_84_04)) || + ((this->dyna.actor.params == 7) && CHECK_WEEKEVENTREG(WEEKEVENTREG_84_08))) { shouldSpawnSeahorse = true; } diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index a4256de8f4..d6617ef1c0 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -38,12 +38,12 @@ void BgTobira01_Open(BgTobira01* this, PlayState* play) { ActorCutscene_Stop(0x7C); } else if (ActorCutscene_GetCanPlayNext(cutsceneId)) { ActorCutscene_StartAndSetUnkLinkFields(cutsceneId, &this->dyna.actor); - gSaveContext.save.weekEventReg[88] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_88_40); this->playCutscene = false; } else { ActorCutscene_SetIntentToPlay(cutsceneId); } - } else if (!(gSaveContext.save.weekEventReg[88] & 0x40) && (this->timer == 0) && (play->actorCtx.unk1F5 != 0) && + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && (this->timer == 0) && (play->actorCtx.unk1F5 != 0) && (play->actorCtx.unk1F4 == 0) && (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { this->playCutscene = true; @@ -52,7 +52,7 @@ void BgTobira01_Open(BgTobira01* this, PlayState* play) { prevTimer = this->timer; - if (gSaveContext.save.weekEventReg[88] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40)) { this->timer++; } else { this->timer--; @@ -67,9 +67,9 @@ void BgTobira01_Open(BgTobira01* this, PlayState* play) { this->timer2 = 180; } - if (!(player->stateFlags1 & PLAYER_STATE1_40) && (gSaveContext.save.weekEventReg[88] & 0x40) && + if (!(player->stateFlags1 & PLAYER_STATE1_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && (DECR(this->timer2) == 0)) { - gSaveContext.save.weekEventReg[88] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); } } @@ -79,7 +79,7 @@ void BgTobira01_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(play, &this->dyna, &object_spot11_obj_Colheader_0011C0); - gSaveContext.save.weekEventReg[88] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); Actor_SetScale(&this->dyna.actor, 1.0f); this->timer2 = gSaveContext.save.isNight; this->timer = 0; diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index 479239f055..bef32aeddc 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -61,7 +61,7 @@ void BgUmajump_StopCutscene(BgUmajump* this, PlayState* play) { void BgUmajump_PlayCutscene(BgUmajump* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - gSaveContext.save.weekEventReg[89] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_89_20); this->actionFunc = BgUmajump_StopCutscene; } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); @@ -93,7 +93,7 @@ void BgUmajump_Init(Actor* thisx, PlayState* play) { thisx->params = BG_UMAJUMP_GET_FF(thisx); if ((thisx->params == BG_UMAJUMP_TYPE_2)) { - if ((((play->sceneId == SCENE_F01) && !(gSaveContext.save.weekEventReg[89] & 0x20)) && + if ((((play->sceneId == SCENE_F01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_89_20)) && !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) && (thisx->cutscene != -1)) { this->actionFunc = BgUmajump_CheckDistance; @@ -134,11 +134,11 @@ void BgUmajump_Update(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->dyna.actor); if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) { - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } } else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_6) { - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } } else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_4) || (this->dyna.actor.params == BG_UMAJUMP_TYPE_3)) { @@ -155,11 +155,11 @@ void BgUmajump_Update(Actor* thisx, PlayState* play) { this->dyna.actor.update = func_8091A5A0; } else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_5) || (this->dyna.actor.params == BG_UMAJUMP_TYPE_6)) { if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) { - if ((this->dyna.bgId == BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1)) { + if ((this->dyna.bgId == BGACTOR_NEG_ONE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } } else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_6) && (this->dyna.bgId == BGACTOR_NEG_ONE) && - (!(gSaveContext.save.weekEventReg[22] & 1) || + (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) || ((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) && ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0)))))) { @@ -191,18 +191,18 @@ void func_8091A5A0(Actor* thisx, PlayState* play) { } if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) { - if ((this->dyna.bgId == BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1)) { + if ((this->dyna.bgId == BGACTOR_NEG_ONE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); - } else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && !(gSaveContext.save.weekEventReg[22] & 1)) { + } else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_6) { if ((this->dyna.bgId == BGACTOR_NEG_ONE) && - (!(gSaveContext.save.weekEventReg[22] & 1) || + (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) || ((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) && (gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0))))) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); - } else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1) && + } else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) && ((gSaveContext.save.day != 2) || (gSaveContext.save.isNight != true) || (gSaveContext.save.time < CLOCK_TIME(5, 30)) || (gSaveContext.save.time > CLOCK_TIME(6, 0)))) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index ceb9ffae58..7a6e22a7ba 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -550,7 +550,7 @@ void Boss02_Init(Actor* thisx, PlayState* play) { s32 i; s32 pad[2]; - if ((gSaveContext.save.weekEventReg[52] & 0x20) && (this->actor.params == TWINMOLD_RED)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (this->actor.params == TWINMOLD_RED)) { sBlueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 60.0f, 0.0f, 0, 0, 0, 1); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); @@ -566,7 +566,7 @@ void Boss02_Init(Actor* thisx, PlayState* play) { this->actor.draw = Boss02_Static_Draw; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_1D70 = 0.00999999977648f; - if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x20) || (sBlueWarp != NULL)) { + if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_55) || (sBlueWarp != NULL)) { this->unk_1D20 = 0; sMusicStartTimer = KREG(15) + 20; } else { @@ -2050,7 +2050,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { break; case 1: - if ((gSaveContext.save.weekEventReg[52] & 0x20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { break; } Cutscene_Start(play, &play->csCtx); @@ -2144,7 +2144,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { this->unk_1D20 = 0; sRedTwinmold->unk_0144 = sBlueTwinmold->unk_0144 = 3; sRedTwinmold->unk_0146[0] = sBlueTwinmold->unk_0146[0] = 60; - gSaveContext.eventInf[5] |= 0x20; + SET_EVENTINF(EVENTINF_55); } break; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 980db6ebec..b92368bf2d 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -7,10 +7,6 @@ /** * Some notes: * - * Global flags: - * - gSaveContext.eventInf[5] & 0x40: Enabled when Gyorg's intro cutscene has been watched - * - gSaveContext.save.weekEventReg[55] & 0x80: Checked to know if Gyorg has been defeated - * * Seaweed: * - Refers to the seaweed at the bottom of the stage where Player fights Gyorg * - The default Gyorg actor will spawn 5 other Gyorg instances using the parameter GYORG_PARAM_SEAWEED to spawn them @@ -453,7 +449,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; Vec3f sp70; - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, PLATFORM_HEIGHT, 200.0f, 0, 0, 0, ENDOORWARP1_FF_1); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, PLATFORM_HEIGHT, 0.0f, 0, 0, 0, 0); @@ -519,8 +515,8 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { GYORG_LIMB_MAX); Actor_SetScale(&this->actor, 0.2f); - // gSaveContext.eventInf[5] & 0x40: intro cutscene already watched - if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x40)) { + // CHECK_EVENTINF(EVENTINF_56): intro cutscene already watched + if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_56)) { this->actionFunc = func_809E344C; D_809E9842 = false; Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); @@ -1377,7 +1373,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; - gSaveContext.eventInf[5] |= 0x40; + SET_EVENTINF(EVENTINF_56); } break; } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 26965b2573..5bffc33f8e 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -199,7 +199,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) { this->actor.world.pos.z = this->unk_6F0; Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 4); - if ((KREG(64) != 0) || (gSaveContext.eventInf[6] & 1)) { + if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_60)) { func_809ECD00(this, play); this->actor.world.pos.y = this->actor.floorHeight + 160.0f; phi_f24 = this->actor.floorHeight; @@ -392,7 +392,7 @@ void func_809EC568(Boss04* this, PlayState* play) { Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); func_80165690(); - gSaveContext.eventInf[6] |= 1; + SET_EVENTINF(EVENTINF_60); } break; } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index c9516bb1ac..4c766b1e60 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -135,7 +135,7 @@ void Boss06_Init(Actor* thisx, PlayState* play) { D_809F4970 = (EnKnight*)this->actor.parent; this->actor.colChkInfo.damageTable = &sDamageTable; - if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x80)) { + if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_57)) { this->actionFunc = func_809F2E14; } else { this->actionFunc = func_809F2B64; diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 19c1105a17..069d829c1e 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -67,7 +67,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { switch (DMCHAR01_GET(&this->dyna.actor)) { case DMCHAR01_0: - if (gSaveContext.save.weekEventReg[20] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { this->unk_34C = 2; this->actionFunc = func_80AA8F1C; break; @@ -97,7 +97,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { break; case DMCHAR01_1: - if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneLayer == 1)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02) || (gSaveContext.sceneLayer == 1)) { this->unk_34C = 1; this->actionFunc = func_80AA8F1C; } else { @@ -107,7 +107,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { case DMCHAR01_2: this->unk_34C = 0; - if (!(gSaveContext.save.weekEventReg[20] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_01)) { this->unk_34C = 1; this->dyna.actor.world.pos.y -= 400.0f; } @@ -123,7 +123,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { case DMCHAR01_3: this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.shape.rot.y += 0x8000; - if (!(gSaveContext.save.weekEventReg[20] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_01)) { Actor_Kill(&this->dyna.actor); return; } @@ -134,7 +134,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleRampAndPlatformCol); this->unk_34D = true; - if (!(gSaveContext.save.weekEventReg[20] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { this->actionFunc = func_80AA9020; this->dyna.actor.world.pos.y -= 120.0f; } else { @@ -160,7 +160,7 @@ void func_80AA8698(DmChar01* this, PlayState* play) { Player* player = GET_PLAYER(play); Player* player2 = GET_PLAYER(play); - if (gSaveContext.save.weekEventReg[20] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_01)) { return; } @@ -180,7 +180,7 @@ void func_80AA8698(DmChar01* this, PlayState* play) { if ((player2->actor.world.pos.x > -40.0f) && (player2->actor.world.pos.x < 40.0f) && (player2->actor.world.pos.z > 1000.0f) && (player2->actor.world.pos.z < 1078.0f)) { - gSaveContext.save.weekEventReg[20] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_20_01); this->actionFunc = func_80AA884C; } } @@ -348,7 +348,7 @@ void func_80AA9020(DmChar01* this, PlayState* play) { CsCmdActorAction* temp_v1 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]; if ((temp_v1->startFrame == play->csCtx.frames) && (temp_v1->action == 2)) { - gSaveContext.save.weekEventReg[20] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_20_02); this->actionFunc = func_80AA90AC; } } diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c index 4013293fb3..0385a82d4f 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c @@ -37,7 +37,7 @@ void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc) { void DmChar06_Init(Actor* thisx, PlayState* play) { DmChar06* this = THIS; - gSaveContext.save.weekEventReg[33] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_33_80); Actor_SetScale(&this->actor, 1.0f); this->alpha = 255; DmChar06_SetupAction(this, func_80AAE6F0); diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index 46bee748cf..4129adfbef 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -164,7 +164,7 @@ void DmChar08_Init(Actor* thisx, PlayState* play2) { this->targetYPos = thisx->world.pos.y; this->unk_1F0 = 0.0f; if (play->sceneId == SCENE_31MISAKI) { - if (gSaveContext.save.weekEventReg[53] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { DynaPolyActor_Init(&this->dyna, 3); DynaPolyActor_LoadMesh(play, &this->dyna, &gTurtleZoraCapeAwakeCol); } else { @@ -185,7 +185,7 @@ void DmChar08_Init(Actor* thisx, PlayState* play2) { switch (play->sceneId) { case SCENE_31MISAKI: - if (gSaveContext.save.weekEventReg[53] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { thisx->world.pos.x = -6480.0f; this->targetYPos = -120.0f; thisx->world.pos.z = 1750.0f; @@ -279,14 +279,14 @@ void DmChar08_SetupAppearCs(DmChar08* this, PlayState* play) { s16 cs = ActorCutscene_GetAdditionalCutscene( ActorCutscene_GetAdditionalCutscene(ActorCutscene_GetAdditionalCutscene(cs1))); - if (gSaveContext.save.weekEventReg[93] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_08)) { cs1 = cs; } if (ActorCutscene_GetCanPlayNext(cs1)) { ActorCutscene_Start(cs1, &this->dyna.actor); - gSaveContext.save.weekEventReg[53] |= 0x20; - gSaveContext.save.weekEventReg[93] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_53_20); + SET_WEEKEVENTREG(WEEKEVENTREG_93_08); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AAF884; } else { @@ -329,10 +329,10 @@ void func_80AAFA18(DmChar08* this, PlayState* play) { nextCs2 = nextCs1; nextCs1 = ActorCutscene_GetAdditionalCutscene(nextCs1); - nextCs = ((void)0, gSaveContext.save.weekEventReg[53] & 0x40) ? nextCs1 : nextCs2; + nextCs = CHECK_WEEKEVENTREG(WEEKEVENTREG_53_40) ? nextCs1 : nextCs2; if (ActorCutscene_GetCanPlayNext(nextCs) != 0) { - gSaveContext.save.weekEventReg[53] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_53_40); ActorCutscene_Start(nextCs, &this->dyna.actor); this->actionFunc = DmChar08_DoNothing; } else { @@ -390,7 +390,7 @@ void DmChar08_SpawnBubbles(DmChar08* this, PlayState* play) { void func_80AAFCCC(DmChar08* this, PlayState* play) { switch (play->sceneId) { case SCENE_31MISAKI: - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { switch (this->unk_206) { case 0: break; diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index ba4c3bb008..25fee11db7 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -32,7 +32,7 @@ void DmRavine_Init(Actor* thisx, PlayState* play) { s32 pad; DmRavine* this = THIS; - if (((((void)0, gSaveContext.save.weekEventReg[0]) & 0x10) | cREG(0)) != 0) { + if (CHECK_WEEKEVENTREG_ALT(WEEKEVENTREG_00_10) | cREG(0)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 6d0fd48a49..f82279c09b 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1149,7 +1149,7 @@ void DmStk_DoNothing(DmStk* this, PlayState* play) { void DmStk_WaitForTelescope(DmStk* this, PlayState* play) { Vec3f screenPos; - if (!(gSaveContext.save.weekEventReg[74] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20)) { Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); if (play->view.fovy < 25.0f) { if ((screenPos.x >= 70.0f) && (screenPos.x < (SCREEN_WIDTH - 70.0f)) && (screenPos.y >= 30.0f) && @@ -1172,7 +1172,7 @@ void DmStk_StartTelescopeCutscene(DmStk* this, PlayState* play) { if (gSaveContext.save.day < 3) { cutscene = dayOneAndTwoCutscene; - } else if ((gSaveContext.save.weekEventReg[8] & 0x40) || + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40) || ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { cutscene = finalHoursCutscene; } else { @@ -1630,7 +1630,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { if (this->alpha < 0) { this->alpha = 0; this->fadeOutState = SK_FADE_OUT_STATE_NONE; - gSaveContext.save.weekEventReg[12] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_12_04); if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) { Actor_Kill(&this->actor); } else { diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c index d91be440ac..ce1cc98f38 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c @@ -230,7 +230,7 @@ void DmTag_Init(Actor* thisx, PlayState* play) { DmTag* this = (DmTag*)thisx; Player* player = GET_PLAYER(play); - if (gSaveContext.save.weekEventReg[85] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_04)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 707150e333..a54f1da748 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -270,7 +270,7 @@ void func_808B8E78(DoorWarp1* this, PlayState* play) { this->unk_1A4 = 700.0f; if (play->sceneId == SCENE_INISIE_N) { DoorWarp1_SetupAction(this, func_808B96A0); - } else if (gSaveContext.save.weekEventReg[86] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_80)) { this->unk_1D4 = 0; DoorWarp1_SetupAction(this, func_808B921C); } else { @@ -652,7 +652,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { if (this->unk_202 != 0) { if (phi_v0_2 > 0) { - gSaveContext.save.weekEventReg[7] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_07_80); } switch (phi_v0_2) { @@ -710,8 +710,8 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { } else { switch (phi_v0_2) { case 0: - if (gSaveContext.save.weekEventReg[20] & 2) { - gSaveContext.save.weekEventReg[7] |= 0x80; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + SET_WEEKEVENTREG(WEEKEVENTREG_07_80); play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -726,7 +726,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 1: - gSaveContext.save.weekEventReg[33] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_33_80); play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -734,14 +734,14 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 3: - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { play->nextEntrance = ENTRANCE(ZORA_CAPE, 9); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { - gSaveContext.save.weekEventReg[55] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_55_80); play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -751,7 +751,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 2: - gSaveContext.save.weekEventReg[52] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_52_20); play->nextEntrance = ENTRANCE(IKANA_CANYON, 15); gSaveContext.nextCutsceneIndex = 0xFFF2; play->transitionTrigger = TRANS_TRIGGER_START; @@ -886,14 +886,14 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play) { phi_f2 = 85.0f; } - if (!(gSaveContext.save.weekEventReg[86] & 0x80) && (fabsf(this->dyna.actor.xzDistToPlayer) < phi_f2) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_80) && (fabsf(this->dyna.actor.xzDistToPlayer) < phi_f2) && ((player->actor.world.pos.y - 20.0f) < this->dyna.actor.world.pos.y) && (this->dyna.actor.world.pos.y < (player->actor.world.pos.y + 20.0f))) { cutscene = this->dyna.actor.cutscene; if (ActorCutscene_GetCanPlayNext(cutscene)) { ActorCutscene_Start(cutscene, &this->dyna.actor); - gSaveContext.save.weekEventReg[86] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_86_80); DoorWarp1_SetupAction(this, func_808BABF4); } else { ActorCutscene_SetIntentToPlay(cutscene); diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c index e69806ac7b..0ffb5c7589 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c @@ -41,19 +41,19 @@ static InitChainEntry sInitChain[] = { }; s32 func_80BA15A0(void) { - if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && !(gSaveContext.save.weekEventReg[87] & 0x10)) { + if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_87_10)) { return true; } - if (CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && !(gSaveContext.save.weekEventReg[87] & 0x20)) { + if (CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_87_20)) { return true; } - if (CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && !(gSaveContext.save.weekEventReg[87] & 0x40)) { + if (CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_87_40)) { return true; } - if (CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD) && !(gSaveContext.save.weekEventReg[87] & 0x80)) { + if (CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_87_80)) { return true; } @@ -62,24 +62,24 @@ s32 func_80BA15A0(void) { void func_80BA165C(void) { if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA)) { - gSaveContext.save.weekEventReg[87] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_87_10); } if (CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { - gSaveContext.save.weekEventReg[87] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_87_20); } if (CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { - gSaveContext.save.weekEventReg[87] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_87_40); } if (CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - gSaveContext.save.weekEventReg[87] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_87_80); } } s32 func_80BA16F4(ElfMsg6* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[31] & 4) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_04) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->actor.textId = 0x216; return false; } @@ -94,7 +94,7 @@ s32 func_80BA16F4(ElfMsg6* this, PlayState* play) { } if (!CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { - if (gSaveContext.save.weekEventReg[31] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_01)) { this->actor.textId = 0x257; } else { this->actor.textId = 0x231; @@ -103,7 +103,7 @@ s32 func_80BA16F4(ElfMsg6* this, PlayState* play) { } if (!CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { - if (gSaveContext.save.weekEventReg[31] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_02)) { this->actor.textId = 0x258; } else { this->actor.textId = 0x232; @@ -112,7 +112,7 @@ s32 func_80BA16F4(ElfMsg6* this, PlayState* play) { } if (!CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - if (gSaveContext.save.weekEventReg[80] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_80_04)) { this->actor.textId = 0x259; } else { this->actor.textId = 0x233; @@ -169,7 +169,7 @@ void ElfMsg6_Init(Actor* thisx, PlayState* play) { break; case 1: - if (gSaveContext.save.weekEventReg[83] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_83_02)) { Actor_Kill(&this->actor); return; } @@ -183,14 +183,14 @@ void ElfMsg6_Init(Actor* thisx, PlayState* play) { return; } - if (gSaveContext.save.weekEventReg[8] & 0x40) { - if (gSaveContext.save.weekEventReg[88] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_20)) { Actor_Kill(&this->actor); return; } this->actor.textId = 0x25B; } else { - if (!(gSaveContext.save.weekEventReg[74] & 0x20) || (gSaveContext.save.weekEventReg[79] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_79_10)) { Actor_Kill(&this->actor); return; } @@ -202,7 +202,7 @@ void ElfMsg6_Init(Actor* thisx, PlayState* play) { case 3: if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor))) || - (gSaveContext.save.weekEventReg[88] & 0x10) || (gSaveContext.save.weekEventReg[91] & 1) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_88_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_91_01) || (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA)) { Actor_Kill(&this->actor); return; @@ -265,18 +265,18 @@ void func_80BA1CF8(ElfMsg6* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { switch (this->actor.textId) { case 0x224: - gSaveContext.save.weekEventReg[79] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_79_10); break; case 0x25B: - gSaveContext.save.weekEventReg[88] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_88_20); break; } Actor_Kill(&this->actor); return; } - if ((this->actor.textId == 0x224) && (gSaveContext.save.weekEventReg[8] & 0x40)) { + if ((this->actor.textId == 0x224) && CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actor.textId = 0x25B; } else if (func_80BA1C00(this) && (player->actor.speedXZ > 1.0f)) { player->tatlTextId = -this->actor.textId; @@ -299,19 +299,19 @@ void func_80BA1E30(ElfMsg6* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { switch (this->actor.textId) { case 0x216: - gSaveContext.save.weekEventReg[31] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_31_04); break; case 0x231: - gSaveContext.save.weekEventReg[31] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_31_01); break; case 0x232: - gSaveContext.save.weekEventReg[31] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_31_02); break; case 0x233: - gSaveContext.save.weekEventReg[80] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_80_04); break; } func_80BA165C(); @@ -330,7 +330,7 @@ void func_80BA1E30(ElfMsg6* this, PlayState* play) { } void func_80BA1F80(ElfMsg6* this, PlayState* play) { - if (((ELFMSG6_GET_F0(&this->actor)) == 1) && (gSaveContext.save.weekEventReg[83] & 2)) { + if ((ELFMSG6_GET_F0(&this->actor) == 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_02)) { Actor_Kill(&this->actor); return; } @@ -363,7 +363,7 @@ void func_80BA2048(ElfMsg6* this, PlayState* play) { } if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor))) || - (gSaveContext.save.weekEventReg[88] & 0x10) || (gSaveContext.save.weekEventReg[91] & 1) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_88_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_91_01) || (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA)) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 2c0cb4ce33..d2bdbf59e6 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -25,7 +25,7 @@ static u8 D_80BD3DB0[] = { /* 0x08 */ SCHEDULE_CMD_RET_VAL_L(1), /* 0x0B */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x20 - 0x0F), /* 0x0F */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(21, 0, 23, 0, 0x1D - 0x15), - /* 0x15 */ SCHEDULE_CMD_CHECK_FLAG_S(0x32, 0x20, 0x1C - 0x19), + /* 0x15 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_50_20, 0x1C - 0x19), /* 0x19 */ SCHEDULE_CMD_RET_VAL_L(1), /* 0x1C */ SCHEDULE_CMD_RET_NONE(), /* 0x1D */ SCHEDULE_CMD_RET_VAL_L(3), diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index e0c19903d8..54013c91a6 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -257,17 +257,17 @@ void func_80BED090(PlayState* play) { Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { - gSaveContext.save.weekEventReg[63] |= 8; - gSaveContext.save.weekEventReg[63] &= (u8)~0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_63_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_10); } else if (player->transformation == PLAYER_FORM_ZORA) { - gSaveContext.save.weekEventReg[63] &= (u8)~8; - gSaveContext.save.weekEventReg[63] |= 0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_08); + SET_WEEKEVENTREG(WEEKEVENTREG_63_10); } else if (player->transformation == PLAYER_FORM_GORON) { - gSaveContext.save.weekEventReg[63] |= 8; - gSaveContext.save.weekEventReg[63] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_63_08); + SET_WEEKEVENTREG(WEEKEVENTREG_63_10); } else if (player->transformation == PLAYER_FORM_HUMAN) { - gSaveContext.save.weekEventReg[63] &= (u8)~8; - gSaveContext.save.weekEventReg[63] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_10); } } @@ -275,19 +275,19 @@ s32 func_80BED140(PlayState* play) { Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { - if ((gSaveContext.save.weekEventReg[63] & 8) && !(gSaveContext.save.weekEventReg[63] & 0x10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_63_10)) { return true; } } else if (player->transformation == PLAYER_FORM_ZORA) { - if (!(gSaveContext.save.weekEventReg[63] & 8) && (gSaveContext.save.weekEventReg[63] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_10)) { return true; } } else if (player->transformation == PLAYER_FORM_GORON) { - if ((gSaveContext.save.weekEventReg[63] & 8) && (gSaveContext.save.weekEventReg[63] & 0x10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_10)) { return true; } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (!(gSaveContext.save.weekEventReg[63] & 8) && !(gSaveContext.save.weekEventReg[63] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_63_10)) { return true; } } @@ -384,8 +384,8 @@ void func_80BED3BC(EnAkindonuts* this, PlayState* play) { break; case 0x15E7: - if (!(gSaveContext.save.weekEventReg[61] & 0x20)) { - gSaveContext.save.weekEventReg[61] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_61_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_61_20); this->unk_33C = 0x15E8; break; } @@ -446,7 +446,7 @@ void func_80BED3BC(EnAkindonuts* this, PlayState* play) { case 0x15E5: this->unk_33C = 0x15E6; func_80BED090(play); - gSaveContext.save.weekEventReg[61] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_61_10); this->unk_32C |= 0x20; break; @@ -461,8 +461,8 @@ void func_80BED3BC(EnAkindonuts* this, PlayState* play) { void func_80BED680(EnAkindonuts* this, PlayState* play) { switch (this->unk_33C) { case 0: - if (func_80BED140(play) && !(gSaveContext.save.weekEventReg[61] & 0x40)) { - gSaveContext.save.weekEventReg[61] |= 0x40; + if (func_80BED140(play) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_61_40)) { + SET_WEEKEVENTREG(WEEKEVENTREG_61_40); this->unk_33C = 0x15F0; break; } @@ -562,8 +562,8 @@ void func_80BED8A4(EnAkindonuts* this, PlayState* play) { break; case 0x15FE: - if (!(gSaveContext.save.weekEventReg[62] & 1)) { - gSaveContext.save.weekEventReg[62] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_62_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_01); this->unk_33C = 0x15FF; break; } @@ -623,7 +623,7 @@ void func_80BED8A4(EnAkindonuts* this, PlayState* play) { case 0x15FA: this->unk_33C = 0x15FB; - gSaveContext.save.weekEventReg[61] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_61_80); this->unk_32C |= 0x20; break; @@ -640,8 +640,8 @@ void func_80BEDB88(EnAkindonuts* this, PlayState* play) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.save.weekEventReg[62] & 2)) { - gSaveContext.save.weekEventReg[62] |= 2; + if ((player->transformation == PLAYER_FORM_DEKU) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_62_02)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_02); this->unk_33C = 0x15F0; break; } @@ -740,8 +740,8 @@ void func_80BEDDAC(EnAkindonuts* this, PlayState* play) { break; case 0x1610: - if (!(gSaveContext.save.weekEventReg[62] & 8)) { - gSaveContext.save.weekEventReg[62] |= 8; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_62_08)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_08); this->unk_33C = 0x1611; break; } @@ -796,7 +796,7 @@ void func_80BEDDAC(EnAkindonuts* this, PlayState* play) { case 0x15FA: this->unk_33C = 0x160D; - gSaveContext.save.weekEventReg[62] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_62_04); this->unk_32C |= 0x20; break; @@ -813,8 +813,8 @@ void func_80BEE070(EnAkindonuts* this, PlayState* play) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_GORON) && !(gSaveContext.save.weekEventReg[62] & 0x10)) { - gSaveContext.save.weekEventReg[62] |= 0x10; + if ((player->transformation == PLAYER_FORM_GORON) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_62_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_10); this->unk_33C = 0x1614; break; } @@ -900,8 +900,8 @@ void func_80BEE274(EnAkindonuts* this, PlayState* play) { break; case 0x1624: - if (!(gSaveContext.save.weekEventReg[62] & 0x40)) { - gSaveContext.save.weekEventReg[62] |= 0x40; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_62_40)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_40); this->unk_33C = 0x1625; break; } @@ -957,7 +957,7 @@ void func_80BEE274(EnAkindonuts* this, PlayState* play) { case 0x1622: this->unk_33C = 0x1623; - gSaveContext.save.weekEventReg[62] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_62_20); this->unk_32C |= 0x20; break; @@ -974,8 +974,8 @@ void func_80BEE530(EnAkindonuts* this, PlayState* play) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_ZORA) && !(gSaveContext.save.weekEventReg[62] & 0x80)) { - gSaveContext.save.weekEventReg[62] |= 0x80; + if ((player->transformation == PLAYER_FORM_ZORA) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_62_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_62_80); this->unk_33C = 0x162A; break; } @@ -1095,7 +1095,7 @@ void func_80BEE73C(EnAkindonuts* this, PlayState* play) { void func_80BEE938(EnAkindonuts* this, PlayState* play) { switch (ENAKINDONUTS_GET_3(&this->actor)) { case 0: - if (gSaveContext.save.weekEventReg[61] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_10)) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BED680; } else { @@ -1109,7 +1109,7 @@ void func_80BEE938(EnAkindonuts* this, PlayState* play) { break; case 1: - if (gSaveContext.save.weekEventReg[61] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_80)) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEDB88; } else { @@ -1123,7 +1123,7 @@ void func_80BEE938(EnAkindonuts* this, PlayState* play) { break; case 2: - if (gSaveContext.save.weekEventReg[62] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_62_04)) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEE070; } else { @@ -1137,7 +1137,7 @@ void func_80BEE938(EnAkindonuts* this, PlayState* play) { break; case 3: - if (gSaveContext.save.weekEventReg[62] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_62_20)) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEE530; } else { diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 7cb0d7d540..5b7a258335 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -200,7 +200,7 @@ Actor* func_80BDE384(EnAl* this, PlayState* play) { switch (this->unk_35C) { case 2: - if (!(gSaveContext.save.weekEventReg[89] & 8) && (gSaveContext.save.weekEventReg[85] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80)) { actor = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_PM); } else { actor = &GET_PLAYER(play)->actor; @@ -410,7 +410,7 @@ s32 func_80BDEA14(EnAl* this, PlayState* play) { switch (this->unk_4E6) { case 0: case 1: - if ((gSaveContext.save.weekEventReg[75] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { sp18 = true; } else if (func_80BDE4E0(this, &this->unk_4E6, 0)) { sp18 = true; @@ -451,7 +451,7 @@ s32* func_80BDEABC(EnAl* this, PlayState* play) { return D_80BDFE84; case 2: - if (!(gSaveContext.save.weekEventReg[89] & 8) && (gSaveContext.save.weekEventReg[85] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80)) { this->unk_4EC = func_80BDE7FC; return D_80BDFCBC; } @@ -699,15 +699,15 @@ void func_80BDF414(EnAl* this, PlayState* play) { switch (this->unk_4EA) { case 0: case 1: - if (!(gSaveContext.save.weekEventReg[89] & 8)) { - if (gSaveContext.save.weekEventReg[85] & 0x80) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80)) { func_80BDE4E0(this, &this->unk_4EA, 0); } } break; case 2: - if (gSaveContext.save.weekEventReg[89] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08)) { this->unk_4EA++; } break; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index ec98213bbc..8e98ae8a33 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -138,8 +138,7 @@ void EnAni_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->actor.flags |= ACTOR_FLAG_10; this->stateFlags |= ANI_STATE_CLIMBING; - gSaveContext.eventInf[1] &= (u8)~0x10; - + CLEAR_EVENTINF(EVENTINF_14); } else { // ANI_TYPE_STANDING // ( unused code ) // for some reason standing he has a large collider @@ -244,7 +243,7 @@ void EnAni_LoseBalance(EnAni* this, PlayState* play) { // frame count : 0.0f, only first frame, rest is handled in next action func Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 5.0f); this->actionFunc = EnAni_FallToGround; - gSaveContext.eventInf[1] |= 0x10; + SET_EVENTINF(EVENTINF_14); } } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 6af60b84d7..1a04bb3e19 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -12,6 +12,8 @@ #define THIS ((EnAob01*)thisx) +//! TODO: this file require macros for its uses of weekEventReg + void EnAob01_Init(Actor* thisx, PlayState* play); void EnAob01_Destroy(Actor* thisx, PlayState* play); void EnAob01_Update(Actor* thisx, PlayState* play); @@ -218,15 +220,15 @@ void func_809C16DC(EnAob01* this, PlayState* play) { switch (gSaveContext.save.day) { case 1: if (!gSaveContext.save.isNight) { - if (!(gSaveContext.save.weekEventReg[64] & 0x80)) { - gSaveContext.save.weekEventReg[64] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_64_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_64_80); this->unk_210 = 0x3520; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.save.weekEventReg[65] & 1)) { - gSaveContext.save.weekEventReg[65] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_01); this->unk_210 = 0x3530; } else { this->unk_210 = 0x352F; @@ -236,15 +238,15 @@ void func_809C16DC(EnAob01* this, PlayState* play) { case 2: if (!gSaveContext.save.isNight) { - if (!(gSaveContext.save.weekEventReg[65] & 2)) { - gSaveContext.save.weekEventReg[65] |= 2; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_02)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_02); this->unk_210 = 0x3531; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.save.weekEventReg[65] & 4)) { - gSaveContext.save.weekEventReg[65] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_04); this->unk_210 = 0x3532; } else { this->unk_210 = 0x352F; @@ -254,15 +256,15 @@ void func_809C16DC(EnAob01* this, PlayState* play) { case 3: if (!gSaveContext.save.isNight) { - if (!(gSaveContext.save.weekEventReg[65] & 8)) { - gSaveContext.save.weekEventReg[65] |= 8; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_08)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_08); this->unk_210 = 0x3533; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.save.weekEventReg[65] & 0x10)) { - gSaveContext.save.weekEventReg[65] |= 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_10); this->unk_210 = 0x3534; } else { this->unk_210 = 0x352F; @@ -412,8 +414,8 @@ void func_809C16DC(EnAob01* this, PlayState* play) { void func_809C1C9C(EnAob01* this, PlayState* play) { if (gSaveContext.rupeeAccumulator == 0) { - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->unk_2D2 |= 0x20; func_800FD750(0x40); play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); @@ -761,13 +763,13 @@ void func_809C2A64(EnAob01* this, PlayState* play) { this->torsoRot = this->unk_2F2; this->actor.parent = NULL; this->actor.shape.rot.y = this->actor.world.rot.y; - if (gSaveContext.save.weekEventReg[8] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_20)) { this->actionFunc = func_809C2BE4; } else { - gSaveContext.save.weekEventReg[8] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_08_20); this->actionFunc = func_809C2BE4; } - } else if (gSaveContext.save.weekEventReg[8] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_20)) { Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); @@ -779,12 +781,12 @@ void func_809C2BE4(EnAob01* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { - if (gSaveContext.save.weekEventReg[63] & 2) { - gSaveContext.save.weekEventReg[63] &= (u8)~2; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); } - if (gSaveContext.save.weekEventReg[63] & 1) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); } this->unk_210 = 0; @@ -833,12 +835,12 @@ void func_809C2D0C(EnAob01* this, PlayState* play) { this->unk_434 = 0; this->actor.shape.rot.y = this->actor.world.rot.y; - if (gSaveContext.save.weekEventReg[63] & 2) { - gSaveContext.save.weekEventReg[63] &= (u8)~2; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); } - if (gSaveContext.save.weekEventReg[63] & 1) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); } this->unk_210 = 0x354C; @@ -967,7 +969,7 @@ void EnAob01_Destroy(Actor* thisx, PlayState* play) { EnAob01* this = THIS; if (!(this->unk_2D2 & 0x20)) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); } Collider_DestroyCylinder(play, &this->collider); } diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index f5a0281527..7548c7604c 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -207,32 +207,32 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { this->actor.targetMode = 1; switch (BEAVER_GET_PARAM_F00(thisx)) { case 0: - phi_v1 = (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 0)) && - (gSaveContext.save.weekEventReg[93] & 1); + phi_v1 = + (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 0)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01); phi_v1 = !phi_v1; break; case 2: phi_v1 = (gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 1)) || - !(gSaveContext.save.weekEventReg[24] & 4); + !CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04); break; case 4: phi_v1 = gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 2); break; case 1: - phi_v1 = (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 0)) && - (gSaveContext.save.weekEventReg[93] & 1); + phi_v1 = + (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 0)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01); phi_v1 = !phi_v1; break; case 3: - phi_v1 = (gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 1)) || - (gSaveContext.save.weekEventReg[24] & 4); + phi_v1 = + (gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 1)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04); break; case 5: phi_v1 = gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 2); break; case 6: phi_v1 = (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 0)) && - !(gSaveContext.save.weekEventReg[93] & 1); + !CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01); phi_v1 = !phi_v1; break; default: @@ -292,7 +292,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { switch (gSaveContext.save.entrance) { case ENTRANCE(WATERFALL_RAPIDS, 0): - if (gSaveContext.save.weekEventReg[93] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01)) { this->unk_2FA = 5; if (this->unk_374 & 2) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -321,14 +321,14 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { func_80A97C0C(this, play); break; case ENTRANCE(WATERFALL_RAPIDS, 1): - if (gSaveContext.save.weekEventReg[93] & 1) { - if (gSaveContext.save.weekEventReg[24] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { this->unk_2FA = 8; } else { this->unk_2FA = 6; } } else { - if (gSaveContext.save.weekEventReg[24] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { this->unk_2FA = 3; } else { this->unk_2FA = 1; @@ -338,7 +338,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { SubS_CopyPointFromPathList(play->setupPathList, BEAVER_GET_PARAM_FF(thisx), play->setupPathList[BEAVER_GET_PARAM_FF(thisx)].count - 1, &D_80A99E80); } - if (gSaveContext.save.weekEventReg[24] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { if (this->unk_374 & 2) { func_80A97D5C(this, play); } else { @@ -351,14 +351,14 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { } break; case ENTRANCE(WATERFALL_RAPIDS, 2): - if (gSaveContext.save.weekEventReg[93] & 1) { - if (gSaveContext.save.weekEventReg[24] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { this->unk_2FA = 9; } else { this->unk_2FA = 7; } } else { - if (gSaveContext.save.weekEventReg[24] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { this->unk_2FA = 4; } else { this->unk_2FA = 2; @@ -698,7 +698,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x70: case 0xCD: - gSaveContext.save.weekEventReg[24] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_01); this->actor.textId = 0x10F2; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW, &this->animIndex); @@ -707,7 +707,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { break; case 0x10CE: this->actor.textId = 0x10CF; - gSaveContext.save.weekEventReg[16] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_16_40); break; case 0x10CF: this->actor.textId = 0x10D0; @@ -782,7 +782,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { break; case 0x10D9: if ((this->unk_2FA == 3) || (this->unk_2FA == 8)) { - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); } func_80A94AB8(this, play, 0); func_80A979DC(this, play); @@ -866,7 +866,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { ret = 0; break; case 0x10E7: - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); func_80A94AB8(this, play, 0); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); @@ -924,7 +924,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { break; case 0x10ED: if ((this->unk_2FA == 4) || (this->unk_2FA == 9)) { - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); } func_80A94AB8(this, play, 0); func_80A979DC(this, play); @@ -943,12 +943,12 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { ret = 0; break; case 0x10F1: - gSaveContext.save.weekEventReg[93] |= 1; - if (gSaveContext.save.weekEventReg[23] & 0x80) { + SET_WEEKEVENTREG(WEEKEVENTREG_93_01); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_80)) { this->getItemId = GI_RUPEE_RED; } else { this->getItemId = GI_BOTTLE; - gSaveContext.save.weekEventReg[23] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_23_80); } SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); @@ -958,7 +958,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { break; case 0x10F2: case 0x1109: - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, @@ -992,7 +992,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { case 0x10F8: if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.weekEventReg[25] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_01)) { this->actor.textId = 0x1107; } else { this->actor.textId = 0x10FA; @@ -1044,7 +1044,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { case 0x10FE: if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.weekEventReg[25] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_01)) { this->actor.textId = 0x1108; } else { this->actor.textId = 0x1101; @@ -1065,7 +1065,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { ret = 0; break; case 0x1100: - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, @@ -1096,11 +1096,11 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { ret = 0; break; case 0x1105: - if (gSaveContext.save.weekEventReg[25] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_01)) { this->getItemId = GI_RUPEE_PURPLE; } else { this->getItemId = GI_HEART_PIECE; - gSaveContext.save.weekEventReg[25] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_25_01); } SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); @@ -1109,7 +1109,7 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { ret = 7; break; case 0x1106: - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, @@ -1188,16 +1188,16 @@ s32 func_80A97274(EnAz* this, PlayState* play) { switch (this->unk_2FA) { case 0: default: - gSaveContext.save.weekEventReg[24] &= (u8)~4; - if (!(gSaveContext.save.weekEventReg[16] & 0x40)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); + if (!(CHECK_WEEKEVENTREG(WEEKEVENTREG_16_40))) { textId = 0x10CE; } else { textId = 0x10D4; } break; case 2: - if (gSaveContext.save.weekEventReg[24] & 1) { - gSaveContext.save.weekEventReg[24] |= 4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_24_04); this->unk_3C0 = 0; textId = 0x10DD; } else { @@ -1205,26 +1205,26 @@ s32 func_80A97274(EnAz* this, PlayState* play) { } break; case 4: - if (gSaveContext.save.weekEventReg[24] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_01)) { textId = 0x10EE; } else { textId = 0x10E9; } break; case 5: - gSaveContext.save.weekEventReg[24] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); textId = 0x10F3; break; case 7: - if (gSaveContext.save.weekEventReg[24] & 1) { - gSaveContext.save.weekEventReg[24] |= 4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_24_04); textId = 0x10FB; } else { textId = 0x10E9; } break; case 9: - if (gSaveContext.save.weekEventReg[24] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_01)) { textId = 0x1102; } else { textId = 0x10E9; @@ -1431,8 +1431,8 @@ void func_80A97AB4(EnAz* this, PlayState* play) { func_80A979DC(this, play); } else { func_8019F230(); - if (gSaveContext.save.weekEventReg[24] & 4) { - gSaveContext.save.weekEventReg[24] &= (u8)~4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); } func_80151938(play, 0x10D9); } @@ -1465,7 +1465,7 @@ void func_80A97C4C(EnAz* this, PlayState* play) { } func_80A97410(this, play); if ((this->unk_2FA == 1) || (this->unk_2FA == 3) || (this->unk_2FA == 6) || (this->unk_2FA == 8)) { - gSaveContext.save.weekEventReg[24] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_01); func_800FD750(NA_BGM_TIMED_MINI_GAME); play->nextEntrance = Entrance_CreateFromSpawn(1); gSaveContext.nextCutsceneIndex = 0; @@ -1487,7 +1487,7 @@ void func_80A97D5C(EnAz* this, PlayState* play) { play->interfaceCtx.unk_280 = 1; if ((this->unk_2FA == 1) || (this->unk_2FA == 3)) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); - } else if (gSaveContext.save.weekEventReg[25] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_01)) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 100); } else { Interface_StartTimer(TIMER_ID_MINIGAME_2, 110); @@ -1543,9 +1543,9 @@ void func_80A97F9C(EnAz* this, PlayState* play) { } if (SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { if (func_80A94B98(this, play)) { - gSaveContext.save.weekEventReg[24] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_01); } else { - gSaveContext.save.weekEventReg[24] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_24_01); } gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_374 &= ~0x10; diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 00e63c7d61..22c78fdfa5 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -167,13 +167,13 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { switch (this->textId) { case 0: if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { - if (gSaveContext.save.weekEventReg[33] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { // Thanks. Can stock Bomb Bags tomorrow this->textId = 0x2A34; break; } - if (gSaveContext.save.weekEventReg[79] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; // Oh my, learned my lesson. Can't stock Bomb Bags tomorrow this->textId = 0x2A33; @@ -185,8 +185,8 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { this->textId = 0x2A32; break; } else if (player->transformation == PLAYER_FORM_DEKU) { - if (!(gSaveContext.save.weekEventReg[79] & 0x20)) { - gSaveContext.save.weekEventReg[79] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_79_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_79_20); this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; // Small customer, use bombs as adult this->textId = 0x2A37; @@ -197,8 +197,8 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { this->textId = 0x2A38; } break; - } else if (!(gSaveContext.save.weekEventReg[33] & 8)) { - if (!(gSaveContext.save.weekEventReg[73] & 1)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_01)) { // Thought could sell Big Bomb Bags this->textId = 0x660; break; @@ -207,7 +207,7 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { this->textId = 0x662; break; } else { - if (!(gSaveContext.save.weekEventReg[73] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_02)) { // Someone helped me out this->textId = 0x65A; break; @@ -234,7 +234,7 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); // I'll go next time this->textId = 0x663; - gSaveContext.save.weekEventReg[73] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_73_01); this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; @@ -254,7 +254,7 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); // I worry about you this->textId = 0x65D; - gSaveContext.save.weekEventReg[73] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_73_02); this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; @@ -476,7 +476,7 @@ s32 EnBaba_FollowTimePath(EnBaba* this, PlayState* play) { void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) { switch (this->scheduleResult) { case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH: - gSaveContext.save.weekEventReg[58] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_58_40); this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; EnBaba_FollowTimePath(this, play); break; @@ -512,7 +512,7 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) && (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) { - if ((gSaveContext.save.weekEventReg[58] & 0x40) || + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_40) || (gSaveContext.save.time >= CLOCK_TIME(0, 20) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { Actor_Kill(&this->actor); return; @@ -524,13 +524,13 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->actionFunc = EnBaba_FollowSchedule; } else if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_IDLE) && (gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7))) { - if (gSaveContext.save.weekEventReg[81] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_02)) { Actor_Kill(&this->actor); return; } this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; - if (gSaveContext.save.weekEventReg[33] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG; } else { this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; @@ -603,12 +603,12 @@ void EnBaba_Talk(EnBaba* this, PlayState* play) { if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { - gSaveContext.save.weekEventReg[81] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_81_02); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); return; } } else { - gSaveContext.save.weekEventReg[81] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_81_02); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } } else { @@ -626,7 +626,7 @@ void EnBaba_Talk(EnBaba* this, PlayState* play) { } } else if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play) && (play->msgCtx.unk120B1 == 0)) { - gSaveContext.save.weekEventReg[81] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_81_02); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } } @@ -698,7 +698,7 @@ void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } } else { - if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->sakonDeadTimer) == 0)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40) && (DECR(this->sakonDeadTimer) == 0)) { Audio_QueueSeqCmd(0x101400FF); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 5716c27d5b..8812ae6d35 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -71,16 +71,14 @@ void EnBaisen_Init(Actor* thisx, PlayState* play) { this->paramCopy = this->actor.params; if (this->actor.params == 0) { this->unk290 = true; - if (!(gSaveContext.save.weekEventReg[63] & 0x80) && - ((gSaveContext.save.day != 3) || !gSaveContext.save.isNight)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) && ((gSaveContext.save.day != 3) || !gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } else { this->collider.dim.radius = 30; this->collider.dim.height = 60; this->collider.dim.yShift = 0; - if ((gSaveContext.save.weekEventReg[63] & 0x80) || - ((gSaveContext.save.day == 3) && (gSaveContext.save.isNight))) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) || ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } @@ -155,7 +153,7 @@ void func_80BE887C(EnBaisen* this, PlayState* play) { } else { if (this->paramCopy != 0) { this->textIdIndex = 0; - if (gSaveContext.save.weekEventReg[60] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_08)) { this->textIdIndex = 1; } if (Player_GetMask(play) == PLAYER_MASK_COUPLE) { diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 3792c09c76..7e936bd9b0 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -104,7 +104,7 @@ void EnBigokuta_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->picto.actor.colChkInfo, NULL, &sColChkInfoInit); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->picto.actor.cutscene); - if (gSaveContext.save.weekEventReg[20] & 2 || + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02) || ((this->picto.actor.params != 0xFF) && Flags_GetSwitch(play, this->picto.actor.params))) { Actor_Kill(&this->picto.actor); } else { @@ -377,7 +377,7 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->picto.actor); - if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { + if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { func_800B724C(play, &this->picto.actor, 7); } else { player = GET_PLAYER(play); @@ -453,7 +453,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { ActorCutscene_Stop(this->cutscene); Actor_Kill(&this->picto.actor); - if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { + if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { func_800B724C(play, &this->picto.actor, 6); } else { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index c3bf191502..ff71bba89c 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -311,13 +311,11 @@ static InitChainEntry sInitChain[] = { }; void EnBigslime_Init(Actor* thisx, PlayState* play2) { - // gSaveContext.save.weekEventReg[KEY] = VALUE - // KEY | VALUE static s32 isFrogReturnedFlags[] = { - (32 << 8) | 0x40, // Woodfall Temple Frog Returned - (32 << 8) | 0x80, // Great Bay Temple Frog Returned - (33 << 8) | 0x01, // Southern Swamp Frog Returned - (33 << 8) | 0x02, // Laundry Pool Frog Returned + WEEKEVENTREG_32_40, + WEEKEVENTREG_32_80, + WEEKEVENTREG_33_01, + WEEKEVENTREG_33_02, }; PlayState* play = play2; EnBigslime* this = THIS; @@ -342,43 +340,43 @@ void EnBigslime_Init(Actor* thisx, PlayState* play2) { if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & - (u8)isFrogReturnedFlags[this->actor.params - 1])) { + if (!CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->actor.params); } - } else { - this->cutscene = this->actor.cutscene; - this->actor.scale.x = this->actor.scale.z = 0.15f; - this->actor.scale.y = 0.075f; - this->vtxScaleX = this->vtxScaleZ = 0.015000001f; - this->actor.home.pos.x = GBT_ROOM_5_CENTER_X; - this->actor.home.pos.y = GBT_ROOM_5_MAX_Y - 75.0f; - this->actor.home.pos.z = GBT_ROOM_5_CENTER_Z; - for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { - this->minislime[i] = (EnMinislime*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, - ACTOR_EN_MINISLIME, 0.0f, 0.0f, 0.0f, 0, 0, 0, i); - if (this->minislime[i] == NULL) { - for (i = i - 1; i >= 0; i--) { - Actor_Kill(&this->minislime[i]->actor); - } - - Actor_Kill(&this->actor); - return; - } - } - - this->minislimeFrozenTexAnim = Lib_SegmentedToVirtual(gMinislimeFrozenTexAnim); - this->bigslimeFrozenTexAnim = Lib_SegmentedToVirtual(gBigslimeFrozenTexAnim); - this->iceShardTexAnim = Lib_SegmentedToVirtual(gBigslimeIceShardTexAnim); - this->actor.world.pos.y = GBT_ROOM_5_MIN_Y; - this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.shape.shadowAlpha = 255; - this->gekkoScale = 0.007f; - this->actor.shape.rot.y = 0; - this->minislimeToThrow = this->minislime[0]; - EnBigslime_SetupInitEntrance(this); + return; } + + this->cutscene = this->actor.cutscene; + this->actor.scale.x = this->actor.scale.z = 0.15f; + this->actor.scale.y = 0.075f; + this->vtxScaleX = this->vtxScaleZ = 0.015000001f; + this->actor.home.pos.x = GBT_ROOM_5_CENTER_X; + this->actor.home.pos.y = GBT_ROOM_5_MAX_Y - 75.0f; + this->actor.home.pos.z = GBT_ROOM_5_CENTER_Z; + for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { + this->minislime[i] = (EnMinislime*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MINISLIME, + 0.0f, 0.0f, 0.0f, 0, 0, 0, i); + if (this->minislime[i] == NULL) { + for (i = i - 1; i >= 0; i--) { + Actor_Kill(&this->minislime[i]->actor); + } + + Actor_Kill(&this->actor); + return; + } + } + + this->minislimeFrozenTexAnim = Lib_SegmentedToVirtual(gMinislimeFrozenTexAnim); + this->bigslimeFrozenTexAnim = Lib_SegmentedToVirtual(gBigslimeFrozenTexAnim); + this->iceShardTexAnim = Lib_SegmentedToVirtual(gBigslimeIceShardTexAnim); + this->actor.world.pos.y = GBT_ROOM_5_MIN_Y; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.shape.shadowAlpha = 255; + this->gekkoScale = 0.007f; + this->actor.shape.rot.y = 0; + this->minislimeToThrow = this->minislime[0]; + EnBigslime_SetupInitEntrance(this); } void EnBigslime_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 41bd948949..aa6839a02f 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -121,34 +121,34 @@ void func_809CD028(EnBji01* this, PlayState* play) { case SHIKASHI_TYPE_FINISHED_CONVERSATION: switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[17] & 0x10) { - if (gSaveContext.save.weekEventReg[74] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { this->textId = 0x5F4; } else { this->textId = 0x5E2; } } else { this->textId = 0x5EC; - gSaveContext.save.weekEventReg[17] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_17_10); } break; case PLAYER_FORM_HUMAN: if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->textId = 0x236A; - } else if (gSaveContext.save.weekEventReg[74] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_10)) { this->textId = 0x5F6; } else { this->textId = 0x5F5; - gSaveContext.save.weekEventReg[74] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_74_10); } break; case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: - if (gSaveContext.save.weekEventReg[75] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_08)) { this->textId = 0x5E4; } else { this->textId = 0x5DC; - gSaveContext.save.weekEventReg[75] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_75_08); } break; } @@ -156,7 +156,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { case SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE: switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[74] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { this->textId = 0x5F2; } else { this->textId = 0x5F1; diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index a8bcfdc883..7331480e17 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -389,7 +389,7 @@ void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { } else if (this->stateFlags & TOILET_HAND_STATE_VISIBLE) { // Vanish if player goes too far away or heart piece given if ((fabsf(this->actor.playerHeightRel) > 70.0f) || (this->actor.xzDistToPlayer > 140.0f) || - (gSaveContext.save.weekEventReg[90] & 0x80)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_90_80)) { SubS_UpdateFlags(&this->stateFlags, 0, 7); this->playedSfx = false; this->stateFlags &= ~TOILET_HAND_STATE_VISIBLE; @@ -398,7 +398,7 @@ void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { } else { // Appear if player approaches and heart piece not given if ((fabsf(this->actor.playerHeightRel) < 20.0f) && (this->actor.xzDistToPlayer < 70.0f) && - !(gSaveContext.save.weekEventReg[90] & 0x80)) { + !CHECK_WEEKEVENTREG(WEEKEVENTREG_90_80)) { this->stateFlags |= TOILET_HAND_STATE_APPEARING; this->playedSfx = false; } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 9dc36ff6cf..4a79d322cb 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -97,7 +97,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, this->unk_29A, 0x3F); this->unk_2C8 = 80.0f; - if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && (gSaveContext.save.weekEventReg[73] & 0x80) && + if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) && !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { this->unk_2D6 = this->actor.cutscene; if (this->unk_2D6 == 0) { @@ -202,8 +202,8 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { func_809C493C(this, 3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_290 = this->actor.yawTowardsPlayer; - gSaveContext.save.weekEventReg[73] &= (u8)~0x10; - gSaveContext.save.weekEventReg[85] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_73_10); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_85_02); this->unk_29C = 0; this->actionFunc = func_809C4DA4; } @@ -337,13 +337,13 @@ void func_809C51B4(EnBomBowlMan* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; gSaveContext.nextTransitionType = TRANS_TYPE_03; - gSaveContext.save.weekEventReg[75] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_75_40); if (player->transformation == PLAYER_FORM_HUMAN) { - gSaveContext.save.weekEventReg[84] |= 0x80; - gSaveContext.save.weekEventReg[77] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_84_80); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_77_02); } else { - gSaveContext.save.weekEventReg[73] |= 0x20; - gSaveContext.save.weekEventReg[85] &= (u8)~1; + SET_WEEKEVENTREG(WEEKEVENTREG_73_20); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_85_01); } } } @@ -401,7 +401,7 @@ void func_809C5408(EnBomBowlMan* this, PlayState* play) { void func_809C5524(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x730; - if (!(gSaveContext.save.weekEventReg[85] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { this->actor.textId = 0x72F; } func_809C493C(this, 3, 1.0f); @@ -483,8 +483,8 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { (this->path != NULL)) { this->unk_298++; if (this->unk_298 >= this->path->count) { - gSaveContext.save.weekEventReg[84] |= 0x80; - gSaveContext.save.weekEventReg[83] &= (u8)~4; + SET_WEEKEVENTREG(WEEKEVENTREG_84_80); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); ActorCutscene_Stop(this->unk_2D6); Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index 91e7fbd4ce..bcb7cb5348 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -92,8 +92,8 @@ void func_80C05B3C(EnBombal* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { player = GET_PLAYER(play); this->collider.base.acFlags &= ~AC_HIT; - if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && - !(gSaveContext.save.weekEventReg[85] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { player->stateFlags1 |= ACTOR_FLAG_20; this->actor.flags |= ACTOR_FLAG_100000; } @@ -107,8 +107,8 @@ void func_80C05C44(EnBombal* this, PlayState* play) { s32 i; Vec3f pos; - if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && - !(gSaveContext.save.weekEventReg[85] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->cutscene); @@ -135,7 +135,7 @@ void func_80C05C44(EnBombal* this, PlayState* play) { EnBombal_InitEffects(this, &pos, 10); } - gSaveContext.save.weekEventReg[83] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_83_04); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); this->timer = 30; this->isPopped = true; @@ -145,8 +145,8 @@ void func_80C05C44(EnBombal* this, PlayState* play) { void func_80C05DE8(EnBombal* this, PlayState* play) { if (this->timer == 0) { - if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && - !(gSaveContext.save.weekEventReg[85] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { ActorCutscene_Stop(this->cutscene); } Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 1d4d646f86..2ca62ef0a0 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -104,20 +104,20 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { this->unk_2BE = ENBOMBERS_GET_F(&this->actor); if (this->unk_2BC == ENBOMBERS_F0_0) { - if ((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { Actor_Kill(&this->actor); return; } this->unk_2BE++; func_80C03ACC(this); - } else if (((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) && - (((this->unk_2BE == ENBOMBERS_F_0) && (gSaveContext.save.weekEventReg[76] & 1)) || - ((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.save.weekEventReg[76] & 2)) || - ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.save.weekEventReg[76] & 4)) || - ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.save.weekEventReg[76] & 8)) || - ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.save.weekEventReg[76] & 0x10)))) { - if (gSaveContext.save.weekEventReg[75] & 0x40) { + } else if ((CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) && + (((this->unk_2BE == ENBOMBERS_F_0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_76_01)) || + ((this->unk_2BE == ENBOMBERS_F_1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_76_02)) || + ((this->unk_2BE == ENBOMBERS_F_2) && CHECK_WEEKEVENTREG(WEEKEVENTREG_76_04)) || + ((this->unk_2BE == ENBOMBERS_F_3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_76_08)) || + ((this->unk_2BE == ENBOMBERS_F_4) && CHECK_WEEKEVENTREG(WEEKEVENTREG_76_10)))) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40)) { if (this->unk_2BE == ENBOMBERS_F_0) { EnBomBowlMan* bomBowlMan = (EnBomBowlMan*)Actor_Spawn( &play->actorCtx, play, ACTOR_EN_BOM_BOWL_MAN, this->actor.world.pos.x, this->actor.world.pos.y, @@ -131,11 +131,11 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { while (cs != -1) { bomBowlMan->unk_2CC[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } // clang-format on - gSaveContext.save.weekEventReg[76] &= (u8)~1; - gSaveContext.save.weekEventReg[76] &= (u8)~2; - gSaveContext.save.weekEventReg[76] &= (u8)~4; - gSaveContext.save.weekEventReg[76] &= (u8)~8; - gSaveContext.save.weekEventReg[76] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_10); } } Actor_Kill(&this->actor); @@ -182,7 +182,7 @@ void func_80C039A8(EnBombers* this, PlayState* play) { switch (player->transformation) { case PLAYER_FORM_HUMAN: this->actor.textId = 0x73D; - if (gSaveContext.save.weekEventReg[84] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_80)) { this->actor.textId = 0x74B; } break; @@ -196,14 +196,14 @@ void func_80C039A8(EnBombers* this, PlayState* play) { break; case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[73] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_20)) { this->actor.textId = 0x75A; - } else if (gSaveContext.save.weekEventReg[73] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_40)) { this->actor.textId = 0x749; - if (((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.save.weekEventReg[74] & 1)) || - ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.save.weekEventReg[74] & 2)) || - ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.save.weekEventReg[74] & 4)) || - ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.save.weekEventReg[74] & 8))) { + if (((this->unk_2BE == ENBOMBERS_F_1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_01)) || + ((this->unk_2BE == ENBOMBERS_F_2) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_02)) || + ((this->unk_2BE == ENBOMBERS_F_3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_04)) || + ((this->unk_2BE == ENBOMBERS_F_4) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_08))) { this->actor.textId = 0x74A; } } else { @@ -395,22 +395,22 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { } else if (this->actor.textId == 0x748) { switch (this->unk_2BE) { case ENBOMBERS_F_1: - gSaveContext.save.weekEventReg[74] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_74_01); break; case ENBOMBERS_F_2: - gSaveContext.save.weekEventReg[74] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_74_02); break; case ENBOMBERS_F_3: - gSaveContext.save.weekEventReg[74] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_74_04); break; case ENBOMBERS_F_4: - gSaveContext.save.weekEventReg[74] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_74_08); break; } - gSaveContext.save.weekEventReg[73] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_73_40); } switch (sp2A) { diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 632ff3b671..74575628f6 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -94,7 +94,8 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { this->jointTable, OBJECT_CS_LIMB_MAX); this->actor.targetMode = 6; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if ((gSaveContext.save.weekEventReg[73] & 0x80) || (gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2))) { + + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) || (gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2))) { this->actor.world.pos.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; cos = Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; this->unk_2AC = 1; @@ -165,7 +166,7 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2B6 = this->actor.world.rot.y; - gSaveContext.save.weekEventReg[86] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_86_02); func_80C04D00(this); return; } @@ -329,7 +330,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { EnBombers2_ChangeAnim(this, 6, 1.0f); this->unk_2A8 = 0; this->unk_2C0 = 1; - gSaveContext.save.weekEventReg[73] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_73_80); ActorCutscene_Stop(this->cutscene); this->unk_2AC = 1; this->actor.textId = sTextIds[this->textIdIndex]; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index a9d81c10bf..126c293c37 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -128,7 +128,7 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - gSaveContext.save.weekEventReg[83] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); this->actor.targetMode = 0; this->unk_2E6 = ENBOMJIMA_GET_F0(&this->actor); this->unk_2E4 = ENBOMJIMA_GET_F(&this->actor); @@ -150,8 +150,8 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { func_80BFFCFC(this); } - if ((gSaveContext.save.weekEventReg[75] & 0x40) || (gSaveContext.save.weekEventReg[73] & 0x10) || - (gSaveContext.save.weekEventReg[85] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) || CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { Actor_Kill(&this->actor); } } @@ -177,12 +177,12 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { case 0: if (player->transformation == PLAYER_FORM_DEKU) { this->actor.textId = 0x759; - if (!(gSaveContext.save.weekEventReg[73] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_20)) { this->actor.textId = 0x708; } } else if (player->transformation == PLAYER_FORM_HUMAN) { this->actor.textId = 0x75A; - if (!(gSaveContext.save.weekEventReg[84] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_80)) { this->actor.textId = 0x719; } } else if ((this->unk_2C8 == 1) || (this->unk_2C8 == 2)) { @@ -362,18 +362,18 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { func_80BFE32C(this, play, 0); if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.save.weekEventReg[73] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_20)) { this->unk_2C8 = 3; func_80BFE32C(this, play, 3); - } else if (gSaveContext.save.weekEventReg[77] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_02)) { this->unk_2C8 = 11; func_80BFE32C(this, play, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (gSaveContext.save.weekEventReg[84] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_80)) { this->unk_2C8 = 0; func_80BFE32C(this, play, 3); - } else if (gSaveContext.save.weekEventReg[85] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_01)) { this->unk_2C8 = 11; func_80BFE32C(this, play, 2); } @@ -472,7 +472,7 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } else { player->stateFlags1 &= ~PLAYER_STATE1_20; - gSaveContext.save.weekEventReg[83] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); @@ -518,11 +518,11 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { } if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.save.weekEventReg[73] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_20)) { this->unk_2C8 = 3; func_80BFE32C(this, play, 3); } else { - if (!(gSaveContext.save.weekEventReg[77] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_02)) { if (this->unk_2E8 == 0) { this->unk_2C8 = 4; } else { @@ -534,11 +534,11 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { func_80BFE32C(this, play, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (gSaveContext.save.weekEventReg[84] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_80)) { this->unk_2C8 = 0; func_80BFE32C(this, play, 3); } else { - if (!(gSaveContext.save.weekEventReg[85] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_85_01)) { if (this->unk_2EA == 0) { this->unk_2C8 = 4; } else { @@ -578,7 +578,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) { bombal->scale = 0.0f; bombal->cutscene = this->bombalCutscene; Actor_ChangeFocus(&this->actor, play, &bombal->actor); - gSaveContext.save.weekEventReg[83] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); func_80BFE65C(this); func_801477B4(play); this->actionFunc = func_80BFEA94; @@ -701,24 +701,24 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { D_80C009F0 = 0; this->unk_2C8 = 9; if (player->transformation == PLAYER_FORM_DEKU) { - gSaveContext.save.weekEventReg[73] |= 0x10; - gSaveContext.save.weekEventReg[77] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_73_10); + SET_WEEKEVENTREG(WEEKEVENTREG_77_02); } else { - gSaveContext.save.weekEventReg[85] |= 2; - gSaveContext.save.weekEventReg[85] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_85_02); + SET_WEEKEVENTREG(WEEKEVENTREG_85_01); } - gSaveContext.save.weekEventReg[11] &= (u8)~1; - gSaveContext.save.weekEventReg[11] &= (u8)~2; - gSaveContext.save.weekEventReg[11] &= (u8)~4; - gSaveContext.save.weekEventReg[11] &= (u8)~8; - gSaveContext.save.weekEventReg[11] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_11_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_11_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_11_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_11_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_11_10); - gSaveContext.save.weekEventReg[76] &= (u8)~1; - gSaveContext.save.weekEventReg[76] &= (u8)~2; - gSaveContext.save.weekEventReg[76] &= (u8)~4; - gSaveContext.save.weekEventReg[76] &= (u8)~8; - gSaveContext.save.weekEventReg[76] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_10); gSaveContext.save.bombersCaughtNum = 0; gSaveContext.save.bombersCaughtOrder[0] = 0; diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 0e3a6f431f..c0033b1036 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -115,38 +115,38 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play) { this->unk_2C6 = ENBOMJIMB_F0_0; } - if ((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { switch (this->unk_2C8) { case ENBOMJIMB_F_0: - if (gSaveContext.save.weekEventReg[11] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_11_01)) { Actor_Kill(&this->actor); return; } break; case ENBOMJIMB_F_1: - if (gSaveContext.save.weekEventReg[11] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_11_02)) { Actor_Kill(&this->actor); return; } break; case ENBOMJIMB_F_2: - if (gSaveContext.save.weekEventReg[11] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_11_04)) { Actor_Kill(&this->actor); return; } break; case ENBOMJIMB_F_3: - if (gSaveContext.save.weekEventReg[11] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_11_08)) { Actor_Kill(&this->actor); return; } break; case ENBOMJIMB_F_4: - if (gSaveContext.save.weekEventReg[11] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_11_10)) { Actor_Kill(&this->actor); return; } @@ -154,8 +154,8 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play) { } } - if ((!(gSaveContext.save.weekEventReg[73] & 0x10) && !(gSaveContext.save.weekEventReg[85] & 2)) || - (gSaveContext.save.weekEventReg[75] & 0x40)) { + if ((!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40)) { Actor_Kill(&this->actor); return; } @@ -674,8 +674,8 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { return; } - if (((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.save.weekEventReg[73] & 0x10)) || - ((player->transformation == PLAYER_FORM_HUMAN) && !(gSaveContext.save.weekEventReg[85] & 2))) { + if (((player->transformation == PLAYER_FORM_DEKU) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10)) || + ((player->transformation == PLAYER_FORM_HUMAN) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02))) { func_80C0113C(this, 17, 1.0f); Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= PLAYER_STATE1_10000000; @@ -698,28 +698,28 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { switch (this->unk_2C8) { case ENBOMJIMB_F_0: - gSaveContext.save.weekEventReg[76] |= 1; - gSaveContext.save.weekEventReg[11] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_76_01); + SET_WEEKEVENTREG(WEEKEVENTREG_11_01); break; case ENBOMJIMB_F_1: - gSaveContext.save.weekEventReg[76] |= 2; - gSaveContext.save.weekEventReg[11] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_76_02); + SET_WEEKEVENTREG(WEEKEVENTREG_11_02); break; case ENBOMJIMB_F_2: - gSaveContext.save.weekEventReg[76] |= 4; - gSaveContext.save.weekEventReg[11] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_76_04); + SET_WEEKEVENTREG(WEEKEVENTREG_11_04); break; case ENBOMJIMB_F_3: - gSaveContext.save.weekEventReg[76] |= 8; - gSaveContext.save.weekEventReg[11] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_76_08); + SET_WEEKEVENTREG(WEEKEVENTREG_11_08); break; case ENBOMJIMB_F_4: - gSaveContext.save.weekEventReg[76] |= 0x10; - gSaveContext.save.weekEventReg[11] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_76_10); + SET_WEEKEVENTREG(WEEKEVENTREG_11_10); break; } @@ -801,8 +801,8 @@ void func_80C02CA4(EnBomjimb* this, PlayState* play) { play->transitionType = TRANS_TYPE_86; gSaveContext.nextTransitionType = TRANS_TYPE_03; } - gSaveContext.save.weekEventReg[75] |= 0x40; - gSaveContext.save.weekEventReg[83] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_75_40); + SET_WEEKEVENTREG(WEEKEVENTREG_83_04); this->actionFunc = func_80C02DAC; } diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index edf68582fe..d32fe32ac9 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -61,7 +61,7 @@ void EnCha_Init(Actor* thisx, PlayState* play) { this->actor.home.rot.z = 0; this->actionFunc = EnCha_Idle; this->actor.home.rot.x = this->actor.home.rot.z; - gSaveContext.save.weekEventReg[60] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_60_04); } void EnCha_Destroy(Actor* thisx, PlayState* play) { @@ -83,16 +83,16 @@ void EnCha_Ring(EnCha* this, PlayState* play) { } void EnCha_Idle(EnCha* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[60] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_04)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); - gSaveContext.save.weekEventReg[60] &= (u8)~4; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_60_04); this->actor.home.rot.z = 0x7D0; } if (this->collider.base.acFlags & AC_HIT) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); this->actor.home.rot.z = 0x7D0; - if (!(gSaveContext.save.weekEventReg[51] & 4)) { - gSaveContext.save.weekEventReg[51] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_51_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_51_04); this->actionFunc = EnCha_Ring; } } diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index 7170ebdc8a..63c83f0ea9 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -94,7 +94,7 @@ void EnColMan_Destroy(Actor* thisx, PlayState* play) { } void func_80AFDD60(EnColMan* this) { - if (!(gSaveContext.save.weekEventReg[56] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_02)) { this->actor.draw = func_80AFE414; this->actor.shape.yOffset = 700.0f; if (this->actor.params == EN_COL_MAN_HEART_PIECE) { @@ -123,14 +123,14 @@ void func_80AFDE00(EnColMan* this, PlayState* play) { this->actor.speedXZ = 0.0f; } } - if (!(gSaveContext.save.weekEventReg[56] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_02)) { this->actor.shape.rot.y += 0x3E8; } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actor.draw = NULL; this->actionFunc = EnColMan_SetHeartPieceCollectedAndKill; - } else if (!(gSaveContext.save.weekEventReg[56] & 2)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_02)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 40.0f, 40.0f); } else { Actor_PickUp(&this->actor, play, GI_RECOVERY_HEART, 40.0f, 40.0f); @@ -139,7 +139,7 @@ void func_80AFDE00(EnColMan* this, PlayState* play) { void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - gSaveContext.save.weekEventReg[56] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_56_02); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 778a358a8c..4e9040d83a 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -116,7 +116,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnCow_Idle; - if (!(gSaveContext.save.weekEventReg[22] & 1) && (CURRENT_DAY != 1) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) && (CURRENT_DAY != 1) && (EN_COW_TYPE(thisx) == EN_COW_TYPE_ABDUCTED)) { Actor_Kill(&this->actor); return; @@ -153,7 +153,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->flags = 0; - gSaveContext.save.weekEventReg[87] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_87_01); } void EnCow_Destroy(Actor* thisx, PlayState* play) { @@ -289,8 +289,8 @@ void EnCow_Idle(EnCow* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f && ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 25000) { if (func_801A5100() == 4) { - if (!(gSaveContext.save.weekEventReg[87] & 1)) { - gSaveContext.save.weekEventReg[87] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_87_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_87_01); if (Inventory_HasEmptyBottle()) { this->actor.textId = 0x32C9; // Text to give milk. } else { @@ -301,7 +301,7 @@ void EnCow_Idle(EnCow* this, PlayState* play) { this->actionFunc = EnCow_Talk; } } else { - gSaveContext.save.weekEventReg[87] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_87_01); } } diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 7b758ca74d..bf97a682a5 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -176,8 +176,8 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneId == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && - !(gSaveContext.save.weekEventReg[30] & 1)) { + if ((play->csCtx.state != CS_STATE_0) && (play->sceneId == SCENE_12HAKUGINMAE) && + (play->csCtx.currentCsIndex == 0) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_30_01)) { if (!(this->unk_1CE & 0x10)) { Flags_SetSwitch(play, 20); this->unk_1CE |= (0x80 | 0x10); @@ -192,7 +192,7 @@ s32 func_80B3E69C(EnDai* this, PlayState* play) { } else if (this->unk_1CE & 0x10) { this->unk_1CE &= ~0x10; this->unk_1CE |= 0x200; - gSaveContext.save.weekEventReg[30] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_30_01); this->actionFunc = func_80B3F00C; } @@ -522,7 +522,7 @@ void EnDai_Init(Actor* thisx, PlayState* play) { this->unk_1CE = 0; this->unk_1D6 = 0; - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1CE |= 0x80; this->unk_1CD = 0xFF; @@ -530,7 +530,7 @@ void EnDai_Init(Actor* thisx, PlayState* play) { return; } - if (gSaveContext.save.weekEventReg[30] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_30_01)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index d9039ad594..263b22ada4 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -88,8 +88,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { this->collider.dim.height = 60; this->collider.dim.yShift = 0; this->actor.flags |= ACTOR_FLAG_8000000; - if ((gSaveContext.save.weekEventReg[63] & 0x80) || - ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) || ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } else if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 7119436592..0e5e7a3eab 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -167,7 +167,7 @@ void func_80BE65B4(EnDaiku2* this, PlayState* play) { switch (gSaveContext.save.day - 1) { case 0: this->unk_28A = 0; - if (gSaveContext.save.weekEventReg[64] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_02)) { this->unk_28A = 6; } func_80BE6408(this, 8); @@ -175,7 +175,7 @@ void func_80BE65B4(EnDaiku2* this, PlayState* play) { case 1: this->unk_28A = 2; - if (gSaveContext.save.weekEventReg[64] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_04)) { this->unk_28A = 7; } func_80BE6408(this, 8); @@ -309,11 +309,11 @@ void func_80BE6BC0(EnDaiku2* this, PlayState* play) { } else { switch (day) { case 0: - gSaveContext.save.weekEventReg[64] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_64_02); break; case 1: - gSaveContext.save.weekEventReg[64] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_64_04); break; } func_80BE65B4(this, play); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index bd2c1e6030..994af8b4de 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -10,6 +10,8 @@ #define THIS ((EnDg*)thisx) +//! TODO: this file require macros for its uses of weekEventReg + void EnDg_Init(Actor* thisx, PlayState* play); void EnDg_Destroy(Actor* thisx, PlayState* play); void EnDg_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 3c97b83775..b339a24222 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -249,7 +249,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { switch (EN_DNO_GET_C000(thisx)) { case EN_DNO_GET_C000_0: func_80A71788(this, play); - if (!(gSaveContext.save.weekEventReg[23] & 0x20) || (gSaveContext.save.weekEventReg[93] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_93_02)) { Actor_Kill(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, @@ -264,7 +264,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { break; case EN_DNO_GET_C000_1: - if (gSaveContext.save.weekEventReg[23] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { Actor_Kill(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, @@ -307,7 +307,7 @@ void func_80A71B68(EnDno* this, PlayState* play) { this->unk_452 = 0; this->actor.textId = 0; if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { - if (gSaveContext.save.weekEventReg[27] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_27_01)) { if (!(this->unk_3B0 & 0x20)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, &this->animIndex); @@ -374,17 +374,17 @@ void func_80A71C3C(EnDno* this, PlayState* play) { void func_80A71E54(EnDno* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { - if (gSaveContext.save.weekEventReg[27] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_27_01)) { this->textId = 0x811; } else { this->textId = 0x80F; - gSaveContext.save.weekEventReg[27] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_27_01); } - } else if (gSaveContext.save.weekEventReg[26] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_80)) { this->textId = 0x80B; } else { this->textId = 0x80C; - gSaveContext.save.weekEventReg[26] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_26_80); } if (this->textId != 0x811) { @@ -617,7 +617,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 2: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) { - gSaveContext.save.weekEventReg[93] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_93_02); Message_StartTextbox(play, 0x802, &this->actor); } break; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 594ddd3d7a..f9eade4be3 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -246,7 +246,7 @@ s32 func_80B3CF60(EnDnp* this, PlayState* play) { this->unk_322 |= 8; this->actionFunc = func_80B3D3F8; ret = true; - } else if (!(gSaveContext.save.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, play)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) && Actor_HasParent(&this->actor, play)) { SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 &= ~0x500; this->actor.parent = NULL; @@ -291,10 +291,10 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { s32 temp_v0; s32 val; - if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneId == SCENE_MITURIN) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40) && (play->sceneId == SCENE_MITURIN) && (play->csCtx.currentCsIndex == 0)) { this->unk_322 |= 0x20; - gSaveContext.save.weekEventReg[29] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_29_40); } if (Cutscene_CheckActorAction(play, 101)) { @@ -385,7 +385,7 @@ void func_80B3D47C(EnDnp* this, PlayState* play) { void func_80B3D558(EnDnp* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - gSaveContext.save.weekEventReg[23] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_23_20); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -414,13 +414,13 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { this->actor.cutscene = 0x10; this->actionFunc = func_80B3D47C; } else if (((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_WOODFALL_TEMPLE) && - !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !(gSaveContext.save.weekEventReg[23] & 0x20)) || + !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) || ((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_DEKU_KINGS_CHAMBER) && - (gSaveContext.save.weekEventReg[23] & 0x20))) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20))) { Actor_SetScale(&this->actor, 0.0085f); SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; - if ((play->sceneId == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { + if ((play->sceneId == SCENE_MITURIN) && CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40)) { this->unk_322 |= 0x20; EnDnp_ChangeAnim(this, EN_DNP_ANIM_HURRY); } @@ -456,7 +456,7 @@ void EnDnp_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); sp2C = this->collider.dim.radius + 50; sp28 = this->collider.dim.height + 30; - if ((this->unk_322 & 0x400) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { + if ((this->unk_322 & 0x400) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { Actor_PickUp(&this->actor, play, GI_MAX, sp2C, sp28); } func_8013C964(&this->actor, play, sp2C, sp28, PLAYER_AP_NONE, this->unk_322 & 7); diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 6ae6c665ce..54ce38c715 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -309,7 +309,7 @@ void func_80A52C6C(EnDnq* this, PlayState* play) { } s32* func_80A52CF8(EnDnq* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[23] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { return &D_80A53400[14]; } @@ -343,11 +343,11 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { SubS_UpdateFlags(&this->unk_37C, 0, 7); } - if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { this->unk_390 = 70.0f; if (Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (ActorCutscene_GetCurrentIndex() == -1)) { - if ((DECR(this->unk_384) == 0) && (gSaveContext.save.weekEventReg[29] & 0x40)) { + if ((DECR(this->unk_384) == 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40)) { Message_StartTextbox(play, 0x969, NULL); this->unk_384 = 200; } @@ -361,7 +361,7 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { this->picto.actor.xzDistToPlayer = this->unk_394; - if (gSaveContext.save.weekEventReg[83] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_83_08)) { func_80A52A78(this, play); } else if (this->unk_3A4 == 0) { Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 3, 0x2AA8); @@ -430,7 +430,7 @@ void EnDnq_Init(Actor* thisx, PlayState* play) { this->unk_386 = 0; this->unk_37C = 0; SubS_UpdateFlags(&this->unk_37C, 3, 7); - if (gSaveContext.save.weekEventReg[9] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80)) { this->unk_3A4 = 1; } else { this->unk_3A4 = 0; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 05189cadf4..b43ad2edea 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -180,7 +180,7 @@ void func_8092C934(EnDns* this) { s32* func_8092C9BC(EnDns* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { if (player->transformation != PLAYER_FORM_DEKU) { return &D_8092DCB0[16]; } else if (this->unk_2FC != 0) { @@ -359,14 +359,14 @@ s32 func_8092D068(EnDns* this) { s32 ret = false; if (ENDNS_GET_8000(&this->actor)) { - if (gSaveContext.save.weekEventReg[23] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { ret = true; } } else if (ENDNS_GET_4000(&this->actor)) { - if ((gSaveContext.save.weekEventReg[9] & 0x80) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { ret = true; } - } else if (!(gSaveContext.save.weekEventReg[9] & 0x80) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { ret = true; } @@ -397,16 +397,16 @@ void func_8092D1B8(EnDns* this, PlayState* play) { } if (!ENDNS_GET_4000(&this->actor) || (this->unk_2D2 != 0)) { - if (!(gSaveContext.save.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && func_8092CC68(play)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) && !CHECK_EVENTINF(EVENTINF_15) && func_8092CC68(play)) { player->stateFlags1 |= PLAYER_STATE1_20; this->unk_2C6 |= 0x100; SubS_UpdateFlags(&this->unk_2C6, 4, 7); play_sound(NA_SE_SY_FOUND); - gSaveContext.eventInf[1] |= 0x20; + SET_EVENTINF(EVENTINF_15); this->unk_2F4 = func_8092CCEC; func_8092C63C(this, EN_DNS_ANIM_WALK_1); this->actionFunc = EnDns_DoNothing; - } else if (gSaveContext.eventInf[1] & 0x40) { + } else if (CHECK_EVENTINF(EVENTINF_16)) { func_8092CCEC(this, play); func_8092C63C(this, EN_DNS_ANIM_WALK_1); this->actionFunc = func_8092D330; @@ -456,7 +456,7 @@ void func_8092D4D8(EnDns* this, PlayState* play) { SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2F4 = NULL; if (ENDNS_GET_4000(&this->actor)) { - if (!(gSaveContext.eventInf[1] & 0x20)) { + if (!CHECK_EVENTINF(EVENTINF_15)) { this->skelAnime.curFrame = this->unk_2F0; this->actor.world.rot.y = this->unk_2DA; func_8092C63C(this, EN_DNS_ANIM_DANCE); @@ -521,14 +521,14 @@ void EnDns_Init(Actor* thisx, PlayState* play) { SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2C6 |= (0x40 | 0x10); this->unk_2C6 |= 0x200; - if (gSaveContext.save.weekEventReg[9] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80)) { this->unk_2FC = 1; } else { this->unk_2FC = 0; } this->actionFunc = func_8092D1B8; - gSaveContext.eventInf[1] &= (u8)~0x20; - gSaveContext.eventInf[1] &= (u8)~0x40; + CLEAR_EVENTINF(EVENTINF_15); + CLEAR_EVENTINF(EVENTINF_16); } void EnDns_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 6230bd0668..5e8cc31f48 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -57,7 +57,7 @@ u8 D_808675E4[] = { /* 0x1C */ SCHEDULE_CMD_RET_NONE(), /* 0x1D */ SCHEDULE_CMD_RET_VAL_S(8), /* 0x1F */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x3C - 0x23), - /* 0x23 */ SCHEDULE_CMD_CHECK_FLAG_S(0x1C, 0x08, 0x2E - 0x27), + /* 0x23 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_28_08, 0x2E - 0x27), /* 0x27 */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(13, 0, 0x2D - 0x2B), /* 0x2B */ SCHEDULE_CMD_RET_VAL_S(9), /* 0x2D */ SCHEDULE_CMD_RET_NONE(), @@ -93,14 +93,14 @@ u8 D_8086764C[] = { u8 D_80867658[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x13 - 0x04), - /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(0x1C, 0x08, 0x0A - 0x08), + /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_28_08, 0x0A - 0x08), /* 0x08 */ SCHEDULE_CMD_RET_VAL_S(12), /* 0x0A */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(15, 10, 22, 0, 0x12 - 0x10), /* 0x10 */ SCHEDULE_CMD_RET_VAL_S(12), /* 0x12 */ SCHEDULE_CMD_RET_NONE(), /* 0x13 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(3, 0x28 - 0x17), /* 0x17 */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(13, 0, 0x28 - 0x1B), - /* 0x1B */ SCHEDULE_CMD_CHECK_FLAG_S(0x33, 0x08, 0x21 - 0x1F), + /* 0x1B */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_51_08, 0x21 - 0x1F), /* 0x1F */ SCHEDULE_CMD_RET_VAL_S(12), /* 0x21 */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(22, 0, 0x27 - 0x25), /* 0x25 */ SCHEDULE_CMD_RET_VAL_S(12), @@ -231,7 +231,7 @@ u8 D_8086773C[] = { u8 D_80867744[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x08 - 0x04), - /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(0x63, 0x80, 0x0E - 0x08), + /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_99_80, 0x0E - 0x08), /* 0x08 */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(20, 0, 0x14 - 0x0C), /* 0x0C */ SCHEDULE_CMD_RET_VAL_S(27), /* 0x0E */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(18, 0, 0x14 - 0x12), @@ -240,12 +240,12 @@ u8 D_80867744[] = { }; u8 D_8086775C[] = { - /* 0x00 */ SCHEDULE_CMD_CHECK_FLAG_S(0x34, 0x20, 0x1B - 0x04), - /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(0x4B, 0x20, 0x1B - 0x08), - /* 0x08 */ SCHEDULE_CMD_CHECK_FLAG_S(0x0E, 0x04, 0x0E - 0x0C), + /* 0x00 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_52_20, 0x1B - 0x04), + /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_75_20, 0x1B - 0x08), + /* 0x08 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_14_04, 0x0E - 0x0C), /* 0x0C */ SCHEDULE_CMD_RET_VAL_S(29), - /* 0x0E */ SCHEDULE_CMD_CHECK_FLAG_S(0x3B, 0x01, 0x1A - 0x12), - /* 0x12 */ SCHEDULE_CMD_CHECK_FLAG_S(0x3D, 0x02, 0x18 - 0x16), + /* 0x0E */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_59_01, 0x1A - 0x12), + /* 0x12 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_61_02, 0x18 - 0x16), /* 0x16 */ SCHEDULE_CMD_RET_VAL_S(30), /* 0x18 */ SCHEDULE_CMD_RET_VAL_S(31), /* 0x1A */ SCHEDULE_CMD_RET_NONE(), diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index ea54d8fdb2..73cc1d8cf3 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -684,37 +684,37 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.cutscene, this->actor.unk20, NULL)) { - gSaveContext.save.weekEventReg[13] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_13_01); switch (this->pythonIndex) { case 0: - gSaveContext.save.weekEventReg[83] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_83_10); break; case 1: - gSaveContext.save.weekEventReg[83] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_83_20); break; case 2: - gSaveContext.save.weekEventReg[83] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_83_40); break; case 3: - gSaveContext.save.weekEventReg[83] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_83_80); break; case 4: - gSaveContext.save.weekEventReg[84] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_84_01); break; case 5: - gSaveContext.save.weekEventReg[84] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_84_02); break; case 6: - gSaveContext.save.weekEventReg[84] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_84_04); break; case 7: - gSaveContext.save.weekEventReg[84] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_84_08); break; } } diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index 75d493b412..7e232d5bdb 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -108,7 +108,7 @@ void EnDrs_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot // Anju removes the Moon Mask at the start of the Couple's Mask cutscene // after that it will no longer be rendered. - if (!(gSaveContext.save.weekEventReg[87] & 2) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_87_02) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp].segment); gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index aa062b46d0..0babd6f189 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1416,7 +1416,7 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { if (!gSaveContext.save.isNight) { func_80151938(play, 0x248); } else if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && - (gSaveContext.save.weekEventReg[74] & 0x20)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20)) { func_80151938(play, 0x225); } else { func_80151938(play, 0x249); diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index b90d3978fd..169d56fddc 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -11,6 +11,8 @@ #define THIS ((EnElfgrp*)thisx) +//! TODO: this file require macros for its uses of weekEventReg + void EnElfgrp_Init(Actor* thisx, PlayState* play); void EnElfgrp_Destroy(Actor* thisx, PlayState* play); void EnElfgrp_Update(Actor* thisx, PlayState* play); @@ -91,7 +93,7 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { switch (this->unk_147) { case ENELFGRP_1: - if (gSaveContext.save.weekEventReg[23] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_02)) { func_80A396B0(this, 1); } else { this->unk_14A |= 4; @@ -146,7 +148,7 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { this->unk_14A |= 2; func_80A396B0(this, 6); } - } else if ((gSaveContext.save.weekEventReg[8] & 0x80)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_80)) { func_80A39DC8(this, play, 24, 0); this->actionFunc = func_80A3A398; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { @@ -421,7 +423,7 @@ void func_80A3A398(EnElfgrp* this, PlayState* play) { } if ((this->unk_14A & 4) != 0) { - gSaveContext.save.weekEventReg[23] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_23_02); } if (this->unk_14A & 0x10) { diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 60c5b3364d..3f52785cb5 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -80,7 +80,7 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { switch (STRAY_FAIRY_TYPE(thisx)) { case STRAY_FAIRY_TYPE_CLOCK_TOWN: - if (gSaveContext.save.weekEventReg[8] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_80)) { Actor_Kill(thisx); return; } @@ -430,7 +430,7 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, PlayState* play) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_20000000; Actor_Kill(&this->actor); - gSaveContext.save.weekEventReg[8] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_08_80); ActorCutscene_Stop(0x7C); return; } diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c index ccb9d16b5a..311668bfe5 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c @@ -152,7 +152,7 @@ void func_809C42A8(EnEncount4* this, PlayState* play) { this->actionFunc = func_809C464C; return; - } else if ((gSaveContext.save.weekEventReg[85] & 0x40) || (this->unk_14C >= 2) || + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_40) || (this->unk_14C >= 2) || (this->actor.xzDistToPlayer > 240.0f)) { return; } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index aaf3958cbd..32a4b7c823 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -220,7 +220,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) { this->actor.draw = EnFall_Moon_Draw; this->actionFunc = EnFall_StoppedClosedMouthMoon_PerformCutsceneActions; Actor_SetScale(&this->actor, this->scale * 3.0f); - if (!(gSaveContext.save.weekEventReg[25] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_25_02)) { Actor_Kill(&this->actor); } break; @@ -229,7 +229,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) { this->actionFunc = EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions; Actor_SetScale(&this->actor, this->scale * 3.0f); this->actor.draw = EnFall_Moon_Draw; - if (gSaveContext.save.weekEventReg[25] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_02)) { Actor_Kill(&this->actor); } break; @@ -326,7 +326,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { case 2: if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - if (gSaveContext.save.weekEventReg[93] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_04)) { if (ActorCutscene_GetCanPlayNext(0xC)) { ActorCutscene_Start(0xC, &this->actor); sGiantsCutsceneState++; @@ -335,7 +335,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { } } else if (ActorCutscene_GetCanPlayNext(0xB)) { ActorCutscene_Start(0xB, &this->actor); - gSaveContext.save.weekEventReg[93] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_93_04); sGiantsCutsceneState++; } else { ActorCutscene_SetIntentToPlay(0xB); @@ -518,8 +518,8 @@ void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play) { if (this->actor.draw != NULL) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, this->actor.speedXZ) <= 0.0f) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_1); - gSaveContext.save.weekEventReg[74] |= 0x80; - gSaveContext.save.weekEventReg[74] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_74_80); + SET_WEEKEVENTREG(WEEKEVENTREG_74_20); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -2); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index fc469da817..c7dd18369b 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -163,27 +163,27 @@ void EnFish2_Init(Actor* thisx, PlayState* play) { this->morphTable, 24); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_344 == 0) { - if (gSaveContext.save.weekEventReg[81] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_10)) { this->unk_2C0 = 1; } - if (gSaveContext.save.weekEventReg[81] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_20)) { this->unk_2C0 = 2; } - if (gSaveContext.save.weekEventReg[81] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_40)) { this->unk_2C0 = 3; } } else { - if (gSaveContext.save.weekEventReg[81] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_80)) { this->unk_2C0 = 1; } - if (gSaveContext.save.weekEventReg[82] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_01)) { this->unk_2C0 = 2; } - if (gSaveContext.save.weekEventReg[82] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_02)) { this->unk_2C0 = 3; } } @@ -619,18 +619,18 @@ void func_80B297FC(EnFish2* this, PlayState* play) { this->unk_2C0++; if (this->unk_344 == 0) { if (this->unk_2C0 == 1) { - gSaveContext.save.weekEventReg[81] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_81_10); } else if (this->unk_2C0 == 2) { - gSaveContext.save.weekEventReg[81] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_81_20); } else if (this->unk_2C0 == 3) { - gSaveContext.save.weekEventReg[81] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_81_40); } } else if (this->unk_2C0 == 1) { - gSaveContext.save.weekEventReg[81] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_81_80); } else if (this->unk_2C0 == 2) { - gSaveContext.save.weekEventReg[82] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_82_01); } else if (this->unk_2C0 == 3) { - gSaveContext.save.weekEventReg[82] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_82_02); } if (this->unk_2B0 != 0) { @@ -890,12 +890,12 @@ void func_80B2A498(EnFish2* this, PlayState* play) { temp_v0->speedXZ = 4.0f; temp_v0->velocity.y = 15.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); - gSaveContext.save.weekEventReg[81] &= (u8)~0x10; - gSaveContext.save.weekEventReg[81] &= (u8)~0x20; - gSaveContext.save.weekEventReg[81] &= (u8)~0x40; - gSaveContext.save.weekEventReg[81] &= (u8)~0x80; - gSaveContext.save.weekEventReg[82] &= (u8)~1; - gSaveContext.save.weekEventReg[82] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_10); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_20); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_40); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_80); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_82_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_82_02); } } diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index ec85119e87..583da4996c 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -153,7 +153,7 @@ u16 EnFsn_GetWelcome(PlayState* play) { void EnFsn_HandleConversationBackroom(EnFsn* this, PlayState* play) { switch (this->textId) { case 0: - if (!(gSaveContext.save.weekEventReg[80] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_10)) { this->textId = 0x29E0; break; } else { @@ -166,7 +166,7 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, PlayState* play) { this->flags |= ENFSN_GIVE_ITEM; this->flags |= ENFSN_GAVE_LETTER_TO_MAMA; this->getItemId = GI_LETTER_TO_MAMA; - gSaveContext.save.weekEventReg[80] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_80_10); this->textId = 0x29F1; break; } else { @@ -186,7 +186,7 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, PlayState* play) { this->flags |= ENFSN_GIVE_ITEM; this->flags |= ENFSN_GAVE_LETTER_TO_MAMA; this->getItemId = GI_LETTER_TO_MAMA; - gSaveContext.save.weekEventReg[80] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_80_10); this->textId = 0x29F1; break; case 0x29F1: @@ -301,8 +301,8 @@ void EnFsn_CursorLeftRight(EnFsn* this) { } s16 EnFsn_GetThirdDayItemId(void) { - if (!(gSaveContext.save.weekEventReg[33] & 4) && CURRENT_DAY == 3) { - if (!(gSaveContext.save.weekEventReg[33] & 8) && !(gSaveContext.save.weekEventReg[79] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04) && CURRENT_DAY == 3) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { return SI_BOMB_BAG_30_1; } return SI_MASK_ALL_NIGHT; @@ -335,7 +335,7 @@ s32 EnFsn_HasItemsToSell(void) { } if ((STOLEN_ITEM_1 != STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 != STOLEN_ITEM_NONE) || - !(gSaveContext.save.weekEventReg[33] & 4)) { + !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { return true; } @@ -441,9 +441,9 @@ s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, PlayState* play) { func_8019F208(); if (CURRENT_DAY != 3) { this->actor.textId = 0x29FB; - } else if (gSaveContext.save.weekEventReg[33] & 4) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { this->actor.textId = 0x29FF; - } else if (!(gSaveContext.save.weekEventReg[33] & 8) && !(gSaveContext.save.weekEventReg[79] & 0x40)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { this->actor.textId = 0x29D7; } else { this->actor.textId = 0x29D8; @@ -861,10 +861,9 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { Message_StartTextbox(play, this->actor.textId, &this->actor); break; case 0x29D2: - if (gSaveContext.save.weekEventReg[33] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { this->actor.textId = 0x2A01; - } else if (!(gSaveContext.save.weekEventReg[33] & 8) && - !(gSaveContext.save.weekEventReg[79] & 0x40)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { this->actor.textId = 0x29D3; } else { this->actor.textId = 0x29D4; @@ -1145,7 +1144,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_2: func_8019F208(); - gSaveContext.save.weekEventReg[33] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_33_04); case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -1416,7 +1415,7 @@ void EnFsn_Init(Actor* thisx, PlayState* play) { EnFsn_GetCutscenes(this); EnFsn_InitShop(this, play); } else { - if ((gSaveContext.save.weekEventReg[33] & 8) || (gSaveContext.save.weekEventReg[79] & 0x40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) || CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 8b035faed0..4571759757 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -229,8 +229,8 @@ void EnFu_Init(Actor* thisx, PlayState* play) { void EnFu_Destroy(Actor* thisx, PlayState* play) { EnFu* this = THIS; - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[8] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); Collider_DestroyCylinder(play, &this->collider); } @@ -388,9 +388,9 @@ void func_80962340(EnFu* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { Message_StartTextbox(play, 0x287E, &this->actor); this->unk_552 = 0x287E; - } else if ((CURRENT_DAY == 3) && (gSaveContext.save.weekEventReg[22] & 0x10) && - (gSaveContext.save.weekEventReg[22] & 0x20)) { - if ((gSaveContext.save.weekEventReg[22] & 0x40)) { + } else if ((CURRENT_DAY == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_40)) { Message_StartTextbox(play, 0x2883, &this->actor); this->unk_552 = 0x2883; } else { @@ -532,8 +532,8 @@ void func_80962660(EnFu* this, PlayState* play) { break; case 0x287D: - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); func_801477B4(play); player->stateFlags1 |= PLAYER_STATE1_20; this->unk_53C = 0; @@ -605,8 +605,8 @@ void func_809628D0(EnFu* this, PlayState* play) { case 0x2884: case 0x2887: case 0x288A: - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); func_809622FC(this); break; @@ -737,7 +737,7 @@ void func_80962EBC(EnFu* this, PlayState* play) { void func_80962F10(EnFu* this) { this->unk_548 = 0; this->actor.flags &= ~ACTOR_FLAG_1; - gSaveContext.save.weekEventReg[8] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_08_01); this->actionFunc = func_80962F4C; } @@ -824,7 +824,7 @@ void func_809632D0(EnFu* this) { Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } - gSaveContext.save.weekEventReg[8] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); if (this->unk_2D4 != NULL) { BgFuMizu* mizu = this->unk_2D4; @@ -878,7 +878,7 @@ void func_80963560(EnFu* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80963610(this); - } else if ((this->unk_552 == 0x2880) && !(gSaveContext.save.weekEventReg[22] & 0x80)) { + } else if ((this->unk_552 == 0x2880) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_80)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -895,13 +895,13 @@ void func_80963630(EnFu* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20) && - (CURRENT_DAY == 3) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { - if (gSaveContext.save.weekEventReg[22] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20) && (CURRENT_DAY == 3) && + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_40)) { Message_StartTextbox(play, 0x2884, &this->actor); this->unk_552 = 0x2884; - } else if (!(gSaveContext.save.weekEventReg[22] & 0x80)) { - gSaveContext.save.weekEventReg[22] |= 0x80; + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_22_80); Message_StartTextbox(play, 0x2882, &this->actor); this->unk_552 = 0x2882; } else { @@ -920,15 +920,15 @@ void func_80963630(EnFu* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { switch (CURRENT_DAY) { case 1: - gSaveContext.save.weekEventReg[22] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_22_10); break; case 2: - gSaveContext.save.weekEventReg[22] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_22_20); break; case 3: - gSaveContext.save.weekEventReg[22] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_22_40); break; } } @@ -1019,7 +1019,7 @@ void func_809639D0(EnFu* this, PlayState* play) { if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Message_StartTextbox(play, 0x2853, &this->actor); this->unk_552 = 0x2853; - } else if (gSaveContext.save.weekEventReg[22] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10)) { Message_StartTextbox(play, 0x284D, &this->actor); this->unk_552 = 0x284D; } else if (this->unk_53E == 1) { @@ -1043,7 +1043,7 @@ void func_809639D0(EnFu* this, PlayState* play) { } else if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Message_StartTextbox(play, 0x2853, &this->actor); this->unk_552 = 0x2853; - } else if (!(gSaveContext.save.weekEventReg[22] & 0x10)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10)) { if (this->unk_53E == 1) { Message_StartTextbox(play, 0x285B, &this->actor); this->unk_552 = 0x285B; @@ -1052,7 +1052,7 @@ void func_809639D0(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x285D, &this->actor); this->unk_552 = 0x285D; } - } else if (gSaveContext.save.weekEventReg[22] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20)) { Message_StartTextbox(play, 0x2855, &this->actor); this->unk_552 = 0x2855; } else if (this->unk_53E == 1) { @@ -1076,15 +1076,15 @@ void func_809639D0(EnFu* this, PlayState* play) { } else if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { Message_StartTextbox(play, 0x284B, &this->actor); this->unk_552 = 0x284B; - } else if (gSaveContext.save.weekEventReg[22] & 0x40) { - if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20)) { Message_StartTextbox(play, 0x285F, &this->actor); this->unk_552 = 0x285F; } else { Message_StartTextbox(play, 0x2861, &this->actor); this->unk_552 = 0x2861; } - } else if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20)) { if (this->unk_53E == 1) { Message_StartTextbox(play, 0x2863, &this->actor); this->unk_552 = 0x2863; @@ -1093,7 +1093,7 @@ void func_809639D0(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x2865, &this->actor); this->unk_552 = 0x2865; } - } else if ((gSaveContext.save.weekEventReg[22] & 0x10) || (gSaveContext.save.weekEventReg[22] & 0x20)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20)) { if (this->unk_53E == 1) { Message_StartTextbox(play, 0x2867, &this->actor); this->unk_552 = 0x2867; diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index f6a2270154..55dc237374 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -145,20 +145,20 @@ void EnGakufu_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_2000000; if (EnGakufu_IsPlayerInRange(this, play)) { - gSaveContext.eventInf[3] |= 2; + SET_EVENTINF(EVENTINF_31); } else { - gSaveContext.eventInf[3] &= (u8)~2; + CLEAR_EVENTINF(EVENTINF_31); } this->actionFunc = EnGakufu_WaitForSong; - gSaveContext.eventInf[3] &= (u8)~4; + CLEAR_EVENTINF(EVENTINF_32); } void EnGakufu_Destroy(Actor* thisx, PlayState* play) { EnGakufu* this = THIS; if (GAKUFU_GET_TYPE(&this->actor) != GAKUFU_MILK_BAR) { - gSaveContext.eventInf[3] &= (u8)~2; + CLEAR_EVENTINF(EVENTINF_31); } } @@ -231,23 +231,23 @@ void EnGakufu_PlayRewardCutscene(EnGakufu* this, PlayState* play) { /** * Waits for the notes on the wall to be played and updates the corresponding flags - * (gSaveContext.eventInf[3] & 2) is checking if Player is within range of the wall - * (gSaveContext.eventInf[3] & 4) is checking if Player has played the notes of the wall + * EVENTINF_31 is used to track if Player is within range of the wall + * EVENTINF_32 is used to track if Player has played the notes of the wall */ void EnGakufu_WaitForSong(EnGakufu* this, PlayState* play) { - if (gSaveContext.eventInf[3] & 2) { - if (gSaveContext.eventInf[3] & 4) { - gSaveContext.eventInf[3] &= (u8)~2; - gSaveContext.eventInf[3] &= (u8)~4; + if (CHECK_EVENTINF(EVENTINF_31)) { + if (CHECK_EVENTINF(EVENTINF_32)) { + CLEAR_EVENTINF(EVENTINF_31); + CLEAR_EVENTINF(EVENTINF_32); this->actionFunc = EnGakufu_PlayRewardCutscene; EnGakufu_PlayRewardCutscene(this, play); this->actor.draw = NULL; } else if (!EnGakufu_IsPlayerInRange(this, play)) { - gSaveContext.eventInf[3] &= (u8)~2; + CLEAR_EVENTINF(EVENTINF_31); } } else if (EnGakufu_IsPlayerInRange(this, play)) { - gSaveContext.eventInf[3] |= 2; + SET_EVENTINF(EVENTINF_31); } } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 6effae85ce..8e55791673 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -120,8 +120,8 @@ s32 func_80B0F660(EnGb2* this, PlayState* play) { } void func_80B0F6DC(EnGb2* this) { - if (!(gSaveContext.save.weekEventReg[54] & 0x20)) { - gSaveContext.save.weekEventReg[54] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_54_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_54_20); this->unk_26E = 0x14D0; } else { this->unk_26E = 0x14D1; @@ -131,15 +131,15 @@ void func_80B0F6DC(EnGb2* this) { } void func_80B0F728(EnGb2* this, PlayState* play) { - if (gSaveContext.eventInf[4] & 0x10) { + if (CHECK_EVENTINF(EVENTINF_44)) { func_80B0FBF0(this, play); this->unk_26E = 0x14E1; - if (gSaveContext.eventInf[4] & 0x80) { + if (CHECK_EVENTINF(EVENTINF_47)) { this->unk_288 = 10; } else { this->unk_288 = 30; } - } else if (gSaveContext.eventInf[4] & 0x20) { + } else if (CHECK_EVENTINF(EVENTINF_45)) { func_80B0FBF0(this, play); this->unk_26E = 0x14E0; this->unk_26C |= 2; @@ -147,9 +147,9 @@ void func_80B0F728(EnGb2* this, PlayState* play) { this->unk_26E = 0x14DC; } - gSaveContext.eventInf[4] &= (u8)~0x10; - gSaveContext.eventInf[4] &= (u8)~0x20; - gSaveContext.eventInf[4] &= (u8)~0x40; + CLEAR_EVENTINF(EVENTINF_44); + CLEAR_EVENTINF(EVENTINF_45); + CLEAR_EVENTINF(EVENTINF_46); this->actionFunc = func_80B10584; } @@ -159,7 +159,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14D1; case 0x14D1: - if (gSaveContext.eventInf[4] & 0x80) { + if (CHECK_EVENTINF(EVENTINF_47)) { return 0x14E4; } @@ -179,7 +179,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14D3; case 0x14D2: - if (gSaveContext.eventInf[4] & 0x80) { + if (CHECK_EVENTINF(EVENTINF_47)) { return 0x14E5; } return 0x14D4; @@ -208,7 +208,7 @@ u16 func_80B0F8F8(EnGb2* this) { case 0x14DE: this->unk_26C |= 2; - gSaveContext.save.weekEventReg[54] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_54_80); return 0x14DF; case 0x14E1: @@ -226,7 +226,7 @@ u16 func_80B0F97C(EnGb2* this) { return 0x14F7; case 0x14F7: - gSaveContext.save.weekEventReg[76] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_76_80); this->unk_26C |= 2; return 0x14F8; @@ -259,7 +259,7 @@ s32 func_80B0FA48(EnGb2* this, PlayState* play) { return false; case PLAYER_MASK_CAPTAIN: - if (!(gSaveContext.save.weekEventReg[80] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_40)) { this->unk_26E = 0x14EB; return false; } @@ -267,7 +267,7 @@ s32 func_80B0FA48(EnGb2* this, PlayState* play) { return true; } - if (!(gSaveContext.save.weekEventReg[80] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) { this->unk_26E = 0x14EF; return false; } else { @@ -372,7 +372,7 @@ void func_80B0FE7C(PlayState* play) { void func_80B0FEBC(EnGb2* this, PlayState* play) { if ((play->msgCtx.ocarinaMode == OCARINA_SONG_ELEGY) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { play->msgCtx.ocarinaMode = 4; - gSaveContext.eventInf[4] |= 0x80; + SET_EVENTINF(EVENTINF_47); this->unk_26E = 0x14D1; this->unk_288 = 10; } @@ -395,7 +395,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { play->msgCtx.stateTimer = 4; this->unk_26E = 0x14D1; this->unk_288 = 30; - gSaveContext.eventInf[4] &= (u8)~0x80; + CLEAR_EVENTINF(EVENTINF_47); this->unk_26C &= ~2; this->actionFunc = func_80B0FEBC; } else { @@ -489,7 +489,7 @@ void func_80B10344(EnGb2* this, PlayState* play) { this->unk_26C &= ~0x200; gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; func_800FE498(); - gSaveContext.eventInf[4] |= 0x40; + SET_EVENTINF(EVENTINF_46); func_80B0FE7C(play); } else if (this->unk_280 == 2) { if (this->unk_26C & 0x400) { @@ -507,8 +507,8 @@ void func_80B10344(EnGb2* this, PlayState* play) { if (gSaveContext.save.playerData.health < 49) { gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; - gSaveContext.eventInf[4] |= 0x40; - gSaveContext.eventInf[4] |= 0x20; + SET_EVENTINF(EVENTINF_46); + SET_EVENTINF(EVENTINF_45); if ((this->unk_268 != NULL) && (this->unk_268->update == NULL)) { this->unk_268 = NULL; @@ -521,8 +521,8 @@ void func_80B10344(EnGb2* this, PlayState* play) { func_80B0FE7C(play); } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; - gSaveContext.eventInf[4] |= 0x40; - gSaveContext.eventInf[4] |= 0x10; + SET_EVENTINF(EVENTINF_46); + SET_EVENTINF(EVENTINF_44); if ((this->unk_268 != NULL) && (this->unk_268->update == NULL)) { this->unk_268 = NULL; @@ -564,7 +564,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { } else { this->unk_26E = 0x14D1; this->unk_288 = 30; - gSaveContext.eventInf[4] &= (u8)~0x80; + CLEAR_EVENTINF(EVENTINF_47); this->actionFunc = func_80B0FEBC; } } else { @@ -617,7 +617,7 @@ void func_80B10868(EnGb2* this, PlayState* play) { void func_80B10924(EnGb2* this, PlayState* play) { s32 sp24; - if (gSaveContext.save.weekEventReg[54] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_40)) { sp24 = 5; } else { sp24 = 12; @@ -626,7 +626,7 @@ void func_80B10924(EnGb2* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (sp24 == 12) { - gSaveContext.save.weekEventReg[54] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_54_40); } else { Rupees_ChangeBy(50); } @@ -707,9 +707,9 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; Message_StartTextbox(play, this->unk_26E, &this->actor); if (this->unk_26E == 0x14EB) { - gSaveContext.save.weekEventReg[80] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_80_40); } else if (this->unk_26E == 0x14EF) { - gSaveContext.save.weekEventReg[80] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_80_20); } this->unk_26C &= ~0x20; this->unk_290 = 0; @@ -885,9 +885,9 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { switch (ENGB2_GET_7(&this->actor)) { case ENGB2_7_0: - if (gSaveContext.save.weekEventReg[54] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_80)) { Actor_Kill(&this->actor); - } else if (gSaveContext.save.weekEventReg[52] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { Actor_Kill(&this->actor); } @@ -901,7 +901,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; - if (gSaveContext.eventInf[4] & 0x40) { + if (CHECK_EVENTINF(EVENTINF_46)) { func_80B0F728(this, play); } else { func_80B0FBF0(this, play); @@ -910,7 +910,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { break; case ENGB2_7_1: - if ((play->curSpawn == 1) || (gSaveContext.save.weekEventReg[80] & 0x80)) { + if ((play->curSpawn == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_80_80)) { Actor_Kill(&this->actor); return; } @@ -940,7 +940,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { return; } - if (gSaveContext.save.weekEventReg[76] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_76_80)) { this->actor.draw = NULL; this->unk_26C |= 0x100; this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index f88aab9503..7fcbe85eef 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -453,7 +453,7 @@ void func_80BB221C(EnGeg* this, PlayState* play) { } } else { this->unk_230 &= ~4; - if (gSaveContext.save.weekEventReg[35] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_35_40)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { this->unk_496 = 0xD62; Message_StartTextbox(play, this->unk_496, &this->actor); @@ -464,7 +464,7 @@ void func_80BB221C(EnGeg* this, PlayState* play) { this->unk_230 |= 8; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { - gSaveContext.save.weekEventReg[35] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_35_40); this->unk_496 = 0xD5E; this->unk_49A = this->unk_49C[0]; Message_StartTextbox(play, this->unk_496, &this->actor); @@ -656,7 +656,7 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->unk_49C[4]) { if (ActorCutscene_GetCanPlayNext(this->unk_498)) { - gSaveContext.save.weekEventReg[37] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_37_08); if (this->actor.child != NULL) { Actor_Kill(this->actor.child); } @@ -798,7 +798,7 @@ void func_80BB31B8(EnGeg* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.weekEventReg[61] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_61_01); if (getItemId == GI_MASK_DON_GERO) { this->unk_230 |= 0x40; } @@ -861,7 +861,7 @@ void EnGeg_Init(Actor* thisx, PlayState* play) { s32 pad2; s32 sp34[] = { 0x3E, 0xF64 }; - if (gSaveContext.save.weekEventReg[61] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_01)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index a1d3ca5e23..15522707da 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -129,7 +129,7 @@ s32 func_80B34FB4(EnGg* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp34, &sp40); if ((this->actor.xzDistToPlayer < 250.0f) && (this->actor.xzDistToPlayer > 50.0f) && - (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (gSaveContext.save.weekEventReg[19] & 0x80))) { + (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80))) { Math_SmoothStepToS(&this->unk_2E8, pitch, 4, 0x2AA8, 1); } else { Math_SmoothStepToS(&this->unk_2E8, 0, 4, 0x2AA8, 1); @@ -212,7 +212,7 @@ void func_80B352A4(EnGg* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; } - gSaveContext.save.weekEventReg[19] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_19_80); this->actionFunc = func_80B3556C; } else if ((this->unk_2E6 == 0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) { if (sp26 < (lastFrame - 1)) { @@ -225,7 +225,7 @@ void func_80B352A4(EnGg* this, PlayState* play) { } void func_80B35450(EnGg* this, PlayState* play) { - if ((gSaveContext.save.weekEventReg[91] & 0x10) && (play->csCtx.state == 0)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10) && (play->csCtx.state == 0)) { func_80B359DC(this, play); } @@ -236,7 +236,7 @@ void func_80B35450(EnGg* this, PlayState* play) { this->unk_308 = 1; this->actionFunc = func_80B352A4; } else if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 50.0f)) { - if (gSaveContext.save.weekEventReg[19] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { func_800B863C(&this->actor, play); this->actor.textId = 0xCEE; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { @@ -400,8 +400,8 @@ void func_80B359DC(EnGg* this, PlayState* play) { if ((player->transformation == PLAYER_FORM_HUMAN) && (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { - if (!(gSaveContext.save.weekEventReg[19] & 0x80)) { - gSaveContext.save.weekEventReg[19] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_19_80); } this->unk_307 = true; } @@ -660,9 +660,9 @@ void EnGg_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); this->actor.flags &= ~ACTOR_FLAG_80; this->unk_310 = this->actor.home.pos.y; this->unk_2DC = this->actor.cutscene; @@ -690,7 +690,7 @@ void EnGg_Update(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; } - if (gSaveContext.save.weekEventReg[19] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { if (play->csCtx.state == 0) { this->actor.flags |= ACTOR_FLAG_1; } else { @@ -708,10 +708,10 @@ void EnGg_Update(Actor* thisx, PlayState* play) { func_80B35968(this, play); } - if (!(gSaveContext.save.weekEventReg[91] & 0x10) && - ((gSaveContext.save.weekEventReg[19] & 0x80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10) && + (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_308 == 1))) { - gSaveContext.save.weekEventReg[91] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_91_10); } this->actionFunc(this, play); @@ -789,7 +789,7 @@ void EnGg_Draw(Actor* thisx, PlayState* play) { this->unk_344.unk_38(&this->unk_344, play); } - if (gSaveContext.save.weekEventReg[19] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B36DFC[this->unk_2E2])); diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index acec19c762..a7c71215c4 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -214,17 +214,17 @@ void func_80B3B294(EnGg2* this, PlayState* play) { if (this->unk_2F1 == 0) { if (play->sceneId == SCENE_11GORONNOSATO) { - gSaveContext.save.weekEventReg[20] |= 4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); } else if (play->sceneId == SCENE_17SETUGEN) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] |= 8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + SET_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] |= 0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + SET_WEEKEVENTREG(WEEKEVENTREG_20_10); } if (this->unk_1D8 != NULL) { @@ -240,17 +240,17 @@ void func_80B3B294(EnGg2* this, PlayState* play) { } else { this->unk_2F1 = 1; if (play->sceneId == SCENE_11GORONNOSATO) { - gSaveContext.save.weekEventReg[20] |= 4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); } else if (play->sceneId == SCENE_17SETUGEN) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] |= 8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + SET_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] |= 0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + SET_WEEKEVENTREG(WEEKEVENTREG_20_10); } } } @@ -360,7 +360,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { return; } - if (gSaveContext.save.weekEventReg[91] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10)) { Actor_Kill(&this->actor); return; } @@ -381,16 +381,16 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { this->unk_2EA = 0; if (play->sceneId == SCENE_11GORONNOSATO) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); this->unk_2EE = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3AFB0; } else if (play->sceneId == SCENE_17SETUGEN) { - if ((gSaveContext.save.weekEventReg[20] & 4) && !(gSaveContext.save.weekEventReg[20] & 8) && - !(gSaveContext.save.weekEventReg[20] & 0x10)) { - gSaveContext.save.weekEventReg[20] &= (u8)~4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); this->unk_2EE = 8; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3B05C; @@ -398,9 +398,9 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); } } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { - if (!(gSaveContext.save.weekEventReg[20] & 4) && (gSaveContext.save.weekEventReg[20] & 8) && - !(gSaveContext.save.weekEventReg[20] & 0x10)) { - gSaveContext.save.weekEventReg[20] &= (u8)~8; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); this->unk_2EE = 8; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3B05C; @@ -408,9 +408,9 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); } } else { - gSaveContext.save.weekEventReg[20] &= (u8)~4; - gSaveContext.save.weekEventReg[20] &= (u8)~8; - gSaveContext.save.weekEventReg[20] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index d44306b09f..dbd1803591 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -183,7 +183,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { } if (GIANT_TYPE_IS_CLOCK_TOWER_SUCCESS(type)) { - if (!(gSaveContext.save.weekEventReg[25] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_25_02)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index fa555bc3a3..5b73682bf6 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -118,7 +118,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { switch (this->curTextId) { case 0x44C: // "Hey there, little guy! Won't you deposit some Rupees? (first dialogue) Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); - if (gSaveContext.save.weekEventReg[10] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08)) { Message_StartTextbox(play, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" } else { @@ -165,18 +165,18 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { break; case 0x45A: // "All right, little guy, now I've got a total of [rupees] from you!" if (((gSaveContext.save.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && - !(gSaveContext.save.weekEventReg[59] & 0x40)) { - gSaveContext.save.weekEventReg[59] |= 0x40; + !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_40)) { + SET_WEEKEVENTREG(WEEKEVENTREG_59_40); Message_StartTextbox(play, 0x45B, &this->actor); this->curTextId = 0x45B; // "What's this? You've already saved up 200 Rupees!?! } else if (((gSaveContext.save.bankRupees & 0xFFFF) >= 1000) && ((this->previousBankValue) < 1000) && - !(gSaveContext.save.weekEventReg[59] & 0x80)) { - gSaveContext.save.weekEventReg[59] |= 0x80; + !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_59_80); Message_StartTextbox(play, 0x45C, &this->actor); this->curTextId = 0x45C; // "What's this? You've already saved up 1000 Rupees!?! } else if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { - if ((this->previousBankValue < 5000) && !(gSaveContext.save.weekEventReg[60] & 1)) { - gSaveContext.save.weekEventReg[60] |= 1; + if ((this->previousBankValue < 5000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_60_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_60_01); Message_StartTextbox(play, 0x45D, &this->actor); this->curTextId = 0x45D; // "What's this? You've already saved up 5000 Rupees?! } else if (this->previousBankValue < (s16)(gSaveContext.save.bankRupees & 0xFFFF)) { @@ -524,14 +524,14 @@ void EnGinkoMan_BankAward(EnGinkoMan* this, PlayState* play) { this->actor.parent = NULL; EnGinkoMan_SetupBankAward2(this); } else if (this->curTextId == 0x45B) { // "Whats this, you already saved up 200?" - if (!(gSaveContext.save.weekEventReg[10] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08)) { Actor_PickUp(&this->actor, play, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } } else if (this->curTextId == 0x45C) { // "Whats this, you already saved up 5000?" Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); - } else if (!(gSaveContext.save.weekEventReg[59] & 8)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_08)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); @@ -546,10 +546,10 @@ void EnGinkoMan_SetupBankAward2(EnGinkoMan* this) { // separate function to handle bank rewards... called while the player is receiving the award void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (!(gSaveContext.save.weekEventReg[10] & 8) && (this->curTextId == 0x45B)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08) && (this->curTextId == 0x45B)) { // "What's this? You've already saved up 200 Rupees!?! Well, little guy, here's your special gift. Take // it!" - gSaveContext.save.weekEventReg[10] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_10_08); Message_StartTextbox(play, 0x47A, &this->actor); this->curTextId = 0x47A; // Message after receiving reward for depositing 200 rupees. } else { @@ -561,8 +561,8 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupDialogue(this); } else if (this->curTextId == 0x45D) { // saved up 5000 rupees for HP if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - if (!(gSaveContext.save.weekEventReg[59] & 8)) { - gSaveContext.save.weekEventReg[59] |= 8; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_08)) { + SET_WEEKEVENTREG(WEEKEVENTREG_59_08); } EnGinkoMan_SetupIdle(this); } diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 0c6ad8a416..65df46284d 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -205,13 +205,13 @@ s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this) { - if (!(gSaveContext.save.weekEventReg[53] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (!(gSaveContext.save.weekEventReg[53] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_10)) { return CANBUY_RESULT_SUCCESS_2; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 627c8d3695..bec9a525b5 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -120,7 +120,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { if (play->sceneId == SCENE_17SETUGEN2) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[40] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_40_80)) { switch (this->unk_31C) { case 0xE7A: return 0xE7B; @@ -133,7 +133,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { case 0xE7E: return 0xE7F; case 0xE7F: - gSaveContext.save.weekEventReg[40] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_40_80); this->unk_1E4 |= 1; return 0xE80; default: @@ -143,7 +143,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { this->unk_1E4 |= 1; return 0xE81; } - } else if (!(gSaveContext.save.weekEventReg[41] & 1)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_01)) { switch (this->unk_31C) { case 0xE82: return 0xE83; @@ -154,7 +154,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { case 0xE7E: return 0xE7F; case 0xE7F: - gSaveContext.save.weekEventReg[41] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_41_01); this->unk_1E4 |= 1; return 0xE80; default: @@ -166,12 +166,12 @@ u16 func_80B50410(EnGk* this, PlayState* play) { } } else if (play->sceneId == SCENE_GORONRACE) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[41] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_04)) { if (this->unk_31C == 0xE88) { - if (!(gSaveContext.save.weekEventReg[41] & 8) || Inventory_HasEmptyBottle()) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_08) || Inventory_HasEmptyBottle()) { return 0xE89; } - gSaveContext.save.weekEventReg[41] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_41_04); this->unk_1E4 |= 1; return 0xE94; } @@ -179,10 +179,10 @@ u16 func_80B50410(EnGk* this, PlayState* play) { } if ((this->unk_31C == 0xE8D) || (this->unk_31C == 0xE98)) { - if (!(gSaveContext.save.weekEventReg[41] & 8) || Inventory_HasEmptyBottle()) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_08) || Inventory_HasEmptyBottle()) { return 0xE89; } - gSaveContext.save.weekEventReg[41] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_41_04); this->unk_1E4 |= 1; return 0xE94; } @@ -193,12 +193,12 @@ u16 func_80B50410(EnGk* this, PlayState* play) { return 0xE98; } - if (!(gSaveContext.save.weekEventReg[41] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_02)) { switch (this->unk_31C) { case 0xE85: return 0xE86; case 0xE86: - gSaveContext.save.weekEventReg[41] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_41_02); this->unk_1E4 |= 1; return 0xE87; default: @@ -216,7 +216,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { u16 func_80B50710(EnGk* this) { switch (this->unk_31C) { case 0xE8E: - gSaveContext.save.weekEventReg[41] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_41_04); this->unk_1E4 &= ~0x10; this->unk_1E4 |= 1; return 0xE8F; @@ -225,7 +225,7 @@ u16 func_80B50710(EnGk* this) { return 0xE8B; case 0xE8B: - gSaveContext.save.weekEventReg[41] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_41_04); this->unk_1E4 |= 0x10; this->unk_1E4 |= 1; return 0xE8C; @@ -630,7 +630,7 @@ void func_80B51760(EnGk* this, PlayState* play) { } } else { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { - gSaveContext.save.weekEventReg[40] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_40_40); this->actionFunc = func_80B51D9C; return; } @@ -829,7 +829,7 @@ void func_80B51EA4(EnGk* this, PlayState* play) { } void func_80B51FD0(EnGk* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { if (this->unk_1E4 & 2) { func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } else { @@ -847,7 +847,7 @@ void func_80B5202C(EnGk* this, PlayState* play) { if (!func_80B50854(this, play)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - gSaveContext.save.weekEventReg[24] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_24_80); this->actionFunc = func_80B51698; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { func_800B863C(&this->actor, play); @@ -895,7 +895,7 @@ void func_80B5227C(EnGk* this, PlayState* play) { func_800B14D4(play, 20.0f, &this->actor.home.pos); this->unk_350 = 60; if (!(this->unk_1E4 & 0x80)) { - gSaveContext.save.weekEventReg[22] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_22_04); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); this->unk_350 = 0x4000; @@ -906,7 +906,7 @@ void func_80B5227C(EnGk* this, PlayState* play) { void func_80B52340(EnGk* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1E4 |= 4; - if (gSaveContext.eventInf[1] & 2) { + if (CHECK_EVENTINF(EVENTINF_11)) { this->unk_31C = 0xE90; this->actionFunc = func_80B52430; } else { @@ -955,7 +955,7 @@ void func_80B52430(EnGk* this, PlayState* play) { void func_80B5253C(EnGk* this, PlayState* play) { s32 sp24; - if (gSaveContext.save.weekEventReg[41] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_08)) { sp24 = 0x93; } else { sp24 = 0x6A; @@ -964,7 +964,7 @@ void func_80B5253C(EnGk* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (sp24 == 0x6A) { - gSaveContext.save.weekEventReg[41] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_41_08); } this->actionFunc = func_80B525E0; } else { @@ -985,7 +985,7 @@ void func_80B525E0(EnGk* this, PlayState* play) { void func_80B52654(EnGk* this, PlayState* play) { this->unk_350 += 0x400; if ((this->unk_1E4 & 0x80) && (play->csCtx.frames == 250)) { - gSaveContext.save.weekEventReg[22] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_22_04); } this->unk_354 = Math_SinS(this->unk_350) * 0.006f * 0.06f; @@ -1027,7 +1027,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80B51760; } } else if (play->sceneId == SCENE_GORONRACE) { - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { this->actionFunc = func_80B51760; } else if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2)) { @@ -1042,7 +1042,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } } else if (ENGK_GET_F(&this->actor) == ENGK_F_2) { - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->actionFunc = func_80B51FD0; this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; @@ -1050,7 +1050,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { } else { Actor_Kill(&this->actor); } - } else if (!(gSaveContext.save.weekEventReg[22] & 4)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->unk_2E4 = 0; this->unk_318 = this->actor.cutscene; this->actor.flags |= ACTOR_FLAG_10; @@ -1074,7 +1074,7 @@ void EnGk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((ENGK_GET_F(&this->actor) == ENGK_F_1) || - ((ENGK_GET_F(&this->actor) == ENGK_F_0) && !(gSaveContext.save.weekEventReg[22] & 4))) { + ((ENGK_GET_F(&this->actor) == ENGK_F_0) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04))) { func_80B507A0(this, play); SkelAnime_Update(&this->skelAnime); Actor_TrackPlayer(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); @@ -1233,7 +1233,7 @@ void EnGk_Draw(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); - if ((ENGK_GET_F(&this->actor) == ENGK_F_0) && (gSaveContext.save.weekEventReg[22] & 4)) { + if ((ENGK_GET_F(&this->actor) == ENGK_F_0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { Matrix_RotateXS(-0x4000, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index b64edb3ae7..60ad089171 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -80,7 +80,7 @@ static u8 D_80951820[] = { /* 0x134 */ SCHEDULE_CMD_RET_TIME(12, 55, 13, 0, 20), /* 0x13A */ SCHEDULE_CMD_RET_NONE(), /* 0x13B */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(2, 0x1EB - 0x140), - /* 0x140 */ SCHEDULE_CMD_CHECK_FLAG_L(0x32, 0x01, 0x1CD - 0x145), + /* 0x140 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_50_01, 0x1CD - 0x145), /* 0x145 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_YADOYA, 0x17A - 0x149), /* 0x149 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(6, 0, 18, 0, 0x174 - 0x14F), /* 0x14F */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(18, 0, 21, 0, 0x16E - 0x155), @@ -463,7 +463,7 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { } case 2: - if (!(gSaveContext.save.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_40) && (this->unk_3E0 == 2)) { ActorCutscene_Stop(sp2A); } else { Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); @@ -632,8 +632,8 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) { switch (this->unk_3E0) { case 0: - if ((gSaveContext.save.weekEventReg[50] & 1) || (gSaveContext.save.weekEventReg[51] & 0x80) || - (gSaveContext.save.weekEventReg[75] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { ret = true; break; } @@ -739,14 +739,14 @@ s32 func_8094EE84(EnGm* this, PlayState* play) { this->actor.child = this->unk_268; this->unk_264 = func_8094EDBC(this, play); - if ((this->unk_258 == 5) && !(gSaveContext.save.weekEventReg[50] & 1) && - !(gSaveContext.save.weekEventReg[51] & 0x80) && !(gSaveContext.save.weekEventReg[75] & 2)) { + if ((this->unk_258 == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { this->unk_3A4 |= 0x20; } else if ((this->unk_258 != 1) && (this->unk_258 != 5) && (this->unk_258 != 7)) { this->unk_3A4 |= 0x20; } - if ((this->unk_258 == 3) && (gSaveContext.save.weekEventReg[75] & 1)) { + if ((this->unk_258 == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01)) { this->unk_3A4 &= ~0x20; } @@ -1137,7 +1137,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { func_8094E054(this, play, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_268 = al; - if (!(gSaveContext.save.weekEventReg[86] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_20)) { this->unk_3C8 = 2; this->unk_3CA = 2; this->unk_3CC = 8; @@ -1352,7 +1352,7 @@ s32 func_80950490(EnGm* this, PlayState* play) { }; s32 pad; - if ((gSaveContext.save.weekEventReg[50] & 1) || (gSaveContext.save.weekEventReg[51] & 0x80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80)) { if (this->unk_400 == 0) { this->unk_3C8 = 1; this->unk_3CA = 1; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 86b0b1b41c..662f6e2959 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -538,7 +538,7 @@ s32 func_80A1222C(EnGo* this, PlayState* play) { if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || - (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneId == SCENE_16GORON_HOUSE) && + (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04) && (play->sceneId == SCENE_16GORON_HOUSE) && (gSaveContext.sceneLayer == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { ret = true; } @@ -945,7 +945,7 @@ void func_80A132C8(EnGo* this, PlayState* play) { if ((fabsf(this->actor.playerHeightRel) > 20.0f) || (this->actor.xzDistToPlayer > 300.0f)) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else if ((player->transformation != PLAYER_FORM_GORON) || (ABS_ALT(temp_v1) >= 0x1C70) || - (gSaveContext.save.weekEventReg[21] & 4) || (gSaveContext.save.weekEventReg[21] & 8)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_21_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_21_08)) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else { SubS_UpdateFlags(&this->unk_390, 4, 7); @@ -953,7 +953,7 @@ void func_80A132C8(EnGo* this, PlayState* play) { } void func_80A133A8(EnGo* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[21] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_08)) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else { SubS_UpdateFlags(&this->unk_390, 4, 7); @@ -988,7 +988,7 @@ Actor* func_80A13400(EnGo* this, PlayState* play) { } void func_80A134B0(EnGo* this, PlayState* play, s32 arg2) { - if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.flags & ACTORCTX_FLAG_0) || arg2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_80) || (play->actorCtx.flags & ACTORCTX_FLAG_0) || arg2) { this->colliderSphere.dim.modelSphere.radius = 300; } else { this->colliderSphere.dim.modelSphere.radius = 380; @@ -1178,7 +1178,7 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { func_80A13728(this, play); this->unk_3C4++; this->unk_3C2 = 0; - gSaveContext.save.weekEventReg[88] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_88_40); } break; @@ -1198,19 +1198,19 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { if (this->unk_3C0 >= 65) { switch (player->transformation) { case PLAYER_FORM_HUMAN: - gSaveContext.save.weekEventReg[88] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_88_80); break; case PLAYER_FORM_GORON: - gSaveContext.save.weekEventReg[89] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_89_04); break; case PLAYER_FORM_ZORA: - gSaveContext.save.weekEventReg[89] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_89_02); break; case PLAYER_FORM_DEKU: - gSaveContext.save.weekEventReg[89] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_89_01); break; } ret = true; @@ -1376,7 +1376,7 @@ void func_80A143A8(EnGo* this, PlayState* play) { void func_80A14430(EnGo* this, PlayState* play) { if (((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 0)) || (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2))) && - (gSaveContext.save.weekEventReg[33] & 0x80)) { + (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80))) { func_80A14018(this, play); this->actionFunc = func_80A149B0; } else { @@ -1414,7 +1414,7 @@ void func_80A145AC(EnGo* this, PlayState* play) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && (((play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) || - !(gSaveContext.save.weekEventReg[21] & 8))) { + !CHECK_WEEKEVENTREG(WEEKEVENTREG_21_08))) { this->actor.child = func_80A13400(this, play); this->actor.child->child = &this->actor; func_80A141D4(this, play); @@ -1426,7 +1426,7 @@ void func_80A145AC(EnGo* this, PlayState* play) { } void func_80A14668(EnGo* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { func_80A14324(this, play); this->actionFunc = func_80A149B0; } else { @@ -1571,7 +1571,7 @@ void func_80A14B30(EnGo* this, PlayState* play) { this->unk_390 &= ~0x200; this->unk_390 |= 0x8000; this->actor.shape.yOffset = 0.0f; - } else if ((this->unk_3EC != 0) && (gSaveContext.save.weekEventReg[22] & 4)) { + } else if ((this->unk_3EC != 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->actor.scale.x = this->unk_3A4 - (Math_SinS(this->unk_3AE) * 0.001f); this->actor.scale.y = (Math_SinS(this->unk_3AE) * 0.001f) + this->unk_3A4; this->actor.scale.z = (Math_SinS(this->unk_3AE) * 0.001f) + this->unk_3A4; diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index cedd5c8942..eb7948ffb2 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -390,7 +390,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { } } - if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(gSaveContext.eventInf[4] & 2) && !this->shouldTurn && + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !CHECK_EVENTINF(EVENTINF_41) && !this->shouldTurn && (this->actor.xzDistToPlayer < 200.0f)) { EnGrasshopper_SetupApproachPlayer(this, play); } else { diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 5bd3826c77..6eb3bb909b 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -459,29 +459,29 @@ void func_8099874C(EnGs* this, PlayState* play) { this->unk_20C = -1; switch (this->unk_194) { case 1: - if (!(gSaveContext.save.weekEventReg[77] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_08)) { this->unk_20C = 6; - gSaveContext.save.weekEventReg[77] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_77_08); } break; case 3: - if (!(gSaveContext.save.weekEventReg[77] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_10)) { this->unk_20C = 6; - gSaveContext.save.weekEventReg[77] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_77_10); } break; case 2: - if (!(gSaveContext.save.weekEventReg[77] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_20)) { this->unk_20C = 6; - gSaveContext.save.weekEventReg[77] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_77_20); } break; } - if (!(gSaveContext.save.weekEventReg[90] & 0x10)) { - gSaveContext.save.weekEventReg[90] |= 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_90_10); this->unk_20C = 12; } diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index b1d7ed4228..b13bca1dd5 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -109,7 +109,7 @@ void EnGuardNuts_Init(Actor* thisx, PlayState* play) { sGuardCount++; // If you have returned deku princess guards will init burrowed. - if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { EnGuardNuts_SetupWait(this); } else { EnGuardNuts_Burrow(this, play); @@ -158,10 +158,10 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) { if (player->transformation == PLAYER_FORM_DEKU) { // this is the palace of... this->guardTextIndex = 0; - if ((gSaveContext.save.weekEventReg[17] & 4) && (!this->hasCompletedConversation)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_04) && (!this->hasCompletedConversation)) { // I told you not to enter!! this->guardTextIndex = 7; - } else if (gSaveContext.save.weekEventReg[12] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_40)) { // come to see the monkey again? this->guardTextIndex = 4; } @@ -234,7 +234,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { if (D_80ABBE38[this->guardTextIndex] == 2) { func_801477B4(play); D_80ABBE20 = 2; - gSaveContext.save.weekEventReg[12] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_12_40); EnGuardNuts_Burrow(this, play); } else { this->guardTextIndex++; @@ -300,7 +300,7 @@ void EnGuardNuts_Unburrow(EnGuardNuts* this, PlayState* play) { Vec3f digPos; // If you have returned Deku Princess, guards will not unburrow - if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); if ((yawDiff < 0x4000) && ((D_80ABBE20 == 0) || (this->actor.xzDistToPlayer > 150.0f))) { Math_Vec3f_Copy(&digPos, &this->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 342415fec5..76cd288439 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -119,10 +119,10 @@ void func_80BC6E10(EnGuruguru* this) { this->textIdIndex = 0; this->unk270 = 0; if (this->actor.params == 0) { - if (gSaveContext.save.weekEventReg[38] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_10)) { this->textIdIndex = 1; } - } else if (gSaveContext.save.weekEventReg[38] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_40)) { this->textIdIndex = 2; } else { this->textIdIndex = 3; @@ -131,8 +131,8 @@ void func_80BC6E10(EnGuruguru* this) { this->headZRotTarget = 0; this->unk268 = 1; this->actor.textId = textIDs[this->textIdIndex]; - if ((this->textIdIndex == 0 || this->textIdIndex == 1) && (gSaveContext.save.weekEventReg[77] & 4)) { - if (!(gSaveContext.save.weekEventReg[88] & 4)) { + if ((this->textIdIndex == 0 || this->textIdIndex == 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_04)) { this->actor.textId = 0x295F; } else { this->actor.textId = 0x2960; @@ -153,7 +153,7 @@ void func_80BC6F14(EnGuruguru* this, PlayState* play) { this->textIdIndex = 3; if (player->transformation == PLAYER_FORM_DEKU) { this->textIdIndex = 13; - if (gSaveContext.save.weekEventReg[79] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_04)) { this->textIdIndex = 14; } } @@ -212,16 +212,16 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { this->headZRotTarget = 0; if ((this->textIdIndex == 13) || (this->textIdIndex == 14)) { func_80151BB4(play, 0x13); - gSaveContext.save.weekEventReg[79] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_79_04); func_80BC6E10(this); return; } if (this->actor.params == 0) { if (this->actor.textId == 0x295F) { - gSaveContext.save.weekEventReg[88] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_88_04); } if (this->actor.textId == 0x292A) { - gSaveContext.save.weekEventReg[38] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_38_10); } func_80151BB4(play, 0x13); func_80BC6E10(this); @@ -232,7 +232,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { return; } if (this->textIdIndex == 12) { - gSaveContext.save.weekEventReg[38] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_38_40); func_801A3B48(0); func_80151BB4(play, 0x36); func_80151BB4(play, 0x13); @@ -297,7 +297,7 @@ void func_80BC7440(EnGuruguru* this, PlayState* play) { func_801A3B48(1); func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); this->unk268 = 0; - gSaveContext.save.weekEventReg[38] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_38_40); this->actionFunc = func_80BC7520; } else { Actor_PickUp(&this->actor, play, GI_MASK_BREMEN, 300.0f, 300.0f); diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index c7fc4eea86..756f37eb84 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -72,16 +72,14 @@ void EnHeishi_Init(Actor* thisx, PlayState* play) { if (this->paramsCopy == 0) { this->shouldSetHeadRotation = 1; - if (!(gSaveContext.save.weekEventReg[63] & 0x80) && - !((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) && !((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } else { this->colliderCylinder.dim.radius = 30; this->colliderCylinder.dim.height = 60; this->colliderCylinder.dim.yShift = 0; - if ((gSaveContext.save.weekEventReg[63] & 0x80) || - ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) || ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 5c14e43994..e100a2de30 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -142,7 +142,7 @@ void EnHg_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { Actor_Kill(&this->actor); } this->actor.targetMode = 1; @@ -326,7 +326,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { break; case 6: - gSaveContext.save.weekEventReg[75] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_75_20); Actor_Kill(&this->actor); break; } @@ -405,9 +405,8 @@ void EnHg_WaitForPlayerAction(EnHg* this, PlayState* play) { } else { if ((this->actor.xzDistToPlayer < 60.0f) && (fabsf(this->actor.playerHeightRel) < 40.0f)) { if ((this->actionFunc != EnHg_PlayCutscene) && (this->actionFunc != EnHg_HandleCsAction)) { - - if (!(gSaveContext.save.weekEventReg[61] & 2)) { - gSaveContext.save.weekEventReg[61] |= 2; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_61_02)) { + SET_WEEKEVENTREG(WEEKEVENTREG_61_02); this->cutsceneIndex = HG_CS_FIRST_ENCOUNTER; } else { this->cutsceneIndex = HG_CS_SUBSEQUENT_ENCOUNTER; diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index 3455e9014c..f7a9df82ab 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -103,12 +103,13 @@ void EnHgo_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&thisx->colChkInfo, NULL, &sColChkInfoInit); thisx->targetMode = 6; + this->eyeIndex = 0; this->blinkTimer = 0; this->textId = 0; this->talkFlags = TALK_FLAG_NONE; this->isInCutscene = false; - if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { EnHgo_SetupTalk(this); } else { thisx->draw = NULL; @@ -221,7 +222,7 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) { break; case 0x1590: - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { Message_StartTextbox(play, 0x1591, &this->actor); this->textId = 0x1591; break; @@ -341,7 +342,7 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { return true; } - if ((play->csCtx.state == 0) && (((gSaveContext.save.weekEventReg[75]) & 0x20)) && + if ((play->csCtx.state == CS_STATE_0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && (this->actionFunc == EnHgo_DoNothing)) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_Spawn(&play->actorCtx, play, ACTOR_ELF_MSG2, this->actor.focus.pos.x, this->actor.focus.pos.y, diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 5a1d6aef8e..30bdd339c4 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -792,7 +792,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->stateFlags = 0; } - if (((play->sceneId == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || + if (((play->sceneId == SCENE_KOEPONARACE) && (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_START)) || ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0))) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -2471,7 +2471,7 @@ void func_808819D8(EnHorse* this, PlayState* play) { func_8088168C(this); } - if (GET_RACE_FLAGS == 3) { + if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3) { this->rider->unk488 = 7; } else { EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1, diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 7b2e349e77..b2e745cadd 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -59,7 +59,7 @@ s32 func_808F8AA0(EnHorseGameCheck* this, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); - if (GET_RACE_FLAGS != RACE_FLAG_START) { + if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) { Actor_Kill(&this->dyna.actor); return false; } @@ -116,7 +116,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { this->unk_168 = 0; this->unk_174 = 0; - if (GET_RACE_FLAGS != RACE_FLAG_START) { + if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) { Actor_Kill(&this->dyna.actor); return false; } @@ -156,14 +156,14 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { return false; } - if (GET_RACE_FLAGS == RACE_FLAG_3) { + if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_02; - } else if (GET_RACE_FLAGS == RACE_FLAG_2) { + } else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) { play->transitionType = TRANS_TYPE_80; gSaveContext.nextTransitionType = TRANS_TYPE_03; - } else if (GET_RACE_FLAGS == RACE_FLAG_4) { - SET_RACE_FLAGS(RACE_FLAG_3); + } else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_4) { + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3); play->transitionType = TRANS_TYPE_02; gSaveContext.nextTransitionType = TRANS_TYPE_02; } @@ -252,7 +252,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - SET_RACE_FLAGS(RACE_FLAG_4); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_4); this->unk_174 = 60; } @@ -285,7 +285,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - SET_RACE_FLAGS(RACE_FLAG_3); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3); this->unk_174 = 60; } @@ -318,7 +318,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x02000000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - SET_RACE_FLAGS(RACE_FLAG_3); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3); this->unk_174 = 60; } @@ -347,7 +347,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x800; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - SET_RACE_FLAGS(RACE_FLAG_2); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_2); this->unk_174 = 60; } return true; diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 52cdc2b645..d43f1f90c3 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -25,22 +25,6 @@ enum { /* 10 */ ENHORSEGAMECHECK_FF_MAX, }; -#define RACE_FLAG_END 0 -#define RACE_FLAG_START 1 -#define RACE_FLAG_2 2 -#define RACE_FLAG_3 3 -#define RACE_FLAG_4 4 -#define RACE_FLAGS 7 - -#define GET_RACE_FLAGS (gSaveContext.save.weekEventReg[92] & RACE_FLAGS) - -#define SET_RACE_FLAGS(flag) \ - { \ - gSaveContext.save.weekEventReg[92] &= (u8)~RACE_FLAGS; \ - gSaveContext.save.weekEventReg[92] = \ - gSaveContext.save.weekEventReg[92] | (u8)((gSaveContext.save.weekEventReg[92] & ~RACE_FLAGS) | (flag)); \ - } (void)0 - typedef struct EnHorseGameCheck { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ s32 unk_15C; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index c02558a844..a10504720b 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -345,7 +345,7 @@ void func_808DF194(EnHorseLinkChild* this, PlayState* play) { sp4C = SkelAnime_Update(&this->skin.skelAnime); if ((sp4C != 0) || (this->unk_148 == 1) || (this->unk_148 == 0)) { - if ((gSaveContext.save.weekEventReg[1] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_01_20)) { f32 sp44 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); s32 pad; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index cb6e587594..1c619cec69 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -218,7 +218,7 @@ void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { play->nextEntrance = play->setupExitList[HS_GET_EXIT_INDEX(&this->actor)]; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[25] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_25_08); this->actionFunc = EnHs_DoNothing; } } @@ -239,7 +239,7 @@ void func_809533A0(EnHs* this, PlayState* play) { } else if (this->stateFlags & 0x10) { sp1E = 0x33F9; this->stateFlags &= ~0x10; - } else if (gSaveContext.save.weekEventReg[25] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_08)) { sp1E = 0x33F4; } else { sp1E = 0x33F5; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index af614450df..8d89464fe7 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -25,7 +25,7 @@ static u8 D_80BF3260[] = { /* 0x05 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_TOWN, 0x57 - 0x09), /* 0x09 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(15, 25, 15, 45, 0x51 - 0x0F), /* 0x0F */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(15, 45, 15, 50, 0x4B - 0x15), - /* 0x15 */ SCHEDULE_CMD_CHECK_FLAG_S(0x4B, 0x10, 0x1A - 0x19), + /* 0x15 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_75_10, 0x1A - 0x19), /* 0x19 */ SCHEDULE_CMD_RET_NONE(), /* 0x1A */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(16, 50, 16, 55, 0x45 - 0x20), /* 0x20 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(16, 55, 17, 15, 0x3F - 0x26), @@ -42,7 +42,7 @@ static u8 D_80BF3260[] = { /* 0x5B */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(15, 45, 15, 50, 0xAF - 0x61), /* 0x61 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(15, 50, 16, 10, 0xA9 - 0x67), /* 0x67 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(16, 10, 16, 30, 0xA3 - 0x6D), - /* 0x6D */ SCHEDULE_CMD_CHECK_FLAG_S(0x4B, 0x10, 0x8A - 0x71), + /* 0x6D */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_75_10, 0x8A - 0x71), /* 0x71 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(16, 30, 16, 50, 0x84 - 0x77), /* 0x77 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(16, 50, 16, 55, 0x7E - 0x7D), /* 0x7D */ SCHEDULE_CMD_RET_NONE(), @@ -372,7 +372,7 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { case 1: case 3: - if (!(gSaveContext.save.weekEventReg[75] & 0x10) && (this->unk_3F6 == 3)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_10) && (this->unk_3F6 == 3)) { ActorCutscene_Stop(sp2A); this->unk_3F6 = 5; } else { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index ba51fb8585..98e7647e89 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -224,7 +224,7 @@ s32 func_808F33B8(void) { s32 ret = (((gSaveContext.save.day == 1) && ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0)))) || (gSaveContext.save.day >= 2)) && - !(gSaveContext.save.weekEventReg[22] & 1); + !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01); return ret; } @@ -336,7 +336,7 @@ void func_808F38F8(EnIn* this, PlayState* play) { } void func_808F395C(EnIn* this, PlayState* play) { - if (this->unk4B0 == RACE_FLAG_END) { + if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_END) { this->actionFunc = func_808F5A94; } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -352,30 +352,30 @@ void func_808F39DC(EnIn* this, PlayState* play) { u16 textId = 0; if (gSaveContext.save.day != 3) { - switch (GET_RACE_FLAGS) { - case RACE_FLAG_2: + switch (GET_WEEKEVENTREG_RACE_FLAGS) { + case WEEKEVENTREG_RACE_FLAG_2: textId = 0x347A; break; - case RACE_FLAG_3: + case WEEKEVENTREG_RACE_FLAG_3: textId = 0x3476; break; } - SET_RACE_FLAGS(RACE_FLAG_END); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END); } else { - switch (GET_RACE_FLAGS) { - case RACE_FLAG_2: + switch (GET_WEEKEVENTREG_RACE_FLAGS) { + case WEEKEVENTREG_RACE_FLAG_2: textId = 0x349D; break; - case RACE_FLAG_3: + case WEEKEVENTREG_RACE_FLAG_3: textId = 0x3499; break; } - SET_RACE_FLAGS(RACE_FLAG_END); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END); } this->actor.flags |= ACTOR_FLAG_10000; this->actor.textId = textId; this->actionFunc = func_808F395C; - if (this->unk4B0 == RACE_FLAG_2) { + if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0); @@ -458,7 +458,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { u16 textId = 0; if (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) { - if (!(gSaveContext.save.weekEventReg[63] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) { textId = 0x34A9; } else if (this->unk4AC & 8) { textId = 0x34B1; @@ -475,14 +475,14 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x345C; } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x3460; - } else if (!(gSaveContext.save.weekEventReg[15] & 8)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_15_08)) { textId = 0x3458; } else { textId = 0x345B; } break; case 1: - if (!(gSaveContext.save.weekEventReg[15] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_15_10)) { textId = 0x3463; } else { textId = 0x346B; @@ -494,7 +494,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || gSaveContext.save.playerForm == PLAYER_FORM_GORON) { textId = 0x3484; - } else if (!(gSaveContext.save.weekEventReg[56] & 4)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_04)) { textId = 0x346D; } else { textId = 0x3482; @@ -505,7 +505,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x348A; } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x348B; - } else if (!(gSaveContext.save.weekEventReg[16] & 1)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_01)) { textId = 0x3486; } else { textId = 0x3489; @@ -514,7 +514,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { case 5: if (func_808F33B8()) { textId = 0x34B3; - } else if (!(gSaveContext.save.weekEventReg[16] & 2)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_02)) { textId = 0x348E; } else { textId = 0x3493; @@ -526,7 +526,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || gSaveContext.save.playerForm == PLAYER_FORM_GORON) { textId = 0x34A7; - } else if (!(gSaveContext.save.weekEventReg[16] & 4)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_04)) { textId = 0x3495; } else { textId = 0x34A5; @@ -578,7 +578,7 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) func_8019F208(); if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { Rupees_ChangeBy(-play->msgCtx.unk1206C); - if (!(gSaveContext.save.weekEventReg[57] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { func_808F4108(this, play, 0x3474); } else if (this->unk4AC & 8) { func_808F4108(this, play, 0x3475); @@ -604,7 +604,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, func_8019F208(); if (gSaveContext.save.playerData.rupees >= fee) { Rupees_ChangeBy(-fee); - if (!(gSaveContext.save.weekEventReg[57] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { if (arg4 != 0) { Actor_ContinueText(play, &this->actor, 0x3474); } else { @@ -635,7 +635,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, s32 func_808F43E0(EnIn* this) { this->unk48C = 0; this->actor.textId = 0; - SET_RACE_FLAGS(RACE_FLAG_END); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END); return 0; } @@ -652,7 +652,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x34A9: func_808F4108(this, play, 0x34AA); - gSaveContext.save.weekEventReg[63] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_63_40); ret = false; break; case 0x34AA: @@ -683,7 +683,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0: switch (textId) { case 0x3458: - gSaveContext.save.weekEventReg[15] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_15_08); Actor_ContinueText(play, &this->actor, 0x3459); ret = false; break; @@ -732,7 +732,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 1: switch (textId) { case 0x3463: - gSaveContext.save.weekEventReg[15] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_15_10); Actor_ContinueText(play, &this->actor, 0x3464); ret = false; break; @@ -808,21 +808,21 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3472: func_808F43E0(this); - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); ret = true; break; case 0x3473: - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); break; case 0x3475: - SET_RACE_FLAGS(RACE_FLAG_START); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[57] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_57_01); break; case 0x3478: if (msgCtx->choiceIndex == 0) { @@ -830,14 +830,14 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } else { func_8019F230(); - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x3479); ret = false; } break; case 0x347B: func_808F4108(this, play, 0x347C); - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; } @@ -846,8 +846,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { switch (textId) { case 0x346D: func_808F4108(this, play, 0x346E); - gSaveContext.save.weekEventReg[56] |= 4; - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_04); + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; case 0x346F: @@ -856,7 +856,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3482: func_808F4108(this, play, 0x3483); - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; case 0x3484: @@ -876,7 +876,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; break; case 0x3477: - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x3478); ret = false; break; @@ -887,7 +887,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { Actor_ContinueText(play, &this->actor, 0x347E); ret = false; } else { - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x347B); ret = false; } @@ -943,7 +943,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { switch (textId) { case 0x3486: Actor_ContinueText(play, &this->actor, 0x3487); - gSaveContext.save.weekEventReg[16] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_16_01); ret = false; break; case 0x3487: @@ -984,7 +984,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x348E: case 0x34B3: Actor_ContinueText(play, &this->actor, 0x348F); - gSaveContext.save.weekEventReg[16] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_16_02); ret = false; break; case 0x3493: @@ -1036,8 +1036,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3495: func_808F4108(this, play, 0x3496); - gSaveContext.save.weekEventReg[16] |= 4; - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_16_04); + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; case 0x3497: @@ -1052,11 +1052,11 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x34A5: func_808F4108(this, play, 0x34A6); - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; case 0x3473: - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); break; case 0x3474: @@ -1064,12 +1064,12 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; break; case 0x3475: - SET_RACE_FLAGS(RACE_FLAG_START); + SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[57] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_57_01); break; case 0x349D: EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); @@ -1078,7 +1078,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { Actor_ContinueText(play, &this->actor, 0x34A1); ret = false; } else { - gSaveContext.save.weekEventReg[56] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x349E); ret = false; } @@ -1161,13 +1161,13 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3472: func_808F43E0(this); - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); ret = true; break; case 0x349E: func_808F4108(this, play, 0x349F); - gSaveContext.save.weekEventReg[56] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; } @@ -1303,8 +1303,8 @@ void func_808F5A94(EnIn* this, PlayState* play) { void func_808F5B58(EnIn* this, PlayState* play) { if (func_800F41E4(play, &play->actorCtx)) { - if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || - gSaveContext.save.weekEventReg[56] & 8) { + if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) { if (gSaveContext.save.day == 3) { func_808F5728(play, this, 6, &this->unk48C); } else { @@ -1312,7 +1312,7 @@ void func_808F5B58(EnIn* this, PlayState* play) { } } } else if (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER || - (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40)) { + (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) { if (gSaveContext.save.day == 3) { func_808F5728(play, this, 4, &this->unk48C); } else { @@ -1322,11 +1322,11 @@ void func_808F5B58(EnIn* this, PlayState* play) { } void func_808F5C98(EnIn* this, PlayState* play) { - if (this->unk4B0 == RACE_FLAG_END) { + if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_END) { this->actionFunc = func_808F5B58; } - if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || - gSaveContext.save.weekEventReg[56] & 8) { + if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) { if (gSaveContext.save.day != 3) { func_808F5728(play, this, 2, &this->unk48C); } else { @@ -1334,7 +1334,7 @@ void func_808F5C98(EnIn* this, PlayState* play) { } } if (this->unk4A8 == 2) { - if (this->unk4B0 == RACE_FLAG_2) { + if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0); @@ -1366,7 +1366,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->unk48C = 0; this->unk4AC = 0; type = ENIN_GET_TYPE(thisx); - this->unk4B0 = GET_RACE_FLAGS; + this->unk4B0 = GET_WEEKEVENTREG_RACE_FLAGS; if (type == ENIN_HORSE_RIDER_BLUE_SHIRT || type == ENIN_BLUE_SHIRT) { this->unk4AC |= 8; } @@ -1387,19 +1387,21 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH(&this->actor), 0x3F); this->unk23D = 0; if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) { - if (GET_RACE_FLAGS == RACE_FLAG_2 || GET_RACE_FLAGS == RACE_FLAG_3) { - gSaveContext.save.weekEventReg[56] &= (u8)~8; + if ((GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) || + (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); this->unk4A8 = 0; this->unk4AC |= 2; func_808F35AC(this, play); this->unk23C = 0; D_801BDAA0 = 0; - if (GET_RACE_FLAGS == RACE_FLAG_2) { + + if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) { EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_6); } else { EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_4); } - if (GET_RACE_FLAGS == RACE_FLAG_2) { + if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) { this->skelAnime.curFrame = ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.endFrame; } if (this->unk4AC & 8) { @@ -1408,8 +1410,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_808F5C98; } } else { - if (GET_RACE_FLAGS != RACE_FLAG_START) { - gSaveContext.save.weekEventReg[56] &= (u8)~8; + if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); this->unk23C = 0; this->unk4AC |= 2; if (type == ENIN_BLUE_SHIRT) { @@ -1417,7 +1419,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0); this->actionFunc = func_808F5A94; } else { - if (gSaveContext.save.weekEventReg[52] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KANBAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0xF); @@ -1428,7 +1430,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { } } } else { - if (gSaveContext.save.weekEventReg[52] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { Actor_Kill(&this->actor); } else { EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_7); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 38fb922aa1..5edfe26370 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1283,7 +1283,7 @@ void func_80B451A0(EnInvadepoh* this, PlayState* play) { } if (D_80B4E940 == 0) { - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { D_80B4E940 = 3; } else { D_80B4E940 = 4; @@ -1745,8 +1745,9 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { if (this->bankIndex < 0) { Actor_Kill(&this->actor); } + if (temp == 5) { - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); return; } @@ -1762,7 +1763,7 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { return; } } else if (temp == 0xC) { - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } D_80B503F4 = this; @@ -1817,7 +1818,7 @@ void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play) { if (this->bankIndex < 0) { Actor_Kill(&this->actor); } - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->actor); } D_80B503F8 = this; @@ -1954,7 +1955,7 @@ void func_80B46FA8(EnInvadepoh* this, PlayState* play) { s32 i; if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - gSaveContext.save.weekEventReg[22] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_22_01); func_80B47064(this); } else { func_80B457A0(this); @@ -2039,7 +2040,7 @@ void func_80B47298(EnInvadepoh* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; gSaveContext.nextTransitionType = TRANS_TYPE_72; - gSaveContext.save.weekEventReg[89] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_89_10); func_80B47304(this); } @@ -3059,7 +3060,7 @@ void func_80B49DFC(EnInvadepoh* this, PlayState* play) { substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[54] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_54_10); this->actor.textId = 0x332E; } func_80B49BD0(this); @@ -3084,8 +3085,8 @@ void func_80B49F88(Actor* thisx, PlayState* play) { func_80B44C24(this, play); func_80B43F0C(this); func_80B4516C(this); - if (0x20 & gSaveContext.save.weekEventReg[21]) { - if (gSaveContext.save.weekEventReg[54] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; } else { this->actor.textId = 0x332D; @@ -3286,7 +3287,7 @@ void func_80B4A81C(EnInvadepoh* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { - gSaveContext.save.weekEventReg[54] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_54_10); this->actor.textId = 0x332E; } if (this->pathIndex == this->endPoint) { @@ -3325,8 +3326,8 @@ void func_80B4A9C8(Actor* thisx, PlayState* play) { func_80B43F0C(this); func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); - if (gSaveContext.save.weekEventReg[21] & 0x20) { - if (gSaveContext.save.weekEventReg[54] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { this->actor.textId = 0x332E; } else { this->actor.textId = 0x332D; @@ -3374,7 +3375,7 @@ void func_80B4ACDC(EnInvadepoh* this) { } void func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { this->actor.draw = func_80B4E324; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); func_80B4AD3C(this); @@ -3402,7 +3403,7 @@ void func_80B4ADB8(EnInvadepoh* this) { void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x3331) { - if (gSaveContext.save.weekEventReg[22] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { EnInvadepoh_SetTextID(this, play, 0x3334); func_80151BB4(play, 0x1D); func_80151BB4(play, 5); @@ -3434,7 +3435,7 @@ void func_80B4AEDC(EnInvadepoh* this, PlayState* play) { } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.weekEventReg[22] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_22_02); func_80B4AF80(this); } else { Actor_PickUp(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 181b88e4ff..9bafd7ea60 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -140,7 +140,7 @@ void EnJcMato_Update(Actor* thisx, PlayState* play) { EnJcMato* this = THIS; this->actionFunc(this, play); - if (!(gSaveContext.eventInf[4] & 1)) { + if (!CHECK_EVENTINF(EVENTINF_40)) { EnJcMato_CheckForHit(this, play); } } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 259d58b18f..e53eb8eb94 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -493,14 +493,14 @@ void EnJg_Talk(EnJg* this, PlayState* play) { temp = this->textId; if ((temp == 0xDBB) || (temp == 0xDBC)) { - if (!(gSaveContext.save.weekEventReg[24] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_24_80)) { // The player hasn't talked to the Goron Child at least once, so they can't learn // the Lullaby Intro. End the current conversation with the player. play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; - } else if (((gSaveContext.save.weekEventReg[24] & 0x40)) || + } else if ((CHECK_WEEKEVENTREG(WEEKEVENTREG_24_40)) || (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO))) { // The player already has the Lullaby or Lullaby Intro, so say "I'm counting on you" this->textId = EnJg_GetNextTextId(this); @@ -700,7 +700,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { } else { this->csAction = 99; this->freezeTimer = 1000; - gSaveContext.save.weekEventReg[24] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_24_40); this->actionFunc = EnJg_Idle; } } @@ -830,7 +830,7 @@ s32 EnJg_GetNextTextId(EnJg* this) { return 0xDDC; // Everyone would accept you case 0xDDC: // Everyone would accept you - gSaveContext.save.weekEventReg[77] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_77_80); return 0xDDD; // Think it over slowly default: @@ -848,7 +848,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play) { if (!EN_JG_IS_IN_GORON_SHRINE(&this->actor)) { if (player->transformation == PLAYER_FORM_GORON) { - if ((gSaveContext.save.weekEventReg[24] & 0x10) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_10) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO)) { // The player has already talked as a Goron at least once. return 0xDBC; // Following me won't do you any good @@ -858,7 +858,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play) { return 0xDB6; // "Hunh???" } - if (gSaveContext.save.weekEventReg[24] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_20)) { // The player has already talked as a non-Goron at least once. return 0xDB5; // This is our problem (repeat) } @@ -868,7 +868,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play) { } if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { // The player has heard the Goron Shrine cheer as a Goron at least once. return 0xDDE; // Come back after entering the race } @@ -908,9 +908,9 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play if (this->textId == 0xDAC) { this->action = EN_JG_ACTION_FIRST_THAW; } else if (this->textId == 0xDAE) { - gSaveContext.save.weekEventReg[24] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_24_20); } else if (this->textId == 0xDB6) { - gSaveContext.save.weekEventReg[24] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_24_10); } Message_StartTextbox(play, this->textId, &this->actor); diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 6f313f0d24..8e82716588 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -141,7 +141,7 @@ void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) { EnJgameTsn* this = THIS; Collider_DestroyCylinder(play, &this->collider); - gSaveContext.save.weekEventReg[90] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_20); } void func_80C13B74(EnJgameTsn* this) { @@ -286,7 +286,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { func_801A2BB8(0x25); play->interfaceCtx.unk_280 = 1; func_80112AFC(play); - gSaveContext.save.weekEventReg[90] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_90_20); Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); this->actionFunc = func_80C1418C; } @@ -379,11 +379,11 @@ void func_80C14540(EnJgameTsn* this) { void func_80C14554(EnJgameTsn* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if (!(gSaveContext.save.weekEventReg[82] & 0x10)) { - gSaveContext.save.weekEventReg[82] |= 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_82_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_82_10); } func_80C145FC(this); - } else if (gSaveContext.save.weekEventReg[82] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_10)) { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); @@ -480,7 +480,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { func_801477B4(play); gSaveContext.minigameState = 3; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; - gSaveContext.save.weekEventReg[90] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_20); func_80C144E4(this); break; diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 51296413ee..e22b6ba733 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -112,9 +112,9 @@ void EnJs_Init(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gMoonChildSittingAnim); func_8016566C(0x3C); - if (gSaveContext.save.weekEventReg[84] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_20)) { Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY)); - gSaveContext.save.weekEventReg[84] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_84_20); } break; case 1: @@ -850,7 +850,7 @@ void func_8096A1E8(EnJs* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = func_8096A38C; Message_StartTextbox(play, 0x2208, &this->actor); - gSaveContext.save.weekEventReg[84] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_84_20); func_809696EC(this, 0); } else { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 4203feb6bd..1ce96c4610 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -177,14 +177,14 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { } if (this->aboveGroundStatus != 0) { - if (gSaveContext.save.weekEventReg[79] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08)) { this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; EnKakasi_SetupIdleUnderground(this); } else { Actor_SetFocus(&this->picto.actor, 60.0f); this->picto.validationFunc = EnKakasi_ValidatePictograph; - if (gSaveContext.save.weekEventReg[83] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_83_01)) { EnKakasi_InitTimeSkipDialogue(this); } else { EnKakasi_SetupIdleStanding(this); @@ -301,12 +301,12 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { if (gSaveContext.respawnFlag != -4 && gSaveContext.respawnFlag != -8) { if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && - !(gSaveContext.eventInf[1] & 0x80)) { + !CHECK_EVENTINF(EVENTINF_17)) { if (this->picto.actor.textId == 0) { // dialogue after skipped time 'did you feel that? went by in an instant' this->picto.actor.textId = 0x1653; - gSaveContext.save.weekEventReg[83] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_01); this->talkState = TEXT_STATE_5; player->stateFlags1 |= PLAYER_STATE1_20; this->picto.actor.flags |= ACTOR_FLAG_10000; @@ -937,12 +937,12 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.respawnFlag = -4; - gSaveContext.eventInf[2] |= 0x80; + SET_EVENTINF(EVENTINF_27); } else { gSaveContext.save.time = CLOCK_TIME(18, 0); gSaveContext.respawnFlag = -8; } - gSaveContext.save.weekEventReg[83] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_83_01); this->unk190 = 0; this->actionFunc = EnKakasi_DoNothing; } @@ -1011,7 +1011,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Math_ApproachF(&this->picto.actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); if (fabsf(this->picto.actor.shape.yOffset + 6000.0f) < 10.0f) { - gSaveContext.save.weekEventReg[79] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_79_08); func_800B7298(play, &this->picto.actor, 6); ActorCutscene_Stop(this->actorCutscenes[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; @@ -1029,7 +1029,7 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { } void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { - if ((gSaveContext.save.weekEventReg[79] & 8) && this->picto.actor.xzDistToPlayer < this->songSummonDist && + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && this->picto.actor.xzDistToPlayer < this->songSummonDist && (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { this->picto.actor.flags &= ~ACTOR_FLAG_8000000; play->msgCtx.ocarinaMode = 4; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 8a3176badf..7a28cf0fc3 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -148,7 +148,7 @@ void EnKendoJs_Destroy(Actor* thisx, PlayState* play) { EnKendoJs* this = THIS; Collider_DestroyCylinder(play, &this->collider); - gSaveContext.save.weekEventReg[82] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_82_08); } void func_80B26538(EnKendoJs* this) { @@ -504,7 +504,7 @@ void func_80B27030(EnKendoJs* this, PlayState* play) { } void func_80B2714C(EnKendoJs* this) { - gSaveContext.save.weekEventReg[82] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_82_08); this->unk_28C = 1; this->unk_290 = 0; this->unk_284 = 0; @@ -565,14 +565,14 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { } if (this->unk_284 == 7) { - gSaveContext.save.weekEventReg[82] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_82_08); func_80B26AE8(this); } } } void func_80B273D0(EnKendoJs* this) { - gSaveContext.save.weekEventReg[82] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_82_08); this->unk_290 = 120; this->unk_284 = 0; this->unk_286 = 1; @@ -605,7 +605,7 @@ void func_80B274BC(EnKendoJs* this, PlayState* play) { this->unk_288 = 0x272E; } player->stateFlags1 |= PLAYER_STATE1_20; - gSaveContext.save.weekEventReg[82] &= (u8)~8; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_82_08); func_80B26AE8(this); return; } @@ -648,7 +648,7 @@ void func_80B276D8(EnKendoJs* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80B27760(this); - } else if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_20)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 800.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 800.0f, 100.0f); @@ -663,8 +663,8 @@ void func_80B27774(EnKendoJs* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { - gSaveContext.save.weekEventReg[63] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_63_20); Message_StartTextbox(play, 0x272F, &this->actor); this->unk_288 = 0x272F; } else { diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 62b529b3da..bdace8290e 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -58,10 +58,10 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->zubora = EnKgy_FindZubora(play); this->iceBlock = EnKgy_FindIceBlock(play); Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); - if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || (gSaveContext.save.weekEventReg[33] & 0x80)) { + if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { Flags_SetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); play->envCtx.lightSettingOverride = 1; - gSaveContext.save.weekEventReg[21] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_21_01); if (!func_80B40D64(play)) { EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); this->actionFunc = func_80B425A0; @@ -78,7 +78,7 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->actor.textId = 0xC50; } } else { - if (gSaveContext.save.weekEventReg[20] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_80)) { EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); } else { EnKgy_ChangeAnim(this, 0, ANIMMODE_LOOP, 0); @@ -1054,7 +1054,7 @@ void func_80B42D28(EnKgy* this, PlayState* play) { func_80B40BC0(this, 1); } else { EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f); - gSaveContext.save.weekEventReg[20] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_20_80); } func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); @@ -1062,7 +1062,7 @@ void func_80B42D28(EnKgy* this, PlayState* play) { if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor))) { this->actor.textId = 0xC30; this->actionFunc = func_80B4296C; - gSaveContext.save.weekEventReg[21] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_21_01); } else if (this->actor.xzDistToPlayer < 200.0f) { if (this->unk_2D2 == 4) { this->actor.textId = 0xC2D; diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index e15d20fc86..511a5dc468 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -235,19 +235,19 @@ void EnKujiya_FinishGivePrize(EnKujiya* this, PlayState* play) { s32 EnKujiya_CheckBoughtTicket(void) { switch (CURRENT_DAY) { case 1: - if (gSaveContext.save.weekEventReg[33] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_10)) { return true; } break; case 2: - if (gSaveContext.save.weekEventReg[33] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_20)) { return true; } break; case 3: - if (gSaveContext.save.weekEventReg[33] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_40)) { return true; } break; @@ -258,15 +258,15 @@ s32 EnKujiya_CheckBoughtTicket(void) { void EnKujiya_SetBoughtTicket(void) { switch (CURRENT_DAY) { case 1: - gSaveContext.save.weekEventReg[33] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_33_10); break; case 2: - gSaveContext.save.weekEventReg[33] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_33_20); break; case 3: - gSaveContext.save.weekEventReg[33] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_33_40); break; } } @@ -277,15 +277,15 @@ void EnKujiya_SetBoughtTicket(void) { void EnKujiya_UnsetBoughtTicket(void) { switch (CURRENT_DAY) { case 1: - gSaveContext.save.weekEventReg[33] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_10); break; case 2: - gSaveContext.save.weekEventReg[33] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_20); break; case 3: - gSaveContext.save.weekEventReg[33] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_40); break; } } diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index 6eac82838b..f6647cc0b0 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -181,15 +181,15 @@ s32 func_80AE9B4C(s32 arg0, s32 arg1) { s32 func_80AE9B8C() { s32 ret = 0; - if (gSaveContext.save.weekEventReg[14] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { ret = 1; } - if (gSaveContext.save.weekEventReg[14] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20)) { ret++; } - if (gSaveContext.save.weekEventReg[14] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_40)) { ret++; } @@ -329,7 +329,7 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { if (gSaveContext.save.time > CLOCK_TIME(23, 30) || gSaveContext.save.time <= CLOCK_TIME(6, 0)) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; - } else if (gSaveContext.save.weekEventReg[14] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { Message_StartTextbox(play, 0x27D9, &this->actor); this->textId = 0x27D9; } else { @@ -343,13 +343,13 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; } else { - if (gSaveContext.save.weekEventReg[14] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20)) { Message_StartTextbox(play, 0x27DB, &this->actor); this->textId = 0x27DB; break; } - if (gSaveContext.save.weekEventReg[14] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { Message_StartTextbox(play, 0x27DC, &this->actor); this->textId = 0x27DC; } else { @@ -363,7 +363,7 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { if (gSaveContext.save.time > CLOCK_TIME(23, 30) || gSaveContext.save.time <= CLOCK_TIME(6, 0)) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; - } else if (gSaveContext.save.weekEventReg[14] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_40)) { Message_StartTextbox(play, 0x27DE, &this->actor); this->textId = 0x27DE; } else if (func_80AE9B8C() == 2) { @@ -382,7 +382,7 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { if (Flags_GetSwitch(play, 0x40)) { Flags_UnsetSwitch(play, 0x40); Inventory_SaveDekuPlaygroundHighScore(4); - if ((gSaveContext.save.weekEventReg[14] & 0x10) && (gSaveContext.save.weekEventReg[14] & 0x20) && + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && CURRENT_DAY == 3) { this->unk_354 = 0; Message_StartTextbox(play, 0x27F4, &this->actor); @@ -833,12 +833,12 @@ void func_80AEB584(EnLiftNuts* this) { void func_80AEB598(EnLiftNuts* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if ((gSaveContext.save.weekEventReg[14] & 0x10) && (gSaveContext.save.weekEventReg[14] & 0x20) && - (CURRENT_DAY == 3) && !(gSaveContext.save.weekEventReg[14] & 0x80)) { - gSaveContext.save.weekEventReg[14] |= 0x80; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && (CURRENT_DAY == 3) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_14_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_14_80); } func_80AEB684(this); - } else if ((this->textId == 0x27F4) && !(gSaveContext.save.weekEventReg[14] & 0x80)) { + } else if ((this->textId == 0x27F4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_14_80)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -851,8 +851,7 @@ void func_80AEB684(EnLiftNuts* this) { void func_80AEB698(EnLiftNuts* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if ((gSaveContext.save.weekEventReg[14] & 0x10) && (gSaveContext.save.weekEventReg[14] & 0x20) && - CURRENT_DAY == 3) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && (CURRENT_DAY == 3)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 13); Message_StartTextbox(play, 0x27F5, &this->actor); this->textId = 0x27F5; @@ -868,15 +867,15 @@ void func_80AEB698(EnLiftNuts* this, PlayState* play) { func_80AEABF0(this); switch (CURRENT_DAY) { case 1: - gSaveContext.save.weekEventReg[14] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_14_10); break; case 2: - gSaveContext.save.weekEventReg[14] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_14_20); break; case 3: - gSaveContext.save.weekEventReg[14] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_14_40); break; default: diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index 2a667d3ad2..195a119baf 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -300,7 +300,7 @@ void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[17] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_17_04); } } diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index a244c3ca81..3d97839a07 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -143,7 +143,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_20000; this->isCharging = false; - if (gSaveContext.save.weekEventReg[23] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_02)) { player->unk_B08[0] = 1.0f; this->collider.info.toucher.damage = sDamages[this->type + ENMTHUNDER_TYPE_MAX]; this->subtype = ENMTHUNDER_SUBTYPE_SPIN_GREAT; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index c83698e6f8..b242aec34d 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -200,7 +200,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { if (CURRENT_DAY == 1) { this->type = MA4_TYPE_DAY1; - } else if (gSaveContext.save.weekEventReg[22] & 1) { // Aliens defeated + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { this->type = MA4_TYPE_ALIENS_DEFEATED; } else { this->type = MA4_TYPE_ALIENS_WON; @@ -238,7 +238,7 @@ void EnMa4_Destroy(Actor* thisx, PlayState* play) { EnMa4* this = THIS; Collider_DestroyCylinder(play, &this->collider); - gSaveContext.save.weekEventReg[8] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); } // Running in circles in the ranch @@ -372,7 +372,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3341: if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - gSaveContext.save.weekEventReg[21] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_21_20); Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { @@ -388,7 +388,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3346: if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - gSaveContext.save.weekEventReg[21] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_21_20); Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { @@ -603,7 +603,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { break; case 0x3358: - if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || !(CHECK_QUEST_ITEM(QUEST_SONG_EPONA))) { + if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { Message_StartTextbox(play, 0x335C, &this->actor); this->textId = 0x335C; func_80151BB4(play, 5); @@ -690,7 +690,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { play->interfaceCtx.unk_280 = 1; Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - gSaveContext.save.weekEventReg[8] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_08_01); func_80112AFC(play); player->stateFlags1 |= PLAYER_STATE1_20; this->actionFunc = EnMa4_SetupHorsebackGameWait; @@ -726,7 +726,7 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { } void EnMa4_SetupHorsebackGameEnd(EnMa4* this, PlayState* play) { - gSaveContext.save.weekEventReg[8] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); this->actionFunc = EnMa4_HorsebackGameEnd; Audio_QueueSeqCmd(NA_BGM_STOP); Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); @@ -873,7 +873,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { switch (this->type) { case MA4_TYPE_DAY1: if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - if ((gSaveContext.save.weekEventReg[21] & 0x80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(play, 0x3337, &this->actor); this->textId = 0x3337; @@ -881,11 +881,11 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { } else { Message_StartTextbox(play, 0x3335, &this->actor); this->textId = 0x3335; - gSaveContext.save.weekEventReg[21] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_21_80); } } else if (this->state == MA4_STATE_DEFAULT) { - if ((gSaveContext.save.weekEventReg[21] & 0x40)) { - if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { Message_StartTextbox(play, 0x3346, &this->actor); this->textId = 0x3346; } else { @@ -895,7 +895,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { } else { Message_StartTextbox(play, 0x3338, &this->actor); this->textId = 0x3338; - gSaveContext.save.weekEventReg[21] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_21_40); } } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) { @@ -929,7 +929,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { case MA4_TYPE_ALIENS_DEFEATED: if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - if ((gSaveContext.save.weekEventReg[21] & 0x80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(play, 0x3337, &this->actor); this->textId = 0x3337; @@ -937,7 +937,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { } else { Message_StartTextbox(play, 0x3335, &this->actor); this->textId = 0x3335; - gSaveContext.save.weekEventReg[21] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_21_80); } } else if (this->state == MA4_STATE_DEFAULT) { Message_StartTextbox(play, 0x3354, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index bd9c39e7d7..ae24321453 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -153,7 +153,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { this->unk320 = 0; this->eyeTexIndex = 0; - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_SetFaceExpression(this, 0, 1); } else { EnMaYto_SetFaceExpression(this, 5, 2); @@ -186,19 +186,19 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: - if (CURRENT_DAY == 3 && !(gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 3 && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; case MA_YTO_TYPE_DINNER: - if (CURRENT_DAY != 1 && (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY != 1 && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; case MA_YTO_TYPE_BARN: - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { if (((this->actor.params & 0x0F00) >> 8) != 0) { return false; } @@ -211,9 +211,8 @@ s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { break; case MA_YTO_TYPE_AFTERMILKRUN: - // if (!(ProtectedCremia) && !(gSaveContext.save.weekEventReg[52] & 2)) || (PlayedMilkMinigame)) - if ((!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) || - (gSaveContext.save.weekEventReg[14] & 1)) { + if ((!CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_02)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_14_01)) { return false; } break; @@ -240,8 +239,7 @@ void EnMaYto_InitAnimation(EnMaYto* this, PlayState* play) { break; case MA_YTO_TYPE_BARN: - // if (AliensDefeated) - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_ChangeAnim(this, 12); } else { EnMaYto_ChangeAnim(this, 8); @@ -279,7 +277,7 @@ void EnMaYto_ChooseAction(EnMaYto* this, PlayState* play) { case MA_YTO_TYPE_AFTERMILKRUN: this->unk310 = 0; - if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI && (gSaveContext.save.weekEventReg[52] & 1) && + if ((INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) && CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01) && (Rand_Next() & 0x80)) { EnMaYto_SetupBeginWarmFuzzyFeelingCs(this); } else { @@ -334,7 +332,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, PlayState* play) { return 0; case MA_YTO_TYPE_DINNER: - if (!(gSaveContext.save.weekEventReg[22] & 1) && CURRENT_DAY == 2) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) && (CURRENT_DAY == 2)) { return 0; } if (EnMaYto_SearchRomani(this, play)) { @@ -343,8 +341,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, PlayState* play) { return 1; case MA_YTO_TYPE_BARN: - // if (AliensDefeated) - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { if (EnMaYto_SearchRomani(this, play)) { return 2; } @@ -498,7 +495,7 @@ void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupDinnerWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 0); this->unk31E = 0; } else { @@ -539,7 +536,7 @@ void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -690,7 +687,7 @@ void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupBarnWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_ChangeAnim(this, 13); func_80B90E50(this, 0); this->unk31E = 0; @@ -718,7 +715,7 @@ void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_BarnStartDialogue(this, play); EnMaYto_SetupBarnDialogueHandler(this); - } else if (!(gSaveContext.save.weekEventReg[22] & 1) || ABS_ALT(direction) < 0x2000) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) || ABS_ALT(direction) < 0x2000) { func_800B8614(&this->actor, play, 100.0f); child = this->actor.child; @@ -730,7 +727,7 @@ void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -878,7 +875,7 @@ void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) { - if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { EnMaYto_SetFaceExpression(this, 3, 1); } else { Audio_PlayFanfare(NA_BGM_FAILURE_1); @@ -893,16 +890,15 @@ void EnMaYto_AfterMilkRunInit(EnMaYto* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { Message_StartTextbox(play, 0x33C1, &this->actor); this->textId = 0x33C1; } else { - // Fails milk minigame + // Failed milk minigame EnMaYto_SetFaceExpression(this, 5, 2); Message_StartTextbox(play, 0x33C0, &this->actor); this->textId = 0x33C0; - // Attempted Cremia Cart Ride - gSaveContext.save.weekEventReg[14] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_14_01); this->unk310 = 4; EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); func_80151BB4(play, 6); @@ -983,8 +979,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play) { EnMaYto_SetFaceExpression(this, 0, 1); Message_StartTextbox(play, 0x33C3, &this->actor); this->textId = 0x33C3; - // Attempted Cremia Cart Ride - gSaveContext.save.weekEventReg[14] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_14_01); this->unk310 = 3; func_80151BB4(play, 0x20); func_80151BB4(play, 0x1F); @@ -995,8 +990,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play) { EnMaYto_SetFaceExpression(this, 0, 1); Message_StartTextbox(play, 0x33D0, &this->actor); this->textId = 0x33D0; - // Attempted Cremia Cart Ride - gSaveContext.save.weekEventReg[14] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_14_01); this->unk310 = 3; func_80151BB4(play, 6); EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); @@ -1046,8 +1040,7 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { break; case 2: - // Attempted Cremia Cart Ride - gSaveContext.save.weekEventReg[14] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_14_01); EnMaYto_ChangeAnim(this, 18); break; @@ -1228,8 +1221,7 @@ void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play) { } void EnMaYto_BarnStartDialogue(EnMaYto* this, PlayState* play) { - // if (AliensDefeated) - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { if (CURRENT_DAY == 2) { if (this->unk310 == 1) { Message_StartTextbox(play, 0x33AE, &this->actor); @@ -1352,7 +1344,7 @@ void EnMaYto_SetFaceExpression(EnMaYto* this, s16 overrideEyeTexIndex, s16 mouth } void EnMaYto_InitFaceExpression(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_SetFaceExpression(this, 0, 1); EnMaYto_SetRomaniFaceExpression(this, 0, 0); } else { @@ -1364,19 +1356,19 @@ void EnMaYto_InitFaceExpression(EnMaYto* this) { s32 EnMaYto_HasSpokenToPlayerToday(void) { switch (CURRENT_DAY) { case 1: - if (gSaveContext.save.weekEventReg[13] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_04)) { return true; } break; case 2: - if (gSaveContext.save.weekEventReg[13] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_08)) { return true; } break; case 3: - if (gSaveContext.save.weekEventReg[13] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_10)) { return true; } break; @@ -1385,20 +1377,20 @@ s32 EnMaYto_HasSpokenToPlayerToday(void) { } s32 EnMaYto_HasSpokenToPlayer(void) { - // Please note each case doesn't have their respective `break`s. + // Please note no case here has a `break`. switch (CURRENT_DAY) { case 3: - if (gSaveContext.save.weekEventReg[13] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_10)) { return true; } case 2: - if (gSaveContext.save.weekEventReg[13] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_08)) { return true; } case 1: - if (gSaveContext.save.weekEventReg[13] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_04)) { return true; } } @@ -1408,15 +1400,15 @@ s32 EnMaYto_HasSpokenToPlayer(void) { void EnMaYto_SetTalkedFlag(void) { switch (CURRENT_DAY) { case 1: - gSaveContext.save.weekEventReg[13] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_13_04); break; case 2: - gSaveContext.save.weekEventReg[13] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_13_08); break; case 3: - gSaveContext.save.weekEventReg[13] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_13_10); break; } } @@ -1466,7 +1458,7 @@ void EnMaYto_Draw(Actor* thisx, PlayState* play) { s32 pad; OPEN_DISPS(play->state.gfxCtx); - if (this->type == MA_YTO_TYPE_BARN && (gSaveContext.save.weekEventReg[22] & 1)) { // Aliens defeated + if (this->type == MA_YTO_TYPE_BARN && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBoxDL); } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index ae72324067..64a6d138cb 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -144,7 +144,7 @@ void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { case MA_YTS_TYPE_SITTING: this->actor.targetMode = 6; // Day 1 or "Winning" the alien invasion - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYts_ChangeAnim(this, 14); } else { EnMaYts_ChangeAnim(this, 18); @@ -177,14 +177,14 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { case 2: // Failing the alien invasion - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; case 3: // "Winning" the alien invasion - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; @@ -193,7 +193,7 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { case MA_YTS_TYPE_BARN: // Failing the alien invasion - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } else if (gSaveContext.save.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { return false; @@ -202,7 +202,7 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { case MA_YTS_TYPE_SLEEPING: // "Winning" the alien invasion - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; @@ -248,7 +248,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { this->hasBow = false; } - if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { this->overrideEyeTexIndex = 0; this->eyeTexIndex = 0; this->mouthTexIndex = 0; @@ -266,7 +266,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { this->mouthTexIndex = 0; this->unk_32C = 2; EnMaYts_SetupEndCreditsHandler(this); - } else if (CURRENT_DAY == 2 && gSaveContext.save.isNight == 1 && (gSaveContext.save.weekEventReg[22] & 1)) { + } else if (CURRENT_DAY == 2 && gSaveContext.save.isNight == 1 && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYts_SetupStartDialogue(this); } else { EnMaYts_SetupDoNothing(this); @@ -296,9 +296,9 @@ void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (!(gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { - if (!(gSaveContext.save.weekEventReg[65] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_80)) { // Saying to non-human Link: "Cremia went to town." - gSaveContext.save.weekEventReg[65] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_65_80); EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(play, 0x335F, &this->actor); this->textId = 0x335F; @@ -310,8 +310,8 @@ void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { func_80151BB4(play, 5); } } else if (Player_GetMask(play) != PLAYER_MASK_NONE) { - if (!(gSaveContext.save.weekEventReg[65] & 0x40)) { - gSaveContext.save.weekEventReg[65] |= 0x40; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_40)) { + SET_WEEKEVENTREG(WEEKEVENTREG_65_40); EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(play, 0x3363, &this->actor); this->textId = 0x3363; @@ -321,14 +321,14 @@ void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { this->textId = 0x3366; func_80151BB4(play, 5); } - } else if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(play, 0x3367, &this->actor); this->textId = 0x3367; } else { - if (!(gSaveContext.save.weekEventReg[65] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_20)) { // Saying to Grasshopper: "Cremia went to town." - gSaveContext.save.weekEventReg[65] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_65_20); EnMaYts_SetFaceExpression(this, 4, 2); Message_StartTextbox(play, 0x3369, &this->actor); this->textId = 0x3369; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 07c147690e..fcdf968b11 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -66,14 +66,8 @@ static TexturePtr D_808A4D74[] = { object_fr_Tex_005BA0, }; -// gSaveContext.save.weekEventReg[KEY] = VALUE -// KEY | VALUE static u16 isFrogReturnedFlags[] = { - (0 << 8) | 0x00, // NULL - (32 << 8) | 0x40, // Woodfall Temple Frog Returned - (32 << 8) | 0x80, // Great Bay Temple Frog Returned - (33 << 8) | 0x01, // Southern Swamp Frog Returned - (33 << 8) | 0x02, // Laundry Pool Frog Returned + 0, WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, WEEKEVENTREG_33_02, }; static s32 isInitialized = false; @@ -94,7 +88,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (!isInitialized) { - for (i = 0; i < 2; i++) { + for (i = 0; i < ARRAY_COUNT(D_808A4D74); i++) { D_808A4D74[i] = Lib_SegmentedToVirtual(D_808A4D74[i]); } isInitialized = true; @@ -112,10 +106,9 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->timer = 0; if (1) {} + if (!EN_MINIFROG_IS_RETURNED(&this->actor)) { - if ((this->frogIndex == MINIFROG_YELLOW) || - ((gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & - (u8)isFrogReturnedFlags[this->frogIndex]))) { + if ((this->frogIndex == MINIFROG_YELLOW) || CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { Actor_Kill(&this->actor); return; } @@ -129,8 +122,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->actor.textId = 0; this->actionFunc = EnMinifrog_SetupYellowFrogDialog; - // Not spoken to MINIFROG_YELLOW - if (!(gSaveContext.save.weekEventReg[34] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_01)) { this->actor.flags |= ACTOR_FLAG_10000; } @@ -141,8 +133,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; // Frog has been returned - if ((gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & - (u8)isFrogReturnedFlags[this->frogIndex])) { + if (CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { this->actionFunc = EnMinifrog_SetupNextFrogInit; } else { this->actor.draw = NULL; @@ -271,16 +262,14 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { func_80151938(play, play->msgCtx.currentTextId + 1); break; - case 0xD82: // "What has brought you all this way?" - if (gSaveContext.save.weekEventReg[33] & 0x80) { // Mountain village is unfrozen + case 0xD82: // "What has brought you all this way?" + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { func_80151938(play, 0xD83); // "Could it be... Has spring finally come to the mountains?" } else { func_80151938(play, 0xD86); // "Could it be... You came all this way looking for me?" } - gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] = - ((void)0, gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8]) | - (u8)isFrogReturnedFlags[this->frogIndex]; + SET_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex]); break; case 0xD85: // "I understand. I shall head for the mountains immediately." @@ -521,7 +510,7 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { // you've lost a little weight..." func_80151938(play, play->msgCtx.currentTextId + 1); this->actor.flags &= ~ACTOR_FLAG_10000; - gSaveContext.save.weekEventReg[34] |= 1; // Spoken to MINIFROG_YELLOW + SET_WEEKEVENTREG(WEEKEVENTREG_34_01); break; case 0xD78: // "Unfortunately, it seems not all of our members have gathered." case 0xD79: // "Perhaps it is because winter was too long? They must not have realized that spring @@ -535,11 +524,11 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { play->msgCtx.msgLength = 0; break; case 0xD7C: // "The conducting was spectacular. And all of our members rose to the occasion!" - if (gSaveContext.save.weekEventReg[35] & 0x80) { // Obtained Heart Piece + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_35_80)) { // Obtained Heart Piece func_80151938(play, 0xD7E); } else { func_80151938(play, 0xD7D); // Get Heart Piece - gSaveContext.save.weekEventReg[35] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_35_80); } break; case 0xD7D: // "This is how deeply we were moved by your spectacular conducting..." @@ -568,7 +557,7 @@ void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, PlayState* play) { EnMinifrog_JumpTimer(this); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMinifrog_YellowFrogDialog; - if (!(gSaveContext.save.weekEventReg[34] & 1)) { // Not spoken with MINIFROG_YELLOW + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_01)) { Message_StartTextbox(play, 0xD76, &this->actor); // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, // but it looks like you've lost a little weight..." diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index c267fb1105..43d5ac3d46 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -147,7 +147,7 @@ void func_80959624(EnMk* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (this->unk_27A & 4) { textId = 0xFB9; - } else if (gSaveContext.save.weekEventReg[55] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { textId = 0xFBC; } else { textId = 0xFBB; @@ -202,17 +202,17 @@ void func_80959844(EnMk* this, PlayState* play) { if ((this->unk_27A & 2) && (func_80959524(play) >= 7)) { textId = 0xFB3; - } else if (gSaveContext.save.weekEventReg[20] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40)) { textId = 0xFB9; - } else if (gSaveContext.save.weekEventReg[19] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { textId = 0xFB5; } else if (func_80959524(play) >= 7) { textId = 0xFB3; } else { switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[19] & 0x10) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { textId = 0xFAF; } else { textId = 0xFAE; @@ -223,8 +223,8 @@ void func_80959844(EnMk* this, PlayState* play) { break; case PLAYER_FORM_GORON: - if (gSaveContext.save.weekEventReg[19] & 8) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { textId = 0xFAB; } else { textId = 0xFAA; @@ -238,8 +238,8 @@ void func_80959844(EnMk* this, PlayState* play) { case PLAYER_FORM_HUMAN: if (func_80959524(play) > 0) { textId = 0xFA7; - } else if (gSaveContext.save.weekEventReg[19] & 4) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_04)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { textId = 0xFBF; } else { textId = 0xFA6; @@ -252,7 +252,7 @@ void func_80959844(EnMk* this, PlayState* play) { default: if (func_80959524(play) > 0) { textId = 0xFB0; - } else if (gSaveContext.save.weekEventReg[19] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_20)) { textId = 0xFB2; } else { textId = 0xFB1; @@ -283,12 +283,12 @@ void func_80959A24(EnMk* this, PlayState* play) { break; case 0xFA2: - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { func_801477B4(play); this->actionFunc = func_80959E18; - break; + } else { + func_80151938(play, play->msgCtx.currentTextId + 1); } - func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0xFA5: @@ -308,30 +308,30 @@ void func_80959A24(EnMk* this, PlayState* play) { break; case 0xFA0: - gSaveContext.save.weekEventReg[19] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_19_04); func_80151938(play, 0xFA1); break; case 0xFA8: - gSaveContext.save.weekEventReg[19] |= 8; - if (gSaveContext.save.weekEventReg[55] & 0x80) { + SET_WEEKEVENTREG(WEEKEVENTREG_19_08); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { func_80151938(play, 0xFBD); - break; + } else { + func_80151938(play, 0xFA9); } - func_80151938(play, 0xFA9); break; case 0xFAC: - gSaveContext.save.weekEventReg[19] |= 0x10; - if (gSaveContext.save.weekEventReg[55] & 0x80) { + SET_WEEKEVENTREG(WEEKEVENTREG_19_10); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { func_80151938(play, 0xFBE); - break; + } else { + func_80151938(play, 0xFAD); } - func_80151938(play, 0xFAD); break; case 0xFB1: - gSaveContext.save.weekEventReg[19] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_19_20); func_801477B4(play); this->actionFunc = func_80959E18; break; @@ -373,7 +373,7 @@ void func_80959D28(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((play->csCtx.state == 0) && (this->actor.cutscene == -1)) { - if (gSaveContext.save.weekEventReg[20] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40)) { this->unk_27A &= ~1; this->actionFunc = func_80959774; this->actor.home.rot.y += 0x4E20; @@ -401,7 +401,7 @@ void func_80959E18(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (gSaveContext.save.weekEventReg[20] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40)) { this->unk_27A &= ~1; this->actionFunc = func_80959774; this->actor.home.rot.y += 0x4E20; @@ -413,7 +413,7 @@ void func_80959E18(EnMk* this, PlayState* play) { this->actionFunc = func_80959D28; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { this->actor.cutscene = this->unk_276[0]; - gSaveContext.save.weekEventReg[20] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_20_40); Item_Give(play, ITEM_SONG_NOVA); } else { this->actor.cutscene = this->unk_276[1]; @@ -428,7 +428,7 @@ void func_80959E18(EnMk* this, PlayState* play) { } else if ((this->actor.xzDistToPlayer < 120.0f) && (ABS_ALT(sp22) <= 0x4300)) { this->unk_27A |= 1; func_800B8614(&this->actor, play, 200.0f); - if (!(gSaveContext.save.weekEventReg[20] & 0x40) && (gSaveContext.save.weekEventReg[19] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { func_800B874C(&this->actor, play, 200.0f, 100.0f); } } else { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 0cd8f1276e..195d5b272b 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -74,8 +74,8 @@ void EnMm_Init(Actor* thisx, PlayState* play) { EnMm* this = THIS; EnMmActionFunc action; - if ((this->actor.params >= 0) && ((!(gSaveContext.save.weekEventReg[37] & 0x10)) || - (gSaveContext.save.weekEventReg[37] & 8) || (gSaveContext.unk_1014 != 0))) { + if ((this->actor.params >= 0) && (!CHECK_WEEKEVENTREG(WEEKEVENTREG_37_10) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_37_08) || (gSaveContext.unk_1014 != 0))) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index a611a309e6..3e58691cc7 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -106,7 +106,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) { void EnMm3_Destroy(Actor* thisx, PlayState* play) { EnMm3* this = THIS; - gSaveContext.save.weekEventReg[63] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); Collider_DestroyCylinder(play, &this->collider); } @@ -279,7 +279,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { case 0x2795: case 0x2796: case 0x2797: - if (gSaveContext.save.weekEventReg[63] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { Message_StartTextbox(play, 0x279B, &this->actor); this->unk_2B4 = 0x279B; func_80151BB4(play, 0xB); @@ -351,8 +351,8 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); func_80A6FBA0(this); } else { - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); func_80A6F270(this); } } @@ -374,8 +374,8 @@ void func_80A6FBA0(EnMm3* this) { AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); func_801A0238(0, 5); - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->actionFunc = func_80A6FBFC; } @@ -425,12 +425,12 @@ void func_80A6FE1C(EnMm3* this) { void func_80A6FE30(EnMm3* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if (!(gSaveContext.save.weekEventReg[77] & 1)) { - gSaveContext.save.weekEventReg[77] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_77_01); } this->actor.parent = NULL; func_80A6FED8(this); - } else if (gSaveContext.save.weekEventReg[77] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_01)) { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index e4178997fd..5fd8442392 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -77,7 +77,7 @@ s32 EnMttag_IsInFinishLine(Vec3f* pos) { * and, if so, what kind of cheating the player is performing. */ s32 EnMttag_CheckPlayerCheatStatus(Vec3f* pos) { - if (!(gSaveContext.eventInf[1] & 1)) { + if (!CHECK_EVENTINF(EVENTINF_10)) { if (Math3D_XZBoundCheck(-466.0f, -386.0f, -687.0f, 193.0f, pos->x, pos->z)) { // The race hasn't started yet, but the player is beyond the starting line. return GORON_RACE_CHEAT_FALSE_START; @@ -234,7 +234,7 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; play->nextEntrance = ENTRANCE(GORON_RACETRACK, 2); - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -288,7 +288,7 @@ void EnMttag_ShowIntroCutscene(EnMttag* this, PlayState* play) { */ void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { - gSaveContext.save.weekEventReg[12] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_12_02); this->actionFunc = EnMttag_RaceStart; } } @@ -311,7 +311,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { } EnMttag_ShowFalseStartMessage(this, play); - gSaveContext.eventInf[1] |= 8; + SET_EVENTINF(EVENTINF_13); } else { if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); @@ -321,7 +321,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20; } else if ((this->timer < 60) && (play->interfaceCtx.unk_280 == 8)) { this->timer = 0; - gSaveContext.eventInf[1] |= 1; + SET_EVENTINF(EVENTINF_10); this->actionFunc = EnMttag_Race; } } @@ -363,14 +363,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); this->timer = 55; - gSaveContext.eventInf[1] |= 2; + SET_EVENTINF(EVENTINF_11); this->actionFunc = EnMttag_RaceFinish; } else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); this->timer = 55; - gSaveContext.eventInf[1] |= 4; + SET_EVENTINF(EVENTINF_12); this->actionFunc = EnMttag_RaceFinish; } else { playerCheatStatus = EnMttag_CheckPlayerCheatStatus(playerPos); @@ -382,10 +382,10 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { } EnMttag_ShowFalseStartMessage(this, play); - gSaveContext.eventInf[1] |= 8; + SET_EVENTINF(EVENTINF_13); } else if ((EnMttag_UpdateCheckpoints(this, play)) && (this->timer == 0)) { EnMttag_ShowCantWinMessage(this, play); - gSaveContext.eventInf[1] |= 8; + SET_EVENTINF(EVENTINF_13); } } } @@ -396,7 +396,7 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { */ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) { if (DECR(this->timer) == 0) { - if ((gSaveContext.eventInf[1] & 2)) { + if (CHECK_EVENTINF(EVENTINF_11)) { // Player won EnMttag_ExitRace(play, TRANS_TYPE_03, TRANS_TYPE_03); } else { @@ -420,7 +420,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { if (this->shouldRestartRace) { play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -435,10 +435,10 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { func_800B7298(play, &this->actor, 7); Magic_Add(play, MAGIC_FILL_TO_CAPACITY); - gSaveContext.eventInf[1] &= (u8)~1; - gSaveContext.eventInf[1] &= (u8)~2; - gSaveContext.eventInf[1] &= (u8)~4; - gSaveContext.eventInf[1] &= (u8)~8; + CLEAR_EVENTINF(EVENTINF_10); + CLEAR_EVENTINF(EVENTINF_11); + CLEAR_EVENTINF(EVENTINF_12); + CLEAR_EVENTINF(EVENTINF_13); gSaveContext.eventInf[2] = ((gSaveContext.eventInf[2] & 0xF) + 1) | (gSaveContext.eventInf[2] & 0xF0); } else { EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02); @@ -458,8 +458,8 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { func_8019F230(); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02); - gSaveContext.eventInf[1] &= (u8)~8; - gSaveContext.eventInf[1] |= 4; + CLEAR_EVENTINF(EVENTINF_13); + SET_EVENTINF(EVENTINF_12); Actor_Kill(&this->actor); return; } @@ -468,7 +468,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { func_8019F208(); func_801477B4(play); func_800B7298(play, &this->actor, 6); - gSaveContext.eventInf[1] &= (u8)~8; + CLEAR_EVENTINF(EVENTINF_13); this->timer = 100; this->actionFunc = EnMttag_Race; } @@ -484,12 +484,12 @@ void EnMttag_Init(Actor* thisx, PlayState* play) { this->raceInitialized = false; this->timer = 100; - gSaveContext.eventInf[1] &= (u8)~1; - gSaveContext.eventInf[1] &= (u8)~2; - gSaveContext.eventInf[1] &= (u8)~4; - gSaveContext.eventInf[1] &= (u8)~8; + CLEAR_EVENTINF(EVENTINF_10); + CLEAR_EVENTINF(EVENTINF_11); + CLEAR_EVENTINF(EVENTINF_12); + CLEAR_EVENTINF(EVENTINF_13); - if (!(gSaveContext.save.weekEventReg[12] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_02)) { this->actionFunc = EnMttag_ShowIntroCutscene; } else { s32 requiredScopeTemp; diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 03b30a2862..f9d17ca963 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -70,7 +70,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) { if (!this->isInMayorsRoom) { this->shouldSetHeadRotation = true; this->textIdIndex = 2; - if (gSaveContext.save.weekEventReg[60] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_80)) { this->textIdIndex = 3; } @@ -82,7 +82,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) { this->collider.dim.height = 60; this->collider.dim.yShift = 0; - if (gSaveContext.save.weekEventReg[63] & 0x80 || (gSaveContext.save.day == 3 && gSaveContext.save.isNight)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) || ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } } @@ -136,7 +136,7 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) { if (!this->isInMayorsRoom) { player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { - if (!(gSaveContext.save.weekEventReg[88] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_08)) { this->actor.textId = 0x62C; } else { this->actor.textId = 0x62B; @@ -164,7 +164,7 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) { } } else { this->textIdIndex = 0; - if (gSaveContext.save.weekEventReg[60] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_08)) { this->textIdIndex = 1; } if (Player_GetMask(play) == PLAYER_MASK_COUPLE) { @@ -202,10 +202,10 @@ void EnMuto_InDialogue(EnMuto* this, PlayState* play) { func_801477B4(play); if (this->actor.textId == 0x62C) { - gSaveContext.save.weekEventReg[88] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_88_08); } if (this->actor.textId == 0x624) { - gSaveContext.save.weekEventReg[60] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_60_80); } this->textIdIndex = 3; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 3d653a6449..8d02d5d140 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -66,7 +66,7 @@ static u8 sScheduleScript[] = { /* 0x3E */ SCHEDULE_CMD_RET_VAL_L(EN_NB_SCH_1), /* 0x41 */ SCHEDULE_CMD_RET_VAL_L(EN_NB_SCH_2), /* 0x44 */ SCHEDULE_CMD_RET_VAL_L(EN_NB_SCH_1), - /* 0x47 */ SCHEDULE_CMD_CHECK_FLAG_S(0x32, 0x20, 0x57 - 0x4B), + /* 0x47 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_50_20, 0x57 - 0x4B), /* 0x4B */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(8, 0, 18, 0, 0x54 - 0x51), /* 0x51 */ SCHEDULE_CMD_RET_VAL_L(EN_NB_SCH_3), /* 0x54 */ SCHEDULE_CMD_RET_VAL_L(EN_NB_SCH_1), diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 5fcd69fc89..74ac78b5f4 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -68,8 +68,7 @@ void EnNwc_Init(Actor* thisx, PlayState* play) { return; } - if (gSaveContext.save.weekEventReg[25] & 8) { - // if breman mask was already used, replace with adult EnNiw + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_08)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, NIW_TYPE_REGULAR); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index a61c0dc22c..7df9d843d5 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -476,16 +476,17 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; + } else { + return 0x1FCD; } - return 0x1FCD; } this->stateFlags |= OSN_STATE_MET_GORON; - if (gSaveContext.save.weekEventReg[76] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_76_20)) { return 0x1FC8; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_76_20); + return 0x1FCE; } - - gSaveContext.save.weekEventReg[76] |= 0x20; - return 0x1FCE; } if (player->transformation == PLAYER_FORM_ZORA) { @@ -497,11 +498,12 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { } return 0x1FCD; } + this->stateFlags |= OSN_STATE_MET_ZORA; - if (gSaveContext.save.weekEventReg[76] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_76_40)) { return 0x1FC8; } - gSaveContext.save.weekEventReg[76] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_76_40); return 0x1FD0; } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index a17113ff82..d60a19847c 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -1386,19 +1386,19 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { switch (player->transformation) { case PLAYER_FORM_DEKU: this->animIndex = FSN_ANIM_SLAM_COUNTER_START; - if (gSaveContext.save.weekEventReg[18] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_10)) { return sWelcomeDekuTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_ZORA: this->animIndex = FSN_ANIM_LEAN_FORWARD_START; - if (gSaveContext.save.weekEventReg[18] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_08)) { return sWelcomeZoraTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_GORON: this->animIndex = FSN_ANIM_HAND_ON_FACE_START; - if (gSaveContext.save.weekEventReg[18] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_04)) { return sWelcomeGoronTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; @@ -1417,17 +1417,17 @@ u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) { } switch (player->transformation) { case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[55] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_10)) { return sWelcomeDekuTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_ZORA: - if (gSaveContext.save.weekEventReg[55] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_08)) { return sWelcomeZoraTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_GORON: - if (gSaveContext.save.weekEventReg[55] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_04)) { return sWelcomeGoronTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; @@ -1438,22 +1438,22 @@ u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) { void EnOssan_SetHaveMet(EnOssan* this) { switch (this->textId) { case 0x06A9: - gSaveContext.save.weekEventReg[18] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_18_10); break; case 0x06C6: - gSaveContext.save.weekEventReg[55] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_55_10); break; case 0x06A7: - gSaveContext.save.weekEventReg[18] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_18_08); break; case 0x06C4: - gSaveContext.save.weekEventReg[55] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_55_08); break; case 0x06A5: - gSaveContext.save.weekEventReg[18] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_18_04); break; case 0x06C2: - gSaveContext.save.weekEventReg[55] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_55_04); break; } } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 487960916d..1313b51d04 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -180,7 +180,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.y = BgCheck_EntityRaycastFloor3(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor.world.pos) + 50.0f; - if (gSaveContext.save.weekEventReg[84] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10)) { Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_MultVecZ(52.519997f, &sp64); Math_Vec3f_Sum(&this->actor.world.pos, &sp64, &sp64); @@ -195,7 +195,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->unk_394.y = this->actor.world.pos.y; this->unk_394.z = (this->actor.world.pos.z + this->unk_360->actor.world.pos.z) * 0.5f; Math_Vec3f_Copy(&this->unk_360->unk_394, &this->unk_394); - if (gSaveContext.save.weekEventReg[32] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_01)) { func_80B5C244(this, play); } else { func_80B5C684(this, play); @@ -230,7 +230,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { switch (this->unk_344) { case 0: Actor_SetScale(&this->actor, 0.0f); - if (!(gSaveContext.save.weekEventReg[13] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_13_01)) { Actor_SetScale(&this->actor, 0.0f); func_80B5C910(this, play); } else { @@ -250,8 +250,8 @@ void EnOt_Init(Actor* thisx, PlayState* play) { case 1: Actor_SetScale(&this->actor, 0.012999999f); - if (gSaveContext.save.weekEventReg[84] & 0x10) { - if (gSaveContext.save.weekEventReg[32] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_01)) { func_80B5C244(this, play); } else { func_80B5C684(this, play); @@ -264,7 +264,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { break; case 3: - if (!(gSaveContext.save.weekEventReg[26] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Actor_SetScale(&this->actor, 0.0064999997f); @@ -376,11 +376,11 @@ void func_80B5BFB8(EnOt* this, PlayState* play) { } void func_80B5C154(EnOt* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[32] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_01)) { this->getItemId = GI_RUPEE_RED; } else { this->getItemId = GI_HEART_PIECE; - gSaveContext.save.weekEventReg[32] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_32_01); } Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; @@ -482,7 +482,7 @@ void func_80B5C634(EnOt* this, PlayState* play) { } void func_80B5C64C(EnOt* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[26] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { Actor_Kill(&this->actor); } } @@ -505,7 +505,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { Matrix_MultVecZ(26.259998f, &sp30); } else { if (this->unk_73C == 0) { - gSaveContext.save.weekEventReg[84] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_84_10); switch (this->unk_388) { case 0: ActorCutscene_Stop(this->cutscenes[2]); @@ -527,7 +527,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_348.x, 1.0f, 2.0f, 0.01f); Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_348.z, 1.0f, 2.0f, 0.01f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); - if ((gSaveContext.save.weekEventReg[84] & 0x10) && (this->unk_33C == 1)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (this->unk_33C == 1)) { this->actor.textId = 0; this->unk_384 = 1; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -556,7 +556,7 @@ void func_80B5C910(EnOt* this, PlayState* play) { void func_80B5C950(EnOt* this, PlayState* play) { if (this->unk_32C & 8) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); - gSaveContext.save.weekEventReg[25] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_25_04); func_80B5CAD0(this, play); } } @@ -650,7 +650,7 @@ void func_80B5CD40(EnOt* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; if (1) {} if (!temp) { - gSaveContext.save.weekEventReg[23] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_23_10); Message_StartTextbox(play, 0x1069, NULL); } break; @@ -701,7 +701,7 @@ void func_80B5CEC8(EnOt* this, PlayState* play) { } } - if (!(gSaveContext.save.weekEventReg[84] & 0x10) && (ENOT_GET_C000(&this->actor) == 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (ENOT_GET_C000(&this->actor) == 1)) { if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.playerHeightRel) <= 130.0f)) { player->unk_B2B = 29; } @@ -754,7 +754,7 @@ void func_80B5D160(EnOt* this, PlayState* play) { phi_a1 = 0x1069; } } else if (Flags_GetSwitch(play, ENOT_GET_3F80(&this->actor))) { - if (gSaveContext.save.weekEventReg[23] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_10)) { phi_a1 = 0x106C; } else { phi_a1 = 0x106B; @@ -985,8 +985,8 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { EnOt* this = THIS; Player* player = GET_PLAYER(play); - if (!(gSaveContext.save.weekEventReg[84] & 0x10) && !(this->unk_32C & 8)) { - if (gSaveContext.save.weekEventReg[25] & 4) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && !(this->unk_32C & 8)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_04)) { Vec3f sp50; func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); @@ -998,7 +998,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { } else if (D_80B5E888 != NULL) { s32 sp4C = false; - if (gSaveContext.save.weekEventReg[13] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_01)) { if (!SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { sp4C = true; } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index ab083aff1a..48d691d138 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -183,7 +183,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { case ENOWL_GET_TYPE_2: this->actionFunc = func_8095BE0C; - if (gSaveContext.save.weekEventReg[9] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_20)) { this->actor.textId = 0xBF0; } else { this->actor.textId = 0xBEA; @@ -613,10 +613,10 @@ void func_8095BA84(EnOwl* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - if (gSaveContext.save.weekEventReg[9] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_40)) { func_80151938(play, 0xBF4); } else { - gSaveContext.save.weekEventReg[9] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_09_40); func_80151938(play, 0xBED); } break; @@ -649,7 +649,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0xBEA: - gSaveContext.save.weekEventReg[9] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_09_20); func_80151938(play, 0xBEB); break; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 8c8a6eb570..2b0aae48a0 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -153,17 +153,19 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { } else { func_80BD8588(this, play); func_80BD8658(this); + if (1) {} - if (!(gSaveContext.save.weekEventReg[14] & 4) || (gSaveContext.save.weekEventReg[52] & 0x20) || - (gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.entrance == ENTRANCE(IKANA_CANYON, 9))) { + + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || (gSaveContext.save.entrance == ENTRANCE(IKANA_CANYON, 9))) { Actor_Kill(&this->actor); } - if (gSaveContext.save.weekEventReg[61] & 4) { - if (!(gSaveContext.save.weekEventReg[59] & 1) || - (gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 2))) { + + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_04)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_01) || (gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 2))) { if ((gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 2)) && - (gSaveContext.save.weekEventReg[59] & 1)) { - gSaveContext.save.weekEventReg[59] &= (u8)~1; + CHECK_WEEKEVENTREG(WEEKEVENTREG_59_01)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_59_01); } func_80BD8700(this); } else { @@ -174,7 +176,7 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { func_80BD8CCC(this); } } else { - gSaveContext.save.weekEventReg[59] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_59_01); func_80BD8FF0(this); } } @@ -201,7 +203,7 @@ void func_80BD8588(EnPamera* this, PlayState* play) { if (path == NULL) { Actor_Kill(&this->actor); } - if (gSaveContext.save.weekEventReg[61] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_04)) { path = &play->setupPathList[path->unk1]; } this->pathPoints = Lib_SegmentedToVirtual(path->points); @@ -290,7 +292,7 @@ void func_80BD8964(EnPamera* this, PlayState* play) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &vec, 1.0f) < 5.0f) { this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); - gSaveContext.save.weekEventReg[59] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_59_01); func_80BD8B50(this); } } @@ -305,10 +307,10 @@ void func_80BD8A7C(EnPamera* this, PlayState* play) { 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, 1.5f) < 10.0f) { - gSaveContext.save.weekEventReg[59] &= (u8)~1; - if (!(gSaveContext.save.weekEventReg[61] & 4)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_59_01); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_61_04)) { func_80BD92D0(this, play); - gSaveContext.save.weekEventReg[61] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_61_04); } func_80BD8700(this); } @@ -567,7 +569,7 @@ void func_80BD9840(EnPamera* this, PlayState* play) { this->actor.update = func_80BDA344; this->actor.flags |= ACTOR_FLAG_2000000; this->actor.flags |= ACTOR_FLAG_100000; - if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { func_80BD9E60(this); func_80BD9938(this); } else { @@ -575,7 +577,7 @@ void func_80BD9840(EnPamera* this, PlayState* play) { func_80BD9E60(this); func_80BD9904(this); } - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { func_801A0204(NA_BGM_MUSIC_BOX_HOUSE); } else { func_801A0204(NA_BGM_INSIDE_A_HOUSE); @@ -603,7 +605,7 @@ void func_80BD994C(EnPamera* this, PlayState* play) { this->unk_324 = 0x15A8; } else if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || - ((gSaveContext.save.weekEventReg[52] & 0x20) && (!(gSaveContext.save.weekEventReg[75] & 0x20)))) { + (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20))) { func_80BD93CC(this, 1, 0); Message_StartTextbox(play, 0x158E, &this->actor); this->unk_324 = 0x158E; @@ -729,7 +731,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { this->setupFunc(this, play); return 1; } - if ((play->csCtx.state == 0) && (gSaveContext.save.weekEventReg[75] & 0x20)) { + if ((play->csCtx.state == 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20)) { if ((this->actionFunc != func_80BD994C) && (this->actionFunc != EnPamera_HandleDialogue)) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80BD9904(this); @@ -853,11 +855,11 @@ void func_80BDA344(Actor* thisx, PlayState* play) { func_80BD9384(this, play); if (func_80BD9CB8(this, play)) { // Pamela is outside - if (gSaveContext.save.weekEventReg[59] & 1) { - gSaveContext.save.weekEventReg[59] &= (u8)~1; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_59_01)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_59_01); } - if (!(gSaveContext.save.weekEventReg[61] & 4)) { - gSaveContext.save.weekEventReg[61] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_61_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_61_04); } Actor_TrackNone(&this->headRot, &this->torsoRot); } else { @@ -866,7 +868,7 @@ void func_80BDA344(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { play->roomCtx.unk7A[0]++; } } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index b4670662ca..e0025ece92 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -171,13 +171,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 10, ICHAIN_STOP), }; -// gSaveContext.save.weekEventReg[KEY] = VALUE -// KEY | VALUE static s32 isFrogReturnedFlags[] = { - (32 << 8) | 0x40, // Woodfall Temple Frog Returned - (32 << 8) | 0x80, // Great Bay Temple Frog Returned - (33 << 8) | 0x01, // Southern Swamp Frog Returned - (33 << 8) | 0x02, // Laundry Pool Frog Returned + WEEKEVENTREG_32_40, + WEEKEVENTREG_32_80, + WEEKEVENTREG_33_01, + WEEKEVENTREG_33_02, }; void EnPametfrog_Init(Actor* thisx, PlayState* play) { @@ -193,8 +191,7 @@ void EnPametfrog_Init(Actor* thisx, PlayState* play) { this->params = CLAMP(this->actor.params, 1, 4); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & - (u8)isFrogReturnedFlags[this->actor.params - 1])) { + if (!CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 317a5eee40..a01822733b 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -132,7 +132,7 @@ static u8 D_80AFAD80[] = { /* 0x239 */ SCHEDULE_CMD_RET_TIME(10, 21, 10, 35, 44), /* 0x23F */ SCHEDULE_CMD_RET_NONE(), /* 0x240 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(2, 0x414 - 0x245), - /* 0x245 */ SCHEDULE_CMD_CHECK_FLAG_L(0x1C, 0x08, 0x2EF - 0x24A), + /* 0x245 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_28_08, 0x2EF - 0x24A), /* 0x24A */ SCHEDULE_CMD_CHECK_TIME_RANGE_L(9, 0, 12, 0, 0x117 - 0x251), /* 0x251 */ SCHEDULE_CMD_CHECK_TIME_RANGE_L(12, 0, 13, 1, 0x2E4 - 0x258), /* 0x258 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(13, 1, 15, 0, 0x2DC - 0x25E), @@ -226,8 +226,8 @@ static u8 D_80AFAD80[] = { /* 0x40D */ SCHEDULE_CMD_RET_TIME(12, 0, 13, 1, 21), /* 0x413 */ SCHEDULE_CMD_RET_NONE(), /* 0x414 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(3, 0x588 - 0x419), - /* 0x419 */ SCHEDULE_CMD_CHECK_FLAG_L(0x1C, 0x08, 0x55D - 0x41E), - /* 0x41E */ SCHEDULE_CMD_CHECK_FLAG_L(0x1C, 0x10, 0x52F - 0x423), + /* 0x419 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_28_08, 0x55D - 0x41E), + /* 0x41E */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_28_10, 0x52F - 0x423), /* 0x423 */ SCHEDULE_CMD_CHECK_TIME_RANGE_L(9, 0, 12, 0, 0x117 - 0x42A), /* 0x42A */ SCHEDULE_CMD_CHECK_TIME_RANGE_L(12, 0, 13, 1, 0x527 - 0x431), /* 0x431 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(13, 1, 15, 0, 0x446 - 0x437), @@ -544,19 +544,19 @@ static AnimationInfoS sAnimationInfo[] = { }; s32 func_80AF7B40(void) { - if (gSaveContext.save.weekEventReg[90] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_01)) { return 4; } - if (gSaveContext.save.weekEventReg[89] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_40)) { return 3; } - if (gSaveContext.save.weekEventReg[89] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08)) { return 2; } - if (gSaveContext.save.weekEventReg[86] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_01)) { return 1; } @@ -566,28 +566,28 @@ s32 func_80AF7B40(void) { s32 func_80AF7BAC(EnPm* this) { switch (this->unk_38C) { case 0: - if (gSaveContext.save.weekEventReg[86] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_01)) { D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } break; case 1: - if (gSaveContext.save.weekEventReg[89] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08)) { D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } break; case 2: - if (gSaveContext.save.weekEventReg[89] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_40)) { D_801F4E78 = 0; this->unk_38C++; } break; case 3: - if (gSaveContext.save.weekEventReg[90] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_01)) { D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } @@ -842,7 +842,7 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { case 1: case 3: case 5: - if ((gSaveContext.save.weekEventReg[86] & 8) && (this->unk_378 == 3)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_08) && (this->unk_378 == 3)) { ActorCutscene_Stop(sp2A); } else { Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); @@ -1103,31 +1103,29 @@ void func_80AF8AC8(EnPm* this) { void func_80AF8BA8(s32 arg0) { static u16 D_80AFB8D4[] = { - 0x1B02, 0x1B04, 0x1B08, 0x1B10, 0x1B20, + WEEKEVENTREG_27_02, WEEKEVENTREG_27_04, WEEKEVENTREG_27_08, WEEKEVENTREG_27_10, WEEKEVENTREG_27_20, }; static u16 D_80AFB8E0[] = { - 0x1B40, 0x1B80, 0x1C01, 0x1C02, 0x1C04, + WEEKEVENTREG_27_40, WEEKEVENTREG_27_80, WEEKEVENTREG_28_01, WEEKEVENTREG_28_02, WEEKEVENTREG_28_04, }; - if (!(gSaveContext.save.weekEventReg[88] & 2)) { - if (gSaveContext.save.weekEventReg[D_80AFB8D4[arg0] >> 8] & - (D_80AFB8D4[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80))) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_02)) { + if (CHECK_WEEKEVENTREG(D_80AFB8D4[arg0])) { switch (gSaveContext.save.day) { case 2: - gSaveContext.save.weekEventReg[28] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_28_08); break; case 3: - gSaveContext.save.weekEventReg[28] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_28_10); break; } - gSaveContext.save.weekEventReg[51] |= 2; - gSaveContext.save.weekEventReg[90] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_51_02); + SET_WEEKEVENTREG(WEEKEVENTREG_90_08); } } - gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8] = - ((void)0, gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8]) | (u8)D_80AFB8E0[arg0]; + SET_WEEKEVENTREG(D_80AFB8E0[arg0]); } void func_80AF8C68(EnPm* this, PlayState* play) { @@ -1261,7 +1259,7 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_36C = scheduleOutput->time1 - scheduleOutput->time0; this->unk_36E = sp56 - scheduleOutput->time0; this->actor.flags &= ~ACTOR_FLAG_1; - if (gSaveContext.save.weekEventReg[90] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_08)) { this->unk_356 |= 0x800; } this->unk_356 |= 0x9000; @@ -1341,7 +1339,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { default: SubS_UpdateFlags(&this->unk_356, 3, 7); func_80AF7E98(this, 0); - if (gSaveContext.save.weekEventReg[90] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_08)) { this->unk_356 |= 0x800; } this->unk_356 |= 0x9000; @@ -1457,10 +1455,10 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { break; case 23: - if (gSaveContext.save.weekEventReg[90] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_08)) { this->unk_356 |= 0x800; } - gSaveContext.save.weekEventReg[60] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_60_04); default: if (scheduleOutput->result == 29) { @@ -1780,11 +1778,9 @@ s32 func_80AF9E7C(EnPm* this, PlayState* play) { } if ((this->unk_356 & 0x10) && (this->unk_258 == 90)) { - u8 val = gSaveContext.save.weekEventReg[89] | 0x40; - - gSaveContext.save.weekEventReg[89] = val; - if (val == 0) { - gSaveContext.save.weekEventReg[89] |= 0x40; + //! @bug Uses SET_WEEKEVENTREG instead of CHECK_WEEKEVENTREG + if (!SET_WEEKEVENTREG(WEEKEVENTREG_89_40)) { + SET_WEEKEVENTREG(WEEKEVENTREG_89_40); } } @@ -1798,7 +1794,7 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { switch (this->unk_258) { case 28: if (gSaveContext.save.time >= CLOCK_TIME(1, 39)) { - gSaveContext.save.weekEventReg[89] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_89_08); } case 16: @@ -2120,7 +2116,7 @@ void EnPm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Matrix_MultVec3f(&gZeroVec3f, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } - if ((this->unk_356 & 0x8000) && !(gSaveContext.save.weekEventReg[90] & 4)) { + if ((this->unk_356 & 0x8000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_90_04)) { func_80AF8890(this, gfx, 1); } break; diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index bae89c5c76..167a51f2bd 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -162,15 +162,15 @@ void EnPst_UpdateCollision(EnPst* this, PlayState* play) { s32 EnPst_HandleLetterDay1(EnPst* this) { switch (this->actor.params) { case POSTBOX_SOUTH_UPPER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x2; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_02); case POSTBOX_NORTH_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x4; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_04); case POSTBOX_EAST_UPPER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x8; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_08); case POSTBOX_EAST_LOWER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x10; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_10); case POSTBOX_SOUTH_LOWER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x20; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_20); default: return false; } @@ -179,15 +179,15 @@ s32 EnPst_HandleLetterDay1(EnPst* this) { s32 EnPst_HandleLetterDay2(EnPst* this) { switch (this->actor.params) { case POSTBOX_SOUTH_UPPER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x40; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_40); case POSTBOX_NORTH_CLOCKTOWN: - return gSaveContext.save.weekEventReg[27] & 0x80; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_80); case POSTBOX_EAST_UPPER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[28] & 0x1; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_01); case POSTBOX_EAST_LOWER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[28] & 0x2; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_02); case POSTBOX_SOUTH_LOWER_CLOCKTOWN: - return gSaveContext.save.weekEventReg[28] & 0x4; + return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_04); default: return false; } @@ -358,19 +358,19 @@ void EnPst_Talk(EnPst* this, PlayState* play) { if (EnPst_HandleLetterDay1(this) != this->isLetterToKafeiDeposited) { switch (gSaveContext.save.day) { case 1: - gSaveContext.save.weekEventReg[91] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_91_04); break; case 2: if (EnPst_HandleLetterDay2(this)) { - gSaveContext.save.weekEventReg[91] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_91_08); } else { - gSaveContext.save.weekEventReg[91] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_91_04); } break; default: - gSaveContext.save.weekEventReg[91] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_91_08); break; } } diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 261c94adcb..932e2d36d9 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -15,6 +15,8 @@ #define THIS ((EnRacedog*)thisx) +//! TODO: this file require macros for its uses of weekEventReg + void EnRacedog_Init(Actor* thisx, PlayState* play); void EnRacedog_Destroy(Actor* thisx, PlayState* play); void EnRacedog_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index c442685090..ac261b44ba 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -235,8 +235,8 @@ void EnRaf_Init(Actor* thisx, PlayState* play) { } if (((this->switchFlag >= 0) || (this->mainType == EN_RAF_TYPE_DORMANT) || - (gSaveContext.save.weekEventReg[12] & 1)) && - ((Flags_GetSwitch(play, this->switchFlag)) || (this->mainType == EN_RAF_TYPE_DORMANT))) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) && + (Flags_GetSwitch(play, this->switchFlag) || (this->mainType == EN_RAF_TYPE_DORMANT))) { s32 i; for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; @@ -700,7 +700,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { DECR(this->timer); this->actionFunc(this, play); - if ((this->action == EN_RAF_ACTION_IDLE) && (gSaveContext.save.weekEventReg[12] & 1)) { + if ((this->action == EN_RAF_ACTION_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; EnRaf_SetupConvulse(this); return; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 7772127a0c..5820cc0c43 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -272,7 +272,7 @@ void EnRailgibud_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (gSaveContext.save.weekEventReg[14] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04)) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index 692bdeef28..051cc8b334 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -149,8 +149,8 @@ void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting - this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80)) { + this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) } else { this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) } diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 2a357739aa..7f6d39886c 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -659,7 +659,7 @@ void func_80BF4EBC(EnRg* this, PlayState* play) { this->actor.shape.yOffset = 14.0f; this->actionFunc = func_80BF4FC4; } - } else if (gSaveContext.save.weekEventReg[12] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_02)) { if (DECR(this->unk_318) == 0) { func_80BF409C(this, 1); this->unk_310 &= ~8; @@ -698,7 +698,7 @@ void func_80BF4FC4(EnRg* this, PlayState* play) { this->unk_310 &= ~0x800; } - if (gSaveContext.eventInf[1] & 1) { + if (CHECK_EVENTINF(EVENTINF_10)) { if (DECR(this->unk_318) == 0) { func_80BF47AC(this, play); @@ -751,7 +751,7 @@ void EnRg_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; SubS_UpdateFlags(&this->unk_310, 3, 7); - if (!(gSaveContext.save.weekEventReg[12] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_02)) { this->unk_318 = Rand_S16Offset(30, 30); } diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index a53ad3bda0..888c65ec55 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -118,7 +118,7 @@ void EnRz_Init(Actor* thisx, PlayState* play) { switch (EN_RZ_GET_TYPE(thisx)) { case EN_RZ_TYPE_1: - if (!(gSaveContext.save.weekEventReg[77] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { Actor_Kill(&this->actor); return; } @@ -129,7 +129,7 @@ void EnRz_Init(Actor* thisx, PlayState* play) { case EN_RZ_TYPE_2: this->actor.flags |= ACTOR_FLAG_10; - if (gSaveContext.save.weekEventReg[77] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { EnRz_ChangeAnim(play, this, EN_RZ_ANIM_LINK_DANCE, ANIMMODE_LOOP, 0.0f); } else { EnRz_ChangeAnim(play, this, EN_RZ_ANIM_DANCE, ANIMMODE_LOOP, 0.0f); @@ -141,7 +141,7 @@ void EnRz_Init(Actor* thisx, PlayState* play) { default: // EN_RZ_TYPE_0 this->stateFlags |= EN_RZ_STATE_2; - if (gSaveContext.save.weekEventReg[77] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { Actor_Kill(&this->actor); return; } @@ -344,7 +344,7 @@ EnRz* EnRz_FindSister(EnRz* this, PlayState* play) { } void func_80BFBDFC(PlayState* play) { - if (gSaveContext.save.weekEventReg[75] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_80)) { func_80151BB4(play, 0x27); } func_80151BB4(play, 0xC); @@ -424,7 +424,7 @@ void func_80BFC078(EnRz* this, PlayState* play) { case 0x2927: case 0x2928: func_80151938(play, play->msgCtx.currentTextId + 1); - gSaveContext.save.weekEventReg[77] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_77_04); break; default: @@ -489,12 +489,12 @@ void func_80BFC2F4(EnRz* this, PlayState* play) { void func_80BFC36C(EnRz* this, PlayState* play) { EnRz_UpdateSkelAnime(this, play); if (func_80BFBFAC(this, play)) { - gSaveContext.save.weekEventReg[77] |= 4; - if (gSaveContext.save.weekEventReg[75] & 0x80) { + SET_WEEKEVENTREG(WEEKEVENTREG_77_04); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_80)) { this->actionFunc = func_80BFC214; } else { this->actionFunc = func_80BFC2F4; - gSaveContext.save.weekEventReg[75] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_75_80); } this->actor.cutscene = this->cutscenes[1]; } @@ -519,7 +519,7 @@ void func_80BFC3F8(EnRz* this, PlayState* play) { this->actor.cutscene = this->cutscenes[0]; this->actor.flags &= ~ACTOR_FLAG_10000; } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { - if (gSaveContext.save.weekEventReg[77] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { Message_StartTextbox(play, 0x2925, &this->actor); func_80BFBDFC(play); } else { @@ -532,7 +532,7 @@ void func_80BFC3F8(EnRz* this, PlayState* play) { } } else if (EnRz_CanTalk(this, play)) { - if (func_80BFBCEC(this, play) && !(gSaveContext.save.weekEventReg[77] & 4) && this->sister != NULL) { + if (func_80BFBCEC(this, play) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04) && this->sister != NULL) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index e78f1970f4..d3330f05fb 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -235,16 +235,16 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { switch (EN_S_GORO_GET_MAIN_TYPE(&this->actor)) { case EN_S_GORO_TYPE_SHRINE_WINTER_A: - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[36] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_02)) { switch (this->textId) { case 0xCFB: return 0xCFC; case 0xCFC: return 0xCFD; case 0xCFD: - gSaveContext.save.weekEventReg[36] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_36_02); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xCFE; default: @@ -255,8 +255,8 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { return 0xCFE; } } else { - if (!(gSaveContext.save.weekEventReg[36] & 1)) { - gSaveContext.save.weekEventReg[36] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_36_01); return 0xCF9; } this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; @@ -266,9 +266,9 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { // Scene flag - Checks whether the chandelier has been lit if (!Flags_GetSwitch(play, EN_S_GORO_SCENEFLAG_INDEX(&this->actor))) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[36] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_08)) { if (this->textId == 0xD02) { - gSaveContext.save.weekEventReg[36] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_36_08); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD03; } @@ -277,10 +277,10 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD04; } - if (!(gSaveContext.save.weekEventReg[36] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_04)) { if (this->textId == 0xCFF) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; - gSaveContext.save.weekEventReg[36] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_36_04); return 0xD00; } return 0xCFF; @@ -288,9 +288,9 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD01; } - if (!(gSaveContext.save.weekEventReg[36] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_10)) { if (this->textId == 0xD05) { - gSaveContext.save.weekEventReg[36] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_36_10); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD06; } @@ -302,14 +302,14 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { break; case EN_S_GORO_TYPE_SHRINE_WINTER_B: - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[36] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_40)) { switch (this->textId) { case 0xD15: return 0xD16; case 0xD16: - gSaveContext.save.weekEventReg[36] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_36_40); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD17; default: @@ -320,20 +320,20 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { return 0xD17; } } else { - if (!(gSaveContext.save.weekEventReg[36] & 0x20)) { - gSaveContext.save.weekEventReg[36] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_36_20); return 0xD13; } this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD14; } } else if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[37] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_37_01)) { switch (this->textId) { case 0xD1E: return 0xD1F; case 0xD1F: - gSaveContext.save.weekEventReg[37] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_37_01); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD20; default: @@ -344,7 +344,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { return 0xD21; } } else { - if (!(gSaveContext.save.weekEventReg[36] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_80)) { switch (this->textId) { case 0xD18: return 0xD19; @@ -353,7 +353,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case 0xD1A: return 0xD1B; case 0xD1B: - gSaveContext.save.weekEventReg[36] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_36_80); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD1C; default: @@ -367,16 +367,16 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { break; case EN_S_GORO_TYPE_SHRINE_WINTER_C: - if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[37] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_37_02)) { switch (this->textId) { case 0xD09: return 0xD0A; case 0xD0A: return 0xD0B; case 0xD0B: - gSaveContext.save.weekEventReg[37] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_37_02); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD0C; default: @@ -391,12 +391,12 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { return 0xD08; } } else if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.save.weekEventReg[37] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_37_04)) { switch (this->textId) { case 0xD0E: return 0xD0F; case 0xD0F: - gSaveContext.save.weekEventReg[37] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_37_04); this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xD10; default: @@ -414,7 +414,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_A: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { if (this->textId == 0xDE3) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xDE4; @@ -429,7 +429,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_B: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { if (this->textId == 0xDE7) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xDE8; @@ -444,7 +444,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_C: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { if (this->textId == 0xDEB) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xDEC; @@ -459,7 +459,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_D: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { if (this->textId == 0xDF1) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xDF2; @@ -482,7 +482,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_E: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { if (this->textId == 0xDF6) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; return 0xDF7; @@ -500,7 +500,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { case EN_S_GORO_TYPE_SHRINE_SPRING_F: if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_80)) { switch (this->textId) { case 0xDFB: return 0xDFC; @@ -771,7 +771,7 @@ void EnSGoro_UpdateSleeping(EnSGoro* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE1); } } - } else if (gSaveContext.save.weekEventReg[22] & 4) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_SUPPRESS_SNORE; } @@ -842,7 +842,7 @@ s32 EnSGoro_CheckGKBehavior(EnSGoro* this, PlayState* play) { return false; } if ((!(this->actionFlags & EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED)) && - ((((EnGk*)this->otherGoron)->unk_1E4 & 0x80) || (gSaveContext.save.weekEventReg[22] & 4))) { + ((((EnGk*)this->otherGoron)->unk_1E4 & 0x80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04))) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED; this->animInfoIndex = EN_S_GORO_ANIM_ROLLUP; @@ -1026,7 +1026,7 @@ void EnSGoro_SetupAction(EnSGoro* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->loadedObjIndex)) { this->actionFlags = 0; if (EN_S_GORO_OFTYPE_WSHRINE) { - if (gSaveContext.save.weekEventReg[22] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED; this->actionFlags |= EN_S_GORO_ACTIONFLAG_EYESOPEN; this->animInfoIndex = EN_S_GORO_ANIM_SHIVER_A; diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c index 15e8089715..fa017af877 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c @@ -73,38 +73,38 @@ void EnScRuppe_UpdateCollision(EnScRuppe* this, PlayState* play) { s32 func_80BD697C(s16 ruppeIndex) { switch (ruppeIndex) { case RUPEE_GREEN: - if (gSaveContext.save.weekEventReg[53] & 4) { - gSaveContext.save.weekEventReg[53] &= (u8)~4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_04)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_53_04); return true; } break; case RUPEE_BLUE: - if (gSaveContext.save.weekEventReg[53] & 0x80) { - gSaveContext.save.weekEventReg[53] &= (u8)~0x80; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_80)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_53_80); return true; } break; case RUPEE_RED: - if (gSaveContext.save.weekEventReg[54] & 1) { - gSaveContext.save.weekEventReg[54] &= (u8)~1; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_01)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_54_01); return true; } break; case RUPEE_ORANGE: - if (gSaveContext.save.weekEventReg[54] & 2) { - gSaveContext.save.weekEventReg[54] &= (u8)~2; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_02)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_54_02); return true; } break; case RUPEE_PURPLE: - if (gSaveContext.save.weekEventReg[54] & 4) { - gSaveContext.save.weekEventReg[54] &= (u8)~4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_04)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_54_04); return true; } break; case RUPEE_UNUSED: - if ((gSaveContext.save.weekEventReg[54] & 8)) { - gSaveContext.save.weekEventReg[54] &= (u8)~8; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_08)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_54_08); return true; } break; diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index bcf7be085d..b37190ee1f 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -69,40 +69,46 @@ void func_80BCD000(EnScopecrow* this, PlayState* play) { s32 func_80BCD09C(s16 arg0) { switch (arg0) { case 0: - if (gSaveContext.save.weekEventReg[53] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_04)) { return true; + } else { + return false; } - return false; case 1: - if (gSaveContext.save.weekEventReg[53] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_80)) { return true; + } else { + return false; } - return false; case 2: - if (gSaveContext.save.weekEventReg[54] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_01)) { return true; + } else { + return false; } - return false; case 3: - if (gSaveContext.save.weekEventReg[54] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_02)) { return true; + } else { + return false; } - return false; case 4: - if (gSaveContext.save.weekEventReg[54] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_04)) { return true; + } else { + return false; } - return false; case 5: - if (gSaveContext.save.weekEventReg[54] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_08)) { return true; + } else { + return false; } - return false; } return false; @@ -111,43 +117,43 @@ s32 func_80BCD09C(s16 arg0) { s32 func_80BCD1AC(s16 arg0) { switch (arg0) { case 0: - if (!(gSaveContext.save.weekEventReg[53] & 4)) { - gSaveContext.save.weekEventReg[53] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_53_04); return true; } break; case 1: - if (!(gSaveContext.save.weekEventReg[53] & 0x80)) { - gSaveContext.save.weekEventReg[53] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_53_80); return true; } break; case 2: - if (!(gSaveContext.save.weekEventReg[54] & 1)) { - gSaveContext.save.weekEventReg[54] |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_54_01)) { + SET_WEEKEVENTREG(WEEKEVENTREG_54_01); return true; } break; case 3: - if (!(gSaveContext.save.weekEventReg[54] & 2)) { - gSaveContext.save.weekEventReg[54] |= 2; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_54_02)) { + SET_WEEKEVENTREG(WEEKEVENTREG_54_02); return true; } break; case 4: - if (!(gSaveContext.save.weekEventReg[54] & 4)) { - gSaveContext.save.weekEventReg[54] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_54_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_54_04); return true; } break; case 5: - if (!(gSaveContext.save.weekEventReg[54] & 8)) { - gSaveContext.save.weekEventReg[54] |= 8; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_54_08)) { + SET_WEEKEVENTREG(WEEKEVENTREG_54_08); return true; } break; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index a4a344ce74..4f82070461 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -170,7 +170,7 @@ void func_80BCAE78(EnScopenuts* this, PlayState* play) { s16 func_80BCAF0C(EnScopenuts* this) { switch (this->unk_33C) { case 0x0: - if (gSaveContext.save.weekEventReg[53] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_02)) { this->unk_328 |= 1; return 0x1638; } @@ -239,7 +239,7 @@ void func_80BCB1C8(EnScopenuts* this, PlayState* play) { this->unk_350 *= 0.92f; Actor_SetScale(&this->actor, this->unk_350); if (this->actor.bgCheckFlags & 1) { - gSaveContext.save.weekEventReg[52] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_52_40); Actor_Kill(&this->actor); } } @@ -368,7 +368,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { void func_80BCB90C(EnScopenuts* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.weekEventReg[53] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_53_02); this->actionFunc = func_80BCB6D0; } else { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); @@ -594,7 +594,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { if (sp32 == 3) { if (this->unk_334 >= (this->path->count - 1)) { ActorCutscene_Stop(this->unk_338); - gSaveContext.save.weekEventReg[52] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_40); this->actionFunc = func_80BCC288; } else { this->unk_334++; @@ -684,8 +684,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { s32 pad; EnScopenuts* this = THIS; - if (!(gSaveContext.save.weekEventReg[74] & 0x40) && - (gSaveContext.save.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40) && (gSaveContext.save.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { Actor_Kill(&this->actor); return; } @@ -705,7 +704,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { this->actor.speedXZ = 0.0f; if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) { - if (gSaveContext.save.weekEventReg[52] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_40)) { Actor_Kill(&this->actor); } else if (play->actorCtx.flags & ACTORCTX_FLAG_1) { this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); @@ -716,7 +715,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } } else if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_1) { - if (gSaveContext.save.weekEventReg[52] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_40)) { this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); if (this->path == NULL) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index 5ad105a76a..88fab32987 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -54,14 +54,15 @@ void EnSekihi_Init(Actor* thisx, PlayState* play) { s32 objectIndex; s32 pad; - if (((params < SEKIHI_TYPE_0) || (params >= SEKIHI_TYPE_MAX)) || sOpaDLists[params] == NULL) { + if ((params < SEKIHI_TYPE_0 || params >= SEKIHI_TYPE_MAX) || sOpaDLists[params] == NULL) { Actor_Kill(&this->dyna.actor); return; } - if ((params == SEKIHI_TYPE_4) && ((gSaveContext.save.skullTokenCount & 0xFFFF) >= 30)) { - gSaveContext.save.weekEventReg[13] |= 0x20; + if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= 30)) { + SET_WEEKEVENTREG(WEEKEVENTREG_13_20); } + objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); if (objectIndex >= 0) { this->objectIndex = objectIndex; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index de8036ef86..e14147a64c 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -348,21 +348,21 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { } else { switch (this->unk_340) { case 0x60E: - gSaveContext.save.weekEventReg[17] |= 0x20; - gSaveContext.save.weekEventReg[86] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_17_20); + SET_WEEKEVENTREG(WEEKEVENTREG_86_04); Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x628: - gSaveContext.save.weekEventReg[77] |= 0x40; - gSaveContext.save.weekEventReg[86] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_77_40); + SET_WEEKEVENTREG(WEEKEVENTREG_86_04); Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x614: - gSaveContext.save.weekEventReg[17] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_17_40); Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; @@ -386,20 +386,20 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; - if (gSaveContext.save.weekEventReg[77] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_40)) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; } } else { this->unk_33A = 1; - if (gSaveContext.save.weekEventReg[17] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_20)) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; } } - } else if (gSaveContext.save.weekEventReg[17] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_40)) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; @@ -479,7 +479,7 @@ void func_80ADBAB8(EnSellnuts* this, PlayState* play) { void func_80ADBBEC(EnSellnuts* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - gSaveContext.save.weekEventReg[17] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_17_80); this->actionFunc = func_80ADBCE4; } else { Actor_PickUp(&this->actor, play, GI_DEED_LAND, 300.0f, 300.0f); @@ -835,7 +835,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_34C == 17) { ActorCutscene_Stop(this->cutscene); - gSaveContext.save.weekEventReg[73] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_73_04); Actor_Kill(&this->actor); } } @@ -871,7 +871,7 @@ void func_80ADCC04(EnSellnuts* this, PlayState* play) { void func_80ADCD3C(EnSellnuts* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); - if (gSaveContext.save.weekEventReg[73] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_04)) { this->unk_338 |= 2; this->unk_338 |= 1; this->unk_340 = 0x626; @@ -947,7 +947,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad2; - if ((gSaveContext.save.weekEventReg[17] & 0x80) || (gSaveContext.save.weekEventReg[61] & 0x10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_61_10)) { Actor_Kill(&this->actor); } @@ -969,7 +969,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->unk_36C = 0.01f; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - if (gSaveContext.save.weekEventReg[73] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_04)) { if (ENSELLNUTS_GET_1(&this->actor)) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 9c1af02bf9..9b5e7e554d 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -216,7 +216,7 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { this->unk_1DA = temp; this->unk_1D8 |= 0x40; } else if (this->unk_1D8 & 0x40) { - if (!(gSaveContext.save.weekEventReg[23] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08)) { func_80AE615C(this, 3); } this->unk_1DA = 0; @@ -258,7 +258,7 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { break; case 6: - gSaveContext.save.weekEventReg[90] &= (u8)~0x40; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_800B7298(play, &this->actor, 7); play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6); gSaveContext.nextCutsceneIndex = 0; @@ -303,7 +303,7 @@ s32 func_80AE68F0(EnShn* this, PlayState* play) { SubS_UpdateFlags(&this->unk_1D8, 0, 7); this->unk_1DC = func_80AE6880(this, play); this->unk_2C6 = 0; - if (gSaveContext.save.weekEventReg[23] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08)) { this->unk_1D8 |= 8; } this->actionFunc = func_80AE6A64; @@ -315,7 +315,7 @@ s32 func_80AE68F0(EnShn* this, PlayState* play) { void func_80AE69E8(EnShn* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); - if ((gSaveContext.save.weekEventReg[23] & 8) && EnShn_IsFacingPlayer(this)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08) && EnShn_IsFacingPlayer(this)) { this->unk_1D8 |= 8; } else { this->unk_1D8 &= ~0x8; @@ -350,7 +350,7 @@ void EnShn_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, NULL, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); this->unk_2E8 = -1; - if (gSaveContext.save.weekEventReg[23] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08)) { func_80AE615C(this, 0); } else { func_80AE615C(this, 2); diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 4fd9f5f148..bb1fb7e0bb 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -807,7 +807,7 @@ void func_809964A0(EnSkb* this, PlayState* play) { void func_809964DC(EnSkb* this, PlayState* play) { if (this->unk_3D6 == 0) { if ((this->actionFunc != func_80994E94) && (this->actionFunc != func_80996284) && - (this->actionFunc != func_809964A0) && (gSaveContext.save.weekEventReg[85] & 0x40)) { + (this->actionFunc != func_809964A0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_85_40)) { this->actor.colChkInfo.health = 0; func_809961E4(this, play); } diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index f2deae2037..bcf62a4380 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -190,7 +190,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { if (this->shopType == BOMB_SHOP) { if (gSaveContext.save.day == 1 && gSaveContext.save.time >= CLOCK_TIME(6, 00)) { return 0x648; - } else if (gSaveContext.save.weekEventReg[33] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { return 0x649; } else { return 0x64A; @@ -229,10 +229,12 @@ u16 EnSob1_GetWelcome(EnSob1* this, PlayState* play) { case PLAYER_MASK_BUNNY: case PLAYER_MASK_POSTMAN: return 0x644; + case PLAYER_MASK_GORON: case PLAYER_MASK_ZORA: case PLAYER_MASK_DEKU: return 0x64B; + case PLAYER_MASK_TRUTH: case PLAYER_MASK_ALL_NIGHT: case PLAYER_MASK_KEATON: @@ -243,78 +245,96 @@ u16 EnSob1_GetWelcome(EnSob1* this, PlayState* play) { case PLAYER_MASK_BREMEN: case PLAYER_MASK_SCENTS: return 0x685; + case PLAYER_MASK_GARO: case PLAYER_MASK_CIRCUS_LEADER: case PLAYER_MASK_GIBDO: case PLAYER_MASK_CAPTAIN: return 0x686; + case PLAYER_MASK_COUPLE: return 0x687; + case PLAYER_MASK_STONE: return 0x688; + case PLAYER_MASK_BLAST: return 0x689; + case PLAYER_MASK_KAFEIS_MASK: return 0x68A; } } else if (this->shopType == ZORA_SHOP) { switch (player->transformation) { case PLAYER_FORM_HUMAN: - if (gSaveContext.save.weekEventReg[57] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_10)) { return 0x12CF; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_57_10); + return 0x12CE; } - gSaveContext.save.weekEventReg[57] |= 0x10; - return 0x12CE; + case PLAYER_FORM_DEKU: - if (gSaveContext.save.weekEventReg[57] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_20)) { return 0x12D1; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_57_20); + return 0x12D0; } - gSaveContext.save.weekEventReg[57] |= 0x20; - return 0x12D0; + case PLAYER_FORM_GORON: - if (gSaveContext.save.weekEventReg[57] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_40)) { return 0x12D3; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_57_40); + return 0x12D2; } - gSaveContext.save.weekEventReg[57] |= 0x40; - return 0x12D2; + case PLAYER_FORM_ZORA: - if (gSaveContext.save.weekEventReg[57] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_80)) { return 0x12D5; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_57_80); + return 0x12D4; } - gSaveContext.save.weekEventReg[57] |= 0x80; - return 0x12D4; + default: return 0x12CE; } } else if (this->shopType == GORON_SHOP) { if (player->transformation != PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[58] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_04)) { return 0xBB9; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_58_04); + return 0xBB8; } - gSaveContext.save.weekEventReg[58] |= 4; - return 0xBB8; } else { - if (gSaveContext.save.weekEventReg[58] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_08)) { return 0xBBB; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_58_08); + return 0xBBA; } - gSaveContext.save.weekEventReg[58] |= 8; - return 0xBBA; } } else if (this->shopType == GORON_SHOP_SPRING) { if (player->transformation != PLAYER_FORM_GORON) { - if (gSaveContext.save.weekEventReg[58] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_10)) { return 0xBBD; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_58_10); + return 0xBBC; } - gSaveContext.save.weekEventReg[58] |= 0x10; - return 0xBBC; } else { - if (gSaveContext.save.weekEventReg[58] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_20)) { return 0xBBF; + } else { + SET_WEEKEVENTREG(WEEKEVENTREG_58_20); + return 0xBBE; } - gSaveContext.save.weekEventReg[58] |= 0x20; - return 0xBBE; } } + return 0; } @@ -386,7 +406,7 @@ void EnSob1_Init(Actor* thisx, PlayState* play) { this->shopType = ZORA_SHOP; break; case GORON_SHOP: - if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { this->shopType = GORON_SHOP_SPRING; } else { this->shopType = GORON_SHOP; @@ -1361,7 +1381,7 @@ void EnSob1_InitShop(EnSob1* this, PlayState* play) { this->actor.world.pos.y += posOffset->y; this->actor.world.pos.z += posOffset->z; shopItems = sShops[this->shopType]; - if ((this->shopType == BOMB_SHOP) && (gSaveContext.save.weekEventReg[33] & 8)) { + if ((this->shopType == BOMB_SHOP) && CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { sShops[this->shopType][0].shopItemId = SI_BOMB_BAG_30_2; } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 023c6ba5d6..7494695fa3 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -708,11 +708,11 @@ void EnSsh_Talk(EnSsh* this, PlayState* play) { void func_809756D0(EnSsh* this, PlayState* play) { u16 phi_a1; - if (gSaveContext.save.weekEventReg[34] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { phi_a1 = 0x914; } else { phi_a1 = 0x910; - gSaveContext.save.weekEventReg[34] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_34_08); } Message_StartTextbox(play, phi_a1, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 4ca1caae43..8e3cc4dac2 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -119,7 +119,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } this->actor.textId = 0; - if (!(gSaveContext.save.weekEventReg[34] & 0x40) || !(gSaveContext.save.weekEventReg[34] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40) || !CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { this->unk_29C |= 1; } break; @@ -136,19 +136,19 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case ENSTH_F_4: - if (gSaveContext.save.weekEventReg[13] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_20)) { Actor_Kill(&this->actor); return; } this->actor.textId = 0; this->actionFunc = func_80B677BC; - if (gSaveContext.save.weekEventReg[13] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_80)) { this->unk_29C |= 2; } break; case ENSTH_F_5: - if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_13_20) || (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { Actor_Kill(&this->actor); return; } @@ -258,7 +258,7 @@ void func_80B67348(EnSth* this, PlayState* play) { break; case 5: - if (gSaveContext.save.weekEventReg[13] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { phi_a1 = 0x113D; } else { phi_a1 = 0x113C; @@ -266,7 +266,7 @@ void func_80B67348(EnSth* this, PlayState* play) { break; default: - if (gSaveContext.save.weekEventReg[13] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { phi_a1 = 0x1142; } else { phi_a1 = 0x1141; @@ -331,14 +331,14 @@ void func_80B67540(EnSth* this, PlayState* play) { break; case 0x1136: - gSaveContext.save.weekEventReg[13] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_13_80); switch (sp2C) { case 0: - if (gSaveContext.save.weekEventReg[13] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { this->actor.home.rot.z = 6; } else { - gSaveContext.save.weekEventReg[13] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_13_40); switch (CUR_UPG_VALUE(UPG_WALLET)) { case 0: this->actor.home.rot.z = 8; @@ -433,14 +433,14 @@ void func_80B67958(EnSth* this, PlayState* play) { void func_80B67984(EnSth* this, PlayState* play) { u16 sp1E; - if (gSaveContext.save.weekEventReg[34] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_10)) { sp1E = 0x903; func_80B670A4(this, 2); - } else if (gSaveContext.save.weekEventReg[34] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_20)) { sp1E = 0x90F; func_80B670A4(this, 2); - } else if (gSaveContext.save.weekEventReg[34] & 0x40) { - if (!(gSaveContext.save.weekEventReg[34] & 8)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { sp1E = 0x91B; } else { sp1E = 0x918; @@ -453,11 +453,11 @@ void func_80B67984(EnSth* this, PlayState* play) { } else { sp1E = 0x916; } - } else if (gSaveContext.save.weekEventReg[34] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_02)) { sp1E = 0x8FF; } else { sp1E = 0x8FC; - gSaveContext.save.weekEventReg[34] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_34_02); } Message_StartTextbox(play, sp1E, &this->actor); } @@ -467,7 +467,7 @@ void func_80B67AB4(EnSth* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B67C1C; - gSaveContext.save.weekEventReg[34] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_34_40); Message_StartTextbox(play, 0x918, &this->actor); } else { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); @@ -484,7 +484,7 @@ void func_80B67B50(EnSth* this, PlayState* play) { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { this->unk_29C &= ~1; - gSaveContext.save.weekEventReg[34] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_34_08); Actor_PickUp(&this->actor, play, GI_MASK_TRUTH, 10000.0f, 50.0f); } } @@ -524,8 +524,8 @@ void func_80B67C1C(EnSth* this, PlayState* play) { break; case 0x91A: - gSaveContext.save.weekEventReg[34] |= 0x40; - gSaveContext.save.weekEventReg[34] &= (u8)~8; + SET_WEEKEVENTREG(WEEKEVENTREG_34_40); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_34_08); case 0x902: case 0x903: @@ -579,8 +579,8 @@ void EnSth_Update(Actor* thisx, PlayState* play) { this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); this->unk_29A = 1; - if ((gSaveContext.save.weekEventReg[34] & 0x10) || (gSaveContext.save.weekEventReg[34] & 0x20) || - (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneId) >= 30)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_34_20) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40) || (Inventory_GetSkullTokenCount(play->sceneId) >= 30)) { func_80B670A4(this, 3); } } else { @@ -598,7 +598,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { break; case ENSTH_F_4: - if (gSaveContext.save.weekEventReg[13] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_80)) { func_80B670A4(this, 5); } else { func_80B670A4(this, 5); diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 9cc5b5fad0..fcd93ff77b 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -161,13 +161,13 @@ void EnStoneheishi_TrackPlayer(EnStoneheishi* this) { void func_80BC94B0(EnStoneheishi* this) { this->textIdIndex = 0; - if (gSaveContext.save.weekEventReg[41] & 0x40) { // After drinking bottle + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40)) { // After drinking bottle EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_CHEER_WITH_SPEAR); this->textIdIndex = 8; this->actor.flags &= ~ACTOR_FLAG_80; } else { // Initial configuration EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_WAVE); - if (gSaveContext.save.weekEventReg[41] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_80)) { this->textIdIndex = 2; } } @@ -185,7 +185,7 @@ void func_80BC9560(EnStoneheishi* this, PlayState* play) { return; } - if (!(gSaveContext.save.weekEventReg[41] & 0x40) && (play->actorCtx.lensMaskSize != 100)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40) && (play->actorCtx.lensMaskSize != 100)) { this->actor.flags |= ACTOR_FLAG_8000000; return; } @@ -286,7 +286,7 @@ void EnStoneheishi_CheckGivenItem(EnStoneheishi* this, PlayState* play) { this->textIdIndex = 3; player->actor.textId = 0; - gSaveContext.save.weekEventReg[41] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_41_80); this->action = EN_STONE_ACTION_1; this->actionFunc = func_80BC9680; } @@ -395,7 +395,7 @@ void func_80BC9D28(EnStoneheishi* this, PlayState* play) { this->actor.parent = NULL; this->textIdIndex++; this->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex]; - gSaveContext.save.weekEventReg[41] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_41_40); Actor_ProcessTalkRequest(&this->actor, &play->state); func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); this->actionFunc = func_80BC9E50; @@ -435,7 +435,7 @@ void EnStoneheishi_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Actor_SetScale(&this->actor, 0.01f); - if (((gSaveContext.save.weekEventReg[41] & 0x40) || (play->actorCtx.lensMaskSize == 100)) && + if ((CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40) || (play->actorCtx.lensMaskSize == 100)) && !(player->stateFlags1 & PLAYER_STATE1_800000)) { if ((this->animIndex != EN_STONE_HEISHI_ANIM_WAVE) && ((((this->action == EN_STONE_ACTION_0) || (this->action == EN_STONE_ACTION_1)) || @@ -447,7 +447,7 @@ void EnStoneheishi_Update(Actor* thisx, PlayState* play) { this->targetHeadRot.y = 0; } - if (!(gSaveContext.save.weekEventReg[41] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40)) { Actor_SetFocus(&this->actor, 30.0f); } else { Actor_SetFocus(&this->actor, 60.0f); @@ -516,7 +516,7 @@ void EnStoneheishi_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (!(gSaveContext.save.weekEventReg[41] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40)) { func_8012C2DC(play->state.gfxCtx); POLY_XLU_DISP = diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index e8d56b6021..e9160116c8 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -130,7 +130,7 @@ static TrackOptionsSet sTrackOptions = { static u8 D_80BAE820[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x80 - 0x04), - /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(0x21, 0x08, 0x7F - 0x08), + /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_33_08, 0x7F - 0x08), /* 0x08 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_ICHIBA, 0x3D - 0x0C), /* 0x0C */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 0, 0, 25, 0x37 - 0x12), /* 0x12 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 25, 0, 30, 0x31 - 0x18), @@ -364,7 +364,7 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { } else if (this->flags1 & 1) { switch (this->textId) { case 0: - if (gSaveContext.save.weekEventReg[81] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_01)) { this->textId = 0x1455; ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; @@ -382,12 +382,12 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { } else { this->flags1 |= 0x400; this->textId = 0x1452; - gSaveContext.save.weekEventReg[81] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_81_01); } break; case 0x1453: this->flags1 |= 0x400; - gSaveContext.save.weekEventReg[81] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_81_01); ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; this->textId = 0x1454; @@ -456,7 +456,7 @@ void func_80BAAFDC(EnSuttari* this, PlayState* play) { if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } - gSaveContext.save.weekEventReg[61] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_61_08); this->unk3F6 = 20; this->actionFunc = func_80BADE8C; } @@ -489,7 +489,7 @@ void func_80BAB1A0(EnSuttari* this, PlayState* play) { if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } - gSaveContext.save.weekEventReg[61] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_61_08); this->unk3F6 = 20; this->actionFunc = func_80BADE8C; } else { @@ -858,7 +858,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->animIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } - if (!(gSaveContext.save.weekEventReg[83] & 4) && !(this->flags1 & 0x1000)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_83_04) && !(this->flags1 & 0x1000)) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { ActorCutscene_Start(this->cutscenes[0], &this->actor); if (!(player->stateFlags1 & PLAYER_STATE1_10000000)) { @@ -907,7 +907,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { Actor_Kill(&this->actor); break; case 2: - if (!(gSaveContext.save.weekEventReg[81] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_81_04)) { this->flags1 |= 0x80; this->actor.world.pos.x = -16.0f; this->actor.world.pos.z = -16.0f; @@ -917,7 +917,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { } break; case 4: - if (!(gSaveContext.save.weekEventReg[33] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { if (this->animIndex == 2 || this->animIndex == 1) { this->animIndex = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); @@ -954,8 +954,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BACA14; return; } else if ((gSaveContext.save.day == 3) && (gSaveContext.save.time <= CLOCK_TIME(19, 0)) && - !(gSaveContext.save.weekEventReg[61] & 8) && !(gSaveContext.save.weekEventReg[33] & 8) && - (gSaveContext.save.weekEventReg[51] & 8)) { + !CHECK_WEEKEVENTREG(WEEKEVENTREG_61_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { this->animIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = func_80BACEE0; @@ -965,8 +965,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_Kill(&this->actor); } - if ((gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7)) || - (gSaveContext.save.weekEventReg[58] & 0x40)) { + + if ((gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_58_40)) { Actor_Kill(&this->actor); } this->cutscenes[0] = this->actor.cutscene; @@ -978,7 +978,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD004; return; } else if (play->sceneId == SCENE_ICHIBA) { - if (gSaveContext.save.weekEventReg[33] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { Actor_Kill(&this->actor); return; } @@ -988,7 +988,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD5F8; return; } else if (play->sceneId == SCENE_AYASHIISHOP) { - if (gSaveContext.save.weekEventReg[33] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { Actor_Kill(&this->actor); return; } @@ -1116,7 +1116,7 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) { func_80BAC2FC(this, play); func_80BAB434(this); if (this->unk428 == 5) { - gSaveContext.save.weekEventReg[58] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_58_80); this->actionFunc = func_80BADDB4; this->actor.speedXZ = 0.0f; } else if (Player_GetMask(play) != PLAYER_MASK_STONE) { @@ -1220,7 +1220,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { this->flags2 |= 8; func_80BAAF1C(this); } else if (this->flags1 & 0x200) { - gSaveContext.save.weekEventReg[79] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_79_40); this->flags2 |= 4; this->actor.speedXZ = 0.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, @@ -1231,7 +1231,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { } if (this->unk1F4[1] == -0x63) { if (this->flags2 & 8) { - gSaveContext.save.weekEventReg[33] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_33_08); } this->actor.speedXZ = 0.0f; Audio_QueueSeqCmd(0x101400FF); @@ -1323,7 +1323,7 @@ void func_80BADA08(EnSuttari* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80BAAB78(this, play); - gSaveContext.save.weekEventReg[81] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_81_04); } else if (this->actor.xzDistToPlayer < 500.0f) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 500.0f); @@ -1401,7 +1401,7 @@ void func_80BADD0C(EnSuttari* this, PlayState* play) { void func_80BADDB4(EnSuttari* this, PlayState* play) { func_80BABA90(this, 1, 1); func_80BAB434(this); - if (gSaveContext.save.weekEventReg[51] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_51_10)) { this->actionFunc = func_80BADE14; } Actor_MoveWithGravity(&this->actor); @@ -1447,7 +1447,7 @@ void EnSuttari_Init(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; - if (gSaveContext.save.weekEventReg[79] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index c6d04def58..bdbc89194c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -222,7 +222,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { } void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); } /** @@ -341,8 +341,8 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { } else { func_8019F208(); Rupees_ChangeBy(-20); - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; @@ -408,11 +408,11 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) break; case 0xA32: // You have to try harder! - if (gSaveContext.save.weekEventReg[63] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { func_801477B4(play); player->stateFlags1 &= ~PLAYER_STATE1_20; - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->actionFunc = EnSyatekiMan_Swamp_Idle; gSaveContext.minigameState = 3; this->shootingGameState = SG_GAME_STATE_NONE; @@ -469,8 +469,8 @@ void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags1 &= ~PLAYER_STATE1_20; - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->actionFunc = EnSyatekiMan_Swamp_Idle; this->shootingGameState = SG_GAME_STATE_NONE; } @@ -660,8 +660,8 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0x3FF; } - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); } } else { func_8019F230(); @@ -747,8 +747,8 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) player->actor.freezeTimer = 0; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; player->stateFlags1 |= PLAYER_STATE1_20; - gSaveContext.save.weekEventReg[63] |= 1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->actionFunc = EnSyatekiMan_Town_MovePlayerAndSayHighScore; } break; @@ -767,10 +767,10 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) break; case 0x401: // You got [score]? Oh, that's too bad... - if (gSaveContext.save.weekEventReg[63] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { func_801477B4(play); - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Town_Idle; } else { @@ -781,10 +781,10 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) break; case 0x403: // You got [score]? Too bad... - if (gSaveContext.save.weekEventReg[63] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { func_801477B4(play); - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Town_Idle; } else { @@ -839,8 +839,8 @@ void EnSyatekiMan_Town_Talk(EnSyatekiMan* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); player->stateFlags1 &= ~PLAYER_STATE1_20; this->actionFunc = EnSyatekiMan_Town_Idle; this->shootingGameState = SG_GAME_STATE_NONE; @@ -862,20 +862,20 @@ void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_HasParent(&this->actor, play)) { - if (!(gSaveContext.save.weekEventReg[59] & 0x10)) { - gSaveContext.save.weekEventReg[59] |= 0x10; - } else if (!(gSaveContext.save.weekEventReg[32] & 2) && (this->score >= 2180)) { - gSaveContext.save.weekEventReg[32] |= 2; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_59_10); + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_02) && (this->score >= 2180)) { + SET_WEEKEVENTREG(WEEKEVENTREG_32_02); } this->actor.parent = NULL; this->actionFunc = EnSyatekiMan_Swamp_GiveReward; } else { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x10)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_10)) { Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else if (this->score < 2180) { Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); - } else if (!(gSaveContext.save.weekEventReg[32] & 2)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_02)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -917,14 +917,14 @@ void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { if (this->prevTextId == 0x407) { - if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { - gSaveContext.save.weekEventReg[59] |= 0x20; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { + SET_WEEKEVENTREG(WEEKEVENTREG_59_20); } } if ((this->prevTextId == 0x405) || (this->prevTextId == 0x406)) { - if (!(gSaveContext.save.weekEventReg[32] & 4)) { - gSaveContext.save.weekEventReg[32] |= 4; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_32_04); } } @@ -932,12 +932,12 @@ void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Town_GiveReward; } else { if (this->prevTextId == 0x407) { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x20)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } - } else if (!(gSaveContext.save.weekEventReg[32] & 4)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_04)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); @@ -958,8 +958,8 @@ void EnSyatekiMan_Town_GiveReward(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20; this->score = 0; this->shootingGameState = SG_GAME_STATE_NONE; - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->actionFunc = EnSyatekiMan_SetupIdle; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -1118,9 +1118,9 @@ void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0xA34; this->shootingGameState = SG_GAME_STATE_ENDED; } else if (this->score >= 2000) { - if (gSaveContext.save.weekEventReg[63] & 2) { - gSaveContext.save.weekEventReg[63] &= (u8)~1; - gSaveContext.save.weekEventReg[63] &= (u8)~2; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); this->shootingGameState = SG_GAME_STATE_NONE; gSaveContext.minigameState = 3; this->actionFunc = EnSyatekiMan_Swamp_Idle; @@ -1373,7 +1373,7 @@ void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play) { this->talkWaitTimer = 15; if ((GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) || (this->score == 50)) { if (GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { - if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { // You got a new record! Message_StartTextbox(play, 0x407, &this->actor); this->prevTextId = 0x407; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index ad1367f061..1e012aeecb 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -435,8 +435,7 @@ s32 func_80BE10BC(EnTab* this, PlayState* play) { } else { dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_1E4->actor.world.pos); - if ((gSaveContext.save.weekEventReg[75] & 1) || (this->unk_1E4->actor.draw == NULL) || - !(dist < 160.0f)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01) || (this->unk_1E4->actor.draw == NULL) || !(dist < 160.0f)) { tempActor = &GET_PLAYER(play)->actor; this->actor.child = tempActor; } else { diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 1c46247baf..58dd65c163 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -143,7 +143,7 @@ void EnTanron2_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); - if ((KREG(64) != 0) || (gSaveContext.eventInf[6] & 1)) { + if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_60)) { func_80BB69C0(this); } else { func_80BB6F64(this); diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 439f3837f7..ea2eb452c0 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -71,7 +71,7 @@ void func_80A41D70(EnTest4* this, PlayState* play) { this->actionFunc = func_80A42F20; sCurrentCs = sCutscenes[this->unk_144]; this->transitionCsTimer = 0; - gSaveContext.eventInf[1] |= 0x80; + SET_EVENTINF(EVENTINF_17); } else if (this->unk_144 == 0) { play_sound(NA_SE_EV_CHICKEN_CRY_M); } else { @@ -108,7 +108,7 @@ void func_80A41FA4(EnTest4* this, PlayState* play) { this->actionFunc = func_80A42F20; sCurrentCs = sCutscenes[this->unk_144]; this->transitionCsTimer = 0; - gSaveContext.eventInf[1] |= 0x80; + SET_EVENTINF(EVENTINF_17); } else if (this->unk_144 == 0) { play_sound(NA_SE_EV_CHICKEN_CRY_M); } else { @@ -298,14 +298,14 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { if (temp_v0 >= 0) { ActorCutscene* temp_v0_2 = ActorCutscene_GetCutscene(sCutscenes[0]); - gSaveContext.eventInf[5] |= 0x4; + SET_EVENTINF(EVENTINF_52); sCutscenes[1] = temp_v0_2->additionalCutscene; } else { - gSaveContext.eventInf[5] &= (u8)~0x4; + CLEAR_EVENTINF(EVENTINF_52); sCutscenes[1] = sCutscenes[0]; } - if (sIsLoaded || (gSaveContext.eventInf[2] & 0x80)) { + if (sIsLoaded || (CHECK_EVENTINF(EVENTINF_27))) { Actor_Kill(&this->actor); } else { sIsLoaded = true; @@ -391,7 +391,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if (CURRENT_DAY == 3) { Interface_StartMoonCrash(play); Actor_Kill(&this->actor); - gSaveContext.eventInf[1] |= 0x80; + SET_EVENTINF(EVENTINF_17); } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) && (CURRENT_DAY != 3)) { func_80A41FA4(this, play); @@ -413,7 +413,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { } gSaveContext.respawnFlag = -4; - gSaveContext.eventInf[2] |= 0x80; + SET_EVENTINF(EVENTINF_27); Actor_Kill(&this->actor); } } @@ -508,8 +508,9 @@ void func_80A42F20(EnTest4* this, PlayState* play) { if (sCurrentCs >= 0) { ActorCutscene_Stop(sCurrentCs); } + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; - gSaveContext.eventInf[1] &= (u8)~0x80; + CLEAR_EVENTINF(EVENTINF_17); Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 0e171a21dd..4088c4fc29 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -125,7 +125,7 @@ void func_80A90730(EnTest6* this, PlayState* play) { phi_s0 = 0; phi_f24 = -900.0f; - if (gSaveContext.eventInf[7] & 1) { + if (CHECK_EVENTINF(EVENTINF_70)) { for (i = 0; i < 6; i++) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 5; } @@ -134,7 +134,7 @@ void func_80A90730(EnTest6* this, PlayState* play) { phi_s0 |= 1; } - if (gSaveContext.eventInf[7] & 0x10) { + if (CHECK_EVENTINF(EVENTINF_74)) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; if (!(phi_s0 & 1)) { @@ -144,7 +144,7 @@ void func_80A90730(EnTest6* this, PlayState* play) { phi_s0 |= 0x10; } - if (gSaveContext.eventInf[7] & 2) { + if (CHECK_EVENTINF(EVENTINF_71)) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; if (!(phi_s0 & 1)) { @@ -154,7 +154,7 @@ void func_80A90730(EnTest6* this, PlayState* play) { phi_s0 |= 2; } - if (gSaveContext.eventInf[7] & 4) { + if (CHECK_EVENTINF(EVENTINF_72)) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 3; if (!(phi_s0 & (0x10 | 0x2 | 0x1))) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 3; @@ -162,7 +162,7 @@ void func_80A90730(EnTest6* this, PlayState* play) { phi_s0 |= 4; } - if (gSaveContext.eventInf[7] & 8) { + if (CHECK_EVENTINF(EVENTINF_73)) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 4; if (!(phi_s0 & (0x10 | 0x2 | 0x1))) { D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 4; @@ -722,7 +722,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 1: func_80A90C34(); - if (gSaveContext.eventInf[5] & 4) { + if (CHECK_EVENTINF(EVENTINF_52)) { this->unk_274 = 9; } break; @@ -979,7 +979,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { play->transitionType = TRANS_TYPE_02; if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; - gSaveContext.eventInf[2] |= 0x80; + SET_EVENTINF(EVENTINF_27); } else { gSaveContext.respawnFlag = 2; } diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index ea671d4ad0..43facd8312 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -667,10 +667,10 @@ void func_80AF2350(EnTest7* this, PlayState* play) { gSaveContext.respawnFlag = -6; } else { play->nextEntrance = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; - if ((play->nextEntrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && (gSaveContext.save.weekEventReg[20] & 2)) { + if ((play->nextEntrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); } else if ((play->nextEntrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && - (gSaveContext.save.weekEventReg[33] & 0x80)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } } diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index fa140ba850..dde29c8241 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -49,7 +49,7 @@ void EnTimeTag_Init(Actor* thisx, PlayState* play) { switch (ENTIMETAG_GET_E000(&this->actor)) { case 4: - if ((gSaveContext.save.weekEventReg[8] & 0x40) || (CURRENT_DAY != 3)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40) || (CURRENT_DAY != 3)) { Actor_Kill(&this->actor); return; } @@ -93,7 +93,7 @@ void func_80AC9FE4(EnTimeTag* this, PlayState* play) { gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - gSaveContext.save.weekEventReg[25] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_25_02); } } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -273,7 +273,7 @@ void func_80ACA724(EnTimeTag* this, PlayState* play) { } void func_80ACA7C4(EnTimeTag* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[63] & 1) && !(gSaveContext.save.weekEventReg[63] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { func_800B7298(play, &this->actor, 7); Message_StartTextbox(play, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); this->actionFunc = func_80ACA724; @@ -287,11 +287,11 @@ void func_80ACA840(EnTimeTag* this, PlayState* play) { if ((play->sceneId != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { temp_ft4 = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F temp_hi = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; - if (gSaveContext.save.weekEventReg[63] & 1) { - if (gSaveContext.save.weekEventReg[63] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { this->actionFunc = func_80ACA7C4; } else if ((temp_ft4 == this->actor.home.rot.x) && (temp_hi == this->actor.home.rot.y)) { - gSaveContext.save.weekEventReg[63] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_63_02); } } else if ((temp_ft4 == this->actor.home.rot.x) && (temp_hi == this->actor.home.rot.y) && !Play_InCsMode(play)) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 5ce216affb..287d6a5e76 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -535,9 +535,9 @@ void func_80AED4F8(EnTk* this, PlayState* play) { } void func_80AED544(EnTk* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[31] & 0x10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_10)) { Message_StartTextbox(play, 0x13FE, &this->actor); - gSaveContext.save.weekEventReg[31] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_31_10); } else if (gSaveContext.save.time < CLOCK_TIME(9, 0)) { Message_StartTextbox(play, 0x13FF, &this->actor); } else if (gSaveContext.save.time < CLOCK_TIME(12, 0)) { @@ -564,7 +564,7 @@ void func_80AED610(EnTk* this, PlayState* play) { func_80AED544(this, play); } else if (!Flags_GetSwitch(play, ENTK_GET_7F0(&this->actor))) { Message_StartTextbox(play, 0x1403, &this->actor); - } else if (gSaveContext.save.weekEventReg[60] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_02)) { func_80AED544(this, play); } else { Message_StartTextbox(play, 0x1413, &this->actor); @@ -595,7 +595,7 @@ void func_80AED610(EnTk* this, PlayState* play) { case 0x1413: Rupees_ChangeBy(30); - gSaveContext.save.weekEventReg[60] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_60_02); func_80151938(play, 0x13FF); break; @@ -758,7 +758,7 @@ void func_80AEDE10(EnTk* this, PlayState* play) { switch (this->unk_310) { case 0: this->unk_2CA &= ~0x1000; - if (!(gSaveContext.save.weekEventReg[52] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_52_80)) { this->unk_2E6 = 0x1405; } else { this->unk_2E6 = 0x140B; @@ -863,7 +863,7 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { break; case 0x140A: - gSaveContext.save.weekEventReg[52] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_52_80); case 0x140B: func_80AEE784(this, play); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 75878a7b6c..89379c05cc 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -11,7 +11,7 @@ #define THIS ((EnToto*)thisx) -#define ENTOTO_WEEK_EVENT_FLAGS (gSaveContext.save.weekEventReg[50] & 1 || gSaveContext.save.weekEventReg[51] & 0x80) +#define ENTOTO_WEEK_EVENT_FLAGS (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80)) void EnToto_Init(Actor* thisx, PlayState* play); void EnToto_Destroy(Actor* thisx, PlayState* play); @@ -551,16 +551,16 @@ s32 func_80BA46D8(EnToto* this, PlayState* play) { s32 func_80BA4740(EnToto* this, PlayState* play) { if (play->msgCtx.ocarinaMode == 4) { if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - gSaveContext.save.weekEventReg[56] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_56_10); } if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - gSaveContext.save.weekEventReg[56] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_56_20); } if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - gSaveContext.save.weekEventReg[56] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_56_40); } if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { - gSaveContext.save.weekEventReg[56] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_56_80); } return 1; } @@ -572,16 +572,16 @@ s32 func_80BA47E0(EnToto* this, PlayState* play) { s32 i; this->unk2B3 = 0; - if (gSaveContext.save.weekEventReg[56] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_10)) { this->unk2B3 += 1; } - if (gSaveContext.save.weekEventReg[56] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_20)) { this->unk2B3 += 2; } - if (gSaveContext.save.weekEventReg[56] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_40)) { this->unk2B3 += 4; } - if (gSaveContext.save.weekEventReg[56] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_80)) { this->unk2B3 += 8; } for (i = 0; i < 4; i++) { @@ -621,9 +621,9 @@ s32 func_80BA4A00(EnToto* this, PlayState* play) { func_800B7298(play, NULL, 0x45); if (this->unk2B3 == 0xF) { if (CURRENT_DAY == 1) { - gSaveContext.save.weekEventReg[50] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_50_01); } else { - gSaveContext.save.weekEventReg[51] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_51_80); } } else { func_80BA402C(this, play); diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 3c144bc99c..3a9729c907 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -202,7 +202,7 @@ u16 EnTrt_GetItemTextId(EnTrt* this) { u16 EnTrt_GetItemChoiceTextId(EnTrt* this) { EnGirlA* item = this->items[this->cursorIndex]; - if ((item->actor.params == SI_POTION_BLUE) && !(gSaveContext.save.weekEventReg[53] & 0x10)) { + if ((item->actor.params == SI_POTION_BLUE) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_53_10)) { this->textId = 0x881; return 0x881; } @@ -348,7 +348,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { case 0x883: this->textId = 0x884; Message_StartTextbox(play, this->textId, &this->actor); - gSaveContext.save.weekEventReg[53] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_53_08); func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x888: @@ -400,7 +400,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) { void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x88F) { - if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { + if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -411,28 +411,28 @@ void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) { } else { this->prevTextId = this->textId; this->textId = 0x88E; - gSaveContext.save.weekEventReg[85] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_85_08); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } else { - if (gSaveContext.save.weekEventReg[12] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { this->textId = 0x83D; EnTrt_SetupStartShopping(play, this, 0); - } else if (gSaveContext.save.weekEventReg[84] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { this->textId = 0x83B; if (Inventory_HasItemInBottle(ITEM_POTION_RED)) { EnTrt_SetupStartShopping(play, this, false); } else { this->actionFunc = EnTrt_TryToGiveRedPotion; } - } else if (gSaveContext.save.weekEventReg[16] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { this->timer = 30; this->textId = 0x838; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; this->actionFunc = EnTrt_Surprised; return; - } else if (gSaveContext.save.weekEventReg[17] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { this->textId = 0x835; EnTrt_SetupStartShopping(play, this, false); } @@ -446,13 +446,13 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { - gSaveContext.save.weekEventReg[12] |= 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_12_10); } - gSaveContext.save.weekEventReg[84] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_84_40); player->stateFlags2 &= ~PLAYER_STATE2_20000000; this->actionFunc = EnTrt_GivenRedPotionForKoume; - } else if (gSaveContext.save.weekEventReg[12] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); @@ -753,7 +753,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item->boughtFunc(play, item); - gSaveContext.save.weekEventReg[53] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_53_10); } } } @@ -762,14 +762,14 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((gSaveContext.save.weekEventReg[85] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { this->textId = 0x88F; } else if (!(this->flags & ENTRT_MET)) { this->textId = 0x834; } else { this->textId = 0x83E; } - if (!(gSaveContext.save.weekEventReg[53] & 8)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { this->talkOptionTextId = 0x845; } else if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->talkOptionTextId = 0x882; @@ -894,8 +894,8 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { this->animIndex = TRT_ANIM_HANDS_ON_COUNTER; switch (this->textId) { case 0x834: - if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && - !(gSaveContext.save.weekEventReg[16] & 0x10) && !(gSaveContext.save.weekEventReg[17] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -952,7 +952,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_Blink; if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { + if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -961,7 +961,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { } else { this->prevTextId = this->textId; this->textId = 0x88E; - gSaveContext.save.weekEventReg[85] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_85_08); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -982,7 +982,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { } else { this->prevTextId = this->textId; this->textId = 0x88E; - gSaveContext.save.weekEventReg[85] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_85_08); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -1054,7 +1054,7 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { } } if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - if (gSaveContext.save.weekEventReg[20] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 5); } else { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 5); @@ -1394,7 +1394,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { itemGiven = func_80123810(play); if (itemGiven > PLAYER_AP_NONE) { if (itemGiven == PLAYER_AP_BOTTLE_MUSHROOM) { - if (gSaveContext.save.weekEventReg[53] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { player->actor.textId = 0x888; } else { player->actor.textId = 0x883; @@ -1463,7 +1463,7 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) { void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeSleepingAnim, NULL, NULL, 0); - if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && (gSaveContext.save.day >= 2)) { this->actor.draw = NULL; } else { @@ -1479,7 +1479,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->timer = Rand_S16Offset(40, 20); - if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && gSaveContext.save.day >= 2) { this->textId = 0x84A; this->actionFunc = EnTrt_ShopkeeperGone; @@ -1545,7 +1545,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) { this->blinkTimer = 20; this->eyeTexIndex = 0; this->blinkFunc = EnTrt_EyesClosed; - if (gSaveContext.save.weekEventReg[53] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { this->flags |= ENTRT_GIVEN_MUSHROOM; } diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 0dca63bd20..2b5d24b802 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -144,13 +144,13 @@ void func_80AD341C(EnTrt2* this, PlayState* play) { } void func_80AD349C(EnTrt2* this) { - if ((gSaveContext.save.weekEventReg[85] & 0x10) && !(gSaveContext.save.weekEventReg[84] & 0x40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { this->unk_3A8 = 0x88F; } else if (this->unk_3A8 == 0) { this->unk_3A8 = 0x84B; - } else if (gSaveContext.save.weekEventReg[16] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { this->unk_3A8 = 0x838; - } else if (gSaveContext.save.weekEventReg[17] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { this->unk_3A8 = 0x84D; } else { this->unk_3A8 = 0x849; @@ -378,7 +378,7 @@ void func_80AD3E34(EnTrt2* this, PlayState* play) { play->msgCtx.stateTimer = 4; this->unk_3B2 = 12; } else { - gSaveContext.save.weekEventReg[85] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_85_10); this->unk_3A8 = 0x88E; Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; @@ -391,11 +391,11 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play)) { - if ((Inventory_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || - !(gSaveContext.save.weekEventReg[12] & 0x10)) { + if ((Inventory_HasEmptyBottle() && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) || + !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { this->unk_3B2 = 12; } else { - gSaveContext.save.weekEventReg[85] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_85_10); this->unk_3A8 = 0x88E; Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; @@ -410,13 +410,13 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { void func_80AD3FF4(EnTrt2* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { - gSaveContext.save.weekEventReg[12] |= 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_12_10); } - gSaveContext.save.weekEventReg[84] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_84_40); this->actor.parent = NULL; this->unk_3B2 = 14; - } else if (gSaveContext.save.weekEventReg[12] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); @@ -742,20 +742,20 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { this->unk_3B8 = 0; this->unk_3BC = func_80AD4608; - if (gSaveContext.save.weekEventReg[12] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { Actor_Kill(&this->actor); return; } - if (gSaveContext.save.weekEventReg[84] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { Actor_Kill(&this->actor); return; } if ((play->sceneId == SCENE_20SICHITAI) || (play->sceneId == SCENE_20SICHITAI2)) { if (gSaveContext.save.day == 2) { - if (!(gSaveContext.save.weekEventReg[15] & 0x80)) { - gSaveContext.save.weekEventReg[15] |= 0x80; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_15_80)) { + SET_WEEKEVENTREG(WEEKEVENTREG_15_80); this->unk_3B2 = 3; } else { Actor_Kill(&this->actor); @@ -766,7 +766,7 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { return; } } else if (gSaveContext.save.day == 2) { - if (gSaveContext.save.weekEventReg[15] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_15_80)) { this->unk_3B2 = 4; } else { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 518ca189e6..e959b30fe7 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -671,11 +671,11 @@ UNK_TYPE* func_80A871E0(EnTru* this, PlayState* play) { return D_80A88924; } - if (!(this->unk_34E & 0x40) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { + if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { return D_80A88918; } - if ((this->unk_34E & 0x1000) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x1000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { return D_80A88910; } @@ -770,7 +770,7 @@ s32 func_80A875AC(Actor* thisx, PlayState* play) { switch (this->unk_364) { case 0: - if ((this->unk_34E & 0x40) || (gSaveContext.save.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x40) || CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { this->unk_374 = this->actor.cutscene; this->unk_364++; } else { @@ -1040,7 +1040,7 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { case 4: if (func_80A87400(this, play) || (DECR(this->unk_362) == 0)) { ret = true; - gSaveContext.save.weekEventReg[12] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_12_08); } break; } @@ -1057,7 +1057,7 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { void func_80A87FD0(EnTru* this, PlayState* play) { if (this->actor.draw != NULL) { - if ((this->unk_34E & 0x80) || (gSaveContext.save.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { if (func_80A873B8(this)) { SubS_UpdateFlags(&this->unk_34E, 3, 7); } else { @@ -1080,7 +1080,7 @@ void func_80A87FD0(EnTru* this, PlayState* play) { EnTru_ChangeAnim(this, KOUME_ANIM_TRY_GET_UP); } } - } else if (!(gSaveContext.save.weekEventReg[16] & 0x10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && (this->actor.xzDistToPlayer < 140.0f)) { SubS_UpdateFlags(&this->unk_34E, 4, 7); this->unk_34E |= 0x1040; @@ -1105,12 +1105,12 @@ void func_80A881E0(EnTru* this, PlayState* play) { ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); } - if (!(this->unk_34E & 0x40) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { + if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_LYING_DOWN); } else if (this->unk_34E & 0x80) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_LYING_DOWN); func_80A86460(this); - } else if (gSaveContext.save.weekEventReg[16] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_HEAD_UP_MORPH); } @@ -1127,7 +1127,7 @@ void func_80A881E0(EnTru* this, PlayState* play) { void EnTru_Init(Actor* thisx, PlayState* play) { EnTru* this = THIS; - if ((gSaveContext.save.entrance != 0xC200) || (gSaveContext.save.weekEventReg[12] & 8)) { + if ((gSaveContext.save.entrance != ENTRANCE(WOODS_OF_MYSTERY, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { Actor_Kill(&this->actor); return; } @@ -1147,7 +1147,7 @@ void EnTru_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.008f); this->unk_34E = 0; - if (gSaveContext.save.weekEventReg[16] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_HEAD_UP); } else { this->unk_388 = PLAYER_AP_NONE; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index dd199db69b..2371ec3e8f 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -344,18 +344,18 @@ void func_80B76980(EnTruMt* this, PlayState* play) { if (gSaveContext.unk_3F3C >= 10) { Message_StartTextbox(play, 0x87F, &this->actor); - gSaveContext.eventInf[3] |= 0x40; - gSaveContext.eventInf[4] |= 1; + SET_EVENTINF(EVENTINF_36); + SET_EVENTINF(EVENTINF_40); player->stateFlags3 &= ~PLAYER_STATE3_400; this->actor.speedXZ = 0.0f; this->actionFunc = func_80B76BB8; - } else if (gSaveContext.eventInf[4] & 1) { + } else if (CHECK_EVENTINF(EVENTINF_40)) { u32 score = gSaveContext.minigameScore; if (((gSaveContext.save.unk_EE8 & 0xFFFF0000) >> 0x10) < score) { gSaveContext.save.unk_EE8 = ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.save.unk_EE8 & 0xFFFF); - gSaveContext.eventInf[3] |= 0x80; + SET_EVENTINF(EVENTINF_37); } } } @@ -413,7 +413,7 @@ void EnTruMt_Init(Actor* thisx, PlayState* play) { s32 pad; EnTruMt* this = THIS; - if (!(gSaveContext.eventInf[3] & 0x20)) { + if (!CHECK_EVENTINF(EVENTINF_35)) { Actor_Kill(&this->actor); return; } @@ -461,7 +461,7 @@ void EnTruMt_Update(Actor* thisx, PlayState* play) { func_80B76110(this); Actor_SetFocus(&this->actor, 34.0f); - if (!(gSaveContext.eventInf[4] & 1)) { + if (!CHECK_EVENTINF(EVENTINF_40)) { func_80B761FC(this, play); } diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 31674a6684..c4572a11ae 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -87,7 +87,7 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { switch (ENTSN_GET_F(&this->actor)) { case ENTSN_F_0: - if (gSaveContext.save.weekEventReg[26] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { Actor_Kill(&this->actor); return; } @@ -95,7 +95,7 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { break; case ENTSN_F_1: - if (gSaveContext.save.weekEventReg[26] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_04)) { this->actor.textId = 0x1091; } else { this->actor.textId = 0x108A; @@ -103,7 +103,7 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { break; } - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_0) { this->actionFunc = func_80AE0D78; } else { @@ -144,7 +144,7 @@ void EnTsn_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } } @@ -158,15 +158,15 @@ void EnTsn_Destroy(Actor* thisx, PlayState* play) { void func_80ADFF84(EnTsn* this, PlayState* play) { u16 textId; - if (gSaveContext.save.weekEventReg[26] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { textId = 0x107E; } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[25] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_80)) { textId = 0x1083; } else { textId = 0x107F; } - } else if (gSaveContext.save.weekEventReg[26] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_01)) { textId = 0x1089; } else { textId = 0x1084; @@ -208,14 +208,14 @@ void func_80AE0010(EnTsn* this, PlayState* play) { case 0x1082: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); - gSaveContext.save.weekEventReg[25] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_25_80); func_801477B4(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1083: - gSaveContext.save.weekEventReg[25] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_25_80); func_801477B4(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; @@ -233,7 +233,7 @@ void func_80AE0010(EnTsn* this, PlayState* play) { case 0x1089: case 0x1093: - gSaveContext.save.weekEventReg[26] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_26_01); func_801477B4(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; @@ -246,7 +246,7 @@ void func_80AE0010(EnTsn* this, PlayState* play) { break; case 0x1088: - gSaveContext.save.weekEventReg[26] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_26_01); if (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) { func_801477B4(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); @@ -317,7 +317,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { sp24 = func_80123810(play); if (sp24 != 0) { - gSaveContext.save.weekEventReg[26] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_26_02); } if (sp24 > 0) { @@ -389,13 +389,13 @@ void func_80AE0704(EnTsn* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x106E: - if (gSaveContext.save.weekEventReg[25] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_40)) { func_80151938(play, 0x1074); } else { func_80151938(play, 0x106F); } this->unk_220 |= 2; - gSaveContext.save.weekEventReg[25] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_25_40); ENTSN_SET_Z(&this->unk_1D8->actor, true); this->unk_220 |= 4; break; @@ -426,7 +426,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x107C: if (Inventory_HasEmptyBottle()) { - gSaveContext.save.weekEventReg[26] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_26_08); func_801477B4(play); this->actionFunc = func_80AE0460; func_80AE0460(this, play); @@ -463,7 +463,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x108A: case 0x1091: - gSaveContext.save.weekEventReg[26] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_26_04); func_80151938(play, play->msgCtx.currentTextId + 1); this->unk_220 |= 2; this->actor.textId = 0x1091; @@ -478,7 +478,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { break; case 0x1092: - if (gSaveContext.save.weekEventReg[26] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { func_80AE0698(this, play); } else { func_80151938(play, 0x10A7); diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index e0c46c7cba..31af7f8b6c 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -74,18 +74,18 @@ void EnTwig_Init(Actor* thisx, PlayState* play2) { break; case 1: if (!sRingsHaveSpawned) { - sRingCount = (gSaveContext.save.weekEventReg[24] & 4) ? 25 : 20; + sRingCount = CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04) ? 25 : 20; for (i = 0; i < sRingCount; i++) { sRingNotCollected[i] = false; } sRingsHaveSpawned = true; } if (RACERING_GET_PARAM_1F0(&this->dyna.actor) != 0) { - if (!(gSaveContext.save.weekEventReg[24] & 4)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { Actor_Kill(&this->dyna.actor); return; } - } else if (gSaveContext.save.weekEventReg[24] & 4) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index ebbc71ca30..ea95cc6d02 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -77,7 +77,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966A08); break; case WEATHERTAG_TYPE_UNK1: - if (gSaveContext.save.weekEventReg[52] & 0x20) { // if cleared STT + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { Actor_Kill(&this->actor); } EnWeatherTag_SetupAction(this, func_80966B08); diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 106b23926c..4effb0da7a 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -120,8 +120,7 @@ void EnYb_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; } - // check if already healed - if (gSaveContext.save.weekEventReg[82] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_04)) { Actor_Kill(&this->actor); } } @@ -292,7 +291,7 @@ void EnYb_Talk(EnYb* this, PlayState* play) { case 0x147D: // I am counting on you func_801477B4(play); this->actionFunc = EnYb_Disappear; - gSaveContext.save.weekEventReg[82] |= 0x4; + SET_WEEKEVENTREG(WEEKEVENTREG_82_04); break; case 0x147C: // Spread my dance across the world if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index cebdd68cff..58dd246d8b 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -114,13 +114,13 @@ void EnZob_Init(Actor* thisx, PlayState* play) { switch (ENZOB_GET_F(&this->actor)) { case ENZOB_F_1: - if (gSaveContext.save.weekEventReg[78] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_01)) { this->actionFunc = func_80BA0BB4; } else { this->actionFunc = func_80BA0AD8; } - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); return; } @@ -135,7 +135,7 @@ void EnZob_Init(Actor* thisx, PlayState* play) { break; default: - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -211,7 +211,7 @@ void func_80B9FA3C(EnZob* this, PlayState* play) { this->unk_2F4 |= 1; if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[30] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_30_02)) { textId = 0x11F9; } else { textId = 0x11F8; @@ -222,7 +222,7 @@ void func_80B9FA3C(EnZob* this, PlayState* play) { textId = 0x1210; this->unk_304 = 3; func_80B9F7E4(this, 5, ANIMMODE_ONCE); - } else if (gSaveContext.save.weekEventReg[31] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_08)) { textId = 0x1205; this->unk_304 = 1; func_80B9F7E4(this, 3, ANIMMODE_LOOP); @@ -234,12 +234,12 @@ void func_80B9FA3C(EnZob* this, PlayState* play) { textId = 0x1203; this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); - } else if (gSaveContext.save.weekEventReg[30] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_30_08)) { textId = 0x11FA; this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); - } else if (!(gSaveContext.save.weekEventReg[30] & 4)) { - gSaveContext.save.weekEventReg[30] |= 4; + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_30_04)) { + SET_WEEKEVENTREG(WEEKEVENTREG_30_04); textId = 0x11FB; this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); @@ -420,7 +420,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { break; case 0x120F: - gSaveContext.save.weekEventReg[31] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_31_08); this->unk_2F4 |= 0x10; func_80B9FCA0(this, play); break; @@ -473,7 +473,7 @@ void func_80BA0374(EnZob* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x11F8: - gSaveContext.save.weekEventReg[30] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_30_02); func_80151938(play, 0x11F9); break; @@ -565,7 +565,7 @@ void func_80BA0728(EnZob* this, PlayState* play) { if (func_800B8718(&this->actor, &play->state)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { Message_StartTextbox(play, 0x1208, NULL); - gSaveContext.save.weekEventReg[30] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_30_08); } else { Message_StartTextbox(play, 0x1216, NULL); } @@ -595,17 +595,17 @@ void func_80BA08E8(EnZob* this, PlayState* play) { s32 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1257; this->unk_304 = 3; func_80B9F7E4(this, 4, ANIMMODE_ONCE); - } else if (gSaveContext.save.weekEventReg[78] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_40)) { textId = 0x1256; this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); } else { textId = 0x1255; - gSaveContext.save.weekEventReg[78] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_78_40); this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); } @@ -664,7 +664,7 @@ void func_80BA0AD8(EnZob* this, PlayState* play) { void func_80BA0BB4(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { this->actionFunc = func_80BA09E0; func_80B9F7E4(this, 0, ANIMMODE_ONCE); this->unk_304 = 5; diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 4f0a829807..b0312fffb4 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -264,7 +264,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { } } - if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (gSaveContext.save.weekEventReg[88] & 0x10)) { + if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && CHECK_WEEKEVENTREG(WEEKEVENTREG_88_10)) { this->unk_302 = this->unk_300 = 0; this->unk_2FC = this->unk_2FE = 3; this->actor.flags |= ACTOR_FLAG_2000000; @@ -274,7 +274,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, D_80B958DC[0]); this->actor.textId = 0x1009; - if (gSaveContext.save.weekEventReg[91] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_91_02)) { this->actor.textId = 0x103C; this->actionFunc = func_80B9451C; } else { @@ -645,7 +645,7 @@ void func_80B9461C(EnZog* this, PlayState* play) { this->actor.textId = 0x103C; this->actionFunc = func_80B9451C; this->actor.flags |= ACTOR_FLAG_2000000; - gSaveContext.save.weekEventReg[91] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_91_02); } if ((this->unk_304 == 11) && ((s32)this->skelAnime.curFrame >= 55)) { @@ -748,11 +748,11 @@ void func_80B94A00(EnZog* this, PlayState* play) { if (func_80B93BE0(this, play)) { this->actionFunc = func_80B948A8; this->actor.flags |= ACTOR_FLAG_2000000; - if (gSaveContext.save.weekEventReg[29] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_20)) { this->actor.textId = 0x1009; } else { this->actor.textId = 0x1008; - gSaveContext.save.weekEventReg[29] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_29_20); } this->unk_300 = 2; this->unk_31C = 2; @@ -905,7 +905,7 @@ void func_80B94E34(EnZog* this, PlayState* play) { this->unk_31C = 1; this->unk_31E = 0; func_80B93BA8(this, 0); - gSaveContext.save.weekEventReg[88] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_88_10); } else if ((this->actor.yawTowardsPlayer > 16000) && (this->actor.yawTowardsPlayer < 32000) && (this->unk_302 == 0)) { func_800B8614(&this->actor, play, 150.0f); @@ -939,7 +939,7 @@ void func_80B95128(EnZog* this, PlayState* play) { } this->actor.flags &= ~ACTOR_FLAG_10000; - gSaveContext.save.weekEventReg[91] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_91_01); } else { func_800B8614(&this->actor, play, 150.0f); } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index f882c97110..2f6f0e7917 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -118,7 +118,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { case ENZORAEGG_1F_07: case ENZORAEGG_1F_08: case ENZORAEGG_1F_09: - if (gSaveContext.save.weekEventReg[19] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; } @@ -131,7 +131,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { case ENZORAEGG_1F_0E: case ENZORAEGG_1F_0F: case ENZORAEGG_1F_10: - if (!(gSaveContext.save.weekEventReg[19] & 0x40)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; } @@ -405,7 +405,7 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { if (temp_v0 != NULL) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, temp_v0); - gSaveContext.eventInf[3] |= 8; + SET_EVENTINF(EVENTINF_33); Actor_Kill(&this->actor); } } else if ((func_80B319A8(play) >= 7) && @@ -475,7 +475,7 @@ void func_80B326F4(EnZoraegg* this, PlayState* play) { Animation_GetLastFrame(&object_zoraegg_Anim_004D20), ANIMMODE_ONCE, 5.0f); this->unk_1E8 = 0; this->actionFunc = func_80B32644; - gSaveContext.save.weekEventReg[19] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_19_40); this->unk_1EC = 2; this->unk_1EE = 100; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); @@ -556,13 +556,13 @@ void func_80B32A88(EnZoraegg* this, PlayState* play) { } void func_80B32B10(EnZoraegg* this, PlayState* play) { - if (gSaveContext.eventInf[3] & 8) { + if (CHECK_EVENTINF(EVENTINF_33)) { this->actionFunc = func_80B32A88; } } void func_80B32B3C(EnZoraegg* this, PlayState* play) { - if (gSaveContext.eventInf[3] & 8) { + if (CHECK_EVENTINF(EVENTINF_33)) { this->actionFunc = func_80B32A88; this->actor.draw = EnZoraegg_Draw; } diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 0570d4c6da..2ace515400 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -100,11 +100,11 @@ void EnZos_Init(Actor* thisx, PlayState* play) { switch (ENZOS_GET_F(&this->actor)) { case ENZOS_F_1: - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } - if (gSaveContext.save.weekEventReg[78] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_01)) { this->actionFunc = func_80BBC24C; } else { this->actionFunc = func_80BBC14C; @@ -120,7 +120,7 @@ void EnZos_Init(Actor* thisx, PlayState* play) { break; default: - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -131,7 +131,7 @@ void EnZos_Init(Actor* thisx, PlayState* play) { void EnZos_Destroy(Actor* thisx, PlayState* play) { EnZos* this = THIS; - gSaveContext.save.weekEventReg[52] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_10); } static AnimationHeader* sAnimations[] = { @@ -223,7 +223,7 @@ void func_80BBB15C(EnZos* this, PlayState* play) { textId = 0x123E; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 2; - } else if (gSaveContext.save.weekEventReg[40] & 0x20) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_20)) { textId = 0x1236; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 0x80; @@ -234,13 +234,13 @@ void func_80BBB15C(EnZos* this, PlayState* play) { } } else { this->unk_2B6 &= ~2; - if (gSaveContext.save.weekEventReg[39] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_10)) { textId = 0x1243; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 0x80; } else { textId = 0x1244; - gSaveContext.save.weekEventReg[39] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_39_10); EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 0x10; } @@ -264,11 +264,11 @@ void func_80BBB354(EnZos* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80BBB2C4; - gSaveContext.save.weekEventReg[39] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_39_20); this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { - if (gSaveContext.save.weekEventReg[39] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_20)) { getItemId = GI_RUPEE_PURPLE; } else { getItemId = GI_HEART_PIECE; @@ -375,22 +375,22 @@ void func_80BBB718(EnZos* this, PlayState* play) { player->actor.textId = 0x1232; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); this->unk_2B6 |= 8; - gSaveContext.save.weekEventReg[40] |= 0x20; - } else if (gSaveContext.save.weekEventReg[39] & 8) { + SET_WEEKEVENTREG(WEEKEVENTREG_40_20); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_08)) { player->actor.textId = 0x1241; } else { player->actor.textId = 0x1237; - gSaveContext.save.weekEventReg[39] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_39_08); EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 4; } this->actionFunc = func_80BBB8AC; } else if (sp24 < 0) { - if (gSaveContext.save.weekEventReg[39] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_08)) { func_80151938(play, 0x1241); } else { func_80151938(play, 0x1237); - gSaveContext.save.weekEventReg[39] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_39_08); EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 4; } @@ -502,12 +502,12 @@ void func_80BBBB84(EnZos* this, PlayState* play) { this->actionFunc = func_80BBB8AC; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 2; - } else if (gSaveContext.save.weekEventReg[41] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_10)) { Message_StartTextbox(play, 0x124A, &this->actor); this->actionFunc = func_80BBB8AC; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); } else { - gSaveContext.save.weekEventReg[41] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_41_10); Message_StartTextbox(play, 0x124B, &this->actor); this->actionFunc = func_80BBB574; EnZos_ChangeAnim(this, EN_ZOS_ANIM_INSPIRED, ANIMMODE_ONCE); @@ -571,9 +571,9 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { } if (!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 100.0f)) { - gSaveContext.save.weekEventReg[52] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_52_10); } else { - gSaveContext.save.weekEventReg[52] &= (u8)~0x10; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_10); } sp28.x = this->actor.projectedPos.x; @@ -586,13 +586,13 @@ void func_80BBBFBC(EnZos* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x125B; - } else if (gSaveContext.save.weekEventReg[78] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_80)) { textId = 0x125A; } else { textId = 0x1259; - gSaveContext.save.weekEventReg[78] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_78_80); } EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); } else { @@ -653,7 +653,7 @@ void func_80BBC22C(EnZos* this, PlayState* play) { void func_80BBC24C(EnZos* this, PlayState* play) { func_80BBB0D4(this, play); - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { this->actionFunc = func_80BBC22C; EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT, ANIMMODE_ONCE); } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 02f726fc53..2c17a2ae5a 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -185,14 +185,14 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { func_80B96BEC(this, 2, ANIMMODE_LOOP); this->actor.colChkInfo.cylRadius = 0; this->actor.shape.yOffset = -1400.0f; - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } break; case 18: this->actionFunc = func_80B99384; - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } break; @@ -220,7 +220,7 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { break; } - if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && (gSaveContext.save.weekEventReg[55] & 0x80)) { + if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } } @@ -230,7 +230,7 @@ void EnZot_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); if (ENZOT_GET_1F(&this->actor) == 8) { - gSaveContext.save.weekEventReg[41] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_41_20); } } @@ -362,17 +362,17 @@ void func_80B97110(EnZot* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x125F; - if (gSaveContext.save.weekEventReg[28] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_28_80)) { textId = 0x1261; } else { - gSaveContext.save.weekEventReg[28] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_28_80); } } else { textId = 0x125C; - if (gSaveContext.save.weekEventReg[28] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_28_40)) { textId = 0x125E; } else { - gSaveContext.save.weekEventReg[28] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_28_40); } } Message_StartTextbox(play, textId, &this->actor); @@ -410,35 +410,35 @@ void func_80B97240(EnZot* this, PlayState* play) { void func_80B972E8(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.weekEventReg[29] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_10)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x126A; - if (gSaveContext.save.weekEventReg[29] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_01)) { textId = 0x126D; } else { - gSaveContext.save.weekEventReg[29] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_29_01); } } else { textId = 0x1267; - if (gSaveContext.save.weekEventReg[29] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_02)) { textId = 0x1269; } else { - gSaveContext.save.weekEventReg[29] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_29_02); } } } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x1265; - if (gSaveContext.save.weekEventReg[29] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_04)) { textId = 0x1266; } else { - gSaveContext.save.weekEventReg[29] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_29_04); } } else { textId = 0x1262; - if (gSaveContext.save.weekEventReg[29] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_08)) { textId = 0x1264; } else { - gSaveContext.save.weekEventReg[29] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_29_08); } } Message_StartTextbox(play, textId, &this->actor); @@ -560,7 +560,7 @@ void func_80B97708(EnZot* this, PlayState* play) { } if (phi_v1 != 0) { - gSaveContext.save.weekEventReg[29] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_29_10); this->actor.flags |= ACTOR_FLAG_10000; if (phi_v1 == 5) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -588,58 +588,58 @@ void func_80B9787C(EnZot* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { switch (ENZOT_GET_1F(&this->actor)) { case 2: - if (gSaveContext.save.weekEventReg[37] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_37_40)) { textId = 0x127E; } else { textId = 0x127C; - gSaveContext.save.weekEventReg[37] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_37_40); } break; case 3: - if (gSaveContext.save.weekEventReg[38] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_01)) { textId = 0x1284; } else { textId = 0x1282; - gSaveContext.save.weekEventReg[38] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_38_01); } break; default: - if (gSaveContext.save.weekEventReg[38] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_04)) { textId = 0x128A; } else { textId = 0x1288; - gSaveContext.save.weekEventReg[38] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_38_04); } break; } } else { switch (ENZOT_GET_1F(&this->actor)) { case 2: - if (gSaveContext.save.weekEventReg[37] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_37_20)) { textId = 0x127B; } else { textId = 0x1279; - gSaveContext.save.weekEventReg[37] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_37_20); } break; case 3: - if (gSaveContext.save.weekEventReg[37] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_37_80)) { textId = 0x1281; } else { textId = 0x127F; - gSaveContext.save.weekEventReg[37] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_37_80); } break; default: - if (gSaveContext.save.weekEventReg[38] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_02)) { textId = 0x1287; } else { textId = 0x1285; - gSaveContext.save.weekEventReg[38] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_38_02); } break; } @@ -786,7 +786,7 @@ void func_80B97E4C(EnZot* this, PlayState* play) { this->actionFunc = func_80B97D6C; this->unk_2F2 |= 4; func_80B96BEC(this, 3, ANIMMODE_LOOP); - gSaveContext.save.weekEventReg[38] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_38_08); break; case 0x128B: @@ -803,7 +803,7 @@ void func_80B97FD0(EnZot* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B97E4C; func_80B97BF8(this, play); - } else if (gSaveContext.save.weekEventReg[38] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_08)) { if ((this->actor.xzDistToPlayer < 120.0f) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { this->unk_2F2 |= 4; this->actionFunc = func_80B97E0C; @@ -837,35 +837,35 @@ void func_80B98178(EnZot* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (CURRENT_DAY == 3) { textId = 0x129D; - } else if (gSaveContext.save.weekEventReg[39] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_01)) { textId = 0x129C; } else { textId = 0x129B; - gSaveContext.save.weekEventReg[39] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_39_01); } - } else if (gSaveContext.save.weekEventReg[38] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_80)) { textId = 0x1293; } else { textId = 0x1291; - gSaveContext.save.weekEventReg[38] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_38_80); } break; case 7: if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[39] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_04)) { textId = 0x12AA; } else { textId = 0x12A6; - gSaveContext.save.weekEventReg[39] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_39_04); } } else if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { textId = 0x12A0; - } else if (gSaveContext.save.weekEventReg[39] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_02)) { textId = 0x12A5; } else { textId = 0x12A2; - gSaveContext.save.weekEventReg[39] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_39_02); } break; @@ -877,7 +877,7 @@ void func_80B98178(EnZot* this, PlayState* play) { case 16: case 17: phi_v0 = (ENZOT_GET_1F(&this->actor) * 4) - 44; - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { phi_v0 += 2; } @@ -1076,17 +1076,17 @@ void func_80B98A4C(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[39] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_80)) { textId = 0x12B6; } else { textId = 0x12B4; - gSaveContext.save.weekEventReg[39] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_39_80); } - } else if (gSaveContext.save.weekEventReg[39] & 0x40) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_40)) { textId = 0x12B3; } else { textId = 0x12B1; - gSaveContext.save.weekEventReg[39] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_39_40); } Message_StartTextbox(play, textId, &this->actor); } @@ -1104,14 +1104,14 @@ void func_80B98AD0(EnZot* this, PlayState* play) { case 0x12B8: func_801477B4(play); this->actionFunc = func_80B98CA8; - gSaveContext.save.weekEventReg[41] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_41_20); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: func_801477B4(play); this->actionFunc = func_80B98CA8; - gSaveContext.save.weekEventReg[41] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_41_20); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; @@ -1126,7 +1126,7 @@ void func_80B98AD0(EnZot* this, PlayState* play) { void func_80B98BF4(EnZot* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.save.weekEventReg[41] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_20)) { Message_StartTextbox(play, 0x12B7, &this->actor); this->actionFunc = func_80B98AD0; } else { @@ -1159,7 +1159,7 @@ void func_80B98CA8(EnZot* this, PlayState* play) { } if (this->actor.xzDistToPlayer > 100.0f) { - gSaveContext.save.weekEventReg[41] &= (u8)~0x20; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_41_20); } } @@ -1168,17 +1168,17 @@ void func_80B98E10(EnZot* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { - if (gSaveContext.save.weekEventReg[40] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_04)) { textId = 0x12C5; } else { textId = 0x12C3; - gSaveContext.save.weekEventReg[40] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_40_04); } - } else if (gSaveContext.save.weekEventReg[40] & 2) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_02)) { textId = 0x12C2; } else { textId = 0x12C0; - gSaveContext.save.weekEventReg[40] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_40_02); } } else { if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { @@ -1188,10 +1188,10 @@ void func_80B98E10(EnZot* this, PlayState* play) { textId = 0x12BE; this->unk_2F2 |= 0x10; } - } else if (gSaveContext.save.weekEventReg[40] & 1) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_01)) { textId = 0x12BC; } else { - gSaveContext.save.weekEventReg[40] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_40_01); this->unk_2F2 |= 4; textId = 0x12BB; } @@ -1254,17 +1254,17 @@ void func_80B99160(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[40] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_10)) { textId = 0x12CD; } else { textId = 0x12CA; - gSaveContext.save.weekEventReg[40] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_40_10); } - } else if (gSaveContext.save.weekEventReg[40] & 8) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_08)) { textId = 0x12C9; } else { textId = 0x12C6; - gSaveContext.save.weekEventReg[40] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_40_08); } Message_StartTextbox(play, textId, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 81f81b0521..851214b5d3 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -107,7 +107,7 @@ void EnZov_Init(Actor* thisx, PlayState* play) { case ENZOV_F_1: this->actionFunc = func_80BD1F1C; func_80BD1570(this, 9, ANIMMODE_LOOP); - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->picto.actor); return; } @@ -120,7 +120,7 @@ void EnZov_Init(Actor* thisx, PlayState* play) { default: this->unk_320 |= 2; - if ((gSaveContext.save.weekEventReg[55] & 0x80) || (gSaveContext.save.weekEventReg[53] & 0x20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { Actor_Kill(&this->picto.actor); } break; @@ -185,7 +185,7 @@ s32 func_80BD15A4(EnZov* this, PlayState* play) { void func_80BD160C(EnZov* this, PlayState* play) { s32 textId = 0; - if (gSaveContext.save.weekEventReg[53] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { this->unk_320 &= ~2; if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { textId = 0x1024; @@ -391,7 +391,7 @@ void func_80BD1D30(EnZov* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1032; } else { textId = 0x1033; @@ -426,7 +426,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { play->nextEntrance = play->setupExitList[ENZOV_GET_FE00(&this->picto.actor)]; play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[78] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_78_01); this->actionFunc = func_80BD1D94; play->msgCtx.msgLength = 0; Audio_QueueSeqCmd(0x101400FF); diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index e1db787df1..7e37091623 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -357,45 +357,45 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { u16 phi_a1; if (ENZOW_GET_F(&this->actor) == ENZOW_F_1) { - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[78] & 4) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_04)) { phi_a1 = 0x12FD; } else { phi_a1 = 0x12FA; - gSaveContext.save.weekEventReg[78] |= 4; + SET_WEEKEVENTREG(WEEKEVENTREG_78_04); } - } else if (gSaveContext.save.weekEventReg[78] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_10)) { phi_a1 = 0x1301; } else { - gSaveContext.save.weekEventReg[78] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_78_10); phi_a1 = 0x12FF; } } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[78] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_08)) { phi_a1 = 0x12F8; } else { phi_a1 = 0x12F3; - gSaveContext.save.weekEventReg[78] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_78_08); } - } else if (gSaveContext.save.weekEventReg[78] & 0x10) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_10)) { phi_a1 = 0x1301; } else { - gSaveContext.save.weekEventReg[78] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_78_10); phi_a1 = 0x12FF; } - } else if (gSaveContext.save.weekEventReg[55] & 0x80) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { phi_a1 = 0x12EC; } else { phi_a1 = 0x12F1; } } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[78] & 2) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_02)) { phi_a1 = 0x12EB; } else { phi_a1 = 0x12E8; - gSaveContext.save.weekEventReg[78] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_78_02); } } else { phi_a1 = 0x12EF; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index e77ea9890f..27f5cc2736 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -310,8 +310,8 @@ void ObjChan_PotAction(ObjChan* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN); func_80BB9A1C((ObjChan*)this->actor.parent, 40.0f); if (this->myPotIndex == 4) { - if (!(((void)0, gSaveContext.save.weekEventReg[0x25]) & 0x10)) { - gSaveContext.save.weekEventReg[0x25] = ((void)0, gSaveContext.save.weekEventReg[0x25]) | 0x10; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_37_10)) { + SET_WEEKEVENTREG(WEEKEVENTREG_37_10); Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000, this->actor.cutscene, this->actor.unk20, NULL); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 367bf16195..2ca898fa74 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -334,7 +334,7 @@ void ObjComb_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitJntSph(play, &this->collider); - if ((sp2C == 1) && OBJCOMB_GET_10(&this->actor) && (gSaveContext.save.weekEventReg[83] & 2)) { + if ((sp2C == 1) && OBJCOMB_GET_10(&this->actor) && CHECK_WEEKEVENTREG(WEEKEVENTREG_83_02)) { Actor_Kill(&this->actor); return; } @@ -534,7 +534,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) { if (((OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor)) == 1) && OBJCOMB_GET_10(&this->actor)) { - gSaveContext.save.weekEventReg[83] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_83_02); } this->unk_1B5 = 2; diff --git a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c index 0b6a6b988e..5a9ef2d05a 100644 --- a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c +++ b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c @@ -31,7 +31,7 @@ ActorInit Obj_Dinner_InitVars = { void ObjDinner_Init(Actor* thisx, PlayState* play) { ObjDinner* this = THIS; - if (gSaveContext.save.isNight != true || (CURRENT_DAY == 3 && gSaveContext.save.weekEventReg[22] & 1)) { + if ((gSaveContext.save.isNight != true) || ((CURRENT_DAY == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01))) { Actor_Kill(&this->actor); } Actor_SetScale(&this->actor, 0.1f); diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 315c7dc0f2..0581706d5d 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -44,7 +44,7 @@ static InitChainEntry D_80B3C96C[] = { }; void func_80B3C260(ObjGhaka* this) { - if (gSaveContext.save.weekEventReg[20] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + 100.0f; } this->actionFunc = func_80B3C39C; @@ -59,7 +59,7 @@ void func_80B3C2B0(ObjGhaka* this) { } void func_80B3C2C4(ObjGhaka* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[20] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 0, this->dyna.actor.cutscene, this->dyna.actor.unk20, 0); } else { @@ -85,7 +85,7 @@ void func_80B3C39C(ObjGhaka* this, PlayState* play) { } } - if (this->dyna.pushForce < 0.0f && !(gSaveContext.save.weekEventReg[20] & 0x20) && + if (this->dyna.pushForce < 0.0f && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20) && player->transformation == PLAYER_FORM_GORON) { func_80B3C2B0(this); } else { @@ -139,7 +139,7 @@ void func_80B3C624(ObjGhaka* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_10; this->dyna.pushForce = 0.0f; func_80B3C2C4(this, play); - gSaveContext.save.weekEventReg[20] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_20_20); func_80B3C260(this); Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); } else { @@ -161,7 +161,7 @@ void ObjGhaka_Init(Actor* thisx, PlayState* play) { if (this->dyna.actor.floorPoly == 0) { Actor_Kill(&this->dyna.actor); } - if (gSaveContext.save.weekEventReg[20] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { func_80B3C2C4(this, play); } func_80B3C260(this); diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index 5ecd2a63f4..e3972be180 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -94,7 +94,7 @@ void ObjHgdoor_SetupIdle(ObjHgdoor* this) { } void ObjHgdoor_Idle(ObjHgdoor* this, PlayState* play) { - if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) && OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { ObjHgdoor_SetChild(this, play); diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 8210f23d32..cade13522e 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -412,7 +412,7 @@ void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_17SETUGEN2))) { - gSaveContext.save.weekEventReg[19] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_19_02); } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index cf6588c318..13f49fd1f8 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -116,7 +116,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.z = -0x500; if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || - ((play->sceneId == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { + ((play->sceneId == SCENE_KAJIYA) && CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80))) { Actor_Kill(thisx); return; } diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index 358cfde4b2..8ff6e84559 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -58,7 +58,7 @@ void ObjMilkBin_Init(Actor* thisx, PlayState* play) { this->disableDraw = 0; this->type = thisx->params; - if ((this->type == OBJ_MILK_BIN_TYPE_2) && !(gSaveContext.save.weekEventReg[52] & 1)) { + if ((this->type == OBJ_MILK_BIN_TYPE_2) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { this->disableDraw |= 1; } } @@ -74,14 +74,14 @@ void ObjMilkBin_Update(Actor* thisx, PlayState* play2) { ObjMilkBin* this = THIS; if (this->type == OBJ_MILK_BIN_TYPE_1) { - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { if (((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == 1)) || (gSaveContext.save.day >= 3)) { Actor_Kill(&this->actor); return; } } } else if (this->type == OBJ_MILK_BIN_TYPE_2) { - if (gSaveContext.save.weekEventReg[52] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { this->disableDraw &= ~1; } else { this->disableDraw |= 1; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index e6f9ec4960..18c36f87ee 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -49,8 +49,8 @@ void ObjMoonStone_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 0; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); func_80C0662C(this); - } else if (!(gSaveContext.save.weekEventReg[74] & 0x40)) { - if ((gSaveContext.save.weekEventReg[74] & 0x80)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { Actor_Spawn(&play->actorCtx, play, 1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -1); } @@ -97,14 +97,14 @@ void func_80C0670C(ObjMoonStone* this, PlayState* play) { } void func_80C0673C(ObjMoonStone* this) { - if (!(gSaveContext.save.weekEventReg[74] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { this->actor.draw = NULL; } this->actionFunc = func_80C06768; } void func_80C06768(ObjMoonStone* this, PlayState* play) { - if ((gSaveContext.save.weekEventReg[74] & 0x80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { if (this->actor.draw == NULL) { this->actor.draw = ObjMoonStone_Draw; Actor_Spawn(&play->actorCtx, play, 1, this->actor.world.pos.x, this->actor.world.pos.y, @@ -128,7 +128,7 @@ void func_80C0685C(ObjMoonStone* this) { void func_80C06870(ObjMoonStone* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - gSaveContext.save.weekEventReg[74] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_74_40); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index 2dca46caae..e2750e6392 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -40,7 +40,7 @@ ActorInit Obj_Mu_Pict_InitVars = { void ObjMuPict_Init(Actor* thisx, PlayState* play) { ObjMuPict* this = THIS; - if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 55d148f4a3..933ea06d26 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -407,17 +407,17 @@ void func_80BA311C(ObjNozoki* this, PlayState* play) { } void func_80BA3230(ObjNozoki* this, PlayState* play) { - if (gSaveContext.save.weekEventReg[64] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_20)) { Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; Actor* test3 = SubS_FindActor(play, npc, ACTORCAT_NPC, ACTOR_EN_TEST3); if ((test3 != NULL) && (test3->draw != NULL)) { - if ((play->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { + if ((play->curSpawn == 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_64_40)) { this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10000); this->dyna.actor.textId = 0x297A; } else { this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - if (gSaveContext.save.weekEventReg[64] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_40)) { this->dyna.actor.textId = 0; } else { this->dyna.actor.textId = 0x2979; @@ -434,9 +434,9 @@ void func_80BA3230(ObjNozoki* this, PlayState* play) { } void func_80BA3344(ObjNozoki* this, PlayState* play) { - if ((play->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { + if ((play->curSpawn == 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_64_40)) { if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { - gSaveContext.save.weekEventReg[64] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_64_40); this->dyna.actor.flags &= ~ACTOR_FLAG_10000; ObjNozoki_SetupAction(this, func_80BA3230); } diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c index 29ffa674e1..ee26937da8 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c @@ -109,14 +109,11 @@ s32 ObjPurify_IsPurified(ObjPurify* this) { ObjPurifyInfo* info = &sObjPurifyInfo[OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor)]; if (!info->isDekuCity) { - // woodfall temple wood flower unraveled - if (gSaveContext.save.weekEventReg[12] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { return true; } - } - // woodfall temple purification cutscene watched - else { - if (gSaveContext.save.weekEventReg[20] & 2) { + } else { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { return true; } } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 0ee9510665..268cbc0c58 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -128,7 +128,7 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; this->actor.world.pos.y += this->actor.scale.y * 1900.0f; this->actor.shape.yOffset = 1500.0f; - gSaveContext.save.weekEventReg[8] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_08_40); } else { this->actionFunc = ObjTokeidai_ExteriorGear_Idle; } @@ -441,7 +441,7 @@ void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, PlayState* play) { void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 132) != 0 && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 5) { - gSaveContext.save.weekEventReg[8] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_08_40); if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && @@ -588,7 +588,7 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, PlayState* play) { if ((Cutscene_CheckActorAction(play, 132) && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 4) || - (gSaveContext.save.weekEventReg[8] & 0x40)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actionFunc = ObjTokeidai_TowerOpening_RaiseTower; } } @@ -610,8 +610,8 @@ void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { - if (((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) || - (gSaveContext.save.weekEventReg[8] & 0x40)) { + if ((((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || CURRENT_DAY >= 4) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actor.draw = ObjTokeidai_Draw; } else { this->actor.draw = NULL; @@ -686,7 +686,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { if (CURRENT_DAY == 3 && this->clockHour < 6 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); - gSaveContext.save.weekEventReg[8] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_08_40); return; } diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 687fb78eaa..c56e771b80 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -14,41 +14,41 @@ /** * weekEventReg flags checked by this actor: - * - gSaveContext.save.weekEventReg[22] & 1: Aliens defeated + * - WEEKEVENTREG_22_01: Aliens defeated * If false: The actor doesn't spawn - * - gSaveContext.save.weekEventReg[31] & 0x40 + * - WEEKEVENTREG_31_40 * If true: Cremia doesn't explain again she'll deliever milk to town - * - gSaveContext.save.weekEventReg[31] & 0x80 + * - WEEKEVENTREG_31_80 * If true: Triggers cutscene on Romani's Ranch - * - gSaveContext.save.weekEventReg[34] & 0x80 + * - WEEKEVENTREG_34_80 * If true: Doesn't spawn on Romani's Ranch - * - gSaveContext.save.weekEventReg[52] & 1 + * - WEEKEVENTREG_52_01 * If true: Doesn't spawn on Romani's Ranch or Milk Road - * - gSaveContext.save.weekEventReg[52] & 2 + * - WEEKEVENTREG_52_02 * If true: Doesn't spawn on Romani's Ranch or Milk Road - * - gSaveContext.save.weekEventReg[59] & 2 + * - WEEKEVENTREG_59_02 * If true: Doesn't spawn again on Milk Road * * weekEventReg flags set by this actor: - * - gSaveContext.save.weekEventReg[31] |= 0x40: Cremia offered a ride + * - WEEKEVENTREG_31_40: Cremia offered a ride * Cremia offered a ride accross the Milk Road to Player - * - gSaveContext.save.weekEventReg[31] |= 0x80: Player is in Milk Run - * Player accepts the ride and is with Cremia during the Milk Run. - * - gSaveContext.save.weekEventReg[34] |= 0x80: Cremia does Milk Run alone + * - WEEKEVENTREG_31_80: Player is in Milk Run + * Player accepts the ride and is with Cremia during the Milk Run + * - WEEKEVENTREG_34_80: Cremia does Milk Run alone * Player didn't interact or didn't accept the ride - * - gSaveContext.save.weekEventReg[52] |= 1: Won Milk Run minigame + * - WEEKEVENTREG_52_01: Won Milk Run minigame * At least one pot is safe. Turns off the "Lose Milk Run minigame" - * - gSaveContext.save.weekEventReg[52] |= 2: Lose Milk Run minigame + * - WEEKEVENTREG_52_02: Lose Milk Run minigame * Every pot was broken by bandits. Turns off the "Win Milk Run minigame" - * - gSaveContext.save.weekEventReg[59] |= 2: ? + * - WEEKEVENTREG_59_02: ? * Passed through Milk Road after winning the Milk Run * * weekEventReg flags unset by this actor: - * - gSaveContext.save.weekEventReg[31] &= (u8)~0x80 + * - WEEKEVENTREG_31_80 * Turned off when the Milk Run finishes - * - gSaveContext.save.weekEventReg[52] &= (u8)~1 + * - WEEKEVENTREG_52_01 * Turned off if Player lose the Milk Run - * - gSaveContext.save.weekEventReg[52] &= (u8)~2 + * - WEEKEVENTREG_52_02 * Turned off if Player wins the Milk Run */ @@ -683,7 +683,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { this->initialPathIndex = OBJ_UM_GET_PATH_INDEX(thisx); // if (!AliensDefeated) - if (!(gSaveContext.save.weekEventReg[22] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { Actor_Kill(&this->dyna.actor); return; } @@ -692,7 +692,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { ObjUm_SetupAction(this, ObjUm_TerminaFieldIdle); } else if (this->type == OBJ_UM_TYPE_RANCH) { this->pathIndex = this->initialPathIndex; - if (gSaveContext.save.weekEventReg[31] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80)) { // In cutscene sp54 = false; @@ -702,9 +702,9 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { } else { // Waiting for player - if ((gSaveContext.save.weekEventReg[34] & 0x80) || gSaveContext.save.time >= CLOCK_TIME(19, 0) || - gSaveContext.save.time <= CLOCK_TIME(6, 0) || (gSaveContext.save.weekEventReg[52] & 1) || - (gSaveContext.save.weekEventReg[52] & 2)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_80) || (gSaveContext.save.time >= CLOCK_TIME(19, 0)) || + (gSaveContext.save.time <= CLOCK_TIME(6, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_52_02)) { Actor_Kill(&this->dyna.actor); return; } @@ -714,12 +714,12 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { ObjUm_SetupAction(this, ObjUm_RanchWait); } } else if (this->type == OBJ_UM_TYPE_PRE_MILK_RUN) { - if (!(gSaveContext.save.weekEventReg[31] & 0x80) || (gSaveContext.save.weekEventReg[52] & 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01)) { Actor_Kill(&this->dyna.actor); return; } - if (!(gSaveContext.save.weekEventReg[52] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_52_02)) { this->pathIndex = this->initialPathIndex; sp54 = false; func_800FE484(); @@ -728,7 +728,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { ObjUm_RotatePlayer(this, play, 0); } } else if (this->type == OBJ_UM_TYPE_MILK_RUN_MINIGAME) { - if (!(gSaveContext.save.weekEventReg[31] & 0x80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80)) { Actor_Kill(&this->dyna.actor); return; } @@ -740,7 +740,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { this->unk_354 = 0; ObjUm_RotatePlayer(this, play, 0); } else if (this->type == OBJ_UM_TYPE_POST_MILK_RUN) { - if (!(gSaveContext.save.weekEventReg[52] & 1) || (gSaveContext.save.weekEventReg[59] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_59_02)) { Actor_Kill(&this->dyna.actor); return; } @@ -828,11 +828,11 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { case 0x33B4: // "Want a ride?" case 0x33CF: - gSaveContext.save.weekEventReg[31] |= 0x40; + SET_WEEKEVENTREG(WEEKEVENTREG_31_40); if (play->msgCtx.choiceIndex == 0) { player = GET_PLAYER(play); func_8019F208(); - gSaveContext.save.weekEventReg[31] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_31_80); play->nextEntrance = ENTRANCE(ROMANI_RANCH, 11); if (player->stateFlags1 & PLAYER_STATE1_800000) { D_801BDAA0 = 1; @@ -907,7 +907,7 @@ u16 ObjUm_RanchGetDialogue(PlayState* play, ObjUm* this, s32 arg2) { u16 textId = 0; if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - if (gSaveContext.save.weekEventReg[31] & 0x40) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_40)) { // "Want a ride?" textId = 0x33CF; } else { @@ -999,7 +999,7 @@ void ObjUm_RanchWait(ObjUm* this, PlayState* play) { func_80B7984C(play, this, 0, &this->unk_2B4); } } else if (!func_80B79A24(this->unk_2B4) && (gSaveContext.save.time > CLOCK_TIME(19, 0))) { - gSaveContext.save.weekEventReg[34] |= 0x80; + SET_WEEKEVENTREG(WEEKEVENTREG_34_80); ObjUm_SetupAction(this, ObjUm_RanchWaitPathFinished); } @@ -1138,7 +1138,7 @@ void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { switch (ObjUm_UpdatePath(this, play)) { case OBJUM_PATH_STATE_1: case OBJUM_PATH_STATE_FINISH: - if (gSaveContext.save.weekEventReg[31] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80)) { ActorCutscene_Stop(this->dyna.actor.cutscene); play->nextEntrance = ENTRANCE(MILK_ROAD, 5); play->transitionType = TRANS_TYPE_64; @@ -1296,24 +1296,24 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { case OBJUM_PATH_STATE_1: case OBJUM_PATH_STATE_FINISH: gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.save.weekEventReg[31] &= (u8)~0x80; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_31_80); gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; - if (!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_52_01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_02)) { if (!this->areAllPotsBroken) { play->nextEntrance = ENTRANCE(MILK_ROAD, 6); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[52] |= 1; - gSaveContext.save.weekEventReg[52] &= (u8)~2; + SET_WEEKEVENTREG(WEEKEVENTREG_52_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_02); } else { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 8); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[52] |= 2; - gSaveContext.save.weekEventReg[52] &= (u8)~1; + SET_WEEKEVENTREG(WEEKEVENTREG_52_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_01); } } break; @@ -1545,10 +1545,10 @@ void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play) { this->wheelRot += 0x3E8; ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); - if ((ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_4) && !(gSaveContext.save.weekEventReg[59] & 2)) { + if ((ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_02)) { ActorCutscene_Stop(this->dyna.actor.cutscene); Audio_SetCutsceneFlag(false); - gSaveContext.save.weekEventReg[59] |= 2; + SET_WEEKEVENTREG(WEEKEVENTREG_59_02); gSaveContext.nextCutsceneIndex = 0xFFF3; play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); play->transitionType = TRANS_TYPE_64; diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index d20f988fd8..24e816644a 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -80,7 +80,7 @@ s32 func_80C07CD0(void) { } } - if (gSaveContext.save.weekEventReg[22] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } return true; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index fc5d05be24..c56cc4bbbd 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -12,7 +12,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { static s32 sOpeningEntrances[] = { ENTRANCE(CUTSCENE, 0), ENTRANCE(CUTSCENE, 1) }; static s32 sOpeningCutscenes[] = { 0xFFFA, 0xFFFA }; - gSaveContext.eventInf[1] &= (u8)~0x80; + CLEAR_EVENTINF(EVENTINF_17); gSaveContext.gameMode = 1; Sram_InitNewSave(); diff --git a/tools/eventinfconvert.py b/tools/eventinfconvert.py new file mode 100755 index 0000000000..7205dfcc92 --- /dev/null +++ b/tools/eventinfconvert.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 + +import argparse +import math +import re + +def isValid(index: int, mask: int) -> bool: + if index < 0 or index > 7: + return False + if mask != (1 << int(math.log2(mask))): + return False + return True + +def getFlagMacro(index: int, mask: int) -> str: + return f"EVENTINF_{index}{int(math.log2(mask))}" + +def getCheckMacro(index: int, mask: int) -> str: + return f"CHECK_EVENTINF({getFlagMacro(index, mask)})" + +def getSetMacro(index: int, mask: int) -> str: + return f"SET_EVENTINF({getFlagMacro(index, mask)})" + +def getClearMacro(index: int, mask: int) -> str: + return f"CLEAR_EVENTINF({getFlagMacro(index, mask)})" + +NUMBER_PATTERN = r"(0[xX])?[0-9a-fA-F]+" + +def applyChange(fileContents: str, compiledRegex: re.Pattern, callback) -> str: + parsedContents = "" + + match = compiledRegex.search(fileContents) + while match: + index = int(match.group("index"), 0) + mask = int(match.group("mask"), 0) + + start, end = match.span() + parsedContents += fileContents[:start] + if isValid(index, mask): + parsedContents += callback(index, mask) + else: + parsedContents += fileContents[start:end] + + fileContents = fileContents[end:] + match = compiledRegex.search(fileContents) + + parsedContents += fileContents + return parsedContents + + +def updateCheck(fileContents: str) -> str: + checkRegex = re.compile(rf"gSaveContext.eventInf\[(?P{NUMBER_PATTERN})\]\s*\&\s*(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, checkRegex, getCheckMacro) + +def updateSet(fileContents: str) -> str: + setRegex = re.compile(rf"gSaveContext.eventInf\[(?P{NUMBER_PATTERN})\]\s*\|=\s*(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, setRegex, getSetMacro) + +def updateClear(fileContents: str) -> str: + clearRegex = re.compile(rf"gSaveContext.eventInf\[(?P{NUMBER_PATTERN})\]\s*\&=\s*(\(u8\))?~(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, clearRegex, getClearMacro) + + +def read_file(filename): + with open(filename) as src_file: + return src_file.read() + +def write_file(filename, contents): + with open(filename, "w") as f: + f.write(contents) + + +def main(): + parser = argparse.ArgumentParser(description="Converts a eventInf access to a macro") + + parser.add_argument("filename", help="Replace every occurrence of numeric eventInf on this file to the corresponding macro") + args = parser.parse_args() + + fileContents = read_file(args.filename) + + parsedContents = updateCheck(fileContents) + parsedContents = updateSet(parsedContents) + parsedContents = updateClear(parsedContents) + + if fileContents != parsedContents: + write_file(args.filename, parsedContents) + +if __name__ == "__main__": + main() diff --git a/tools/overlayhelpers/scheduledis.py b/tools/overlayhelpers/scheduledis.py index b441b94c7e..5eb70d5188 100755 --- a/tools/overlayhelpers/scheduledis.py +++ b/tools/overlayhelpers/scheduledis.py @@ -7,8 +7,8 @@ import argparse, os, struct, math from actor_symbols import resolve_symbol cmd_info = [ - ('SCHEDULE_CMD_CHECK_FLAG_S', 0x04, '>BBb', (2, )), - ('SCHEDULE_CMD_CHECK_FLAG_L', 0x05, '>BBh', (2, )), + ('SCHEDULE_CMD_CHECK_FLAG_S', 0x04, '>Hb', (1, )), + ('SCHEDULE_CMD_CHECK_FLAG_L', 0x05, '>Hh', (1, )), ('SCHEDULE_CMD_CHECK_TIME_RANGE_S', 0x06, '>BBBBb', (4, )), ('SCHEDULE_CMD_CHECK_TIME_RANGE_L', 0x07, '>BBBBh', (4, )), ('SCHEDULE_CMD_RET_VAL_L', 0x03, '>H', ( )), @@ -198,6 +198,8 @@ def disassemble_unk_script(data_file, offset): elif arg_type == "H": if (cmd == 0x0A or cmd == 0x0B) and (arg_value < len(scene_names)): arg_formatted = scene_names[arg_value] + elif cmd == 0x00 or cmd == 0x01: + arg_formatted = f"WEEKEVENTREG_{arg_value>>8:02}_{arg_value&0xFF:02X}" else: arg_formatted = f"{arg_value}" elif arg_type == "B": diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 380acbfc2b..b273f8dec9 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -20,6 +20,16 @@ CLOCK_TIME = "int" CURRENT_DAY = "int" CHECK_NEWF = "int" NULL = "int" +CHECK_WEEKEVENTREG = "int" +SET_WEEKEVENTREG = "int" +CLEAR_WEEKEVENTREG = "int" +"WEEKEVENTREG_.+" = "int" +CHECK_EVENTINF = "int" +SET_EVENTINF = "int" +CLEAR_EVENTINF = "int" +CLEAR_EVENTINF_ALT = "int" +"EVENTINF_.*" = "int" +".+REG" = "int" [decompme.compilers] "tools/ido_recomp/linux/7.1/cc" = "ido7.1" diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py new file mode 100755 index 0000000000..4e8ca13113 --- /dev/null +++ b/tools/weekeventregconvert.py @@ -0,0 +1,889 @@ +#!/usr/bin/env python3 + +import argparse +import re + +weekEventReg = { + ( 0 << 8) | 0x01: "WEEKEVENTREG_00_01", + ( 0 << 8) | 0x02: "WEEKEVENTREG_00_02", + ( 0 << 8) | 0x04: "WEEKEVENTREG_00_04", + ( 0 << 8) | 0x08: "WEEKEVENTREG_00_08", + ( 0 << 8) | 0x10: "WEEKEVENTREG_00_10", + ( 0 << 8) | 0x20: "WEEKEVENTREG_00_20", + ( 0 << 8) | 0x40: "WEEKEVENTREG_00_40", + ( 0 << 8) | 0x80: "WEEKEVENTREG_00_80", + ( 1 << 8) | 0x01: "WEEKEVENTREG_01_01", + ( 1 << 8) | 0x02: "WEEKEVENTREG_01_02", + ( 1 << 8) | 0x04: "WEEKEVENTREG_01_04", + ( 1 << 8) | 0x08: "WEEKEVENTREG_01_08", + ( 1 << 8) | 0x10: "WEEKEVENTREG_01_10", + ( 1 << 8) | 0x20: "WEEKEVENTREG_01_20", + ( 1 << 8) | 0x40: "WEEKEVENTREG_01_40", + ( 1 << 8) | 0x80: "WEEKEVENTREG_01_80", + ( 2 << 8) | 0x01: "WEEKEVENTREG_02_01", + ( 2 << 8) | 0x02: "WEEKEVENTREG_02_02", + ( 2 << 8) | 0x04: "WEEKEVENTREG_02_04", + ( 2 << 8) | 0x08: "WEEKEVENTREG_02_08", + ( 2 << 8) | 0x10: "WEEKEVENTREG_02_10", + ( 2 << 8) | 0x20: "WEEKEVENTREG_02_20", + ( 2 << 8) | 0x40: "WEEKEVENTREG_02_40", + ( 2 << 8) | 0x80: "WEEKEVENTREG_02_80", + ( 3 << 8) | 0x01: "WEEKEVENTREG_03_01", + ( 3 << 8) | 0x02: "WEEKEVENTREG_03_02", + ( 3 << 8) | 0x04: "WEEKEVENTREG_03_04", + ( 3 << 8) | 0x08: "WEEKEVENTREG_03_08", + ( 3 << 8) | 0x10: "WEEKEVENTREG_03_10", + ( 3 << 8) | 0x20: "WEEKEVENTREG_03_20", + ( 3 << 8) | 0x40: "WEEKEVENTREG_03_40", + ( 3 << 8) | 0x80: "WEEKEVENTREG_03_80", + ( 4 << 8) | 0x01: "WEEKEVENTREG_04_01", + ( 4 << 8) | 0x02: "WEEKEVENTREG_04_02", + ( 4 << 8) | 0x04: "WEEKEVENTREG_04_04", + ( 4 << 8) | 0x08: "WEEKEVENTREG_04_08", + ( 4 << 8) | 0x10: "WEEKEVENTREG_04_10", + ( 4 << 8) | 0x20: "WEEKEVENTREG_04_20", + ( 4 << 8) | 0x40: "WEEKEVENTREG_04_40", + ( 4 << 8) | 0x80: "WEEKEVENTREG_04_80", + ( 5 << 8) | 0x01: "WEEKEVENTREG_05_01", + ( 5 << 8) | 0x02: "WEEKEVENTREG_05_02", + ( 5 << 8) | 0x04: "WEEKEVENTREG_05_04", + ( 5 << 8) | 0x08: "WEEKEVENTREG_05_08", + ( 5 << 8) | 0x10: "WEEKEVENTREG_05_10", + ( 5 << 8) | 0x20: "WEEKEVENTREG_05_20", + ( 5 << 8) | 0x40: "WEEKEVENTREG_05_40", + ( 5 << 8) | 0x80: "WEEKEVENTREG_05_80", + ( 6 << 8) | 0x01: "WEEKEVENTREG_06_01", + ( 6 << 8) | 0x02: "WEEKEVENTREG_06_02", + ( 6 << 8) | 0x04: "WEEKEVENTREG_06_04", + ( 6 << 8) | 0x08: "WEEKEVENTREG_06_08", + ( 6 << 8) | 0x10: "WEEKEVENTREG_06_10", + ( 6 << 8) | 0x20: "WEEKEVENTREG_06_20", + ( 6 << 8) | 0x40: "WEEKEVENTREG_06_40", + ( 6 << 8) | 0x80: "WEEKEVENTREG_06_80", + ( 7 << 8) | 0x01: "WEEKEVENTREG_07_01", + ( 7 << 8) | 0x02: "WEEKEVENTREG_07_02", + ( 7 << 8) | 0x04: "WEEKEVENTREG_07_04", + ( 7 << 8) | 0x08: "WEEKEVENTREG_07_08", + ( 7 << 8) | 0x10: "WEEKEVENTREG_07_10", + ( 7 << 8) | 0x20: "WEEKEVENTREG_07_20", + ( 7 << 8) | 0x40: "WEEKEVENTREG_07_40", + ( 7 << 8) | 0x80: "WEEKEVENTREG_07_80", + ( 8 << 8) | 0x01: "WEEKEVENTREG_08_01", + ( 8 << 8) | 0x02: "WEEKEVENTREG_08_02", + ( 8 << 8) | 0x04: "WEEKEVENTREG_08_04", + ( 8 << 8) | 0x08: "WEEKEVENTREG_08_08", + ( 8 << 8) | 0x10: "WEEKEVENTREG_08_10", + ( 8 << 8) | 0x20: "WEEKEVENTREG_08_20", + ( 8 << 8) | 0x40: "WEEKEVENTREG_08_40", + ( 8 << 8) | 0x80: "WEEKEVENTREG_08_80", + ( 9 << 8) | 0x01: "WEEKEVENTREG_09_01", + ( 9 << 8) | 0x02: "WEEKEVENTREG_09_02", + ( 9 << 8) | 0x04: "WEEKEVENTREG_09_04", + ( 9 << 8) | 0x08: "WEEKEVENTREG_09_08", + ( 9 << 8) | 0x10: "WEEKEVENTREG_09_10", + ( 9 << 8) | 0x20: "WEEKEVENTREG_09_20", + ( 9 << 8) | 0x40: "WEEKEVENTREG_09_40", + ( 9 << 8) | 0x80: "WEEKEVENTREG_09_80", + (10 << 8) | 0x01: "WEEKEVENTREG_10_01", + (10 << 8) | 0x02: "WEEKEVENTREG_10_02", + (10 << 8) | 0x04: "WEEKEVENTREG_10_04", + (10 << 8) | 0x08: "WEEKEVENTREG_10_08", + (10 << 8) | 0x10: "WEEKEVENTREG_10_10", + (10 << 8) | 0x20: "WEEKEVENTREG_10_20", + (10 << 8) | 0x40: "WEEKEVENTREG_10_40", + (10 << 8) | 0x80: "WEEKEVENTREG_10_80", + (11 << 8) | 0x01: "WEEKEVENTREG_11_01", + (11 << 8) | 0x02: "WEEKEVENTREG_11_02", + (11 << 8) | 0x04: "WEEKEVENTREG_11_04", + (11 << 8) | 0x08: "WEEKEVENTREG_11_08", + (11 << 8) | 0x10: "WEEKEVENTREG_11_10", + (11 << 8) | 0x20: "WEEKEVENTREG_11_20", + (11 << 8) | 0x40: "WEEKEVENTREG_11_40", + (11 << 8) | 0x80: "WEEKEVENTREG_11_80", + (12 << 8) | 0x01: "WEEKEVENTREG_12_01", + (12 << 8) | 0x02: "WEEKEVENTREG_12_02", + (12 << 8) | 0x04: "WEEKEVENTREG_12_04", + (12 << 8) | 0x08: "WEEKEVENTREG_12_08", + (12 << 8) | 0x10: "WEEKEVENTREG_12_10", + (12 << 8) | 0x20: "WEEKEVENTREG_12_20", + (12 << 8) | 0x40: "WEEKEVENTREG_12_40", + (12 << 8) | 0x80: "WEEKEVENTREG_12_80", + (13 << 8) | 0x01: "WEEKEVENTREG_13_01", + (13 << 8) | 0x02: "WEEKEVENTREG_13_02", + (13 << 8) | 0x04: "WEEKEVENTREG_13_04", + (13 << 8) | 0x08: "WEEKEVENTREG_13_08", + (13 << 8) | 0x10: "WEEKEVENTREG_13_10", + (13 << 8) | 0x20: "WEEKEVENTREG_13_20", + (13 << 8) | 0x40: "WEEKEVENTREG_13_40", + (13 << 8) | 0x80: "WEEKEVENTREG_13_80", + (14 << 8) | 0x01: "WEEKEVENTREG_14_01", + (14 << 8) | 0x02: "WEEKEVENTREG_14_02", + (14 << 8) | 0x04: "WEEKEVENTREG_14_04", + (14 << 8) | 0x08: "WEEKEVENTREG_14_08", + (14 << 8) | 0x10: "WEEKEVENTREG_14_10", + (14 << 8) | 0x20: "WEEKEVENTREG_14_20", + (14 << 8) | 0x40: "WEEKEVENTREG_14_40", + (14 << 8) | 0x80: "WEEKEVENTREG_14_80", + (15 << 8) | 0x01: "WEEKEVENTREG_15_01", + (15 << 8) | 0x02: "WEEKEVENTREG_15_02", + (15 << 8) | 0x04: "WEEKEVENTREG_15_04", + (15 << 8) | 0x08: "WEEKEVENTREG_15_08", + (15 << 8) | 0x10: "WEEKEVENTREG_15_10", + (15 << 8) | 0x20: "WEEKEVENTREG_15_20", + (15 << 8) | 0x40: "WEEKEVENTREG_15_40", + (15 << 8) | 0x80: "WEEKEVENTREG_15_80", + (16 << 8) | 0x01: "WEEKEVENTREG_16_01", + (16 << 8) | 0x02: "WEEKEVENTREG_16_02", + (16 << 8) | 0x04: "WEEKEVENTREG_16_04", + (16 << 8) | 0x08: "WEEKEVENTREG_16_08", + (16 << 8) | 0x10: "WEEKEVENTREG_16_10", + (16 << 8) | 0x20: "WEEKEVENTREG_16_20", + (16 << 8) | 0x40: "WEEKEVENTREG_16_40", + (16 << 8) | 0x80: "WEEKEVENTREG_16_80", + (17 << 8) | 0x01: "WEEKEVENTREG_17_01", + (17 << 8) | 0x02: "WEEKEVENTREG_17_02", + (17 << 8) | 0x04: "WEEKEVENTREG_17_04", + (17 << 8) | 0x08: "WEEKEVENTREG_17_08", + (17 << 8) | 0x10: "WEEKEVENTREG_17_10", + (17 << 8) | 0x20: "WEEKEVENTREG_17_20", + (17 << 8) | 0x40: "WEEKEVENTREG_17_40", + (17 << 8) | 0x80: "WEEKEVENTREG_17_80", + (18 << 8) | 0x01: "WEEKEVENTREG_18_01", + (18 << 8) | 0x02: "WEEKEVENTREG_18_02", + (18 << 8) | 0x04: "WEEKEVENTREG_18_04", + (18 << 8) | 0x08: "WEEKEVENTREG_18_08", + (18 << 8) | 0x10: "WEEKEVENTREG_18_10", + (18 << 8) | 0x20: "WEEKEVENTREG_18_20", + (18 << 8) | 0x40: "WEEKEVENTREG_18_40", + (18 << 8) | 0x80: "WEEKEVENTREG_18_80", + (19 << 8) | 0x01: "WEEKEVENTREG_19_01", + (19 << 8) | 0x02: "WEEKEVENTREG_19_02", + (19 << 8) | 0x04: "WEEKEVENTREG_19_04", + (19 << 8) | 0x08: "WEEKEVENTREG_19_08", + (19 << 8) | 0x10: "WEEKEVENTREG_19_10", + (19 << 8) | 0x20: "WEEKEVENTREG_19_20", + (19 << 8) | 0x40: "WEEKEVENTREG_19_40", + (19 << 8) | 0x80: "WEEKEVENTREG_19_80", + (20 << 8) | 0x01: "WEEKEVENTREG_20_01", + (20 << 8) | 0x02: "WEEKEVENTREG_20_02", + (20 << 8) | 0x04: "WEEKEVENTREG_20_04", + (20 << 8) | 0x08: "WEEKEVENTREG_20_08", + (20 << 8) | 0x10: "WEEKEVENTREG_20_10", + (20 << 8) | 0x20: "WEEKEVENTREG_20_20", + (20 << 8) | 0x40: "WEEKEVENTREG_20_40", + (20 << 8) | 0x80: "WEEKEVENTREG_20_80", + (21 << 8) | 0x01: "WEEKEVENTREG_21_01", + (21 << 8) | 0x02: "WEEKEVENTREG_21_02", + (21 << 8) | 0x04: "WEEKEVENTREG_21_04", + (21 << 8) | 0x08: "WEEKEVENTREG_21_08", + (21 << 8) | 0x10: "WEEKEVENTREG_21_10", + (21 << 8) | 0x20: "WEEKEVENTREG_21_20", + (21 << 8) | 0x40: "WEEKEVENTREG_21_40", + (21 << 8) | 0x80: "WEEKEVENTREG_21_80", + (22 << 8) | 0x01: "WEEKEVENTREG_22_01", + (22 << 8) | 0x02: "WEEKEVENTREG_22_02", + (22 << 8) | 0x04: "WEEKEVENTREG_22_04", + (22 << 8) | 0x08: "WEEKEVENTREG_22_08", + (22 << 8) | 0x10: "WEEKEVENTREG_22_10", + (22 << 8) | 0x20: "WEEKEVENTREG_22_20", + (22 << 8) | 0x40: "WEEKEVENTREG_22_40", + (22 << 8) | 0x80: "WEEKEVENTREG_22_80", + (23 << 8) | 0x01: "WEEKEVENTREG_23_01", + (23 << 8) | 0x02: "WEEKEVENTREG_23_02", + (23 << 8) | 0x04: "WEEKEVENTREG_23_04", + (23 << 8) | 0x08: "WEEKEVENTREG_23_08", + (23 << 8) | 0x10: "WEEKEVENTREG_23_10", + (23 << 8) | 0x20: "WEEKEVENTREG_23_20", + (23 << 8) | 0x40: "WEEKEVENTREG_23_40", + (23 << 8) | 0x80: "WEEKEVENTREG_23_80", + (24 << 8) | 0x01: "WEEKEVENTREG_24_01", + (24 << 8) | 0x02: "WEEKEVENTREG_24_02", + (24 << 8) | 0x04: "WEEKEVENTREG_24_04", + (24 << 8) | 0x08: "WEEKEVENTREG_24_08", + (24 << 8) | 0x10: "WEEKEVENTREG_24_10", + (24 << 8) | 0x20: "WEEKEVENTREG_24_20", + (24 << 8) | 0x40: "WEEKEVENTREG_24_40", + (24 << 8) | 0x80: "WEEKEVENTREG_24_80", + (25 << 8) | 0x01: "WEEKEVENTREG_25_01", + (25 << 8) | 0x02: "WEEKEVENTREG_25_02", + (25 << 8) | 0x04: "WEEKEVENTREG_25_04", + (25 << 8) | 0x08: "WEEKEVENTREG_25_08", + (25 << 8) | 0x10: "WEEKEVENTREG_25_10", + (25 << 8) | 0x20: "WEEKEVENTREG_25_20", + (25 << 8) | 0x40: "WEEKEVENTREG_25_40", + (25 << 8) | 0x80: "WEEKEVENTREG_25_80", + (26 << 8) | 0x01: "WEEKEVENTREG_26_01", + (26 << 8) | 0x02: "WEEKEVENTREG_26_02", + (26 << 8) | 0x04: "WEEKEVENTREG_26_04", + (26 << 8) | 0x08: "WEEKEVENTREG_26_08", + (26 << 8) | 0x10: "WEEKEVENTREG_26_10", + (26 << 8) | 0x20: "WEEKEVENTREG_26_20", + (26 << 8) | 0x40: "WEEKEVENTREG_26_40", + (26 << 8) | 0x80: "WEEKEVENTREG_26_80", + (27 << 8) | 0x01: "WEEKEVENTREG_27_01", + (27 << 8) | 0x02: "WEEKEVENTREG_27_02", + (27 << 8) | 0x04: "WEEKEVENTREG_27_04", + (27 << 8) | 0x08: "WEEKEVENTREG_27_08", + (27 << 8) | 0x10: "WEEKEVENTREG_27_10", + (27 << 8) | 0x20: "WEEKEVENTREG_27_20", + (27 << 8) | 0x40: "WEEKEVENTREG_27_40", + (27 << 8) | 0x80: "WEEKEVENTREG_27_80", + (28 << 8) | 0x01: "WEEKEVENTREG_28_01", + (28 << 8) | 0x02: "WEEKEVENTREG_28_02", + (28 << 8) | 0x04: "WEEKEVENTREG_28_04", + (28 << 8) | 0x08: "WEEKEVENTREG_28_08", + (28 << 8) | 0x10: "WEEKEVENTREG_28_10", + (28 << 8) | 0x20: "WEEKEVENTREG_28_20", + (28 << 8) | 0x40: "WEEKEVENTREG_28_40", + (28 << 8) | 0x80: "WEEKEVENTREG_28_80", + (29 << 8) | 0x01: "WEEKEVENTREG_29_01", + (29 << 8) | 0x02: "WEEKEVENTREG_29_02", + (29 << 8) | 0x04: "WEEKEVENTREG_29_04", + (29 << 8) | 0x08: "WEEKEVENTREG_29_08", + (29 << 8) | 0x10: "WEEKEVENTREG_29_10", + (29 << 8) | 0x20: "WEEKEVENTREG_29_20", + (29 << 8) | 0x40: "WEEKEVENTREG_29_40", + (29 << 8) | 0x80: "WEEKEVENTREG_29_80", + (30 << 8) | 0x01: "WEEKEVENTREG_30_01", + (30 << 8) | 0x02: "WEEKEVENTREG_30_02", + (30 << 8) | 0x04: "WEEKEVENTREG_30_04", + (30 << 8) | 0x08: "WEEKEVENTREG_30_08", + (30 << 8) | 0x10: "WEEKEVENTREG_30_10", + (30 << 8) | 0x20: "WEEKEVENTREG_30_20", + (30 << 8) | 0x40: "WEEKEVENTREG_30_40", + (30 << 8) | 0x80: "WEEKEVENTREG_30_80", + (31 << 8) | 0x01: "WEEKEVENTREG_31_01", + (31 << 8) | 0x02: "WEEKEVENTREG_31_02", + (31 << 8) | 0x04: "WEEKEVENTREG_31_04", + (31 << 8) | 0x08: "WEEKEVENTREG_31_08", + (31 << 8) | 0x10: "WEEKEVENTREG_31_10", + (31 << 8) | 0x20: "WEEKEVENTREG_31_20", + (31 << 8) | 0x40: "WEEKEVENTREG_31_40", + (31 << 8) | 0x80: "WEEKEVENTREG_31_80", + (32 << 8) | 0x01: "WEEKEVENTREG_32_01", + (32 << 8) | 0x02: "WEEKEVENTREG_32_02", + (32 << 8) | 0x04: "WEEKEVENTREG_32_04", + (32 << 8) | 0x08: "WEEKEVENTREG_32_08", + (32 << 8) | 0x10: "WEEKEVENTREG_32_10", + (32 << 8) | 0x20: "WEEKEVENTREG_32_20", + (32 << 8) | 0x40: "WEEKEVENTREG_32_40", + (32 << 8) | 0x80: "WEEKEVENTREG_32_80", + (33 << 8) | 0x01: "WEEKEVENTREG_33_01", + (33 << 8) | 0x02: "WEEKEVENTREG_33_02", + (33 << 8) | 0x04: "WEEKEVENTREG_33_04", + (33 << 8) | 0x08: "WEEKEVENTREG_33_08", + (33 << 8) | 0x10: "WEEKEVENTREG_33_10", + (33 << 8) | 0x20: "WEEKEVENTREG_33_20", + (33 << 8) | 0x40: "WEEKEVENTREG_33_40", + (33 << 8) | 0x80: "WEEKEVENTREG_33_80", + (34 << 8) | 0x01: "WEEKEVENTREG_34_01", + (34 << 8) | 0x02: "WEEKEVENTREG_34_02", + (34 << 8) | 0x04: "WEEKEVENTREG_34_04", + (34 << 8) | 0x08: "WEEKEVENTREG_34_08", + (34 << 8) | 0x10: "WEEKEVENTREG_34_10", + (34 << 8) | 0x20: "WEEKEVENTREG_34_20", + (34 << 8) | 0x40: "WEEKEVENTREG_34_40", + (34 << 8) | 0x80: "WEEKEVENTREG_34_80", + (35 << 8) | 0x01: "WEEKEVENTREG_35_01", + (35 << 8) | 0x02: "WEEKEVENTREG_35_02", + (35 << 8) | 0x04: "WEEKEVENTREG_35_04", + (35 << 8) | 0x08: "WEEKEVENTREG_35_08", + (35 << 8) | 0x10: "WEEKEVENTREG_35_10", + (35 << 8) | 0x20: "WEEKEVENTREG_35_20", + (35 << 8) | 0x40: "WEEKEVENTREG_35_40", + (35 << 8) | 0x80: "WEEKEVENTREG_35_80", + (36 << 8) | 0x01: "WEEKEVENTREG_36_01", + (36 << 8) | 0x02: "WEEKEVENTREG_36_02", + (36 << 8) | 0x04: "WEEKEVENTREG_36_04", + (36 << 8) | 0x08: "WEEKEVENTREG_36_08", + (36 << 8) | 0x10: "WEEKEVENTREG_36_10", + (36 << 8) | 0x20: "WEEKEVENTREG_36_20", + (36 << 8) | 0x40: "WEEKEVENTREG_36_40", + (36 << 8) | 0x80: "WEEKEVENTREG_36_80", + (37 << 8) | 0x01: "WEEKEVENTREG_37_01", + (37 << 8) | 0x02: "WEEKEVENTREG_37_02", + (37 << 8) | 0x04: "WEEKEVENTREG_37_04", + (37 << 8) | 0x08: "WEEKEVENTREG_37_08", + (37 << 8) | 0x10: "WEEKEVENTREG_37_10", + (37 << 8) | 0x20: "WEEKEVENTREG_37_20", + (37 << 8) | 0x40: "WEEKEVENTREG_37_40", + (37 << 8) | 0x80: "WEEKEVENTREG_37_80", + (38 << 8) | 0x01: "WEEKEVENTREG_38_01", + (38 << 8) | 0x02: "WEEKEVENTREG_38_02", + (38 << 8) | 0x04: "WEEKEVENTREG_38_04", + (38 << 8) | 0x08: "WEEKEVENTREG_38_08", + (38 << 8) | 0x10: "WEEKEVENTREG_38_10", + (38 << 8) | 0x20: "WEEKEVENTREG_38_20", + (38 << 8) | 0x40: "WEEKEVENTREG_38_40", + (38 << 8) | 0x80: "WEEKEVENTREG_38_80", + (39 << 8) | 0x01: "WEEKEVENTREG_39_01", + (39 << 8) | 0x02: "WEEKEVENTREG_39_02", + (39 << 8) | 0x04: "WEEKEVENTREG_39_04", + (39 << 8) | 0x08: "WEEKEVENTREG_39_08", + (39 << 8) | 0x10: "WEEKEVENTREG_39_10", + (39 << 8) | 0x20: "WEEKEVENTREG_39_20", + (39 << 8) | 0x40: "WEEKEVENTREG_39_40", + (39 << 8) | 0x80: "WEEKEVENTREG_39_80", + (40 << 8) | 0x01: "WEEKEVENTREG_40_01", + (40 << 8) | 0x02: "WEEKEVENTREG_40_02", + (40 << 8) | 0x04: "WEEKEVENTREG_40_04", + (40 << 8) | 0x08: "WEEKEVENTREG_40_08", + (40 << 8) | 0x10: "WEEKEVENTREG_40_10", + (40 << 8) | 0x20: "WEEKEVENTREG_40_20", + (40 << 8) | 0x40: "WEEKEVENTREG_40_40", + (40 << 8) | 0x80: "WEEKEVENTREG_40_80", + (41 << 8) | 0x01: "WEEKEVENTREG_41_01", + (41 << 8) | 0x02: "WEEKEVENTREG_41_02", + (41 << 8) | 0x04: "WEEKEVENTREG_41_04", + (41 << 8) | 0x08: "WEEKEVENTREG_41_08", + (41 << 8) | 0x10: "WEEKEVENTREG_41_10", + (41 << 8) | 0x20: "WEEKEVENTREG_41_20", + (41 << 8) | 0x40: "WEEKEVENTREG_41_40", + (41 << 8) | 0x80: "WEEKEVENTREG_41_80", + (42 << 8) | 0x01: "WEEKEVENTREG_42_01", + (42 << 8) | 0x02: "WEEKEVENTREG_42_02", + (42 << 8) | 0x04: "WEEKEVENTREG_42_04", + (42 << 8) | 0x08: "WEEKEVENTREG_42_08", + (42 << 8) | 0x10: "WEEKEVENTREG_42_10", + (42 << 8) | 0x20: "WEEKEVENTREG_42_20", + (42 << 8) | 0x40: "WEEKEVENTREG_42_40", + (42 << 8) | 0x80: "WEEKEVENTREG_42_80", + (43 << 8) | 0x01: "WEEKEVENTREG_43_01", + (43 << 8) | 0x02: "WEEKEVENTREG_43_02", + (43 << 8) | 0x04: "WEEKEVENTREG_43_04", + (43 << 8) | 0x08: "WEEKEVENTREG_43_08", + (43 << 8) | 0x10: "WEEKEVENTREG_43_10", + (43 << 8) | 0x20: "WEEKEVENTREG_43_20", + (43 << 8) | 0x40: "WEEKEVENTREG_43_40", + (43 << 8) | 0x80: "WEEKEVENTREG_43_80", + (44 << 8) | 0x01: "WEEKEVENTREG_44_01", + (44 << 8) | 0x02: "WEEKEVENTREG_44_02", + (44 << 8) | 0x04: "WEEKEVENTREG_44_04", + (44 << 8) | 0x08: "WEEKEVENTREG_44_08", + (44 << 8) | 0x10: "WEEKEVENTREG_44_10", + (44 << 8) | 0x20: "WEEKEVENTREG_44_20", + (44 << 8) | 0x40: "WEEKEVENTREG_44_40", + (44 << 8) | 0x80: "WEEKEVENTREG_44_80", + (45 << 8) | 0x01: "WEEKEVENTREG_45_01", + (45 << 8) | 0x02: "WEEKEVENTREG_45_02", + (45 << 8) | 0x04: "WEEKEVENTREG_45_04", + (45 << 8) | 0x08: "WEEKEVENTREG_45_08", + (45 << 8) | 0x10: "WEEKEVENTREG_45_10", + (45 << 8) | 0x20: "WEEKEVENTREG_45_20", + (45 << 8) | 0x40: "WEEKEVENTREG_45_40", + (45 << 8) | 0x80: "WEEKEVENTREG_45_80", + (46 << 8) | 0x01: "WEEKEVENTREG_46_01", + (46 << 8) | 0x02: "WEEKEVENTREG_46_02", + (46 << 8) | 0x04: "WEEKEVENTREG_46_04", + (46 << 8) | 0x08: "WEEKEVENTREG_46_08", + (46 << 8) | 0x10: "WEEKEVENTREG_46_10", + (46 << 8) | 0x20: "WEEKEVENTREG_46_20", + (46 << 8) | 0x40: "WEEKEVENTREG_46_40", + (46 << 8) | 0x80: "WEEKEVENTREG_46_80", + (47 << 8) | 0x01: "WEEKEVENTREG_47_01", + (47 << 8) | 0x02: "WEEKEVENTREG_47_02", + (47 << 8) | 0x04: "WEEKEVENTREG_47_04", + (47 << 8) | 0x08: "WEEKEVENTREG_47_08", + (47 << 8) | 0x10: "WEEKEVENTREG_47_10", + (47 << 8) | 0x20: "WEEKEVENTREG_47_20", + (47 << 8) | 0x40: "WEEKEVENTREG_47_40", + (47 << 8) | 0x80: "WEEKEVENTREG_47_80", + (48 << 8) | 0x01: "WEEKEVENTREG_48_01", + (48 << 8) | 0x02: "WEEKEVENTREG_48_02", + (48 << 8) | 0x04: "WEEKEVENTREG_48_04", + (48 << 8) | 0x08: "WEEKEVENTREG_48_08", + (48 << 8) | 0x10: "WEEKEVENTREG_48_10", + (48 << 8) | 0x20: "WEEKEVENTREG_48_20", + (48 << 8) | 0x40: "WEEKEVENTREG_48_40", + (48 << 8) | 0x80: "WEEKEVENTREG_48_80", + (49 << 8) | 0x01: "WEEKEVENTREG_49_01", + (49 << 8) | 0x02: "WEEKEVENTREG_49_02", + (49 << 8) | 0x04: "WEEKEVENTREG_49_04", + (49 << 8) | 0x08: "WEEKEVENTREG_49_08", + (49 << 8) | 0x10: "WEEKEVENTREG_49_10", + (49 << 8) | 0x20: "WEEKEVENTREG_49_20", + (49 << 8) | 0x40: "WEEKEVENTREG_49_40", + (49 << 8) | 0x80: "WEEKEVENTREG_49_80", + (50 << 8) | 0x01: "WEEKEVENTREG_50_01", + (50 << 8) | 0x02: "WEEKEVENTREG_50_02", + (50 << 8) | 0x04: "WEEKEVENTREG_50_04", + (50 << 8) | 0x08: "WEEKEVENTREG_50_08", + (50 << 8) | 0x10: "WEEKEVENTREG_50_10", + (50 << 8) | 0x20: "WEEKEVENTREG_50_20", + (50 << 8) | 0x40: "WEEKEVENTREG_50_40", + (50 << 8) | 0x80: "WEEKEVENTREG_50_80", + (51 << 8) | 0x01: "WEEKEVENTREG_51_01", + (51 << 8) | 0x02: "WEEKEVENTREG_51_02", + (51 << 8) | 0x04: "WEEKEVENTREG_51_04", + (51 << 8) | 0x08: "WEEKEVENTREG_51_08", + (51 << 8) | 0x10: "WEEKEVENTREG_51_10", + (51 << 8) | 0x20: "WEEKEVENTREG_51_20", + (51 << 8) | 0x40: "WEEKEVENTREG_51_40", + (51 << 8) | 0x80: "WEEKEVENTREG_51_80", + (52 << 8) | 0x01: "WEEKEVENTREG_52_01", + (52 << 8) | 0x02: "WEEKEVENTREG_52_02", + (52 << 8) | 0x04: "WEEKEVENTREG_52_04", + (52 << 8) | 0x08: "WEEKEVENTREG_52_08", + (52 << 8) | 0x10: "WEEKEVENTREG_52_10", + (52 << 8) | 0x20: "WEEKEVENTREG_52_20", + (52 << 8) | 0x40: "WEEKEVENTREG_52_40", + (52 << 8) | 0x80: "WEEKEVENTREG_52_80", + (53 << 8) | 0x01: "WEEKEVENTREG_53_01", + (53 << 8) | 0x02: "WEEKEVENTREG_53_02", + (53 << 8) | 0x04: "WEEKEVENTREG_53_04", + (53 << 8) | 0x08: "WEEKEVENTREG_53_08", + (53 << 8) | 0x10: "WEEKEVENTREG_53_10", + (53 << 8) | 0x20: "WEEKEVENTREG_53_20", + (53 << 8) | 0x40: "WEEKEVENTREG_53_40", + (53 << 8) | 0x80: "WEEKEVENTREG_53_80", + (54 << 8) | 0x01: "WEEKEVENTREG_54_01", + (54 << 8) | 0x02: "WEEKEVENTREG_54_02", + (54 << 8) | 0x04: "WEEKEVENTREG_54_04", + (54 << 8) | 0x08: "WEEKEVENTREG_54_08", + (54 << 8) | 0x10: "WEEKEVENTREG_54_10", + (54 << 8) | 0x20: "WEEKEVENTREG_54_20", + (54 << 8) | 0x40: "WEEKEVENTREG_54_40", + (54 << 8) | 0x80: "WEEKEVENTREG_54_80", + (55 << 8) | 0x01: "WEEKEVENTREG_55_01", + (55 << 8) | 0x02: "WEEKEVENTREG_55_02", + (55 << 8) | 0x04: "WEEKEVENTREG_55_04", + (55 << 8) | 0x08: "WEEKEVENTREG_55_08", + (55 << 8) | 0x10: "WEEKEVENTREG_55_10", + (55 << 8) | 0x20: "WEEKEVENTREG_55_20", + (55 << 8) | 0x40: "WEEKEVENTREG_55_40", + (55 << 8) | 0x80: "WEEKEVENTREG_55_80", + (56 << 8) | 0x01: "WEEKEVENTREG_56_01", + (56 << 8) | 0x02: "WEEKEVENTREG_56_02", + (56 << 8) | 0x04: "WEEKEVENTREG_56_04", + (56 << 8) | 0x08: "WEEKEVENTREG_56_08", + (56 << 8) | 0x10: "WEEKEVENTREG_56_10", + (56 << 8) | 0x20: "WEEKEVENTREG_56_20", + (56 << 8) | 0x40: "WEEKEVENTREG_56_40", + (56 << 8) | 0x80: "WEEKEVENTREG_56_80", + (57 << 8) | 0x01: "WEEKEVENTREG_57_01", + (57 << 8) | 0x02: "WEEKEVENTREG_57_02", + (57 << 8) | 0x04: "WEEKEVENTREG_57_04", + (57 << 8) | 0x08: "WEEKEVENTREG_57_08", + (57 << 8) | 0x10: "WEEKEVENTREG_57_10", + (57 << 8) | 0x20: "WEEKEVENTREG_57_20", + (57 << 8) | 0x40: "WEEKEVENTREG_57_40", + (57 << 8) | 0x80: "WEEKEVENTREG_57_80", + (58 << 8) | 0x01: "WEEKEVENTREG_58_01", + (58 << 8) | 0x02: "WEEKEVENTREG_58_02", + (58 << 8) | 0x04: "WEEKEVENTREG_58_04", + (58 << 8) | 0x08: "WEEKEVENTREG_58_08", + (58 << 8) | 0x10: "WEEKEVENTREG_58_10", + (58 << 8) | 0x20: "WEEKEVENTREG_58_20", + (58 << 8) | 0x40: "WEEKEVENTREG_58_40", + (58 << 8) | 0x80: "WEEKEVENTREG_58_80", + (59 << 8) | 0x01: "WEEKEVENTREG_59_01", + (59 << 8) | 0x02: "WEEKEVENTREG_59_02", + (59 << 8) | 0x08: "WEEKEVENTREG_59_08", + (59 << 8) | 0x04: "WEEKEVENTREG_59_04", + (59 << 8) | 0x10: "WEEKEVENTREG_59_10", + (59 << 8) | 0x20: "WEEKEVENTREG_59_20", + (59 << 8) | 0x40: "WEEKEVENTREG_59_40", + (59 << 8) | 0x80: "WEEKEVENTREG_59_80", + (60 << 8) | 0x01: "WEEKEVENTREG_60_01", + (60 << 8) | 0x02: "WEEKEVENTREG_60_02", + (60 << 8) | 0x04: "WEEKEVENTREG_60_04", + (60 << 8) | 0x08: "WEEKEVENTREG_60_08", + (60 << 8) | 0x10: "WEEKEVENTREG_60_10", + (60 << 8) | 0x20: "WEEKEVENTREG_60_20", + (60 << 8) | 0x40: "WEEKEVENTREG_60_40", + (60 << 8) | 0x80: "WEEKEVENTREG_60_80", + (61 << 8) | 0x01: "WEEKEVENTREG_61_01", + (61 << 8) | 0x02: "WEEKEVENTREG_61_02", + (61 << 8) | 0x04: "WEEKEVENTREG_61_04", + (61 << 8) | 0x08: "WEEKEVENTREG_61_08", + (61 << 8) | 0x10: "WEEKEVENTREG_61_10", + (61 << 8) | 0x20: "WEEKEVENTREG_61_20", + (61 << 8) | 0x40: "WEEKEVENTREG_61_40", + (61 << 8) | 0x80: "WEEKEVENTREG_61_80", + (62 << 8) | 0x01: "WEEKEVENTREG_62_01", + (62 << 8) | 0x02: "WEEKEVENTREG_62_02", + (62 << 8) | 0x04: "WEEKEVENTREG_62_04", + (62 << 8) | 0x08: "WEEKEVENTREG_62_08", + (62 << 8) | 0x10: "WEEKEVENTREG_62_10", + (62 << 8) | 0x20: "WEEKEVENTREG_62_20", + (62 << 8) | 0x40: "WEEKEVENTREG_62_40", + (62 << 8) | 0x80: "WEEKEVENTREG_62_80", + (63 << 8) | 0x01: "WEEKEVENTREG_63_01", + (63 << 8) | 0x02: "WEEKEVENTREG_63_02", + (63 << 8) | 0x04: "WEEKEVENTREG_63_04", + (63 << 8) | 0x08: "WEEKEVENTREG_63_08", + (63 << 8) | 0x10: "WEEKEVENTREG_63_10", + (63 << 8) | 0x20: "WEEKEVENTREG_63_20", + (63 << 8) | 0x40: "WEEKEVENTREG_63_40", + (63 << 8) | 0x80: "WEEKEVENTREG_63_80", + (64 << 8) | 0x01: "WEEKEVENTREG_64_01", + (64 << 8) | 0x02: "WEEKEVENTREG_64_02", + (64 << 8) | 0x04: "WEEKEVENTREG_64_04", + (64 << 8) | 0x08: "WEEKEVENTREG_64_08", + (64 << 8) | 0x10: "WEEKEVENTREG_64_10", + (64 << 8) | 0x20: "WEEKEVENTREG_64_20", + (64 << 8) | 0x40: "WEEKEVENTREG_64_40", + (64 << 8) | 0x80: "WEEKEVENTREG_64_80", + (65 << 8) | 0x01: "WEEKEVENTREG_65_01", + (65 << 8) | 0x02: "WEEKEVENTREG_65_02", + (65 << 8) | 0x04: "WEEKEVENTREG_65_04", + (65 << 8) | 0x08: "WEEKEVENTREG_65_08", + (65 << 8) | 0x10: "WEEKEVENTREG_65_10", + (65 << 8) | 0x20: "WEEKEVENTREG_65_20", + (65 << 8) | 0x40: "WEEKEVENTREG_65_40", + (65 << 8) | 0x80: "WEEKEVENTREG_65_80", + (66 << 8) | 0x01: "WEEKEVENTREG_66_01", + (66 << 8) | 0x02: "WEEKEVENTREG_66_02", + (66 << 8) | 0x04: "WEEKEVENTREG_66_04", + (66 << 8) | 0x08: "WEEKEVENTREG_66_08", + (66 << 8) | 0x10: "WEEKEVENTREG_66_10", + (66 << 8) | 0x20: "WEEKEVENTREG_66_20", + (66 << 8) | 0x40: "WEEKEVENTREG_66_40", + (66 << 8) | 0x80: "WEEKEVENTREG_66_80", + (67 << 8) | 0x01: "WEEKEVENTREG_67_01", + (67 << 8) | 0x02: "WEEKEVENTREG_67_02", + (67 << 8) | 0x04: "WEEKEVENTREG_67_04", + (67 << 8) | 0x08: "WEEKEVENTREG_67_08", + (67 << 8) | 0x10: "WEEKEVENTREG_67_10", + (67 << 8) | 0x20: "WEEKEVENTREG_67_20", + (67 << 8) | 0x40: "WEEKEVENTREG_67_40", + (67 << 8) | 0x80: "WEEKEVENTREG_67_80", + (68 << 8) | 0x01: "WEEKEVENTREG_68_01", + (68 << 8) | 0x02: "WEEKEVENTREG_68_02", + (68 << 8) | 0x04: "WEEKEVENTREG_68_04", + (68 << 8) | 0x08: "WEEKEVENTREG_68_08", + (68 << 8) | 0x10: "WEEKEVENTREG_68_10", + (68 << 8) | 0x20: "WEEKEVENTREG_68_20", + (68 << 8) | 0x40: "WEEKEVENTREG_68_40", + (68 << 8) | 0x80: "WEEKEVENTREG_68_80", + (69 << 8) | 0x01: "WEEKEVENTREG_69_01", + (69 << 8) | 0x02: "WEEKEVENTREG_69_02", + (69 << 8) | 0x04: "WEEKEVENTREG_69_04", + (69 << 8) | 0x08: "WEEKEVENTREG_69_08", + (69 << 8) | 0x10: "WEEKEVENTREG_69_10", + (69 << 8) | 0x20: "WEEKEVENTREG_69_20", + (69 << 8) | 0x40: "WEEKEVENTREG_69_40", + (69 << 8) | 0x80: "WEEKEVENTREG_69_80", + (70 << 8) | 0x01: "WEEKEVENTREG_70_01", + (70 << 8) | 0x02: "WEEKEVENTREG_70_02", + (70 << 8) | 0x04: "WEEKEVENTREG_70_04", + (70 << 8) | 0x08: "WEEKEVENTREG_70_08", + (70 << 8) | 0x10: "WEEKEVENTREG_70_10", + (70 << 8) | 0x20: "WEEKEVENTREG_70_20", + (70 << 8) | 0x40: "WEEKEVENTREG_70_40", + (70 << 8) | 0x80: "WEEKEVENTREG_70_80", + (71 << 8) | 0x01: "WEEKEVENTREG_71_01", + (71 << 8) | 0x02: "WEEKEVENTREG_71_02", + (71 << 8) | 0x04: "WEEKEVENTREG_71_04", + (71 << 8) | 0x08: "WEEKEVENTREG_71_08", + (71 << 8) | 0x10: "WEEKEVENTREG_71_10", + (71 << 8) | 0x20: "WEEKEVENTREG_71_20", + (71 << 8) | 0x40: "WEEKEVENTREG_71_40", + (71 << 8) | 0x80: "WEEKEVENTREG_71_80", + (72 << 8) | 0x01: "WEEKEVENTREG_72_01", + (72 << 8) | 0x02: "WEEKEVENTREG_72_02", + (72 << 8) | 0x04: "WEEKEVENTREG_72_04", + (72 << 8) | 0x08: "WEEKEVENTREG_72_08", + (72 << 8) | 0x10: "WEEKEVENTREG_72_10", + (72 << 8) | 0x20: "WEEKEVENTREG_72_20", + (72 << 8) | 0x40: "WEEKEVENTREG_72_40", + (72 << 8) | 0x80: "WEEKEVENTREG_72_80", + (73 << 8) | 0x01: "WEEKEVENTREG_73_01", + (73 << 8) | 0x02: "WEEKEVENTREG_73_02", + (73 << 8) | 0x04: "WEEKEVENTREG_73_04", + (73 << 8) | 0x08: "WEEKEVENTREG_73_08", + (73 << 8) | 0x10: "WEEKEVENTREG_73_10", + (73 << 8) | 0x20: "WEEKEVENTREG_73_20", + (73 << 8) | 0x40: "WEEKEVENTREG_73_40", + (73 << 8) | 0x80: "WEEKEVENTREG_73_80", + (74 << 8) | 0x01: "WEEKEVENTREG_74_01", + (74 << 8) | 0x02: "WEEKEVENTREG_74_02", + (74 << 8) | 0x04: "WEEKEVENTREG_74_04", + (74 << 8) | 0x08: "WEEKEVENTREG_74_08", + (74 << 8) | 0x10: "WEEKEVENTREG_74_10", + (74 << 8) | 0x20: "WEEKEVENTREG_74_20", + (74 << 8) | 0x40: "WEEKEVENTREG_74_40", + (74 << 8) | 0x80: "WEEKEVENTREG_74_80", + (75 << 8) | 0x01: "WEEKEVENTREG_75_01", + (75 << 8) | 0x02: "WEEKEVENTREG_75_02", + (75 << 8) | 0x04: "WEEKEVENTREG_75_04", + (75 << 8) | 0x08: "WEEKEVENTREG_75_08", + (75 << 8) | 0x10: "WEEKEVENTREG_75_10", + (75 << 8) | 0x20: "WEEKEVENTREG_75_20", + (75 << 8) | 0x40: "WEEKEVENTREG_75_40", + (75 << 8) | 0x80: "WEEKEVENTREG_75_80", + (76 << 8) | 0x01: "WEEKEVENTREG_76_01", + (76 << 8) | 0x02: "WEEKEVENTREG_76_02", + (76 << 8) | 0x04: "WEEKEVENTREG_76_04", + (76 << 8) | 0x08: "WEEKEVENTREG_76_08", + (76 << 8) | 0x10: "WEEKEVENTREG_76_10", + (76 << 8) | 0x20: "WEEKEVENTREG_76_20", + (76 << 8) | 0x40: "WEEKEVENTREG_76_40", + (76 << 8) | 0x80: "WEEKEVENTREG_76_80", + (77 << 8) | 0x01: "WEEKEVENTREG_77_01", + (77 << 8) | 0x02: "WEEKEVENTREG_77_02", + (77 << 8) | 0x04: "WEEKEVENTREG_77_04", + (77 << 8) | 0x08: "WEEKEVENTREG_77_08", + (77 << 8) | 0x10: "WEEKEVENTREG_77_10", + (77 << 8) | 0x20: "WEEKEVENTREG_77_20", + (77 << 8) | 0x40: "WEEKEVENTREG_77_40", + (77 << 8) | 0x80: "WEEKEVENTREG_77_80", + (78 << 8) | 0x01: "WEEKEVENTREG_78_01", + (78 << 8) | 0x02: "WEEKEVENTREG_78_02", + (78 << 8) | 0x04: "WEEKEVENTREG_78_04", + (78 << 8) | 0x08: "WEEKEVENTREG_78_08", + (78 << 8) | 0x10: "WEEKEVENTREG_78_10", + (78 << 8) | 0x20: "WEEKEVENTREG_78_20", + (78 << 8) | 0x40: "WEEKEVENTREG_78_40", + (78 << 8) | 0x80: "WEEKEVENTREG_78_80", + (79 << 8) | 0x01: "WEEKEVENTREG_79_01", + (79 << 8) | 0x02: "WEEKEVENTREG_79_02", + (79 << 8) | 0x04: "WEEKEVENTREG_79_04", + (79 << 8) | 0x08: "WEEKEVENTREG_79_08", + (79 << 8) | 0x10: "WEEKEVENTREG_79_10", + (79 << 8) | 0x20: "WEEKEVENTREG_79_20", + (79 << 8) | 0x40: "WEEKEVENTREG_79_40", + (79 << 8) | 0x80: "WEEKEVENTREG_79_80", + (80 << 8) | 0x01: "WEEKEVENTREG_80_01", + (80 << 8) | 0x02: "WEEKEVENTREG_80_02", + (80 << 8) | 0x04: "WEEKEVENTREG_80_04", + (80 << 8) | 0x08: "WEEKEVENTREG_80_08", + (80 << 8) | 0x10: "WEEKEVENTREG_80_10", + (80 << 8) | 0x20: "WEEKEVENTREG_80_20", + (80 << 8) | 0x40: "WEEKEVENTREG_80_40", + (80 << 8) | 0x80: "WEEKEVENTREG_80_80", + (81 << 8) | 0x01: "WEEKEVENTREG_81_01", + (81 << 8) | 0x02: "WEEKEVENTREG_81_02", + (81 << 8) | 0x04: "WEEKEVENTREG_81_04", + (81 << 8) | 0x08: "WEEKEVENTREG_81_08", + (81 << 8) | 0x10: "WEEKEVENTREG_81_10", + (81 << 8) | 0x20: "WEEKEVENTREG_81_20", + (81 << 8) | 0x40: "WEEKEVENTREG_81_40", + (81 << 8) | 0x80: "WEEKEVENTREG_81_80", + (82 << 8) | 0x01: "WEEKEVENTREG_82_01", + (82 << 8) | 0x02: "WEEKEVENTREG_82_02", + (82 << 8) | 0x04: "WEEKEVENTREG_82_04", + (82 << 8) | 0x08: "WEEKEVENTREG_82_08", + (82 << 8) | 0x10: "WEEKEVENTREG_82_10", + (82 << 8) | 0x20: "WEEKEVENTREG_82_20", + (82 << 8) | 0x40: "WEEKEVENTREG_82_40", + (82 << 8) | 0x80: "WEEKEVENTREG_82_80", + (83 << 8) | 0x01: "WEEKEVENTREG_83_01", + (83 << 8) | 0x02: "WEEKEVENTREG_83_02", + (83 << 8) | 0x04: "WEEKEVENTREG_83_04", + (83 << 8) | 0x08: "WEEKEVENTREG_83_08", + (83 << 8) | 0x10: "WEEKEVENTREG_83_10", + (83 << 8) | 0x20: "WEEKEVENTREG_83_20", + (83 << 8) | 0x40: "WEEKEVENTREG_83_40", + (83 << 8) | 0x80: "WEEKEVENTREG_83_80", + (84 << 8) | 0x01: "WEEKEVENTREG_84_01", + (84 << 8) | 0x02: "WEEKEVENTREG_84_02", + (84 << 8) | 0x04: "WEEKEVENTREG_84_04", + (84 << 8) | 0x08: "WEEKEVENTREG_84_08", + (84 << 8) | 0x10: "WEEKEVENTREG_84_10", + (84 << 8) | 0x20: "WEEKEVENTREG_84_20", + (84 << 8) | 0x40: "WEEKEVENTREG_84_40", + (84 << 8) | 0x80: "WEEKEVENTREG_84_80", + (85 << 8) | 0x01: "WEEKEVENTREG_85_01", + (85 << 8) | 0x02: "WEEKEVENTREG_85_02", + (85 << 8) | 0x04: "WEEKEVENTREG_85_04", + (85 << 8) | 0x08: "WEEKEVENTREG_85_08", + (85 << 8) | 0x10: "WEEKEVENTREG_85_10", + (85 << 8) | 0x20: "WEEKEVENTREG_85_20", + (85 << 8) | 0x40: "WEEKEVENTREG_85_40", + (85 << 8) | 0x80: "WEEKEVENTREG_85_80", + (86 << 8) | 0x01: "WEEKEVENTREG_86_01", + (86 << 8) | 0x02: "WEEKEVENTREG_86_02", + (86 << 8) | 0x04: "WEEKEVENTREG_86_04", + (86 << 8) | 0x08: "WEEKEVENTREG_86_08", + (86 << 8) | 0x10: "WEEKEVENTREG_86_10", + (86 << 8) | 0x20: "WEEKEVENTREG_86_20", + (86 << 8) | 0x40: "WEEKEVENTREG_86_40", + (86 << 8) | 0x80: "WEEKEVENTREG_86_80", + (87 << 8) | 0x01: "WEEKEVENTREG_87_01", + (87 << 8) | 0x02: "WEEKEVENTREG_87_02", + (87 << 8) | 0x04: "WEEKEVENTREG_87_04", + (87 << 8) | 0x08: "WEEKEVENTREG_87_08", + (87 << 8) | 0x10: "WEEKEVENTREG_87_10", + (87 << 8) | 0x20: "WEEKEVENTREG_87_20", + (87 << 8) | 0x40: "WEEKEVENTREG_87_40", + (87 << 8) | 0x80: "WEEKEVENTREG_87_80", + (88 << 8) | 0x01: "WEEKEVENTREG_88_01", + (88 << 8) | 0x02: "WEEKEVENTREG_88_02", + (88 << 8) | 0x04: "WEEKEVENTREG_88_04", + (88 << 8) | 0x08: "WEEKEVENTREG_88_08", + (88 << 8) | 0x10: "WEEKEVENTREG_88_10", + (88 << 8) | 0x20: "WEEKEVENTREG_88_20", + (88 << 8) | 0x40: "WEEKEVENTREG_88_40", + (88 << 8) | 0x80: "WEEKEVENTREG_88_80", + (89 << 8) | 0x01: "WEEKEVENTREG_89_01", + (89 << 8) | 0x02: "WEEKEVENTREG_89_02", + (89 << 8) | 0x04: "WEEKEVENTREG_89_04", + (89 << 8) | 0x08: "WEEKEVENTREG_89_08", + (89 << 8) | 0x10: "WEEKEVENTREG_89_10", + (89 << 8) | 0x20: "WEEKEVENTREG_89_20", + (89 << 8) | 0x40: "WEEKEVENTREG_89_40", + (89 << 8) | 0x80: "WEEKEVENTREG_89_80", + (90 << 8) | 0x01: "WEEKEVENTREG_90_01", + (90 << 8) | 0x02: "WEEKEVENTREG_90_02", + (90 << 8) | 0x04: "WEEKEVENTREG_90_04", + (90 << 8) | 0x08: "WEEKEVENTREG_90_08", + (90 << 8) | 0x10: "WEEKEVENTREG_90_10", + (90 << 8) | 0x20: "WEEKEVENTREG_90_20", + (90 << 8) | 0x40: "WEEKEVENTREG_90_40", + (90 << 8) | 0x80: "WEEKEVENTREG_90_80", + (91 << 8) | 0x01: "WEEKEVENTREG_91_01", + (91 << 8) | 0x02: "WEEKEVENTREG_91_02", + (91 << 8) | 0x04: "WEEKEVENTREG_91_04", + (91 << 8) | 0x08: "WEEKEVENTREG_91_08", + (91 << 8) | 0x10: "WEEKEVENTREG_91_10", + (91 << 8) | 0x20: "WEEKEVENTREG_91_20", + (91 << 8) | 0x40: "WEEKEVENTREG_91_40", + (91 << 8) | 0x80: "WEEKEVENTREG_91_80", + (92 << 8) | 0x01: "WEEKEVENTREG_92_01", + (92 << 8) | 0x02: "WEEKEVENTREG_92_02", + (92 << 8) | 0x04: "WEEKEVENTREG_92_04", + (92 << 8) | 0x08: "WEEKEVENTREG_92_08", + (92 << 8) | 0x10: "WEEKEVENTREG_92_10", + (92 << 8) | 0x20: "WEEKEVENTREG_92_20", + (92 << 8) | 0x40: "WEEKEVENTREG_92_40", + (92 << 8) | 0x80: "WEEKEVENTREG_92_80", + (93 << 8) | 0x01: "WEEKEVENTREG_93_01", + (93 << 8) | 0x02: "WEEKEVENTREG_93_02", + (93 << 8) | 0x04: "WEEKEVENTREG_93_04", + (93 << 8) | 0x08: "WEEKEVENTREG_93_08", + (93 << 8) | 0x10: "WEEKEVENTREG_93_10", + (93 << 8) | 0x20: "WEEKEVENTREG_93_20", + (93 << 8) | 0x40: "WEEKEVENTREG_93_40", + (93 << 8) | 0x80: "WEEKEVENTREG_93_80", + (94 << 8) | 0x01: "WEEKEVENTREG_94_01", + (94 << 8) | 0x02: "WEEKEVENTREG_94_02", + (94 << 8) | 0x04: "WEEKEVENTREG_94_04", + (94 << 8) | 0x08: "WEEKEVENTREG_94_08", + (94 << 8) | 0x10: "WEEKEVENTREG_94_10", + (94 << 8) | 0x20: "WEEKEVENTREG_94_20", + (94 << 8) | 0x40: "WEEKEVENTREG_94_40", + (94 << 8) | 0x80: "WEEKEVENTREG_94_80", + (95 << 8) | 0x01: "WEEKEVENTREG_95_01", + (95 << 8) | 0x02: "WEEKEVENTREG_95_02", + (95 << 8) | 0x04: "WEEKEVENTREG_95_04", + (95 << 8) | 0x08: "WEEKEVENTREG_95_08", + (95 << 8) | 0x10: "WEEKEVENTREG_95_10", + (95 << 8) | 0x20: "WEEKEVENTREG_95_20", + (95 << 8) | 0x40: "WEEKEVENTREG_95_40", + (95 << 8) | 0x80: "WEEKEVENTREG_95_80", + (96 << 8) | 0x01: "WEEKEVENTREG_96_01", + (96 << 8) | 0x02: "WEEKEVENTREG_96_02", + (96 << 8) | 0x04: "WEEKEVENTREG_96_04", + (96 << 8) | 0x08: "WEEKEVENTREG_96_08", + (96 << 8) | 0x10: "WEEKEVENTREG_96_10", + (96 << 8) | 0x20: "WEEKEVENTREG_96_20", + (96 << 8) | 0x40: "WEEKEVENTREG_96_40", + (96 << 8) | 0x80: "WEEKEVENTREG_96_80", + (97 << 8) | 0x01: "WEEKEVENTREG_97_01", + (97 << 8) | 0x02: "WEEKEVENTREG_97_02", + (97 << 8) | 0x04: "WEEKEVENTREG_97_04", + (97 << 8) | 0x08: "WEEKEVENTREG_97_08", + (97 << 8) | 0x10: "WEEKEVENTREG_97_10", + (97 << 8) | 0x20: "WEEKEVENTREG_97_20", + (97 << 8) | 0x40: "WEEKEVENTREG_97_40", + (97 << 8) | 0x80: "WEEKEVENTREG_97_80", + (98 << 8) | 0x01: "WEEKEVENTREG_98_01", + (98 << 8) | 0x02: "WEEKEVENTREG_98_02", + (98 << 8) | 0x04: "WEEKEVENTREG_98_04", + (98 << 8) | 0x08: "WEEKEVENTREG_98_08", + (98 << 8) | 0x10: "WEEKEVENTREG_98_10", + (98 << 8) | 0x20: "WEEKEVENTREG_98_20", + (98 << 8) | 0x40: "WEEKEVENTREG_98_40", + (98 << 8) | 0x80: "WEEKEVENTREG_98_80", + (99 << 8) | 0x01: "WEEKEVENTREG_99_01", + (99 << 8) | 0x02: "WEEKEVENTREG_99_02", + (99 << 8) | 0x04: "WEEKEVENTREG_99_04", + (99 << 8) | 0x08: "WEEKEVENTREG_99_08", + (99 << 8) | 0x10: "WEEKEVENTREG_99_10", + (99 << 8) | 0x20: "WEEKEVENTREG_99_20", + (99 << 8) | 0x40: "WEEKEVENTREG_99_40", + (99 << 8) | 0x80: "WEEKEVENTREG_99_80", +} + +def getFlagMacro(index: int, mask: int) -> str: + flag = (index << 8) | mask + if flag in weekEventReg: + return weekEventReg[flag] + return f"WEEKEVENTREG_{index:02}_{mask:02X}" + +def getCheckMacro(index: int, mask: int) -> str: + return f"CHECK_WEEKEVENTREG({getFlagMacro(index, mask)})" + +def getSetMacro(index: int, mask: int) -> str: + return f"SET_WEEKEVENTREG({getFlagMacro(index, mask)})" + +def getClearMacro(index: int, mask: int) -> str: + return f"CLEAR_WEEKEVENTREG({getFlagMacro(index, mask)})" + +NUMBER_PATTERN = r"(0[xX])?[0-9a-fA-F]+" + +def applyChange(fileContents: str, compiledRegex: re.Pattern, callback) -> str: + parsedContents = "" + + match = compiledRegex.search(fileContents) + while match: + index = int(match.group("index"), 0) + mask = int(match.group("mask"), 0) + + start, end = match.span() + parsedContents += fileContents[:start] + parsedContents += callback(index, mask) + + fileContents = fileContents[end:] + match = compiledRegex.search(fileContents) + + parsedContents += fileContents + return parsedContents + + +def updateCheck(fileContents: str) -> str: + # gSaveContext.save.weekEventReg[86] & 2 + checkRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&\s*(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, checkRegex, getCheckMacro) + +def updateSet(fileContents: str) -> str: + # gSaveContext.save.weekEventReg[51] |= 0x10 + setRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\|=\s*(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, setRegex, getSetMacro) + +def updateClear(fileContents: str) -> str: + # gSaveContext.save.weekEventReg[85] &= (u8)~0x80 + clearRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&=\s*(\(u8\))?~(?P{NUMBER_PATTERN})") + + return applyChange(fileContents, clearRegex, getClearMacro) + + +def read_file(filename): + with open(filename) as src_file: + return src_file.read() + +def write_file(filename, contents): + with open(filename, "w") as f: + f.write(contents) + + +def main(): + parser = argparse.ArgumentParser(description="Converts a weekEventReg access to a macro") + + parser.add_argument("filename", help="Replace every occurrence of numeric weekEventReg on this file to the corresponding macro") + args = parser.parse_args() + + fileContents = read_file(args.filename) + + parsedContents = updateCheck(fileContents) + parsedContents = updateSet(parsedContents) + parsedContents = updateClear(parsedContents) + + if fileContents != parsedContents: + write_file(args.filename, parsedContents) + +if __name__ == "__main__": + main()