From 5ff1817c34a50e2ac4d09af3bfac577fb780d745 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 23 Oct 2018 20:53:05 -0400 Subject: [PATCH 01/23] Divide sound volume by number of local players --- src/s_sound.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index d87b6106..91d85746 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -530,6 +530,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Initialize sound parameters pitch = NORM_PITCH; priority = NORM_PRIORITY; + volume /= (splitscreen+1); if (splitscreen && listenmobj2) // Copy the sound for the split player { @@ -1007,7 +1008,7 @@ void S_UpdateSounds(void) if (I_SoundIsPlaying(c->handle)) { // initialize parameters - volume = 255; // 8 bits internal volume precision + volume = 255/(splitscreen+1); // 8 bits internal volume precision pitch = NORM_PITCH; sep = NORM_SEP; @@ -1325,6 +1326,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; } + *vol /= (splitscreen+1); + return (*vol > 0); } From 146c8b228b6ec98cda3b4f3a8f8f1e15517cee64 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 25 Oct 2018 22:53:58 -0400 Subject: [PATCH 02/23] - Reduce volume reduction - Don't apply to sounds without an origin mobj --- src/s_sound.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 91d85746..8f2e4a35 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -530,7 +530,9 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Initialize sound parameters pitch = NORM_PITCH; priority = NORM_PRIORITY; - volume /= (splitscreen+1); + + if (origin) + volume = FixedDiv(volume<>FRACBITS; if (splitscreen && listenmobj2) // Copy the sound for the split player { @@ -1008,10 +1010,13 @@ void S_UpdateSounds(void) if (I_SoundIsPlaying(c->handle)) { // initialize parameters - volume = 255/(splitscreen+1); // 8 bits internal volume precision + volume = 255; // 8 bits internal volume precision pitch = NORM_PITCH; sep = NORM_SEP; + if (c->origin) + volume = FixedDiv(volume<>FRACBITS; + // check non-local sounds for distance clipping // or modify their params if (c->origin && ((c->origin != players[consoleplayer].mo) @@ -1326,7 +1331,7 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; } - *vol /= (splitscreen+1); + *vol = FixedDiv((*vol)<>FRACBITS; return (*vol > 0); } From 555fbbe2f5d7d26e82e663f86db72780811630a7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 26 Oct 2018 00:51:58 -0400 Subject: [PATCH 03/23] Speed up spinout based on timer left --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 0f89f826..3b7410a5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6657,7 +6657,7 @@ static void P_MovePlayer(player_t *player) if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); - player->frameangle -= ANGLE_22h; + player->frameangle -= (ANGLE_11hh * min(8, player->kartstuff[k_spinouttimer]/8)); } else if (player->powers[pw_nocontrol] && player->pflags & PF_SKIDDOWN) { From 27f118a06c7974a4a77d156d682c3c44903f18dc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 26 Oct 2018 00:55:20 -0400 Subject: [PATCH 04/23] Adjust spinout times to face your forward about 90% of the time --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 76670f17..33c954b2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1849,7 +1849,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem if (player->kartstuff[k_spinouttype] <= 0) { - player->kartstuff[k_spinouttimer] = 3*TICRATE/2; // Banana Spinout + player->kartstuff[k_spinouttimer] = (3*TICRATE/2)+2; // Banana Spinout // At spinout, player speed is increased to 1/4 their regular speed, moving them forward if (player->speed < K_GetKartSpeed(player, true)/4) @@ -1858,7 +1858,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem S_StartSound(player->mo, sfx_slip); } else - player->kartstuff[k_spinouttimer] = TICRATE+20; // Wipeout + player->kartstuff[k_spinouttimer] = TICRATE+27; // Wipeout player->powers[pw_flashing] = K_GetKartFlashing(player); @@ -2032,7 +2032,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b if (inflictor && inflictor->type == MT_SPBEXPLOSION && inflictor->extravalue1) { - player->kartstuff[k_spinouttimer] = (3*player->kartstuff[k_spinouttimer])/2; + player->kartstuff[k_spinouttimer] = ((3*player->kartstuff[k_spinouttimer])/2)+1; player->mo->momz *= 2; } From 240d7a44c1482ffa3f3c76fd7d8fa2bb692e3782 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 26 Oct 2018 00:56:02 -0400 Subject: [PATCH 05/23] CRITICAL BUGFIX Make sure flashing tics don't go down WHILE you're in a hit animation (wipeout, squished) --- src/k_kart.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 33c954b2..bb9ac47b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3956,6 +3956,18 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->kartstuff[k_timeovercam] = 0; + // Make ABSOLUTELY SURE that your flashing tics don't get set WHILE you're still in hit animations. + if (player->kartstuff[k_spinouttimer] != 0 + || player->kartstuff[k_wipeoutslow] != 0 + || player->kartstuff[k_squishedtimer] != 0) + { + player->powers[pw_flashing] = K_GetKartFlashing(player); + } + else if (player->powers[pw_flashing] == K_GetKartFlashing(player)) + { + player->powers[pw_flashing]--; + } + if (player->kartstuff[k_spinouttimer]) { if ((P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype] == 1) @@ -3983,9 +3995,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } } - if (player->kartstuff[k_spinouttimer] == 0 && player->powers[pw_flashing] == K_GetKartFlashing(player)) - player->powers[pw_flashing]--; - /*if (player->kartstuff[k_thunderanim]) player->kartstuff[k_thunderanim]--;*/ From 6dd7718d6e091e35c9035f7eba15b2ffe2eebe2a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 26 Oct 2018 01:07:14 -0400 Subject: [PATCH 06/23] More consistent face-forward Needs it to still land in a close ballpark, so the timer changes are still needed, but this makes it less prone to error --- src/p_user.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 3b7410a5..ac4847e7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6654,10 +6654,15 @@ static void P_MovePlayer(player_t *player) } else if (player->kartstuff[k_spinouttimer] > 0 || player->pflags & PF_SLIDING) { + INT32 speed = max(1, min(8, player->kartstuff[k_spinouttimer]/8)); + if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); - player->frameangle -= (ANGLE_11hh * min(8, player->kartstuff[k_spinouttimer]/8)); + if (speed == 1 && abs(player->mo->angle - player->frameangle) < ANGLE_22h) + player->frameangle = player->mo->angle; // Face forward at the end of the animation + else + player->frameangle -= (ANGLE_11hh * speed); } else if (player->powers[pw_nocontrol] && player->pflags & PF_SKIDDOWN) { From 8058b7774334a186217ea32bf817efc761bcb3d2 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 26 Oct 2018 01:07:54 -0400 Subject: [PATCH 07/23] Combine spinout & wipeout timers Turns out they were only 1 tic apart originally, sooo --- src/k_kart.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index bb9ac47b..35044002 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1847,19 +1847,15 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem player->kartstuff[k_spinouttype] = type; - if (player->kartstuff[k_spinouttype] <= 0) + if (player->kartstuff[k_spinouttype] <= 0) // type 0 is spinout, type 1 is wipeout { - player->kartstuff[k_spinouttimer] = (3*TICRATE/2)+2; // Banana Spinout - // At spinout, player speed is increased to 1/4 their regular speed, moving them forward if (player->speed < K_GetKartSpeed(player, true)/4) P_InstaThrust(player->mo, player->mo->angle, FixedMul(K_GetKartSpeed(player, true)/4, player->mo->scale)); - S_StartSound(player->mo, sfx_slip); } - else - player->kartstuff[k_spinouttimer] = TICRATE+27; // Wipeout + player->kartstuff[k_spinouttimer] = (3*TICRATE/2)+2; player->powers[pw_flashing] = K_GetKartFlashing(player); if (player->mo->state != &states[S_KART_SPIN]) From 3d760271e369decb2c6561ac68e3d794fb04c6b4 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 27 Oct 2018 21:41:45 +0100 Subject: [PATCH 08/23] Fix the issue with sliding I identified this morning. Also, apply it to being in a zoom tube, too! For extra forwards compatibility with all the terrible SRB2 Riders ports that are almost an inevitability. --- src/p_user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index ac4847e7..ef214e4f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6652,7 +6652,13 @@ static void P_MovePlayer(player_t *player) if (player->mo->state != &states[S_KART_SQUISH]) P_SetPlayerMobjState(player->mo, S_KART_SQUISH); } - else if (player->kartstuff[k_spinouttimer] > 0 || player->pflags & PF_SLIDING) + else if ((player->pflags & PF_SLIDING) || (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT)) + { + if (player->mo->state != &states[S_KART_SPIN]) + P_SetPlayerMobjState(player->mo, S_KART_SPIN); + player->frameangle -= ANGLE_22h; + } + else if (player->kartstuff[k_spinouttimer] > 0) { INT32 speed = max(1, min(8, player->kartstuff[k_spinouttimer]/8)); From e8410b2575e1752549dae3efbddf7d9240972841 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 27 Oct 2018 22:05:15 +0100 Subject: [PATCH 09/23] Fix and then subsequently disable the zoom tube angle setting stuff. --- src/p_user.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ef214e4f..42833e96 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6652,7 +6652,7 @@ static void P_MovePlayer(player_t *player) if (player->mo->state != &states[S_KART_SQUISH]) P_SetPlayerMobjState(player->mo, S_KART_SQUISH); } - else if ((player->pflags & PF_SLIDING) || (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT)) + else if (player->pflags & PF_SLIDING) { if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); @@ -7346,7 +7346,7 @@ static void P_DoZoomTube(player_t *player) fixed_t dist; boolean reverse; - player->mo->height = P_GetPlayerSpinHeight(player); + //player->mo->height = P_GetPlayerSpinHeight(player); if (player->speed > 0) reverse = false; @@ -7451,6 +7451,11 @@ static void P_DoZoomTube(player_t *player) else if (player == &players[fourthdisplayplayer]) localangle4 = player->mo->angle; } +#if 0 + if (player->mo->state != &states[S_KART_SPIN]) + P_SetPlayerMobjState(player->mo, S_KART_SPIN); + player->frameangle -= ANGLE_22h; +#endif } // From 339a857cba4d599980ca12f8bb3fb1549e534e40 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 27 Oct 2018 20:44:05 -0400 Subject: [PATCH 10/23] Reduce camspeed in splitscreen --- src/p_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 0f89f826..1b7c71ef 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8250,6 +8250,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (mo->eflags & MFE_VERTICALFLIP) camheight += thiscam->height; + if (splitscreen == 1) + camspeed = (3*camspeed)/4; + if (timeover) angle = mo->angle + FixedAngle(camrotate*FRACUNIT); else if (leveltime < starttime) From f1f8f91aea7cc88a2b5ba9310cc3baad772e7dbe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 27 Oct 2018 20:56:11 -0400 Subject: [PATCH 11/23] Higher default scale, WANTED indicator scales properly --- src/p_mobj.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5de7e246..f4fd40c9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6798,7 +6798,7 @@ void P_MobjThinker(mobj_t *mobj) && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD /*&& players[displayplayer].mo && !players[displayplayer].spectator*/) { - fixed_t scale = mobj->target->scale; + fixed_t scale = 4*mobj->target->scale; mobj->color = mobj->target->color; K_MatchGenericExtraFlags(mobj, mobj->target); @@ -6993,7 +6993,7 @@ void P_MobjThinker(mobj_t *mobj) && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD && players[displayplayer].mo && !players[displayplayer].spectator) { - fixed_t scale = mobj->target->scale; + fixed_t scale = 4*mobj->target->scale; if (!K_IsPlayerWanted(mobj->target->player)) { @@ -7023,10 +7023,13 @@ void P_MobjThinker(mobj_t *mobj) } P_SetThingPosition(mobj); - scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, - players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); - if (scale > 16*FRACUNIT) - scale = 16*FRACUNIT; + if (!splitscreen) + { + scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, + players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); + if (scale > 16*FRACUNIT) + scale = 16*FRACUNIT; + } mobj->destscale = scale; } else if (mobj->health > 0) From dc5a738f7fb47cb4150b13323b3ce77afc7ac363 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 27 Oct 2018 21:45:04 -0400 Subject: [PATCH 12/23] "if !splitscreen" instances that SHOULD be "if netgame" --- src/hu_stuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4210b70e..225ef234 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2293,9 +2293,9 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (players[tab[i].num].spectator || !players[tab[i].num].mo) continue; //ignore them. - if (!splitscreen) // don't draw it on splitscreen, + if (netgame) // don't draw it offline { - if (!(tab[i].num == serverplayer)) + if (tab[i].num != serverplayer) HU_drawPing(x+ 253, y+2, playerpingtable[tab[i].num], false); } @@ -2783,7 +2783,7 @@ static void HU_DrawRankings(void) HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/ // draw spectators in a ticker across the bottom - if (!splitscreen && G_GametypeHasSpectators()) + if (netgame && G_GametypeHasSpectators()) HU_DrawSpectatorTicker(); } From d0a50ae24708fbcd2b60b7d7176745d410a7a560 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 27 Oct 2018 21:48:50 -0400 Subject: [PATCH 13/23] This bothers me, so I might as well do it while I'm in here. --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 225ef234..b28793b7 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2609,7 +2609,7 @@ static inline void HU_DrawSpectatorTicker(void) templength = length; } - V_DrawString(templength, height + 8, V_TRANSLUCENT, current); + V_DrawString(templength, height + 8, V_TRANSLUCENT|V_ALLOWLOWERCASE, current); } length += (signed)strlen(player_names[i]) * 8 + 16; From e9515294e8eb79653683db124633e487330fa7fc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 27 Oct 2018 22:43:57 -0400 Subject: [PATCH 14/23] Show LOSE/COOL in splitscreen again Looked goofy offline, with 1 WIN and 3 LOSEs, but now that there's COOL and online splitscreen I thought it should come back --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 76670f17..faff611d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7013,7 +7013,7 @@ static void K_drawBattleFullscreen(void) { if (stplyr->kartstuff[k_position] == 1) V_DrawFixedPatch(x< Date: Sat, 27 Oct 2018 23:14:11 -0400 Subject: [PATCH 15/23] No more rescaling gfx for countdown/finish --- src/k_kart.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index faff611d..58e679c8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5501,8 +5501,8 @@ static patch_t *kp_karmasticker; static patch_t *kp_splitkarmabomb; static patch_t *kp_timeoutsticker; -static patch_t *kp_startcountdown[8]; -static patch_t *kp_racefinish[2]; +static patch_t *kp_startcountdown[16]; +static patch_t *kp_racefinish[6]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; static patch_t *kp_winnernum[NUMPOSFRAMES]; @@ -5589,9 +5589,25 @@ void K_LoadKartHUDGraphics(void) kp_startcountdown[5] = W_CachePatchName("K_CNT2B", PU_HUDGFX); kp_startcountdown[6] = W_CachePatchName("K_CNT1B", PU_HUDGFX); kp_startcountdown[7] = W_CachePatchName("K_CNTGOB", PU_HUDGFX); + // Splitscreen + kp_startcountdown[8] = W_CachePatchName("K_SMC3A", PU_HUDGFX); + kp_startcountdown[9] = W_CachePatchName("K_SMC2A", PU_HUDGFX); + kp_startcountdown[10] = W_CachePatchName("K_SMC1A", PU_HUDGFX); + kp_startcountdown[11] = W_CachePatchName("K_SMCGOA", PU_HUDGFX); + kp_startcountdown[12] = W_CachePatchName("K_SMC3B", PU_HUDGFX); + kp_startcountdown[13] = W_CachePatchName("K_SMC2B", PU_HUDGFX); + kp_startcountdown[14] = W_CachePatchName("K_SMC1B", PU_HUDGFX); + kp_startcountdown[15] = W_CachePatchName("K_SMCGOB", PU_HUDGFX); + // Finish kp_racefinish[0] = W_CachePatchName("K_FINA", PU_HUDGFX); kp_racefinish[1] = W_CachePatchName("K_FINB", PU_HUDGFX); + // Splitscreen + kp_racefinish[2] = W_CachePatchName("K_SMFINA", PU_HUDGFX); + kp_racefinish[3] = W_CachePatchName("K_SMFINB", PU_HUDGFX); + // 2P splitscreen + kp_racefinish[4] = W_CachePatchName("K_2PFINA", PU_HUDGFX); + kp_racefinish[5] = W_CachePatchName("K_2PFINB", PU_HUDGFX); // Position numbers sprintf(buffer, "K_POSNxx"); @@ -6924,11 +6940,10 @@ static void K_drawKartStartCountdown(void) pnum++; if ((leveltime % (2*5)) / 5) // blink pnum += 4; + if (splitscreen) // splitscreen + pnum += 8; - if (splitscreen) - V_DrawSmallScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/4), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/4), splitflags, kp_startcountdown[pnum]); - else - V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); + V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); } static void K_drawKartFinish(void) @@ -6941,12 +6956,14 @@ static void K_drawKartFinish(void) if ((stplyr->kartstuff[k_cardanimation] % (2*5)) / 5) // blink pnum = 1; - if (splitscreen > 1) - { - V_DrawTinyScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/8), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/8), splitflags, kp_racefinish[pnum]); - return; - } + if (splitscreen > 1) // small splitscreen + pnum += 2; + else if (splitscreen == 1) // wide splitscreen + pnum += 4; + if (splitscreen > 1) // Stationary FIN + V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]); + else // Scrolling FINISH { INT32 scaleshift = (FRACBITS - splitscreen); // FRACUNIT or FRACUNIT/2 INT32 x = ((vid.width<width)< Date: Sun, 28 Oct 2018 00:58:49 -0400 Subject: [PATCH 16/23] Fix up respawning so that it takes respawning with Shrink into account --- src/k_kart.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 76670f17..a72e1f1b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1362,8 +1362,8 @@ void K_RespawnChecker(player_t *player) fixed_t newx, newy, newz; newangle = FixedAngle(((360/8)*i)*FRACUNIT); - newx = player->mo->x + P_ReturnThrustX(player->mo, newangle, 31*player->mo->scale); - newy = player->mo->y + P_ReturnThrustY(player->mo, newangle, 31*player->mo->scale); + newx = player->mo->x + P_ReturnThrustX(player->mo, newangle, 31<mo->y + P_ReturnThrustY(player->mo, newangle, 31<mo->eflags & MFE_VERTICALFLIP) newz = player->mo->z + player->mo->height; else @@ -1383,11 +1383,19 @@ void K_RespawnChecker(player_t *player) } else if (player->kartstuff[k_respawn] == 1) { - if (!P_IsObjectOnGround(player->mo)) + if (player->kartstuff[k_growshrinktimer] < 0) + { + player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE; + player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8; + if (cv_kartdebugshrink.value && !player->bot) + player->mo->destscale = 6*player->mo->destscale/8; + } + + if (!P_IsObjectOnGround(player->mo) && !mapreset) { player->powers[pw_flashing] = 2; - // Sal: That's stupid and prone to accidental usage. + // Sal: The old behavior was stupid and prone to accidental usage. // Let's rip off Mania instead, and turn this into a Drop Dash! if (cmd->buttons & BT_ACCELERATE) @@ -3879,7 +3887,12 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) fast->momz = 3*player->mo->momz/4; } - if (player->kartstuff[k_eggmanexplode]) // You're gonna diiiiie + if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here + { + player->mo->colorized = false; + player->mo->color = player->skincolor; + } + else if (player->kartstuff[k_eggmanexplode]) // You're gonna diiiiie { const INT32 flashtime = 4<<(player->kartstuff[k_eggmanexplode]/TICRATE); if (player->kartstuff[k_eggmanexplode] == 1 || (player->kartstuff[k_eggmanexplode] % (flashtime/2) != 0)) @@ -4008,11 +4021,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_invincibilitytimer]) player->kartstuff[k_invincibilitytimer]--; - if (player->kartstuff[k_growshrinktimer] > 0) - player->kartstuff[k_growshrinktimer]--; - - if (player->kartstuff[k_growshrinktimer] < 0) - player->kartstuff[k_growshrinktimer]++; + if (!player->kartstuff[k_respawn]) + { + if (player->kartstuff[k_growshrinktimer] > 0) + player->kartstuff[k_growshrinktimer]--; + if (player->kartstuff[k_growshrinktimer] < 0) + player->kartstuff[k_growshrinktimer]++; + } if (player->kartstuff[k_growshrinktimer] == 1 || player->kartstuff[k_growshrinktimer] == -1) { From 93e989cf617dded1c8b0efb7f46931c6288939d7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 01:02:30 -0400 Subject: [PATCH 17/23] Fix invincibility item cap It was supposed to be capped at 2 invincibility items at a time, not 3. (may consider scaling with number of players, just not for R1) --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index a72e1f1b..c67a06bf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -666,7 +666,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) break; case KITEM_INVINCIBILITY: POWERITEMODDS(newodds); - if ((!cv_invincibility.value) || (pinvin > 2)) newodds = 0; + if ((!cv_invincibility.value) || (pinvin >= 2)) newodds = 0; break; case KITEM_BANANA: if (!cv_banana.value) newodds = 0; From b6d8c3ea7d5a05ed836d1e14e030bc4b85337baf Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 01:02:49 -0400 Subject: [PATCH 18/23] This didn't commit with for some reason... --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index c67a06bf..fc46c347 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -700,7 +700,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) break; case KITEM_GROW: POWERITEMODDS(newodds); - if ((!cv_grow.value) || (pinvin > 2)) newodds = 0; + if ((!cv_grow.value) || (pinvin >= 2)) newodds = 0; break; case KITEM_SHRINK: POWERITEMODDS(newodds); From 67a8ee178db3eb4a243f8072daa6875696c26ff0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 01:22:26 -0400 Subject: [PATCH 19/23] More smoothly decide which invincibility music to use Less P_RestoreMusic conflicts in splitscreen, just see the Toxic Palace video for an example :V --- src/p_user.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1b7c71ef..fe1dad0e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1217,6 +1217,8 @@ void P_RestoreMusic(player_t *player) if (!P_IsLocalPlayer(player)) // Only applies to a local player return; + S_SpeedMusic(1.0f); + // Event - HERE COMES A NEW CHALLENGER if (mapreset) { @@ -1228,24 +1230,47 @@ void P_RestoreMusic(player_t *player) if (P_EndingMusic(player)) return; - S_SpeedMusic(1.0f); - // Event - Level Start if (leveltime < (starttime + (TICRATE/2))) S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); else // see also where time overs are handled - search for "lives = 2" in this file { + INT32 bestlocalmus = 0; // 0 is level music, 1 is invincibility, 2 is grow + + if (splitscreen) + { + if (players[displayplayer].playerstate == PST_LIVE) + bestlocalmus = (players[displayplayer].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[displayplayer].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); +#define setbests(p) \ + if (players[p].playerstate == PST_LIVE && (players[p].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[p].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)) > bestlocalmus) \ + bestlocalmus = (players[p].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[p].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); + setbests(secondarydisplayplayer); + if (splitscreen > 1) + setbests(thirddisplayplayer); + if (splitscreen > 2) + setbests(fourthdisplayplayer); +#undef setbests + } + else + { + if (player->playerstate == PST_LIVE) + bestlocalmus = (player->kartstuff[k_growshrinktimer] > 1 ? 2 : (player->kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); + } + // Item - Grow - if (player->kartstuff[k_growshrinktimer] > 1 && player->playerstate == PST_LIVE) + if (bestlocalmus == 2) S_ChangeMusicInternal("kgrow", true); // Item - Invincibility - else if (player->kartstuff[k_invincibilitytimer] > 1 && player->playerstate == PST_LIVE) + else if (bestlocalmus == 1) S_ChangeMusicInternal("kinvnc", true); else { +#if 0 // Event - Final Lap + // Still works for GME, but disabled for consistency if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) S_SpeedMusic(1.2f); +#endif S_ChangeMusic(mapmusname, mapmusflags, true); } } From 84c9dbfcce3e05b1013d257a38c09d4bc1b7f778 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 01:38:01 -0400 Subject: [PATCH 20/23] Even better: base it off how much timer is left So instead of prioritizing a specific track, the person who activated their powerup the latest gets their music. That should be a nicer solution for when multiple players are activating their powerups at the same time. --- src/p_user.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index fe1dad0e..2c580643 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1235,15 +1235,21 @@ void P_RestoreMusic(player_t *player) S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); else // see also where time overs are handled - search for "lives = 2" in this file { - INT32 bestlocalmus = 0; // 0 is level music, 1 is invincibility, 2 is grow + INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow if (splitscreen) { - if (players[displayplayer].playerstate == PST_LIVE) - bestlocalmus = (players[displayplayer].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[displayplayer].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); + INT32 bestlocaltimer = 1; + #define setbests(p) \ - if (players[p].playerstate == PST_LIVE && (players[p].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[p].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)) > bestlocalmus) \ - bestlocalmus = (players[p].kartstuff[k_growshrinktimer] > 1 ? 2 : (players[p].kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); + if (players[p].playerstate == PST_LIVE) \ + { \ + if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ + { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ + else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ + { wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \ + } + setbests(displayplayer); setbests(secondarydisplayplayer); if (splitscreen > 1) setbests(thirddisplayplayer); @@ -1254,14 +1260,19 @@ void P_RestoreMusic(player_t *player) else { if (player->playerstate == PST_LIVE) - bestlocalmus = (player->kartstuff[k_growshrinktimer] > 1 ? 2 : (player->kartstuff[k_invincibilitytimer] > 1 ? 1 : 0)); + { + if (player->kartstuff[k_growshrinktimer] > 1) + wantedmus = 2; + else if (player->kartstuff[k_invincibilitytimer] > 1) + wantedmus = 1; + } } // Item - Grow - if (bestlocalmus == 2) + if (wantedmus == 2) S_ChangeMusicInternal("kgrow", true); // Item - Invincibility - else if (bestlocalmus == 1) + else if (wantedmus == 1) S_ChangeMusicInternal("kinvnc", true); else { From a885f340aeb7ac8cc6356db455f0095d3aa8d138 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 01:50:27 -0400 Subject: [PATCH 21/23] Use V_ORANGEMAP for blinking WANTED text in Battle splitscreen --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 58e679c8..e47f3baf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6601,7 +6601,7 @@ static void K_drawKartWanted(void) if (splitscreen) // Can't fit the poster on screen, sadly { if (K_IsPlayerWanted(stplyr) && leveltime % 10 > 3) - V_DrawRightAlignedString(WANT_X, WANT_Y, K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS|V_REDMAP), "WANTED"); + V_DrawRightAlignedString(WANT_X, WANT_Y, K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS|V_ORANGEMAP), "WANTED"); return; } From a23c62e60e337a802ad5879606d56177c64bf0ac Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 28 Oct 2018 13:52:25 -0400 Subject: [PATCH 22/23] Move lap animation up slightly (I'm not gonna remember to do this later either) --- src/k_kart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e47f3baf..07ef148b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7360,38 +7360,38 @@ static void K_drawLapStartAnim(void) const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; V_DrawScaledPatch(BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)), - 64 - (32*max(0, progress-76)), + 56 - (32*max(0, progress-76)), 0, kp_lapanim_emblem); if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { V_DrawScaledPatch(27 - (32*max(0, progress-76)), - 40, + 32, 0, kp_lapanim_final[min(progress/2, 10)]); if (progress/2-12 >= 0) { V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 40, + 32, 0, kp_lapanim_lap[min(progress/2-12, 6)]); } } else { V_DrawScaledPatch(61 - (32*max(0, progress-76)), - 40, + 32, 0, kp_lapanim_lap[min(progress/2, 6)]); if (progress/2-8 >= 0) { V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 40, + 32, 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)]); if (progress/2-10 >= 0) { V_DrawScaledPatch(221 + (32*max(0, progress-76)), - 40, + 32, 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)]); } } From f8d87c8f08082e2099154a2f8c46b0c89fa9411b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 29 Oct 2018 05:26:17 -0400 Subject: [PATCH 23/23] Preface with splitscreen checks --- src/s_sound.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 8f2e4a35..6dae619a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -531,7 +531,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) pitch = NORM_PITCH; priority = NORM_PRIORITY; - if (origin) + if (splitscreen && origin) volume = FixedDiv(volume<>FRACBITS; if (splitscreen && listenmobj2) // Copy the sound for the split player @@ -1014,7 +1014,7 @@ void S_UpdateSounds(void) pitch = NORM_PITCH; sep = NORM_SEP; - if (c->origin) + if (splitscreen && c->origin) volume = FixedDiv(volume<>FRACBITS; // check non-local sounds for distance clipping @@ -1331,7 +1331,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; } - *vol = FixedDiv((*vol)<>FRACBITS; + if (splitscreen) + *vol = FixedDiv((*vol)<>FRACBITS; return (*vol > 0); }