mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 04:30:38 +00:00
Some minor tweeks to the hud plugin
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2470 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
35c93f1f60
commit
2f059d7b59
6 changed files with 116 additions and 54 deletions
|
@ -2187,11 +2187,17 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
||||||
if (scr_drawdialog)
|
if (scr_drawdialog)
|
||||||
{
|
{
|
||||||
if (!nohud)
|
if (!nohud)
|
||||||
|
{
|
||||||
#ifdef PLUGINS
|
#ifdef PLUGINS
|
||||||
Plug_SBar ();
|
Plug_SBar ();
|
||||||
#else
|
#else
|
||||||
Sbar_Draw ();
|
if (Sbar_ShouldDraw())
|
||||||
|
{
|
||||||
|
Sbar_Draw ();
|
||||||
|
Sbar_DrawScoreboard ();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
SCR_ShowPics_Draw();
|
SCR_ShowPics_Draw();
|
||||||
Draw_FadeScreen ();
|
Draw_FadeScreen ();
|
||||||
SCR_DrawNotifyString ();
|
SCR_DrawNotifyString ();
|
||||||
|
@ -2202,11 +2208,17 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
||||||
SCR_DrawLoading ();
|
SCR_DrawLoading ();
|
||||||
|
|
||||||
if (!nohud)
|
if (!nohud)
|
||||||
|
{
|
||||||
#ifdef PLUGINS
|
#ifdef PLUGINS
|
||||||
Plug_SBar ();
|
Plug_SBar ();
|
||||||
#else
|
#else
|
||||||
Sbar_Draw ();
|
if (Sbar_ShouldDraw())
|
||||||
|
{
|
||||||
|
Sbar_Draw ();
|
||||||
|
Sbar_DrawScoreboard ();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
SCR_ShowPics_Draw();
|
SCR_ShowPics_Draw();
|
||||||
}
|
}
|
||||||
else if (cl.intermission == 1 && key_dest == key_game)
|
else if (cl.intermission == 1 && key_dest == key_game)
|
||||||
|
@ -2239,7 +2251,11 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
||||||
#ifdef PLUGINS
|
#ifdef PLUGINS
|
||||||
Plug_SBar ();
|
Plug_SBar ();
|
||||||
#else
|
#else
|
||||||
Sbar_Draw ();
|
if (Sbar_ShouldDraw())
|
||||||
|
{
|
||||||
|
Sbar_Draw ();
|
||||||
|
Sbar_DrawScoreboard ();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
SCR_ShowPics_Draw();
|
SCR_ShowPics_Draw();
|
||||||
|
|
||||||
|
|
|
@ -1136,11 +1136,17 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
|
||||||
vid.recalc_refdef = 1;
|
vid.recalc_refdef = 1;
|
||||||
|
|
||||||
if (csqc_drawsbar)
|
if (csqc_drawsbar)
|
||||||
|
{
|
||||||
#ifdef PLUGINS
|
#ifdef PLUGINS
|
||||||
Plug_SBar();
|
Plug_SBar();
|
||||||
#else
|
#else
|
||||||
Sbar_Draw();
|
if (Sbar_ShouldDraw())
|
||||||
|
{
|
||||||
|
Sbar_Draw ();
|
||||||
|
Sbar_DrawScoreboard ();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (csqc_addcrosshair)
|
if (csqc_addcrosshair)
|
||||||
Draw_Crosshair();
|
Draw_Crosshair();
|
||||||
|
|
|
@ -1255,6 +1255,10 @@ void Sbar_SoloScoreboard (void)
|
||||||
units = seconds - 10*tens;
|
units = seconds - 10*tens;
|
||||||
sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
|
sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
|
||||||
Sbar_DrawString (184, 4, str);
|
Sbar_DrawString (184, 4, str);
|
||||||
|
|
||||||
|
// draw level name
|
||||||
|
l = strlen (cl.levelname);
|
||||||
|
Sbar_DrawString (232 - l*4, 12, cl.levelname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sbar_CoopScoreboard (void)
|
void Sbar_CoopScoreboard (void)
|
||||||
|
@ -1650,6 +1654,70 @@ void Sbar_DrawNormal (int pnum)
|
||||||
, cl.stats[pnum][STAT_AMMO] <= 10);
|
, cl.stats[pnum][STAT_AMMO] <= 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean Sbar_ShouldDraw (void)
|
||||||
|
{
|
||||||
|
#ifdef TEXTEDITOR
|
||||||
|
extern qboolean editoractive;
|
||||||
|
#endif
|
||||||
|
qboolean headsup;
|
||||||
|
char st[512];
|
||||||
|
int pnum;
|
||||||
|
|
||||||
|
int deadcount=0;
|
||||||
|
|
||||||
|
if (scr_con_current == vid.height)
|
||||||
|
return false; // console is full screen
|
||||||
|
|
||||||
|
#ifdef TEXTEDITOR
|
||||||
|
if (editoractive)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VM_UI
|
||||||
|
if (UI_DrawStatusBar((sb_showscores?1:0) + (sb_showteamscores?2:0))>0)
|
||||||
|
return false;
|
||||||
|
if (UI_MenuState())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
headsup = !(cl_sbar.value || (scr_viewsize.value<100&&cl.splitclients==1));
|
||||||
|
if ((sb_updates >= vid.numpages) && !headsup)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sbar_DrawScoreboard (void)
|
||||||
|
{
|
||||||
|
int pnum;
|
||||||
|
int deadcount=0;
|
||||||
|
|
||||||
|
if (cls.protocol == CP_QUAKE2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (pnum = 0; pnum < cl.splitclients; pnum++)
|
||||||
|
{
|
||||||
|
if (cl.stats[pnum][STAT_HEALTH] <= 0)
|
||||||
|
deadcount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deadcount == cl.splitclients && !cl.spectator)
|
||||||
|
{
|
||||||
|
if (cl.teamplay > 0 && !sb_showscores)
|
||||||
|
Sbar_TeamOverlay();
|
||||||
|
else
|
||||||
|
Sbar_DeathmatchOverlay (0);
|
||||||
|
}
|
||||||
|
else if (sb_showscores)
|
||||||
|
Sbar_DeathmatchOverlay (0);
|
||||||
|
else if (sb_showteamscores)
|
||||||
|
Sbar_TeamOverlay();
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
sb_updates = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
Sbar_Draw
|
Sbar_Draw
|
||||||
|
@ -1664,22 +1732,7 @@ void Sbar_Draw (void)
|
||||||
char st[512];
|
char st[512];
|
||||||
int pnum;
|
int pnum;
|
||||||
|
|
||||||
int deadcount=0;
|
|
||||||
|
|
||||||
if (scr_con_current == vid.height)
|
|
||||||
return; // console is full screen
|
|
||||||
|
|
||||||
#ifdef TEXTEDITOR
|
|
||||||
if (editoractive)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VM_UI
|
|
||||||
if (UI_DrawStatusBar((sb_showscores?1:0) + (sb_showteamscores?2:0))>0)
|
|
||||||
return;
|
|
||||||
if (UI_MenuState())
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
headsup = !(cl_sbar.value || (scr_viewsize.value<100&&cl.splitclients==1));
|
headsup = !(cl_sbar.value || (scr_viewsize.value<100&&cl.splitclients==1));
|
||||||
if ((sb_updates >= vid.numpages) && !headsup)
|
if ((sb_updates >= vid.numpages) && !headsup)
|
||||||
|
@ -1692,7 +1745,7 @@ void Sbar_Draw (void)
|
||||||
SCR_VRectForPlayer(&sbar_rect, 0);
|
SCR_VRectForPlayer(&sbar_rect, 0);
|
||||||
|
|
||||||
if (*cl.q2statusbar)
|
if (*cl.q2statusbar)
|
||||||
Sbar_ExecuteLayoutString(cl.q2statusbar);
|
Sbar_ExecuteLayoutString(cl.q2statusbar);
|
||||||
if (*cl.q2layout)
|
if (*cl.q2layout)
|
||||||
{
|
{
|
||||||
if (cl.q2frame.playerstate.stats[Q2STAT_LAYOUTS])
|
if (cl.q2frame.playerstate.stats[Q2STAT_LAYOUTS])
|
||||||
|
@ -1798,34 +1851,11 @@ void Sbar_Draw (void)
|
||||||
else
|
else
|
||||||
Sbar_DrawNormal (pnum);
|
Sbar_DrawNormal (pnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl.stats[pnum][STAT_HEALTH] <= 0)
|
|
||||||
deadcount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// main screen deathmatch rankings
|
|
||||||
// if we're dead show team scores in team games
|
|
||||||
if (deadcount == cl.splitclients && !cl.spectator)
|
|
||||||
{
|
|
||||||
if (cl.teamplay > 0 &&
|
|
||||||
!sb_showscores)
|
|
||||||
Sbar_TeamOverlay();
|
|
||||||
else
|
|
||||||
Sbar_DeathmatchOverlay (0);
|
|
||||||
}
|
|
||||||
else if (sb_showscores)
|
|
||||||
Sbar_DeathmatchOverlay (0);
|
|
||||||
else if (sb_showteamscores)
|
|
||||||
Sbar_TeamOverlay();
|
|
||||||
|
|
||||||
#ifdef RGLQUAKE
|
#ifdef RGLQUAKE
|
||||||
if (cl_sbar.value == 1 || scr_viewsize.value<100)
|
if (cl_sbar.value == 1 || scr_viewsize.value<100)
|
||||||
{
|
{
|
||||||
if (sb_showscores || sb_showteamscores ||
|
|
||||||
deadcount == cl.splitclients)
|
|
||||||
sb_updates = 0;
|
|
||||||
// clear unused areas in gl
|
|
||||||
|
|
||||||
if (cl.splitclients==1 && sbar_rect.x>0)
|
if (cl.splitclients==1 && sbar_rect.x>0)
|
||||||
{ // left
|
{ // left
|
||||||
Draw_TileClear (0, sbar_rect.height - sb_lines, sbar_rect.x, sb_lines);
|
Draw_TileClear (0, sbar_rect.height - sb_lines, sbar_rect.x, sb_lines);
|
||||||
|
|
|
@ -33,7 +33,9 @@ void Sbar_ReInit (void);
|
||||||
void Sbar_Changed (void);
|
void Sbar_Changed (void);
|
||||||
// call whenever any of the client stats represented on the sbar changes
|
// call whenever any of the client stats represented on the sbar changes
|
||||||
|
|
||||||
|
qboolean Sbar_ShouldDraw(void);
|
||||||
void Sbar_Draw (void);
|
void Sbar_Draw (void);
|
||||||
|
void Sbar_DrawScoreboard (void);
|
||||||
// called every frame by screen
|
// called every frame by screen
|
||||||
|
|
||||||
void Sbar_IntermissionOverlay (void);
|
void Sbar_IntermissionOverlay (void);
|
||||||
|
|
|
@ -927,7 +927,7 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
|
||||||
|
|
||||||
pluginstream_t *stream;
|
pluginstream_t *stream;
|
||||||
int handle = VM_LONG(arg[0]);
|
int handle = VM_LONG(arg[0]);
|
||||||
qboolean anon = true;
|
qboolean anon = false;
|
||||||
if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug)
|
if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug)
|
||||||
{
|
{
|
||||||
Con_Printf("Plug_Net_SetTLSClient: socket does not belong to you (or is invalid)\n");
|
Con_Printf("Plug_Net_SetTLSClient: socket does not belong to you (or is invalid)\n");
|
||||||
|
@ -1536,8 +1536,11 @@ void Plug_SBar(void)
|
||||||
int cp, ret;
|
int cp, ret;
|
||||||
vrect_t rect;
|
vrect_t rect;
|
||||||
|
|
||||||
|
if (!Sbar_ShouldDraw())
|
||||||
|
return;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (!plug_sbar.value)
|
if (!plug_sbar.value || cl.splitclients > 1)
|
||||||
currentplug = NULL;
|
currentplug = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1556,12 +1559,9 @@ void Plug_SBar(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ret)
|
if (!(ret & 1))
|
||||||
{
|
{
|
||||||
Sbar_Draw();
|
Sbar_Draw();
|
||||||
currentplug = oc;
|
|
||||||
return; //our current sbar draws a scoreboard too. We don't want that bug to be quite so apparent.
|
|
||||||
//please don't implement this identical hack in your engines...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (currentplug = plugs; currentplug; currentplug = currentplug->next)
|
for (currentplug = plugs; currentplug; currentplug = currentplug->next)
|
||||||
|
@ -1573,7 +1573,7 @@ void Plug_SBar(void)
|
||||||
SCR_VRectForPlayer(&rect, cp);
|
SCR_VRectForPlayer(&rect, cp);
|
||||||
if (Draw_ImageColours)
|
if (Draw_ImageColours)
|
||||||
Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset
|
Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset
|
||||||
VM_Call(currentplug->vm, currentplug->sbarlevel[1], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2);
|
ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[1], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1587,11 +1587,16 @@ void Plug_SBar(void)
|
||||||
SCR_VRectForPlayer(&rect, cp);
|
SCR_VRectForPlayer(&rect, cp);
|
||||||
if (Draw_ImageColours)
|
if (Draw_ImageColours)
|
||||||
Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset
|
Draw_ImageColours(1, 1, 1, 1); // ensure menu colors are reset
|
||||||
VM_Call(currentplug->vm, currentplug->sbarlevel[2], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2);
|
ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[2], cp, rect.x, rect.y, rect.width, rect.height, sb_showscores+sb_showteamscores*2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(ret & 2))
|
||||||
|
{
|
||||||
|
Sbar_DrawScoreboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
currentplug = oc;
|
currentplug = oc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1195,13 +1195,16 @@ int UI_StatusBar(int *arg)
|
||||||
float vsx, vsy;
|
float vsx, vsy;
|
||||||
|
|
||||||
if (hudedit) // don't redraw twice
|
if (hudedit) // don't redraw twice
|
||||||
return true;
|
return 1;
|
||||||
|
|
||||||
if (arg[5])
|
if (arg[5])
|
||||||
return false;
|
return 1;
|
||||||
|
|
||||||
CL_GetStats(arg[0], stats, sizeof(stats)/sizeof(int));
|
CL_GetStats(arg[0], stats, sizeof(stats)/sizeof(int));
|
||||||
|
|
||||||
|
if (stats[STAT_HEALTH] <= 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
vsx = arg[3]/640.0f;
|
vsx = arg[3]/640.0f;
|
||||||
vsy = arg[4]/480.0f;
|
vsy = arg[4]/480.0f;
|
||||||
for (i = 0; i < numelements; i++)
|
for (i = 0; i < numelements; i++)
|
||||||
|
@ -1215,7 +1218,7 @@ int UI_StatusBar(int *arg)
|
||||||
drawelement[element[i].type].draw();
|
drawelement[element[i].type].draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UI_StatusBarEdit(int *arg) // seperated so further improvements to editor view can be done
|
int UI_StatusBarEdit(int *arg) // seperated so further improvements to editor view can be done
|
||||||
|
|
Loading…
Reference in a new issue