From 84867ee6201f6208da945be292ae2d6b9db38130 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 12 Dec 2011 23:18:35 +0000 Subject: [PATCH] Mapster32: Rudimentary support for auto-aligning along TROR nextwalls. Usage: press the ['] (quote) modifier together with the PERIOD key. Aligns only the immediate upper and lower neighbors of each wall that got aligned by following point2s or nextwalls. Doesn't play well with Alt (carry over xrepeat) yet, might need two subsequent alignment passes. git-svn-id: https://svn.eduke32.com/eduke32@2178 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 33 ++++++++++++++++++++++++++----- polymer/eduke32/source/astub.c | 8 +++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 219371b7a..36dd304d1 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -10052,15 +10052,17 @@ static int32_t GetWallBaseZ(int32_t wallnum) return(z); } -static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t tilenum) +static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t doxpanning) { int32_t n; + int32_t tilenum = wall[w0].picnum; if (tilesizx[tilenum]==0 || tilesizy[tilenum]==0) return; //do the x alignment - wall[w1].xpanning = (uint8_t)((wall[w0].xpanning + (wall[w0].xrepeat<<3))%tilesizx[tilenum]); + if (doxpanning) + wall[w1].xpanning = (uint8_t)((wall[w0].xpanning + (wall[w0].xrepeat<<3))%tilesizx[tilenum]); for (n=picsiz[tilenum]>>4; (1<>3] |= (1<<(w1&7)); +#ifdef YAX_ENABLE + if (flags&8) + { + int32_t cf, ynw; + + for (cf=0; cf<2; cf++) + { + ynw = yax_getnextwall(w0, cf); + + if (ynw >= 0 && wall[ynw].picnum==tilenum && (visited[ynw>>3]&(1<<(ynw&7)))==0) + { + wall[ynw].xrepeat = wall[w0].xrepeat; + wall[ynw].xpanning = wall[w0].xpanning; + AlignWalls(w0,z0, ynw,GetWallBaseZ(ynw), 0); // initial vertical alignment + +// AutoAlignWalls(ynw, flags&~8, nrecurs+1); // recurse once + } + } + } +#endif //break if reached back of left wall if (wall[w1].nextwall == w0) break; @@ -10141,7 +10164,7 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs) { if ((flags&4) && w0!=wall0) fixxrepeat(w0, lenrepquot); - AlignWalls(w0,z0, w1,z1, tilenum); + AlignWalls(w0,z0, w1,z1, 1); wall[w1].cstat &= ~ALIGN_WALLS_CSTAT_MASK; wall[w1].cstat |= cstat0; numaligned++; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 9e0f6e9a7..7cf43fd45 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5330,12 +5330,14 @@ static void Keys3d(void) // . Search & fix panning to the right (3D) if (AIMING_AT_WALL_OR_MASK && PRESSED_KEYSC(PERIOD)) { - int32_t naligned=AutoAlignWalls(searchwall, eitherCTRL|((!eitherSHIFT)<<1)|eitherALT<<2, 0); - message("Aligned %d wall%s based on wall %d%s%s%s", naligned, + int32_t naligned=AutoAlignWalls(searchwall, eitherCTRL|((!eitherSHIFT)<<1)| + (eitherALT<<2)|((!!keystatus[KEYSC_QUOTE])<<3), 0); + message("Aligned %d wall%s based on wall %d%s%s%s%s", naligned, naligned==1?"":"s", searchwall, eitherCTRL?", recursing nextwalls":"", !eitherSHIFT?", iterating point2s":"", - eitherALT?", aligning xrepeats":""); + eitherALT?", aligning xrepeats":"", + keystatus[KEYSC_QUOTE]?", aligning TROR-nextwalls":""); } tsign = 0;