]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Offset jumppad push target position by the entity's height in VQ3 compatibility mode...
authorMario <zacjardine@y7mail.com>
Sat, 15 Sep 2018 23:21:38 +0000 (09:21 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 15 Sep 2018 23:21:38 +0000 (09:21 +1000)
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/physics/movetypes/walk.qc
qcsrc/common/stats.qh
qcsrc/server/autocvars.qh

index 5ffdf2d1066085d9bd47fd1dd5d541af179b4671..ca1faeaf93c2ddd97e8c3ef052c3d770122cde26 100644 (file)
@@ -133,9 +133,20 @@ bool jumppad_push(entity this, entity targ)
        if (!isPushable(targ))
                return false;
 
+       vector org = targ.origin;
+#ifdef SVQC
+       if(autocvar_sv_vq3compat)
+#elif defined(CSQC)
+       if(STAT(VQ3COMPAT))
+#endif
+       {
+               org.z += targ.mins_z;
+               org.z += 1; // off by 1!
+       }
+
        if(this.enemy)
        {
-               targ.velocity = trigger_push_calculatevelocity(targ.origin, this.enemy, this.height, targ);
+               targ.velocity = trigger_push_calculatevelocity(org, this.enemy, this.height, targ);
        }
        else if(this.target && this.target != "")
        {
@@ -148,7 +159,7 @@ bool jumppad_push(entity this, entity targ)
                        else
                                RandomSelection_AddEnt(e, 1, 1);
                }
-               targ.velocity = trigger_push_calculatevelocity(targ.origin, RandomSelection_chosen_ent, this.height, targ);
+               targ.velocity = trigger_push_calculatevelocity(org, RandomSelection_chosen_ent, this.height, targ);
        }
        else
        {
index 9ac3e4299901db21051d4ea2f206fe8636bbfa30..e518fe21027fa5089623adf331c4ecabae65607d 100644 (file)
@@ -232,6 +232,9 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
        if(GAMEPLAYFIX_EASIERWATERJUMP(this) && (this.flags & FL_WATERJUMP) && !(blocked & 8))
                this.velocity = primal_velocity;
 
+       if(PHYS_WALLCLIP(this) && this.pm_time && !(this.flags & FL_WATERJUMP) && !(blocked & 8))
+               this.velocity = primal_velocity;
+
        if(applygravity)
        {
                if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !IS_ONGROUND(this))
index 85912ee1c33f915ebdf59f907c616ef2f571c4f3..20f9adba1076a7b3499f60b0ed9096ec41f0d6d2 100644 (file)
@@ -26,6 +26,8 @@ const int WATERLEVEL_SUBMERGED = 3;
 #define PHYS_JUMPSTEP(s)                    STAT(MOVEVARS_JUMPSTEP)
 #define PHYS_WALLFRICTION(s)                STAT(MOVEVARS_WALLFRICTION)
 
+#define PHYS_WALLCLIP(s)                                       STAT(MOVEVARS_WALLCLIP)
+
 #ifdef CSQC
 .float bouncestop;
 .float bouncefactor;
@@ -55,6 +57,8 @@ const int WATERLEVEL_SUBMERGED = 3;
 
 void set_movetype(entity this, int mt);
 
+.float pm_time;
+
 .float move_movetype;
 .float move_time;
 //.vector move_origin;
index d41802963a27b2df248313dd89b5f20c2324060a..8ac2516180b55726d396d96c3512e23f811c562c 100644 (file)
@@ -20,6 +20,14 @@ void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
        vector start_origin = this.origin;
        vector start_velocity = this.velocity;
 
+       if(PHYS_WALLCLIP(this) && this.pm_time)
+       {
+               if(dt >= this.pm_time || (this.flags & FL_WATERJUMP))
+                       this.pm_time = 0;
+               else
+                       this.pm_time -= dt;
+       }
+
        int clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0);
 
        if (GAMEPLAYFIX_DOWNTRACEONGROUND(this) && !(clip & 1))
@@ -45,6 +53,8 @@ void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
        // if the move did not hit the ground at any point, we're not on ground
        if (!(clip & 1))
                UNSET_ONGROUND(this);
+       else if(PHYS_WALLCLIP(this) && !this.groundentity && start_velocity.z < -200) // don't do landing time if we were just going down a slope
+               this.pm_time = 0.25;
 
        _Movetype_CheckVelocity(this);
        _Movetype_LinkEdict(this, true);
index 9b8f04041780fd55f707331540c74ab99b0e8e88..91548ccdf1a0cf2a663109a052deeb3168310092 100644 (file)
@@ -301,6 +301,11 @@ bool autocvar_sv_slick_applygravity;
 #endif
 REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
 
+#ifdef SVQC
+bool autocvar_sv_vq3compat;
+#endif
+REGISTER_STAT(VQ3COMPAT, bool, autocvar_sv_vq3compat)
+
 #ifdef SVQC
 #include "physics/movetypes/movetypes.qh"
 float warmup_limit;
@@ -360,6 +365,10 @@ REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
 REGISTER_STAT(MOVEVARS_SPECIALCOMMAND, bool)
+#ifdef SVQC
+bool autocvar_sv_wallclip;
+#endif
+REGISTER_STAT(MOVEVARS_WALLCLIP, bool, autocvar_sv_wallclip)
 
 
 #ifdef CSQC
index 2d19f6f9ab83c2d19a1bf90a50427f5d2d319f9c..4e180f731b2acd7d95efb8e74ba75b091f47f4c8 100644 (file)
@@ -316,7 +316,6 @@ string autocvar_sv_motd;
 bool autocvar_sv_precacheplayermodels;
 //float autocvar_sv_precacheweapons; // WEAPONTODO?
 bool autocvar_sv_q3acompat_machineshotgunswap;
-bool autocvar_sv_vq3compat;
 bool autocvar_sv_servermodelsonly;
 int autocvar_sv_spectate;
 float autocvar_sv_spectator_speed_multiplier;