mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
d30bf6768e
7 changed files with 279 additions and 183 deletions
|
@ -82,9 +82,7 @@ CVAR (Int, sb_deathmatch_otherplayercolor, CR_GREY, CVAR_ARCHIVE)
|
|||
CVAR (Bool, sb_teamdeathmatch_enable, true, CVAR_ARCHIVE)
|
||||
CVAR (Int, sb_teamdeathmatch_headingcolor, CR_RED, CVAR_ARCHIVE)
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
||||
int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
||||
{
|
||||
// Compare first be frags/kills, then by name.
|
||||
player_t *p1 = *(player_t **)arg1;
|
||||
|
@ -99,7 +97,7 @@ static int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
|||
return diff;
|
||||
}
|
||||
|
||||
static int STACK_ARGS compareteams (const void *arg1, const void *arg2)
|
||||
int STACK_ARGS compareteams (const void *arg1, const void *arg2)
|
||||
{
|
||||
// Compare first by teams, then by frags, then by name.
|
||||
player_t *p1 = *(player_t **)arg1;
|
||||
|
@ -118,6 +116,8 @@ static int STACK_ARGS compareteams (const void *arg1, const void *arg2)
|
|||
return diff;
|
||||
}
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
//==========================================================================
|
||||
|
@ -247,7 +247,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||
ypadding = (lineheight - height + 1) / 2;
|
||||
|
||||
bottom = gamestate != GS_INTERMISSION ? ST_Y : SCREENHEIGHT;
|
||||
bottom = ST_Y;
|
||||
y = MAX(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2);
|
||||
|
||||
HU_DrawTimeRemaining (bottom - height);
|
||||
|
@ -255,10 +255,6 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
if (teamplay && deathmatch)
|
||||
{
|
||||
y -= (BigFont->GetHeight() + 8) * CleanYfac;
|
||||
if (gamestate == GS_INTERMISSION)
|
||||
{
|
||||
y = MAX(BigFont->GetHeight() * 4, y);
|
||||
}
|
||||
|
||||
for (i = 0; i < Teams.Size (); i++)
|
||||
{
|
||||
|
|
|
@ -50,4 +50,9 @@ void HU_GetPlayerWidths(int &maxnamewidth, int &maxscorewidth, int &maxiconheigh
|
|||
void HU_DrawColorBar(int x, int y, int height, int playernum);
|
||||
int HU_GetRowColor(player_t *player, bool hightlight);
|
||||
|
||||
// Sorting routines
|
||||
|
||||
int comparepoints(const void *arg1, const void *arg2);
|
||||
int compareteams(const void *arg1, const void *arg2);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -500,6 +500,7 @@ void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
|
|||
|
||||
void P_DelSector_List();
|
||||
void P_DelSeclist(msecnode_t *); // phares 3/16/98
|
||||
msecnode_t* P_DelSecnode(msecnode_t *);
|
||||
void P_CreateSecNodeList(AActor*,fixed_t,fixed_t); // phares 3/14/98
|
||||
int P_GetMoveFactor(const AActor *mo, int *frictionp); // phares 3/6/98
|
||||
int P_GetFriction(const AActor *mo, int *frictionfactor);
|
||||
|
|
|
@ -2742,25 +2742,11 @@ void P_UnPredictPlayer ()
|
|||
act->UnlinkFromWorld();
|
||||
memcpy(&act->x, PredictionActorBackup, sizeof(AActor)-((BYTE *)&act->x - (BYTE *)act));
|
||||
|
||||
// Make the sector_list match the player's touching_sectorlist before it got predicted.
|
||||
P_DelSeclist(sector_list);
|
||||
sector_list = NULL;
|
||||
for (i = PredictionTouchingSectorsBackup.Size(); i-- > 0;)
|
||||
{
|
||||
sector_list = P_AddSecnode(PredictionTouchingSectorsBackup[i], act, sector_list);
|
||||
}
|
||||
|
||||
// The blockmap ordering needs to remain unchanged, too. Right now, act has the right
|
||||
// pointers, so temporarily set its MF_NOBLOCKMAP flag so that LinkToWorld() does not
|
||||
// mess with them.
|
||||
{
|
||||
DWORD keepflags = act->flags;
|
||||
act->flags |= MF_NOBLOCKMAP;
|
||||
act->LinkToWorld();
|
||||
act->flags = keepflags;
|
||||
}
|
||||
|
||||
// Restore sector links.
|
||||
// The blockmap ordering needs to remain unchanged, too.
|
||||
// Restore sector links and refrences.
|
||||
// [ED850] This is somewhat of a duplicate of LinkToWorld(), but we need to keep every thing the same,
|
||||
// otherwise we end up fixing bugs in blockmap logic (i.e undefined behaviour with polyobject collisions),
|
||||
// which we really don't want to do here.
|
||||
if (!(act->flags & MF_NOSECTOR))
|
||||
{
|
||||
sector_t *sec = act->Sector;
|
||||
|
@ -2781,6 +2767,39 @@ void P_UnPredictPlayer ()
|
|||
*link = me;
|
||||
}
|
||||
|
||||
// Destroy old refrences
|
||||
msecnode_t *node = sector_list;
|
||||
while (node)
|
||||
{
|
||||
node->m_thing = NULL;
|
||||
node = node->m_tnext;
|
||||
}
|
||||
|
||||
// Make the sector_list match the player's touching_sectorlist before it got predicted.
|
||||
P_DelSeclist(sector_list);
|
||||
sector_list = NULL;
|
||||
for (i = PredictionTouchingSectorsBackup.Size(); i-- > 0;)
|
||||
{
|
||||
sector_list = P_AddSecnode(PredictionTouchingSectorsBackup[i], act, sector_list);
|
||||
}
|
||||
act->touching_sectorlist = sector_list; // Attach to thing
|
||||
sector_list = NULL; // clear for next time
|
||||
|
||||
node = sector_list;
|
||||
while (node)
|
||||
{
|
||||
if (node->m_thing == NULL)
|
||||
{
|
||||
if (node == sector_list)
|
||||
sector_list = node->m_tnext;
|
||||
node = P_DelSecnode(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = node->m_tnext;
|
||||
}
|
||||
}
|
||||
|
||||
msecnode_t *snode;
|
||||
|
||||
// Restore sector thinglist order
|
||||
|
|
361
src/wi_stuff.cpp
361
src/wi_stuff.cpp
|
@ -45,6 +45,7 @@
|
|||
#include "v_text.h"
|
||||
#include "gi.h"
|
||||
#include "d_player.h"
|
||||
#include "d_netinf.h"
|
||||
#include "b_bot.h"
|
||||
#include "textures/textures.h"
|
||||
#include "r_data/r_translate.h"
|
||||
|
@ -63,6 +64,7 @@ typedef enum
|
|||
CVAR (Bool, wi_percents, true, CVAR_ARCHIVE)
|
||||
CVAR (Bool, wi_showtotaltime, true, CVAR_ARCHIVE)
|
||||
CVAR (Bool, wi_noautostartmap, false, CVAR_USERINFO|CVAR_ARCHIVE)
|
||||
CVAR (Int, wi_autoadvance, 0, CVAR_SERVERINFO)
|
||||
|
||||
|
||||
void WI_loadData ();
|
||||
|
@ -190,6 +192,7 @@ static TArray<in_anim_t> anims;
|
|||
#define SHOWNEXTLOCDELAY 4 // in seconds
|
||||
|
||||
static int acceleratestage; // used to accelerate or skip a stage
|
||||
static bool playerready[MAXPLAYERS];
|
||||
static int me; // wbs->pnum
|
||||
static stateenum_t state; // specifies current state
|
||||
static wbstartstruct_t *wbs; // contains information passed into intermission
|
||||
|
@ -199,11 +202,17 @@ static int bcnt; // used for timing of background animation
|
|||
static int cnt_kills[MAXPLAYERS];
|
||||
static int cnt_items[MAXPLAYERS];
|
||||
static int cnt_secret[MAXPLAYERS];
|
||||
static int cnt_frags[MAXPLAYERS];
|
||||
static int cnt_deaths[MAXPLAYERS];
|
||||
static int cnt_time;
|
||||
static int cnt_total_time;
|
||||
static int cnt_par;
|
||||
static int cnt_pause;
|
||||
static int total_frags;
|
||||
static int total_deaths;
|
||||
static bool noautostartmap;
|
||||
static int dofrags;
|
||||
static int ng_state;
|
||||
|
||||
//
|
||||
// GRAPHICS
|
||||
|
@ -1105,6 +1114,7 @@ void WI_updateNoState ()
|
|||
else
|
||||
{
|
||||
bool noauto = noautostartmap;
|
||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||
|
||||
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
||||
{
|
||||
|
@ -1113,7 +1123,7 @@ void WI_updateNoState ()
|
|||
noauto |= players[i].userinfo.GetNoAutostartMap();
|
||||
}
|
||||
}
|
||||
if (!noauto)
|
||||
if (!noauto || autoskip)
|
||||
{
|
||||
cnt--;
|
||||
}
|
||||
|
@ -1208,128 +1218,134 @@ int WI_fragSum (int playernum)
|
|||
return frags;
|
||||
}
|
||||
|
||||
static int dm_state;
|
||||
static int dm_frags[MAXPLAYERS][MAXPLAYERS];
|
||||
static int dm_totals[MAXPLAYERS];
|
||||
static int player_deaths[MAXPLAYERS];
|
||||
|
||||
void WI_initDeathmatchStats (void)
|
||||
{
|
||||
|
||||
int i, j;
|
||||
|
||||
state = StatCount;
|
||||
acceleratestage = 0;
|
||||
dm_state = 1;
|
||||
memset(playerready, 0, sizeof(playerready));
|
||||
memset(cnt_frags, 0, sizeof(cnt_frags));
|
||||
memset(cnt_deaths, 0, sizeof(cnt_frags));
|
||||
memset(player_deaths, 0, sizeof(player_deaths));
|
||||
total_frags = 0;
|
||||
total_deaths = 0;
|
||||
|
||||
ng_state = 1;
|
||||
cnt_pause = TICRATE;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
if (playeringame[j])
|
||||
dm_frags[i][j] = 0;
|
||||
|
||||
dm_totals[i] = 0;
|
||||
player_deaths[i] += plrs[j].frags[i];
|
||||
total_deaths += player_deaths[i];
|
||||
total_frags += plrs[i].fragcount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WI_updateDeathmatchStats ()
|
||||
{
|
||||
/*
|
||||
int i, j;
|
||||
|
||||
int i;
|
||||
bool stillticking;
|
||||
*/
|
||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||
|
||||
WI_updateAnimatedBack();
|
||||
|
||||
if (acceleratestage && dm_state != 4)
|
||||
if ((acceleratestage || autoskip) && ng_state != 6)
|
||||
{
|
||||
/*
|
||||
acceleratestage = 0;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
for (i = 0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
||||
if (playeringame[j])
|
||||
dm_frags[i][j] = plrs[i].frags[j];
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
dm_totals[i] = WI_fragSum(i);
|
||||
cnt_frags[i] = plrs[i].fragcount;
|
||||
cnt_deaths[i] = player_deaths[i];
|
||||
}
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||
ng_state = 6;
|
||||
}
|
||||
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||
*/
|
||||
dm_state = 4;
|
||||
}
|
||||
|
||||
|
||||
if (dm_state == 2)
|
||||
if (ng_state == 2)
|
||||
{
|
||||
/*
|
||||
if (!(bcnt&3))
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
|
||||
if (!(bcnt & 3))
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
|
||||
|
||||
stillticking = false;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
for (i = 0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
||||
{
|
||||
if (playeringame[j]
|
||||
&& dm_frags[i][j] != plrs[i].frags[j])
|
||||
{
|
||||
if (plrs[i].frags[j] < 0)
|
||||
dm_frags[i][j]--;
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
cnt_frags[i] += 2;
|
||||
|
||||
if (cnt_frags[i] > plrs[i].fragcount)
|
||||
cnt_frags[i] = plrs[i].fragcount;
|
||||
else
|
||||
dm_frags[i][j]++;
|
||||
|
||||
if (dm_frags[i][j] > 99)
|
||||
dm_frags[i][j] = 99;
|
||||
|
||||
if (dm_frags[i][j] < -99)
|
||||
dm_frags[i][j] = -99;
|
||||
|
||||
stillticking = true;
|
||||
}
|
||||
|
||||
if (!stillticking)
|
||||
{
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||
ng_state++;
|
||||
}
|
||||
dm_totals[i] = WI_fragSum(i);
|
||||
|
||||
if (dm_totals[i] > 99)
|
||||
dm_totals[i] = 99;
|
||||
|
||||
if (dm_totals[i] < -99)
|
||||
dm_totals[i] = -99;
|
||||
}
|
||||
else if (ng_state == 4)
|
||||
{
|
||||
if (!(bcnt & 3))
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
|
||||
|
||||
stillticking = false;
|
||||
|
||||
for (i = 0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
cnt_deaths[i] += 2;
|
||||
if (cnt_deaths[i] > player_deaths[i])
|
||||
cnt_deaths[i] = player_deaths[i];
|
||||
else
|
||||
stillticking = true;
|
||||
}
|
||||
if (!stillticking)
|
||||
{
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||
dm_state++;
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||
ng_state++;
|
||||
}
|
||||
*/
|
||||
dm_state = 3;
|
||||
}
|
||||
else if (dm_state == 4)
|
||||
else if (ng_state == 6)
|
||||
{
|
||||
if (acceleratestage)
|
||||
int i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/pastdmstats", 1, ATTN_NONE);
|
||||
// If the player is in the game and not ready, stop checking
|
||||
if (playeringame[i] && !players[i].isbot && !playerready[i])
|
||||
break;
|
||||
}
|
||||
|
||||
// All players are ready; proceed.
|
||||
if ((i == MAXPLAYERS && acceleratestage) || autoskip)
|
||||
{
|
||||
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/pastdmstats", 1, ATTN_NONE);
|
||||
WI_initShowNextLoc();
|
||||
}
|
||||
}
|
||||
else if (dm_state & 1)
|
||||
else if (ng_state & 1)
|
||||
{
|
||||
if (!--cnt_pause)
|
||||
{
|
||||
dm_state++;
|
||||
ng_state++;
|
||||
cnt_pause = TICRATE;
|
||||
}
|
||||
}
|
||||
|
@ -1339,97 +1355,126 @@ void WI_updateDeathmatchStats ()
|
|||
|
||||
void WI_drawDeathmatchStats ()
|
||||
{
|
||||
int i, pnum, x, y, ypadding, height, lineheight;
|
||||
int maxnamewidth, maxscorewidth, maxiconheight;
|
||||
int pwidth = IntermissionFont->GetCharWidth('%');
|
||||
int icon_x, name_x, frags_x, deaths_x;
|
||||
int deaths_len;
|
||||
float h, s, v, r, g, b;
|
||||
EColorRange color;
|
||||
const char *text_deaths, *text_frags;
|
||||
FTexture *readyico = TexMan.FindTexture("READYICO");
|
||||
player_t *sortedplayers[MAXPLAYERS];
|
||||
|
||||
// draw animated background
|
||||
WI_drawBackground();
|
||||
WI_drawLF();
|
||||
|
||||
// [RH] Draw heads-up scores display
|
||||
HU_DrawScores (&players[me]);
|
||||
y = WI_drawLF();
|
||||
|
||||
/*
|
||||
int i;
|
||||
int j;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight);
|
||||
// Use the readyico height if it's bigger.
|
||||
height = readyico->GetScaledHeight() - readyico->GetScaledTopOffset();
|
||||
maxiconheight = MAX(height, maxiconheight);
|
||||
height = SmallFont->GetHeight() * CleanYfac;
|
||||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||
ypadding = (lineheight - height + 1) / 2;
|
||||
y += CleanYfac;
|
||||
|
||||
int lh; // line height
|
||||
text_deaths = GStrings("SCORE_DEATHS");
|
||||
//text_color = GStrings("SCORE_COLOR");
|
||||
text_frags = GStrings("SCORE_FRAGS");
|
||||
|
||||
lh = WI_SPACINGY;
|
||||
icon_x = 8 * CleanXfac;
|
||||
name_x = icon_x + maxscorewidth * CleanXfac;
|
||||
frags_x = name_x + (maxnamewidth + MAX(SmallFont->StringWidth("XXXXX"), SmallFont->StringWidth(text_frags)) + 8) * CleanXfac;
|
||||
deaths_x = frags_x + ((deaths_len = SmallFont->StringWidth(text_deaths)) + 8) * CleanXfac;
|
||||
|
||||
// draw stat titles (top line)
|
||||
V_DrawPatchClean(DM_TOTALSX-LittleShort(total->width)/2,
|
||||
DM_MATRIXY-WI_SPACINGY+10,
|
||||
&FB,
|
||||
total);
|
||||
x = (SCREENWIDTH - deaths_x) >> 1;
|
||||
icon_x += x;
|
||||
name_x += x;
|
||||
frags_x += x;
|
||||
deaths_x += x;
|
||||
|
||||
V_DrawPatchClean(DM_KILLERSX, DM_KILLERSY, &FB, killers);
|
||||
V_DrawPatchClean(DM_VICTIMSX, DM_VICTIMSY, &FB, victims);
|
||||
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||
|
||||
// draw P?
|
||||
x = DM_MATRIXX + DM_SPACINGX;
|
||||
y = DM_MATRIXY;
|
||||
screen->DrawText(SmallFont, color, name_x, y, GStrings("SCORE_NAME"), DTA_CleanNoMove, true, TAG_DONE);
|
||||
screen->DrawText(SmallFont, color, frags_x - SmallFont->StringWidth(text_frags)*CleanXfac, y, text_frags, DTA_CleanNoMove, true, TAG_DONE);
|
||||
screen->DrawText(SmallFont, color, deaths_x - deaths_len*CleanXfac, y, text_deaths, DTA_CleanNoMove, true, TAG_DONE);
|
||||
y += height + 6 * CleanYfac;
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
// Sort all players
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
V_DrawPatchClean(x-LittleShort(p[i]->width)/2,
|
||||
DM_MATRIXY - WI_SPACINGY,
|
||||
&FB,
|
||||
p[i]);
|
||||
|
||||
V_DrawPatchClean(DM_MATRIXX-LittleShort(p[i]->width)/2,
|
||||
y,
|
||||
&FB,
|
||||
p[i]);
|
||||
|
||||
if (i == me)
|
||||
{
|
||||
V_DrawPatchClean(x-LittleShort(p[i]->width)/2,
|
||||
DM_MATRIXY - WI_SPACINGY,
|
||||
&FB,
|
||||
bstar);
|
||||
|
||||
V_DrawPatchClean(DM_MATRIXX-LittleShort(p[i]->width)/2,
|
||||
y,
|
||||
&FB,
|
||||
star);
|
||||
}
|
||||
}
|
||||
x += DM_SPACINGX;
|
||||
y += WI_SPACINGY;
|
||||
sortedplayers[i] = &players[i];
|
||||
}
|
||||
|
||||
// draw stats
|
||||
y = DM_MATRIXY+10;
|
||||
w = LittleShort(num[0]->width);
|
||||
if (teamplay)
|
||||
qsort(sortedplayers, MAXPLAYERS, sizeof(player_t *), compareteams);
|
||||
else
|
||||
qsort(sortedplayers, MAXPLAYERS, sizeof(player_t *), comparepoints);
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
// Draw lines for each player
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
x = DM_MATRIXX + DM_SPACINGX;
|
||||
player_t *player = sortedplayers[i];
|
||||
pnum = int(player - players);
|
||||
|
||||
if (playeringame[i])
|
||||
{
|
||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
||||
{
|
||||
if (playeringame[j])
|
||||
WI_drawNum(x+w, y, dm_frags[i][j], 2);
|
||||
if (!playeringame[pnum])
|
||||
continue;
|
||||
|
||||
x += DM_SPACINGX;
|
||||
D_GetPlayerColor(pnum, &h, &s, &v, NULL);
|
||||
HSVtoRGB(&r, &g, &b, h, s, v);
|
||||
|
||||
screen->Dim(MAKERGB(clamp(int(r*255.f), 0, 255),
|
||||
clamp(int(g*255.f), 0, 255),
|
||||
clamp(int(b*255.f), 0, 255)), 0.8f, x, y - ypadding, (deaths_x - x) + (8 * CleanXfac), lineheight);
|
||||
|
||||
if (playerready[pnum] || player->isbot) // Bots are automatically assumed ready, to prevent confusion
|
||||
screen->DrawTexture(readyico, x - (readyico->GetWidth() * CleanXfac), y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
|
||||
color = (EColorRange)HU_GetRowColor(player, pnum == consoleplayer);
|
||||
if (player->mo->ScoreIcon.isValid())
|
||||
{
|
||||
FTexture *pic = TexMan[player->mo->ScoreIcon];
|
||||
screen->DrawTexture(pic, icon_x, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
WI_drawNum(DM_TOTALSX+w, y, dm_totals[i], 2);
|
||||
screen->DrawText(SmallFont, color, name_x, y + ypadding, player->userinfo.GetName(), DTA_CleanNoMove, true, TAG_DONE);
|
||||
WI_drawNum(SmallFont, frags_x, y + ypadding, cnt_frags[pnum], 0, false, color);
|
||||
if (ng_state >= 2)
|
||||
{
|
||||
WI_drawNum(SmallFont, deaths_x, y + ypadding, cnt_deaths[pnum], 0, false, color);
|
||||
}
|
||||
y += WI_SPACINGY;
|
||||
y += lineheight + CleanYfac;
|
||||
}
|
||||
*/
|
||||
|
||||
// Draw "TOTAL" line
|
||||
y += height + 3 * CleanYfac;
|
||||
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||
screen->DrawText(SmallFont, color, name_x, y, GStrings("SCORE_TOTAL"), DTA_CleanNoMove, true, TAG_DONE);
|
||||
WI_drawNum(SmallFont, frags_x, y, total_frags, 0, false, color);
|
||||
if (ng_state >= 4)
|
||||
{
|
||||
WI_drawNum(SmallFont, deaths_x, y, total_deaths, 0, false, color);
|
||||
}
|
||||
|
||||
// Draw game time
|
||||
y += height + CleanYfac;
|
||||
|
||||
int seconds = plrs[me].stime / TICRATE;
|
||||
int hours = seconds / 3600;
|
||||
int minutes = (seconds % 3600) / 60;
|
||||
seconds = seconds % 60;
|
||||
|
||||
FString leveltime = GStrings("SCORE_LVLTIME");
|
||||
leveltime += ": ";
|
||||
|
||||
char timer[sizeof "HH:MM:SS"];
|
||||
mysnprintf(timer, sizeof(timer), "%02i:%02i:%02i", hours, minutes, seconds);
|
||||
leveltime += timer;
|
||||
|
||||
screen->DrawText(SmallFont, color, x, y, leveltime, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
|
||||
static int cnt_frags[MAXPLAYERS];
|
||||
static int dofrags;
|
||||
static int ng_state;
|
||||
|
||||
void WI_initNetgameStats ()
|
||||
{
|
||||
|
||||
|
@ -1437,6 +1482,7 @@ void WI_initNetgameStats ()
|
|||
|
||||
state = StatCount;
|
||||
acceleratestage = 0;
|
||||
memset(playerready, 0, sizeof(playerready));
|
||||
ng_state = 1;
|
||||
|
||||
cnt_pause = TICRATE;
|
||||
|
@ -1460,10 +1506,11 @@ void WI_updateNetgameStats ()
|
|||
int i;
|
||||
int fsum;
|
||||
bool stillticking;
|
||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||
|
||||
WI_updateAnimatedBack ();
|
||||
|
||||
if (acceleratestage && ng_state != 10)
|
||||
if ((acceleratestage || autoskip) && ng_state != 10)
|
||||
{
|
||||
acceleratestage = 0;
|
||||
|
||||
|
@ -1587,7 +1634,16 @@ void WI_updateNetgameStats ()
|
|||
}
|
||||
else if (ng_state == 10)
|
||||
{
|
||||
if (acceleratestage)
|
||||
int i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
// If the player is in the game and not ready, stop checking
|
||||
if (playeringame[i] && !players[i].isbot && !playerready[i])
|
||||
break;
|
||||
}
|
||||
|
||||
// All players are ready; proceed.
|
||||
if ((i == MAXPLAYERS && acceleratestage) || autoskip)
|
||||
{
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/pastcoopstats", 1, ATTN_NONE);
|
||||
WI_initShowNextLoc();
|
||||
|
@ -1611,8 +1667,10 @@ void WI_drawNetgameStats ()
|
|||
int icon_x, name_x, kills_x, bonus_x, secret_x;
|
||||
int bonus_len, secret_len;
|
||||
int missed_kills, missed_items, missed_secrets;
|
||||
float h, s, v, r, g, b;
|
||||
EColorRange color;
|
||||
const char *text_bonus, *text_color, *text_secret, *text_kills;
|
||||
const char *text_bonus, *text_secret, *text_kills;
|
||||
FTexture *readyico = TexMan.FindTexture("READYICO");
|
||||
|
||||
// draw animated background
|
||||
WI_drawBackground();
|
||||
|
@ -1620,17 +1678,22 @@ void WI_drawNetgameStats ()
|
|||
y = WI_drawLF();
|
||||
|
||||
HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight);
|
||||
// Use the readyico height if it's bigger.
|
||||
height = readyico->GetScaledHeight() - readyico->GetScaledTopOffset();
|
||||
if (height > maxiconheight)
|
||||
{
|
||||
maxiconheight = height;
|
||||
}
|
||||
height = SmallFont->GetHeight() * CleanYfac;
|
||||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||
ypadding = (lineheight - height + 1) / 2;
|
||||
y += 16*CleanYfac;
|
||||
y += CleanYfac;
|
||||
|
||||
text_bonus = GStrings((gameinfo.gametype & GAME_Raven) ? "SCORE_BONUS" : "SCORE_ITEMS");
|
||||
text_color = GStrings("SCORE_COLOR");
|
||||
text_secret = GStrings("SCORE_SECRET");
|
||||
text_kills = GStrings("SCORE_KILLS");
|
||||
|
||||
icon_x = (SmallFont->StringWidth(text_color) + 8) * CleanXfac;
|
||||
icon_x = 8 * CleanXfac;
|
||||
name_x = icon_x + maxscorewidth * CleanXfac;
|
||||
kills_x = name_x + (maxnamewidth + MAX(SmallFont->StringWidth("XXXXX"), SmallFont->StringWidth(text_kills)) + 8) * CleanXfac;
|
||||
bonus_x = kills_x + ((bonus_len = SmallFont->StringWidth(text_bonus)) + 8) * CleanXfac;
|
||||
|
@ -1645,7 +1708,6 @@ void WI_drawNetgameStats ()
|
|||
|
||||
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||
|
||||
screen->DrawText(SmallFont, color, x, y, text_color, DTA_CleanNoMove, true, TAG_DONE);
|
||||
screen->DrawText(SmallFont, color, name_x, y, GStrings("SCORE_NAME"), DTA_CleanNoMove, true, TAG_DONE);
|
||||
screen->DrawText(SmallFont, color, kills_x - SmallFont->StringWidth(text_kills)*CleanXfac, y, text_kills, DTA_CleanNoMove, true, TAG_DONE);
|
||||
screen->DrawText(SmallFont, color, bonus_x - bonus_len*CleanXfac, y, text_bonus, DTA_CleanNoMove, true, TAG_DONE);
|
||||
|
@ -1665,7 +1727,17 @@ void WI_drawNetgameStats ()
|
|||
continue;
|
||||
|
||||
player = &players[i];
|
||||
HU_DrawColorBar(x, y, lineheight, i);
|
||||
|
||||
D_GetPlayerColor(i, &h, &s, &v, NULL);
|
||||
HSVtoRGB(&r, &g, &b, h, s, v);
|
||||
|
||||
screen->Dim(MAKERGB(clamp(int(r*255.f), 0, 255),
|
||||
clamp(int(g*255.f), 0, 255),
|
||||
clamp(int(b*255.f), 0, 255)), 0.8f, x, y - ypadding, (secret_x - x) + (8 * CleanXfac), lineheight);
|
||||
|
||||
if (playerready[i] || player->isbot) // Bots are automatically assumed ready, to prevent confusion
|
||||
screen->DrawTexture(readyico, x - (readyico->GetWidth() * CleanXfac), y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
|
||||
color = (EColorRange)HU_GetRowColor(player, i == consoleplayer);
|
||||
if (player->mo->ScoreIcon.isValid())
|
||||
{
|
||||
|
@ -1689,7 +1761,7 @@ void WI_drawNetgameStats ()
|
|||
}
|
||||
|
||||
// Draw "MISSED" line
|
||||
y += 5 * CleanYfac;
|
||||
y += 3 * CleanYfac;
|
||||
screen->DrawText(SmallFont, CR_DARKGRAY, name_x, y, GStrings("SCORE_MISSED"), DTA_CleanNoMove, true, TAG_DONE);
|
||||
WI_drawPercent(SmallFont, kills_x, y, missed_kills, wbs->maxkills, false, CR_DARKGRAY);
|
||||
if (ng_state >= 4)
|
||||
|
@ -1702,7 +1774,7 @@ void WI_drawNetgameStats ()
|
|||
}
|
||||
|
||||
// Draw "TOTAL" line
|
||||
y += height + 5 * CleanYfac;
|
||||
y += height + 3 * CleanYfac;
|
||||
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||
screen->DrawText(SmallFont, color, name_x, y, GStrings("SCORE_TOTAL"), DTA_CleanNoMove, true, TAG_DONE);
|
||||
WI_drawNum(SmallFont, kills_x, y, wbs->maxkills, 0, false, color);
|
||||
|
@ -1939,6 +2011,7 @@ void WI_checkForAccelerate(void)
|
|||
== players[i].oldbuttons) && !player->isbot)
|
||||
{
|
||||
acceleratestage = 1;
|
||||
playerready[i] = true;
|
||||
}
|
||||
player->oldbuttons = player->cmd.ucmd.buttons;
|
||||
}
|
||||
|
|
BIN
wadsrc/static/graphics/readyico.png
Normal file
BIN
wadsrc/static/graphics/readyico.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 B |
|
@ -838,8 +838,10 @@ SCORE_SECRET = "SECRET";
|
|||
SCORE_NAME = "NAME";
|
||||
SCORE_KILLS = "KILLS";
|
||||
SCORE_FRAGS = "FRAGS";
|
||||
SCORE_DEATHS = "DEATHS";
|
||||
SCORE_MISSED = "MISSED";
|
||||
SCORE_TOTAL = "TOTAL";
|
||||
SCORE_LVLTIME = "LEVEL TIME";
|
||||
|
||||
// Item tags: Doom weapons
|
||||
TAG_FIST = "Brass Knuckles";
|
||||
|
|
Loading…
Reference in a new issue