mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- properly track whether some action in the current frame may have triggered a dynamic light activation.
This commit is contained in:
parent
da806b354d
commit
6c12a8de12
6 changed files with 30 additions and 4 deletions
|
@ -260,6 +260,7 @@ enum ELevelFlags : unsigned int
|
|||
LEVEL3_NOSHADOWMAP = 0x00010000, // disables shadowmaps for a given level.
|
||||
LEVEL3_AVOIDMELEE = 0x00020000, // global flag needed for proper MBF support.
|
||||
LEVEL3_NOJUMPDOWN = 0x00040000, // only for MBF21. Inverse of MBF's dog_jumping flag.
|
||||
LEVEL3_LIGHTCREATED = 0x00080000, // a light had been created in the last frame
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -598,6 +598,9 @@ void P_SetupLevel(FLevelLocals *Level, int position, bool newGame)
|
|||
|
||||
auto it = Level->GetThinkerIterator<AActor>();
|
||||
AActor* ac;
|
||||
|
||||
Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
|
||||
// Initial setup of the dynamic lights.
|
||||
while ((ac = it.Next()))
|
||||
{
|
||||
|
|
|
@ -850,6 +850,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;
|
||||
self->Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -894,6 +895,7 @@ int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radiu
|
|||
userlight->UnsetSpotPitch();
|
||||
}
|
||||
self->flags8 |= MF8_RECREATELIGHTS;
|
||||
self->Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -931,6 +933,7 @@ int RemoveLight(AActor *self, int _lightid)
|
|||
delete self->UserLights[userlight];
|
||||
self->UserLights.Delete(userlight);
|
||||
self->flags8 |= MF8_RECREATELIGHTS;
|
||||
self->Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -144,8 +144,9 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
|||
}
|
||||
} while (count != 0);
|
||||
|
||||
if (Level->HasDynamicLights)
|
||||
if (Level->lights || (Level->flags3 & LEVEL3_LIGHTCREATED))
|
||||
{
|
||||
Level->flags3 &= ~LEVEL3_LIGHTCREATED;
|
||||
recreateLights();
|
||||
for (auto light = Level->lights; light;)
|
||||
{
|
||||
|
@ -174,8 +175,9 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
|||
}
|
||||
} while (count != 0);
|
||||
|
||||
if (Level->lights && Level->HasDynamicLights)
|
||||
if (Level->lights || (Level->flags3 & LEVEL3_LIGHTCREATED))
|
||||
{
|
||||
Level->flags3 &= ~LEVEL3_LIGHTCREATED;
|
||||
recreateLights();
|
||||
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
|
||||
auto &prof = Profiles[NAME_InternalDynamicLight];
|
||||
|
|
|
@ -584,7 +584,11 @@ bool AActor::SetState (FState *newstate, bool nofunction)
|
|||
newstate = newstate->GetNextState();
|
||||
} while (tics == 0);
|
||||
|
||||
flags8 |= MF8_RECREATELIGHTS;
|
||||
if (GetInfo()->LightAssociations.Size())
|
||||
{
|
||||
flags8 |= MF8_RECREATELIGHTS;
|
||||
Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4799,7 +4803,11 @@ void AActor::PostBeginPlay ()
|
|||
{
|
||||
PrevAngles = Angles;
|
||||
flags7 |= MF7_HANDLENODELAY;
|
||||
flags8 |= MF8_RECREATELIGHTS;
|
||||
if (GetInfo()->LightAssociations.Size())
|
||||
{
|
||||
flags8 |= MF8_RECREATELIGHTS;
|
||||
Level->flags3 |= LEVEL3_LIGHTCREATED;
|
||||
}
|
||||
}
|
||||
|
||||
void AActor::CallPostBeginPlay()
|
||||
|
|
|
@ -1333,6 +1333,15 @@ enum ELevelFlags
|
|||
LEVEL3_HIDEAUTHORNAME = 0x00000100,
|
||||
LEVEL3_PROPERMONSTERFALLINGDAMAGE = 0x00000200, // Properly apply falling damage to the monsters
|
||||
LEVEL3_SKYBOXAO = 0x00000400, // Apply SSAO to sector skies
|
||||
LEVEL3_E1M8SPECIAL = 0x00000800,
|
||||
LEVEL3_E2M8SPECIAL = 0x00001000,
|
||||
LEVEL3_E3M8SPECIAL = 0x00002000,
|
||||
LEVEL3_E4M8SPECIAL = 0x00004000,
|
||||
LEVEL3_E4M6SPECIAL = 0x00008000,
|
||||
LEVEL3_NOSHADOWMAP = 0x00010000, // disables shadowmaps for a given level.
|
||||
LEVEL3_AVOIDMELEE = 0x00020000, // global flag needed for proper MBF support.
|
||||
LEVEL3_NOJUMPDOWN = 0x00040000, // only for MBF21. Inverse of MBF's dog_jumping flag.
|
||||
LEVEL3_LIGHTCREATED = 0x00080000, // a light had been created in the last frame
|
||||
};
|
||||
|
||||
// [RH] Compatibility flags.
|
||||
|
|
Loading…
Reference in a new issue