mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Bugfix for JaggZilla Bug #637
When a throwing knife hits a window structure it won't duplicate anymore. Throwing knifes that land on a roof will be created there instead of ground level. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6536 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+19
-17
@@ -6538,27 +6538,27 @@ void MoveBullet( INT32 iBullet )
|
||||
{
|
||||
if (pStructure->fFlags & STRUCTURE_PERSON)
|
||||
{
|
||||
if(!(UsingNewCTHSystem() || pBullet->fFragment || (pBullet->usFlags & BULLET_FLAG_BUCKSHOT)) && fIntended && pBullet->sHitBy < 0 && pBullet->pFirer->ubTargetID == pStructure->usStructureID)//dnl ch60 010913 don't hit target if CTH roll decide to miss
|
||||
{
|
||||
gpLocalStructure[iStructureLoop] = NULL;
|
||||
//SendFmtMsg("shoot me, miss me, lucky me :-)");
|
||||
}
|
||||
else
|
||||
{
|
||||
// hit someone!
|
||||
fStopped = BulletHitMerc( pBullet, pStructure, fIntended );
|
||||
if (fStopped)
|
||||
if(!(UsingNewCTHSystem() || pBullet->fFragment || (pBullet->usFlags & BULLET_FLAG_BUCKSHOT)) && fIntended && pBullet->sHitBy < 0 && pBullet->pFirer->ubTargetID == pStructure->usStructureID)//dnl ch60 010913 don't hit target if CTH roll decide to miss
|
||||
{
|
||||
// remove bullet function now called from within BulletHitMerc, so just quit
|
||||
return;
|
||||
gpLocalStructure[iStructureLoop] = NULL;
|
||||
//SendFmtMsg("shoot me, miss me, lucky me :-)");
|
||||
}
|
||||
else
|
||||
{
|
||||
// set pointer to null so that we don't consider hitting this person again
|
||||
gpLocalStructure[iStructureLoop] = NULL;
|
||||
// hit someone!
|
||||
fStopped = BulletHitMerc( pBullet, pStructure, fIntended );
|
||||
if (fStopped)
|
||||
{
|
||||
// remove bullet function now called from within BulletHitMerc, so just quit
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// set pointer to null so that we don't consider hitting this person again
|
||||
gpLocalStructure[iStructureLoop] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pStructure->fFlags & STRUCTURE_WALLNWINDOW && pBullet->qCurrZ >= qWindowBottomHeight && pBullet->qCurrZ <= qWindowTopHeight)
|
||||
{
|
||||
fResolveHit = ResolveHitOnWall( pStructure, iGridNo, pBullet->bLOSIndexX, pBullet->bLOSIndexY, pBullet->ddHorizAngle );
|
||||
@@ -6573,7 +6573,9 @@ void MoveBullet( INT32 iBullet )
|
||||
iRemainingImpact = HandleBulletStructureInteraction( pBullet, pStructure, &fHitStructure );
|
||||
if ( iRemainingImpact <= 0 )
|
||||
{
|
||||
// check angle of knife and place on ground appropriately
|
||||
// silversurfer: Bugfix for JaggZilla Bug #637
|
||||
// This is now done in function BulletHitStructure(). Otherwise we would create two items.
|
||||
/* // check angle of knife and place on ground appropriately
|
||||
OBJECTTYPE Object;
|
||||
INT32 iKnifeGridNo;
|
||||
|
||||
@@ -6616,7 +6618,7 @@ void MoveBullet( INT32 iBullet )
|
||||
}
|
||||
|
||||
// Make team look for items
|
||||
NotifySoldiersToLookforItems( );
|
||||
NotifySoldiersToLookforItems( );*/
|
||||
|
||||
// bullet must end here!
|
||||
StopBullet( pBullet->iBullet );
|
||||
|
||||
+70
-2
@@ -4621,8 +4621,10 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
||||
// When it hits the ground, leave on map...
|
||||
if ( Item[ usWeaponIndex ].usItemClass == IC_THROWING_KNIFE )
|
||||
{
|
||||
// silversurfer: We better don't do this randomly. It looks strange when the knife suddenly appears at the other side of a wall
|
||||
// or other structure that it can't pass. We want the knife on that side of the structure where it hit.
|
||||
//dnl ch67 080913
|
||||
INT8 bMaxLeft, bMaxRight, bMaxUp, bMaxDown, bXOffset, bYOffset, ubSearchRange;
|
||||
/* INT8 bMaxLeft, bMaxRight, bMaxUp, bMaxDown, bXOffset, bYOffset, ubSearchRange;
|
||||
INT32 iGridNo = NOWHERE;
|
||||
for(ubSearchRange = 0; ubSearchRange < 4 && iGridNo == NOWHERE; ubSearchRange++)
|
||||
{
|
||||
@@ -4636,7 +4638,61 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
||||
break;
|
||||
iGridNo = NOWHERE;
|
||||
}
|
||||
}*/
|
||||
|
||||
// by default knife at same tile as structure
|
||||
INT32 iGridNo = sGridNo;
|
||||
|
||||
// we hit a wall structure
|
||||
if ( pStructure != NULL )
|
||||
{
|
||||
if (pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT)
|
||||
{
|
||||
if ( pBullet->qIncrX > 0)
|
||||
{
|
||||
// heading east so place knife on west, in same tile
|
||||
}
|
||||
else
|
||||
{
|
||||
// place to east of structure
|
||||
iGridNo += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pBullet->qIncrY > 0)
|
||||
{
|
||||
// heading south so place knife to north, in same tile of structure
|
||||
}
|
||||
else
|
||||
{
|
||||
iGridNo += WORLD_ROWS;
|
||||
}
|
||||
}
|
||||
}
|
||||
// something else that blocks our way
|
||||
else if ( FindStructure(iGridNo, STRUCTURE_BLOCKSMOVES) )
|
||||
{
|
||||
if ( pBullet->qIncrX > 0)
|
||||
{
|
||||
// heading east
|
||||
}
|
||||
else
|
||||
{
|
||||
// heading west, place to east of structure
|
||||
iGridNo += 1;
|
||||
}
|
||||
if (pBullet->qIncrY > 0)
|
||||
{
|
||||
// heading south
|
||||
}
|
||||
else
|
||||
{
|
||||
// heading north, place to south of structure
|
||||
iGridNo += WORLD_ROWS;
|
||||
}
|
||||
}
|
||||
|
||||
if(iGridNo != NOWHERE)
|
||||
{
|
||||
UINT16 usItem = pBullet->fromItem;
|
||||
@@ -4650,7 +4706,19 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
||||
}
|
||||
}
|
||||
CreateItem(usItem, (pBullet->ubItemStatus>1 ? pBullet->ubItemStatus-Random(2) : pBullet->ubItemStatus), &gTempObject);
|
||||
AddItemToPool(iGridNo, &gTempObject, -1, 0, 0, -1);
|
||||
|
||||
if ( pBullet->bEndCubesAboveLevelZ >= 3 )
|
||||
{
|
||||
// roof
|
||||
AddItemToPool( iGridNo, &gTempObject, -1, 1, 0, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// ground level
|
||||
AddItemToPool( iGridNo, &gTempObject, -1, 0, 0, -1 );
|
||||
}
|
||||
|
||||
// AddItemToPool(iGridNo, &gTempObject, -1, 0, 0, -1);
|
||||
NotifySoldiersToLookforItems();
|
||||
}
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user