}
}
- if (IS_ONGROUND(this) || this.velocity.z <= 0 || PHYS_TELEPORT_TIME(this) <= 0)
- PHYS_TELEPORT_TIME(this) = 0;
+ if (IS_ONGROUND(this) || this.velocity.z <= 0 || pmove_waterjumptime <= 0)
+ pmove_waterjumptime = 0;
#endif
}
animdecide_setaction(this, ANIMACTION_JUMP, true);
if (autocvar_g_jump_grunt)
- WITH(entity, self, 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
PHYS_TELEPORT_TIME(this) = time + 2; // safety net
+ #elif defined(CSQC)
+ pmove_waterjumptime = time + 2;
+ #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
}
// acceleration
vector wishdir = normalize(wishvel);
float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
+#ifdef SVQC
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;
- PHYS_TELEPORT_TIME(this) = 2;
+ #ifdef CSQC
+ pmove_waterjumptime = 2;
+ #endif
UNSET_ONGROUND(this);
SET_JUMP_HELD(this);
}
vector wishdir = normalize(wishvel);
float wishspeed = vlen(wishvel);
- if(PHYS_TELEPORT_TIME(this) < time)
+#ifdef SVQC
+ if(time >= PHYS_TELEPORT_TIME(this))
+#elif defined(CSQC)
+ if(pmove_waterjumptime <= 0)
+#endif
{
float maxairspd = PHYS_MAXAIRSPEED(this) * min(maxspd_mod, 1);
this.team = myteam + 1; // is this correct?
if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump
UNSET_JUMP_HELD(this); // canjump = true
- PHYS_TELEPORT_TIME(this) -= PHYS_INPUT_TIMELENGTH;
+ pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH;
PM_ClientMovement_UpdateStatus(this, true);
#endif
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;