#include "mutator/cloaked/module.inc"
#include "mutator/damagetext/module.inc"
#include "mutator/dodging/module.inc"
+#include "mutator/doublejump/module.inc"
#include "mutator/hook/module.inc"
#include "mutator/instagib/module.inc"
#include "mutator/invincibleproj/module.inc"
this.velocity += PHYS_DODGING_UP_SPEED * v_up;
- #ifdef CSQC
- LOG_INFO("YES?!\n");
- #endif
-
#ifdef SVQC
if (autocvar_sv_dodging_sound)
PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
--- /dev/null
+#ifdef IMPLEMENTATION
+#ifdef SVQC
+ #include "../../../../server/antilag.qh"
+#endif
+#include "../../../physics.qh"
+
+
+#if defined(SVQC)
+void doublejump_AddStats();
+
+REGISTER_MUTATOR(doublejump, true)
+{
+ MUTATOR_ONADD
+ {
+ doublejump_AddStats();
+ }
+ return false;
+}
+#elif defined(CSQC)
+REGISTER_MUTATOR(doublejump, true);
+#endif
+
+
+#ifdef CSQC
+
+#define PHYS_DOUBLEJUMP getstati(STAT_DOUBLEJUMP)
+
+#elif defined(SVQC)
+
+bool autocvar_sv_doublejump;
+
+#define PHYS_DOUBLEJUMP autocvar_sv_doublejump
+
+.int stat_doublejump;
+
+void doublejump_UpdateStats(entity this)
+{
+ this.stat_doublejump = PHYS_DOUBLEJUMP;
+}
+
+void doublejump_AddStats()
+{
+ addstat(STAT_DOUBLEJUMP, AS_INT, stat_doublejump);
+}
+
+#endif
+
+
+MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
+{
+ if (PHYS_DOUBLEJUMP)
+ {
+ tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
+ if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
+ {
+ player_multijump = true;
+
+ // we MUST clip velocity here!
+ float f = self.velocity * trace_plane_normal;
+ if (f < 0)
+ self.velocity -= f * trace_plane_normal;
+ }
+ }
+ return false;
+}
+
+MUTATOR_HOOKFUNCTION(doublejump, PlayerPhysics)
+{
+#ifdef SVQC
+ doublejump_UpdateStats(self);
+#endif
+ 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
--- /dev/null
+#ifndef MENUQC
+#include "doublejump.qc"
+#endif
addstat(STAT_MOVEVARS_CL_TRACK_CANJUMP, AS_INT, cvar_cl_movement_track_canjump);
addstat(STAT_MOVEVARS_TRACK_CANJUMP, AS_INT, stat_sv_track_canjump);
- // double jump
- addstat(STAT_DOUBLEJUMP, AS_INT, stat_doublejump);
-
// jump speed caps
addstat(STAT_MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, AS_INT, stat_jumpspeedcap_disable_onramps);
self.stat_sv_maxspeed = Physics_ClientOption(self, "maxspeed") * maxspd_mod; // also slow walking
self.stat_movement_highspeed = PHYS_HIGHSPEED; // TODO: remove this!
- self.stat_doublejump = PHYS_DOUBLEJUMP;
-
self.stat_jetpack_antigravity = PHYS_JETPACK_ANTIGRAVITY;
self.stat_jetpack_accel_up = PHYS_JETPACK_ACCEL_UP;
self.stat_jetpack_accel_side = PHYS_JETPACK_ACCEL_SIDE;
bool doublejump = false;
float mjumpheight = PHYS_JUMPVELOCITY;
-#ifdef CSQC
- player_multijump = doublejump;
- player_jumpheight = mjumpheight;
-#endif
if (MUTATOR_CALLHOOK(PlayerJump, doublejump, mjumpheight))
return true;
doublejump = player_multijump;
mjumpheight = player_jumpheight;
- if (PHYS_DOUBLEJUMP)
- {
- tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
- if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
- {
- doublejump = true;
-
- // we MUST clip velocity here!
- float f;
- f = self.velocity * trace_plane_normal;
- if (f < 0)
- self.velocity -= f * trace_plane_normal;
- }
- }
-
if (self.waterlevel >= WATERLEVEL_SWIMMING)
{
self.velocity_z = PHYS_MAXSPEED(self) * 0.7;
#define PHYS_FROZEN(s) getstati(STAT_FROZEN)
- #define PHYS_DOUBLEJUMP getstati(STAT_DOUBLEJUMP)
-
#define PHYS_JUMPSPEEDCAP_MIN cvar_string("cl_jumpspeedcap_min")
#define PHYS_JUMPSPEEDCAP_MAX cvar_string("cl_jumpspeedcap_max")
#define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS getstati(STAT_MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS)
.float stat_sv_friction_on_land;
.float stat_sv_friction_slick;
- .float stat_doublejump;
-
.string stat_jumpspeedcap_min;
.string stat_jumpspeedcap_max;
.float stat_jumpspeedcap_disable_onramps;
#define PHYS_FROZEN(s) s.frozen
- #define PHYS_DOUBLEJUMP autocvar_sv_doublejump
-
#define PHYS_JUMPSPEEDCAP_MIN autocvar_sv_jumpspeedcap_min
#define PHYS_JUMPSPEEDCAP_MAX autocvar_sv_jumpspeedcap_max
#define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS autocvar_sv_jumpspeedcap_max_disable_on_ramps
string autocvar_sv_defaultplayermodel_yellow;
int autocvar_sv_defaultplayerskin;
bool autocvar_sv_dodging_frozen;
-bool autocvar_sv_doublejump;
bool autocvar_sv_eventlog;
bool autocvar_sv_eventlog_console;
bool autocvar_sv_eventlog_files;