VM_RETURN_EDICT(chain);
}
-// #34 float() droptofloor
+// #34 float([ent]) droptofloor
static void VM_CL_droptofloor (prvm_prog_t *prog)
{
prvm_edict_t *ent;
// assume failure if it returns early
PRVM_G_FLOAT(OFS_RETURN) = 0;
- ent = PRVM_PROG_TO_EDICT(PRVM_clientglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 0)
+ ent = PRVM_G_EDICT(OFS_PARM0);
+ else
+ ent = PRVM_PROG_TO_EDICT(PRVM_clientglobaledict(self));
if (ent == prog->edicts)
{
VM_Warning(prog, "droptofloor: can not modify world entity\n");
===============
VM_CL_walkmove
-float(float yaw, float dist[, settrace]) walkmove
+float(float yaw, float dist[, settrace, ent]) walkmove
===============
*/
static void VM_CL_walkmove (prvm_prog_t *prog)
int oldself;
qboolean settrace;
- VM_SAFEPARMCOUNTRANGE(2, 3, VM_CL_walkmove);
+ VM_SAFEPARMCOUNTRANGE(2, 4, VM_CL_walkmove);
// assume failure if it returns early
PRVM_G_FLOAT(OFS_RETURN) = 0;
- ent = PRVM_PROG_TO_EDICT(PRVM_clientglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 4)
+ ent = PRVM_G_EDICT(OFS_PARM3);
+ else
+ ent = PRVM_PROG_TO_EDICT(PRVM_clientglobaledict(self));
if (ent == prog->edicts)
{
VM_Warning(prog, "walkmove: can not modify world entity\n");
VM_traceon, // #29 void() traceon (QUAKE)
VM_traceoff, // #30 void() traceoff (QUAKE)
VM_eprint, // #31 void(entity e) eprint (QUAKE)
-VM_CL_walkmove, // #32 float(float yaw, float dist[, float settrace]) walkmove (QUAKE)
+VM_CL_walkmove, // #32 float(float yaw, float dist[, float settrace, entity ent]) walkmove (QUAKE)
NULL, // #33 (QUAKE)
VM_CL_droptofloor, // #34 float() droptofloor (QUAKE)
VM_CL_lightstyle, // #35 void(float style, string value) lightstyle (QUAKE)
void() traceon = #29;
void() traceoff = #30;
void(entity e) eprint = #31;
-// settrace optional
-float(float yaw, float dist, float settrace) walkmove = #32;
+// settrace and ent optional
+float(float yaw, float dist, float settrace, entity ent) walkmove = #32;
float() droptofloor = #34;
void(float style, string value) lightstyle = #35;
prvm_prog_t *prog = SVVM_prog;
vec3_t move, oldorigin;
float delta;
+ int saveSelf;
PRVM_serveredictfloat(ent, ideal_yaw) = yaw;
+
+ // Mario: since changeyaw has no parameters, copy self to ent temporarily (EXT_ENTITYPARAM)
+ saveSelf = PRVM_serverglobaledict(self);
+ PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(ent);
VM_changeyaw(prog);
+ PRVM_serverglobaledict(self) = saveSelf;
yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist;
prvm_edict_t *ent, *goal;
float dist;
- VM_SAFEPARMCOUNT(1, SV_MoveToGoal);
+ VM_SAFEPARMCOUNTRANGE(1, 2, SV_MoveToGoal);
- ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 2)
+ ent = PRVM_G_EDICT(OFS_PARM1);
+ else
+ ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
goal = PRVM_PROG_TO_EDICT(PRVM_serveredictedict(ent, goalentity));
dist = PRVM_G_FLOAT(OFS_PARM0);
If (self.origin + self.viewofs) is not in the PVS of the current target,
it is not returned at all.
-name checkclient ()
+name checkclient ([ent])
=================
*/
int c_invis, c_notvis;
prvm_edict_t *ent, *self;
vec3_t view;
- VM_SAFEPARMCOUNT(0, VM_SV_checkclient);
+ VM_SAFEPARMCOUNTRANGE(0, 1, VM_SV_checkclient);
// find a new check if on a new frame
if (sv.time - sv.lastchecktime >= 0.1)
}
// if current entity can't possibly see the check entity, return 0
- self = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 1)
+ self = PRVM_G_EDICT(OFS_PARM0);
+ else
+ self = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
VectorAdd(PRVM_serveredictvector(self, origin), PRVM_serveredictvector(self, view_ofs), view);
if (sv.worldmodel && checkpvsbytes && !sv.worldmodel->brush.BoxTouchingPVS(sv.worldmodel, checkpvs, view, view))
{
===============
VM_SV_walkmove
-float(float yaw, float dist[, settrace]) walkmove
+float(float yaw, float dist[, settrace, ent]) walkmove
===============
*/
static void VM_SV_walkmove(prvm_prog_t *prog)
int oldself;
qboolean settrace;
- VM_SAFEPARMCOUNTRANGE(2, 3, VM_SV_walkmove);
+ VM_SAFEPARMCOUNTRANGE(2, 4, VM_SV_walkmove);
// assume failure if it returns early
PRVM_G_FLOAT(OFS_RETURN) = 0;
- ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 4)
+ ent = PRVM_G_EDICT(OFS_PARM3);
+ else
+ ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
if (ent == prog->edicts)
{
VM_Warning(prog, "walkmove: can not modify world entity\n");
===============
VM_SV_droptofloor
-void() droptofloor
+void([ent]) droptofloor
===============
*/
// assume failure if it returns early
PRVM_G_FLOAT(OFS_RETURN) = 0;
- ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
+ // optional entity parameter for self (EXT_ENTITYPARAM)
+ if (prog->argc >= 1)
+ ent = PRVM_G_EDICT(OFS_PARM0);
+ else
+ ent = PRVM_PROG_TO_EDICT(PRVM_serverglobaledict(self));
if (ent == prog->edicts)
{
VM_Warning(prog, "droptofloor: can not modify world entity\n");