From 593b82692e886becd23293536abe67ae5da69458 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 30 May 2013 18:10:45 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/editor.h | 2 +- polymer/eduke32/build/src/build.c | 81 +++++++++++++++++--------- polymer/eduke32/source/astub.c | 12 ++-- 3 files changed, 62 insertions(+), 33 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 6652786fc..9cf4287f8 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index c5ed0051b..b0c097fd3 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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 = §or[sectnum]; - for (i=0; iwallptr == 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= 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. + 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); } } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 20277f12a..0fed14aef 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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;