From ecf20de61836844a2285e19288f61b8ff8cf7a58 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Sun, 15 Oct 2023 05:56:25 +0100 Subject: [PATCH] Work around an issue with the remaster's e3m3. --- Quake/gl_model.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Quake/gl_model.c b/Quake/gl_model.c index cc053018..c2786134 100644 --- a/Quake/gl_model.c +++ b/Quake/gl_model.c @@ -1606,9 +1606,17 @@ static void Mod_LoadFaces (lump_t *l, qboolean bsp2) if (Mod_ParseWorldspawnKey(loadmodel, "lightmap_scale", scalebuf, sizeof(scalebuf))) { - i = atoi(scalebuf); - for(defaultshift = 0; i > 1; defaultshift++) - i >>= 1; + char *e; + i = strtol(scalebuf, &e, 10); + if (i < 0 || *e) + Con_Warning("Incorrect value for lightmap_scale field - %s - should be texels-per-luxel (and power-of-two), use 16 to match vanilla quake.\n", scalebuf); + else if (i == 0) + ; //silently use default when its explicitly set to 0 or empty. a bogus value but oh well. + else + { + for(defaultshift = 0; i > 1; defaultshift++) + i >>= 1; + } } }