- fixed the colorization parser.

This commit is contained in:
Christoph Oelckers 2019-12-29 12:11:16 +01:00
parent 3530bc5945
commit 77469e0512
4 changed files with 13 additions and 8 deletions

View file

@ -1208,7 +1208,7 @@ struct side_t
uint32_t LeftSide, RightSide; // [RH] Group walls into loops
uint16_t TexelLength;
int16_t Light;
uint8_t Flags;
uint16_t Flags;
int UDMFIndex; // needed to access custom UDMF fields which are stored in loading order.
FLightNode * lighthead; // all dynamic lights that may affect this wall
seg_t **segs; // all segs belonging to this sidedef in ascending order. Used for precise rendering

View file

@ -692,12 +692,14 @@ void FTextureManager::AddHiresTextures (int wadnum)
void FTextureManager::ParseColorization(FScanner& sc)
{
TextureManipulation tm = {};
tm.ModulateColor = 0x01ffffff;
sc.MustGetString();
FName cname = sc.String;
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
if (sc.Compare("desaturation"))
sc.MustGetString();
if (sc.Compare("DesaturationFactor"))
{
sc.MustGetFloat();
tm.DesaturationFactor = (float)sc.Float;
@ -716,6 +718,7 @@ void FTextureManager::ParseColorization(FScanner& sc)
sc.MustGetNumber();
tm.ModulateColor.a = sc.Number;
}
else tm.ModulateColor.a = 1;
}
else if (sc.Compare("BlendColor"))
{
@ -723,18 +726,20 @@ void FTextureManager::ParseColorization(FScanner& sc)
tm.BlendColor = V_GetColor(NULL, sc) & 0xffffff;
sc.MustGetToken(',');
sc.MustGetString();
static const char* opts[] = {"none", "alpha", "screen", "overlay", "hardlight", nullptr};
static const char* opts[] = { "none", "alpha", "screen", "overlay", "hardlight", nullptr };
tm.AddColor.a = (tm.AddColor.a & ~TextureManipulation::BlendMask) | sc.MustMatchString(opts);
if (sc.CheckToken(','))
if (sc.Compare("alpha"))
{
sc.MustGetToken(',');
sc.MustGetFloat();
tm.BlendColor.a = (uint8_t)clamp(sc.Float, 0., 1.) * 255;
tm.BlendColor.a = (uint8_t)(clamp(sc.Float, 0., 1.) * 255);
}
}
else if (sc.Compare("invert"))
{
tm.AddColor.a |= TextureManipulation::InvertBit;
}
else sc.ScriptError("Unknown token '%s'", sc.String);
}
if (tm.CheckIfEnabled())
{

View file

@ -157,7 +157,7 @@ struct FVector4PalEntry
r = newvalue.r * normScale;
g = newvalue.g * normScale;
b = newvalue.b * normScale;
a = newvalue.a;
a = 1;
return *this;
}

View file

@ -67,7 +67,7 @@ struct Side native play
//DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
native readonly Line linedef;
native int16 Light;
native uint8 Flags;
native uint16 Flags;
native TextureID GetTexture(int which);
native void SetTexture(int which, TextureID tex);
@ -159,7 +159,7 @@ struct Line native play
native uint activation; // activation type
native int special;
native int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width)
native double alpha; // <--- translucency (0=invisible, FRACUNIT=opaque)
native double alpha; // <--- translucency (0=invisible, 1.0=opaque)
native readonly Side sidedef[2];
native readonly double bbox[4]; // bounding box, for the extent of the LineDef.
native readonly Sector frontsector, backsector;