1
0
Fork 0
forked from fte/fteqw

minor fixes, change name and sys_linebuffer to callbacks

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2241 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-06 02:53:36 +00:00
parent 74d84a0ae6
commit 8e65ba98d5
6 changed files with 37 additions and 32 deletions

View file

@ -770,6 +770,17 @@ void CLNQ_SendMove (usercmd_t *cmd, int pnum, sizebuf_t *buf)
}
}
void Name_Callback(struct cvar_s *var, char *oldvalue)
{
if (cls.state <= ca_connected)
return;
if (cls.protocol != CP_NETQUAKE)
return;
CL_SendClientCommand(true, "name \"%s\"\n", var->string);
}
void CLNQ_SendCmd(void)
{
extern int cl_latestframenum, nq_dp_protocol;
@ -792,12 +803,6 @@ void CLNQ_SendCmd(void)
CLNQ_SendMove (&independantphysics[0], 0, &unrel);
}
if (name.modified)
{
name.modified = false;
CL_SendClientCommand(true, "name \"%s\"\n", name.string);
}
if (nq_dp_protocol > 0 && cls.signon == 4)
{
MSG_WriteByte(&cls.netchan.message, 50);

View file

@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// callbacks
void CL_Sbar_Callback(struct cvar_s *var, char *oldvalue);
void Name_Callback(struct cvar_s *var, char *oldvalue);
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
@ -94,7 +95,7 @@ static qboolean allowremotecmd = true;
//
cvar_t password = SCVARF("password", "", CVAR_USERINFO); //this is parhaps slightly dodgy...
cvar_t spectator = SCVARF("spectator", "", CVAR_USERINFO);
cvar_t name = SCVARF("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t name = SCVARFC("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, Name_Callback);
cvar_t team = SCVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t skin = SCVARF("skin", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t model = SCVARF("model", "", CVAR_ARCHIVE | CVAR_USERINFO);

View file

@ -1876,7 +1876,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
case 2:
CL_SendClientCommand(true, "name \"%s\"\n", name.string);
name.modified = false;
CL_SendClientCommand(true, "color %i %i\n", (int)topcolor.value, (int)bottomcolor.value);

View file

@ -1346,7 +1346,6 @@ void SZ_Print (sizebuf_t *buf, const char *data)
//============================================================================
/*
============
COM_SkipPath

View file

@ -1338,7 +1338,6 @@ void GLDraw_Alt_String (int x, int y, const qbyte *str)
#include "crosshairs.dat"
vec3_t chcolor;
int chmodified;
void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue)
{

View file

@ -36,11 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <errno.h>
#include <fcntl.h>
cvar_t sys_nostdout = {"sys_nostdout","0"};
cvar_t sys_extrasleep = {"sys_extrasleep","0"};
cvar_t sys_maxtic = {"sys_maxtic", "100"};
cvar_t sys_colorconsole = {"sys_colorconsole", "0"};
cvar_t sys_linebuffer = {"sys_linebuffer", "1"};
// callbacks
void Sys_Linebuffer_Callback (struct cvar_s *var, char *oldvalue);
cvar_t sys_nostdout = SCVAR{"sys_nostdout","0"};
cvar_t sys_extrasleep = SCVAR{"sys_extrasleep","0"};
cvar_t sys_maxtic = SCVAR{"sys_maxtic", "100"};
cvar_t sys_colorconsole = SCVAR{"sys_colorconsole", "0"};
cvar_t sys_linebuffer = SCVARC{"sys_linebuffer", "1", Sys_Linebuffer_Callback};
qboolean stdin_ready;
@ -578,28 +581,27 @@ Checks for a complete line of text typed in at the console, then forwards
it to the host command processor
================
*/
void Sys_Linebuffer_Callback (struct cvar_s *var, char *oldvalue)
{
changes = orig;
if (var->value)
{
changes.c_lflag |= (ICANON|ECHO);
}
else
{
changes.c_lflag &= ~(ICANON|ECHO);
changes.c_cc[VTIME] = 0;
changes.c_cc[VMIN] = 1;
}
tcsetattr(STDIN_FILENO, TCSADRAIN, &changes);
}
char *Sys_ConsoleInput (void)
{
static char text[256];
int len;
if (sys_linebuffer.modified)
{
sys_linebuffer.modified = false;
changes = orig;
if (sys_linebuffer.value)
{
changes.c_lflag |= (ICANON|ECHO);
}
else
{
changes.c_lflag &= ~(ICANON|ECHO);
changes.c_cc[VTIME] = 0;
changes.c_cc[VMIN] = 1;
}
tcsetattr(STDIN_FILENO, TCSADRAIN, &changes);
}
if (!stdin_ready || !do_stdin)
return NULL; // the select didn't say it was ready
stdin_ready = false;