--- /dev/null
+void _Movetype_Physics_Follow() // SV_Physics_Follow
+{
+ entity e = self.move_aiment; // TODO: networking?
+
+ // LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects
+ if(self.move_angles == self.move_punchangle)
+ {
+ self.move_origin = e.move_origin + self.view_ofs;
+ }
+ else
+ {
+ vector ang, v;
+ ang_x = -self.move_punchangle_x;
+ ang_y = self.move_punchangle_y;
+ ang_z = self.move_punchangle_z;
+ makevectors(ang);
+ v_x = self.view_ofs_x * v_forward_x + self.view_ofs_y * v_right_x + self.view_ofs_z * v_up_x;
+ v_y = self.view_ofs_x * v_forward_y + self.view_ofs_y * v_right_y + self.view_ofs_z * v_up_y;
+ v_z = self.view_ofs_x * v_forward_z + self.view_ofs_y * v_right_z + self.view_ofs_z * v_up_z;
+ ang_x = -e.move_angles_x;
+ ang_y = e.move_angles_y;
+ ang_z = e.move_angles_z;
+ makevectors(ang);
+ self.move_origin_x = v_x * v_forward_x + v_y * v_forward_y + v_z * v_forward_z + e.move_origin_x;
+ self.move_origin_x = v_x * v_right_x + v_y * v_right_y + v_z * v_right_z + e.move_origin_y;
+ self.move_origin_x = v_x * v_up_x + v_y * v_up_y + v_z * v_up_z + e.move_origin_z;
+ }
+
+ self.move_angles = e.move_angles + self.v_angle;
+ _Movetype_LinkEdict(false);
+}
#include "push.qc"
#include "toss.qc"
#include "walk.qc"
+#include "step.qc"
+#include "follow.qc"
#include "movetypes.qc"
case MOVETYPE_NONE:
break;
case MOVETYPE_FOLLOW:
- error("SV_Physics_Follow not implemented");
+ _Movetype_Physics_Follow();
break;
case MOVETYPE_NOCLIP:
_Movetype_CheckWater(self);
_Movetype_LinkEdict(false);
break;
case MOVETYPE_STEP:
- error("SV_Physics_Step not implemented");
+ _Movetype_Physics_Step(movedt);
break;
case MOVETYPE_WALK:
_Movetype_Physics_Walk(movedt);
.float move_bounce_stopspeed;
.float move_nomonsters; // -1 for MOVE_NORMAL, otherwise a MOVE_ constant
+.entity move_aiment;
+.vector move_punchangle;
+
// should match sv_gameplayfix_fixedcheckwatertransition
float autocvar_cl_gameplayfix_fixedcheckwatertransition = 1;
#ifdef SVQC
+.int stat_gameplayfix_upvelocityclearsonground;
+
#define GRAVITY_UNAFFECTED_BY_TICRATE autocvar_sv_gameplayfix_gravityunaffectedbyticrate
+#define UPWARD_VELOCITY_CLEARS_ONGROUND autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag
#define TICRATE sys_frametime
#elif defined(CSQC)
#define GRAVITY_UNAFFECTED_BY_TICRATE (getstati(STAT_MOVEFLAGS) & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+#define UPWARD_VELOCITY_CLEARS_ONGROUND getstati(STAT_GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND)
#define TICRATE ticrate
#endif
--- /dev/null
+void _Movetype_Physics_Step(float dt) // SV_Physics_Step
+{
+ if(self.move_flags & FL_ONGROUND)
+ {
+ if(self.velocity_z >= (1.0 / 32.0) && UPWARD_VELOCITY_CLEARS_ONGROUND)
+ {
+ self.move_flags &= ~FL_ONGROUND;
+ _Movetype_CheckVelocity();
+ _Movetype_FlyMove(dt, true, '0 0 0', 0);
+ _Movetype_LinkEdict(true);
+ }
+ }
+ else
+ {
+ _Movetype_CheckVelocity();
+ _Movetype_FlyMove(dt, true, '0 0 0', 0);
+ _Movetype_LinkEdict(true);
+
+ // TODO? movetypesteplandevent
+ }
+
+ _Movetype_CheckWaterTransition(self);
+}
addstat(STAT_MOVEVARS_STOPSPEED, AS_FLOAT, stat_sv_stopspeed);
addstat(STAT_MOVEVARS_AIRACCELERATE, AS_FLOAT, stat_sv_airaccelerate);
addstat(STAT_MOVEVARS_AIRSTOPACCELERATE, AS_FLOAT, stat_sv_airstopaccelerate);
+
+ addstat(STAT_GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, AS_INT, stat_gameplayfix_upvelocityclearsonground);
}
void Physics_UpdateStats(float maxspd_mod)
self.stat_sv_airaccelerate = Physics_ClientOption(self, "airaccelerate");
self.stat_sv_airstopaccelerate = Physics_ClientOption(self, "airstopaccelerate");
self.stat_sv_jumpvelocity = Physics_ClientOption(self, "jumpvelocity");
+
+ self.stat_gameplayfix_upvelocityclearsonground = UPWARD_VELOCITY_CLEARS_ONGROUND;
}
#endif
// 163 empty?
// 164 empty?
// 165 empty?
-// 166 empty?
+const int STAT_GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND = 166;
const int STAT_MULTIJUMP_MAXSPEED = 167;
const int STAT_JETPACK_REVERSE_THRUST = 168;
const int STAT_BUGRIGS_REVERSE_STOPPING = 169;
#define autocvar_utf8_enable cvar("utf8_enable")
float autocvar_waypoint_benchmark;
float autocvar_sv_gameplayfix_gravityunaffectedbyticrate;
+float autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag;
float autocvar_g_trueaim_minrange;
float autocvar_g_debug_defaultsounds;
float autocvar_g_grab_range;