Show lengths in Mapster for walls being drawn or moved

git-svn-id: https://svn.eduke32.com/eduke32@1047 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-09-02 02:45:06 +00:00
parent 166019082f
commit fbf25c7483
4 changed files with 58 additions and 22 deletions

View file

@ -92,7 +92,7 @@ void _printmessage16(const char *fmt, ...);
#define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__) #define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__)
void getpoint(int searchxe, int searchye, int *x, int *y); void getpoint(int searchxe, int searchye, int *x, int *y);
int getpointhighlight(int xplc, int yplc); int getpointhighlight(int xplc, int yplc, int point);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -192,7 +192,7 @@ void showwalldata(short wallnum);
void showspritedata(short spritenum); void showspritedata(short spritenum);
int drawtilescreen(int pictopleft, int picbox); int drawtilescreen(int pictopleft, int picbox);
void overheadeditor(void); void overheadeditor(void);
int getlinehighlight(int xplc, int yplc); int getlinehighlight(int xplc, int yplc, int line);
void fixspritesectors(void); void fixspritesectors(void);
int movewalls(int start, int offs); int movewalls(int start, int offs);
int loadnames(void); int loadnames(void);
@ -3098,7 +3098,7 @@ void overheadeditor(void)
} }
getpoint(searchx,searchy,&mousxplc,&mousyplc); getpoint(searchx,searchy,&mousxplc,&mousyplc);
linehighlight = getlinehighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight);
if (newnumwalls >= numwalls) if (newnumwalls >= numwalls)
{ {
@ -3182,7 +3182,15 @@ void overheadeditor(void)
x4 = divscale14(halfxdim16,zoom)+posx; x4 = divscale14(halfxdim16,zoom)+posx;
y4 = divscale14(ydim16-(midydim16-4),zoom)+posy; y4 = divscale14(ydim16-(midydim16-4),zoom)+posy;
for (i=numwalls-1,wal=&wall[i];i>=0;i--,wal--) if (newnumwalls >= 0)
{
for (i=newnumwalls;i>=tempint;i--)
wall[i].cstat |= (1<<14);
}
i = numwalls-1;
if (newnumwalls >= 0) i = newnumwalls-1;
for (wal=&wall[i];i>=0;i--,wal--)
{ {
//Get average point of wall //Get average point of wall
dax = ((wal->x+wall[wal->point2].x)>>1); dax = ((wal->x+wall[wal->point2].x)>>1);
@ -3200,13 +3208,13 @@ void overheadeditor(void)
y2 = y1 + 7; y2 = y1 + 7;
if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16)) if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16))
{ {
printext16(x1,y1,0,4,dabuffer,1); printext16(x1,y1,0,31,dabuffer,1);
drawline16(x1-1,y1-1,x2-3,y1-1,4); drawline16(x1-1,y1-1,x2-3,y1-1,31);
drawline16(x1-1,y2+1,x2-3,y2+1,4); drawline16(x1-1,y2+1,x2-3,y2+1,31);
drawline16(x1-2,y1,x1-2,y2,4); drawline16(x1-2,y1,x1-2,y2,31);
drawline16(x2-2,y1,x2-2,y2,4); drawline16(x2-2,y1,x2-2,y2,31);
drawline16(x2-3,y1,x2-3,y2,4); drawline16(x2-3,y1,x2-3,y2,31);
} }
} }
} }
@ -3580,8 +3588,8 @@ void overheadeditor(void)
} }
if (keystatus[0x30]) // B (clip Blocking xor) (2D) if (keystatus[0x30]) // B (clip Blocking xor) (2D)
{ {
pointhighlight = getpointhighlight(mousxplc, mousyplc); pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight);
linehighlight = getlinehighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight);
if ((pointhighlight&0xc000) == 16384) if ((pointhighlight&0xc000) == 16384)
{ {
@ -3608,7 +3616,7 @@ void overheadeditor(void)
keystatus[0x21] = 0; keystatus[0x21] = 0;
if (keystatus[0x38]|keystatus[0xb8]) //ALT-F (relative alignmment flip) if (keystatus[0x38]|keystatus[0xb8]) //ALT-F (relative alignmment flip)
{ {
linehighlight = getlinehighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight);
if (linehighlight >= 0) if (linehighlight >= 0)
{ {
setfirstwall(sectorofwall(linehighlight),linehighlight); setfirstwall(sectorofwall(linehighlight),linehighlight);
@ -3969,8 +3977,8 @@ void overheadeditor(void)
keystatus[0x23] = 0; keystatus[0x23] = 0;
if (keystatus[0x1d]|keystatus[0x9d]) //Ctrl-H if (keystatus[0x1d]|keystatus[0x9d]) //Ctrl-H
{ {
pointhighlight = getpointhighlight(mousxplc, mousyplc); pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight);
linehighlight = getlinehighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight);
if ((pointhighlight&0xc000) == 16384) if ((pointhighlight&0xc000) == 16384)
{ {
@ -4422,7 +4430,7 @@ void overheadeditor(void)
else else
{ {
if ((bstatus&1) > (oldmousebstatus&1)) if ((bstatus&1) > (oldmousebstatus&1))
pointhighlight = getpointhighlight(mousxplc, mousyplc); pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight);
if (pointhighlight >= 0) if (pointhighlight >= 0)
{ {
@ -4493,7 +4501,7 @@ void overheadeditor(void)
} }
else else
{ {
pointhighlight = getpointhighlight(mousxplc, mousyplc); pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight);
sectorhighlightstat = -1; sectorhighlightstat = -1;
} }
@ -6303,12 +6311,15 @@ void getpoint(int searchxe, int searchye, int *x, int *y)
if (*y >= editorgridextent) *y = editorgridextent; if (*y >= editorgridextent) *y = editorgridextent;
} }
int getlinehighlight(int xplc, int yplc) int getlinehighlight(int xplc, int yplc, int line)
{ {
int i, dst, dist, closest, x1, y1, x2, y2, nx, ny; int i, dst, dist, closest, x1, y1, x2, y2, nx, ny;
if (numwalls == 0) if (numwalls == 0)
return(-1); return(-1);
if (mouseb & 1) return line;
dist = 1024; dist = 1024;
closest = -1; closest = -1;
for (i=0;i<numwalls;i++) for (i=0;i<numwalls;i++)
@ -6336,13 +6347,15 @@ int getlinehighlight(int xplc, int yplc)
return(closest); return(closest);
} }
int getpointhighlight(int xplc, int yplc) int getpointhighlight(int xplc, int yplc, int point)
{ {
int i, dst, dist = 512, closest = -1; int i, dst, dist = 512, closest = -1;
if (numwalls == 0) if (numwalls == 0)
return(-1); return(-1);
if (mouseb & 1) return point;
if (grid < 1) if (grid < 1)
dist = 0; dist = 0;

View file

@ -8949,6 +8949,9 @@ void dragpoint(short pointhighlight, int dax, int day)
wall[pointhighlight].x = dax; wall[pointhighlight].x = dax;
wall[pointhighlight].y = day; wall[pointhighlight].y = day;
wall[pointhighlight].cstat |= (1<<14);
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
cnt = MAXWALLS; cnt = MAXWALLS;
tempshort = pointhighlight; //search points CCW tempshort = pointhighlight; //search points CCW
@ -8959,6 +8962,7 @@ void dragpoint(short pointhighlight, int dax, int day)
tempshort = wall[wall[tempshort].nextwall].point2; tempshort = wall[wall[tempshort].nextwall].point2;
wall[tempshort].x = dax; wall[tempshort].x = dax;
wall[tempshort].y = day; wall[tempshort].y = day;
wall[tempshort].cstat |= (1<<14);
} }
else else
{ {
@ -8970,6 +8974,7 @@ void dragpoint(short pointhighlight, int dax, int day)
tempshort = wall[lastwall(tempshort)].nextwall; tempshort = wall[lastwall(tempshort)].nextwall;
wall[tempshort].x = dax; wall[tempshort].x = dax;
wall[tempshort].y = day; wall[tempshort].y = day;
wall[tempshort].cstat |= (1<<14);
} }
else else
{ {

View file

@ -455,7 +455,20 @@ const char *ExtGetSectorCaption(short sectnum)
const char *ExtGetWallCaption(short wallnum) const char *ExtGetWallCaption(short wallnum)
{ {
static char tempbuf[1024]; static char tempbuf[1024];
Bmemset(tempbuf,0,sizeof(tempbuf)); Bmemset(tempbuf,0,sizeof(tempbuf));
if (wall[wallnum].cstat & (1<<14))
{
int dax = wall[wallnum].x-wall[wall[wallnum].point2].x;
int day = wall[wallnum].y-wall[wall[wallnum].point2].y;
int dist = ksqrt(dax*dax+day*day);
Bsprintf(tempbuf,"%d",dist);
wall[wallnum].cstat &= ~(1<<14);
return(tempbuf);
}
if (!(onnames==2 || onnames==4)) if (!(onnames==2 || onnames==4))
{ {
tempbuf[0] = 0; tempbuf[0] = 0;
@ -5969,7 +5982,7 @@ static void Keys2d(void)
clearmidstatbar16(); clearmidstatbar16();
showspritedata((short)i); showspritedata((short)i);
} }
else if ((linehighlight >= 0) && (sectorofwall(linehighlight) == cursectornum)) else if ((linehighlight >= 0) && (bstatus&1 || sectorofwall(linehighlight) == cursectornum))
{ {
clearmidstatbar16(); clearmidstatbar16();
showwalldata((short)linehighlight); showwalldata((short)linehighlight);
@ -6031,7 +6044,7 @@ static void Keys2d(void)
} }
getpoint(searchx,searchy,&mousxplc,&mousyplc); getpoint(searchx,searchy,&mousxplc,&mousyplc);
ppointhighlight = getpointhighlight(mousxplc,mousyplc); ppointhighlight = getpointhighlight(mousxplc,mousyplc, ppointhighlight);
if ((ppointhighlight&0xc000) == 16384) if ((ppointhighlight&0xc000) == 16384)
{ {
@ -9463,8 +9476,13 @@ typedef struct
short *headspritestat; short *headspritestat;
short *prevspritestat; short *prevspritestat;
short *nextspritestat; short *nextspritestat;
int revision; int revision;
mapundo_t *next; // 'redo' loads this
mapundo_t *prev; // 'undo' loads this
} mapundo_t; } mapundo_t;
mapundo_t *undopos = NULL; // pointer to current
mapundo_t undoredo[UNDODEPTH]; mapundo_t undoredo[UNDODEPTH];
*/ */