Continuously keep track of the number of sprites in the world.

New engine variable 'int32_t Numsprites', not yet saved into savegames
or mapstates. (The capitalization is to distinguish it from the often-used
'numsprites' locals or structure member names.
In the editor, get rid of updatenumsprites().

git-svn-id: https://svn.eduke32.com/eduke32@2478 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-14 22:30:24 +00:00
parent 9c34845faa
commit 4d4221d71f
8 changed files with 38 additions and 64 deletions

View file

@ -318,6 +318,7 @@ EXTERN int32_t numyaxbunches;
EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS]; EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS];
#endif #endif
EXTERN int32_t Numsprites;
EXTERN int16_t numsectors, numwalls; EXTERN int16_t numsectors, numwalls;
EXTERN char display_mirror; EXTERN char display_mirror;
EXTERN int32_t totalclock; EXTERN int32_t totalclock;

View file

@ -82,7 +82,6 @@ extern int32_t autosave;
extern int32_t mlook; extern int32_t mlook;
extern int16_t prefixtiles[10]; extern int16_t prefixtiles[10];
extern int32_t numsprites;
extern int32_t showfirstwall; extern int32_t showfirstwall;
extern int32_t graphicsmode; extern int32_t graphicsmode;

View file

@ -84,7 +84,6 @@ int32_t grid = 3, autogrid = 0, gridlock = 1, showtags = 2;
int32_t zoom = 768, gettilezoom = 1; int32_t zoom = 768, gettilezoom = 1;
int32_t lastpm16time = 0; int32_t lastpm16time = 0;
int32_t numsprites;
extern int32_t mapversion; extern int32_t mapversion;
int16_t highlight[MAXWALLS+MAXSPRITES]; int16_t highlight[MAXWALLS+MAXSPRITES];
@ -217,7 +216,6 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line);
int32_t fixspritesectors(void); int32_t fixspritesectors(void);
static int32_t movewalls(int32_t start, int32_t offs); static int32_t movewalls(int32_t start, int32_t offs);
int32_t loadnames(const char *namesfile, int8_t root); int32_t loadnames(const char *namesfile, int8_t root);
void updatenumsprites(void);
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny, static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny,
int32_t maybe_screen_coord_p); int32_t maybe_screen_coord_p);
static void initcrc(void); static void initcrc(void);
@ -416,7 +414,6 @@ static void reset_default_mapstate(void)
numsectors = 0; numsectors = 0;
numwalls = 0; numwalls = 0;
numsprites = 0;
editorzrange[0] = INT32_MIN; editorzrange[0] = INT32_MIN;
editorzrange[1] = INT32_MAX; editorzrange[1] = INT32_MAX;
@ -1277,7 +1274,6 @@ void editinput(void)
correct_sprite_yoffset(i); correct_sprite_yoffset(i);
updatenumsprites();
asksave = 1; asksave = 1;
VM_OnEvent(EVENT_INSERTSPRITE3D, i); VM_OnEvent(EVENT_INSERTSPRITE3D, i);
@ -1685,12 +1681,11 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal)
{ {
int32_t i, j, sect, onumsectors=numsectors, newnumsectors, newnumwalls; int32_t i, j, sect, onumsectors=numsectors, newnumsectors, newnumwalls;
updatenumsprites();
if (numsectors+mapinfo->numsectors>MAXSECTORS || numwalls+mapinfo->numwalls>MAXWALLS if (numsectors+mapinfo->numsectors>MAXSECTORS || numwalls+mapinfo->numwalls>MAXWALLS
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
|| numyaxbunches+mapinfo->numyaxbunches > YAX_MAXBUNCHES || numyaxbunches+mapinfo->numyaxbunches > YAX_MAXBUNCHES
#endif #endif
|| numsprites+mapinfo->numsprites>MAXSPRITES) || Numsprites+mapinfo->numsprites>MAXSPRITES)
{ {
mapinfofull_free(mapinfo); mapinfofull_free(mapinfo);
return -1; return -1;
@ -1762,7 +1757,6 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal)
mapinfofull_free(mapinfo); mapinfofull_free(mapinfo);
numwalls = newnumwalls; numwalls = newnumwalls;
updatenumsprites();
update_highlightsector(); update_highlightsector();
@ -1948,7 +1942,7 @@ static void duplicate_selected_sprites(void)
// sprite[j].sectnum = sprite[k].sectnum; //Don't let memcpy overwrite sector! // sprite[j].sectnum = sprite[k].sectnum; //Don't let memcpy overwrite sector!
// setsprite(j,(vec3_t *)&sprite[j]); // setsprite(j,(vec3_t *)&sprite[j]);
} }
updatenumsprites();
printmessage16("Sprites duplicated and stamped."); printmessage16("Sprites duplicated and stamped.");
asksave = 1; asksave = 1;
} }
@ -6136,7 +6130,7 @@ end_join_sectors:
correct_sprite_yoffset(i); correct_sprite_yoffset(i);
printmessage16("Sprite inserted."); printmessage16("Sprite inserted.");
updatenumsprites();
asksave = 1; asksave = 1;
VM_OnEvent(EVENT_INSERTSPRITE2D, i); VM_OnEvent(EVENT_INSERTSPRITE2D, i);
@ -7036,7 +7030,7 @@ end_batch_insert_points:
{ {
deletesprite(pointhighlight&16383); deletesprite(pointhighlight&16383);
printmessage16("Sprite deleted."); printmessage16("Sprite deleted.");
updatenumsprites();
update_highlight(); update_highlight();
asksave = 1; asksave = 1;
} }
@ -7721,7 +7715,6 @@ int32_t LoadBoard(const char *filename, uint32_t flags)
i==0?"successfully": (i<4 ? "(moderate corruption)" : "(HEAVY corruption)")); i==0?"successfully": (i<4 ? "(moderate corruption)" : "(HEAVY corruption)"));
} }
updatenumsprites();
startposx = pos.x; //this is same startposx = pos.x; //this is same
startposy = pos.y; startposy = pos.y;
startposz = pos.z; startposz = pos.z;
@ -8153,7 +8146,6 @@ static int32_t deletesector(int16_t sucksect)
while (headspritesect[sucksect] >= 0) while (headspritesect[sucksect] >= 0)
deletesprite(headspritesect[sucksect]); deletesprite(headspritesect[sucksect]);
updatenumsprites();
startwall = sector[sucksect].wallptr; startwall = sector[sucksect].wallptr;
endwall = startwall + sector[sucksect].wallnum - 1; endwall = startwall + sector[sucksect].wallnum - 1;
@ -9615,7 +9607,7 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
char snotbuf[80]; char snotbuf[80];
int32_t i, m; int32_t i, m;
int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 ||
numsprites > MAXSPRITESV7 || numyaxbunches > 0); Numsprites > MAXSPRITESV7 || numyaxbunches > 0);
#if M32_UNDO #if M32_UNDO
Bsprintf(snotbuf,"x:%d y:%d ang:%d r%d",posxe,posye,ange,map_revision-1); Bsprintf(snotbuf,"x:%d y:%d ang:%d r%d",posxe,posye,ange,map_revision-1);
#else #else
@ -9644,20 +9636,20 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
{ {
if (xdim >= 800) if (xdim >= 800)
Bsprintf(&snotbuf[m], "/%d wal. %d/16k spr. %d/256 bn.", Bsprintf(&snotbuf[m], "/%d wal. %d/16k spr. %d/256 bn.",
MAXWALLSV8, numsprites, numyaxbunches); MAXWALLSV8, Numsprites, numyaxbunches);
else else
Bsprintf(&snotbuf[m], " wal. %d spr. %d/256 bn.", Bsprintf(&snotbuf[m], " wal. %d spr. %d/256 bn.",
numsprites, numyaxbunches); Numsprites, numyaxbunches);
} }
else else
{ {
if (xdim >= 800) if (xdim >= 800)
Bsprintf(&snotbuf[m], "/%d wal. %d/%d spr.", Bsprintf(&snotbuf[m], "/%d wal. %d/%d spr.",
v8?MAXWALLSV8:MAXWALLSV7, numsprites, v8?MAXWALLSV8:MAXWALLSV7, Numsprites,
v8?MAXSPRITESV8:MAXSPRITESV7); v8?MAXSPRITESV8:MAXSPRITESV7);
else else
Bsprintf(&snotbuf[m], "/%dk wal. %d/%dk spr.", Bsprintf(&snotbuf[m], "/%dk wal. %d/%dk spr.",
(v8?MAXWALLSV8:MAXWALLSV7)/1000, numsprites, (v8?MAXWALLSV8:MAXWALLSV7)/1000, Numsprites,
(v8?MAXSPRITESV8:MAXSPRITESV7)/1000); (v8?MAXSPRITESV8:MAXSPRITESV7)/1000);
} }
} }
@ -9694,15 +9686,6 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0); printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0);
} }
void updatenumsprites(void)
{
int32_t i;
numsprites = 0;
for (i=0; i<MAXSPRITES; i++)
numsprites += (sprite[i].statnum != MAXSTATUS);
}
#define DOPRINT(Yofs, fmt, ...) \ #define DOPRINT(Yofs, fmt, ...) \
Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \ Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \
printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0);

