]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
For completeness, port step and follow movetypes (untested)
authorMario <zacjardine@y7mail.com>
Sun, 5 Apr 2015 10:55:37 +0000 (20:55 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 5 Apr 2015 10:55:37 +0000 (20:55 +1000)
qcsrc/common/movetypes/follow.qc [new file with mode: 0644]
qcsrc/common/movetypes/include.qc
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/movetypes/movetypes.qh
qcsrc/common/movetypes/step.qc [new file with mode: 0644]
qcsrc/common/physics.qc
qcsrc/common/stats.qh
qcsrc/server/autocvars.qh

diff --git a/qcsrc/common/movetypes/follow.qc b/qcsrc/common/movetypes/follow.qc
new file mode 100644 (file)
index 0000000..6cf28d6
--- /dev/null
@@ -0,0 +1,31 @@
+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);
+}
index 64d92d4a99fc7fc59c7bd506837b11612a04cda9..322b3c4de13de003a1218820aa57ea0dea1a3941 100644 (file)
@@ -1,5 +1,7 @@
 #include "push.qc"
 #include "toss.qc"
 #include "walk.qc"
+#include "step.qc"
+#include "follow.qc"
 
 #include "movetypes.qc"
index a7351ac6625327739596f6cd4954557b7b7b9164..3dd286e0000e52547cb50c2af1dd8c36088f46a7 100644 (file)
@@ -575,7 +575,7 @@ void _Movetype_Physics_Frame(float movedt)
                case MOVETYPE_NONE:
                        break;
                case MOVETYPE_FOLLOW:
-                       error("SV_Physics_Follow not implemented");
+                       _Movetype_Physics_Follow();
                        break;
                case MOVETYPE_NOCLIP:
                        _Movetype_CheckWater(self);
@@ -584,7 +584,7 @@ void _Movetype_Physics_Frame(float movedt)
                        _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);
index 88b545fe110bb0d76a5f90bd865518838a442805..67cd51e16b7d1e1a153558c2a103dd2115c49663 100644 (file)
 .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
diff --git a/qcsrc/common/movetypes/step.qc b/qcsrc/common/movetypes/step.qc
new file mode 100644 (file)
index 0000000..822bf09
--- /dev/null
@@ -0,0 +1,23 @@
+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);
+}
index d2a9b1d373ce66b1ab4d43bf8c0fb8e6eb1a7a88..0a8d5e0c7b530f3491169316255c01aeaceea45b 100644 (file)
@@ -79,6 +79,8 @@ void Physics_AddStats()
        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)
@@ -133,6 +135,8 @@ 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
 
index d668862d24dcd6a450f108ceb21653382d6f2043..edbe4ecde399b6bb85f61761a6971e32fc800be1 100644 (file)
@@ -194,7 +194,7 @@ const int STAT_VIP_PINK               = 104;
 // 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;
index 6934d3ca3461c88102198af3cafcfcbea55c103f..d545963cf20250c192ce3e80e64405be83132ba1 100644 (file)
@@ -736,6 +736,7 @@ float autocvar_timelimit_suddendeath;
 #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;