]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_cmds.c
added some memory corruption checks, trying to find a bug
[xonotic/darkplaces.git] / pr_cmds.c
index 49cc08d2fb54d776b52b059b2882b5b9c808e4da..08a1368efcc24e45b7bad39162740e9f93375f61 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -262,7 +262,7 @@ void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate)
                
                VectorCopy (min, bounds[0]);
                VectorCopy (max, bounds[1]);
-               
+
                rmin[0] = rmin[1] = rmin[2] = 9999;
                rmax[0] = rmax[1] = rmax[2] = -9999;
                
@@ -350,16 +350,16 @@ void PF_setmodel (void)
        for (i=0, check = sv.model_precache ; *check ; i++, check++)
                if (!strcmp(*check, m))
                        break;
-                       
+
        if (!*check)
                PR_RunError ("no precache: %s\n", m);
-               
+
 
        e->v.model = m - pr_strings;
        e->v.modelindex = i; //SV_ModelIndex (m);
 
        mod = sv.models[ (int)e->v.modelindex];  // Mod_ForName (m, true);
-       
+
        if (mod)
        /*
        { // LordHavoc: corrected model bounding box, but for compatibility that means I have to break it here
@@ -374,7 +374,7 @@ void PF_setmodel (void)
                        SetMinMaxSize (e, mod->mins, mod->maxs, true);
        }
        */
-               SetMinMaxSize (e, mod->mins, mod->maxs, true);
+               SetMinMaxSize (e, mod->normalmins, mod->normalmaxs, true);
        else
                SetMinMaxSize (e, vec3_origin, vec3_origin, true);
 }
@@ -646,7 +646,7 @@ void PF_ambientsound (void)
        for (soundnum=0, check = sv.sound_precache ; *check ; check++, soundnum++)
                if (!strcmp(*check,samp))
                        break;
-                       
+
        if (!*check)
        {
                Con_Printf ("no precache: %s\n", samp);
@@ -764,11 +764,12 @@ void PF_traceline (void)
        pr_global_struct->trace_inopen = trace.inopen;
        VectorCopy (trace.endpos, pr_global_struct->trace_endpos);
        VectorCopy (trace.plane.normal, pr_global_struct->trace_plane_normal);
-       pr_global_struct->trace_plane_dist =  trace.plane.dist; 
+       pr_global_struct->trace_plane_dist =  trace.plane.dist;
        if (trace.ent)
                pr_global_struct->trace_ent = EDICT_TO_PROG(trace.ent);
        else
                pr_global_struct->trace_ent = EDICT_TO_PROG(sv.edicts);
+       // FIXME: add trace_endcontents
 }
 
 
@@ -1005,7 +1006,7 @@ localcmd (string)
 void PF_localcmd (void)
 {
        char    *str;
-       
+
        str = G_STRING(OFS_PARM0);      
        Cbuf_AddText (str);
 }
@@ -1325,7 +1326,7 @@ void PF_precache_model (void)
                PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
                
        s = G_STRING(OFS_PARM0);
-       if (hlbsp && ((!s) || (!s[0])))
+       if (sv.worldmodel->ishlbsp && ((!s) || (!s[0])))
                return;
        G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
        PR_CheckEmptyString (s);
@@ -1335,7 +1336,7 @@ void PF_precache_model (void)
                if (!sv.model_precache[i])
                {
                        sv.model_precache[i] = s;
-                       sv.models[i] = Mod_ForName (s, true);
+                       sv.models[i] = Mod_ForName (s, true, true, false);
                        return;
                }
                if (!strcmp(sv.model_precache[i], s))
@@ -1570,7 +1571,7 @@ void PF_aim (void)
        VectorMA (start, 2048, dir, end);
        tr = SV_Move (start, vec3_origin, vec3_origin, end, MOVE_NORMAL, ent);
        if (tr.ent && tr.ent->v.takedamage == DAMAGE_AIM
-       && (!teamplay.value || ent->v.team <=0 || ent->v.team != tr.ent->v.team) )
+       && (!teamplay.integer || ent->v.team <=0 || ent->v.team != tr.ent->v.team) )
        {
                VectorCopy (pr_global_struct->v_forward, G_VECTOR(OFS_RETURN));
                return;
@@ -1589,7 +1590,7 @@ void PF_aim (void)
                        continue;
                if (check == ent)
                        continue;
-               if (teamplay.value && ent->v.team > 0 && ent->v.team == check->v.team)
+               if (teamplay.integer && ent->v.team > 0 && ent->v.team == check->v.team)
                        continue;       // don't aim at teammate
                for (j=0 ; j<3 ; j++)
                        end[j] = check->v.origin[j]