added waitms

This commit is contained in:
myT 2022-04-12 04:18:32 +02:00
parent 9e445bc284
commit 1544a61cfc
2 changed files with 22 additions and 1 deletions

View file

@ -4,6 +4,8 @@ See the end of this file for known issues.
DD Mmm 20 - 1.53
add: /waitms <milliseconds> to delay command executions by the specified number of milliseconds
add: r_alphaToCoverageMipBoost <0.0 to 0.5> (default: 0.125) boosts the alpha value of higher mip levels
with A2C enabled, it prevents alpha-tested surfaces from fading (too much) in the distance

View file

@ -34,7 +34,8 @@ typedef struct {
int cursize;
} cmd_t;
static int cmd_wait;
static int cmd_wait; // how many more frames to wait for
static int cmd_wait_stop; // the time when the wait ends
static cmd_t cmd_text;
static byte cmd_text_buf[MAX_CMD_BUFFER];
@ -52,6 +53,19 @@ static void Cmd_Wait_f( void )
}
static void Cmd_WaitMS_f( void )
{
const char* const arg0 = Cmd_Argv( 0 );
const int duration = atoi( Cmd_Argv( 1 ) );
if ( Cmd_Argc() != 2 || duration <= 0 ) {
Com_Printf( "usage: %s milliseconds\n", arg0 );
return;
}
cmd_wait_stop = Sys_Milliseconds() + duration;
}
static void Cmd_Help_f()
{
const char* const arg0 = Cmd_Argv( 0 );
@ -163,6 +177,10 @@ void Cbuf_Execute()
break;
}
if ( cmd_wait_stop > Sys_Milliseconds() )
break;
cmd_wait_stop = 0;
// find a \n or ; line break
text = (char *)cmd_text.data;
@ -741,6 +759,7 @@ static const cmdTableItem_t cl_cmds[] =
{ "vstr", Cmd_Vstr_f, Cmd_CompleteVstr_f, "executes the string value of a cvar" },
{ "echo", Cmd_Echo_f, NULL, "prints the arguments to the console" },
{ "wait", Cmd_Wait_f, NULL, "delays command execution by N frames" },
{ "waitms", Cmd_WaitMS_f, NULL, "delays command execution by N milliseconds" },
{ "help", Cmd_Help_f, Cmd_CompleteHelp_f, "displays the help of a cvar or command" },
{ "man", Cmd_Help_f, Cmd_CompleteHelp_f, "displays the help of a cvar or command" },
{ "searchhelp", Cmd_SearchHelp_f, NULL, "lists all cvars+cmds whose help matches" }