Merge pull request #610 from 0lvin/for_review

Add ioquake3 vstr/nextdemo support
This commit is contained in:
Yamagi 2020-10-08 10:24:30 +02:00 committed by GitHub
commit 257075c928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 1 deletions

View file

@ -129,6 +129,11 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
spawned in maps (in fact, some official Ground Zero maps contain
these entities). This cvar is set to 0 by default.
* **nextdemo**: Defines the next command to run after maps from the
`nextserver` list. By default this is set to the empty string.
* **nextserver**: Used for looping the introduction demos.
## Audio
* **al_device**: OpenAL device to use. In most cases there's no need to

View file

@ -21,3 +21,5 @@ original clients (Vanilla Quake II) commands are still in place.
* **listmaps**: Lists available maps for the player to load. Maps from
loaded pak files will be listed first followed by maps placed in
the current game's maps folder.
* **vstr**: Inserts the current value of a variable as command text.

View file

@ -366,6 +366,9 @@ Cbuf_AddLateCommands(void)
return ret;
}
/*
* Execute a script file
*/
void
Cmd_Exec_f(void)
{
@ -401,6 +404,21 @@ Cmd_Exec_f(void)
FS_FreeFile(f);
}
/*
* Inserts the current value of a variable as command text
*/
void Cmd_Vstr_f( void ) {
const char *v;
if (Cmd_Argc() != 2) {
Com_Printf("vstr <variablename> : execute a variable command\n");
return;
}
v = Cvar_VariableString(Cmd_Argv(1));
Cbuf_InsertText(va("%s\n", v));
}
/*
* Just prints the rest of the line to the console
*/
@ -1111,6 +1129,7 @@ Cmd_Init(void)
/* register our commands */
Cmd_AddCommand("cmdlist", Cmd_List_f);
Cmd_AddCommand("exec", Cmd_Exec_f);
Cmd_AddCommand("vstr", Cmd_Vstr_f);
Cmd_AddCommand("echo", Cmd_Echo_f);
Cmd_AddCommand("alias", Cmd_Alias_f);
Cmd_AddCommand("wait", Cmd_Wait_f);

View file

@ -440,7 +440,10 @@ SV_Map(qboolean attractloop, char *levelstring, qboolean loadgame)
}
else
{
Cvar_Set("nextserver", "");
// use next demo command if list of map commands as empty
Cvar_Set("nextserver", (char*)Cvar_VariableString("nextdemo"));
// and cleanup nextdemo
Cvar_Set("nextdemo", "");
}
/* hack for end game screen in coop mode */