mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
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:
@@ -182,9 +182,8 @@ void HandleTacticalEndTurn( )
|
|||||||
|
|
||||||
DecayBombTimers( );
|
DecayBombTimers( );
|
||||||
|
|
||||||
DecaySmokeEffects( uiTime );
|
|
||||||
|
|
||||||
DecayLightEffects( uiTime );
|
DecayLightEffects( uiTime );
|
||||||
|
DecaySmokeEffects( uiTime );
|
||||||
|
|
||||||
// Decay smells
|
// Decay smells
|
||||||
//DecaySmells();
|
//DecaySmells();
|
||||||
|
|||||||
@@ -460,8 +460,8 @@ void EndTurnEvents( void )
|
|||||||
// decay bomb timers and maybe set some off!
|
// decay bomb timers and maybe set some off!
|
||||||
DecayBombTimers();
|
DecayBombTimers();
|
||||||
|
|
||||||
DecaySmokeEffects( GetWorldTotalSeconds( ) );
|
|
||||||
DecayLightEffects( GetWorldTotalSeconds( ) );
|
DecayLightEffects( GetWorldTotalSeconds( ) );
|
||||||
|
DecaySmokeEffects( GetWorldTotalSeconds( ) );
|
||||||
|
|
||||||
SOLDIERTYPE* pSoldier = NULL;
|
SOLDIERTYPE* pSoldier = NULL;
|
||||||
UINT32 cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
UINT32 cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||||
|
|||||||
@@ -415,15 +415,15 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sevenfm: add light for fire and signal effects
|
// sevenfm: add light for fire and signal effects
|
||||||
if (gGameExternalOptions.bAddLightAfterExplosion &&
|
/*if (gGameExternalOptions.bAddLightAfterExplosion &&
|
||||||
((gubEnvLightValue >= NORMAL_LIGHTLEVEL_NIGHT - 3) || gbWorldSectorZ) &&
|
((gubEnvLightValue >= NORMAL_LIGHTLEVEL_NIGHT - 3) || gbWorldSectorZ) &&
|
||||||
(Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE) &&
|
(Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE) &&
|
||||||
bLevel == 0 &&
|
bLevel == 0 &&
|
||||||
!Water(sGridNo, bLevel))
|
!Water(sGridNo, bLevel))
|
||||||
{
|
{
|
||||||
// add light
|
// add light
|
||||||
NewLightEffect(sGridNo, (UINT8)Explosive[Item[usItem].ubClassIndex].ubDuration + 2, (UINT8)Explosive[Item[usItem].ubClassIndex].ubRadius + 1);
|
NewLightEffect(sGridNo, (UINT8)Explosive[Item[usItem].ubClassIndex].ubDuration + Explosive[Item[usItem].ubClassIndex].ubRadius - Explosive[Item[usItem].ubClassIndex].ubStartRadius, (UINT8)Explosive[Item[usItem].ubClassIndex].ubRadius + 1);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2980,6 +2980,17 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
|||||||
fSmokeEffect = TRUE;
|
fSmokeEffect = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sevenfm: create light effect for fire and signal smoke
|
||||||
|
if (gGameExternalOptions.bAddLightAfterExplosion &&
|
||||||
|
fSubsequent != ERASE_SPREAD_EFFECT &&
|
||||||
|
((gubEnvLightValue >= NORMAL_LIGHTLEVEL_NIGHT - 3) || gbWorldSectorZ) &&
|
||||||
|
(Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE) &&
|
||||||
|
bLevel == 0 &&
|
||||||
|
!Water(sGridNo, bLevel))
|
||||||
|
{
|
||||||
|
NewLightEffect(sGridNo, 1, ubRadius);
|
||||||
|
}
|
||||||
/*if(is_networked)
|
/*if(is_networked)
|
||||||
{
|
{
|
||||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"explosives not coded in MP");
|
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"explosives not coded in MP");
|
||||||
@@ -3000,7 +3011,6 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
|||||||
fRecompileMovement = TRUE;
|
fRecompileMovement = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (ubDir = NORTH; ubDir <= NORTHWEST; ubDir++ )
|
for (ubDir = NORTH; ubDir <= NORTHWEST; ubDir++ )
|
||||||
{
|
{
|
||||||
uiTempSpot = sGridNo;
|
uiTempSpot = sGridNo;
|
||||||
@@ -3176,7 +3186,6 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
|||||||
if ( fSubsequent != BLOOD_SPREAD_EFFECT )
|
if ( fSubsequent != BLOOD_SPREAD_EFFECT )
|
||||||
{
|
{
|
||||||
MakeNoise( NOBODY, sGridNo, bLevel, gpWorldLevelData[sGridNo].ubTerrainID, (UINT8)Explosive[ Item [ usItem ].ubClassIndex ].ubVolume, NOISE_EXPLOSION );
|
MakeNoise( NOBODY, sGridNo, bLevel, gpWorldLevelData[sGridNo].ubTerrainID, (UINT8)Explosive[ Item [ usItem ].ubClassIndex ].ubVolume, NOISE_EXPLOSION );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gfMPDebugOutputRandoms = false;
|
gfMPDebugOutputRandoms = false;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
BOOLEAN fAnyUpdate = 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 light effects, deactivate those that are just dispersing
|
||||||
for ( cnt = 0; cnt < guiNumLightEffects; ++cnt )
|
for ( cnt = 0; cnt < guiNumLightEffects; ++cnt )
|
||||||
{
|
{
|
||||||
pLight = &gLightEffectData[ cnt ];
|
pLight = &gLightEffectData[ cnt ];
|
||||||
@@ -229,8 +229,8 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
{
|
{
|
||||||
fUpdate = TRUE;
|
fUpdate = TRUE;
|
||||||
}
|
}
|
||||||
// ATE: Do this every so ofte, to acheive the effect we want...
|
// ATE: Do this every so often, to achieve the effect we want...
|
||||||
else if ( (uiTime - pLight->uiTimeOfLastUpdate) > 10 )
|
else if ( (uiTime - pLight->uiTimeOfLastUpdate) >= 10 )
|
||||||
{
|
{
|
||||||
fUpdate = TRUE;
|
fUpdate = TRUE;
|
||||||
usNumUpdates = (UINT16)((uiTime - pLight->uiTimeOfLastUpdate) / 10);
|
usNumUpdates = (UINT16)((uiTime - pLight->uiTimeOfLastUpdate) / 10);
|
||||||
@@ -247,14 +247,17 @@ void DecayLightEffects( UINT32 uiTime )
|
|||||||
if ( pLight->ubDuration <= 0 )
|
if ( pLight->ubDuration <= 0 )
|
||||||
fDelete = TRUE;
|
fDelete = TRUE;
|
||||||
|
|
||||||
// if this cloud remains effective (duration not reached)
|
// if this light remains effective (duration not reached)
|
||||||
if ( pLight->bAge < pLight->ubDuration)
|
if ( pLight->bAge < pLight->ubDuration)
|
||||||
{
|
{
|
||||||
// calculate the new cloud radius
|
// 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;
|
--pLight->bRadius;
|
||||||
|
}*/
|
||||||
|
if (pLight->ubDuration - pLight->bAge < pLight->bRadius)
|
||||||
|
{
|
||||||
|
pLight->bRadius--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pLight->bRadius == 0 )
|
if ( pLight->bRadius == 0 )
|
||||||
|
|||||||
@@ -763,7 +763,7 @@ void DecaySmokeEffects( UINT32 uiTime )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ATE: Do this every so ofte, to acheive the effect we want...
|
// ATE: Do this every so ofte, to acheive the effect we want...
|
||||||
if ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) > 10 )
|
if ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) >= 10 )
|
||||||
{
|
{
|
||||||
fUpdate = TRUE;
|
fUpdate = TRUE;
|
||||||
usNumUpdates = ( UINT16 ) ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) / 10 );
|
usNumUpdates = ( UINT16 ) ( ( uiTime - pSmoke->uiTimeOfLastUpdate ) / 10 );
|
||||||
|
|||||||
Reference in New Issue
Block a user