Refactor Rankings Drawing #155

Merged
alufolie91 merged 14 commits from rankingsrefactor into Saturn-Next 2025-03-23 17:10:23 +01:00
7 changed files with 425 additions and 281 deletions

No files matched your search

+18 -19
View File
@@ -2603,7 +2603,6 @@ static void HU_DrawRankings(void)
playersort_t tab[MAXPLAYERS];
INT32 i, j, scorelines, hilicol, numplayersingame = 0;
boolean completed[MAXPLAYERS];
UINT32 whiteplayer = MAXPLAYERS;
if (!automapactive)
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
@@ -2615,20 +2614,25 @@ static void HU_DrawRankings(void)
else
hilicol = ((gametype == GT_RACE) ? V_SKYMAP : V_REDMAP);
// draw the current gametype in the lower right
//if (modeattacking)
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Record Attack");
//else
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
// draw the current map in the lower right if theres none just say its unknown
char *maptitle = G_BuildMapTitle(gamemap);
if (!maptitle)
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
if (!demo.playback)
{
// draw the current map in the lower right
char *maptitle = G_BuildMapTitle(gamemap);
if (maptitle)
{
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
Z_Free(maptitle);
}
else
{
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
}
}
else
{
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
Z_Free(maptitle);
// draw the current gametype in the lower right
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, (modeattacking) ? "Record Attack" : gametype_cons_t[gametype].strvalue);
}
if (G_GametypeHasTeams())
@@ -2691,11 +2695,6 @@ static void HU_DrawRankings(void)
V_DrawCenteredString(256, 16, hilicol, cv_kartspeed.string);
}
// When you play, you quickly see your score because your name is displayed in white.
// When playing back a demo, you quickly see who's the view.
if (!splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
scorelines = 0;
memset(completed, 0, sizeof (completed));
memset(tab, 0, sizeof (playersort_t)*MAXPLAYERS);
@@ -2751,7 +2750,7 @@ static void HU_DrawRankings(void)
#endif
}
HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol);
HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, hilicol);
// draw spectators in a ticker across the bottom
if (netgame && G_GametypeHasSpectators())
+1 -1
View File
@@ -122,7 +122,7 @@ void HU_clearChatChars(void);
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
//void HU_DrawDualTabRankings(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_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 hilicol);
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
const char *HU_SkinColorToConsoleColor(skincolors_t color);
+33 -30
View File
@@ -9052,12 +9052,14 @@ static boolean K_drawKartPositionFaces(void)
//
// HU_DrawTabRankings -- moved here to take advantage of kart stuff!
//
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol)
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 hilicol)
{
INT32 i, rightoffset = 240;
const UINT8 *colormap;
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
boolean (*_isHighlightedPlayer)(const player_t *) = (demo.playback ? P_IsDisplayPlayer : P_IsLocalPlayer);
//this function is designed for 9 or less score lines only
//I_Assert(scorelines <= 9); -- not today bitch, kart fixed it up
@@ -9072,43 +9074,44 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
for (i = 0; i < scorelines; i++)
{
char strtime[MAXPLAYERNAME+1];
const UINT8 pnum = tab[i].num;
player_t *player = &players[pnum];
if (players[tab[i].num].spectator || !players[tab[i].num].mo)
if (player->spectator || !player->mo)
continue; //ignore them.
if ((netgame && tab[i].num != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(&players[tab[i].num])))
const boolean whiteplayer = _isHighlightedPlayer(player);
const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(player->skincolor) : 0);
if ((netgame && pnum != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(player)))
{
HU_drawPlayerPing(x + ((i < 8) ? -17 : rightoffset + 11), y-4, tab[i].num, 0);
HU_drawPlayerPing(x + ((i < 8) ? -17 : rightoffset + 11), y-4, pnum, 0);
}
STRBUFCPY(strtime, tab[i].name);
if (scorelines > 8)
V_DrawThinString(x + 20, y, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
V_DrawThinString(x + 20, y, philicol|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
else
V_DrawString(x + 20, y, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime);
V_DrawString(x + 20, y, philicol|V_ALLOWLOWERCASE, strtime);
if (players[tab[i].num].mo->color)
if (player->mo->color)
{
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE);
if (players[tab[i].num].mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, players[tab[i].num].mo->color, GTC_CACHE);
if (player->mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, player->mo->color, GTC_CACHE);
else
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE);
colormap = R_GetTranslationColormap(player->skin, player->mo->color, GTC_CACHE);
{
player_t *p;
p = &players[tab[i].num];
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(p), colormap);
else
V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap);
}
/*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x, y-4, 0, R_GetSkinFaceWant(player), colormap);
else
V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(player), colormap);
/*if (G_BattleGametype() && player->kartstuff[k_bumper] > 0) -- not enough space for this
{
INT32 bumperx = x+19;
V_DrawMappedPatch(bumperx-2, y-4, 0, kp_tinybumper[0], colormap);
for (j = 1; j < players[tab[i].num].kartstuff[k_bumper]; j++)
for (j = 1; j < player->kartstuff[k_bumper]; j++)
{
bumperx += 5;
V_DrawMappedPatch(bumperx, y-4, 0, kp_tinybumper[1], colormap);
@@ -9116,14 +9119,14 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
}*/
}
if (tab[i].num == whiteplayer)
if (whiteplayer)
V_DrawScaledPatch(x, y-4, 0, kp_facehighlight[(leveltime / 4) % 8]);
if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] <= 0)
if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
V_DrawScaledPatch(x-4, y-7, 0, kp_ranknobumpers);
else
{
INT32 pos = players[tab[i].num].kartstuff[k_position];
INT32 pos = player->kartstuff[k_position];
if (pos < 0 || pos > MAXPLAYERS)
pos = 0;
// Draws the little number over the face
@@ -9135,18 +9138,18 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
#define timestring(time) va("%i'%02i\"%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time))
if (scorelines > 8)
{
if (players[tab[i].num].exiting)
V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(players[tab[i].num].realtime));
else if (players[tab[i].num].pflags & PF_TIMEOVER)
if (player->exiting)
V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(player->realtime));
else if (player->pflags & PF_TIMEOVER)
V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, "NO CONTEST.");
else if (circuitmap)
V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, va("Lap %d", tab[i].count));
}
else
{
if (players[tab[i].num].exiting)
V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[tab[i].num].realtime));
else if (players[tab[i].num].pflags & PF_TIMEOVER)
if (player->exiting)
V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(player->realtime));
else if (player->pflags & PF_TIMEOVER)
V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST.");
else if (circuitmap)
V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count));
+126
View File
@@ -3166,6 +3166,132 @@ char V_GetSkincolorChar(INT32 color)
return cstart;
}
INT32 V_SkinColorToHighlightcolor(skincolors_t color)
{
switch (color)
{
case SKINCOLOR_WHITE:
case SKINCOLOR_SILVER:
case SKINCOLOR_SLATE:
return V_STEELMAP;
case SKINCOLOR_GREY:
case SKINCOLOR_NICKEL:
case SKINCOLOR_BLACK:
case SKINCOLOR_SKUNK:
case SKINCOLOR_JET:
return V_GRAYMAP;
case SKINCOLOR_SEPIA:
case SKINCOLOR_BEIGE:
case SKINCOLOR_WALNUT:
case SKINCOLOR_BROWN:
case SKINCOLOR_LEATHER:
case SKINCOLOR_RUST:
case SKINCOLOR_WRISTWATCH:
return V_BROWNMAP;
case SKINCOLOR_FAIRY:
case SKINCOLOR_SALMON:
case SKINCOLOR_PINK:
case SKINCOLOR_ROSE:
case SKINCOLOR_BRICK:
case SKINCOLOR_LEMONADE:
case SKINCOLOR_BUBBLEGUM:
case SKINCOLOR_LILAC:
return V_PINKMAP;
case SKINCOLOR_CINNAMON:
case SKINCOLOR_RUBY:
case SKINCOLOR_RASPBERRY:
case SKINCOLOR_CHERRY:
case SKINCOLOR_RED:
case SKINCOLOR_CRIMSON:
case SKINCOLOR_MAROON:
case SKINCOLOR_FLAME:
case SKINCOLOR_SCARLET:
case SKINCOLOR_KETCHUP:
return V_REDMAP;
case SKINCOLOR_DAWN:
case SKINCOLOR_SUNSET:
case SKINCOLOR_CREAMSICLE:
case SKINCOLOR_ORANGE:
case SKINCOLOR_PUMPKIN:
case SKINCOLOR_ROSEWOOD:
case SKINCOLOR_BURGUNDY:
case SKINCOLOR_TANGERINE:
return V_ORANGEMAP;
case SKINCOLOR_PEACH:
case SKINCOLOR_CARAMEL:
case SKINCOLOR_CREAM:
return V_PEACHMAP;
case SKINCOLOR_GOLD:
case SKINCOLOR_ROYAL:
case SKINCOLOR_BRONZE:
case SKINCOLOR_COPPER:
case SKINCOLOR_THUNDER:
return V_GOLDMAP;
case SKINCOLOR_POPCORN:
case SKINCOLOR_QUARRY:
case SKINCOLOR_YELLOW:
case SKINCOLOR_MUSTARD:
case SKINCOLOR_CROCODILE:
case SKINCOLOR_OLIVE:
return V_YELLOWMAP;
case SKINCOLOR_ARTICHOKE:
case SKINCOLOR_VOMIT:
case SKINCOLOR_GARDEN:
case SKINCOLOR_TEA:
case SKINCOLOR_PISTACHIO:
return V_TEAMAP;
case SKINCOLOR_LIME:
case SKINCOLOR_HANDHELD:
case SKINCOLOR_MOSS:
case SKINCOLOR_CAMOUFLAGE:
case SKINCOLOR_ROBOHOOD:
case SKINCOLOR_MINT:
case SKINCOLOR_GREEN:
case SKINCOLOR_PINETREE:
case SKINCOLOR_EMERALD:
case SKINCOLOR_SWAMP:
case SKINCOLOR_DREAM:
case SKINCOLOR_PLAGUE:
case SKINCOLOR_ALGAE:
return V_GREENMAP;
case SKINCOLOR_CARIBBEAN:
case SKINCOLOR_AZURE:
case SKINCOLOR_AQUA:
case SKINCOLOR_TEAL:
case SKINCOLOR_CYAN:
case SKINCOLOR_JAWZ:
case SKINCOLOR_CERULEAN:
case SKINCOLOR_NAVY:
case SKINCOLOR_SAPPHIRE:
return V_SKYMAP;
case SKINCOLOR_PIGEON:
case SKINCOLOR_PLATINUM:
case SKINCOLOR_STEEL:
return V_STEELMAP;
case SKINCOLOR_PERIWINKLE:
case SKINCOLOR_BLUE:
case SKINCOLOR_BLUEBERRY:
case SKINCOLOR_NOVA:
return V_BLUEMAP;
case SKINCOLOR_ULTRAVIOLET:
case SKINCOLOR_PURPLE:
case SKINCOLOR_FUCHSIA:
return V_PURPLEMAP;
case SKINCOLOR_PASTEL:
case SKINCOLOR_MOONSLAM:
case SKINCOLOR_DUSK:
case SKINCOLOR_TOXIC:
case SKINCOLOR_MAUVE:
case SKINCOLOR_LAVENDER:
case SKINCOLOR_BYZANTIUM:
case SKINCOLOR_POMEGRANATE:
return V_LAVENDERMAP;
default:
return 0;
}
}
boolean *heatshifter = NULL;
INT32 lastheight = 0;
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
+2
View File
@@ -268,6 +268,8 @@ INT32 V_SubStringLengthToFit(const char *string, INT32 width, INT32 option);
char V_GetSkincolorChar(INT32 color);
INT32 V_SkinColorToHighlightcolor(skincolors_t color);
typedef struct player_s player_t;
void V_DoPostProcessor(INT32 view, INT32 param);
+228 -231
View File
@@ -55,27 +55,8 @@ typedef struct
UINT8 display;
} y_bonus_t;
typedef union
{
struct
{
UINT8 *color[MAXPLAYERS]; // Winner's color #
INT32 *character[MAXPLAYERS]; // Winner's character #
INT32 num[MAXPLAYERS]; // Winner's player #
char *name[MAXPLAYERS]; // Winner's name
INT32 numplayers; // Number of players being displayed
char levelstring[64]; // holds levelnames up to 64 characters
// SRB2kart
UINT8 increase[MAXPLAYERS]; // how much did the score increase by?
UINT8 jitter[MAXPLAYERS]; // wiggle
UINT32 val[MAXPLAYERS]; // Gametype-specific value
UINT8 pos[MAXPLAYERS]; // player positions. used for ties
boolean rankingsmode; // rankings mode
boolean encore; // encore mode
} match;
} y_data;
static y_data_t data;
static y_data data;
// graphics
static patch_t *bgpatch = NULL; // INTERSCR
@@ -159,11 +140,11 @@ static void Y_CompareRace(INT32 i)
UINT32 val = ((players[i].pflags & PF_TIMEOVER || players[i].realtime == UINT32_MAX)
? (UINT32_MAX-1) : players[i].realtime);
if (!(val < data.match.val[data.match.numplayers]))
if (!(val < data.val[data.numplayers]))
return;
data.match.val[data.match.numplayers] = val;
data.match.num[data.match.numplayers] = i;
data.val[data.numplayers] = val;
data.num[data.numplayers] = i;
}
static void Y_CompareBattle(INT32 i)
@@ -171,22 +152,22 @@ static void Y_CompareBattle(INT32 i)
UINT32 val = ((players[i].pflags & PF_TIMEOVER)
? (UINT32_MAX-1) : players[i].marescore);
if (!(data.match.val[data.match.numplayers] == UINT32_MAX
|| (!(players[i].pflags & PF_TIMEOVER) && val > data.match.val[data.match.numplayers])))
if (!(data.val[data.numplayers] == UINT32_MAX
|| (!(players[i].pflags & PF_TIMEOVER) && val > data.val[data.numplayers])))
return;
data.match.val[data.match.numplayers] = val;
data.match.num[data.match.numplayers] = i;
data.val[data.numplayers] = val;
data.num[data.numplayers] = i;
}
static void Y_CompareRank(INT32 i)
{
UINT8 increase = ((data.match.increase[i] == UINT8_MAX) ? 0 : data.match.increase[i]);
if (!(data.match.val[data.match.numplayers] == UINT32_MAX || (players[i].score - increase) > data.match.val[data.match.numplayers]))
UINT8 increase = ((data.increase[i] == UINT8_MAX) ? 0 : data.increase[i]);
if (!(data.val[data.numplayers] == UINT32_MAX || (players[i].score - increase) > data.val[data.numplayers]))
return;
data.match.val[data.match.numplayers] = (players[i].score - increase);
data.match.num[data.match.numplayers] = i;
data.val[data.numplayers] = (players[i].score - increase);
data.num[data.numplayers] = i;
}
static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
@@ -198,10 +179,10 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
// Initialize variables
if (rankingsmode > 1)
;
else if ((data.match.rankingsmode = (boolean)rankingsmode))
else if ((data.rankingsmode = (boolean)rankingsmode))
{
sprintf(data.match.levelstring, "* Total Rankings *");
data.match.encore = false;
sprintf(data.levelstring, "* Total Rankings *");
data.encore = false;
}
else
{
@@ -209,13 +190,13 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
if (mapheaderinfo[prevmap]->levelflags & LF_NOZONE)
{
if (mapheaderinfo[prevmap]->actnum[0])
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
snprintf(data.levelstring,
sizeof data.levelstring,
"* %s %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
snprintf(data.levelstring,
sizeof data.levelstring,
"* %s *",
mapheaderinfo[prevmap]->lvlttl);
}
@@ -223,44 +204,44 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
{
const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "Zone");
if (mapheaderinfo[prevmap]->actnum[0])
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
snprintf(data.levelstring,
sizeof data.levelstring,
"* %s %s %s *",
mapheaderinfo[prevmap]->lvlttl, zonttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
snprintf(data.levelstring,
sizeof data.levelstring,
"* %s %s *",
mapheaderinfo[prevmap]->lvlttl, zonttl);
}
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0';
data.levelstring[sizeof data.levelstring - 1] = '\0';
data.match.encore = encoremode;
data.encore = encoremode;
memset(data.match.jitter, 0, sizeof (data.match.jitter));
memset(data.jitter, 0, sizeof (data.jitter));
}
for (i = 0; i < MAXPLAYERS; i++)
{
data.match.val[i] = UINT32_MAX;
data.val[i] = UINT32_MAX;
if (!playeringame[i] || players[i].spectator)
{
data.match.increase[i] = UINT8_MAX;
data.increase[i] = UINT8_MAX;
continue;
}
if (!rankingsmode)
data.match.increase[i] = UINT8_MAX;
data.increase[i] = UINT8_MAX;
numplayersingame++;
}
memset(data.match.color, 0, sizeof (data.match.color));
memset(data.match.character, 0, sizeof (data.match.character));
memset(data.color, 0, sizeof (data.color));
memset(data.character, 0, sizeof (data.character));
memset(completed, 0, sizeof (completed));
data.match.numplayers = 0;
data.numplayers = 0;
for (j = 0; j < numplayersingame; j++)
{
@@ -274,35 +255,35 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
comparison(i);
}
i = data.match.num[data.match.numplayers];
i = data.num[data.numplayers];
completed[i] = true;
data.match.color[data.match.numplayers] = &players[i].skincolor;
data.match.character[data.match.numplayers] = &players[i].skin;
data.match.name[data.match.numplayers] = player_names[i];
data.color[data.numplayers] = &players[i].skincolor;
data.character[data.numplayers] = &players[i].skin;
data.name[data.numplayers] = player_names[i];
if (data.match.numplayers && (data.match.val[data.match.numplayers] == data.match.val[data.match.numplayers-1]))
data.match.pos[data.match.numplayers] = data.match.pos[data.match.numplayers-1];
if (data.numplayers && (data.val[data.numplayers] == data.val[data.numplayers-1]))
data.pos[data.numplayers] = data.pos[data.numplayers-1];
else
data.match.pos[data.match.numplayers] = data.match.numplayers+1;
data.pos[data.numplayers] = data.numplayers+1;
if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.match.pos[data.match.numplayers] < nump))
if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.pos[data.numplayers] < nump))
{
data.match.increase[i] = nump - data.match.pos[data.match.numplayers];
players[i].score += data.match.increase[i];
data.increase[i] = nump - data.pos[data.numplayers];
players[i].score += data.increase[i];
}
if (demo.recording && !rankingsmode)
G_WriteStanding(
data.match.pos[data.match.numplayers],
data.match.name[data.match.numplayers],
*data.match.character[data.match.numplayers],
*data.match.color[data.match.numplayers],
data.match.val[data.match.numplayers]
data.pos[data.numplayers],
data.name[data.numplayers],
*data.character[data.numplayers],
*data.color[data.numplayers],
data.val[data.numplayers]
);
data.match.numplayers++;
data.numplayers++;
}
}
@@ -333,7 +314,7 @@ static void Y_AnimatedVoteScreenCheck(void)
currentAnimFrame = 0;
INT32 i = 1;
while(!stopSearching)
while (!stopSearching)
{
boolean normalLumpExists = W_LumpExists(va("%sC%d", tmpPrefix, i));
boolean wideLumpExists = W_LumpExists(va("%sW%d", tmpPrefix, i));
@@ -353,6 +334,171 @@ static void Y_AnimatedVoteScreenCheck(void)
}
}
// Y_PlayerStandingsDrawer
//
// Handles drawing the center-of-screen player standings.
//
static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
{
if (standings->numplayers == 0)
{
return;
}
INT32 i;
#define NUMFORNEWCOLUMN 8
INT32 y = 41, gutter = ((standings->numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2));
INT32 dupadjust = cv_betainterscreen.value ? 314 : (vid.width/vid.dupx), duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
const char *timeheader;
if (standings->rankingsmode)
timeheader = "RANK";
else
timeheader = (intertype == int_race ? "TIME" : "SCORE");
// draw the level name
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12, 0, standings->levelstring);
V_DrawFill((x-3) - duptweak, 34, dupadjust-2, 1, 0);
if (standings->encore)
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12-8, hilicol, "ENCORE MODE");
if (standings->numplayers > NUMFORNEWCOLUMN)
{
V_DrawFill(x+156, 24, 1, 158, 0);
V_DrawFill((x-3) - duptweak, 182, dupadjust-2, 1, 0);
V_DrawCenteredString(x+6+(BASEVIDWIDTH/2), 24, hilicol, "#");
V_DrawString(x+36+(BASEVIDWIDTH/2), 24, hilicol, "NAME");
V_DrawRightAlignedString(x+152, 24, hilicol, timeheader);
}
V_DrawCenteredString(x+6, 24, hilicol, "#");
V_DrawString(x+36, 24, hilicol, "NAME");
V_DrawRightAlignedString(x+(BASEVIDWIDTH/2)+152, 24, hilicol, timeheader);
boolean (*_isHighlightedPlayer)(const player_t *) = (demo.playback ? P_IsDisplayPlayer : P_IsLocalPlayer);
for (i = 0; i < standings->numplayers; i++)
{
const UINT8 pnum = standings->num[i];
player_t *player = &players[pnum];
if (pnum == MAXPLAYERS)
;
else if (!playeringame[pnum] || player->spectator)
standings->num[i] = MAXPLAYERS; // this should be the only field setting in this function
else
{
char strtime[MAXPLAYERNAME+1];
const boolean whiteplayer = _isHighlightedPlayer(player);
const INT32 philicol = (whiteplayer ? V_SkinColorToHighlightcolor(player->skincolor) : 0);
// Apply the jitter offset (later reversed)
if (standings->jitter[pnum] > 0)
y--;
V_DrawCenteredString(x+6, y, 0, va("%d", standings->pos[i]));
// localskins are amazing
if (standings->color[i] != SKINCOLOR_NONE)
{
UINT8 *colormap = R_GetTranslationColormap(*standings->character[i], *standings->color[i], GTC_CACHE);
INT32 skinnum = (player->localskin ? (player->localskin - 1) : *standings->character[i]);
patch_t *faceprefix = NULL;
if (!player->skinlocal)
faceprefix = (cv_highresportrait.value ? facewantprefix[skinnum] : facerankprefix[skinnum]);
else
faceprefix = (cv_highresportrait.value ? localfacewantprefix[skinnum] : localfacerankprefix[skinnum]);
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x + 16, y - 4, 0, faceprefix, colormap);
else
V_DrawMappedPatch(x + 16, y - 4, 0, faceprefix, colormap);
}
if (pnum == whiteplayer)
{
UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
}
STRBUFCPY(strtime, standings->name[i]);
if (standings->numplayers > NUMFORNEWCOLUMN)
V_DrawThinString(x+36, y-1, philicol|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
else
V_DrawString(x+36, y, philicol|V_ALLOWLOWERCASE, strtime);
if (standings->rankingsmode)
{
if (standings->increase[pnum] != UINT8_MAX)
{
if (standings->increase[pnum] > 9)
snprintf(strtime, sizeof strtime, "(+%02d)", standings->increase[pnum]);
else
snprintf(strtime, sizeof strtime, "(+ %d)", standings->increase[pnum]);
if (standings->numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+135+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+120+gutter, y, 0, strtime);
}
snprintf(strtime, sizeof strtime, "%d", standings->val[i]);
if (standings->numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+152+gutter, y, 0, strtime);
}
else
{
if (standings->val[i] == (UINT32_MAX-1))
V_DrawRightAlignedThinString(x+152+gutter, y-1, (standings->numplayers > NUMFORNEWCOLUMN ? V_6WIDTHSPACE : 0), "NO CONTEST.");
else
{
if (intertype == int_race)
{
snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(standings->val[i], true),
G_TicsToSeconds(standings->val[i]), G_TicsToCentiseconds(standings->val[i]));
strtime[sizeof strtime - 1] = '\0';
if (standings->numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+152+gutter, y, 0, strtime);
}
else
{
if (standings->numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, va("%i", standings->val[i]));
else
V_DrawRightAlignedString(x+152+gutter, y, 0, va("%i", standings->val[i]));
}
}
}
if (standings->jitter[pnum] > 0)
y++;
}
y += 18;
if (i == NUMFORNEWCOLUMN-1)
{
y = 41;
x += BASEVIDWIDTH/2;
}
#undef NUMFORNEWCOLUMN
}
}
//
// Y_IntermissionDrawer
//
@@ -361,7 +507,7 @@ static void Y_AnimatedVoteScreenCheck(void)
//
void Y_IntermissionDrawer(void)
{
INT32 i, whiteplayer = MAXPLAYERS, x = 4, hilicol = V_YELLOWMAP; // fallback
INT32 x = 4, hilicol = V_YELLOWMAP; // fallback
if (intertype == int_none || rendermode == render_none)
return;
@@ -377,7 +523,7 @@ void Y_IntermissionDrawer(void)
if (rendermode == render_soft)
VID_BlitLinearScreen(screens[1], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
#ifdef HWRENDER
else if(rendermode == render_opengl)
else if (rendermode == render_opengl)
HWR_DrawIntermissionBG();
#endif
}
@@ -385,9 +531,6 @@ void Y_IntermissionDrawer(void)
// Fade everything out
V_DrawFadeScreen(0xFF00, 22);
if (!splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
else if (modeattacking)
@@ -407,152 +550,7 @@ void Y_IntermissionDrawer(void)
}
if (intertype == int_race || intertype == int_match)
{
#define NUMFORNEWCOLUMN 8
INT32 y = 41, gutter = ((data.match.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2));
INT32 dupadjust = cv_betainterscreen.value ? 314 : (vid.width/vid.dupx), duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
const char *timeheader;
if (data.match.rankingsmode)
timeheader = "RANK";
else
timeheader = (intertype == int_race ? "TIME" : "SCORE");
// draw the level name
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12, 0, data.match.levelstring);
V_DrawFill((x-3) - duptweak, 34, dupadjust-2, 1, 0);
if (data.match.encore)
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12-8, hilicol, "ENCORE MODE");
if (data.match.numplayers > NUMFORNEWCOLUMN)
{
V_DrawFill(x+156, 24, 1, 158, 0);
V_DrawFill((x-3) - duptweak, 182, dupadjust-2, 1, 0);
V_DrawCenteredString(x+6+(BASEVIDWIDTH/2), 24, hilicol, "#");
V_DrawString(x+36+(BASEVIDWIDTH/2), 24, hilicol, "NAME");
V_DrawRightAlignedString(x+152, 24, hilicol, timeheader);
}
V_DrawCenteredString(x+6, 24, hilicol, "#");
V_DrawString(x+36, 24, hilicol, "NAME");
V_DrawRightAlignedString(x+(BASEVIDWIDTH/2)+152, 24, hilicol, timeheader);
for (i = 0; i < data.match.numplayers; i++)
{
if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator)
{
char strtime[MAXPLAYERNAME+1];
// Apply the jitter offset (later reversed)
if (data.match.jitter[data.match.num[i]] > 0)
y--;
V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i]));
if (data.match.color[i])
{
UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE);
// i fucking hate this i fucking hate this i hate this so much
if (!players[data.match.num[i]].skinlocal)
{
int skinIndex = players[data.match.num[i]].localskin ? players[data.match.num[i]].localskin - 1 : *data.match.character[i];
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x + 16, y - 4, 0, facewantprefix[skinIndex], colormap);
else
V_DrawMappedPatch(x + 16, y - 4, 0, facerankprefix[skinIndex], colormap);
}
else
{
if (cv_highresportrait.value)
V_DrawSmallMappedPatch(x + 16, y - 4, 0, localfacewantprefix[players[data.match.num[i]].localskin - 1], colormap);
else
V_DrawMappedPatch(x + 16, y - 4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap);
}
}
if (data.match.num[i] == whiteplayer)
{
UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
}
STRBUFCPY(strtime, data.match.name[i]);
if (data.match.numplayers > NUMFORNEWCOLUMN)
V_DrawThinString(x+36, y-1, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
else
V_DrawString(x+36, y, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime);
if (data.match.rankingsmode)
{
if (data.match.increase[data.match.num[i]] != UINT8_MAX)
{
if (data.match.increase[data.match.num[i]] > 9)
snprintf(strtime, sizeof strtime, "(+%02d)", data.match.increase[data.match.num[i]]);
else
snprintf(strtime, sizeof strtime, "(+ %d)", data.match.increase[data.match.num[i]]);
if (data.match.numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+135+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+120+gutter, y, 0, strtime);
}
snprintf(strtime, sizeof strtime, "%d", data.match.val[i]);
if (data.match.numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+152+gutter, y, 0, strtime);
}
else
{
if (data.match.val[i] == (UINT32_MAX-1))
V_DrawRightAlignedThinString(x+152+gutter, y-1, (data.match.numplayers > NUMFORNEWCOLUMN ? V_6WIDTHSPACE : 0), "NO CONTEST.");
else
{
if (intertype == int_race)
{
snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.match.val[i], true),
G_TicsToSeconds(data.match.val[i]), G_TicsToCentiseconds(data.match.val[i]));
strtime[sizeof strtime - 1] = '\0';
if (data.match.numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, strtime);
else
V_DrawRightAlignedString(x+152+gutter, y, 0, strtime);
}
else
{
if (data.match.numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, va("%i", data.match.val[i]));
else
V_DrawRightAlignedString(x+152+gutter, y, 0, va("%i", data.match.val[i]));
}
}
}
if (data.match.jitter[data.match.num[i]] > 0)
y++;
}
else
data.match.num[i] = MAXPLAYERS; // this should be the only field setting in this function
y += 18;
if (i == NUMFORNEWCOLUMN-1)
{
y = 41;
x += BASEVIDWIDTH/2;
}
#undef NUMFORNEWCOLUMN
}
}
Y_PlayerStandingsDrawer(&data, x, hilicol);
if (timer)
{
@@ -564,8 +562,7 @@ void Y_IntermissionDrawer(void)
else
string = va("%s starts in %d", cv_advancemap.string, tickdown);
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol,
string);
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol, string);
}
if ((demo.recording || demo.savemode == DSM_SAVED) && !demo.playback)
@@ -651,9 +648,9 @@ void Y_Ticker(void)
return;
}
if (data.match.rankingsmode && intertic & 1)
if (data.rankingsmode && intertic & 1)
{
memset(data.match.jitter, 0, sizeof (data.match.jitter));
memset(data.jitter, 0, sizeof (data.jitter));
return;
}
@@ -665,24 +662,24 @@ void Y_Ticker(void)
sorttic = intertic + max((cv_inttime.value/2)-2, 2)*TICRATE; // 8 second pause after match results
else if (!(multiplayer && demo.playback)) // Don't advance to rankings in replays
{
if (!data.match.rankingsmode && (intertic >= sorttic + 8))
if (!data.rankingsmode && (intertic >= sorttic + 8))
Y_CalculateMatchData(1, Y_CompareRank);
if (data.match.rankingsmode && intertic > sorttic+16+(2*TICRATE))
if (data.rankingsmode && intertic > sorttic+16+(2*TICRATE))
{
INT32 q=0,r=0;
boolean kaching = true;
for (q = 0; q < data.match.numplayers; q++)
for (q = 0; q < data.numplayers; q++)
{
if (data.match.num[q] == MAXPLAYERS
|| !data.match.increase[data.match.num[q]]
|| data.match.increase[data.match.num[q]] == UINT8_MAX)
if (data.num[q] == MAXPLAYERS
|| !data.increase[data.num[q]]
|| data.increase[data.num[q]] == UINT8_MAX)
continue;
r++;
data.match.jitter[data.match.num[q]] = 1;
if (--data.match.increase[data.match.num[q]])
data.jitter[data.num[q]] = 1;
if (--data.increase[data.num[q]])
kaching = false;
}
+17
View File
@@ -23,6 +23,23 @@ void Y_StartVote(void);
void Y_EndVote(void);
void Y_SetupVoteFinish(SINT8 pick, SINT8 level);
typedef struct
{
UINT8 *color[MAXPLAYERS]; // Winner's color #
INT32 *character[MAXPLAYERS]; // Winner's character #
INT32 num[MAXPLAYERS]; // Winner's player #
char *name[MAXPLAYERS]; // Winner's name
INT32 numplayers; // Number of players being displayed
char levelstring[64]; // holds levelnames up to 64 characters
// SRB2kart
UINT8 increase[MAXPLAYERS]; // how much did the score increase by?
UINT8 jitter[MAXPLAYERS]; // wiggle
UINT32 val[MAXPLAYERS]; // Gametype-specific value
UINT8 pos[MAXPLAYERS]; // player positions. used for ties
boolean rankingsmode; // rankings mode
boolean encore; // encore mode
} y_data_t;
typedef enum
{
int_none,