2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
sbar.c
|
|
|
|
|
2001-05-09 05:41:34 +00:00
|
|
|
Status bar
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2002-03-14 15:43:08 +00:00
|
|
|
#include <time.h>
|
2001-02-19 21:15:25 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/cmd.h"
|
2003-05-07 15:58:15 +00:00
|
|
|
#include "QF/console.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "QF/cvar.h"
|
2001-05-09 22:40:51 +00:00
|
|
|
#include "QF/draw.h"
|
2004-03-02 03:55:18 +00:00
|
|
|
#include "QF/dstring.h"
|
|
|
|
#include "QF/gib.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/msg.h"
|
2002-08-27 07:16:28 +00:00
|
|
|
#include "QF/quakefs.h"
|
2001-04-15 08:04:15 +00:00
|
|
|
#include "QF/screen.h"
|
2003-05-07 15:58:15 +00:00
|
|
|
#include "QF/sys.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/va.h"
|
2001-04-15 04:18:22 +00:00
|
|
|
#include "QF/vid.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2012-02-13 12:58:34 +00:00
|
|
|
#include "QF/plugin/console.h"
|
|
|
|
|
2022-05-05 05:41:46 +00:00
|
|
|
#include "QF/scene/scene.h"
|
|
|
|
|
2021-06-12 13:50:51 +00:00
|
|
|
#include "QF/ui/view.h"
|
|
|
|
|
2001-08-28 03:47:10 +00:00
|
|
|
#include "compat.h"
|
2020-06-21 14:15:17 +00:00
|
|
|
|
2022-02-28 03:12:51 +00:00
|
|
|
#include "client/hud.h"
|
2022-11-02 06:08:09 +00:00
|
|
|
#include "client/screen.h"
|
2022-03-04 16:48:10 +00:00
|
|
|
#include "client/world.h"
|
2022-02-28 03:12:51 +00:00
|
|
|
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "qw/bothdefs.h"
|
|
|
|
#include "qw/include/cl_cam.h"
|
|
|
|
#include "qw/include/cl_parse.h"
|
|
|
|
#include "qw/include/client.h"
|
2001-05-09 22:40:51 +00:00
|
|
|
#include "sbar.h"
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
int sb_updates; // if >= vid.numpages, no update needed
|
2022-10-31 15:40:52 +00:00
|
|
|
static int sb_update_flags;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
static int sb_view_size;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static view_t sbar_main;
|
|
|
|
static view_t sbar_inventory;
|
|
|
|
static view_t sbar_frags;
|
|
|
|
static view_t sbar_sigils;
|
|
|
|
static view_t sbar_items;
|
|
|
|
static view_t sbar_armament;
|
|
|
|
static view_t sbar_weapons;
|
|
|
|
static view_t sbar_miniammo;
|
|
|
|
static view_t sbar_statusbar;
|
|
|
|
static view_t sbar_armor;
|
|
|
|
static view_t sbar_face;
|
|
|
|
static view_t sbar_health;
|
|
|
|
static view_t sbar_ammo;
|
|
|
|
//static view_t sbar_status;
|
|
|
|
static view_t sbar_tile[2];
|
|
|
|
|
|
|
|
static view_t
|
|
|
|
sbar_view (int x, int y, int w, int h, grav_t gravity, view_t parent)
|
|
|
|
{
|
|
|
|
view_t view = View_New (hud_registry, parent);
|
|
|
|
View_SetPos (view, x, y);
|
|
|
|
View_SetLen (view, w, h);
|
|
|
|
View_SetGravity (view, gravity);
|
|
|
|
View_SetVisible (view, 1);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
sbar_setcomponent (view_t view, uint32_t comp, void *data)
|
|
|
|
{
|
|
|
|
Ent_SetComponent (view.id, comp, view.reg, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
sbar_hascomponent (view_t view, uint32_t comp)
|
|
|
|
{
|
|
|
|
return Ent_HasComponent (view.id, comp, view.reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *
|
|
|
|
sbar_getcomponent (view_t view, uint32_t comp)
|
|
|
|
{
|
|
|
|
return Ent_GetComponent (view.id, comp, view.reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
sbar_remcomponent (view_t view, uint32_t comp)
|
|
|
|
{
|
|
|
|
Ent_RemoveComponent (view.id, comp, view.reg);
|
|
|
|
}
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
#define STAT_MINUS 10 // num frame for '-' stats digit
|
2001-06-02 20:39:54 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
qpic_t *sb_nums[2][11];
|
|
|
|
qpic_t *sb_colon, *sb_slash;
|
|
|
|
qpic_t *sb_ibar;
|
|
|
|
qpic_t *sb_sbar;
|
|
|
|
qpic_t *sb_scorebar;
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
qpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
|
2001-02-19 21:15:25 +00:00
|
|
|
qpic_t *sb_ammo[4];
|
|
|
|
qpic_t *sb_sigil[4];
|
|
|
|
qpic_t *sb_armor[3];
|
|
|
|
qpic_t *sb_items[32];
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
qpic_t *sb_faces[7][2]; // 0 is gibbed, 1 is dead, 2-6 are alive
|
|
|
|
// 0 is static, 1 is temporary animation
|
2001-02-19 21:15:25 +00:00
|
|
|
qpic_t *sb_face_invis;
|
|
|
|
qpic_t *sb_face_quad;
|
|
|
|
qpic_t *sb_face_invuln;
|
|
|
|
qpic_t *sb_face_invis_invuln;
|
|
|
|
|
|
|
|
qboolean sb_showscores;
|
|
|
|
qboolean sb_showteamscores;
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
//static qboolean largegame = false;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *fs_fraglog;
|
|
|
|
static cvar_t fs_fraglog_cvar = {
|
|
|
|
.name = "fs_fraglog",
|
|
|
|
.description =
|
|
|
|
"Filename of the automatic frag-log.",
|
|
|
|
.default_value = "qw-scores.log",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = 0, .value = &fs_fraglog },
|
|
|
|
};
|
|
|
|
int cl_fraglog;
|
|
|
|
static cvar_t cl_fraglog_cvar = {
|
|
|
|
.name = "cl_fraglog",
|
|
|
|
.description =
|
|
|
|
"Automatic fraglogging, non-zero value will switch it on.",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_ARCHIVE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &cl_fraglog },
|
|
|
|
};
|
|
|
|
int hud_scoreboard_uid;
|
|
|
|
static cvar_t hud_scoreboard_uid_cvar = {
|
|
|
|
.name = "hud_scoreboard_uid",
|
|
|
|
.description =
|
|
|
|
"Set to 1 to show uid instead of ping. Set to 2 to show both.",
|
|
|
|
.default_value = "0",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_int, .value = &hud_scoreboard_uid },
|
|
|
|
};
|
|
|
|
float scr_centertime;
|
|
|
|
static cvar_t scr_centertime_cvar = {
|
|
|
|
.name = "scr_centertime",
|
|
|
|
.description =
|
|
|
|
"How long in seconds screen hints are displayed",
|
|
|
|
.default_value = "2",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_float, .value = &scr_centertime },
|
|
|
|
};
|
|
|
|
float scr_printspeed;
|
|
|
|
static cvar_t scr_printspeed_cvar = {
|
|
|
|
.name = "scr_printspeed",
|
|
|
|
.description =
|
|
|
|
"How fast the text is displayed at the end of the single player "
|
|
|
|
"episodes",
|
|
|
|
.default_value = "8",
|
|
|
|
.flags = CVAR_NONE,
|
|
|
|
.value = { .type = &cexpr_float, .value = &scr_printspeed },
|
|
|
|
};
|
2003-05-07 17:23:18 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
//static void (*Sbar_Draw_DMO_func) (view_t *view, int l, int y, int skip);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
static void
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
viewsize_f (int view_size)
|
2003-02-11 21:24:27 +00:00
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
sb_view_size = view_size;
|
|
|
|
HUD_Calc_sb_lines (view_size);
|
2022-03-18 15:56:30 +00:00
|
|
|
if (hud_sbar) {
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
SCR_SetBottomMargin (hud_sbar ? hud_sb_lines : 0);
|
2022-03-18 15:56:30 +00:00
|
|
|
}
|
2003-02-11 21:24:27 +00:00
|
|
|
}
|
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static int __attribute__((used))
|
2011-08-22 11:00:17 +00:00
|
|
|
Sbar_ColorForMap (int m)
|
|
|
|
{
|
|
|
|
return (bound (0, m, 13) * 16) + 8;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_ShowTeamScores (void)
|
|
|
|
{
|
|
|
|
if (sb_showteamscores)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sb_showteamscores = true;
|
|
|
|
sb_updates = 0;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_DontShowTeamScores (void)
|
|
|
|
{
|
|
|
|
sb_showteamscores = false;
|
|
|
|
sb_updates = 0;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_ShowScores (void)
|
|
|
|
{
|
|
|
|
if (sb_showscores)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sb_showscores = true;
|
|
|
|
sb_updates = 0;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_DontShowScores (void)
|
|
|
|
{
|
|
|
|
sb_showscores = false;
|
|
|
|
sb_updates = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-10-31 15:40:52 +00:00
|
|
|
Sbar_Changed (sbar_changed change)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
sb_update_flags |= 1 << change;
|
2001-02-19 21:15:25 +00:00
|
|
|
sb_updates = 0; // update next frame
|
|
|
|
}
|
|
|
|
|
2009-12-19 10:54:23 +00:00
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_num (view_t *view, int num, int digits, int color)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2003-07-08 22:39:45 +00:00
|
|
|
char str[12];
|
2001-02-19 21:15:25 +00:00
|
|
|
char *ptr;
|
2022-10-31 15:40:52 +00:00
|
|
|
int l, frame, x = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-07-08 22:39:45 +00:00
|
|
|
if (num > 999999999)
|
|
|
|
num = 999999999;
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
l = snprintf (str, sizeof (str), "%d", num);
|
2001-02-19 21:15:25 +00:00
|
|
|
ptr = str;
|
|
|
|
if (l > digits)
|
|
|
|
ptr += (l - digits);
|
2022-10-31 15:40:52 +00:00
|
|
|
while (digits > l) {
|
|
|
|
sbar_remcomponent (view[x++], hud_pic);
|
|
|
|
digits--;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
if (*ptr == '-')
|
|
|
|
frame = STAT_MINUS;
|
|
|
|
else
|
|
|
|
frame = *ptr - '0';
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
sbar_setcomponent (view[x++], hud_pic, &sb_nums[color][frame]);
|
2001-02-19 21:15:25 +00:00
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-08 22:39:45 +00:00
|
|
|
static inline void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_smallnum (view_t view, int x, int y, int n, int packed, int colored)
|
2003-07-08 22:39:45 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
void *comp = sbar_getcomponent (view, hud_charbuff);
|
|
|
|
__auto_type charbuff = *(draw_charbuffer_t **) comp;
|
|
|
|
char num[4];
|
2003-07-08 22:39:45 +00:00
|
|
|
|
|
|
|
packed = packed != 0; // ensure 0 or 1
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
n = bound (-99, n, 999);
|
2003-07-08 22:39:45 +00:00
|
|
|
snprintf (num, sizeof (num), "%3d", n);
|
2022-10-31 15:40:52 +00:00
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
charbuff->chars[i] = num[i] - (colored && num[i] != ' ' ? '0' - 18 : 0);
|
2003-07-08 22:39:45 +00:00
|
|
|
}
|
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_miniammo (view_t view)
|
2011-08-22 11:00:17 +00:00
|
|
|
{
|
|
|
|
int i, count;
|
|
|
|
|
|
|
|
// ammo counts
|
|
|
|
for (i = 0; i < 4; i++) {
|
2022-10-31 15:40:52 +00:00
|
|
|
view_t v = View_GetChild (view, i);
|
2011-08-22 11:00:17 +00:00
|
|
|
count = cl.stats[STAT_SHELLS + i];
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_smallnum (v, (6 * i + 1) * 8 + 2, 0, count, 0, 1);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_ammo (view_t view)
|
2011-08-22 11:00:17 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
qpic_t *pic = 0;
|
|
|
|
if (cl.stats[STAT_ITEMS] & IT_SHELLS)
|
|
|
|
pic = sb_ammo[0];
|
|
|
|
else if (cl.stats[STAT_ITEMS] & IT_NAILS)
|
|
|
|
pic = sb_ammo[1];
|
|
|
|
else if (cl.stats[STAT_ITEMS] & IT_ROCKETS)
|
|
|
|
pic = sb_ammo[2];
|
|
|
|
else if (cl.stats[STAT_ITEMS] & IT_CELLS)
|
|
|
|
pic = sb_ammo[3];
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
view_t ammo = View_GetChild (view, 0);
|
|
|
|
if (pic) {
|
|
|
|
sbar_setcomponent (ammo, hud_pic, &pic);
|
|
|
|
} else {
|
|
|
|
sbar_remcomponent (ammo, hud_pic);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
|
|
|
|
view_t num[3] = {
|
|
|
|
View_GetChild (view, 1),
|
|
|
|
View_GetChild (view, 2),
|
|
|
|
View_GetChild (view, 3),
|
|
|
|
};
|
|
|
|
draw_num (num, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
calc_flashon (float time, int mask)
|
|
|
|
{
|
|
|
|
int flashon;
|
|
|
|
|
|
|
|
flashon = (int) ((cl.time - time) * 10);
|
|
|
|
if (flashon < 0)
|
|
|
|
flashon = 0;
|
|
|
|
if (flashon >= 10) {
|
|
|
|
if (cl.stats[STAT_ACTIVEWEAPON] == mask)
|
|
|
|
flashon = 1;
|
|
|
|
else
|
|
|
|
flashon = 0;
|
|
|
|
} else
|
|
|
|
flashon = (flashon % 5) + 2;
|
|
|
|
return flashon;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_weapons_sbar (view_t view)
|
2011-08-22 11:00:17 +00:00
|
|
|
{
|
|
|
|
int flashon, i;
|
|
|
|
|
|
|
|
for (i = 0; i < 7; i++) {
|
2022-10-31 15:40:52 +00:00
|
|
|
view_t weap = View_GetChild (view, i);
|
2011-08-22 11:00:17 +00:00
|
|
|
if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) {
|
|
|
|
flashon = calc_flashon (cl.item_gettime[i], IT_SHOTGUN << i);
|
|
|
|
if (flashon > 1)
|
2022-10-31 15:40:52 +00:00
|
|
|
sb_updates = 0; // force update to remove flash
|
|
|
|
sbar_setcomponent (weap, hud_pic, &sb_weapons[flashon][i]);
|
|
|
|
} else {
|
|
|
|
sbar_remcomponent (weap, hud_pic);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_items (view_t view)
|
2011-08-22 11:00:17 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
//float time;
|
|
|
|
//int flashon = 0, i;
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
view_t item = View_GetChild (view, i);
|
2011-08-22 11:00:17 +00:00
|
|
|
if (cl.stats[STAT_ITEMS] & (1 << (17 + i))) {
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2011-08-22 11:00:17 +00:00
|
|
|
time = cl.item_gettime[17 + i];
|
|
|
|
if (time && time > cl.time - 2 && flashon) { // Flash frame
|
|
|
|
sb_updates = 0;
|
|
|
|
} else {
|
|
|
|
draw_pic (view, i * 16, 0, sb_items[i]);
|
|
|
|
}
|
|
|
|
if (time && time > cl.time - 2)
|
|
|
|
sb_updates = 0;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
|
|
|
sbar_setcomponent (item, hud_pic, &sb_items[i]);
|
|
|
|
} else {
|
|
|
|
sbar_remcomponent (item, hud_pic);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_sigils (view_t view)
|
2011-08-22 11:00:17 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
//float time;
|
|
|
|
//int flashon = 0, i;
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
view_t sigil = View_GetChild (view, i);
|
2011-08-22 11:00:17 +00:00
|
|
|
if (cl.stats[STAT_ITEMS] & (1 << (28 + i))) {
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2011-08-22 11:00:17 +00:00
|
|
|
time = cl.item_gettime[28 + i];
|
|
|
|
if (time && time > cl.time - 2 && flashon) { // flash frame
|
|
|
|
sb_updates = 0;
|
|
|
|
} else {
|
|
|
|
draw_pic (view, i * 8, 0, sb_sigil[i]);
|
|
|
|
}
|
|
|
|
if (time && time > cl.time - 2)
|
|
|
|
sb_updates = 0;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
|
|
|
sbar_setcomponent (sigil, hud_pic, &sb_sigil[i]);
|
|
|
|
} else {
|
|
|
|
sbar_remcomponent (sigil, hud_pic);
|
2011-08-22 11:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2011-08-22 11:00:17 +00:00
|
|
|
static void
|
|
|
|
draw_inventory_sbar (view_t *view)
|
|
|
|
{
|
|
|
|
if (cl.spectator && autocam == CAM_TRACK) {
|
|
|
|
if (sbar_frags_view)
|
|
|
|
sbar_frags_view->draw (sbar_frags_view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
draw_pic (view, 0, 0, sb_ibar);
|
|
|
|
view_draw (view);
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2022-05-04 12:03:34 +00:00
|
|
|
typedef struct {
|
|
|
|
char team[16 + 1];
|
|
|
|
int frags;
|
|
|
|
int players;
|
|
|
|
int plow, phigh, ptotal;
|
|
|
|
} team_t;
|
|
|
|
|
|
|
|
team_t teams[MAX_CLIENTS];
|
|
|
|
int teamsort[MAX_CLIENTS];
|
|
|
|
int fragsort[MAX_CLIENTS]; // ZOID changed this from [MAX_SCOREBOARD]
|
|
|
|
int scoreboardlines, scoreboardteams;
|
|
|
|
|
|
|
|
static void
|
|
|
|
Sbar_SortFrags (qboolean includespec)
|
|
|
|
{
|
|
|
|
int i, j, k;
|
|
|
|
|
|
|
|
// sort by frags
|
|
|
|
scoreboardlines = 0;
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
if (cl.players[i].name && cl.players[i].name->value[0]
|
|
|
|
&& (!cl.players[i].spectator || includespec)) {
|
|
|
|
fragsort[scoreboardlines] = i;
|
|
|
|
scoreboardlines++;
|
|
|
|
if (cl.players[i].spectator)
|
|
|
|
cl.players[i].frags = -999;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < scoreboardlines; i++) {
|
|
|
|
for (j = 0; j < scoreboardlines - 1 - i; j++) {
|
|
|
|
if (cl.players[fragsort[j]].frags <
|
|
|
|
cl.players[fragsort[j + 1]].frags) {
|
|
|
|
k = fragsort[j];
|
|
|
|
fragsort[j] = fragsort[j + 1];
|
|
|
|
fragsort[j + 1] = k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2022-05-04 12:03:34 +00:00
|
|
|
Sbar_SortTeams (void)
|
|
|
|
{
|
|
|
|
char t[16 + 1];
|
|
|
|
int i, j, k;
|
|
|
|
player_info_t *s;
|
|
|
|
|
|
|
|
// request new ping times every two second
|
|
|
|
scoreboardteams = 0;
|
|
|
|
|
|
|
|
if (!cl.teamplay)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// sort the teams
|
|
|
|
memset (teams, 0, sizeof (teams));
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
teams[i].plow = 999;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
s = &cl.players[i];
|
|
|
|
if (!s->name || !s->name->value[0])
|
|
|
|
continue;
|
|
|
|
if (s->spectator)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// find his team in the list
|
|
|
|
t[16] = 0;
|
|
|
|
strncpy (t, s->team->value, 16);
|
|
|
|
if (!t[0])
|
|
|
|
continue; // not on team
|
|
|
|
for (j = 0; j < scoreboardteams; j++)
|
|
|
|
if (!strcmp (teams[j].team, t)) {
|
|
|
|
teams[j].frags += s->frags;
|
|
|
|
teams[j].players++;
|
|
|
|
goto addpinginfo;
|
|
|
|
}
|
|
|
|
if (j == scoreboardteams) { // must add him
|
|
|
|
j = scoreboardteams++;
|
|
|
|
strcpy (teams[j].team, t);
|
|
|
|
teams[j].frags = s->frags;
|
|
|
|
teams[j].players = 1;
|
|
|
|
addpinginfo:
|
|
|
|
if (teams[j].plow > s->ping)
|
|
|
|
teams[j].plow = s->ping;
|
|
|
|
if (teams[j].phigh < s->ping)
|
|
|
|
teams[j].phigh = s->ping;
|
|
|
|
teams[j].ptotal += s->ping;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sort
|
|
|
|
for (i = 0; i < scoreboardteams; i++)
|
|
|
|
teamsort[i] = i;
|
|
|
|
|
|
|
|
// good 'ol bubble sort
|
|
|
|
for (i = 0; i < scoreboardteams - 1; i++) {
|
|
|
|
for (j = i + 1; j < scoreboardteams; j++) {
|
|
|
|
if (teams[teamsort[i]].frags < teams[teamsort[j]].frags) {
|
|
|
|
k = teamsort[i];
|
|
|
|
teamsort[i] = teamsort[j];
|
|
|
|
teamsort[j] = k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2022-05-04 12:03:34 +00:00
|
|
|
draw_solo (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2022-05-04 12:03:34 +00:00
|
|
|
char str[80];
|
|
|
|
int minutes, seconds;
|
|
|
|
|
|
|
|
draw_pic (view, 0, 0, sb_scorebar);
|
|
|
|
|
|
|
|
minutes = cl.time / 60;
|
|
|
|
seconds = cl.time - 60 * minutes;
|
|
|
|
snprintf (str, sizeof (str), "Time :%3i:%02i", minutes, seconds);
|
|
|
|
draw_string (view, 184, 4, str);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2022-05-04 12:03:34 +00:00
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
static inline void
|
|
|
|
dmo_ping (view_t *view, int x, int y, player_info_t *s)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int p;
|
|
|
|
|
|
|
|
p = s->ping;
|
|
|
|
if (p < 0 || p > 999)
|
|
|
|
p = 999;
|
2003-07-08 22:39:45 +00:00
|
|
|
draw_smallnum (view, x + 8, y, p, 0, 0);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dmo_uid (view_t *view, int x, int y, player_info_t *s)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-08-05 01:45:52 +00:00
|
|
|
char num[12];
|
2003-05-07 21:03:58 +00:00
|
|
|
int p;
|
|
|
|
|
|
|
|
p = s->userid;
|
|
|
|
snprintf (num, sizeof (num), "%4i", p);
|
|
|
|
draw_string (view, x, y, num);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dmo_pl (view_t *view, int x, int y, player_info_t *s)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int p;
|
|
|
|
|
|
|
|
// draw pl
|
|
|
|
p = s->pl;
|
2003-07-08 22:39:45 +00:00
|
|
|
draw_smallnum (view, x, y, p, 0, p > 25);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
calc_fph (int frags, int total)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int fph;
|
|
|
|
|
|
|
|
if (total != 0) {
|
|
|
|
fph = (3600 * frags) / total;
|
|
|
|
|
|
|
|
if (fph >= 999)
|
|
|
|
fph = 999;
|
|
|
|
else if (fph <= -999)
|
|
|
|
fph = -999;
|
|
|
|
} else {
|
|
|
|
fph = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return fph;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
|
|
|
return 0;
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dmo_main (view_t *view, int x, int y, player_info_t *s, int is_client)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-07-08 22:39:45 +00:00
|
|
|
char num[12];
|
2003-05-07 21:03:58 +00:00
|
|
|
int fph, minutes, total, top, bottom, f;
|
|
|
|
|
|
|
|
// get time
|
|
|
|
if (cl.intermission)
|
|
|
|
total = cl.completed_time - s->entertime;
|
|
|
|
else
|
|
|
|
total = realtime - s->entertime;
|
|
|
|
minutes = total / 60;
|
|
|
|
|
|
|
|
// get frags
|
|
|
|
f = s->frags;
|
|
|
|
|
|
|
|
// draw fph
|
|
|
|
fph = calc_fph (f, total);
|
|
|
|
snprintf (num, sizeof (num), "%3i", fph);
|
|
|
|
draw_string (view, x, y, num);
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
//draw time
|
|
|
|
snprintf (num, sizeof (num), "%4i", minutes);
|
|
|
|
draw_string (view, x + 32, y, num);
|
|
|
|
|
|
|
|
// draw background
|
|
|
|
top = Sbar_ColorForMap (s->topcolor);
|
|
|
|
bottom = Sbar_ColorForMap (s->bottomcolor);
|
|
|
|
if (largegame)
|
|
|
|
draw_fill (view, x + 72, y + 1, 40, 3, top);
|
|
|
|
else
|
|
|
|
draw_fill (view, x + 72, y, 40, 4, top);
|
|
|
|
draw_fill (view, x + 72, y + 4, 40, 4, bottom);
|
|
|
|
|
|
|
|
// draw frags
|
|
|
|
if (!is_client) {
|
|
|
|
snprintf (num, sizeof (num), " %3i ", f);
|
|
|
|
} else {
|
|
|
|
snprintf (num, sizeof (num), "\x10%3i\x11", f);
|
|
|
|
}
|
|
|
|
draw_nstring (view, x + 72, y, num, 5);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dmo_team (view_t *view, int x, int y, player_info_t *s)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
draw_nstring (view, x, y, s->team->value, 4);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dmo_name (view_t *view, int x, int y, player_info_t *s)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2012-05-21 14:04:47 +00:00
|
|
|
draw_string (view, x, y, s->name->value);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 21:03:58 +00:00
|
|
|
}
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_frags (view_t view)
|
2003-05-07 15:58:15 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 15:58:15 +00:00
|
|
|
int i, k, l, p = -1;
|
2001-02-19 21:15:25 +00:00
|
|
|
int top, bottom;
|
2003-05-07 15:58:15 +00:00
|
|
|
int x;
|
2001-02-19 21:15:25 +00:00
|
|
|
player_info_t *s;
|
|
|
|
|
|
|
|
Sbar_SortFrags (false);
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
// draw the text
|
2001-02-19 21:15:25 +00:00
|
|
|
l = scoreboardlines <= 4 ? scoreboardlines : 4;
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
x = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < l; i++) {
|
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
if (s->spectator)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// draw background
|
|
|
|
top = Sbar_ColorForMap (top);
|
|
|
|
bottom = Sbar_ColorForMap (bottom);
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_fill (view, x + 4, 1, 28, 4, top);
|
|
|
|
draw_fill (view, x + 4, 5, 28, 3, bottom);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-07-08 22:39:45 +00:00
|
|
|
draw_smallnum (view, x + 6, 0, s->frags, 0, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
if (k == cl.playernum)
|
|
|
|
p = i;
|
|
|
|
|
|
|
|
x += 32;
|
|
|
|
}
|
|
|
|
if (p != -1) {
|
|
|
|
draw_character (view, p * 32, 0, 16);
|
|
|
|
draw_character (view, p * 32 + 26, 0, 17);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_face (view_t view)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2001-02-19 21:15:25 +00:00
|
|
|
int f, anim;
|
|
|
|
|
|
|
|
if ((cl.stats[STAT_ITEMS] & (IT_INVISIBILITY | IT_INVULNERABILITY))
|
|
|
|
== (IT_INVISIBILITY | IT_INVULNERABILITY)) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_pic (view, 112, 0, sb_face_invis_invuln);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cl.stats[STAT_ITEMS] & IT_QUAD) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_pic (view, 112, 0, sb_face_quad);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_pic (view, 112, 0, sb_face_invis);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_pic (view, 112, 0, sb_face_invuln);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cl.stats[STAT_HEALTH] >= 100)
|
|
|
|
f = 4;
|
|
|
|
else
|
|
|
|
f = cl.stats[STAT_HEALTH] / 20;
|
|
|
|
|
|
|
|
if (cl.time <= cl.faceanimtime) {
|
|
|
|
anim = 1;
|
|
|
|
sb_updates = 0; // make sure the anim gets drawn over
|
|
|
|
} else
|
|
|
|
anim = 0;
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_pic (view, 112, 0, sb_faces[f][anim]);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 16:35:54 +00:00
|
|
|
draw_spectator (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-07-08 22:39:45 +00:00
|
|
|
char st[512];
|
2003-05-07 16:35:54 +00:00
|
|
|
|
|
|
|
if (autocam != CAM_TRACK) {
|
|
|
|
draw_string (view, 160 - 7 * 8, 4, "SPECTATOR MODE");
|
|
|
|
draw_string (view, 160 - 14 * 8 + 4, 12,
|
|
|
|
"Press [ATTACK] for AutoCamera");
|
|
|
|
} else {
|
|
|
|
// Sbar_DrawString (160-14*8+4,4, "SPECTATOR MODE - TRACK CAMERA");
|
2021-12-29 17:02:22 +00:00
|
|
|
if (cl.players[spec_track].name) {
|
|
|
|
snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next",
|
|
|
|
cl.players[spec_track].name->value);
|
|
|
|
} else {
|
|
|
|
snprintf (st, sizeof (st), "Lost player, [JUMP] for next");
|
|
|
|
}
|
2003-05-07 16:35:54 +00:00
|
|
|
draw_string (view, 0, -8, st);
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 04:13:42 +00:00
|
|
|
}
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2022-05-04 12:03:34 +00:00
|
|
|
static inline void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_armor (view_t view)
|
|
|
|
{
|
|
|
|
view_t armor = View_GetChild (view, 0);
|
|
|
|
view_t num[3] = {
|
|
|
|
View_GetChild (view, 1),
|
|
|
|
View_GetChild (view, 2),
|
|
|
|
View_GetChild (view, 3),
|
|
|
|
};
|
2003-05-07 15:58:15 +00:00
|
|
|
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) {
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_num (num, 666, 3, 1);
|
2003-05-07 15:58:15 +00:00
|
|
|
} else {
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_num (num, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
|
2003-05-07 15:58:15 +00:00
|
|
|
if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
|
2022-10-31 15:40:52 +00:00
|
|
|
sbar_setcomponent (armor, hud_pic, &sb_armor[2]);
|
2003-05-07 15:58:15 +00:00
|
|
|
else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
|
2022-10-31 15:40:52 +00:00
|
|
|
sbar_setcomponent (armor, hud_pic, &sb_armor[1]);
|
2003-05-07 15:58:15 +00:00
|
|
|
else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
|
2022-10-31 15:40:52 +00:00
|
|
|
sbar_setcomponent (armor, hud_pic, &sb_armor[0]);
|
|
|
|
else
|
|
|
|
sbar_remcomponent (armor, hud_pic);
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
2022-05-04 12:03:34 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
draw_status_bar (view_t *view)
|
2022-05-04 12:03:34 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
if (cl.spectator && autocam != CAM_TRACK)
|
|
|
|
draw_pic (view, 0, 0, sb_scorebar);
|
|
|
|
else
|
|
|
|
draw_pic (view, 0, 0, sb_sbar);
|
2022-05-04 12:03:34 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2022-05-04 12:03:34 +00:00
|
|
|
static inline void
|
2022-10-31 15:40:52 +00:00
|
|
|
draw_health (view_t view)
|
2022-05-04 12:03:34 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
view_t num[3] = {
|
|
|
|
View_GetChild (view, 0),
|
|
|
|
View_GetChild (view, 1),
|
|
|
|
View_GetChild (view, 2),
|
|
|
|
};
|
|
|
|
draw_num (num, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2022-05-04 12:03:34 +00:00
|
|
|
static void
|
|
|
|
draw_status (view_t *view)
|
|
|
|
{
|
|
|
|
if (cl.spectator) {
|
|
|
|
draw_spectator (view);
|
|
|
|
if (autocam != CAM_TRACK)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (sb_showscores || cl.stats[STAT_HEALTH] <= 0) {
|
|
|
|
draw_solo (view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_armor (view);
|
|
|
|
draw_face (view);
|
|
|
|
draw_health (view);
|
|
|
|
draw_ammo (view);
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2013-01-16 04:18:54 +00:00
|
|
|
/*
|
|
|
|
Sbar_DeathmatchOverlay
|
2003-05-07 17:23:18 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
ping time frags name
|
|
|
|
*/
|
2013-01-13 11:08:01 +00:00
|
|
|
static void
|
2013-01-16 04:18:54 +00:00
|
|
|
Sbar_DeathmatchOverlay (view_t *view, int start)
|
2003-05-07 15:58:15 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2013-01-16 04:18:54 +00:00
|
|
|
int l, y;
|
|
|
|
int skip = 10;
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
if (cl_screen_view->xlen < 244) // FIXME: magic number, gained through experimentation
|
2003-05-07 15:58:15 +00:00
|
|
|
return;
|
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
if (largegame)
|
|
|
|
skip = 8;
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
// request new ping times every two second
|
|
|
|
if (realtime - cl.last_ping_request > 2.0) {
|
|
|
|
cl.last_ping_request = realtime;
|
|
|
|
if (!cls.demoplayback) {
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
|
|
|
SZ_Print (&cls.netchan.message, "pings");
|
|
|
|
}
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
r_data->scr_copyeverything = 1;
|
|
|
|
r_data->scr_fullupdate = 0;
|
2003-05-07 16:35:54 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
if (!start) {
|
|
|
|
draw_cachepic (view, 0, 0, "gfx/ranking.lmp", 1);
|
|
|
|
y = 24;
|
|
|
|
} else
|
|
|
|
y = start;
|
2003-05-07 16:35:54 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
// scores
|
|
|
|
Sbar_SortFrags (true);
|
2003-05-07 16:35:54 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
// draw the text
|
|
|
|
l = scoreboardlines;
|
2013-01-08 12:36:28 +00:00
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
// func ptr, avoids absurd if testing
|
|
|
|
Sbar_Draw_DMO_func (view, l, y, skip);
|
|
|
|
|
|
|
|
if (y >= view->ylen - 10) // we ran over the screen size, squish
|
|
|
|
largegame = true;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2003-05-07 16:35:54 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
Sbar_TeamOverlay
|
|
|
|
|
|
|
|
team frags
|
|
|
|
added by Zoid
|
|
|
|
*/
|
2013-01-16 04:18:54 +00:00
|
|
|
static void
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_TeamOverlay (view_t *view)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-08-05 01:45:52 +00:00
|
|
|
char num[20];
|
2011-06-19 01:48:02 +00:00
|
|
|
int pavg, plow, phigh, i, k, x, y;
|
2001-02-19 21:15:25 +00:00
|
|
|
team_t *tm;
|
2002-10-02 15:42:39 +00:00
|
|
|
info_key_t *player_team = cl.players[cl.playernum].team;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
if (!cl.teamplay) { // FIXME: if not teamplay, why teamoverlay?
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_DeathmatchOverlay (view, 0);
|
2001-02-19 21:15:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->scr_copyeverything = 1;
|
|
|
|
r_data->scr_fullupdate = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
draw_cachepic (view, 0, 0, "gfx/ranking.lmp", 1);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
y = 24;
|
|
|
|
x = 36;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "low/avg/high team total players");
|
2001-02-19 21:15:25 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f "
|
2001-08-25 02:47:11 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1f");
|
2001-02-19 21:15:25 +00:00
|
|
|
y += 8;
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
// sort the teams
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_SortTeams ();
|
|
|
|
|
2001-05-14 19:46:16 +00:00
|
|
|
// draw the text
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < scoreboardteams && y <= view->ylen - 10; i++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
k = teamsort[i];
|
|
|
|
tm = teams + k;
|
|
|
|
|
|
|
|
// draw pings
|
|
|
|
plow = tm->plow;
|
|
|
|
if (plow < 0 || plow > 999)
|
|
|
|
plow = 999;
|
|
|
|
phigh = tm->phigh;
|
|
|
|
if (phigh < 0 || phigh > 999)
|
|
|
|
phigh = 999;
|
|
|
|
if (!tm->players)
|
|
|
|
pavg = 999;
|
|
|
|
else
|
|
|
|
pavg = tm->ptotal / tm->players;
|
|
|
|
if (pavg < 0 || pavg > 999)
|
|
|
|
pavg = 999;
|
|
|
|
|
|
|
|
snprintf (num, sizeof (num), "%3i/%3i/%3i", plow, pavg, phigh);
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, num);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// draw team
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_nstring (view, x + 104, y, tm->team, 4);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// draw total
|
|
|
|
snprintf (num, sizeof (num), "%5i", tm->frags);
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 104 + 40, y, num);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// draw players
|
|
|
|
snprintf (num, sizeof (num), "%5i", tm->players);
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 104 + 88, y, num);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-10-02 15:42:39 +00:00
|
|
|
if (player_team && strnequal (player_team->value, tm->team, 16)) {
|
2003-09-24 02:24:30 +00:00
|
|
|
draw_character (view, x + 104 - 8, y, 16);
|
|
|
|
draw_character (view, x + 104 + 32, y, 17);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
y += 8;
|
|
|
|
}
|
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_DeathmatchOverlay (view, y);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2013-01-16 04:18:54 +00:00
|
|
|
static void
|
|
|
|
draw_overlay (view_t *view)
|
|
|
|
{
|
|
|
|
if (cls.state != ca_active
|
|
|
|
|| !((cl.stats[STAT_HEALTH] <= 0 && !cl.spectator)
|
|
|
|
|| sb_showscores || sb_showteamscores))
|
|
|
|
return;
|
|
|
|
// main screen deathmatch rankings
|
|
|
|
// if we're dead show team scores in team games
|
|
|
|
if (cl.stats[STAT_HEALTH] <= 0 && !cl.spectator)
|
|
|
|
if (cl.teamplay > 0 && !sb_showscores)
|
|
|
|
Sbar_TeamOverlay (view);
|
|
|
|
else
|
|
|
|
Sbar_DeathmatchOverlay (view, 0);
|
|
|
|
else if (sb_showscores)
|
|
|
|
Sbar_DeathmatchOverlay (view, 0);
|
|
|
|
else if (sb_showteamscores)
|
|
|
|
Sbar_TeamOverlay (view);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sbar_update_vis (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2013-01-16 04:18:54 +00:00
|
|
|
qboolean headsup;
|
|
|
|
|
|
|
|
if (r_data->scr_copyeverything)
|
|
|
|
Sbar_Changed ();
|
|
|
|
|
|
|
|
sbar_view->visible = 0;
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
headsup = !(hud_sbar || sb_view_size < 100);
|
2013-01-16 04:18:54 +00:00
|
|
|
|
|
|
|
if ((sb_updates >= r_data->vid->numpages) && !headsup)
|
|
|
|
return;
|
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
if (con_module && con_module->data->console->lines == cl_screen_view->ylen)
|
2013-01-16 04:18:54 +00:00
|
|
|
return; // console is full screen
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!hud_sb_lines)
|
2013-01-16 04:18:54 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
sbar_view->visible = 1;
|
|
|
|
|
|
|
|
r_data->scr_copyeverything = 1;
|
|
|
|
sb_updates++;
|
|
|
|
|
|
|
|
if (sb_showscores || sb_showteamscores || cl.stats[STAT_HEALTH] <= 0)
|
|
|
|
sb_updates = 0;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2013-01-16 04:18:54 +00:00
|
|
|
}
|
|
|
|
|
2002-03-14 15:43:08 +00:00
|
|
|
/*
|
|
|
|
Sbar_LogFrags
|
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
autologging of frags after a match ended
|
2002-03-14 15:43:08 +00:00
|
|
|
(called by recived network packet with command scv_intermission)
|
|
|
|
TODO: Find a new and better place for this function
|
|
|
|
(i am nearly shure this is wrong place)
|
|
|
|
added by Elmex
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Sbar_LogFrags (void)
|
|
|
|
{
|
2003-07-08 22:39:45 +00:00
|
|
|
char *name;
|
|
|
|
char *team;
|
|
|
|
byte *cp = NULL;
|
2002-08-27 07:16:28 +00:00
|
|
|
QFile *file = NULL;
|
2003-03-21 21:25:44 +00:00
|
|
|
int minutes, fph, total, d, f, i, k, l, p;
|
2002-03-14 19:41:49 +00:00
|
|
|
player_info_t *s = NULL;
|
2003-03-21 21:25:44 +00:00
|
|
|
const char *t = NULL;
|
|
|
|
time_t tt = time (NULL);
|
2002-03-14 15:43:08 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!cl_fraglog)
|
2002-07-29 17:36:01 +00:00
|
|
|
return;
|
2002-03-14 19:41:49 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if ((file = QFS_Open (fs_fraglog, "a")) == NULL)
|
2002-03-14 15:43:08 +00:00
|
|
|
return;
|
|
|
|
|
2002-07-29 17:36:01 +00:00
|
|
|
t = ctime (&tt);
|
|
|
|
if (t)
|
2002-08-15 09:38:23 +00:00
|
|
|
Qwrite (file, t, strlen (t));
|
2002-03-14 15:43:08 +00:00
|
|
|
|
2022-03-04 16:48:10 +00:00
|
|
|
Qprintf (file, "%s\n%s %s\n", cls.servername->str,
|
2022-05-05 05:41:46 +00:00
|
|
|
cl_world.scene->worldmodel->path, cl.levelname);
|
2002-03-14 15:43:08 +00:00
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
// scores
|
2002-03-14 15:43:08 +00:00
|
|
|
Sbar_SortFrags (true);
|
|
|
|
|
|
|
|
// draw the text
|
|
|
|
l = scoreboardlines;
|
|
|
|
|
|
|
|
if (cl.teamplay) {
|
|
|
|
// TODO: test if the teamplay does correct output
|
2002-07-29 17:36:01 +00:00
|
|
|
Qwrite (file, "pl fph time frags team name\n",
|
|
|
|
strlen ("pl fph time frags team name\n"));
|
2002-03-14 15:43:08 +00:00
|
|
|
} else {
|
2002-07-29 17:36:01 +00:00
|
|
|
Qwrite (file, "pl fph time frags name\n",
|
|
|
|
strlen ("pl fph time frags name\n"));
|
2002-03-14 15:43:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < l; i++) {
|
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-03-14 15:43:08 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// draw pl
|
|
|
|
p = s->pl;
|
2011-06-19 01:48:02 +00:00
|
|
|
(void) p; //FIXME
|
2002-03-14 15:43:08 +00:00
|
|
|
|
|
|
|
// get time
|
|
|
|
if (cl.intermission)
|
|
|
|
total = cl.completed_time - s->entertime;
|
|
|
|
else
|
|
|
|
total = realtime - s->entertime;
|
2002-08-15 09:38:23 +00:00
|
|
|
minutes = total / 60;
|
2002-03-14 15:43:08 +00:00
|
|
|
|
|
|
|
// get frags
|
|
|
|
f = s->frags;
|
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
fph = calc_fph (f, total);
|
2002-03-14 19:41:49 +00:00
|
|
|
|
2012-05-21 14:04:47 +00:00
|
|
|
name = malloc (strlen (s->name->value) + 1);
|
|
|
|
for (cp = (byte *) s->name->value, d = 0; *cp; cp++, d++)
|
2003-07-08 22:39:45 +00:00
|
|
|
name[d] = sys_char_map[*cp];
|
|
|
|
name[d] = 0;
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
if (s->spectator) {
|
2003-07-08 22:39:45 +00:00
|
|
|
Qprintf (file, "%-3i%% %s (spectator)", s->pl, name);
|
2002-03-14 15:43:08 +00:00
|
|
|
} else {
|
2002-08-15 09:38:23 +00:00
|
|
|
if (cl.teamplay) {
|
2003-07-08 22:39:45 +00:00
|
|
|
team = malloc (strlen (s->team->value) + 1);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
for (cp = (byte *) s->team, d = 0; *cp; cp++, d++)
|
2003-07-08 22:39:45 +00:00
|
|
|
team[d] = sys_char_map[*cp];
|
|
|
|
team[d] = 0;
|
|
|
|
|
|
|
|
Qprintf (file, "%-3i%% %-3i %-4i %-3i %-4s %s",
|
|
|
|
s->pl, fph, minutes, f, team, name);
|
|
|
|
free (team);
|
2002-03-14 15:43:08 +00:00
|
|
|
} else {
|
2003-07-08 22:39:45 +00:00
|
|
|
Qprintf (file, "%-3i%% %-3i %-4i %-3i %s",
|
|
|
|
s->pl, fph, minutes, f, name);
|
2002-03-14 15:43:08 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-08 22:39:45 +00:00
|
|
|
free (name);
|
2003-03-21 21:25:44 +00:00
|
|
|
Qwrite (file, "\n\n", 1);
|
2002-03-14 15:43:08 +00:00
|
|
|
}
|
2011-08-22 11:00:17 +00:00
|
|
|
|
2003-03-21 21:25:44 +00:00
|
|
|
Qclose (file);
|
2002-03-14 15:43:08 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_Team_Ping (view_t *view, int l, int y, int skip)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2002-08-15 09:38:23 +00:00
|
|
|
player_info_t *s;
|
2002-03-14 15:43:08 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
x = 4;
|
2011-08-22 11:00:17 +00:00
|
|
|
// 0 40 64 104 152 192 224
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "ping pl fph time frags team name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
|
|
|
y += 8;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2002-08-15 09:38:23 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-08-15 09:38:23 +00:00
|
|
|
continue;
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_ping (view, x + 0, y, s);
|
2003-05-26 01:41:58 +00:00
|
|
|
dmo_pl (view, x + 32, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_name (view, x + 224, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_team (view, x + 184, y, s);
|
|
|
|
dmo_name (view, x + 224, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
y += skip;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_Team_UID (view_t *view, int l, int y, int skip)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2001-08-28 03:47:10 +00:00
|
|
|
player_info_t *s;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
x = 4;
|
2003-05-07 19:53:08 +00:00
|
|
|
// 0 40 64 104 152 192
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, " uid pl fph time frags team name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
|
|
|
y += 8;
|
2001-10-02 03:24:36 +00:00
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2002-08-15 09:38:23 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-08-15 09:38:23 +00:00
|
|
|
continue;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_uid (view, x + 0, y, s);
|
|
|
|
dmo_ping (view, x + 32, y, s);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_name (view, x + 224, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_team (view, x + 184, y, s);
|
|
|
|
dmo_name (view, x + 224, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
y += skip;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_Team_Ping_UID (view_t *view, int l, int y, int skip)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2002-08-15 09:38:23 +00:00
|
|
|
player_info_t *s;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
x = 4;
|
2003-05-07 19:53:08 +00:00
|
|
|
// 0 40 64 104 152 192
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "ping pl fph time frags team uid name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
|
|
|
y += 8;
|
2002-07-29 17:36:01 +00:00
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2002-08-15 09:38:23 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-08-15 09:38:23 +00:00
|
|
|
continue;
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_ping (view, x + 0, y, s);
|
|
|
|
dmo_pl (view, x + 32, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_uid (view, x + 224, y, s);
|
|
|
|
dmo_name (view, x + 264, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_team (view, x + 184, y, s);
|
|
|
|
dmo_uid (view, x + 224, y, s);
|
|
|
|
dmo_name (view, x + 264, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
y += skip;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_Ping (view_t *view, int l, int y, int skip)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2002-08-15 09:38:23 +00:00
|
|
|
player_info_t *s;
|
|
|
|
|
|
|
|
x = 16;
|
2003-05-07 19:53:08 +00:00
|
|
|
// 0 40 64 104 152
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "ping pl fph time frags name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e"
|
|
|
|
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
|
|
|
y += 8;
|
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2002-08-15 09:38:23 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-08-15 09:38:23 +00:00
|
|
|
continue;
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_ping (view, x + 0, y, s);
|
|
|
|
dmo_pl (view, x + 32, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_name (view, x + 184, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_name (view, x + 184, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
y += skip;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_UID (view_t *view, int l, int y, int skip)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2002-08-15 09:38:23 +00:00
|
|
|
player_info_t *s;
|
|
|
|
|
|
|
|
x = 16;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, " uid pl fph time frags name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1e\x1e\x1e\x1e"
|
|
|
|
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
2002-08-14 10:49:38 +00:00
|
|
|
y += 8;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_uid (view, x + 0, y, s);
|
|
|
|
dmo_pl (view, x + 32, y, s);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_name (view, x + 184, y, s);
|
2001-02-19 21:15:25 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
2002-07-29 17:36:01 +00:00
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_name (view, x + 184, y, s);
|
2002-01-27 21:19:29 +00:00
|
|
|
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2003-05-07 17:23:18 +00:00
|
|
|
Sbar_Draw_DMO_Ping_UID (view_t *view, int l, int y, int skip)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 21:03:58 +00:00
|
|
|
int i, k, x;
|
2002-08-15 09:38:23 +00:00
|
|
|
player_info_t *s;
|
|
|
|
|
|
|
|
x = 16;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "ping pl fph time frags uid name");
|
2002-08-15 09:38:23 +00:00
|
|
|
y += 8;
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1f "
|
2002-08-15 09:38:23 +00:00
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f "
|
|
|
|
"\x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e"
|
|
|
|
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
|
|
|
|
y += 8;
|
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < l && y <= view->ylen - 10; i++) {
|
2002-08-15 09:38:23 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2002-08-15 09:38:23 +00:00
|
|
|
continue;
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_ping (view, x + 0, y, s);
|
|
|
|
dmo_pl (view, x + 32, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
|
|
|
|
if (s->spectator) {
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_string (view, x + 72, y, "(spectator)");
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_name (view, x + 184, y, s);
|
2002-08-15 09:38:23 +00:00
|
|
|
y += skip;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-07 21:03:58 +00:00
|
|
|
dmo_main (view, x + 64, y, s, k == cl.playernum);
|
|
|
|
dmo_uid (view, x + 184, y, s);
|
|
|
|
dmo_name (view, x + 224, y, s);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
y += skip;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Sbar_DMO_Init_f (void *data, const cvar_t *cvar)
|
2002-08-15 09:38:23 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2002-08-15 09:38:23 +00:00
|
|
|
if (cl.teamplay)
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_scoreboard_uid > 1)
|
2002-08-15 09:38:23 +00:00
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_Team_Ping_UID;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
else if (hud_scoreboard_uid > 0)
|
2002-08-15 09:38:23 +00:00
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_Team_UID;
|
|
|
|
else
|
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_Team_Ping;
|
|
|
|
else
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_scoreboard_uid > 1)
|
2002-08-15 09:38:23 +00:00
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_Ping_UID;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
else if (hud_scoreboard_uid > 0)
|
2002-08-15 09:38:23 +00:00
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_UID;
|
|
|
|
else
|
|
|
|
Sbar_Draw_DMO_func = Sbar_Draw_DMO_Ping;
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2002-08-15 09:38:23 +00:00
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
2003-05-07 17:23:18 +00:00
|
|
|
draw_minifrags
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
frags name
|
|
|
|
frags team name
|
|
|
|
displayed to right of status bar if there's room
|
|
|
|
*/
|
2003-05-07 15:58:15 +00:00
|
|
|
static void
|
|
|
|
draw_minifrags (view_t *view)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2001-11-04 19:06:50 +00:00
|
|
|
int numlines, top, bottom, f, i, k, x, y;
|
2003-08-05 01:45:52 +00:00
|
|
|
char num[20];
|
2001-02-19 21:15:25 +00:00
|
|
|
player_info_t *s;
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->scr_copyeverything = 1;
|
|
|
|
r_data->scr_fullupdate = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
// scores
|
2001-02-19 21:15:25 +00:00
|
|
|
Sbar_SortFrags (false);
|
|
|
|
|
|
|
|
if (!scoreboardlines)
|
|
|
|
return; // no one there?
|
|
|
|
|
2003-05-07 21:10:37 +00:00
|
|
|
numlines = view->ylen / 8;
|
2003-05-08 04:13:42 +00:00
|
|
|
if (numlines < 3)
|
2001-02-19 21:15:25 +00:00
|
|
|
return; // not enough room
|
|
|
|
|
|
|
|
// find us
|
|
|
|
for (i = 0; i < scoreboardlines; i++)
|
|
|
|
if (fragsort[i] == cl.playernum)
|
|
|
|
break;
|
|
|
|
|
2011-08-22 11:00:17 +00:00
|
|
|
if (i == scoreboardlines) // we're not there, we are probably a
|
2001-02-19 21:15:25 +00:00
|
|
|
// spectator, just display top
|
|
|
|
i = 0;
|
|
|
|
else // figure out start
|
|
|
|
i = i - numlines / 2;
|
|
|
|
|
|
|
|
if (i > scoreboardlines - numlines)
|
|
|
|
i = scoreboardlines - numlines;
|
|
|
|
if (i < 0)
|
|
|
|
i = 0;
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
x = 4;
|
|
|
|
y = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
for (; i < scoreboardlines && y < view->ylen - 8 + 1; i++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
k = fragsort[i];
|
|
|
|
s = &cl.players[k];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!s->name || !s->name->value[0])
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// draw ping
|
|
|
|
top = s->topcolor;
|
|
|
|
bottom = s->bottomcolor;
|
|
|
|
top = Sbar_ColorForMap (top);
|
|
|
|
bottom = Sbar_ColorForMap (bottom);
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_fill (view, x + 2, y + 1, 37, 3, top);
|
|
|
|
draw_fill (view, x + 2, y + 4, 37, 4, bottom);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// draw number
|
|
|
|
f = s->frags;
|
2002-01-10 07:48:41 +00:00
|
|
|
if (k != cl.playernum) {
|
|
|
|
snprintf (num, sizeof (num), " %3i ", f);
|
|
|
|
} else {
|
|
|
|
snprintf (num, sizeof (num), "\x10%3i\x11", f);
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_nstring (view, x, y, num, 5);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// team
|
2001-11-04 19:06:50 +00:00
|
|
|
if (cl.teamplay) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_nstring (view, x + 48, y, s->team->value, 4);
|
2012-05-21 14:04:47 +00:00
|
|
|
draw_nstring (view, x + 48 + 40, y, s->name->value, 16);
|
2002-01-10 04:28:17 +00:00
|
|
|
} else
|
2012-05-21 14:04:47 +00:00
|
|
|
draw_nstring (view, x + 48, y, s->name->value, 16);
|
2001-02-19 21:15:25 +00:00
|
|
|
y += 8;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
static void
|
|
|
|
draw_miniteam (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 15:58:15 +00:00
|
|
|
int i, k, x, y;
|
2003-08-05 01:45:52 +00:00
|
|
|
char num[12];
|
2003-05-07 15:58:15 +00:00
|
|
|
info_key_t *player_team = cl.players[cl.playernum].team;
|
|
|
|
team_t *tm;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
if (!cl.teamplay)
|
|
|
|
return;
|
2003-05-08 04:13:42 +00:00
|
|
|
Sbar_SortTeams ();
|
2003-07-08 22:39:45 +00:00
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
2003-05-07 21:10:37 +00:00
|
|
|
for (i = 0; i < scoreboardteams && y <= view->ylen; i++) {
|
2001-02-19 21:15:25 +00:00
|
|
|
k = teamsort[i];
|
|
|
|
tm = teams + k;
|
|
|
|
|
|
|
|
// draw pings
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_nstring (view, x, y, tm->team, 4);
|
2001-02-19 21:15:25 +00:00
|
|
|
// draw total
|
|
|
|
snprintf (num, sizeof (num), "%5i", tm->frags);
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_string (view, x + 40, y, num);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-10-02 15:42:39 +00:00
|
|
|
if (player_team && strnequal (player_team->value, tm->team, 16)) {
|
2003-05-07 15:58:15 +00:00
|
|
|
draw_character (view, x - 8, y, 16);
|
|
|
|
draw_character (view, x + 32, y, 17);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
y += 8;
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-05-08 05:49:57 +00:00
|
|
|
static void
|
|
|
|
draw_time (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2021-03-29 08:27:06 +00:00
|
|
|
struct tm *local = 0;
|
2003-05-08 05:49:57 +00:00
|
|
|
time_t utc = 0;
|
2003-08-05 01:45:52 +00:00
|
|
|
char st[80];
|
2003-05-08 05:49:57 +00:00
|
|
|
|
|
|
|
// Get local time
|
2021-03-29 08:27:06 +00:00
|
|
|
utc = time (0);
|
2003-05-08 05:49:57 +00:00
|
|
|
local = localtime (&utc);
|
|
|
|
|
2021-03-30 08:38:42 +00:00
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
# define HOUR12 "%I"
|
|
|
|
# define HOUR24 "%H"
|
|
|
|
# define PM "%p"
|
|
|
|
#else
|
|
|
|
# define HOUR12 "%l"
|
|
|
|
# define HOUR24 "%k"
|
|
|
|
# define PM "%P"
|
|
|
|
#endif
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_time == 1) { // Use international format
|
2021-03-30 08:38:42 +00:00
|
|
|
strftime (st, sizeof (st), HOUR24":%M", local);
|
2021-03-29 08:27:06 +00:00
|
|
|
draw_string (view, 8, 0, st);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
} else if (hud_time >= 2) { // US AM/PM display
|
2021-03-30 08:38:42 +00:00
|
|
|
strftime (st, sizeof (st), HOUR12":%M "PM, local);
|
2021-03-29 08:27:06 +00:00
|
|
|
draw_string (view, 8, 0, st);
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_fps (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-08-05 01:45:52 +00:00
|
|
|
static char st[80];
|
2003-05-08 05:49:57 +00:00
|
|
|
double t;
|
|
|
|
static double lastframetime;
|
2003-07-27 22:25:45 +00:00
|
|
|
static double lastfps;
|
2003-05-08 05:49:57 +00:00
|
|
|
|
|
|
|
t = Sys_DoubleTime ();
|
2003-07-27 22:25:45 +00:00
|
|
|
if ((t - lastframetime) >= 0.2) {
|
|
|
|
lastfps = fps_count / (t - lastframetime);
|
2003-05-08 05:49:57 +00:00
|
|
|
fps_count = 0;
|
|
|
|
lastframetime = t;
|
2003-07-27 22:25:45 +00:00
|
|
|
snprintf (st, sizeof (st), "%5.1f FPS", lastfps);
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
|
|
|
draw_string (view, 80, 8, st);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_net (view_t *view)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-08 05:49:57 +00:00
|
|
|
// request new ping times every two seconds
|
|
|
|
if (!cls.demoplayback && realtime - cl.last_ping_request > 2) {
|
|
|
|
cl.last_ping_request = realtime;
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
|
|
|
SZ_Print (&cls.netchan.message, "pings");
|
|
|
|
}
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_ping) {
|
2003-05-08 05:49:57 +00:00
|
|
|
int ping = cl.players[cl.playernum].ping;
|
|
|
|
|
|
|
|
ping = bound (0, ping, 999);
|
2021-01-31 07:01:20 +00:00
|
|
|
draw_string (view, 0, 0, va (0, "%3d ms ", ping));
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_ping && hud_pl)
|
2003-05-08 05:49:57 +00:00
|
|
|
draw_character (view, 48, 0, '/');
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_pl) {
|
2003-05-08 05:49:57 +00:00
|
|
|
int lost = CL_CalcNet ();
|
|
|
|
|
|
|
|
lost = bound (0, lost, 999);
|
2021-01-31 07:01:20 +00:00
|
|
|
draw_string (view, 56, 0, va (0, "%3d pl", lost));
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 05:49:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_stuff (view_t *view)
|
|
|
|
{
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_time > 0)
|
2003-05-08 05:49:57 +00:00
|
|
|
draw_time (view);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (hud_fps > 0)
|
2003-05-08 05:49:57 +00:00
|
|
|
draw_fps (view);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (cls.state == ca_active && (hud_ping || hud_pl))
|
2003-05-08 05:49:57 +00:00
|
|
|
draw_net (view);
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
void
|
|
|
|
Sbar_IntermissionOverlay (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->scr_copyeverything = 1;
|
|
|
|
r_data->scr_fullupdate = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-04 19:06:50 +00:00
|
|
|
if (cl.teamplay > 0 && !sb_showscores)
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Sbar_TeamOverlay (hud_overlay_view);
|
2001-02-19 21:15:25 +00:00
|
|
|
else
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Sbar_DeathmatchOverlay (hud_overlay_view, 0);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2004-03-02 03:55:18 +00:00
|
|
|
/* CENTER PRINTING */
|
|
|
|
static dstring_t center_string = {&dstring_default_mem};
|
|
|
|
static float centertime_start; // for slow victory printing
|
|
|
|
static float centertime_off;
|
|
|
|
static int center_lines;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Called for important messages that should stay in the center of the screen
|
|
|
|
for a few moments
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Sbar_CenterPrint (const char *str)
|
|
|
|
{
|
|
|
|
if (!str) {
|
|
|
|
centertime_off = 0;
|
|
|
|
dstring_clearstr (¢er_string);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dstring_copystr (¢er_string, str);
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
centertime_off = scr_centertime;
|
2004-03-02 03:55:18 +00:00
|
|
|
centertime_start = realtime;
|
|
|
|
|
|
|
|
// count the number of lines for centering
|
|
|
|
center_lines = 1;
|
|
|
|
while (*str) {
|
|
|
|
if (*str == '\n')
|
|
|
|
center_lines++;
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void __attribute__((used))
|
2004-03-02 03:55:18 +00:00
|
|
|
Sbar_DrawCenterString (view_t *view, int remaining)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2004-03-02 03:55:18 +00:00
|
|
|
const char *start;
|
|
|
|
int j, l, x, y;
|
|
|
|
|
|
|
|
start = center_string.str;
|
|
|
|
|
|
|
|
if (center_lines <= 4)
|
|
|
|
y = view->yabs + view->ylen * 0.35;
|
|
|
|
else
|
|
|
|
y = view->yabs + 48;
|
|
|
|
|
|
|
|
do {
|
|
|
|
// scan the width of the line
|
|
|
|
for (l = 0; l < 40; l++)
|
|
|
|
if (start[l] == '\n' || !start[l])
|
|
|
|
break;
|
|
|
|
x = view->xabs + (view->xlen - l * 8) / 2;
|
|
|
|
for (j = 0; j < l; j++, x += 8) {
|
2012-02-14 10:47:02 +00:00
|
|
|
r_funcs->Draw_Character (x, y, start[j]);
|
2004-03-02 03:55:18 +00:00
|
|
|
if (!remaining--)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
y += 8;
|
|
|
|
|
|
|
|
while (*start && *start != '\n')
|
|
|
|
start++;
|
|
|
|
if (!*start)
|
|
|
|
break;
|
|
|
|
start++; // skip the \n
|
|
|
|
} while (1);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2004-03-02 03:55:18 +00:00
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
void
|
|
|
|
Sbar_FinaleOverlay (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2004-03-02 00:58:13 +00:00
|
|
|
int remaining;
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->scr_copyeverything = 1;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
draw_cachepic (hud_overlay_view, 0, 16, "gfx/finale.lmp", 1);
|
2004-03-02 00:58:13 +00:00
|
|
|
// the finale prints the characters one at a time
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
remaining = scr_printspeed * (realtime - centertime_start);
|
|
|
|
Sbar_DrawCenterString (hud_overlay_view, remaining);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2004-03-01 23:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Sbar_DrawCenterPrint (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->scr_copytop = 1;
|
2004-03-02 00:58:13 +00:00
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
centertime_off -= r_data->frametime;
|
2004-03-02 03:55:18 +00:00
|
|
|
if (centertime_off <= 0)
|
2004-03-02 00:58:13 +00:00
|
|
|
return;
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Sbar_DrawCenterString (hud_overlay_view, -1);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Sbar_Draw (void)
|
|
|
|
{
|
|
|
|
if (cls.state != ca_active) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sb_update_flags = ~0;
|
|
|
|
if (sb_update_flags & (1 << sbc_ammo)) {
|
|
|
|
draw_miniammo (sbar_miniammo);
|
|
|
|
draw_ammo (sbar_ammo);
|
|
|
|
}
|
|
|
|
if (sb_update_flags & (1 << sbc_armor)) draw_armor (sbar_armor);
|
|
|
|
if (sb_update_flags & (1 << sbc_frags)) draw_frags (sbar_frags);
|
|
|
|
if (sb_update_flags & (1 << sbc_health)) draw_health (sbar_health);
|
|
|
|
if (sb_update_flags & (1 << sbc_info)) {
|
|
|
|
draw_miniteam (0);
|
|
|
|
draw_minifrags (0);
|
|
|
|
draw_stuff (0);
|
|
|
|
draw_overlay (0);
|
|
|
|
//draw_intermission (0);
|
|
|
|
Sbar_DeathmatchOverlay (0, 0);
|
|
|
|
sbar_update_vis ();
|
|
|
|
}
|
|
|
|
if (sb_update_flags & (1 << sbc_items)) {
|
|
|
|
draw_items (sbar_items);
|
|
|
|
draw_sigils (sbar_items);
|
|
|
|
}
|
|
|
|
if (sb_update_flags & (1 << sbc_weapon)) draw_weapons_sbar (sbar_weapons);
|
|
|
|
if (sb_update_flags & ((1 << sbc_health) | (1 << sbc_items))) {
|
|
|
|
draw_face (sbar_face);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
sbar_update_vis ();
|
|
|
|
hud_main_view->draw (hud_main_view);
|
|
|
|
#endif
|
|
|
|
sb_update_flags = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
static void
|
2003-05-08 04:13:42 +00:00
|
|
|
init_sbar_views (void)
|
2003-05-07 15:58:15 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-07 15:58:15 +00:00
|
|
|
view_t *view;
|
2003-05-08 05:49:57 +00:00
|
|
|
view_t *minifrags_view = 0;
|
|
|
|
view_t *miniteam_view = 0;
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
if (cl_screen_view->xlen < 512) {
|
2003-05-07 15:58:15 +00:00
|
|
|
sbar_view = view_new (0, 0, 320, 48, grav_south);
|
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
sbar_frags_view = view_new (0, 0, 130, 8, grav_northeast);
|
|
|
|
sbar_frags_view->draw = draw_frags;
|
2022-09-21 08:31:18 +00:00
|
|
|
} else if (cl_screen_view->xlen < 640) {
|
2003-05-07 15:58:15 +00:00
|
|
|
sbar_view = view_new (0, 0, 512, 48, grav_south);
|
|
|
|
minifrags_view = view_new (320, 0, 192, 48, grav_southwest);
|
|
|
|
minifrags_view->draw = draw_minifrags;
|
|
|
|
minifrags_view->resize_y = 1;
|
|
|
|
|
|
|
|
view = view_new (0, 0, 192, 48, grav_southeast);
|
|
|
|
view->draw = draw_tile;
|
|
|
|
view->resize_y = 1;
|
|
|
|
view_add (sbar_view, view);
|
|
|
|
} else {
|
|
|
|
sbar_view = view_new (0, 0, 640, 48, grav_south);
|
|
|
|
minifrags_view = view_new (320, 0, 192, 48, grav_southwest);
|
|
|
|
minifrags_view->draw = draw_minifrags;
|
|
|
|
minifrags_view->resize_y = 1;
|
|
|
|
miniteam_view = view_new (0, 0, 96, 48, grav_southeast);
|
|
|
|
miniteam_view->draw = draw_miniteam;
|
|
|
|
miniteam_view->resize_y = 1;
|
|
|
|
|
|
|
|
view = view_new (0, 0, 320, 48, grav_southeast);
|
|
|
|
view->draw = draw_tile;
|
|
|
|
view->resize_y = 1;
|
|
|
|
view_add (sbar_view, view);
|
|
|
|
}
|
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
sbar_inventory_view = view_new (0, 0, 320, 24, grav_northwest);
|
|
|
|
sbar_inventory_view->draw = draw_inventory_sbar;
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
view = view_new (0, 0, 32, 16, grav_southwest);
|
2003-05-08 04:13:42 +00:00
|
|
|
view->draw = draw_weapons_sbar;
|
|
|
|
view_add (sbar_inventory_view, view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
view = view_new (0, 0, 32, 8, grav_northwest);
|
2003-05-08 04:13:42 +00:00
|
|
|
view->draw = draw_ammo_sbar;
|
|
|
|
view_add (sbar_inventory_view, view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
view = view_new (32, 0, 96, 16, grav_southeast);
|
2003-05-07 15:58:15 +00:00
|
|
|
view->draw = draw_items;
|
2003-05-08 04:13:42 +00:00
|
|
|
view_add (sbar_inventory_view, view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
view = view_new (0, 0, 32, 16, grav_southeast);
|
|
|
|
view->draw = draw_sigils;
|
2003-05-08 04:13:42 +00:00
|
|
|
view_add (sbar_inventory_view, view);
|
|
|
|
|
|
|
|
if (sbar_frags_view)
|
|
|
|
view_add (sbar_inventory_view, sbar_frags_view);
|
|
|
|
|
|
|
|
view_add (sbar_view, sbar_inventory_view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
view = view_new (0, 0, 320, 24, grav_southwest);
|
|
|
|
view->draw = draw_status_bar;
|
|
|
|
view_add (sbar_view, view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2003-05-08 04:13:42 +00:00
|
|
|
view = view_new (0, 0, 320, 24, grav_southwest);
|
|
|
|
view->draw = draw_status;
|
|
|
|
view_add (sbar_view, view);
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
if (minifrags_view)
|
|
|
|
view_add (sbar_view, minifrags_view);
|
|
|
|
if (miniteam_view)
|
|
|
|
view_add (sbar_view, miniteam_view);
|
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
if (cl_screen_view->xlen > 640) {
|
|
|
|
int l = (cl_screen_view->xlen - 640) / 2;
|
2003-05-07 15:58:15 +00:00
|
|
|
|
|
|
|
view = view_new (-l, 0, l, 48, grav_southwest);
|
|
|
|
view->draw = draw_tile;
|
|
|
|
view->resize_y = 1;
|
|
|
|
view_add (sbar_view, view);
|
|
|
|
|
|
|
|
view = view_new (-l, 0, l, 48, grav_southeast);
|
|
|
|
view->draw = draw_tile;
|
|
|
|
view->resize_y = 1;
|
|
|
|
view_add (sbar_view, view);
|
|
|
|
}
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
|
|
|
sbar_main = sbar_view ( 0, 0, 320, 48, grav_south, cl_screen_view);
|
|
|
|
sbar_inventory = sbar_view ( 0, 0, 320, 24, grav_northwest, sbar_main);
|
|
|
|
sbar_frags = sbar_view ( 0, 0, 130, 8, grav_northeast, sbar_inventory);
|
|
|
|
sbar_sigils = sbar_view ( 0, 0, 32, 16, grav_southeast, sbar_inventory);
|
|
|
|
sbar_items = sbar_view (32, 0, 96, 16, grav_southeast, sbar_inventory);
|
|
|
|
sbar_armament = sbar_view ( 0, 0, 202, 24, grav_northwest, sbar_inventory);
|
|
|
|
sbar_weapons = sbar_view ( 0, 0, 192, 16, grav_southwest, sbar_armament);
|
|
|
|
sbar_miniammo = sbar_view ( 0, 0, 32, 8, grav_northwest, sbar_armament);
|
|
|
|
sbar_statusbar = sbar_view ( 0, 0, 320, 24, grav_southwest, sbar_main);
|
|
|
|
sbar_armor = sbar_view ( 0, 0, 96, 24, grav_northwest, sbar_statusbar);
|
|
|
|
sbar_face = sbar_view (112, 0, 24, 24, grav_northwest, sbar_statusbar);
|
|
|
|
sbar_health = sbar_view (136, 0, 72, 24, grav_northwest, sbar_statusbar);
|
|
|
|
sbar_ammo = sbar_view (224, 0, 96, 24, grav_northwest, sbar_statusbar);
|
|
|
|
sbar_tile[0] = sbar_view ( 0, 0, 0, 48, grav_southwest, sbar_main);
|
|
|
|
sbar_tile[1] = sbar_view ( 0, 0, 0, 48, grav_southeast, sbar_main);
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
sbar_view (i * 8, 0, 8, 16, grav_northwest, sbar_sigils);
|
|
|
|
|
|
|
|
sbar_view (i * 24, 0, 24, 24, grav_northwest, sbar_armor);
|
|
|
|
sbar_view (i * 24, 0, 24, 24, grav_northwest, sbar_ammo);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
sbar_view (i * 16, 0, 16, 16, grav_northwest, sbar_items);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
sbar_view (i * 24, 0, 24, 16, grav_northwest, sbar_weapons);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
sbar_view (i * 24, 0, 24, 16, grav_northwest, sbar_health);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
view_t v = sbar_view (i * 48 + 10, 0, 8, 8, grav_northwest,
|
|
|
|
sbar_miniammo);
|
|
|
|
draw_charbuffer_t *buffer = Draw_CreateBuffer (3, 1);
|
|
|
|
sbar_setcomponent (v, hud_charbuff, &buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
sbar_setcomponent (sbar_inventory, hud_pic, &sb_ibar);
|
|
|
|
sbar_setcomponent (sbar_statusbar, hud_pic, &sb_sbar);
|
|
|
|
|
|
|
|
if (r_data->vid->width > 320) {
|
|
|
|
int l = (r_data->vid->width - 320) / 2;
|
|
|
|
View_SetPos (sbar_tile[0], -l, 0);
|
|
|
|
View_SetLen (sbar_tile[0], l, 48);
|
|
|
|
View_SetPos (sbar_tile[1], -l, 0);
|
|
|
|
View_SetLen (sbar_tile[1], l, 48);
|
|
|
|
sbar_setcomponent (sbar_tile[0], hud_tile, 0);
|
|
|
|
sbar_setcomponent (sbar_tile[1], hud_tile, 0);
|
|
|
|
}
|
2003-05-08 04:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_hud_views (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2003-05-08 04:13:42 +00:00
|
|
|
view_t *view;
|
2003-05-08 05:49:57 +00:00
|
|
|
view_t *minifrags_view = 0;
|
|
|
|
view_t *miniteam_view = 0;
|
2003-05-08 04:13:42 +00:00
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
if (cl_screen_view->xlen < 512) {
|
2003-05-08 04:13:42 +00:00
|
|
|
hud_view = view_new (0, 0, 320, 48, grav_south);
|
|
|
|
|
|
|
|
hud_frags_view = view_new (0, 0, 130, 8, grav_northeast);
|
|
|
|
hud_frags_view->draw = draw_frags;
|
2022-09-21 08:31:18 +00:00
|
|
|
} else if (cl_screen_view->xlen < 640) {
|
2003-05-08 04:13:42 +00:00
|
|
|
hud_view = view_new (0, 0, 512, 48, grav_south);
|
|
|
|
|
|
|
|
minifrags_view = view_new (320, 0, 192, 48, grav_southwest);
|
|
|
|
minifrags_view->draw = draw_minifrags;
|
|
|
|
minifrags_view->resize_y = 1;
|
|
|
|
} else {
|
|
|
|
hud_view = view_new (0, 0, 640, 48, grav_south);
|
|
|
|
|
|
|
|
minifrags_view = view_new (320, 0, 192, 48, grav_southwest);
|
|
|
|
minifrags_view->draw = draw_minifrags;
|
|
|
|
minifrags_view->resize_y = 1;
|
|
|
|
|
|
|
|
miniteam_view = view_new (0, 0, 96, 48, grav_southeast);
|
|
|
|
miniteam_view->draw = draw_miniteam;
|
|
|
|
miniteam_view->resize_y = 1;
|
2003-05-07 17:23:18 +00:00
|
|
|
}
|
2003-05-08 04:13:42 +00:00
|
|
|
hud_view->resize_y = 1;
|
|
|
|
|
|
|
|
hud_armament_view = view_new (0, 48, 42, 156, grav_southeast);
|
|
|
|
|
|
|
|
view = view_new (0, 0, 42, 44, grav_northeast);
|
|
|
|
view->draw = draw_weapons_hud;
|
|
|
|
view_add (hud_armament_view, view);
|
|
|
|
|
|
|
|
view = view_new (0, 0, 42, 44, grav_southeast);
|
|
|
|
view->draw = draw_ammo_hud;
|
|
|
|
view_add (hud_armament_view, view);
|
|
|
|
|
|
|
|
hud_inventory_view = view_new (0, 0, 320, 24, grav_northwest);
|
|
|
|
view_add (hud_view, hud_inventory_view);
|
|
|
|
|
|
|
|
view = view_new (0, 0, 320, 24, grav_southwest);
|
|
|
|
view->draw = draw_status;
|
|
|
|
view_add (hud_view, view);
|
|
|
|
|
|
|
|
view = view_new (32, 0, 96, 16, grav_southeast);
|
|
|
|
view->draw = draw_items;
|
|
|
|
view_add (hud_inventory_view, view);
|
|
|
|
|
|
|
|
view = view_new (0, 0, 32, 16, grav_southeast);
|
|
|
|
view->draw = draw_sigils;
|
|
|
|
view_add (hud_inventory_view, view);
|
|
|
|
|
|
|
|
if (hud_frags_view)
|
|
|
|
view_add (hud_inventory_view, hud_frags_view);
|
|
|
|
|
|
|
|
if (minifrags_view)
|
|
|
|
view_add (hud_view, minifrags_view);
|
|
|
|
if (miniteam_view)
|
|
|
|
view_add (hud_view, miniteam_view);
|
|
|
|
|
2022-09-21 08:31:18 +00:00
|
|
|
view = view_new (0, 0, cl_screen_view->xlen, 48, grav_south);
|
2022-09-21 16:40:30 +00:00
|
|
|
view->resize_x = 1;
|
2003-05-08 04:13:42 +00:00
|
|
|
view_add (view, hud_view);
|
|
|
|
hud_view = view;
|
|
|
|
|
|
|
|
view_add (hud_view, hud_armament_view);
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
view_insert (hud_main_view, hud_view, 0);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 04:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_views (void)
|
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
#if 0
|
2022-09-21 08:31:18 +00:00
|
|
|
hud_main_view = view_new (0, 0, cl_screen_view->xlen, cl_screen_view->ylen,
|
|
|
|
grav_northwest);
|
|
|
|
view_insert (cl_screen_view, hud_main_view, 0);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
hud_main_view->resize_x = 1; // get resized if the 2d view resizes
|
|
|
|
hud_main_view->resize_y = 1;
|
|
|
|
hud_main_view->visible = 0; // but don't let the console draw our stuff
|
2022-09-21 08:31:18 +00:00
|
|
|
if (cl_screen_view->ylen > 300)
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
hud_overlay_view = view_new (0, 0, 320, 300, grav_center);
|
2003-05-08 04:13:42 +00:00
|
|
|
else
|
2022-09-21 08:31:18 +00:00
|
|
|
hud_overlay_view = view_new (0, 0, 320, cl_screen_view->ylen,
|
|
|
|
grav_center);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
hud_overlay_view->draw = draw_overlay;
|
|
|
|
hud_overlay_view->visible = 0;
|
2003-05-08 04:13:42 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
hud_stuff_view = view_new (0, 48, 152, 16, grav_southwest);
|
|
|
|
hud_stuff_view->draw = draw_stuff;
|
2003-05-08 05:49:57 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
view_insert (hud_main_view, hud_overlay_view, 0);
|
|
|
|
view_insert (hud_main_view, hud_stuff_view, 0);
|
2022-10-31 15:40:52 +00:00
|
|
|
#endif
|
2003-05-08 04:13:42 +00:00
|
|
|
init_sbar_views ();
|
|
|
|
init_hud_views ();
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
|
|
|
|
2004-03-02 03:55:18 +00:00
|
|
|
static void
|
|
|
|
Sbar_GIB_Print_Center_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc () != 2) {
|
|
|
|
GIB_USAGE ("text");
|
|
|
|
} else
|
|
|
|
Sbar_CenterPrint (GIB_Argv(1));
|
|
|
|
}
|
2021-11-28 15:03:53 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
static void
|
|
|
|
load_pics (void)
|
2003-05-07 15:58:15 +00:00
|
|
|
{
|
2022-10-31 15:40:52 +00:00
|
|
|
for (int i = 0; i < 10; i++) {
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_nums[0][i] = r_funcs->Draw_PicFromWad (va (0, "num_%i", i));
|
|
|
|
sb_nums[1][i] = r_funcs->Draw_PicFromWad (va (0, "anum_%i", i));
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
sb_nums[0][10] = r_funcs->Draw_PicFromWad ("num_minus");
|
|
|
|
sb_nums[1][10] = r_funcs->Draw_PicFromWad ("anum_minus");
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
sb_colon = r_funcs->Draw_PicFromWad ("num_colon");
|
|
|
|
sb_slash = r_funcs->Draw_PicFromWad ("num_slash");
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
sb_weapons[0][0] = r_funcs->Draw_PicFromWad ("inv_shotgun");
|
|
|
|
sb_weapons[0][1] = r_funcs->Draw_PicFromWad ("inv_sshotgun");
|
|
|
|
sb_weapons[0][2] = r_funcs->Draw_PicFromWad ("inv_nailgun");
|
|
|
|
sb_weapons[0][3] = r_funcs->Draw_PicFromWad ("inv_snailgun");
|
|
|
|
sb_weapons[0][4] = r_funcs->Draw_PicFromWad ("inv_rlaunch");
|
|
|
|
sb_weapons[0][5] = r_funcs->Draw_PicFromWad ("inv_srlaunch");
|
|
|
|
sb_weapons[0][6] = r_funcs->Draw_PicFromWad ("inv_lightng");
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
sb_weapons[1][0] = r_funcs->Draw_PicFromWad ("inv2_shotgun");
|
|
|
|
sb_weapons[1][1] = r_funcs->Draw_PicFromWad ("inv2_sshotgun");
|
|
|
|
sb_weapons[1][2] = r_funcs->Draw_PicFromWad ("inv2_nailgun");
|
|
|
|
sb_weapons[1][3] = r_funcs->Draw_PicFromWad ("inv2_snailgun");
|
|
|
|
sb_weapons[1][4] = r_funcs->Draw_PicFromWad ("inv2_rlaunch");
|
|
|
|
sb_weapons[1][5] = r_funcs->Draw_PicFromWad ("inv2_srlaunch");
|
|
|
|
sb_weapons[1][6] = r_funcs->Draw_PicFromWad ("inv2_lightng");
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
for (int i = 0; i < 5; i++) {
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][0] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_shotgun",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][1] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_sshotgun",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][2] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_nailgun",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][3] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_snailgun",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][4] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_rlaunch",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][5] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_srlaunch",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2021-01-31 07:01:20 +00:00
|
|
|
sb_weapons[2 + i][6] = r_funcs->Draw_PicFromWad (va (0,
|
|
|
|
"inva%i_lightng",
|
2012-02-14 10:47:02 +00:00
|
|
|
i + 1));
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
sb_ammo[0] = r_funcs->Draw_PicFromWad ("sb_shells");
|
|
|
|
sb_ammo[1] = r_funcs->Draw_PicFromWad ("sb_nails");
|
|
|
|
sb_ammo[2] = r_funcs->Draw_PicFromWad ("sb_rocket");
|
|
|
|
sb_ammo[3] = r_funcs->Draw_PicFromWad ("sb_cells");
|
|
|
|
|
|
|
|
sb_armor[0] = r_funcs->Draw_PicFromWad ("sb_armor1");
|
|
|
|
sb_armor[1] = r_funcs->Draw_PicFromWad ("sb_armor2");
|
|
|
|
sb_armor[2] = r_funcs->Draw_PicFromWad ("sb_armor3");
|
|
|
|
|
|
|
|
sb_items[0] = r_funcs->Draw_PicFromWad ("sb_key1");
|
|
|
|
sb_items[1] = r_funcs->Draw_PicFromWad ("sb_key2");
|
|
|
|
sb_items[2] = r_funcs->Draw_PicFromWad ("sb_invis");
|
|
|
|
sb_items[3] = r_funcs->Draw_PicFromWad ("sb_invuln");
|
|
|
|
sb_items[4] = r_funcs->Draw_PicFromWad ("sb_suit");
|
|
|
|
sb_items[5] = r_funcs->Draw_PicFromWad ("sb_quad");
|
|
|
|
|
|
|
|
sb_sigil[0] = r_funcs->Draw_PicFromWad ("sb_sigil1");
|
|
|
|
sb_sigil[1] = r_funcs->Draw_PicFromWad ("sb_sigil2");
|
|
|
|
sb_sigil[2] = r_funcs->Draw_PicFromWad ("sb_sigil3");
|
|
|
|
sb_sigil[3] = r_funcs->Draw_PicFromWad ("sb_sigil4");
|
|
|
|
|
|
|
|
sb_faces[4][0] = r_funcs->Draw_PicFromWad ("face1");
|
|
|
|
sb_faces[4][1] = r_funcs->Draw_PicFromWad ("face_p1");
|
|
|
|
sb_faces[3][0] = r_funcs->Draw_PicFromWad ("face2");
|
|
|
|
sb_faces[3][1] = r_funcs->Draw_PicFromWad ("face_p2");
|
|
|
|
sb_faces[2][0] = r_funcs->Draw_PicFromWad ("face3");
|
|
|
|
sb_faces[2][1] = r_funcs->Draw_PicFromWad ("face_p3");
|
|
|
|
sb_faces[1][0] = r_funcs->Draw_PicFromWad ("face4");
|
|
|
|
sb_faces[1][1] = r_funcs->Draw_PicFromWad ("face_p4");
|
|
|
|
sb_faces[0][0] = r_funcs->Draw_PicFromWad ("face5");
|
|
|
|
sb_faces[0][1] = r_funcs->Draw_PicFromWad ("face_p5");
|
|
|
|
|
|
|
|
sb_face_invis = r_funcs->Draw_PicFromWad ("face_invis");
|
|
|
|
sb_face_invuln = r_funcs->Draw_PicFromWad ("face_invul2");
|
|
|
|
sb_face_invis_invuln = r_funcs->Draw_PicFromWad ("face_inv2");
|
|
|
|
sb_face_quad = r_funcs->Draw_PicFromWad ("face_quad");
|
2003-05-07 15:58:15 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
sb_sbar = r_funcs->Draw_PicFromWad ("sbar");
|
|
|
|
sb_ibar = r_funcs->Draw_PicFromWad ("ibar");
|
|
|
|
sb_scorebar = r_funcs->Draw_PicFromWad ("scorebar");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Sbar_Init (void)
|
|
|
|
{
|
|
|
|
load_pics ();
|
|
|
|
init_views ();
|
|
|
|
View_UpdateHierarchy (sbar_main);
|
|
|
|
|
2003-05-07 15:58:15 +00:00
|
|
|
Cmd_AddCommand ("+showscores", Sbar_ShowScores,
|
|
|
|
"Display information on everyone playing");
|
|
|
|
Cmd_AddCommand ("-showscores", Sbar_DontShowScores,
|
|
|
|
"Stop displaying information on everyone playing");
|
|
|
|
Cmd_AddCommand ("+showteamscores", Sbar_ShowTeamScores,
|
|
|
|
"Display information for your team");
|
|
|
|
Cmd_AddCommand ("-showteamscores", Sbar_DontShowTeamScores,
|
|
|
|
"Stop displaying information for your team");
|
|
|
|
|
2012-02-14 10:47:02 +00:00
|
|
|
r_data->viewsize_callback = viewsize_f;
|
2003-05-07 15:58:15 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
HUD_Init_Cvars ();
|
|
|
|
|
|
|
|
Cvar_Register (&hud_scoreboard_uid_cvar, Sbar_DMO_Init_f, 0);
|
|
|
|
Cvar_Register (&fs_fraglog_cvar, 0, 0);
|
|
|
|
Cvar_Register (&cl_fraglog_cvar, 0, 0);
|
|
|
|
Cvar_Register (&scr_centertime_cvar, 0, 0);
|
|
|
|
Cvar_Register (&scr_printspeed_cvar, 0, 0);
|
2004-03-02 03:55:18 +00:00
|
|
|
|
|
|
|
// register GIB builtins
|
|
|
|
GIB_Builtin_Add ("print::center", Sbar_GIB_Print_Center_f);
|
2003-05-07 15:58:15 +00:00
|
|
|
}
|