Some new stuff for the hud plugin.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1884 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
e3cb464de9
commit
48514d4807
3 changed files with 71 additions and 4 deletions
|
@ -116,6 +116,9 @@ BUILTINR(int, Cvar_Update, (qhandle_t handle, int *modificationcount, char *stri
|
|||
#define ARGNAMES ,pnum,stats,maxstats
|
||||
BUILTIN(void, CL_GetStats, (int pnum, unsigned int *stats, int maxstats));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,pnum,info
|
||||
BUILTIN(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info));
|
||||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,soundname
|
||||
BUILTIN(void, LocalSound, (char *soundname));
|
||||
|
@ -306,6 +309,7 @@ void Plug_InitStandardBuiltins(void)
|
|||
|
||||
//random things
|
||||
CHECKBUILTIN(CL_GetStats);
|
||||
CHECKBUILTIN(GetPlayerInfo);
|
||||
CHECKBUILTIN(LocalSound);
|
||||
CHECKBUILTIN(Menu_Control);
|
||||
CHECKBUILTIN(Key_GetKeyCode);
|
||||
|
|
|
@ -82,6 +82,24 @@ typedef float vec3_t[3];
|
|||
typedef void* funcptr_t;
|
||||
|
||||
|
||||
#define PLUGMAX_SCOREBOARDNAME 64
|
||||
typedef struct {
|
||||
int topcolour;
|
||||
int bottomcolour;
|
||||
int frags;
|
||||
char name[PLUGMAX_SCOREBOARDNAME];
|
||||
int ping;
|
||||
int pl;
|
||||
int starttime;
|
||||
int userid;
|
||||
int spectator;
|
||||
char userinfo[1024];
|
||||
char team[8];
|
||||
} plugclientinfo_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Basic builtins:
|
||||
EBUILTIN(funcptr_t, Plug_GetEngineFunction, (char *funcname)); //set up in vmMain, use this to get all other builtins
|
||||
|
@ -114,6 +132,7 @@ EBUILTIN(int, Cvar_Update, (qhandle_t handle, int *modificationcount, char *stri
|
|||
EBUILTIN(void, GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
EBUILTIN(void, LocalSound, (char *soundname));
|
||||
EBUILTIN(void, CL_GetStats, (int pnum, unsigned int *stats, int maxstats));
|
||||
EBUILTIN(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info));
|
||||
|
||||
EBUILTIN(void, Menu_Control, (int mnum));
|
||||
#define MENU_CLEAR 0
|
||||
|
|
|
@ -18,7 +18,7 @@ int vsnprintf(char *buffer, int maxlen, char *format, va_list vargs)
|
|||
int _int;
|
||||
float _float;
|
||||
int i;
|
||||
int use0s;
|
||||
int use0s, useprepad;
|
||||
int precision;
|
||||
|
||||
if (!maxlen)
|
||||
|
@ -31,10 +31,14 @@ maxlen--;
|
|||
{
|
||||
case '%':
|
||||
precision= 0;
|
||||
useprepad=0;
|
||||
use0s=0;
|
||||
retry:
|
||||
switch(*(++format))
|
||||
{
|
||||
case '-':
|
||||
useprepad=true;
|
||||
goto retry;
|
||||
case '0':
|
||||
if (!precision)
|
||||
{
|
||||
|
@ -140,6 +144,38 @@ retry:
|
|||
case 'u':
|
||||
case 'i':
|
||||
_int = va_arg(vargs, int);
|
||||
/*
|
||||
if (useprepad)
|
||||
{
|
||||
if (_int >= 1000)
|
||||
useprepad = 4;
|
||||
else if (_int >= 100)
|
||||
useprepad = 3;
|
||||
else if (_int >= 10)
|
||||
useprepad = 2;
|
||||
else if (_int >= 0)
|
||||
useprepad = 1;
|
||||
else if (_int <= -1000)
|
||||
useprepad = 5;
|
||||
else if (_int <= -100)
|
||||
useprepad = 4;
|
||||
else if (_int <= -10)
|
||||
useprepad = 3;
|
||||
else
|
||||
useprepad = 2;
|
||||
|
||||
useprepad = precision - useprepad;
|
||||
Con_Printf("add %i chars\n", useprepad);
|
||||
while (useprepad>0)
|
||||
{
|
||||
if (--maxlen < 0)
|
||||
{*buffer++='\0';return tokens;}
|
||||
*buffer++ = ' ';
|
||||
useprepad--;
|
||||
}
|
||||
Con_Printf("%i bytes left\n", maxlen);
|
||||
}
|
||||
*/
|
||||
if (_int < 0)
|
||||
{
|
||||
if (--maxlen < 0)
|
||||
|
@ -166,13 +202,21 @@ retry:
|
|||
}
|
||||
|
||||
precision -= 62-i;
|
||||
while (precision>0)
|
||||
/* while (precision>0)
|
||||
{
|
||||
string--;
|
||||
*string = ' ';
|
||||
precision--;
|
||||
}
|
||||
*/
|
||||
while(precision>0)
|
||||
{
|
||||
if (--maxlen < 0)
|
||||
{*buffer++='\0';return tokens;}
|
||||
if (use0s)
|
||||
*string = '0';
|
||||
*buffer++ = '0';
|
||||
else
|
||||
*string = ' ';
|
||||
*buffer++ = ' ';
|
||||
precision--;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue