Scoreboard display will now handle big games better, instead of truncating the list.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6007 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-08-04 21:18:20 +00:00
parent 662f7cfd75
commit cd45de7a1e
7 changed files with 171 additions and 148 deletions

View file

@ -1800,7 +1800,7 @@ void CL_UpdateSeats(void)
//some userinfos should always have a value
if (!*InfoBuf_ValueForKey(info, "name")) //$name-2
InfoBuf_SetKey(info, "name", va("%s-%i\n", InfoBuf_ValueForKey(&cls.userinfo[0], "name"), cl.splitclients+1));
InfoBuf_SetKey(info, "name", va("%s-%i", InfoBuf_ValueForKey(&cls.userinfo[0], "name"), cl.splitclients+1));
if (cls.protocol != CP_QUAKE2)
{
if (!*InfoBuf_ValueForKey(info, "team")) //put players on the same team by default. this avoids team damage in coop, and if you're playing on the same computer then you probably want to be on the same team anyway.

View file

@ -3381,7 +3381,9 @@ static void CLQW_ParseServerData (void)
/*parsing here is slightly different to allow us 255 max players instead of 127*/
cl.splitclients = (qbyte)MSG_ReadByte();
if (cl.splitclients & 128)
if (cls.fteprotocolextensions2 & PEXT2_VRINPUTS)
;
else if (cl.splitclients & 128)
{
// spec = true;
cl.splitclients &= ~128;

View file

@ -947,14 +947,14 @@ void Key_DefaultLinkClicked(console_t *con, char *text, char *info)
else
{
char cmdprefix[6];
if (i == 0)
// if (i == 0)
*cmdprefix = 0;
else
snprintf(cmdprefix, sizeof(cmdprefix), "%i ", i+1);
// else
// snprintf(cmdprefix, sizeof(cmdprefix), "%i ", i+1);
//hey look! its you!
if (cl.playerview[i].spectator || cls.demoplayback)
if (i || cl.playerview[i].spectator || cls.demoplayback)
{
//need join option here or something
}

View file

@ -270,11 +270,6 @@ void Draw_FunStringWidthFont(struct font_s *font, float x, float y, const void *
}
#ifdef QUAKEHUD
static qboolean largegame = false;
#ifdef Q2CLIENT
@ -3311,7 +3306,7 @@ ping time frags name
},{ \
if (!s->spectator) \
{ \
if (largegame) \
if (skip==8) \
Sbar_FillPC(x, y+1, 40, 3, top); \
else \
Sbar_FillPC(x, y, 40, 4, top); \
@ -3365,12 +3360,12 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start)
int namesize = (cl.teamplay ? 12*8 : 16*8);
float backalpha;
int pages;
int linesperpage, firstline, lastline;
if (!pv)
return;
if (largegame)
skip = 8;
// request new ping times every two second
if (realtime - cl.last_ping_request > 2 && cls.demoplayback != DPB_EZTV)
{
@ -3431,7 +3426,16 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start)
y += 8;
}
y += gr.y;
start = y;
y+=8;
linesperpage = floor(((gr.height-10.)-y)/skip);
while (scoreboardlines > linesperpage && skip > 8)
{ //won't fit, shrink the gaps.
skip--;
linesperpage = floor(((vid.height-10.)-y)/skip);
}
linesperpage = max(linesperpage,1);
pages = max(1, (scoreboardlines+linesperpage-1)/linesperpage);
showcolumns = 0;
@ -3476,7 +3480,7 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start)
#undef COLUMN
rank_width -= namesize;
if (rank_width < 320)
if (rank_width < 320 && pages <= 1)
{
namesize += 320-rank_width;
if (namesize > 32*8)
@ -3484,33 +3488,44 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start)
}
rank_width += namesize;
startx = (gr.width-rank_width)/2;
startx += gr.x;
if (scr_scoreboard_newstyle.ival)
startx = (gr.width-rank_width*pages)/2;
if (startx < 0)
{
// Electro's scoreboard eyecandy: Draw top border
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock(startx - 3, y - 1, rank_width - 1, 1);
// Electro's scoreboard eyecandy: Draw the title row background
R2D_ImagePaletteColour (1, scr_scoreboard_fillalpha.value);
R2D_FillBlock(startx - 2, y, rank_width - 3, 9);
R2D_ImageColours(1, 1, 1, 1);
startx = fmod(realtime*128, rank_width*pages) - (gr.width/2);
startx = -bound(0, startx, (rank_width*pages-gr.width));
}
startx += gr.x;
for (firstline = 0; firstline < scoreboardlines; firstline += linesperpage, startx += rank_width)
{
if (startx+rank_width < gr.x || startx > gr.x+gr.width)
continue;
lastline = min(firstline + linesperpage, scoreboardlines);
y = start + gr.y;
x = startx;
if (scr_scoreboard_newstyle.ival)
{
// Electro's scoreboard eyecandy: Draw top border
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock(startx - 3, y - 1, rank_width - 1, 1);
// Electro's scoreboard eyecandy: Draw the title row background
R2D_ImagePaletteColour (1, scr_scoreboard_fillalpha.value);
R2D_FillBlock(startx - 2, y, rank_width - 3, 9);
R2D_ImageColours(1, 1, 1, 1);
}
x = startx;
#define COLUMN(title, width, code, fill) if (width && (showcolumns & (1<<COLUMN##title))) {Draw_FunString(x, y, #title); x += width+8;}
ALLCOLUMNS
#undef COLUMN
y += 8;
y += 8;
if (scr_scoreboard_titleseperator.ival && !scr_scoreboard_newstyle.ival)
{
x = startx;
if (scr_scoreboard_titleseperator.ival && !scr_scoreboard_newstyle.ival)
{
x = startx;
#define COLUMN(title, width, code, fill) \
if (showcolumns & (1<<COLUMN##title)) \
{ \
@ -3520,132 +3535,130 @@ if (showcolumns & (1<<COLUMN##title)) \
Draw_FunString(x+i, y, "^Ue01f"); \
x += width+8; \
}
ALLCOLUMNS
ALLCOLUMNS
#undef COLUMN
y += 8;
}
if (scr_scoreboard_newstyle.ival)
{
// Electro's scoreboard eyecandy: Draw top border (under header)
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock (startx - 3, y + 1, rank_width - 1, 1);
// Electro's scoreboard eyecandy: Don't go over the black border, move the rest down
y += 2;
// Electro's scoreboard eyecandy: Draw left border
R2D_FillBlock (startx - 3, y - 10, 1, 9);
// Electro's scoreboard eyecandy: Draw right border
R2D_FillBlock (startx - 3 + rank_width - 2, y - 10, 1, 9);
}
y -= skip;
//drawfills (these are split out to aid batching)
for (i = 0; i < scoreboardlines; i++)
{
char team[5];
unsigned int top, bottom;
// TODO: Sort players so that the leading teams are drawn first
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
continue;
y += skip;
if (y > vid.height-10)
break;
isme = (pv->cam_state == CAM_FREECAM && k == pv->playernum) ||
(pv->cam_state != CAM_FREECAM && k == pv->cam_spec_track);
// Electro's scoreboard eyecandy: Moved this up here for usage with the row background color
top = Sbar_TopColour(s);
bottom = Sbar_BottomColour(s);
y += 8;
}
if (scr_scoreboard_newstyle.ival)
{
backalpha = scr_scoreboard_backgroundalpha.value*scr_scoreboard_fillalpha.value;
if (isme)
backalpha *= 1.7;
// Electro's scoreboard eyecandy: Render the main background transparencies behind players row
// TODO: Alpha values on the background
if ((cl.teamplay) && (!s->spectator))
{
int background_color;
// Electro's scoreboard eyecandy: red vs blue are common teams, force the colours
Q_strncpyz (team, InfoBuf_ValueForKey(&s->userinfo, "team"), sizeof(team));
if (S_Voip_Speaking(k))
background_color = 0x00ff00;
else if (!(strcmp("red", team)))
background_color = 4; // forced red
else if (!(strcmp("blue", team)))
background_color = 13; // forced blue
else
background_color = bottom;
Sbar_FillPCDark (startx - 2, y, rank_width - 3, skip, background_color, backalpha);
}
else if (S_Voip_Speaking(k))
Sbar_FillPCDark (startx - 2, y, rank_width - 3, skip, 0x00ff00, backalpha);
else
{
R2D_ImagePaletteColour (2, backalpha);
R2D_FillBlock (startx - 2, y, rank_width - 3, skip);
}
// Electro's scoreboard eyecandy: Draw top border (under header)
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock (startx - 3, y, 1, skip); // Electro - Border - Left
R2D_FillBlock (startx - 3 + rank_width - 2, y, 1, skip); // Electro - Border - Right
R2D_FillBlock (startx - 3, y + 1, rank_width - 1, 1);
// Electro's scoreboard eyecandy: Don't go over the black border, move the rest down
y += 2;
// Electro's scoreboard eyecandy: Draw left border
R2D_FillBlock (startx - 3, y - 10, 1, 9);
// Electro's scoreboard eyecandy: Draw right border
R2D_FillBlock (startx - 3 + rank_width - 2, y - 10, 1, 9);
}
x = startx;
y -= skip;
//drawfills (these are split out to aid batching)
for (i = firstline; i < lastline; i++)
{
char team[5];
unsigned int top, bottom;
// TODO: Sort players so that the leading teams are drawn first
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
continue;
y += skip;
if (y > vid.height-10)
break;
isme = (pv->cam_state == CAM_FREECAM && k == pv->playernum) ||
(pv->cam_state != CAM_FREECAM && k == pv->cam_spec_track);
// Electro's scoreboard eyecandy: Moved this up here for usage with the row background color
top = Sbar_TopColour(s);
bottom = Sbar_BottomColour(s);
if (scr_scoreboard_newstyle.ival)
{
backalpha = scr_scoreboard_backgroundalpha.value*scr_scoreboard_fillalpha.value;
if (isme)
backalpha *= 1.7;
// Electro's scoreboard eyecandy: Render the main background transparencies behind players row
// TODO: Alpha values on the background
if ((cl.teamplay) && (!s->spectator))
{
int background_color;
// Electro's scoreboard eyecandy: red vs blue are common teams, force the colours
Q_strncpyz (team, InfoBuf_ValueForKey(&s->userinfo, "team"), sizeof(team));
if (S_Voip_Speaking(k))
background_color = 0x00ff00;
else if (!(strcmp("red", team)))
background_color = 4; // forced red
else if (!(strcmp("blue", team)))
background_color = 13; // forced blue
else
background_color = bottom;
Sbar_FillPCDark (startx - 2, y, rank_width - 3, skip, background_color, backalpha);
}
else if (S_Voip_Speaking(k))
Sbar_FillPCDark (startx - 2, y, rank_width - 3, skip, 0x00ff00, backalpha);
else
{
R2D_ImagePaletteColour (2, backalpha);
R2D_FillBlock (startx - 2, y, rank_width - 3, skip);
}
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock (startx - 3, y, 1, skip); // Electro - Border - Left
R2D_FillBlock (startx - 3 + rank_width - 2, y, 1, skip); // Electro - Border - Right
}
x = startx;
#define COLUMN(title, width, code, fills) \
if (showcolumns & (1<<COLUMN##title)) \
{ \
fills \
x += width+8; \
}
ALLCOLUMNS
ALLCOLUMNS
#undef COLUMN
}
if (scr_scoreboard_newstyle.ival)
{
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock (startx - 3, y + skip, rank_width - 1, 1); // Electro - Border - Bottom
}
R2D_ImageColours(1.0, 1.0, 1.0, 1.0);
y -= i * skip;
}
if (scr_scoreboard_newstyle.ival)
{
R2D_ImagePaletteColour (0, scr_scoreboard_fillalpha.value);
R2D_FillBlock (startx - 3, y + skip, rank_width - 1, 1); // Electro - Border - Bottom
}
R2D_ImageColours(1.0, 1.0, 1.0, 1.0);
y -= (i-firstline) * skip;
//text parts
for (i = 0; i < scoreboardlines; i++)
{
// TODO: Sort players so that the leading teams are drawn first
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
continue;
//text parts
for (i = firstline; i < lastline; i++)
{
// TODO: Sort players so that the leading teams are drawn first
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
continue;
y += skip;
if (y > vid.height-10)
break;
isme = (pv->cam_state == CAM_FREECAM && k == pv->playernum) ||
(pv->cam_state != CAM_FREECAM && k == pv->cam_spec_track);
y += skip;
if (y > vid.height-10)
break;
isme = (pv->cam_state == CAM_FREECAM && k == pv->playernum) ||
(pv->cam_state != CAM_FREECAM && k == pv->cam_spec_track);
x = startx;
x = startx;
#define COLUMN(title, width, code, fills) \
if (showcolumns & (1<<COLUMN##title)) \
{ \
code \
x += width+8; \
}
ALLCOLUMNS
ALLCOLUMNS
#undef COLUMN
}
}
if (y >= vid.height-10) // we ran over the screen size, squish
largegame = true;
}
/*

View file

@ -2458,6 +2458,7 @@ void V_RenderView (qboolean no2d)
{
int seatnum;
int maxseats = cl.splitclients;
int pl;
Surf_LessenStains();
@ -2466,13 +2467,16 @@ void V_RenderView (qboolean no2d)
if (cl.intermissionmode != IM_NONE)
maxseats = 1;
else if (cl_forceseat.ival && cl_splitscreen.ival >= 4)
maxseats = 1;
R_PushDlights ();
r_secondaryview = 0;
for (seatnum = 0; seatnum < cl.splitclients && seatnum < maxseats; seatnum++)
{
V_ClearRefdef(&cl.playerview[seatnum]);
pl = (maxseats==1&&cl_forceseat.ival>=1)?(cl_forceseat.ival-1)%cl.splitclients:seatnum;
V_ClearRefdef(&cl.playerview[pl]);
if (no2d)
r_refdef.drawcrosshair = r_refdef.drawsbar = 0;
if (seatnum)

View file

@ -10324,10 +10324,10 @@ void SV_SetSSQCInputs(usercmd_t *ucmd)
if (pr_global_ptrs->input_angles)
{
if (sv_player->v->fixangle)
{
(pr_global_struct->input_angles)[0] = sv_player->v->v_angle[0];
(pr_global_struct->input_angles)[1] = sv_player->v->v_angle[1];
(pr_global_struct->input_angles)[2] = sv_player->v->v_angle[2];
{ //hate this, but somehow still pending
(pr_global_struct->input_angles)[0] = sv_player->v->angles[0];
(pr_global_struct->input_angles)[1] = sv_player->v->angles[1];
(pr_global_struct->input_angles)[2] = sv_player->v->angles[2];
}
else
{
@ -10441,12 +10441,6 @@ qboolean SV_RunFullQCMovement(client_t *client, usercmd_t *ucmd)
}
#endif
if (!sv_player->v->fixangle)
{
sv_player->v->v_angle[0] = SHORT2ANGLE(ucmd->angles[0]);
sv_player->v->v_angle[1] = SHORT2ANGLE(ucmd->angles[1]);
sv_player->v->v_angle[2] = SHORT2ANGLE(ucmd->angles[2]);
}
VectorCopy(sv_player->v->v_angle, startangle);
#ifdef HEXEN2

View file

@ -363,7 +363,10 @@ void SV_New_f (void)
splitnum = 0;
for (split = host_client, splitnum = 0; split; split = split->controlled)
splitnum++;
ClientReliableWrite_Byte (host_client, (host_client->spectator?128:0) | splitnum); //read each player's userinfo to see if its a spectator or not. this hint is merely a cheat.
if (fteext2 & PEXT2_VRINPUTS)
ClientReliableWrite_Byte (host_client, splitnum);
else
ClientReliableWrite_Byte (host_client, (host_client->spectator?128:0) | splitnum); //read each player's userinfo to see if its a spectator or not. this hint is merely a cheat.
for (split = host_client; split; split = split->controlled)
{
playernum = split - svs.clients;// NUM_FOR_EDICT(svprogfuncs, split->edict)-1;
@ -9458,6 +9461,13 @@ void SV_ClientThink (void)
sv_player->xv->movement[0] = cmd.forwardmove;
sv_player->xv->movement[1] = cmd.sidemove;
sv_player->xv->movement[2] = cmd.upmove;
if (!sv_player->v->fixangle)
{
sv_player->v->v_angle[0] = SHORT2ANGLE(cmd.angles[0]);
sv_player->v->v_angle[1] = SHORT2ANGLE(cmd.angles[1]);
sv_player->v->v_angle[2] = SHORT2ANGLE(cmd.angles[2]);
}
}
SV_SetSSQCInputs(&cmd);