From d2a4d53a0af87a40701c0a54d1f98d62cf3868fe Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 27 Jan 2017 22:35:31 +0000 Subject: [PATCH] AmmoTypes.xml: tag replaced with (unsigned integer). If value is > 0, a bullet can pierce a person after hitting. Higher values increase the chance to do so. Vehicles can now be pierced as well. Requires GameDir >= r2360. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8378 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/LOS.cpp | 9 ++++++--- Tactical/Weapons.h | 2 +- Tactical/XML_AmmoTypes.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 9dcb41b5..ed6024a8 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -3112,9 +3112,10 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend } SWeaponHit.ubSpecial = ubSpecial; + // Flugente: we already accounted in the impact calculation whether this is a vehicle or not. Vehicles can be pierced just as well. // now check to see if the bullet goes THROUGH this person! (not vehicles) // HEADROCK HAM 5: Attacking weapon already defined above. - if ( !(pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE) && (AmmoTypes[ubAmmoType].canGoThrough) && !EXPLOSIVE_GUN( usAttackingWeapon ) ) + if ( AmmoTypes[ubAmmoType].usPiercePersonChanceModifier > 0 && !EXPLOSIVE_GUN( usAttackingWeapon ) ) { // if we do more damage than expected, then the bullet will be more likely // to be lodged in the body @@ -3130,7 +3131,9 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend { iImpact = iDamage; } - uiChanceThrough = (UINT8) __max( 0, ( iImpact - 20 ) ); + + // Flugente: a separate modifier for chance to go through + uiChanceThrough = (UINT32)__max( 0, (iImpact - 20) + AmmoTypes[ubAmmoType].usPiercePersonChanceModifier ); if (PreRandom( 100 ) < uiChanceThrough ) { // bullet MAY go through @@ -3460,7 +3463,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop ); iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[ubAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[ubAmmoType].structureImpactReductionDivisor)); - + //switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ][0]->data.gun.ubGunAmmoType) //{ // case AMMO_HP: diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 21524af8..6059f4e4 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -230,7 +230,7 @@ typedef struct // minimum damage can be zero BOOLEAN zeroMinimumDamage; - BOOLEAN canGoThrough; + UINT16 usPiercePersonChanceModifier; BOOLEAN standardIssue; UINT8 numberOfBullets; INT32 multipleBulletDamageMultiplier; diff --git a/Tactical/XML_AmmoTypes.cpp b/Tactical/XML_AmmoTypes.cpp index b0249f68..df7f0f3a 100644 --- a/Tactical/XML_AmmoTypes.cpp +++ b/Tactical/XML_AmmoTypes.cpp @@ -64,7 +64,7 @@ ammotypeStartElementHandle(void *userData, const XML_Char *name, const XML_Char strcmp(name, "beforeArmourDamageDivisor") == 0 || strcmp(name, "multipleBulletDamageDivisor") == 0 || strcmp(name, "zeroMinimumDamage") == 0 || - strcmp(name, "canGoThrough") == 0 || + strcmp(name, "usPiercePersonChanceModifier") == 0 || strcmp(name, "standardIssue") == 0 || strcmp(name, "numberOfBullets") == 0 || //zilpin: pellet spread patterns externalized in XML @@ -218,10 +218,10 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curAmmoType.zeroMinimumDamage = (BOOLEAN) atol(pData->szCharData); } - else if(strcmp(name, "canGoThrough") == 0) + else if(strcmp(name, "usPiercePersonChanceModifier") == 0) { pData->curElement = ELEMENT; - pData->curAmmoType.canGoThrough = (BOOLEAN) atol(pData->szCharData); + pData->curAmmoType.usPiercePersonChanceModifier = (UINT16)atol( pData->szCharData ); } else if(strcmp(name, "standardIssue") == 0) { @@ -448,7 +448,7 @@ BOOLEAN WriteAmmoTypeStats() FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageMultiplier ); FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].afterArmourDamageDivisor ); FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].zeroMinimumDamage ); - FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].canGoThrough ); + FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].usPiercePersonChanceModifier ); FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].standardIssue ); FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].numberOfBullets ); FilePrintf(hFile,"\t\t%d\r\n", AmmoTypes[cnt].multipleBulletDamageMultiplier );