Armour and its attachements can now alter the fire damage received by setting a value in the <sFireResistance>-tag. This is affected by item status.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8664 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2019-02-10 20:42:39 +00:00
parent 0f558da7e4
commit de8bf8a7d6
14 changed files with 94 additions and 3 deletions
+20
View File
@@ -2345,6 +2345,18 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
cnt++;
}
//////////////////// FIRE RESISTANCE
if ( Item[gpItemDescObject->usItem].sFireResistance )
{
CHAR16 pStr2[256];
swprintf( pStr2, szUDBGenSecondaryStatsExplanationsTooltipText[45], Item[gpItemDescObject->usItem].sFireResistance );
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[45], pStr2 );
SetRegionFastHelpText( &( gUDBFasthelpRegions[iFirstDataRegion + cnt] ), pStr );
MSYS_EnableRegion( &gUDBFasthelpRegions[iFirstDataRegion + cnt] );
cnt++;
}
}
if (Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO)
@@ -6004,6 +6016,14 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject )
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 5, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
cnt++;
}
////////////////// FIRE RESISTANCE
if ( ( Item[gpItemDescObject->usItem].sFireResistance && !fComparisonMode ) ||
( fComparisonMode && Item[gpComparedItemDescObject->usItem].sFireResistance ) )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 43, gItemDescGenSecondaryRegions[cnt].sLeft + sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
++cnt;
}
}
if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_AMMO))
+2
View File
@@ -1195,6 +1195,8 @@ typedef struct
UINT16 usRiotShieldStrength; // strength of shield
UINT16 usRiotShieldGraphic; // graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti)
// Flugente: fire resistance
INT16 sFireResistance;
} INVTYPE;
+37
View File
@@ -1255,6 +1255,43 @@ INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier )
return( (INT8) (iHelmet + iVest + iLeg + iVestPack) );
}
// Flugente: fire resistance
INT16 FireEffectiveArmour( OBJECTTYPE * pObj )
{
if ( pObj == NULL || Item[pObj->usItem].usItemClass != IC_ARMOUR )
{
return( 0 );
}
INT32 iValue = Item[pObj->usItem].sFireResistance * ( *pObj )[0]->data.objectStatus / 100;
for ( attachmentList::iterator iter = ( *pObj )[0]->attachments.begin(); iter != ( *pObj )[0]->attachments.end(); ++iter )
{
if ( Item[iter->usItem].usItemClass == IC_ARMOUR && ( *iter )[0]->data.objectStatus > 0 && iter->exists() )
{
iValue += Item[iter->usItem].sFireResistance * ( *iter )[0]->data.objectStatus / 100;
}
}
return iValue;
}
INT16 ArmourVersusFirePercent( SOLDIERTYPE * pSoldier )
{
INT16 val = 0;
for ( int i = BODYPOSSTART; i < BODYPOSFINAL; ++i )
{
if ( pSoldier->inv[i].exists() == true )
{
val += FireEffectiveArmour( &( pSoldier->inv[i] ) );
}
}
// resistance can't be higher than 100%. No, we don't allow healing by fire (yet?) ;-)
return min(100, val);
}
void AdjustImpactByHitLocation( INT32 iImpact, UINT8 ubHitLocation, INT32 * piNewImpact, INT32 * piImpactForCrits )
{
switch( ubHitLocation )
+2
View File
@@ -457,6 +457,8 @@ extern bool gbForceWeaponReady;
extern INT32 EffectiveArmour( OBJECTTYPE * pObj );
extern INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier );
// Flugente: fire resistance
INT16 ArmourVersusFirePercent( SOLDIERTYPE * pSoldier );
extern BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo );
extern void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange , UINT8 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation );
extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped );
+9
View File
@@ -2138,6 +2138,15 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
}
}
// Flugente: check for fire resistance
if ( pExplosive->ubType == EXPLOSV_BURNABLEGAS )
{
INT16 fireresistance = ArmourVersusFirePercent( pSoldier );
sWoundAmt = max( 0, sWoundAmt * ( 100 - fireresistance ) / 100 );
sBreathAmt = max( 0, sBreathAmt * ( 100 - fireresistance ) / 100 );
}
// a gas effect, take damage directly...
pSoldier->SoldierTakeDamage( ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE );
+8 -1
View File
@@ -296,7 +296,8 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
strcmp(name, "usRiotShieldStrength" ) == 0 ||
strcmp(name, "usRiotShieldGraphic" ) == 0 ||
strcmp(name, "bloodbag" ) == 0 ||
strcmp(name, "emptybloodbag" ) == 0))
strcmp(name, "emptybloodbag" ) == 0 ||
strcmp(name, "sFireResistance" ) == 0))
{
pData->curElement = ELEMENT_PROPERTY;
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
@@ -1533,6 +1534,11 @@ itemEndElementHandle(void *userData, const XML_Char *name)
if ( (BOOLEAN)atol( pData->szCharData ) )
pData->curItem.usItemFlag |= EMPTY_BLOOD_BAG;
}
else if ( strcmp( name, "sFireResistance" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curItem.sFireResistance = min( 100, (INT16)atol( pData->szCharData ) );
}
--pData->maxReadDepth;
}
@@ -2173,6 +2179,7 @@ BOOLEAN WriteItemStats()
FilePrintf(hFile,"\t\t<usRiotShieldStrength>%d</usRiotShieldStrength>\r\n", Item[cnt].usRiotShieldStrength );
FilePrintf(hFile,"\t\t<usRiotShieldGraphic>%d</usRiotShieldGraphic>\r\n", Item[cnt].usRiotShieldGraphic );
FilePrintf(hFile,"\t\t<sFireResistance>%d</sFireResistance>\r\n", Item[cnt].sFireResistance );
FilePrintf(hFile,"\t</ITEM>\r\n");
}
+2
View File
@@ -8455,6 +8455,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|掩|埋|工|具|", //L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8504,6 +8505,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \n这个物品能让你更有效地掩埋尸体。", //L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8471,6 +8471,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8520,6 +8521,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2 -2
View File
@@ -8455,6 +8455,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g",
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8504,8 +8505,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.",
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8458,6 +8458,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8507,6 +8508,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8287,6 +8287,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|B|l|u|t|b|e|u|t|e|l |(|l|e|e|r|)",
L"|B|l|u|t|b|e|u|t|e|l", // 44
L"|W|i|d|e|r|s|t|a|n|d|s|f|ä|h|i|g|k|e|i|t |g|e|g|e|n |F|e|u|e|r",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8336,6 +8337,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8461,6 +8461,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8510,6 +8511,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8473,6 +8473,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8522,6 +8523,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=
+2
View File
@@ -8455,6 +8455,7 @@ STR16 szUDBGenSecondaryStatsTooltipText[]=
L"|B|u|r|i|a|l |M|o|d|i|f|i|e|r",
L"|E|m|p|t|y |B|l|o|o|d |B|a|g", // TODO.Translate
L"|B|l|o|o|d |B|a|g", // 44
L"|R|e|s|i|s|t|a|n|t |t|o |F|i|r|e",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
@@ -8504,6 +8505,7 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
L"\n \nThis item makes you more effective at burying corpses.",
L"\n \nA paramedic can extract blood\nfrom a donor with this.", // TODO.Translate
L"\n \nA paramedic can use up this item to increase\nthe amount of health regenerated by surgery.", // 44
L"\n \nThis armor lowers fire damage by %i%%.",
};
STR16 szUDBAdvStatsTooltipText[]=