From 2ca5f6a72d0242f2e4c0d6cc33dd396b31000719 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 23 Jun 2009 19:11:15 +0000 Subject: [PATCH] * don't expand cvars in comments * improve text definition of alias * fix SDL cd loop bug git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9032 d7cf8633-e32d-0410-b094-e92efae38249 --- cd_sdl.c | 2 +- cmd.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cd_sdl.c b/cd_sdl.c index 66ab1b6f..abb8cfbe 100644 --- a/cd_sdl.c +++ b/cd_sdl.c @@ -70,7 +70,7 @@ void CDAudio_SysSetVolume (float volume) int CDAudio_SysPlay (int track) { - return SDL_CDPlayTracks(cd, track, 0, 1, 0); + return SDL_CDPlayTracks(cd, track-1, 0, 1, 0); } int CDAudio_SysStop (void) diff --git a/cmd.c b/cmd.c index fad9aa4d..b684a0ca 100644 --- a/cmd.c +++ b/cmd.c @@ -876,7 +876,7 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t * /* Cmd_PreprocessString -Preprocesses strings and replaces $*, $param#, $cvar accordingly +Preprocesses strings and replaces $*, $param#, $cvar accordingly. Also strips comments. */ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned maxoutlen, cmdalias_t *alias ) { const char *in; @@ -983,9 +983,11 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma --eat; } } - } else { - outtext[outlen++] = *in++; } + else if( *in == '/' && *(in+1) == '/') // comment line starting + break; + else + outtext[outlen++] = *in++; } outtext[outlen] = 0; } @@ -1140,7 +1142,7 @@ void Cmd_Init_Commands (void) Cmd_AddCommand ("stuffcmds",Cmd_StuffCmds_f, "execute commandline parameters (must be present in quake.rc script)"); Cmd_AddCommand ("exec",Cmd_Exec_f, "execute a script file"); Cmd_AddCommand ("echo",Cmd_Echo_f, "print a message to the console (useful in scripts)"); - Cmd_AddCommand ("alias",Cmd_Alias_f, "create a script function (parameters are passed in as $1 through $9, and $* for all parameters)"); + Cmd_AddCommand ("alias",Cmd_Alias_f, "create a script function (parameters are passed in as $X (being X a number), $* for all parameters, $X- for all parameters starting from $X). Without arguments show the list of all alias"); Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "send a console commandline to the server (used by some mods)"); Cmd_AddCommand ("wait", Cmd_Wait_f, "make script execution wait for next rendered frame"); Cmd_AddCommand ("set", Cvar_Set_f, "create or change the value of a console variable"); -- 2.39.2