From: Mario Date: Sat, 29 Aug 2015 06:11:06 +0000 (+1000) Subject: Add a clientside hook for PlayerJump X-Git-Tag: xonotic-v0.8.2~2002 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aad362a8f350ab4f81604a171173b6c77d8435e1;p=xonotic%2Fxonotic-data.pk3dir.git Add a clientside hook for PlayerJump --- diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 9516fd25e..d6ac0c881 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -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 diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index e5b83443f..34dedf132 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -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; diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index d4e5fdd38..a249b238d 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -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