- minor reorganization of tiles.

This commit is contained in:
Christoph Oelckers 2019-10-08 19:46:39 +02:00
parent b78b53d75b
commit 93f9303c62
3 changed files with 16 additions and 77 deletions

View file

@ -839,6 +839,11 @@ typedef struct {
int8_t xofs, yofs;
uint8_t sf; // anim. speed and flags
uint8_t extra;
void Clear()
{
extra = sf = yofs = xofs = num = 0;
}
} picanm_t;
EXTERN picanm_t picanm[MAXTILES];
typedef struct { int16_t newtile; int16_t owner; } rottile_t;
@ -1053,7 +1058,7 @@ typedef struct {
typedef struct artheader_t {
int32_t tilestart, tileend, numtiles;
} artheader_t;
#define ARTv1_UNITOFFSET ((signed)(4*sizeof(int32_t) + 2*sizeof(int16_t) + sizeof(picanm_t)))
#define ARTv1_UNITOFFSET 24 // using siseof does not work because picanm_t is not the in-file format.
int32_t enginePreInit(void); // a partial setup of the engine used for launch windows
int32_t engineInit(void);

View file

@ -1017,7 +1017,7 @@ static int32_t defsparser(scriptfile *script)
if (texstatus < 0)
break;
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
picanm[tile].Clear();
break;
}
@ -1041,8 +1041,8 @@ static int32_t defsparser(scriptfile *script)
if (xsiz > 0 && ysiz > 0)
{
tileSetSize(tile, xsiz, ysiz);
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
tileSetupDummy(tile);
picanm[tile].Clear();
tileSetupDummy(tile);
}
break;
@ -1072,8 +1072,8 @@ static int32_t defsparser(scriptfile *script)
for (i=tile1; i<=tile2; i++)
{
tileSetSize(i, xsiz, ysiz);
Bmemset(&picanm[i], 0, sizeof(picanm_t));
tileSetupDummy(i);
picanm[i].Clear();
tileSetupDummy(i);
}
break;
@ -2287,8 +2287,8 @@ static int32_t defsparser(scriptfile *script)
if (xsiz > 0 && ysiz > 0)
{
tileSetSize(tile, xsiz, ysiz);
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
tileSetupDummy(tile);
picanm[tile].Clear();
tileSetupDummy(tile);
}
#ifdef USE_OPENGL
xscale = 1.0f / xscale;

View file

@ -132,10 +132,6 @@ void artClearMapArt(void)
#ifdef USE_OPENGL
//POGOTODO: review this to ensure we're not invalidating more than we have to
gltexinvalidatetype(INVALIDATE_ART);
# ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_texinvalidate();
# endif
#endif
}
@ -255,8 +251,7 @@ static void tileSoftDelete(int32_t const tile)
waloff[tile] = 0;
faketile[tile>>3] &= ~pow2char[tile&7];
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
picanm[tile].Clear();
}
void tileDelete(int32_t const tile)
@ -507,9 +502,7 @@ static int32_t artReadIndexedFile(int32_t tilefilei)
const int32_t permap = (tilefilei >= MAXARTFILES_BASE); // is it a per-map ART file?
buildvfs_kfd fil;
auto kopen4loadfunc = bloodhack == 2 ? kopen4loadfrommod : kopen4load;
if ((fil = kopen4loadfunc(fn, 0)) != buildvfs_kfd_invalid)
if ((fil = kopen4loadfrommod(fn, 0)) != buildvfs_kfd_invalid)
{
artheader_t local;
int const headerval = artReadHeader(fil, fn, &local);
@ -543,11 +536,7 @@ static int32_t artReadIndexedFile(int32_t tilefilei)
artReadManifest(fil, &local);
#ifndef USE_PHYSFS
if (cache1d_file_fromzip(fil))
#else
if (1)
#endif
{
if (permap)
artPreloadFileSafe(fil, &local);
@ -570,10 +559,6 @@ static int32_t artReadIndexedFile(int32_t tilefilei)
}
}
#ifdef DEBUGGINGAIDS
if (permap)
initprintf("Read in per-map ART file \"%s\"\n", fn);
#endif
kclose(fil);
return 0;
}
@ -619,7 +604,6 @@ int32_t artLoadFiles(const char *filename, int32_t askedsize)
//
// loadtile
//
static void tilePostLoad(int16_t tilenume);
bool tileLoad(int16_t tileNum)
{
@ -636,23 +620,6 @@ bool tileLoad(int16_t tileNum)
tileLoadData(tileNum, dasiz, (char *) waloff[tileNum]);
/*
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST &&
in3dmode())
{
//POGOTODO: this type stuff won't be necessary down the line -- review this
int type;
for (type = 0; type <= 1; ++type)
{
gltexinvalidate(tileNum, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED);
texcache_fetch(tileNum, 0, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED);
}
}
#endif
*/
tilePostLoad(tileNum);
return (waloff[tileNum] != 0 && tilesiz[tileNum].x > 0 && tilesiz[tileNum].y > 0);
}
@ -742,39 +709,6 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer)
artfilplc = tilefileoffs[tilenume]+dasiz;
}
static void tilePostLoad(int16_t tilenume)
{
#if !defined DEBUG_TILESIZY_512 && !defined DEBUG_TILEOFFSETS
UNREFERENCED_PARAMETER(tilenume);
#endif
#ifdef DEBUG_TILESIZY_512
if (tilesizy[tilenume] >= 512)
{
int32_t i;
char *p = (char *) waloff[tilenume];
for (i=0; i<tilesizx[tilenume]*tilesizy[tilenume]; i++)
p[i] = i;
}
#endif
#ifdef DEBUG_TILEOFFSETS
// Add some dark blue marker lines to STEAM and CEILINGSTEAM.
// See test_tileoffsets.map.
if (tilenume==1250 || tilenume==1255)
{
char *p = (char *) waloff[tilenume];
p[0] = p[1] = p[2] = p[3] = 254;
}
// Add some offset to the cocktail glass neon sign. It's more asymmetric
// than the steam, and thus more suited to debugging the spatial
// orientation of drawn sprites.
if (tilenume==1008)
{
picanm[tilenume].xofs = 8;
picanm[tilenume].yofs = 12;
}
#endif
}
int32_t tileCRC(int16_t tileNum)
{
@ -810,7 +744,7 @@ intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz)
cacheAllocateBlock(&waloff[tilenume], dasiz, &walock[tilenume]);
tileSetSize(tilenume, xsiz, ysiz);
Bmemset(&picanm[tilenume], 0, sizeof(picanm_t));
picanm[tilenume].Clear();
return waloff[tilenume];
}