View file

@ -1268,7 +1268,7 @@ int32_t clipmapinfo_load(const char *filename)
char fn[BMAX_PATH], loadedwhich[32]={0}, *lwcp=loadedwhich; char fn[BMAX_PATH], loadedwhich[32]={0}, *lwcp=loadedwhich;
int32_t slen, fi, fisec[10], fispr[10]; int32_t slen, fi, fisec[10], fispr[10];
int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0, numsprites; int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0;
clipmapinfo_init(); clipmapinfo_init();
@ -1298,14 +1298,11 @@ int32_t clipmapinfo_load(const char *filename)
i = loadboard(fn, 0, &px,&py,&pz, &ang,&cs); i = loadboard(fn, 0, &px,&py,&pz, &ang,&cs);
if (i<0) if (i<0)
continue; continue;
// Numsprites will now be set!
for (numsprites=0; numsprites<MAXSPRITES; numsprites++)
if (sprite[numsprites].statnum == MAXSTATUS)
break;
if (ournumsectors+numsectors>MAXSECTORS || if (ournumsectors+numsectors>MAXSECTORS ||
ournumwalls+numwalls>MAXWALLS || ournumwalls+numwalls>MAXWALLS ||
ournumsprites+numsprites>MAXSPRITES) ournumsprites+Numsprites>MAXSPRITES)
{ {
initprintf("clip map: warning: exceeded limits when loading %s, aborting.\n", fn); initprintf("clip map: warning: exceeded limits when loading %s, aborting.\n", fn);
break; break;
@ -1313,7 +1310,7 @@ int32_t clipmapinfo_load(const char *filename)
Bmemcpy(loadsector+ournumsectors, sector, numsectors*sizeof(sectortype)); Bmemcpy(loadsector+ournumsectors, sector, numsectors*sizeof(sectortype));
Bmemcpy(loadwall+ournumwalls, wall, numwalls*sizeof(walltype)); Bmemcpy(loadwall+ournumwalls, wall, numwalls*sizeof(walltype));
Bmemcpy(loadsprite+ournumsprites, sprite, numsprites*sizeof(spritetype)); Bmemcpy(loadsprite+ournumsprites, sprite, Numsprites*sizeof(spritetype));
for (i=ournumsectors; i<ournumsectors+numsectors; i++) for (i=ournumsectors; i<ournumsectors+numsectors; i++)
loadsector[i].wallptr += ournumwalls; loadsector[i].wallptr += ournumwalls;
for (i=ournumwalls; i<ournumwalls+numwalls; i++) for (i=ournumwalls; i<ournumwalls+numwalls; i++)
@ -1326,12 +1323,12 @@ int32_t clipmapinfo_load(const char *filename)
loadwall[i].nextsector += ournumsectors; loadwall[i].nextsector += ournumsectors;
} }
} }
for (i=ournumsprites; i<ournumsprites+numsprites; i++) for (i=ournumsprites; i<ournumsprites+Numsprites; i++)
if (loadsprite[i].sectnum>=0) if (loadsprite[i].sectnum>=0)
loadsprite[i].sectnum += ournumsectors; loadsprite[i].sectnum += ournumsectors;
ournumsectors += numsectors; ournumsectors += numsectors;
ournumwalls += numwalls; ournumwalls += numwalls;
ournumsprites += numsprites; ournumsprites += Numsprites;
if (lwcp != loadedwhich) if (lwcp != loadedwhich)
{ {
@ -7598,7 +7595,10 @@ int32_t insertsprite(int16_t sectnum, int16_t statnum)
int32_t newspritenum = insertspritestat(statnum); int32_t newspritenum = insertspritestat(statnum);
if (newspritenum >= 0) if (newspritenum >= 0)
{
do_insertsprite_at_headofsect(newspritenum, sectnum); do_insertsprite_at_headofsect(newspritenum, sectnum);
Numsprites++;
}
return newspritenum; return newspritenum;
@ -7632,6 +7632,7 @@ int32_t deletesprite(int16_t spritenum)
sprite[spritenum].statnum = MAXSTATUS; sprite[spritenum].statnum = MAXSTATUS;
tailspritefree = spritenum; tailspritefree = spritenum;
Numsprites--;
return 0; return 0;
} }
@ -8132,6 +8133,7 @@ void initspritelists(void)
nextspritestat[MAXSPRITES-1] = -1; nextspritestat[MAXSPRITES-1] = -1;
tailspritefree = MAXSPRITES-1; tailspritefree = MAXSPRITES-1;
Numsprites = 0;
} }
@ -10016,6 +10018,7 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_
numsprites++; numsprites++;
} }
#endif #endif
assert(numsprites == Numsprites);
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (numyaxbunches > 0) if (numyaxbunches > 0)

