From f7eb5adb40fcf0d5f1ffb8c1ba7769530b4beec2 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 15 Nov 2012 14:28:00 +0000 Subject: [PATCH] Split r3159..r3161, part 4: Tweaks of tiledata_t's "cacherange" member. REM: This will need a savegame version bump. git-svn-id: https://svn.eduke32.com/eduke32@3169 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.h | 2 +- polymer/eduke32/source/gamedef.c | 14 +++++--------- polymer/eduke32/source/premap.c | 8 ++++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 229947332..6770e6f2c 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -172,7 +172,7 @@ typedef struct { uint32_t flags; // formerly SpriteFlags, ActorType - int16_t cacherange[2]; // formerly SpriteCache + int16_t cacherange; // formerly SpriteCache // todo: make this a pointer and allocate at runtime projectile_t defproj; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 4ef29b2f5..621a44370 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -4147,7 +4147,6 @@ static int32_t C_ParseCommand(int32_t loop) g_tile[*g_scriptPtr].flags |= SPRITE_NOPAL; break; case CON_PRECACHE: - g_tile[*g_scriptPtr].flags |= SPRITE_CACHE; C_GetNextValue(LABEL_DEFINE); g_scriptPtr--; i = *g_scriptPtr; @@ -4156,16 +4155,13 @@ static int32_t C_ParseCommand(int32_t loop) C_ReportError(ERROR_EXCEEDSMAXTILES); g_numCompilerErrors++; } - g_tile[j].cacherange[0] = i; + g_tile[j].cacherange = i; + C_GetNextValue(LABEL_DEFINE); g_scriptPtr--; - i = *g_scriptPtr; - if ((unsigned)i >= MAXTILES) - { - C_ReportError(ERROR_EXCEEDSMAXTILES); - g_numCompilerErrors++; - } - g_tile[j].cacherange[1] = i; + if (*g_scriptPtr) + g_tile[j].flags |= SPRITE_CACHE; + break; } continue; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 93272de19..6a44ae0c8 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -88,8 +88,8 @@ static void G_CacheSpriteNum(int32_t i) maxc = 1; - if (A_CheckSpriteTileFlags(PN, SPRITE_CACHE) && g_tile[PN].cacherange[1]) - for (j = g_tile[PN].cacherange[0]; j <= g_tile[PN].cacherange[1]; j++) + if (g_tile[PN].cacherange >= PN) + for (j = PN; j <= g_tile[PN].cacherange; j++) tloadtile(j,1); switch (DYNAMICTILEMAP(PN)) @@ -227,8 +227,8 @@ static void G_PrecacheSprites(void) if (g_tile[i].flags & SPRITE_PROJECTILE) tloadtile(i,1); - if (A_CheckSpriteTileFlags(i, SPRITE_CACHE) && g_tile[i].cacherange[1]) - for (j = g_tile[i].cacherange[0]; j <= g_tile[i].cacherange[1]; j++) + if (A_CheckSpriteTileFlags(i, SPRITE_CACHE)) + for (j = i; j <= g_tile[i].cacherange; j++) tloadtile(j,1); } tloadtile(BOTTOMSTATUSBAR,1);