mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 16:07:55 +00:00
Merge branch 'master' into Glew_Version_For_Real
This commit is contained in:
commit
6457ced53f
8 changed files with 284 additions and 184 deletions
|
@ -253,7 +253,11 @@ endif( GLEW_INCLUDE_DIR )
|
||||||
# GLEW include directory
|
# GLEW include directory
|
||||||
include_directories( "${GLEW_INCLUDE_DIR}" )
|
include_directories( "${GLEW_INCLUDE_DIR}" )
|
||||||
|
|
||||||
find_library( GLEW_LIBRARY glew32 )
|
if( NOT WIN32 OR APPLE )
|
||||||
|
find_library( GLEW_LIBRARY libGLEW.so )
|
||||||
|
else( NOT WIN32 OR APPLE )
|
||||||
|
find_library( GLEW_LIBRARY glew32 )
|
||||||
|
endif( NOT WIN32 OR APPLE )
|
||||||
|
|
||||||
if( NOT GLEW_LIBRARY )
|
if( NOT GLEW_LIBRARY )
|
||||||
message( SEND_ERROR "Could not find GLEW library files" )
|
message( SEND_ERROR "Could not find GLEW library files" )
|
||||||
|
|
|
@ -82,9 +82,7 @@ CVAR (Int, sb_deathmatch_otherplayercolor, CR_GREY, CVAR_ARCHIVE)
|
||||||
CVAR (Bool, sb_teamdeathmatch_enable, true, CVAR_ARCHIVE)
|
CVAR (Bool, sb_teamdeathmatch_enable, true, CVAR_ARCHIVE)
|
||||||
CVAR (Int, sb_teamdeathmatch_headingcolor, CR_RED, CVAR_ARCHIVE)
|
CVAR (Int, sb_teamdeathmatch_headingcolor, CR_RED, CVAR_ARCHIVE)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
||||||
|
|
||||||
static int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
|
||||||
{
|
{
|
||||||
// Compare first be frags/kills, then by name.
|
// Compare first be frags/kills, then by name.
|
||||||
player_t *p1 = *(player_t **)arg1;
|
player_t *p1 = *(player_t **)arg1;
|
||||||
|
@ -99,7 +97,7 @@ static int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
||||||
return diff;
|
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.
|
// Compare first by teams, then by frags, then by name.
|
||||||
player_t *p1 = *(player_t **)arg1;
|
player_t *p1 = *(player_t **)arg1;
|
||||||
|
@ -118,6 +116,8 @@ static int STACK_ARGS compareteams (const void *arg1, const void *arg2)
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -247,7 +247,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
||||||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||||
ypadding = (lineheight - height + 1) / 2;
|
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);
|
y = MAX(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2);
|
||||||
|
|
||||||
HU_DrawTimeRemaining (bottom - height);
|
HU_DrawTimeRemaining (bottom - height);
|
||||||
|
@ -255,10 +255,6 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
||||||
if (teamplay && deathmatch)
|
if (teamplay && deathmatch)
|
||||||
{
|
{
|
||||||
y -= (BigFont->GetHeight() + 8) * CleanYfac;
|
y -= (BigFont->GetHeight() + 8) * CleanYfac;
|
||||||
if (gamestate == GS_INTERMISSION)
|
|
||||||
{
|
|
||||||
y = MAX(BigFont->GetHeight() * 4, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < Teams.Size (); i++)
|
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);
|
void HU_DrawColorBar(int x, int y, int height, int playernum);
|
||||||
int HU_GetRowColor(player_t *player, bool hightlight);
|
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
|
#endif
|
||||||
|
|
|
@ -500,6 +500,7 @@ void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
|
||||||
|
|
||||||
void P_DelSector_List();
|
void P_DelSector_List();
|
||||||
void P_DelSeclist(msecnode_t *); // phares 3/16/98
|
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
|
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_GetMoveFactor(const AActor *mo, int *frictionp); // phares 3/6/98
|
||||||
int P_GetFriction(const AActor *mo, int *frictionfactor);
|
int P_GetFriction(const AActor *mo, int *frictionfactor);
|
||||||
|
|
|
@ -2742,25 +2742,11 @@ void P_UnPredictPlayer ()
|
||||||
act->UnlinkFromWorld();
|
act->UnlinkFromWorld();
|
||||||
memcpy(&act->x, PredictionActorBackup, sizeof(AActor)-((BYTE *)&act->x - (BYTE *)act));
|
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.
|
// The blockmap ordering needs to remain unchanged, too.
|
||||||
P_DelSeclist(sector_list);
|
// Restore sector links and refrences.
|
||||||
sector_list = NULL;
|
// [ED850] This is somewhat of a duplicate of LinkToWorld(), but we need to keep every thing the same,
|
||||||
for (i = PredictionTouchingSectorsBackup.Size(); i-- > 0;)
|
// 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.
|
||||||
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.
|
|
||||||
if (!(act->flags & MF_NOSECTOR))
|
if (!(act->flags & MF_NOSECTOR))
|
||||||
{
|
{
|
||||||
sector_t *sec = act->Sector;
|
sector_t *sec = act->Sector;
|
||||||
|
@ -2781,6 +2767,39 @@ void P_UnPredictPlayer ()
|
||||||
*link = me;
|
*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;
|
msecnode_t *snode;
|
||||||
|
|
||||||
// Restore sector thinglist order
|
// Restore sector thinglist order
|
||||||
|
|
383
src/wi_stuff.cpp
383
src/wi_stuff.cpp
|
@ -45,6 +45,7 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
|
#include "d_netinf.h"
|
||||||
#include "b_bot.h"
|
#include "b_bot.h"
|
||||||
#include "textures/textures.h"
|
#include "textures/textures.h"
|
||||||
#include "r_data/r_translate.h"
|
#include "r_data/r_translate.h"
|
||||||
|
@ -63,6 +64,7 @@ typedef enum
|
||||||
CVAR (Bool, wi_percents, true, CVAR_ARCHIVE)
|
CVAR (Bool, wi_percents, true, CVAR_ARCHIVE)
|
||||||
CVAR (Bool, wi_showtotaltime, true, CVAR_ARCHIVE)
|
CVAR (Bool, wi_showtotaltime, true, CVAR_ARCHIVE)
|
||||||
CVAR (Bool, wi_noautostartmap, false, CVAR_USERINFO|CVAR_ARCHIVE)
|
CVAR (Bool, wi_noautostartmap, false, CVAR_USERINFO|CVAR_ARCHIVE)
|
||||||
|
CVAR (Int, wi_autoadvance, 0, CVAR_SERVERINFO)
|
||||||
|
|
||||||
|
|
||||||
void WI_loadData ();
|
void WI_loadData ();
|
||||||
|
@ -190,6 +192,7 @@ static TArray<in_anim_t> anims;
|
||||||
#define SHOWNEXTLOCDELAY 4 // in seconds
|
#define SHOWNEXTLOCDELAY 4 // in seconds
|
||||||
|
|
||||||
static int acceleratestage; // used to accelerate or skip a stage
|
static int acceleratestage; // used to accelerate or skip a stage
|
||||||
|
static bool playerready[MAXPLAYERS];
|
||||||
static int me; // wbs->pnum
|
static int me; // wbs->pnum
|
||||||
static stateenum_t state; // specifies current state
|
static stateenum_t state; // specifies current state
|
||||||
static wbstartstruct_t *wbs; // contains information passed into intermission
|
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_kills[MAXPLAYERS];
|
||||||
static int cnt_items[MAXPLAYERS];
|
static int cnt_items[MAXPLAYERS];
|
||||||
static int cnt_secret[MAXPLAYERS];
|
static int cnt_secret[MAXPLAYERS];
|
||||||
|
static int cnt_frags[MAXPLAYERS];
|
||||||
|
static int cnt_deaths[MAXPLAYERS];
|
||||||
static int cnt_time;
|
static int cnt_time;
|
||||||
static int cnt_total_time;
|
static int cnt_total_time;
|
||||||
static int cnt_par;
|
static int cnt_par;
|
||||||
static int cnt_pause;
|
static int cnt_pause;
|
||||||
|
static int total_frags;
|
||||||
|
static int total_deaths;
|
||||||
static bool noautostartmap;
|
static bool noautostartmap;
|
||||||
|
static int dofrags;
|
||||||
|
static int ng_state;
|
||||||
|
|
||||||
//
|
//
|
||||||
// GRAPHICS
|
// GRAPHICS
|
||||||
|
@ -1105,6 +1114,7 @@ void WI_updateNoState ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool noauto = noautostartmap;
|
bool noauto = noautostartmap;
|
||||||
|
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||||
|
|
||||||
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1113,7 +1123,7 @@ void WI_updateNoState ()
|
||||||
noauto |= players[i].userinfo.GetNoAutostartMap();
|
noauto |= players[i].userinfo.GetNoAutostartMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!noauto)
|
if (!noauto || autoskip)
|
||||||
{
|
{
|
||||||
cnt--;
|
cnt--;
|
||||||
}
|
}
|
||||||
|
@ -1208,128 +1218,134 @@ int WI_fragSum (int playernum)
|
||||||
return frags;
|
return frags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dm_state;
|
static int player_deaths[MAXPLAYERS];
|
||||||
static int dm_frags[MAXPLAYERS][MAXPLAYERS];
|
|
||||||
static int dm_totals[MAXPLAYERS];
|
|
||||||
|
|
||||||
void WI_initDeathmatchStats (void)
|
void WI_initDeathmatchStats (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
state = StatCount;
|
state = StatCount;
|
||||||
acceleratestage = 0;
|
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;
|
cnt_pause = TICRATE;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
{
|
{
|
||||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
for (j = 0; j < MAXPLAYERS; j++)
|
||||||
if (playeringame[j])
|
if (playeringame[j])
|
||||||
dm_frags[i][j] = 0;
|
player_deaths[i] += plrs[j].frags[i];
|
||||||
|
total_deaths += player_deaths[i];
|
||||||
dm_totals[i] = 0;
|
total_frags += plrs[i].fragcount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WI_updateDeathmatchStats ()
|
void WI_updateDeathmatchStats ()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
int i, j;
|
int i;
|
||||||
bool stillticking;
|
bool stillticking;
|
||||||
*/
|
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||||
|
|
||||||
WI_updateAnimatedBack();
|
WI_updateAnimatedBack();
|
||||||
|
|
||||||
if (acceleratestage && dm_state != 4)
|
if ((acceleratestage || autoskip) && ng_state != 6)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
acceleratestage = 0;
|
acceleratestage = 0;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for (i = 0; i<MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (!playeringame[i])
|
||||||
{
|
continue;
|
||||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
|
||||||
if (playeringame[j])
|
cnt_frags[i] = plrs[i].fragcount;
|
||||||
dm_frags[i][j] = plrs[i].frags[j];
|
cnt_deaths[i] = player_deaths[i];
|
||||||
|
|
||||||
dm_totals[i] = WI_fragSum(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
ng_state = 6;
|
||||||
*/
|
|
||||||
dm_state = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ng_state == 2)
|
||||||
if (dm_state == 2)
|
|
||||||
{
|
{
|
||||||
/*
|
if (!(bcnt & 3))
|
||||||
if (!(bcnt&3))
|
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
|
||||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
|
|
||||||
|
|
||||||
stillticking = false;
|
stillticking = false;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for (i = 0; i<MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (!playeringame[i])
|
||||||
{
|
continue;
|
||||||
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]--;
|
|
||||||
else
|
|
||||||
dm_frags[i][j]++;
|
|
||||||
|
|
||||||
if (dm_frags[i][j] > 99)
|
cnt_frags[i] += 2;
|
||||||
dm_frags[i][j] = 99;
|
|
||||||
|
|
||||||
if (dm_frags[i][j] < -99)
|
if (cnt_frags[i] > plrs[i].fragcount)
|
||||||
dm_frags[i][j] = -99;
|
cnt_frags[i] = plrs[i].fragcount;
|
||||||
|
else
|
||||||
stillticking = true;
|
stillticking = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
dm_totals[i] = WI_fragSum(i);
|
|
||||||
|
|
||||||
if (dm_totals[i] > 99)
|
if (!stillticking)
|
||||||
dm_totals[i] = 99;
|
{
|
||||||
|
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||||
if (dm_totals[i] < -99)
|
ng_state++;
|
||||||
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)
|
if (!stillticking)
|
||||||
{
|
{
|
||||||
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
|
||||||
dm_state++;
|
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();
|
WI_initShowNextLoc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dm_state & 1)
|
else if (ng_state & 1)
|
||||||
{
|
{
|
||||||
if (!--cnt_pause)
|
if (!--cnt_pause)
|
||||||
{
|
{
|
||||||
dm_state++;
|
ng_state++;
|
||||||
cnt_pause = TICRATE;
|
cnt_pause = TICRATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1339,97 +1355,126 @@ void WI_updateDeathmatchStats ()
|
||||||
|
|
||||||
void WI_drawDeathmatchStats ()
|
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
|
// draw animated background
|
||||||
WI_drawBackground();
|
WI_drawBackground();
|
||||||
WI_drawLF();
|
|
||||||
|
|
||||||
// [RH] Draw heads-up scores display
|
y = WI_drawLF();
|
||||||
HU_DrawScores (&players[me]);
|
|
||||||
|
|
||||||
/*
|
HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight);
|
||||||
int i;
|
// Use the readyico height if it's bigger.
|
||||||
int j;
|
height = readyico->GetScaledHeight() - readyico->GetScaledTopOffset();
|
||||||
int x;
|
maxiconheight = MAX(height, maxiconheight);
|
||||||
int y;
|
height = SmallFont->GetHeight() * CleanYfac;
|
||||||
int w;
|
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||||
|
ypadding = (lineheight - height + 1) / 2;
|
||||||
int lh; // line height
|
y += CleanYfac;
|
||||||
|
|
||||||
lh = WI_SPACINGY;
|
text_deaths = GStrings("SCORE_DEATHS");
|
||||||
|
//text_color = GStrings("SCORE_COLOR");
|
||||||
|
text_frags = GStrings("SCORE_FRAGS");
|
||||||
|
|
||||||
// draw stat titles (top line)
|
icon_x = 8 * CleanXfac;
|
||||||
V_DrawPatchClean(DM_TOTALSX-LittleShort(total->width)/2,
|
name_x = icon_x + maxscorewidth * CleanXfac;
|
||||||
DM_MATRIXY-WI_SPACINGY+10,
|
frags_x = name_x + (maxnamewidth + MAX(SmallFont->StringWidth("XXXXX"), SmallFont->StringWidth(text_frags)) + 8) * CleanXfac;
|
||||||
&FB,
|
deaths_x = frags_x + ((deaths_len = SmallFont->StringWidth(text_deaths)) + 8) * CleanXfac;
|
||||||
total);
|
|
||||||
|
|
||||||
V_DrawPatchClean(DM_KILLERSX, DM_KILLERSY, &FB, killers);
|
|
||||||
V_DrawPatchClean(DM_VICTIMSX, DM_VICTIMSY, &FB, victims);
|
|
||||||
|
|
||||||
// draw P?
|
x = (SCREENWIDTH - deaths_x) >> 1;
|
||||||
x = DM_MATRIXX + DM_SPACINGX;
|
icon_x += x;
|
||||||
y = DM_MATRIXY;
|
name_x += x;
|
||||||
|
frags_x += x;
|
||||||
|
deaths_x += x;
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Sort all players
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
sortedplayers[i] = &players[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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw stats
|
if (teamplay)
|
||||||
y = DM_MATRIXY+10;
|
qsort(sortedplayers, MAXPLAYERS, sizeof(player_t *), compareteams);
|
||||||
w = LittleShort(num[0]->width);
|
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])
|
if (!playeringame[pnum])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
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())
|
||||||
{
|
{
|
||||||
for (j=0 ; j<MAXPLAYERS ; j++)
|
FTexture *pic = TexMan[player->mo->ScoreIcon];
|
||||||
{
|
screen->DrawTexture(pic, icon_x, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||||
if (playeringame[j])
|
|
||||||
WI_drawNum(x+w, y, dm_frags[i][j], 2);
|
|
||||||
|
|
||||||
x += DM_SPACINGX;
|
|
||||||
}
|
|
||||||
WI_drawNum(DM_TOTALSX+w, y, dm_totals[i], 2);
|
|
||||||
}
|
}
|
||||||
y += WI_SPACINGY;
|
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 += 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 ()
|
void WI_initNetgameStats ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1437,6 +1482,7 @@ void WI_initNetgameStats ()
|
||||||
|
|
||||||
state = StatCount;
|
state = StatCount;
|
||||||
acceleratestage = 0;
|
acceleratestage = 0;
|
||||||
|
memset(playerready, 0, sizeof(playerready));
|
||||||
ng_state = 1;
|
ng_state = 1;
|
||||||
|
|
||||||
cnt_pause = TICRATE;
|
cnt_pause = TICRATE;
|
||||||
|
@ -1460,10 +1506,11 @@ void WI_updateNetgameStats ()
|
||||||
int i;
|
int i;
|
||||||
int fsum;
|
int fsum;
|
||||||
bool stillticking;
|
bool stillticking;
|
||||||
|
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
||||||
|
|
||||||
WI_updateAnimatedBack ();
|
WI_updateAnimatedBack ();
|
||||||
|
|
||||||
if (acceleratestage && ng_state != 10)
|
if ((acceleratestage || autoskip) && ng_state != 10)
|
||||||
{
|
{
|
||||||
acceleratestage = 0;
|
acceleratestage = 0;
|
||||||
|
|
||||||
|
@ -1587,7 +1634,16 @@ void WI_updateNetgameStats ()
|
||||||
}
|
}
|
||||||
else if (ng_state == 10)
|
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);
|
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/pastcoopstats", 1, ATTN_NONE);
|
||||||
WI_initShowNextLoc();
|
WI_initShowNextLoc();
|
||||||
|
@ -1611,8 +1667,10 @@ void WI_drawNetgameStats ()
|
||||||
int icon_x, name_x, kills_x, bonus_x, secret_x;
|
int icon_x, name_x, kills_x, bonus_x, secret_x;
|
||||||
int bonus_len, secret_len;
|
int bonus_len, secret_len;
|
||||||
int missed_kills, missed_items, missed_secrets;
|
int missed_kills, missed_items, missed_secrets;
|
||||||
|
float h, s, v, r, g, b;
|
||||||
EColorRange color;
|
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
|
// draw animated background
|
||||||
WI_drawBackground();
|
WI_drawBackground();
|
||||||
|
@ -1620,17 +1678,22 @@ void WI_drawNetgameStats ()
|
||||||
y = WI_drawLF();
|
y = WI_drawLF();
|
||||||
|
|
||||||
HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight);
|
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;
|
height = SmallFont->GetHeight() * CleanYfac;
|
||||||
lineheight = MAX(height, maxiconheight * CleanYfac);
|
lineheight = MAX(height, maxiconheight * CleanYfac);
|
||||||
ypadding = (lineheight - height + 1) / 2;
|
ypadding = (lineheight - height + 1) / 2;
|
||||||
y += 16*CleanYfac;
|
y += CleanYfac;
|
||||||
|
|
||||||
text_bonus = GStrings((gameinfo.gametype & GAME_Raven) ? "SCORE_BONUS" : "SCORE_ITEMS");
|
text_bonus = GStrings((gameinfo.gametype & GAME_Raven) ? "SCORE_BONUS" : "SCORE_ITEMS");
|
||||||
text_color = GStrings("SCORE_COLOR");
|
|
||||||
text_secret = GStrings("SCORE_SECRET");
|
text_secret = GStrings("SCORE_SECRET");
|
||||||
text_kills = GStrings("SCORE_KILLS");
|
text_kills = GStrings("SCORE_KILLS");
|
||||||
|
|
||||||
icon_x = (SmallFont->StringWidth(text_color) + 8) * CleanXfac;
|
icon_x = 8 * CleanXfac;
|
||||||
name_x = icon_x + maxscorewidth * CleanXfac;
|
name_x = icon_x + maxscorewidth * CleanXfac;
|
||||||
kills_x = name_x + (maxnamewidth + MAX(SmallFont->StringWidth("XXXXX"), SmallFont->StringWidth(text_kills)) + 8) * 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;
|
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;
|
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, 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, 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);
|
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;
|
continue;
|
||||||
|
|
||||||
player = &players[i];
|
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);
|
color = (EColorRange)HU_GetRowColor(player, i == consoleplayer);
|
||||||
if (player->mo->ScoreIcon.isValid())
|
if (player->mo->ScoreIcon.isValid())
|
||||||
{
|
{
|
||||||
|
@ -1689,7 +1761,7 @@ void WI_drawNetgameStats ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw "MISSED" line
|
// 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);
|
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);
|
WI_drawPercent(SmallFont, kills_x, y, missed_kills, wbs->maxkills, false, CR_DARKGRAY);
|
||||||
if (ng_state >= 4)
|
if (ng_state >= 4)
|
||||||
|
@ -1702,7 +1774,7 @@ void WI_drawNetgameStats ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw "TOTAL" line
|
// Draw "TOTAL" line
|
||||||
y += height + 5 * CleanYfac;
|
y += height + 3 * CleanYfac;
|
||||||
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
color = (gameinfo.gametype & GAME_Raven) ? CR_GREEN : CR_UNTRANSLATED;
|
||||||
screen->DrawText(SmallFont, color, name_x, y, GStrings("SCORE_TOTAL"), DTA_CleanNoMove, true, TAG_DONE);
|
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);
|
WI_drawNum(SmallFont, kills_x, y, wbs->maxkills, 0, false, color);
|
||||||
|
@ -1939,6 +2011,7 @@ void WI_checkForAccelerate(void)
|
||||||
== players[i].oldbuttons) && !player->isbot)
|
== players[i].oldbuttons) && !player->isbot)
|
||||||
{
|
{
|
||||||
acceleratestage = 1;
|
acceleratestage = 1;
|
||||||
|
playerready[i] = true;
|
||||||
}
|
}
|
||||||
player->oldbuttons = player->cmd.ucmd.buttons;
|
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_NAME = "NAME";
|
||||||
SCORE_KILLS = "KILLS";
|
SCORE_KILLS = "KILLS";
|
||||||
SCORE_FRAGS = "FRAGS";
|
SCORE_FRAGS = "FRAGS";
|
||||||
|
SCORE_DEATHS = "DEATHS";
|
||||||
SCORE_MISSED = "MISSED";
|
SCORE_MISSED = "MISSED";
|
||||||
SCORE_TOTAL = "TOTAL";
|
SCORE_TOTAL = "TOTAL";
|
||||||
|
SCORE_LVLTIME = "LEVEL TIME";
|
||||||
|
|
||||||
// Item tags: Doom weapons
|
// Item tags: Doom weapons
|
||||||
TAG_FIST = "Brass Knuckles";
|
TAG_FIST = "Brass Knuckles";
|
||||||
|
|
Loading…
Reference in a new issue