View file

@ -457,7 +457,6 @@ void create_map_snapshot(void)
} }
fixspritesectors(); fixspritesectors();
updatenumsprites();
mapstate->numsectors = numsectors; mapstate->numsectors = numsectors;
mapstate->numwalls = numwalls; mapstate->numwalls = numwalls;
@ -506,7 +505,7 @@ void create_map_snapshot(void)
} }
} }
if (numsprites) if (Numsprites)
{ {
tempcrc = crc32once((uint8_t *)&sprite[0],sizeof(spritetype) * MAXSPRITES); tempcrc = crc32once((uint8_t *)&sprite[0],sizeof(spritetype) * MAXSPRITES);
@ -520,11 +519,11 @@ void create_map_snapshot(void)
else else
{ {
int32_t i = 0; int32_t i = 0;
spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + 1), spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * Numsprites + 1),
*spri = &tspri[0]; *spri = &tspri[0];
mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + QADDNSZ); mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * Numsprites + QADDNSZ);
for (j=0; j<MAXSPRITES && i < numsprites; j++) for (j=0; j<MAXSPRITES && i < Numsprites; j++)
{ {
if (sprite[j].statnum != MAXSTATUS) if (sprite[j].statnum != MAXSTATUS)
{ {
@ -534,7 +533,7 @@ void create_map_snapshot(void)
} }
mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0], mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0],
sizeof(spritetype) * numsprites, state_compress); sizeof(spritetype) * Numsprites, state_compress);
mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j); mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j);
mapstate->spritecrc = tempcrc; mapstate->spritecrc = tempcrc;
Bfree(tspri); Bfree(tspri);
@ -596,11 +595,8 @@ int32_t map_undoredo(int32_t dir)
numsectors = mapstate->numsectors; numsectors = mapstate->numsectors;
numwalls = mapstate->numwalls; numwalls = mapstate->numwalls;
numsprites = mapstate->numsprites;
map_revision = mapstate->revision; map_revision = mapstate->revision;
initspritelists();
Bmemset(show2dsector, 0, sizeof(show2dsector)); Bmemset(show2dsector, 0, sizeof(show2dsector));
Bmemset(show2dsprite, 0, sizeof(show2dsprite)); Bmemset(show2dsprite, 0, sizeof(show2dsprite));
Bmemset(show2dwall, 0, sizeof(show2dwall)); Bmemset(show2dwall, 0, sizeof(show2dwall));
@ -617,14 +613,16 @@ int32_t map_undoredo(int32_t dir)
qlz_decompress((const char *)&mapstate->sprites[0], &sprite[0], state_decompress); qlz_decompress((const char *)&mapstate->sprites[0], &sprite[0], state_decompress);
} }
updatenumsprites(); initspritelists();
for (i=0; i<numsprites; i++) for (i=0; i<mapstate->numsprites; i++)
{ {
if ((sprite[i].cstat & 48) == 48) sprite[i].cstat &= ~48; if ((sprite[i].cstat & 48) == 48) sprite[i].cstat &= ~48;
insertsprite(sprite[i].sectnum,sprite[i].statnum); insertsprite(sprite[i].sectnum,sprite[i].statnum);
} }
assert(Numsprites == mapstate->numsprites);
#ifdef POLYMER #ifdef POLYMER
if (qsetmode == 200 && rendmode == 4) if (qsetmode == 200 && rendmode == 4)
polymer_loadboard(); polymer_loadboard();
@ -4576,8 +4574,6 @@ ENDFOR1:
cursor = insertsprite(sprite[startspr].sectnum,0); cursor = insertsprite(sprite[startspr].sectnum,0);
if (cursor < 0) goto ERROR_TOOMANYSPRITES; if (cursor < 0) goto ERROR_TOOMANYSPRITES;
updatenumsprites();
sp = &sprite[cursor]; sp = &sprite[cursor];
Bmemcpy(sp, &sprite[startspr], sizeof(spritetype)); Bmemcpy(sp, &sprite[startspr], sizeof(spritetype));
sp->yoffset = 0; sp->yoffset = 0;
@ -4676,7 +4672,7 @@ ENDFOR1:
sect = sprite[curspr].sectnum; sect = sprite[curspr].sectnum;
updatesector(dax,day,&sect); updatesector(dax,day,&sect);
if (numsprites < MAXSPRITES && sect >= 0) if (Numsprites < MAXSPRITES && sect >= 0)
{ {
i = insertsprite(sect,0); i = insertsprite(sect,0);
Bmemcpy(&sprite[i], &sprite[linebegspr], sizeof(spritetype)); Bmemcpy(&sprite[i], &sprite[linebegspr], sizeof(spritetype));
@ -4702,7 +4698,6 @@ ENDFOR1:
curspr = i; curspr = i;
doingspace = 0; doingspace = 0;
updatenumsprites();
asksave = 1; asksave = 1;
if (numletters >= stackallocsize) if (numletters >= stackallocsize)
@ -4745,15 +4740,14 @@ ENDFOR1:
numletters--; numletters--;
deletesprite(last); deletesprite(last);
updatenumsprites();
asksave = 1; asksave = 1;
} }
else else
{ {
numletters--; numletters--;
deletesprite(last); deletesprite(last);
curspr = linebegspr; curspr = linebegspr;
updatenumsprites();
asksave = 1; asksave = 1;
} }
} }
@ -4775,7 +4769,6 @@ ENDFOR1:
ERROR_TOOMANYSPRITES: ERROR_TOOMANYSPRITES:
if (cursor < 0) message("Too many sprites in map!"); if (cursor < 0) message("Too many sprites in map!");
else deletesprite(cursor); else deletesprite(cursor);
updatenumsprites();
ERROR_NOMEMORY: ERROR_NOMEMORY:
if (spritenums) Bfree(spritenums); if (spritenums) Bfree(spritenums);
@ -5221,7 +5214,7 @@ static void Keys3d(void)
if (AIMING_AT_SPRITE) if (AIMING_AT_SPRITE)
{ {
deletesprite(searchwall); deletesprite(searchwall);
updatenumsprites();
message("Sprite %d deleted",searchwall); message("Sprite %d deleted",searchwall);
if (AmbienceToggle) if (AmbienceToggle)
{ {
@ -10707,7 +10700,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
if (graphicsmode && !m32_sideview && zoom >= 256) if (graphicsmode && !m32_sideview && zoom >= 256)
{ {
for (i=ii=0; i<MAXSPRITES && ii < numsprites; i++) for (i=ii=0; i<MAXSPRITES && ii < Numsprites; i++)
{ {
if ((sprite[i].cstat & 48) != 0 || sprite[i].statnum == MAXSTATUS) continue; if ((sprite[i].cstat & 48) != 0 || sprite[i].statnum == MAXSTATUS) continue;
ii++; ii++;

View file

@ -1666,7 +1666,7 @@ badindex:
int32_t dasectnum = Gv_GetVarX(*insptr++), ret; int32_t dasectnum = Gv_GetVarX(*insptr++), ret;
X_ERROR_INVALIDSECT(dasectnum); X_ERROR_INVALIDSECT(dasectnum);
if (numsprites >= MAXSPRITES) if (Numsprites >= MAXSPRITES)
{ {
M32_ERROR("Maximum number of sprites reached."); M32_ERROR("Maximum number of sprites reached.");
continue; continue;
@ -1675,7 +1675,6 @@ badindex:
ret = insertsprite(dasectnum, 0); ret = insertsprite(dasectnum, 0);
vm.g_i = ret; vm.g_i = ret;
vm.g_sp = &sprite[ret]; vm.g_sp = &sprite[ret];
numsprites++;
} }
continue; continue;
@ -1689,7 +1688,7 @@ badindex:
{ {
M32_ERROR("Tried to duplicate nonexistent sprite %d", ospritenum); M32_ERROR("Tried to duplicate nonexistent sprite %d", ospritenum);
} }
if ((tw==CON_DUPSPRITE && numsprites >= MAXSPRITES) || if ((tw==CON_DUPSPRITE && Numsprites >= MAXSPRITES) ||
(tw==CON_DUPSPRITE && spritesortcnt >= MAXSPRITESONSCREEN)) (tw==CON_DUPSPRITE && spritesortcnt >= MAXSPRITESONSCREEN))
{ {
M32_ERROR("Maximum number of sprites reached."); M32_ERROR("Maximum number of sprites reached.");
@ -1709,7 +1708,6 @@ badindex:
Bmemcpy(&sprite[nspritenum], &sprite[ospritenum], sizeof(spritetype)); Bmemcpy(&sprite[nspritenum], &sprite[ospritenum], sizeof(spritetype));
vm.g_i = nspritenum; vm.g_i = nspritenum;
vm.g_sp = &sprite[nspritenum]; vm.g_sp = &sprite[nspritenum];
numsprites++;
} }
else else
{ {
@ -1730,8 +1728,6 @@ badindex:
X_ERROR_INVALIDSPRI(daspritenum); X_ERROR_INVALIDSPRI(daspritenum);
ret = deletesprite(daspritenum); ret = deletesprite(daspritenum);
g_iReturnVar = ret; g_iReturnVar = ret;
if (ret==0)
numsprites--;
} }
continue; continue;

View file

@ -554,7 +554,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("numwalls",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("numwalls",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("numsprites",(intptr_t)&numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_NewVar("numsprites",(intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
{ {
static int32_t numtiles; static int32_t numtiles;
Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);

View file

@ -40,7 +40,6 @@ uint8_t default_buildkeys[NUMBUILDKEYS] =
}; };
extern char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck); extern char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck);
extern void updatenumsprites(void);
static char autospritehelp=0, autosecthelp=0; static char autospritehelp=0, autosecthelp=0;
//static int32_t lastmessagetime=-1; //static int32_t lastmessagetime=-1;