mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
}
- DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+ DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
//TODO: use the speed_up cvar too ??
}
MUTATOR_HOOKFUNCTION(nb, ClientDisconnect)
-{SELFPARAM();
- nb_DropBall(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ nb_DropBall(player);
}
MUTATOR_HOOKFUNCTION(nb, PlayerDies)
}
MUTATOR_HOOKFUNCTION(nb, MakePlayerObserver)
-{SELFPARAM();
- nb_DropBall(self);
+{
+ entity player = M_ARGV(0, entity);
+
+ nb_DropBall(player);
return false;
}
MUTATOR_HOOKFUNCTION(nb, SpectateCopy)
{
- SELFPARAM();
- this.metertime = other.metertime;
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.metertime = spectatee.metertime;
}
MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
MUTATOR_HOOKFUNCTION(nb, GetTeamCount)
{
- ret_string = "nexball_team";
+ M_ARGV(1, string) = "nexball_team";
return true;
}
MUTATOR_HOOKFUNCTION(nb, WantWeapon)
{
- ret_float = 0; // weapon is set a few lines later, apparently
+ M_ARGV(1, float) = 0; // weapon is set a few lines later, apparently
return true;
}
}
MUTATOR_HOOKFUNCTION(ons, ClientDisconnect)
-{SELFPARAM();
- self.ons_deathloc = '0 0 0';
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.ons_deathloc = '0 0 0';
}
MUTATOR_HOOKFUNCTION(ons, MakePlayerObserver)
-{SELFPARAM();
- self.ons_deathloc = '0 0 0';
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.ons_deathloc = '0 0 0';
}
MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
}
MUTATOR_HOOKFUNCTION(ons, SpectateCopy)
-{SELFPARAM();
- self.ons_roundlost = other.ons_roundlost; // make spectators see it too
- return false;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too
}
MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
{
+ entity frag_victim = M_ARGV(0, entity);
+
return (frag_victim.classname == "onslaught_generator" && !frag_victim.isshielded)
|| (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
}
MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
{
+ entity turret_target = M_ARGV(1, entity);
+
if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
{
- ret_float = -3;
+ M_ARGV(3, float) = -3;
return true;
}
string output = strcat("models/items/", item_mdl);
#ifdef SVQC
MUTATOR_CALLHOOK(ItemModel, item_mdl, output);
- output = item_model_output;
+ output = M_ARGV(1, string);
#endif
return output;
}
return false;
}
-MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { SELFPARAM(); return buffs_RemovePlayer(self); }
-MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { SELFPARAM(); return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); }
MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
{SELFPARAM();
}
MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor)
-{SELFPARAM();
- if(self.buffs & BUFF_SPEED.m_itemid)
- weapon_rate *= autocvar_g_buffs_speed_rate;
+{
+ entity player = M_ARGV(1, entity);
- if(time < self.buff_disability_time)
- weapon_rate *= autocvar_g_buffs_disability_rate;
+ if(player.buffs & BUFF_SPEED.m_itemid)
+ M_ARGV(0, float) *= autocvar_g_buffs_speed_rate;
- return false;
+ if(time < player.buff_disability_time)
+ M_ARGV(0, float) *= autocvar_g_buffs_disability_rate;
}
MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor)
-{SELFPARAM();
- if(self.buffs & BUFF_SPEED.m_itemid)
- ret_float *= autocvar_g_buffs_speed_weaponspeed;
+{
+ entity player = M_ARGV(1, entity);
- if(time < self.buff_disability_time)
- ret_float *= autocvar_g_buffs_disability_weaponspeed;
+ if(player.buffs & BUFF_SPEED.m_itemid)
+ M_ARGV(0, float) *= autocvar_g_buffs_speed_weaponspeed;
- return false;
+ if(time < player.buff_disability_time)
+ M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed;
}
MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
}
MUTATOR_HOOKFUNCTION(buffs, SpectateCopy)
-{SELFPARAM();
- self.buffs = other.buffs;
- return false;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.buffs = spectatee.buffs;
}
MUTATOR_HOOKFUNCTION(buffs, VehicleEnter)
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver)
-{SELFPARAM();
- instagib_stop_countdown(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ instagib_stop_countdown(player);
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
}
MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
-{SELFPARAM();
- Item_ItemsTime_SetTimesForPlayer(self);
+{
+ entity player = M_ARGV(0, entity);
+
+ Item_ItemsTime_SetTimesForPlayer(player);
}
MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
}
void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
-{SELFPARAM();
+{
if(e.nade == world)
return;
if (trace_startsolid)
setorigin(_nade, e.origin);
- if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(self))
+ if(e.v_angle.x >= 70 && e.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(e))
_nade.velocity = '0 0 100';
else if(autocvar_g_nades_nade_newton_style == 1)
_nade.velocity = e.velocity + _velocity;
else if(autocvar_g_nades_nade_newton_style == 2)
_nade.velocity = _velocity;
else
- _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
+ _nade.velocity = W_CalculateProjectileVelocity(e, e.velocity, _velocity, true);
if(set_owner)
_nade.realowner = e;
return false;
}
-bool nades_RemovePlayer()
-{SELFPARAM();
- nades_Clear(self);
- nades_RemoveBonus(self);
- return false;
+void nades_RemovePlayer(entity this)
+{
+ nades_Clear(this);
+ nades_RemoveBonus(this);
}
-MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { nades_RemovePlayer(); }
-MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { nades_RemovePlayer(); }
-MUTATOR_HOOKFUNCTION(nades, reset_map_global) { nades_RemovePlayer(); }
+MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
+MUTATOR_HOOKFUNCTION(nades, reset_map_global)
+{
+ FOREACH_CLIENT(IS_PLAYER(it),
+ {
+ nades_RemovePlayer(it);
+ });
+}
MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
-{SELFPARAM();
- self.nade_timer = other.nade_timer;
- self.nade_type = other.nade_type;
- self.pokenade_type = other.pokenade_type;
- self.bonus_nades = other.bonus_nades;
- self.bonus_nade_score = other.bonus_nade_score;
- self.stat_healing_orb = other.stat_healing_orb;
- self.stat_healing_orb_alpha = other.stat_healing_orb_alpha;
- return false;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.nade_timer = spectatee.nade_timer;
+ client.nade_type = spectatee.nade_type;
+ client.pokenade_type = spectatee.pokenade_type;
+ client.bonus_nades = spectatee.bonus_nades;
+ client.bonus_nade_score = spectatee.bonus_nade_score;
+ client.stat_healing_orb = spectatee.stat_healing_orb;
+ client.stat_healing_orb_alpha = spectatee.stat_healing_orb_alpha;
}
REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(hmg, refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
}
if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
if(time >= self.jump_interval)
{
- self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
+ self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor(this);
makevectors(self.v_angle);
Weapon oldwep = PS(self).m_weapon;
}
MUTATOR_HOOKFUNCTION(ok, SpectateCopy)
-{SELFPARAM();
- self.ammo_charge[PS(self).m_weapon.m_id] = other.ammo_charge[PS(other).m_weapon.m_id];
- self.ok_use_ammocharge = other.ok_use_ammocharge;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
- return false;
+ client.ammo_charge[PS(client).m_weapon.m_id] = spectatee.ammo_charge[PS(spectatee).m_weapon.m_id];
+ client.ok_use_ammocharge = spectatee.ok_use_ammocharge;
}
MUTATOR_HOOKFUNCTION(ok, SetStartItems)
MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect)
{
- superspec_save_client_conf();
- return false;
+ entity player = M_ARGV(0, entity);
+
+ WITHSELF(player, superspec_save_client_conf());
}
#endif
REGISTER_STAT(WEAPON_NEXTTHINK, float)
#ifdef SVQC
SPECTATE_COPYFIELD(_STAT(WEAPON_NEXTTHINK))
-float W_WeaponRateFactor();
+float W_WeaponRateFactor(entity this);
#endif
-REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor())
+REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
REGISTER_STAT(GAMESTARTTIME, float)
REGISTER_STAT(STRENGTH_FINISHED, float)
return -1;
if(MUTATOR_CALLHOOK(TurretValidateTarget, e_turret, e_target, validate_flags))
- return ret_float;
+ return M_ARGV(3, float);
if (validate_flags & TFL_TARGETSELECT_NO)
return -4;
string output = strcat("weapons/", w_snd);
#ifdef SVQC
MUTATOR_CALLHOOK(WeaponSound, w_snd, output);
- return weapon_sound_output;
+ return M_ARGV(1, string);
#else
return output;
#endif
sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor);
}
actor.arc_BUTTON_ATCK_prev = false;
W_Arc_Attack2();
actor.arc_count = autocvar_g_balance_arc_secondary_count;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
- actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+ actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor(actor);
}
#endif
}
// accelerate
makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0');
- velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor() - (self.velocity * v_forward);
+ velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(self.realowner) - (self.velocity * v_forward);
if(velspeed > 0)
- self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
+ self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(self.realowner) * frametime, velspeed);
// laser guided, or remote detonation
if(PS(self.realowner).m_weapon == WEP_DEVASTATOR)
W_Electro_Attack_Orb(thiswep, actor);
actor.electro_count = WEP_CVAR_SEC(electro, count);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
- actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
+ actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
}
}
}
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(fireball, refire)))
{
W_Fireball_Attack1_Frame0(thiswep, actor, weaponentity, fire);
- actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor();
+ actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor(actor);
}
}
else if(fire & 2)
}
weapon_thinkf(self, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
- self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor();
+ self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
self.hagar_load = 0;
}
sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
// pause until we can load rockets again, once we re-press the alt fire button
- self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
+ self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
// require letting go of the alt fire button before we can load again
self.hagar_loadblock = true;
if(self.hagar_load >= WEP_CVAR_SEC(hagar, load_max))
stopped = true;
else
- self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
+ self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
}
}
if(stopped && !self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame
// if this is the last rocket we can load, play a beep sound to notify the player
sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
self.hagar_loadbeep = true;
- self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor();
+ self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor);
}
}
}
W_Hagar_Attack(thiswep, actor);
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor);
int theframe = WFRAME_FIRE1;
entity this = actor.(weaponentity);
if(this)
}
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor);
W_HLAC_Attack(WEP_HLAC, actor);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
if(actor.hook)
{
// if hooked, no bombs, and increase the timer
- actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor());
+ actor.hook_refire = max(actor.hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor));
// hook also inhibits health regeneration, but only for 1 second
if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
RemoveGrapplingHook(actor);
WITHSELF(actor, FireGrapplingHook());
actor.hook_state &= ~HOOK_FIRING;
- actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
+ actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor(actor));
}
else if (actor.hook_state & HOOK_REMOVING)
{
}
int slot = weaponslot(weaponentity);
// this attack_finished just enforces a cooldown at the end of a burst
- ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
if(self.misc_bulletcounter == 1)
fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor);
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto);
}
if(actor.misc_bulletcounter == 0)
{
int slot = weaponslot(weaponentity);
- ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready);
}
else
return;
}
- this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor();
+ this.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor(this.realowner);
entity own = this.realowner;
makevectors(self.realowner.v_angle);
// calculate swing percentage based on time
- meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
+ meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
entity meleetemp = new_pure(meleetemp);
meleetemp.owner = meleetemp.realowner = actor;
setthink(meleetemp, W_Shockwave_Melee_Think);
- meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
+ meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
}
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
{
W_Shockwave_Attack(actor);
- actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+ actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
}
}
makevectors(self.realowner.v_angle); // update values for v_* vectors
// calculate swing percentage based on time
- meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor();
+ meleetime = WEP_CVAR_SEC(shotgun, melee_time) * W_WeaponRateFactor(this.realowner);
swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
f = ((1 - swing) * WEP_CVAR_SEC(shotgun, melee_traces));
entity meleetemp = new_pure(meleetemp);
meleetemp.realowner = actor;
setthink(meleetemp, W_Shotgun_Melee_Think);
- meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
+ meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor(actor);
W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
}
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
{
W_Shotgun_Attack(thiswep, actor, true);
- actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
+ actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
}
}
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
{
W_Shotgun_Attack(thiswep, actor, false);
- actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
+ actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
}
}
Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
}
- self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
+ self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely
//sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL);
//W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
- proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+ proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
proj.movetype = MOVETYPE_BOUNCEMISSILE;
proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
- proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+ proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
else if (actor.jump_interval <= time)
{
// handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
- actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
+ actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor(actor);
// decrease ammo for the laser?
if(WEP_CVAR_SEC(vaporizer, ammo))
hf = this.dphitcontentsmask;
this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- shotspeed *= W_WeaponSpeedFactor();
- shotspeedupward *= W_WeaponSpeedFactor();
+ shotspeed *= W_WeaponSpeedFactor(this);
+ shotspeedupward *= W_WeaponSpeedFactor(this);
if (!shotspeed)
{
LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " shotspeed is zero!\n");
void PutObserverInServer()
{
SELFPARAM();
- bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver);
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this);
PlayerState_detach(this);
if (IS_PLAYER(this) && this.health >= 1) {
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname);
- MUTATOR_CALLHOOK(ClientDisconnect);
+ MUTATOR_CALLHOOK(ClientDisconnect, this);
ClientState_detach(this);
{
if (this.vehicle) return;
if (IS_DEAD(this)) return;
- W_ThrowWeapon(this, W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
+ W_ThrowWeapon(this, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), '0 0 0', true);
}
IMPULSE(weapon_reload)
if(checkrules_status == WINNING_YES)
bprint("Hey! Someone ran out of spawns!\n");
else if(MUTATOR_CALLHOOK(CheckRules_World, checkrules_status, timelimit, fraglimit))
- checkrules_status = ret_float;
+ checkrules_status = M_ARGV(0, float);
else
checkrules_status = WinningCondition_Scores(fraglimit, leadlimit);
return 0;
bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked);
- d = ret_float;
- allguns = want_allguns;
- allow_mutatorblocked = false;
+ d = M_ARGV(1, float);
+ allguns = M_ARGV(2, bool);
+ allow_mutatorblocked = M_ARGV(3, bool);
if(allguns)
{
/** called when a player becomes observer, after shared setup */
#define EV_MakePlayerObserver(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
/** called when a player disconnects */
#define EV_ClientDisconnect(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
/** called when a player dies to e.g. remove stuff he was carrying */
#define EV_PlayHitsound(i, o) \
- /**/ i(entity, frag_victim) \
+ /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
-entity frag_victim;
MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
/** called when a weapon sound is about to be played, allows custom paths etc. */
#define EV_WeaponSound(i, o) \
- /**/ i(string, weapon_sound) \
- /**/ i(string, weapon_sound_output) \
- /**/ o(string, weapon_sound_output) \
+ /** sound */ i(string, MUTATOR_ARGV_0_string) \
+ /** output */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-string weapon_sound;
-string weapon_sound_output;
MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
/** called when an item model is about to be set, allows custom paths etc. */
#define EV_ItemModel(i, o) \
- /**/ i(string, item_model) \
- /**/ i(string, item_model_output) \
- /**/ o(string, item_model_output) \
+ /** model */ i(string, MUTATOR_ARGV_0_string) \
+ /** output */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-string item_model;
-string item_model_output;
MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
/** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
/** called when the match ends */
MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
-/** should adjust ret_float to contain the team count */
+/** should adjust number to contain the team count */
#define EV_GetTeamCount(i, o) \
- /**/ i(float, ret_float) \
- /**/ o(float, ret_float) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** number of teams */ i(float, MUTATOR_ARGV_0_float) \
+ /**/ o(float, MUTATOR_ARGV_0_float) \
+ /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-float ret_float;
MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
/** copies variables for spectating "other" to "self" */
#define EV_SpectateCopy(i, o) \
- /**/ i(entity, other) \
- /**/ i(entity, __self) \
+ /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** client */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
/** allows changing attack rate */
#define EV_WeaponRateFactor(i, o) \
- /**/ i(float, weapon_rate) \
- /**/ o(float, weapon_rate) \
+ /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
+ /**/ o(float, MUTATOR_ARGV_0_float) \
+ /** player */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
-float weapon_rate;
MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
/** allows changing weapon speed (projectiles mostly) */
#define EV_WeaponSpeedFactor(i, o) \
- /**/ i(float, ret_float) \
- /**/ o(float, ret_float) \
+ /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
+ /**/ o(float, MUTATOR_ARGV_0_float) \
+ /** player */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
* }
*/
#define EV_SV_ParseClientCommand(i, o) \
- /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
- /** command name */ i(string, MUTATOR_ARGV_1_string) \
- /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
+ /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** command name */ i(string, MUTATOR_ARGV_1_string) \
+ /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
/** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
/**/
MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
/**/ i(string, ret_string) \
/**/ o(string, ret_string) \
/**/
+//string ret_string;
MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
/** called when an item is about to respawn */
/** called when player triggered kill (or is changing teams), return error to not do anything */
#define EV_ClientKill(i, o) \
- /** player */ i(entity, __self) \
- /* kill delay */ i(float, ret_float) \
- /* kill delay */ o(float, ret_float) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
/**/
MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
#define EV_FixClientCvars(i, o) \
- /**/ i(entity, fix_client) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
-entity fix_client;
MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
#define EV_SpectateSet(i, o) \
};
#define EV_CheckRules_World(i, o) \
- /* status */ i(float, ret_float) \
- /* status */ o(float, ret_float) \
- /* time limit */ i(float, checkrules_timelimit) \
- /* frag limit */ i(int, checkrules_fraglimit) \
+ /** status */ i(float, MUTATOR_ARGV_0_float) \
+ /**/ o(float, MUTATOR_ARGV_0_float) \
+ /* time limit */ i(float, MUTATOR_ARGV_1_float) \
+ /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
/**/
-float checkrules_timelimit;
-int checkrules_fraglimit;
MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
#define EV_WantWeapon(i, o) \
- /**/ i(entity, want_weaponinfo) \
- /**/ i(float, ret_float) \
- /**/ o(float, ret_float) \
- /**/ i(bool, want_allguns) \
- /**/ o(bool, want_allguns) \
- /**/ i(bool, want_mutatorblocked) \
- /**/ o(bool, want_mutatorblocked) \
- /**/
-entity want_weaponinfo;
-bool want_allguns;
-bool want_mutatorblocked;
+ /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** do want? */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
+ /**/ o(bool, MUTATOR_ARGV_2_bool) \
+ /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
+ /**/ o(bool, MUTATOR_ARGV_3_bool) \
+ /**/
MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
#define EV_AddPlayerScore(i, o) \
- /**/ i(int, score_field) \
- /**/ i(float, ret_float) \
- /**/ o(float, ret_float) \
+ /** score field */ i(int, MUTATOR_ARGV_0_int) \
+ /** score */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /** player */ i(entity, MUTATOR_ARGV_2_entity) \
/**/
-int score_field;
MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
#define EV_GetPlayerStatus(i, o) \
MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
#define EV_TurretValidateTarget(i, o) \
- /**/ i(entity, turret_this) \
- /**/ i(entity, turret_target) \
- /**/ i(int, turret_vflags) \
+ /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
+ /** target score */ o(float, MUTATOR_ARGV_3_float) \
/**/
-entity turret_this;
-entity turret_target;
-int turret_vflags;
MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
#define EV_TurretThink(i, o) \
MUTATOR_HOOKFUNCTION(as, PlayHitsound)
{
+ entity frag_victim = M_ARGV(0, entity);
+
return (frag_victim.classname == "func_assault_destructible");
}
MUTATOR_HOOKFUNCTION(as, CheckRules_World)
{
- ret_float = WinningCondition_Assault();
+ M_ARGV(0, float) = WinningCondition_Assault();
return true;
}
ca_teams = autocvar_g_ca_teams_override;
if (ca_teams < 2) ca_teams = autocvar_g_ca_teams;
ca_teams = bound(2, ca_teams, 4);
- ret_float = ca_teams;
ScoreRules_basics(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, true);
ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
MUTATOR_HOOKFUNCTION(ca, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_float = ca_teams;
- return false;
+ M_ARGV(0, float) = ca_teams;
}
entity ca_LastPlayerForTeam()
MUTATOR_HOOKFUNCTION(ca, ClientDisconnect)
{
- SELFPARAM();
- if (this.caplayer == 1)
+ entity player = M_ARGV(0, entity);
+
+ if (player.caplayer == 1)
ca_LastPlayerForTeam_Notify();
- return 1;
+ return true;
}
MUTATOR_HOOKFUNCTION(ca, ForbidPlayerScore_Clear)
MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
{
- SELFPARAM();
- if (!IS_DEAD(this))
+ entity player = M_ARGV(0, entity);
+
+ if (!IS_DEAD(player))
ca_LastPlayerForTeam_Notify();
- if (this.killindicator_teamchange == -2)
- this.caplayer = 0;
- if (this.caplayer)
- this.frags = FRAGS_LMS_LOSER;
+ if (player.killindicator_teamchange == -2)
+ player.caplayer = 0;
+ if (player.caplayer)
+ player.frags = FRAGS_LMS_LOSER;
if (!warmup_stage)
eliminatedPlayers.SendFlags |= 1;
return true; // prevent team reset
MUTATOR_HOOKFUNCTION(ca, WantWeapon)
{
- want_allguns = true;
- return false;
+ M_ARGV(2, bool) = true; // all weapons
}
MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
- flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false);
+ flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, flag_velocity, false);
ctf_Handle_Drop(flag, player, droptype);
break;
}
default:
case DROP_NORMAL:
{
- flag.velocity = W_CalculateProjectileVelocity(player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
+ flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
ctf_Handle_Drop(flag, player, droptype);
break;
}
}
MUTATOR_HOOKFUNCTION(ctf, MakePlayerObserver)
-{SELFPARAM();
- ctf_RemovePlayer(self);
+{
+ entity player = M_ARGV(0, entity);
+
+ ctf_RemovePlayer(player);
return false;
}
MUTATOR_HOOKFUNCTION(ctf, ClientDisconnect)
-{SELFPARAM();
- ctf_RemovePlayer(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ ctf_RemovePlayer(player);
}
MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
MUTATOR_HOOKFUNCTION(ctf, GetTeamCount)
{
- //ret_float = ctf_teams;
- ret_string = "ctf_team";
+ //M_ARGV(0, float) = ctf_teams;
+ M_ARGV(1, string) = "ctf_team";
return true;
}
MUTATOR_HOOKFUNCTION(ctf, SpectateCopy)
-{SELFPARAM();
- self.ctf_flagstatus = other.ctf_flagstatus;
- return false;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.ctf_flagstatus = spectatee.ctf_flagstatus;
}
MUTATOR_HOOKFUNCTION(ctf, GetRecords)
}
MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver)
-{SELFPARAM();
- if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
- self.frags = FRAGS_LMS_LOSER;
+{
+ entity player = M_ARGV(0, entity);
+
+ if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+ player.frags = FRAGS_LMS_LOSER;
else
- self.frags = FRAGS_SPECTATOR;
+ player.frags = FRAGS_SPECTATOR;
- race_PreparePlayer(this);
- self.race_checkpoint = -1;
+ race_PreparePlayer(player);
+ player.race_checkpoint = -1;
return false;
}
void ClientKill_Now();
MUTATOR_HOOKFUNCTION(cts, ClientKill)
{
- SELFPARAM();
- ret_float = 0;
+ entity player = M_ARGV(0, entity);
- if(self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
+ M_ARGV(1, float) = 0; // kill delay
+
+ if(player.killindicator && player.killindicator.health == 1) // player.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
{
- remove(self.killindicator);
- self.killindicator = world;
+ remove(player.killindicator);
+ player.killindicator = world;
- ClientKill_Now(); // allow instant kill in this case
+ WITHSELF(player, ClientKill_Now()); // allow instant kill in this case
return;
}
-
}
MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint)
MUTATOR_HOOKFUNCTION(cts, FixClientCvars)
{
- stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n");
- return false;
+ entity player = M_ARGV(0, entity);
+
+ stuffcmd(player, "cl_cmd settemp cl_movecliptokeyboard 2\n");
}
MUTATOR_HOOKFUNCTION(cts, WantWeapon)
{
- ret_float = (want_weaponinfo == WEP_SHOTGUN);
- want_mutatorblocked = true;
+ M_ARGV(1, float) = (M_ARGV(0, entity) == WEP_SHOTGUN); // want weapon = weapon info
+ M_ARGV(3, bool) = true; // want mutator blocked
return true;
}
MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
{
// fallback?
- ret_float = domination_teams;
- ret_string = "dom_team";
+ M_ARGV(0, float) = domination_teams;
+ string ret_string = "dom_team";
entity head = find(world, classname, ret_string);
while(head)
head = find(head, classname, ret_string);
}
- ret_string = string_null;
+ M_ARGV(1, string) = string_null;
return true;
}
// Hook Functions
// ==============
-void ft_RemovePlayer()
-{SELFPARAM();
- self.health = 0; // neccessary to update correctly alive stats
- if(!STAT(FROZEN, self))
+void ft_RemovePlayer(entity this)
+{
+ this.health = 0; // neccessary to update correctly alive stats
+ if(!STAT(FROZEN, this))
freezetag_LastPlayerForTeam_Notify();
- freezetag_Unfreeze(world);
+ WITHSELF(this, freezetag_Unfreeze(world));
freezetag_count_alive_players();
}
MUTATOR_HOOKFUNCTION(ft, ClientDisconnect)
{
- ft_RemovePlayer();
- return 1;
+ entity player = M_ARGV(0, entity);
+
+ ft_RemovePlayer(player);
+ return true;
}
MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver)
{
- ft_RemovePlayer();
+ entity player = M_ARGV(0, entity);
+
+ ft_RemovePlayer(player);
return false;
}
MUTATOR_HOOKFUNCTION(ft, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_float = freezetag_teams;
- return false;
+ M_ARGV(0, float) = freezetag_teams;
}
MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
MUTATOR_HOOKFUNCTION(inv, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_float = invasion_teams;
- return false;
+ M_ARGV(0, float) = invasion_teams;
}
MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
}
MUTATOR_HOOKFUNCTION(ka, ClientDisconnect)
-{SELFPARAM();
- if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
}
MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver)
-{SELFPARAM();
- if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
return false;
}
kh_Key_AssignTo(key, world);
makevectors(player.v_angle);
- key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
+ key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
key.pusher = world;
key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
key.kh_dropperteam = key.team;
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT(key, INFO_KEYHUNT_LOST), player.netname);
kh_Key_AssignTo(key, world);
makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
- key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
+ key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
key.pusher = mypusher;
key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
if(suicide)
// register this as a mutator
MUTATOR_HOOKFUNCTION(kh, ClientDisconnect)
-{SELFPARAM();
- kh_Key_DropAll(self, true);
- return 0;
+{
+ entity player = M_ARGV(0, entity);
+
+ kh_Key_DropAll(player, true);
}
MUTATOR_HOOKFUNCTION(kh, MakePlayerObserver)
-{SELFPARAM();
- kh_Key_DropAll(self, true);
- return 0;
+{
+ entity player = M_ARGV(0, entity);
+
+ kh_Key_DropAll(player, true);
}
MUTATOR_HOOKFUNCTION(kh, PlayerDies)
MUTATOR_HOOKFUNCTION(kh, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_float = kh_teams;
- return false;
+ M_ARGV(0, float) = kh_teams;
}
MUTATOR_HOOKFUNCTION(kh, SpectateCopy)
-{SELFPARAM();
- self.kh_state = other.kh_state;
- return 0;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.kh_state = spectatee.kh_state;
}
MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
}
MUTATOR_HOOKFUNCTION(lms, ClientDisconnect)
-{SELFPARAM();
- lms_RemovePlayer(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ lms_RemovePlayer(player);
}
MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
{
- SELFPARAM();
- lms_RemovePlayer(this);
+ entity player = M_ARGV(0, entity);
+
+ lms_RemovePlayer(player);
return true; // prevent team reset
}
MUTATOR_HOOKFUNCTION(lms, CheckRules_World)
{
- ret_float = WinningCondition_LMS();
+ M_ARGV(0, float) = WinningCondition_LMS();
return true;
}
MUTATOR_HOOKFUNCTION(lms, WantWeapon)
{
- want_allguns = true;
- return false;
+ M_ARGV(2, bool) = true; // all weapons
}
MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus)
MUTATOR_HOOKFUNCTION(lms, AddPlayerScore)
{
if(gameover)
- if(score_field == SP_LMS_RANK)
+ if(M_ARGV(0, int) == SP_LMS_RANK) // score field
return true; // allow writing to this field in intermission as it is needed for newly joining players
return false;
}
}
MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(g_race_qualifying)
- if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
- self.frags = FRAGS_LMS_LOSER;
+ if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+ player.frags = FRAGS_LMS_LOSER;
else
- self.frags = FRAGS_SPECTATOR;
-
- race_PreparePlayer(this);
- self.race_checkpoint = -1;
+ player.frags = FRAGS_SPECTATOR;
- return false;
+ race_PreparePlayer(player);
+ player.race_checkpoint = -1;
}
MUTATOR_HOOKFUNCTION(rc, PlayerSpawn)
MUTATOR_HOOKFUNCTION(rc, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_float = race_teams;
- return false;
+ M_ARGV(0, float) = race_teams;
}
MUTATOR_HOOKFUNCTION(rc, Scores_CountFragsRemaining)
MUTATOR_HOOKFUNCTION(rc, FixClientCvars)
{
- stuffcmd(fix_client, "cl_cmd settemp cl_movecliptokeyboard 2\n");
- return false;
+ entity player = M_ARGV(0, entity);
+
+ stuffcmd(player, "cl_cmd settemp cl_movecliptokeyboard 2\n");
}
MUTATOR_HOOKFUNCTION(rc, CheckRules_World)
{
+ float checkrules_timelimit = M_ARGV(1, float);
+ float checkrules_fraglimit = M_ARGV(2, float);
+
if(checkrules_timelimit >= 0)
{
if(!g_race_qualifying)
{
- ret_float = WinningCondition_Race(checkrules_fraglimit);
+ M_ARGV(0, float) = WinningCondition_Race(checkrules_fraglimit);
return true;
}
else if(g_race_qualifying == 2)
{
- ret_float = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
+ M_ARGV(0, float) = WinningCondition_QualifyingThenRace(checkrules_fraglimit);
return true;
}
}
MUTATOR_HOOKFUNCTION(tdm, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
- ret_string = "tdm_team";
+ M_ARGV(1, string) = "tdm_team";
return true;
}
float PlayerScore_Add(entity player, float scorefield, float score)
{
- bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score);
- score = ret_float;
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
+ score = M_ARGV(1, float);
if(gameover)
if(!mutator_returnvalue)
string teament_name = string_null;
bool mutator_returnvalue = MUTATOR_CALLHOOK(GetTeamCount, dm, teament_name);
- teament_name = ret_string;
- dm = ret_float;
+ dm = M_ARGV(0, float);
+ teament_name = M_ARGV(1, string);
if(!mutator_returnvalue)
{
//if(w_shotdir != prevdir) { printf("SERVER: shotDIR differs: %s - %s\n", vtos(w_shotdir), vtos(prevdir)); }
}
-vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute)
+vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
{
vector mdirection;
float mspeed;
vector outvelocity;
- mvelocity = mvelocity * W_WeaponSpeedFactor();
+ mvelocity = mvelocity * W_WeaponSpeedFactor(actor);
mdirection = normalize(mvelocity);
mspeed = vlen(mvelocity);
LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
#endif
- proj.velocity = W_CalculateProjectileVelocity(proj.owner.velocity, pSpeed * dir, forceAbsolute);
+ proj.velocity = W_CalculateProjectileVelocity(proj.owner, proj.owner.velocity, pSpeed * dir, forceAbsolute);
}
#define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
#define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
-vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute);
+vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute);
#if 0
float mspercallsum;
.float weapon_frametime;
-float W_WeaponRateFactor()
+float W_WeaponRateFactor(entity this)
{
float t = 1.0 / g_weaponratefactor;
- MUTATOR_CALLHOOK(WeaponRateFactor, t);
- t = weapon_rate;
+ MUTATOR_CALLHOOK(WeaponRateFactor, t, this);
+ t = M_ARGV(0, float);
return t;
}
-float W_WeaponSpeedFactor()
+float W_WeaponSpeedFactor(entity this)
{
float t = 1.0 * g_weaponspeedfactor;
- MUTATOR_CALLHOOK(WeaponSpeedFactor, t);
- t = ret_float;
+ MUTATOR_CALLHOOK(WeaponSpeedFactor, t, this);
+ t = M_ARGV(0, float);
return t;
}
ATTACK_FINISHED(actor, slot) = time;
// dprint("resetting attack finished to ", ftos(time), "\n");
}
- ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * W_WeaponRateFactor();
+ ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * W_WeaponRateFactor(actor);
}
actor.bulletcounter += 1;
// dprint("attack finished ", ftos(ATTACK_FINISHED(actor, slot)), "\n");
if (this.weapon_think == w_ready && func != w_ready && this.state == WS_RAISE) backtrace(
"Tried to override initial weapon think function - should this really happen?");
- t *= W_WeaponRateFactor();
+ t *= W_WeaponRateFactor(actor);
// VorteX: haste can be added here
if (this.weapon_think == w_ready)
void W_WeaponFrame(Player actor);
-float W_WeaponRateFactor();
+float W_WeaponRateFactor(entity this);
-float W_WeaponSpeedFactor();
+float W_WeaponSpeedFactor(entity this);
bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);