diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 9da91a884..fc1a46f9f 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -285,6 +285,8 @@ extern int32_t taglab_getnextfreetag(void); extern int32_t showtags; +int32_t select_sprite_tag(int32_t spritenum); + #define NEXTWALL(i) (wall[wall[i].nextwall]) #define POINT2(i) (wall[wall[i].point2]) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 21f20fd76..06995f4dd 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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)) +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) { @@ -3175,6 +3223,22 @@ void overheadeditor(void) draw2dscreen(&pos,cursectnum,ang,zoom,grid); 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= 768) diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 151eebc43..d276c2e3c 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -482,7 +482,6 @@ int32_t writesetup(const char *fn) "autocorruptchecksec = %d\n" "\n" "; Ignore 'already referenced wall' warnings\n" - "; (toggled with 'corruptcheck noalreadyrefd')\n" "corruptcheck_noalreadyrefd = %d\n" "\n" "; Fix sprite sectnums when saving a map or entering 3D mode\n" diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 2203f978c..742d023b3 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1062,7 +1062,8 @@ int32_t taglab_gettag(const char *label) #define 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 // 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 i, lt, nextfreetag=1; + int32_t i, nextfreetag=1; + for (i=0; i= -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 { - char did_wrap = 0, outofgrid=0; + char did_wrap = 0, outofgrid; int32_t i, j, k = 0; dir = 1-2*(dir<0); @@ -7563,21 +7593,10 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards } // found matching sprite - if (pos.x >= -editorgridextent && pos.x <= editorgridextent && - 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; + outofgrid = jump_to_sprite(gs_cursprite); printmessage16("%s Sprite seach%s: found sprite %d%s", dir<0 ? "<" : ">", did_wrap ? " (wrap)" : "", gs_cursprite, outofgrid?"(outside grid)":""); - did_wrap = 0; return; NEXTSPRITE: @@ -8072,72 +8091,118 @@ static void Keys2d(void) if (tsign) { - if (eitherALT && numcorruptthings>0) + if (eitherALT) { - int32_t wrap=0, x, y, z; + if (numcorruptthings > 0) + { + int32_t wrap=0, x, y, z; - if (curcorruptthing<0 || curcorruptthing>=numcorruptthings) - curcorruptthing = 0; + if (curcorruptthing<0 || curcorruptthing>=numcorruptthings) + curcorruptthing = 0; + else + { + curcorruptthing += tsign; + wrap = (curcorruptthing<0 || curcorruptthing>=numcorruptthings); + curcorruptthing += numcorruptthings; + curcorruptthing %= numcorruptthings; + } + + k = corruptthings[curcorruptthing]; + j = -1; + switch (k&CORRUPT_MASK) + { + case 0: + printmessage16("MAP LIMITS EXCEEDED!"); + x = y = z = 0; + break; + case CORRUPT_SECTOR: + i = k&(MAXSECTORS-1); + j = 0; + x = wall[sector[i].wallptr].x; + y = wall[sector[i].wallptr].y; + z = getflorzofslope(i, x, y); + break; + case CORRUPT_WALL: + i = k&(MAXWALLS-1); + j = 1; + x = wall[i].x + (wall[wall[i].point2].x-wall[i].x)/2; + y = wall[i].y + (wall[wall[i].point2].y-wall[i].y)/2; + z = getflorzofslope(sectorofwall(i), x, y); + break; + case CORRUPT_SPRITE: + i = k&(MAXSPRITES-1); + j = 2; + x = sprite[i].x; + y = sprite[i].y; + z = sprite[i].z; + break; + default: + k = 0; + x = y = z = 0; + break; + } + + if (k) + { + static const char *secwalspr[3] = {"sector", "wall", "sprite"}; + if (x>=-editorgridextent && x<=editorgridextent && + y>=-editorgridextent && y<=editorgridextent) + { + pos.x = x; + pos.y = y; + pos.z = z; +#ifdef YAX_ENABLE + yax_updategrays(pos.z); +#endif + } + else x=editorgridextent+1; + + printmessage16("#%d: %s Corrupt %s %d%s", curcorruptthing+1, tsign<0?"<":">", secwalspr[j], + i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : "")); + } + } else { - curcorruptthing += tsign; - wrap = (curcorruptthing<0 || curcorruptthing>=numcorruptthings); - curcorruptthing += numcorruptthings; - curcorruptthing %= numcorruptthings; + printmessage16("Map has no corruptions, cannot cycle them."); } - - k = corruptthings[curcorruptthing]; - j = -1; - switch (k&CORRUPT_MASK) + } + else if (keystatus[KEYSC_LSHIFT]) + { + if (pointhighlight&16384) { - case 0: - printmessage16("MAP LIMITS EXCEEDED!"); - x = y = z = 0; - break; - case CORRUPT_SECTOR: - i = k&(MAXSECTORS-1); - j = 0; - x = wall[sector[i].wallptr].x; - y = wall[sector[i].wallptr].y; - z = getflorzofslope(i, x, y); - break; - case CORRUPT_WALL: - i = k&(MAXWALLS-1); - j = 1; - x = wall[i].x + (wall[wall[i].point2].x-wall[i].x)/2; - y = wall[i].y + (wall[wall[i].point2].y-wall[i].y)/2; - z = getflorzofslope(sectorofwall(i), x, y); - break; - case CORRUPT_SPRITE: - i = k&(MAXSPRITES-1); - j = 2; - x = sprite[i].x; - y = sprite[i].y; - z = sprite[i].z; - break; - default: - k = 0; - x = y = z = 0; - break; - } + const int32_t refspritenum = pointhighlight&16383; + const int32_t reftag = select_sprite_tag(refspritenum); + int32_t tmpspritenum = refspritenum; - if (k) - { - static const char *secwalspr[3] = {"sector", "wall", "sprite"}; - if (x>=-editorgridextent && x<=editorgridextent && - y>=-editorgridextent && y<=editorgridextent) + while (reftag != INT32_MIN) // if (reftag != INT32_MIN) while (1) { - pos.x = x; - pos.y = y; - pos.z = z; -#ifdef YAX_ENABLE - yax_updategrays(pos.z); -#endif - } - else x=editorgridextent+1; + tmpspritenum += tsign; + if ((unsigned)tmpspritenum >= MAXSPRITES) + tmpspritenum = (MAXSPRITES+tmpspritenum)%MAXSPRITES; - printmessage16("#%d: %s Corrupt %s %d%s", curcorruptthing+1, tsign<0?"<":">", secwalspr[j], - i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : "")); + 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) @@ -8167,11 +8232,6 @@ static void Keys2d(void) } else if (wallsprite==2) DoSpriteSearch(tsign); - -///__old_sprite_search_1__ - -///__old_sprite_search_2__ - } if (PRESSED_KEYSC(G)) // G (grid on/off)