: a * pow(fabs(b / a), lerp);
}
-noref float pmove_waterjumptime;
-
#define unstick_offsets(X) \
/* 1 no nudge (just return the original if this test passes) */ \
X(' 0.000 0.000 0.000') \
void PM_ClientMovement_UpdateStatus(entity this, bool ground)
{
+#ifdef CSQC
// make sure player is not stuck
- PM_ClientMovement_Unstick(this);
+ if(autocvar_cl_movement != 3)
+ PM_ClientMovement_Unstick(this);
// set crouched
if (PHYS_INPUT_BUTTON_CROUCH(this))
vector origin1 = this.origin + '0 0 1';
vector origin2 = this.origin - '0 0 1';
- if (ground)
+ if (ground && autocvar_cl_movement != 3)
{
tracebox(origin1, this.mins, this.maxs, origin2, MOVE_NORMAL, this);
if (trace_fraction < 1.0 && trace_plane_normal.z > 0.7)
UNSET_ONGROUND(this);
}
- // set watertype/waterlevel
- origin1 = this.origin;
- origin1.z += this.mins_z + 1;
- this.waterlevel = WATERLEVEL_NONE;
+ if(autocvar_cl_movement != 3)
+ {
+ // set watertype/waterlevel
+ origin1 = this.origin;
+ origin1.z += this.mins_z + 1;
+ this.waterlevel = WATERLEVEL_NONE;
- int thepoint = pointcontents(origin1);
+ int thepoint = pointcontents(origin1);
- this.watertype = (thepoint == CONTENT_WATER || thepoint == CONTENT_LAVA || thepoint == CONTENT_SLIME);
+ this.watertype = (thepoint == CONTENT_WATER || thepoint == CONTENT_LAVA || thepoint == CONTENT_SLIME);
- if (this.watertype)
- {
- this.waterlevel = WATERLEVEL_WETFEET;
- origin1.z = this.origin.z + (this.mins.z + this.maxs.z) * 0.5;
- thepoint = pointcontents(origin1);
- if (thepoint == CONTENT_WATER || thepoint == CONTENT_LAVA || thepoint == CONTENT_SLIME)
+ if (this.watertype)
{
- this.waterlevel = WATERLEVEL_SWIMMING;
- origin1.z = this.origin.z + 22;
+ this.waterlevel = WATERLEVEL_WETFEET;
+ origin1.z = this.origin.z + (this.mins.z + this.maxs.z) * 0.5;
thepoint = pointcontents(origin1);
if (thepoint == CONTENT_WATER || thepoint == CONTENT_LAVA || thepoint == CONTENT_SLIME)
- this.waterlevel = WATERLEVEL_SUBMERGED;
+ {
+ this.waterlevel = WATERLEVEL_SWIMMING;
+ origin1.z = this.origin.z + 22;
+ thepoint = pointcontents(origin1);
+ if (thepoint == CONTENT_WATER || thepoint == CONTENT_LAVA || thepoint == CONTENT_SLIME)
+ this.waterlevel = WATERLEVEL_SUBMERGED;
+ }
}
}
if (IS_ONGROUND(this) || this.velocity.z <= 0 || pmove_waterjumptime <= 0)
pmove_waterjumptime = 0;
+#endif
}
void PM_ClientMovement_Move(entity this)
f = (this.velocity * trace1_plane_normal);
this.velocity = this.velocity + -f * trace1_plane_normal;
}
- if(pmove_waterjumptime > 0)
+ if(PHYS_TELEPORT_TIME(this) > 0)
this.velocity = primalvelocity;
#endif
}
animdecide_setaction(this, ANIMACTION_JUMP, true);
if (autocvar_g_jump_grunt)
- WITH(entity, this, this, PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND));
+ PlayerSound(this, playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
#endif
return true;
}
this.velocity_z = 225;
this.flags |= FL_WATERJUMP;
SET_JUMP_HELD(this);
-#ifdef SVQC
- this.teleport_time = time + 2; // safety net
-#elif defined(CSQC)
+ #ifdef SVQC
+ PHYS_TELEPORT_TIME(this) = time + 2; // safety net
+ #elif defined(CSQC)
pmove_waterjumptime = time + 2;
-#endif
+ #endif
}
}
}
void PM_check_hitground(entity this)
{
#ifdef SVQC
- if (!IS_PLAYER(this)) return; // no fall sounds for observers thank you very much
- if (!IS_ONGROUND(this)) return;
if (!this.wasFlying) return;
this.wasFlying = false;
if (this.waterlevel >= WATERLEVEL_SWIMMING) return;
this.nextstep = time + 0.3 + random() * 0.1;
trace_dphitq3surfaceflags = 0;
tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
- if ((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)) return;
- entity fall = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) ? GS_FALL_METAL : GS_FALL;
- WITH(entity, self, this, GlobalSound(fall, CH_PLAYER, VOICETYPE_PLAYERSOUND));
+ if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) return;
+ entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+ ? GS_FALL_METAL
+ : GS_FALL;
+ GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+#endif
+}
+
+void PM_Footsteps(entity this)
+{
+#ifdef SVQC
+ if (!g_footsteps) return;
+ if (IS_DUCKED(this)) return;
+ if (time >= this.lastground + 0.2) return;
+ if (vdist(this.velocity, <=, autocvar_sv_maxspeed * 0.6)) return;
+ if ((time > this.nextstep) || (time < (this.nextstep - 10.0)))
+ {
+ this.nextstep = time + 0.3 + random() * 0.1;
+ trace_dphitq3surfaceflags = 0;
+ tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
+ if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) return;
+ entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+ ? GS_STEP_METAL
+ : GS_STEP;
+ GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ }
#endif
}
vector wishdir = normalize(wishvel);
float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
#ifdef SVQC
- if (time >= this.teleport_time)
+ if(time >= PHYS_TELEPORT_TIME(this))
#endif
PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this) * maxspd_mod, 1, 0, 0, 0);
PM_ClientMovement_Move(this);
{
this.velocity = forward * 50;
this.velocity_z = 310;
+ #ifdef CSQC
pmove_waterjumptime = 2;
+ #endif
UNSET_ONGROUND(this);
SET_JUMP_HELD(this);
}
// acceleration
vector wishdir = normalize(wishvel);
float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
-#ifdef SVQC
- if (time >= this.teleport_time)
-#endif
+ if(time >= PHYS_TELEPORT_TIME(this))
// water acceleration
PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this)*maxspd_mod, 1, 0, 0, 0);
PM_ClientMovement_Move(this);
float wishspeed = vlen(wishvel);
#ifdef SVQC
- if (time >= this.teleport_time)
-#else
- if (pmove_waterjumptime <= 0)
+ if(time >= PHYS_TELEPORT_TIME(this))
+#elif defined(CSQC)
+ if(pmove_waterjumptime <= 0)
#endif
{
float maxairspd = PHYS_MAXAIRSPEED(this) * min(maxspd_mod, 1);
stuffcmd(this, strcat("cl_upspeed ", temps, "\n"));
}
- if(this.stat_jumpspeedcap_min != PHYS_JUMPSPEEDCAP_MIN)
+ if(this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min)
{
- this.stat_jumpspeedcap_min = PHYS_JUMPSPEEDCAP_MIN;
- stuffcmd(this, strcat("cl_jumpspeedcap_min ", PHYS_JUMPSPEEDCAP_MIN, "\n"));
+ this.jumpspeedcap_min = autocvar_sv_jumpspeedcap_min;
+ stuffcmd(this, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min));
}
- if(this.stat_jumpspeedcap_max != PHYS_JUMPSPEEDCAP_MAX)
+ if(this.jumpspeedcap_max != autocvar_sv_jumpspeedcap_max)
{
- this.stat_jumpspeedcap_min = PHYS_JUMPSPEEDCAP_MAX;
- stuffcmd(this, strcat("cl_jumpspeedcap_max ", PHYS_JUMPSPEEDCAP_MAX, "\n"));
+ this.jumpspeedcap_max = autocvar_sv_jumpspeedcap_max;
+ stuffcmd(this, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max));
}
#endif
this.angles = '0 1 0' * this.v_angle.y;
#endif
- PM_check_hitground(this);
+ if (IS_PLAYER(this) && IS_ONGROUND(this))
+ {
+ PM_check_hitground(this);
+ PM_Footsteps(this);
+ }
if(IsFlying(this))
this.wasFlying = 1;
{
this.velocity_x = this.movedir.x;
this.velocity_y = this.movedir.y;
- if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE)
+ if (time > PHYS_TELEPORT_TIME(this) || this.waterlevel == WATERLEVEL_NONE)
{
this.flags &= ~FL_WATERJUMP;
- this.teleport_time = 0;
+ PHYS_TELEPORT_TIME(this) = 0;
}
}
else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod))
{ }
+#ifdef SVQC
else if (this.movetype == MOVETYPE_NOCLIP || this.movetype == MOVETYPE_FLY || this.movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this))
+#elif defined(CSQC)
+ else if (this.move_movetype == MOVETYPE_NOCLIP || this.move_movetype == MOVETYPE_FLY || this.move_movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this))
+#endif
PM_fly(this, maxspeed_mod);
else if (this.waterlevel >= WATERLEVEL_SWIMMING)
SELFPARAM();
#endif
PM_Main(this);
-#ifdef CSQC
- this.pmove_flags =
- ((this.flags & FL_DUCKED) ? PMF_DUCKED : 0) |
- (!(this.flags & FL_JUMPRELEASED) ? PMF_JUMP_HELD : 0) |
- ((this.flags & FL_ONGROUND) ? PMF_ONGROUND : 0);
-#endif
}