mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Mapster32: draw lines to linking sprites with LShift, jump to them with +[ or +]
When LShift is pressed and the mouse is over a linking sprite (as determined by the tag labeling system), lines are drawn to all other sprites, and pressing [ or ] will cycle these then. False positives and missed sprites are possible. Additional changes: - consider SE 31 and 32's lotag to NOT be linking, since the ACTIVATOR is what matters. The original maps are inconsistent there. - When pressing Alt+[ or Alt+] and there are no corruptions, say so instead of doing [ or ]. git-svn-id: https://svn.eduke32.com/eduke32@3108 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2dfe3c3d93
commit
e6fdb25d6d
4 changed files with 209 additions and 84 deletions
|
@ -285,6 +285,8 @@ extern int32_t taglab_getnextfreetag(void);
|
||||||
|
|
||||||
extern int32_t showtags;
|
extern int32_t showtags;
|
||||||
|
|
||||||
|
int32_t select_sprite_tag(int32_t spritenum);
|
||||||
|
|
||||||
|
|
||||||
#define NEXTWALL(i) (wall[wall[i].nextwall])
|
#define NEXTWALL(i) (wall[wall[i].nextwall])
|
||||||
#define POINT2(i) (wall[wall[i].point2])
|
#define POINT2(i) (wall[wall[i].point2])
|
||||||
|
|
|
@ -2977,6 +2977,54 @@ static int32_t AddLoopToSector(int32_t k, int32_t *ret_ofirstwallofs)
|
||||||
|
|
||||||
#define EDITING_MAP_P() (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1))
|
#define EDITING_MAP_P() (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1))
|
||||||
|
|
||||||
|
int32_t select_sprite_tag(int32_t spritenum)
|
||||||
|
{
|
||||||
|
int32_t lt = taglab_linktags(1, spritenum);
|
||||||
|
spritetype *spr = &sprite[spritenum];
|
||||||
|
|
||||||
|
if (lt==0)
|
||||||
|
return INT32_MIN;
|
||||||
|
|
||||||
|
if (lt&1)
|
||||||
|
return spr->lotag;
|
||||||
|
if (lt&2)
|
||||||
|
return spr->hitag;
|
||||||
|
if (lt&4)
|
||||||
|
return spr->extra;
|
||||||
|
if (lt&8)
|
||||||
|
return spr->xvel;
|
||||||
|
if (lt&16)
|
||||||
|
return spr->yvel;
|
||||||
|
if (lt&32)
|
||||||
|
return spr->zvel;
|
||||||
|
if (lt&64)
|
||||||
|
return spr->extra;
|
||||||
|
|
||||||
|
return INT32_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawlinebetween(int32_t si1, int32_t si2, int32_t col, uint32_t pat)
|
||||||
|
{
|
||||||
|
// based on m32exec.c/drawline*
|
||||||
|
const spritetype *s1 = &sprite[si1], *s2 = &sprite[si2];
|
||||||
|
const int32_t xofs=halfxdim16, yofs=midydim16;
|
||||||
|
const uint32_t opat=drawlinepat;
|
||||||
|
|
||||||
|
int32_t x1, x2, y1, y2;
|
||||||
|
|
||||||
|
screencoords(&x1,&y1, s1->x-pos.x,s1->y-pos.y, zoom);
|
||||||
|
screencoords(&x2,&y2, s2->x-pos.x,s2->y-pos.y, zoom);
|
||||||
|
|
||||||
|
if (m32_sideview)
|
||||||
|
{
|
||||||
|
y1 += getscreenvdisp(s1->z-pos.z,zoom);
|
||||||
|
y2 += getscreenvdisp(s2->z-pos.z,zoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawlinepat = pat;
|
||||||
|
drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col>=0?editorcolors[col&15]:((-col)&255));
|
||||||
|
drawlinepat = opat;
|
||||||
|
}
|
||||||
|
|
||||||
void overheadeditor(void)
|
void overheadeditor(void)
|
||||||
{
|
{
|
||||||
|
@ -3175,6 +3223,22 @@ void overheadeditor(void)
|
||||||
draw2dscreen(&pos,cursectnum,ang,zoom,grid);
|
draw2dscreen(&pos,cursectnum,ang,zoom,grid);
|
||||||
|
|
||||||
begindrawing(); //{{{
|
begindrawing(); //{{{
|
||||||
|
|
||||||
|
if (keystatus[0x2a] && (pointhighlight&16384))
|
||||||
|
{
|
||||||
|
// draw lines to linking sprites
|
||||||
|
const int32_t refspritenum = pointhighlight&16383;
|
||||||
|
const int32_t reftag = select_sprite_tag(refspritenum);
|
||||||
|
|
||||||
|
if (reftag != INT32_MIN)
|
||||||
|
{
|
||||||
|
for (i=0; i<numsectors; i++)
|
||||||
|
for (SPRITES_OF_SECT(i, j))
|
||||||
|
if (reftag==select_sprite_tag(j))
|
||||||
|
drawlinebetween(refspritenum, j, 12, 0x33333333);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (showtags)
|
if (showtags)
|
||||||
{
|
{
|
||||||
if (zoom >= 768)
|
if (zoom >= 768)
|
||||||
|
|
|
@ -482,7 +482,6 @@ int32_t writesetup(const char *fn)
|
||||||
"autocorruptchecksec = %d\n"
|
"autocorruptchecksec = %d\n"
|
||||||
"\n"
|
"\n"
|
||||||
"; Ignore 'already referenced wall' warnings\n"
|
"; Ignore 'already referenced wall' warnings\n"
|
||||||
"; (toggled with 'corruptcheck noalreadyrefd')\n"
|
|
||||||
"corruptcheck_noalreadyrefd = %d\n"
|
"corruptcheck_noalreadyrefd = %d\n"
|
||||||
"\n"
|
"\n"
|
||||||
"; Fix sprite sectnums when saving a map or entering 3D mode\n"
|
"; Fix sprite sectnums when saving a map or entering 3D mode\n"
|
||||||
|
|
|
@ -1062,7 +1062,8 @@ int32_t taglab_gettag(const char *label)
|
||||||
|
|
||||||
#define TLCHAR "+"
|
#define TLCHAR "+"
|
||||||
#define TLCHR(Cond) ((Cond)?TLCHAR:"")
|
#define TLCHR(Cond) ((Cond)?TLCHAR:"")
|
||||||
static uint64_t taglab_nolink_SEs = (1ull<<10)|(1ull<<27)|(1ull<<28)|(1ull<<29)|(1ull<<49)|(1ull<<50);
|
static uint64_t taglab_nolink_SEs = (1ull<<10)|(1ull<<27)|(1ull<<28)|(1ull<<29)|
|
||||||
|
(1ull<<31)|(1ull<<32)|(1ull<<49)|(1ull<<50);
|
||||||
|
|
||||||
// Whether the individual tags have linking semantics. Based on
|
// Whether the individual tags have linking semantics. Based on
|
||||||
// http://infosuite.duke4.net/index.php?page=references_special_textures
|
// http://infosuite.duke4.net/index.php?page=references_special_textures
|
||||||
|
@ -1173,9 +1174,12 @@ int32_t taglab_linktags(int32_t spritep, int32_t num)
|
||||||
|
|
||||||
int32_t taglab_getnextfreetag(void)
|
int32_t taglab_getnextfreetag(void)
|
||||||
{
|
{
|
||||||
int32_t i, lt, nextfreetag=1;
|
int32_t i, nextfreetag=1;
|
||||||
|
|
||||||
for (i=0; i<MAXSPRITES; i++)
|
for (i=0; i<MAXSPRITES; i++)
|
||||||
{
|
{
|
||||||
|
int32_t tag;
|
||||||
|
|
||||||
if (sprite[i].statnum == MAXSTATUS)
|
if (sprite[i].statnum == MAXSTATUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1188,16 +1192,16 @@ int32_t taglab_getnextfreetag(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lt = taglab_linktags(1, i);
|
tag = select_sprite_tag(i);
|
||||||
if ((lt&1) && nextfreetag <= sprite[i].lotag)
|
|
||||||
nextfreetag = sprite[i].lotag+1;
|
if (tag != INT32_MIN && nextfreetag <= tag)
|
||||||
if ((lt&2) && nextfreetag <= sprite[i].hitag)
|
nextfreetag = tag+1;
|
||||||
nextfreetag = sprite[i].hitag+1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<numwalls; i++)
|
for (i=0; i<numwalls; i++)
|
||||||
{
|
{
|
||||||
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;
|
||||||
if ((lt&2) && nextfreetag <= wall[i].hitag)
|
if ((lt&2) && nextfreetag <= wall[i].hitag)
|
||||||
|
@ -7482,9 +7486,35 @@ paste_ceiling_or_floor:
|
||||||
VM_OnEvent(EVENT_KEYS3D, -1);
|
VM_OnEvent(EVENT_KEYS3D, -1);
|
||||||
}// end 3d
|
}// end 3d
|
||||||
|
|
||||||
|
// returns: whether sprite is out of grid
|
||||||
|
static int32_t jump_to_sprite(int32_t spritenum)
|
||||||
|
{
|
||||||
|
const spritetype *spr = &sprite[spritenum];
|
||||||
|
|
||||||
|
if (pos.x >= -editorgridextent && pos.x <= editorgridextent &&
|
||||||
|
pos.y >= -editorgridextent && pos.y <= editorgridextent)
|
||||||
|
{
|
||||||
|
pos.x = spr->x;
|
||||||
|
pos.y = spr->y;
|
||||||
|
|
||||||
|
// BZ_MAX?
|
||||||
|
if (pos.z >= -(editorgridextent<<4) && pos.z <= editorgridextent<<4)
|
||||||
|
pos.z = spr->z;
|
||||||
|
|
||||||
|
ang = spr->ang;
|
||||||
|
|
||||||
|
if ((unsigned)spr->sectnum < (unsigned)numsectors)
|
||||||
|
cursectnum = spr->sectnum;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
||||||
{
|
{
|
||||||
char did_wrap = 0, outofgrid=0;
|
char did_wrap = 0, outofgrid;
|
||||||
int32_t i, j, k = 0;
|
int32_t i, j, k = 0;
|
||||||
|
|
||||||
dir = 1-2*(dir<0);
|
dir = 1-2*(dir<0);
|
||||||
|
@ -7563,21 +7593,10 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
||||||
}
|
}
|
||||||
|
|
||||||
// found matching sprite
|
// found matching sprite
|
||||||
if (pos.x >= -editorgridextent && pos.x <= editorgridextent &&
|
outofgrid = jump_to_sprite(gs_cursprite);
|
||||||
pos.y >= -editorgridextent && pos.y <= editorgridextent)
|
|
||||||
{
|
|
||||||
pos.x = sprite[gs_cursprite].x;
|
|
||||||
pos.y = sprite[gs_cursprite].y;
|
|
||||||
if (pos.z >= -editorgridextent<<4 && pos.z <= editorgridextent<<4)
|
|
||||||
pos.z = sprite[gs_cursprite].z;
|
|
||||||
ang = sprite[gs_cursprite].ang;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
outofgrid = 1;
|
|
||||||
|
|
||||||
printmessage16("%s Sprite seach%s: found sprite %d%s", dir<0 ? "<" : ">",
|
printmessage16("%s Sprite seach%s: found sprite %d%s", dir<0 ? "<" : ">",
|
||||||
did_wrap ? " (wrap)" : "", gs_cursprite, outofgrid?"(outside grid)":"");
|
did_wrap ? " (wrap)" : "", gs_cursprite, outofgrid?"(outside grid)":"");
|
||||||
did_wrap = 0;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NEXTSPRITE:
|
NEXTSPRITE:
|
||||||
|
@ -8072,7 +8091,9 @@ static void Keys2d(void)
|
||||||
|
|
||||||
if (tsign)
|
if (tsign)
|
||||||
{
|
{
|
||||||
if (eitherALT && numcorruptthings>0)
|
if (eitherALT)
|
||||||
|
{
|
||||||
|
if (numcorruptthings > 0)
|
||||||
{
|
{
|
||||||
int32_t wrap=0, x, y, z;
|
int32_t wrap=0, x, y, z;
|
||||||
|
|
||||||
|
@ -8140,6 +8161,50 @@ static void Keys2d(void)
|
||||||
i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : ""));
|
i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printmessage16("Map has no corruptions, cannot cycle them.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (keystatus[KEYSC_LSHIFT])
|
||||||
|
{
|
||||||
|
if (pointhighlight&16384)
|
||||||
|
{
|
||||||
|
const int32_t refspritenum = pointhighlight&16383;
|
||||||
|
const int32_t reftag = select_sprite_tag(refspritenum);
|
||||||
|
int32_t tmpspritenum = refspritenum;
|
||||||
|
|
||||||
|
while (reftag != INT32_MIN) // if (reftag != INT32_MIN) while (1)
|
||||||
|
{
|
||||||
|
tmpspritenum += tsign;
|
||||||
|
if ((unsigned)tmpspritenum >= MAXSPRITES)
|
||||||
|
tmpspritenum = (MAXSPRITES+tmpspritenum)%MAXSPRITES;
|
||||||
|
|
||||||
|
if (tmpspritenum==refspritenum)
|
||||||
|
{
|
||||||
|
silentmessage("No other sprites with tag %d");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reftag==select_sprite_tag(tmpspritenum))
|
||||||
|
{
|
||||||
|
int32_t oog = jump_to_sprite(tmpspritenum);
|
||||||
|
|
||||||
|
// center cursor so that we can repeat this
|
||||||
|
searchx = halfxdim16;
|
||||||
|
searchy = midydim16;
|
||||||
|
|
||||||
|
silentmessage("Next sprite with tag %d: %d%s", reftag, tmpspritenum,
|
||||||
|
oog ? "(out of grid)" : "");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printmessage16("No sprite higlighted, cannot cycle linking sprites.");
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (wallsprite==0)
|
else if (wallsprite==0)
|
||||||
{
|
{
|
||||||
SearchSectors(tsign);
|
SearchSectors(tsign);
|
||||||
|
@ -8167,11 +8232,6 @@ static void Keys2d(void)
|
||||||
}
|
}
|
||||||
else if (wallsprite==2)
|
else if (wallsprite==2)
|
||||||
DoSpriteSearch(tsign);
|
DoSpriteSearch(tsign);
|
||||||
|
|
||||||
///__old_sprite_search_1__
|
|
||||||
|
|
||||||
///__old_sprite_search_2__
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRESSED_KEYSC(G)) // G (grid on/off)
|
if (PRESSED_KEYSC(G)) // G (grid on/off)
|
||||||
|
|
Loading…
Reference in a new issue