diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2022-12-23 18:46:56 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-24 03:46:56 +0100 |
| commit | 4a9873775cfda32008cc1f66bd26310b3c2afdf3 (patch) | |
| tree | 5de59688279dcd8625800f1fd1577bd7638cda05 /src | |
| parent | 1c6878b070b6dcafaff89a843d6e508a09402a1b (diff) | |
TransitionFade docs and clean up other transitions (#1459)
* TransitionFade docs
* PR suggestions
* Fix
* Fill
* Other transitions + enums
* Prefix transition assests with trans
* Fix end_title
* format
* OutNames
* nitpicks PR
* cleaner
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_fbdemo_circle.c | 66 | ||||
| -rw-r--r-- | src/code/z_fbdemo_fade.c | 93 | ||||
| -rw-r--r-- | src/code/z_fbdemo_triforce.c | 38 | ||||
| -rw-r--r-- | src/code/z_fbdemo_wipe1.c | 63 | ||||
| -rw-r--r-- | src/code/z_play.c | 18 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 2 | ||||
| -rw-r--r-- | src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 2 |
7 files changed, 157 insertions, 125 deletions
diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 36460e918..72ee6e128 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,13 +1,18 @@ #include "global.h" +typedef enum { + /* 0 */ TRANS_CIRCLE_DIR_IN, + /* 1 */ TRANS_CIRCLE_DIR_OUT +} TransitionCircleDirection; + // unused -Gfx sCircleEmptyDList[] = { +Gfx sTransCircleEmptyDL[] = { gsSPEndDisplayList(), }; #include "assets/code/fbdemo_circle/z_fbdemo_circle.c" -Gfx sCircleDList[] = { +Gfx sTransCircleDL[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), @@ -20,7 +25,7 @@ Gfx sCircleDList[] = { gsDPLoadTextureBlock(0x08000000, G_IM_FMT_I, G_IM_SIZ_8b, 16, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(0x09000000), - gsSPVertex(sCircleWipeVtx, 32, 0), + gsSPVertex(sTransCircleVtx, 32, 0), gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0), gsSP2Triangles(3, 5, 6, 0, 5, 7, 8, 0), gsSP2Triangles(7, 9, 10, 0, 9, 11, 12, 0), @@ -29,7 +34,7 @@ Gfx sCircleDList[] = { gsSP2Triangles(19, 21, 22, 0, 21, 23, 24, 0), gsSP2Triangles(23, 25, 26, 0, 25, 27, 28, 0), gsSP1Triangle(27, 29, 30, 0), - gsSPVertex(&sCircleWipeVtx[31], 3, 0), + gsSPVertex(&sTransCircleVtx[31], 3, 0), gsSP1Triangle(0, 1, 2, 0), gsSPEndDisplayList(), }; @@ -43,12 +48,15 @@ void TransitionCircle_Start(void* thisx) { case TCA_WAVE: this->texture = sTransCircleWaveTex; break; + case TCA_RIPPLE: this->texture = sTransCircleRippleTex; break; + case TCA_STARBURST: this->texture = sTransCircleStarburstTex; break; + default: this->texture = sTransCircleNormalTex; break; @@ -71,20 +79,22 @@ void TransitionCircle_Start(void* thisx) { this->color.a = 255; } else { this->speed = 40; - this->color.rgba = this->appearanceType == TCA_WAVE ? RGBA8(0, 0, 0, 255) : RGBA8(160, 160, 160, 255); + this->color.rgba = (this->appearanceType == TCA_WAVE) ? RGBA8(0, 0, 0, 255) : RGBA8(160, 160, 160, 255); } - if (this->direction != 0) { - this->texY = (s32)(0.0 * (1 << 2)); + + if (this->direction != TRANS_CIRCLE_DIR_IN) { + this->texY = (s32)(0.0f * (1 << 2)); if (this->colorType == TCC_SPECIAL) { - this->texY = (s32)(62.5 * (1 << 2)); + this->texY = (s32)(62.5f * (1 << 2)); } } else { - this->texY = (s32)(125.0 * (1 << 2)); + this->texY = (s32)(125.0f * (1 << 2)); if (this->appearanceType == TCA_RIPPLE) { Audio_PlaySfxGeneral(NA_SE_OC_SECRET_WARP_OUT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } + guPerspective(&this->projection, &this->normal, 60.0f, (4.0f / 3.0f), 10.0f, 12800.0f, 1.0f); guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); } @@ -92,7 +102,7 @@ void TransitionCircle_Start(void* thisx) { void* TransitionCircle_Init(void* thisx) { TransitionCircle* this = (TransitionCircle*)thisx; - bzero(this, sizeof(*this)); + bzero(this, sizeof(TransitionCircle)); return this; } @@ -101,10 +111,8 @@ void TransitionCircle_Destroy(void* thisx) { void TransitionCircle_Update(void* thisx, s32 updateRate) { TransitionCircle* this = (TransitionCircle*)thisx; - s32 temp_t2; - s32 temp_t3; - if (this->direction != 0) { + if (this->direction != TRANS_CIRCLE_DIR_IN) { if (this->texY == 0) { if (this->appearanceType == TCA_RIPPLE) { Audio_PlaySfxGeneral(NA_SE_OC_SECRET_WARP_IN, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -112,20 +120,20 @@ void TransitionCircle_Update(void* thisx, s32 updateRate) { } } this->texY += this->speed * 3 / updateRate; - if (this->texY >= (s32)(125.0 * (1 << 2))) { - this->texY = (s32)(125.0 * (1 << 2)); + if (this->texY >= (s32)(125.0f * (1 << 2))) { + this->texY = (s32)(125.0f * (1 << 2)); this->isDone = true; } } else { this->texY -= this->speed * 3 / updateRate; if (this->colorType != TCC_SPECIAL) { - if (this->texY <= (s32)(0.0 * (1 << 2))) { - this->texY = (s32)(0.0 * (1 << 2)); + if (this->texY <= (s32)(0.0f * (1 << 2))) { + this->texY = (s32)(0.0f * (1 << 2)); this->isDone = true; } } else { - if (this->texY <= (s32)(62.5 * (1 << 2))) { - this->texY = (s32)(62.5 * (1 << 2)); + if (this->texY <= (s32)(62.5f * (1 << 2))) { + this->texY = (s32)(62.5f * (1 << 2)); this->isDone = true; } } @@ -169,7 +177,7 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) { guTranslate(&modelView[2], tPos, tPos, 0.0f); gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); } - gSPDisplayList(gfx++, sCircleDList); + gSPDisplayList(gfx++, sTransCircleDL); gDPPipeSync(gfx++); *gfxP = gfx; } @@ -186,15 +194,15 @@ void TransitionCircle_SetType(void* thisx, s32 type) { if (type & TC_SET_PARAMS) { // SetType is called twice for circles, the actual direction value will be set on the second call. // The direction set here will be overwritten on that second call. - this->direction = (type >> 5) & 0x1; + this->direction = (type >> 5) & 1; - this->colorType = (type >> 3) & 0x3; - this->speedType = type & 0x1; - this->appearanceType = (type >> 1) & 0x3; - } else if (type == 1) { - this->direction = 1; + this->colorType = (type >> 3) & 3; + this->speedType = type & 1; + this->appearanceType = (type >> 1) & 3; + } else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->direction = TRANS_CIRCLE_DIR_OUT; } else { - this->direction = 0; + this->direction = TRANS_CIRCLE_DIR_IN; } } @@ -204,8 +212,8 @@ void TransitionCircle_SetColor(void* thisx, u32 color) { this->color.rgba = color; } -void TransitionCircle_SetUnkColor(void* thisx, u32 unkColor) { +void TransitionCircle_SetUnkColor(void* thisx, u32 color) { TransitionCircle* this = (TransitionCircle*)thisx; - this->unkColor.rgba = unkColor; + this->unkColor.rgba = color; } diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 7d3481076..8769a5909 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,7 +1,18 @@ #include "global.h" #include "terminal.h" -static Gfx sRCPSetupFade[] = { +typedef enum { + /* 0 */ TRANS_FADE_DIR_IN, + /* 1 */ TRANS_FADE_DIR_OUT +} TransitionFadeDirection; + +typedef enum { + /* 0 */ TRANS_FADE_TYPE_NONE, + /* 1 */ TRANS_FADE_TYPE_ONE_WAY, + /* 2 */ TRANS_FADE_TYPE_FLASH +} TransitionFadeType; + +static Gfx sTransFadeSetupDL[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), @@ -15,15 +26,17 @@ static Gfx sRCPSetupFade[] = { void TransitionFade_Start(void* thisx) { TransitionFade* this = (TransitionFade*)thisx; - switch (this->fadeType) { - case 0: + switch (this->type) { + case TRANS_FADE_TYPE_NONE: break; - case 1: - this->fadeTimer = 0; - this->fadeColor.a = this->fadeDirection != 0 ? 0xFF : 0; + + case TRANS_FADE_TYPE_ONE_WAY: + this->timer = 0; + this->color.a = (this->direction != TRANS_FADE_DIR_IN) ? 255 : 0; break; - case 2: - this->fadeColor.a = 0; + + case TRANS_FADE_TYPE_FLASH: + this->color.a = 0; break; } this->isDone = false; @@ -32,7 +45,7 @@ void TransitionFade_Start(void* thisx) { void* TransitionFade_Init(void* thisx) { TransitionFade* this = (TransitionFade*)thisx; - bzero(this, sizeof(*this)); + bzero(this, sizeof(TransitionFade)); return this; } @@ -44,39 +57,41 @@ void TransitionFade_Update(void* thisx, s32 updateRate) { s16 newAlpha; TransitionFade* this = (TransitionFade*)thisx; - switch (this->fadeType) { - case 0: + switch (this->type) { + case TRANS_FADE_TYPE_NONE: break; - case 1: - this->fadeTimer += updateRate; - if (this->fadeTimer >= gSaveContext.transFadeDuration) { - this->fadeTimer = gSaveContext.transFadeDuration; + + case TRANS_FADE_TYPE_ONE_WAY: + this->timer += updateRate; + if (this->timer >= gSaveContext.transFadeDuration) { + this->timer = gSaveContext.transFadeDuration; this->isDone = true; } - if (!gSaveContext.transFadeDuration) { + if ((u32)gSaveContext.transFadeDuration == 0) { // "Divide by 0! Zero is included in ZCommonGet fade_speed" osSyncPrintf(VT_COL(RED, WHITE) "0除算! ZCommonGet fade_speed に0がはいってる" VT_RST); } - alpha = (255.0f * this->fadeTimer) / ((void)0, gSaveContext.transFadeDuration); - this->fadeColor.a = (this->fadeDirection != 0) ? 255 - alpha : alpha; + alpha = (255.0f * this->timer) / ((void)0, gSaveContext.transFadeDuration); + this->color.a = (this->direction != TRANS_FADE_DIR_IN) ? 255 - alpha : alpha; break; - case 2: - newAlpha = this->fadeColor.a; - if (iREG(50) != 0) { - if (iREG(50) < 0) { + + case TRANS_FADE_TYPE_FLASH: + newAlpha = this->color.a; + if (R_TRANS_FADE_FLASH_ALPHA_STEP != 0) { + if (R_TRANS_FADE_FLASH_ALPHA_STEP < 0) { if (Math_StepToS(&newAlpha, 255, 255)) { - iREG(50) = 150; + R_TRANS_FADE_FLASH_ALPHA_STEP = 150; } } else { - Math_StepToS(&iREG(50), 20, 60); - if (Math_StepToS(&newAlpha, 0, iREG(50))) { - iREG(50) = 0; + Math_StepToS(&R_TRANS_FADE_FLASH_ALPHA_STEP, 20, 60); + if (Math_StepToS(&newAlpha, 0, R_TRANS_FADE_FLASH_ALPHA_STEP)) { + R_TRANS_FADE_FLASH_ALPHA_STEP = 0; this->isDone = true; } } } - this->fadeColor.a = newAlpha; + this->color.a = newAlpha; break; } } @@ -84,11 +99,11 @@ void TransitionFade_Update(void* thisx, s32 updateRate) { void TransitionFade_Draw(void* thisx, Gfx** gfxP) { TransitionFade* this = (TransitionFade*)thisx; Gfx* gfx; - Color_RGBA8_u32* color = &this->fadeColor; + Color_RGBA8_u32* color = &this->color; if (color->a > 0) { gfx = *gfxP; - gSPDisplayList(gfx++, sRCPSetupFade); + gSPDisplayList(gfx++, sTransFadeSetupDL); gDPSetPrimColor(gfx++, 0, 0, color->r, color->g, color->b, color->a); gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, gScreenHeight - 1); gDPPipeSync(gfx++); @@ -105,21 +120,21 @@ s32 TransitionFade_IsDone(void* thisx) { void TransitionFade_SetColor(void* thisx, u32 color) { TransitionFade* this = (TransitionFade*)thisx; - this->fadeColor.rgba = color; + this->color.rgba = color; } void TransitionFade_SetType(void* thisx, s32 type) { TransitionFade* this = (TransitionFade*)thisx; - if (type == 1) { - this->fadeType = 1; - this->fadeDirection = 1; - } else if (type == 2) { - this->fadeType = 1; - this->fadeDirection = 0; - } else if (type == 3) { - this->fadeType = 2; + if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->type = TRANS_FADE_TYPE_ONE_WAY; + this->direction = TRANS_FADE_DIR_OUT; + } else if (type == TRANS_INSTANCE_TYPE_FILL_IN) { + this->type = TRANS_FADE_TYPE_ONE_WAY; + this->direction = TRANS_FADE_DIR_IN; + } else if (type == TRANS_INSTANCE_TYPE_FADE_FLASH) { + this->type = TRANS_FADE_TYPE_FLASH; } else { - this->fadeType = 0; + this->type = TRANS_FADE_TYPE_NONE; } } diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c index fe7068f26..19ce810f8 100644 --- a/src/code/z_fbdemo_triforce.c +++ b/src/code/z_fbdemo_triforce.c @@ -10,19 +10,23 @@ void TransitionTriforce_Start(void* thisx) { case 2: this->transPos = 1.0f; return; + + default: + this->transPos = 0.03f; + return; } - this->transPos = 0.03f; } void* TransitionTriforce_Init(void* thisx) { TransitionTriforce* this = (TransitionTriforce*)thisx; - bzero(this, sizeof(*this)); + bzero(this, sizeof(TransitionTriforce)); guOrtho(&this->projection, -160.0f, 160.0f, -120.0f, 120.0f, -1000.0f, 1000.0f, 1.0f); this->transPos = 1.0f; this->state = 2; this->step = 0.015f; - this->fadeDirection = 1; + this->type = TRANS_INSTANCE_TYPE_FILL_OUT; + return this; } @@ -31,7 +35,6 @@ void TransitionTriforce_Destroy(void* thisx) { void TransitionTriforce_Update(void* thisx, s32 updateRate) { TransitionTriforce* this = (TransitionTriforce*)thisx; - f32 temp_f0; s32 i; for (i = updateRate; i > 0; i--) { @@ -56,7 +59,7 @@ void TransitionTriforce_SetColor(void* thisx, u32 color) { void TransitionTriforce_SetType(void* thisx, s32 type) { TransitionTriforce* this = (TransitionTriforce*)thisx; - this->fadeDirection = type; + this->type = type; } // unused @@ -82,21 +85,23 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { guRotate(&modelView[1], rotation, 0.0f, 0.0f, 1.0f); guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f); gDPPipeSync(gfx++); - gSPDisplayList(gfx++, sTriforceWipeDL); + gSPDisplayList(gfx++, sTransTriforceDL); gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); gSPMatrix(gfx++, &this->projection, G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(gfx++, &modelView[0], G_MTX_LOAD); gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_MUL); gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_MUL); - gSPVertex(gfx++, sTriforceWipeVtx, 10, 0); + gSPVertex(gfx++, sTransTriforceVtx, 10, 0); + if (!TransitionTriforce_IsDone(this)) { - switch (this->fadeDirection) { - case 1: + switch (this->type) { + case TRANS_INSTANCE_TYPE_FILL_OUT: gSP2Triangles(gfx++, 0, 4, 5, 0, 4, 1, 3, 0); gSP1Triangle(gfx++, 5, 3, 2, 0); break; - case 2: + + case TRANS_INSTANCE_TYPE_FILL_IN: gSP2Triangles(gfx++, 3, 4, 5, 0, 0, 2, 6, 0); gSP2Triangles(gfx++, 0, 6, 7, 0, 1, 0, 7, 0); gSP2Triangles(gfx++, 1, 7, 8, 0, 1, 8, 9, 0); @@ -104,10 +109,11 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { break; } } else { - switch (this->fadeDirection) { - case 1: + switch (this->type) { + case TRANS_INSTANCE_TYPE_FILL_OUT: break; - case 2: + + case TRANS_INSTANCE_TYPE_FILL_IN: gSP1Quadrangle(gfx++, 6, 7, 8, 9, 0); break; } @@ -119,13 +125,11 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { s32 TransitionTriforce_IsDone(void* thisx) { TransitionTriforce* this = (TransitionTriforce*)thisx; - s32 ret = 0; - if (this->state == 1 || this->state == 2) { return this->transPos <= 0.03f; - } else if (this->state == 3 || this->state == 4) { return this->transPos >= 1.0f; + } else { + return false; } - return ret; } diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index 16b4fc2e4..aea2235e3 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -1,8 +1,13 @@ #include "global.h" +typedef enum { + /* 0 */ TRANS_WIPE_DIR_IN, + /* 1 */ TRANS_WIPE_DIR_OUT +} TransitionWipeDirection; + #include "assets/code/fbdemo_wipe1/z_fbdemo_wipe1.c" -Gfx sWipeDList[] = { +Gfx sTransWipeDL[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), @@ -13,14 +18,14 @@ Gfx sWipeDList[] = { gsDPSetCombineLERP(TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0), gsDPSetPrimDepth(0, 0), - gsDPLoadTextureBlock_4b(sWipe1Tex, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 6, 6, - 11, G_TX_NOLOD), - gsDPLoadMultiBlock_4b(sWipe1Tex, 0x0100, 1, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, + gsDPLoadTextureBlock_4b(sTransWipeTex, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 6, + 6, 11, G_TX_NOLOD), + gsDPLoadMultiBlock_4b(sTransWipeTex, 0x0100, 1, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 6, 6, 11, 1), gsDPSetTextureLUT(G_TT_NONE), gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), gsSPDisplayList(0x08000000), - gsSPVertex(sWipe1Vtx, 25, 0), + gsSPVertex(sTransWipeVtx, 25, 0), gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0), gsSP2Triangles(5, 6, 7, 0, 6, 8, 9, 0), gsSP2Triangles(8, 10, 11, 0, 10, 12, 13, 0), @@ -31,7 +36,7 @@ Gfx sWipeDList[] = { }; // unused. -Gfx sWipeSyncDList[] = { +Gfx sTransWipeSyncDL[] = { gsDPPipeSync(), gsSPEndDisplayList(), }; @@ -41,20 +46,20 @@ void TransitionWipe_Start(void* thisx) { this->isDone = false; - if (this->direction) { - this->texY = (s32)(83.25 * (1 << 2)); + if (this->direction != TRANS_WIPE_DIR_IN) { + this->texY = (s32)(83.25f * (1 << 2)); } else { - this->texY = (s32)(153.0 * (1 << 2)); + this->texY = (s32)(153.0f * (1 << 2)); } - guPerspective(&this->projection, &this->normal, 60.0f, 4.0 / 3.0f, 10.0f, 12800.0f, 1.0f); + guPerspective(&this->projection, &this->normal, 60.0f, (4.0f / 3.0f), 10.0f, 12800.0f, 1.0f); guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); } void* TransitionWipe_Init(void* thisx) { TransitionWipe* this = (TransitionWipe*)thisx; - bzero(this, sizeof(*this)); + bzero(this, sizeof(TransitionWipe)); return this; } @@ -64,16 +69,16 @@ void TransitionWipe_Destroy(void* thisx) { void TransitionWipe_Update(void* thisx, s32 updateRate) { TransitionWipe* this = (TransitionWipe*)thisx; - if (this->direction != 0) { + if (this->direction != TRANS_WIPE_DIR_IN) { this->texY += (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate; - if (this->texY >= (s32)(153.0 * (1 << 2))) { - this->texY = (s32)(153.0 * (1 << 2)); + if (this->texY >= (s32)(153.0f * (1 << 2))) { + this->texY = (s32)(153.0f * (1 << 2)); this->isDone = true; } } else { this->texY -= (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate; - if (this->texY <= (s32)(83.25 * (1 << 2))) { - this->texY = (s32)(83.25 * (1 << 2)); + if (this->texY <= (s32)(83.25f * (1 << 2))) { + this->texY = (s32)(83.25f * (1 << 2)); this->isDone = true; } } @@ -84,17 +89,17 @@ void TransitionWipe_Draw(void* thisx, Gfx** gfxP) { Mtx* modelView; TransitionWipe* this = (TransitionWipe*)thisx; s32 pad[4]; - Gfx* tex; + Gfx* texScroll; modelView = this->modelView[this->frame]; - this->frame ^= 1; + guScale(&modelView[0], 0.56f, 0.56f, 1.0f); guRotate(&modelView[1], 0.0f, 0.0f, 0.0f, 1.0f); guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f); gDPPipeSync(gfx++); - tex = Gfx_BranchTexScroll(&gfx, this->texX, this->texY, 0, 0); - gSPSegment(gfx++, 8, tex); + texScroll = Gfx_BranchTexScroll(&gfx, this->texX, this->texY, 0, 0); + gSPSegment(gfx++, 8, texScroll); gDPSetPrimColor(gfx++, 0, 0x80, this->color.r, this->color.g, this->color.b, 255); gSPMatrix(gfx++, &this->projection, G_MTX_LOAD | G_MTX_PROJECTION); gSPPerspNormalize(gfx++, this->normal); @@ -102,7 +107,7 @@ void TransitionWipe_Draw(void* thisx, Gfx** gfxP) { gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); - gSPDisplayList(gfx++, sWipeDList); + gSPDisplayList(gfx++, sTransWipeDL); gDPPipeSync(gfx++); *gfxP = gfx; } @@ -116,16 +121,16 @@ s32 TransitionWipe_IsDone(void* thisx) { void TransitionWipe_SetType(void* thisx, s32 type) { TransitionWipe* this = (TransitionWipe*)thisx; - if (type == 1) { - this->direction = 1; + if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->direction = TRANS_WIPE_DIR_OUT; } else { - this->direction = 0; + this->direction = TRANS_WIPE_DIR_IN; } - if (this->direction != 0) { - this->texY = (s32)(83.25 * (1 << 2)); + if (this->direction != TRANS_WIPE_DIR_IN) { + this->texY = (s32)(83.25f * (1 << 2)); } else { - this->texY = (s32)(153.0 * (1 << 2)); + this->texY = (s32)(153.0f * (1 << 2)); } } @@ -135,8 +140,8 @@ void TransitionWipe_SetColor(void* thisx, u32 color) { this->color.rgba = color; } -void TransitionWipe_SetEnvColor(void* thisx, u32 color) { +void TransitionWipe_SetUnkColor(void* thisx, u32 color) { TransitionWipe* this = (TransitionWipe*)thisx; - this->envColor.rgba = color; + this->unkColor.rgba = color; } diff --git a/src/code/z_play.c b/src/code/z_play.c index 9a3fb3204..8e0552497 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -198,7 +198,7 @@ void Play_Destroy(GameState* thisx) { } Letterbox_Destroy(); - TransitionFade_Destroy(&this->transitionFade); + TransitionFade_Destroy(&this->transitionFadeFlash); VisMono_Destroy(&D_80161498); if (gSaveContext.linkAge != this->linkAgeOnLoad) { @@ -386,10 +386,10 @@ void Play_Init(GameState* thisx) { } Letterbox_Init(); - TransitionFade_Init(&this->transitionFade); - TransitionFade_SetType(&this->transitionFade, 3); - TransitionFade_SetColor(&this->transitionFade, RGBA8(160, 160, 160, 255)); - TransitionFade_Start(&this->transitionFade); + TransitionFade_Init(&this->transitionFadeFlash); + TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH); + TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255)); + TransitionFade_Start(&this->transitionFadeFlash); VisMono_Init(&D_80161498); D_801614B0.a = 0; Flags_UnsetAllEnv(this); @@ -609,9 +609,9 @@ void Play_Update(PlayState* this) { } if (this->transitionTrigger == TRANS_TRIGGER_END) { - this->transitionCtx.setType(&this->transitionCtx.instanceData, 1); + this->transitionCtx.setType(&this->transitionCtx.instanceData, TRANS_INSTANCE_TYPE_FILL_OUT); } else { - this->transitionCtx.setType(&this->transitionCtx.instanceData, 2); + this->transitionCtx.setType(&this->transitionCtx.instanceData, TRANS_INSTANCE_TYPE_FILL_IN); } this->transitionCtx.start(&this->transitionCtx.instanceData); @@ -970,7 +970,7 @@ void Play_Update(PlayState* this) { Letterbox_Update(R_UPDATE_RATE); PLAY_LOG(3783); - TransitionFade_Update(&this->transitionFade, R_UPDATE_RATE); + TransitionFade_Update(&this->transitionFadeFlash, R_UPDATE_RATE); } else { goto skip; } @@ -1094,7 +1094,7 @@ void Play_Draw(PlayState* this) { this->transitionCtx.draw(&this->transitionCtx.instanceData, &gfxP); } - TransitionFade_Draw(&this->transitionFade, &gfxP); + TransitionFade_Draw(&this->transitionFadeFlash, &gfxP); if (D_801614B0.a > 0) { D_80161498.primColor.rgba = D_801614B0.rgba; diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 6ad51489c..7857935bb 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -270,7 +270,7 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { } if (this->actor.params == ARROW_NUT) { - iREG(50) = -1; + R_TRANS_FADE_FLASH_ALPHA_STEP = -1; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); sfxId = NA_SE_IT_DEKU; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index db2bbafe7..b6223aab2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -76,6 +76,6 @@ void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this) { if ((this->life == 6) && (this->rReg0 != 0)) { - iREG(50) = 0; + R_TRANS_FADE_FLASH_ALPHA_STEP = 0; } } |
