Having more than one var tracking one state can lead to bugs.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
IN_Move ();
// send mouse move to csqc
- if (cl.csqc_loaded && cl_csqc_generatemousemoveevents.integer)
+ if (CLVM_prog->loaded && cl_csqc_generatemousemoveevents.integer)
{
if (cl.csqc_wantsmousemove)
{
CL_UpdateViewModel();
// when csqc is loaded, it will call this in CSQC_UpdateView
- if (!cl.csqc_loaded)
+ if (!CLVM_prog->loaded)
{
// clear the CL_Mesh_Scene() used for some engine effects
CL_MeshEntities_Scene_Clear();
// if CSQC is loaded, it is required to provide the CSQC_UpdateView function,
// and won't render a view if it does not call that.
- if (cl.csqc_loaded)
+ if (CLVM_prog->loaded)
CL_VM_UpdateView(r_stereo_side ? 0.0 : max(0.0, cl.time - cl.oldtime));
else
{
// csqc stuff:
// server entity number corresponding to a clientside entity
unsigned short csqc_server2csqcentitynumber[MAX_EDICTS];
- qbool csqc_loaded;
vec3_t csqc_vieworigin;
vec3_t csqc_viewangles;
vec3_t csqc_vieworiginfromengine;
void CL_VM_PreventInformationLeaks(void)
{
prvm_prog_t *prog = CLVM_prog;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return;
CSQC_BEGIN
VM_ClearTraceGlobals(prog);
void CL_VM_UpdateDmgGlobals (int dmg_take, int dmg_save, vec3_t dmg_origin)
{
prvm_prog_t *prog = CLVM_prog;
- if(cl.csqc_loaded)
+ if(prog->loaded)
{
CSQC_BEGIN
PRVM_clientglobalfloat(dmg_take) = dmg_take;
void CSQC_UpdateNetworkTimes(double newtime, double oldtime)
{
prvm_prog_t *prog = CLVM_prog;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return;
CSQC_BEGIN
PRVM_clientglobalfloat(servertime) = newtime;
prvm_prog_t *prog = CLVM_prog;
qbool r;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return false;
CSQC_BEGIN
emptyvector[1] = 0;
emptyvector[2] = 0;
// vec3_t oldangles;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return false;
R_TimeReport("pre-UpdateView");
CSQC_BEGIN
qbool CL_VM_ConsoleCommand(const char *text, size_t textlen)
{
prvm_prog_t *prog = CLVM_prog;
- return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.CSQC_ConsoleCommand, false, cl.csqc_server2csqcentitynumber[cl.playerentity], cl.time, cl.csqc_loaded, "QC function CSQC_ConsoleCommand is missing");
+ return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.CSQC_ConsoleCommand, false, cl.csqc_server2csqcentitynumber[cl.playerentity], cl.time, "QC function CSQC_ConsoleCommand is missing");
}
qbool CL_VM_Parse_TempEntity (void)
prvm_prog_t *prog = CLVM_prog;
int t;
qbool r = false;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return false;
CSQC_BEGIN
if(PRVM_clientfunction(CSQC_Parse_TempEntity))
return;
}
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
{
Cbuf_AddText(cmd_local, msg);
return;
size_t writebytes = min(msg_len + 1, MAX_INPUTLINE - cl.csqc_printtextbuf_len);
CSQC_BEGIN
- if(cl.csqc_loaded && PRVM_clientfunction(CSQC_Parse_Print))
+ if(prog->loaded && PRVM_clientfunction(CSQC_Parse_Print))
{
if(msg[msg_len - 1] != '\n' && msg[msg_len - 1] != '\r')
{
prvm_prog_t *prog = CLVM_prog;
int restorevm_tempstringsbuf_cursize;
CSQC_BEGIN
- if(cl.csqc_loaded && PRVM_clientfunction(CSQC_Parse_CenterPrint))
+ if(prog->loaded && PRVM_clientfunction(CSQC_Parse_CenterPrint))
{
PRVM_clientglobalfloat(time) = cl.time;
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
void CL_VM_UpdateIntermissionState (int intermission)
{
prvm_prog_t *prog = CLVM_prog;
- if(cl.csqc_loaded)
+ if(prog->loaded)
{
CSQC_BEGIN
PRVM_clientglobalfloat(intermission) = intermission;
void CL_VM_UpdateShowingScoresState (int showingscores)
{
prvm_prog_t *prog = CLVM_prog;
- if(cl.csqc_loaded)
+ if(prog->loaded)
{
CSQC_BEGIN
PRVM_clientglobalfloat(sb_showscores) = showingscores;
{
prvm_prog_t *prog = CLVM_prog;
qbool r = false;
- if(cl.csqc_loaded)
+ if(prog->loaded)
{
CSQC_BEGIN
if(PRVM_clientfunction(CSQC_Event_Sound))
int localcoop;
int localdeathmatch;
- if(cl.csqc_loaded)
+ if(prog->loaded)
{
if(gametype == GAME_COOP)
{
{
prvm_prog_t *prog = CLVM_prog;
float r = 0;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
return 0;
CSQC_BEGIN
if(PRVM_clientfunction(CSQC_Event))
{
prvm_prog_t *prog = CLVM_prog;
unsigned short entnum, oldself, realentnum;
- if(!cl.csqc_loaded)
+ if(!prog->loaded)
{
Host_Error ("CSQC_ReadEntities: CSQC is not loaded");
return;
// Once CSQC_Init was called, we consider csqc code fully initialized.
prog->inittime = host.realtime;
- cl.csqc_loaded = true;
-
cl.csqc_vidvars.drawcrosshair = false;
cl.csqc_vidvars.drawenginesbar = false;
Cmd_ClearCSQCCommands(cmd_local);
//Cvar_SetValueQuick(&csqc_progcrc, -1);
//Cvar_SetValueQuick(&csqc_progsize, -1);
- if(!cl.csqc_loaded)
- return;
CSQC_BEGIN
if (prog->loaded)
{
PRVM_Prog_Reset(prog);
CSQC_END
Con_DPrint("CSQC ^1unloaded\n");
- cl.csqc_loaded = false;
}
qbool CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out)
qbool MP_ConsoleCommand(const char *text, size_t textlen)
{
prvm_prog_t *prog = MVM_prog;
- return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.GameCommand, false, -1, 0, prog->loaded, "QC function GameCommand is missing");
+ return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.GameCommand, false, -1, 0, "QC function GameCommand is missing");
}
/*
prog->error_cmd("%s: Bad string", prog->name);
}
-qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, qbool prog_loaded, const char *error_message)
+qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, const char *error_message)
{
int restorevm_tempstringsbuf_cursize;
int save_self = 0; // hush compiler warning
qbool r = false;
- if(!prog_loaded)
+ if(!prog->loaded)
return false;
if(func)
void VM_CheckEmptyString (prvm_prog_t *prog, const char *s);
/// Returns the length of the *out string excluding the \0 terminator.
size_t VM_VarString(prvm_prog_t *prog, int first, char *out, size_t outsize);
-qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, qbool prog_loaded, const char *error_message);
+qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, const char *error_message);
prvm_stringbuffer_t *BufStr_FindCreateReplace (prvm_prog_t *prog, int bufindex, unsigned flags, const char *format);
void BufStr_Set(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer, int strindex, const char *str);
void BufStr_Del(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer);
qbool SV_VM_ConsoleCommand(const char *text, size_t textlen)
{
prvm_prog_t *prog = SVVM_prog;
- return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.ConsoleCmd, true, PRVM_EDICT_TO_PROG(sv.world.prog->edicts), sv.time, !(!sv.active || !prog || !prog->loaded), "QC function ConsoleCmd is missing");
+ return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.ConsoleCmd, true, PRVM_EDICT_TO_PROG(sv.world.prog->edicts), sv.time, "QC function ConsoleCmd is missing");
}
// #352 void(string cmdname) registercommand (EXT_CSQC)