mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 12:40:42 +00:00
Made fraglogging switchable. And added it to the features-menu.
cl_fraglog is the new cvar for toggling fraglogging.
This commit is contained in:
parent
91ca4104a2
commit
706de39c06
2 changed files with 38 additions and 17 deletions
|
@ -193,10 +193,11 @@ integer (string text, integer key) control_options_f =
|
|||
}
|
||||
break;
|
||||
case "cl_autorecord":
|
||||
if(cvar("cl_autorecord") == 0)
|
||||
Cbuf_AddText ("set cl_autorecord 1\n");
|
||||
else
|
||||
Cbuf_AddText ("set cl_autorecord 0\n");
|
||||
Cbuf_AddText ("toggle cl_autorecord\n");
|
||||
break;
|
||||
case "cl_fraglog":
|
||||
Cbuf_AddText ("toggle cl_fraglog\n");
|
||||
break;
|
||||
}
|
||||
if(!(key == QFK_RIGHT || key == QFK_LEFT)) {
|
||||
return 0;
|
||||
|
@ -269,6 +270,8 @@ integer () options_features_draw =
|
|||
|
||||
tmp = cvar("cl_autorecord") != 0 ? "On" : "Off";
|
||||
draw_val_item (70, 60, spacing, "Auto Record", tmp);
|
||||
tmp = cvar("cl_fraglog") != 0 ? "On" : "Off";
|
||||
draw_val_item (70, 70, spacing, "Fraglogging", tmp);
|
||||
|
||||
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
|
||||
return 1;
|
||||
|
@ -281,6 +284,7 @@ void () options_features_menu =
|
|||
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
||||
Menu_Draw (options_features_draw);
|
||||
Menu_Item (54, 70, "cl_autorecord", control_options_f, 0);
|
||||
Menu_Item (54, 80, "cl_fraglog", control_options_f, 0);
|
||||
Menu_End ();
|
||||
};
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ static const char rcsid[] =
|
|||
#include "QF/va.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/vfs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "bothdefs.h"
|
||||
#include "cl_cam.h"
|
||||
|
@ -92,7 +93,7 @@ static qboolean largegame = false;
|
|||
|
||||
cvar_t *cl_showscoresuid;
|
||||
cvar_t *fs_fraglog;
|
||||
|
||||
cvar_t *cl_fraglog;
|
||||
|
||||
/*
|
||||
Sbar_ShowTeamScores
|
||||
|
@ -251,6 +252,8 @@ Sbar_Init (void)
|
|||
|
||||
fs_fraglog = Cvar_Get ("fs_fraglog", "qw-scores.log", CVAR_NONE, NULL,
|
||||
"filename of the automatic frag-log");
|
||||
cl_fraglog = Cvar_Get ("cl_fraglog", "0", CVAR_NONE, NULL,
|
||||
"automatic fraglogging, non-zero value will switch it on");
|
||||
}
|
||||
|
||||
// drawing routines are reletive to the status bar location
|
||||
|
@ -899,13 +902,18 @@ void
|
|||
Sbar_LogFrags (void)
|
||||
{
|
||||
char num[512];
|
||||
VFile *file;
|
||||
int minutes, fph, total, f, i, k, l, p;
|
||||
player_info_t *s;
|
||||
char conv[512];
|
||||
char conv2[512];
|
||||
char *cp = NULL;
|
||||
VFile *file = NULL;
|
||||
int minutes, fph, total, f, i, k, l, p, d;
|
||||
player_info_t *s = NULL;
|
||||
const char *t = NULL;
|
||||
time_t tt = time(NULL);
|
||||
char e_path[MAX_OSPATH];
|
||||
|
||||
if(!cl_fraglog->int_val) return;
|
||||
|
||||
memset(&e_path,0,MAX_OSPATH);
|
||||
Qexpand_squiggle (fs_userpath->string, e_path);
|
||||
|
||||
|
@ -967,15 +975,24 @@ Sbar_LogFrags (void)
|
|||
if(fph >= 999) fph = 999;
|
||||
if(fph <= -999) fph = -999;
|
||||
|
||||
|
||||
memset(&conv, 0, 512);
|
||||
for (cp = (unsigned char *) s->name, d = 0; *cp; cp++, d++)
|
||||
conv[d] = sys_char_map[(unsigned int)*cp];
|
||||
|
||||
if(s->spectator) {
|
||||
snprintf(num, sizeof (num), "%3i (spec)", s->pl);
|
||||
snprintf(num, sizeof (num), "%-3i%% %s (spectator)", s->pl, (char*)&conv);
|
||||
} else {
|
||||
if(cl.teamplay) {
|
||||
snprintf(num, sizeof (num), "%3i %3i %4i %3i %4s %s", s->pl, fph,
|
||||
minutes, f, s->team->value, s->name);
|
||||
memset(&conv2, 0, 512);
|
||||
for (cp = (unsigned char *) s->team->value, d = 0; *cp; cp++, d++)
|
||||
conv2[d] = sys_char_map[(unsigned int)*cp];
|
||||
|
||||
snprintf(num, sizeof (num), "%-3i%% %-3i %-4i %-3i %-4s %s", s->pl, fph,
|
||||
minutes, f, (char*)&conv2, (char*)&conv);
|
||||
} else {
|
||||
snprintf(num, sizeof (num), "%3i %3i %4i %3i %s", s->pl, fph,
|
||||
minutes, f, s->name);
|
||||
snprintf(num, sizeof (num), "%-3i%% %-3i %-4i %-3i %s", s->pl, fph,
|
||||
minutes, f, (char*)&conv);
|
||||
}
|
||||
}
|
||||
Qwrite(file, num, strlen(num));
|
||||
|
|
Loading…
Reference in a new issue