l = (int)strlen(text);
Cbuf_Lock(cmd);
- if (cmd->text.cursize + l >= (size_t)cmd->text.maxsize)
+ if (cmd->text.maxsize - cmd->text.cursize <= l)
Con_Print("Cbuf_AddText: overflow\n");
else
SZ_Write(&cmd->text, (const unsigned char *)text, l);
*/
static void Cbuf_Execute_Deferred (cmd_state_t *cmd)
{
- static double oldrealtime = 0;
cmddeferred_t *defcmd, *prev;
double eat;
- if (realtime - oldrealtime < 0 || realtime - oldrealtime > 1800) oldrealtime = realtime;
- eat = realtime - oldrealtime;
+ if (realtime - cmd->deferred_oldrealtime < 0 || realtime - cmd->deferred_oldrealtime > 1800) cmd->deferred_oldrealtime = realtime;
+ eat = realtime - cmd->deferred_oldrealtime;
if (eat < (1.0 / 120.0))
return;
- oldrealtime = realtime;
+ cmd->deferred_oldrealtime = realtime;
prev = NULL;
defcmd = cmd->deferred_list;
while(defcmd)
// better than CRASHING on overlong input lines that may SOMEHOW enter the buffer
if(i >= MAX_INPUTLINE)
{
- Con_Printf("Warning: console input buffer had an overlong line. Ignored.\n");
+ Con_Warnf("Warning: console input buffer had an overlong line. Ignored.\n");
line[0] = 0;
}
else
"sys_ticrate 0.01388889\n"
"r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
case GAME_NEHAHRA:
"sys_ticrate 0.01388889\n"
"r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
// hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
"sys_ticrate 0.02\n"
"r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
// rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
"sys_ticrate 0.01388889\n"
"r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
case GAME_TENEBRAE:
"sys_ticrate 0.01388889\n"
"r_shadow_gloss 2\n"
"r_shadow_bumpscale_basetexture 4\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
case GAME_NEXUIZ:
"sys_ticrate 0.01388889\n"
"sv_gameplayfix_q2airaccelerate 1\n"
"sv_gameplayfix_stepmultipletimes 1\n"
+"csqc_polygons_defaultmaterial_nocullface 1\n"
+ );
+ break;
+ case GAME_XONOTIC:
+ case GAME_VORETOURNAMENT:
+ // compatibility for versions prior to 2020-05-25, this can be overridden in newer versions to get the default behavior and be consistent with FTEQW engine
+ Cbuf_InsertText(cmd, "\n"
+"csqc_polygons_defaultmaterial_nocullface 1\n"
);
break;
// Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1
"sv_gameplayfix_downtracesupportsongroundflag 1\n"
"sys_ticrate 0.01388889\n"
"cl_csqc_generatemousemoveevents 0\n"
+"csqc_polygons_defaultmaterial_nocullface 1\n"
);
break;
default:
"sv_gameplayfix_swiminbmodels 1\n"
"sv_gameplayfix_downtracesupportsongroundflag 1\n"
"sys_ticrate 0.01388889\n"
+"csqc_polygons_defaultmaterial_nocullface 0\n"
);
break;
}
{
// empty cvar name?
if(alias)
- Con_Printf("Warning: Could not expand $ in alias %s\n", alias->name);
+ Con_Warnf("Warning: Could not expand $ in alias %s\n", alias->name);
else
- Con_Printf("Warning: Could not expand $\n");
+ Con_Warnf("Warning: Could not expand $\n");
return "$";
}
if(required)
{
if(alias)
- Con_Printf("Error: Could not expand $%s in alias %s\n", varname, alias->name);
+ Con_Errorf("Error: Could not expand $%s in alias %s\n", varname, alias->name);
else
- Con_Printf("Error: Could not expand $%s\n", varname);
+ Con_Errorf("Error: Could not expand $%s\n", varname);
return NULL;
}
else if(optional)
else
{
if(alias)
- Con_Printf("Warning: Could not expand $%s in alias %s\n", varname, alias->name);
+ Con_Warnf("Warning: Could not expand $%s in alias %s\n", varname, alias->name);
else
- Con_Printf("Warning: Could not expand $%s\n", varname);
+ Con_Warnf("Warning: Could not expand $%s\n", varname);
dpsnprintf(varval, sizeof(varval), "$%s", varname);
return varval;
}
//
// client-only commands
Cmd_AddCommand(&cmd_client, "cmd", Cmd_ForwardToServer_f, "send a console commandline to the server (used by some mods)");
+ Cmd_AddCommand(&cmd_clientfromserver, "cmd", Cmd_ForwardToServer_f, "send a console commandline to the server (used by some mods)");
Cmd_AddCommand(&cmd_client, "wait", Cmd_Wait_f, "make script execution wait for next rendered frame");
Cmd_AddCommand(&cmd_client, "cprint", Cmd_Centerprint_f, "print something at the screen center");
return buf;
}
-void Cmd_ClearCsqcFuncs (cmd_state_t *cmd)
+// TODO: Make this more generic?
+void Cmd_ClearCSQCCommands (cmd_state_t *cmd)
{
cmd_function_t *func;
- for (func = cmd->userdefined->csqc_functions; func; func = func->next)
- func->csqcfunc = false;
+ cmd_function_t **next = &cmd->userdefined->csqc_functions;
+
+ while(*next)
+ {
+ func = *next;
+ *next = func->next;
+ Z_Free(func);
+ }
}
/*
FIXME: lookupnoadd the token to speed search?
============
*/
+extern hook_t *csqc_concmd;
+
void Cmd_ExecuteString (cmd_state_t *cmd, const char *text, cmd_source_t src, qboolean lockmutex)
{
int oldpos;
{
if (!strcasecmp(cmd->argv[0], func->name))
{
- if (func->csqcfunc && CL_VM_ConsoleCommand(text)) //[515]: csqc
+ if (func->csqcfunc && Hook_Call(csqc_concmd, text)->bval) //[515]: csqc
goto done;
break;
}
// if it's a client command and no command was found, say so.
if (cmd->source == src_client)
{
- Con_Printf("player \"%s\" tried to %s\n", host_client->name, text);
+ Con_Printf("Client \"%s\" tried to execute \"%s\"\n", host_client->name, text);
goto done;
}
}
// check cvars
- if (!Cvar_Command(cmd) && host_framecount > 0)
- Con_Printf("Unknown command \"%s\"\n", Cmd_Argv(cmd, 0));
-
+ if (!Cvar_Command(cmd) && host_framecount > 0) {
+ if (cmd == &cmd_clientfromserver) {
+ Con_Printf("Server tried to execute \"%s\"\n", Cmd_Argv(cmd, 0));
+ } else {
+ Con_Printf("Unknown command \"%s\"\n", Cmd_Argv(cmd, 0));
+ }
+ }
done:
cmd->tokenizebufferpos = oldpos;
if (lockmutex)