- reworked spot lights to receive all relevant information through the args.

As a bonus, arg0str can now be used for all dynamic lights to pass a color in textual form, including X11R6RGB-names.
This commit is contained in:
Christoph Oelckers 2018-01-20 22:41:28 +01:00
commit 6aaf5df617
4 changed files with 20 additions and 14 deletions

View file

@ -6094,10 +6094,26 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->fillcolor = (mthing->fillcolor & 0xffffff) | (ColorMatcher.Pick((mthing->fillcolor & 0xff0000) >> 16,
(mthing->fillcolor & 0xff00) >> 8, (mthing->fillcolor & 0xff)) << 24);
// allow color strings for lights and reshuffle the args for spot lights
if (i->IsDescendantOf(RUNTIME_CLASS(ADynamicLight)))
{
((ADynamicLight*)mobj)->SpotInnerAngle = mthing->SpotInnerAngle;
((ADynamicLight*)mobj)->SpotOuterAngle = mthing->SpotOuterAngle;
auto light = static_cast<ADynamicLight*>(mobj);
if (mthing->arg0str.IsNotEmpty())
{
PalEntry color = V_GetColor(nullptr, mthing->arg0str);
}
else if (light->lightflags & LF_SPOT)
{
light->args[0] = RPART(mthing->args[0]);
light->args[1] = GPART(mthing->args[0]);
light->args[2] = BPART(mthing->args[0]);
}
if (light->lightflags & LF_SPOT)
{
light->SpotInnerAngle = double(mthing->args[1]);
light->SpotOuterAngle = double(mthing->args[2]);
}
}
mobj->CallBeginPlay ();