1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 03:14:38 +00:00

Document Transition System (#1131)

* transition type enum

* mode enum, start documenting some types

* some more

* use enums for entrance table

* entrance table filled out

* sceneLoadFlag -> transitionTrigger

* sandstorm state/mode/type

* done i think

* fixes

* clean up circle weirdness

* circle use enum + fix texture names

* fix

* how did that even happen lol

* jesus

* review2

* some more review

* most review, still some more to do

* new transition trigger names

* some of review

* next type default
This commit is contained in:
fig02 2022-04-27 16:00:25 -04:00 committed by GitHub
parent fed9ac3e20
commit 16790bc253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 2477 additions and 1382 deletions

View file

@ -10,7 +10,7 @@ s32 gTrnsnUnkState;
VisMono D_80161498;
Color_RGBA8_u32 D_801614B0;
FaultClient D_801614B8;
s16 D_801614C8;
s16 sTransitionFillTimer;
u64 D_801614D0[0xA00];
void func_800BC450(GlobalContext* globalCtx) {
@ -43,13 +43,14 @@ void func_800BC590(GlobalContext* globalCtx) {
}
}
void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
void Gameplay_SetupTransition(GlobalContext* globalCtx, s32 transitionType) {
TransitionContext* transitionCtx = &globalCtx->transitionCtx;
bzero(transitionCtx, sizeof(TransitionContext));
transitionCtx->transitionType = transitionType;
// circle types
if ((transitionCtx->transitionType >> 5) == 1) {
transitionCtx->init = TransitionCircle_Init;
transitionCtx->destroy = TransitionCircle_Destroy;
@ -62,7 +63,7 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
transitionCtx->setEnvColor = TransitionCircle_SetEnvColor;
} else {
switch (transitionCtx->transitionType) {
case 1:
case TRANS_TYPE_TRIFORCE:
transitionCtx->init = TransitionTriforce_Init;
transitionCtx->destroy = TransitionTriforce_Destroy;
transitionCtx->start = TransitionTriforce_Start;
@ -73,8 +74,9 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
transitionCtx->setColor = TransitionTriforce_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 0:
case 8:
case TRANS_TYPE_WIPE:
case TRANS_TYPE_WIPE_FAST:
transitionCtx->init = TransitionWipe_Init;
transitionCtx->destroy = TransitionWipe_Destroy;
transitionCtx->start = TransitionWipe_Start;
@ -85,16 +87,17 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
transitionCtx->setColor = TransitionWipe_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 13:
case 17:
case 18:
case 19:
case TRANS_TYPE_FADE_BLACK:
case TRANS_TYPE_FADE_WHITE:
case TRANS_TYPE_FADE_BLACK_FAST:
case TRANS_TYPE_FADE_WHITE_FAST:
case TRANS_TYPE_FADE_BLACK_SLOW:
case TRANS_TYPE_FADE_WHITE_SLOW:
case TRANS_TYPE_FADE_WHITE_CS_DELAYED:
case TRANS_TYPE_FADE_WHITE_INSTANT:
case TRANS_TYPE_FADE_GREEN:
case TRANS_TYPE_FADE_BLUE:
transitionCtx->init = TransitionFade_Init;
transitionCtx->destroy = TransitionFade_Destroy;
transitionCtx->start = TransitionFade_Start;
@ -105,25 +108,32 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
transitionCtx->setColor = TransitionFade_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 9:
case 10:
globalCtx->transitionMode = 4;
case TRANS_TYPE_FILL_WHITE2:
case TRANS_TYPE_FILL_WHITE:
globalCtx->transitionMode = TRANS_MODE_FILL_WHITE_INIT;
break;
case 11:
globalCtx->transitionMode = 10;
case TRANS_TYPE_INSTANT:
globalCtx->transitionMode = TRANS_MODE_INSTANT;
break;
case 12:
globalCtx->transitionMode = 7;
case TRANS_TYPE_FILL_BROWN:
globalCtx->transitionMode = TRANS_MODE_FILL_BROWN_INIT;
break;
case 14:
globalCtx->transitionMode = 12;
case TRANS_TYPE_SANDSTORM_PERSIST:
globalCtx->transitionMode = TRANS_MODE_SANDSTORM_INIT;
break;
case 15:
globalCtx->transitionMode = 14;
case TRANS_TYPE_SANDSTORM_END:
globalCtx->transitionMode = TRANS_MODE_SANDSTORM_END_INIT;
break;
case 16:
globalCtx->transitionMode = 16;
case TRANS_TYPE_CS_BLACK_FILL:
globalCtx->transitionMode = TRANS_MODE_CS_BLACK_FILL_INIT;
break;
default:
Fault_AddHungupAndCrash("../z_play.c", 2290);
break;
@ -159,10 +169,10 @@ void Gameplay_Destroy(GameState* thisx) {
gTrnsnUnkState = 0;
}
if (globalCtx->transitionMode == 3) {
if (globalCtx->transitionMode == TRANS_MODE_INSTANCE_RUNNING) {
globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx.data);
func_800BC88C(globalCtx);
globalCtx->transitionMode = 0;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
ShrinkWindow_Destroy();
@ -325,27 +335,28 @@ void Gameplay_Init(GameState* thisx) {
PreRender_SetValuesSave(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0);
PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
gTrnsnUnkState = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionMode = TRANS_MODE_OFF;
FrameAdvance_Init(&globalCtx->frameAdvCtx);
Rand_Seed((u32)osGetTime());
Matrix_Init(&globalCtx->state);
globalCtx->state.main = Gameplay_Main;
globalCtx->state.destroy = Gameplay_Destroy;
globalCtx->sceneLoadFlag = -0x14;
globalCtx->transitionTrigger = TRANS_TRIGGER_END;
globalCtx->unk_11E16 = 0xFF;
globalCtx->unk_11E18 = 0;
globalCtx->unk_11DE9 = false;
if (gSaveContext.gameMode != 1) {
if (gSaveContext.nextTransition == 0xFF) {
globalCtx->fadeTransition =
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field >> 7) & 0x7F; // Fade In
if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) {
// fade in
globalCtx->transitionType =
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field >> 7) & 0x7F;
} else {
globalCtx->fadeTransition = gSaveContext.nextTransition;
gSaveContext.nextTransition = 0xFF;
globalCtx->transitionType = gSaveContext.nextTransitionType;
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
}
} else {
globalCtx->fadeTransition = 6;
globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_SLOW;
}
ShrinkWindow_Init();
@ -443,8 +454,8 @@ void Gameplay_Update(GlobalContext* globalCtx) {
gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
if (FrameAdvance_Update(&globalCtx->frameAdvCtx, &input[1])) {
if ((globalCtx->transitionMode == 0) && (globalCtx->sceneLoadFlag != 0)) {
globalCtx->transitionMode = 1;
if ((globalCtx->transitionMode == TRANS_MODE_OFF) && (globalCtx->transitionTrigger != TRANS_TRIGGER_OFF)) {
globalCtx->transitionMode = TRANS_MODE_SETUP;
}
if (gTrnsnUnkState != 0) {
@ -467,19 +478,22 @@ void Gameplay_Update(GlobalContext* globalCtx) {
if (globalCtx->transitionMode) {
switch (globalCtx->transitionMode) {
case 1:
if (globalCtx->sceneLoadFlag != -0x14) {
s16 sp6E = 0;
case TRANS_MODE_SETUP:
if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
s16 sceneSetupIndex = 0;
Interface_ChangeAlpha(1);
if (gSaveContext.cutsceneIndex >= 0xFFF0) {
sp6E = (gSaveContext.cutsceneIndex & 0xF) + 4;
sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
}
if (!(gEntranceTable[globalCtx->nextEntranceIndex + sp6E].field & 0x8000)) { // Continue BGM Off
// fade out bgm if "continue bgm" flag is not set
if (!(gEntranceTable[globalCtx->nextEntranceIndex + sceneSetupIndex].field & 0x8000)) {
// "Sound initalized. 111"
osSyncPrintf("\n\n\nサウンドイニシャル来ました。111");
if ((globalCtx->fadeTransition < 56) && !Environment_IsForcedSequenceDisabled()) {
if ((globalCtx->transitionType < TRANS_TYPE_MAX) &&
!Environment_IsForcedSequenceDisabled()) {
// "Sound initalized. 222"
osSyncPrintf("\n\n\nサウンドイニシャル来ました。222");
func_800F6964(0x14);
@ -489,71 +503,80 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
}
if (CREG(11) == 0) {
func_800BC5E0(globalCtx, globalCtx->fadeTransition);
if (!R_TRANS_DBG_ENABLED) {
Gameplay_SetupTransition(globalCtx, globalCtx->transitionType);
} else {
func_800BC5E0(globalCtx, CREG(12));
Gameplay_SetupTransition(globalCtx, R_TRANS_DBG_TYPE);
}
if (globalCtx->transitionMode >= 4) {
if (globalCtx->transitionMode >= TRANS_MODE_FILL_WHITE_INIT) {
// non-instance modes break out of this switch
break;
}
case 2:
// fallthrough
case TRANS_MODE_INSTANCE_INIT:
globalCtx->transitionCtx.init(&globalCtx->transitionCtx.data);
// circle types
if ((globalCtx->transitionCtx.transitionType >> 5) == 1) {
globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data,
globalCtx->transitionCtx.transitionType | 0x80);
globalCtx->transitionCtx.transitionType | TC_SET_PARAMS);
}
gSaveContext.unk_1419 = 14;
if ((globalCtx->transitionCtx.transitionType == 8) ||
(globalCtx->transitionCtx.transitionType == 9)) {
gSaveContext.unk_1419 = 28;
gSaveContext.transWipeSpeed = 14;
if ((globalCtx->transitionCtx.transitionType == TRANS_TYPE_WIPE_FAST) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FILL_WHITE2)) {
//! @bug TRANS_TYPE_FILL_WHITE2 will never reach this code.
//! It is a non-instance type transition which doesn't run this case.
gSaveContext.transWipeSpeed = 28;
}
gSaveContext.fadeDuration = 60;
if ((globalCtx->transitionCtx.transitionType == 4) ||
(globalCtx->transitionCtx.transitionType == 5)) {
gSaveContext.fadeDuration = 20;
} else if ((globalCtx->transitionCtx.transitionType == 6) ||
(globalCtx->transitionCtx.transitionType == 7)) {
gSaveContext.fadeDuration = 150;
} else if (globalCtx->transitionCtx.transitionType == 17) {
gSaveContext.fadeDuration = 2;
gSaveContext.transFadeDuration = 60;
if ((globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_BLACK_FAST) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_FAST)) {
gSaveContext.transFadeDuration = 20;
} else if ((globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_BLACK_SLOW) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_SLOW)) {
gSaveContext.transFadeDuration = 150;
} else if (globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_INSTANT) {
gSaveContext.transFadeDuration = 2;
}
if ((globalCtx->transitionCtx.transitionType == 3) ||
(globalCtx->transitionCtx.transitionType == 5) ||
(globalCtx->transitionCtx.transitionType == 7) ||
(globalCtx->transitionCtx.transitionType == 13) ||
(globalCtx->transitionCtx.transitionType == 17)) {
if ((globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_FAST) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_SLOW) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) ||
(globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_INSTANT)) {
globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(160, 160, 160, 255));
if (globalCtx->transitionCtx.setEnvColor != NULL) {
globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data,
RGBA8(160, 160, 160, 255));
}
} else if (globalCtx->transitionCtx.transitionType == 18) {
} else if (globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_GREEN) {
globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(140, 140, 100, 255));
if (globalCtx->transitionCtx.setEnvColor != NULL) {
globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data,
RGBA8(140, 140, 100, 255));
}
} else if (globalCtx->transitionCtx.transitionType == 19) {
} else if (globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_BLUE) {
globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(70, 100, 110, 255));
if (globalCtx->transitionCtx.setEnvColor != NULL) {
globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data,
RGBA8(70, 100, 110, 255));
}
} else {
globalCtx->transitionCtx.setColor(&globalCtx->transitionCtx.data, RGBA8(0, 0, 0, 0));
if (globalCtx->transitionCtx.setEnvColor != NULL) {
globalCtx->transitionCtx.setEnvColor(&globalCtx->transitionCtx.data, RGBA8(0, 0, 0, 0));
}
}
if (globalCtx->sceneLoadFlag == -0x14) {
if (globalCtx->transitionTrigger == TRANS_TRIGGER_END) {
globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data, 1);
} else {
globalCtx->transitionCtx.setType(&globalCtx->transitionCtx.data, 2);
@ -561,26 +584,28 @@ void Gameplay_Update(GlobalContext* globalCtx) {
globalCtx->transitionCtx.start(&globalCtx->transitionCtx);
if (globalCtx->transitionCtx.transitionType == 13) {
globalCtx->transitionMode = 11;
if (globalCtx->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) {
globalCtx->transitionMode = TRANS_MODE_INSTANCE_WAIT;
} else {
globalCtx->transitionMode = 3;
globalCtx->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
}
break;
case 3:
if (globalCtx->transitionCtx.isDone(&globalCtx->transitionCtx) != 0) {
if (globalCtx->transitionCtx.transitionType >= 56) {
if (globalCtx->sceneLoadFlag == -0x14) {
case TRANS_MODE_INSTANCE_RUNNING:
if (globalCtx->transitionCtx.isDone(&globalCtx->transitionCtx)) {
if (globalCtx->transitionCtx.transitionType >= TRANS_TYPE_MAX) {
if (globalCtx->transitionTrigger == TRANS_TRIGGER_END) {
globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx);
func_800BC88C(globalCtx);
globalCtx->transitionMode = 0;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
} else if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->state.running = 0;
} else if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
globalCtx->state.running = false;
if (gSaveContext.gameMode != 2) {
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
gSaveContext.entranceIndex = globalCtx->nextEntranceIndex;
if (gSaveContext.minigameState == 1) {
gSaveContext.minigameState = 3;
}
@ -590,177 +615,186 @@ void Gameplay_Update(GlobalContext* globalCtx) {
} else {
globalCtx->transitionCtx.destroy(&globalCtx->transitionCtx);
func_800BC88C(globalCtx);
globalCtx->transitionMode = 0;
globalCtx->transitionMode = TRANS_MODE_OFF;
if (gTrnsnUnkState == 3) {
TransitionUnk_Destroy(&sTrnsnUnk);
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
}
}
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
} else {
globalCtx->transitionCtx.update(&globalCtx->transitionCtx.data, R_UPDATE_RATE);
}
break;
}
// update non-instance transitions
switch (globalCtx->transitionMode) {
case 4:
D_801614C8 = 0;
case TRANS_MODE_FILL_WHITE_INIT:
sTransitionFillTimer = 0;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 160;
globalCtx->envCtx.screenFillColor[1] = 160;
globalCtx->envCtx.screenFillColor[2] = 160;
if (globalCtx->sceneLoadFlag != -0x14) {
if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
globalCtx->envCtx.screenFillColor[3] = 0;
globalCtx->transitionMode = 5;
globalCtx->transitionMode = TRANS_MODE_FILL_IN;
} else {
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 6;
globalCtx->transitionMode = TRANS_MODE_FILL_OUT;
}
break;
case 5:
globalCtx->envCtx.screenFillColor[3] = (D_801614C8 / 20.0f) * 255.0f;
if (D_801614C8 >= 20 && 1) {
globalCtx->state.running = 0;
case TRANS_MODE_FILL_IN:
globalCtx->envCtx.screenFillColor[3] = (sTransitionFillTimer / 20.0f) * 255.0f;
if (sTransitionFillTimer >= 20) {
globalCtx->state.running = false;
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
gSaveContext.entranceIndex = globalCtx->nextEntranceIndex;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
} else {
D_801614C8++;
sTransitionFillTimer++;
}
break;
case 6:
globalCtx->envCtx.screenFillColor[3] = (1 - D_801614C8 / 20.0f) * 255.0f;
if (D_801614C8 >= 20 && 1) {
case TRANS_MODE_FILL_OUT:
globalCtx->envCtx.screenFillColor[3] = (1 - sTransitionFillTimer / 20.0f) * 255.0f;
if (sTransitionFillTimer >= 20) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
globalCtx->envCtx.fillScreen = false;
} else {
D_801614C8++;
sTransitionFillTimer++;
}
break;
case 7:
D_801614C8 = 0;
case TRANS_MODE_FILL_BROWN_INIT:
sTransitionFillTimer = 0;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 170;
globalCtx->envCtx.screenFillColor[1] = 160;
globalCtx->envCtx.screenFillColor[2] = 150;
if (globalCtx->sceneLoadFlag != -0x14) {
if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
globalCtx->envCtx.screenFillColor[3] = 0;
globalCtx->transitionMode = 5;
globalCtx->transitionMode = TRANS_MODE_FILL_IN;
} else {
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 6;
globalCtx->transitionMode = TRANS_MODE_FILL_OUT;
}
break;
case 10:
if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->state.running = 0;
case TRANS_MODE_INSTANT:
if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
globalCtx->state.running = false;
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
gSaveContext.entranceIndex = globalCtx->nextEntranceIndex;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
} else {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
break;
case 11:
if (gSaveContext.unk_1410 != 0) {
globalCtx->transitionMode = 3;
case TRANS_MODE_INSTANCE_WAIT:
if (gSaveContext.cutsceneTransitionControl != 0) {
globalCtx->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
}
break;
case 12:
if (globalCtx->sceneLoadFlag != -0x14) {
globalCtx->envCtx.sandstormState = 1;
globalCtx->transitionMode = 13;
case TRANS_MODE_SANDSTORM_INIT:
if (globalCtx->transitionTrigger != TRANS_TRIGGER_END) {
// trigger in, leaving area
globalCtx->envCtx.sandstormState = SANDSTORM_FILL;
globalCtx->transitionMode = TRANS_MODE_SANDSTORM;
} else {
globalCtx->envCtx.sandstormState = 2;
globalCtx->envCtx.sandstormState = SANDSTORM_UNFILL;
globalCtx->envCtx.sandstormPrimA = 255;
globalCtx->envCtx.sandstormEnvA = 255;
globalCtx->transitionMode = 13;
globalCtx->transitionMode = TRANS_MODE_SANDSTORM;
}
break;
case 13:
case TRANS_MODE_SANDSTORM:
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
if (globalCtx->sceneLoadFlag == -0x14) {
if (globalCtx->transitionTrigger == TRANS_TRIGGER_END) {
if (globalCtx->envCtx.sandstormPrimA < 110) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
} else {
if (globalCtx->envCtx.sandstormEnvA == 255) {
globalCtx->state.running = 0;
globalCtx->state.running = false;
SET_NEXT_GAMESTATE(&globalCtx->state, Gameplay_Init, GlobalContext);
gSaveContext.entranceIndex = globalCtx->nextEntranceIndex;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
}
break;
case 14:
if (globalCtx->sceneLoadFlag == -0x14) {
globalCtx->envCtx.sandstormState = 4;
case TRANS_MODE_SANDSTORM_END_INIT:
if (globalCtx->transitionTrigger == TRANS_TRIGGER_END) {
globalCtx->envCtx.sandstormState = SANDSTORM_DISSIPATE;
globalCtx->envCtx.sandstormPrimA = 255;
globalCtx->envCtx.sandstormEnvA = 255;
// "It's here!!!!!!!!!"
LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!", "../z_play.c", 3471);
globalCtx->transitionMode = 15;
globalCtx->transitionMode = TRANS_MODE_SANDSTORM_END;
} else {
globalCtx->transitionMode = 12;
globalCtx->transitionMode = TRANS_MODE_SANDSTORM_INIT;
}
break;
case 15:
case TRANS_MODE_SANDSTORM_END:
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
if (globalCtx->sceneLoadFlag == -0x14) {
if (globalCtx->transitionTrigger == TRANS_TRIGGER_END) {
if (globalCtx->envCtx.sandstormPrimA <= 0) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
}
break;
case 16:
D_801614C8 = 0;
case TRANS_MODE_CS_BLACK_FILL_INIT:
sTransitionFillTimer = 0;
globalCtx->envCtx.fillScreen = true;
globalCtx->envCtx.screenFillColor[0] = 0;
globalCtx->envCtx.screenFillColor[1] = 0;
globalCtx->envCtx.screenFillColor[2] = 0;
globalCtx->envCtx.screenFillColor[3] = 255;
globalCtx->transitionMode = 17;
globalCtx->transitionMode = TRANS_MODE_CS_BLACK_FILL;
break;
case 17:
if (gSaveContext.unk_1410 != 0) {
globalCtx->envCtx.screenFillColor[3] = gSaveContext.unk_1410;
if (gSaveContext.unk_1410 < 0x65) {
case TRANS_MODE_CS_BLACK_FILL:
if (gSaveContext.cutsceneTransitionControl != 0) {
globalCtx->envCtx.screenFillColor[3] = gSaveContext.cutsceneTransitionControl;
if (gSaveContext.cutsceneTransitionControl <= 100) {
gTrnsnUnkState = 0;
R_UPDATE_RATE = 3;
globalCtx->sceneLoadFlag = 0;
globalCtx->transitionMode = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_OFF;
globalCtx->transitionMode = TRANS_MODE_OFF;
}
}
break;
@ -1116,7 +1150,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
gfxP = Graph_GfxPlusOne(sp1CC);
gSPDisplayList(OVERLAY_DISP++, gfxP);
if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) ||
if ((globalCtx->transitionMode == TRANS_MODE_INSTANCE_RUNNING) ||
(globalCtx->transitionMode == TRANS_MODE_INSTANCE_WAIT) ||
(globalCtx->transitionCtx.transitionType >= 56)) {
View view;
@ -1271,7 +1306,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
}
if ((HREG(80) != 10) || (HREG(88) != 0)) {
if (globalCtx->envCtx.sandstormState != 0) {
if (globalCtx->envCtx.sandstormState != SANDSTORM_OFF) {
Environment_DrawSandstorm(globalCtx, globalCtx->envCtx.sandstormState);
}
}
@ -1756,14 +1791,14 @@ void Gameplay_TriggerVoidOut(GlobalContext* globalCtx) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = globalCtx->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = globalCtx->actorCtx.flags.tempCollect;
gSaveContext.respawnFlag = 1;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
globalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
globalCtx->fadeTransition = 2;
globalCtx->transitionType = TRANS_TYPE_FADE_BLACK;
}
void Gameplay_LoadToLastEntrance(GlobalContext* globalCtx) {
gSaveContext.respawnFlag = -1;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
if ((globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) ||
(globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO) || (globalCtx->sceneNum == SCENE_GANON_DEMO)) {
@ -1776,7 +1811,7 @@ void Gameplay_LoadToLastEntrance(GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = gSaveContext.entranceIndex;
}
globalCtx->fadeTransition = 2;
globalCtx->transitionType = TRANS_TYPE_FADE_BLACK;
}
void Gameplay_TriggerRespawn(GlobalContext* globalCtx) {