]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - world_cs.c
fix a few typos in comments
[xonotic/darkplaces.git] / world_cs.c
index 4a24d25fafe298f2ae9354bf437b1f37497d967a..9dfaffcaf7c48cb00c3aa1ca92f0788484e00036 100644 (file)
@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // world.c -- world query functions
 
 #include "quakedef.h"
+#include "csprogs.h"
 
 /*
 
@@ -321,7 +322,7 @@ void CSSV_LinkEdict (prvm_edict_t *ent, qboolean touch_triggers)
 
        if (ent->fields.client->solid == SOLID_BSP)
        {
-               int modelindex = ent->fields.client->modelindex;
+               int modelindex = (int)ent->fields.client->modelindex;
                if (modelindex < 0 || modelindex > MAX_MODELS)
                {
                        Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
@@ -449,7 +450,7 @@ trace_t CSSV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_
 
        if ((int) ent->fields.client->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
        {
-               unsigned int modelindex = ent->fields.client->modelindex;
+               unsigned int modelindex = (unsigned int)ent->fields.client->modelindex;
                // if the modelindex is 0, it shouldn't be SOLID_BSP!
                if (modelindex == 0)
                {
@@ -501,7 +502,7 @@ trace_t CSSV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_
                model->TraceBox(model, frame, &trace, starttransformed, mins, maxs, endtransformed, hitsupercontents);
        }
        else
-               Collision_ClipTrace_Box(&trace, ent->fields.client->mins, ent->fields.client->maxs, starttransformed, mins, maxs, endtransformed, hitsupercontents, SUPERCONTENTS_SOLID);
+               Collision_ClipTrace_Box(&trace, ent->fields.client->mins, ent->fields.client->maxs, starttransformed, mins, maxs, endtransformed, hitsupercontents, ent->fields.client->solid == SOLID_CORPSE ? SUPERCONTENTS_CORPSE : SUPERCONTENTS_BODY, 0, NULL);
        trace.fraction = bound(0, trace.fraction, 1);
        trace.realfraction = bound(0, trace.realfraction, 1);
 
@@ -537,6 +538,7 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
        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;
@@ -561,14 +563,25 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
        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.client->solid == SOLID_SLIDEBOX)
-                       hitsupercontentsmask |= SUPERCONTENTS_PLAYERCLIP;
-               if ((int)passedict->fields.client->flags & FL_MONSTER)
-                       hitsupercontentsmask |= SUPERCONTENTS_MONSTERCLIP;
+               val = PRVM_GETEDICTFIELDVALUE(passedict, csqc_fieldoff_dphitcontentsmask);
+               if (val && val->_float)
+                       hitsupercontentsmask = (int)val->_float;
+               else if (passedict->fields.client->solid == SOLID_SLIDEBOX)
+               {
+                       if ((int)passedict->fields.client->flags & FL_MONSTER)
+                               hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_MONSTERCLIP;
+                       else
+                               hitsupercontentsmask = SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_PLAYERCLIP;
+               }
+               else if (passedict->fields.client->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 = CSSV_ClipMoveToEntity(prog->edicts, clipstart, clipmins, clipmaxs, clipend, type, hitsupercontentsmask);
@@ -621,7 +634,7 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
        // precalculate passedict's owner edict pointer for comparisons
        traceowner = passedict ? PRVM_PROG_TO_EDICT(passedict->fields.client->owner) : 0;
 
-       // clip to enttiies
+       // clip to entities
        numtouchedicts = CSSV_EntitiesInBox(clipboxmins, clipboxmaxs, MAX_EDICTS, touchedicts);
        if (numtouchedicts > MAX_EDICTS)
        {
@@ -652,12 +665,6 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
                        // don't clip points against points (they can't collide)
                        if (pointtrace && VectorCompare(touch->fields.client->mins, touch->fields.client->maxs) && (type != MOVE_MISSILE || !((int)touch->fields.client->flags & FL_MONSTER)))
                                continue;
-                       // don't clip corpse against character
-                       if (passedict->fields.client->solid == SOLID_CORPSE && (touch->fields.client->solid == SOLID_SLIDEBOX || touch->fields.client->solid == SOLID_CORPSE))
-                               continue;
-                       // don't clip character against corpse
-                       if (passedict->fields.client->solid == SOLID_SLIDEBOX && touch->fields.client->solid == SOLID_CORPSE)
-                               continue;
                }
 
                // might interact, so do an exact clip
@@ -690,6 +697,9 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
                        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;
        }
@@ -711,7 +721,7 @@ trace_t CSSV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, cons
 #if COLLISIONPARANOID < 3
                if (trace.startsolid || endstuck)
 #endif
-                       Con_Printf("%s{e%i:%f %f %f:%f %f %f:%f:%f %f %f%s%s}\n", (trace.startsolid || endstuck) ? "\002" : "", passedict ? passedict - prog->edicts : -1, passedict->fields.client->origin[0], passedict->fields.client->origin[1], passedict->fields.client->origin[2], end[0] - passedict->fields.client->origin[0], end[1] - passedict->fields.client->origin[1], end[2] - passedict->fields.client->origin[2], trace.fraction, trace.endpos[0] - passedict->fields.client->origin[0], trace.endpos[1] - passedict->fields.client->origin[1], trace.endpos[2] - passedict->fields.client->origin[2], trace.startsolid ? " startstuck" : "", endstuck ? " endstuck" : "");
+                       Con_Printf("%s{e%i:%f %f %f:%f %f %f:%f:%f %f %f%s%s}\n", (trace.startsolid || endstuck) ? "^3" : "", passedict ? passedict - prog->edicts : -1, passedict->fields.client->origin[0], passedict->fields.client->origin[1], passedict->fields.client->origin[2], end[0] - passedict->fields.client->origin[0], end[1] - passedict->fields.client->origin[1], end[2] - passedict->fields.client->origin[2], trace.fraction, trace.endpos[0] - passedict->fields.client->origin[0], trace.endpos[1] - passedict->fields.client->origin[1], trace.endpos[2] - passedict->fields.client->origin[2], trace.startsolid ? " startstuck" : "", endstuck ? " endstuck" : "");
        }
        return trace;
 }
@@ -722,9 +732,4 @@ int CSSV_PointSuperContents(const vec3_t point)
        return CSSV_Move(point, vec3_origin, vec3_origin, point, sv_gameplayfix_swiminbmodels.integer ? MOVE_NOMONSTERS : MOVE_WORLDONLY, NULL).startsupercontents;
 }
 
-int CSSV_PointQ1Contents(const vec3_t point)
-{
-       return Mod_Q1BSP_NativeContentsFromSuperContents(NULL, CSSV_PointSuperContents(point));
-}
-