1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-16 12:54:40 +00:00

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
This commit is contained in:
Derek Hensley 2022-12-23 18:46:56 -08:00 committed by GitHub
parent 1c6878b070
commit 4a9873775c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 186 additions and 146 deletions

View file

@ -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;
}