]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - world.c
remove a superfluous -L
[xonotic/darkplaces.git] / world.c
diff --git a/world.c b/world.c
index 646204f8e2cb712d5bbd2717651bf544b06fcca4..a43544770573bc09c3833dc1af5ce3868e3f1d98 100644 (file)
--- a/world.c
+++ b/world.c
@@ -254,9 +254,27 @@ void SV_TouchAreaGrid(prvm_edict_t *ent)
                touch = touchedicts[i];
                if (touch != ent && (int)touch->fields.server->solid == SOLID_TRIGGER && touch->fields.server->touch)
                {
+                       prvm_eval_t *val;
                        prog->globals.server->self = PRVM_EDICT_TO_PROG(touch);
                        prog->globals.server->other = PRVM_EDICT_TO_PROG(ent);
                        prog->globals.server->time = sv.time;
+                       prog->globals.server->trace_allsolid = false;
+                       prog->globals.server->trace_startsolid = false;
+                       prog->globals.server->trace_fraction = 1;
+                       prog->globals.server->trace_inwater = false;
+                       prog->globals.server->trace_inopen = true;
+                       VectorCopy (touch->fields.server->origin, prog->globals.server->trace_endpos);
+                       VectorSet (prog->globals.server->trace_plane_normal, 0, 0, 1);
+                       prog->globals.server->trace_plane_dist = 0;
+                       prog->globals.server->trace_ent = PRVM_EDICT_TO_PROG(ent);
+                       if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dpstartcontents)))
+                               val->_float = 0;
+                       if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphitcontents)))
+                               val->_float = 0;
+                       if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphitq3surfaceflags)))
+                               val->_float = 0;
+                       if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphittexturename)))
+                               val->string = 0;
                        PRVM_ExecuteProgram (touch->fields.server->touch, "QC function self.touch is missing");
                }
        }
@@ -476,7 +494,7 @@ trace_t SV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_t
                model->TraceBox(model, frame, &trace, starttransformed, mins, maxs, endtransformed, hitsupercontents);
        }
        else
-               Collision_ClipTrace_Box(&trace, ent->fields.server->mins, ent->fields.server->maxs, starttransformed, mins, maxs, endtransformed, hitsupercontents, SUPERCONTENTS_SOLID);
+               Collision_ClipTrace_Box(&trace, ent->fields.server->mins, ent->fields.server->maxs, starttransformed, mins, maxs, endtransformed, hitsupercontents, ent->fields.server->solid == SOLID_CORPSE ? SUPERCONTENTS_CORPSE : SUPERCONTENTS_BODY, 0, NULL);
        trace.fraction = bound(0, trace.fraction, 1);
        trace.realfraction = bound(0, trace.realfraction, 1);
 
@@ -529,6 +547,7 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const
        int passedictprog;
        qboolean pointtrace;
        prvm_edict_t *traceowner, *touch;
+       prvm_eval_t *val;
        trace_t trace;
        // bounding box of entire move area
        vec3_t clipboxmins, clipboxmaxs;
@@ -553,14 +572,25 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const
        Con_Printf("move(%f %f %f,%f %f %f)", clipstart[0], clipstart[1], clipstart[2], clipend[0], clipend[1], clipend[2]);
 #endif
 
-       hitsupercontentsmask = SUPERCONTENTS_SOLID;
        if (passedict)
        {
-               if (passedict->fields.server->solid == SOLID_SLIDEBOX)
-                       hitsupercontentsmask |= SUPERCONTENTS_PLAYERCLIP;
-               if ((int)passedict->fields.server->flags & FL_MONSTER)
-                       hitsupercontentsmask |= SUPERCONTENTS_MONSTERCLIP;
+               val = PRVM_GETEDICTFIELDVALUE(passedict, eval_dphitcontentsmask);
+               if (val && val->_float)
+                       hitsupercontentsmask = (int)val->_float;
+               else if (passedict->fields.server->solid == SOLID_SLIDEBOX)
+               {
+                       if ((int)passedict->fields.server->flags & FL_MONSTER)
+                               hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_MONSTERCLIP;
+                       else
+                               hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_PLAYERCLIP;
+               }
+               else if (passedict->fields.server->solid == SOLID_CORPSE)
+                       hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY;
+               else
+                       hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_CORPSE;
        }
+       else
+               hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_CORPSE;
 
        // clip to world
        cliptrace = SV_ClipMoveToWorld(clipstart, clipmins, clipmaxs, clipend, type, hitsupercontentsmask);
@@ -644,12 +674,6 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const
                        // don't clip points against points (they can't collide)
                        if (pointtrace && VectorCompare(touch->fields.server->mins, touch->fields.server->maxs) && (type != MOVE_MISSILE || !((int)touch->fields.server->flags & FL_MONSTER)))
                                continue;
-                       // don't clip corpse against character
-                       if (passedict->fields.server->solid == SOLID_CORPSE && (touch->fields.server->solid == SOLID_SLIDEBOX || touch->fields.server->solid == SOLID_CORPSE))
-                               continue;
-                       // don't clip character against corpse
-                       if (passedict->fields.server->solid == SOLID_SLIDEBOX && touch->fields.server->solid == SOLID_CORPSE)
-                               continue;
                }
 
                // might interact, so do an exact clip
@@ -682,6 +706,9 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const
                        VectorCopy(trace.endpos, cliptrace.endpos);
                        cliptrace.plane = trace.plane;
                        cliptrace.ent = touch;
+                       cliptrace.hitsupercontents = trace.hitsupercontents;
+                       cliptrace.hitq3surfaceflags = trace.hitq3surfaceflags;
+                       cliptrace.hittexture = trace.hittexture;
                }
                cliptrace.startsupercontents |= trace.startsupercontents;
        }