]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix a bunch of things that should have been checking if the model (usually cl.worldmo...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 12 Jul 2003 16:50:07 +0000 (16:50 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 12 Jul 2003 16:50:07 +0000 (16:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3261 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cl_particles.c
gl_rsurf.c
r_lerpanim.c
r_light.c

index 7dfb971fbfaebf42926da0362323bc7313b2366b..820d6253dca8c0299c18a387b302d3b4afd15a08 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -452,7 +452,8 @@ dlightsetup:
        //Con_Printf("dlight %i : %f %f %f : %f %f %f\n", i, org[0], org[1], org[2], red * radius, green * radius, blue * radius);
        memset (dl, 0, sizeof(*dl));
        dl->ent = ent;
-       cl.worldmodel->FindNonSolidLocation(cl.worldmodel, org, dl->origin, 6);
+       if (cl.worldmodel)
+               cl.worldmodel->FindNonSolidLocation(cl.worldmodel, org, dl->origin, 6);
        //VectorCopy(org, dl->origin);
        dl->radius = radius;
        dl->color[0] = red;
index c25a3b4b6a112b5e9838548cd661aa513aff400c..da6be2fa7cb02089b5bd825ec3fba9a41b93a1c5 100644 (file)
@@ -458,6 +458,9 @@ void CL_ReadPointFile_f (void)
        char *pointfile = NULL, *pointfilepos, *t, tchar;
        char name[MAX_OSPATH];
 
+       if (!cl.worldmodel)
+               return;
+
        FS_StripExtension(cl.worldmodel->name, name);
        strcat(name, ".pts");
 #if WORKINGLQUAKE
index 51be852cd5aae54ad66b745d7fac8c6668498818..35b582a57d8038a139ef3ea817f9b1636d42a234 100644 (file)
@@ -1764,7 +1764,7 @@ void R_WorldVisibility (entity_render_t *ent)
        mleaf_t *viewleaf;
 
        Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg);
-       viewleaf = ent->model->PointInLeaf(ent->model, modelorg);
+       viewleaf = ent->model ? ent->model->PointInLeaf(ent->model, modelorg) : NULL;
        R_PVSUpdate(ent, viewleaf);
 
        if (!viewleaf)
index 91b55bff88e3893e336796f31dc2d0dc0c6d03fd..0a91e8133c25b1f0d9af446267c764a66065fcbb 100644 (file)
@@ -11,7 +11,7 @@ void R_LerpAnimation(entity_render_t *r)
        animscene_t *scene;
        frameblend_t *blend;
 
-       if (!r->model)
+       if (!r->model || !r->model->type)
                return;
 
        blend = r->frameblend;
index 7da1daa005f448b648ad92b8d80846fbc6684483..2e5067da623b439abe5a628c2ce38641aea86816 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -298,7 +298,7 @@ static void R_VisMarkLights (entity_render_t *ent, rdlight_t *rd, int bit, int b
        int row;
        float low[3], high[3], dist, maxdist;
 
-       if (!r_dynamic.integer)
+       if (!r_dynamic.integer || !ent->model)
                return;
 
        Matrix4x4_Transform(&ent->inversematrix, rd->origin, lightorigin);
@@ -579,7 +579,7 @@ void R_CompleteLightPoint (vec3_t color, const vec3_t p, int dynamic, const mlea
        float f;
        rdlight_t *rd;
        mlight_t *sl;
-       if (leaf == NULL)
+       if (leaf == NULL && cl.worldmodel != NULL)
                leaf = cl.worldmodel->PointInLeaf(cl.worldmodel, p);
        if (!leaf || leaf->contents == CONTENTS_SOLID || r_fullbright.integer || !cl.worldmodel->lightdata)
        {
@@ -681,7 +681,7 @@ int R_LightModel(float *ambient4f, const entity_render_t *ent, float colorr, flo
                ambient4f[3] = colora;
                return false;
        }
-       leaf = cl.worldmodel->PointInLeaf(cl.worldmodel, ent->origin);
+       leaf = cl.worldmodel ? cl.worldmodel->PointInLeaf(cl.worldmodel, ent->origin) : NULL;
        if (!leaf || leaf->contents == CONTENTS_SOLID || !cl.worldmodel->lightdata)
                ambient4f[0] = ambient4f[1] = ambient4f[2] = 1;
        else