Rework intertype_t

- Now you select based on whether you want to rank by
    - Time always (Race, Special)
    - Score always (might be useful for custom gametypes..?)
    - Time in 1P, Score otherwise (Battle, Versus)
- No longer has gametype-specific text colours on the intermission
- Also cleans up a case where invalid music could play for winning a custom gametype without GTR_CIRCUIT *or* GTR_BUMPERS
This commit is contained in:
toaster 2022-12-27 14:33:58 +00:00
parent 63f75fcba1
commit 470f82104d
5 changed files with 44 additions and 50 deletions

View file

@ -6396,9 +6396,9 @@ struct int_const_s const INT_CONST[] = {
// Intermission types
{"int_none",int_none},
{"int_race",int_race},
{"int_battle",int_battle},
{"int_battletime", int_battletime},
{"int_time",int_time},
{"int_score",int_score},
{"int_scoreortimeattack", int_scoreortimeattack},
// Jingles (jingletype_t)
{"JT_NONE",JT_NONE},

View file

@ -2995,7 +2995,7 @@ static gametype_t defaultgametypes[] =
"GT_RACE",
GTR_CIRCUIT|GTR_BOTS|GTR_ENCORE,
TOL_RACE,
int_race,
int_time,
0,
0,
},
@ -3006,17 +3006,18 @@ static gametype_t defaultgametypes[] =
"GT_BATTLE",
GTR_SPHERES|GTR_BUMPERS|GTR_PAPERITEMS|GTR_POWERSTONES|GTR_KARMA|GTR_ITEMARROWS|GTR_CAPSULES|GTR_BATTLESTARTS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_CLOSERPLAYERS,
TOL_BATTLE,
int_battle,
int_scoreortimeattack,
0,
2,
},
// GT_SPECIAL
{
"Special",
"GT_SPECIAL",
GTR_CATCHER|GTR_CIRCUIT,
TOL_SPECIAL,
int_race,
int_time,
0,
0,
},
@ -3027,7 +3028,7 @@ static gametype_t defaultgametypes[] =
"GT_VERSUS",
GTR_BOSS|GTR_SPHERES|GTR_BUMPERS|GTR_POINTLIMIT|GTR_CLOSERPLAYERS|GTR_NOCUPSELECT|GTR_ENCORE,
TOL_BOSS,
int_battle,
int_scoreortimeattack,
0,
0,
},

View file

@ -720,6 +720,7 @@ boolean P_EndingMusic(player_t *player)
{
char buffer[9];
boolean looping = true;
boolean racetracks = !!(gametyperules & GTR_CIRCUIT);
INT32 bestlocalpos, test;
player_t *bestlocalplayer;
@ -773,7 +774,7 @@ boolean P_EndingMusic(player_t *player)
#undef getplayerpos
if ((gametyperules & GTR_CIRCUIT) && bestlocalpos == MAXPLAYERS+1)
if (racetracks == true && bestlocalpos == MAXPLAYERS+1)
sprintf(buffer, "k*fail"); // F-Zero death results theme
else
{
@ -787,9 +788,11 @@ boolean P_EndingMusic(player_t *player)
S_SpeedMusic(1.0f);
if ((gametyperules & GTR_CIRCUIT))
if (racetracks == true)
{
buffer[1] = 'r';
else if ((gametyperules & GTR_BUMPERS))
}
else
{
buffer[1] = 'b';
looping = false;

View file

@ -334,7 +334,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
//
void Y_IntermissionDrawer(void)
{
INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = V_YELLOWMAP; // fallback
INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = highlightflags;
if (intertype == int_none || rendermode == render_none)
return;
@ -357,11 +357,6 @@ void Y_IntermissionDrawer(void)
if (!r_splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (modeattacking)
hilicol = V_ORANGEMAP;
else
hilicol = ((intertype == int_race) ? V_SKYMAP : V_REDMAP);
if (sorttic != -1 && intertic > sorttic)
{
INT32 count = (intertic - sorttic);
@ -374,7 +369,7 @@ void Y_IntermissionDrawer(void)
x += (((16 - count) * vid.width) / (8 * vid.dupx));
}
if (intertype == int_race || intertype == int_battle || intertype == int_battletime)
if (intertype == int_time || intertype == int_score)
{
#define NUMFORNEWCOLUMN 8
INT32 y = 41, gutter = ((data.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2));
@ -397,7 +392,7 @@ void Y_IntermissionDrawer(void)
{
switch (intertype)
{
case int_battle:
case int_score:
timeheader = "SCORE";
break;
default:
@ -532,7 +527,7 @@ void Y_IntermissionDrawer(void)
V_DrawRightAlignedThinString(x+152+gutter, y-1, (data.numplayers > NUMFORNEWCOLUMN ? V_6WIDTHSPACE : 0), "NO CONTEST.");
else
{
if (intertype == int_race || intertype == int_battletime)
if (intertype == int_time)
{
snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true),
G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i]));
@ -668,7 +663,7 @@ void Y_Ticker(void)
if (intertic < TICRATE || intertic & 1 || endtic != -1)
return;
if (intertype == int_race || intertype == int_battle || intertype == int_battletime)
if (intertype == int_time || intertype == int_score)
{
{
if (!data.rankingsmode && sorttic != -1 && (intertic >= sorttic + 8))
@ -750,27 +745,27 @@ void Y_Ticker(void)
//
void Y_DetermineIntermissionType(void)
{
// no intermission for GP events
if (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)
{
intertype = int_none;
return;
}
// set initially
intertype = gametypes[gametype]->intermission;
// TODO: special cases
if (intertype == int_battle)
// special cases
if (intertype == int_scoreortimeattack)
{
if (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)
UINT8 i = 0, nump = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
intertype = int_none;
}
else
{
UINT8 i = 0, nump = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
nump++;
}
intertype = (nump < 2 ? int_battletime : int_battle);
if (!playeringame[i] || players[i].spectator)
continue;
nump++;
}
intertype = (nump < 2 ? int_time : int_score);
}
}
@ -836,23 +831,18 @@ void Y_StartIntermission(void)
if (prevmap >= nummapheaders || !mapheaderinfo[prevmap])
I_Error("Y_StartIntermission: Internal map ID %d not found (nummapheaders = %d)", prevmap, nummapheaders);
if (!(gametyperules & GTR_CIRCUIT) && (timer > 1))
S_ChangeMusicInternal("racent", true); // loop it
switch (intertype)
{
case int_battle:
case int_battletime:
case int_score:
{
if (timer > 1)
S_ChangeMusicInternal("racent", true); // loop it
// Calculate who won
if (intertype == int_battle)
{
Y_CalculateMatchData(0, Y_CompareScore);
break;
}
Y_CalculateMatchData(0, Y_CompareScore);
break;
}
// FALLTHRU
case int_race:
case int_time:
{
// Calculate who won
Y_CalculateMatchData(0, Y_CompareTime);

View file

@ -26,9 +26,9 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level);
typedef enum
{
int_none,
int_race, // Race
int_battle, // Battle (score-based)
int_battletime, // Battle (time-based)
int_time, // Always time
int_score, // Always score
int_scoreortimeattack, // Score unless 1P
} intertype_t;
extern intertype_t intertype;