Fix: light sources did not decay in turnbased mode

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7482 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-09-02 20:11:16 +00:00
parent 3f4f8004ec
commit 650deb67a5
2 changed files with 44 additions and 24 deletions
+31 -11
View File
@@ -207,11 +207,13 @@ void DecayLightEffects( UINT32 uiTime )
{
LIGHTEFFECT *pLight;
UINT32 cnt, cnt2;
BOOLEAN fUpdate = FALSE;
BOOLEAN fDelete = FALSE;
BOOLEAN fAnyUpdate = FALSE;
UINT16 usNumUpdates = 1;
// age all active tear gas clouds, deactivate those that are just dispersing
for ( cnt = 0; cnt < guiNumLightEffects; cnt++ )
for ( cnt = 0; cnt < guiNumLightEffects; ++cnt )
{
pLight = &gLightEffectData[ cnt ];
@@ -219,19 +221,32 @@ void DecayLightEffects( UINT32 uiTime )
if ( pLight->fAllocated )
{
// ATE: Do this every so ofte, to acheive the effect we want...
if ( ( uiTime - pLight->uiTimeOfLastUpdate ) > 10 )
{
usNumUpdates = ( UINT16 ) ( ( uiTime - pLight->uiTimeOfLastUpdate ) / 10 );
usNumUpdates = 1;
// Do things differently for combat /vs realtime
// always try to update during combat
if ( gTacticalStatus.uiFlags & INCOMBAT )
{
fUpdate = TRUE;
}
// ATE: Do this every so ofte, to acheive the effect we want...
else if ( (uiTime - pLight->uiTimeOfLastUpdate) > 10 )
{
fUpdate = TRUE;
usNumUpdates = (UINT16)((uiTime - pLight->uiTimeOfLastUpdate) / 10);
}
if ( fUpdate )
{
pLight->uiTimeOfLastUpdate = uiTime;
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
for ( cnt2 = 0; cnt2 < usNumUpdates; ++cnt2 )
{
pLight->bAge++;
++pLight->bAge;
if ( pLight->ubDuration <= 0 )
fDelete = TRUE;
// if this cloud remains effective (duration not reached)
if ( pLight->bAge < pLight->ubDuration)
{
@@ -239,7 +254,7 @@ void DecayLightEffects( UINT32 uiTime )
// cloud expands by 1 every turn outdoors, and every other turn indoors
if ( ( pLight->bAge % 2 ) )
{
pLight->bRadius--;
--pLight->bRadius;
}
if ( pLight->bRadius == 0 )
@@ -270,12 +285,17 @@ void DecayLightEffects( UINT32 uiTime )
}
}
// Handle sight here....
AllTeamsLookForAll( FALSE );
// we have to update sight later on if any light was updated
fAnyUpdate = TRUE;
}
}
}
if ( fAnyUpdate )
{
// Handle sight here....
AllTeamsLookForAll( FALSE );
}
}
+13 -13
View File
@@ -558,7 +558,7 @@ void DecaySmokeEffects( UINT32 uiTime )
INT8 bLevel;
UINT16 usNumUpdates = 1;
for ( cnt = 0; cnt < guiNumMercSlots; cnt++ )
for ( cnt = 0; cnt < guiNumMercSlots; ++cnt )
{
if ( MercSlots[ cnt ] )
{
@@ -571,7 +571,7 @@ void DecaySmokeEffects( UINT32 uiTime )
// all the deleting has to be done first///
// age all active tear gas clouds, deactivate those that are just dispersing
for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ )
for ( cnt = 0; cnt < guiNumSmokeEffects; ++cnt )
{
fSpreadEffect = TRUE;
@@ -608,7 +608,7 @@ void DecaySmokeEffects( UINT32 uiTime )
{
pSmoke->uiTimeOfLastUpdate = uiTime;
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
for ( cnt2 = 0; cnt2 < usNumUpdates; ++cnt2 )
{
pSmoke->bAge++;
@@ -660,24 +660,24 @@ void DecaySmokeEffects( UINT32 uiTime )
}
}
for ( cnt = 0; cnt < guiNumSmokeEffects; cnt++ )
for ( cnt = 0; cnt < guiNumSmokeEffects; ++cnt )
{
pSmoke = &gSmokeEffectData[ cnt ];
if ( pSmoke->fAllocated )
{
if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF )
{
bLevel = 1;
}
else
{
bLevel = 0;
}
// if this cloud remains effective (duration not reached)
if ( pSmoke->bFlags & SMOKE_EFFECT_MARK_FOR_UPDATE )
{
if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF )
{
bLevel = 1;
}
else
{
bLevel = 0;
}
SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, cnt );
pSmoke->bFlags &= (~SMOKE_EFFECT_MARK_FOR_UPDATE);
}