]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanse the physics hooks
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 08:54:05 +0000 (18:54 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 08:54:05 +0000 (18:54 +1000)
15 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/mutators/events.qh
qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/dodging/dodging.qc
qcsrc/common/mutators/mutator/doublejump/doublejump.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/physics/player.qc
qcsrc/common/weapons/all.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_race.qc

index 110141476dfff629cd8c2e63b573b455bf851515..e624428ec2a319135fa35cf6849b8bd87b57914f 100644 (file)
@@ -1038,13 +1038,14 @@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
-{SELFPARAM();
-       if(self.ballcarried)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ballcarried)
        {
        {
-               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
-               self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
+               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
+               player.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
        }
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
index 6ec111b1f791daf09808baf0fc4b4059521af1ad..ba899548b6b470b01821e706ca748fe09a64d325 100644 (file)
@@ -56,14 +56,14 @@ REGISTER_MUTATOR(spiderweb, true);
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 {
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 {
-    SELFPARAM();
-       if (time >= this.spider_slowness)
+    entity player = M_ARGV(0, entity);
+
+       if (time >= player.spider_slowness)
                return false;
                return false;
-       PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
-       PHYS_MAXAIRSPEED(this) *= 0.5;
-       PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
-       PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
-       return false;
+       PHYS_MAXSPEED(player) *= 0.5; // half speed while slow from spider
+       PHYS_MAXAIRSPEED(player) *= 0.5;
+       PHYS_AIRSPEEDLIMIT_NONQW(player) *= 0.5;
+       PHYS_AIRSTRAFEACCELERATE(player) *= 0.5;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
index 69e077e350066bed614e3c1203c58c569981c0e7..75fc8d31e1508a7037037c1db71e1b7db1c77e8a 100644 (file)
@@ -74,38 +74,33 @@ MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
  * is run AFTER bot code and idle checking on the server
  */
 #define EV_PlayerPhysics(i, o) \
  * is run AFTER bot code and idle checking on the server
  */
 #define EV_PlayerPhysics(i, o) \
-    /**/ i(entity, __self) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
 
 /** called when a player presses the jump key */
 #define EV_PlayerJump(i, o) \
     /**/
 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
 
 /** called when a player presses the jump key */
 #define EV_PlayerJump(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(float, player_multijump) \
-    /**/ i(float, player_jumpheight) \
-    /**/ o(float, player_multijump) \
-    /**/ o(float, player_jumpheight) \
+    /** player */      i(entity, MUTATOR_ARGV_0_entity) \
+    /** jump height */ i(float, MUTATOR_ARGV_1_float) \
+    /**/               o(float, MUTATOR_ARGV_1_float) \
+    /** multijump */   i(bool, MUTATOR_ARGV_2_bool) \
+    /**/               o(bool, MUTATOR_ARGV_2_bool) \
     /**/
     /**/
-float player_multijump;
-float player_jumpheight;
 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
 
 /** called during player physics, allows adjusting the movement type used */
 #define EV_PM_Physics(i, o) \
 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
 
 /** called during player physics, allows adjusting the movement type used */
 #define EV_PM_Physics(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(float, pm_maxspeed_mod) \
+    /** player */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
     /**/
     /**/
-float pm_maxspeed_mod;
 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
 
 /** called when a weapon model is about to be set, allows custom paths etc. */
 #define EV_WeaponModel(i, o) \
 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
 
 /** called when a weapon model is about to be set, allows custom paths etc. */
 #define EV_WeaponModel(i, o) \
-    /**/ i(string, weapon_model) \
-    /**/ i(string, weapon_model_output) \
-    /**/ o(string, weapon_model_output) \
+    /** model */  i(string, MUTATOR_ARGV_0_string) \
+    /** output */ i(string, MUTATOR_ARGV_1_string) \
+    /**/          o(string, MUTATOR_ARGV_1_string) \
     /**/
     /**/
-string weapon_model;
-string weapon_model_output;
 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
 
 #endif
 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
 
 #endif
index cdef3d953171197c8e0371c5c8709a7a8171124b..4cbdfcfb7bd04e6864dce472c3cf0b56bd9aac8b 100644 (file)
@@ -24,8 +24,10 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
-{SELFPARAM();
-       if(self.health <= autocvar_g_bloodloss)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.health <= autocvar_g_bloodloss)
                return true;
 
        return false;
                return true;
 
        return false;
index 492c657d87886d07dd289c4dc53c030355c36b1e..78ced032d827c21df5cd86abf196591de4d9d2b5 100644 (file)
@@ -640,34 +640,34 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn)
 .float stat_sv_jumpvelocity;
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics)
 .float stat_sv_jumpvelocity;
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics)
-{SELFPARAM();
-       if(self.buffs & BUFF_SPEED.m_itemid)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.buffs & BUFF_SPEED.m_itemid)
        {
        {
-               self.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
-               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed;
+               player.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
+               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed;
        }
 
        }
 
-       if(time < self.buff_disability_time)
+       if(time < player.buff_disability_time)
        {
        {
-               self.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed;
-               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
+               player.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed;
+               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
        }
 
        }
 
-       if(self.buffs & BUFF_JUMP.m_itemid)
+       if(player.buffs & BUFF_JUMP.m_itemid)
        {
                // automatically reset, no need to worry
        {
                // automatically reset, no need to worry
-               self.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height;
+               player.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height;
        }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerJump)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerJump)
