make shrak work (lots of SOLID_BSP/MOVETYPE_PUSH entities with no models)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Apr 2004 23:20:30 +0000 (23:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Apr 2004 23:20:30 +0000 (23:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4080 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c
world.c

index 628591e..74b254b 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -575,11 +575,15 @@ void SV_PushMove (edict_t *pusher, float movetime)
                SV_LinkEdict (pusher, false);
                return;
        default:
-               Host_Error("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid);
+               Con_DPrintf("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid);
+               return;
        }
        index = (int) pusher->v->modelindex;
        if (index < 1 || index >= MAX_MODELS)
-               Host_Error("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex);
+       {
+               Con_DPrintf("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex);
+               return;
+       }
        pushermodel = sv.models[index];
 
        movetime2 = movetime;
diff --git a/world.c b/world.c
index 51b2457..1d6763d 100644 (file)
--- a/world.c
+++ b/world.c
@@ -311,14 +311,18 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
 
        if (ent->v->solid == SOLID_BSP)
        {
-               if (ent->v->modelindex < 0 || ent->v->modelindex > MAX_MODELS)
-                       Host_Error("SOLID_BSP with invalid modelindex!\n");
-               model = sv.models[(int) ent->v->modelindex];
+               int modelindex = ent->v->modelindex;
+               if (modelindex < 0 || modelindex > MAX_MODELS)
+               {
+                       Con_DPrintf("edict %i: SOLID_BSP with invalid modelindex!\n", NUM_FOR_EDICT(ent));
+                       modelindex = 0;
+               }
+               model = sv.models[modelindex];
                if (model != NULL)
                {
                        Mod_CheckLoaded(model);
                        if (!model->TraceBox)
-                               Host_Error("SOLID_BSP with non-collidable model\n");
+                               Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", NUM_FOR_EDICT(ent));
 
                        if (ent->v->angles[0] || ent->v->angles[2] || ent->v->avelocity[0] || ent->v->avelocity[2])
                        {
@@ -425,34 +429,34 @@ eventually rotation) of the end points
 */
 trace_t SV_ClipMoveToEntity(edict_t *ent, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int movetype)
 {
-       int i;
        trace_t trace;
        model_t *model = NULL;
        matrix4x4_t matrix, imatrix;
        float tempnormal[3], starttransformed[3], endtransformed[3];
        float starttransformedmins[3], starttransformedmaxs[3], endtransformedmins[3], endtransformedmaxs[3];
 
+       memset(&trace, 0, sizeof(trace));
+       trace.fraction = trace.realfraction = 1;
+       VectorCopy(end, trace.endpos);
+
        if ((int) ent->v->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
        {
-               i = ent->v->modelindex;
+               unsigned int modelindex = ent->v->modelindex;
                // if the modelindex is 0, it shouldn't be SOLID_BSP!
-               if (i == 0)
+               if (modelindex == 0)
                {
-                       Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent));
-                       memset(&trace, 0, sizeof(trace));
+                       Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent));
                        return trace;
                }
-               if ((unsigned int) i >= MAX_MODELS)
+               if (modelindex >= MAX_MODELS)
                {
-                       Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
-                       memset(&trace, 0, sizeof(trace));
+                       Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
                        return trace;
                }
-               model = sv.models[i];
-               if (i != 0 && model == NULL)
+               model = sv.models[modelindex];
+               if (modelindex != 0 && model == NULL)
                {
-                       Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
-                       memset(&trace, 0, sizeof(trace));
+                       Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
                        return trace;
                }
 
@@ -461,16 +465,14 @@ trace_t SV_ClipMoveToEntity(edict_t *ent, const vec3_t start, const vec3_t mins,
                {
                        if (!model->TraceBox)
                        {
-                               Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent));
-                               memset(&trace, 0, sizeof(trace));
-                               return trace;
-                       }
-                       if (ent->v->movetype != MOVETYPE_PUSH)
-                       {
-                               Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent));
-                               memset(&trace, 0, sizeof(trace));
+                               Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent));
                                return trace;
                        }
+                       //if (ent->v->movetype != MOVETYPE_PUSH)
+                       //{
+                       //      Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent));
+                       //      return trace;
+                       //}
                }
                Matrix4x4_CreateFromQuakeEntity(&matrix, ent->v->origin[0], ent->v->origin[1], ent->v->origin[2], ent->v->angles[0], ent->v->angles[1], ent->v->angles[2], 1);
        }