Commit 22c2334c authored by Dino Bollinger's avatar Dino Bollinger Committed by Richard Gobeille

Amend commit 298d80a2 by restoring only per-map tiles from backup.

No longer backup the walock, waloff and picsiz arrays as this caused
problems elsewhere.

Fixes #66
parent ead785f4
......@@ -31,9 +31,6 @@ static int32_t tilefileoffs[MAXTILES];
static uint8_t *g_bakTileFileNum;
static int32_t *g_bakTileFileOffs;
static vec2_16_t *g_bakTileSiz;
static char *g_bakPicSiz;
static char *g_bakWalock;
static intptr_t *g_bakWaloff;
static picanm_t *g_bakPicAnm;
static char * g_bakFakeTile;
static char ** g_bakFakeTileData;
......@@ -71,7 +68,9 @@ template <typename origar_t, typename bakar_t>
static inline void RESTORE_MAPART_ARRAY(origar_t & origar, bakar_t & bakar)
EDUKE32_STATIC_ASSERT(sizeof(origar[0]) == sizeof(bakar[0]));
Bmemcpy(origar, bakar, ARRAY_SIZE(origar) * sizeof(origar[0]));
for (bssize_t i=0; i<MAXTILES; i++)
if (tilefilenum[i] >= MAXARTFILES_BASE)
origar[i] = bakar[i];
......@@ -109,19 +108,15 @@ void artClearMapArt(void)
// Restore original per-tile arrays
RESTORE_MAPART_ARRAY(tilefilenum, g_bakTileFileNum);
RESTORE_MAPART_ARRAY(tilefileoffs, g_bakTileFileOffs);
RESTORE_MAPART_ARRAY(tilesiz, g_bakTileSiz);
RESTORE_MAPART_ARRAY(picsiz, g_bakPicSiz);
RESTORE_MAPART_ARRAY(walock, g_bakWalock);
RESTORE_MAPART_ARRAY(waloff, g_bakWaloff);
RESTORE_MAPART_ARRAY(picanm, g_bakPicAnm);
RESTORE_MAPART_ARRAY(faketile, g_bakFakeTile);
RESTORE_MAPART_ARRAY(rottile, g_bakRottile);
for (size_t i = 0; i < MAXUSERTILES; ++i)
if (faketiledata[i] != g_bakFakeTileData[i])
if (tilefilenum[i] >= MAXARTFILES_BASE && faketiledata[i] != g_bakFakeTileData[i])
faketiledata[i] = g_bakFakeTileData[i];
......@@ -129,6 +124,9 @@ void artClearMapArt(void)
// must be restored last
RESTORE_MAPART_ARRAY(tilefilenum, g_bakTileFileNum);
//POGOTODO: review this to ensure we're not invalidating more than we have to
......@@ -166,9 +164,6 @@ void artSetupMapArt(const char *filename)
ALLOC_MAPART_ARRAY(tilefilenum, g_bakTileFileNum);
ALLOC_MAPART_ARRAY(tilefileoffs, g_bakTileFileOffs);
ALLOC_MAPART_ARRAY(tilesiz, g_bakTileSiz);
ALLOC_MAPART_ARRAY(picsiz, g_bakPicSiz);
ALLOC_MAPART_ARRAY(walock, g_bakWalock);
ALLOC_MAPART_ARRAY(waloff, g_bakWaloff);
ALLOC_MAPART_ARRAY(picanm, g_bakPicAnm);
ALLOC_MAPART_ARRAY(faketile, g_bakFakeTile);
ALLOC_MAPART_ARRAY(faketiledata, g_bakFakeTileData);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment