From e438ef0a970e5e9659825b7a2df50381d093d967 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 18 Sep 2023 17:35:59 +0100 Subject: [PATCH] SPR2_SIGL If you achieve a perfect race (OK hand for every lap) on Hard speed (or better), use a special taunting signpost frame. --- src/deh_tables.c | 1 + src/info.c | 6 ++++-- src/info.h | 3 ++- src/p_mobj.c | 23 ++++++++++++++++++++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index b36fa412c..7a730b6ce 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -367,6 +367,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_KART_SPINOUT", "S_KART_DEAD", "S_KART_SIGN", + "S_KART_SIGL", // technically the player goes here but it's an infinite tic state "S_OBJPLACE_DUMMY", diff --git a/src/info.c b/src/info.c index b1f696e79..0a311d369 100644 --- a/src/info.c +++ b/src/info.c @@ -916,7 +916,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "SPIN", // Spinout "DEAD", // Dead - "SIGN", // Finish signpost + "SIGN", "SIGL", // Finish signpost "XTRA", // Three Faces of Darkness "TALK", // Dialogue }; @@ -959,6 +959,7 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { 0, // SPR2_DEAD 0, // SPR2_SIGN + SPR2_SIGN, // SPR2_SIGL 0, // SPR2_XTRA 0, // SPR2_TALK }; @@ -1018,7 +1019,8 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_DRRI, 1, {NULL}, 0, 0, S_KART_DRIFT_R_IN}, // S_KART_DRIFT_R_IN {SPR_PLAY, SPR2_SPIN|FF_ANIMATE, 350, {NULL}, 0, 1, S_KART_STILL}, // S_KART_SPINOUT {SPR_PLAY, SPR2_DEAD, 3, {NULL}, 0, 0, S_KART_DEAD}, // S_KART_DEAD - {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_KART_SIGN}, // S_KART_SIGN + {SPR_PLAY, SPR2_SIGN|FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 0, 1, 0}, // S_KART_SIGN + {SPR_PLAY, SPR2_SIGL|FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 0, 1, 0}, // S_KART_SIGL {SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, // S_OBJPLACE_DUMMY diff --git a/src/info.h b/src/info.h index dc5257a08..1a4054638 100644 --- a/src/info.h +++ b/src/info.h @@ -1469,7 +1469,7 @@ typedef enum playersprite SPR2_DRRN, SPR2_DRRO, SPR2_DRRI, SPR2_SPIN, SPR2_DEAD, - SPR2_SIGN, + SPR2_SIGN, SPR2_SIGL, SPR2_XTRA, SPR2_TALK, @@ -1525,6 +1525,7 @@ typedef enum state S_KART_SPINOUT, S_KART_DEAD, S_KART_SIGN, + S_KART_SIGL, // technically the player goes here but it's an infinite tic state S_OBJPLACE_DUMMY, diff --git a/src/p_mobj.c b/src/p_mobj.c index b9afb6a69..35d3595bb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8731,6 +8731,23 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->angle += ANGLE_11hh; } + boolean newperfect = false; + if ( + (newplayer != NULL) + && (gametyperules & GTR_CIRCUIT) + && (gamespeed >= KARTSPEED_HARD) + && (K_TimeAttackRules() == false) + ) + { + UINT16 totalLaps = numlaps; + if (inDuel == false) + { + totalLaps *= 2; + } + + newperfect = (newplayer->lapPoints >= totalLaps); + } + mobj_t *cur = mobj->hnext; while (cur && !P_MobjWasRemoved(cur)) { @@ -8746,7 +8763,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) cur->frame = cur->state->frame + skincolors[newplayer->skincolor].invshade; } } - else if (cur->state == &states[S_KART_SIGN]) + else if (cur->state == &states[S_KART_SIGN] + || cur->state == &states[S_KART_SIGL]) { z += (5*mobj->scale); amt += 1; @@ -8755,6 +8773,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) { cur->skin = &skins[newplayer->skin]; cur->color = newplayer->skincolor; + // Even if we didn't have the Perfect Sign to consider, + // it's still necessary to refresh SPR2 on skin changes. + P_SetMobjState(cur, (newperfect == true) ? S_KART_SIGL : S_KART_SIGN); } } else if (cur->state == &states[S_SIGN_ERROR])