implemented autotracking, hightrack is no longer quite so obnoxious.
implement cfg_save_all cvar, so cfg_save can save all. downloads attempt to avoid using the fte/ gamedir actually registering r_tracker_frags cvar. fix ezhud wad image issues. fix mouse binds not working when running fullscreen. dedicated servers can now use getsurface builtins. gl_font can now attempt to use conchars subdir too. terrain editor can now display the areas which cannot accept the selected texture for painting. this should help reduce edges. attempt to fix some of the less-supported ports. don't be annoying with entity foo = someclass; fteqcc now offers to create files if you try opening one that doesn't exist. plugins can now query ping etc info properly. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4893 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
daa4496b7c
commit
3fd21ea6ea
52 changed files with 1097 additions and 437 deletions
|
@ -223,8 +223,51 @@ char *TP_ItemName(unsigned int itbit)
|
|||
return "Dunno";
|
||||
}
|
||||
|
||||
void Replace_In_String(char *string, size_t strsize, char leadchar, int patterns, ...)
|
||||
void Replace_In_String(char *src, size_t strsize, char leadchar, int patterns, ...)
|
||||
{
|
||||
char orig[1024];
|
||||
char *out, *outstop;
|
||||
va_list ap;
|
||||
int i;
|
||||
|
||||
strlcpy(orig, src, sizeof(orig));
|
||||
out = src;
|
||||
outstop = out + strsize-1;
|
||||
src = orig;
|
||||
|
||||
while(*src)
|
||||
{
|
||||
if (out == outstop)
|
||||
break;
|
||||
if (*src != leadchar)
|
||||
*out++ = *src++;
|
||||
else if (*++src == leadchar)
|
||||
*out++ = leadchar;
|
||||
else
|
||||
{
|
||||
va_start(ap, patterns);
|
||||
for (i = 0; i < patterns; i++)
|
||||
{
|
||||
const char *arg = va_arg(ap, const char *);
|
||||
const char *val = va_arg(ap, const char *);
|
||||
size_t alen = strlen(arg);
|
||||
if (!strncmp(src, arg, strlen(arg)))
|
||||
{
|
||||
strlcpy(out, val, (outstop-out)+1);
|
||||
out += strlen(out);
|
||||
src += alen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == patterns)
|
||||
{
|
||||
strlcpy(out, "unknown", (outstop-out)+1);
|
||||
out += strlen(out);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
*out = 0;
|
||||
}
|
||||
|
||||
int SCR_GetClockStringWidth(const char *s, qbool big, float scale)
|
||||
|
@ -356,6 +399,13 @@ void SCR_DrawSmallClock(int x, int y, int style, int blink, float scale, const c
|
|||
}
|
||||
}
|
||||
|
||||
#include "builtin_huds.h"
|
||||
void EZHud_UseNquake_f(void)
|
||||
{
|
||||
const char *hudstr = builtin_hud_nquake;
|
||||
pCmd_AddText(hudstr, true);
|
||||
}
|
||||
|
||||
struct
|
||||
{
|
||||
xcommand_t cmd;
|
||||
|
@ -577,6 +627,7 @@ qintptr_t Plug_Init(qintptr_t *args)
|
|||
Plug_Export("Tick", EZHud_Tick) &&
|
||||
Plug_Export("ExecuteCommand", EZHud_ExecuteCommand))
|
||||
{
|
||||
Cmd_AddCommand("ezhud_nquake", EZHud_UseNquake_f);
|
||||
HUD_Init();
|
||||
HUD_Editor_Init();
|
||||
return 1;
|
||||
|
|
|
@ -393,6 +393,10 @@ void SCR_HUD_DrawFPS(hud_t *hud)
|
|||
|
||||
if (HUD_PrepareDraw(hud, strlen(st)*8, 8, &x, &y))
|
||||
{
|
||||
vmnetinfo_t *netinfo = GetNetworkInfo();
|
||||
if (netinfo->capturing == 2) //don't show fps if its locked to something anyway.
|
||||
return;
|
||||
|
||||
if ((hud_fps_style->value) == 1)
|
||||
Draw_Alt_String(x, y, st);
|
||||
else if ((hud_fps_style->value) == 2) {
|
||||
|
@ -674,11 +678,11 @@ static void SCR_HUD_DrawPing(hud_t *hud)
|
|||
|
||||
// period = max(hud_ping_period->value, 0);
|
||||
|
||||
ping_avg = (int)(netinfo->ping.avg*1000 + 0.5);
|
||||
ping_min = (int)(netinfo->ping.mn*1000 + 0.5);
|
||||
ping_max = (int)(netinfo->ping.mx*1000 + 0.5);
|
||||
ping_dev = netinfo->ping.stddev;
|
||||
pl = netinfo->ping.loss*100;
|
||||
ping_avg = (int)(netinfo->ping.s_avg*1000 + 0.5);
|
||||
ping_min = (int)(netinfo->ping.s_mn*1000 + 0.5);
|
||||
ping_max = (int)(netinfo->ping.s_mx*1000 + 0.5);
|
||||
ping_dev = netinfo->ping.ms_stddev;
|
||||
pl = netinfo->loss.dropped*100;
|
||||
|
||||
clamp(ping_avg, 0, 999);
|
||||
clamp(ping_min, 0, 999);
|
||||
|
@ -937,28 +941,28 @@ static void SCR_NetStats(int x, int y, float period, vmnetinfo_t *netinfo)
|
|||
|
||||
last_calculated = t;
|
||||
|
||||
ping_avg = (int)(netinfo->ping.avg + 0.5);
|
||||
ping_min = (int)(netinfo->ping.mn + 0.5);
|
||||
ping_max = (int)(netinfo->ping.mx + 0.5);
|
||||
ping_dev = netinfo->ping.stddev;
|
||||
ping_avg = (int)(netinfo->ping.s_avg*1000 + 0.5);
|
||||
ping_min = (int)(netinfo->ping.s_mn*1000 + 0.5);
|
||||
ping_max = (int)(netinfo->ping.s_mx*1000 + 0.5);
|
||||
ping_dev = netinfo->ping.ms_stddev;
|
||||
|
||||
clamp(ping_avg, 0, 999);
|
||||
clamp(ping_min, 0, 999);
|
||||
clamp(ping_max, 0, 999);
|
||||
clamp(ping_dev, 0, 99.9);
|
||||
|
||||
f_avg = -1;//(int)(result.ping_f_avg + 0.5);
|
||||
f_min = -1;//(int)(result.ping_f_min + 0.5);
|
||||
f_max = -1;//(int)(result.ping_f_max + 0.5);
|
||||
f_avg = (int)(netinfo->ping.fr_avg+0.5);
|
||||
f_min = netinfo->ping.fr_mn;
|
||||
f_max = netinfo->ping.fr_mx;
|
||||
|
||||
clamp(f_avg, 0, 99.9);
|
||||
clamp(f_min, 0, 99.9);
|
||||
clamp(f_max, 0, 99.9);
|
||||
clamp(f_avg, 0, 99);
|
||||
clamp(f_min, 0, 99);
|
||||
clamp(f_max, 0, 99);
|
||||
|
||||
lost_lost = (int)(netinfo->ping.loss + 0.5);
|
||||
lost_rate = -1;//(int)(result.lost_rate + 0.5);
|
||||
lost_delta = -1;//(int)(result.lost_delta + 0.5);
|
||||
lost_total = -1;//(int)(result.lost_lost + result.lost_rate + result.lost_delta + 0.5);
|
||||
lost_lost = (int)(netinfo->loss.dropped*100 + 0.5);
|
||||
lost_rate = (int)(netinfo->loss.choked*100 + 0.5);
|
||||
lost_delta = (int)(netinfo->loss.invalid*100 + 0.5);
|
||||
lost_total = (int)((netinfo->loss.dropped + netinfo->loss.choked + netinfo->loss.invalid)*100 + 0.5);
|
||||
|
||||
clamp(lost_lost, 0, 100);
|
||||
clamp(lost_rate, 0, 100);
|
||||
|
@ -966,9 +970,9 @@ static void SCR_NetStats(int x, int y, float period, vmnetinfo_t *netinfo)
|
|||
clamp(lost_total, 0, 100);
|
||||
|
||||
//per packet sizes
|
||||
// size_in = (int)(netinfo->clrate.size_in + 0.5);
|
||||
// size_out = (int)(netinfo->size_out + 0.5);
|
||||
// size_all = (int)(netinfo->size_in + result.size_out + 0.5);
|
||||
size_in = (int)(netinfo->clrate.in_bps/netinfo->clrate.in_pps + 0.5);
|
||||
size_out = (int)(netinfo->clrate.out_bps/netinfo->clrate.out_pps + 0.5);
|
||||
size_all = (int)(netinfo->clrate.in_bps/netinfo->clrate.in_pps + netinfo->clrate.out_bps/netinfo->clrate.out_pps + 0.5);
|
||||
|
||||
//overall rate
|
||||
bandwidth_in = (int)(netinfo->clrate.in_bps + 0.5);
|
||||
|
@ -982,25 +986,25 @@ static void SCR_NetStats(int x, int y, float period, vmnetinfo_t *netinfo)
|
|||
clamp(bandwidth_out, 0, 99999);
|
||||
clamp(bandwidth_all, 0, 99999);
|
||||
|
||||
// with_delta = result.delta;
|
||||
with_delta = !pCvar_GetFloat("cl_nodelta");
|
||||
}
|
||||
|
||||
Draw_Alt_String(x+36, y, "latency");
|
||||
y+=12;
|
||||
|
||||
snprintf (line, sizeof (line), "min %4.1f %3d ms", f_min, ping_min);
|
||||
snprintf (line, sizeof (line), "min %4f %3d ms", f_min, ping_min);
|
||||
Draw_String(x, y, line);
|
||||
y+=8;
|
||||
|
||||
snprintf(line, sizeof (line), "avg %4.1f %3d ms", f_avg, ping_avg);
|
||||
snprintf(line, sizeof (line), "avg %4f %3d ms", f_avg, ping_avg);
|
||||
Draw_String(x, y, line);
|
||||
y+=8;
|
||||
|
||||
snprintf(line, sizeof (line), "max %4.1f %3d ms", f_max, ping_max);
|
||||
snprintf(line, sizeof (line), "max %4f %3d ms", f_max, ping_max);
|
||||
Draw_String(x, y, line);
|
||||
y+=8;
|
||||
|
||||
snprintf(line, sizeof (line), "dev %5.2f ms", ping_dev);
|
||||
snprintf(line, sizeof (line), "dev %f ms", ping_dev);
|
||||
Draw_String(x, y, line);
|
||||
y+=12;
|
||||
|
||||
|
@ -1060,9 +1064,11 @@ static void SCR_HUD_DrawNetStats(hud_t *hud)
|
|||
width = 16*8 ;
|
||||
height = 12 + 8 + 8 + 8 + 8 + 16 + 8 + 8 + 8 + 8 + 16 + 8 + 8 + 8;
|
||||
|
||||
if (HUD_PrepareDraw(hud, width, height, &x, &y))
|
||||
if (!netinfo || netinfo->capturing==2)
|
||||
HUD_PrepareDraw(hud, 0, 0, &x, &y);
|
||||
else if (HUD_PrepareDraw(hud, width, height, &x, &y))
|
||||
{
|
||||
// SCR_NetStats(x, y, hud_net_period->value);
|
||||
SCR_NetStats(x, y, hud_net_period->value, netinfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2401,7 +2407,7 @@ static void SCR_HUD_NetProblem (hud_t *hud) {
|
|||
if(scale == NULL)
|
||||
scale = HUD_FindVar(hud, "scale");
|
||||
|
||||
if (netinfo->ping.loss < 1)
|
||||
if (netinfo->loss.dropped < 1)
|
||||
{
|
||||
if (hud_editor)
|
||||
HUD_PrepareDraw(hud, picwidth, picheight, &x, &y);
|
||||
|
@ -2440,7 +2446,12 @@ void SCR_HUD_DrawGroup(hud_t *hud, int width, int height, mpic_t *pic, int pic_s
|
|||
float picwidth = 64;
|
||||
float picheight = 64;
|
||||
|
||||
pDraw_ImageSize((intptr_t)pic, &picwidth, &picheight);
|
||||
if (pic && pDraw_ImageSize((intptr_t)pic, &picwidth, &picheight) <= 0)
|
||||
{
|
||||
pic = NULL;
|
||||
picwidth = 64;
|
||||
picheight = 64;
|
||||
}
|
||||
|
||||
clamp(width, 1, 99999);
|
||||
clamp(height, 1, 99999);
|
||||
|
@ -7862,7 +7873,7 @@ void CommonDraw_Init(void)
|
|||
HUD_Register("tracking", NULL, "Shows the name of tracked player.",
|
||||
HUD_PLUSMINUS, ca_active, 9, SCR_HUD_DrawTracking,
|
||||
"1", "face", "center", "before", "0", "0", "0", "0 0 0", NULL,
|
||||
"format", "^mTracking:^m %t %n, ^mJUMP^m for next", //"Tracking: team name, JUMP for next", "Tracking:" and "JUMP" are brown. default: "Tracking %t %n, [JUMP] for next"
|
||||
"format", "^mTracking:^m %t %n"/*, ^mJUMP^m for next"*/, //"Tracking: team name, JUMP for next", "Tracking:" and "JUMP" are brown. default: "Tracking %t %n, [JUMP] for next"
|
||||
"scale", "1",
|
||||
NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue