return;
b = PRVM_clientglobaledict(self);
PRVM_clientglobaledict(self) = PRVM_EDICT_TO_PROG(ed);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ed);
prog->ExecuteProgram(prog, PRVM_clientedictfunction(ed, predraw), "CSQC_Predraw: NULL function\n");
PRVM_clientglobaledict(self) = b;
}
PRVM_clientedictfloat(ed, nextthink) = 0;
b = PRVM_clientglobaledict(self);
PRVM_clientglobaledict(self) = PRVM_EDICT_TO_PROG(ed);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ed);
prog->ExecuteProgram(prog, PRVM_clientedictfunction(ed, think), "CSQC_Think: NULL function\n");
PRVM_clientglobaledict(self) = b;
}
// pass in width and height as parameters (EXT_CSQC_1)
PRVM_G_FLOAT(OFS_PARM0) = vid.width;
PRVM_G_FLOAT(OFS_PARM1) = vid.height;
+ PRVM_G_INT(OFS_PARM2) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_UpdateView), "QC function CSQC_UpdateView is missing");
//VectorCopy(oldangles, cl.viewangles);
// Dresk : Reset Dmg Globals Here
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, cmd);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_ConsoleCommand), "QC function CSQC_ConsoleCommand is missing");
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
r = CSQC_RETURNVAL != 0;
t = cl_message.readcount;
PRVM_clientglobalfloat(time) = cl.time;
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Parse_TempEntity), "QC function CSQC_Parse_TempEntity is missing");
r = CSQC_RETURNVAL != 0;
if(!r)
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, msg);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Parse_StuffCmd), "QC function CSQC_Parse_StuffCmd is missing");
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
}
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, msg);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Parse_Print), "QC function CSQC_Parse_Print is missing");
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
}
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, msg);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[cl.playerentity];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Parse_CenterPrint), "QC function CSQC_Parse_CenterPrint is missing");
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
}
VectorCopy(pos, PRVM_G_VECTOR(OFS_PARM5) );
PRVM_G_FLOAT(OFS_PARM6) = speed * 100.0f;
PRVM_G_FLOAT(OFS_PARM7) = flags; // flags
+ // NOTE: entity parameter can't be used here, as there are not enough offsets available
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Event_Sound), "QC function CSQC_Event_Sound is missing");
r = CSQC_RETURNVAL != 0;
}
{
if(PRVM_clientglobaledict(self))
{
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = cl.csqc_server2csqcentitynumber[realentnum];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Ent_Remove), "QC function CSQC_Ent_Remove is missing");
cl.csqc_server2csqcentitynumber[realentnum] = 0;
}
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[realentnum] = PRVM_EDICT( PRVM_G_INT( OFS_RETURN ) );
}
PRVM_G_FLOAT(OFS_PARM0) = 1;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[realentnum];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Ent_Update), "QC function CSQC_Ent_Update is missing");
}
else {
PRVM_G_FLOAT(OFS_PARM0) = 0;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = cl.csqc_server2csqcentitynumber[realentnum];
prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Ent_Update), "QC function CSQC_Ent_Update is missing");
}
}
PRVM_clientglobaledict(self) = entnum;
VectorCopy(origin, PRVM_G_VECTOR(OFS_PARM0));
VectorCopy(ang, PRVM_G_VECTOR(OFS_PARM1));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM2) = entnum;
VectorCopy(forward, PRVM_clientglobalvector(v_forward));
VectorScale(left, -1, PRVM_clientglobalvector(v_right));
VectorCopy(up, PRVM_clientglobalvector(v_up));
.float clipgroup;
//description:
//If two entities have this field set to the same non-zero integer value, they won't collide with each other.
+
+//EXT_ENTITYPARAM
+//idea: TimePath
+//darkplaces implementation: Mario
+//description:
+//shows that the engine supports the "entity e" parameter in most builtin functions that make use of the global ("self" or "other" for example) entity
+//Note: mods are required to modify progsdefs.qc to include the parameters in the builtin functions they wish to access
host_client->clientconnectcalled = false;
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientDisconnect), "QC function ClientDisconnect is missing");
PRVM_serverglobaledict(self) = saveSelf;
}
{
Con_DPrint("Calling SV_ChangeTeam\n");
prog->globals.fp[OFS_PARM0] = playercolor;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = PRVM_EDICT_TO_PROG(host_client->edict);
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_ChangeTeam), "QC function SV_ChangeTeam is missing");
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientKill), "QC function ClientKill is missing");
}
Con_DPrint("Calling RestoreGame\n");
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(RestoreGame), "QC function RestoreGame is missing");
}
}
host_client->clientconnectcalled = true;
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
if (cls.state == ca_dedicated)
Con_Printf("%s connected\n", host_client->name);
PRVM_serverglobalfloat(time) = sv.time;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");
}
msg->allowoverflow = true;
PRVM_G_INT(OFS_PARM0) = sv.writeentitiestoclient_cliententitynumber;
PRVM_G_FLOAT(OFS_PARM1) = sendflags;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM2) = number;
PRVM_serverglobaledict(self) = number;
prog->ExecuteProgram(prog, PRVM_serveredictfunction(ed, SendEntity), "Null SendEntity\n");
msg->allowoverflow = false;
// self = ent
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_OnEntityPreSpawnFunction), "QC function SV_OnEntityPreSpawnFunction is missing");
}
// self = ent
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_OnEntityNoSpawnFunction), "QC function SV_OnEntityNoSpawnFunction is missing");
}
else
// self = ent
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_OnEntityPostSpawnFunction), "QC function SV_OnEntityPostSpawnFunction is missing");
}
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = s->number;
PRVM_serverglobaledict(other) = sv.writeentitiestoclient_cliententitynumber;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = s->number;
+ // optional entity parameter for other (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = sv.writeentitiestoclient_cliententitynumber;
prog->ExecuteProgram(prog, s->customizeentityforclient, "customizeentityforclient: NULL function");
if(!PRVM_G_FLOAT(OFS_RETURN) || !SV_PrepareEntityForSending(PRVM_EDICT_NUM(s->number), s, s->number))
return;
VectorCopy(sv.writeentitiestoclient_eyes[0], PRVM_serverglobalvector(trace_endpos));
VectorCopy(sv.writeentitiestoclient_eyes[0], PRVM_G_VECTOR(OFS_PARM0));
VectorClear(PRVM_G_VECTOR(OFS_PARM1));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM2) = sv.writeentitiestoclient_cliententitynumber;
prog->ExecuteProgram(prog, PRVM_serveredictfunction(ed, camera_transform), "QC function e.camera_transform is missing");
if(!VectorCompare(PRVM_serverglobalvector(trace_endpos), sv.writeentitiestoclient_eyes[0]))
{
// call the progs to get default spawn parms for the new client
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(SetChangeParms), "QC function SetChangeParms is missing");
for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
host_client->spawn_parms[j] = (&PRVM_serverglobalfloat(parm1))[j];
host_client->clientconnectcalled = true;
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");
host_client->begun = true;
}
PRVM_serverglobalfloat(trace_dphitcontents) = 0;
PRVM_serverglobalfloat(trace_dphitq3surfaceflags) = 0;
PRVM_serverglobalstring(trace_dphittexturename) = 0;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(touch);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(touch, touch), "QC function self.touch is missing");
}
PRVM_serveredictfloat(ent, nextthink) = 0;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
PRVM_serverglobaledict(other) = PRVM_EDICT_TO_PROG(prog->edicts);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(ent, think), "QC function self.think is missing");
// mods often set nextthink to time to cause a think every frame,
// we don't want to loop in that case, so exit if the new nextthink is
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(e1);
PRVM_serverglobaledict(other) = PRVM_EDICT_TO_PROG(e2);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(e1);
+ // optional entity parameter for other (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = PRVM_EDICT_TO_PROG(e2);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(e1, touch), "QC function self.touch is missing");
}
PRVM_serverglobalfloat(trace_dphitcontents) = 0;
PRVM_serverglobalfloat(trace_dphitq3surfaceflags) = 0;
PRVM_serverglobalstring(trace_dphittexturename) = 0;
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(e2);
+ // optional entity parameter for other (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = PRVM_EDICT_TO_PROG(e1);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(e2, touch), "QC function self.touch is missing");
}
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(pusher);
PRVM_serverglobaledict(other) = PRVM_EDICT_TO_PROG(check);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(pusher);
+ // optional entity parameter for other (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = PRVM_EDICT_TO_PROG(check);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(pusher, blocked), "QC function self.blocked is missing");
}
break;
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
PRVM_serverglobaledict(other) = PRVM_EDICT_TO_PROG(prog->edicts);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serveredictfunction(ent, think), "QC function self.think is missing");
}
}
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobalfloat(frametime) = 0;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPreThink), "QC function PlayerPreThink is missing");
PRVM_serverglobalfloat(frametime) = sv.frametime;
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobalfloat(frametime) = 0;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPostThink), "QC function PlayerPostThink is missing");
PRVM_serverglobalfloat(frametime) = sv.frametime;
// call standard client pre-think
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPreThink), "QC function PlayerPreThink is missing");
// make sure the velocity is still sane (not a NaN)
// call standard player post-think
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(ent);
prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPostThink), "QC function PlayerPostThink is missing");
// make sure the velocity is still sane (not a NaN)
{
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM0) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_PlayerPhysics), "QC function SV_PlayerPhysics is missing");
SV_CheckVelocity(host_client->edict);
return;
int restorevm_tempstringsbuf_cursize;
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, s);
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ PRVM_G_INT(OFS_PARM1) = PRVM_EDICT_TO_PROG(host_client->edict);
PRVM_serverglobalfloat(time) = sv.time;
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(SV_ParseClientCommand), "QC function SV_ParseClientCommand is missing");
"TW_SV_STEPCONTROL "
"ZQ_PAUSE "
"DP_RM_CLIPGROUP "
+"EXT_ENTITYPARAM "
//"EXT_CSQC " // not ready yet
;