-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
This commit is contained in:
MaddMugsy
2006-06-26 16:12:05 +00:00
parent 7b4ede034f
commit df50c0e606
4 changed files with 54 additions and 10 deletions
+7 -3
View File
@@ -3478,7 +3478,8 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
{ {
ubReason = TAKE_DAMAGE_TENTACLES; 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 ) if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL )
{ {
@@ -3535,7 +3536,9 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
} }
ubReason = TAKE_DAMAGE_HANDTOHAND; 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 ) 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 ); 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 ); SoldierGotHitExplosion( pSoldier, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation );
} }
+28 -6
View File
@@ -2797,19 +2797,28 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
if ( EXPLOSIVE_GUN( usWeaponIndex ) ) if ( EXPLOSIVE_GUN( usWeaponIndex ) )
{ {
// Reduce attacker count! // 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 ) if ( Item[usWeaponIndex].singleshotrocketlauncher )
{ {
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), C1, pTargetSoldier->bLevel ); 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 ) ); 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 ); IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pTargetSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; 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 else // tank cannon
{ {
@@ -2901,24 +2910,37 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
if (fStopped) 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 ); RemoveBullet( iBullet );
// Reduce attacker count! // Reduce attacker count!
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") );
FreeUpAttacker( ubAttackerID ); 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 ) ); 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 ) ); 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 ) ); 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; 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; return;
} }
+7
View File
@@ -413,6 +413,13 @@ void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT q
{ {
strcpy( AniParams.zCachedFile, "TILECACHE\\BULLET_TRACER.STI" ); strcpy( AniParams.zCachedFile, "TILECACHE\\BULLET_TRACER.STI" );
AniParams.uiFlags |= ANITILE_LIGHT; 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 ); CreateAnimationTile( &AniParams );
+12 -1
View File
@@ -245,7 +245,18 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16
// OK, go on! // OK, go on!
ExpParams.uiFlags = EXPLOSION_FLAG_USEABSPOS; ExpParams.uiFlags = EXPLOSION_FLAG_USEABSPOS;
ExpParams.ubOwner = ubOwner; 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.sX = sX;
ExpParams.sY = sY; ExpParams.sY = sY;
ExpParams.sZ = sZ; ExpParams.sZ = sZ;