From bd317dbb9d961a229eac1e9505f9de669dc8e3e0 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Wed, 28 Dec 2022 13:29:59 -0800 Subject: [PATCH] Fbdemo Docs: `TransitionTile` (#1471) * TransitionTile' * Final clean up * PR * Header comment * vtx_tn * Name background DL * row <-> col * Rename update functions * Update header * Enum * Done -> Ready + cleanups * Update include/z64transition.h Co-authored-by: Dragorn421 Co-authored-by: Dragorn421 --- include/functions.h | 11 +- include/variables.h | 2 +- include/z64.h | 2 +- include/z64transition.h | 23 +- src/code/z_fbdemo.c | 208 ++++++++++-------- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_parameter.c | 2 +- src/code/z_play.c | 65 +++--- src/code/z_rcp.c | 2 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 2 +- 10 files changed, 178 insertions(+), 143 deletions(-) diff --git a/include/functions.h b/include/functions.h index 56d4eedcd5..e59a2a51a1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1208,13 +1208,10 @@ void func_800AD920(struct_80166500* this); void func_800AD950(struct_80166500* this); void func_800AD958(struct_80166500* this, Gfx** gfxp); void PlayerCall_InitFuncPtrs(void); -void TransitionUnk_InitGraphics(TransitionUnk* this); -void TransitionUnk_InitData(TransitionUnk* this); -void TransitionUnk_Destroy(TransitionUnk* this); -TransitionUnk* TransitionUnk_Init(TransitionUnk* this, s32 row, s32 col); -void TransitionUnk_SetData(TransitionUnk* this); -void TransitionUnk_Draw(TransitionUnk* this, Gfx**); -void func_800B23E8(TransitionUnk* this); +void TransitionTile_Destroy(TransitionTile* this); +TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows); +void TransitionTile_Draw(TransitionTile* this, Gfx** gfxP); +void TransitionTile_Update(TransitionTile* this); void TransitionTriforce_Start(void* thisx); void* TransitionTriforce_Init(void* thisx); void TransitionTriforce_Destroy(void* thisx); diff --git a/include/variables.h b/include/variables.h index cd14efb6a2..c0fcc8dc4f 100644 --- a/include/variables.h +++ b/include/variables.h @@ -183,7 +183,7 @@ extern LightningStrike gLightningStrike; extern MapData* gMapData; extern f32 gBossMarkScale; extern PauseMapMarksData* gLoadedPauseMarkDataTable; -extern s32 gTrnsnUnkState; +extern s32 gTransitionTileState; extern Color_RGBA8_u32 gVisMonoColor; extern PreNmiBuff* gAppNmiBufferPtr; extern Scheduler gScheduler; diff --git a/include/z64.h b/include/z64.h index 3d8a8a823f..e8922f88e1 100644 --- a/include/z64.h +++ b/include/z64.h @@ -663,7 +663,7 @@ typedef enum { /* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing. /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters. - /* 3 */ PAUSE_BG_PRERENDER_DONE, // The pause background is ready to be used. + /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used. /* 4 */ PAUSE_BG_PRERENDER_MAX } PauseBgPreRenderState; diff --git a/include/z64transition.h b/include/z64transition.h index e49ef1e660..34c3499b68 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -4,16 +4,23 @@ #include "ultra64.h" #include "color.h" -typedef struct { - f32 unk_0; - f32 unk_4; -} TransitionUnkData; +typedef enum { + /* 0 */ TRANS_TILE_OFF, // Inactive, do nothing + /* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers + /* 2 */ TRANS_TILE_PROCESS, // Initialize the transition + /* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame +} TransitionTileStatus; typedef struct { - /* 0x00 */ s32 row; - /* 0x04 */ s32 col; + /* 0x0 */ f32 x; + /* 0x4 */ f32 y; +} TransitionTileVtxData; // size = 0x8 + +typedef struct { + /* 0x00 */ s32 cols; + /* 0x04 */ s32 rows; /* 0x08 */ s32 frame; - /* 0x0C */ TransitionUnkData* unk_0C; + /* 0x0C */ TransitionTileVtxData* vtxData; /* 0x10 */ Vtx* vtxFrame1; /* 0x14 */ Vtx* vtxFrame2; /* 0x18 */ Mtx projection; @@ -21,7 +28,7 @@ typedef struct { /* 0x98 */ Mtx unk_98; /* 0xD8 */ Gfx* gfx; // "gfxtbl" /* 0xDC */ u16* zBuffer; -} TransitionUnk; // size = 0xE0 +} TransitionTile; // size = 0xE0 typedef enum { /* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1, diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index c15255fc2d..f1e36a396c 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -1,9 +1,24 @@ +/** + * @file z_fbdemo.c + * + * This file implements an unused transition system that takes the current screen, partitions it into large tiles, and + * can apply an effect to them. + * + * The screen is divided into 7 rows and 10 columns of tiles. (`gScreenWidth`/ 10 = `gScreenHeight` / 7 = 0x20) + * + * @note The only coded effect has a visual effect to blend the tiles to a single point, which looks like the screen + * gets sucked into. + */ #include "global.h" -Gfx D_8012AFB0[] = { +// color framebuffer +extern u16 D_0F000000[]; + +// Unused background; a blue rectangle with a grey border that fills the screen +Gfx sTransTileBackgroundDL[] = { gsDPPipeSync(), gsDPSetCycleType(G_CYC_FILL), - gsDPSetColorImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, 0x0F000000), + gsDPSetColorImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, D_0F000000), gsDPSetFillColor((GPACK_RGBA5551(65, 65, 65, 1) << 16) | GPACK_RGBA5551(65, 65, 65, 1)), gsDPFillRectangle(0, 0, 319, 239), gsDPPipeSync(), @@ -13,7 +28,7 @@ Gfx D_8012AFB0[] = { gsSPEndDisplayList(), }; -Gfx D_8012B000[] = { +Gfx sTransTileSetupDL[] = { gsDPPipeSync(), gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | @@ -25,18 +40,15 @@ Gfx D_8012B000[] = { gsSPEndDisplayList(), }; -void TransitionUnk_InitGraphics(TransitionUnk* this) { - s32 row2; - s32 pad2; - s32 pad3; - Vtx_t* vtx2; +void TransitionTile_InitGraphics(TransitionTile* this) { s32 frame; - s32 rowTex; - s32 row; - Gfx* gfx; - Vtx* vtx; s32 col; + s32 col2; s32 colTex; + Vtx* vtx; + s32 row; + s32 rowTex; + Gfx* gfx; guMtxIdent(&this->modelView); guMtxIdent(&this->unk_98); @@ -45,74 +57,84 @@ void TransitionUnk_InitGraphics(TransitionUnk* this) { for (frame = 0; frame < 2; frame++) { this->frame = frame; vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; - for (colTex = 0, col = 0; col < this->col + 1; colTex += 0x20, col++) { - for (rowTex = 0, row = 0; row < this->row + 1; row++) { - vtx2 = &vtx->v; - vtx++; + rowTex = 0; + for (row = 0; row < this->rows + 1; row++) { + colTex = 0; + for (col = 0; col < this->cols + 1; col++) { + Vtx_tn* vtxn = &vtx->n; - vtx2->tc[0] = rowTex << 6; - vtx2->ob[0] = row * 0x20; - vtx2->ob[1] = col * 0x20; - vtx2->ob[2] = -5; - vtx2->flag = 0; - vtx2->tc[1] = colTex << 6; - vtx2->cn[0] = 0; - vtx2->cn[1] = 0; - vtx2->cn[2] = 120; - vtx2->cn[3] = 255; - rowTex += 0x20; + vtx++; + vtxn->tc[0] = colTex << 6; + vtxn->ob[0] = col * 0x20; + vtxn->ob[1] = row * 0x20; + vtxn->ob[2] = -5; + vtxn->flag = 0; + vtxn->tc[1] = rowTex << 6; + vtxn->n[0] = 0; + vtxn->n[1] = 0; + vtxn->n[2] = 120; + vtxn->a = 255; + + colTex += 0x20; } + + rowTex += 0x20; } } gfx = this->gfx; - for (colTex = 0, col = 0; col < this->col; colTex += 0x20, col++) { + rowTex = 0; + for (row = 0; row < this->rows; row++) { + gSPVertex(gfx++, SEGMENT_ADDR(0xA, (u32)row * (this->cols + 1) * sizeof(Vtx)), 2 * (this->cols + 1), 0); - gSPVertex(gfx++, SEGMENT_ADDR(0xA, (u32)col * (this->row + 1) * sizeof(Vtx)), 2 * (this->row + 1), 0); - - for (rowTex = 0, row = 0, row2 = 0; row < this->row;) { + colTex = 0; + col2 = 0; + col = 0; + while (col < this->cols) { gDPPipeSync(gfx++); gDPLoadTextureTile(gfx++, SEGMENT_ADDR(0xB, 0), G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, SCREEN_HEIGHT, - rowTex, colTex, rowTex + 0x20, colTex + 0x20, 0, G_TX_NOMIRROR | G_TX_WRAP, + colTex, rowTex, colTex + 0x20, rowTex + 0x20, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(gfx++, row, row + 1, row2 + this->row + 2, this->row + row2 + 1, 0); + gSP1Quadrangle(gfx++, col, col + 1, col2 + this->cols + 2, this->cols + col2 + 1, 0); - rowTex += 0x20; - row2++; - row++; + colTex += 0x20; + col2++; + col++; } + + rowTex += 0x20; } gDPPipeSync(gfx++); gSPEndDisplayList(gfx++); - LOG_NUM("this->col * (1 + this->row * (1 + 7 + 1)) + 1 + 1", this->col * (1 + this->row * 9) + 2, "../z_fbdemo.c", + LOG_NUM("this->col * (1 + this->row * (1 + 7 + 1)) + 1 + 1", this->rows * (1 + this->cols * 9) + 2, "../z_fbdemo.c", 144); LOG_NUM("gp - this->gfxtbl", gfx - this->gfx, "../z_fbdemo.c", 145); } -void TransitionUnk_InitData(TransitionUnk* this) { - s32 col; +void TransitionTile_InitVtxData(TransitionTile* this) { s32 row; + s32 col; - for (col = 0; col < this->col + 1; col++) { - for (row = 0; row < this->row + 1; row++) { - (this->unk_0C + row + col * (this->row + 1))->unk_0 = row * 32; - (this->unk_0C + row + col * (this->row + 1))->unk_4 = col * 32; + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { + (this->vtxData + col + row * (this->cols + 1))->x = col * 0x20; + (this->vtxData + col + row * (this->cols + 1))->y = row * 0x20; } } } -void TransitionUnk_Destroy(TransitionUnk* this) { +void TransitionTile_Destroy(TransitionTile* this) { osSyncPrintf("fbdemo_cleanup(%08x)\n", this); osSyncPrintf("msleep(100);\n"); Sleep_Msec(100); - if (this->unk_0C != NULL) { - SystemArena_FreeDebug(this->unk_0C, "../z_fbdemo.c", 180); - this->unk_0C = NULL; + if (this->vtxData != NULL) { + SystemArena_FreeDebug(this->vtxData, "../z_fbdemo.c", 180); + this->vtxData = NULL; } if (this->vtxFrame1 != NULL) { SystemArena_FreeDebug(this->vtxFrame1, "../z_fbdemo.c", 181); @@ -128,22 +150,23 @@ void TransitionUnk_Destroy(TransitionUnk* this) { } } -TransitionUnk* TransitionUnk_Init(TransitionUnk* this, s32 row, s32 col) { - osSyncPrintf("fbdemo_init(%08x, %d, %d)\n", this, row, col); - bzero(this, sizeof(*this)); +TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows) { + osSyncPrintf("fbdemo_init(%08x, %d, %d)\n", this, cols, rows); + bzero(this, sizeof(TransitionTile)); this->frame = 0; - this->row = row; - this->col = col; - this->unk_0C = SystemArena_MallocDebug((row + 1) * sizeof(TransitionUnkData) * (col + 1), "../z_fbdemo.c", 195); - this->vtxFrame1 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1), "../z_fbdemo.c", 196); - this->vtxFrame2 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1), "../z_fbdemo.c", 197); - this->gfx = SystemArena_MallocDebug((this->col * (1 + this->row * 9) + 2) * sizeof(Gfx), "../z_fbdemo.c", 198); + this->cols = cols; + this->rows = rows; + this->vtxData = + SystemArena_MallocDebug((cols + 1) * sizeof(TransitionTileVtxData) * (rows + 1), "../z_fbdemo.c", 195); + this->vtxFrame1 = SystemArena_MallocDebug((cols + 1) * sizeof(Vtx) * (rows + 1), "../z_fbdemo.c", 196); + this->vtxFrame2 = SystemArena_MallocDebug((cols + 1) * sizeof(Vtx) * (rows + 1), "../z_fbdemo.c", 197); + this->gfx = SystemArena_MallocDebug((this->rows * (1 + this->cols * 9) + 2) * sizeof(Gfx), "../z_fbdemo.c", 198); - if (this->unk_0C == NULL || this->vtxFrame1 == NULL || this->vtxFrame2 == NULL || this->gfx == NULL) { + if ((this->vtxData == NULL) || (this->vtxFrame1 == NULL) || (this->vtxFrame2 == NULL) || (this->gfx == NULL)) { osSyncPrintf("fbdemo_init allocation error\n"); - if (this->unk_0C != NULL) { - SystemArena_FreeDebug(this->unk_0C, "../z_fbdemo.c", 202); - this->unk_0C = NULL; + if (this->vtxData != NULL) { + SystemArena_FreeDebug(this->vtxData, "../z_fbdemo.c", 202); + this->vtxData = NULL; } if (this->vtxFrame1 != NULL) { SystemArena_FreeDebug(this->vtxFrame1, "../z_fbdemo.c", 203); @@ -159,72 +182,75 @@ TransitionUnk* TransitionUnk_Init(TransitionUnk* this, s32 row, s32 col) { } return NULL; } - TransitionUnk_InitGraphics(this); - TransitionUnk_InitData(this); + + TransitionTile_InitGraphics(this); + TransitionTile_InitVtxData(this); this->frame = 0; return this; } -void TransitionUnk_SetData(TransitionUnk* this) { +void TransitionTile_SetVtx(TransitionTile* this) { + s32 row; s32 col; Vtx* vtx; - s32 row; - for (col = 0; col < this->col + 1; col++) { - for (row = 0; row < this->row + 1; row++) { + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; - (vtx + row + col * (this->row + 1))->v.ob[0] = (this->unk_0C + row + col * (this->row + 1))->unk_0; + (vtx + col + row * (this->cols + 1))->n.ob[0] = (this->vtxData + col + row * (this->cols + 1))->x; + vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; - (vtx + row + col * (this->row + 1))->v.ob[1] = (this->unk_0C + row + col * (this->row + 1))->unk_4; + (vtx + col + row * (this->cols + 1))->n.ob[1] = (this->vtxData + col + row * (this->cols + 1))->y; } } } -void TransitionUnk_Draw(TransitionUnk* this, Gfx** gfxP) { +void TransitionTile_Draw(TransitionTile* this, Gfx** gfxP) { Gfx* gfx = *gfxP; - gSPDisplayList(gfx++, D_8012B000); - TransitionUnk_SetData(this); + gSPDisplayList(gfx++, sTransTileSetupDL); + TransitionTile_SetVtx(this); gSPMatrix(gfx++, &this->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(gfx++, &this->modelView, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(gfx++, 0xA, this->frame == 0 ? this->vtxFrame1 : this->vtxFrame2); gSPSegment(gfx++, 0xB, this->zBuffer); - gSPDisplayList(gfx++, D_8012B000); + gSPDisplayList(gfx++, sTransTileSetupDL); gSPDisplayList(gfx++, this->gfx); gDPPipeSync(gfx++); this->frame ^= 1; *gfxP = gfx; } -void TransitionUnk_Update(TransitionUnk* this) { - f32 temp_f00; - f32 temp_f12; - s32 col; - f32 phi_f14; +/** + * Blends tiles which has the visual effect of sucking those tiles into a single point + */ +void TransitionTile_Suck(TransitionTile* this) { s32 row; + s32 col; + f32 diffX; + f32 diffY; + f32 scale; - for (col = 0; col < this->col + 1; col++) { - for (row = 0; row < this->row + 1; row++) { - temp_f00 = - (this->unk_0C + row + col * (this->row + 1))->unk_0 - (this->unk_0C + 5 + 4 * (this->row + 1))->unk_0; - temp_f12 = - (this->unk_0C + row + col * (this->row + 1))->unk_4 - (this->unk_0C + 5 + 4 * (this->row + 1))->unk_4; - phi_f14 = (SQ(temp_f00) + SQ(temp_f12)) / 100.0f; - if (phi_f14 != 0.0f) { - if (phi_f14 < 1.0f) { - phi_f14 = 1.0f; + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { + diffX = (this->vtxData + col + row * (this->cols + 1))->x - (this->vtxData + 5 + 4 * (this->cols + 1))->x; + diffY = (this->vtxData + col + row * (this->cols + 1))->y - (this->vtxData + 5 + 4 * (this->cols + 1))->y; + scale = (SQ(diffX) + SQ(diffY)) / 100.0f; + if (scale != 0.0f) { + if (scale < 1.0f) { + scale = 1.0f; } - (this->unk_0C + row + col * (this->row + 1))->unk_0 -= temp_f00 / phi_f14; - (this->unk_0C + row + col * (this->row + 1))->unk_4 -= temp_f12 / phi_f14; + (this->vtxData + col + row * (this->cols + 1))->x -= diffX / scale; + (this->vtxData + col + row * (this->cols + 1))->y -= diffY / scale; } } } } -void func_800B23E8(TransitionUnk* this) { +void TransitionTile_Update(TransitionTile* this) { } -s32 func_800B23F0(TransitionUnk* this) { +s32 func_800B23F0(TransitionTile* this) { return 0; } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index ced5b5203e..1f22ebdad5 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -76,7 +76,7 @@ void KaleidoScopeCall_Update(PlayState* play) { } else if ((pauseCtx->state == 2) || (pauseCtx->state == 9)) { osSyncPrintf("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_BG_PRERENDER_STATE); - if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_DONE) { + if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { pauseCtx->state++; } } else if (pauseCtx->state != 0) { @@ -118,7 +118,7 @@ void KaleidoScopeCall_Update(PlayState* play) { void KaleidoScopeCall_Draw(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_DONE) { + if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index e7c64cfe7b..00d16db9a9 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3239,7 +3239,7 @@ void Interface_Draw(PlayState* play) { Minimap_Draw(play); if ((R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) && - (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_DONE)) { + (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_READY)) { func_8002C124(&play->actorCtx.targetCtx, play); // Draw Z-Target } diff --git a/src/code/z_play.c b/src/code/z_play.c index 4168adf1bb..69d647fa2f 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -6,8 +6,8 @@ void* gDebugCutsceneScript = NULL; UNK_TYPE D_8012D1F4 = 0; // unused Input* D_8012D1F8 = NULL; -TransitionUnk sTrnsnUnk; -s32 gTrnsnUnkState; +TransitionTile sTransitionTile; +s32 gTransitionTileState; VisMono D_80161498; Color_RGBA8_u32 gVisMonoColor; FaultClient D_801614B8; @@ -186,9 +186,9 @@ void Play_Destroy(GameState* thisx) { EffectSs_ClearAll(this); CollisionCheck_DestroyContext(this, &this->colChkCtx); - if (gTrnsnUnkState == 3) { - TransitionUnk_Destroy(&sTrnsnUnk); - gTrnsnUnkState = 0; + if (gTransitionTileState == TRANS_TILE_READY) { + TransitionTile_Destroy(&sTransitionTile); + gTransitionTileState = TRANS_TILE_OFF; } if (this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) { @@ -361,7 +361,7 @@ void Play_Init(GameState* thisx) { PreRender_Init(&this->pauseBgPreRender); PreRender_SetValuesSave(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, NULL); PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL); - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; this->transitionMode = TRANS_MODE_OFF; FrameAdvance_Init(&this->frameAdvCtx); Rand_Seed((u32)osGetTime()); @@ -492,20 +492,24 @@ void Play_Update(PlayState* this) { this->transitionMode = TRANS_MODE_SETUP; } - if (gTrnsnUnkState != 0) { - switch (gTrnsnUnkState) { - case 2: - if (TransitionUnk_Init(&sTrnsnUnk, 10, 7) == NULL) { + if (gTransitionTileState != TRANS_TILE_OFF) { + switch (gTransitionTileState) { + case TRANS_TILE_PROCESS: + if (TransitionTile_Init(&sTransitionTile, 10, 7) == NULL) { osSyncPrintf("fbdemo_init呼出し失敗!\n"); // "fbdemo_init call failed!" - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; } else { - sTrnsnUnk.zBuffer = (u16*)gZBuffer; - gTrnsnUnkState = 3; + sTransitionTile.zBuffer = (u16*)gZBuffer; + gTransitionTileState = TRANS_TILE_READY; R_UPDATE_RATE = 1; } break; - case 3: - func_800B23E8(&sTrnsnUnk); + + case TRANS_TILE_READY: + TransitionTile_Update(&sTransitionTile); + break; + + default: break; } } @@ -652,9 +656,9 @@ void Play_Update(PlayState* this) { func_800BC88C(this); this->transitionMode = TRANS_MODE_OFF; - if (gTrnsnUnkState == 3) { - TransitionUnk_Destroy(&sTrnsnUnk); - gTrnsnUnkState = 0; + if (gTransitionTileState == TRANS_TILE_READY) { + TransitionTile_Destroy(&sTransitionTile); + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; } } @@ -702,7 +706,7 @@ void Play_Update(PlayState* this) { this->envCtx.screenFillColor[3] = (1 - sTransitionFillTimer / 20.0f) * 255.0f; if (sTransitionFillTimer >= 20) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -736,7 +740,7 @@ void Play_Update(PlayState* this) { this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; } else { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -767,7 +771,7 @@ void Play_Update(PlayState* this) { if (this->transitionTrigger == TRANS_TRIGGER_END) { if (this->envCtx.sandstormPrimA < 110) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -802,7 +806,7 @@ void Play_Update(PlayState* this) { if (this->transitionTrigger == TRANS_TRIGGER_END) { if (this->envCtx.sandstormPrimA <= 0) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -825,7 +829,7 @@ void Play_Update(PlayState* this) { this->envCtx.screenFillColor[3] = gSaveContext.cutsceneTransitionControl; if (gSaveContext.cutsceneTransitionControl <= 100) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; R_UPDATE_RATE = 3; this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -837,7 +841,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3533); - if (1 && (gTrnsnUnkState != 3)) { + if (1 && (gTransitionTileState != TRANS_TILE_READY)) { PLAY_LOG(3542); if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (this->msgCtx.msgMode == MSGMODE_NONE) && @@ -1109,10 +1113,10 @@ void Play_Draw(PlayState* this) { POLY_OPA_DISP = gfxP; } - if (gTrnsnUnkState == 3) { + if (gTransitionTileState == TRANS_TILE_READY) { Gfx* sp88 = POLY_OPA_DISP; - TransitionUnk_Draw(&sTrnsnUnk, &sp88); + TransitionTile_Draw(&sTransitionTile, &sp88); POLY_OPA_DISP = sp88; goto Play_Draw_DrawOverlayElements; } else { @@ -1126,12 +1130,12 @@ void Play_Draw(PlayState* this) { PreRender_ApplyFilters(&this->pauseBgPreRender); - R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_DONE; + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_READY; } else if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_MAX) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF; } - if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) { + if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) { Gfx* gfxP = POLY_OPA_DISP; PreRender_RestoreFramebuffer(&this->pauseBgPreRender, &gfxP); @@ -1247,7 +1251,8 @@ void Play_Draw(PlayState* this) { DebugDisplay_DrawObjects(this); } - if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || (gTrnsnUnkState == 1)) { + if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || + (gTransitionTileState == TRANS_TILE_SETUP)) { Gfx* gfxP = OVERLAY_DISP; // Copy the frame buffer contents at this point in the display list to the zbuffer @@ -1261,7 +1266,7 @@ void Play_Draw(PlayState* this) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_PROCESS; } else { - gTrnsnUnkState = 2; + gTransitionTileState = TRANS_TILE_PROCESS; } OVERLAY_DISP = gfxP; this->unk_121C7 = 2; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 7b93284593..aa4d56998e 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1469,7 +1469,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { gDPSetDepthImage(POLY_XLU_DISP++, gZBuffer); gDPSetDepthImage(OVERLAY_DISP++, gZBuffer); - if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTrnsnUnkState < 2)) { + if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { s32 letterboxSize = Letterbox_GetSize(); if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 95b16ae33d..05b29ef639 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2500,7 +2500,7 @@ void KaleidoScope_Update(PlayState* play) { s16 stepA; s32 pad; - if ((R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_DONE) && + if ((R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) && (((pauseCtx->state >= 4) && (pauseCtx->state <= 7)) || ((pauseCtx->state >= 0xA) && (pauseCtx->state <= 0x12)))) {