From 1500d682d296e5ff7ebc0cfb583ac8a3895d3ee4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 14 Aug 2020 01:06:55 -0400 Subject: [PATCH] hu_stuff & y_inter --- src/hardware/hw_draw.c | 10 +- src/hu_stuff.c | 76 +--------- src/hu_stuff.h | 7 +- src/k_hud.c | 2 +- src/k_hud.h | 1 + src/st_stuff.c | 8 +- src/v_video.c | 8 +- src/y_inter.c | 334 ++++++++++++++++------------------------- 8 files changed, 153 insertions(+), 293 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index e3e54693c..7f8c64803 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -216,7 +216,7 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t } } - if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER)) + if (pscale != FRACUNIT || (splitscreen && option & V_SPLITSCREEN)) { fwidth = (float)SHORT(gpatch->width) * fscalew * dupx; fheight = (float)SHORT(gpatch->height) * fscaleh * dupy; @@ -322,7 +322,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal dupx = dupy = (dupx < dupy ? dupx : dupy); fscale = FIXED_TO_FLOAT(pscale); - // fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus... + // fuck it, no GL support for croppedpatch V_SPLITSCREEN right now. it's not like it's accessible to Lua or anything, and we only use it for menus... cy -= (float)SHORT(gpatch->topoffset) * fscale; cx -= (float)SHORT(gpatch->leftoffset) * fscale; @@ -603,7 +603,7 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac // |/ | // 0--1 - if (splitscreen && (color & V_PERPLAYER)) + if (splitscreen && (color & V_SPLITSCREEN)) { fixed_t adjusty = ((color & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; h >>= 1; @@ -1082,7 +1082,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 // |/ | // 0--1 - if (splitscreen && (color & V_PERPLAYER)) + if (splitscreen && (color & V_SPLITSCREEN)) { fixed_t adjusty = ((color & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; h >>= 1; @@ -1231,7 +1231,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) // |/ | // 0--1 - if (splitscreen && (color & V_PERPLAYER)) + if (splitscreen && (color & V_SPLITSCREEN)) { fixed_t adjusty = ((color & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; h >>= 1; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 165735f2d..8e40609f5 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -54,6 +54,7 @@ #include "s_sound.h" // song credits #include "k_kart.h" #include "k_color.h" +#include "k_hud.h" // coords are scaled #define HU_INPUTX 0 @@ -94,17 +95,12 @@ patch_t *tallinfin; // coop hud //------------------------------------------- -patch_t *emeraldpics[3][8]; // 0 = normal, 1 = tiny, 2 = coinbox static patch_t *emblemicon; -patch_t *tokenicon; -static patch_t *exiticon; //------------------------------------------- // misc vars //------------------------------------------- -// crosshair 0 = off, 1 = cross, 2 = angle, 3 = point, see m_menu.c -static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics // song credits static patch_t *songcreditbg; @@ -190,43 +186,7 @@ void HU_LoadGraphics(void) // minus for negative tallnums tallminus = HU_CachePatch("STTMINUS"); - // cache the crosshairs, don't bother to know which one is being used, - // just cache all 3, they're so small anyway. - for (i = 0; i < HU_CROSSHAIRS; i++) - { - crosshair[i] = HU_CachePatch("CROSHAI%c", '1'+i); - } - emblemicon = HU_CachePatch("EMBLICON"); - tokenicon = HU_CachePatch("TOKNICON"); - - emeraldpics[0][0] = W_CachePatchName("CHAOS1", PU_HUDGFX); - emeraldpics[0][1] = W_CachePatchName("CHAOS2", PU_HUDGFX); - emeraldpics[0][2] = W_CachePatchName("CHAOS3", PU_HUDGFX); - emeraldpics[0][3] = W_CachePatchName("CHAOS4", PU_HUDGFX); - emeraldpics[0][4] = W_CachePatchName("CHAOS5", PU_HUDGFX); - emeraldpics[0][5] = W_CachePatchName("CHAOS6", PU_HUDGFX); - emeraldpics[0][6] = W_CachePatchName("CHAOS7", PU_HUDGFX); - emeraldpics[0][7] = W_CachePatchName("CHAOS8", PU_HUDGFX); - - emeraldpics[1][0] = W_CachePatchName("TEMER1", PU_HUDGFX); - emeraldpics[1][1] = W_CachePatchName("TEMER2", PU_HUDGFX); - emeraldpics[1][2] = W_CachePatchName("TEMER3", PU_HUDGFX); - emeraldpics[1][3] = W_CachePatchName("TEMER4", PU_HUDGFX); - emeraldpics[1][4] = W_CachePatchName("TEMER5", PU_HUDGFX); - emeraldpics[1][5] = W_CachePatchName("TEMER6", PU_HUDGFX); - emeraldpics[1][6] = W_CachePatchName("TEMER7", PU_HUDGFX); - //emeraldpics[1][7] = W_CachePatchName("TEMER8", PU_HUDGFX); -- unused - - emeraldpics[2][0] = W_CachePatchName("EMBOX1", PU_HUDGFX); - emeraldpics[2][1] = W_CachePatchName("EMBOX2", PU_HUDGFX); - emeraldpics[2][2] = W_CachePatchName("EMBOX3", PU_HUDGFX); - emeraldpics[2][3] = W_CachePatchName("EMBOX4", PU_HUDGFX); - emeraldpics[2][4] = W_CachePatchName("EMBOX5", PU_HUDGFX); - emeraldpics[2][5] = W_CachePatchName("EMBOX6", PU_HUDGFX); - emeraldpics[2][6] = W_CachePatchName("EMBOX7", PU_HUDGFX); - //emeraldpics[2][7] = W_CachePatchName("EMBOX8", PU_HUDGFX); -- unused - songcreditbg = HU_CachePatch("K_SONGCR"); // cache ping gfx: @@ -914,7 +874,7 @@ void HU_Ticker(void) hu_tick++; hu_tick &= 7; // currently only to blink chat input cursor - if (PLAYER1INPUTDOWN(gc_scores)) + if (PlayerInputDown(1, gc_scores)) hu_showscores = !chat_on; else hu_showscores = false; @@ -1861,7 +1821,7 @@ static void HU_DrawCEcho(void) INT32 y = (BASEVIDHEIGHT/2)-4; INT32 pnumlines = 0; - UINT32 realflags = cechoflags|V_PERPLAYER; // requested as part of splitscreen's stuff + UINT32 realflags = cechoflags|V_SPLITSCREEN; // requested as part of splitscreen's stuff INT32 realalpha = (INT32)((cechoflags & V_ALPHAMASK) >> V_ALPHASHIFT); char *line; @@ -1913,21 +1873,6 @@ static void HU_DrawCEcho(void) --cechotimer; } -static void HU_drawGametype(void) -{ - const char *strvalue = NULL; - - if (gametype < 0 || gametype >= gametypecount) - return; // not a valid gametype??? - - strvalue = Gametype_Names[gametype]; - - if (splitscreen) - V_DrawString(4, 184, 0, strvalue); - else - V_DrawString(4, 192, 0, strvalue); -} - // // demo info stuff // @@ -2345,19 +2290,6 @@ static void HU_DrawRankings(void) else V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue); - if (G_GametypeHasTeams()) - { - p = bmatcico; - - V_DrawSmallScaledPatch(128 - SHORT(p->width)/4, 4, 0, p); - V_DrawCenteredString(128, 16, 0, va("%u", bluescore)); - - p = rmatcico; - - V_DrawSmallScaledPatch(192 - SHORT(p->width)/4, 4, 0, p); - V_DrawCenteredString(192, 16, 0, va("%u", redscore)); - } - if (gametyperules & (GTR_TIMELIMIT|GTR_POINTLIMIT)) { if ((gametyperules & GTR_TIMELIMIT) && cv_timelimit.value && timelimitintics > 0) @@ -2459,7 +2391,7 @@ static void HU_DrawRankings(void) #endif } - HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol); + K_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol); // draw spectators in a ticker across the bottom if (netgame && G_GametypeHasSpectators()) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index b7d510f89..afbbe7b73 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -60,8 +60,6 @@ enum }; #undef X -#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init(); - extern char *shiftxform; // english translation shift table extern char english_shiftxform[]; @@ -107,7 +105,6 @@ extern patch_t *bmatcico; extern patch_t *tagico; extern patch_t *tallminus; extern patch_t *tallinfin; -extern patch_t *tokenicon; // set true whenever the tab rankings are being shown for any reason extern boolean hu_showscores; @@ -130,10 +127,8 @@ void HU_Drawer(void); char HU_dequeueChatChar(void); void HU_Erase(void); void HU_clearChatChars(void); -void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags); // Lat': Ping drawer for scoreboard. +void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping drawer for scoreboard. void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); -void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer); -void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds); INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]); diff --git a/src/k_hud.c b/src/k_hud.c index 4ceb24dd9..d9c87ecd9 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1653,7 +1653,7 @@ 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 K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol) { static tic_t alagles_timer = 9; INT32 i, rightoffset = 240; diff --git a/src/k_hud.h b/src/k_hud.h index 27f21bd23..0c205990e 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -24,5 +24,6 @@ void K_LoadKartHUDGraphics(void); void K_drawKartHUD(void); void K_drawKartFreePlay(UINT32 flashtime); void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode); +void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol); #endif diff --git a/src/st_stuff.c b/src/st_stuff.c index ba0e8b030..5eb56ce21 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -791,13 +791,13 @@ void ST_drawTitleCard(void) else V_DrawMappedPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat, colormap); } - V_DrawLevelActNum(ttlnumxpos + ttlscroll, 104, V_PERPLAYER, actnum); + V_DrawLevelActNum(ttlnumxpos + ttlscroll, 104, V_SPLITSCREEN, actnum); } - V_DrawLevelTitle(lvlttlxpos - ttlscroll, 80, V_PERPLAYER, lvlttl); + V_DrawLevelTitle(lvlttlxpos - ttlscroll, 80, V_SPLITSCREEN, lvlttl); if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) - V_DrawLevelTitle(zonexpos + ttlscroll, 104, V_PERPLAYER, M_GetText("Zone")); - V_DrawCenteredString(subttlxpos - ttlscroll, 135, V_PERPLAYER|V_ALLOWLOWERCASE, subttl); + V_DrawLevelTitle(zonexpos + ttlscroll, 104, V_SPLITSCREEN, M_GetText("Zone")); + V_DrawCenteredString(subttlxpos - ttlscroll, 135, V_SPLITSCREEN|V_ALLOWLOWERCASE, subttl); lt_lasttic = lt_ticker; diff --git a/src/v_video.c b/src/v_video.c index a4adb8c57..d03f8aca7 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -825,7 +825,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ y -= FixedMul(SHORT(patch->topoffset)<leftoffset)<>= 1; @@ -1060,7 +1060,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) } #endif - if (splitscreen && (c & V_PERPLAYER)) + if (splitscreen && (c & V_SPLITSCREEN)) { fixed_t adjusty = ((c & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)>>1; h >>= 1; @@ -1246,7 +1246,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) return; // invis } - if (splitscreen && (c & V_PERPLAYER)) + if (splitscreen && (c & V_SPLITSCREEN)) { fixed_t adjusty = ((c & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)>>1; h >>= 1; @@ -1511,7 +1511,7 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U } #endif - if (splitscreen && (c & V_PERPLAYER)) + if (splitscreen && (c & V_SPLITSCREEN)) { fixed_t adjusty = ((c & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)>>1; h >>= 1; diff --git a/src/y_inter.c b/src/y_inter.c index 915fe7d96..0bf53bf45 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -40,11 +40,10 @@ #include "lua_hud.h" #include "m_random.h" // M_RandomKey -#include "g_input.h" // PLAYER1INPUTDOWN +#include "g_input.h" // PlayerInputDown #include "k_battle.h" #include "k_pwrlv.h" #include "console.h" // cons_menuhighlight -#include "lua_hook.h" // IntermissionThinker hook #include "k_grandprix.h" #ifdef HWRENDER @@ -60,34 +59,31 @@ typedef struct typedef union { + INT32 *character[MAXPLAYERS]; // Winner's character # + UINT16 *color[MAXPLAYERS]; // Winner's color # + SINT8 num[MAXPLAYERS]; // Winner's player # + char *name[MAXPLAYERS]; // Winner's name - struct - { - UINT8 *color[MAXPLAYERS]; // Winner's color # - } coop; + UINT8 numplayers; // Number of players being displayed + char levelstring[64]; // holds levelnames up to 64 characters - struct - { - 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 - INT16 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; + // SRB2kart + INT16 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; static y_data data; // graphics static patch_t *bgpatch = NULL; // INTERSCR +static patch_t *widebgpatch = NULL; static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK static patch_t *interpic = NULL; // custom picture defined in map header static boolean usetile; @@ -111,7 +107,6 @@ static boolean safetorender = true; static y_buffer_t *y_buffer; static INT32 intertic; -static INT32 tallydonetic = -1; static INT32 endtic = -1; static INT32 sorttic = -1; @@ -175,11 +170,11 @@ static void Y_CompareTime(INT32 i) UINT32 val = ((players[i].pflags & PF_GAMETYPEOVER || 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_CompareScore(INT32 i) @@ -187,17 +182,17 @@ static void Y_CompareScore(INT32 i) UINT32 val = ((players[i].pflags & PF_GAMETYPEOVER) ? (UINT32_MAX-1) : players[i].marescore); - if (!(data.match.val[data.match.numplayers] == UINT32_MAX - || (!(players[i].pflags & PF_GAMETYPEOVER) && val > data.match.val[data.match.numplayers]))) + if (!(data.val[data.numplayers] == UINT32_MAX + || (!(players[i].pflags & PF_GAMETYPEOVER) && 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) { - INT16 increase = ((data.match.increase[i] == INT16_MIN) ? 0 : data.match.increase[i]); + INT16 increase = ((data.increase[i] == INT16_MIN) ? 0 : data.increase[i]); UINT32 score = players[i].score; if (powertype != PWRLV_DISABLED) @@ -205,11 +200,11 @@ static void Y_CompareRank(INT32 i) score = clientpowerlevels[i][powertype]; } - if (!(data.match.val[data.match.numplayers] == UINT32_MAX || (score - increase) > data.match.val[data.match.numplayers])) + if (!(data.val[data.numplayers] == UINT32_MAX || (score - increase) > data.val[data.numplayers])) return; - data.match.val[data.match.numplayers] = (score - increase); - data.match.num[data.match.numplayers] = i; + data.val[data.numplayers] = (score - increase); + data.num[data.numplayers] = i; } static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) @@ -221,10 +216,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 { @@ -232,13 +227,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 %d *", 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); } @@ -246,47 +241,47 @@ 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 %d *", 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 (nospectategrief[i] != -1) numgriefers++; if (!playeringame[i] || players[i].spectator) { - data.match.increase[i] = INT16_MIN; + data.increase[i] = INT16_MIN; continue; } if (!rankingsmode) - data.match.increase[i] = INT16_MIN; + data.increase[i] = INT16_MIN; 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++) { @@ -298,45 +293,45 @@ 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])) + if (data.numplayers && (data.val[data.numplayers] == data.val[data.numplayers-1])) { - data.match.pos[data.match.numplayers] = data.match.pos[data.match.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 ((powertype == PWRLV_DISABLED) && (!rankingsmode) && !(players[i].pflags & PF_GAMETYPEOVER) - && (data.match.pos[data.match.numplayers] < (numplayersingame + numgriefers))) + && (data.pos[data.numplayers] < (numplayersingame + numgriefers))) { // Online rank is handled further below in this file. - data.match.increase[i] = K_CalculateGPRankPoints(data.match.pos[data.match.numplayers], numplayersingame + numgriefers); - players[i].score += data.match.increase[i]; + data.increase[i] = K_CalculateGPRankPoints(data.pos[data.numplayers], numplayersingame + numgriefers); + 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++; } } @@ -423,6 +418,7 @@ void Y_CleanupScreenBuffer(void) Z_Free(y_buffer); y_buffer = NULL; +} // // Y_IntermissionDrawer @@ -516,12 +512,12 @@ dontdrawbg: if (intertype == int_race || intertype == int_battle) { #define NUMFORNEWCOLUMN 8 - INT32 y = 41, gutter = ((data.match.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2)); + INT32 y = 41, gutter = ((data.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2)); INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2; const char *timeheader; int y2; - if (data.match.rankingsmode) + if (data.rankingsmode) { if (powertype == PWRLV_DISABLED) { @@ -554,13 +550,13 @@ dontdrawbg: } // draw the level name - V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12, 0, data.match.levelstring); + V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12, 0, data.levelstring); V_DrawFill((x-3) - duptweak, 34, dupadjust-2, 1, 0); - if (data.match.encore) + if (data.encore) V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 12-8, hilicol, "ENCORE MODE"); - if (data.match.numplayers > NUMFORNEWCOLUMN) + if (data.numplayers > NUMFORNEWCOLUMN) { V_DrawFill(x+156, 24, 1, 158, 0); V_DrawFill((x-3) - duptweak, 182, dupadjust-2, 1, 0); @@ -576,37 +572,37 @@ dontdrawbg: V_DrawRightAlignedString(x+(BASEVIDWIDTH/2)+152, 24, hilicol, timeheader); - for (i = 0; i < data.match.numplayers; i++) + for (i = 0; i < data.numplayers; i++) { - boolean dojitter = data.match.jitter[data.match.num[i]]; - data.match.jitter[data.match.num[i]] = 0; + boolean dojitter = data.jitter[data.num[i]]; + data.jitter[data.num[i]] = 0; - if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator) + if (data.num[i] != MAXPLAYERS && playeringame[data.num[i]] && !players[data.num[i]].spectator) { char strtime[MAXPLAYERNAME+1]; if (dojitter) y--; - V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i])); + V_DrawCenteredString(x+6, y, 0, va("%d", data.pos[i])); - if (data.match.color[i]) + if (data.color[i]) { - UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE); - V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap); + UINT8 *colormap = R_GetTranslationColormap(*data.character[i], *data.color[i], GTC_CACHE); + V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.character[i]], colormap); } - if (data.match.num[i] == whiteplayer) + if (data.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]); + STRBUFCPY(strtime, data.name[i]); y2 = y; - if (netgame && playerconsole[data.match.num[i]] == 0 && server_lagless && !players[data.match.num[i]].bot) + if (netgame && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot) { static int alagles_timer = 0; patch_t *alagles; @@ -635,61 +631,61 @@ dontdrawbg: y2 += SHORT (alagles->height) + 1; } - if (data.match.numplayers > NUMFORNEWCOLUMN) - V_DrawThinString(x+36, y2-1, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); + if (data.numplayers > NUMFORNEWCOLUMN) + V_DrawThinString(x+36, y2-1, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime); else - V_DrawString(x+36, y2, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime); + V_DrawString(x+36, y2, ((data.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime); - if (data.match.rankingsmode) + if (data.rankingsmode) { - if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.match.num[i]][powertype]) + if (powertype != PWRLV_DISABLED && !clientpowerlevels[data.num[i]][powertype]) { // No power level (splitscreen guests) STRBUFCPY(strtime, "----"); } else { - if (data.match.increase[data.match.num[i]] != INT16_MIN) + if (data.increase[data.num[i]] != INT16_MIN) { - snprintf(strtime, sizeof strtime, "(%d)", data.match.increase[data.match.num[i]]); + snprintf(strtime, sizeof strtime, "(%d)", data.increase[data.num[i]]); - if (data.match.numplayers > NUMFORNEWCOLUMN) + if (data.numplayers > NUMFORNEWCOLUMN) V_DrawRightAlignedThinString(x+133+gutter, y-1, V_6WIDTHSPACE, strtime); else V_DrawRightAlignedString(x+118+gutter, y, 0, strtime); } - snprintf(strtime, sizeof strtime, "%d", data.match.val[i]); + snprintf(strtime, sizeof strtime, "%d", data.val[i]); } - if (data.match.numplayers > NUMFORNEWCOLUMN) + if (data.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."); + if (data.val[i] == (UINT32_MAX-1)) + V_DrawRightAlignedThinString(x+152+gutter, y-1, (data.numplayers > NUMFORNEWCOLUMN ? V_6WIDTHSPACE : 0), "NO CONTEST."); else { if (intertype == int_race || (intertype == int_battle && battlecapsules)) { - 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])); + snprintf(strtime, sizeof strtime, "%i'%02i\"%02i", G_TicsToMinutes(data.val[i], true), + G_TicsToSeconds(data.val[i]), G_TicsToCentiseconds(data.val[i])); strtime[sizeof strtime - 1] = '\0'; - if (data.match.numplayers > NUMFORNEWCOLUMN) + if (data.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])); + if (data.numplayers > NUMFORNEWCOLUMN) + V_DrawRightAlignedThinString(x+152+gutter, y-1, V_6WIDTHSPACE, va("%i", data.val[i])); else - V_DrawRightAlignedString(x+152+gutter, y, 0, va("%i", data.match.val[i])); + V_DrawRightAlignedString(x+152+gutter, y, 0, va("%i", data.val[i])); } } } @@ -698,7 +694,7 @@ dontdrawbg: y++; } else - data.match.num[i] = MAXPLAYERS; // this should be the only field setting in this function + data.num[i] = MAXPLAYERS; // this should be the only field setting in this function y += 18; @@ -821,59 +817,59 @@ void Y_Ticker(void) { 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]] == INT16_MIN) + if (data.num[q] == MAXPLAYERS + || !data.increase[data.num[q]] + || data.increase[data.num[q]] == INT16_MIN) { continue; } r++; - data.match.jitter[data.match.num[q]] = 1; + data.jitter[data.num[q]] = 1; if (powertype != PWRLV_DISABLED) { // Power Levels - if (abs(data.match.increase[data.match.num[q]]) < 10) + if (abs(data.increase[data.num[q]]) < 10) { // Not a lot of point increase left, just set to 0 instantly - data.match.increase[data.match.num[q]] = 0; + data.increase[data.num[q]] = 0; } else { SINT8 remove = 0; // default (should not happen) - if (data.match.increase[data.match.num[q]] < 0) + if (data.increase[data.num[q]] < 0) remove = -10; - else if (data.match.increase[data.match.num[q]] > 0) + else if (data.increase[data.num[q]] > 0) remove = 10; // Remove 10 points at a time - data.match.increase[data.match.num[q]] -= remove; + data.increase[data.num[q]] -= remove; // Still not zero, no kaching yet - if (data.match.increase[data.match.num[q]] != 0) + if (data.increase[data.num[q]] != 0) kaching = false; } } else { // Basic bitch points - if (data.match.increase[data.match.num[q]]) + if (data.increase[data.num[q]]) { - if (--data.match.increase[data.match.num[q]]) + if (--data.increase[data.num[q]]) kaching = false; } } @@ -890,29 +886,6 @@ void Y_Ticker(void) } else if (!(intertic & 1)) S_StartSound(NULL, sfx_ptally); // tally sound effect - - if (data.spec.gotlife > 0 && (skip == true || data.spec.score % 50000 < oldscore % 50000)) // just passed a 50000 point mark - { - // lives are already added since tally is fake, but play the music - P_PlayLivesJingle(NULL); - --data.spec.gotlife; - } - } - else if (intertype == int_battle || intertype == int_ctf || intertype == int_teammatch) // match - { - if (!intertic) // first time only - S_ChangeMusicInternal("_inter", true); // loop it - - // If a player has left or joined, recalculate scores. - if (data.match.numplayers != D_NumPlayers()) - Y_CalculateMatchWinners(); - } - else if (intertype == int_race || intertype == int_comp) // race - { - if (!intertic) // first time only - S_ChangeMusicInternal("_inter", true); // loop it - - // Don't bother recalcing for race. It doesn't make as much sense. } } @@ -946,7 +919,7 @@ static void K_UpdatePowerLevels(void) UINT16 theirpower = PWRLVRECORD_DEF; INT16 diff = 0; // Loser PWR.LV - Winner PWR.LV INT16 inc = 0; // Total pt increment - UINT8 ipnum = data.match.num[i]; + UINT8 ipnum = data.num[i]; UINT8 jpnum; CONS_Debug(DBG_GAMELOGIC, "Power Level Gain for player %d:\n", ipnum); @@ -961,14 +934,14 @@ static void K_UpdatePowerLevels(void) { boolean won = false; - jpnum = data.match.num[j]; + jpnum = data.num[j]; if (i == j || ipnum == jpnum) // Same person continue; CONS_Debug(DBG_GAMELOGIC, "Player %d VS Player %d:\n", ipnum, jpnum); - if (data.match.val[i] == data.match.val[j]) // Tie -- neither get any points for this match up. + if (data.val[i] == data.val[j]) // Tie -- neither get any points for this match up. { CONS_Debug(DBG_GAMELOGIC, "TIE, no change.\n"); continue; @@ -983,12 +956,12 @@ static void K_UpdatePowerLevels(void) if ((gametyperules & GTR_CIRCUIT)) { - if (data.match.val[i] < data.match.val[j]) + if (data.val[i] < data.val[j]) won = true; } else { - if (data.match.val[i] > data.match.val[j]) + if (data.val[i] > data.val[j]) won = true; } @@ -1033,7 +1006,7 @@ static void K_UpdatePowerLevels(void) if (inc == 0) { - data.match.increase[ipnum] = INT16_MIN; + data.increase[ipnum] = INT16_MIN; CONS_Debug(DBG_GAMELOGIC, "Total Result: No increment, no change.\n"); continue; } @@ -1053,8 +1026,8 @@ static void K_UpdatePowerLevels(void) if (increment[i] == 0) continue; - data.match.increase[i] = increment[i]; - clientpowerlevels[i][powertype] += data.match.increase[i]; + data.increase[i] = increment[i]; + clientpowerlevels[i][powertype] += data.increase[i]; if (i == consoleplayer) { @@ -1107,21 +1080,6 @@ void Y_StartIntermission(void) if (!multiplayer) { timer = 20*TICRATE; - - if (!majormods && !multiplayer && !demo.playback) // move this once we have a proper time attack screen - { - // Update visitation flags - mapvisited[gamemap-1] |= MV_BEATEN; - if (ALL7EMERALDS(emeralds)) - mapvisited[gamemap-1] |= MV_ALLEMERALDS; - /*if (ultimatemode) - mapvisited[gamemap-1] |= MV_ULTIMATE; - if (data.coop.gotperfbonus) - mapvisited[gamemap-1] |= MV_PERFECT;*/ - - if (modeattacking) - Y_UpdateRecordReplays(); - } } else { @@ -1222,6 +1180,7 @@ static void Y_FollowIntermission(void) } #define UNLOAD(x) Z_ChangeTag(x, PU_CACHE); x = NULL +#define CLEANUP(x) x = NULL; // // Y_UnloadData @@ -1238,34 +1197,15 @@ static void Y_UnloadData(void) UNLOAD(widebgpatch); UNLOAD(bgtile); UNLOAD(interpic); +} - /*switch (intertype) - { - case int_coop: - // unload the coop and single player patches - UNLOAD(data.coop.ttlnum); - UNLOAD(data.coop.bonuspatches[3]); - UNLOAD(data.coop.bonuspatches[2]); - UNLOAD(data.coop.bonuspatches[1]); - UNLOAD(data.coop.bonuspatches[0]); - UNLOAD(data.coop.ptotal); - break; - case int_spec: - // unload the special stage patches - //UNLOAD(data.spec.cemerald); - //UNLOAD(data.spec.nowsuper); - UNLOAD(data.spec.bonuspatch); - UNLOAD(data.spec.pscore); - UNLOAD(data.spec.pcontinues); - break; - case int_battle: - case int_race: - default: - //without this default, - //int_none, int_tag, int_chaos, and int_classicrace - //are not handled - break; - }*/ +static void Y_CleanupData(void) +{ + // unload the background patches + CLEANUP(bgpatch); + CLEANUP(widebgpatch); + CLEANUP(bgtile); + CLEANUP(interpic); } // SRB2Kart: Voting! @@ -1700,7 +1640,7 @@ void Y_VoteTicker(void) && !voteclient.playerinfo[i].delay && pickedvote == -1 && votes[p] == -1) { - if (PlayerInputDown(i+1, gc_aimforward) || PlayerJoyAxis(i+1. AXISAIM) < 0) + if (PlayerInputDown(i+1, gc_aimforward) || PlayerJoyAxis(i+1, AXISAIM) < 0) { voteclient.playerinfo[i].selection--; pressed = true; @@ -1983,14 +1923,6 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) else S_ChangeMusicInternal("voteea", true); } -} - -static void Y_CleanupData(void) -{ - // unload the background patches - CLEANUP(bgpatch); - CLEANUP(bgtile); - CLEANUP(interpic); deferredlevel = level; pickedvote = pick;