Mapster32: allow setting first walls of TROR sectors independently.

In 3D mode, Alt+F now only attempts to set the first wall of the aimed at
wall, not collecting upper/lower neighbors. For this, press Shift+Alt+F.
In 2D mode, they are always collected.

git-svn-id: https://svn.eduke32.com/eduke32@3825 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-30 18:10:45 +00:00
parent 4457a5fbca
commit 593b82692e
3 changed files with 62 additions and 33 deletions

View File

@ -151,7 +151,7 @@ extern void fixxrepeat(int16_t wallnum, uint32_t lenrepquot);
extern void AlignWallPoint2(int32_t w0);
extern int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs);
extern void SetFirstWall(int32_t sectnum, int32_t wallnum);
extern void SetFirstWall(int32_t sectnum, int32_t wallnum, int32_t alsoynw);
extern int32_t fixspritesectors(void);
extern void clearkeys(void);

View File

@ -2588,45 +2588,72 @@ static void sort_walls_geometrically(int16_t *wallist, int32_t nwalls)
}
#endif
void SetFirstWall(int32_t sectnum, int32_t wallnum)
void SetFirstWall(int32_t sectnum, int32_t wallnum, int32_t alsoynw)
{
#ifdef YAX_ENABLE
int32_t i, j, k, startwall, endwall;
int16_t cf, bunchnum, tempsect, tempwall;
int32_t i, j, k=0;
#endif
const sectortype *sec = &sector[sectnum];
for (i=0; i<numwalls; i++)
wall[i].cstat &= ~(1<<14);
for (cf=0; cf<2; cf++)
if (sec->wallptr == wallnum)
{
tempsect = sectnum;
tempwall = wallnum;
while ((bunchnum = yax_getbunch(tempsect, cf)) >= 0 &&
(tempsect=yax_is121(bunchnum, cf)) >= 0)
{
tempwall = yax_getnextwall(tempwall, cf);
if (tempwall < 0)
break; // corrupt!
wall[tempwall].cstat |= (1<<14);
}
message("Wall %d already first wall of sector %d", wallnum, sectnum);
return;
}
k = 0;
for (i=0; i<numsectors; i++)
for (WALLS_OF_SECTOR(i, j))
#ifdef YAX_ENABLE
if (alsoynw)
{
// Also consider upper/lower TROR neighbor walls.
int32_t startwall, endwall;
int16_t cf;
for (i=0; i<numwalls; i++)
wall[i].cstat &= ~(1<<14);
for (cf=0; cf<2; cf++)
{
if (wall[j].cstat & (1<<14))
int16_t bunchnum;
int32_t tempsect=sectnum, tempwall=wallnum;
while ((bunchnum = yax_getbunch(tempsect, cf)) >= 0 &&
(tempsect=yax_is121(bunchnum, cf)) >= 0)
{
setfirstwall(i, j);
k++;
break;
tempwall = yax_getnextwall(tempwall, cf);
if (tempwall < 0)
break; // corrupt!
wall[tempwall].cstat |= (1<<14);
}
}
for (i=0; i<numsectors; i++)
for (WALLS_OF_SECTOR(i, j))
{
if (wall[j].cstat & (1<<14))
{
setfirstwall(i, j);
k++;
break;
}
}
}
else
{
// Only consider aimed at wall <wallnum>.
int16_t cb = yax_getbunch(sectnum, YAX_CEILING);
int16_t fb = yax_getbunch(sectnum, YAX_FLOOR);
if ((cb>=0 && (sec->ceilingstat&2)) || (fb >= 0 && (sec->floorstat&2)))
{
message("Extended ceilings/floors must not be sloped to set first wall");
return;
}
}
if (k > 0)
message("Set first walls (sector[].wallptr) for %d sectors", k+1);
else
if (k == 0)
#endif
message("This wall now sector %d's first wall (sector[].wallptr)", sectnum);
@ -3851,7 +3878,7 @@ void overheadeditor(void)
{
linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight);
if (linehighlight >= 0)
SetFirstWall(sectorofwall(linehighlight), linehighlight);
SetFirstWall(sectorofwall(linehighlight), linehighlight, 1);
}
}

View File

@ -5692,7 +5692,7 @@ static void Keys3d(void)
if (eitherALT) //ALT-F (relative alignmment flip)
{
if (!AIMING_AT_SPRITE && ASSERT_AIMING)
SetFirstWall(searchsector, searchwall);
SetFirstWall(searchsector, searchwall, eitherSHIFT);
}
else
{
@ -7373,16 +7373,18 @@ paste_ceiling_or_floor:
else if (AIMING_AT_CEILING_OR_FLOOR)
{
#ifdef YAX_ENABLE
j = yax_getbunch(searchsector, AIMING_AT_FLOOR);
if (j < 0)
int16_t bunchnum = yax_getbunch(searchsector, AIMING_AT_FLOOR);
# if !defined NEW_MAP_FORMAY
if (bunchnum < 0)
# endif
#endif
AIMED_CEILINGFLOOR(xpanning) = 0;
AIMED_CEILINGFLOOR(ypanning) = 0;
AIMED_CEILINGFLOOR(stat) &= ~2;
AIMED_CEILINGFLOOR(heinum) = 0;
#ifdef YAX_ENABLE
if (j >= 0)
for (SECTORS_OF_BUNCH(j,!AIMING_AT_FLOOR, i))
if (bunchnum >= 0)
for (SECTORS_OF_BUNCH(bunchnum,!AIMING_AT_FLOOR, i))
{
SECTORFLD(i,stat, !AIMING_AT_FLOOR) &= ~2;
SECTORFLD(i,heinum, !AIMING_AT_FLOOR) = 0;