- 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 uint32_t LeftSide, RightSide; // [RH] Group walls into loops
uint16_t TexelLength; uint16_t TexelLength;
int16_t Light; int16_t Light;
uint8_t Flags; uint16_t Flags;
int UDMFIndex; // needed to access custom UDMF fields which are stored in loading order. int UDMFIndex; // needed to access custom UDMF fields which are stored in loading order.
FLightNode * lighthead; // all dynamic lights that may affect this wall 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 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) void FTextureManager::ParseColorization(FScanner& sc)
{ {
TextureManipulation tm = {}; TextureManipulation tm = {};
tm.ModulateColor = 0x01ffffff;
sc.MustGetString(); sc.MustGetString();
FName cname = sc.String; FName cname = sc.String;
sc.MustGetToken('{'); sc.MustGetToken('{');
while (!sc.CheckToken('}')) while (!sc.CheckToken('}'))
{ {
if (sc.Compare("desaturation")) sc.MustGetString();
if (sc.Compare("DesaturationFactor"))
{ {
sc.MustGetFloat(); sc.MustGetFloat();
tm.DesaturationFactor = (float)sc.Float; tm.DesaturationFactor = (float)sc.Float;
@ -716,6 +718,7 @@ void FTextureManager::ParseColorization(FScanner& sc)
sc.MustGetNumber(); sc.MustGetNumber();
tm.ModulateColor.a = sc.Number; tm.ModulateColor.a = sc.Number;
} }
else tm.ModulateColor.a = 1;
} }
else if (sc.Compare("BlendColor")) else if (sc.Compare("BlendColor"))
{ {
@ -723,18 +726,20 @@ void FTextureManager::ParseColorization(FScanner& sc)
tm.BlendColor = V_GetColor(NULL, sc) & 0xffffff; tm.BlendColor = V_GetColor(NULL, sc) & 0xffffff;
sc.MustGetToken(','); sc.MustGetToken(',');
sc.MustGetString(); 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); tm.AddColor.a = (tm.AddColor.a & ~TextureManipulation::BlendMask) | sc.MustMatchString(opts);
if (sc.CheckToken(',')) if (sc.Compare("alpha"))
{ {
sc.MustGetToken(',');
sc.MustGetFloat(); 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")) else if (sc.Compare("invert"))
{ {
tm.AddColor.a |= TextureManipulation::InvertBit; tm.AddColor.a |= TextureManipulation::InvertBit;
} }
else sc.ScriptError("Unknown token '%s'", sc.String);
} }
if (tm.CheckIfEnabled()) if (tm.CheckIfEnabled())
{ {

View file

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

View file

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