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 <hensley.derek58@gmail.com>

* Update src/overlays/actors/ovl_En_Baisen/z_en_baisen.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/overlays/actors/ovl_Boss_06/z_boss_06.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/overlays/actors/ovl_En_Raf/z_en_raf.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* review

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* new files

* format

* weekeventreg

* review

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* update

* format

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* 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 <hensley.derek58@gmail.com>
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
Anghelo Carvajal
2022-11-05 15:48:36 -03:00
committed by GitHub
co-authored by Derek Hensley EllipticEllipsis
parent baaa79b979
commit ba4368d0e8
191 changed files with 3964 additions and 1907 deletions
+1 -1
View File
@@ -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 {
+1007
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -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)
+3 -3
View File
@@ -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);
+5 -4
View File
@@ -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));
+12 -12
View File
@@ -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;
}
+1 -1
View File
@@ -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 &&
+1 -1
View File
@@ -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)) {
+4 -7
View File
@@ -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]]);
+25 -25
View File
@@ -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);
+4 -4
View File
@@ -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);
}
+126 -46
View File
@@ -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);
@@ -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);
}
}
@@ -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 {
@@ -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);
}
+21 -22
View File
@@ -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;
@@ -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 {
@@ -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;
}
@@ -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;
@@ -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);

Some files were not shown because too many files have changed in this diff Show More