MUTATOR_HOOKFUNCTION(nb, SendWaypoint)
{
- wp_sendflags &= ~0x80;
- return false;
+ M_ARGV(2, int) &= ~0x80;
}
REGISTER_MUTATOR(nb, g_nexball)
MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
{
- SELFPARAM();
- if(wp_sendflags & 16)
+ entity wp = M_ARGV(0, entity);
+ entity to = M_ARGV(1, entity);
+ int sf = M_ARGV(2, int);
+ int wp_flag = M_ARGV(3, int);
+
+ if(sf & 16)
{
- if(self.owner.classname == "onslaught_controlpoint")
+ if(wp.owner.classname == "onslaught_controlpoint")
{
- entity wp_owner = self.owner;
- entity e = WaypointSprite_getviewentity(wp_sendto);
+ entity wp_owner = wp.owner;
+ entity e = WaypointSprite_getviewentity(to);
if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
}
- if(self.owner.classname == "onslaught_generator")
+ if(wp.owner.classname == "onslaught_generator")
{
- entity wp_owner = self.owner;
+ entity wp_owner = wp.owner;
if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; }
if(wp_owner.health <= 0) { wp_flag |= 2; }
}
}
- return false;
+ M_ARGV(3, int) = wp_flag;
}
MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
MUTATOR_HOOKFUNCTION(ons, TurretThink)
{
- SELFPARAM();
+ entity turret = M_ARGV(0, entity);
+
// ONS uses somewhat backwards linking.
- if(self.target)
+ if(turret.target)
{
- entity e = find(world, targetname, self.target);
+ entity e = find(world, targetname, turret.target);
if (e != world)
- self.team = e.team;
+ turret.team = e.team;
}
- if(self.team != self.tur_head.team)
- turret_respawn(self);
-
- return false;
+ if(turret.team != turret.tur_head.team)
+ turret_respawn(turret);
}
string output = strcat("models/monsters/", m_mdl);
#ifdef SVQC
MUTATOR_CALLHOOK(MonsterModel, m_mdl, output);
- return monster_model_output;
+ return M_ARGV(1, string);
#else
return output;
#endif
int activerealplayers = 0;
int realplayers = 0;
if (MUTATOR_CALLHOOK(Bot_FixCount, activerealplayers, realplayers)) {
- activerealplayers = bot_activerealplayers;
- realplayers = bot_realplayers;
+ activerealplayers = M_ARGV(0, int);
+ realplayers = M_ARGV(1, int);
} else {
FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
if(IS_PLAYER(it))
{SELFPARAM();
if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
return false;
- pl = spec_player;
+ pl = M_ARGV(1, entity);
SetSpectatee(this, pl);
return SpectateSet();
other = find(this.enemy, classname, STR_PLAYER);
if (MUTATOR_CALLHOOK(SpectateNext, this, other))
- other = spec_player;
+ other = M_ARGV(1, entity);
else if (!other)
other = find(other, classname, STR_PLAYER);
switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
{
case MUT_SPECPREV_FOUND:
- other = spec_player;
+ other = M_ARGV(1, entity);
break;
case MUT_SPECPREV_RETURN:
- other = spec_player;
+ other = M_ARGV(1, entity);
return true;
case MUT_SPECPREV_CONTINUE:
default:
/** returns true if dropping the current weapon shall not be allowed at any time including death */
#define EV_ForbidDropCurrentWeapon(i, o) \
- /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
#define EV_SpectateSet(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, spec_player) \
- /**/ o(entity, spec_player) \
+ /** client */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/**/
-entity spec_player;
MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
#define EV_SpectateNext(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, spec_player) \
- /**/ o(entity, spec_player) \
+ /** client */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
#define EV_SpectatePrev(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, spec_player) \
- /**/ o(entity, spec_player) \
- /**/ i(entity, spec_first) \
+ /** client */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
+ /** first */ i(entity, MUTATOR_ARGV_2_entity) \
/**/
-entity spec_first;
MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
enum {
/** called when player triggered kill (or is changing teams), return error to not do anything */
#define EV_Bot_FixCount(i, o) \
- /**/ i(int, bot_activerealplayers) \
- /**/ o(int, bot_activerealplayers) \
- /**/ i(int, bot_realplayers) \
- /**/ o(int, bot_realplayers) \
+ /** active real players */ i(int, MUTATOR_ARGV_0_int) \
+ /**/ o(int, MUTATOR_ARGV_0_int) \
+ /** real players */ i(int, MUTATOR_ARGV_1_int) \
+ /**/ o(int, MUTATOR_ARGV_1_int) \
/**/
-int bot_activerealplayers;
-int bot_realplayers;
MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
#define EV_ClientCommand_Spectate(i, o) \
- /**/ i(entity, __self) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
#define EV_SendWaypoint(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, wp_sendto) \
- /**/ i(int, wp_sendflags) \
- /**/ o(int, wp_sendflags) \
- /**/ i(int, wp_flag) \
- /**/ o(int, wp_flag) \
- /**/
-entity wp_sendto;
-int wp_sendflags;
-int wp_flag;
+ /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** to */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** send flags */ i(int, MUTATOR_ARGV_2_int) \
+ /**/ o(int, MUTATOR_ARGV_2_int) \
+ /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
+ /**/ o(int, MUTATOR_ARGV_3_int) \
+ /**/
MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
#define EV_TurretValidateTarget(i, o) \
MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
#define EV_TurretThink(i, o) \
- /**/ i(entity, __self) \
+ /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
/** */
#define EV_PrepareExplosionByDamage(i, o) \
/** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
- /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
/** called when a monster model is about to be set, allows custom paths etc. */
#define EV_MonsterModel(i, o) \
- /**/ i(string, monster_model) \
- /**/ i(string, monster_model_output) \
- /**/ o(string, monster_model_output) \
+ /** model */ i(string, MUTATOR_ARGV_0_string) \
+ /** output */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-string monster_model;
-string monster_model_output;
MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
/**/
#define EV_Player_ChangeTeam(i, o) \
- /**/ i(entity, __self) \
- /**/ i(float, pct_curteam) \
- /**/ i(float, pct_newteam) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** current team */ i(float, MUTATOR_ARGV_1_float) \
+ /** new team */ i(float, MUTATOR_ARGV_2_float) \
/**/
-float pct_curteam;
-float pct_newteam;
MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
/**/
#define EV_URI_GetCallback(i, o) \
- /**/ i(float, uricb_id) \
- /**/ i(float, uricb_status) \
- /**/ i(string, uricb_data) \
+ /** id */ i(float, MUTATOR_ARGV_0_float) \
+ /** status */ i(float, MUTATOR_ARGV_1_float) \
+ /** data */ i(string, MUTATOR_ARGV_2_string) \
/**/
-float uricb_id;
-float uricb_status;
-string uricb_data;
MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
MUTATOR_HOOKFUNCTION(ca, SpectateSet)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
- if (DIFF_TEAM(spec_player, this))
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
+ if (DIFF_TEAM(targ, client))
return true;
+
return false;
}
MUTATOR_HOOKFUNCTION(ca, SpectateNext)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
{
- spec_player = CA_SpectateNext(this, spec_player);
+ targ = CA_SpectateNext(client, targ);
return true;
}
return false;
MUTATOR_HOOKFUNCTION(ca, SpectatePrev)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+ entity first = M_ARGV(2, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
{
- do { spec_player = spec_player.chain; }
- while(spec_player && DIFF_TEAM(spec_player, this));
+ do { targ = targ.chain; }
+ while(targ && DIFF_TEAM(targ, client));
- if (!spec_player)
+ if (!targ)
{
- for (spec_player = spec_first; spec_player && DIFF_TEAM(spec_player, this); spec_player = spec_player.chain);
+ for (targ = first; targ && DIFF_TEAM(targ, client); targ = targ.chain);
- if (spec_player == this.enemy)
+ if (targ == client.enemy)
return MUT_SPECPREV_RETURN;
}
}
{
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
if (IS_PLAYER(it) || it.caplayer == 1)
- ++bot_activerealplayers;
- ++bot_realplayers;
+ ++M_ARGV(0, int);
+ ++M_ARGV(1, int);
});
return true;
}
MUTATOR_HOOKFUNCTION(ca, ClientCommand_Spectate)
{
- SELFPARAM();
- if (this.caplayer)
+ entity player = M_ARGV(0, entity);
+
+ if (player.caplayer)
{
// they're going to spec, we can do other checks
- if (autocvar_sv_spectate && (IS_SPEC(this) || IS_OBSERVER(this)))
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CA_LEAVE);
+ if (autocvar_sv_spectate && (IS_SPEC(player) || IS_OBSERVER(player)))
+ Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_LEAVE);
return MUT_SPECCMD_FORCE;
}
MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
{
FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
- ++bot_activerealplayers;
- ++bot_realplayers;
+ ++M_ARGV(0, int);
+ ++M_ARGV(1, int);
));
return true;
MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
{
- SELFPARAM();
- if(self.lms_spectate_warning)
+ entity player = M_ARGV(0, entity);
+
+ if(player.lms_spectate_warning)
{
// for the forfeit message...
- self.lms_spectate_warning = 2;
+ player.lms_spectate_warning = 2;
// mark player as spectator
- PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0));
+ PlayerScore_Add(player, SP_LMS_RANK, 666 - PlayerScore_Add(player, SP_LMS_RANK, 0));
}
else
{
- self.lms_spectate_warning = 1;
- sprint(self, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
+ player.lms_spectate_warning = 1;
+ sprint(player, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
return MUT_SPECCMD_RETURN;
}
return MUT_SPECCMD_CONTINUE;