Reserve 16 tiles from the end of MAXTILES, don't allow as user tiles from ART/DEF.

git-svn-id: https://svn.eduke32.com/eduke32@4225 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-28 17:04:22 +00:00
parent 2442b107f7
commit 8a2d786e23
4 changed files with 13 additions and 10 deletions

View file

@ -72,6 +72,8 @@ enum rendmode_t {
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3)) #define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
#define MAXTILES 30720 #define MAXTILES 30720
#define MAXUSERTILES (MAXTILES-16) // reserve 16 tiles at the end
#define MAXVOXELS 4096 #define MAXVOXELS 4096
#define MAXSTATUS 1024 #define MAXSTATUS 1024
#define MAXPLAYERS 16 #define MAXPLAYERS 16

View file

@ -94,7 +94,7 @@ enum scripttoken_t
}; };
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
int32_t nextvoxid = 0; static int32_t nextvoxid = 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
extern float alphahackarray[MAXTILES]; extern float alphahackarray[MAXTILES];
@ -146,7 +146,7 @@ static int32_t check_tile_range(const char *defcmd, int32_t *tilebeg, int32_t *t
swaplong(tilebeg, tileend); swaplong(tilebeg, tileend);
} }
if ((unsigned)*tilebeg >= MAXTILES || (unsigned)*tileend >= MAXTILES) if ((unsigned)*tilebeg >= MAXUSERTILES || (unsigned)*tileend >= MAXUSERTILES)
{ {
initprintf("Error: %s: Invalid tile range on line %s:%d\n", defcmd, initprintf("Error: %s: Invalid tile range on line %s:%d\n", defcmd,
script->filename, scriptfile_getlinum(script,cmdtokptr)); script->filename, scriptfile_getlinum(script,cmdtokptr));
@ -159,7 +159,7 @@ static int32_t check_tile_range(const char *defcmd, int32_t *tilebeg, int32_t *t
static int32_t check_tile(const char *defcmd, int32_t tile, const scriptfile *script, static int32_t check_tile(const char *defcmd, int32_t tile, const scriptfile *script,
const char *cmdtokptr) const char *cmdtokptr)
{ {
if ((unsigned)tile >= MAXTILES) if ((unsigned)tile >= MAXUSERTILES)
{ {
initprintf("Error: %s: Invalid tile number on line %s:%d\n", defcmd, initprintf("Error: %s: Invalid tile number on line %s:%d\n", defcmd,
script->filename, scriptfile_getlinum(script,cmdtokptr)); script->filename, scriptfile_getlinum(script,cmdtokptr));
@ -469,7 +469,7 @@ static int32_t defsparser(scriptfile *script)
int32_t tile, tmp; int32_t tile, tmp;
if (scriptfile_getsymbol(script,&tile)) break; if (scriptfile_getsymbol(script,&tile)) break;
if (tile >= MAXTILES)break; if ((unsigned)tile >= MAXUSERTILES) break;
if (scriptfile_getsymbol(script,&h_xsize[tile])) break; // XXX if (scriptfile_getsymbol(script,&h_xsize[tile])) break; // XXX
if (scriptfile_getsymbol(script,&h_ysize[tile])) break; if (scriptfile_getsymbol(script,&h_ysize[tile])) break;
if (scriptfile_getsymbol(script,&tmp)) break; if (scriptfile_getsymbol(script,&tmp)) break;
@ -585,7 +585,7 @@ static int32_t defsparser(scriptfile *script)
} }
} }
if ((unsigned)tile >= MAXTILES) if ((unsigned)tile >= MAXUSERTILES)
{ {
initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n",
script->filename, scriptfile_getlinum(script,texturetokptr)); script->filename, scriptfile_getlinum(script,texturetokptr));
@ -1807,7 +1807,7 @@ static int32_t defsparser(scriptfile *script)
} }
} }
if ((unsigned)tile >= MAXTILES) break; // message is printed later if ((unsigned)tile >= MAXUSERTILES) break; // message is printed later
if ((unsigned)pal >= MAXPALOOKUPS - RESERVEDPALS) if ((unsigned)pal >= MAXPALOOKUPS - RESERVEDPALS)
{ {
initprintf("Error: missing or invalid 'palette number' for texture definition near " initprintf("Error: missing or invalid 'palette number' for texture definition near "
@ -1886,7 +1886,7 @@ static int32_t defsparser(scriptfile *script)
} }
} }
if ((unsigned)tile >= MAXTILES) break; // message is printed later if ((unsigned)tile >= MAXUSERTILES) break; // message is printed later
if (!fn) if (!fn)
{ {
initprintf("Error: missing 'file name' for texture definition near line %s:%d\n", initprintf("Error: missing 'file name' for texture definition near line %s:%d\n",
@ -1923,7 +1923,7 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
} }
if ((unsigned)tile >= MAXTILES) if ((unsigned)tile >= MAXUSERTILES)
{ {
initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n",
script->filename, scriptfile_getlinum(script,texturetokptr)); script->filename, scriptfile_getlinum(script,texturetokptr));
@ -2050,7 +2050,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getnumber(script,&e)) break; if (scriptfile_getnumber(script,&e)) break;
b = max(b, 0); b = max(b, 0);
e = min(e, MAXTILES-1); e = min(e, MAXUSERTILES-1);
for (i=b; i<=e; i++) for (i=b; i<=e; i++)
picanm[i].sf |= (tokn==T_TEXHITSCANRANGE) ? picanm[i].sf |= (tokn==T_TEXHITSCANRANGE) ?

View file

@ -11027,7 +11027,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
kread(fil,&localtilestart,4); localtilestart = B_LITTLE32(localtilestart); kread(fil,&localtilestart,4); localtilestart = B_LITTLE32(localtilestart);
kread(fil,&localtileend,4); localtileend = B_LITTLE32(localtileend); kread(fil,&localtileend,4); localtileend = B_LITTLE32(localtileend);
if ((uint32_t)localtilestart >= MAXTILES || (uint32_t)localtileend >= MAXTILES) if ((uint32_t)localtilestart >= MAXUSERTILES || (uint32_t)localtileend >= MAXUSERTILES)
{ {
initprintf("loadpics: Invalid localtilestart or localtileend in %s\n", artfilename); initprintf("loadpics: Invalid localtilestart or localtileend in %s\n", artfilename);
kclose(fil); kclose(fil);

View file

@ -102,6 +102,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TILE_TILT (MAXTILES-2) #define TILE_TILT (MAXTILES-2)
#define TILE_ANIM (MAXTILES-4) #define TILE_ANIM (MAXTILES-4)
#define TILE_VIEWSCR (MAXTILES-5) #define TILE_VIEWSCR (MAXTILES-5)
EDUKE32_STATIC_ASSERT(5 <= MAXTILES-MAXUSERTILES);
// sprites with these statnums should be considered for fixing (bitmap) // sprites with these statnums should be considered for fixing (bitmap)
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \ #define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \