]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix lighting origins on CSQC entities.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Apr 2018 21:59:24 +0000 (21:59 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Apr 2018 21:59:24 +0000 (21:59 +0000)
Fix a couple crashes with showtex 1 on level change where prog is not fully initialized.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12409 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
world.c

index 6c2d1eff6b9c74d9c2dbb71f92c6c1a33ebf5aff..68dbd8394cabd71119ad0dcf2df71ed339b1efa1 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -349,8 +349,8 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum)
 
        // LadyHavoc: use the CL_GetTagMatrix function on self to ensure consistent behavior (duplicate code would be bad)
        // this also sets the custommodellight_origin for us
-       VectorCopy(modellight_origin, entrender->custommodellight_origin);
        CL_GetTagMatrix(prog, &entrender->matrix, ed, 0, modellight_origin);
+       VectorCopy(modellight_origin, entrender->custommodellight_origin);
 
        // set up the animation data
        VM_GenerateFrameGroupBlend(prog, ed->priv.server->framegroupblend, ed);
diff --git a/world.c b/world.c
index 60bd0937728f7a5e6275c8281bdcd4adca5cf17d..c62a83fa7eeeec1b9eadf9c10ec6cf660e19b790 100644 (file)
--- a/world.c
+++ b/world.c
@@ -185,6 +185,10 @@ int World_EntitiesInBox(world_t *world, const vec3_t requestmins, const vec3_t r
        vec3_t paddedmins, paddedmaxs;
        int igrid[3], igridmins[3], igridmaxs[3];
 
+       // avoid crash in showtex code on level change
+       if (prog == NULL || prog->num_edicts < 1)
+               return 0;
+
        // LordHavoc: discovered this actually causes its own bugs (dm6 teleporters being too close to info_teleport_destination)
        //VectorSet(paddedmins, requestmins[0] - 1.0f, requestmins[1] - 1.0f, requestmins[2] - 1.0f);
        //VectorSet(paddedmaxs, requestmaxs[0] + 1.0f, requestmaxs[1] + 1.0f, requestmaxs[2] + 1.0f);