-{SELFPARAM();
-       if(self.buffs & BUFF_JUMP.m_itemid)
-               player_jumpheight = autocvar_g_buffs_jump_height;
+{
+       entity player = M_ARGV(0, entity);
 
 
-       return false;
+       if(player.buffs & BUFF_JUMP.m_itemid)
+               M_ARGV(1, float) = autocvar_g_buffs_jump_height;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, MonsterMove)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, MonsterMove)
index 7d7ba3939766c318b475cc2ee3843822a867b78e..df25ad4c5965083c67e7cd88c569b1a1bbda7c1b 100644 (file)
@@ -271,27 +271,25 @@ void RaceCarPhysics(entity this)
 #endif
 MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
 {
 #endif
 MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
 {
-    SELFPARAM();
-       if(!PHYS_BUGRIGS(self) || !IS_PLAYER(self)) { return false; }
+    entity player = M_ARGV(0, entity);
+
+       if(!PHYS_BUGRIGS(player) || !IS_PLAYER(player)) { return false; }
 
 #ifdef SVQC
 
 #ifdef SVQC
-       self.angles = self.bugrigs_prevangles;
+       player.angles = player.bugrigs_prevangles;
 #endif
 
 #endif
 
-       RaceCarPhysics(self);
+       RaceCarPhysics(player);
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
 {
        return true;
 }
 
 MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
 {
+       if(!PHYS_BUGRIGS(M_ARGV(0, entity))) { return false; }
 #ifdef SVQC
 #ifdef SVQC
-    SELFPARAM();
+       entity player = M_ARGV(0, entity);
+       player.bugrigs_prevangles = player.angles;
 #endif
 #endif
-       if(!PHYS_BUGRIGS(self)) { return false; }
-#ifdef SVQC
-       self.bugrigs_prevangles = self.angles;
-#endif
-       return false;
 }
 
 #ifdef SVQC
 }
 
 #ifdef SVQC
index 8e2ece08358a689de3a6c9a5f3da4dd48a9d7ccb..98ebe9c986ac032f76848f081ee81a8088a5ab27 100644 (file)
@@ -267,11 +267,11 @@ void PM_dodging_GetPressedKeys(entity this)
 
 MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 {
 
 MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 {
-    SELFPARAM();
+    entity player = M_ARGV(0, entity);
+
        // print("dodging_PlayerPhysics\n");
        // print("dodging_PlayerPhysics\n");
-       PM_dodging_GetPressedKeys(self);
-       PM_dodging(self);
-       return false;
+       PM_dodging_GetPressedKeys(player);
+       PM_dodging(player);
 }
 
 #ifdef SVQC
 }
 
 #ifdef SVQC
index 144e87ae8ef691efa3617680a801c63a8bd81f48..d490ecaaff364d71ad3bc5511c5fb734a2f1cce2 100644 (file)
@@ -15,21 +15,21 @@ REGISTER_MUTATOR(doublejump, true);
 
 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
 {
 
 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
 {
-    SELFPARAM();
-       if (PHYS_DOUBLEJUMP(self))
+    entity player = M_ARGV(0, entity);
+
+       if (PHYS_DOUBLEJUMP(player))
        {
        {
-               tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
+               tracebox(player.origin + '0 0 0.01', player.mins, player.maxs, player.origin - '0 0 0.01', MOVE_NORMAL, player);
                if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
                {
                if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
                {
-                       player_multijump = true;
+                       M_ARGV(2, bool) = true;
 
                        // we MUST clip velocity here!
 
                        // we MUST clip velocity here!
-                       float f = self.velocity * trace_plane_normal;
+                       float f = player.velocity * trace_plane_normal;
                        if (f < 0)
                        if (f < 0)
-                               self.velocity -= f * trace_plane_normal;
+                               player.velocity -= f * trace_plane_normal;
                }
        }
                }
        }
-       return false;
 }
 
 #endif
 }
 
 #endif
index 57afc84a196388fcd2e45cb9480b348299c941ae..ef1856d688dd3f17487017e9ac171d1bee8e5513 100644 (file)
@@ -252,11 +252,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics)
-{SELFPARAM();
-       if(self.items & ITEM_Speed.m_itemid)
-               self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
+{
+       entity player = M_ARGV(0, entity);
 
 
-       return false;
+       if(player.items & ITEM_Speed.m_itemid)
+               player.stat_sv_maxspeed = player.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor)
index 8cd137252e6da426e73ccea71362fc25ae849e5d..cafe5255f150db4f8b0d2a7f4ffc530f856283a8 100644 (file)
@@ -11,12 +11,12 @@ REGISTER_MUTATOR(multijump, cvar("g_multijump"));
 REGISTER_MUTATOR(multijump, true);
 #endif
 
 REGISTER_MUTATOR(multijump, true);
 #endif
 
-#define PHYS_MULTIJUMP                                 STAT(MULTIJUMP, self)
-#define PHYS_MULTIJUMP_SPEED           STAT(MULTIJUMP_SPEED, self)
-#define PHYS_MULTIJUMP_ADD                     STAT(MULTIJUMP_ADD, self)
-#define PHYS_MULTIJUMP_MAXSPEED        STAT(MULTIJUMP_MAXSPEED, self)
-#define PHYS_MULTIJUMP_DODGING                 STAT(MULTIJUMP_DODGING, self)
-#define PHYS_MULTIJUMP_COUNT(s)        STAT(MULTIJUMP_COUNT, s)
+#define PHYS_MULTIJUMP(s)                              STAT(MULTIJUMP, s)
+#define PHYS_MULTIJUMP_SPEED(s)                STAT(MULTIJUMP_SPEED, s)
+#define PHYS_MULTIJUMP_ADD(s)                  STAT(MULTIJUMP_ADD, s)
+#define PHYS_MULTIJUMP_MAXSPEED(s)             STAT(MULTIJUMP_MAXSPEED, s)
+#define PHYS_MULTIJUMP_DODGING(s)              STAT(MULTIJUMP_DODGING, s)
+#define PHYS_MULTIJUMP_COUNT(s)                STAT(MULTIJUMP_COUNT, s)
 
 .bool multijump_ready;
 
 
 .bool multijump_ready;
 
@@ -30,90 +30,85 @@ bool autocvar_cl_multijump = true;
        #define PHYS_MULTIJUMP_CLIENT(s)        (s).cvar_cl_multijump
 #endif
 
        #define PHYS_MULTIJUMP_CLIENT(s)        (s).cvar_cl_multijump
 #endif
 
-bool PM_multijump_checkjump(entity this)
+MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
 {
 {
-       if(!PHYS_MULTIJUMP) { return false; }
+    entity player = M_ARGV(0, entity);
+
+#ifdef CSQC
+       player.multijump_count = PHYS_MULTIJUMP_COUNT(player);
+#endif
+       if(!PHYS_MULTIJUMP(player)) { return; }
+
+       if(IS_ONGROUND(player))
+               player.multijump_count = 0;
+}
 
 
-       int client_multijump = PHYS_MULTIJUMP_CLIENT(this);
+MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(!PHYS_MULTIJUMP(player)) { return false; }
+
+       int client_multijump = PHYS_MULTIJUMP_CLIENT(player);
        if(client_multijump > 1)
                return false; // nope
 
        if(client_multijump > 1)
                return false; // nope
 
-       if (!IS_JUMP_HELD(this) && !IS_ONGROUND(this) && client_multijump) // jump button pressed this frame and we are in midair
-               this.multijump_ready = true;  // this is necessary to check that we released the jump button and pressed it again
+       if (!IS_JUMP_HELD(player) && !IS_ONGROUND(player) && client_multijump) // jump button pressed this frame and we are in midair
+               player.multijump_ready = true;  // this is necessary to check that we released the jump button and pressed it again
        else
        else
-               this.multijump_ready = false;
+               player.multijump_ready = false;
 
 
-       int phys_multijump = PHYS_MULTIJUMP;
+       int phys_multijump = PHYS_MULTIJUMP(player);
 
 
-       if(!player_multijump && this.multijump_ready && (PHYS_MULTIJUMP_COUNT(this) < phys_multijump || phys_multijump == -1) && this.velocity_z > PHYS_MULTIJUMP_SPEED && (!PHYS_MULTIJUMP_MAXSPEED || vlen(this.velocity) <= PHYS_MULTIJUMP_MAXSPEED))
+       if(!M_ARGV(2, bool) && player.multijump_ready && (PHYS_MULTIJUMP_COUNT(player) < phys_multijump || phys_multijump == -1) && player.velocity_z > PHYS_MULTIJUMP_SPEED(player) && 
+               (!PHYS_MULTIJUMP_MAXSPEED(player) || vdist(player.velocity, <=, PHYS_MULTIJUMP_MAXSPEED(player))))
        {
        {
-               if (PHYS_MULTIJUMP)
+               if (PHYS_MULTIJUMP(player))
                {
                {
-                       if (!PHYS_MULTIJUMP_ADD) // in this case we make the z velocity == jumpvelocity
+                       if (!PHYS_MULTIJUMP_ADD(player)) // in this case we make the z velocity == jumpvelocity
                        {
                        {
-                               if (this.velocity_z < PHYS_JUMPVELOCITY(this))
+                               if (player.velocity_z < PHYS_JUMPVELOCITY(player))
                                {
                                {
-                                       player_multijump = true;
-                                       this.velocity_z = 0;
+                                       M_ARGV(2, bool) = true;
+                                       player.velocity_z = 0;
                                }
                        }
                        else
                                }
                        }
                        else
-                               player_multijump = true;
+                               M_ARGV(2, bool) = true;
 
 
-                       if(player_multijump)
+                       if(M_ARGV(2, bool))
                        {
                        {
-                               if(PHYS_MULTIJUMP_DODGING)
-                               if(this.movement_x != 0 || this.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+                               if(PHYS_MULTIJUMP_DODGING(player))
+                               if(player.movement_x != 0 || player.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
                                {
                                        float curspeed;
                                        vector wishvel, wishdir;
 
 /*#ifdef SVQC
                                        curspeed = max(
                                {
                                        float curspeed;
                                        vector wishvel, wishdir;
 
 /*#ifdef SVQC
                                        curspeed = max(
-                                               vlen(vec2(this.velocity)), // current xy speed
-                                               vlen(vec2(antilag_takebackavgvelocity(this, max(this.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
+                                               vlen(vec2(player.velocity)), // current xy speed
+                                               vlen(vec2(antilag_takebackavgvelocity(player, max(player.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
                                        );
 #elif defined(CSQC)*/
                                        );
 #elif defined(CSQC)*/
-                                       curspeed = vlen(vec2(this.velocity));
+                                       curspeed = vlen(vec2(player.velocity));
 //#endif
 
 //#endif
 
-                                       makevectors(this.v_angle_y * '0 1 0');
-                                       wishvel = v_forward * this.movement_x + v_right * this.movement_y;
+                                       makevectors(player.v_angle_y * '0 1 0');
+                                       wishvel = v_forward * player.movement_x + v_right * player.movement_y;
                                        wishdir = normalize(wishvel);
 
                                        wishdir = normalize(wishvel);
 
-                                       this.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
-                                       this.velocity_y = wishdir_y * curspeed;
+                                       player.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
+                                       player.velocity_y = wishdir_y * curspeed;
                                        // keep velocity_z unchanged!
                                }
                                        // keep velocity_z unchanged!
                                }
-                               if (PHYS_MULTIJUMP > 0)
+                               if (PHYS_MULTIJUMP(player) > 0)
                                {
                                {
-                                       this.multijump_count += 1;
+                                       player.multijump_count += 1;
                                }
                        }
                }
                                }
                        }
                }
-               this.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
+               player.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
        }
        }
-
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
-{
-    SELFPARAM();
-#ifdef CSQC
-       this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
-#endif
-       if(!PHYS_MULTIJUMP) { return; }
-
-       if(IS_ONGROUND(this))
-               this.multijump_count = 0;
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
-{
-    SELFPARAM();
-       return PM_multijump_checkjump(this);
 }
 
 #ifdef SVQC
 }
 
 #ifdef SVQC
index e59dc306e3b37a4a96e23dc644e89348288994c2..285b2cb7f9835a65666b5dbb70773b1d5d03166b 100644 (file)
@@ -452,11 +452,11 @@ bool PlayerJump(entity this)
        bool doublejump = false;
        float mjumpheight = PHYS_JUMPVELOCITY(this);
 
        bool doublejump = false;
        float mjumpheight = PHYS_JUMPVELOCITY(this);
 
-       if (MUTATOR_CALLHOOK(PlayerJump, this, doublejump, mjumpheight))
+       if (MUTATOR_CALLHOOK(PlayerJump, this, mjumpheight, doublejump))
                return true;
 
                return true;
 
-       doublejump = player_multijump;
-       mjumpheight = player_jumpheight;
+       mjumpheight = M_ARGV(1, float);
+       doublejump = M_ARGV(2, bool);
 
        if (this.waterlevel >= WATERLEVEL_SWIMMING)
        {
 
        if (this.waterlevel >= WATERLEVEL_SWIMMING)
        {
@@ -587,16 +587,18 @@ void CheckWaterJump(entity this)
 void CheckPlayerJump(entity this)
 {
 #ifdef SVQC
 void CheckPlayerJump(entity this)
 {
 #ifdef SVQC
-       float was_flying = ITEMS_STAT(this) & IT_USING_JETPACK;
+       bool was_flying = boolean(ITEMS_STAT(this) & IT_USING_JETPACK);
 #endif
        if (JETPACK_JUMP(this) < 2)
                ITEMS_STAT(this) &= ~IT_USING_JETPACK;
 
        if(PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this))
        {
 #endif
        if (JETPACK_JUMP(this) < 2)
                ITEMS_STAT(this) &= ~IT_USING_JETPACK;
 
        if(PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this))
        {
-               float air_jump = !PlayerJump(this) || player_multijump; // PlayerJump() has important side effects
-               float activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this);
-               float has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO);
+               bool playerjump = PlayerJump(this); // required
+
+               bool air_jump = !playerjump || M_ARGV(2, bool);
+               bool activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this);
+               bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO);
 
                if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
                else if (this.jetpack_stopped) { }
 
                if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
                else if (this.jetpack_stopped) { }
index 1e1ce3eede1b1b429aae7fbd53e9264eb8dce530..65168e13a331c2cebf305e667e7542328571b4ff 100644 (file)
@@ -272,7 +272,7 @@ string W_Model(string w_mdl)
 {
        string output = strcat("models/weapons/", w_mdl);
        MUTATOR_CALLHOOK(WeaponModel, w_mdl, output);
 {
        string output = strcat("models/weapons/", w_mdl);
        MUTATOR_CALLHOOK(WeaponModel, w_mdl, output);
-       return weapon_model_output;
+       return M_ARGV(1, string);
 }
 
 #ifndef MENUQC
 }
 
 #ifndef MENUQC
index 9079a2f600eacdc90f67dc9fe0e8c9f831169a59..5f2a7eeedc9e5e448913289b544665a737bdf934 100644 (file)
@@ -109,24 +109,26 @@ void CTS_ClientKill(entity e) // silent version of ClientKill, used when player
 }
 
 MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
 }
 
 MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
