mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Mapster32: make wall texture alignment [.]/[,] work with bottom-swapped walls.
In simple cases, it should be added. Combinations of alignment across TROR boundaries and bottom-swapping will probably not work right. git-svn-id: https://svn.eduke32.com/eduke32@4265 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ae299b0e59
commit
8b7cb9e6c9
2 changed files with 32 additions and 15 deletions
|
@ -10472,22 +10472,27 @@ static int32_t GetWallBaseZ(int32_t wallnum)
|
||||||
|
|
||||||
////////// AUTOMATIC WALL ALIGNMENT //////////
|
////////// 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 tilenum, int32_t z0, int32_t z1, int32_t doxpanning,
|
||||||
|
int32_t w0_pan, int32_t w0_rep, int32_t w1_pan, int32_t w1_rep)
|
||||||
{
|
{
|
||||||
int32_t n;
|
int32_t n;
|
||||||
int32_t tilenum = wall[w0].picnum;
|
|
||||||
|
|
||||||
if (tilesizx[tilenum]==0 || tilesizy[tilenum]==0)
|
if (tilesizx[tilenum]==0 || tilesizy[tilenum]==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//do the x alignment
|
//do the x alignment
|
||||||
if (doxpanning)
|
if (doxpanning)
|
||||||
wall[w1].xpanning = (uint8_t)((wall[w0].xpanning + (wall[w0].xrepeat<<3))%tilesizx[tilenum]);
|
wall[w1_pan].xpanning = (uint8_t)((wall[w0_pan].xpanning + (wall[w0_rep].xrepeat<<3))%tilesizx[tilenum]);
|
||||||
|
|
||||||
for (n=picsiz[tilenum]>>4; (1<<n)<tilesizy[tilenum]; n++);
|
for (n=picsiz[tilenum]>>4; (1<<n)<tilesizy[tilenum]; n++);
|
||||||
|
|
||||||
wall[w1].yrepeat = wall[w0].yrepeat;
|
wall[w1_rep].yrepeat = wall[w0_rep].yrepeat;
|
||||||
wall[w1].ypanning = (uint8_t)(wall[w0].ypanning + (((z1-z0)*wall[w0].yrepeat)>>(n+3)));
|
wall[w1_pan].ypanning = (uint8_t)(wall[w0_pan].ypanning + (((z1-z0)*wall[w0_rep].yrepeat)>>(n+3)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AlignWalls(int32_t w0, int32_t z0, int32_t w1, int32_t z1, int32_t doxpanning)
|
||||||
|
{
|
||||||
|
AlignWalls_(wall[w0].picnum, z0, z1, doxpanning, w0, w0, w1, w1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlignWallPoint2(int32_t w0)
|
void AlignWallPoint2(int32_t w0)
|
||||||
|
@ -10498,21 +10503,31 @@ void AlignWallPoint2(int32_t w0)
|
||||||
|
|
||||||
#define ALIGN_WALLS_CSTAT_MASK (4+8+256)
|
#define ALIGN_WALLS_CSTAT_MASK (4+8+256)
|
||||||
|
|
||||||
|
static int32_t AlignGetWall(int32_t botswap, int32_t w)
|
||||||
|
{
|
||||||
|
return botswap && (wall[w].cstat&2) && wall[w].nextwall >= 0 ? wall[w].nextwall : w;
|
||||||
|
}
|
||||||
|
|
||||||
// flags:
|
// flags:
|
||||||
// 1: more than once
|
// 1: more than once
|
||||||
// 2: (unused)
|
// 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)
|
||||||
|
// 32: use special logic for 'bottom-swapped' walls
|
||||||
int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
{
|
{
|
||||||
static int32_t numaligned, wall0, cstat0;
|
static int32_t numaligned, wall0, cstat0;
|
||||||
static uint32_t lenrepquot;
|
static uint32_t lenrepquot;
|
||||||
|
|
||||||
const int32_t totheleft = flags&16;
|
const int32_t totheleft = flags&16;
|
||||||
|
const int32_t botswap = flags&32;
|
||||||
|
|
||||||
int32_t z0 = GetWallBaseZ(w0);
|
int32_t z0 = GetWallBaseZ(w0);
|
||||||
int32_t w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
int32_t w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
||||||
const int32_t tilenum = wall[w0].picnum;
|
|
||||||
|
int32_t w0b = AlignGetWall(botswap, w0);
|
||||||
|
const int32_t tilenum = wall[w0b].picnum;
|
||||||
|
|
||||||
if (nrecurs == 0)
|
if (nrecurs == 0)
|
||||||
{
|
{
|
||||||
|
@ -10522,12 +10537,14 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
numaligned = 0;
|
numaligned = 0;
|
||||||
lenrepquot = getlenbyrep(wallength(w0), wall[w0].xrepeat);
|
lenrepquot = getlenbyrep(wallength(w0), wall[w0].xrepeat);
|
||||||
wall0 = w0;
|
wall0 = w0;
|
||||||
cstat0 = wall[w0].cstat & ALIGN_WALLS_CSTAT_MASK; // top/bottom orientation; x/y-flip
|
cstat0 = wall[w0b].cstat & ALIGN_WALLS_CSTAT_MASK; // top/bottom orientation; x/y-flip
|
||||||
}
|
}
|
||||||
|
|
||||||
//loop through walls at this vertex in point2 order
|
//loop through walls at this vertex in point2 order
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
int32_t w1b = AlignGetWall(botswap, w1);
|
||||||
|
|
||||||
//break if this wall would connect us in a loop
|
//break if this wall would connect us in a loop
|
||||||
if (visited[w1>>3]&(1<<(w1&7)))
|
if (visited[w1>>3]&(1<<(w1&7)))
|
||||||
break;
|
break;
|
||||||
|
@ -10548,8 +10565,6 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
wall[ynw].xrepeat = wall[w0].xrepeat;
|
wall[ynw].xrepeat = wall[w0].xrepeat;
|
||||||
wall[ynw].xpanning = wall[w0].xpanning;
|
wall[ynw].xpanning = wall[w0].xpanning;
|
||||||
AlignWalls(w0,z0, ynw,GetWallBaseZ(ynw), 0); // initial vertical alignment
|
AlignWalls(w0,z0, ynw,GetWallBaseZ(ynw), 0); // initial vertical alignment
|
||||||
|
|
||||||
// AutoAlignWalls(ynw, flags&~8, nrecurs+1); // recurse once
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10559,7 +10574,7 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
if (wall[w1].nextwall == w0)
|
if (wall[w1].nextwall == w0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (wall[w1].picnum == tilenum)
|
if (wall[w1b].picnum == tilenum)
|
||||||
{
|
{
|
||||||
int32_t visible = 1;
|
int32_t visible = 1;
|
||||||
const int32_t nextsec = wall[w1].nextsector;
|
const int32_t nextsec = wall[w1].nextsector;
|
||||||
|
@ -10586,9 +10601,9 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
|
|
||||||
if ((flags&4) && w1!=wall0)
|
if ((flags&4) && w1!=wall0)
|
||||||
fixxrepeat(w1, lenrepquot);
|
fixxrepeat(w1, lenrepquot);
|
||||||
AlignWalls(w0,z0, w1,z1, 1);
|
AlignWalls_(tilenum,z0, z1, 1, w0b, w0, w1b, w1);
|
||||||
wall[w1].cstat &= ~ALIGN_WALLS_CSTAT_MASK;
|
wall[w1b].cstat &= ~ALIGN_WALLS_CSTAT_MASK;
|
||||||
wall[w1].cstat |= cstat0;
|
wall[w1b].cstat |= cstat0;
|
||||||
numaligned++;
|
numaligned++;
|
||||||
|
|
||||||
if ((flags&1)==0)
|
if ((flags&1)==0)
|
||||||
|
@ -10598,6 +10613,7 @@ int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs)
|
||||||
if (wall[w1].nextwall < 0)
|
if (wall[w1].nextwall < 0)
|
||||||
{
|
{
|
||||||
w0 = w1;
|
w0 = w1;
|
||||||
|
w0b = AlignGetWall(botswap, w0);
|
||||||
z0 = GetWallBaseZ(w0);
|
z0 = GetWallBaseZ(w0);
|
||||||
w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
w1 = totheleft ? lastwall(w0) : wall[w0].point2;
|
||||||
|
|
||||||
|
|
|
@ -5213,7 +5213,8 @@ static void Keys3d(void)
|
||||||
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 = (!eitherSHIFT) | (tsign?0:16) |
|
uint32_t flags = (!eitherSHIFT) | (tsign?0:16) |
|
||||||
(eitherALT<<2) | ((!!keystatus[KEYSC_QUOTE])<<3);
|
(eitherALT<<2) | ((!!keystatus[KEYSC_QUOTE])<<3) |
|
||||||
|
32*(searchwall != searchbottomwall);
|
||||||
|
|
||||||
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!!!
|
// Do it a second time because the first one is wrong. FIXME!!!
|
||||||
|
@ -5224,7 +5225,7 @@ static void Keys3d(void)
|
||||||
!eitherSHIFT ? " iteratively" : "",
|
!eitherSHIFT ? " iteratively" : "",
|
||||||
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");
|
(wall[searchbottomwall].cstat&4) ? "" : ". WARNING: top-aligned");
|
||||||
}
|
}
|
||||||
|
|
||||||
tsign = 0;
|
tsign = 0;
|
||||||
|
|
Loading…
Reference in a new issue