Merge branch 'splitscreen-tuneup' into 'master'

Splitscreen tuneup

See merge request KartKrew/Kart!67
This commit is contained in:
Sal 2018-10-29 05:30:49 -04:00
commit 916fb49be6
4 changed files with 92 additions and 33 deletions

View file

@ -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) if (players[tab[i].num].spectator || !players[tab[i].num].mo)
continue; //ignore them. 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); HU_drawPing(x+ 253, y+2, playerpingtable[tab[i].num], false);
} }
@ -2609,7 +2609,7 @@ static inline void HU_DrawSpectatorTicker(void)
templength = length; 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; length += (signed)strlen(player_names[i]) * 8 + 16;
@ -2783,7 +2783,7 @@ static void HU_DrawRankings(void)
HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/ HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/
// draw spectators in a ticker across the bottom // draw spectators in a ticker across the bottom
if (!splitscreen && G_GametypeHasSpectators()) if (netgame && G_GametypeHasSpectators())
HU_DrawSpectatorTicker(); HU_DrawSpectatorTicker();
} }

View file

@ -5506,8 +5506,8 @@ static patch_t *kp_karmasticker;
static patch_t *kp_splitkarmabomb; static patch_t *kp_splitkarmabomb;
static patch_t *kp_timeoutsticker; static patch_t *kp_timeoutsticker;
static patch_t *kp_startcountdown[8]; static patch_t *kp_startcountdown[16];
static patch_t *kp_racefinish[2]; static patch_t *kp_racefinish[6];
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
static patch_t *kp_winnernum[NUMPOSFRAMES]; static patch_t *kp_winnernum[NUMPOSFRAMES];
@ -5594,9 +5594,25 @@ void K_LoadKartHUDGraphics(void)
kp_startcountdown[5] = W_CachePatchName("K_CNT2B", PU_HUDGFX); kp_startcountdown[5] = W_CachePatchName("K_CNT2B", PU_HUDGFX);
kp_startcountdown[6] = W_CachePatchName("K_CNT1B", PU_HUDGFX); kp_startcountdown[6] = W_CachePatchName("K_CNT1B", PU_HUDGFX);
kp_startcountdown[7] = W_CachePatchName("K_CNTGOB", 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[0] = W_CachePatchName("K_FINA", PU_HUDGFX);
kp_racefinish[1] = W_CachePatchName("K_FINB", 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 // Position numbers
sprintf(buffer, "K_POSNxx"); sprintf(buffer, "K_POSNxx");
@ -6590,7 +6606,7 @@ static void K_drawKartWanted(void)
if (splitscreen) // Can't fit the poster on screen, sadly if (splitscreen) // Can't fit the poster on screen, sadly
{ {
if (K_IsPlayerWanted(stplyr) && leveltime % 10 > 3) 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; return;
} }
@ -6929,10 +6945,9 @@ static void K_drawKartStartCountdown(void)
pnum++; pnum++;
if ((leveltime % (2*5)) / 5) // blink if ((leveltime % (2*5)) / 5) // blink
pnum += 4; 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]);
} }
@ -6946,12 +6961,14 @@ static void K_drawKartFinish(void)
if ((stplyr->kartstuff[k_cardanimation] % (2*5)) / 5) // blink if ((stplyr->kartstuff[k_cardanimation] % (2*5)) / 5) // blink
pnum = 1; pnum = 1;
if (splitscreen > 1) if (splitscreen > 1) // small splitscreen
{ pnum += 2;
V_DrawTinyScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/8), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/8), splitflags, kp_racefinish[pnum]); else if (splitscreen == 1) // wide splitscreen
return; 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 scaleshift = (FRACBITS - splitscreen); // FRACUNIT or FRACUNIT/2
INT32 x = ((vid.width<<FRACBITS)/vid.dupx), xval = (SHORT(kp_racefinish[pnum]->width)<<scaleshift); INT32 x = ((vid.width<<FRACBITS)/vid.dupx), xval = (SHORT(kp_racefinish[pnum]->width)<<scaleshift);
@ -7018,7 +7035,7 @@ static void K_drawBattleFullscreen(void)
{ {
if (stplyr->kartstuff[k_position] == 1) if (stplyr->kartstuff[k_position] == 1)
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL); V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
else if (splitscreen < 2) else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL); V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL);
} }
else else
@ -7348,38 +7365,38 @@ static void K_drawLapStartAnim(void)
const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation];
V_DrawScaledPatch(BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)), 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); 0, kp_lapanim_emblem);
if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) if (stplyr->laps == (UINT8)(cv_numlaps.value - 1))
{ {
V_DrawScaledPatch(27 - (32*max(0, progress-76)), V_DrawScaledPatch(27 - (32*max(0, progress-76)),
40, 32,
0, kp_lapanim_final[min(progress/2, 10)]); 0, kp_lapanim_final[min(progress/2, 10)]);
if (progress/2-12 >= 0) if (progress/2-12 >= 0)
{ {
V_DrawScaledPatch(194 + (32*max(0, progress-76)), V_DrawScaledPatch(194 + (32*max(0, progress-76)),
40, 32,
0, kp_lapanim_lap[min(progress/2-12, 6)]); 0, kp_lapanim_lap[min(progress/2-12, 6)]);
} }
} }
else else
{ {
V_DrawScaledPatch(61 - (32*max(0, progress-76)), V_DrawScaledPatch(61 - (32*max(0, progress-76)),
40, 32,
0, kp_lapanim_lap[min(progress/2, 6)]); 0, kp_lapanim_lap[min(progress/2, 6)]);
if (progress/2-8 >= 0) if (progress/2-8 >= 0)
{ {
V_DrawScaledPatch(194 + (32*max(0, progress-76)), V_DrawScaledPatch(194 + (32*max(0, progress-76)),
40, 32,
0, kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)]); 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)]);
if (progress/2-10 >= 0) if (progress/2-10 >= 0)
{ {
V_DrawScaledPatch(221 + (32*max(0, progress-76)), V_DrawScaledPatch(221 + (32*max(0, progress-76)),
40, 32,
0, kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)]); 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)]);
} }
} }

