-.float race_penalty;
+#include "physics.qh"
+#include "triggers/trigger/swamp.qh"
+#include "triggers/trigger/jumppads.qh"
-.float gravity;
-.float swamp_slowdown;
-.float lastflags;
-.float lastground;
-.float wasFlying;
-.float spectatorspeed;
-
-.vector movement_old;
-.float buttons_old;
-.vector v_angle_old;
-.string lastclassname;
-
-.float() PlayerPhysplug;
-float AdjustAirAccelQW(float accelqw, float factor);
-
-#ifdef CSQC
-
-.float watertype;
-
-#elif defined(SVQC)
-.float stat_sv_airaccel_qw;
-.float stat_sv_airstrafeaccel_qw;
-.float stat_sv_airspeedlimit_nonqw;
-.float stat_sv_maxspeed;
-.float stat_movement_highspeed;
-
-.float stat_doublejump;
-
-.float stat_jumpspeedcap_min;
-.float stat_jumpspeedcap_max;
-.float stat_jumpspeedcap_disable_onramps;
+#ifdef SVQC
-.float stat_jetpack_accel_side;
-.float stat_jetpack_accel_up;
-.float stat_jetpack_antigravity;
-.float stat_jetpack_fuel;
-.float stat_jetpack_maxspeed_up;
-.float stat_jetpack_maxspeed_side;
+#include "../server/miscfunctions.qh"
void Physics_AddStats()
{
addstat(STAT_MOVEVARS_JUMPSPEEDCAP_MIN, AS_FLOAT, stat_jumpspeedcap_min);
addstat(STAT_MOVEVARS_JUMPSPEEDCAP_MIN, AS_FLOAT, stat_jumpspeedcap_min);
addstat(STAT_MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, AS_INT, stat_jumpspeedcap_disable_onramps);
+
+ // hacks
+ addstat(STAT_MOVEVARS_FRICTION_ONLAND, AS_FLOAT, stat_sv_friction_on_land);
+ addstat(STAT_MOVEVARS_FRICTION_SLICK, AS_FLOAT, stat_sv_friction_slick);
+ addstat(STAT_GAMEPLAYFIX_EASIERWATERJUMP, AS_INT, stat_gameplayfix_easierwaterjump);
}
void Physics_UpdateStats(float maxspd_mod)
self.stat_jumpspeedcap_min = PHYS_JUMPSPEEDCAP_MIN;
self.stat_jumpspeedcap_max = PHYS_JUMPSPEEDCAP_MAX;
self.stat_jumpspeedcap_disable_onramps = PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS;
+
+ self.stat_sv_friction_on_land = PHYS_FRICTION_ONLAND;
+ self.stat_sv_friction_slick = PHYS_FRICTION_SLICK;
+
+ self.stat_gameplayfix_easierwaterjump = GAMEPLAYFIX_EASIERWATERJUMP;
}
#endif
tracebox(neworigin, PL_CROUCH_MIN, PL_CROUCH_MAX, neworigin, MOVE_NORMAL, self);
if (!trace_startsolid)
{
- self.origin = neworigin;
+ setorigin(self, neworigin);
return;// true;
}
}
}
-void PM_ClientMovement_UpdateStatus()
+void PM_ClientMovement_UpdateStatus(bool ground)
{
// make sure player is not stuck
PM_ClientMovement_Unstick();
vector origin1 = self.origin + '0 0 1';
vector origin2 = self.origin - '0 0 1';
- tracebox(origin1, self.mins, self.maxs, origin2, MOVE_NORMAL, self);
- if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
+ if(ground)
{
- SET_ONGROUND(self);
+ tracebox(origin1, self.mins, self.maxs, origin2, MOVE_NORMAL, self);
+ if (trace_fraction < 1.0 && trace_plane_normal_z > 0.7)
+ {
+ SET_ONGROUND(self);
- // this code actually "predicts" an impact; so let's clip velocity first
- float f = dotproduct(self.velocity, trace_plane_normal);
- if (f < 0) // only if moving downwards actually
+ // this code actually "predicts" an impact; so let's clip velocity first
+ float f = self.velocity * trace_plane_normal;
self.velocity -= f * trace_plane_normal;
+ }
+ else
+ UNSET_ONGROUND(self);
}
- else
- UNSET_ONGROUND(self);
// set watertype/waterlevel
origin1 = self.origin;
#ifdef CSQC
float t = PHYS_INPUT_TIMELENGTH;
vector primalvelocity = self.velocity;
- PM_ClientMovement_UpdateStatus();
+ PM_ClientMovement_UpdateStatus(false);
float bump = 0;
- for (bump = 0; bump < 8 && self.velocity * self.velocity > 0; bump++)
+ for (bump = 0; bump < MAX_CLIP_PLANES && (self.velocity * self.velocity) > 0; bump++)
{
vector neworigin = self.origin + t * self.velocity;
tracebox(self.origin, self.mins, self.maxs, neworigin, MOVE_NORMAL, self);
float old_trace2_fraction = trace_fraction;
vector old_trace2_plane_normal = trace_plane_normal;
tracebox(currentorigin2, self.mins, self.maxs, neworigin2, MOVE_NORMAL, self);
- //Con_Printf("%f %f %f %f : %f %f %f %f : %f %f %f %f\n", trace.fraction, trace.endpos[0], trace.endpos[1], trace.endpos[2], trace2.fraction, trace2.endpos[0], trace2.endpos[1], trace2.endpos[2], trace3.fraction, trace3.endpos[0], trace3.endpos[1], trace3.endpos[2]);
// accept the new trace if it made some progress
if (fabs(trace_endpos_x - old_trace1_endpos_x) >= 0.03125 || fabs(trace_endpos_y - old_trace1_endpos_y) >= 0.03125)
{
// check if it moved at all
if (trace_fraction >= 0.001)
- self.origin = trace_endpos;
+ setorigin(self, trace_endpos);
// check if it moved all the way
if (trace_fraction == 1)
t -= t * trace_fraction;
- float f = dotproduct(self.velocity, trace_plane_normal);
+ float f = self.velocity * trace_plane_normal;
self.velocity -= f * trace_plane_normal;
}
if (pmove_waterjumptime > 0)
void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
{
- float k;
-#if 0
- // this doesn't play well with analog input
- if (PHYS_INPUT_MOVEVALUES(self).x == 0 || PHYS_INPUT_MOVEVALUES(self).y != 0)
- return; // can't control movement if not moving forward or backward
- k = 32;
-#else
- k = 32 * (2 * IsMoveInDirection(PHYS_INPUT_MOVEVALUES(self), 0) - 1);
+ float k = 32 * (2 * IsMoveInDirection(PHYS_INPUT_MOVEVALUES(self), 0) - 1);
if (k <= 0)
return;
-#endif
k *= bound(0, wishspeed / PHYS_MAXAIRSPEED, 1);
if (dot > 0) // we can't change direction while slowing down
{
- k *= pow(dot, PHYS_AIRCONTROL_POWER)*PHYS_INPUT_TIMELENGTH;
+ k *= pow(dot, PHYS_AIRCONTROL_POWER) * PHYS_INPUT_TIMELENGTH;
xyspeed = max(0, xyspeed - PHYS_AIRCONTROL_PENALTY * sqrt(max(0, 1 - dot*dot)) * k/32);
k *= PHYS_AIRCONTROL;
self.velocity = normalize(self.velocity * xyspeed + wishdir * k);
PlayerJump
When you press the jump key
+returns true if handled
=============
*/
-void PlayerJump (void)
+float PlayerJump (void)
{
if (PHYS_FROZEN(self))
- return; // no jumping in freezetag when frozen
+ return true; // no jumping in freezetag when frozen
#ifdef SVQC
if (self.player_blocked)
- return; // no jumping while blocked
+ return true; // no jumping while blocked
#endif
- float doublejump = FALSE;
+ float doublejump = false;
float mjumpheight = PHYS_JUMPVELOCITY;
player_multijump = doublejump;
player_jumpheight = mjumpheight;
#ifdef SVQC
if (MUTATOR_CALLHOOK(PlayerJump))
- return;
#elif defined(CSQC)
if(PM_multijump_checkjump())
- return;
#endif
+ return true;
doublejump = player_multijump;
mjumpheight = player_jumpheight;
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;
+ doublejump = true;
// we MUST clip velocity here!
float f;
if (self.waterlevel >= WATERLEVEL_SWIMMING)
{
self.velocity_z = PHYS_MAXSPEED(self) * 0.7;
- return;
+ return true;
}
if (!doublejump)
if (!IS_ONGROUND(self))
- return;
+ return IS_JUMP_HELD(self);
if (PHYS_TRACK_CANJUMP(self))
if (IS_JUMP_HELD(self))
- return;
+ return true;
// sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
// velocity bounds. Final velocity is bound between (jumpheight *
}
}
-#ifdef SVQC
- if (!(self.lastflags & FL_ONGROUND))
+ if (!WAS_ONGROUND(self))
{
- if (autocvar_speedmeter)
+#ifdef SVQC
+ if(autocvar_speedmeter)
dprint(strcat("landing velocity: ", vtos(self.velocity), " (abs: ", ftos(vlen(self.velocity)), ")\n"));
- if (self.lastground < time - 0.3)
+#endif
+ if(self.lastground < time - 0.3)
{
- self.velocity_x *= (1 - autocvar_sv_friction_on_land);
- self.velocity_y *= (1 - autocvar_sv_friction_on_land);
+ self.velocity_x *= (1 - PHYS_FRICTION_ONLAND);
+ self.velocity_y *= (1 - PHYS_FRICTION_ONLAND);
}
- if (self.jumppadcount > 1)
+#ifdef SVQC
+ if(self.jumppadcount > 1)
dprint(strcat(ftos(self.jumppadcount), "x jumppad combo\n"));
self.jumppadcount = 0;
- }
#endif
+ }
self.velocity_z += mjumpheight;
self.oldvelocity_z = self.velocity_z;
- animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
+ animdecide_setaction(self, ANIMACTION_JUMP, true);
if (autocvar_g_jump_grunt)
PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
#endif
+ return true;
}
void CheckWaterJump()
v_forward_z = 0;
normalize(v_forward);
vector end = start + v_forward*24;
- traceline (start, end, TRUE, self);
+ traceline (start, end, true, self);
if (trace_fraction < 1)
{ // solid at waist
start_z = start_z + self.maxs_z - 8;
end = start + v_forward*24;
self.movedir = trace_plane_normal * -50;
- traceline(start, end, TRUE, self);
+ traceline(start, end, true, self);
if (trace_fraction == 1)
{ // open at eye level
self.velocity_z = 225;
-#ifdef SVQC
self.flags |= FL_WATERJUMP;
SET_JUMP_HELD(self);
self.teleport_time = time + 2; // safety net
-#endif
}
}
}
+
+#ifdef SVQC
+ #define JETPACK_JUMP(s) s.cvar_cl_jetpack_jump
+#elif defined(CSQC)
+ float autocvar_cl_jetpack_jump;
+ #define JETPACK_JUMP(s) autocvar_cl_jetpack_jump
+#endif
+.float jetpack_stopped;
+// Hack: shouldn't need to know about this
+.float multijump_count;
void CheckPlayerJump()
{
- if(PHYS_INPUT_BUTTON_JUMP(self))
- PlayerJump();
+#ifdef SVQC
+ float was_flying = ITEMS(self) & IT_USING_JETPACK;
+#endif
+ if (JETPACK_JUMP(self) < 2)
+ ITEMS(self) &= ~IT_USING_JETPACK;
+
+ if(PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_JETPACK(self))
+ {
+ float air_jump = !PlayerJump() || self.multijump_count > 0; // PlayerJump() has important side effects
+ float activate = JETPACK_JUMP(self) && air_jump && PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_JETPACK(self);
+ float has_fuel = !PHYS_JETPACK_FUEL || PHYS_AMMO_FUEL(self) || ITEMS(self) & IT_UNLIMITED_WEAPON_AMMO;
+
+ if (!(ITEMS(self) & IT_JETPACK)) { }
+ else if (self.jetpack_stopped) { }
+ else if (!has_fuel)
+ {
+#ifdef SVQC
+ if (was_flying) // TODO: ran out of fuel message
+ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+ else if (activate)
+ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+#endif
+ self.jetpack_stopped = true;
+ ITEMS(self) &= ~IT_USING_JETPACK;
+ }
+ else if (activate && !PHYS_FROZEN(self))
+ ITEMS(self) |= IT_USING_JETPACK;
+ }
else
+ {
+ self.jetpack_stopped = false;
+ ITEMS(self) &= ~IT_USING_JETPACK;
+ }
+ if (!PHYS_INPUT_BUTTON_JUMP(self))
UNSET_JUMP_HELD(self);
if (self.waterlevel == WATERLEVEL_SWIMMING)
#endif
}
-#ifdef SVQC
-float speedaward_speed;
-string speedaward_holder;
-string speedaward_uid;
-#endif
-void race_send_speedaward(float msg)
-{
-#ifdef SVQC
- // send the best speed of the round
- WriteByte(msg, SVC_TEMPENTITY);
- WriteByte(msg, TE_CSQC_RACE);
- WriteByte(msg, RACE_NET_SPEED_AWARD);
- WriteInt24_t(msg, floor(speedaward_speed+0.5));
- WriteString(msg, speedaward_holder);
-#endif
-}
-
-#ifdef SVQC
-float speedaward_alltimebest;
-string speedaward_alltimebest_holder;
-string speedaward_alltimebest_uid;
-#endif
-void race_send_speedaward_alltimebest(float msg)
-{
-#ifdef SVQC
- // send the best speed
- WriteByte(msg, SVC_TEMPENTITY);
- WriteByte(msg, TE_CSQC_RACE);
- WriteByte(msg, RACE_NET_SPEED_AWARD_BEST);
- WriteInt24_t(msg, floor(speedaward_alltimebest+0.5));
- WriteString(msg, speedaward_alltimebest_holder);
-#endif
-}
-
float PM_check_keepaway(void)
{
#ifdef SVQC
{
self.specialcommand_pos = 0;
SpecialCommand();
- return TRUE;
+ return true;
}
}
else if (self.specialcommand_pos && (c != substring(specialcommand, self.specialcommand_pos - 1, 1)))
self.specialcommand_pos = 0;
#endif
- return FALSE;
+ return false;
}
void PM_check_nickspam(void)
PHYS_INPUT_ANGLES(self)_x = random() * 360;
PHYS_INPUT_ANGLES(self)_y = random() * 360;
// at least I'm not forcing retardedview by also assigning to angles_z
- self.fixangle = TRUE;
+ self.fixangle = true;
}
}
#endif
}
}
+void PM_check_hitground()
+{
+#ifdef SVQC
+ if (IS_ONGROUND(self))
+ if (IS_PLAYER(self)) // no fall sounds for observers thank you very much
+ if (self.wasFlying)
+ {
+ self.wasFlying = 0;
+ if (self.waterlevel < WATERLEVEL_SWIMMING)
+ if (time >= self.ladder_time)
+ if (!self.hook)
+ {
+ self.nextstep = time + 0.3 + random() * 0.1;
+ trace_dphitq3surfaceflags = 0;
+ tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
+ if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS))
+ {
+ if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+ GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ else
+ GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ }
+ }
+ }
+#endif
+}
+
void PM_check_blocked(void)
{
#ifdef SVQC
#ifdef SVQC
float speedaward_lastsent;
float speedaward_lastupdate;
-string GetMapname(void);
#endif
void PM_check_race(void)
{
#ifdef SVQC
- if not(g_cts || g_race)
+ if(!(g_cts || g_race))
return;
if (vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed)
{
xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
// add the extra charge
- self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * frametime);
+ self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
}
#endif
}
PM_Accelerate(wishdir, wishspeed, wishspeed, PHYS_ACCELERATE*maxspd_mod, 1, 0, 0, 0);
}
-void PM_check_jumppad()
-{
-#ifdef CSQC
- entity oldself = self;
-
- for(self = world; (self = find(self, classname, "jumppad")); )
- trigger_push_draw();
-
- self = oldself;
-#endif
-}
-
void PM_jetpack(float maxspd_mod)
{
//makevectors(PHYS_INPUT_ANGLES(self).y * '0 1 0');
if (!(ITEMS(self) & IT_UNLIMITED_WEAPON_AMMO))
self.ammo_fuel -= PHYS_JETPACK_FUEL * PHYS_INPUT_TIMELENGTH * fvel * f;
- self.items |= IT_USING_JETPACK;
+ ITEMS(self) |= IT_USING_JETPACK;
// jetpack also inhibits health regeneration, but only for 1 second
self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
void PM_walk(float buttons_prev, float maxspd_mod)
{
-#ifdef SVQC
- // we get here if we ran out of ammo
- if ((ITEMS(self) & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
- sprint(self, "You don't have any fuel for the ^2Jetpack\n");
- if (!(self.lastflags & FL_ONGROUND))
+ if (!WAS_ONGROUND(self))
{
+#ifdef SVQC
if (autocvar_speedmeter)
dprint(strcat("landing velocity: ", vtos(self.velocity), " (abs: ", ftos(vlen(self.velocity)), ")\n"));
+#endif
if (self.lastground < time - 0.3)
- self.velocity *= (1 - autocvar_sv_friction_on_land);
+ self.velocity *= (1 - PHYS_FRICTION_ONLAND);
+#ifdef SVQC
if (self.jumppadcount > 1)
dprint(strcat(ftos(self.jumppadcount), "x jumppad combo\n"));
self.jumppadcount = 0;
- }
#endif
+ }
+
// walking
makevectors(PHYS_INPUT_ANGLES(self).y * '0 1 0');
vector wishvel = v_forward * PHYS_INPUT_MOVEVALUES(self).x
float f = vlen(vec2(self.velocity));
if (f > 0)
{
+ float realfriction;
+ trace_dphitq3surfaceflags = 0;
+ tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
// TODO: apply edge friction
// apply ground friction
- f = 1 - PHYS_INPUT_TIMELENGTH * PHYS_FRICTION * ((f < PHYS_STOPSPEED) ? (PHYS_STOPSPEED / f) : 1);
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)
+ realfriction = PHYS_FRICTION_SLICK;
+ else
+ realfriction = PHYS_FRICTION;
+
+ f = 1 - PHYS_INPUT_TIMELENGTH * realfriction * ((f < PHYS_STOPSPEED) ? (PHYS_STOPSPEED / f) : 1);
f = max(0, f);
self.velocity *= f;
/*
void PM_air(float buttons_prev, float maxspd_mod)
{
-#ifdef SVQC
- // we get here if we ran out of ammo
- if ((ITEMS(self) & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && PHYS_AMMO_FUEL(self) < 0.01)
- sprint(self, "You don't have any fuel for the ^2Jetpack\n");
-#endif
makevectors(PHYS_INPUT_ANGLES(self).y * '0 1 0');
vector wishvel = v_forward * PHYS_INPUT_MOVEVALUES(self).x
+ v_right * PHYS_INPUT_MOVEVALUES(self).y;
}
// used for calculating airshots
-float PM_is_flying()
+bool IsFlying(entity a)
{
- if (IS_ONGROUND(self))
- return 0;
- if (self.waterlevel >= WATERLEVEL_SWIMMING)
- return 0;
- traceline(self.origin, self.origin - '0 0 48', MOVE_NORMAL, self);
- return trace_fraction >= 1;
+ if(IS_ONGROUND(a))
+ return false;
+ if(a.waterlevel >= WATERLEVEL_SWIMMING)
+ return false;
+ traceline(a.origin, a.origin - '0 0 48', MOVE_NORMAL, a);
+ if(trace_fraction < 1)
+ return false;
+ return true;
}
void PM_Main()
{
- PM_check_jumppad();
float buttons = PHYS_INPUT_BUTTON_MASK(self);
#ifdef CSQC
+ self.items = getstati(STAT_ITEMS, 0, 24);
+
self.team = myteam + 1; // is this correct?
- //Con_Printf(" %f", PHYS_INPUT_TIMELENGTH);
if (!(PHYS_INPUT_BUTTON_JUMP(self))) // !jump
UNSET_JUMP_HELD(self); // canjump = true
pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH;
- PM_ClientMovement_UpdateStatus();
+
+ PM_ClientMovement_UpdateStatus(true);
#endif
+
#ifdef SVQC
WarpZone_PlayerPhysics_FixVAngle();
bot_think();
}
- self.items &= ~IT_USING_JETPACK;
-
if (IS_PLAYER(self))
#endif
{
not_allowed_to_move = 1;
#endif
#ifdef SVQC
- if (!autocvar_sv_ready_restart_after_countdown)
- if (time < game_starttime)
- not_allowed_to_move = 1;
+ if (time < game_starttime)
+ not_allowed_to_move = 1;
#endif
if (not_allowed_to_move)
maxspeed_mod = 1;
-#ifdef SVQC
- if (self.in_swamp) {
+ if (self.in_swamp)
maxspeed_mod *= self.swamp_slowdown; //cvar("g_balance_swamp_moverate");
- }
-#endif
-#ifdef SVQC
// conveyors: first fix velocity
if (self.conveyor.state)
self.velocity -= self.conveyor.movedir;
-#endif
#ifdef SVQC
MUTATOR_CALLHOOK(PlayerPhysics);
}
#endif
-#ifdef SVQC
- // if dead, behave differently
- // in CSQC, physics don't handle dead player
- if (self.deadflag)
+ if(PHYS_DEAD(self))
goto end;
-#endif
#ifdef SVQC
if (!self.fixangle && !g_bugrigs)
self.angles = '0 1 0' * PHYS_INPUT_ANGLES(self).y;
#endif
-#ifdef SVQC
- if (IS_ONGROUND(self))
- if (IS_PLAYER(self)) // no fall sounds for observers thank you very much
- if (self.wasFlying)
- {
- self.wasFlying = 0;
- if (self.waterlevel < WATERLEVEL_SWIMMING)
- if (time >= self.ladder_time)
- if (!self.hook)
- {
- self.nextstep = time + 0.3 + random() * 0.1;
- trace_dphitq3surfaceflags = 0;
- tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
- if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS))
- {
- if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
- GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- else
- GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- }
- }
- }
-#endif
+ PM_check_hitground();
- if (PM_is_flying())
+ if(IsFlying(self))
self.wasFlying = 1;
-#ifdef SVQC
if (IS_PLAYER(self))
-#endif
CheckPlayerJump();
- if (self.flags & /* FL_WATERJUMP */ 2048)
+ if (self.flags & FL_WATERJUMP)
{
self.velocity_x = self.movedir_x;
self.velocity_y = self.movedir_y;
if (time > self.teleport_time || self.waterlevel == WATERLEVEL_NONE)
{
- self.flags &= ~/* FL_WATERJUMP */ 2048;
+ self.flags &= ~FL_WATERJUMP;
self.teleport_time = 0;
}
}
else if (time < self.ladder_time)
PM_ladder(maxspeed_mod);
- else if ((ITEMS(self) & IT_JETPACK) && PHYS_INPUT_BUTTON_HOOK(self) && (!PHYS_JETPACK_FUEL || PHYS_AMMO_FUEL(self) > 0 || (ITEMS(self) & IT_UNLIMITED_WEAPON_AMMO)) && !PHYS_FROZEN(self))
+ else if (ITEMS(self) & IT_USING_JETPACK)
PM_jetpack(maxspeed_mod);
+ else if (IS_ONGROUND(self))
+ PM_walk(buttons_prev, maxspeed_mod);
+
else
- {
- if (IS_ONGROUND(self))
- PM_walk(buttons_prev, maxspeed_mod);
- else
- PM_air(buttons_prev, maxspeed_mod);
- }
+ PM_air(buttons_prev, maxspeed_mod);
#ifdef SVQC
if (!IS_OBSERVER(self))
if (IS_ONGROUND(self))
self.lastground = time;
-#ifdef SVQC
// conveyors: then break velocity again
- if (self.conveyor.state)
+ if(self.conveyor.state)
self.velocity += self.conveyor.movedir;
-#endif
+
self.lastflags = self.flags;
+
self.lastclassname = self.classname;
}
#endif
{
PM_Main();
-}
\ No newline at end of file
+
+#ifdef CSQC
+ self.pmove_flags =
+ ((self.flags & FL_DUCKED) ? PMF_DUCKED : 0) |
+ (!(self.flags & FL_JUMPRELEASED) ? 0 : PMF_JUMP_HELD) |
+ ((self.flags & FL_ONGROUND) ? PMF_ONGROUND : 0);
+#endif
+}