]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed MOVETYPE_STEP and MOVETYPE_WALK to match Quake behavior (unable
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Mar 2013 04:57:07 +0000 (04:57 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 2 Mar 2013 04:57:07 +0000 (04:57 +0000)
to move when allsolid - but also check SUPERCONTENTS_SOLID), this makes
hip2m3 shalrath work again

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11923 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_phys.c
svvm_cmds.c

index ce3fcfa19ede703f5544a78189bb3ec6106989fc..669174bc42ff785c66cd4b03f6ed9d9b9af6c54d 100644 (file)
--- a/server.h
+++ b/server.h
@@ -566,6 +566,10 @@ void SV_LinkEdict_TouchAreaGrid_Call(prvm_edict_t *touch, prvm_edict_t *ent); //
  * returns true if it found a better place
  */
 qboolean SV_UnstickEntity (prvm_edict_t *ent);
+/*! move an entity that is stuck out of the surface it is stuck in (can move large amounts)
+ * returns true if it found a better place
+ */
+qboolean SV_NudgeOutOfSolid(prvm_edict_t *ent);
 
 /// calculates hitsupercontentsmask for a generic qc entity
 int SV_GenericHitSuperContentsMask(const prvm_edict_t *edict);
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;
index ec7eac412094cd79b96a98ed89445599b20021b9..c13608dedd5c6d92140b986c5daefa437a45a826 100644 (file)
@@ -1148,8 +1148,7 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
        end[2] -= 256;
 
        if (sv_gameplayfix_droptofloorstartsolid_nudgetocorrect.integer)
-               if (sv_gameplayfix_unstickentities.integer)
-                       SV_UnstickEntity(ent);
+               SV_NudgeOutOfSolid(ent);
 
        VectorCopy(PRVM_serveredictvector(ent, origin), entorigin);
        VectorCopy(PRVM_serveredictvector(ent, mins), entmins);
@@ -1165,8 +1164,6 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
                if (trace.startsolid)
                {
                        Con_DPrintf("droptofloor at %f %f %f - COULD NOT FIX BADLY PLACED ENTITY\n", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]);
-                       if (sv_gameplayfix_unstickentities.integer)
-                               SV_UnstickEntity(ent);
                        SV_LinkEdict(ent);
                        PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) | FL_ONGROUND;
                        PRVM_serveredictedict(ent, groundentity) = 0;
@@ -1176,8 +1173,8 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
                {
                        Con_DPrintf("droptofloor at %f %f %f - FIXED BADLY PLACED ENTITY\n", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]);
                        VectorCopy (trace.endpos, PRVM_serveredictvector(ent, origin));
-                       if (sv_gameplayfix_unstickentities.integer)
-                               SV_UnstickEntity(ent);
+                       if (sv_gameplayfix_droptofloorstartsolid_nudgetocorrect.integer)
+                               SV_NudgeOutOfSolid(ent);
                        SV_LinkEdict(ent);
                        PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) | FL_ONGROUND;
                        PRVM_serveredictedict(ent, groundentity) = PRVM_EDICT_TO_PROG(trace.ent);
@@ -1188,10 +1185,9 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
        }
        else
        {
-               if (trace.fraction != 1)
+               if (!trace.allsolid && trace.fraction < 1)
                {
-                       if (trace.fraction < 1)
-                               VectorCopy (trace.endpos, PRVM_serveredictvector(ent, origin));
+                       VectorCopy (trace.endpos, PRVM_serveredictvector(ent, origin));
                        SV_LinkEdict(ent);
                        PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) | FL_ONGROUND;
                        PRVM_serveredictedict(ent, groundentity) = PRVM_EDICT_TO_PROG(trace.ent);