A bunch of little things.

* Fix both cv_timelimit and cv_pointlimit as "hidden options" for people to play with if they know about them via the console.
* Show GAME SPEED on the tab screen.
* Fix Invincibility and Grow's music changes being broken. (I didn't test them properly when making them P_RestoreMusic calls, sorry.)
* Stop showing the First Person Kart view in spectator mode, per Sal's request.
This commit is contained in:
toaster 2018-07-18 21:40:04 +01:00
parent 2b7298e959
commit a036e9cdc8
5 changed files with 74 additions and 62 deletions

View file

@ -1121,16 +1121,6 @@ static void HU_DrawCEcho(void)
--cechotimer; --cechotimer;
} }
static void HU_drawGametype(void)
{
INT32 flags;
if (gametype == GT_MATCH)
flags = V_REDMAP;
else
flags = V_SKYMAP;
V_DrawString(4, 188, flags, gametype_cons_t[gametype].strvalue);
}
// //
// demo info stuff // demo info stuff
// //
@ -1315,9 +1305,9 @@ void HU_Erase(void)
// //
// HU_DrawTabRankings // HU_DrawTabRankings
// //
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer) void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol)
{ {
INT32 i, j, hilicol, rightoffset = 240; INT32 i, j, rightoffset = 240;
const UINT8 *colormap; const UINT8 *colormap;
//this function is designed for 9 or less score lines only //this function is designed for 9 or less score lines only
@ -1331,13 +1321,6 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
rightoffset = 156; rightoffset = 156;
} }
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
else if (modeattacking)
hilicol = V_ORANGEMAP;
else
hilicol = ((gametype == GT_RACE) ? V_SKYMAP : V_REDMAP);
for (i = 0; i < scorelines; i++) for (i = 0; i < scorelines; i++)
{ {
if (players[tab[i].num].spectator || !players[tab[i].num].mo) if (players[tab[i].num].spectator || !players[tab[i].num].mo)
@ -1664,12 +1647,22 @@ static void HU_DrawRankings(void)
{ {
patch_t *p; patch_t *p;
playersort_t tab[MAXPLAYERS]; playersort_t tab[MAXPLAYERS];
INT32 i, j, scorelines, numplayersingame = 0, lowestposition = 2; INT32 i, j, scorelines, hilicol, numplayersingame = 0, lowestposition = 2;
boolean completed[MAXPLAYERS]; boolean completed[MAXPLAYERS];
UINT32 whiteplayer = MAXPLAYERS; UINT32 whiteplayer = MAXPLAYERS;
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
else if (modeattacking)
hilicol = V_ORANGEMAP;
else
hilicol = ((gametype == GT_RACE) ? V_SKYMAP : V_REDMAP);
// draw the current gametype in the lower right // draw the current gametype in the lower right
HU_drawGametype(); if (modeattacking)
V_DrawString(4, 188, hilicol, "Record Attack");
else
V_DrawString(4, 188, hilicol, gametype_cons_t[gametype].strvalue);
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
@ -1694,29 +1687,32 @@ static void HU_DrawRankings(void)
{ {
if (cv_timelimit.value && timelimitintics > 0) if (cv_timelimit.value && timelimitintics > 0)
{ {
INT32 timeval = (timelimitintics+1-leveltime)/TICRATE; UINT32 timeval = (timelimitintics + starttime + 1 - leveltime);
if (timeval > timelimitintics+1)
timeval = timelimitintics;
timeval /= TICRATE;
if (leveltime <= timelimitintics) if (leveltime <= timelimitintics)
{ {
V_DrawCenteredString(64, 8, 0, "TIME LEFT"); V_DrawCenteredString(64, 8, 0, "TIME LEFT");
V_DrawCenteredString(64, 16, 0, va("%u", timeval)); V_DrawCenteredString(64, 16, hilicol, va("%u", timeval));
} }
// overtime // overtime
if ((leveltime > (timelimitintics + TICRATE/2)) && cv_overtime.value) if (!players[consoleplayer].exiting && (leveltime > (timelimitintics + starttime + TICRATE/2)) && cv_overtime.value)
{ {
V_DrawCenteredString(64, 8, 0, "TIME LEFT"); V_DrawCenteredString(64, 8, 0, "TIME LEFT");
V_DrawCenteredString(64, 16, 0, "OVERTIME"); V_DrawCenteredString(64, 16, hilicol, "OVERTIME");
} }
} }
if (cv_pointlimit.value > 0) if (cv_pointlimit.value > 0)
{ {
V_DrawCenteredString(256, 8, 0, "POINT LIMIT"); V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
V_DrawCenteredString(256, 16, 0, va("%d", cv_pointlimit.value)); V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value));
} }
} }
else if (gametype == GT_COOP) /*else if (gametype == GT_COOP)
{ {
INT32 totalscore = 0; INT32 totalscore = 0;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
@ -1727,14 +1723,17 @@ static void HU_DrawRankings(void)
V_DrawCenteredString(256, 8, 0, "TOTAL SCORE"); V_DrawCenteredString(256, 8, 0, "TOTAL SCORE");
V_DrawCenteredString(256, 16, 0, va("%u", totalscore)); V_DrawCenteredString(256, 16, 0, va("%u", totalscore));
} }*/
else else
{ {
if (circuitmap) if (circuitmap)
{ {
V_DrawCenteredString(64, 8, 0, "NUMBER OF LAPS"); V_DrawCenteredString(64, 8, 0, "LAP COUNT");
V_DrawCenteredString(64, 16, 0, va("%d", cv_numlaps.value)); V_DrawCenteredString(64, 16, hilicol, va("%d", cv_numlaps.value));
} }
V_DrawCenteredString(256, 8, 0, "GAME SPEED");
V_DrawCenteredString(256, 16, hilicol, cv_kartspeed.string);
} }
// When you play, you quickly see your score because your name is displayed in white. // When you play, you quickly see your score because your name is displayed in white.
@ -1799,7 +1798,7 @@ static void HU_DrawRankings(void)
/*if (G_GametypeHasTeams()) /*if (G_GametypeHasTeams())
HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request -- gotta fix this up later HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request -- gotta fix this up later
else if (scorelines > 10)*/ else if (scorelines > 10)*/
HU_DrawTabRankings(((scorelines > 9) ? 32 : 40), 32, tab, scorelines, whiteplayer); HU_DrawTabRankings(((scorelines > 9) ? 32 : 40), 32, tab, scorelines, whiteplayer, hilicol);
/*else /*else
HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/ HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/

View file

@ -102,7 +102,7 @@ void HU_Drawer(void);
char HU_dequeueChatChar(void); char HU_dequeueChatChar(void);
void HU_Erase(void); void HU_Erase(void);
void HU_clearChatChars(void); void HU_clearChatChars(void);
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer); void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer); //void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer); //void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds); void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);

View file

@ -3393,9 +3393,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
case KITEM_INVINCIBILITY: case KITEM_INVINCIBILITY:
if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) // Doesn't hold your item slot hostage normally, so you're free to waste it if you have multiple if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) // Doesn't hold your item slot hostage normally, so you're free to waste it if you have multiple
{ {
P_RestoreMusic(player);
if (!cv_kartinvinsfx.value && !P_IsLocalPlayer(player))
S_StartSound(player->mo, sfx_kinvnc);
if (!player->kartstuff[k_invincibilitytimer]) if (!player->kartstuff[k_invincibilitytimer])
{ {
mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_INVULNFLASH); mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_INVULNFLASH);
@ -3404,6 +3401,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
P_SetScale(overlay, player->mo->scale); P_SetScale(overlay, player->mo->scale);
} }
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
P_RestoreMusic(player);
if (!cv_kartinvinsfx.value && !P_IsLocalPlayer(player))
S_StartSound(player->mo, sfx_kinvnc);
K_PlayTauntSound(player->mo); K_PlayTauntSound(player->mo);
player->kartstuff[k_itemamount]--; player->kartstuff[k_itemamount]--;
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
@ -3623,15 +3623,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO
&& player->kartstuff[k_growshrinktimer] <= 0) // Grow holds the item box hostage && player->kartstuff[k_growshrinktimer] <= 0) // Grow holds the item box hostage
{ {
P_RestoreMusic(player);
if (!cv_kartinvinsfx.value && !P_IsLocalPlayer(player))
S_StartSound(player->mo, sfx_kgrow);
K_PlayTauntSound(player->mo); K_PlayTauntSound(player->mo);
player->mo->scalespeed = FRACUNIT/TICRATE; player->mo->scalespeed = FRACUNIT/TICRATE;
player->mo->destscale = 3*(mapheaderinfo[gamemap-1]->mobj_scale)/2; player->mo->destscale = 3*(mapheaderinfo[gamemap-1]->mobj_scale)/2;
if (cv_kartdebugshrink.value && !player->bot) if (cv_kartdebugshrink.value && !player->bot)
player->mo->destscale = 6*player->mo->destscale/8; player->mo->destscale = 6*player->mo->destscale/8;
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
P_RestoreMusic(player);
if (!cv_kartinvinsfx.value && !P_IsLocalPlayer(player))
S_StartSound(player->mo, sfx_kgrow);
S_StartSound(player->mo, sfx_kc5a); S_StartSound(player->mo, sfx_kc5a);
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
player->kartstuff[k_itemamount]--; player->kartstuff[k_itemamount]--;
@ -5429,7 +5429,7 @@ static void K_drawKartFirstPerson(void)
UINT8 *colmap = NULL; UINT8 *colmap = NULL;
ticcmd_t *cmd = &stplyr->cmd; ticcmd_t *cmd = &stplyr->cmd;
if (stplyr->mo && stplyr->mo->flags2 & MF2_DONTDRAW) if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW))
return; return;
if (stplyr == &players[secondarydisplayplayer] && splitscreen) if (stplyr == &players[secondarydisplayplayer] && splitscreen)
@ -5448,12 +5448,10 @@ static void K_drawKartFirstPerson(void)
x >>= 1; x >>= 1;
} }
if (stplyr->spectator || !stplyr->mo)
splitflags |= FF_TRANS50; // this isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it
else
{ {
if (stplyr->speed < FixedMul(stplyr->runspeed, stplyr->mo->scale) && (leveltime & 1) && !splitscreen) if (stplyr->speed < FixedMul(stplyr->runspeed, stplyr->mo->scale) && (leveltime & 1) && !splitscreen)
y++; y++;
// this isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it
if (stplyr->mo->frame & FF_TRANSMASK) if (stplyr->mo->frame & FF_TRANSMASK)
splitflags |= (stplyr->mo->frame & FF_TRANSMASK); // ditto splitflags |= (stplyr->mo->frame & FF_TRANSMASK); // ditto
} }

View file

@ -1797,7 +1797,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
*/ */
void P_CheckTimeLimit(void) void P_CheckTimeLimit(void)
{ {
INT32 i; INT32 i, k;
if (!cv_timelimit.value) if (!cv_timelimit.value)
return; return;
@ -1808,7 +1808,7 @@ void P_CheckTimeLimit(void)
if (G_RaceGametype()) if (G_RaceGametype())
return; return;
if (leveltime < timelimitintics) if (leveltime < (timelimitintics + starttime))
return; return;
if (gameaction == ga_completed) if (gameaction == ga_completed)
@ -1830,13 +1830,10 @@ void P_CheckTimeLimit(void)
P_AddPlayerScore(&players[i], players[i].score); P_AddPlayerScore(&players[i], players[i].score);
} }
} }
if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
} }
//Optional tie-breaker for Match/CTF //Optional tie-breaker for Match/CTF
/*else if (cv_overtime.value) else if (cv_overtime.value)
{ {
INT32 playerarray[MAXPLAYERS]; INT32 playerarray[MAXPLAYERS];
INT32 tempplayer = 0; INT32 tempplayer = 0;
@ -1846,6 +1843,8 @@ void P_CheckTimeLimit(void)
//Figure out if we have enough participating players to care. //Figure out if we have enough participating players to care.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (players[i].exiting)
return;
if (playeringame[i] && players[i].spectator) if (playeringame[i] && players[i].spectator)
spectators++; spectators++;
} }
@ -1874,7 +1873,7 @@ void P_CheckTimeLimit(void)
{ {
for (k = i; k < playercount; k++) for (k = i; k < playercount; k++)
{ {
if (players[playerarray[i-1]].score < players[playerarray[k]].score) if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore)
{ {
tempplayer = playerarray[i-1]; tempplayer = playerarray[i-1];
playerarray[i-1] = playerarray[k]; playerarray[i-1] = playerarray[k];
@ -1884,7 +1883,7 @@ void P_CheckTimeLimit(void)
} }
//End the round if the top players aren't tied. //End the round if the top players aren't tied.
if (players[playerarray[0]].score == players[playerarray[1]].score) if (players[playerarray[0]].marescore == players[playerarray[1]].marescore)
return; return;
} }
else else
@ -1894,12 +1893,19 @@ void P_CheckTimeLimit(void)
return; return;
} }
} }
if (server) }
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
}*/
if (server) for (i = 0; i < MAXPLAYERS; i++)
SendNetXCmd(XD_EXITLEVEL, NULL, 0); {
if (!playeringame[i] || players[i].spectator)
continue;
if (players[i].exiting)
return;
P_DoPlayerExit(&players[i]);
}
/*if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);*/
} }
/** Checks if a player's score is over the pointlimit and the round should end. /** Checks if a player's score is over the pointlimit and the round should end.
@ -1922,7 +1928,7 @@ void P_CheckPointLimit(void)
return; return;
// pointlimit is nonzero, check if it's been reached by this player // pointlimit is nonzero, check if it's been reached by this player
if (G_GametypeHasTeams()) /*if (G_GametypeHasTeams())
{ {
// Just check both teams // Just check both teams
if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore) if ((UINT32)cv_pointlimit.value <= redscore || (UINT32)cv_pointlimit.value <= bluescore)
@ -1931,18 +1937,27 @@ void P_CheckPointLimit(void)
SendNetXCmd(XD_EXITLEVEL, NULL, 0); SendNetXCmd(XD_EXITLEVEL, NULL, 0);
} }
} }
else else*/
{ {
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (!playeringame[i] || players[i].spectator) if (!playeringame[i] || players[i].spectator)
continue; continue;
if ((UINT32)cv_pointlimit.value <= players[i].score) if ((UINT32)cv_pointlimit.value <= players[i].marescore)
{ {
if (server) for (i = 0; i < MAXPLAYERS; i++) // AAAAA nested loop using the same iteration variable ;;
SendNetXCmd(XD_EXITLEVEL, NULL, 0); {
return; if (!playeringame[i] || players[i].spectator)
continue;
if (players[i].exiting)
return;
P_DoPlayerExit(&players[i]);
}
/*if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);*/
return; // good thing we're leaving the function immediately instead of letting the loop get mangled!
} }
} }
} }

View file

@ -1190,7 +1190,7 @@ void P_RestoreMusic(player_t *player)
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 (player->kartstuff[k_invincibilitytimer] > 1 && player->playerstate == PST_LIVE)
S_ChangeMusicInternal("kinvnc", false); S_ChangeMusicInternal("kinvnc", true);
else else
{ {
// Event - Final Lap // Event - Final Lap