Mapster32: in e.g. F5 "next free tag" display, note object w/ greatest tag.

git-svn-id: https://svn.eduke32.com/eduke32@4464 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-05-06 22:15:19 +00:00
parent 7fb2ad8e32
commit b82b5dc6b7
3 changed files with 39 additions and 8 deletions

View file

@ -289,7 +289,7 @@ extern const char *taglab_getlabel(int16_t tag);
extern int32_t taglab_gettag(const char *label); extern int32_t taglab_gettag(const char *label);
extern int32_t taglab_linktags(int32_t spritep, int32_t num); extern int32_t taglab_linktags(int32_t spritep, int32_t num);
extern int32_t taglab_getnextfreetag(void); extern int32_t taglab_getnextfreetag(int32_t *duetoptr);
extern int32_t showtags; extern int32_t showtags;

View file

@ -8949,7 +8949,7 @@ int32_t getnumber_autocomplete(const char *namestart, char ch, int32_t *danum, i
} }
else if (*danum==0) else if (*danum==0)
{ {
i = taglab_getnextfreetag(); i = taglab_getnextfreetag(NULL);
if (i >= 1) if (i >= 1)
{ {
*danum = i; *danum = i;

View file

@ -1083,9 +1083,15 @@ int32_t taglab_linktags(int32_t spritep, int32_t num)
return link; return link;
} }
int32_t taglab_getnextfreetag(void) // <duetoptr>: if non-NULL, a value will be written denoting the object with
// the currently greatest tag:
// 32768 + spritenum, or
// wallnum, or
// -1 (the return value i.e. no more tags left OR there are no tagged objects)
int32_t taglab_getnextfreetag(int32_t *duetoptr)
{ {
int32_t i, nextfreetag=1; int32_t i, nextfreetag=1;
int32_t obj = -1;
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXSPRITES; i++)
{ {
@ -1098,15 +1104,23 @@ int32_t taglab_getnextfreetag(void)
{ {
// MULTISWITCH needs special care // MULTISWITCH needs special care
int32_t endtag = sprite[i].lotag+3; int32_t endtag = sprite[i].lotag+3;
if (nextfreetag <= endtag) if (nextfreetag <= endtag)
{
nextfreetag = endtag+1; nextfreetag = endtag+1;
obj = 32768 + i;
}
continue; continue;
} }
tag = select_sprite_tag(i); tag = select_sprite_tag(i);
if (tag != INT32_MIN && nextfreetag <= tag) if (tag != INT32_MIN && nextfreetag <= tag)
{
nextfreetag = tag+1; nextfreetag = tag+1;
obj = 32768 + i;
}
} }
for (i=0; i<numwalls; i++) for (i=0; i<numwalls; i++)
@ -1114,11 +1128,14 @@ int32_t taglab_getnextfreetag(void)
int32_t lt = taglab_linktags(0, i); int32_t lt = taglab_linktags(0, i);
if ((lt&1) && nextfreetag <= wall[i].lotag) if ((lt&1) && nextfreetag <= wall[i].lotag)
nextfreetag = wall[i].lotag+1; nextfreetag = wall[i].lotag+1, obj = i;
if ((lt&2) && nextfreetag <= wall[i].hitag) if ((lt&2) && nextfreetag <= wall[i].hitag)
nextfreetag = wall[i].hitag+1; nextfreetag = wall[i].hitag+1, obj = i;
} }
if (duetoptr != NULL)
*duetoptr = obj;
if (nextfreetag < 32768) if (nextfreetag < 32768)
return nextfreetag; return nextfreetag;
@ -1462,6 +1479,21 @@ static void PrintStatus(const char *string, int32_t num, int32_t x, int32_t y, i
printext16(x*8, ydim-STATUS2DSIZ+y*8, editorcolors[color], -1, tempbuf, 0); printext16(x*8, ydim-STATUS2DSIZ+y*8, editorcolors[color], -1, tempbuf, 0);
} }
static void PrintNextTag(void)
{
int32_t obj;
int32_t nexttag = taglab_getnextfreetag(&obj);
if (nexttag >= 1)
{
if (obj == -1)
printmessage16("Level %s next tag %d (no tagged objects)", levelname, nexttag);
else
printmessage16("Level %s next tag %d (%s %d has greatest)", levelname, nexttag,
(obj&32768) ? "sprite" : "wall", obj&32767);
}
}
void ExtShowSectorData(int16_t sectnum) //F5 void ExtShowSectorData(int16_t sectnum) //F5
{ {
int32_t x,x2,y; int32_t x,x2,y;
@ -1512,7 +1544,7 @@ void ExtShowSectorData(int16_t sectnum) //F5
drawgradient(); drawgradient();
ydim += 8; ydim += 8;
printmessage16("Level %s next tag %d", levelname, taglab_getnextfreetag()); PrintNextTag();
#define PRSTAT(Str, Tiledef) \ #define PRSTAT(Str, Tiledef) \
PrintStatus(Str, numsprite[Tiledef], x, y+yi, numsprite[Tiledef]?11:7); \ PrintStatus(Str, numsprite[Tiledef], x, y+yi, numsprite[Tiledef]?11:7); \
@ -1602,8 +1634,7 @@ void ExtShowWallData(int16_t wallnum) //F6
clearmidstatbar16(); clearmidstatbar16();
drawgradient(); drawgradient();
printmessage16("Level %s next tag %d", levelname, taglab_getnextfreetag()); PrintNextTag();
#define CASES_LIZTROOP \ #define CASES_LIZTROOP \
LIZTROOP: case LIZTROOPRUNNING : case LIZTROOPSTAYPUT: case LIZTROOPSHOOT: \ LIZTROOP: case LIZTROOPRUNNING : case LIZTROOPSTAYPUT: case LIZTROOPSHOOT: \