From 8fb886b14a87888819c3b844a4f703c3b29310ae Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 16 Jan 2013 20:38:41 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/build.h | 2 +- polymer/eduke32/build/include/editor.h | 2 -- polymer/eduke32/build/src/build.c | 9 +++++---- polymer/eduke32/build/src/engine.c | 12 +++++++++--- polymer/eduke32/source/actors.c | 6 +++--- polymer/eduke32/source/astub.c | 2 +- polymer/eduke32/source/gameexec.c | 2 +- polymer/eduke32/source/m32exec.c | 2 +- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index f99b7b95c..d32b12ca7 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -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; diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 530176190..6cb6e3c64 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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]; diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index b8c4f06a9..51819f604 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 52e5d76a8..c10c5bd84 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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>3] & (1<<(w&7))) + { wall[w].cstat |= (1<<14); + if (flags&2) + wall[lastwall(w)].cstat |= (1<<14); + } } } #else diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 31f2198dd..ede8f3934 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -667,7 +667,7 @@ static void A_MoveSector(int32_t i) for (; xx+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)) { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 07a90fefa..efb33febb 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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); } } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 3d93e6433..672bc5dc1 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2183,7 +2183,7 @@ nullquote: CON_ERRPRINTF("Invalid wall %d\n", wallnum); continue; } - dragpoint(wallnum,newx,newy); + dragpoint(wallnum,newx,newy,0); continue; } diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 5aa413e37..dc297fe15 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -2115,7 +2115,7 @@ badindex: M32_ERROR("Invalid wall %d", wallnum); continue; } - dragpoint(wallnum,newx,newy); + dragpoint(wallnum,newx,newy,0); continue; }