Remove 'lightintensity' UDMF key from Things, replaced it with the Thing's alpha instead

This commit is contained in:
nashmuhandes 2022-02-20 04:17:45 +08:00
parent 20cd01ebad
commit f38995889d
4 changed files with 11 additions and 10 deletions

View file

@ -220,6 +220,7 @@ struct MapThing2
short angle; short angle;
short type; short type;
short flags; short flags;
float alpha;
uint8_t special; uint8_t special;
uint8_t args[5]; uint8_t args[5];
}; };
@ -239,6 +240,7 @@ struct IntThing
short pitch; // UDMF short pitch; // UDMF
float height; // UDMF float height; // UDMF
float alpha;
TArray<UDMFKey> props; TArray<UDMFKey> props;
}; };

View file

@ -150,6 +150,7 @@ void FProcessor::LoadThings ()
Level.Things[i].args[3] = Things[i].args[3]; Level.Things[i].args[3] = Things[i].args[3];
Level.Things[i].args[4] = Things[i].args[4]; Level.Things[i].args[4] = Things[i].args[4];
Level.Things[i].pitch = 0; Level.Things[i].pitch = 0;
Level.Things[i].alpha = Things[i].alpha;
} }
delete[] Things; delete[] Things;
} }
@ -174,6 +175,7 @@ void FProcessor::LoadThings ()
Level.Things[i].args[3] = 0; Level.Things[i].args[3] = 0;
Level.Things[i].args[4] = 0; Level.Things[i].args[4] = 0;
Level.Things[i].pitch = 0; Level.Things[i].pitch = 0;
Level.Things[i].alpha = 1.0f;
} }
delete[] mt; delete[] mt;
} }

View file

@ -324,16 +324,8 @@ void FLevel::CreateLights()
// this is known as "intensity" on dynamic lights (and in UDB) // this is known as "intensity" on dynamic lights (and in UDB)
lightdistance = thing->args[3]; lightdistance = thing->args[3];
for (unsigned int propIndex = 0; propIndex < thing->props.Size(); propIndex++) // static light intensity (not to be confused with dynamic lights' intensity, which is actually static light distance
{ lightintensity = thing->alpha;
const UDMFKey &key = thing->props[propIndex];
// static light intensity (not to be confused with dynamic lights' intensity, which is actually static light distance
if (!stricmp(key.key, "lightintensity"))
{
lightintensity = atof(key.value);
}
}
if (lightdistance > 0.0f && lightintensity > 0.0f && lightcolor != 0) if (lightdistance > 0.0f && lightintensity > 0.0f && lightcolor != 0)
{ {

View file

@ -219,6 +219,11 @@ void FProcessor::ParseThing(IntThing *th)
{ {
th->args[4] = CheckInt(key); th->args[4] = CheckInt(key);
} }
th->alpha = 1.0f;
if (!stricmp(key, "alpha"))
{
th->alpha = CheckFloat(key);
}
// now store the key in its unprocessed form // now store the key in its unprocessed form
UDMFKey k = {key, value}; UDMFKey k = {key, value};