From a62687f222272d216e7fb6fa16748f8750643c92 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 10 Jun 2016 17:11:01 +1000 Subject: [PATCH] Fix up even more mutators --- .../gamemodes/gamemode/onslaught/onslaught.qc | 20 +++--- qcsrc/common/monsters/monster/spider.qc | 16 ++--- qcsrc/common/monsters/sv_monsters.qc | 6 +- qcsrc/common/mutators/events.qh | 2 + qcsrc/common/mutators/mutator/buffs/buffs.qc | 12 ++-- .../mutators/mutator/instagib/instagib.qc | 61 ++++++++++--------- .../common/mutators/mutator/midair/midair.qc | 10 +-- qcsrc/server/mutators/events.qh | 37 +++++------ .../mutators/mutator/gamemode_invasion.qc | 16 ++--- .../mutators/mutator/gamemode_keepaway.qc | 12 ++-- 10 files changed, 98 insertions(+), 94 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index fad837f40..58cfe61ea 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -1933,17 +1933,17 @@ MUTATOR_HOOKFUNCTION(ons, PlayerDies) } MUTATOR_HOOKFUNCTION(ons, MonsterMove) -{SELFPARAM(); - entity e = find(world, targetname, self.target); - if (e != world) - self.team = e.team; +{ + entity mon = M_ARGV(0, entity); - return false; + entity e = find(world, targetname, mon.target); + if (e != world) + mon.team = e.team; } void ons_MonsterSpawn_Delayed(entity this) { - entity own = self.owner; + entity own = this.owner; if(!own) { remove(this); return; } @@ -1962,12 +1962,12 @@ void ons_MonsterSpawn_Delayed(entity this) } MUTATOR_HOOKFUNCTION(ons, MonsterSpawn) -{SELFPARAM(); +{ + entity mon = M_ARGV(0, entity); + entity e = spawn(); - e.owner = self; + e.owner = mon; InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET); - - return false; } void ons_TurretSpawn_Delayed(entity this) diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 8727b798d..6ec111b1f 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -68,13 +68,13 @@ MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics) MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove) { - SELFPARAM(); - if(time < self.spider_slowness) + entity mon = M_ARGV(0, entity); + + if(time < mon.spider_slowness) { - monster_speed_run *= 0.5; - monster_speed_walk *= 0.5; + M_ARGV(1, float) *= 0.5; // run speed + M_ARGV(2, float) *= 0.5; // walk speed } - return false; } MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn) @@ -87,9 +87,9 @@ MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn) MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn) { - SELFPARAM(); - self.spider_slowness = 0; - return false; + entity mon = M_ARGV(0, entity); + + mon.spider_slowness = 0; } SOUND(SpiderAttack_FIRE, W_Sound("electro_fire")); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index f641d7944..1ae7e83a9 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -795,9 +795,9 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed) return; } - targ = monster_target; - runspeed = bound(0, monster_speed_run * MONSTER_SKILLMOD(this), runspeed * 2.5); // limit maxspeed to prevent craziness - walkspeed = bound(0, monster_speed_walk * MONSTER_SKILLMOD(this), walkspeed * 2.5); // limit maxspeed to prevent craziness + targ = M_ARGV(3, entity); + runspeed = bound(0, M_ARGV(1, float) * MONSTER_SKILLMOD(this), runspeed * 2.5); // limit maxspeed to prevent craziness + walkspeed = bound(0, M_ARGV(2, float) * MONSTER_SKILLMOD(this), walkspeed * 2.5); // limit maxspeed to prevent craziness if(teamplay) if(autocvar_g_monsters_teams) diff --git a/qcsrc/common/mutators/events.qh b/qcsrc/common/mutators/events.qh index 58f9c43d0..cae6b1984 100644 --- a/qcsrc/common/mutators/events.qh +++ b/qcsrc/common/mutators/events.qh @@ -28,6 +28,8 @@ MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 5) MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 6) MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 7) MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 8) +MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 9) +MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10) #undef MUTATOR_TYPES #undef MUTATOR_NEWGLOBAL diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index b97124a39..ea9511db2 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -671,14 +671,14 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerJump) } MUTATOR_HOOKFUNCTION(buffs, MonsterMove) -{SELFPARAM(); - if(time < self.buff_disability_time) +{ + entity mon = M_ARGV(0, entity); + + if(time < mon.buff_disability_time) { - monster_speed_walk *= autocvar_g_buffs_disability_speed; - monster_speed_run *= autocvar_g_buffs_disability_speed; + M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed + M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed } - - return false; } MUTATOR_HOOKFUNCTION(buffs, PlayerDies) diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index ec96d4626..c913be742 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -153,10 +153,12 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem) } MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterSpawn) -{SELFPARAM(); +{ + entity mon = M_ARGV(0, entity); + // always refill ammo - if(self.monsterid == MON_MAGE.monsterid) - self.skin = 1; + if(mon.monsterid == MON_MAGE.monsterid) + mon.skin = 1; return false; } @@ -196,52 +198,53 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerRegen) } MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups) -{SELFPARAM(); - if (!(self.effects & EF_FULLBRIGHT)) - self.effects |= EF_FULLBRIGHT; +{ + entity player = M_ARGV(0, entity); - if (self.items & ITEM_Invisibility.m_itemid) + if (!(player.effects & EF_FULLBRIGHT)) + player.effects |= EF_FULLBRIGHT; + + if (player.items & ITEM_Invisibility.m_itemid) { - play_countdown(self.strength_finished, SND_POWEROFF); - if (time > self.strength_finished) + play_countdown(player.strength_finished, SND_POWEROFF); + if (time > player.strength_finished) { - self.alpha = default_player_alpha; - self.exteriorweaponentity.alpha = default_weapon_alpha; - self.items &= ~ITEM_Invisibility.m_itemid; - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY); + player.alpha = default_player_alpha; + player.exteriorweaponentity.alpha = default_weapon_alpha; + player.items &= ~ITEM_Invisibility.m_itemid; + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY); } } else { - if (time < self.strength_finished) + if (time < player.strength_finished) { - self.alpha = autocvar_g_instagib_invis_alpha; - self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha; - self.items |= ITEM_Invisibility.m_itemid; - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname); - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); + player.alpha = autocvar_g_instagib_invis_alpha; + player.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha; + player.items |= ITEM_Invisibility.m_itemid; + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, player.netname); + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } } - if (self.items & ITEM_Speed.m_itemid) + if (player.items & ITEM_Speed.m_itemid) { - play_countdown(self.invincible_finished, SND_POWEROFF); - if (time > self.invincible_finished) + play_countdown(player.invincible_finished, SND_POWEROFF); + if (time > player.invincible_finished) { - self.items &= ~ITEM_Speed.m_itemid; - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED); + player.items &= ~ITEM_Speed.m_itemid; + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_SPEED); } } else { - if (time < self.invincible_finished) + if (time < player.invincible_finished) { - self.items |= ITEM_Speed.m_itemid; - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname); - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED); + player.items |= ITEM_Speed.m_itemid; + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, player.netname); + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_SPEED); } } - return false; } .float stat_sv_maxspeed; diff --git a/qcsrc/common/mutators/mutator/midair/midair.qc b/qcsrc/common/mutators/mutator/midair/midair.qc index c9a62f349..cc426a36d 100644 --- a/qcsrc/common/mutators/mutator/midair/midair.qc +++ b/qcsrc/common/mutators/mutator/midair/midair.qc @@ -20,12 +20,14 @@ MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate) } MUTATOR_HOOKFUNCTION(midair, PlayerPowerups) -{SELFPARAM(); +{ + entity player = M_ARGV(0, entity); + if(time >= game_starttime) - if(IS_ONGROUND(self)) + if(IS_ONGROUND(player)) { - self.effects |= (EF_ADDITIVE | EF_FULLBRIGHT); - self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime); + player.effects |= (EF_ADDITIVE | EF_FULLBRIGHT); + player.midair_shieldtime = max(player.midair_shieldtime, time + autocvar_g_midair_shieldtime); } return false; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 9591efbf2..b66b394af 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -214,7 +214,7 @@ MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile); /** called when a monster spawns */ #define EV_MonsterSpawn(i, o) \ - /**/ i(entity, __self) \ + /** monster */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn); @@ -228,23 +228,22 @@ MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies); /** called when a monster dies */ #define EV_MonsterRemove(i, o) \ - /**/ i(entity, rem_mon) \ + /** monster */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ -entity rem_mon; // avoiding ovewriting self & other MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove); /** called when a monster wants to respawn */ #define EV_MonsterRespawn(i, o) \ - /**/ i(entity, other) \ + /** monster */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn); /** called when a monster is dropping loot */ #define EV_MonsterDropItem(i, o) \ - /* monster */ i(entity, MUTATOR_ARGV_0_entity) \ + /* monster */ i(entity, MUTATOR_ARGV_0_entity) \ /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \ - /**/ o(entity, MUTATOR_ARGV_1_entity) \ - /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \ + /**/ o(entity, MUTATOR_ARGV_1_entity) \ + /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \ /**/ .void(entity this) monster_loot; MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem); @@ -254,16 +253,13 @@ MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem); * returning true makes the monster stop */ #define EV_MonsterMove(i, o) \ - /**/ i(entity, __self) \ - /**/ i(float, monster_speed_run) \ - /**/ o(float, monster_speed_run) \ - /**/ i(float, monster_speed_walk) \ - /**/ o(float, monster_speed_walk) \ - /**/ i(entity, monster_target) \ - /**/ -float monster_speed_run; -float monster_speed_walk; -entity monster_target; + /** monster */ i(entity, MUTATOR_ARGV_0_entity) \ + /** run speed */ i(float, MUTATOR_ARGV_1_float) \ + /**/ o(float, MUTATOR_ARGV_1_float) \ + /** walk speed */ i(float, MUTATOR_ARGV_2_float) \ + /**/ o(float, MUTATOR_ARGV_2_float) \ + /** move target */ i(entity, MUTATOR_ARGV_3_entity) \ + /**/ MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove); /** called when a monster looks for another target */ @@ -271,7 +267,7 @@ MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS); /** called to change a random monster to a miniboss */ #define EV_MonsterCheckBossFlag(i, o) \ - /**/ i(entity, __self) \ + /** monster */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag); @@ -345,10 +341,9 @@ MUTATOR_HOOKABLE(W_Reload, EV_W_Reload); /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */ #define EV_PlayerPowerups(i, o) \ - /**/ i(entity, __self) \ - /**/ i(int, olditems) \ + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ + /** old items */ i(int, MUTATOR_ARGV_1_int) \ /**/ -int olditems; MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups); /** diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 5bf26c4b8..d0606853c 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -355,22 +355,24 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies) } MUTATOR_HOOKFUNCTION(inv, MonsterSpawn) -{SELFPARAM(); - if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) +{ + entity mon = M_ARGV(0, entity); + + if(!(mon.spawnflags & MONSTERFLAG_SPAWNED)) return true; - if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) + if(!(mon.spawnflags & MONSTERFLAG_RESPAWNED)) { inv_numspawned += 1; inv_maxcurrent += 1; } - self.monster_skill = inv_monsterskill; + mon.monster_skill = inv_monsterskill; - if((get_monsterinfo(self.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER) - Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, self.monster_name); + if((get_monsterinfo(mon.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER) + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, mon.monster_name); - self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP; + mon.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP; return false; } diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index d13e62200..e9e2efcc2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -423,16 +423,16 @@ MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver) } MUTATOR_HOOKFUNCTION(ka, PlayerPowerups) -{SELFPARAM(); +{ + entity player = M_ARGV(0, entity); + // In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup // So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player() - self.effects &= ~autocvar_g_keepaway_ballcarrier_effects; + player.effects &= ~autocvar_g_keepaway_ballcarrier_effects; - if(self.ballcarried) - self.effects |= autocvar_g_keepaway_ballcarrier_effects; - - return false; + if(player.ballcarried) + player.effects |= autocvar_g_keepaway_ballcarrier_effects; } .float stat_sv_airspeedlimit_nonqw; -- 2.39.2