From 85bb5192b3d77629440003114984fb6a768c732f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 22 Dec 2016 16:10:06 +0200 Subject: [PATCH] Replaced sectorflooroffset with more generic compatibility parameter New parameter setsectoroffset can set offset of floor or ceiling # Conflicts: # src/compatibility.cpp --- src/compatibility.cpp | 26 ++++++++++++++++++-------- wadsrc/static/compatibility.txt | 8 ++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 04b3f2ce3..65afc72ff 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -80,7 +80,7 @@ enum CP_SETSPECIAL, CP_CLEARSPECIAL, CP_SETACTIVATION, - CP_SECTORFLOOROFFSET, + CP_SETSECTOROFFSET, CP_SETSECTORSPECIAL, CP_SETWALLYSCALE, CP_SETWALLTEXTURE, @@ -168,6 +168,11 @@ static const char *const WallTiers[] = "Top", "Mid", "Bot", NULL }; +static const char *const SectorPlanes[] = +{ + "floor", "ceil", NULL +}; + static TArray CompatParams; static int ii_compatparams; static TArray TexNames; @@ -291,12 +296,14 @@ void ParseCompatibility() sc.MustGetNumber(); CompatParams.Push(sc.Number); } - else if (sc.Compare("sectorflooroffset")) + else if (sc.Compare("setsectoroffset")) { if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); - CompatParams.Push(CP_SECTORFLOOROFFSET); + CompatParams.Push(CP_SETSECTOROFFSET); sc.MustGetNumber(); CompatParams.Push(sc.Number); + sc.MustGetString(); + CompatParams.Push(sc.MustMatchString(SectorPlanes)); sc.MustGetFloat(); CompatParams.Push(int(sc.Float*65536.)); } @@ -574,16 +581,19 @@ void SetCompatibilityParams() i += 3; break; } - case CP_SECTORFLOOROFFSET: + case CP_SETSECTOROFFSET: { if ((unsigned)CompatParams[i+1] < level.sectors.Size()) { sector_t *sec = &level.sectors[CompatParams[i+1]]; - const double delta = CompatParams[i + 2] / 65536.0; - sec->floorplane.ChangeHeight(delta); - sec->ChangePlaneTexZ(sector_t::floor, delta); + const double delta = CompatParams[i + 3] / 65536.0; + secplane_t& plane = sector_t::floor == CompatParams[i + 2] + ? sec->floorplane + : sec->ceilingplane; + plane.ChangeHeight(delta); + sec->ChangePlaneTexZ(CompatParams[i + 2], delta); } - i += 3; + i += 4; break; } case CP_SETSECTORSPECIAL: diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 93807661e..c48fa27eb 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -2,25 +2,25 @@ { // Slightly squash the pillars in the starting room with "stimpacks" // floating on them so that they can be obtained. - sectorflooroffset 62 -8 + setsectoroffset 62 floor -8 setwallyscale 286 front bot 1.090909 setwallyscale 287 front bot 1.090909 setwallyscale 288 front bot 1.090909 setwallyscale 289 front bot 1.090909 - sectorflooroffset 63 -8 + setsectoroffset 63 floor -8 setwallyscale 290 front bot 1.090909 setwallyscale 291 front bot 1.090909 setwallyscale 292 front bot 1.090909 setwallyscale 293 front bot 1.090909 - sectorflooroffset 118 -8 + setsectoroffset 118 floor -8 setwallyscale 710 front bot 1.090909 setwallyscale 711 front bot 1.090909 setwallyscale 712 front bot 1.090909 setwallyscale 713 front bot 1.090909 - sectorflooroffset 119 -8 + setsectoroffset 119 floor -8 setwallyscale 714 front bot 1.090909 setwallyscale 715 front bot 1.090909 setwallyscale 716 front bot 1.090909