]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_move.c
Check bbox for overlap even on bmodels again (disabling it was a speed loss)
[xonotic/darkplaces.git] / sv_move.c
index 87f3ed434a38ab1cd53b99de326a0701472b501c..4462519bf32a78d974cdf8435fbffee4bdbc47b4 100644 (file)
--- a/sv_move.c
+++ b/sv_move.c
@@ -71,7 +71,7 @@ realcheck:
        start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
        start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
        stop[2] = start[2] - 2*STEPSIZE;
-       trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
+       trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, ent);
 
        if (trace.fraction == 1.0)
                return false;
@@ -84,7 +84,7 @@ realcheck:
                        start[0] = stop[0] = x ? maxs[0] : mins[0];
                        start[1] = stop[1] = y ? maxs[1] : mins[1];
                        
-                       trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
+                       trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, ent);
                        
                        if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
                                bottom = trace.endpos[2];
@@ -110,12 +110,12 @@ pr_global_struct->trace_normal is set to the normal of the blocking wall
 qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
 {
        float           dz;
-       vec3_t          oldorg, neworg, end;
+       vec3_t          oldorg, neworg, end, traceendpos;
        trace_t         trace;
        int                     i;
        edict_t         *enemy;
 
-// try the move        
+// try the move
        VectorCopy (ent->v.origin, oldorg);
        VectorAdd (ent->v.origin, move, neworg);
 
@@ -135,23 +135,24 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
                                if (dz < 30)
                                        neworg[2] += 8;
                        }
-                       trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent);
-       
+                       trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, MOVE_NORMAL, ent);
+
                        if (trace.fraction == 1)
                        {
-                               if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY )
+                               VectorCopy(trace.endpos, traceendpos);
+                               if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(traceendpos) == CONTENTS_EMPTY )
                                        return false;   // swim monster left water
-       
-                               VectorCopy (trace.endpos, ent->v.origin);
+
+                               VectorCopy (traceendpos, ent->v.origin);
                                if (relink)
                                        SV_LinkEdict (ent, true);
                                return true;
                        }
-                       
+
                        if (enemy == sv.edicts)
                                break;
                }
-               
+
                return false;
        }
 
@@ -160,7 +161,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
        VectorCopy (neworg, end);
        end[2] -= STEPSIZE*2;
 
-       trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
+       trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
 
        if (trace.allsolid)
                return false;
@@ -168,7 +169,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
        if (trace.startsolid)
        {
                neworg[2] -= STEPSIZE;
-               trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
+               trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
                if (trace.allsolid || trace.startsolid)
                        return false;
        }
@@ -287,8 +288,8 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
        float                   d[3];
        float           tdir, olddir, turnaround;
 
-       olddir = anglemod( (int)(actor->v.ideal_yaw/45)*45 );
-       turnaround = anglemod(olddir - 180);
+       olddir = ANGLEMOD((int)(actor->v.ideal_yaw/45)*45);
+       turnaround = ANGLEMOD(olddir - 180);
 
        deltax = enemy->v.origin[0] - actor->v.origin[0];
        deltay = enemy->v.origin[1] - actor->v.origin[1];