if ((e->render.colormap > 0 && e->render.colormap <= cl.maxclients) || e->render.colormap >= 1024)
{
- int cb;
unsigned char *cbcolor;
int palcol;
if (e->render.colormap >= 1024)
else
palcol = cl.scores[e->render.colormap-1].colors;
- cb = (palcol & 0xF) << 4;cb += (cb >= 128 && cb < 224) ? 4 : 12;
- cbcolor = (unsigned char *) (&palette_complete[cb]);
+ cbcolor = (unsigned char *) (&palette_pantscolormap[palcol & 0xF]);
e->render.colormap_pantscolor[0] = cbcolor[0] * (1.0f / 255.0f);
e->render.colormap_pantscolor[1] = cbcolor[1] * (1.0f / 255.0f);
e->render.colormap_pantscolor[2] = cbcolor[2] * (1.0f / 255.0f);
- cb = (palcol & 0xF0);cb += (cb >= 128 && cb < 224) ? 4 : 12;
- cbcolor = (unsigned char *) (&palette_complete[cb]);
+ cbcolor = (unsigned char *) (&palette_shirtcolormap[(palcol & 0xF0) >> 4]);
e->render.colormap_shirtcolor[0] = cbcolor[0] * (1.0f / 255.0f);
e->render.colormap_shirtcolor[1] = cbcolor[1] * (1.0f / 255.0f);
e->render.colormap_shirtcolor[2] = cbcolor[2] * (1.0f / 255.0f);
qboolean CL_VM_ConsoleCommand (const char *cmd)
{
int restorevm_tempstringsbuf_cursize;
- qboolean r;
- if(!cl.csqc_loaded || !prog->funcoffsets.CSQC_ConsoleCommand)
+ qboolean r = false;
+ if(!cl.csqc_loaded)
return false;
CSQC_BEGIN
+ if (prog->funcoffsets.CSQC_ConsoleCommand)
+ {
prog->globals.client->time = cl.time;
restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(cmd);
PRVM_ExecuteProgram(prog->funcoffsets.CSQC_ConsoleCommand, "QC function CSQC_ConsoleCommand is missing");
vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
r = CSQC_RETURNVAL;
+ }
CSQC_END
return r;
}
CSQC_END
}
+void CL_VM_UpdateIntermissionState (int intermission)
+{
+ prvm_eval_t *val;
+ if(cl.csqc_loaded)
+ {
+ CSQC_BEGIN
+ val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.intermission);
+ if(val)
+ val->_float = intermission;
+ CSQC_END
+ }
+}
+void CL_VM_UpdateCoopDeathmatchGlobals (int gametype)
+{
+ // Avoid global names for clean(er) coding
+ int localcoop;
+ int localdeathmatch;
+
+ prvm_eval_t *val;
+ if(cl.csqc_loaded)
+ {
+ if(gametype == GAME_COOP)
+ {
+ localcoop = 1;
+ localdeathmatch = 0;
+ }
+ else
+ if(gametype == GAME_DEATHMATCH)
+ {
+ localcoop = 0;
+ localdeathmatch = 1;
+ }
+ else
+ {
+ // How did the ServerInfo send an unknown gametype?
+ // Better just assign the globals as 0...
+ localcoop = 0;
+ localdeathmatch = 0;
+ }
+ CSQC_BEGIN
+ val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.coop);
+ if(val)
+ val->_float = localcoop;
+ val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.deathmatch);
+ if(val)
+ val->_float = localdeathmatch;
+ CSQC_END
+ }
+}
+
float CL_VM_Event (float event) //[515]: needed ? I'd say "YES", but don't know for what :D
{
float r = 0;
fs_offset_t csprogsdatasize;
int csprogsdatacrc, requiredcrc;
int requiredsize;
+ prvm_eval_t *val;
// reset csqc_progcrc after reading it, so that changing servers doesn't
// expect csqc on the next server
prog->globals.client->mapname = PRVM_SetEngineString(cl.worldmodel->name);
prog->globals.client->player_localentnum = cl.playerentity;
+ // set map description (use world entity 0)
+ val = PRVM_EDICTFIELDVALUE(prog->edicts, prog->fieldoffsets.message);
+ if(val)
+ val->string = PRVM_SetEngineString(cl.levelname);
+
// call the prog init
PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Init, "QC function CSQC_Init is missing");
cl.csqc_vidvars.drawcrosshair = false;
cl.csqc_vidvars.drawenginesbar = false;
+
+ // Update Coop and Deathmatch Globals (at this point the client knows them from ServerInfo)
+ CL_VM_UpdateCoopDeathmatchGlobals(cl.gametype);
}
void CL_VM_ShutDown (void)