]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
changed MOVETYPE_STEP and MOVETYPE_WALK to match Quake behavior (unable
[xonotic/darkplaces.git] / sv_phys.c
index 7a158800fd760ff1594eafeac0f3683ec1d809b8..6b1c8c6cc4966a498f9246799410c7190cd661f4 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1248,7 +1248,7 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
        int i, j, numplanes;
        float d, time_left, gravity;
        vec3_t dir, push, planes[MAX_CLIP_PLANES];
-       prvm_vec3_t primal_velocity, original_velocity, new_velocity;
+       prvm_vec3_t primal_velocity, original_velocity, new_velocity, restore_velocity;
 #if 0
        vec3_t end;
 #endif
@@ -1257,6 +1257,8 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
                return 0;
        gravity = 0;
 
+       VectorCopy(PRVM_serveredictvector(ent, velocity), restore_velocity);
+
        if(applygravity)
        {
                gravity = SV_Gravity(ent);
@@ -1281,7 +1283,7 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
                        break;
 
                VectorScale(PRVM_serveredictvector(ent, velocity), time_left, push);
-               if(!SV_PushEntity(&trace, ent, push, false, false))
+               if(!SV_PushEntity(&trace, ent, push, true, false))
                {
                        // we got teleported by a touch function
                        // let's abort the move
@@ -1289,6 +1291,15 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
                        break;
                }
 
+               // this code is used by MOVETYPE_WALK and MOVETYPE_STEP and SV_UnstickEntity
+               // abort move if it started in SUPERCONTENTS_SOLID (not SUPERCONTENTS_BODY used by SOLID_BBOX)
+               // note the SV_PushEntity call above must pass true for failonbmodelstartsolid
+               if (trace.allsolid && (trace.startsupercontents & SUPERCONTENTS_SOLID))
+               {
+                       VectorCopy(restore_velocity, PRVM_serveredictvector(ent, velocity));
+                       return 3;
+               }
+
                if (trace.fraction == 1)
                        break;
                if (trace.plane.normal[2])
@@ -1575,7 +1586,7 @@ static qboolean SV_NudgeOutOfSolid_PivotIsKnownGood(prvm_edict_t *ent, vec3_t pi
        return true;
 }
 
-static qboolean SV_NudgeOutOfSolid(prvm_edict_t *ent)
+qboolean SV_NudgeOutOfSolid(prvm_edict_t *ent)
 {
        prvm_prog_t *prog = SVVM_prog;
        int bump;