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
parent baaa79b979
commit ba4368d0e8
191 changed files with 3964 additions and 1907 deletions
+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);