From df50c0e606c7d269d793e7d65deef6830197f656 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Mon, 26 Jun 2006 16:12:05 +0000 Subject: [PATCH] -added explosive ammo code from Callahan -disabled tracer light effects on rooftops, since lights don't work on roofs yet git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@303 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 10 +++++++--- Tactical/Weapons.cpp | 34 ++++++++++++++++++++++++++------ Tactical/bullets.cpp | 7 +++++++ TileEngine/Explosion Control.cpp | 13 +++++++++++- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 020798f1..3d0b89d0 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -3478,7 +3478,8 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa { ubReason = TAKE_DAMAGE_TENTACLES; } - else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) ) + // marke take out gunfire if ammotype is an explosive + else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize <= 1) { if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL ) { @@ -3535,7 +3536,9 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa } ubReason = TAKE_DAMAGE_HANDTOHAND; } - else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV ) + // marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1 + // extracting attackerīs ammo type + else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize > 1) { if ( usWeaponIndex == STRUCTURE_EXPLOSION ) { @@ -3843,7 +3846,8 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa { SoldierGotHitBlade( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } - if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || Item[ usWeaponIndex ].usItemClass & IC_TENTACLES ) + // marke setting ammo explosions included here with 3rd 'or' including ubReason + if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || Item[ usWeaponIndex ].usItemClass & IC_TENTACLES || ubReason == TAKE_DAMAGE_EXPLOSION ) { SoldierGotHitExplosion( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); } diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 33c4ce25..d6b3fb4f 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -2797,19 +2797,28 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s if ( EXPLOSIVE_GUN( usWeaponIndex ) ) { // Reduce attacker count! - if ( Item[usWeaponIndex].rocketlauncher ) + // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType + // 2cond 'or' added + if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1 ) { if ( Item[usWeaponIndex].singleshotrocketlauncher ) { IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), C1, pTargetSoldier->bLevel ); } - else + // changed rpg type to work only with two flags matching + else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) ); IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pTargetSoldier->bLevel ); pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; } + else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1) + { + // re-routed the Highexplosive value to define exposion type + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , pTargetSoldier->bLevel ); + // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; + } } else // tank cannon { @@ -2901,24 +2910,37 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT if (fStopped) { - if ( Item[usWeaponIndex].rocketlauncher ) + // marke need another attacker id assignment + SOLDIERTYPE *pSoldier; + + // Get attacker + pSoldier = MercPtrs[ ubAttackerID ]; + // marke added one 'or' to get this working with HE ammo + if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1) { RemoveBullet( iBullet ); // Reduce attacker count! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); FreeUpAttacker( ubAttackerID ); - if ( Item[usWeaponIndex].rocketlauncher ) + if ( Item[usWeaponIndex].singleshotrocketlauncher ) { IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, C1, (INT8)( sZPos >= WALL_HEIGHT ) ); } - else + // changed too to use 2 flag to determine + else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS].usGunAmmoItem ) ); - IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) ); pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem = NONE; } + else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1) + { + // re-routed the Highexplosive value to define exposion type + IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) ); + // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; + } + return; } diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index 12b78b2a..e418517d 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -413,6 +413,13 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q { strcpy( AniParams.zCachedFile, "TILECACHE\\BULLET_TRACER.STI" ); AniParams.uiFlags |= ANITILE_LIGHT; + if ( pBullet->pFirer->bLevel > 0 ) // if firer on roof then + { + if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area + { + AniParams.uiFlags &= ~ANITILE_LIGHT; + } + } } CreateAnimationTile( &AniParams ); diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index fa114918..24031c3d 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -245,7 +245,18 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 // OK, go on! ExpParams.uiFlags = EXPLOSION_FLAG_USEABSPOS; ExpParams.ubOwner = ubOwner; - ExpParams.ubTypeID = Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; + //ExpParams.ubTypeID = Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; + // marke had to hardcode animation caused by lack of ability to load anim out of gun ammo-explosives from here + if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) ) + { + ExpParams.ubTypeID = 2; + // return; + } + else + { + ExpParams.ubTypeID = Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; + } + ExpParams.sX = sX; ExpParams.sY = sY; ExpParams.sZ = sZ;