View file

@ -6798,7 +6798,7 @@ void P_MobjThinker(mobj_t *mobj)
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD
/*&& players[displayplayer].mo && !players[displayplayer].spectator*/) /*&& players[displayplayer].mo && !players[displayplayer].spectator*/)
{ {
fixed_t scale = mobj->target->scale; fixed_t scale = 4*mobj->target->scale;
mobj->color = mobj->target->color; mobj->color = mobj->target->color;
K_MatchGenericExtraFlags(mobj, mobj->target); 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 && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD
&& players[displayplayer].mo && !players[displayplayer].spectator) && 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)) if (!K_IsPlayerWanted(mobj->target->player))
{ {
@ -7023,10 +7023,13 @@ void P_MobjThinker(mobj_t *mobj)
} }
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
if (!splitscreen)
{
scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, 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); players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
if (scale > 16*FRACUNIT) if (scale > 16*FRACUNIT)
scale = 16*FRACUNIT; scale = 16*FRACUNIT;
}
mobj->destscale = scale; mobj->destscale = scale;
} }
else if (mobj->health > 0) else if (mobj->health > 0)

View file

@ -1217,6 +1217,8 @@ void P_RestoreMusic(player_t *player)
if (!P_IsLocalPlayer(player)) // Only applies to a local player if (!P_IsLocalPlayer(player)) // Only applies to a local player
return; return;
S_SpeedMusic(1.0f);
// Event - HERE COMES A NEW CHALLENGER // Event - HERE COMES A NEW CHALLENGER
if (mapreset) if (mapreset)
{ {
@ -1228,24 +1230,58 @@ void P_RestoreMusic(player_t *player)
if (P_EndingMusic(player)) if (P_EndingMusic(player))
return; return;
S_SpeedMusic(1.0f);
// Event - Level Start // Event - Level Start
if (leveltime < (starttime + (TICRATE/2))) if (leveltime < (starttime + (TICRATE/2)))
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic();
else // see also where time overs are handled - search for "lives = 2" in this file else // see also where time overs are handled - search for "lives = 2" in this file
{ {
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
{
INT32 bestlocaltimer = 1;
#define setbests(p) \
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);
if (splitscreen > 2)
setbests(fourthdisplayplayer);
#undef setbests
}
else
{
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
}
// Item - Grow // Item - Grow
if (player->kartstuff[k_growshrinktimer] > 1 && player->playerstate == PST_LIVE) if (wantedmus == 2)
S_ChangeMusicInternal("kgrow", true); S_ChangeMusicInternal("kgrow", true);
// Item - Invincibility // Item - Invincibility
else if (player->kartstuff[k_invincibilitytimer] > 1 && player->playerstate == PST_LIVE) else if (wantedmus == 1)
S_ChangeMusicInternal("kinvnc", true); S_ChangeMusicInternal("kinvnc", true);
else else
{ {
#if 0
// Event - Final Lap // Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f); S_SpeedMusic(1.2f);
#endif
S_ChangeMusic(mapmusname, mapmusflags, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
} }
@ -8266,6 +8302,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
camheight += thiscam->height; camheight += thiscam->height;
if (splitscreen == 1)
camspeed = (3*camspeed)/4;
if (timeover) if (timeover)
angle = mo->angle + FixedAngle(camrotate*FRACUNIT); angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
else if (leveltime < starttime) else if (leveltime < starttime)