Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 4636 → Rev 4637

/polymer/eduke32/build/src/defs.c
95,6 → 95,8
 
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
static int32_t nextvoxid = 0;
static char *faketilebuffer = NULL;
static int32_t faketilebuffersiz = 0;
 
#ifdef USE_OPENGL
extern float alphahackarray[MAXTILES];
171,26 → 173,31
 
static void tile_from_truecolpic(int32_t tile, const palette_t *picptr, int32_t alphacut)
{
const int32_t xsiz = tilesiz[tile].x, ysiz = tilesiz[tile].y;
int32_t i, j;
const vec2_t siz = tilesiz[tile];
int32_t i, j, tsiz = siz.x * siz.y;
 
char *ftd = (char *)Xmalloc(xsiz*ysiz);
if (tsiz > faketilebuffersiz)
{
faketilebuffer = (char *) Xrealloc(faketilebuffer, tsiz);
faketilebuffersiz = tsiz;
}
 
faketiledata[tile] = (char *)Xmalloc(xsiz*ysiz + 400);
faketiledata[tile] = (char *)Xmalloc(tsiz + 32);
 
for (i=xsiz-1; i>=0; i--)
for (i=siz.x-1; i>=0; i--)
{
for (j=ysiz-1; j>=0; j--)
uint32_t ofs = i * siz.y;
 
for (j=siz.y-1; j>=0; j--)
{
const palette_t *col = &picptr[j*xsiz+i];
if (col->f < alphacut) { ftd[i*ysiz+j] = 255; continue; }
ftd[i*ysiz+j] = getclosestcol(col->b>>2,col->g>>2,col->r>>2);
const palette_t *col = &picptr[j*siz.x+i];
if (col->f < alphacut) { faketilebuffer[ofs+j] = 255; continue; }
faketilebuffer[ofs+j] = getclosestcol(col->b>>2, col->g>>2, col->r>>2);
}
// initprintf(" %d %d %d %d\n",col->r,col->g,col->b,col->f);
}
 
faketilesiz[tile] = LZ4_compress(ftd, faketiledata[tile], xsiz*ysiz);
Bfree(ftd);
faketilesiz[tile] = LZ4_compress(faketilebuffer, faketiledata[tile], tsiz);
}
 
#undef USE_DEF_PROGRESS
277,6 → 284,7
iter = 0;
}
#endif
handleevents();
if (quitevent) return 0;
tokn = getatoken(script,basetokens,ARRAY_SIZE(basetokens));
cmdtokptr = script->ltextptr;
1586,7 → 1594,7
break;
}
 
i = kprender(filebuf, filesize, (intptr_t)highpaldata, xsiz*sizeof(coltype), xsiz, ysiz, 0, 0);
i = kprender(filebuf, filesize, (intptr_t)highpaldata, xsiz*sizeof(coltype), xsiz, ysiz);
Bfree(filebuf);
if (i)
{ Bfree(highpaldata); initprintf("Error: failed rendering \"%s\".\n", fn); break; }
2167,6 → 2175,9
 
scriptfile_clearsymbols();
 
DO_FREE_AND_NULL(faketilebuffer);
faketilebuffersiz = 0;
 
if (!script) return -1;
 
initprintf("\n");