First decay light effects and then decay smoke effects, because fire can create light.

Dynamic creation of light effects for fire and signal smoke (ADD_LIGHT_AFTER_EXPLOSION option).
Fixed/improved code to decay light effects so that ubDuration works correctly.
Note: <ubRadius> tag is not used for light effects as they cannot spread, light is always created with <ubStartRadius> and can only decay later.
Improved code to decay smoke effects.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8767 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-03-03 17:48:43 +00:00
parent a09c0a8b33
commit 5b8f91912f
5 changed files with 27 additions and 16 deletions
+9 -6
View File
@@ -212,7 +212,7 @@ void DecayLightEffects( UINT32 uiTime )
BOOLEAN fAnyUpdate = FALSE;
UINT16 usNumUpdates = 1;
// age all active tear gas clouds, deactivate those that are just dispersing
// age all active light effects, deactivate those that are just dispersing
for ( cnt = 0; cnt < guiNumLightEffects; ++cnt )
{
pLight = &gLightEffectData[ cnt ];
@@ -229,8 +229,8 @@ void DecayLightEffects( UINT32 uiTime )
{
fUpdate = TRUE;
}
// ATE: Do this every so ofte, to acheive the effect we want...
else if ( (uiTime - pLight->uiTimeOfLastUpdate) > 10 )
// ATE: Do this every so often, to achieve the effect we want...
else if ( (uiTime - pLight->uiTimeOfLastUpdate) >= 10 )
{
fUpdate = TRUE;
usNumUpdates = (UINT16)((uiTime - pLight->uiTimeOfLastUpdate) / 10);
@@ -247,14 +247,17 @@ void DecayLightEffects( UINT32 uiTime )
if ( pLight->ubDuration <= 0 )
fDelete = TRUE;
// if this cloud remains effective (duration not reached)
// if this light remains effective (duration not reached)
if ( pLight->bAge < pLight->ubDuration)
{
// calculate the new cloud radius
// cloud expands by 1 every turn outdoors, and every other turn indoors
if ( ( pLight->bAge % 2 ) )
/*if ( ( pLight->bAge % 2 ) )
{
--pLight->bRadius;
}*/
if (pLight->ubDuration - pLight->bAge < pLight->bRadius)
{
pLight->bRadius--;
}
if ( pLight->bRadius == 0 )