From 340b2f76470ec3a27aba891473e430ad97989ef1 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 15 Jan 2012 22:39:10 +0000 Subject: [PATCH] Increase the number of maximum art files from 64 to 256 and tweak loadpics(). It is likely that this is the value it used to have at some point, because the MAXTILEFILES macro equals 256 and is as old as the Duke3D source. loadpics() now refuses to load an ART file with localtilestart or localtileend out of bounds, or if localtileend<=localtilestart (i.e. no tiles in ART file, or nonsense). Also, on 'invalid art file version', continue instead of returning. Note: this does not increase the maximum number of tiles, which is still 15360, it only gives a bit more freedom to arrange them (well, into more art files). Also, I don't see what anyone keeps off from packing any number of tiles (from 1 to 15360) into an art file. Old EDITART limits? git-svn-id: https://svn.eduke32.com/eduke32@2259 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 5d811fc99..b61b116a6 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -134,9 +134,8 @@ static int32_t lastageclock; int32_t artsize = 0, cachesize = 0; -// max tilesXXX <- num to be checked for: -#define MAX_TILEFILEI 64 -static char *artptrs[MAX_TILEFILEI]; +// maximum number of ART files +static char *artptrs[MAXTILEFILES]; static int16_t radarang2[MAXXDIM]; static uint16_t sqrtable[4096], shlookup[4096+256]; @@ -7870,7 +7869,7 @@ void uninitengine(void) kclose(artfil); // this leaves a bunch of invalid pointers in waloff... fixme? - for (i=0; i= MAXTILES || localtileend < localtilestart) + if ((uint32_t)localtilestart >= MAXTILES || (uint32_t)localtileend >= MAXTILES) { - Bprintf("loadpics(): Invalid localtilestart or localtileend in %s\n", artfilename); + initprintf("loadpics: Invalid localtilestart or localtileend in %s\n", artfilename); + kclose(fil); + continue; + } + if (localtileend <= localtilestart) + { + initprintf("loadpics: localtileend <= localtilestart in %s\n", artfilename); kclose(fil); continue; }