]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/doublejump/doublejump.qc
Merge branch 'DefaultUser/gametype_votescreen' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / doublejump / doublejump.qc
index 7a09b81e1dc9d251e59818768a806034b9991047..cc60ccc1fd8a9bccf1a9006ca0b46a86796d35f8 100644 (file)
@@ -1,45 +1,36 @@
-#ifdef IMPLEMENTATION
+#include "doublejump.qh"
+
+#ifdef GAMEQC
 #ifdef SVQC
-       #include "../../../../server/antilag.qh"
+       #include <server/antilag.qh>
 #endif
-#include "../../../physics.qh"
+#include <common/physics/player.qh>
 
+#ifdef SVQC
+REGISTER_MUTATOR(doublejump, autocvar_sv_doublejump);
+#elif defined(CSQC)
 REGISTER_MUTATOR(doublejump, true);
+#endif
 
 #define PHYS_DOUBLEJUMP(s)                     STAT(DOUBLEJUMP, s)
 
 
 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
 {
-       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)
                {
-                       player_multijump = true;
+                       M_ARGV(2, bool) = true;
 
                        // we MUST clip velocity here!
-                       float f = self.velocity * trace_plane_normal;
+                       float f = player.velocity * trace_plane_normal;
                        if (f < 0)
-                               self.velocity -= f * trace_plane_normal;
+                               player.velocity -= f * trace_plane_normal;
                }
        }
-       return false;
-}
-
-#ifdef SVQC
-
-MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsString)
-{
-       ret_string = strcat(ret_string, ":doublejump");
-       return false;
 }
-
-MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsPrettyString)
-{
-       ret_string = strcat(ret_string, ", Double jump");
-       return false;
-}
-
-#endif
 #endif