Mapster32: more or less fix the auto wall-alignment feature ([.]/[,]).

- Run it twice, since the first one is wrong.
- Warn when attempting to align based on a top-oriented wall. When the
  sequence of walls to align has "windows", only the bottom parts will
  be correct.
- Make the modifiers actually useful:
  * Pressing SHIFT aligns at most one wall, remove the old CTRL modifier.
  * The rest is as before: ALT makes the walls have (approximately) equal
    texture stretching, ['] (quote) aligns the immediate TROR-nextwalls.

git-svn-id: https://svn.eduke32.com/eduke32@3396 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-16 20:38:50 +00:00
parent ac31e386ff
commit 0648d25db1
2 changed files with 21 additions and 14 deletions

View File

@ -10368,6 +10368,9 @@ static int32_t GetWallBaseZ(int32_t wallnum)
return z;
}
////////// AUTOMATIC WALL ALIGNMENT //////////
static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t doxpanning)
{
int32_t n;
@ -10395,8 +10398,8 @@ void AlignWallPoint2(int32_t w0)
#define ALIGN_WALLS_CSTAT_MASK (4+8+256)
// flags:
// 1: recurse nextwalls
// 2: iterate point2's
// 1: more than once
// 2: (unused)
// 4: carry pixel width from first wall over to the rest
// 8: align TROR nextwalls
// 16: iterate lastwall()s (point2 in reverse)
@ -10487,11 +10490,12 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
wall[w1].cstat |= cstat0;
numaligned++;
if ((flags&1)==0)
return 1;
//if wall was 1-sided, no need to recurse
if (wall[w1].nextwall < 0)
{
if (!(flags&2))
break;
w0 = w1;
z0 = GetWallBaseZ(w0);
w1 = totheleft ? lastwall(w0) : wall[w0].point2;
@ -10499,12 +10503,11 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
continue;
}
if (flags&1)
AutoAlignWalls(w1, flags, nrecurs+1);
AutoAlignWalls(w1, flags, nrecurs+1);
}
}
if (wall[w1].nextwall < 0 || !(flags&2))
if (wall[w1].nextwall < 0)
break;
w1 = totheleft ? lastwall(wall[w1].nextwall) : NEXTWALL(w1).point2;
}

View File

@ -5242,18 +5242,22 @@ static void Keys3d(void)
ShowFileText("sthelp.hlp");
}
// . Search & fix panning to the right (3D)
// [.] or [,]: Search & fix panning to the right or left (3D)
if (AIMING_AT_WALL_OR_MASK && ((tsign=PRESSED_KEYSC(PERIOD)) || PRESSED_KEYSC(COMMA)))
{
uint32_t flags = eitherCTRL | ((!eitherSHIFT)<<1) | (tsign?0:16) |
uint32_t flags = (!eitherSHIFT) | (tsign?0:16) |
(eitherALT<<2) | ((!!keystatus[KEYSC_QUOTE])<<3);
int32_t naligned=AutoAlignWalls(searchwall, flags, 0);
// Do it a second time because the first one is wrong. FIXME!!!
AutoAlignWalls(searchwall, flags, 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":"",
keystatus[KEYSC_QUOTE]?", aligning TROR-nextwalls":"");
naligned==1 ? "" : "s", searchwall,
!eitherSHIFT ? " iteratively" : "",
eitherALT ? ", aligning xrepeats" : "",
keystatus[KEYSC_QUOTE] ? ", aligning TROR-nextwalls" : "",
(wall[searchwall].cstat&4) ? "" : ". WARNING: top-aligned");
}
tsign = 0;