Replace dragpoint()'s "dragpoint_noreset" global with a "flags" argument.

Also, add another flag, signifying that from the editor, also the
"lastwall"s (i.e. the CCW-linked points) should get collected. This is
to signal the editor that their wall lengths should be displayed, too.

git-svn-id: https://svn.eduke32.com/eduke32@3394 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-16 20:38:41 +00:00
parent 898462152c
commit 8fb886b14a
8 changed files with 21 additions and 16 deletions

View file

@ -802,7 +802,7 @@ void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum,
const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3,4)));
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4)));
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day);
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags);
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
extern const int16_t *chsecptr_onextwall;

View file

@ -103,8 +103,6 @@ extern int32_t m32_osd_tryscript;
extern int32_t showheightindicators;
extern int32_t showambiencesounds;
extern int32_t dragpoint_noreset;
extern int32_t numgraysects;
extern uint8_t graysectbitmap[MAXSECTORS>>3];
extern uint8_t graywallbitmap[MAXWALLS>>3];

View file

@ -4700,6 +4700,7 @@ end_yax: ;
else
{
int32_t tx, ty, onlySprites=eitherCTRL;
int32_t accum_dragged_verts = 0;
if (!setop)
{
@ -4739,8 +4740,9 @@ end_yax: ;
{
if (numgraysects > 0 || m32_sideview)
{
dragpoint(i, wall[i].x, wall[i].y);
dragpoint_noreset = 1; // vvv
// Only called to find out which walls would get dragged:
dragpoint(i, wall[i].x, wall[i].y, accum_dragged_verts);
accum_dragged_verts = 1;
}
else
show2dwall[i>>3] |= (1<<(i&7));
@ -4749,7 +4751,6 @@ end_yax: ;
show2dwall[i>>3] &= ~(1<<(i&7));
}
}
dragpoint_noreset = 0; // ^^^
if (!sub && (numgraysects > 0 || m32_sideview))
{
@ -5458,7 +5459,7 @@ end_after_dragging:
goto end_point_dragging;
}
dragpoint(pointhighlight,dax,day);
dragpoint(pointhighlight,dax,day,2);
if ((unsigned)linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);

View file

@ -11889,8 +11889,10 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
//
// dragpoint
//
int32_t dragpoint_noreset = 0;
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
// flags:
// 1: don't reset walbitmap[] (the bitmap of already dragged vertices)
// 2: In the editor, do wall[].cstat |= (1<<14) also for the lastwall().
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags)
#ifdef YAX_ENABLE
{
int32_t i, numyaxwalls=0;
@ -11898,7 +11900,7 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
uint8_t *const walbitmap = (uint8_t *)tempbuf;
if (!dragpoint_noreset)
if ((flags&1)==0)
Bmemset(walbitmap, 0, (numwalls+7)>>3);
yaxwalls[numyaxwalls++] = pointhighlight;
@ -11973,7 +11975,11 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
// TODO: extern a separate bitmap instead?
for (w=0; w<numwalls; w++)
if (walbitmap[w>>3] & (1<<(w&7)))
{
wall[w].cstat |= (1<<14);
if (flags&2)
wall[lastwall(w)].cstat |= (1<<14);
}
}
}
#else

View file

@ -667,7 +667,7 @@ static void A_MoveSector(int32_t i)
for (; x<endwall; x++)
{
rotatepoint(0,0,msx[j],msy[j],k&2047,&tx,&ty);
dragpoint(x,s->x+tx,s->y+ty);
dragpoint(x,s->x+tx,s->y+ty,0);
j++;
}
@ -7082,8 +7082,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = nextj;
}
dragpoint((int16_t)t[1],wall[t[1]].x+x,wall[t[1]].y+l);
dragpoint((int16_t)t[2],wall[t[2]].x+x,wall[t[2]].y+l);
dragpoint((int16_t)t[1],wall[t[1]].x+x,wall[t[1]].y+l,0);
dragpoint((int16_t)t[2],wall[t[2]].x+x,wall[t[2]].y+l,0);
for (TRAVERSE_CONNECT(p))
{

View file

@ -8246,7 +8246,7 @@ static void Keys2d(void)
j = getnumber16(tempbuf, j, editorgridextent, 1);
Bsprintf(tempbuf, "Wall %d y: ", i);
k = getnumber16(tempbuf, k, editorgridextent, 1);
dragpoint(i, j, k);
dragpoint(i, j, k, 0);
printmessage16("Wall %d updated", i);
}
}

View file

@ -2183,7 +2183,7 @@ nullquote:
CON_ERRPRINTF("Invalid wall %d\n", wallnum);
continue;
}
dragpoint(wallnum,newx,newy);
dragpoint(wallnum,newx,newy,0);
continue;
}

View file

@ -2115,7 +2115,7 @@ badindex:
M32_ERROR("Invalid wall %d", wallnum);
continue;
}
dragpoint(wallnum,newx,newy);
dragpoint(wallnum,newx,newy,0);
continue;
}