WARNING: I haven't tested these changes yet, since I'm still at work :p I'll be testing them and making updates as needed tonight.

- updated breaklight effect to use the radius and duration values from Explosives.xml
- updated tracer bullet lighting effect (will probably require more tweaking)
- updated AI - when trapped in gas in Insane the AI goes nuts instead of getting scared.  AI in all levels is more likely to use autofire over burst/single fire when in gas (panicking).


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@190 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2006-06-08 00:14:23 +00:00
parent ea7e68297c
commit 21bc685f8d
7 changed files with 69 additions and 80 deletions
+1 -1
View File
@@ -2917,7 +2917,7 @@ void HandleExplosionQueue( void )
}
else if ( pObj->usBombItem == TRIP_FLARE )
{
NewLightEffect( sGridNo, LIGHT_FLARE_MARK_1 );
NewLightEffect( sGridNo, Explosive[pObj->usItem].ubDuration, Explosive[pObj->usItem].ubStartRadius );
RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel );
}
else
+36 -48
View File
@@ -96,12 +96,10 @@ void UpdateLightingSprite( LIGHTEFFECT *pLight )
}
INT32 NewLightEffect( INT16 sGridNo, INT8 bType )
INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius )
{
LIGHTEFFECT *pLight;
INT32 iLightIndex;
UINT8 ubDuration=0;
UINT8 ubStartRadius=0;
if( ( iLightIndex = GetFreeLightEffect() )==(-1) )
return(-1);
@@ -112,20 +110,9 @@ INT32 NewLightEffect( INT16 sGridNo, INT8 bType )
// Set some values...
pLight->sGridNo = sGridNo;
pLight->bType = bType;
pLight->iLight = -1;
pLight->uiTimeOfLastUpdate = GetWorldTotalSeconds( );
switch( bType )
{
case LIGHT_FLARE_MARK_1:
ubDuration = 6;
ubStartRadius = 6;
break;
}
pLight->ubDuration = ubDuration;
pLight->bRadius = ubStartRadius;
pLight->bAge = 0;
@@ -139,7 +126,7 @@ INT32 NewLightEffect( INT16 sGridNo, INT8 bType )
//Play the breaklight sound
// PlayJA2Sample( BREAK_LIGHT_IGNITING, RATE_11025, SoundVolume( LOWVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
// MAdd: for some reason this crashes the game!
return( iLightIndex );
return( pLight->iLight );
}
@@ -192,41 +179,41 @@ void DecayLightEffects( UINT32 uiTime )
// ATE: Do this every so ofte, to acheive the effect we want...
if ( ( uiTime - pLight->uiTimeOfLastUpdate ) > 350 )
{
usNumUpdates = ( UINT16 ) ( ( uiTime - pLight->uiTimeOfLastUpdate ) / 350 );
usNumUpdates = ( UINT16 ) ( ( uiTime - pLight->uiTimeOfLastUpdate ) / 350 );
pLight->uiTimeOfLastUpdate = uiTime;
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
{
pLight->bAge++;
for ( cnt2 = 0; cnt2 < usNumUpdates; cnt2++ )
{
pLight->bAge++;
// if this cloud 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 ) )
{
pLight->bRadius--;
}
// if this cloud 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 ) )
{
pLight->bRadius--;
}
if ( pLight->bRadius == 0 )
{
// Delete...
fDelete = TRUE;
break;
}
else
{
UpdateLightingSprite( pLight );
}
}
else
{
fDelete = TRUE;
break;
}
}
if ( pLight->bRadius == 0 )
{
// Delete...
fDelete = TRUE;
break;
}
else
{
UpdateLightingSprite( pLight );
}
}
else
{
fDelete = TRUE;
break;
}
}
if ( fDelete )
{
@@ -238,10 +225,11 @@ void DecayLightEffects( UINT32 uiTime )
}
}
// Handle sight here....
AllTeamsLookForAll( FALSE );
// Handle sight here....
AllTeamsLookForAll( FALSE );
}
}
}
}
}
+3 -3
View File
@@ -2,13 +2,14 @@
#define __LIGHT_EFFECTS
/*
// Light effect types
enum
{
NO_LIGHT_EFFECT,
LIGHT_FLARE_MARK_1,
};
*/
typedef struct
{
@@ -18,7 +19,6 @@ typedef struct
UINT8 bRadius; // the current radius
INT8 bAge; // the number of turns light has been around
BOOLEAN fAllocated;
INT8 bType;
INT32 iLight;
UINT32 uiTimeOfLastUpdate;
@@ -35,7 +35,7 @@ void AddLightEffectToTile( INT8 bType, INT16 sGridNo );
void RemoveLightEffectFromTile( INT16 sGridNo );
INT32 NewLightEffect( INT16 sGridNo, INT8 bType );
INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius );
BOOLEAN SaveLightEffectsToSaveGameFile( HWFILE hFile );
+6 -19
View File
@@ -138,20 +138,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
if ( uiFlags & ANITILE_LIGHT )
{
if ( ubAmbientLightLevel >= MIN_AMB_LEVEL_FOR_MERC_LIGHTS )
{
if( ( pNewAniNode->lightSprite=LightSpriteCreate("L-R03.LHT", 0 ) )!=(-1))
{
LightSpritePower(pNewAniNode->lightSprite, TRUE);
{
INT16 sXPos, sYPos;
ConvertGridNoToCenterCellXY( sGridNo, &sXPos, &sYPos );
LightSpritePosition( pNewAniNode->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
}
}
}
pNewAniNode->lightSprite = NewLightEffect(sGridNo, 1, 0);
}
if ( ( uiFlags & ANITILE_CACHEDTILE ) )
@@ -381,7 +368,7 @@ void DeleteAniTile( ANITILE *pAniTile )
break;
}
if ( pAniNode->uiFlags & ANITILE_LIGHT && ubAmbientLightLevel >= MIN_AMB_LEVEL_FOR_MERC_LIGHTS )
if ( pAniNode->uiFlags & ANITILE_LIGHT && pAniNode->lightSprite != NULL )
{
LightSpriteDestroy(pAniNode->lightSprite);
}
@@ -614,10 +601,10 @@ void UpdateAniTiles( )
}
else
{
//if ( pNode->uiFlags & ANITILE_LIGHT )
//{
// LightSpriteDestroy(pNode->lightSprite);
//}
if ( pNode->uiFlags & ANITILE_LIGHT && pNode->lightSprite != NULL )
{
LightSpriteDestroy(pNode->lightSprite);
}
// Delete from world!
DeleteAniTile( pNode );
+2 -2
View File
@@ -2495,7 +2495,6 @@ DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2337"));
}
else
{
fDoImpact = TRUE;
fDoImpact = TRUE;
}
@@ -2507,7 +2506,8 @@ DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2403"));
if( pObject->Position.z > 0 )
{
//we cannot create the light source above the ground, or on a roof. The system doesnt support it.
//we cannot create the light source above the ground, or on a roof. The system doesnt support it.
AddItemToPool( pObject->sGridNo, &( pObject->Obj ), 1, 1, 0, -1 );
}
else
{
// Add a light effect...