mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
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:
parent
ac31e386ff
commit
0648d25db1
2 changed files with 21 additions and 14 deletions
|
@ -10368,6 +10368,9 @@ static int32_t GetWallBaseZ(int32_t wallnum)
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////// AUTOMATIC WALL ALIGNMENT //////////
|
||||||
|
|
||||||
static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t doxpanning)
|
static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t doxpanning)
|
||||||
{
|
{
|
||||||
int32_t n;
|
int32_t n;
|
||||||
|
@ -10395,8 +10398,8 @@ void AlignWallPoint2(int32_t w0)
|
||||||
#define ALIGN_WALLS_CSTAT_MASK (4+8+256)
|
#define ALIGN_WALLS_CSTAT_MASK (4+8+256)
|
||||||
|
|
||||||
// flags:
|
// flags:
|
||||||
// 1: recurse nextwalls
|
// 1: more than once
|
||||||
// 2: iterate point2's
|
// 2: (unused)
|
||||||
// 4: carry pixel width from first wall over to the rest
|
// 4: carry pixel width from first wall over to the rest
|
||||||
// 8: align TROR nextwalls
|
// 8: align TROR nextwalls
|
||||||
// 16: iterate lastwall()s (point2 in reverse)
|
// 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;
|
wall[w1].cstat |= cstat0;
|
||||||
numaligned++;
|
numaligned++;
|
||||||
|
|
||||||
|
if ((flags&1)==0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
//if wall was 1-sided, no need to recurse
|
//if wall was 1-sided, no need to recurse
|
||||||
if (wall[w1].nextwall < 0)
|
if (wall[w1].nextwall < 0)
|
||||||
{
|
{
|
||||||
if (!(flags&2))
|
|
||||||
break;
|
|
||||||
w0 = w1;
|
w0 = w1;
|
||||||
z0 = GetWallBaseZ(w0);
|
z0 = GetWallBaseZ(w0);
|
||||||
w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
||||||
|
@ -10499,12 +10503,11 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
continue;
|
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;
|
break;
|
||||||
w1 = totheleft ? lastwall(wall[w1].nextwall) : NEXTWALL(w1).point2;
|
w1 = totheleft ? lastwall(wall[w1].nextwall) : NEXTWALL(w1).point2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5242,18 +5242,22 @@ static void Keys3d(void)
|
||||||
ShowFileText("sthelp.hlp");
|
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)))
|
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);
|
(eitherALT<<2) | ((!!keystatus[KEYSC_QUOTE])<<3);
|
||||||
|
|
||||||
int32_t naligned=AutoAlignWalls(searchwall, flags, 0);
|
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,
|
message("Aligned %d wall%s based on wall %d%s%s%s%s", naligned,
|
||||||
naligned==1?"":"s", searchwall,
|
naligned==1 ? "" : "s", searchwall,
|
||||||
eitherCTRL?", recursing nextwalls":"",
|
!eitherSHIFT ? " iteratively" : "",
|
||||||
!eitherSHIFT?", iterating point2s":"",
|
eitherALT ? ", aligning xrepeats" : "",
|
||||||
eitherALT?", aligning xrepeats":"",
|
keystatus[KEYSC_QUOTE] ? ", aligning TROR-nextwalls" : "",
|
||||||
keystatus[KEYSC_QUOTE]?", aligning TROR-nextwalls":"");
|
(wall[searchwall].cstat&4) ? "" : ". WARNING: top-aligned");
|
||||||
}
|
}
|
||||||
|
|
||||||
tsign = 0;
|
tsign = 0;
|
||||||
|
|
Loading…
Reference in a new issue