.float move_ltime;
.void(entity this) move_think;
.float move_nextthink;
-.void()move_blocked;
+.void() move_blocked;
.float move_movetype;
.float move_time;
_sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
}
-void func_breakable_init_for_player(entity player)
-{SELFPARAM();
- if (self.noise1 && self.state == 0 && clienttype(player) == CLIENTTYPE_REAL)
+void func_breakable_init_for_player(entity this, entity player)
+{
+ if (this.noise1 && this.state == 0 && clienttype(player) == CLIENTTYPE_REAL)
{
msg_entity = player;
- soundto (MSG_ONE, self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+ soundto (MSG_ONE, this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
}
}
void button_return(entity this)
{
self.state = STATE_DOWN;
- SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
+ SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, button_done);
self.frame = 0; // use normal textures
if (self.health)
self.takedamage = DAMAGE_YES; // can be shot again
}
-void button_fire()
-{SELFPARAM();
+void button_fire(entity this)
+{
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // will be reset upon return
_sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
self.state = STATE_UP;
- SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, button_wait);
+ SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, button_wait);
}
void button_reset(entity this)
return;
this.enemy = actor;
- WITHSELF(this, button_fire());
+ WITHSELF(this, button_fire(this));
}
void button_touch(entity this)
self.enemy = other;
if (other.owner)
self.enemy = other.owner;
- button_fire ();
+ button_fire (self);
}
void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
if (this.health <= 0)
{
this.enemy = damage_attacker;
- WITHSELF(this, button_fire());
+ WITHSELF(this, button_fire(this));
}
}
*/
void door_go_down(entity this);
-void() door_go_up;
+void door_go_up(entity this);
void door_rotating_go_down(entity this);
-void() door_rotating_go_up;
+void door_rotating_go_up(entity this);
void door_blocked()
{SELFPARAM();
if (self.state == STATE_DOWN)
if (self.classname == "door")
{
- door_go_up ();
+ door_go_up (self);
} else
{
- door_rotating_go_up ();
+ door_rotating_go_up (self);
}
else
if (self.classname == "door")
}
self.state = STATE_DOWN;
- SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, door_hit_bottom);
+ SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_hit_bottom);
}
-void door_go_up()
-{SELFPARAM();
+void door_go_up(entity this)
+{
if (self.state == STATE_UP)
return; // already going up
if (self.noise2 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
self.state = STATE_UP;
- SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, door_hit_top);
+ SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_hit_top);
string oldmessage;
oldmessage = self.message;
entity e = this;
do {
if (e.classname == "door") {
- WITHSELF(e, door_go_up());
+ WITHSELF(e, door_go_up(e));
} else {
// if the BIDIR spawnflag (==2) is set and the trigger has set trigger_reverse, reverse the opening direction
if ((e.spawnflags & 2) && other.trigger_reverse!=0 && e.lip != 666 && e.state == STATE_BOTTOM) {
if (!((e.spawnflags & 2) && (e.spawnflags & 8) && e.state == STATE_DOWN
&& (((e.lip == 666) && (other.trigger_reverse == 0)) || ((e.lip != 666) && (other.trigger_reverse != 0)))))
{
- WITHSELF(e, door_rotating_go_up());
+ WITHSELF(e, door_rotating_go_up(e));
}
}
e = e.enemy;
#endif
}
-void door_generic_plat_blocked()
-{SELFPARAM();
+void door_generic_plat_blocked(entity this)
+{
if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
#ifdef SVQC
if (self.wait >= 0)
{
if (self.state == STATE_DOWN)
- door_rotating_go_up ();
+ door_rotating_go_up (self);
else
door_rotating_go_down (self);
}
}
self.state = STATE_DOWN;
- SUB_CalcAngleMove (self.pos1, TSPEED_LINEAR, self.speed, door_rotating_hit_bottom);
+ SUB_CalcAngleMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_rotating_hit_bottom);
}
-void door_rotating_go_up()
-{SELFPARAM();
+void door_rotating_go_up(entity this)
+{
if (self.state == STATE_UP)
return; // already going up
if (self.noise2 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
self.state = STATE_UP;
- SUB_CalcAngleMove (self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top);
+ SUB_CalcAngleMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top);
string oldmessage;
oldmessage = self.message;
door_use(this.owner, other, NULL);
}
-void door_spawnfield(vector fmins, vector fmaxs)
-{SELFPARAM();
+void door_spawnfield(entity this, vector fmins, vector fmaxs)
+{
entity trigger;
vector t1 = fmins, t2 = fmaxs;
*/
entity LinkDoors_nextent(entity cur, entity near, entity pass)
-{SELFPARAM();
- while((cur = find(cur, classname, self.classname)) && ((cur.spawnflags & 4) || cur.enemy))
+{
+ while((cur = find(cur, classname, pass.classname)) && ((cur.spawnflags & 4) || cur.enemy))
{
}
return cur;
if (self.items)
return;
- door_spawnfield(self.absmin, self.absmax);
+ door_spawnfield(self, self.absmin, self.absmax);
return; // don't want to link this door
}
- FindConnectedComponent(self, enemy, LinkDoors_nextent, LinkDoors_isconnected, world);
+ FindConnectedComponent(self, enemy, LinkDoors_nextent, LinkDoors_isconnected, self);
// set owner, and make a loop of the chain
LOG_TRACE("LinkDoors: linking doors:");
if (self.items)
return;
- door_spawnfield(cmins, cmaxs);
+ door_spawnfield(self, cmins, cmaxs);
}
REGISTER_NET_LINKED(ENT_CLIENT_DOOR)
*/
-float door_send(entity to, float sf)
-{SELFPARAM();
+float door_send(entity this, entity to, float sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_DOOR);
WriteByte(MSG_ENTITY, sf);
this.dest1 = this.origin + v_right * (this.t_width * temp);
this.dest2 = this.dest1 + v_forward * this.t_length;
- WITHSELF(this, SUB_CalcMove(this.dest1, TSPEED_LINEAR, this.speed, fd_secret_move1));
+ WITHSELF(this, SUB_CalcMove(this, this.dest1, TSPEED_LINEAR, this.speed, fd_secret_move1));
if (this.noise2 != "")
_sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
}
{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
+ SUB_CalcMove(self, self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
}
// Wait here until time to go back...
{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
+ SUB_CalcMove(self, self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
}
// Wait 1 second...
{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
+ SUB_CalcMove(self, self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
}
void fd_secret_done(entity this)
}
#ifdef SVQC
-bool func_ladder_send(entity to, int sf)
-{SELFPARAM();
+bool func_ladder_send(entity this, entity to, int sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
WriteString(MSG_ENTITY, self.classname);
void func_ladder_link(entity this)
{
- this.SendEntity = func_ladder_send;
- this.SendFlags = 0xFFFFFF;
+ trigger_link(this, func_ladder_send);
//this.model = "null";
}
void plat_delayedinit(entity this)
{
plat_link();
- plat_spawn_inside_trigger(); // the "start moving" trigger
+ plat_spawn_inside_trigger(this); // the "start moving" trigger
}
-float plat_send(entity to, float sf)
-{SELFPARAM();
+float plat_send(entity this, entity to, float sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_PLAT);
WriteByte(MSG_ENTITY, sf);
this.move_angles = this.angles;
this.move_time = time;
- plat_spawn_inside_trigger();
+ plat_spawn_inside_trigger(this);
}
if(sf & SF_TRIGGER_RESET)
ang_x = -ang_x; // flip up / down orientation
if(self.wait > 0) // slow turning
- SUB_CalcAngleMove(ang, TSPEED_TIME, self.SUB_LTIME - time + self.wait, train_wait);
+ SUB_CalcAngleMove(self, ang, TSPEED_TIME, self.SUB_LTIME - time + self.wait, train_wait);
else // instant turning
- SUB_CalcAngleMove(ang, TSPEED_TIME, 0.0000001, train_wait);
+ SUB_CalcAngleMove(self, ang, TSPEED_TIME, 0.0000001, train_wait);
self.train_wait_turning = true;
return;
}
if (targ.speed)
{
if (cp)
- SUB_CalcMove_Bezier(cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
+ SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
else
- SUB_CalcMove(targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
+ SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
}
else
{
if (cp)
- SUB_CalcMove_Bezier(cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
+ SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
else
- SUB_CalcMove(targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
+ SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
}
if(self.noise != "")
REGISTER_NET_LINKED(ENT_CLIENT_TRAIN)
#ifdef SVQC
-float train_send(entity to, float sf)
-{SELFPARAM();
+float train_send(entity this, entity to, float sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRAIN);
WriteByte(MSG_ENTITY, sf);
#endif
}
-void plat_spawn_inside_trigger()
-{SELFPARAM();
+void plat_spawn_inside_trigger(entity this)
+{
entity trigger;
vector tmin, tmax;
{
_sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
self.state = 3;
- SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
+ SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
}
-void plat_go_up()
-{SELFPARAM();
+void plat_go_up(entity this)
+{
_sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
self.state = 4;
- SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
+ SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
}
void plat_center_touch(entity this)
return;
#endif
- if (self.enemy.state == 2)
- WITHSELF(self.enemy, plat_go_up());
- else if (self.enemy.state == 1)
+ if (self.enemy.state == 2) {
+ entity e = self.enemy;
+ WITHSELF(e, plat_go_up(e));
+ } else if (self.enemy.state == 1)
self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
}
if (self.state == 4)
plat_go_down (self);
else if (self.state == 3)
- plat_go_up ();
+ plat_go_up (self);
// when in other states, then the plat_crush event came delayed after
// plat state already had changed
// this isn't a bug per se!
void plat_center_touch(entity this);
void plat_outside_touch(entity this);
void plat_trigger_use(entity this, entity actor, entity trigger);
-void() plat_go_up;
+void plat_go_up(entity this);
void plat_go_down(entity this);
-void() plat_crush;
+void plat_crush();
const float PLAT_LOW_TRIGGER = 1;
.float dmg;
==================
*/
.float friction;
-void SUB_Friction ()
-{SELFPARAM();
+void SUB_Friction (entity this)
+{
self.SUB_NEXTTHINK = time;
if(self.SUB_FLAGS & FL_ONGROUND)
self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction);
float TSPEED_END = 2;
// TODO average too?
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
-{SELFPARAM();
+void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
+{
float traveltime;
entity controller;
WITHSELF(controller, getthink(controller)(controller));
}
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func)
-{SELFPARAM();
+void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
+{
vector delta;
float traveltime;
}
// now just run like a bezier curve...
- SUB_CalcMove_Bezier((self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
+ SUB_CalcMove_Bezier(self, (self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
}
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
{
- WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcMove(ent, tdest, tspeedtype, tspeed, func));
}
/*
}
// FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func)
-{SELFPARAM();
+void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
+{
vector delta;
float traveltime;
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
{
- WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcAngleMove (ent, destangle, tspeedtype, tspeed, func));
}
self.nextthink = time;
}
-void Ent_TriggerMusic_Remove()
-{SELFPARAM();
+void Ent_TriggerMusic_Remove(entity this)
+{
if(self.noise)
strunzone(self.noise);
self.noise = string_null;
void Ent_TriggerMusic_Think(entity this);
-void Ent_TriggerMusic_Remove();
+void Ent_TriggerMusic_Remove(entity this);
#elif defined(SVQC)
void target_music_kill();
.float target_spawn_id;
float target_spawn_count;
-void target_spawn_helper_setmodel()
-{SELFPARAM();
+void target_spawn_helper_setmodel(entity this)
+{
_setmodel(self, self.model);
}
-void target_spawn_helper_setsize()
-{SELFPARAM();
+void target_spawn_helper_setsize(entity this)
+{
setsize(self, self.mins, self.maxs);
}
makevectors (to_angles);
#ifdef SVQC
- SELFPARAM();
if(player.teleportable == TELEPORT_NORMAL) // don't play sounds or show particles for anything that isn't a player, maybe change later to block only observers
{
- if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
+ if(teleporter.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
{
if(tflags & TELEPORT_FLAG_SOUND)
{
Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
Send_Effect(EFFECT_TELEPORT, to + v_forward * 32, '0 0 0', 1);
}
- self.pushltime = time + 0.2;
+ teleporter.pushltime = time + 0.2;
}
}
#endif
}
#ifdef SVQC
-void trigger_push_link();
+void trigger_push_link(entity this);
void trigger_push_updatelink(entity this);
#endif
void trigger_push_findtarget(entity this)
remove(e);
}
- trigger_push_link();
+ trigger_push_link(this);
defer(this, 0.1, trigger_push_updatelink);
#endif
}
this.SendFlags |= 1;
}
-void trigger_push_link()
+void trigger_push_link(entity this)
{
- SELFPARAM();
trigger_link(this, trigger_push_send);
}
#ifdef SVQC
-void secrets_setstatus()
-{SELFPARAM();
+void secrets_setstatus(entity this)
+{
this.stat_secrets_total = secrets_total;
this.stat_secrets_found = secrets_found;
}
/**
* update secrets status.
*/
-void secrets_setstatus();
+void secrets_setstatus(entity this);
#endif
#endif
sv_notice_join(this);
FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
- WITHSELF(it, it.init_for_player(it));
+ it.init_for_player(it, this);
});
MUTATOR_CALLHOOK(ClientConnect, this);
if (frametime) player_anim();
// secret status
- secrets_setstatus();
+ secrets_setstatus(this);
// monsters status
monsters_setstatus(this);
.string cvar_cl_physics;
-.float init_for_player_needed;
-.void(entity) init_for_player;
+.bool init_for_player_needed;
+.void(entity this, entity player) init_for_player;
==================
*/
.float friction;
-void SUB_Friction ();
+void SUB_Friction (entity this);
/*
==================
void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
+void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func);
+void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
void SUB_CalcAngleMoveDone (entity this);
// FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func);
+void SUB_CalcAngleMove (entity this, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func);