]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a clientside hook for PlayerJump
authorMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 06:11:06 +0000 (16:11 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 06:11:06 +0000 (16:11 +1000)
qcsrc/client/mutators/events.qh
qcsrc/common/physics.qc
qcsrc/common/physics.qh

index 9516fd25e794788e8da9bc4c792c7a5ad6efd132..d6ac0c88115eaaffa841e9ce80bc67eab79fb9e7 100644 (file)
@@ -112,4 +112,15 @@ MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
 string checkmodel_input, checkmodel_command;
 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
 
+/** called when a player presses the jump key */
+#define EV_PlayerJump(i, o) \
+    /**/ i(float, player_multijump) \
+    /**/ i(float, player_jumpheight) \
+    /**/ o(float, player_multijump) \
+    /**/ o(float, player_jumpheight) \
+    /**/
+float player_multijump;
+float player_jumpheight;
+MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
+
 #endif
index e5b83443fbcd3c28aecce9276cd006e5eead2e74..34dedf13280ad6ba0b9d2aaf75ac64918f746b24 100644 (file)
@@ -552,15 +552,16 @@ bool PlayerJump (void)
 
        bool doublejump = false;
        float mjumpheight = PHYS_JUMPVELOCITY;
-
-#ifdef SVQC
-       if (MUTATOR_CALLHOOK(PlayerJump, doublejump, mjumpheight))
-#elif defined(CSQC)
+#ifdef CSQC
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
-       if (PM_multijump_checkjump())
 #endif
-               return true;
+
+       if (MUTATOR_CALLHOOK(PlayerJump, doublejump, mjumpheight)
+#ifdef CSQC
+               || PM_multijump_checkjump()
+#endif
+               ) { return true; }
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
index d4e5fdd389b9e86dc33f8881c05403cbcff9f404..a249b238d7bf197650833c3e3d1badad89135478 100644 (file)
@@ -43,8 +43,8 @@ bool IsFlying(entity a);
        #define IS_PLAYER(s)                                            (s).isplayermodel
        #define isPushable(s)                                           (s).isplayermodel
 
-       float player_multijump;
-       float player_jumpheight;
+       //float player_multijump;
+       //float player_jumpheight;
 
        #define PHYS_INPUT_ANGLES(s)                            input_angles
 // TODO