mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
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:
+31
-11
@@ -207,11 +207,13 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
{
|
{
|
||||||
LIGHTEFFECT *pLight;
|
LIGHTEFFECT *pLight;
|
||||||
UINT32 cnt, cnt2;
|
UINT32 cnt, cnt2;
|
||||||
|
BOOLEAN fUpdate = FALSE;
|
||||||
BOOLEAN fDelete = FALSE;
|
BOOLEAN fDelete = FALSE;
|
||||||
|
BOOLEAN fAnyUpdate = FALSE;
|
||||||
UINT16 usNumUpdates = 1;
|
UINT16 usNumUpdates = 1;
|
||||||
|
|
||||||
// age all active tear gas clouds, deactivate those that are just dispersing
|
// 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 ];
|
pLight = &gLightEffectData[ cnt ];
|
||||||
|
|
||||||
@@ -219,19 +221,32 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
|
|
||||||
if ( pLight->fAllocated )
|
if ( pLight->fAllocated )
|
||||||
{
|
{
|
||||||
// ATE: Do this every so ofte, to acheive the effect we want...
|
usNumUpdates = 1;
|
||||||
if ( ( uiTime - pLight->uiTimeOfLastUpdate ) > 10 )
|
|
||||||
{
|
|
||||||
usNumUpdates = ( UINT16 ) ( ( uiTime - pLight->uiTimeOfLastUpdate ) / 10 );
|
|
||||||
|
|
||||||
|
// 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;
|
pLight->uiTimeOfLastUpdate = uiTime;
|
||||||
|
|
||||||
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
|
for ( cnt2 = 0; cnt2 < usNumUpdates; ++cnt2 )
|
||||||
{
|
{
|
||||||
pLight->bAge++;
|
++pLight->bAge;
|
||||||
|
|
||||||
if ( pLight->ubDuration <= 0 )
|
if ( pLight->ubDuration <= 0 )
|
||||||
fDelete = TRUE;
|
fDelete = TRUE;
|
||||||
|
|
||||||
// if this cloud remains effective (duration not reached)
|
// if this cloud remains effective (duration not reached)
|
||||||
if ( pLight->bAge < pLight->ubDuration)
|
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
|
// cloud expands by 1 every turn outdoors, and every other turn indoors
|
||||||
if ( ( pLight->bAge % 2 ) )
|
if ( ( pLight->bAge % 2 ) )
|
||||||
{
|
{
|
||||||
pLight->bRadius--;
|
--pLight->bRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pLight->bRadius == 0 )
|
if ( pLight->bRadius == 0 )
|
||||||
@@ -270,12 +285,17 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we have to update sight later on if any light was updated
|
||||||
// Handle sight here....
|
fAnyUpdate = TRUE;
|
||||||
AllTeamsLookForAll( FALSE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( fAnyUpdate )
|
||||||
|
{
|
||||||
|
// Handle sight here....
|
||||||
|
AllTeamsLookForAll( FALSE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -558,7 +558,7 @@ void DecaySmokeEffects( UINT32 uiTime )
|
|||||||
INT8 bLevel;
|
INT8 bLevel;
|
||||||
UINT16 usNumUpdates = 1;
|
UINT16 usNumUpdates = 1;
|
||||||
|
|
||||||
for ( cnt = 0; cnt < guiNumMercSlots; cnt++ )
|
for ( cnt = 0; cnt < guiNumMercSlots; ++cnt )
|
||||||
{
|
{
|
||||||
if ( MercSlots[ cnt ] )
|
if ( MercSlots[ cnt ] )
|
||||||
{
|
{
|
||||||
@@ -571,7 +571,7 @@ void DecaySmokeEffects( UINT32 uiTime )
|
|||||||
// all the deleting has to be done first///
|
// all the deleting has to be done first///
|
||||||
|
|
||||||
// age all active tear gas clouds, deactivate those that are just dispersing
|
// 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;
|
fSpreadEffect = TRUE;
|
||||||
|
|
||||||
@@ -608,7 +608,7 @@ void DecaySmokeEffects( UINT32 uiTime )
|
|||||||
{
|
{
|
||||||
pSmoke->uiTimeOfLastUpdate = uiTime;
|
pSmoke->uiTimeOfLastUpdate = uiTime;
|
||||||
|
|
||||||
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
|
for ( cnt2 = 0; cnt2 < usNumUpdates; ++cnt2 )
|
||||||
{
|
{
|
||||||
pSmoke->bAge++;
|
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 ];
|
pSmoke = &gSmokeEffectData[ cnt ];
|
||||||
|
|
||||||
if ( pSmoke->fAllocated )
|
if ( pSmoke->fAllocated )
|
||||||
{
|
{
|
||||||
if ( pSmoke->bFlags & SMOKE_EFFECT_ON_ROOF )
|
|
||||||
{
|
|
||||||
bLevel = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bLevel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this cloud remains effective (duration not reached)
|
// if this cloud remains effective (duration not reached)
|
||||||
if ( pSmoke->bFlags & SMOKE_EFFECT_MARK_FOR_UPDATE )
|
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 );
|
SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, TRUE, bLevel, cnt );
|
||||||
pSmoke->bFlags &= (~SMOKE_EFFECT_MARK_FOR_UPDATE);
|
pSmoke->bFlags &= (~SMOKE_EFFECT_MARK_FOR_UPDATE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user