1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +00:00

z_demo retail code matched (#1655)

* match all functions

* format

* clarify between 'dest' and 'skip' debug features

* format

* better match for CutsceneHandler_RunScript

* review

* format

* remove macro
This commit is contained in:
fig02 2024-01-30 18:52:04 -05:00 committed by GitHub
parent af6b821193
commit 8be8848f85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 26 deletions

View File

@ -438,7 +438,7 @@ typedef enum {
#define EVENTCHKINF_4C 0x4C
#define EVENTCHKINF_4D 0x4D
#define EVENTCHKINF_4E 0x4E
#define EVENTCHKINF_4F 0x4F
#define EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS 0x4F // Cutscene in Temple of Time as adult after pulling the Master Sword for the first time
#define EVENTCHKINF_50 0x50
#define EVENTCHKINF_51 0x51
#define EVENTCHKINF_52 0x52

View File

@ -130,6 +130,7 @@ s16 sQuakeIndex;
void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx);
#if OOT_DEBUG
void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) {
GfxPrint printer;
s32 pad[2];
@ -149,6 +150,7 @@ void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx
*dlist = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer);
}
#endif
void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) {
csCtx->state = CS_STATE_IDLE;
@ -173,6 +175,8 @@ void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) {
}
void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
#if OOT_DEBUG
{
Input* input = &play->state.input[0];
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) {
@ -187,6 +191,8 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
gSaveContext.save.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
}
}
#endif
if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) {
gSaveContext.cutsceneTrigger = 0;
@ -562,7 +568,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
}
if ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped ||
((csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) &&
(OOT_DEBUG && (csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) &&
(gSaveContext.fileNum != 0xFEDC))) {
csCtx->state = CS_STATE_RUN_UNSTOPPABLE;
Audio_SetCutsceneFlag(0);
@ -717,7 +723,9 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
break;
case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION:
SET_EVENTCHKINF(EVENTCHKINF_4F);
#if OOT_DEBUG
SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS);
#endif
play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK;
@ -886,7 +894,9 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
break;
case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT:
SET_EVENTCHKINF(EVENTCHKINF_4F);
#if OOT_DEBUG
SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS);
#endif
play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
@ -941,8 +951,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
break;
case CS_DEST_GERUDO_VALLEY_CREDITS:
#if OOT_DEBUG
gSaveContext.gameMode = GAMEMODE_END_CREDITS;
Audio_SetSfxBanksMute(0x6F);
#endif
play->linkAgeOnLoad = LINK_AGE_CHILD;
play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0;
gSaveContext.save.cutsceneIndex = 0xFFF2;
@ -1779,10 +1791,12 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script)
return;
}
#if OOT_DEBUG
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) {
csCtx->state = CS_STATE_STOP;
return;
}
#endif
for (i = 0; i < totalEntries; i++) {
MemCpy(&cmdType, script, sizeof(cmdType));
@ -2189,15 +2203,11 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script)
}
void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) {
if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {
if (OOT_DEBUG && BREG(0) != 0) {
Gfx* displayList;
Gfx* prevDisplayList;
if (0) {} // Necessary to match
if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {
if (0) {} // Also necessary to match
if (BREG(0) != 0) {
OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101);
prevDisplayList = POLY_OPA_DISP;
@ -2210,10 +2220,9 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) {
CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108);
}
csCtx->curFrame++;
if (R_USE_DEBUG_CUTSCENE) {
if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) {
Cutscene_ProcessScript(play, csCtx, gDebugCutsceneScript);
} else {
Cutscene_ProcessScript(play, csCtx, play->csCtx.script);

View File

@ -93,9 +93,9 @@ void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) {
}
void func_808BAF40(BgTokiSwd* this, PlayState* play) {
if (!GET_EVENTCHKINF(EVENTCHKINF_4F) && !IS_CUTSCENE_LAYER &&
if (!GET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS) && !IS_CUTSCENE_LAYER &&
Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(play)) {
SET_EVENTCHKINF(EVENTCHKINF_4F);
SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS);
play->csCtx.script = D_808BBD90;
gSaveContext.cutsceneTrigger = 1;
}