Define changes for transitions, two bug fixes (#739)

* Fixed one or two bugs, cleaned up a few things, put every non vanilla styled change into POLISHED_TRANSITIONS

And renamed set_and_reset_transition_fade_timer

* Undid the renaming of set_and_reset_transition_fade_timer as suggested
This commit is contained in:
Lilaa3
2023-12-29 23:32:19 +00:00
committed by GitHub
parent 7df16608a7
commit 08f0e3efa4
5 changed files with 13 additions and 23 deletions

View File

@@ -141,9 +141,10 @@
#define DEFAULT_CULLING_RADIUS 300
/**
* Eases the textured screen transitions to make them look smoother.
* Eases the textured screen transitions to make them look smoother.
* Extends the full radius for mario, bowser and the star transitions.
*/
#define EASE_IN_OUT_TRANSITIONS
// #define POLISHED_TRANSITIONS
/**
* Uses frustratio of 2 instead of 1.

View File

@@ -331,11 +331,13 @@ void play_transition(s16 transType, s16 time, Color red, Color green, Color blue
red = gWarpTransRed, green = gWarpTransGreen, blue = gWarpTransBlue;
}
if (transType < WARP_TRANSITION_TYPE_STAR) { // if transition is WARP_TRANSITION_TYPE_COLOR
if (transType & WARP_TRANSITION_TYPE_COLOR) {
gWarpTransition.data.red = red;
gWarpTransition.data.green = green;
gWarpTransition.data.blue = blue;
} else { // if transition is textured
set_and_reset_transition_fade_timer(0); // Reset transition timers by passing in 0 for time
gWarpTransition.data.red = red;
gWarpTransition.data.green = green;
gWarpTransition.data.blue = blue;
@@ -353,8 +355,7 @@ void play_transition(s16 transType, s16 time, Color red, Color green, Color blue
s16 fullRadius = GFX_DIMENSIONS_FULL_RADIUS;
// HackerSM64: this fixes the pop-in with texture transition, comment out this switch
// statement if you want to restore the original full radius.
#ifdef POLISHED_TRANSITIONS
switch (transType){
case WARP_TRANSITION_TYPE_BOWSER:
case WARP_TRANSITION_FADE_INTO_BOWSER:
@@ -369,6 +370,7 @@ void play_transition(s16 transType, s16 time, Color red, Color green, Color blue
fullRadius *= 1.5f;
break;
}
#endif
if (transType & WARP_TRANSITION_FADE_INTO) { // Is the image fading in?
gWarpTransition.data.startTexRadius = fullRadius;

View File

@@ -382,10 +382,8 @@ void init_mario_after_warp(void) {
sDelayedWarpOp = WARP_OP_NONE;
switch (marioSpawnType) {
case MARIO_SPAWN_PIPE:
play_transition(WARP_TRANSITION_FADE_FROM_STAR, 0x10, 0x00, 0x00, 0x00);
break;
case MARIO_SPAWN_DOOR_WARP:
case MARIO_SPAWN_SPIN_AIRBORNE_CIRCLE:
play_transition(WARP_TRANSITION_FADE_FROM_CIRCLE, 0x10, 0x00, 0x00, 0x00);
break;
case MARIO_SPAWN_TELEPORT:
@@ -394,9 +392,6 @@ void init_mario_after_warp(void) {
case MARIO_SPAWN_SPIN_AIRBORNE:
play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 0x1A, 0xFF, 0xFF, 0xFF);
break;
case MARIO_SPAWN_SPIN_AIRBORNE_CIRCLE:
play_transition(WARP_TRANSITION_FADE_FROM_CIRCLE, 0x10, 0x00, 0x00, 0x00);
break;
case MARIO_SPAWN_FADE_FROM_BLACK:
play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 0x10, 0x00, 0x00, 0x00);
break;

View File

@@ -81,10 +81,10 @@ void make_tex_transition_vertices(Vtx *verts, f32 centerTransX, f32 centerTransY
make_tex_transition_vertex(verts, 7, centerTransX, centerTransY, -SOLID_COL_RADIUS, SOLID_COL_RADIUS, 0, 0);
}
f32 calc_tex_transition_radius(s8 transTime, struct WarpTransitionData *transData) {
f32 calc_tex_transition_radius(u8 transTime, struct WarpTransitionData *transData) {
f32 amount = (f32) sTransitionFadeTimer / (f32) (transTime - 1);
#ifdef EASE_IN_OUT_TRANSITIONS
#ifdef POLISHED_TRANSITIONS
return smoothstep(transData->startTexRadius, transData->endTexRadius, amount);
#else
return lerpf(transData->startTexRadius, transData->endTexRadius, amount);
@@ -128,7 +128,7 @@ u16 calc_tex_transition_direction(struct WarpTransitionData *transData) {
* Called during render_screen_transition.
* Handles shape transitions (such as the star, circle and Mario and bowser´s heads).
*/
s32 render_textured_transition(s8 transTime, struct WarpTransitionData *transData, s8 texID, s8 transTexType) {
s32 render_textured_transition(u8 transTime, struct WarpTransitionData *transData, s8 texID, s8 transTexType) {
u16 texTransDir = calc_tex_transition_direction(transData);
f32 posDistance = calc_tex_transition_pos_distance(transTime, transData);
@@ -138,7 +138,6 @@ s32 render_textured_transition(s8 transTime, struct WarpTransitionData *transDat
f32 texTransRadius = calc_tex_transition_radius(transTime, transData);
Vtx *verts = alloc_display_list(8 * sizeof(Vtx));
if (verts != NULL) {
make_tex_transition_vertices(verts, centerTransX, centerTransY, texTransRadius, transTexType);
gSPDisplayList(gDisplayListHead++, dl_proj_mtx_fullscreen);
@@ -253,29 +252,21 @@ s32 render_screen_transition(s8 transType, u8 transTime, struct WarpTransitionDa
break;
case WARP_TRANSITION_FADE_FROM_STAR:
return render_textured_transition(transTime, transData, TEX_TRANS_STAR, TRANS_TYPE_MIRROR);
break;
case WARP_TRANSITION_FADE_INTO_STAR:
return render_textured_transition(transTime, transData, TEX_TRANS_STAR, TRANS_TYPE_MIRROR);
break;
case WARP_TRANSITION_FADE_FROM_CIRCLE:
return render_textured_transition(transTime, transData, TEX_TRANS_CIRCLE, TRANS_TYPE_MIRROR);
break;
case WARP_TRANSITION_FADE_INTO_CIRCLE:
return render_textured_transition(transTime, transData, TEX_TRANS_CIRCLE, TRANS_TYPE_MIRROR);
break;
case WARP_TRANSITION_FADE_FROM_MARIO:
return render_textured_transition(transTime, transData, TEX_TRANS_MARIO, TRANS_TYPE_CLAMP);
break;
case WARP_TRANSITION_FADE_INTO_MARIO:
return render_textured_transition(transTime, transData, TEX_TRANS_MARIO, TRANS_TYPE_CLAMP);
break;
case WARP_TRANSITION_FADE_FROM_BOWSER:
return render_textured_transition(transTime, transData, TEX_TRANS_BOWSER, TRANS_TYPE_MIRROR);
break;
case WARP_TRANSITION_FADE_INTO_BOWSER:
return render_textured_transition(transTime, transData, TEX_TRANS_BOWSER, TRANS_TYPE_MIRROR);
break;

View File

@@ -24,6 +24,7 @@ enum ColorTransitionFade {
COLOR_TRANS_FADE_FROM_COLOR,
};
s32 set_and_reset_transition_fade_timer(u8 transTime);
s32 render_screen_transition(s8 transType, u8 transTime, struct WarpTransitionData *transData);
Gfx *geo_cannon_circle_base(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx);