q3bsps suck.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@489 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-11-20 01:08:16 +00:00
parent c8438cbc3e
commit b8a58b4db2

View file

@ -3465,7 +3465,7 @@ int GLAllocBlock (int w, int h, int *x, int *y)
//rather than forgetting that and redoing it, let's just keep the data. //rather than forgetting that and redoing it, let's just keep the data.
int GLFillBlock (int texnum, int w, int h, int x, int y) int GLFillBlock (int texnum, int w, int h, int x, int y)
{ {
int i; int i, l;
while (texnum >= numlightmaps) //allocate 4 more lightmap slots. not much memory usage, but we don't want any caps here. while (texnum >= numlightmaps) //allocate 4 more lightmap slots. not much memory usage, but we don't want any caps here.
{ {
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4)); lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4));
@ -3485,15 +3485,21 @@ int GLFillBlock (int texnum, int w, int h, int x, int y)
for (i = texnum; i >= 0; i--) for (i = texnum; i >= 0; i--)
{ {
if (!lightmap[i]) if (!lightmap[i])
{
lightmap[i] = BZ_Malloc(sizeof(*lightmap[i])); lightmap[i] = BZ_Malloc(sizeof(*lightmap[i]));
for (l=0 ; l<LMBLOCK_HEIGHT ; l++)
{
lightmap[i]->allocated[l] = LMBLOCK_HEIGHT;
}
//maybe someone screwed with my lightmap...
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
}
else else
break; break;
} }
for (i=0 ; i<w ; i++)
{
lightmap[texnum]->allocated[x + i] = y + h;
}
return texnum; return texnum;
} }