-{SELFPARAM();
-       self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
-       float f = floor(self.race_movetime_frac);
-       self.race_movetime_frac -= f;
-       self.race_movetime_count += f;
-       self.race_movetime = self.race_movetime_frac + self.race_movetime_count;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
+       float f = floor(player.race_movetime_frac);
+       player.race_movetime_frac -= f;
+       player.race_movetime_count += f;
+       player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
 
 #ifdef SVQC
 
 #ifdef SVQC
-       if(IS_PLAYER(self))
+       if(IS_PLAYER(player))
        {
        {
-               if (self.race_penalty)
-                       if (time > self.race_penalty)
-                               self.race_penalty = 0;
-               if(self.race_penalty)
+               if (player.race_penalty)
+                       if (time > player.race_penalty)
+                               player.race_penalty = 0;
+               if(player.race_penalty)
                {
                {
-                       self.velocity = '0 0 0';
-                       self.movetype = MOVETYPE_NONE;
-                       self.disableclientprediction = 2;
+                       player.velocity = '0 0 0';
+                       player.movetype = MOVETYPE_NONE;
+                       player.disableclientprediction = 2;
                }
        }
 #endif
                }
        }
 #endif
@@ -139,8 +141,8 @@ MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel.x = fabs(self.movement.x);
-       wishvel.y = fabs(self.movement.y);
+       wishvel.x = fabs(player.movement.x);
+       wishvel.y = fabs(player.movement.y);
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
@@ -148,36 +150,34 @@ MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(self.movement.x > 0)
-                               self.movement_x = wishspeed;
+                       if(player.movement.x > 0)
+                               player.movement_x = wishspeed;
                        else
                        else
-                               self.movement_x = -wishspeed;
-                       self.movement_y = 0;
+                               player.movement_x = -wishspeed;
+                       player.movement_y = 0;
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
-                       self.movement_x = 0;
-                       if(self.movement.y > 0)
-                               self.movement_y = wishspeed;
+                       player.movement_x = 0;
+                       if(player.movement.y > 0)
+                               player.movement_y = wishspeed;
                        else
                        else
-                               self.movement_y = -wishspeed;
+                               player.movement_y = -wishspeed;
                }
                else
                {
                        // diagonal
                }
                else
                {
                        // diagonal
-                       if(self.movement.x > 0)
-                               self.movement_x = M_SQRT1_2 * wishspeed;
+                       if(player.movement.x > 0)
+                               player.movement_x = M_SQRT1_2 * wishspeed;
                        else
                        else
-                               self.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(self.movement.y > 0)
-                               self.movement_y = M_SQRT1_2 * wishspeed;
+                               player.movement_x = -M_SQRT1_2 * wishspeed;
+                       if(player.movement.y > 0)
+                               player.movement_y = M_SQRT1_2 * wishspeed;
                        else
                        else
-                               self.movement_y = -M_SQRT1_2 * wishspeed;
+                               player.movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(cts, reset_map_global)
index f93ddfefc3ab00ecc4ad53bd776129c496c3304f..7af44fcc1517f9a4535908d303a30836e322f8e9 100644 (file)
@@ -439,13 +439,14 @@ MUTATOR_HOOKFUNCTION(ka, PlayerPowerups)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
 .float stat_sv_maxspeed;
 
 MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
-{SELFPARAM();
-       if(self.ballcarried)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(player.ballcarried)
        {
        {
-               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
-               self.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
+               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
+               player.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
        }
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
 }
 
 MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
index 8d5cbe9da999b500e48018b7867e435b48aec220..2b68bf6d388e08748278dcb620325cf0fcd78dcd 100644 (file)
@@ -141,24 +141,26 @@ float WinningCondition_QualifyingThenRace(float limit)
 }
 
 MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
 }
 
 MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
