- fixed attached dynamic light setup.
This was only run on a state change and missed every external light change. Any place which wants to flag a light change now only will set a flag and at the end of the thinker loop all flagged actors will be processed. For performance reasons this was merged with the P_RunEffects iterator loop.
This commit is contained in:
parent
6e8ee9a684
commit
ae57bc71d4
6 changed files with 29 additions and 36 deletions
|
|
@ -764,17 +764,11 @@ void AActor::SetDynamicLights()
|
|||
AttachLight(count++, def);
|
||||
}
|
||||
|
||||
if (LightAssociations.Size() > 0)
|
||||
for (const auto asso : LightAssociations)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < LightAssociations.Size(); i++)
|
||||
if (asso->Sprite() == sprite && (asso->Frame() == frame || asso->Frame() == -1))
|
||||
{
|
||||
if (LightAssociations[i]->Sprite() == sprite &&
|
||||
(LightAssociations[i]->Frame()==frame || LightAssociations[i]->Frame()==-1))
|
||||
{
|
||||
AttachLight(count++, LightAssociations[i]->Light());
|
||||
}
|
||||
AttachLight(count++, asso->Light());
|
||||
}
|
||||
}
|
||||
if (count == 0 && state->Light > 0)
|
||||
|
|
@ -850,6 +844,7 @@ int AttachLightDef(AActor *self, int _lightid, int _lightname)
|
|||
{
|
||||
auto userlight = self->UserLights[FindUserLight(self, lightid, true)];
|
||||
userlight->CopyFrom(*LightDefaults[lightdef]);
|
||||
self->flags8 |= MF8_RECREATELIGHTS;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -893,7 +888,7 @@ int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radiu
|
|||
{
|
||||
userlight->UnsetSpotPitch();
|
||||
}
|
||||
|
||||
self->flags8 |= MF8_RECREATELIGHTS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -930,8 +925,10 @@ int RemoveLight(AActor *self, int _lightid)
|
|||
{
|
||||
delete self->UserLights[userlight];
|
||||
self->UserLights.Delete(userlight);
|
||||
self->flags8 |= MF8_RECREATELIGHTS;
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_RemoveLight, RemoveLight)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue