Replaced sectorflooroffset with more generic compatibility parameter

New parameter setsectoroffset can set offset of floor or ceiling

# Conflicts:
#	src/compatibility.cpp
This commit is contained in:
alexey.lysiuk 2016-12-22 16:10:06 +02:00 committed by Christoph Oelckers
parent de97b753f6
commit 85bb5192b3
2 changed files with 22 additions and 12 deletions

View file

@ -80,7 +80,7 @@ enum
CP_SETSPECIAL, CP_SETSPECIAL,
CP_CLEARSPECIAL, CP_CLEARSPECIAL,
CP_SETACTIVATION, CP_SETACTIVATION,
CP_SECTORFLOOROFFSET, CP_SETSECTOROFFSET,
CP_SETSECTORSPECIAL, CP_SETSECTORSPECIAL,
CP_SETWALLYSCALE, CP_SETWALLYSCALE,
CP_SETWALLTEXTURE, CP_SETWALLTEXTURE,
@ -168,6 +168,11 @@ static const char *const WallTiers[] =
"Top", "Mid", "Bot", NULL "Top", "Mid", "Bot", NULL
}; };
static const char *const SectorPlanes[] =
{
"floor", "ceil", NULL
};
static TArray<int> CompatParams; static TArray<int> CompatParams;
static int ii_compatparams; static int ii_compatparams;
static TArray<FString> TexNames; static TArray<FString> TexNames;
@ -291,12 +296,14 @@ void ParseCompatibility()
sc.MustGetNumber(); sc.MustGetNumber();
CompatParams.Push(sc.Number); CompatParams.Push(sc.Number);
} }
else if (sc.Compare("sectorflooroffset")) else if (sc.Compare("setsectoroffset"))
{ {
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SECTORFLOOROFFSET); CompatParams.Push(CP_SETSECTOROFFSET);
sc.MustGetNumber(); sc.MustGetNumber();
CompatParams.Push(sc.Number); CompatParams.Push(sc.Number);
sc.MustGetString();
CompatParams.Push(sc.MustMatchString(SectorPlanes));
sc.MustGetFloat(); sc.MustGetFloat();
CompatParams.Push(int(sc.Float*65536.)); CompatParams.Push(int(sc.Float*65536.));
} }
@ -574,16 +581,19 @@ void SetCompatibilityParams()
i += 3; i += 3;
break; break;
} }
case CP_SECTORFLOOROFFSET: case CP_SETSECTOROFFSET:
{ {
if ((unsigned)CompatParams[i+1] < level.sectors.Size()) if ((unsigned)CompatParams[i+1] < level.sectors.Size())
{ {
sector_t *sec = &level.sectors[CompatParams[i+1]]; sector_t *sec = &level.sectors[CompatParams[i+1]];
const double delta = CompatParams[i + 2] / 65536.0; const double delta = CompatParams[i + 3] / 65536.0;
sec->floorplane.ChangeHeight(delta); secplane_t& plane = sector_t::floor == CompatParams[i + 2]
sec->ChangePlaneTexZ(sector_t::floor, delta); ? sec->floorplane
: sec->ceilingplane;
plane.ChangeHeight(delta);
sec->ChangePlaneTexZ(CompatParams[i + 2], delta);
} }
i += 3; i += 4;
break; break;
} }
case CP_SETSECTORSPECIAL: case CP_SETSECTORSPECIAL:

View file

@ -2,25 +2,25 @@
{ {
// Slightly squash the pillars in the starting room with "stimpacks" // Slightly squash the pillars in the starting room with "stimpacks"
// floating on them so that they can be obtained. // floating on them so that they can be obtained.
sectorflooroffset 62 -8 setsectoroffset 62 floor -8
setwallyscale 286 front bot 1.090909 setwallyscale 286 front bot 1.090909
setwallyscale 287 front bot 1.090909 setwallyscale 287 front bot 1.090909
setwallyscale 288 front bot 1.090909 setwallyscale 288 front bot 1.090909
setwallyscale 289 front bot 1.090909 setwallyscale 289 front bot 1.090909
sectorflooroffset 63 -8 setsectoroffset 63 floor -8
setwallyscale 290 front bot 1.090909 setwallyscale 290 front bot 1.090909
setwallyscale 291 front bot 1.090909 setwallyscale 291 front bot 1.090909
setwallyscale 292 front bot 1.090909 setwallyscale 292 front bot 1.090909
setwallyscale 293 front bot 1.090909 setwallyscale 293 front bot 1.090909
sectorflooroffset 118 -8 setsectoroffset 118 floor -8
setwallyscale 710 front bot 1.090909 setwallyscale 710 front bot 1.090909
setwallyscale 711 front bot 1.090909 setwallyscale 711 front bot 1.090909
setwallyscale 712 front bot 1.090909 setwallyscale 712 front bot 1.090909
setwallyscale 713 front bot 1.090909 setwallyscale 713 front bot 1.090909
sectorflooroffset 119 -8 setsectoroffset 119 floor -8
setwallyscale 714 front bot 1.090909 setwallyscale 714 front bot 1.090909
setwallyscale 715 front bot 1.090909 setwallyscale 715 front bot 1.090909
setwallyscale 716 front bot 1.090909 setwallyscale 716 front bot 1.090909