git-svn-id: https://svn.eduke32.com/eduke32@574 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2007-09-06 10:43:42 +00:00
parent 6a8346ddab
commit 8a6e2bb008
4 changed files with 52 additions and 14 deletions

View file

@ -168,16 +168,16 @@ typedef struct BPACK {
#define SPREXT_NOTMD 1 #define SPREXT_NOTMD 1
#define SPREXT_NOMDANIM 2 #define SPREXT_NOMDANIM 2
EXTERN spriteexttype spriteext[MAXSPRITES+MAXUNIQHUDID]; EXTERN spriteexttype *spriteext;
EXTERN spritesmoothtype spritesmooth[MAXSPRITES+MAXUNIQHUDID]; EXTERN spritesmoothtype *spritesmooth;
EXTERN long guniqhudid; EXTERN long guniqhudid;
EXTERN sectortype sector[MAXSECTORS]; EXTERN sectortype *sector;
EXTERN walltype wall[MAXWALLS]; EXTERN walltype *wall;
EXTERN spritetype sprite[MAXSPRITES]; EXTERN spritetype *sprite;
EXTERN long spritesortcnt; EXTERN long spritesortcnt;
EXTERN spritetype tsprite[MAXSPRITESONSCREEN]; EXTERN spritetype *tsprite;
EXTERN long xdim, ydim, ylookup[MAXYDIM+1], numpages; EXTERN long xdim, ydim, ylookup[MAXYDIM+1], numpages;
EXTERN long yxaspect, viewingrange; EXTERN long yxaspect, viewingrange;

View file

@ -5519,6 +5519,30 @@ int preinitengine(void)
char *e; char *e;
if (initsystem()) exit(1); if (initsystem()) exit(1);
if (sector != NULL)
Bfree(sector);
sector = Bcalloc(MAXSECTORS,sizeof(sectortype));
if (wall != NULL)
Bfree(wall);
wall = Bcalloc(MAXWALLS,sizeof(walltype));
if (sprite != NULL)
Bfree(sprite);
sprite = Bcalloc(MAXSPRITES,sizeof(spritetype));
if (tsprite != NULL)
Bfree(tsprite);
tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype));
if (spriteext != NULL)
Bfree(spriteext);
spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteexttype));
if (spritesmooth != NULL)
Bfree(spritesmooth);
spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype));
if ((e = Bgetenv("BUILD_NOP6")) != NULL) if ((e = Bgetenv("BUILD_NOP6")) != NULL)
if (!Bstrcasecmp(e, "TRUE")) { if (!Bstrcasecmp(e, "TRUE")) {
Bprintf("Disabling P6 optimizations.\n"); Bprintf("Disabling P6 optimizations.\n");
@ -5550,6 +5574,7 @@ int initengine(void)
sigact.sa_flags = SA_SIGINFO; sigact.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &sigact, &oldact); sigaction(SIGFPE, &sigact, &oldact);
#endif #endif
if (!preinitcalled) { if (!preinitcalled) {
i = preinitengine(); i = preinitengine();
if (i) return i; if (i) return i;
@ -5642,6 +5667,19 @@ if (transluc != NULL) { kkfree(transluc); transluc = NULL; }
} }
for (i=0;i<MAXPALOOKUPS;i++) for (i=0;i<MAXPALOOKUPS;i++)
if (palookup[i] != NULL) { kkfree(palookup[i]); palookup[i] = NULL; } if (palookup[i] != NULL) { kkfree(palookup[i]); palookup[i] = NULL; }
if (sector != NULL)
Bfree(sector);
if (wall != NULL)
Bfree(wall);
if (sprite != NULL)
Bfree(sprite);
if (tsprite != NULL)
Bfree(tsprite);
if (spriteext != NULL)
Bfree(spriteext);
if (spritesmooth != NULL)
Bfree(spritesmooth);
} }
@ -6676,7 +6714,7 @@ long loadboard(char *filename, char fromwhere, long *daposx, long *daposy, long
kclose(fil); kclose(fil);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
memset(spriteext, 0, sizeof(spriteext)); memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES);
memset(spritesmooth, 0, sizeof(spritesmooth)); memset(spritesmooth, 0, sizeof(spritesmooth));
if (rendmode == 4) if (rendmode == 4)
@ -7147,7 +7185,7 @@ if (numsprites > MAXSPRITES) { kclose(fil); return(-1); }
kclose(fil); kclose(fil);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
memset(spriteext, 0, sizeof(spriteext)); memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES);
memset(spritesmooth, 0, sizeof(spritesmooth)); memset(spritesmooth, 0, sizeof(spritesmooth));
#endif #endif
guniqhudid = 0; guniqhudid = 0;
@ -7204,7 +7242,7 @@ long loadmaphack(char *filename)
script = scriptfile_fromfile(filename); script = scriptfile_fromfile(filename);
if (!script) return -1; if (!script) return -1;
memset(spriteext, 0, sizeof(spriteext)); memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES);
memset(spritesmooth, 0, sizeof(spritesmooth)); memset(spritesmooth, 0, sizeof(spritesmooth));
while (1) { while (1) {

View file

@ -9378,7 +9378,7 @@ static void compilecons(void)
loadefs(confilename); loadefs(confilename);
} }
if ((unsigned long)labelcnt > sizeof(sprite)/64) // see the arithmetic above for why if ((unsigned long)labelcnt > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why
gameexit("Error: too many labels defined!"); gameexit("Error: too many labels defined!");
else else
{ {
@ -9399,9 +9399,9 @@ static void compilecons(void)
label = newlabel; label = newlabel;
labelcode = newlabelcode; labelcode = newlabelcode;
} }
clearbufbyte(&sprite[0], sizeof(sprite), 0); clearbufbyte(&sprite[0], sizeof(spritetype) * MAXSPRITES, 0);
clearbufbyte(&sector[0], sizeof(sector), 0); clearbufbyte(&sector[0], sizeof(sectortype) * MAXSECTORS, 0);
clearbufbyte(&wall[0], sizeof(wall), 0); clearbufbyte(&wall[0], sizeof(walltype) * MAXWALLS, 0);
OnEvent(EVENT_INIT, -1, -1, -1); OnEvent(EVENT_INIT, -1, -1, -1);
} }

View file

@ -4943,7 +4943,7 @@ void loadefs(const char *filenam)
} }
initprintf("\nCompiled code size: %ld bytes\n",(unsigned)(scriptptr-script)); initprintf("\nCompiled code size: %ld bytes\n",(unsigned)(scriptptr-script));
initprintf("%ld/%ld labels, %d/%d variables\n",labelcnt,min((sizeof(sector)/sizeof(long)),(sizeof(sprite)/(1<<6))),iGameVarCount,MAXGAMEVARS); initprintf("%ld/%ld labels, %d/%d variables\n",labelcnt,min((MAXSECTORS * sizeof(sectortype)/sizeof(long)),(MAXSPRITES * sizeof(spritetype)/(1<<6))),iGameVarCount,MAXGAMEVARS);
initprintf("%ld event definitions, %ld defined actors\n\n",j,k); initprintf("%ld event definitions, %ld defined actors\n\n",j,k);
for (i=0;i<128;i++) for (i=0;i<128;i++)