mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-18 14:31:52 +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 (!nohud)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
Plug_SBar ();
|
||||
#else
|
||||
Sbar_Draw ();
|
||||
if (Sbar_ShouldDraw())
|
||||
{
|
||||
Sbar_Draw ();
|
||||
Sbar_DrawScoreboard ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
SCR_ShowPics_Draw();
|
||||
Draw_FadeScreen ();
|
||||
SCR_DrawNotifyString ();
|
||||
|
@ -2202,11 +2208,17 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
|||
SCR_DrawLoading ();
|
||||
|
||||
if (!nohud)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
Plug_SBar ();
|
||||
#else
|
||||
Sbar_Draw ();
|
||||
if (Sbar_ShouldDraw())
|
||||
{
|
||||
Sbar_Draw ();
|
||||
Sbar_DrawScoreboard ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
SCR_ShowPics_Draw();
|
||||
}
|
||||
else if (cl.intermission == 1 && key_dest == key_game)
|
||||
|
@ -2239,7 +2251,11 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
|||
#ifdef PLUGINS
|
||||
Plug_SBar ();
|
||||
#else
|
||||
Sbar_Draw ();
|
||||
if (Sbar_ShouldDraw())
|
||||
{
|
||||
Sbar_Draw ();
|
||||
Sbar_DrawScoreboard ();
|
||||
}
|
||||
#endif
|
||||
SCR_ShowPics_Draw();
|
||||
|
||||
|
|
|
@ -1136,11 +1136,17 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
vid.recalc_refdef = 1;
|
||||
|
||||
if (csqc_drawsbar)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
Plug_SBar();
|
||||
#else
|
||||
Sbar_Draw();
|
||||
if (Sbar_ShouldDraw())
|
||||
{
|
||||
Sbar_Draw ();
|
||||
Sbar_DrawScoreboard ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (csqc_addcrosshair)
|
||||
Draw_Crosshair();
|
||||
|
|
|
@ -1255,6 +1255,10 @@ void Sbar_SoloScoreboard (void)
|
|||
units = seconds - 10*tens;
|
||||
sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
|
||||
Sbar_DrawString (184, 4, str);
|
||||
|
||||
// draw level name
|
||||
l = strlen (cl.levelname);
|
||||
Sbar_DrawString (232 - l*4, 12, cl.levelname);
|
||||
}
|
||||
|
||||
void Sbar_CoopScoreboard (void)
|
||||
|
@ -1650,6 +1654,70 @@ void Sbar_DrawNormal (int pnum)
|
|||
, 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
|
||||
|
@ -1664,22 +1732,7 @@ void Sbar_Draw (void)
|
|||
char st[512];
|
||||
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));
|
||||
if ((sb_updates >= vid.numpages) && !headsup)
|
||||
|
@ -1692,7 +1745,7 @@ void Sbar_Draw (void)
|
|||
SCR_VRectForPlayer(&sbar_rect, 0);
|
||||
|
||||
if (*cl.q2statusbar)
|
||||
Sbar_ExecuteLayoutString(cl.q2statusbar);
|
||||
Sbar_ExecuteLayoutString(cl.q2statusbar);
|
||||
if (*cl.q2layout)
|
||||
{
|
||||
if (cl.q2frame.playerstate.stats[Q2STAT_LAYOUTS])
|
||||
|
@ -1798,34 +1851,11 @@ void Sbar_Draw (void)
|
|||
else
|
||||
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
|
||||
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)
|
||||
{ // left
|
||||
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);
|
||||
// call whenever any of the client stats represented on the sbar changes
|
||||
|
||||
qboolean Sbar_ShouldDraw(void);
|
||||
void Sbar_Draw (void);
|
||||
void Sbar_DrawScoreboard (void);
|
||||
// called every frame by screen
|
||||
|
||||
void Sbar_IntermissionOverlay (void);
|
||||
|
|
|
@ -927,7 +927,7 @@ int VARGS Plug_Net_SetTLSClient(void *offset, unsigned int mask, const long *arg
|
|||
|
||||
pluginstream_t *stream;
|
||||
int handle = VM_LONG(arg[0]);
|
||||
qboolean anon = true;
|
||||
qboolean anon = false;
|
||||
if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug)
|
||||
{
|
||||
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;
|
||||
vrect_t rect;
|
||||
|
||||
if (!Sbar_ShouldDraw())
|
||||
return;
|
||||
|
||||
ret = 0;
|
||||
if (!plug_sbar.value)
|
||||
if (!plug_sbar.value || cl.splitclients > 1)
|
||||
currentplug = NULL;
|
||||
else
|
||||
{
|
||||
|
@ -1556,12 +1559,9 @@ void Plug_SBar(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!ret)
|
||||
if (!(ret & 1))
|
||||
{
|
||||
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)
|
||||
|
@ -1573,7 +1573,7 @@ void Plug_SBar(void)
|
|||
SCR_VRectForPlayer(&rect, cp);
|
||||
if (Draw_ImageColours)
|
||||
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);
|
||||
if (Draw_ImageColours)
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1195,13 +1195,16 @@ int UI_StatusBar(int *arg)
|
|||
float vsx, vsy;
|
||||
|
||||
if (hudedit) // don't redraw twice
|
||||
return true;
|
||||
return 1;
|
||||
|
||||
if (arg[5])
|
||||
return false;
|
||||
return 1;
|
||||
|
||||
CL_GetStats(arg[0], stats, sizeof(stats)/sizeof(int));
|
||||
|
||||
if (stats[STAT_HEALTH] <= 0)
|
||||
return 1;
|
||||
|
||||
vsx = arg[3]/640.0f;
|
||||
vsy = arg[4]/480.0f;
|
||||
for (i = 0; i < numelements; i++)
|
||||
|
@ -1215,7 +1218,7 @@ int UI_StatusBar(int *arg)
|
|||
drawelement[element[i].type].draw();
|
||||
}
|
||||
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int UI_StatusBarEdit(int *arg) // seperated so further improvements to editor view can be done
|
||||
|
|
Loading…
Reference in a new issue