- bug fix: Smoke grenade has the same effect as mustard gas grenade (need to run in gas cloud to reproduce)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@365 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2006-07-21 23:33:57 +00:00
parent 2948f62eb1
commit 822f29ad76
9 changed files with 141 additions and 114 deletions
+93 -70
View File
@@ -1815,10 +1815,10 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
pSoldier->bBreathCollapsed = TRUE;
pSoldier->bEndDoorOpenCode = FALSE;
if ( fInitialMove )
{
UnSetUIBusy( pSoldier->ubID );
}
if ( fInitialMove )
{
UnSetUIBusy( pSoldier->ubID );
}
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HandleGotoNewGridNo() Failed: Out of Breath") );
return( FALSE );
@@ -1930,7 +1930,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
(*pfKeepMoving ) = FALSE;
return( FALSE );
}
// OK, open!
StartInteractiveObject( sDoorGridNo, pStructure->usStructureID, pSoldier, bDirection );
InteractWithInteractiveObject( pSoldier, pStructure, bDirection );
@@ -1955,11 +1955,11 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "HandleGotoNewGridNo() Failed: Tile %d Was blocked", usNewGridNo ) );
// ATE: If our own guy and an initial move.. display message
//if ( fInitialMove && pSoldier->bTeam == gbPlayerNum )
//{
// ATE: If our own guy and an initial move.. display message
//if ( fInitialMove && pSoldier->bTeam == gbPlayerNum )
//{
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name );
//}
//}
pSoldier->bEndDoorOpenCode = FALSE;
// GO on to next guy!
@@ -1976,27 +1976,27 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
// we find something by metal detector... we should definitely stop
// but we won't place a locator or say anything
// IF not in combat, stop them all
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
{
INT32 cnt2;
SOLDIERTYPE *pSoldier2;
// IF not in combat, stop them all
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
{
INT32 cnt2;
SOLDIERTYPE *pSoldier2;
cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
// look for all mercs on the same team,
for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- )
{
if ( pSoldier2->bActive )
{
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
}
}
}
else
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
}
// look for all mercs on the same team,
for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- )
{
if ( pSoldier2->bActive )
{
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
}
}
}
else
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
}
(*pfKeepMoving) = FALSE;
@@ -2044,7 +2044,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
}
//else if ( gTacticalStatus.fEnemySightingOnTheirTurn )
//{
// Hault guy!
// Hault guy!
// AdjustNoAPToFinishMove( pSoldier, TRUE );
// (*pfKeepMoving ) = FALSE;
//}
@@ -2061,7 +2061,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & ANY_SMOKE_EFFECT && PreRandom( 5 ) == 0 )
{
EXPLOSIVETYPE * pExplosive = NULL;
INT8 bPosOfMask;
INT8 bPosOfMask;
bPosOfMask = FindGasMask (pSoldier);
//if ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK && pSoldier->inv[ HEAD1POS ].bStatus[0] >= GASMASK_MIN_STATUS )
@@ -2077,14 +2077,24 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
// bPosOfMask = NO_SLOT;
//}
// TODO: Madd: This next section is pretty lame because it can't figure out which explosive was used to actually cause a gas effect
// TODO: Madd: This next section is pretty lame because it can't figure out which explosive was used to actually cause a gas effect
// so for now, the first explosive to use a gas effect decides the health and breath damage for all of the gasses of that type
// (this was hard coded before by the developers - i guess they figured they didn't need to look for the actual explosion item,
// since they only had one of each gas item?!?)
// anyway, it means that we can only have one set of health/breath damage values for each gas type, until someone has time
// to dig into this further and actually make it find the original item that caused the gas
if ( !AM_A_ROBOT( pSoldier ) )
{
if ( !AM_A_ROBOT( pSoldier ) )
{
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_SMOKE )
{
if ( bPosOfMask == NO_SLOT )
{
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_SMOKE) ].ubClassIndex ]);
}
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_TEARGAS )
{
if ( !(pSoldier->fHitByGasFlags & HIT_BY_TEARGAS) && bPosOfMask == NO_SLOT )
@@ -2092,6 +2102,8 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_TEARGAS) ].ubClassIndex ]);
}
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_MUSTARDGAS )
{
if ( !(pSoldier->fHitByGasFlags & HIT_BY_MUSTARDGAS) && bPosOfMask == NO_SLOT )
@@ -2100,6 +2112,8 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
}
}
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_CREATUREGAS )
{
if ( !(pSoldier->fHitByGasFlags & HIT_BY_CREATUREGAS) ) // gas mask doesn't help vs creaturegas
@@ -2107,6 +2121,8 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_CREATUREGAS) ].ubClassIndex ]);
}
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
{
if ( !(pSoldier->fHitByGasFlags & HIT_BY_BURNABLEGAS) )
@@ -2114,14 +2130,21 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_BURNABLEGAS) ].ubClassIndex ]);
}
}
if ( pExplosive )
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
fDontContinue = TRUE;
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pSoldier->fHitByGasFlags: %d", pSoldier->fHitByGasFlags );
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
(INT16) (pExplosive->ubDamage + (UINT8)PreRandom( pExplosive->ubDamage ) ),
(INT16) (100 * ( pExplosive->ubStunDamage + (INT16)PreRandom( ( pExplosive->ubStunDamage / 2 ) ) ) ), NOBODY );
if ( !(gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->bLevel] & MAPELEMENT_EXT_SMOKE ))
{
if ( pExplosive )
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
fDontContinue = TRUE;
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
(INT16) (pExplosive->ubDamage + (UINT8)PreRandom( pExplosive->ubDamage ) ),
(INT16) (100 * ( pExplosive->ubStunDamage + (INT16)PreRandom( ( pExplosive->ubStunDamage / 2 ) ) ) ), NOBODY );
}
}
}
@@ -2151,7 +2174,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
}
if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) &&
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
{
// 20% chance of falling over!
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
@@ -2164,7 +2187,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
return( FALSE );
}
else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) &&
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
{
// 20% chance of falling over!
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
@@ -2177,35 +2200,35 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
return( FALSE );
}
else
// ATE; First check for profile
// Forgetful guy might forget his path
if ( (pSoldier->bTeam == gbPlayerNum) && ( pSoldier->ubProfile != NO_PROFILE ) && gMercProfiles[pSoldier->ubProfile].bPersonalityTrait == FORGETFUL )
{
if ( pSoldier->ubNumTilesMovesSinceLastForget < 255 )
// ATE; First check for profile
// Forgetful guy might forget his path
if ( (pSoldier->bTeam == gbPlayerNum) && ( pSoldier->ubProfile != NO_PROFILE ) && gMercProfiles[pSoldier->ubProfile].bPersonalityTrait == FORGETFUL )
{
pSoldier->ubNumTilesMovesSinceLastForget++;
}
if ( pSoldier->usPathIndex > 2 && (Random( 100 ) == 0) && pSoldier->ubNumTilesMovesSinceLastForget > 200 )
{
pSoldier->ubNumTilesMovesSinceLastForget = 0;
TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT );
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
if (pSoldier->bActionPoints > 0)
if ( pSoldier->ubNumTilesMovesSinceLastForget < 255 )
{
pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1);
pSoldier->ubNumTilesMovesSinceLastForget++;
}
fDontContinue = TRUE;
if ( pSoldier->usPathIndex > 2 && (Random( 100 ) == 0) && pSoldier->ubNumTilesMovesSinceLastForget > 200 )
{
pSoldier->ubNumTilesMovesSinceLastForget = 0;
UnSetUIBusy( pSoldier->ubID );
TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT );
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
if (pSoldier->bActionPoints > 0)
{
pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1);
}
fDontContinue = TRUE;
UnSetUIBusy( pSoldier->ubID );
}
}
}
}
}
if ( !fDontContinue )
{
// Don't apply the first deduction in points...
@@ -2227,14 +2250,14 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
{
pSoldier->bReverse = TRUE;
if ( pSoldier->ubBodyType == INFANT_MONSTER )
{
ChangeSoldierState( pSoldier, WALK_BACKWARDS, 1, TRUE );
}
else
{
ChangeSoldierState( pSoldier, MONSTER_WALK_BACKWARDS, 1, TRUE );
}
if ( pSoldier->ubBodyType == INFANT_MONSTER )
{
ChangeSoldierState( pSoldier, WALK_BACKWARDS, 1, TRUE );
}
else
{
ChangeSoldierState( pSoldier, MONSTER_WALK_BACKWARDS, 1, TRUE );
}
}
}
else