mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Brief: //dnl ch67
- Throwing knives had tendency to magically disappear if hit some kind structure. Details: - For those who like Dimitri, throwing knives will not disappear anymore if hit some structure or flies into the sky, also using them affect their condition. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6378 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+8
-15
@@ -2364,30 +2364,23 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
|
||||
if (pBullet->usFlags & BULLET_FLAG_KNIFE)
|
||||
{
|
||||
//dnl ch67 080913
|
||||
// Place knife on guy....
|
||||
|
||||
UINT16 usItem = (Item[pBullet->fromItem].bloodieditem>0 ? Item[pBullet->fromItem].bloodieditem : pBullet->fromItem);
|
||||
UINT16 usItemStatus = (pBullet->ubItemStatus>1 ? pBullet->ubItemStatus-Random(2) : pBullet->ubItemStatus);
|
||||
// See if they have room ( and make sure it's not in hand pos?
|
||||
// CHRISL:
|
||||
bSlot = FindEmptySlotWithin( pTarget, BIGPOCKSTART, NUM_INV_SLOTS );
|
||||
if (bSlot == NO_SLOT)
|
||||
if(bSlot == NO_SLOT)
|
||||
{
|
||||
// Add item
|
||||
|
||||
CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &gTempObject );
|
||||
|
||||
AddItemToPool( pTarget->sGridNo, &gTempObject, -1 , pTarget->pathing.bLevel, 0, 0 );
|
||||
|
||||
CreateItem(usItem, usItemStatus, &gTempObject);
|
||||
AddItemToPool(pTarget->sGridNo, &gTempObject, -1, pTarget->pathing.bLevel, 0, 0);
|
||||
// Make team look for items
|
||||
NotifySoldiersToLookforItems( );
|
||||
NotifySoldiersToLookforItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Item[pBullet->fromItem].bloodieditem > 0 )
|
||||
CreateItem( Item[pBullet->fromItem].bloodieditem, (INT8) pBullet->ubItemStatus, &(pTarget->inv[bSlot]) );
|
||||
else
|
||||
CreateItem( pBullet->fromItem, (INT8) pBullet->ubItemStatus, &(pTarget->inv[bSlot]) );
|
||||
}
|
||||
|
||||
CreateItem(usItem, usItemStatus, &pTarget->inv[bSlot]);
|
||||
ubAmmoType = AMMO_KNIFE;
|
||||
}
|
||||
else if (pBullet->fFragment)
|
||||
|
||||
+61
-1
@@ -4601,6 +4601,39 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
||||
// When it hits the ground, leave on map...
|
||||
if ( Item[ usWeaponIndex ].usItemClass == IC_THROWING_KNIFE )
|
||||
{
|
||||
//dnl ch67 080913
|
||||
INT8 bMaxLeft, bMaxRight, bMaxUp, bMaxDown, bXOffset, bYOffset, ubSearchRange;
|
||||
INT32 iGridNo = NOWHERE;
|
||||
for(ubSearchRange = 0; ubSearchRange < 4 && iGridNo == NOWHERE; ubSearchRange++)
|
||||
{
|
||||
bMaxLeft = bMaxRight = ubSearchRange;// determine maximum horizontal limits
|
||||
bMaxUp = bMaxDown = ubSearchRange;// determine maximum vertical limits
|
||||
for(bYOffset = -bMaxUp; bYOffset <= bMaxDown && iGridNo == NOWHERE; bYOffset++)// evaluate every tile until find first reachable one
|
||||
for(bXOffset = -bMaxLeft; bXOffset <= bMaxRight; bXOffset++)
|
||||
{
|
||||
iGridNo = pBullet->sGridNo + bXOffset + (MAXCOL * bYOffset);// calculate the next potential gridno near this opponent
|
||||
if(!TileIsOutOfBounds(iGridNo) && !FindStructure(iGridNo, STRUCTURE_BLOCKSMOVES))
|
||||
break;
|
||||
iGridNo = NOWHERE;
|
||||
}
|
||||
}
|
||||
if(iGridNo != NOWHERE)
|
||||
{
|
||||
UINT16 usItem = pBullet->fromItem;
|
||||
if(usStructureID == INVALID_STRUCTURE_ID)
|
||||
{
|
||||
for(int i=0; i<MAXITEMS; i++)
|
||||
if(Item[i].bloodieditem == pBullet->fromItem)
|
||||
{
|
||||
usItem = Item[i].uiIndex;// clean the blood from knife, actually this should be done during repair
|
||||
break;
|
||||
}
|
||||
}
|
||||
CreateItem(usItem, (pBullet->ubItemStatus>1 ? pBullet->ubItemStatus-Random(2) : pBullet->ubItemStatus), &gTempObject);
|
||||
AddItemToPool(iGridNo, &gTempObject, -1, 0, 0, -1);
|
||||
NotifySoldiersToLookforItems();
|
||||
}
|
||||
/*
|
||||
// OK, have we hit ground?
|
||||
if ( usStructureID == INVALID_STRUCTURE_ID )
|
||||
{
|
||||
@@ -4612,7 +4645,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
||||
// Make team look for items
|
||||
NotifySoldiersToLookforItems( );
|
||||
}
|
||||
|
||||
*/
|
||||
if ( !fHitSameStructureAsBefore )
|
||||
{
|
||||
PlayJA2Sample( MISS_KNIFE, RATE_11025, uiMissVolume, 1, SoundDir( sGridNo ) );
|
||||
@@ -10019,6 +10052,33 @@ void ShotMiss( UINT8 ubAttackerID, INT32 iBullet )
|
||||
case MONSTERCLASS:
|
||||
PlayJA2Sample( SPIT_RICOCHET, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||
break;
|
||||
|
||||
case KNIFECLASS://dnl ch67 080913
|
||||
if((pBullet=GetBulletPtr(iBullet)) != NULL)
|
||||
{
|
||||
INT8 bMaxLeft, bMaxRight, bMaxUp, bMaxDown, bXOffset, bYOffset, ubSearchRange;
|
||||
INT32 iGridNo = NOWHERE;
|
||||
for(ubSearchRange = 0; ubSearchRange < 4 && iGridNo == NOWHERE; ubSearchRange++)
|
||||
{
|
||||
bMaxLeft = bMaxRight = ubSearchRange;// determine maximum horizontal limits
|
||||
bMaxUp = bMaxDown = ubSearchRange;// determine maximum vertical limits
|
||||
for(bYOffset = -bMaxUp; bYOffset <= bMaxDown && iGridNo == NOWHERE; bYOffset++)// evaluate every tile until find first reachable one
|
||||
for(bXOffset = -bMaxLeft; bXOffset <= bMaxRight; bXOffset++)
|
||||
{
|
||||
iGridNo = pBullet->sGridNo + bXOffset + (MAXCOL * bYOffset);// calculate the next potential gridno near this opponent
|
||||
if(!TileIsOutOfBounds(iGridNo) && !FindStructure(iGridNo, STRUCTURE_BLOCKSMOVES))
|
||||
break;
|
||||
iGridNo = NOWHERE;
|
||||
}
|
||||
}
|
||||
if(iGridNo != NOWHERE)
|
||||
{
|
||||
CreateItem(pBullet->fromItem, (pBullet->ubItemStatus>1 ? pBullet->ubItemStatus-Random(2) : pBullet->ubItemStatus), &gTempObject);
|
||||
AddItemToPool(iGridNo, &gTempObject, -1, 0, 0, -1);
|
||||
NotifySoldiersToLookforItems();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( fDoMissForGun )
|
||||
|
||||
Reference in New Issue
Block a user