-{SELFPARAM();
-       self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
-       float f = floor(self.race_movetime_frac);
-       self.race_movetime_frac -= f;
-       self.race_movetime_count += f;
-       self.race_movetime = self.race_movetime_frac + self.race_movetime_count;
+{
+       entity player = M_ARGV(0, entity);
+
+       player.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
+       float f = floor(player.race_movetime_frac);
+       player.race_movetime_frac -= f;
+       player.race_movetime_count += f;
+       player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
 
 #ifdef SVQC
 
 #ifdef SVQC
-       if(IS_PLAYER(self))
+       if(IS_PLAYER(player))
        {
        {
-               if (self.race_penalty)
-                       if (time > self.race_penalty)
-                               self.race_penalty = 0;
-               if(self.race_penalty)
+               if (player.race_penalty)
+                       if (time > player.race_penalty)
+                               player.race_penalty = 0;
+               if(player.race_penalty)
                {
                {
-                       self.velocity = '0 0 0';
-                       self.movetype = MOVETYPE_NONE;
-                       self.disableclientprediction = 2;
+                       player.velocity = '0 0 0';
+                       player.movetype = MOVETYPE_NONE;
+                       player.disableclientprediction = 2;
                }
        }
 #endif
                }
        }
 #endif
@@ -171,8 +173,8 @@ MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel.x = fabs(self.movement.x);
-       wishvel.y = fabs(self.movement.y);
+       wishvel.x = fabs(player.movement.x);
+       wishvel.y = fabs(player.movement.y);
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
        if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
                wishvel.z = 0;
@@ -180,36 +182,34 @@ MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
                if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(self.movement.x > 0)
-                               self.movement_x = wishspeed;
+                       if(player.movement.x > 0)
+                               player.movement_x = wishspeed;
                        else
                        else
-                               self.movement_x = -wishspeed;
-                       self.movement_y = 0;
+                               player.movement_x = -wishspeed;
+                       player.movement_y = 0;
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
                }
                else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
-                       self.movement_x = 0;
-                       if(self.movement.y > 0)
-                               self.movement_y = wishspeed;
+                       player.movement_x = 0;
+                       if(player.movement.y > 0)
+                               player.movement_y = wishspeed;
                        else
                        else
-                               self.movement_y = -wishspeed;
+                               player.movement_y = -wishspeed;
                }
                else
                {
                        // diagonal
                }
                else
                {
                        // diagonal
-                       if(self.movement.x > 0)
-                               self.movement_x = M_SQRT1_2 * wishspeed;
+                       if(player.movement.x > 0)
+                               player.movement_x = M_SQRT1_2 * wishspeed;
                        else
                        else
-                               self.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(self.movement.y > 0)
-                               self.movement_y = M_SQRT1_2 * wishspeed;
+                               player.movement_x = -M_SQRT1_2 * wishspeed;
+                       if(player.movement.y > 0)
+                               player.movement_y = M_SQRT1_2 * wishspeed;
                        else
                        else
-                               self.movement_y = -M_SQRT1_2 * wishspeed;
+                               player.movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
                }
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(rc, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(rc, reset_map_global)