2004-08-21 01:25:48 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-07-03 15:16:20 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-21 01:25:48 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// cmd.c -- Quake script command processing module
# include "quakedef.h"
2014-10-11 19:39:45 +00:00
# include "fs.h"
2017-12-09 21:22:46 +00:00
# include "cl_master.h"
2004-08-21 01:25:48 +00:00
2016-09-08 19:04:35 +00:00
cvar_t ruleset_allow_in = CVAR ( " ruleset_allow_in " , " 1 " ) ;
cvar_t rcon_level = CVAR ( " rcon_level " , " 20 " ) ;
cvar_t cmd_maxbuffersize = CVAR ( " cmd_maxbuffersize " , " 65536 " ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2016-09-08 19:04:35 +00:00
cvar_t dpcompat_set = CVAR ( " dpcompat_set " , " 0 " ) ;
2017-08-14 16:38:44 +00:00
cvar_t dpcompat_console = CVARD ( " dpcompat_console " , " 0 " , " Enables hacks to emulate DP's console. " ) ;
2018-07-22 11:49:37 +00:00
# else
static const cvar_t dpcompat_set = { 0 } ;
static const cvar_t dpcompat_console = { 0 } ;
# endif
2004-08-21 01:25:48 +00:00
int Cmd_ExecLevel ;
2013-08-21 07:14:39 +00:00
qboolean cmd_didwait ;
2014-06-24 03:02:32 +00:00
qboolean cmd_blockwait ;
2004-08-21 01:25:48 +00:00
void Cmd_ForwardToServer ( void ) ;
# define MAX_ALIAS_NAME 32
typedef struct cmdalias_s
{
struct cmdalias_s * next ;
char * value ;
2018-11-19 06:37:25 +00:00
int flags ;
2004-08-21 01:25:48 +00:00
qbyte execlevel ;
qbyte restriction ;
2017-08-14 16:38:44 +00:00
char name [ 1 ] ;
2004-08-21 01:25:48 +00:00
} cmdalias_t ;
# define ALIAS_FROMSERVER 1
cmdalias_t * cmd_alias ;
2015-08-28 03:13:45 +00:00
cvar_t cfg_save_all = CVARFD ( " cfg_save_all " , " " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, cfg_save ALWAYS saves all cvars. If 0, cfg_save only ever saves archived cvars. If empty, cfg_save saves all cvars only when an explicit filename was given (ie: when not used internally via quit menu options). " ) ;
cvar_t cfg_save_auto = CVARFD ( " cfg_save_auto " , " 0 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, the config will automatically be saved and without prompts. If 0, you'll have to save your config manually (possibly via prompts from the quit menu). " ) ;
2018-04-09 18:01:15 +00:00
cvar_t cfg_save_infos = CVARFD ( " cfg_save_infos " , " 1 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, saves userinfo and serverinfo to configs. " ) ;
2020-04-29 10:43:22 +00:00
cvar_t cfg_save_aliases = CVARFD ( " cfg_save_aliases " , " 1 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, saves aliases to configs. Note that aliases sent from servers are assumed to be server-specific and are never saved (and are forgotten on map changes, too). " ) ;
2018-04-09 18:01:15 +00:00
cvar_t cfg_save_binds = CVARFD ( " cfg_save_binds " , " 1 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, saves all key bindings to configs. " ) ;
cvar_t cfg_save_buttons = CVARFD ( " cfg_save_buttons " , " 0 " , CVAR_ARCHIVE | CVAR_NOTFROMSERVER , " If 1, saves the state of things such as +mlook or +forward to configs. " ) ;
2014-03-30 08:55:06 +00:00
cvar_t cl_warncmd = CVARF ( " cl_warncmd " , " 1 " , CVAR_NOSAVE | CVAR_NORESET ) ;
2021-05-27 11:34:07 +00:00
cvar_t cl_aliasoverlap = CVARFD ( " cl_aliasoverlap " , " 1 " , CVAR_NOTFROMSERVER , " Rename new aliases if they would override cvar names. " ) ;
2004-08-21 01:25:48 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2014-03-30 08:55:06 +00:00
cvar_t tp_disputablemacros = CVARF ( " tp_disputablemacros " , " 1 " , CVAR_SEMICHEAT ) ;
2018-12-28 00:04:36 +00:00
# endif
2004-08-21 01:25:48 +00:00
//=============================================================================
2020-04-19 01:23:32 +00:00
# define MAX_MACROS 70
2004-08-21 01:25:48 +00:00
typedef struct {
char name [ 32 ] ;
char * ( * func ) ( void ) ;
2005-02-28 07:16:19 +00:00
int disputableintentions ;
2004-08-21 01:25:48 +00:00
} macro_command_t ;
static macro_command_t macro_commands [ MAX_MACROS ] ;
static int macro_count = 0 ;
2005-02-28 07:16:19 +00:00
void Cmd_AddMacro ( char * s , char * ( * f ) ( void ) , int disputableintentions )
2004-08-21 01:25:48 +00:00
{
2009-04-01 22:03:56 +00:00
int i ;
for ( i = 0 ; i < macro_count ; i + + )
{
if ( ! strcmp ( macro_commands [ i ] . name , s ) )
break ;
}
if ( i = = MAX_MACROS )
2004-08-21 01:25:48 +00:00
Sys_Error ( " Cmd_AddMacro: macro_count == MAX_MACROS " ) ;
2009-04-01 22:03:56 +00:00
2020-04-19 01:23:32 +00:00
Q_strncpyz ( macro_commands [ i ] . name , s , sizeof ( macro_commands [ macro_count ] . name ) ) ;
macro_commands [ i ] . func = f ;
macro_commands [ i ] . disputableintentions = disputableintentions ;
2009-04-01 22:03:56 +00:00
if ( i = = macro_count )
macro_count + + ;
2004-08-21 01:25:48 +00:00
}
2018-10-11 10:31:23 +00:00
static char * TP_MacroString ( char * s , int * newaccesslevel , int * len )
2004-08-21 01:25:48 +00:00
{
int i ;
macro_command_t * macro ;
for ( i = 0 ; i < macro_count ; i + + )
{
macro = & macro_commands [ i ] ;
if ( ! Q_strcasecmp ( s , macro - > name ) )
{
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2005-02-28 07:16:19 +00:00
if ( macro - > disputableintentions )
2009-11-04 21:16:50 +00:00
if ( ! tp_disputablemacros . ival )
2015-09-18 20:30:10 +00:00
* newaccesslevel = 0 ;
2018-12-28 00:04:36 +00:00
# endif
2004-09-20 23:25:38 +00:00
if ( len )
* len = strlen ( macro - > name ) ;
2004-08-21 01:25:48 +00:00
return macro - > func ( ) ;
}
}
return NULL ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_MacroList_f ( void )
2004-08-21 01:25:48 +00:00
{
int i ;
if ( ! macro_count )
{
Con_Printf ( " No macros! " ) ;
return ;
}
for ( i = 0 ; i < macro_count ; i + + )
Con_Printf ( " $%s \n " , macro_commands [ i ] . name ) ;
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
COMMAND BUFFER
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
struct {
sizebuf_t buf ;
int noclear ;
double waitattime ;
2015-04-14 23:12:17 +00:00
} cmd_text [ RESTRICT_MAX + 3 + MAX_SPLITS ] ; //max is local.
2004-08-21 01:25:48 +00:00
//RESTRICT_MAX+1 is the from sever buffer (max+2 is for second player...)
2015-06-29 23:46:31 +00:00
void Cbuf_Waited ( void )
{
//input packet was sent to server, its okay to continue executing stuff like -attack now
cmd_text [ RESTRICT_LOCAL ] . waitattime = 0 ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cmd_Wait_f
Causes execution of the remainder of the command buffer to be delayed until
next frame . This allows commands like :
bind g " impulse 5 ; +attack ; wait ; -attack ; impulse 2 "
= = = = = = = = = = = =
*/
2018-10-11 10:31:23 +00:00
static void Cmd_Wait_f ( void )
2004-08-21 01:25:48 +00:00
{
2014-06-24 03:02:32 +00:00
if ( cmd_blockwait )
return ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2013-08-21 07:14:39 +00:00
if ( cmd_didwait & & sv . state )
Con_DPrintf ( " waits without server frames \n " ) ;
2013-08-21 07:57:17 +00:00
# endif
2013-08-21 07:14:39 +00:00
cmd_didwait = true ;
2005-07-03 15:16:20 +00:00
cmd_text [ Cmd_ExecLevel ] . waitattime = realtime ;
2004-08-21 01:25:48 +00:00
}
2015-07-03 02:07:41 +00:00
/*
lame timers . : s
*/
typedef struct cmdtimer_s {
struct cmdtimer_s * next ;
float timer ;
2018-10-14 16:16:34 +00:00
int iarg ;
void ( * callback ) ( int iarg , void * data ) ;
char data [ 1 ] ;
2015-07-03 02:07:41 +00:00
} cmdtimer_t ;
static cmdtimer_t * cmdtimers ;
static void Cmd_ExecuteTimers ( void )
{
cmdtimer_t * * link , * t ;
//FIXME: we should probably insert these in order instead, then early out.
//really, it depends on just how many we end up with
for ( link = & cmdtimers ; ( t = * link ) ; )
{
if ( t - > timer < realtime )
{
* link = t - > next ;
2018-10-14 16:16:34 +00:00
t - > callback ( t - > iarg , t - > data ) ;
2015-07-03 02:07:41 +00:00
Z_Free ( t ) ;
}
else
link = & t - > next ;
}
}
2018-10-14 16:16:34 +00:00
void Cmd_AddTimer ( float delay , void ( * callback ) ( int iarg , void * data ) , int iarg , void * data , size_t datasize )
{
cmdtimer_t * n = Z_Malloc ( sizeof ( * n ) + datasize ) ;
n - > iarg = iarg ;
n - > callback = callback ;
memcpy ( n - > data , data , datasize ) ;
n - > data [ datasize ] = 0 ; //just in case.
n - > timer = realtime + delay ;
n - > next = cmdtimers ;
cmdtimers = n ;
}
static void Cmd_In_Callback ( int iarg , void * data )
{
Cbuf_AddText ( ( char * ) data , iarg ) ;
Cbuf_AddText ( " \n " , iarg ) ;
}
2015-07-03 02:07:41 +00:00
static void Cmd_In_f ( void )
{
float delay = atof ( Cmd_Argv ( 1 ) ) ;
char * cmd ;
if ( Cmd_Argc ( ) < 3 )
{
Con_Printf ( " %s <seconds to wait> <command to execute> \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
Cmd_ShiftArgs ( 1 , false ) ;
cmd = Cmd_Args ( ) ;
2016-07-12 00:40:13 +00:00
if ( ruleset_allow_in . ival | | ! delay )
2018-10-14 16:16:34 +00:00
Cmd_AddTimer ( delay , Cmd_In_Callback , Cmd_ExecLevel , cmd , strlen ( cmd ) ) ;
2015-07-03 02:07:41 +00:00
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cbuf_Init
= = = = = = = = = = = =
*/
void Cbuf_Init ( void )
{
int level ;
for ( level = 0 ; level < = RESTRICT_MAX + 1 ; level + + )
cmd_text [ level ] . waitattime = - 1 ;
}
2014-10-11 19:39:45 +00:00
static void Cbuf_WorkerAddText ( void * ctx , void * data , size_t a , size_t b )
{
Cbuf_AddText ( data , a ) ;
Z_Free ( data ) ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cbuf_AddText
Adds command text at the end of the buffer
= = = = = = = = = = = =
*/
void Cbuf_AddText ( const char * text , int level )
{
int l ;
2014-10-14 16:42:48 +00:00
if ( ! Sys_IsMainThread ( ) )
2014-10-11 19:39:45 +00:00
{
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Cbuf_WorkerAddText , NULL , Z_StrDup ( text ) , level , 0 ) ;
2014-10-11 19:39:45 +00:00
return ;
}
2004-08-21 01:25:48 +00:00
if ( level > sizeof ( cmd_text ) / sizeof ( cmd_text [ 0 ] ) | | level < 0 )
{
Con_Printf ( " Bad execution level \n " ) ;
return ; //reject.
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
l = Q_strlen ( text ) ;
if ( ! cmd_text [ level ] . buf . maxsize )
{
2006-05-07 05:31:01 +00:00
cmd_text [ level ] . buf . data = ( qbyte * ) BZ_Malloc ( 8192 ) ;
2004-08-21 01:25:48 +00:00
cmd_text [ level ] . buf . maxsize = 8192 ;
}
if ( cmd_text [ level ] . buf . cursize + l > = cmd_text [ level ] . buf . maxsize )
{
int newmax ;
newmax = cmd_text [ level ] . buf . maxsize * 2 ;
2009-11-04 21:16:50 +00:00
if ( newmax > cmd_maxbuffersize . ival & & cmd_maxbuffersize . ival )
2004-08-21 01:25:48 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s: overflow \n " , " Cbuf_AddText " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
while ( newmax < cmd_text [ level ] . buf . cursize + l )
newmax * = 2 ;
2006-05-07 05:31:01 +00:00
cmd_text [ level ] . buf . data = ( qbyte * ) BZ_Realloc ( cmd_text [ level ] . buf . data , newmax ) ;
2004-08-21 01:25:48 +00:00
cmd_text [ level ] . buf . maxsize = newmax ;
}
SZ_Write ( & cmd_text [ level ] . buf , text , Q_strlen ( text ) ) ;
}
/*
= = = = = = = = = = = =
Cbuf_InsertText
Adds command text immediately after the current command
Adds a \ n to the text
FIXME : actually change the command buffer to do less copying
= = = = = = = = = = = =
*/
2006-02-06 01:06:17 +00:00
void Cbuf_InsertText ( const char * text , int level , qboolean addnl )
2004-08-21 01:25:48 +00:00
{
char * temp ;
int templen ;
if ( level > sizeof ( cmd_text ) / sizeof ( cmd_text [ 0 ] ) | | level < 0 )
{
Con_Printf ( " Bad execution level \n " ) ;
return ; //reject.
}
// copy off any commands still remaining in the exec buffer
templen = cmd_text [ level ] . buf . cursize ;
if ( templen )
{
2005-03-28 00:11:59 +00:00
temp = ( char * ) Z_Malloc ( templen + 1 ) ;
2004-08-21 01:25:48 +00:00
Q_memcpy ( temp , cmd_text [ level ] . buf . data , templen ) ;
SZ_Clear ( & cmd_text [ level ] . buf ) ;
}
else
temp = NULL ; // shut up compiler
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// add the entire text of the file
Cbuf_AddText ( text , level ) ;
2006-02-06 01:06:17 +00:00
if ( addnl )
2014-02-11 17:51:29 +00:00
Cbuf_AddText ( " \n " , level ) ;
2004-08-21 01:25:48 +00:00
// add the copied off data
if ( templen )
{
temp [ templen ] = ' \0 ' ;
Cbuf_AddText ( temp , level ) ;
// SZ_Write (&cmd_text[level].buf, temp, templen);
Z_Free ( temp ) ;
}
}
2011-12-05 15:23:40 +00:00
char * Cbuf_GetNext ( int level , qboolean ignoresemicolon )
2004-08-21 01:25:48 +00:00
{
int i ;
char * text ;
int quotes ;
static char line [ 1024 ] ;
start :
text = ( char * ) cmd_text [ level ] . buf . data ;
quotes = 0 ;
for ( i = 0 ; i < cmd_text [ level ] . buf . cursize ; i + + )
{
if ( text [ i ] = = ' " ' )
quotes + + ;
2011-12-05 15:23:40 +00:00
if ( ! ( quotes & 1 ) & & text [ i ] = = ' ; ' & & ! ignoresemicolon )
2004-08-21 01:25:48 +00:00
break ; // don't break if inside a quoted string
if ( text [ i ] = = ' \n ' )
break ;
}
if ( i > = sizeof ( line ) - 1 )
{
Con_Printf ( " Statement too long \n " ) ;
return " " ;
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
memcpy ( line , text , i ) ;
line [ i ] = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the
// beginning of the text buffer
if ( i = = cmd_text [ level ] . buf . cursize )
cmd_text [ level ] . buf . cursize = 0 ;
else
{
i + + ;
cmd_text [ level ] . buf . cursize - = i ;
2011-01-30 01:32:30 +00:00
memmove ( text , text + i , cmd_text [ level ] . buf . cursize ) ;
2004-08-21 01:25:48 +00:00
}
// Con_Printf("Found \"%s\"\n", line);
text = line ;
while ( * text = = ' ' | | * text = = ' \t ' )
text + + ;
if ( ! * text )
if ( cmd_text [ level ] . buf . cursize )
goto start ; //should be a while.
return text ;
}
2018-10-11 10:31:23 +00:00
static char * Cbuf_StripText ( int level ) //remove all text in the command buffer and return it (so it can be readded later)
2004-08-21 01:25:48 +00:00
{
char * buf ;
2005-03-28 00:11:59 +00:00
buf = ( char * ) Z_Malloc ( cmd_text [ level ] . buf . cursize + 1 ) ;
2004-08-21 01:25:48 +00:00
Q_memcpy ( buf , cmd_text [ level ] . buf . data , cmd_text [ level ] . buf . cursize ) ;
cmd_text [ level ] . buf . cursize = 0 ;
return buf ;
}
void Cbuf_ExecuteLevel ( int level )
{
int i ;
char * text ;
2019-06-18 13:03:37 +00:00
char linebuf [ 65536 ] , * line ;
2016-08-25 00:12:14 +00:00
qboolean comment ;
int quotes ;
2004-08-21 01:25:48 +00:00
while ( cmd_text [ level ] . buf . cursize )
{
if ( cmd_text [ level ] . waitattime = = realtime )
{ // skip out while text still remains in buffer, leaving it
// for next frame
break ;
}
2004-11-13 17:22:13 +00:00
2004-08-21 01:25:48 +00:00
// find a \n or ; line break
text = ( char * ) cmd_text [ level ] . buf . data ;
2006-03-06 21:54:32 +00:00
quotes = false ;
comment = false ;
2004-08-21 01:25:48 +00:00
for ( i = 0 ; i < cmd_text [ level ] . buf . cursize ; i + + )
{
2006-03-06 21:54:32 +00:00
if ( text [ i ] = = ' \n ' )
break ;
2016-08-25 00:12:14 +00:00
if ( quotes )
2006-03-06 21:54:32 +00:00
{
2016-08-25 00:12:14 +00:00
if ( text [ i ] = = ' " ' )
{
quotes = false ;
}
if ( text [ i ] = = ' \\ ' & & quotes = = 2 )
{
//skip over both chars if its something embedded.
if ( text [ i + 1 ] = = ' \" ' | | text [ i + 1 ] = = ' \\ ' )
{
i + + ;
continue ;
}
}
continue ;
}
else if ( text [ i ] = = ' " ' )
{ //simple quoted string
quotes = true ;
continue ;
}
else if ( text [ i ] = = ' \\ ' & & text [ i + 1 ] = = ' \" ' )
{ //escaped quoted string.
quotes = 2 ;
i + + ;
2006-03-06 21:54:32 +00:00
continue ;
}
2016-08-25 00:12:14 +00:00
if ( comment )
2006-03-06 21:54:32 +00:00
continue ;
if ( text [ i ] = = ' / ' & & i + 1 < cmd_text [ level ] . buf . cursize & & text [ i + 1 ] = = ' / ' )
comment = true ;
else if ( text [ i ] = = ' ; ' )
2004-08-21 01:25:48 +00:00
break ; // don't break if inside a quoted string
}
2019-06-18 13:03:37 +00:00
if ( i > = sizeof ( linebuf ) )
line = malloc ( i + 1 ) ; //might leak if the command longjmps. :(
else
line = linebuf ;
2004-08-21 01:25:48 +00:00
memcpy ( line , text , i ) ;
line [ i ] = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the
// beginning of the text buffer
if ( i = = cmd_text [ level ] . buf . cursize )
cmd_text [ level ] . buf . cursize = 0 ;
else
{
i + + ;
cmd_text [ level ] . buf . cursize - = i ;
2010-07-12 22:46:37 +00:00
memmove ( text , text + i , cmd_text [ level ] . buf . cursize ) ;
2004-08-21 01:25:48 +00:00
}
2005-07-03 15:16:20 +00:00
// execute the command line
2004-08-21 01:25:48 +00:00
Cmd_ExecuteString ( line , level ) ;
2019-06-18 13:03:37 +00:00
if ( line ! = linebuf )
free ( line ) ;
2004-08-21 01:25:48 +00:00
}
}
/*
= = = = = = = = = = = =
Cbuf_Execute
= = = = = = = = = = = =
*/
void Cbuf_Execute ( void )
{
int level ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2015-06-29 23:46:31 +00:00
if ( cmd_text [ RESTRICT_LOCAL ] . waitattime & & cls . state = = ca_active )
{
//keep binds blocked until after the next input frame was sent to the server (at which point it will be cleared
//this ensures that wait and +attack etc works synchronously, as though your client never even supported network independance! yay... I guess.
cmd_text [ RESTRICT_LOCAL ] . waitattime = realtime ;
}
# endif
2015-07-03 02:07:41 +00:00
Cmd_ExecuteTimers ( ) ;
2015-06-29 23:46:31 +00:00
2004-08-26 10:17:21 +00:00
for ( level = 0 ; level < sizeof ( cmd_text ) / sizeof ( cmd_text [ 0 ] ) ; level + + )
2014-10-22 19:41:20 +00:00
if ( cmd_text [ level ] . buf . cursize )
Cbuf_ExecuteLevel ( level ) ;
2004-08-21 01:25:48 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
SCRIPT COMMANDS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = =
Cmd_StuffCmds_f
Adds command line parameters as script statements
Commands lead with a + , and continue until a - or another +
quake + prog jctest . qp + cmd amlev1
quake - nosound + cmd amlev1
= = = = = = = = = = = = = = =
*/
2005-01-07 02:46:11 +00:00
void Cmd_StuffCmds ( void )
2004-08-21 01:25:48 +00:00
{
int i , j ;
int s ;
char * text , * build , c ;
// build the combined string to parse from
s = 0 ;
for ( i = 1 ; i < com_argc ; i + + )
{
if ( ! com_argv [ i ] )
continue ; // NEXTSTEP nulls out -NXHost
s + = Q_strlen ( com_argv [ i ] ) + 3 ;
}
if ( ! s )
return ;
2005-07-03 15:16:20 +00:00
2005-03-28 00:11:59 +00:00
text = ( char * ) Z_Malloc ( s + 1 ) ;
2004-08-21 01:25:48 +00:00
text [ 0 ] = 0 ;
for ( i = 1 ; i < com_argc ; i + + )
{
if ( ! com_argv [ i ] )
continue ; // NEXTSTEP nulls out -NXHost
2016-08-25 00:12:14 +00:00
if ( strchr ( com_argv [ i ] , ' ' ) | | strchr ( com_argv [ i ] , ' \t ' ) | | strchr ( com_argv [ i ] , ' @ ' ) | | strchr ( com_argv [ i ] , ' / ' ) | | strchr ( com_argv [ i ] , ' \\ ' ) )
2008-03-14 11:52:09 +00:00
{
Q_strcat ( text , " \" " ) ;
Q_strcat ( text , com_argv [ i ] ) ;
Q_strcat ( text , " \" " ) ;
}
else
Q_strcat ( text , com_argv [ i ] ) ;
2004-08-21 01:25:48 +00:00
if ( i ! = com_argc - 1 )
Q_strcat ( text , " " ) ;
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// pull out the commands
2005-03-28 00:11:59 +00:00
build = ( char * ) Z_Malloc ( s + 1 ) ;
2004-08-21 01:25:48 +00:00
build [ 0 ] = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
for ( i = 0 ; i < s - 1 ; i + + )
{
if ( text [ i ] = = ' + ' )
{
i + + ;
2010-03-14 14:35:56 +00:00
for ( j = i ; ( ( text [ j - 1 ] ! = ' ' ) | | ( ( text [ j ] ! = ' + ' ) & & ( text [ j ] ! = ' - ' ) ) ) & & ( text [ j ] ! = 0 ) ; j + + )
2004-08-21 01:25:48 +00:00
;
c = text [ j ] ;
text [ j ] = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
Q_strcat ( build , text + i ) ;
Q_strcat ( build , " \n " ) ;
text [ j ] = c ;
i = j - 1 ;
}
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( build [ 0 ] )
2005-01-07 02:46:11 +00:00
Cbuf_AddText ( build , RESTRICT_LOCAL ) ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
Z_Free ( text ) ;
Z_Free ( build ) ;
}
2021-10-05 05:05:34 +00:00
# if defined(HAVE_LEGACY) && defined(HAVE_CLIENT)
static const char * replacementq1binds =
" unbindall \n "
" bind ` toggleconsole \n "
" bind w +forward \n "
" bind s +back \n "
" bind a +moveleft \n "
" bind d +moveright \n "
" bind MOUSE1 +attack \n "
" bind MOUSE2 +jump \n "
" bind SPACE +jump \n "
" bind v +voip \n "
" bind t messagemode2 \n "
" bind y messagemode \n "
" bind TAB +showscores \n "
" bind e +moveup \n "
" bind c +movedown \n "
" bind MWHEELUP impulse 12 \n "
" bind MWHEELDOWN impulse 10 \n "
" bind UPARROW +forward \n "
" bind DOWNARROW +back \n "
" bind LEFTARROW +left \n "
" bind RIGHTARROW +right \n "
" bind LCTRL +attack \n "
" bind RCTRL +attack \n "
" bind LALT +strafe \n "
" bind RALT +strafe \n "
" bind LSHIFT +speed \n "
" bind RSHIFT +speed \n "
" bind + sizeup \n "
" bind - sizedown \n "
" bind 1 impulse 1 \n "
" bind 2 impulse 2 \n "
" bind 3 impulse 3 \n "
" bind 4 impulse 4 \n "
" bind 5 impulse 5 \n "
" bind 6 impulse 6 \n "
" bind 7 impulse 7 \n "
" bind 8 impulse 8 \n "
// "bind 9 impulse 9\n"
// "bind 0 impulse 10\n"
// "bind F1 help\n"
" bind F2 menu_save \n "
" bind F3 menu_load \n "
" bind F4 menu_options \n "
" bind F5 menu_multiplayer \n "
" bind F6 save quick \n "
// "bind F7
// "bind F8
" bind F9 load quick \n "
" bind F10 menu_quit \n "
// "bind F11 +zoom\n"
" bind F12 screenshot \n "
;
2023-01-09 05:14:38 +00:00
static const char * defaulttouchcfg =
" showpic_removeall \n "
// "sv_aim 0.90\n" //quake style, avoid needing to pitch too much
" showpic touch_moveforward.tga fwd -128 -112 bm 32 32 +forward 5 \n "
" showpic touch_moveback.tga back -128 -80 bm 32 32 +back 5 \n "
" showpic touch_moveleft.tga left -160 -88 bm 32 32 +moveleft 5 \n "
" showpic touch_moveright.tga rght -96 -88 bm 32 32 +moveright 5 \n "
" showpic touch_attack.tga fire -160 -160 bm 32 32 +attack 5 \n "
" showpic touch_jump.tga jump 128 -80 bm 32 32 +jump 5 \n "
" showpic touch_weapons.tga weap 80 -80 bm 32 32 +weaponwheel 5 \n "
" showpic touch_menu.tga menu -32 0 tr 32 32 togglemenu 10 \n "
;
2021-10-05 05:05:34 +00:00
# endif
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = =
Cmd_Exec_f
= = = = = = = = = = = = = = =
*/
2018-10-11 10:31:23 +00:00
static void Cmd_Exec_f ( void )
2004-08-21 01:25:48 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
char * f , * s ;
2004-08-21 01:25:48 +00:00
char name [ 256 ] ;
2016-08-25 00:12:14 +00:00
char buf [ 512 ] ;
2014-10-11 19:39:45 +00:00
flocation_t loc ;
qboolean untrusted ;
vfsfile_t * file ;
size_t l ;
2016-08-25 00:12:14 +00:00
unsigned int level ;
2004-08-21 01:25:48 +00:00
if ( Cmd_Argc ( ) ! = 2 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " exec <filename> : execute a script file \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
if ( ! strcmp ( Cmd_Argv ( 0 ) , " cfg_load " ) )
{
f = Cmd_Argv ( 1 ) ;
if ( ! * f )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
f = fs_manifest - > mainconfig ;
if ( ! * f )
f = " config " ;
2006-03-06 01:41:09 +00:00
snprintf ( name , sizeof ( name ) - 5 , " configs/%s " , f ) ;
2006-03-11 03:12:10 +00:00
COM_DefaultExtension ( name , " .cfg " , sizeof ( name ) ) ;
2004-08-21 01:25:48 +00:00
}
else
2017-11-23 07:46:39 +00:00
{
2004-08-21 01:25:48 +00:00
Q_strncpyz ( name , Cmd_Argv ( 1 ) , sizeof ( name ) ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( * fs_manifest - > mainconfig & & Q_strcasecmp ( " config.cfg " , fs_manifest - > mainconfig ) & & Q_strcasecmp ( " q3config.cfg " , fs_manifest - > mainconfig ) )
2017-11-23 07:46:39 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
//fte writes to a different config file from that specified by the quake.rc, to avoid conflicts.
//so make sure that fte's settings override those from whatever other engine that wrote the legacy config.cfg file.
if ( ! strcmp ( name , " config.cfg " ) | | ! strcmp ( name , " q3config.cfg " ) )
2017-11-23 07:46:39 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
int cfgdepth = COM_FDepthFile ( name , true ) ;
int defdepth = COM_FDepthFile ( " default.cfg " , true ) ;
Cbuf_InsertText ( va ( " exec %s " , fs_manifest - > mainconfig ) , Cmd_ExecLevel , true ) ;
if ( defdepth < cfgdepth & & cfgdepth ! = FDEPTH_MISSING )
2017-11-23 07:46:39 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( cl_warncmd . ival )
{
char fulldefault [ MAX_OSPATH ] ;
char fullconfig [ MAX_OSPATH ] ;
* fulldefault = * fullconfig = 0 ;
FS_NativePath ( " default.cfg " , FS_GAME , fulldefault , sizeof ( fulldefault ) ) ;
FS_NativePath ( name , FS_GAME , fullconfig , sizeof ( fullconfig ) ) ;
Con_Printf ( " Refusing to execute \" %s \" , superceded by %s \n " , fullconfig , fulldefault ) ;
}
return ;
2017-11-23 07:46:39 +00:00
}
}
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
else if ( ! strcmp ( name , fs_manifest - > mainconfig ) )
2017-11-23 07:46:39 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
int cfgdepth = COM_FDepthFile ( name , true ) ;
int defdepth = COM_FDepthFile ( " default.cfg " , true ) ;
if ( defdepth < cfgdepth & & cfgdepth ! = FDEPTH_MISSING )
2017-11-23 07:46:39 +00:00
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( cl_warncmd . ival )
{
char fulldefault [ MAX_OSPATH ] ;
char fullconfig [ MAX_OSPATH ] ;
* fulldefault = * fullconfig = 0 ;
FS_NativePath ( " default.cfg " , FS_GAME , fulldefault , sizeof ( fulldefault ) ) ;
FS_NativePath ( name , FS_GAME , fullconfig , sizeof ( fullconfig ) ) ;
Con_Printf ( " Refusing to execute \" %s \" , superceded by %s \n " , fullconfig , fulldefault ) ;
}
return ;
2017-11-23 07:46:39 +00:00
}
}
}
}
2004-08-21 01:25:48 +00:00
2015-12-12 19:25:15 +00:00
if ( ! strncmp ( name , " ../ " , 3 ) | | ! strncmp ( name , " .. \\ " , 3 ) | | ! strncmp ( name , " ./ " , 2 ) | | ! strncmp ( name , " . \\ " , 2 ) )
{ //filesystem will correctly block this (and more), but it does look dodgy when servers try doing this dodgy shit anyway.
if ( Cmd_IsInsecure ( ) )
2023-01-09 05:14:38 +00:00
Con_TPrintf ( " %s: %s is an invalid path (from server) \n " , Cmd_Argv ( 0 ) , name ) ;
2015-12-12 19:25:15 +00:00
else
2023-01-09 05:14:38 +00:00
Con_TPrintf ( " %s: %s is an invalid path \n " , Cmd_Argv ( 0 ) , name ) ;
2015-12-12 19:25:15 +00:00
return ;
}
2021-10-05 05:05:34 +00:00
if ( FS_FLocateFile ( name , FSLF_IFFOUND | FSLF_IGNOREPURE , & loc ) | | FS_FLocateFile ( va ( " %s.cfg " , name ) , FSLF_IFFOUND , & loc ) )
2004-08-21 01:25:48 +00:00
{
2021-10-05 05:05:34 +00:00
file = FS_OpenReadLocation ( name , & loc ) ;
if ( ! file )
{
2023-01-09 05:14:38 +00:00
Con_TPrintf ( " couldn't %s %s. check permissions. \n " , Cmd_Argv ( 0 ) , name ) ;
2021-10-05 05:05:34 +00:00
return ;
}
l = VFS_GETLEN ( file ) ;
f = BZ_Malloc ( l + 1 ) ;
f [ l ] = 0 ;
VFS_READ ( file , f , l ) ;
VFS_CLOSE ( file ) ;
untrusted = ! ! ( loc . search - > flags & SPF_UNTRUSTED ) ;
2014-10-11 19:39:45 +00:00
}
2021-10-05 05:05:34 +00:00
# if defined(HAVE_LEGACY) && defined(HAVE_CLIENT)
else if ( ! strcmp ( name , " default.cfg " ) ) //the q1 rerelease lacks a default.cfg (which I suppose is kinda handy, but oh well)
2014-10-11 19:39:45 +00:00
{
2021-10-05 05:05:34 +00:00
f = Z_StrDup ( replacementq1binds ) ;
untrusted = false ;
l = 0 ;
}
2023-01-09 05:14:38 +00:00
else if ( ! strcmp ( name , " touch.cfg " ) ) //auto-execed if they touch a touchscreen.
{
f = Z_StrDup ( defaulttouchcfg ) ;
untrusted = false ;
l = 0 ;
}
2021-10-05 05:05:34 +00:00
# endif
else
{
Con_TPrintf ( " couldn't exec %s \n " , name ) ;
2005-10-16 03:46:33 +00:00
return ;
}
2021-10-05 05:05:34 +00:00
level = ( ( Cmd_FromGamecode ( ) | | untrusted ) ? RESTRICT_INSECURE : Cmd_ExecLevel ) ;
2020-05-14 15:50:26 +00:00
if ( cl_warncmd . ival | | developer . ival | | cvar_watched | | dpcompat_console . ival )
2018-08-04 19:00:19 +00:00
{
if ( loc . search )
2018-09-23 19:35:24 +00:00
Con_TPrintf ( " execing ^[^7%s \\ tip \\ from %s/%s^] \n " , name , loc . search - > logicalpath , name ) ;
2018-08-04 19:00:19 +00:00
else
2018-09-23 19:35:24 +00:00
Con_TPrintf ( " execing %s \n " , name ) ;
2018-08-04 19:00:19 +00:00
}
2005-04-16 16:21:27 +00:00
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
s = f ;
if ( s [ 0 ] = = ' \xef ' & & s [ 1 ] = = ' \xbb ' & & s [ 2 ] = = ' \xbf ' )
{
Con_DPrintf ( " Ignoring UTF-8 BOM \n " ) ;
s + = 3 ;
}
2014-10-05 20:04:11 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( ! strcmp ( name , " config.cfg " ) | | ! strcmp ( name , " q3config.cfg " ) | | ! strcmp ( name , fs_manifest - > mainconfig ) )
2014-10-05 20:04:11 +00:00
{
//if the config is from id1 and the default.cfg was from some mod, make sure the default.cfg overrides the config.
//we won't just exec the default instead, because we can at least retain things which are not specified (ie: a few binds)
int cfgdepth = COM_FDepthFile ( name , true ) ;
int defdepth = COM_FDepthFile ( " default.cfg " , true ) ;
if ( defdepth < cfgdepth )
2016-08-25 00:12:14 +00:00
Cbuf_InsertText ( " exec default.cfg \n " , level , false ) ;
2015-06-04 06:15:14 +00:00
//hack to work around the more insideous hacks of other engines.
//namely: vid_restart at the end of config.cfg is evil, and NOT desired in FTE as it generally means any saved video settings are wrong.
if ( l > = 13 & & ! strcmp ( f + l - 13 , " \n vid_restart \n " ) )
{
Con_Printf ( CON_WARNING " WARNING: %s came from a different engine \n " , loc . rawname ) ;
l - = 12 ;
}
else if ( l > = 14 & & ! strcmp ( f + l - 14 , " \n vid_restart \r \n " ) )
{
Con_Printf ( CON_WARNING " WARNING: %s came from a different engine \n " , loc . rawname ) ;
l - = 13 ;
}
f [ l ] = 0 ;
2014-10-05 20:04:11 +00:00
}
2016-08-25 00:12:14 +00:00
if ( * loc . rawname )
COM_QuotedString ( loc . rawname , buf , sizeof ( buf ) , false ) ;
2021-10-05 05:05:34 +00:00
else if ( loc . search )
2016-08-25 00:12:14 +00:00
COM_QuotedString ( va ( " %s/%s " , loc . search - > logicalpath , name ) , buf , sizeof ( buf ) , false ) ;
2021-10-05 05:05:34 +00:00
else
COM_QuotedString ( name , buf , sizeof ( buf ) , false ) ;
2016-08-25 00:12:14 +00:00
if ( cvar_watched )
Cbuf_InsertText ( va ( " echo END %s " , buf ) , level , true ) ;
2013-06-23 02:17:02 +00:00
// don't execute anything if it was from server (either the stuffcmd/localcmd, or the file)
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( ! strcmp ( name , " default.cfg " ) )
{
if ( ! ( Cmd_FromGamecode ( ) | | untrusted ) )
Cbuf_InsertText ( " \n cvar_lockdefaults 1 \n " , level , false ) ;
if ( fs_manifest - > defaultoverrides )
Cbuf_InsertText ( fs_manifest - > defaultoverrides , level , false ) ;
2021-10-05 05:05:34 +00:00
# if defined(HAVE_LEGACY) && defined(HAVE_CLIENT)
if ( l = = 1914 & & Com_BlockChecksum ( f , l ) = = 0x2d7b72b9 )
s = ( char * ) replacementq1binds ;
# endif
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
}
2017-12-09 21:22:46 +00:00
# ifndef QUAKETC
//hack to try to work around nquake's b0rkedness
2018-04-27 16:40:50 +00:00
if ( ! strncmp ( s , " // This is nQuake's Frogbot config " , 33 ) )
2020-10-26 06:30:35 +00:00
{
2021-05-09 13:01:21 +00:00
s = va ( " echo \" " CON_ERROR " Refusing to exec nQuake's %s \" " , buf ) ; //otherwise many people with nquake installed will be fucked over whenever they try playing singleplayer
2020-10-26 06:30:35 +00:00
Cbuf_InsertText ( s , level , true ) ;
}
else
2017-12-09 21:22:46 +00:00
{
2020-10-26 06:30:35 +00:00
int foundone = 0 ;
while ( ! strncmp ( s , " // " , 2 ) )
2017-12-09 21:22:46 +00:00
{
2020-10-26 06:30:35 +00:00
char * eol = strstr ( s , " \n " ) ;
if ( eol )
{
* eol + + = 0 ;
if ( strstr ( s , " nQuake " ) | | strstr ( s , " N Q U A K E " ) )
{ //this is evil, but if we're running quake then com_parseutf8 will be 0 and we can just convert to quake chars (less text).
char * out = s = eol ;
const char * in = s ;
while ( * in )
2017-12-09 21:22:46 +00:00
{
2020-10-26 06:30:35 +00:00
if ( * in = = ' \n ' & & ! strncmp ( in , " \n exec configs/config.cfg " , 24 ) )
{ //ezquake writes its configs elsewhere, and nquake stomps on everything in its autoexec.cfg, so we need to try to work around its breakages
memmove ( out , in , 6 ) ; out + = 6 ; in + = 6 ;
in + = 8 ;
foundone + + ;
continue ;
}
if ( * in = = ' ^ ' )
{
* out + + = 0x80 | * + + in ;
foundone + + ;
}
else
* out + + = * in ;
in + + ;
2017-12-09 21:22:46 +00:00
}
2020-10-26 06:30:35 +00:00
* out = 0 ;
break ;
2017-12-09 21:22:46 +00:00
}
2020-10-26 06:30:35 +00:00
s = eol ;
continue ;
2017-12-09 21:22:46 +00:00
}
2020-10-26 06:30:35 +00:00
break ;
2017-12-09 21:22:46 +00:00
}
2021-05-09 13:01:21 +00:00
# ifdef HAVE_CLIENT
if ( ! cl_warncmd . ival & & foundone & & ( ! strcmp ( name , " quake.rc " ) | | ! strcmp ( name , " default.cfg " ) | | ! strcmp ( name , " autoexec.cfg " ) ) )
{
2022-03-08 05:31:34 +00:00
# if defined(HAVE_LEGACY)
2021-10-05 05:05:34 +00:00
if ( ! strcmp ( name , " default.cfg " ) )
{
s = ( char * ) replacementq1binds ;
foundone = 0 ;
}
else
# endif
{
2022-03-08 05:31:34 +00:00
Menu_Prompt ( NULL , NULL , va ( " WARNING: nquake %s file detected. The file has been ignored. " , name ) , NULL , NULL , " Argh " , false ) ;
2021-10-05 05:05:34 +00:00
* s = 0 ;
foundone = 0 ;
}
2021-05-09 13:01:21 +00:00
}
# endif
2020-10-26 06:30:35 +00:00
Cbuf_InsertText ( s , level , true ) ;
if ( foundone )
Cbuf_InsertText ( va ( " \n echo \" " CON_ERROR " fixups for nquake config %s: %i replacements \" \n " , buf , foundone ) , level , false ) ;
2017-12-09 21:22:46 +00:00
}
2020-10-26 06:30:35 +00:00
# else
2016-08-25 00:12:14 +00:00
Cbuf_InsertText ( s , level , true ) ;
2020-10-26 06:30:35 +00:00
# endif
2016-08-25 00:12:14 +00:00
if ( cvar_watched )
Cbuf_InsertText ( va ( " echo BEGIN %s " , buf ) , level , true ) ;
2014-10-11 19:39:45 +00:00
BZ_Free ( f ) ;
2018-10-11 10:31:23 +00:00
if ( level ! = Cmd_ExecLevel )
Cbuf_ExecuteLevel ( level ) ;
2004-08-21 01:25:48 +00:00
}
2017-07-04 05:07:51 +00:00
static int QDECL CompleteExecList ( const char * name , qofs_t flags , time_t mtime , void * parm , searchpathfuncs_t * spath )
{
struct xcommandargcompletioncb_s * ctx = parm ;
2018-04-15 02:48:23 +00:00
ctx - > cb ( name , NULL , NULL , ctx ) ;
2017-07-04 05:07:51 +00:00
return true ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_Exec_c ( int argn , const char * partial , struct xcommandargcompletioncb_s * ctx )
2017-07-04 05:07:51 +00:00
{
if ( argn = = 1 )
{
COM_EnumerateFiles ( va ( " configs/%s*.cfg " , partial ) , CompleteExecList , ctx ) ;
COM_EnumerateFiles ( va ( " %s*.cfg " , partial ) , CompleteExecList , ctx ) ;
COM_EnumerateFiles ( va ( " %s*.rc " , partial ) , CompleteExecList , ctx ) ;
}
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = =
Cmd_Echo_f
Just prints the rest of the line to the console
= = = = = = = = = = = = = = =
*/
2017-12-09 21:22:46 +00:00
char * TP_ParseFunChars ( char * s ) ;
2018-10-11 10:31:23 +00:00
static void Cmd_Echo_f ( void )
2004-08-21 01:25:48 +00:00
{
2017-12-09 21:22:46 +00:00
char text [ 4096 ] ;
char extext [ 4096 ] , * t ;
int level = Cmd_ExecLevel ;
2004-08-21 01:25:48 +00:00
int i ;
2017-12-09 21:22:46 +00:00
* text = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
for ( i = 1 ; i < Cmd_Argc ( ) ; i + + )
2014-10-05 20:04:11 +00:00
{
2015-10-27 15:20:15 +00:00
if ( i > = 2 )
2017-12-09 21:22:46 +00:00
Q_strncatz ( text , " " , sizeof ( text ) ) ;
Q_strncatz ( text , Cmd_Argv ( i ) , sizeof ( text ) ) ;
}
Q_strncatz ( text , " \n " , sizeof ( text ) ) ;
//echo text is often quoted, so expand the text again now that we're no longer in quotes.
t = Cmd_ExpandString ( text , extext , sizeof ( extext ) , & level , ! Cmd_IsInsecure ( ) ? true : false , true ) ;
2018-12-28 00:04:36 +00:00
# ifndef HAVE_CLIENT
2017-12-09 21:22:46 +00:00
Con_Printf ( " %s " , t ) ;
2014-10-05 20:04:11 +00:00
# else
2017-12-09 21:22:46 +00:00
t = TP_ParseFunChars ( t ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2019-03-01 22:39:30 +00:00
Con_PrintFlags ( t , ( ( ezcompat_markup . ival > = 2 ) ? PFS_EZQUAKEMARKUP : 0 ) , 0 ) ;
2018-07-22 11:49:37 +00:00
# else
Con_PrintFlags ( t , 0 , 0 ) ;
# endif
2014-10-05 20:04:11 +00:00
# endif
2004-08-21 01:25:48 +00:00
}
2017-08-14 16:38:44 +00:00
static void Key_Alias_c ( int argn , const char * partial , struct xcommandargcompletioncb_s * ctx )
{
cmdalias_t * a ;
size_t len = strlen ( partial ) ;
if ( argn ! = 1 )
return ;
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! Q_strncasecmp ( partial , a - > name , len ) )
2018-04-15 02:48:23 +00:00
ctx - > cb ( a - > name , a - > value , NULL , ctx ) ;
2017-08-14 16:38:44 +00:00
}
}
static void Cmd_ShowAlias_f ( void )
2004-12-21 04:38:02 +00:00
{
cmdalias_t * a ;
char * s ;
s = Cmd_Argv ( 1 ) ;
//find it, print it
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! strcmp ( s , a - > name ) )
{
Con_Printf ( " alias %s %s \n " , a - > name , a - > value ) ;
return ;
}
}
Con_Printf ( " Alias doesn't exist \n " ) ;
}
2013-10-29 17:38:22 +00:00
//returns a zoned string.
char * Cmd_ParseMultiline ( qboolean checkheader )
{
char * result ;
char * end ;
int in = checkheader ? 0 : 1 ;
char * s ;
result = NULL ;
for ( ; ; )
{
s = Cbuf_GetNext ( Cmd_ExecLevel , false ) ;
if ( ! * s )
{
if ( in )
Con_Printf ( CON_WARNING " WARNING: Multiline alias was not terminated \n " ) ;
break ;
}
while ( * s < = ' ' & & * s )
s + + ;
for ( end = s + strlen ( s ) - 1 ; end > = s & & * end < = ' ' ; end - - )
* end = ' \0 ' ;
if ( ! strcmp ( s , " { " ) )
{
in + + ;
if ( in = = 1 )
continue ; //don't embed the first one in the string, because that would be weird.
}
else if ( ! strcmp ( s , " } " ) )
{
in - - ;
if ( ! in )
break ; //phew
}
if ( result )
{
char * newv = ( char * ) Z_Malloc ( strlen ( result ) + strlen ( s ) + 2 ) ;
sprintf ( newv , " %s;%s " , result , s ) ;
Z_Free ( result ) ;
result = newv ;
}
else
result = Z_StrDup ( s ) ;
if ( ! in )
break ;
}
return result ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = =
Cmd_Alias_f
Creates a new command that executes a command string ( possibly ; seperated )
= = = = = = = = = = = = = = =
*/
2018-10-11 10:31:23 +00:00
static void Cmd_Alias_f ( void )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * a , * b ;
2016-08-25 00:12:14 +00:00
char cmd [ 65536 ] ;
2004-08-21 01:25:48 +00:00
int i , c ;
char * s ;
qboolean multiline ;
if ( Cmd_Argc ( ) = = 1 ) //list em all.
{
2005-04-16 16:21:27 +00:00
if ( Cmd_FromGamecode ( ) )
2004-08-21 01:25:48 +00:00
{
if ( Cmd_ExecLevel = = RESTRICT_SERVER )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Current alias commands: \n " ) ;
2004-08-21 01:25:48 +00:00
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( a - > flags & ALIAS_FROMSERVER )
Con_Printf ( " %s : %s \n " , a - > name , a - > value ) ;
}
}
}
else
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Current alias commands: \n " ) ;
2004-08-21 01:25:48 +00:00
for ( a = cmd_alias ; a ; a = a - > next )
{
/* extern int con_linewidth;
if ( strlen ( a - > value ) + strlen ( a - > name ) + 3 > con_linewidth )
Con_Printf ( " %s ... \n " , a - > name ) ;
else */
Con_Printf ( " %s : %s \n " , a - > name , a - > value ) ;
}
}
return ;
}
s = Cmd_Argv ( 1 ) ;
2017-08-14 16:38:44 +00:00
if ( ! strcmp ( s , " say " ) ) //reject aliasing the say command. We use it as an easy way to warn that our player is cheating.
2004-08-21 01:25:48 +00:00
{
2017-08-14 16:38:44 +00:00
Con_TPrintf ( " Refusing to create an alias with the name '%s' \n " , s ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2021-05-27 11:34:07 +00:00
// check for overlap with a command
if ( Cmd_Exists ( s ) )
{ //commands always take precedence over aliases (so mods can't clobber 'quit' etc), so creating an alias with one of these names is stupid. always try to rename them.
if ( Cmd_IsInsecure ( ) )
2004-08-21 01:25:48 +00:00
{
2021-05-27 11:34:07 +00:00
snprintf ( cmd , sizeof ( cmd ) , " %s_a " , s ) ;
if ( Cmd_Exists ( cmd ) )
2004-08-21 01:25:48 +00:00
{
2021-05-27 11:34:07 +00:00
Con_Printf ( S_COLOR_RED " Can't register alias, %s is a command \n " , s ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2021-05-27 11:34:07 +00:00
Con_Printf ( S_COLOR_RED " alias %s: renamed to %s due to command conflict \n " , s , cmd ) ;
s = cmd ;
2004-08-21 01:25:48 +00:00
}
2021-05-27 11:34:07 +00:00
else
{
Con_Printf ( S_COLOR_RED " Can't register alias, %s is a command \n " , s ) ;
return ;
}
}
if ( ! cl_aliasoverlap . value )
{ //aliases take precedence over cvars (while cvars can be set via 'set'), so user's choice.
if ( Cvar_FindVar ( s ) )
2004-08-21 01:25:48 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( Cmd_IsInsecure ( ) )
2004-08-21 01:25:48 +00:00
{
2006-03-06 01:41:09 +00:00
snprintf ( cmd , sizeof ( cmd ) , " %s_a " , s ) ;
2021-05-27 11:34:07 +00:00
Con_Printf ( S_COLOR_RED " alias %s: renamed to %s due to cvar conflict \n " , s , cmd ) ;
2004-08-21 01:25:48 +00:00
s = cmd ;
}
else
{
2021-05-27 11:34:07 +00:00
Con_Printf ( S_COLOR_RED " alias %s: can't register alias - matches existing cvar \n " , s ) ;
2004-08-21 01:25:48 +00:00
return ;
}
}
}
2005-07-28 15:22:15 +00:00
// if the alias already exists, reuse it
2004-08-21 01:25:48 +00:00
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! strcmp ( s , a - > name ) )
{
2009-11-04 21:16:50 +00:00
if ( ( a - > restriction ? a - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2004-08-21 01:25:48 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Alias is already bound with a higher restriction \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2008-01-05 09:58:55 +00:00
if ( ! stricmp ( Cmd_Argv ( 0 ) , " newalias " ) )
return ; //newalias command only registers the alias if it is new, and does not change it if it already exists
2004-08-21 01:25:48 +00:00
Z_Free ( a - > value ) ;
break ;
}
}
if ( ! a )
{
2017-08-14 16:38:44 +00:00
cmdalias_t * * link ;
a = ( cmdalias_t * ) Z_Malloc ( sizeof ( cmdalias_t ) + strlen ( s ) ) ;
strcpy ( a - > name , s ) ;
for ( link = & cmd_alias ; ; link = & ( * link ) - > next )
{
if ( ! * link | | strcmp ( ( * link ) - > name , s ) > = 0 )
{
a - > next = * link ;
* link = a ;
break ;
}
}
2004-08-21 01:25:48 +00:00
}
2005-04-16 16:21:27 +00:00
if ( Cmd_FromGamecode ( ) )
2004-08-21 01:25:48 +00:00
a - > flags | = ALIAS_FROMSERVER ;
else
a - > flags & = ~ ALIAS_FROMSERVER ;
multiline = false ;
if ( Cmd_Argc ( ) = = 2 ) //check the next statement for being '{'
{
char * line , * end ;
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( Cmd_ExecLevel , false ) ;
2004-08-21 01:25:48 +00:00
while ( * line < = ' ' & & * line ) //skip leading whitespace.
line + + ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
for ( end = line + strlen ( line ) - 1 ; end > = line & & * end < = ' ' ; end - - ) //skip trailing
* end = ' \0 ' ;
if ( ! strcmp ( line , " { " ) )
multiline = true ;
else
2006-02-06 01:06:17 +00:00
Cbuf_InsertText ( line , Cmd_ExecLevel , true ) ; //whoops. Stick the trimmed string back in to the cbuf.
2004-08-21 01:25:48 +00:00
}
else if ( ! strcmp ( Cmd_Argv ( 2 ) , " { " ))
multiline = true ;
if ( multiline )
{ //fun! MULTILINE ALIASES!!!!
2013-10-29 17:38:22 +00:00
a - > value = Cmd_ParseMultiline ( false ) ;
2004-08-21 01:25:48 +00:00
}
2016-08-25 00:12:14 +00:00
else
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
// copy the rest of the command line
cmd [ 0 ] = 0 ; // start out with a null string
c = Cmd_Argc ( ) ;
for ( i = 2 ; i < c ; i + + )
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
strcat ( cmd , Cmd_Argv ( i ) ) ;
if ( i ! = c - 1 )
strcat ( cmd , " " ) ;
2004-08-21 01:25:48 +00:00
}
2016-08-25 00:12:14 +00:00
2017-08-14 16:38:44 +00:00
if ( ! * cmd & & ! dpcompat_console . ival ) //someone wants to wipe it. let them
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
if ( a = = cmd_alias )
{
cmd_alias = a - > next ;
Z_Free ( a ) ;
return ;
}
else
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
for ( b = cmd_alias ; b ; b = b - > next )
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
if ( b - > next = = a )
{
b - > next = a - > next ;
Z_Free ( a ) ;
return ;
}
2004-08-21 01:25:48 +00:00
}
}
}
2016-08-25 00:12:14 +00:00
a - > value = Z_StrDup ( cmd ) ;
2004-08-21 01:25:48 +00:00
}
2005-04-16 16:21:27 +00:00
if ( Cmd_FromGamecode ( ) )
2004-12-24 08:45:56 +00:00
{
a - > execlevel = RESTRICT_SERVER ; //server-set aliases MUST run at the server's level.
a - > restriction = 1 ; //and be runnable at the user's level
}
else
{
a - > execlevel = 0 ; //run at users exec level
a - > restriction = 1 ; //this is possibly a security risk if the admin also changes execlevel
}
2004-08-21 01:25:48 +00:00
}
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2017-08-14 16:38:44 +00:00
static void Cmd_AliasEdit_f ( void )
{
char * alias = Cmd_AliasExist ( Cmd_Argv ( 1 ) , RESTRICT_LOCAL ) ;
char quotedalias [ 2048 ] ;
if ( alias )
{
COM_QuotedString ( alias , quotedalias , sizeof ( quotedalias ) , false ) ;
Key_ConsoleReplace ( va ( " alias %s %s " , Cmd_Argv ( 1 ) , quotedalias ) ) ;
}
else
Con_Printf ( " Not an alias \n " ) ;
}
# endif
2018-10-11 10:31:23 +00:00
/*static void Cmd_DeleteAlias(const char *name)
2004-08-21 01:25:48 +00:00
{
2018-06-02 08:55:57 +00:00
cmdalias_t * a , * * link ;
for ( link = & cmd_alias ; ( a = * link ) ; link = & ( * link ) - > next )
2004-08-21 01:25:48 +00:00
{
2018-06-02 08:55:57 +00:00
if ( ! strcmp ( a - > name , name ) )
2004-08-21 01:25:48 +00:00
{
2018-06-02 08:55:57 +00:00
* link = a - > next ;
Z_Free ( a - > value ) ;
Z_Free ( a ) ;
2004-08-21 01:25:48 +00:00
return ;
}
}
2018-10-11 10:31:23 +00:00
} */
2004-08-21 01:25:48 +00:00
2014-03-30 08:55:06 +00:00
char * Cmd_AliasExist ( const char * name , int restrictionlevel )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * a ;
2005-07-28 15:22:15 +00:00
// if the alias already exists, reuse it
2004-08-21 01:25:48 +00:00
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! strcmp ( name , a - > name ) )
{
2009-11-04 21:16:50 +00:00
if ( ( a - > restriction ? a - > restriction : rcon_level . ival ) > restrictionlevel )
2004-08-21 01:25:48 +00:00
{
return NULL ; //not at this level...
}
return a - > value ;
}
}
return NULL ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_AliasLevel_f ( void )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * a ;
char * s = Cmd_Argv ( 1 ) ;
int level ;
if ( Cmd_Argc ( ) < 2 | | Cmd_Argc ( ) > 3 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " aliaslevel <var> [execlevel] \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! strcmp ( s , a - > name ) )
{
break ;
}
}
if ( ! a )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Alias not found \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
if ( Cmd_Argc ( ) = = 3 )
{
level = atoi ( Cmd_Argv ( 2 ) ) ;
if ( level > RESTRICT_MAX )
{
level = RESTRICT_MAX ;
}
else if ( level < RESTRICT_MIN )
level = RESTRICT_MIN ;
2009-11-04 21:16:50 +00:00
if ( level > Cmd_ExecLevel | | ( a - > restriction ? a - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2004-08-21 01:25:48 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " You arn't allowed to raise a command above your own level \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
a - > execlevel = level ;
if ( a - > restriction = = 1 )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " WARNING: %s is available to all clients, any client will be able to use it at the new level. \n " , a - > name ) ;
2004-08-21 01:25:48 +00:00
}
else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " alias %s is set to run at the user level of %i \n " , s , a - > execlevel ) ;
2004-08-21 01:25:48 +00:00
}
//lists commands, also prints restriction level
2018-10-11 10:31:23 +00:00
static void Cmd_AliasList_f ( void )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * cmd ;
2005-07-03 15:16:20 +00:00
int num = 0 ;
2006-09-18 22:53:22 +00:00
int flags ;
if ( ! strcmp ( Cmd_Argv ( 1 ) , " server " ) )
flags = ALIAS_FROMSERVER ;
else
flags = 0 ;
2004-08-21 01:25:48 +00:00
for ( cmd = cmd_alias ; cmd ; cmd = cmd - > next )
2005-07-03 15:16:20 +00:00
{
2009-11-04 21:16:50 +00:00
if ( ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2004-08-21 01:25:48 +00:00
continue ;
2006-09-18 22:53:22 +00:00
if ( flags & & ! ( cmd - > flags & flags ) )
continue ;
2004-08-21 01:25:48 +00:00
if ( ! num )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Alias list: \n " ) ;
2004-08-21 01:25:48 +00:00
if ( cmd - > execlevel )
2009-11-04 21:16:50 +00:00
Con_Printf ( " (%2i)(%2i) %s \n " , ( int ) ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) , cmd - > execlevel , cmd - > name ) ;
2004-08-21 01:25:48 +00:00
else
2009-11-04 21:16:50 +00:00
Con_Printf ( " (%2i) %s \n " , ( int ) ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) , cmd - > name ) ;
2004-08-21 01:25:48 +00:00
num + + ;
}
if ( num )
Con_Printf ( " \n " ) ;
}
2018-10-11 10:31:23 +00:00
static void Alias_WriteAliases ( vfsfile_t * f )
2004-08-21 01:25:48 +00:00
{
2016-08-25 00:12:14 +00:00
const char * s ;
2004-08-21 01:25:48 +00:00
cmdalias_t * cmd ;
2005-07-03 15:16:20 +00:00
int num = 0 ;
2016-08-25 00:12:14 +00:00
char buf [ 65536 ] ;
2004-08-21 01:25:48 +00:00
for ( cmd = cmd_alias ; cmd ; cmd = cmd - > next )
2005-07-03 15:16:20 +00:00
{
2009-11-04 21:16:50 +00:00
// if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
2004-08-21 01:25:48 +00:00
// continue;
2004-12-24 08:45:56 +00:00
if ( cmd - > flags & ALIAS_FROMSERVER )
continue ;
2004-08-21 01:25:48 +00:00
if ( ! num )
2005-12-21 03:07:33 +00:00
{
s = va ( " \n ////////////////// \n //Aliases \n " ) ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
}
2016-08-25 00:12:14 +00:00
s = va ( " alias %s " , cmd - > name ) ;
2005-12-21 03:07:33 +00:00
VFS_WRITE ( f , s , strlen ( s ) ) ;
2016-08-25 00:12:14 +00:00
s = COM_QuotedString ( cmd - > value , buf , sizeof ( buf ) , false ) ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
VFS_WRITE ( f , " \n " , 1 ) ;
2004-12-24 08:45:56 +00:00
if ( cmd - > restriction ! = 1 ) //1 is default
2005-12-21 03:07:33 +00:00
{
s = va ( " restrict %s %i \n " , cmd - > name , cmd - > restriction ) ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
}
2004-12-24 08:45:56 +00:00
if ( cmd - > execlevel ! = 0 ) //0 is default (runs at user's level)
2005-12-21 03:07:33 +00:00
{
s = va ( " aliaslevel %s %i \n " , cmd - > name , cmd - > execlevel ) ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
}
2004-08-21 01:25:48 +00:00
num + + ;
}
}
2013-08-27 13:18:09 +00:00
void Alias_WipeStuffedAliases ( void )
2004-08-21 01:25:48 +00:00
{
2013-08-27 13:18:09 +00:00
cmdalias_t * * link , * cmd ;
for ( link = & cmd_alias ; ( cmd = * link ) ; )
2004-08-21 01:25:48 +00:00
{
if ( cmd - > flags & ALIAS_FROMSERVER )
{
2013-08-27 13:18:09 +00:00
* link = cmd - > next ;
Z_Free ( cmd - > value ) ;
Z_Free ( cmd ) ;
2004-08-21 01:25:48 +00:00
}
else
2013-08-27 13:18:09 +00:00
link = & ( * link ) - > next ;
2004-08-21 01:25:48 +00:00
}
}
void Cvar_List_f ( void ) ;
2005-08-23 03:25:22 +00:00
void Cvar_Reset_f ( void ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
void Cvar_ResetAll_f ( void ) ;
2013-10-29 17:38:22 +00:00
void Cvar_LockDefaults_f ( void ) ;
void Cvar_PurgeDefaults_f ( void ) ;
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
COMMAND EXECUTION
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
typedef struct cmd_function_s
{
struct cmd_function_s * next ;
2017-08-14 16:38:44 +00:00
const char * name ;
const char * description ;
2004-08-21 01:25:48 +00:00
xcommand_t function ;
2017-07-04 05:07:51 +00:00
xcommandargcompletion_t argcompletion ;
2004-08-21 01:25:48 +00:00
qbyte restriction ; //restriction of admin level
} cmd_function_t ;
# define MAX_ARGS 80
static int cmd_argc ;
static char * cmd_argv [ MAX_ARGS ] ;
static char * cmd_null_string = " " ;
2008-01-29 23:18:06 +00:00
static char * cmd_args = NULL , * cmd_args_buf ;
2004-08-21 01:25:48 +00:00
static cmd_function_t * cmd_functions ; // possible commands to execute
/*
= = = = = = = = = = = =
Cmd_Argc
= = = = = = = = = = = =
*/
2005-03-18 06:13:36 +00:00
int VARGS Cmd_Argc ( void )
2004-08-21 01:25:48 +00:00
{
return cmd_argc ;
}
/*
= = = = = = = = = = = =
Cmd_Argv
= = = = = = = = = = = =
*/
2005-03-18 06:13:36 +00:00
char * VARGS Cmd_Argv ( int arg )
2004-08-21 01:25:48 +00:00
{
if ( arg > = cmd_argc )
return cmd_null_string ;
2005-07-03 15:16:20 +00:00
return cmd_argv [ arg ] ;
2004-08-21 01:25:48 +00:00
}
/*
= = = = = = = = = = = =
Cmd_Args
Returns a single string containing argv ( 1 ) to argv ( argc ( ) - 1 )
= = = = = = = = = = = =
*/
2005-03-18 06:13:36 +00:00
char * VARGS Cmd_Args ( void )
2004-08-21 01:25:48 +00:00
{
if ( ! cmd_args )
2016-07-15 12:26:24 +00:00
return " \0 \0 " ; //fucking hell gcc, I shouldn't need this shit.
2004-08-21 01:25:48 +00:00
return cmd_args ;
}
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
void Cmd_Args_Set ( const char * newargs , size_t len )
2007-02-23 00:21:33 +00:00
{
2008-01-29 23:18:06 +00:00
if ( cmd_args_buf )
Z_Free ( cmd_args_buf ) ;
if ( newargs )
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
cmd_args_buf = ( char * ) Z_Malloc ( len + 1 ) ;
memcpy ( cmd_args_buf , newargs , len ) ;
cmd_args_buf [ len ] = 0 ;
2008-01-29 23:18:06 +00:00
cmd_args = cmd_args_buf ;
}
else
{
cmd_args = NULL ;
cmd_args_buf = NULL ;
}
2007-02-23 00:21:33 +00:00
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cmd_ShiftArgs
Shifts Cmd_Argv results down one ( killing first param )
= = = = = = = = = = = =
*/
2004-12-08 04:14:52 +00:00
void Cmd_ShiftArgs ( int ammount , qboolean expandstring )
2004-08-21 01:25:48 +00:00
{
int arg ;
while ( ammount > 0 & & cmd_argc )
{
arg = 0 ;
cmd_argc - - ;
Z_Free ( cmd_argv [ 0 ] ) ;
while ( arg < cmd_argc )
{
cmd_argv [ arg ] = cmd_argv [ arg + 1 ] ;
arg + + ;
}
cmd_argv [ arg ] = NULL ;
ammount - - ;
if ( cmd_args )
{
2011-02-25 04:22:14 +00:00
cmd_args = COM_StringParse ( cmd_args , com_token , sizeof ( com_token ) , expandstring , false ) ;
2004-08-21 01:25:48 +00:00
if ( cmd_args )
2007-01-08 03:11:36 +00:00
while ( * cmd_args = = ' ' | | * cmd_args = = ' \t ' )
2004-08-21 01:25:48 +00:00
cmd_args + + ;
}
}
}
2018-10-11 10:31:23 +00:00
static const char * Cmd_ExpandCvar ( char * cvarterm , int maxaccesslevel , int * newaccesslevel , qboolean enclosed , int * len )
2008-01-29 23:18:06 +00:00
{
2017-08-14 16:38:44 +00:00
const char * ret = NULL ;
char * fixup = NULL , fixval = 0 , * t ;
2008-01-29 23:18:06 +00:00
cvar_t * var ;
static char temp [ 12 ] ;
2017-08-14 16:38:44 +00:00
static char quoted [ 256 ] ;
2013-05-11 05:03:07 +00:00
unsigned int result ;
2017-08-14 16:38:44 +00:00
int termlen , pl ;
2008-01-29 23:18:06 +00:00
2017-08-14 16:38:44 +00:00
int quotetype = 0 ;
const char * cvarname ;
2017-08-29 02:29:06 +00:00
//set foo ba"r; ${foo q} -> ba\"r
//set foo bar; ${foo asis} -> ba"r
//${bar q} -> <EMPTY>
//${bar ?} -> ""
//${bar !} -> <ERROR>
fixup = cvarterm + strlen ( cvarterm ) ;
fixval = 0 ;
termlen = fixup - cvarterm ;
if ( fixup - cvarterm > 2 & & ! strncmp ( fixup - 2 , " ? " , 2 ) )
{ //force expansion, even if not defined.
pl = 2 ;
quotetype = 2 ;
}
else if ( fixup - cvarterm > 2 & & ! strncmp ( fixup - 2 , " ! " , 2 ) )
{ //abort is not defined
pl = 2 ;
quotetype = 3 ;
}
else if ( fixup - cvarterm > 2 & & ! strncmp ( fixup - 2 , " q " , 2 ) )
{ //escaping it if not empty, otherwise empty.
pl = 2 ;
quotetype = 1 ;
}
2018-09-29 17:31:58 +00:00
else if ( fixup - cvarterm > 5 & & ! strncmp ( fixup - 5 , " asis " , 5 ) )
2017-08-29 02:29:06 +00:00
{ //no escaping...
pl = 5 ;
quotetype = 0 ;
2008-01-29 23:18:06 +00:00
}
else
{
2017-08-29 02:29:06 +00:00
pl = 0 ;
2017-09-21 12:22:16 +00:00
quotetype = enclosed & & dpcompat_console . ival ; //default to escaping.
2017-08-29 02:29:06 +00:00
}
if ( pl )
{
fixup - = pl ;
2008-01-29 23:18:06 +00:00
fixval = * fixup ;
2017-08-29 02:29:06 +00:00
* fixup = 0 ;
2008-01-29 23:18:06 +00:00
}
2017-08-29 02:29:06 +00:00
else
fixup = NULL ;
if ( * cvarterm = = ' $ ' )
2017-09-21 12:22:16 +00:00
cvarname = Cmd_ExpandCvar ( cvarterm + 1 , maxaccesslevel , newaccesslevel , false , & pl ) ;
2017-08-29 02:29:06 +00:00
else
cvarname = cvarterm ;
2008-01-29 23:18:06 +00:00
2017-08-14 16:38:44 +00:00
result = strtoul ( cvarname , & t , 10 ) ;
if ( ( dpcompat_console . ival | | fixval ) & & ( * t = = 0 | | ( * t = = ' - ' & & t [ 1 ] = = 0 ) ) ) //only expand $0 if its actually ${0} - this avoids conflicting with the $0 macro
{
if ( * t = = ' - ' ) //pure number with a trailing minus means
{ //args starting after that.
ret = Cmd_Args ( ) ;
while ( ret & & result - - > 1 )
ret = COM_StringParse ( ret , com_token , sizeof ( com_token ) , false , false ) ;
while ( ret & & ( * ret = = ' ' | | * ret = = ' \t ' ) )
ret + + ;
}
else //purely numerical
ret = Cmd_Argv ( result ) ;
2008-01-29 23:18:06 +00:00
}
else if ( ! strcmp ( cvarname , " * " ) | | ! stricmp ( cvarname , " cmd_args " ) )
{
ret = Cmd_Args ( ) ;
}
else if ( ! strnicmp ( cvarname , " cmd_argv " , 8 ) )
{
ret = Cmd_Argv ( atoi ( cvarname + 8 ) ) ;
}
2017-08-14 16:38:44 +00:00
else if ( ! strcmp ( cvarname , " # " ) | | ! stricmp ( cvarname , " cmd_argc " ) )
2008-01-29 23:18:06 +00:00
{
Q_snprintfz ( temp , sizeof ( temp ) , " %u " , Cmd_Argc ( ) ) ;
ret = temp ;
}
else if ( ( var = Cvar_FindVar ( cvarname ) ) ! = NULL )
{
if ( var - > restriction < = maxaccesslevel & & ! ( ( var - > flags & CVAR_NOUNSAFEEXPAND ) & & Cmd_IsInsecure ( ) ) )
{
ret = var - > string ;
2015-09-18 20:30:10 +00:00
if ( var - > flags & CVAR_TEAMPLAYTAINT ) //if we're only allowed to expand this for teamplay, then switch access levels
* newaccesslevel = 0 ;
2008-01-29 23:18:06 +00:00
}
}
2017-08-29 02:29:06 +00:00
if ( fixup )
* fixup = fixval ;
2017-08-14 16:38:44 +00:00
if ( quotetype = = 3 )
2008-01-29 23:18:06 +00:00
{
2017-08-14 16:38:44 +00:00
if ( ret )
quotetype = 1 ;
else
return NULL ;
}
else if ( quotetype = = 2 )
{
quotetype = 1 ;
if ( ! ret )
ret = " " ;
2008-01-29 23:18:06 +00:00
}
2017-08-14 16:38:44 +00:00
if ( ret )
* len = termlen ;
if ( quotetype )
ret = COM_QuotedString ( ret ? ret : " " , quoted , sizeof ( quoted ) , true ) ;
2008-01-29 23:18:06 +00:00
return ret ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = =
Cmd_ExpandString
Expands all $ cvar expressions to cvar values
If not SERVERONLY , also expands $ macro expressions
Note : dest must point to a 1024 byte buffer
= = = = = = = = = = = = = = = =
*/
2017-08-14 16:38:44 +00:00
char * Cmd_ExpandString ( const char * data , char * dest , int destlen , int * accesslevel , qboolean expandcvars , qboolean expandmacros )
2004-08-21 01:25:48 +00:00
{
unsigned int c ;
char buf [ 255 ] ;
int i , len ;
int quotes = 0 ;
2017-08-14 16:38:44 +00:00
const char * str ;
const char * bestvar ;
2015-07-14 14:47:00 +00:00
int name_length , var_length ;
2004-09-20 23:25:38 +00:00
qboolean striptrailing ;
2015-09-18 20:30:10 +00:00
int maxaccesslevel = * accesslevel ;
2004-08-21 01:25:48 +00:00
len = 0 ;
while ( ( c = * data ) ! = 0 )
{
if ( c = = ' " ' )
quotes + + ;
2019-02-24 08:32:45 +00:00
if ( c = = ' % ' & & ! ( quotes & 1 ) & & ! dpcompat_console . ival )
{ //QW262/ezquake does this. kinda annoying.
char * end ;
if ( data [ 1 ] = = ' % ' )
{
str = " % " ;
data + = 2 ;
}
else if ( data [ 1 ] = = ' # ' )
{
str = va ( " \" %s \" " , Cmd_Args ( ) ) ;
data + = 2 ;
}
else if ( data [ 1 ] = = ' * ' )
{
str = Cmd_Args ( ) ;
data + = 2 ;
}
else if ( ( i = strtol ( data + 1 , & end , 10 ) ) )
{
data = end ;
str = Cmd_Argv ( i ) ;
}
else
{
data + + ;
str = " % " ; //some kind of encoding error
}
// check buffer size
if ( len + strlen ( str ) > = destlen - 1 )
break ;
strcpy ( & dest [ len ] , str ) ;
len + = strlen ( str ) ;
}
else if ( c = = ' $ ' & & ( ! ( quotes & 1 ) | | dpcompat_console . ival ) )
2004-08-21 01:25:48 +00:00
{
data + + ;
2017-08-29 02:29:06 +00:00
if ( * data = = ' $ ' )
{ //double-dollar expands to a single dollar.
data + + ;
str = " $ " ;
striptrailing = false ;
name_length = 0 ;
buf [ 0 ] = 0 ;
buf [ 1 ] = 0 ;
}
else if ( * data = = ' { ' )
{ //${foo} can do some especially weird expansions.
data + + ;
i = 0 ;
buf [ i + + ] = ' { ' ;
striptrailing = ( * data = = ' - ' ) ? true : false ;
while ( * data & & * data ! = ' } ' )
2017-08-14 16:38:44 +00:00
{
2017-08-29 02:29:06 +00:00
if ( i < sizeof ( buf ) - 2 )
buf [ i + + ] = * data ;
2017-08-14 16:38:44 +00:00
data + + ;
}
2004-08-21 01:25:48 +00:00
buf [ i ] = 0 ;
2017-08-29 02:29:06 +00:00
bestvar = NULL ;
2019-03-03 06:25:47 +00:00
if ( ( str = Cmd_ExpandCvar ( buf + 1 + striptrailing , expandcvars ? maxaccesslevel : - 999 , accesslevel , true , & var_length ) ) )
2015-07-14 14:47:00 +00:00
bestvar = str ;
2017-08-29 02:29:06 +00:00
if ( expandmacros & & ( str = TP_MacroString ( buf + 1 + striptrailing , accesslevel , & var_length ) ) )
2015-07-14 14:47:00 +00:00
bestvar = str ;
2008-01-29 23:18:06 +00:00
str = bestvar ;
2017-08-29 02:29:06 +00:00
if ( * data = = ' } ' )
{
data + + ;
buf [ i + + ] = ' } ' ;
buf [ i ] = 0 ;
}
name_length = i ;
2004-08-21 01:25:48 +00:00
}
2004-09-20 23:25:38 +00:00
else
{
2017-08-29 02:29:06 +00:00
striptrailing = ( * data = = ' - ' ) ? true : false ;
// Copy the text after '$' to a temp buffer
i = 0 ;
buf [ 0 ] = 0 ;
buf [ 1 ] = 0 ;
bestvar = NULL ;
var_length = 0 ;
while ( ( c = * data ) )
{
if ( c < ' ' | | c = = ' $ ' )
break ;
if ( c = = ' ' & & buf [ 0 ] ! = ' { ' )
break ;
data + + ;
buf [ i + + ] = c ;
buf [ i ] = 0 ;
2019-03-03 06:25:47 +00:00
if ( ( str = Cmd_ExpandCvar ( buf + striptrailing , expandcvars ? maxaccesslevel : - 999 , accesslevel , false , & var_length ) ) )
2017-08-29 02:29:06 +00:00
bestvar = str ;
if ( expandmacros & & ( str = TP_MacroString ( buf + striptrailing , accesslevel , & var_length ) ) )
bestvar = str ;
}
if ( bestvar )
{
str = bestvar ;
name_length = var_length ;
}
else
{
str = NULL ;
name_length = 0 ;
}
2004-09-20 23:25:38 +00:00
}
2004-08-21 01:25:48 +00:00
if ( str )
{
// check buffer size
2004-09-20 23:25:38 +00:00
if ( len + strlen ( str ) > = destlen - 1 )
2004-08-21 01:25:48 +00:00
break ;
strcpy ( & dest [ len ] , str ) ;
len + = strlen ( str ) ;
i = name_length ;
while ( buf [ i ] )
dest [ len + + ] = buf [ i + + ] ;
2004-09-20 23:25:38 +00:00
if ( striptrailing & & ! * str )
while ( * data < = ' ' & & * data )
data + + ;
2004-08-21 01:25:48 +00:00
}
else
{
// no matching cvar or macro
dest [ len + + ] = ' $ ' ;
2004-09-20 23:25:38 +00:00
if ( len + strlen ( buf ) > = destlen - 1 )
2004-08-21 01:25:48 +00:00
break ;
strcpy ( & dest [ len ] , buf ) ;
len + = strlen ( buf ) ;
}
}
else
{
dest [ len ] = c ;
data + + ;
len + + ;
2004-09-20 23:25:38 +00:00
if ( len > = destlen - 1 )
2004-08-21 01:25:48 +00:00
break ;
}
} ;
dest [ len ] = 0 ;
2004-09-20 23:25:38 +00:00
2014-02-11 17:51:29 +00:00
if ( len & & dest [ len - 1 ] = = ' \r ' ) //with dos line endings, don't add some pointless \r char on the end.
dest [ len - 1 ] = 0 ;
2004-09-20 23:25:38 +00:00
return dest ;
2004-08-21 01:25:48 +00:00
}
/*
= = = = = = = = = = = =
Cmd_TokenizeString
2012-11-27 03:23:19 +00:00
Parses the given string into command line tokens , stopping at the \ n
2004-08-21 01:25:48 +00:00
= = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
const char * Cmd_TokenizeString ( const char * text , qboolean expandmacros , qboolean qctokenize )
2004-08-21 01:25:48 +00:00
{
int i ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
const char * args = NULL ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// clear the args from the last string
for ( i = 0 ; i < cmd_argc ; i + + )
Z_Free ( cmd_argv [ i ] ) ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
cmd_argc = 0 ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
while ( 1 )
{
2008-05-25 22:23:43 +00:00
// skip whitespace up to a \n
2005-08-03 23:14:59 +00:00
while ( * text & & ( unsigned ) * text < = ' ' & & * text ! = ' \n ' )
2004-08-21 01:25:48 +00:00
{
text + + ;
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( * text = = ' \n ' )
{ // a newline seperates commands in the buffer
2005-07-03 15:16:20 +00:00
text + + ;
2004-08-21 01:25:48 +00:00
break ;
}
if ( ! * text )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
break ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( cmd_argc = = 1 )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
args = text ;
2004-12-08 04:14:52 +00:00
2011-02-25 04:22:14 +00:00
text = COM_StringParse ( text , com_token , sizeof ( com_token ) , expandmacros , qctokenize ) ;
2004-08-21 01:25:48 +00:00
if ( ! text )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
break ;
2012-11-27 03:23:19 +00:00
if ( ! strcmp ( com_token , " \n " ) )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
break ;
2004-08-21 01:25:48 +00:00
if ( cmd_argc < MAX_ARGS )
{
2005-03-28 00:11:59 +00:00
cmd_argv [ cmd_argc ] = ( char * ) Z_Malloc ( Q_strlen ( com_token ) + 1 ) ;
2004-08-21 01:25:48 +00:00
Q_strcpy ( cmd_argv [ cmd_argc ] , com_token ) ;
cmd_argc + + ;
}
}
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( args )
{
const char * argsend = text ? text : args + strlen ( args ) ;
while ( argsend > args & & ( argsend [ - 1 ] = = ' \n ' | | argsend [ - 1 ] = = ' \r ' ) )
argsend - - ;
Cmd_Args_Set ( args , argsend - args ) ;
}
else
Cmd_Args_Set ( NULL , 0 ) ;
2012-11-27 03:23:19 +00:00
return text ;
2008-11-09 22:29:28 +00:00
}
void Cmd_TokenizePunctation ( char * text , char * punctuation )
{
int i ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
char * args = NULL ;
2008-11-09 22:29:28 +00:00
// clear the args from the last string
for ( i = 0 ; i < cmd_argc ; i + + )
Z_Free ( cmd_argv [ i ] ) ;
cmd_argc = 0 ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
Cmd_Args_Set ( NULL , 0 ) ;
2008-11-09 22:29:28 +00:00
while ( 1 )
{
// skip whitespace up to a \n
while ( * text & & ( unsigned ) * text < = ' ' & & * text ! = ' \n ' )
{
text + + ;
}
if ( * text = = ' \n ' )
{ // a newline seperates commands in the buffer
text + + ;
break ;
}
if ( ! * text )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
break ;
2008-11-09 22:29:28 +00:00
if ( cmd_argc = = 1 )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
args = text ;
2005-07-03 15:16:20 +00:00
2008-11-09 22:29:28 +00:00
text = COM_ParseToken ( text , punctuation ) ;
if ( ! text )
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
break ;
2008-11-09 22:29:28 +00:00
if ( cmd_argc < MAX_ARGS )
{
cmd_argv [ cmd_argc ] = ( char * ) Z_Malloc ( Q_strlen ( com_token ) + 1 ) ;
Q_strcpy ( cmd_argv [ cmd_argc ] , com_token ) ;
cmd_argc + + ;
}
}
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( args )
{
const char * argsend = text ? text : args + strlen ( args ) ;
while ( argsend > args & & ( argsend [ - 1 ] = = ' \n ' | | argsend [ - 1 ] = = ' \r ' ) )
argsend - - ;
Cmd_Args_Set ( args , argsend - args ) ;
}
2004-08-21 01:25:48 +00:00
}
/*
= = = = = = = = = = = =
Cmd_AddCommand
= = = = = = = = = = = =
*/
2005-07-03 15:16:20 +00:00
2017-08-14 16:38:44 +00:00
qboolean Cmd_AddCommandAD ( const char * cmd_name , xcommand_t function , xcommandargcompletion_t argcompletion , const char * desc )
2004-08-21 01:25:48 +00:00
{
cmd_function_t * cmd ;
// fail if the command is a variable name
2020-03-07 09:00:40 +00:00
cvar_t * var = Cvar_FindVar ( cmd_name ) ;
if ( var & & function )
2004-08-21 01:25:48 +00:00
{
Con_Printf ( " Cmd_AddCommand: %s already defined as a var \n " , cmd_name ) ;
2005-01-15 17:39:12 +00:00
return false ;
2004-08-21 01:25:48 +00:00
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// fail if the command already exists
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
if ( ! Q_strcmp ( cmd_name , cmd - > name ) )
{
2006-02-26 05:50:37 +00:00
if ( cmd - > function = = function ) //happens a lot with q3
Con_DPrintf ( " Cmd_AddCommand: %s already defined \n " , cmd_name ) ;
else
2009-04-01 22:03:56 +00:00
{
2006-02-26 05:50:37 +00:00
Con_Printf ( " Cmd_AddCommand: %s already defined \n " , cmd_name ) ;
2009-04-01 22:03:56 +00:00
break ;
}
2005-01-15 17:39:12 +00:00
return false ;
2004-08-21 01:25:48 +00:00
}
}
2005-03-28 00:11:59 +00:00
cmd = ( cmd_function_t * ) Z_Malloc ( sizeof ( cmd_function_t ) + strlen ( cmd_name ) + 1 ) ;
2005-01-15 20:50:02 +00:00
cmd - > name = ( char * ) ( cmd + 1 ) ;
2017-08-14 16:38:44 +00:00
strcpy ( ( char * ) ( cmd + 1 ) , cmd_name ) ;
2017-07-04 05:07:51 +00:00
cmd - > argcompletion = argcompletion ;
2012-11-27 03:23:19 +00:00
cmd - > description = desc ;
2004-08-21 01:25:48 +00:00
cmd - > function = function ;
cmd - > next = cmd_functions ;
cmd - > restriction = 0 ;
cmd_functions = cmd ;
2005-01-15 17:39:12 +00:00
return true ;
2004-08-21 01:25:48 +00:00
}
2017-08-14 16:38:44 +00:00
qboolean Cmd_AddCommandD ( const char * cmd_name , xcommand_t function , const char * desc )
2017-07-04 05:07:51 +00:00
{
return Cmd_AddCommandAD ( cmd_name , function , NULL , desc ) ;
}
2017-08-14 16:38:44 +00:00
qboolean Cmd_AddCommand ( const char * cmd_name , xcommand_t function )
2012-11-27 03:23:19 +00:00
{
2017-07-04 05:07:51 +00:00
return Cmd_AddCommandAD ( cmd_name , function , NULL , NULL ) ;
2012-11-27 03:23:19 +00:00
}
2017-08-14 16:38:44 +00:00
void Cmd_RemoveCommand ( const char * cmd_name )
2004-08-21 01:25:48 +00:00
{
cmd_function_t * cmd , * * back ;
back = & cmd_functions ;
while ( 1 )
{
cmd = * back ;
if ( ! cmd )
{
2004-09-30 22:49:01 +00:00
// Con_Printf ("Cmd_RemoveCommand: %s not added\n", cmd_name);
2004-08-21 01:25:48 +00:00
return ;
}
if ( ! strcmp ( cmd_name , cmd - > name ) )
{
* back = cmd - > next ;
Z_Free ( cmd ) ;
return ;
}
back = & cmd - > next ;
}
}
2013-08-27 13:18:09 +00:00
void Cmd_RemoveCommands ( xcommand_t function )
{
cmd_function_t * cmd , * * back ;
for ( back = & cmd_functions ; ( cmd = * back ) ; )
{
if ( cmd - > function = = function )
{
* back = cmd - > next ;
Z_Free ( cmd ) ;
continue ;
}
back = & cmd - > next ;
}
}
2004-08-21 01:25:48 +00:00
2018-10-11 10:31:23 +00:00
static void Cmd_RestrictCommand_f ( void )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * a ;
cvar_t * v ;
cmd_function_t * cmd ;
char * cmd_name = Cmd_Argv ( 1 ) ;
2005-03-12 23:40:42 +00:00
int level ;
2004-08-21 01:25:48 +00:00
if ( Cmd_Argc ( ) ! = 3 & & Cmd_Argc ( ) ! = 2 )
{
Con_Printf ( " restrict <commandname> [level] \n " ) ;
return ;
}
2005-03-12 23:40:42 +00:00
if ( Cmd_Argc ( ) > 2 )
2004-08-21 01:25:48 +00:00
{
2005-03-12 23:40:42 +00:00
level = atoi ( Cmd_Argv ( 2 ) ) ;
2004-08-21 01:25:48 +00:00
if ( level > RESTRICT_MAX )
{
level = RESTRICT_MAX ;
if ( level > Cmd_ExecLevel )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " You arn't allowed to raise a command above your own level \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
}
else if ( level < RESTRICT_MIN )
level = RESTRICT_MIN ;
}
2005-03-12 23:40:42 +00:00
else level = 0 ;
2004-08-21 01:25:48 +00:00
//commands
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
if ( ! Q_strcmp ( cmd_name , cmd - > name ) )
{
if ( Cmd_Argc ( ) = = 2 )
{
if ( cmd - > restriction )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to %i \n " , cmd_name , ( int ) cmd - > restriction ) ;
2004-08-21 01:25:48 +00:00
else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to rcon_level (%i) \n " , cmd_name , rcon_level . ival ) ;
2004-08-21 01:25:48 +00:00
}
2009-11-04 21:16:50 +00:00
else if ( ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " You arn't allowed to alter a level above your own \n " ) ;
2004-08-21 01:25:48 +00:00
else
2005-07-03 15:16:20 +00:00
cmd - > restriction = level ;
2004-08-21 01:25:48 +00:00
return ;
}
}
//cvars
v = Cvar_FindVar ( cmd_name ) ;
if ( v )
{
if ( Cmd_Argc ( ) = = 2 )
{
if ( v - > restriction )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to %i \n " , cmd_name , ( int ) v - > restriction ) ;
2004-08-21 01:25:48 +00:00
else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to rcon_level (%i) \n " , cmd_name , rcon_level . ival ) ;
2004-08-21 01:25:48 +00:00
}
2009-11-04 21:16:50 +00:00
else if ( ( v - > restriction ? v - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " You arn't allowed to alter a level above your own \n " ) ;
2004-08-21 01:25:48 +00:00
else
v - > restriction = level ;
return ;
}
// check alias
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! Q_strcasecmp ( cmd_name , a - > name ) )
{
if ( Cmd_Argc ( ) = = 2 )
{
if ( a - > restriction )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to %i \n " , cmd_name , ( int ) a - > restriction ) ;
2004-08-21 01:25:48 +00:00
else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s is restricted to rcon_level (%i) \n " , cmd_name , rcon_level . ival ) ;
2004-08-21 01:25:48 +00:00
}
2009-11-04 21:16:50 +00:00
else if ( ( a - > restriction ? a - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " You arn't allowed to alter a level above your own \n " ) ;
2004-08-21 01:25:48 +00:00
else
a - > restriction = level ;
return ;
}
}
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " restrict: %s not defined \n " , cmd_name ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2015-12-28 17:41:39 +00:00
void Cmd_EnumerateLevel ( int level , char * buf , size_t bufsize )
{
cmdalias_t * a ;
cmd_function_t * cmds ;
int cmdlevel ;
* buf = 0 ;
for ( cmds = cmd_functions ; cmds ; cmds = cmds - > next )
{
cmdlevel = cmds - > restriction ? cmds - > restriction : rcon_level . ival ;
if ( level = = cmdlevel )
{
if ( * buf )
Q_strncatz ( buf , " \t " , bufsize ) ;
Q_strncatz ( buf , cmds - > name , bufsize ) ;
}
}
for ( a = cmd_alias ; a ; a = a - > next )
{
cmdlevel = a - > restriction ? a - > restriction : rcon_level . ival ;
if ( level = = cmdlevel )
{
if ( * buf )
Q_strncatz ( buf , " \t " , bufsize ) ;
2016-07-12 00:40:13 +00:00
Q_strncatz ( buf , a - > name , bufsize ) ;
2015-12-28 17:41:39 +00:00
}
}
}
2017-08-14 16:38:44 +00:00
int Cmd_Level ( const char * name )
2004-08-21 01:25:48 +00:00
{
cmdalias_t * a ;
cmd_function_t * cmds ;
for ( cmds = cmd_functions ; cmds ; cmds = cmds - > next )
{
if ( ! strcmp ( cmds - > name , name ) )
{
2009-11-04 21:16:50 +00:00
return cmds - > restriction ? cmds - > restriction : rcon_level . ival ;
2004-08-21 01:25:48 +00:00
}
}
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! strcmp ( a - > name , name ) )
{
2015-12-28 17:41:39 +00:00
return a - > restriction ? a - > restriction : rcon_level . ival ;
2004-08-21 01:25:48 +00:00
}
}
return - 1 ;
}
/*
= = = = = = = = = = = =
Cmd_Exists
= = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
qboolean Cmd_Exists ( const char * cmd_name )
2004-08-21 01:25:48 +00:00
{
cmd_function_t * cmd ;
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
if ( ! Q_strcmp ( cmd_name , cmd - > name ) )
return true ;
}
return false ;
}
2012-03-19 06:30:41 +00:00
/*
= = = = = = = = = = = =
Cmd_Exists
= = = = = = = = = = = =
*/
2017-08-14 16:38:44 +00:00
const char * Cmd_Describe ( const char * cmd_name )
2012-03-19 06:30:41 +00:00
{
cmd_function_t * cmd ;
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
if ( ! Q_strcmp ( cmd_name , cmd - > name ) )
return cmd - > description ;
}
return NULL ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cmd_CompleteCommand
= = = = = = = = = = = =
*/
2018-04-15 02:48:23 +00:00
struct cmdargcompletion_ctx_s
2017-07-04 05:07:51 +00:00
{
struct xcommandargcompletioncb_s cb ;
cmd_function_t * cmd ;
2017-08-14 16:38:44 +00:00
const char * prefix ;
2017-07-04 05:07:51 +00:00
size_t prefixlen ;
2018-04-15 02:48:23 +00:00
qboolean quoted ;
cmd_completion_t * res ;
2017-07-04 05:07:51 +00:00
const char * desc ;
} ;
2018-04-15 14:31:44 +00:00
fte_inlinestatic int Q_tolower ( char c )
2018-04-15 02:48:23 +00:00
{
if ( c > = ' a ' & & c < = ' z ' )
c - = ( ' a ' - ' A ' ) ;
return c ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_Complete_CheckArg ( const char * value , const char * desc , const char * repl , struct xcommandargcompletioncb_s * vctx ) //compare cumulative strings and join the result
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
struct cmdargcompletion_ctx_s * ctx = ( struct cmdargcompletion_ctx_s * ) vctx ;
cmd_completion_t * res = ctx - > res ;
char * text ;
2017-07-04 05:07:51 +00:00
2018-04-15 02:48:23 +00:00
const char * c ;
char * p ;
char quoted [ 8192 ] ;
2017-07-04 05:07:51 +00:00
2018-04-15 02:48:23 +00:00
if ( ! desc ) //if no arg desc, use the command's.
desc = ctx - > desc ;
if ( strchr ( value , ' ' ) | | strchr ( value , ' \t ' ) | | strchr ( value , ' \" ' ) | | strchr ( value , ' \r ' ) | | strchr ( value , ' \n ' ) )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
if ( /*ctx->prefix[ctx->prefixlen] &&*/ ! ctx - > quoted ) //FIXME... Figure out some way to insert quotes earlier in the completion without it bugging out
return ;
}
if ( ctx - > quoted )
{
value = COM_QuotedString ( value , quoted , sizeof ( quoted ) , false ) ;
value + + ;
}
if ( ! res - > guessed )
{
text = BZ_Malloc ( ctx - > prefixlen + strlen ( value ) + 1 ) ;
memcpy ( text , ctx - > prefix , ctx - > prefixlen ) ;
strcpy ( text + ctx - > prefixlen , value ) ;
res - > guessed = text ;
}
else
{
for ( p = res - > guessed , c = ctx - > prefix ; * p & & c < ctx - > prefix + ctx - > prefixlen ; p + + , c + + )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
if ( Q_tolower ( * p ) ! = Q_tolower ( * c ) )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
* p = 0 ;
break ;
2017-07-04 05:07:51 +00:00
}
}
2018-04-15 02:48:23 +00:00
if ( c = = ctx - > prefix + ctx - > prefixlen )
for ( c = value ; * p ; p + + , c + + )
{
if ( Q_tolower ( * p ) ! = Q_tolower ( * c ) )
{
* p = 0 ;
break ;
}
if ( ! * c )
break ;
}
}
if ( res - > num = = countof ( res - > completions ) )
{
res - > extra + + ;
return ; //no more space for more options
}
text = BZ_Malloc ( ctx - > prefixlen + strlen ( value ) + 1 ) ;
memcpy ( text , ctx - > prefix , ctx - > prefixlen ) ;
strcpy ( text + ctx - > prefixlen , value ) ;
if ( repl )
{
p = BZ_Malloc ( ctx - > prefixlen + strlen ( repl ) + 2 ) ;
memcpy ( p , ctx - > prefix , ctx - > prefixlen ) ;
strcpy ( p + ctx - > prefixlen , repl ) ;
if ( value = = quoted + 1 )
Q_strcat ( p , " \" " ) ;
repl = p ;
}
res - > completions [ res - > num ] . text_alloced = true ;
res - > completions [ res - > num ] . text = text ;
res - > completions [ res - > num ] . desc_alloced = true ;
2018-04-17 13:58:11 +00:00
res - > completions [ res - > num ] . desc = desc ? Z_StrDup ( desc ) : NULL ;
2018-04-15 02:48:23 +00:00
res - > completions [ res - > num ] . repl = repl ;
res - > num + + ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_Complete_Check ( const char * check , cmd_completion_t * res , const char * desc ) //compare cumulative strings and join the result
2018-04-15 02:48:23 +00:00
{
const char * c ;
char * p ;
if ( ! res - > guessed )
res - > guessed = Z_StrDup ( check ) ;
else for ( p = res - > guessed , c = check ; * p ; p + + , c + + )
{ //we need to do this stuff here because we're not always tracking all of them.
if ( Q_tolower ( * p ) ! = Q_tolower ( * c ) )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
* p = 0 ;
break ;
2017-07-04 05:07:51 +00:00
}
2018-04-15 02:48:23 +00:00
if ( ! * c )
break ;
2017-07-04 05:07:51 +00:00
}
2018-04-15 02:48:23 +00:00
if ( res - > num = = countof ( res - > completions ) )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
res - > extra + + ;
return ; //no more space for more options
2017-07-04 05:07:51 +00:00
}
2018-04-15 02:48:23 +00:00
res - > completions [ res - > num ] . text_alloced = false ;
res - > completions [ res - > num ] . text = check ;
res - > completions [ res - > num ] . desc_alloced = false ;
res - > completions [ res - > num ] . desc = desc ;
res - > completions [ res - > num ] . repl = NULL ;
res - > num + + ;
2017-07-04 05:07:51 +00:00
}
2018-10-11 10:31:23 +00:00
static void Cmd_Complete_End ( cmd_completion_t * c )
2018-04-15 02:48:23 +00:00
{
size_t u ;
for ( u = 0 ; u < c - > num ; u + + )
{
if ( c - > completions [ u ] . text_alloced )
Z_Free ( ( char * ) c - > completions [ u ] . text ) ;
c - > completions [ u ] . text_alloced = false ;
c - > completions [ u ] . text = NULL ;
if ( c - > completions [ u ] . desc_alloced )
Z_Free ( ( char * ) c - > completions [ u ] . desc ) ;
c - > completions [ u ] . desc_alloced = false ;
c - > completions [ u ] . desc = NULL ;
c - > completions [ u ] . repl = NULL ;
}
c - > num = 0 ;
c - > extra = 0 ;
Z_Free ( c - > guessed ) ;
c - > guessed = NULL ;
Z_Free ( c - > partial ) ;
c - > partial = NULL ;
}
2018-10-11 10:31:23 +00:00
static int QDECL Cmd_Complete_Sort ( const void * a , const void * b )
2018-04-15 02:48:23 +00:00
{ //FIXME: its possible that they're equal (eg: filesystem searches). we should strip one in that case, but gah.
const struct cmd_completion_opt_s * c1 = a , * c2 = b ;
2018-07-05 16:21:44 +00:00
return Q_strcasecmp ( c1 - > text , c2 - > text ) ;
2018-04-15 02:48:23 +00:00
}
cmd_completion_t * Cmd_Complete ( const char * partial , qboolean caseinsens )
2004-08-21 01:25:48 +00:00
{
extern cvar_group_t * cvar_groups ;
cmd_function_t * cmd ;
int len ;
cmdalias_t * a ;
cvar_group_t * grp ;
2005-07-03 15:16:20 +00:00
cvar_t * cvar ;
2017-08-14 16:38:44 +00:00
const char * sp ;
2018-04-15 02:48:23 +00:00
qboolean quoted = false ;
static cmd_completion_t c ;
2018-07-05 16:21:44 +00:00
2018-04-15 02:48:23 +00:00
if ( ! partial )
{
Cmd_Complete_End ( & c ) ;
return NULL ;
}
if ( ( c . partial & & ! strcmp ( partial , c . partial ) ) & & c . caseinsens = = caseinsens )
return & c ; //still valid.
Cmd_Complete_End ( & c ) ;
c . partial = Z_StrDup ( partial ) ;
c . caseinsens = caseinsens ;
2005-07-03 15:16:20 +00:00
2017-07-04 05:07:51 +00:00
for ( sp = partial ; * sp ; sp + + )
{
if ( * sp = = ' ' | | * sp = = ' \t ' )
break ;
}
len = sp - partial ;
if ( * sp )
{
while ( * sp = = ' ' | | * sp = = ' \t ' )
sp + + ;
2018-04-15 02:48:23 +00:00
//try to handle quotes
if ( * sp = = ' \\ ' & & sp [ 1 ] = = ' \" ' )
{
sp + = 2 ;
quoted = true ;
}
else if ( * sp = = ' \" ' )
{
sp + + ;
quoted = true ;
}
2017-07-04 05:07:51 +00:00
}
2012-03-19 06:30:41 +00:00
else
2017-07-04 05:07:51 +00:00
sp = NULL ;
2005-07-03 15:16:20 +00:00
2018-04-17 13:58:11 +00:00
// if (len)
2005-06-04 04:20:20 +00:00
{
2018-04-15 02:48:23 +00:00
if ( caseinsens )
{
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
if ( ! Q_strncasecmp ( partial , cmd - > name , len ) & & ( ! partial [ len ] | | strlen ( cmd - > name ) = = len ) )
2017-07-04 05:07:51 +00:00
{
2018-04-15 02:48:23 +00:00
if ( sp & & cmd - > argcompletion )
{
struct cmdargcompletion_ctx_s ctx ;
ctx . cb . cb = Cmd_Complete_CheckArg ;
ctx . cmd = cmd ;
ctx . prefix = partial ;
ctx . prefixlen = sp - partial ;
ctx . res = & c ;
ctx . desc = cmd - > description ;
ctx . quoted = quoted ;
cmd - > argcompletion ( 1 , sp , & ctx . cb ) ;
}
else
Cmd_Complete_Check ( cmd - > name , & c , cmd - > description ) ;
2017-07-04 05:07:51 +00:00
}
2018-04-15 02:48:23 +00:00
for ( a = cmd_alias ; a ; a = a - > next )
if ( ! Q_strncasecmp ( partial , a - > name , len ) & & ( ! partial [ len ] | | strlen ( a - > name ) = = len ) )
Cmd_Complete_Check ( a - > name , & c , a - > value ) ;
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( cvar = grp - > cvars ; cvar ; cvar = cvar - > next )
{
if ( ! Q_strncasecmp ( partial , cvar - > name , len ) & & ( ! partial [ len ] | | strlen ( cvar - > name ) = = len ) )
Cmd_Complete_Check ( cvar - > name , & c , cvar - > description ) ;
if ( cvar - > name2 & & ! Q_strncasecmp ( partial , cvar - > name2 , len ) & & ( ! partial [ len ] | | strlen ( cvar - > name2 ) = = len ) )
Cmd_Complete_Check ( cvar - > name2 , & c , cvar - > description ) ;
2017-07-04 05:07:51 +00:00
}
2018-04-15 02:48:23 +00:00
}
else
2006-04-21 06:02:06 +00:00
{
2018-04-15 02:48:23 +00:00
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
if ( ! Q_strncmp ( partial , cmd - > name , len ) & & ( ! partial [ len ] | | strlen ( cmd - > name ) = = len ) )
Cmd_Complete_Check ( cmd - > name , & c , cmd - > description ) ;
for ( a = cmd_alias ; a ; a = a - > next )
if ( ! Q_strncmp ( partial , a - > name , len ) & & ( ! partial [ len ] | | strlen ( a - > name ) = = len ) )
Cmd_Complete_Check ( a - > name , & c , " " ) ;
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( cvar = grp - > cvars ; cvar ; cvar = cvar - > next )
{
if ( ! Q_strncmp ( partial , cvar - > name , len ) & & ( ! partial [ len ] | | strlen ( cvar - > name ) = = len ) )
Cmd_Complete_Check ( cvar - > name , & c , cvar - > description ) ;
if ( cvar - > name2 & & ! Q_strncmp ( partial , cvar - > name2 , len ) & & ( ! partial [ len ] | | strlen ( cvar - > name2 ) = = len ) )
Cmd_Complete_Check ( cvar - > name2 , & c , cvar - > description ) ;
}
2006-04-21 06:02:06 +00:00
}
2018-04-15 02:48:23 +00:00
}
//quickly sort the completions. this is primarily so that the first item is the shortest, but whatever.
qsort ( c . completions , c . num , sizeof ( c . completions [ 0 ] ) , Cmd_Complete_Sort ) ;
return & c ;
}
char * Cmd_CompleteCommand ( const char * partial , qboolean fullonly , qboolean caseinsens , int matchnum , const char * * descptr )
{
cmd_completion_t * c = Cmd_Complete ( partial , caseinsens ) ;
const char * text = NULL , * desc = NULL ;
2004-08-21 01:25:48 +00:00
2018-04-15 02:48:23 +00:00
if ( matchnum < 0 )
{ //completes only if there's an EXACT match.
for ( matchnum = 0 ; matchnum < c - > num ; matchnum + + )
{
if ( ! strcmp ( partial , c - > completions [ matchnum ] . text ) )
{
text = c - > completions [ matchnum ] . text ;
desc = c - > completions [ matchnum ] . desc ;
break ;
}
}
}
else if ( ! matchnum )
{ //returns the longest-common-denominator of all the matches
text = c - > guessed ;
desc = ( ( c - > num = = 1 ) ? c - > completions [ matchnum ] . desc : NULL ) ;
2005-06-04 04:20:20 +00:00
}
else
{
2018-04-15 02:48:23 +00:00
matchnum - - ;
if ( matchnum < c - > num )
2006-04-21 06:02:06 +00:00
{
2018-04-15 02:48:23 +00:00
text = c - > completions [ matchnum ] . text ;
desc = c - > completions [ matchnum ] . desc ;
2006-04-21 06:02:06 +00:00
}
2005-06-04 04:20:20 +00:00
}
2012-11-27 03:23:19 +00:00
if ( descptr )
2018-04-15 02:48:23 +00:00
* descptr = desc ;
return ( char * ) text ;
2004-08-21 01:25:48 +00:00
}
2018-04-15 02:48:23 +00:00
2004-08-21 01:25:48 +00:00
//lists commands, also prints restriction level
2018-10-11 10:31:23 +00:00
static void Cmd_List_f ( void )
2004-08-21 01:25:48 +00:00
{
cmd_function_t * cmd ;
2005-07-03 15:16:20 +00:00
int num = 0 ;
2022-02-19 20:49:49 +00:00
const char * search = ( Cmd_Argc ( ) > 1 ) ? Cmd_Argv ( 1 ) : NULL ;
2004-08-21 01:25:48 +00:00
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
2009-11-04 21:16:50 +00:00
if ( ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2004-08-21 01:25:48 +00:00
continue ;
2022-02-19 20:49:49 +00:00
if ( search )
if ( ! wildcmp ( search , cmd - > name ) )
continue ; //nope, no match
2004-08-21 01:25:48 +00:00
if ( ! num )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Command list: \n " ) ;
2009-11-04 21:16:50 +00:00
Con_Printf ( " (%2i) %s \n " , ( int ) ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) , cmd - > name ) ;
2004-08-21 01:25:48 +00:00
num + + ;
}
if ( num )
Con_Printf ( " \n " ) ;
}
2014-10-05 20:04:11 +00:00
//I'm not personally keen on this name, but its somewhat standard in both DP and suse (which lh uses, hence why DP uses that name). oh well.
2018-10-11 10:31:23 +00:00
static void Cmd_Apropos_f ( void )
2014-10-05 20:04:11 +00:00
{
extern cvar_group_t * cvar_groups ;
cmd_function_t * cmd ;
cvar_group_t * grp ;
cvar_t * var ;
char * name ;
char escapedvalue [ 1024 ] ;
char latchedvalue [ 1024 ] ;
char * query = Cmd_Argv ( 1 ) ;
2020-08-13 08:39:48 +00:00
const char * d ;
2014-10-05 20:04:11 +00:00
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( var = grp - > cvars ; var ; var = var - > next )
{
2020-08-13 08:39:48 +00:00
d = var - > description ? localtext ( var - > description ) : NULL ;
2014-10-05 20:04:11 +00:00
if ( var - > name & & Q_strcasestr ( var - > name , query ) )
name = var - > name ;
else if ( var - > name2 & & Q_strcasestr ( var - > name2 , query ) )
name = var - > name2 ;
2020-08-13 08:39:48 +00:00
else if ( d & & Q_strcasestr ( d , query ) )
2014-10-05 20:04:11 +00:00
name = var - > name ;
else
continue ;
2015-01-02 05:20:56 +00:00
COM_QuotedString ( var - > string , escapedvalue , sizeof ( escapedvalue ) , false ) ;
2014-10-05 20:04:11 +00:00
if ( var - > latched_string )
{
2015-01-02 05:20:56 +00:00
COM_QuotedString ( var - > latched_string , latchedvalue , sizeof ( latchedvalue ) , false ) ;
2020-08-13 08:39:48 +00:00
if ( d )
Con_TPrintf ( " cvar ^2%s^7: %s (effective %s): ^3%s \n " , name , latchedvalue , escapedvalue , d ) ;
else
Con_TPrintf ( " cvar ^2%s^7: %s (effective %s): ^3no description \n " , name , latchedvalue , escapedvalue ) ;
2014-10-05 20:04:11 +00:00
}
else
2020-08-13 08:39:48 +00:00
{
if ( d )
Con_TPrintf ( " cvar ^2%s^7: %s : ^3%s \n " , name , escapedvalue , d ) ;
else
Con_TPrintf ( " cvar ^2%s^7: %s : ^3no description \n " , name , escapedvalue ) ;
}
2014-10-05 20:04:11 +00:00
}
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
2020-08-13 08:39:48 +00:00
d = cmd - > description ? localtext ( cmd - > description ) : NULL ;
2014-10-05 20:04:11 +00:00
if ( cmd - > name & & Q_strcasestr ( cmd - > name , query ) )
;
2020-08-13 08:39:48 +00:00
else if ( d & & strstr ( d , query ) )
2014-10-05 20:04:11 +00:00
;
else
continue ;
2020-08-13 08:39:48 +00:00
if ( d )
Con_TPrintf ( " command ^2%s^7: ^3%s \n " , cmd - > name , d ) ;
else
Con_TPrintf ( " command ^2%s^7: ^3no description \n " , cmd - > name ) ;
2014-10-05 20:04:11 +00:00
}
//FIXME: add aliases.
}
2004-08-21 01:25:48 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT // FIXME
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = = = = =
Cmd_ForwardToServer
adds the current command line as a clc_stringcmd to the client message .
things like godmode , noclip , etc , are commands directed to the server ,
so when they are typed in at the console , they will need to be forwarded .
= = = = = = = = = = = = = = = = = = =
*/
void Cmd_ForwardToServer ( void )
{
2013-03-12 23:18:12 +00:00
int sp ;
2004-08-21 01:25:48 +00:00
if ( cls . state = = ca_disconnected )
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( cl_warncmd . ival )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Can't \" %s \" , not connected \n " , Cmd_Argv ( 0 ) ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( cls . demoplayback )
return ; // not really connected
2004-12-24 08:45:56 +00:00
# ifdef Q3CLIENT
2005-06-04 04:20:20 +00:00
if ( cls . protocol = = CP_QUAKE3 )
2004-12-24 08:45:56 +00:00
{
2022-03-08 05:31:34 +00:00
q3 - > cl . SendClientCommand ( " %s %s " , Cmd_Argv ( 0 ) , Cmd_Args ( ) ) ;
2004-12-24 08:45:56 +00:00
return ;
}
# endif
2013-03-12 23:18:12 +00:00
sp = CL_TargettedSplit ( false ) ;
2021-07-17 15:10:10 +00:00
if ( Cmd_Argc ( ) > 1 )
CL_SendSeatClientCommand ( true , sp , " %s %s " , Cmd_Argv ( 0 ) , Cmd_Args ( ) ) ;
2005-02-28 07:16:19 +00:00
else
2021-07-17 15:10:10 +00:00
CL_SendSeatClientCommand ( true , sp , " %s " , Cmd_Argv ( 0 ) ) ;
2004-08-21 01:25:48 +00:00
}
// don't forward the first argument
2018-10-11 10:31:23 +00:00
static void Cmd_ForwardToServer_f ( void )
2004-08-21 01:25:48 +00:00
{
if ( cls . state = = ca_disconnected )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Can't \" %s \" , not connected \n " , Cmd_Argv ( 0 ) ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2018-11-19 08:06:07 +00:00
# ifdef IMAGEFMT_PCX
2013-03-12 23:24:15 +00:00
if ( Q_strcasecmp ( Cmd_Argv ( 1 ) , " snap " ) = = 0 & & cls . protocol = = CP_QUAKEWORLD )
2006-11-03 15:53:04 +00:00
{
2004-08-21 01:25:48 +00:00
if ( SCR_RSShot ( ) )
return ;
}
2018-11-19 08:06:07 +00:00
# endif
2016-07-12 00:40:13 +00:00
# ifdef NQPROT
if ( Q_strcasecmp ( Cmd_Argv ( 1 ) , " protocols " ) = = 0 & & cls . protocol = = CP_NETQUAKE )
{
CL_SendClientCommand ( true , " protocols %#x %#x %#x %#x %#x " , PROTOCOL_VERSION_RMQ , PROTOCOL_VERSION_FITZ , PROTOCOL_VERSION_BJP3 , PROTOCOL_VERSION_BJP2 , PROTOCOL_VERSION_DP7 ) ;
return ;
}
# endif
2017-08-29 02:29:06 +00:00
if ( Q_strcasecmp ( Cmd_Argv ( 1 ) , " pext " ) = = 0 & & ( cls . protocol ! = CP_NETQUAKE | | cls . fteprotocolextensions2 | | cls . protocol_nq ! = CPNQ_ID | | cls . proquake_angles_hack | | cls . netchan . remote_address . type ! = NA_LOOPBACK ) )
2013-03-12 22:35:33 +00:00
{ //don't send any extension flags this if we're using cl_loopbackprotocol nqid, purely for a compat test.
//if you want to record compat-demos, disable extensions instead.
2019-05-10 09:31:21 +00:00
unsigned int fp1 = Net_PextMask ( PROTOCOL_VERSION_FTE1 , cls . protocol = = CP_NETQUAKE ) ,
fp2 = Net_PextMask ( PROTOCOL_VERSION_FTE2 , cls . protocol = = CP_NETQUAKE ) ,
ez1 = Net_PextMask ( PROTOCOL_VERSION_EZQUAKE1 , cls . protocol = = CP_NETQUAKE ) & EZPEXT1_CLIENTADVERTISE ;
2016-10-22 07:06:51 +00:00
extern cvar_t cl_nopext ;
2019-03-23 07:06:37 +00:00
char line [ 256 ] ;
2016-10-22 07:06:51 +00:00
if ( cl_nopext . ival )
{
fp1 = 0 ;
fp2 = 0 ;
}
2019-03-23 07:06:37 +00:00
Q_strncpyz ( line , " pext " , sizeof ( line ) ) ;
if ( fp1 )
2019-05-10 09:31:21 +00:00
Q_strncatz ( line , va ( " %#x %#x " , PROTOCOL_VERSION_FTE1 , fp1 ) , sizeof ( line ) ) ;
2019-03-23 07:06:37 +00:00
if ( fp2 )
Q_strncatz ( line , va ( " %#x %#x " , PROTOCOL_VERSION_FTE2 , fp2 ) , sizeof ( line ) ) ;
if ( ez1 )
Q_strncatz ( line , va ( " %#x %#x " , PROTOCOL_VERSION_EZQUAKE1 , ez1 ) , sizeof ( line ) ) ;
CL_SendClientCommand ( true , " %s " , line ) ;
2013-03-12 22:35:33 +00:00
return ;
}
2006-11-03 15:53:04 +00:00
if ( Q_strcasecmp ( Cmd_Argv ( 1 ) , " ptrack " ) = = 0 )
{
2013-06-23 02:17:02 +00:00
playerview_t * pv = & cl . playerview [ CL_TargettedSplit ( false ) ] ;
2006-11-03 15:53:04 +00:00
if ( ! * Cmd_Argv ( 2 ) )
2013-06-23 02:17:02 +00:00
Cam_Unlock ( pv ) ;
2006-11-03 15:53:04 +00:00
else
2013-06-23 02:17:02 +00:00
Cam_Lock ( pv , atoi ( Cmd_Argv ( 2 ) ) ) ;
2006-11-03 15:53:04 +00:00
return ;
}
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( Cmd_Argc ( ) > 1 )
2014-02-07 08:38:40 +00:00
{
2016-01-18 05:22:07 +00:00
int split = CL_TargettedSplit ( false ) ;
2021-07-17 15:10:10 +00:00
CL_SendSeatClientCommand ( true , split , " %s " , Cmd_Args ( ) ) ;
2014-02-07 08:38:40 +00:00
}
2004-08-21 01:25:48 +00:00
}
# else
void Cmd_ForwardToServer ( void )
{
}
# endif
2022-03-08 05:31:34 +00:00
static void Cmd_FindForExecution ( const char * name , int level , cmd_function_t * * foundcmd , cmdalias_t * * foundalias , cvar_t * * foundcvar )
{
//WARNING: PF_checkcommand should match the order.
cmd_function_t * cmd ;
cmdalias_t * a ;
* foundcmd = NULL ;
* foundalias = NULL ;
* foundcvar = NULL ;
for ( cmd = cmd_functions ; cmd ; cmd = cmd - > next )
{
if ( ! Q_strcasecmp ( name , cmd - > name ) )
{
* foundcmd = cmd ;
if ( ! strcmp ( name , cmd - > name ) )
break ; //don't keep looking for others when we get an exact match.
}
}
cmd = * foundcmd ;
if ( ! cmd )
;
else if ( level = = RESTRICT_TEAMPLAY )
{ //extra weirdness so that teamplay macros can only execute certain known commands
static char * tpcmds [ ] =
{
" if " , " wait " , /*would be nice to include alias in here*/
" say " , " say_team " , " echo " , /*display stuff, because it would be useless otherwise*/
" set_tp " , " set " , " set_calc " , " inc " , /*because scripting variables is fun. not.*/
" tp_point " , " tp_pickup " , " tp_took " /*updates what the $took etc macros are allowed to generate*/
} ;
size_t i ;
for ( i = 0 ; i < countof ( tpcmds ) ; i + + )
if ( ! strcmp ( cmd - > name , tpcmds [ i ] ) )
break ;
if ( i = = countof ( tpcmds ) )
* foundcmd = NULL ;
else if ( cmd - > restriction & & cmd - > restriction > 0 )
{
//warning, these commands would normally be considered to be run at restrict_local, but they're running at a much lower level
//which means that if there's ANY restriction on them then they'll fail.
//this means we have to ignore the default restriction levels and just do it anyway.
Con_TPrintf ( " '%s' was restricted. \n " , cmd_argv [ 0 ] ) ;
* foundcmd = NULL ;
}
}
else if ( ( cmd - > restriction ? cmd - > restriction : rcon_level . ival ) > level )
{
Con_TPrintf ( " cmd '%s' was restricted. \n " , name ) ;
* foundcmd = NULL ;
}
// check alias
for ( a = cmd_alias ; a ; a = a - > next )
{
if ( ! Q_strcasecmp ( cmd_argv [ 0 ] , a - > name ) )
{
//teamplay restrictions block any execlevel elevations, so the contents are what matter
//(there's no reason to restrict aliases other than for exec level promotion)
if ( level ! = RESTRICT_TEAMPLAY )
if ( ( a - > restriction ? a - > restriction : rcon_level . ival ) > level )
{
Con_TPrintf ( " alias '%s' was restricted. \n " , cmd_argv [ 0 ] ) ;
return ;
}
* foundalias = a ;
if ( ! strcmp ( name , a - > name ) )
break ;
}
}
// check cvars
* foundcvar = Cvar_FindVar ( name ) ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cmd_ExecuteString
A complete command line has been parsed , so try to execute it
FIXME : lookupnoadd the token to speed search ?
= = = = = = = = = = = =
*/
2022-03-08 05:31:34 +00:00
void Cmd_ExecuteString ( const char * text , int level )
2005-07-03 15:16:20 +00:00
{
2013-08-21 07:14:39 +00:00
//WARNING: PF_checkcommand should match the order.
2004-08-21 01:25:48 +00:00
cmd_function_t * cmd ;
cmdalias_t * a ;
2022-03-08 05:31:34 +00:00
cvar_t * var ;
int olev = Cmd_ExecLevel ;
2004-08-21 01:25:48 +00:00
2019-06-18 13:03:37 +00:00
char dest [ 65536 ] ;
2004-09-20 23:25:38 +00:00
2017-08-14 16:38:44 +00:00
while ( * text = = ' ' | | * text = = ' \n ' )
text + + ;
if ( dpcompat_console . ival & & ! strncmp ( text , " alias " , 5 ) & & ( text [ 5 ] = = ' ' | | text [ 5 ] = = ' \t ' ) )
; //certain commands don't get pre-expanded in dp. evil hack. quote them to pre-expand anyway. double evil.
else
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
text = Cmd_ExpandString ( text , dest , sizeof ( dest ) , & level , true /*!Cmd_IsInsecure()?true:false*/ , true ) ;
2017-08-29 02:29:06 +00:00
Cmd_TokenizeString ( text , ( level = = RESTRICT_LOCAL & & ! dpcompat_console . ival ) ? true : false , false ) ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
// execute the command line
if ( ! Cmd_Argc ( ) )
return ; // no tokens
2022-03-08 05:31:34 +00:00
Cmd_FindForExecution ( cmd_argv [ 0 ] , level , & cmd , & a , & var ) ;
2015-09-18 20:30:10 +00:00
2022-03-08 05:31:34 +00:00
//check (explicit) functions
if ( cmd & & cmd - > function )
{
Cmd_ExecLevel = level ;
cmd - > function ( ) ;
Cmd_ExecLevel = olev ;
return ;
2004-08-21 01:25:48 +00:00
}
2022-03-08 05:31:34 +00:00
//priority is cmd>alias>cvar
//but this means that user aliases can override cvars
//which means users can use aliases to block cvar access, aka cheat.
//so favour the cvar when its a server command (unless the alias was also created by the server)
if ( a & & ( ! var | | Cmd_ExecLevel < RESTRICT_SERVER | | a - > flags & ALIAS_FROMSERVER ) )
2004-08-21 01:25:48 +00:00
{
2022-03-08 05:31:34 +00:00
int execlevel ;
2005-09-17 17:05:21 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT //an emergency escape mechansim, to avoid infinatly recursing aliases.
2022-03-08 05:31:34 +00:00
extern unsigned int con_splitmodifier ;
2005-09-14 04:20:19 +00:00
2022-03-08 05:31:34 +00:00
if ( keydown [ K_SHIFT ] & & ( keydown [ K_LCTRL ] | | keydown [ K_RCTRL ] ) & & ( keydown [ K_LALT ] | | keydown [ K_RALT ] ) & & ! isDedicated )
return ;
2005-09-17 17:05:21 +00:00
# endif
2004-08-21 01:25:48 +00:00
2022-03-08 05:31:34 +00:00
Cmd_ExecLevel = level ;
if ( level = = RESTRICT_TEAMPLAY )
execlevel = level ; //teamplay aliases can't let the user's settings promote them out of their restrictions.
else
{
if ( a - > execlevel )
execlevel = a - > execlevel ;
2015-09-18 20:30:10 +00:00
else
2022-03-08 05:31:34 +00:00
execlevel = level ;
}
2004-08-21 01:25:48 +00:00
2022-03-08 05:31:34 +00:00
Cbuf_InsertText ( " \n " , execlevel , false ) ;
2004-08-30 07:05:41 +00:00
2022-03-08 05:31:34 +00:00
// if the alias value is a command or cvar and
// the alias is called with parameters, add them
//unless we're mimicing dp, or the alias has explicit expansions (or macros) in which case it can do its own damn args
{
char * ignoringquoteswasstupid ;
Cmd_ExpandString ( a - > value , dest , sizeof ( dest ) , & execlevel , ! Cmd_IsInsecure ( ) ? true : false , true ) ;
for ( ignoringquoteswasstupid = dest ; * ignoringquoteswasstupid ; )
{ //double up dollars, to prevent expansion when its actually execed.
if ( * ignoringquoteswasstupid = = ' $ ' )
2017-08-14 16:38:44 +00:00
{
2022-03-08 05:31:34 +00:00
memmove ( ignoringquoteswasstupid + 1 , ignoringquoteswasstupid , strlen ( ignoringquoteswasstupid ) + 1 ) ;
ignoringquoteswasstupid + + ;
2017-08-14 16:38:44 +00:00
}
2022-03-08 05:31:34 +00:00
ignoringquoteswasstupid + + ;
2017-08-14 16:38:44 +00:00
}
2022-03-08 05:31:34 +00:00
if ( ( a - > restriction ? a - > restriction : rcon_level . ival ) > execlevel )
return ;
2004-08-21 01:25:48 +00:00
}
2022-03-08 05:31:34 +00:00
if ( ! dpcompat_console . ival )
2015-09-18 20:30:10 +00:00
{
2022-03-08 05:31:34 +00:00
if ( Cmd_Argc ( ) > 1 & & ( ! strncmp ( a - > value , " cmd " , 4 ) | | ( ! strchr ( a - > value , ' ' ) & & ! strchr ( a - > value , ' \t ' ) & &
( Cvar_FindVar ( a - > value ) | | ( Cmd_Exists ( a - > value ) & & a - > value [ 0 ] ! = ' + ' & & a - > value [ 0 ] ! = ' - ' ) ) ) )
)
2015-09-18 20:30:10 +00:00
{
2022-03-08 05:31:34 +00:00
Cbuf_InsertText ( Cmd_Args ( ) , execlevel , false ) ;
Cbuf_InsertText ( " " , execlevel , false ) ;
2015-09-18 20:30:10 +00:00
}
}
2022-03-08 05:31:34 +00:00
Cbuf_InsertText ( dest , execlevel , false ) ;
2004-08-21 01:25:48 +00:00
2022-03-08 05:31:34 +00:00
# ifdef HAVE_CLIENT
if ( con_splitmodifier > 0 )
{ //if the alias was execed via p1/p2 etc, make sure that propagates properly (at least for simple aliases like impulses)
//fixme: should probably prefix each line. that may have different issues however.
//don't need to care about + etc
Cbuf_InsertText ( va ( " p %i " , con_splitmodifier ) , execlevel , false ) ;
}
# endif
Con_DPrintf ( " Execing alias %s ^3%s: \n ^1%s \n ^2%s \n " , a - > name , Cmd_Args ( ) , a - > value , dest ) ;
Cmd_ExecLevel = olev ;
2004-08-21 01:25:48 +00:00
return ;
}
2022-03-08 05:31:34 +00:00
// check cvars
Cmd_ExecLevel = level ;
if ( ! cmd & & Cvar_Command ( var , level ) )
;
2018-12-28 00:04:36 +00:00
# if defined(CSQC_DAT) && defined(HAVE_CLIENT)
2022-03-08 05:31:34 +00:00
else if ( CSQC_ConsoleCommand ( - 1 , text ) )
;
2005-05-15 18:49:04 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(MENU_DAT) && defined(HAVE_CLIENT)
2022-03-08 05:31:34 +00:00
else if ( MP_ConsoleCommand ( text ) )
; //let the csqc handle it if it wants.
2005-05-15 18:49:04 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(MENU_NATIVECODE) && defined(HAVE_CLIENT)
2018-07-05 16:21:44 +00:00
if ( mn_entry & & mn_entry - > ConsoleCommand ( text , cmd_argc , ( char const * const * ) cmd_argv ) )
2022-03-08 05:31:34 +00:00
;
2005-07-14 01:57:34 +00:00
# endif
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2022-03-08 05:31:34 +00:00
else if ( sv . state & & PR_ConsoleCmd ( text ) )
;
2004-08-21 01:25:48 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(VM_CG) && defined(HAVE_CLIENT)
2022-03-08 05:31:34 +00:00
else if ( q3 & & q3 - > cg . ConsoleCommand ( ) )
;
2004-12-24 08:45:56 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(Q3SERVER) && defined(HAVE_SERVER)
2022-03-08 05:31:34 +00:00
else if ( q3 & & q3 - > sv . ConsoleCommand ( ) )
;
2005-09-08 22:52:46 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(VM_UI) && defined(HAVE_CLIENT)
2022-03-08 05:31:34 +00:00
else if ( q3 & & q3 - > ui . ConsoleCommand ( ) )
;
2005-09-08 22:52:46 +00:00
# endif
2022-03-08 05:31:34 +00:00
else if ( cmd
2018-12-28 00:04:36 +00:00
# if defined(Q2CLIENT) && defined(HAVE_CLIENT)
2022-03-08 05:31:34 +00:00
| | ( cls . state ! = ca_disconnected & & ( cls . protocol = = CP_QUAKE2 | | cls . protocol = = CP_QUAKE3 ) )
# endif
)
2005-05-26 12:55:34 +00:00
{ //q2 servers convert unknown commands to text.
2004-08-21 01:25:48 +00:00
Cmd_ForwardToServer ( ) ;
2005-05-15 18:49:04 +00:00
}
2022-03-08 05:31:34 +00:00
else if ( ( cl_warncmd . value & & level < = RESTRICT_LOCAL ) | | developer . value )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Unknown command \" %s \" \n " , Cmd_Argv ( 0 ) ) ;
2019-02-16 19:09:07 +00:00
Cmd_ExecLevel = olev ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = =
Cmd_CheckParm
Returns the position ( 1 to argc - 1 ) in the command ' s argument list
where the given parameter apears , or 0 if not present
= = = = = = = = = = = = = = = =
*/
2017-08-14 16:38:44 +00:00
int Cmd_CheckParm ( const char * parm )
2004-08-21 01:25:48 +00:00
{
int i ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( ! parm )
Sys_Error ( " Cmd_CheckParm: NULL " ) ;
for ( i = 1 ; i < Cmd_Argc ( ) ; i + + )
if ( ! Q_strcasecmp ( parm , Cmd_Argv ( i ) ) )
return i ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
return 0 ;
}
typedef struct tempstack_s {
struct tempstack_s * next ;
char str [ 1 ] ;
} tempstack_t ;
2015-09-10 10:16:26 +00:00
static tempstack_t * ifstack ;
2004-08-21 01:25:48 +00:00
2015-09-10 10:16:26 +00:00
static void If_Token_Clear ( tempstack_t * mark )
2004-08-21 01:25:48 +00:00
{
tempstack_t * ois ;
while ( ifstack )
{
if ( ifstack = = mark )
break ;
ois = ifstack ;
ifstack = ifstack - > next ;
Z_Free ( ois ) ;
}
}
2015-09-10 10:16:26 +00:00
static tempstack_t * If_Token_GetMark ( void )
2004-08-21 01:25:48 +00:00
{
return ifstack ;
}
2015-09-10 10:16:26 +00:00
static const char * retstring ( const char * s )
2004-08-21 01:25:48 +00:00
{
tempstack_t * ret ;
2005-03-28 00:11:59 +00:00
ret = ( tempstack_t * ) Z_Malloc ( sizeof ( tempstack_t ) + strlen ( s ) ) ;
2004-08-21 01:25:48 +00:00
ret - > next = ifstack ;
ifstack = ret ;
strcpy ( ret - > str , s ) ;
return ret - > str ;
}
2015-09-10 10:16:26 +00:00
static const char * retint ( int f )
2012-01-17 07:57:46 +00:00
{
char s [ 1024 ] ;
tempstack_t * ret ;
if ( ! f )
return " " ;
sprintf ( s , " %d " , f ) ;
ret = ( tempstack_t * ) Z_Malloc ( sizeof ( tempstack_t ) + strlen ( s ) ) ;
ret - > next = ifstack ;
ifstack = ret ;
strcpy ( ret - > str , s ) ;
return ret - > str ;
}
2015-09-10 10:16:26 +00:00
static const char * retbool ( qboolean b )
{
if ( b )
return " 1 " ;
return " " ;
}
static const char * retfloat ( float f )
2004-08-21 01:25:48 +00:00
{
char s [ 1024 ] ;
tempstack_t * ret ;
if ( ! f )
return " " ;
2015-09-10 10:16:26 +00:00
sprintf ( s , " %g " , f ) ;
2005-03-28 00:11:59 +00:00
ret = ( tempstack_t * ) Z_Malloc ( sizeof ( tempstack_t ) + strlen ( s ) ) ;
2004-08-21 01:25:48 +00:00
ret - > next = ifstack ;
ifstack = ret ;
strcpy ( ret - > str , s ) ;
return ret - > str ;
}
2015-09-10 10:16:26 +00:00
static qboolean is_numeric ( const char * c )
2005-07-03 15:16:20 +00:00
{
2004-08-21 01:25:48 +00:00
return ( * c > = ' 0 ' & & * c < = ' 9 ' ) | |
( ( * c = = ' - ' | | * c = = ' + ' ) & & ( c [ 1 ] = = ' . ' | | ( c [ 1 ] > = ' 0 ' & & c [ 1 ] < = ' 9 ' ) ) ) | |
2005-03-28 00:11:59 +00:00
( * c = = ' . ' & & ( c [ 1 ] > = ' 0 ' & & c [ 1 ] < = ' 9 ' ) ) ? true : false ;
2004-08-21 01:25:48 +00:00
}
2015-09-10 10:16:26 +00:00
static qboolean is_true ( const char * c )
2015-09-07 14:34:39 +00:00
{
if ( is_numeric ( c ) )
return ! ! atof ( c ) ;
if ( ! Q_strcasecmp ( c , " true " ) | | ! Q_strcasecmp ( c , " yes " ) )
return true ;
if ( ! Q_strcasecmp ( c , " false " ) | | ! Q_strcasecmp ( c , " no " ) | | ! Q_strcasecmp ( c , " null " ) | | ! Q_strcasecmp ( c , " nil " ) )
return false ;
return ! ! * c ;
}
2015-09-10 10:16:26 +00:00
# define IF_PRI_MAX 12
# define IFPUNCT "(,{})~\':;=!><&|+* / -"
static const char * If_Token ( const char * func , const char * * end , int pri ) ;
static const char * If_Token_Term ( const char * func , const char * * end )
2005-07-03 15:16:20 +00:00
{
2005-03-28 00:11:59 +00:00
const char * s , * s2 ;
2004-08-21 01:25:48 +00:00
cvar_t * var ;
int level ;
while ( * func < = ' ' & & * func )
func + + ;
2015-08-28 03:13:45 +00:00
if ( * func = = ' \' ' )
{
char * o = com_token ;
func + + ;
while ( * func )
{
if ( * func = = ' \' ' )
{
func + + ;
break ;
}
if ( o < com_token + sizeof ( com_token ) - 1 )
* o + + = * func ;
func + + ;
}
* o = 0 ;
s = func ;
}
else
s = COM_ParseToken ( func , IFPUNCT ) ;
2004-08-21 01:25:48 +00:00
if ( * com_token = = ' ( ' )
{
s2 = s ;
level = 1 ;
while ( * s2 )
{
if ( * s2 = = ' ) ' )
{
level - - ;
if ( ! level )
2017-12-14 21:12:11 +00:00
{
s2 + + ;
2004-08-21 01:25:48 +00:00
break ;
2017-12-14 21:12:11 +00:00
}
2004-08-21 01:25:48 +00:00
}
else if ( * s2 = = ' ( ' )
level + + ;
s2 + + ;
2005-07-03 15:16:20 +00:00
}
2018-09-01 04:18:08 +00:00
if ( ! level )
{
char * t = malloc ( s2 - s + 1 ) ;
memcpy ( t , s , s2 - s ) ;
t [ s2 - s - ( ( s2 = = s ) ? 0 : 1 ) ] = 0 ;
func = If_Token ( t , end , IF_PRI_MAX ) ;
free ( t ) ;
}
else
func = If_Token ( s , end , IF_PRI_MAX ) ;
2017-12-14 21:12:11 +00:00
* end = s2 ;
2004-08-21 01:25:48 +00:00
s = * end ;
s2 = func ;
}
else if ( * com_token = = ' ! ' )
{
2016-09-08 19:04:35 +00:00
func = If_Token ( s , & s , 0 ) ;
2015-09-10 10:16:26 +00:00
s2 = retbool ( ! is_true ( func ) ) ;
}
else if ( * com_token = = ' ~ ' )
{
2016-09-08 19:04:35 +00:00
func = If_Token ( s , & s , 0 ) ;
2015-09-10 10:16:26 +00:00
s2 = retbool ( ~ atoi ( func ) ) ;
2004-08-21 01:25:48 +00:00
}
2016-09-08 19:04:35 +00:00
else if ( * com_token = = ' - ' )
{
func = If_Token ( s , & s , 0 ) ;
s2 = retfloat ( - atof ( func ) ) ;
}
2006-09-17 00:59:22 +00:00
else if ( ! strcmp ( com_token , " int " ) )
{
2016-09-08 19:04:35 +00:00
func = If_Token ( s , & s , 0 ) ;
2015-09-07 14:34:39 +00:00
s2 = retint ( atoi ( func ) ) ;
2006-09-17 00:59:22 +00:00
}
else if ( ! strcmp ( com_token , " strlen " ) )
{
2016-09-08 19:04:35 +00:00
func = If_Token ( s , & s , 0 ) ;
2015-09-07 14:34:39 +00:00
s2 = retfloat ( strlen ( func ) ) ;
2006-09-17 00:59:22 +00:00
}
2015-09-10 10:16:26 +00:00
else if ( ! strcmp ( com_token , " eval " ) )
{
//read the stuff to the right
2016-09-08 19:04:35 +00:00
func = If_Token ( s , & s , IF_PRI_MAX ) ;
2015-09-10 10:16:26 +00:00
//and evaluate it
s2 = If_Token ( func , & func , IF_PRI_MAX ) ;
}
2004-08-21 01:25:48 +00:00
else if ( ! strcmp ( com_token , " defined " ) ) //functions
{
2006-09-17 00:59:22 +00:00
s = COM_ParseToken ( s , IFPUNCT ) ;
2004-08-21 01:25:48 +00:00
var = Cvar_FindVar ( com_token ) ;
* end = s ;
2015-09-10 10:16:26 +00:00
s2 = retbool ( var ! = NULL ) ;
2004-08-21 01:25:48 +00:00
}
else if ( ! strcmp ( com_token , " random " ) )
{
s2 = retfloat ( ( rand ( ) & 0x7fff ) / ( float ) 0x7fff ) ;
}
else if ( ! strcmp ( com_token , " vid " ) ) //mostly for use with the menu system.
{
2006-09-17 00:59:22 +00:00
s = COM_ParseToken ( s , IFPUNCT ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2004-08-21 01:25:48 +00:00
if ( qrenderer = = QR_NONE )
s2 = " " ;
else if ( ! strcmp ( com_token , " width " ) )
2015-09-10 10:16:26 +00:00
s2 = retint ( vid . width ) ;
2004-08-21 01:25:48 +00:00
else if ( ! strcmp ( com_token , " height " ) )
2015-09-10 10:16:26 +00:00
s2 = retint ( vid . height ) ;
2004-08-21 01:25:48 +00:00
else
# endif
s2 = " " ;
}
else
{
if ( * com_token = = ' $ ' )
var = Cvar_FindVar ( com_token + 1 ) ;
else
var = Cvar_FindVar ( com_token ) ; //for consistancy.
if ( var )
{
2009-11-04 21:16:50 +00:00
if ( ( var - > restriction ? var - > restriction : rcon_level . ival ) > Cmd_ExecLevel )
2015-09-10 10:16:26 +00:00
{
Con_Printf ( " Console script attempted to read restricted cvar %s \n " , var - > name ) ;
2004-08-21 01:25:48 +00:00
s2 = " RESTRICTED " ;
2015-09-10 10:16:26 +00:00
}
2004-08-21 01:25:48 +00:00
else
2005-07-03 15:16:20 +00:00
s2 = var - > string ;
2004-08-21 01:25:48 +00:00
}
else
s2 = retstring ( com_token ) ;
}
* end = s ;
2015-09-10 10:16:26 +00:00
return s2 ;
}
enum
{
IFOP_CAT ,
IFOP_MUL ,
IFOP_DIV ,
IFOP_MOD ,
IFOP_ADD ,
IFOP_SUB ,
IFOP_SHL ,
IFOP_SHR ,
IFOP_ISIN ,
IFOP_ISNOTIN ,
IFOP_LT ,
IFOP_LE ,
IFOP_GT ,
IFOP_GE ,
IFOP_EQ ,
IFOP_NE ,
IFOP_BA ,
IFOP_XOR ,
IFOP_BO ,
IFOP_LA ,
IFOP_LO
} ;
static const struct
{
int opnamelen ;
const char * opname ;
int pri ;
int op ;
} ifops [ ] =
{
{ 3 , " cat " , 3 , IFOP_CAT } ,
{ 1 , " * " , 3 , IFOP_MUL } ,
{ 3 , " mul " , 3 , IFOP_MUL } ,
{ 1 , " / " , 3 , IFOP_DIV } ,
{ 3 , " div " , 3 , IFOP_DIV } ,
{ 1 , " % " , 3 , IFOP_MOD } ,
{ 3 , " mod " , 3 , IFOP_MOD } ,
{ 1 , " + " , 4 , IFOP_ADD } ,
{ 3 , " add " , 4 , IFOP_ADD } ,
{ 1 , " - " , 4 , IFOP_SUB } ,
{ 3 , " sub " , 4 , IFOP_SUB } ,
{ 2 , " << " , 5 , IFOP_SHL } ,
{ 2 , " >> " , 5 , IFOP_SHR } ,
{ 4 , " isin " , 5 , IFOP_ISIN } , //fuhquake
{ 5 , " !isin " , 5 , IFOP_ISNOTIN } , //fuhquake
{ 2 , " <= " , 6 , IFOP_LE } ,
{ 1 , " < " , 6 , IFOP_LT } ,
{ 2 , " >= " , 6 , IFOP_GE } ,
{ 1 , " > " , 6 , IFOP_GT } ,
{ 2 , " == " , 7 , IFOP_EQ } ,
{ 1 , " = " , 7 , IFOP_EQ } ,
{ 5 , " equal " , 7 , IFOP_EQ } , //qw262
{ 2 , " != " , 7 , IFOP_NE } ,
{ 2 , " && " , 11 , IFOP_LA } ,
{ 1 , " & " , 8 , IFOP_BA } ,
{ 3 , " and " , 8 , IFOP_BA } , //qw262
{ 1 , " ^ " , 9 , IFOP_XOR } ,
{ 3 , " xor " , 8 , IFOP_XOR } , //qw262
{ 2 , " || " , 12 , IFOP_LO } ,
{ 1 , " | " , 10 , IFOP_BO } ,
{ 2 , " or " , 10 , IFOP_BO } //qw262
} ;
static const char * If_Operator ( int op , const char * left , const char * right )
{
int r ;
switch ( op )
{
case IFOP_CAT :
return retstring ( va ( " %s%s " , left , right ) ) ;
case IFOP_MUL :
return retfloat ( atof ( left ) * atof ( right ) ) ;
case IFOP_DIV :
return retfloat ( atof ( left ) / atof ( right ) ) ;
case IFOP_MOD :
r = atoi ( right ) ;
if ( r )
return retfloat ( atoi ( left ) % r ) ;
2004-08-21 01:25:48 +00:00
else
2015-09-10 10:16:26 +00:00
return retfloat ( 0 ) ;
case IFOP_ADD :
return retfloat ( atof ( left ) + atof ( right ) ) ;
case IFOP_SUB :
return retfloat ( atof ( left ) - atof ( right ) ) ;
case IFOP_SHL :
return retfloat ( atoi ( left ) < < atoi ( right ) ) ;
case IFOP_SHR :
return retfloat ( atoi ( left ) > > atoi ( right ) ) ;
case IFOP_ISIN :
return retfloat ( ! ! strstr ( right , left ) ) ;
case IFOP_ISNOTIN :
return retfloat ( ! strstr ( right , left ) ) ;
case IFOP_LT :
return retfloat ( atof ( left ) < atof ( right ) ) ;
case IFOP_LE :
return retfloat ( atof ( left ) < = atof ( right ) ) ;
case IFOP_GT :
return retfloat ( atof ( left ) > atof ( right ) ) ;
case IFOP_GE :
return retfloat ( atof ( left ) > = atof ( right ) ) ;
case IFOP_EQ :
if ( is_numeric ( left ) & & is_numeric ( right ) )
return retfloat ( atof ( left ) = = atof ( right ) ) ;
else
return retfloat ( ! strcmp ( left , right ) ) ;
case IFOP_NE :
if ( is_numeric ( left ) & & is_numeric ( right ) )
return retfloat ( atof ( left ) ! = atof ( right ) ) ;
else
return retfloat ( ! ! strcmp ( left , right ) ) ;
case IFOP_BA :
return retfloat ( atoi ( left ) & atoi ( right ) ) ;
case IFOP_XOR :
return retfloat ( atoi ( left ) ^ atoi ( right ) ) ;
case IFOP_BO :
return retfloat ( atoi ( left ) | atoi ( right ) ) ;
case IFOP_LA :
return retfloat ( is_true ( left ) & & is_true ( right ) ) ;
case IFOP_LO :
return retfloat ( is_true ( left ) | | is_true ( right ) ) ;
default :
return retfloat ( 0 ) ;
}
}
static const char * If_Token ( const char * func , const char * * end , int pri )
{
const char * s , * s2 ;
int i ;
if ( pri > 0 )
s2 = If_Token ( func , & s , pri - 1 ) ;
else
s2 = If_Token_Term ( func , & s ) ;
* end = s ;
2016-09-08 19:04:35 +00:00
if ( s )
2004-08-21 01:25:48 +00:00
{
2016-09-08 19:04:35 +00:00
while ( * s = = ' ' | | * s = = ' \t ' )
s + + ;
for ( i = 0 ; i < countof ( ifops ) ; i + + )
2004-08-21 01:25:48 +00:00
{
2016-09-08 19:04:35 +00:00
if ( ! strncmp ( s , ifops [ i ] . opname , ifops [ i ] . opnamelen ) )
2004-08-21 01:25:48 +00:00
{
2016-09-08 19:04:35 +00:00
if ( pri = = ifops [ i ] . pri )
{
s = If_Token ( s + ifops [ i ] . opnamelen , end , pri ) ;
s2 = If_Operator ( ifops [ i ] . op , s2 , s ) ;
}
break ;
2004-08-21 01:25:48 +00:00
}
}
2006-09-17 00:59:22 +00:00
}
2004-08-21 01:25:48 +00:00
return s2 ;
}
2015-09-07 14:34:39 +00:00
qboolean If_EvaluateBoolean ( const char * text , int restriction )
{
qboolean ret ;
const char * end ;
tempstack_t * ts = If_Token_GetMark ( ) ;
int restore = Cmd_ExecLevel ;
Cmd_ExecLevel = restriction ;
2015-09-10 10:16:26 +00:00
text = If_Token ( text , & end , IF_PRI_MAX ) ;
2015-09-07 14:34:39 +00:00
ret = is_true ( text ) ;
If_Token_Clear ( ts ) ;
Cmd_ExecLevel = restore ;
return ret ;
}
2018-10-11 10:31:23 +00:00
static void Cbuf_ExecBlock ( int level )
2004-08-21 01:25:48 +00:00
{
char * remainingcbuf ;
char * exectext = NULL ;
char * line , * end ;
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( level , false ) ;
2004-08-21 01:25:48 +00:00
while ( * line < = ' ' & & * line ) //skip leading whitespace.
line + + ;
for ( end = line + strlen ( line ) - 1 ; end > = line & & * end < = ' ' ; end - - ) //skip trailing
* end = ' \0 ' ;
if ( ! strcmp ( line , " { " ) ) //multiline block
{
int indent = 1 ;
for ( ; ; )
{
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( level , false ) ;
2004-08-21 01:25:48 +00:00
while ( * line < = ' ' & & * line ) //skip leading whitespace.
line + + ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
for ( end = line + strlen ( line ) - 1 ; end > = line & & * end < = ' ' ; end - - ) //skip trailing
* end = ' \0 ' ;
if ( ! strcmp ( line , " { " ) )
indent + + ;
else if ( ! strcmp ( line , " } " ) )
{
indent - - ;
if ( ! indent )
break ;
}
else if ( ! * line )
{
Con_Printf ( " Unterminated block \n " ) ;
break ;
}
if ( exectext )
{
char * newv ;
2005-03-28 00:11:59 +00:00
newv = ( char * ) Z_Malloc ( strlen ( exectext ) + strlen ( line ) + 2 ) ;
2004-08-21 01:25:48 +00:00
sprintf ( newv , " %s;%s " , exectext , line ) ;
Z_Free ( exectext ) ;
exectext = newv ;
}
else
2013-08-27 13:18:09 +00:00
exectext = Z_StrDup ( line ) ;
2004-08-21 01:25:48 +00:00
// Con_Printf("Exec \"%s\"\n", line);
}
}
else
{
2013-08-27 13:18:09 +00:00
exectext = Z_StrDup ( line ) ;
2004-08-21 01:25:48 +00:00
// Con_Printf("Exec \"%s\"\n", line);
}
remainingcbuf = Cbuf_StripText ( level ) ; //this craziness is to prevent an if } from breaking the entire con text
Cbuf_AddText ( exectext , level ) ;
Z_Free ( exectext ) ;
Cbuf_ExecuteLevel ( level ) ;
Cbuf_AddText ( remainingcbuf , level ) ;
Z_Free ( remainingcbuf ) ;
}
2018-10-11 10:31:23 +00:00
static void Cbuf_SkipBlock ( int level )
2004-08-21 01:25:48 +00:00
{
char * line , * end ;
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( level , false ) ;
2004-08-21 01:25:48 +00:00
while ( * line < = ' ' & & * line ) //skip leading whitespace.
line + + ;
for ( end = line + strlen ( line ) - 1 ; end > = line & & * end < = ' ' ; end - - ) //skip trailing
* end = ' \0 ' ;
if ( ! strcmp ( line , " { " ) ) //multiline block
{
int indent = 1 ;
for ( ; ; )
{
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( level , false ) ;
2004-08-21 01:25:48 +00:00
while ( * line < = ' ' & & * line ) //skip leading whitespace.
line + + ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
for ( end = line + strlen ( line ) - 1 ; end > = line & & * end < = ' ' ; end - - ) //skip trailing
* end = ' \0 ' ;
if ( ! strcmp ( line , " { " ) )
indent + + ;
else if ( ! strcmp ( line , " } " ) )
{
indent - - ;
if ( ! indent )
break ;
}
else if ( ! * line )
{
Con_Printf ( " Unterminated block \n " ) ;
break ;
}
// Con_Printf("Skip \"%s\"\n", line);
}
}
// else
// Con_Printf("Skip \"%s\"\n", line);
}
void Cmd_if_f ( void )
{
char * text = Cmd_Args ( ) ;
2005-03-28 00:11:59 +00:00
const char * ret ;
2004-08-21 01:25:48 +00:00
char * end ;
2005-03-28 00:11:59 +00:00
char * ws ;
2004-08-21 01:25:48 +00:00
int level ;
qboolean trueblock = false ;
tempstack_t * ts ;
if ( Cmd_Argc ( ) = = 1 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " if <condition> <statement> [elseif <condition> <statement>] [...] [else <statement>] \n " ) ;
2004-08-21 01:25:48 +00:00
return ;
}
ts = If_Token_GetMark ( ) ;
level = Cmd_ExecLevel ;
elseif :
// Con_Printf("if %s\n", text);
2015-09-10 10:16:26 +00:00
ret = If_Token ( text , ( const char * * ) & end , IF_PRI_MAX ) ;
2004-08-21 01:25:48 +00:00
if ( ! end )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Not terminated \n " ) ;
2004-08-21 01:25:48 +00:00
If_Token_Clear ( ts ) ;
return ;
}
skipws :
2015-09-18 20:30:10 +00:00
while ( * end = = ' ' | | * end = = ' \t ' ) //skip leading whitespace.
2004-08-21 01:25:48 +00:00
end + + ;
for ( ws = end + strlen ( end ) - 1 ; ws > = end & & * ws < = ' ' ; ws - - ) //skip trailing
* ws = ' \0 ' ;
2005-04-26 16:04:12 +00:00
if ( ! strncmp ( end , " then " , 4 ) ) //sigh... trying to make fuhquake's ifs work.
2004-08-21 01:25:48 +00:00
{
end + = 4 ;
goto skipws ;
}
2005-07-03 15:16:20 +00:00
2015-09-18 20:30:10 +00:00
while ( * end = = ' ' | | * end = = ' \t ' )
end + + ;
2004-08-21 01:25:48 +00:00
if ( ! * end )
{
2015-09-18 20:30:10 +00:00
if ( is_true ( ret ) ) //equation was true.
2004-08-21 01:25:48 +00:00
{
trueblock = true ;
Cbuf_ExecBlock ( level ) ;
}
else //equation was false.
{
skipblock :
Cbuf_SkipBlock ( level ) ;
}
2011-12-05 15:23:40 +00:00
end = Cbuf_GetNext ( level , false ) ;
2004-08-21 01:25:48 +00:00
while ( * end < = ' ' & & * end )
end + + ;
if ( ! strncmp ( end , " else " , 4 ) )
{
end + = 4 ;
while ( * end < = ' ' & & * end ) //skip leading whitespace.
end + + ;
if ( ! strncmp ( end , " if " , 2 ) )
{
text = end + 2 ;
if ( trueblock )
goto skipblock ; //we've had our true, all others are assumed to be false.
else
goto elseif ; //and have annother go.
}
else
{ //we got an else. This is the last block. Don't go through the normal way, cos that would let us follow up with a second else.
if ( trueblock )
Cbuf_SkipBlock ( level ) ;
else
Cbuf_ExecBlock ( level ) ;
If_Token_Clear ( ts ) ;
return ;
}
}
//whoops. Too far.
2006-02-06 01:06:17 +00:00
Cbuf_InsertText ( end , level , true ) ;
2004-08-21 01:25:48 +00:00
If_Token_Clear ( ts ) ;
return ;
}
text = strstr ( end , " else " ) ;
if ( ret & & * ret )
{
if ( text ) //don't bother execing the else bit...
* text = ' \0 ' ;
2006-02-06 01:06:17 +00:00
Cbuf_InsertText ( end , level , true ) ;
2004-08-21 01:25:48 +00:00
}
else
{
if ( text )
2006-02-06 01:06:17 +00:00
Cbuf_InsertText ( text + 4 , level , true ) ; //ironically, this will do elseif...
2004-08-21 01:25:48 +00:00
}
If_Token_Clear ( ts ) ;
}
2018-10-11 10:31:23 +00:00
static void Cmd_Vstr_f ( void )
2005-09-08 22:52:46 +00:00
{
char * v ;
if ( Cmd_Argc ( ) ! = 2 )
{
Con_Printf ( " vstr <variablename> : execute a variable command \n " ) ;
return ;
}
v = Cvar_VariableString ( Cmd_Argv ( 1 ) ) ;
2006-02-06 01:06:17 +00:00
Cbuf_InsertText ( v , Cmd_ExecLevel , true ) ;
2005-09-08 22:52:46 +00:00
}
2018-10-11 10:31:23 +00:00
static void Cmd_toggle_f ( void )
2009-07-05 18:45:53 +00:00
{
cvar_t * v ;
if ( Cmd_Argc ( ) < 2 )
{
Con_Printf ( " missing cvar name \n " ) ;
return ;
}
v = Cvar_Get ( Cmd_Argv ( 1 ) , " 0 " , 0 , " Custom variables " ) ;
if ( ! v )
return ;
2019-07-16 02:59:12 +00:00
if ( Cmd_Argc ( ) > = 3 )
{
const char * newval = Cmd_Argv ( 2 ) ;
const char * defval = ( Cmd_Argc ( ) > 3 ) ? Cmd_Argv ( 3 ) : v - > defaultstr ;
if ( ! strcmp ( newval , v - > string ) )
Cvar_Set ( v , defval ) ;
else
Cvar_Set ( v , newval ) ;
}
2009-07-05 18:45:53 +00:00
else
2019-07-16 02:59:12 +00:00
{
if ( v - > value )
Cvar_Set ( v , " 0 " ) ;
else
Cvar_Set ( v , " 1 " ) ;
}
2009-07-05 18:45:53 +00:00
}
2018-05-06 15:55:32 +00:00
static void Cmd_Set_c ( int argn , const char * partial , struct xcommandargcompletioncb_s * ctx )
{
extern cvar_group_t * cvar_groups ;
size_t len = strlen ( partial ) ;
cvar_group_t * grp ;
cvar_t * var ;
if ( argn ! = 1 )
return ;
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( var = grp - > cvars ; var ; var = var - > next )
{
if ( ! Q_strncasecmp ( partial , var - > name , len ) )
ctx - > cb ( var - > name , var - > description , NULL , ctx ) ;
else if ( var - > name2 & & ! Q_strncasecmp ( partial , var - > name2 , len ) )
ctx - > cb ( var - > name2 , var - > description , NULL , ctx ) ;
}
}
2018-10-11 10:31:23 +00:00
static void Cmd_set_f ( void )
2004-08-21 01:25:48 +00:00
{
2005-09-17 16:49:21 +00:00
void * mark ;
2004-08-21 01:25:48 +00:00
cvar_t * var ;
2005-03-28 00:11:59 +00:00
const char * end ;
const char * text ;
int forceflags = 0 ;
2006-09-17 00:59:22 +00:00
qboolean docalc ;
2010-07-18 08:42:59 +00:00
char name [ 256 ] ;
2016-11-15 22:22:04 +00:00
const char * desc = NULL ;
2005-03-28 00:11:59 +00:00
2006-09-17 00:59:22 +00:00
if ( ! strcmp ( Cmd_Argv ( 0 ) , " set_calc " ) | | ! strcmp ( Cmd_Argv ( 0 ) , " seta_calc " ) )
docalc = true ;
else
docalc = false ;
2022-02-07 14:34:36 +00:00
if ( Cmd_Argc ( ) < 3 )
{
if ( docalc )
Con_TPrintf ( " %s %s <equation> \n " , Cmd_Argv ( 0 ) , * Cmd_Argv ( 1 ) ? Cmd_Argv ( 1 ) : " <var> " ) ;
else if ( ! strcmp ( Cmd_Argv ( 0 ) , " setfl " ) )
Con_TPrintf ( " %s %s <value> <a|u|s> \n " , Cmd_Argv ( 0 ) , * Cmd_Argv ( 1 ) ? Cmd_Argv ( 1 ) : " <var> " ) ;
else
Con_TPrintf ( " %s %s <value> \n " , Cmd_Argv ( 0 ) , * Cmd_Argv ( 1 ) ? Cmd_Argv ( 1 ) : " <var> " ) ;
return ;
}
2016-01-18 05:22:07 +00:00
if ( ! strncmp ( Cmd_Argv ( 0 ) , " seta " , 4 ) & & ! Cmd_FromGamecode ( ) )
forceflags | = CVAR_ARCHIVE ;
2010-07-18 08:42:59 +00:00
Q_strncpyz ( name , Cmd_Argv ( 1 ) , sizeof ( name ) ) ;
2005-03-28 00:11:59 +00:00
2016-11-15 22:22:04 +00:00
if ( ! strcmp ( Cmd_Argv ( 0 ) , " setfl " ) | | Cmd_FromGamecode ( ) ) //AARGHHHH!!! Q2 set command is different
2005-03-28 00:11:59 +00:00
{
text = Cmd_Argv ( 3 ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
while ( * text )
{
switch ( * text + + )
{
case ' u ' :
forceflags | = CVAR_USERINFO ;
break ;
case ' s ' :
forceflags | = CVAR_SERVERINFO ;
break ;
case ' a ' :
forceflags | = CVAR_ARCHIVE ;
break ;
default :
return ;
}
}
2005-03-28 00:11:59 +00:00
text = Cmd_Argv ( 2 ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
2016-11-15 22:22:04 +00:00
if ( Cmd_Argc ( ) > = 5 )
desc = Cmd_Argv ( 4 ) ;
2005-03-28 00:11:59 +00:00
}
2012-01-17 07:57:46 +00:00
else if ( dpcompat_set . ival & & ! docalc )
2010-07-18 08:42:59 +00:00
{
text = Cmd_Argv ( 2 ) ;
2016-11-15 22:22:04 +00:00
if ( Cmd_Argc ( ) > = 4 )
desc = Cmd_Argv ( 3 ) ;
2010-07-18 08:42:59 +00:00
}
2005-03-28 00:11:59 +00:00
else
{
2006-09-17 00:59:22 +00:00
Cmd_ShiftArgs ( 1 , false ) ;
2005-03-28 00:11:59 +00:00
text = Cmd_Args ( ) ;
2016-11-15 22:22:04 +00:00
if ( ! docalc & & Cmd_Argc ( ) = = 2 & & ( * text = = ' \" ' | | ( * text = = ' \\ ' & & text [ 1 ] = = ' \" ' ) ) ) //if it's already quoted, dequote it, and ignore trailing stuff, for q2/q3 compatability
{
desc = COM_StringParse ( text , com_token , sizeof ( com_token ) , false , false ) ;
while ( * desc = = ' ' | | * desc = = ' \t ' )
desc + + ;
if ( desc [ 0 ] = = ' / ' & & desc [ 1 ] = = ' / ' )
{
desc + = 2 ;
while ( * desc = = ' ' | | * desc = = ' \t ' )
desc + + ;
end = desc + strlen ( desc ) ;
while ( end > desc )
{
end - - ;
if ( * end = = ' ' | | * end = = ' \t ' | | * end = = ' \r ' )
* ( char * ) end = 0 ;
else
break ;
}
}
else
desc = NULL ;
2006-09-17 00:59:22 +00:00
text = Cmd_Argv ( 1 ) ;
2016-11-15 22:22:04 +00:00
}
2008-11-09 22:29:28 +00:00
else
{
2016-11-15 22:22:04 +00:00
desc = strstr ( text , " // " ) ;
if ( desc )
end = desc ;
else
end = text + strlen ( text ) ;
end - - ;
while ( end > = text )
2008-11-09 22:29:28 +00:00
{
2016-11-15 22:22:04 +00:00
if ( * end = = ' ' | | * end = = ' \t ' | | * end = = ' \r ' )
end - - ;
else
break ;
}
end + + ;
* ( char * ) end = 0 ;
if ( desc )
{
desc + = 2 ;
while ( * desc = = ' ' | | * desc = = ' \t ' )
desc + + ;
end = desc + strlen ( desc ) ;
while ( end > desc )
2008-11-09 22:29:28 +00:00
{
2016-11-15 22:22:04 +00:00
end - - ;
2016-07-21 19:27:59 +00:00
if ( * end = = ' ' | | * end = = ' \t ' | | * end = = ' \r ' )
2016-11-15 22:22:04 +00:00
* ( char * ) end = 0 ;
2008-11-09 22:29:28 +00:00
else
break ;
}
}
}
2016-11-15 22:22:04 +00:00
//fixme: should peek onto the next line to see if that's an indented // too, or something.
2016-01-18 05:22:07 +00:00
forceflags | = 0 ;
2005-03-28 00:11:59 +00:00
}
2004-08-21 01:25:48 +00:00
2022-03-08 05:31:34 +00:00
var = Cvar_Get2 ( name , text , CVAR_TEAMPLAYTAINT | forceflags , desc , " Custom variables " ) ;
2010-07-18 08:42:59 +00:00
2005-09-17 16:49:21 +00:00
mark = If_Token_GetMark ( ) ;
2004-08-21 01:25:48 +00:00
if ( var )
2004-11-13 17:22:13 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( var - > flags & CVAR_NOTFROMSERVER & & Cmd_IsInsecure ( ) )
2004-11-13 17:22:13 +00:00
{
Con_Printf ( " Server tried setting %s cvar \n " , var - > name ) ;
2004-11-17 17:37:18 +00:00
return ;
2004-11-13 17:22:13 +00:00
}
2013-10-29 17:38:22 +00:00
if ( var - > flags & CVAR_NOSET )
{
Con_Printf ( " variable %s is readonly \n " , var - > name ) ;
return ;
}
2019-10-14 02:36:57 +00:00
if ( var - > flags & CVAR_NOUNSAFEEXPAND )
forceflags & = ~ ( CVAR_USERINFO | CVAR_SERVERINFO ) ;
2004-11-13 17:22:13 +00:00
2005-04-16 16:21:27 +00:00
if ( Cmd_FromGamecode ( ) )
2005-03-28 00:11:59 +00:00
{
if ( forceflags )
{
var - > flags & = ~ ( CVAR_USERINFO | CVAR_SERVERINFO ) ;
var - > flags | = forceflags ;
}
2004-11-13 17:22:13 +00:00
Cvar_LockFromServer ( var , text ) ;
2005-03-28 00:11:59 +00:00
}
2004-11-13 17:22:13 +00:00
else
2005-03-28 00:11:59 +00:00
{
2006-09-17 00:59:22 +00:00
if ( docalc )
2015-09-10 10:16:26 +00:00
text = If_Token ( text , & end , IF_PRI_MAX ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
var - > flags | = CVAR_USERCREATED | forceflags ;
2021-07-18 12:13:11 +00:00
Cvar_Set ( var , text ) ;
2006-01-28 06:41:20 +00:00
2015-09-18 20:30:10 +00:00
if ( Cmd_ExecLevel = = RESTRICT_TEAMPLAY )
var - > flags | = CVAR_TEAMPLAYTAINT ;
2005-03-28 00:11:59 +00:00
}
2004-11-13 17:22:13 +00:00
}
2004-08-21 01:25:48 +00:00
else
2004-11-13 17:22:13 +00:00
{
2006-09-17 00:59:22 +00:00
if ( docalc )
2015-09-10 10:16:26 +00:00
text = If_Token ( text , & end , IF_PRI_MAX ) ;
2005-04-16 16:21:27 +00:00
if ( Cmd_FromGamecode ( ) )
2004-11-13 17:22:13 +00:00
{
var = Cvar_Get ( Cmd_Argv ( 1 ) , " " , 0 , " Game variables " ) ;
2006-09-17 00:59:22 +00:00
if ( var )
Cvar_LockFromServer ( var , text ) ;
2004-11-13 17:22:13 +00:00
}
else
2016-01-18 05:22:07 +00:00
var = Cvar_Get ( Cmd_Argv ( 1 ) , text , CVAR_USERCREATED , " User variables " ) ;
2004-08-21 01:25:48 +00:00
2017-08-14 16:38:44 +00:00
if ( var )
var - > flags | = forceflags ;
2016-01-18 05:22:07 +00:00
}
2005-09-17 16:49:21 +00:00
If_Token_Clear ( mark ) ;
2004-08-21 01:25:48 +00:00
}
2018-10-11 10:31:23 +00:00
static void Cvar_Inc_f ( void )
2004-08-21 01:25:48 +00:00
{
int c ;
cvar_t * var ;
float delta ;
c = Cmd_Argc ( ) ;
if ( c ! = 2 & & c ! = 3 )
{
Con_Printf ( " inc <cvar> [value] \n " ) ;
return ;
}
var = Cvar_FindVar ( Cmd_Argv ( 1 ) ) ;
if ( ! var )
{
Con_Printf ( " Unknown variable \" %s \" \n " , Cmd_Argv ( 1 ) ) ;
return ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( var - > flags & CVAR_NOTFROMSERVER & & Cmd_IsInsecure ( ) )
2004-11-13 17:22:13 +00:00
{
Con_Printf ( " Server tried setting %s cvar \n " , var - > name ) ;
2004-11-17 17:37:18 +00:00
return ;
2004-11-13 17:22:13 +00:00
}
2004-08-21 01:25:48 +00:00
delta = ( c = = 3 ) ? atof ( Cmd_Argv ( 2 ) ) : 1 ;
2015-09-18 20:30:10 +00:00
if ( Cmd_ExecLevel = = RESTRICT_TEAMPLAY | | ( var - > flags & CVAR_TEAMPLAYTAINT ) )
{
Cvar_SetValue ( var , var - > value + delta ) ;
var - > flags | = CVAR_TEAMPLAYTAINT ;
}
else
Cvar_SetValue ( var , var - > value + delta ) ;
2004-08-21 01:25:48 +00:00
}
2016-08-25 00:12:14 +00:00
void Cvar_ParseWatches ( void )
{
const char * cvarname ;
int i ;
cvar_t * var ;
for ( i = 1 ; i < com_argc - 1 ; i + + )
{
if ( ! com_argv [ i ] | | strcmp ( com_argv [ i ] , " -watch " ) )
continue ; // NEXTSTEP sometimes clears appkit vars.
cvarname = com_argv [ i + 1 ] ;
if ( ! cvarname )
continue ;
var = Cvar_FindVar ( cvarname ) ;
if ( ! var )
{
Con_Printf ( " cvar \" %s \" is not defined yet \n " , cvarname ) ;
continue ;
}
var - > flags | = CVAR_WATCHED ;
cvar_watched = true ;
i + + ;
}
}
2018-10-11 10:31:23 +00:00
static void Cvar_Watch_f ( void )
2016-08-25 00:12:14 +00:00
{
char * cvarname = Cmd_Argv ( 1 ) ;
cvar_t * var ;
cvar_group_t * grp ;
extern cvar_group_t * cvar_groups ;
if ( ! strcmp ( cvarname , " " ) )
{
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( var = grp - > cvars ; var ; var = var - > next )
{
if ( var - > flags & CVAR_WATCHED )
Con_Printf ( " Watching %s \n " , var - > name ) ;
}
return ;
}
else if ( ! strcmp ( cvarname , " off " ) )
{
cvar_watched = false ;
Con_Printf ( " Disabling all cvar watches \n " ) ;
for ( grp = cvar_groups ; grp ; grp = grp - > next )
for ( var = grp - > cvars ; var ; var = var - > next )
var - > flags & = ~ CVAR_WATCHED ;
return ;
}
else if ( ! strcmp ( cvarname , " all " ) )
{
cvar_watched = 2 ;
Con_Printf ( " Notifying for ALL cvar changes \n " ) ;
return ;
}
else
{
var = Cvar_FindVar ( cvarname ) ;
if ( ! var )
{
Con_Printf ( " cvar \" %s \" is not defined yet \n " , cvarname ) ;
return ;
}
var - > flags | = CVAR_WATCHED ;
cvar_watched | = true ;
}
}
2018-10-11 10:31:23 +00:00
static void Cmd_WriteConfig_f ( void )
2004-08-21 01:25:48 +00:00
{
2021-05-09 13:02:01 +00:00
char curtime [ 256 ] ;
2005-12-21 03:07:33 +00:00
vfsfile_t * f ;
2004-08-21 01:25:48 +00:00
char * filename ;
2016-08-25 00:12:14 +00:00
char fname [ MAX_QPATH ] ;
2012-11-27 03:23:19 +00:00
char sysname [ MAX_OSPATH ] ;
2014-12-23 15:26:42 +00:00
qboolean all = true ;
2004-08-21 01:25:48 +00:00
2022-03-08 05:31:34 +00:00
//special variation that only saves if an archived cvar was actually modified.
if ( ! Q_strcasecmp ( Cmd_Argv ( 0 ) , " cfg_save_ifmodified " ) )
if ( ! Cvar_UnsavedArchive ( ) )
return ;
2004-08-21 01:25:48 +00:00
filename = Cmd_Argv ( 1 ) ;
if ( ! * filename )
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Q_strncpyz ( fname , fs_manifest - > mainconfig , sizeof ( fname ) ) ;
2015-06-14 01:28:01 +00:00
2018-12-28 00:04:36 +00:00
# if defined(CL_MASTER) && defined(HAVE_CLIENT)
2017-12-09 21:22:46 +00:00
MasterInfo_WriteServers ( ) ;
2018-12-28 00:04:36 +00:00
# endif
2017-12-09 21:22:46 +00:00
2020-05-14 15:50:26 +00:00
f = FS_OpenWithFriends ( fname , sysname , sizeof ( sysname ) , 4 , " quake.rc " , " hexen.rc " , " *.cfg " , " configs/*.cfg " , " dlcache/*.pk3* " ) ;
2014-12-23 15:26:42 +00:00
2015-06-12 14:44:50 +00:00
all = cfg_save_all . ival ;
2004-08-21 01:25:48 +00:00
}
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
else if ( ! Q_strcasecmp ( Cmd_Argv ( 0 ) , " saveconfig " ) )
{
//dpcompat: this variation allows writing to any path. at least force the extension.
snprintf ( fname , sizeof ( fname ) , " %s " , filename ) ;
COM_RequireExtension ( fname , " .cfg " , sizeof ( fname ) ) ;
if ( Cmd_IsInsecure ( ) & & strncmp ( fname , " data/ " , 5 ) )
{
Con_Printf ( " %s %s: not allowed \n " , Cmd_Argv ( 0 ) , Cmd_Args ( ) ) ;
return ;
}
FS_NativePath ( fname , FS_BASEGAMEONLY , sysname , sizeof ( sysname ) ) ;
FS_CreatePath ( fname , FS_BASEGAMEONLY ) ;
f = FS_OpenVFS ( fname , " wbp " , FS_BASEGAMEONLY ) ;
all = cfg_save_all . ival ; // || !*cfg_save_all.string;
}
2009-06-21 17:45:33 +00:00
else
{
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( Cmd_IsInsecure ( ) )
{
Con_Printf ( " %s %s: not allowed \n " , Cmd_Argv ( 0 ) , Cmd_Args ( ) ) ;
return ;
}
2009-06-21 17:45:33 +00:00
if ( strstr ( filename , " .. " ) )
{
2016-08-25 00:12:14 +00:00
Con_Printf ( CON_ERROR " Couldn't write config %s \n " , filename ) ;
2009-06-21 17:45:33 +00:00
return ;
}
snprintf ( fname , sizeof ( fname ) , " configs/%s " , filename ) ;
COM_DefaultExtension ( fname , " .cfg " , sizeof ( fname ) ) ;
2007-10-05 17:23:43 +00:00
2014-04-06 15:16:39 +00:00
FS_NativePath ( fname , FS_BASEGAMEONLY , sysname , sizeof ( sysname ) ) ;
2014-03-30 08:55:06 +00:00
FS_CreatePath ( fname , FS_BASEGAMEONLY ) ;
2014-08-27 08:41:31 +00:00
f = FS_OpenVFS ( fname , " wbp " , FS_BASEGAMEONLY ) ;
2014-12-23 15:26:42 +00:00
2015-06-12 14:44:50 +00:00
all = cfg_save_all . ival | | ! * cfg_save_all . string ;
2009-06-21 17:45:33 +00:00
}
2004-08-21 01:25:48 +00:00
if ( ! f )
{
2016-08-25 00:12:14 +00:00
Con_Printf ( CON_ERROR " Couldn't write config %s \n " , sysname ) ;
2004-08-21 01:25:48 +00:00
return ;
}
2009-06-21 17:45:33 +00:00
2021-05-09 13:02:01 +00:00
{
time_t t = time ( NULL ) ;
strftime ( curtime , sizeof ( curtime ) , " %Y-%m-%d %H:%M " , localtime ( & t ) ) ;
}
VFS_PRINTF ( f , " // %s config file (%s) \n \n " , * fs_gamename . string ? fs_gamename . string : FULLENGINENAME , curtime ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2018-04-09 18:01:15 +00:00
if ( cfg_save_binds . ival )
Key_WriteBindings ( f ) ;
if ( cfg_save_buttons . ival )
IN_WriteButtons ( f , all ) ;
2018-06-02 08:55:57 +00:00
# ifdef HAVE_CDPLAYER
// if (cfg_save_cdtracks.ival)
Media_SaveTracks ( f ) ;
# endif
2018-04-09 18:01:15 +00:00
if ( cfg_save_infos . ival )
CL_SaveInfo ( f ) ;
2004-08-21 01:25:48 +00:00
# else
2005-12-21 03:07:33 +00:00
VFS_WRITE ( f , " // Dedicated Server config \n \n " , 28 ) ;
2004-11-17 17:37:18 +00:00
# endif
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2018-04-09 18:01:15 +00:00
if ( cfg_save_infos . ival )
SV_SaveInfos ( f ) ;
2018-12-28 00:04:36 +00:00
# else
VFS_WRITE ( f , " // no local/server infos \n \n " , 26 ) ;
2004-08-21 01:25:48 +00:00
# endif
2018-04-09 18:01:15 +00:00
if ( cfg_save_aliases . ival )
Alias_WriteAliases ( f ) ;
2014-12-23 15:26:42 +00:00
Cvar_WriteVariables ( f , all ) ;
2005-12-21 03:07:33 +00:00
VFS_CLOSE ( f ) ;
2005-11-30 01:20:53 +00:00
2012-04-24 07:59:11 +00:00
Cvar_Saved ( ) ;
2012-11-27 03:23:19 +00:00
Con_Printf ( " Wrote %s \n " , sysname ) ;
2004-08-21 01:25:48 +00:00
}
2018-10-11 10:31:23 +00:00
static void Cmd_Reset_f ( void )
2006-01-02 23:01:54 +00:00
{
2021-05-05 21:59:23 +00:00
//FIXME: this should reset to _engine_ defaults (with fmf overrides)
Cbuf_InsertText ( " cvarreset * \n " , RESTRICT_LOCAL , false ) ;
//FIXME: wipe aliases
//FIXME: reset + commands
//FIXME: destroy custom cvars (unless there's a live pointer still... which is not tracked properly, bah)
// Cbuf_InsertText("exec default.cfg\n", RESTRICT_LOCAL, false);
2006-01-02 23:01:54 +00:00
}
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2005-09-21 01:14:04 +00:00
// dumps current console contents to a text file
2018-10-11 10:31:23 +00:00
static void Cmd_Condump_f ( void )
2005-09-21 01:14:04 +00:00
{
2018-11-19 06:37:25 +00:00
console_t * c = Con_GetMain ( ) ;
2006-01-02 23:01:54 +00:00
vfsfile_t * f ;
2005-09-21 01:14:04 +00:00
char * filename ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
char line [ 8192 ] ;
2005-09-21 01:14:04 +00:00
2018-11-19 06:37:25 +00:00
if ( ! c )
2005-09-21 01:14:04 +00:00
{
Con_Printf ( " No console to dump. \n " ) ;
return ;
}
if ( Cmd_IsInsecure ( ) ) // don't allow insecure level execute this
return ;
filename = Cmd_Argv ( 1 ) ;
if ( ! * filename )
filename = " condump " ;
2006-01-02 23:01:54 +00:00
filename = va ( " %s " , filename ) ;
2006-03-11 03:12:10 +00:00
COM_DefaultExtension ( filename , " .txt " , MAX_QPATH ) ;
2011-05-15 13:23:13 +00:00
2006-01-02 23:01:54 +00:00
f = FS_OpenVFS ( filename , " wb " , FS_GAME ) ;
2005-09-21 01:14:04 +00:00
if ( ! f )
{
2016-08-25 00:12:14 +00:00
Con_Printf ( CON_ERROR " Couldn't write console dump %s \n " , filename ) ;
2005-09-21 01:14:04 +00:00
return ;
}
// print out current contents of console
// stripping out starting blank lines and blank spaces
{
2009-07-05 18:45:53 +00:00
conline_t * l ;
conchar_t * t ;
2018-11-19 06:37:25 +00:00
for ( l = c - > oldest ; l ; l = l - > newer )
2009-07-05 18:45:53 +00:00
{
t = ( conchar_t * ) ( l + 1 ) ;
2018-11-19 06:37:25 +00:00
COM_DeFunString ( t , t + l - > length , line , sizeof ( line ) , true , ! ! ( c - > parseflags & PFS_FORCEUTF8 ) ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
VFS_WRITE ( f , line , strlen ( line ) ) ;
2009-07-05 18:45:53 +00:00
VFS_WRITE ( f , " \n " , 1 ) ;
2005-09-21 01:14:04 +00:00
}
}
2006-01-02 23:01:54 +00:00
VFS_CLOSE ( f ) ;
2005-09-21 01:14:04 +00:00
Con_Printf ( " Dumped console to %s \n " , filename ) ;
}
# endif
2009-04-01 22:03:56 +00:00
void Cmd_Shutdown ( void )
{
2012-05-09 15:30:53 +00:00
cmd_function_t * c ;
2011-01-30 01:32:30 +00:00
cmdalias_t * a ;
2012-07-05 19:42:36 +00:00
int i ;
2009-04-01 22:03:56 +00:00
//make sure we get no other execution
int level ;
for ( level = 0 ; level < sizeof ( cmd_text ) / sizeof ( cmd_text [ 0 ] ) ; level + + )
2012-07-05 19:42:36 +00:00
{
2009-04-01 22:03:56 +00:00
SZ_Clear ( & cmd_text [ level ] . buf ) ;
2012-07-05 19:42:36 +00:00
if ( cmd_text [ level ] . buf . data )
{
BZ_Free ( cmd_text [ level ] . buf . data ) ;
cmd_text [ level ] . buf . data = NULL ;
cmd_text [ level ] . buf . maxsize = 0 ;
}
}
2018-04-27 16:40:50 +00:00
Cmd_Complete ( NULL , false ) ; //NULL frees any cached results without generating new ones.
2012-05-09 15:30:53 +00:00
while ( cmd_functions )
{
c = cmd_functions ;
cmd_functions = c - > next ;
Z_Free ( c ) ;
}
2011-01-30 01:32:30 +00:00
while ( cmd_alias )
{
a = cmd_alias ;
cmd_alias = a - > next ;
Z_Free ( a - > value ) ;
Z_Free ( a ) ;
}
2012-07-05 19:42:36 +00:00
for ( i = 0 ; i < cmd_argc ; i + + )
Z_Free ( cmd_argv [ i ] ) ;
Z_Free ( cmd_args_buf ) ;
cmd_argc = 0 ;
cmd_args_buf = NULL ;
2009-04-01 22:03:56 +00:00
}
2012-04-16 12:15:05 +00:00
static char macro_buf [ 256 ] = " " ;
static char * Macro_Time ( void )
{
time_t t ;
struct tm * ptm ;
time ( & t ) ;
ptm = localtime ( & t ) ;
if ( ! ptm )
return " #bad date# " ;
strftime ( macro_buf , sizeof ( macro_buf ) - 1 , " %H:%M " , ptm ) ;
return macro_buf ;
}
static char * Macro_UKDate ( void ) //and much but not all of EU
{
time_t t ;
struct tm * ptm ;
time ( & t ) ;
ptm = localtime ( & t ) ;
if ( ! ptm )
return " #bad date# " ;
strftime ( macro_buf , sizeof ( macro_buf ) - 1 , " %d.%m.%Y " , ptm ) ;
return macro_buf ;
}
2013-05-03 04:28:08 +00:00
static char * Macro_USDate ( void ) //and much but not all of EU
{
time_t t ;
struct tm * ptm ;
time ( & t ) ;
ptm = localtime ( & t ) ;
if ( ! ptm )
return " #bad date# " ;
2013-06-24 09:04:00 +00:00
strftime ( macro_buf , sizeof ( macro_buf ) - 1 , " %m.%d.%Y " , ptm ) ;
2013-05-03 04:28:08 +00:00
return macro_buf ;
}
2012-04-16 12:15:05 +00:00
static char * Macro_ProperDate ( void ) //americans get it wrong. besides, this is more easily sortable for filenames etc
{
time_t t ;
struct tm * ptm ;
time ( & t ) ;
ptm = localtime ( & t ) ;
if ( ! ptm )
return " #bad date# " ;
strftime ( macro_buf , sizeof ( macro_buf ) - 1 , " %Y-%m-%d " , ptm ) ;
return macro_buf ;
}
static char * Macro_Version ( void )
{
/* you probably don't need date, but it's included as this is likly to be used by
q2 servers checking for cheats . */
return va ( " %.2f %s " , 2.57 , version_string ( ) ) ;
}
2017-08-29 02:29:06 +00:00
static char * Macro_Dedicated ( void )
{
if ( isDedicated )
return " 1 " ;
else
return " 0 " ;
}
2012-04-16 12:15:05 +00:00
static char * Macro_Quote ( void )
{
return " \" " ;
}
2015-07-14 14:47:00 +00:00
static char * Macro_Random ( void )
{
Q_snprintfz ( macro_buf , sizeof ( macro_buf ) , " %u " , rand ( ) ) ;
return macro_buf ;
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = =
Cmd_Init
= = = = = = = = = = = =
*/
void Cmd_Init ( void )
{
2019-02-23 09:29:20 +00:00
macro_count = 0 ;
2004-08-21 01:25:48 +00:00
//
// register our commands
//
2017-07-04 05:07:51 +00:00
Cmd_AddCommandAD ( " cfg_save " , Cmd_WriteConfig_f , Cmd_Exec_c , NULL ) ;
2022-03-08 05:31:34 +00:00
Cmd_AddCommandAD ( " cfg_save_ifmodified " , Cmd_WriteConfig_f , Cmd_Exec_c , NULL ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cmd_AddCommandAD ( " saveconfig " , Cmd_WriteConfig_f , Cmd_Exec_c , NULL ) ; //for dpcompat
2005-03-18 06:13:36 +00:00
2017-07-04 05:07:51 +00:00
Cmd_AddCommandAD ( " cfg_load " , Cmd_Exec_f , Cmd_Exec_c , NULL ) ;
2021-05-05 21:59:23 +00:00
Cmd_AddCommand ( " cfg_reset " , Cmd_Reset_f ) ; //ezquake
Cmd_AddCommand ( " resetcfg " , Cmd_Reset_f ) ; //QS
2004-08-30 07:05:41 +00:00
2017-07-04 05:07:51 +00:00
Cmd_AddCommandAD ( " exec " , Cmd_Exec_f , Cmd_Exec_c , NULL ) ;
2004-08-21 01:25:48 +00:00
Cmd_AddCommand ( " echo " , Cmd_Echo_f ) ;
Cmd_AddCommand ( " alias " , Cmd_Alias_f ) ;
2008-01-05 09:58:55 +00:00
Cmd_AddCommand ( " newalias " , Cmd_Alias_f ) ;
2004-08-21 01:25:48 +00:00
Cmd_AddCommand ( " wait " , Cmd_Wait_f ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2004-08-21 01:25:48 +00:00
Cmd_AddCommand ( " cmd " , Cmd_ForwardToServer_f ) ;
2005-09-21 01:14:04 +00:00
Cmd_AddCommand ( " condump " , Cmd_Condump_f ) ;
2017-08-14 16:38:44 +00:00
Cmd_AddCommandAD ( " aliasedit " , Cmd_AliasEdit_f , Key_Alias_c , NULL ) ;
2005-03-12 23:40:42 +00:00
# endif
2004-08-21 01:25:48 +00:00
Cmd_AddCommand ( " restrict " , Cmd_RestrictCommand_f ) ;
2017-08-14 16:38:44 +00:00
Cmd_AddCommandAD ( " aliaslevel " , Cmd_AliasLevel_f , Key_Alias_c , NULL ) ;
2005-03-12 23:40:42 +00:00
2017-08-14 16:38:44 +00:00
Cmd_AddCommandAD ( " showalias " , Cmd_ShowAlias_f , Key_Alias_c , NULL ) ;
2004-08-21 01:25:48 +00:00
2019-07-16 02:59:12 +00:00
Cmd_AddCommandAD ( " toggle " , Cmd_toggle_f , Cmd_Set_c , " Toggles a cvar between two values \n toggle CVARNAME [newval [altval]] " ) ;
2018-05-06 15:55:32 +00:00
Cmd_AddCommandAD ( " set " , Cmd_set_f , Cmd_Set_c , " Changes the current value of the named cvar, creating it if it doesn't yet exist. " ) ;
Cmd_AddCommandAD ( " setfl " , Cmd_set_f , Cmd_Set_c , " Changes the current value of the named cvar, creating it if it doesn't yet exist. The third arg allows setting cvar flags and should be u, s, or a. This command should normally be used only inside default.cfg. " ) ;
Cmd_AddCommandAD ( " set_calc " , Cmd_set_f , Cmd_Set_c , " Sets the named cvar to the result of a (complex) expression. " ) ;
# ifndef QUAKETC
Cmd_AddCommandAD ( " set_tp " , Cmd_set_f , Cmd_Set_c , " Identical to set. Included for compatibility with ezquake where ruleset restrictions on macros are on commands rather than cvars. " ) ;
# endif
Cmd_AddCommandAD ( " seta " , Cmd_set_f , Cmd_Set_c , " Changes the current value of the named cvar, creating it if it doesn't yet exist. Also forces the archive flag so that the cvar will always be written into any saved configs. " ) ;
Cmd_AddCommandAD ( " seta_calc " , Cmd_set_f , Cmd_Set_c , " Sets the named cvar to the result of a (complex) expression. Also forces the archive flag so that the cvar will always be written into any saved configs. " ) ;
2020-02-11 18:06:10 +00:00
Cmd_AddCommandD ( " vstr " , Cmd_Vstr_f , " Executes the string value of the cvar, much like if it were an alias. For compatibility with q3. " ) ;
2018-05-06 15:55:32 +00:00
Cmd_AddCommandAD ( " inc " , Cvar_Inc_f , Cmd_Set_c , " Adds a value to the named cvar. Use a negative value if you wish to decrease the cvar's value. " ) ;
2004-08-21 01:25:48 +00:00
Cmd_AddCommand ( " if " , Cmd_if_f ) ;
Cmd_AddCommand ( " cmdlist " , Cmd_List_f ) ;
Cmd_AddCommand ( " aliaslist " , Cmd_AliasList_f ) ;
2018-07-22 11:49:37 +00:00
Cmd_AddCommandD ( " macrolist " , Cmd_MacroList_f , " Lists all available $macro expansions. " ) ;
Cmd_AddCommandD ( " cvarlist " , Cvar_List_f , " Lists all cvars. eg, 'cvarlist -cvd *' can be used to list all cvars with a value other than the mod's default. " ) ;
Cmd_AddCommandD ( " cvarreset " , Cvar_Reset_f , " Resets the named cvar to its default value. " ) ;
2016-08-25 00:12:14 +00:00
Cmd_AddCommandD ( " cvarwatch " , Cvar_Watch_f , " Prints a notification when the named cvar is changed. Also displays the start/end of configs. Alternatively, use '-watch foo' on the commandline. " ) ;
2013-10-29 17:38:22 +00:00
Cmd_AddCommand ( " cvar_lockdefaults " , Cvar_LockDefaults_f ) ;
2018-07-22 11:49:37 +00:00
Cmd_AddCommandD ( " cvar_purgedefaults " , Cvar_PurgeDefaults_f , " Resets all cvar defaults to back to the engine's default. Does not change their active value. " ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cmd_AddCommandD ( " cvar_resettodefaults_nosaveonly " , Cvar_ResetAll_f , " Resets all unsaved cvars to the mod's default value. " ) ;
Cmd_AddCommandD ( " cvar_resettodefaults_saveonly " , Cvar_ResetAll_f , " Resets all saved cvars to the mod's default value (without changing unsaved cvars). " ) ;
Cmd_AddCommandD ( " cvar_resettodefaults_all " , Cvar_ResetAll_f , " Resets all cvars to the mod's default value. " ) ;
2005-09-21 01:14:04 +00:00
2014-10-05 20:04:11 +00:00
Cmd_AddCommandD ( " apropos " , Cmd_Apropos_f , " Lists all cvars or commands with the specified substring somewhere in their name or descrition. " ) ;
2017-10-13 17:50:28 +00:00
Cmd_AddCommandD ( " find " , Cmd_Apropos_f , " Lists all cvars or commands with the specified substring somewhere in their name or descrition. " ) ;
2014-10-05 20:04:11 +00:00
2015-07-14 14:47:00 +00:00
Cmd_AddMacro ( " random " , Macro_Random , true ) ;
2012-04-16 12:15:05 +00:00
Cmd_AddMacro ( " time " , Macro_Time , true ) ;
2013-05-03 04:28:08 +00:00
Cmd_AddMacro ( " ukdate " , Macro_UKDate , false ) ;
Cmd_AddMacro ( " usdate " , Macro_USDate , false ) ;
Cmd_AddMacro ( " date " , Macro_ProperDate , false ) ;
2012-04-16 12:15:05 +00:00
Cmd_AddMacro ( " version " , Macro_Version , false ) ;
Cmd_AddMacro ( " qt " , Macro_Quote , false ) ;
2017-08-29 02:29:06 +00:00
Cmd_AddMacro ( " dedicated " , Macro_Dedicated , false ) ;
2012-04-16 12:15:05 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2005-02-28 07:16:19 +00:00
Cvar_Register ( & tp_disputablemacros , " Teamplay " ) ;
2018-12-28 00:04:36 +00:00
# endif
2005-02-28 07:16:19 +00:00
2015-07-03 02:07:41 +00:00
Cvar_Register ( & ruleset_allow_in , " Console " ) ;
Cmd_AddCommandD ( " in " , Cmd_In_f , " Issues the given command after a time delay. Disabled if ruleset_allow_in is 0. " ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2020-09-08 05:11:09 +00:00
Cmd_AddCommandD ( " defer " , Cmd_In_f , " Issues the given command after a time delay. Disabled if ruleset_allow_in is 0. " ) ;
2011-05-20 04:10:46 +00:00
Cvar_Register ( & dpcompat_set , " Darkplaces compatibility " ) ;
2017-08-14 16:38:44 +00:00
Cvar_Register ( & dpcompat_console , " Darkplaces compatibility " ) ;
2018-07-22 11:49:37 +00:00
# endif
2013-06-23 02:17:02 +00:00
Cvar_Register ( & cl_warncmd , " Warnings " ) ;
2015-06-12 14:52:15 +00:00
Cvar_Register ( & cfg_save_all , " client operation options " ) ;
2015-09-01 04:45:15 +00:00
Cvar_Register ( & cfg_save_auto , " client operation options " ) ;
2018-04-09 18:01:15 +00:00
Cvar_Register ( & cfg_save_infos , " client operation options " ) ;
Cvar_Register ( & cfg_save_aliases , " client operation options " ) ;
Cvar_Register ( & cfg_save_binds , " client operation options " ) ;
Cvar_Register ( & cfg_save_buttons , " client operation options " ) ;
2011-05-20 04:10:46 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2013-10-29 17:38:22 +00:00
rcon_level . ival = atof ( rcon_level . enginevalue ) ; //client is restricted to not be allowed to change restrictions.
2004-08-21 01:25:48 +00:00
# else
Cvar_Register ( & rcon_level , " Access controls " ) ; //server gains versatility.
# endif
rcon_level . restriction = RESTRICT_MAX ; //default. Don't let anyone change this too easily.
cmd_maxbuffersize . restriction = RESTRICT_MAX ; //filling this causes a loop for quite some time.
Cvar_Register ( & cl_aliasoverlap , " Console " ) ;
//FIXME: go through quake.rc and parameters looking for sets and setas and setting them now.
}