mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
The beginnings of an f_* reply system have been added. f_version works
like normal, f_skins reports the average percent fullbright for all loaded skins, and f_skins skinname reports the fullbright percent for a signle skin. cl_freply controls the time in seconds before another query can be made. Set it to 0 to disable them. More queries will be added later. The table for accessing special characters from the console has been tweaked a bit. Expect it to get tweaked more in the future.
This commit is contained in:
parent
dc779acdb5
commit
008b59b777
8 changed files with 4152 additions and 15 deletions
|
@ -47,12 +47,15 @@ typedef struct skin_s
|
|||
} data;
|
||||
int texture;
|
||||
int fb_texture;
|
||||
int numfb;
|
||||
} skin_t;
|
||||
|
||||
extern byte player_8bit_texels[320 * 200];
|
||||
extern skin_t skin_cache[MAX_CACHED_SKINS];
|
||||
extern int skin_textures;
|
||||
extern int skin_fb_textures;
|
||||
extern int numskins;
|
||||
extern int fullfb;
|
||||
|
||||
struct tex_s;
|
||||
struct tex_s *Skin_Cache (skin_t *skin);
|
||||
|
|
4030
include/QF/skin_stencil.h
Normal file
4030
include/QF/skin_stencil.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -31,6 +31,14 @@
|
|||
|
||||
extern struct cvar_s *cl_parsesay;
|
||||
extern struct cvar_s *cl_nofake;
|
||||
extern struct cvar_s *cl_freply;
|
||||
|
||||
typedef char * (*ffunc_t) (char *args);
|
||||
typedef struct freply_s {
|
||||
char *name;
|
||||
ffunc_t func;
|
||||
float lasttime;
|
||||
} freply_t;
|
||||
|
||||
void Team_Init_Cvars (void);
|
||||
void Team_BestWeaponImpulse (void);
|
||||
|
@ -38,5 +46,6 @@ void Team_Dead (void);
|
|||
void Team_NewMap (void);
|
||||
const char *Team_ParseSay (const char *);
|
||||
void Locs_Init (void);
|
||||
|
||||
void Team_ParseChat (const char *string);
|
||||
void Team_ResetTimers (void);
|
||||
#endif // __teamplay_h
|
||||
|
|
|
@ -1076,22 +1076,25 @@ skipwhite:
|
|||
|
||||
struct stable_s {char a, b;} stable1[] =
|
||||
{
|
||||
{'\\', 13},
|
||||
{'[', 0x90},
|
||||
{'\\',0x0D}, // Fake message
|
||||
{'[', 0x90}, // Gold braces
|
||||
{']', 0x91},
|
||||
{'(', 0x80},
|
||||
{'(', 0x80}, // Scroll bar characters
|
||||
{'=', 0x81},
|
||||
{')', 0x82},
|
||||
{'|', 0x83},
|
||||
{'<', 0x9D},
|
||||
{'<', 0x9D}, // Vertical line characters
|
||||
{'-', 0X9E},
|
||||
{'>', 0x9F},
|
||||
{'.', 0x8E},
|
||||
{',', 0x0E},
|
||||
{'B', 0x8B},
|
||||
{'a', 0x7F},
|
||||
{'A', 0x8D},
|
||||
{'0', 0x92},
|
||||
{'.', 0x8E}, // Gold dot
|
||||
{',', 0x0E}, // White dot
|
||||
{'G', 0x86}, // Ocrana leds from ocrana.wad
|
||||
{'R', 0x87},
|
||||
{'Y', 0x88},
|
||||
{'B', 0x89},
|
||||
{'a', 0x7F}, // White arrow
|
||||
{'A', 0x8D}, // Brown arrow
|
||||
{'0', 0x92}, // Gold numbers
|
||||
{'1', 0x93},
|
||||
{'2', 0x94},
|
||||
{'3', 0x95},
|
||||
|
@ -1101,8 +1104,7 @@ struct stable_s {char a, b;} stable1[] =
|
|||
{'7', 0x99},
|
||||
{'8', 0x9A},
|
||||
{'9', 0x9B},
|
||||
{'\'', 0x7E},
|
||||
{'n', '\n'},
|
||||
{'n', '\n'}, // Newline!
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -495,6 +495,8 @@ CL_Disconnect (void)
|
|||
|
||||
CL_StopUpload ();
|
||||
|
||||
Team_ResetTimers ();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -630,6 +630,7 @@ CL_ParsePrint (void)
|
|||
}
|
||||
con_ormask = 128;
|
||||
S_LocalSound ("misc/talk.wav");
|
||||
Team_ParseChat(string);
|
||||
}
|
||||
Con_Printf ("%s", string);
|
||||
con_ormask = 0;
|
||||
|
|
|
@ -45,6 +45,7 @@ static const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
#include "QF/texture.h"
|
||||
#include "QF/vfs.h"
|
||||
#include "QF/skin_stencil.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
@ -67,6 +68,8 @@ int num_temp_skins;
|
|||
int skin_textures;
|
||||
int skin_fb_textures;
|
||||
|
||||
int fullfb;
|
||||
|
||||
static const char *
|
||||
skin_get_key (void *_skin, void *unused)
|
||||
{
|
||||
|
@ -142,7 +145,7 @@ Skin_Cache (skin_t *skin)
|
|||
tex_t *tex;
|
||||
int pixels;
|
||||
byte *ipix, *opix;
|
||||
int i;
|
||||
int i, numfb;
|
||||
|
||||
if (cls.downloadtype == dl_skin) // use base until downloaded
|
||||
return NULL;
|
||||
|
@ -195,6 +198,10 @@ Skin_Cache (skin_t *skin)
|
|||
|
||||
skin->failedload = false;
|
||||
|
||||
for (i = 0,numfb = 0; i < 320*200; i++)
|
||||
if (skin_stencil[i] && out->data[i] >= 256 - 32)
|
||||
numfb++;
|
||||
skin->numfb = numfb;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -241,8 +248,11 @@ Skin_Init_Textures (int base)
|
|||
void
|
||||
Skin_Init (void)
|
||||
{
|
||||
int i;
|
||||
skin_hash = Hash_NewTable (1021, skin_get_key, 0, 0);
|
||||
Skin_Init_Translation ();
|
||||
for (i = 0, fullfb = 0; i < 320*200; i++)
|
||||
fullfb += skin_stencil[i];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ static const char rcsid[] =
|
|||
|
||||
#include <errno.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -46,6 +48,8 @@ static const char rcsid[] =
|
|||
#include "QF/model.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/teamplay.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/skin.h"
|
||||
|
||||
#include "bothdefs.h"
|
||||
#include "cl_input.h"
|
||||
|
@ -59,7 +63,7 @@ cvar_t *cl_deadbodyfilter;
|
|||
cvar_t *cl_gibfilter;
|
||||
cvar_t *cl_parsesay;
|
||||
cvar_t *cl_nofake;
|
||||
|
||||
cvar_t *cl_freply;
|
||||
|
||||
|
||||
void
|
||||
|
@ -315,6 +319,8 @@ Team_Init_Cvars (void)
|
|||
"when you put %l in messages");
|
||||
cl_nofake = Cvar_Get ("cl_nofake", "0", CVAR_NONE, NULL,
|
||||
"Unhide fake messages");
|
||||
cl_freply = Cvar_Get ("cl_freply", "20", CVAR_NONE, NULL,
|
||||
"Delay between replies to f_*. Set to zero to disable.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -398,3 +404,77 @@ Locs_Init (void)
|
|||
Cmd_AddCommand ("loc", locs_loc, "Location marker editing commands: 'loc "
|
||||
"help' for more");
|
||||
}
|
||||
|
||||
char *
|
||||
Team_F_Version (char *args)
|
||||
{
|
||||
return va("say %s %s", PROGRAM, VERSION);
|
||||
}
|
||||
|
||||
char *
|
||||
Team_F_Skins (char *args)
|
||||
{
|
||||
int totalfb, i, l;
|
||||
skin_t *skin;
|
||||
|
||||
while(isspace(*args))
|
||||
args++;
|
||||
for (l = 0;args[l] && !isspace(args[l]);l++);
|
||||
|
||||
if (l == 0) {
|
||||
for (i = 0, totalfb = 0; i < numskins; i++)
|
||||
totalfb += skin_cache[i].numfb;
|
||||
return va("say Average percent fullbright for all loaded skins is %.1f", (float)totalfb/(float)(numskins * fullfb)*100.0);
|
||||
}
|
||||
|
||||
for (i = 0, skin = 0; i < numskins; i++) {
|
||||
if (!strncmp(skin_cache[i].name, args, l)) {
|
||||
skin = &skin_cache[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skin)
|
||||
return va("say \"Skin %s is %.1f%% fullbright\"",
|
||||
skin->name,
|
||||
(float)skin->numfb/(float)fullfb*100.0);
|
||||
else
|
||||
return ("say \"Skin not currently loaded.\"");
|
||||
}
|
||||
|
||||
freply_t f_replies[] = {
|
||||
{"f_version", Team_F_Version, 0},
|
||||
{"f_skins", Team_F_Skins, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
void
|
||||
Team_ParseChat (const char *string)
|
||||
{
|
||||
char *s;
|
||||
int i;
|
||||
|
||||
s = strchr(string, ':') + 1;
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
|
||||
if (s && cl_freply->value) {
|
||||
for (i = 0; f_replies[i].name; i++) {
|
||||
if (!strncmp(f_replies[i].name, s, strlen(f_replies[i].name)) && cl_freply->value) {
|
||||
while (*s && !isspace(*s))
|
||||
s++;
|
||||
Cbuf_AddText(f_replies[i].func(s));
|
||||
f_replies[i].lasttime = realtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Team_ResetTimers (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; f_replies[i].name; i++)
|
||||
f_replies[i].lasttime = realtime - cl_freply->value;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue