- New behaviour for gas grenades:

Gas grenades now don't cause direct damage on hit anymore. They will cause damage on start of turn or if you move inside a gas cloud. Of course gas mask still helps (except for creature gas and fire).
Every tile moved inside a gas cloud deals a percentage of the normal damage (default 10%). This is set in Item_Settings.ini (DAMAGE_HEALTH_MOVE_EXPLOSIVE_MODIFIER, DAMAGE_BREATH_MOVE_EXPLOSIVE_MODIFIER).
Tiles can now have multiple gas effects on them. Unfortunately this is not visualized (yet).
Smoke doesn't make a character immune to other gas types anymore.
The 25% chance of taking damage while moving through a gas cloud has been removed. Damage is now applied 100% of the time.

- New modifiers for explosive damage in Item_Settings.ini (DAMAGE_HEALTH_EXPLOSIVE_MODIFIER, DAMAGE_BREATH_EXPLOSIVE_MODIFIER). These could fully replace EXPLOSIVES_DAMAGE_MODIFIER in Ja2_Options.ini but I left that general modifier untouched for now.

- Some compiler warning fixes.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6517 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2013-10-21 07:13:15 +00:00
parent a71f8745ab
commit 3346fddf09
20 changed files with 141 additions and 78 deletions
+2 -2
View File
@@ -8309,7 +8309,7 @@ void DrawExplosiveValues( OBJECTTYPE * gpItemDescObject )
sHeight = gItemDescGenRegions[ubNumLine][1].sBottom - sTop;
// Get final damage
INT16 iFinalDamage = GetModifiedExplosiveDamage( Explosive[Item[ gpItemDescObject->usItem ].ubClassIndex ].ubDamage );
INT16 iFinalDamage = GetModifiedExplosiveDamage( Explosive[Item[ gpItemDescObject->usItem ].ubClassIndex ].ubDamage, 0 );
// Get base damage
INT16 iDamage = iFinalDamage;
@@ -8350,7 +8350,7 @@ void DrawExplosiveValues( OBJECTTYPE * gpItemDescObject )
sHeight = gItemDescGenRegions[ubNumLine][1].sBottom - sTop;
// Get final damage
INT16 iFinalStunDamage = GetModifiedExplosiveDamage( Explosive[Item[ gpItemDescObject->usItem ].ubClassIndex ].ubStunDamage);
INT16 iFinalStunDamage = GetModifiedExplosiveDamage( Explosive[Item[ gpItemDescObject->usItem ].ubClassIndex ].ubStunDamage, 1 );
// Get base damage
INT16 iStunDamage = iFinalStunDamage;
+2 -2
View File
@@ -12023,8 +12023,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
// HEADROCK HAM 3.6: Can now use negative modifier.
//UINT16 explDamage = (UINT16)( Explosive[Item[ usItem ].ubClassIndex].ubDamage + ( (double) Explosive[Item[ usItem ].ubClassIndex].ubDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier );
//UINT16 explStunDamage = (UINT16)( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage + ( (double) Explosive[Item[ usItem ].ubClassIndex].ubStunDamage / 100) * gGameExternalOptions.ubExplosivesDamageMultiplier );
UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage );
UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage );
UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 );
UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 );
#ifdef CHINESE
swprintf( pStr, ChineseSpecString5,
+23 -11
View File
@@ -5479,23 +5479,28 @@ std::vector<UINT16> GetItemSlots(OBJECTTYPE* pObj, UINT8 subObject, BOOLEAN fAtt
UINT64 uiClass = (UINT64)pow((double)2, (int)sClass);
UINT32 slotSize = tempItemSlots.size();
if(fItemSlots & uiClass){ //don't bother with this slot if it's not a valid class
for(UINT32 sCount = 1; sCount < MAXITEMS+1; sCount++){
for(UINT32 sCount = 1; sCount < MAXITEMS+1; sCount++)
{
if(AttachmentSlots[sCount].uiSlotIndex == 0)
break;
if(AttachmentSlots[sCount].nasAttachmentClass & uiClass && AttachmentSlots[sCount].nasLayoutClass & fItemLayout){ //found a slot
if(AttachmentSlots[sCount].nasAttachmentClass & uiClass && AttachmentSlots[sCount].nasLayoutClass & fItemLayout) //found a slot
{
if(magSize > 0 && AttachmentSlots[sCount].fMultiShot)
magSize--;
else if(AttachmentSlots[sCount].fMultiShot)
continue;
if(Item[pObj->usItem].usItemClass == IC_LBEGEAR && AttachmentSlots[sCount].ubPocketMapping > 0){
if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketsAvailable & (UINT16)pow((double)2, AttachmentSlots[sCount].ubPocketMapping - 1)){
tempItemSlots.push_back(AttachmentSlots[sCount].uiSlotIndex);
}
}else{
if(Item[pObj->usItem].usItemClass == IC_LBEGEAR && AttachmentSlots[sCount].ubPocketMapping > 0)
{
if(LoadBearingEquipment[Item[pObj->usItem].ubClassIndex].lbePocketsAvailable & (UINT16)pow((double)2, AttachmentSlots[sCount].ubPocketMapping - 1))
{
tempItemSlots.push_back(AttachmentSlots[sCount].uiSlotIndex);
}
}
else
{
tempItemSlots.push_back(AttachmentSlots[sCount].uiSlotIndex);
}
}
}
}
if(slotSize == tempItemSlots.size()){ //we didn't find a layout specific slot so try to find a default layout slot
@@ -13840,14 +13845,21 @@ INT8 FindBackpackOnSoldier( SOLDIERTYPE * pSoldier )
}
// HEADROCK HAM 3.6: This applies the INI modifier to explosives
UINT8 GetModifiedExplosiveDamage( UINT16 sDamage )
UINT8 GetModifiedExplosiveDamage( UINT16 sDamage, UINT8 ubType )
{
if (sDamage == 0)
{
return(0);
}
sDamage = (INT16)(( sDamage * gGameExternalOptions.iExplosivesDamageModifier ) / 100);
// apply ini modifiers by type
if ( ubType == 0 ) // type 0 is health damage
sDamage = (FLOAT)(( sDamage * gGameExternalOptions.iExplosivesDamageModifier * gItemSettings.fDamageHealthModifierExplosive ) / 100);
else if ( ubType == 1 ) // type 1 is breath damage
sDamage = (FLOAT)(( sDamage * gGameExternalOptions.iExplosivesDamageModifier * gItemSettings.fDamageBreathModifierExplosive ) / 100);
else
return(0); // undefined type
sDamage = __max(1, sDamage);
sDamage = __min(255, sDamage);
+1 -1
View File
@@ -441,7 +441,7 @@ INT16 GetSnowCamoBonus( OBJECTTYPE * pObj );
INT8 FindBackpackOnSoldier( SOLDIERTYPE * pSoldier );
// HEADROCK HAM 3.6: Handler functions to get modified damage with INI parameter.
UINT8 GetModifiedExplosiveDamage( UINT16 ubDamage );
UINT8 GetModifiedExplosiveDamage( UINT16 ubDamage, UINT8 ubType );
UINT8 GetModifiedMeleeDamage( UINT16 ubDamage );
UINT8 GetModifiedGunDamage( UINT16 ubDamage );
+27 -16
View File
@@ -2264,13 +2264,17 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
{
BOOLEAN fDontContinue = FALSE;
if ( pSoldier->pathing.usPathIndex > 0 )
{
// silversurfer: Moved this further down. We will now check for gas at the starting point.
// Otherwise the soldier might just run out of the gas and take no damage when next tile has no gas.
// This change was necessary because we don't apply gas damage directly anymore when a gas grenade is tossed.
// if ( pSoldier->pathing.usPathIndex > 0 )
// {
// check for running into gas
// note: this will have to use the minimum types of structures for tear/creature gas
// since there isn't a way to retrieve the smoke effect structure
if ( (gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & ANY_SMOKE_EFFECT && PreRandom( 4 ) == 0 ) || gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
// silversurfer: removed the randomness. Character is running through a gas cloud so make him suffer without a gas mask!
if ( (gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & ANY_SMOKE_EFFECT /* && PreRandom( 4 ) == 0*/ ) || gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
{
EXPLOSIVETYPE * pExplosive = NULL;
INT8 bPosOfMask;
@@ -2287,12 +2291,15 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
// 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
//
// silversurfer: Changed the way the HitByGasFlags are handled. The old way allowed to run through a gas cloud and be immune to gas
// as long as you have been affected once. This is now handled by function DishOutGasDamage() that is used below.
if ( !AM_A_ROBOT( pSoldier ) )
{
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE )
{
if ( bPosOfMask == NO_SLOT && !(pSoldier->flags.fHitByGasFlags & HIT_BY_SMOKEGAS) )//dnl ch40 200909
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_SMOKEGAS) )//dnl ch40 200909
{
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_SMOKE) ].ubClassIndex ]);
}
@@ -2301,7 +2308,7 @@ 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->pathing.bLevel] & MAPELEMENT_EXT_TEARGAS )
{
if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS) && bPosOfMask == NO_SLOT )
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS) )
{
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_TEARGAS) ].ubClassIndex ]);
}
@@ -2310,7 +2317,7 @@ 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->pathing.bLevel] & MAPELEMENT_EXT_MUSTARDGAS )
{
if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS) && bPosOfMask == NO_SLOT )
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS) )
{
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_MUSTGAS) ].ubClassIndex ]);
}
@@ -2319,39 +2326,43 @@ 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->pathing.bLevel] & MAPELEMENT_EXT_CREATUREGAS )
{
if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS) ) // gas mask doesn't help vs creaturegas
//if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_CREATUREGAS) ) // gas mask doesn't help vs creaturegas
{
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_CREATUREGAS) ].ubClassIndex ]);
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->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
{
if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_BURNABLEGAS) )
//if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_BURNABLEGAS) ) // gas mask doesn't help vs fire damage
{
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_BURNABLEGAS) ].ubClassIndex ]);
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_BURNABLEGAS) ].ubClassIndex ]);
}
}
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pSoldier->flags.fHitByGasFlags: %d", pSoldier->flags.fHitByGasFlags );
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
if ( !(gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE ))
// silversurfer: Why this? Smoke on a tile makes us immune to other damage types? I don't think so...
//if ( !(gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE ))
{
if ( pExplosive )
{
pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection );
fDontContinue = TRUE;
// silversurfer: Don't stop the merc anymore. Let him run and suffer!
//pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection );
//fDontContinue = TRUE;
INT16 iGasHealthDamage = GetModifiedExplosiveDamage( pExplosive->ubDamage, 0 ) + (INT16)PreRandom( GetModifiedExplosiveDamage( pExplosive->ubDamage, 0 ));
INT16 iGasBreathDamage = ( 100 * ( GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) + (INT16)PreRandom( ( GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) / 2 ) ) ) );
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
(INT16) (pExplosive->ubDamage + (UINT8)PreRandom( pExplosive->ubDamage ) ),
(INT16) (100 * ( pExplosive->ubStunDamage + (INT16)PreRandom( ( pExplosive->ubStunDamage / 2 ) ) ) ), NOBODY );
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE, iGasHealthDamage, iGasBreathDamage, NOBODY );
}
}
}
}
if ( pSoldier->pathing.usPathIndex > 0 )
{
if ( !fDontContinue )
{
+1 -1
View File
@@ -7201,7 +7201,7 @@ void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection )
if ( gpCurrentTalkingFace != NULL )
return;
UINT8 ubSourceMerc = gusSelectedSoldier;
UINT8 ubSourceMerc = (UINT8)gusSelectedSoldier;
UINT8 ubTargetMerc;
UINT8 ubGroupID = pSoldier->ubGroupID;
INT8 bOldPosition = GetTeamSlotFromPlayerID ( MercPtrs[ ubSourceMerc ]->ubID );
+1 -1
View File
@@ -6111,7 +6111,7 @@ else
}
}
// Make sure cap is within limits
uiCap = __max(uiCap, __max(0,(UINT32)iChance));
uiCap = __max(uiCap, __max(0, iChance));
uiCap = __min(uiCap, gGameExternalOptions.ubMaximumCTH);
// Now figure out the distance between the Base CTH and the CTH Cap. This is the distance we'll potentially