Fix for 1% chance to hit target when distance is > 52

Camo and other effects are taken into account when aiming at a body part
Max Distance Visible is more consistent in being calculated based on the soldier and direction rather than a fixed number

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1239 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
AalaarDB
2007-08-21 10:21:56 +00:00
parent c01ba3f6f1
commit 3f6ff281a3
31 changed files with 361 additions and 610 deletions
+50 -65
View File
@@ -1253,7 +1253,6 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam )
{
INT32 cnt;
SOLDIERTYPE *pSoldier;
INT16 sDistVisible;
INT16 sGridNo;
// If this cump is already visible, return
@@ -1275,23 +1274,17 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam )
// look for all mercs on the same team,
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++,pSoldier++ )
{
// ATE: Ok, lets check for some basic things here!
if ( pSoldier->bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector )
// ATE: Ok, lets check for some basic things here!
if ( pSoldier->bLife >= OKLIFE && pSoldier->sGridNo != NOWHERE && pSoldier->bActive && pSoldier->bInSector )
{
// and we can trace a line of sight to his x,y coordinates?
// (taking into account we are definitely aware of this guy now)
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, TRUE ) )
{
// is he close enough to see that gridno if he turns his head?
sDistVisible = DistanceVisible( pSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, pCorpse->def.bLevel, pSoldier );
if (PythSpacesAway( pSoldier->sGridNo, sGridNo ) <= sDistVisible )
{
// and we can trace a line of sight to his x,y coordinates?
// (taking into account we are definitely aware of this guy now)
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, (UINT8) sDistVisible, TRUE ) )
{
MakeCorpseVisible( pSoldier, pCorpse );
return;
}
}
MakeCorpseVisible( pSoldier, pCorpse );
return;
}
}
}
}
@@ -1299,72 +1292,64 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam )
void MercLooksForCorpses( SOLDIERTYPE *pSoldier )
{
INT32 cnt;
INT16 sDistVisible;
INT16 sGridNo;
ROTTING_CORPSE *pCorpse;
// Should we say disgust quote?
if ( ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_ROTTINGCORPSE ) )
{
return;
}
return;
}
if ( pSoldier->ubProfile == NO_PROFILE )
{
return;
}
if ( pSoldier->ubProfile == NO_PROFILE )
{
return;
}
if ( AM_AN_EPC( pSoldier ) )
{
return;
}
if ( AM_AN_EPC( pSoldier ) )
{
return;
}
if ( QuoteExp_HeadShotOnly[ pSoldier->ubProfile ] == 1 )
{
return;
}
if ( QuoteExp_HeadShotOnly[ pSoldier->ubProfile ] == 1 )
{
return;
}
// Every so often... do a corpse quote...
if ( Random( 400 ) <= 2 )
{
// Loop through all corpses....
for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ )
{
pCorpse = &(gRottingCorpse[ cnt ] );
// Every so often... do a corpse quote...
if ( Random( 400 ) <= 2 )
{
// Loop through all corpses....
for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ )
{
pCorpse = &(gRottingCorpse[ cnt ] );
if ( !pCorpse->fActivated )
{
if ( !pCorpse->fActivated )
{
continue;
}
}
// Has this corpse rotted enough?
if ( pCorpse->def.ubType == ROTTING_STAGE2 )
{
sGridNo = pCorpse->def.sGridNo;
// Has this corpse rotted enough?
if ( pCorpse->def.ubType == ROTTING_STAGE2 )
{
sGridNo = pCorpse->def.sGridNo;
// and we can trace a line of sight to his x,y coordinates?
// (taking into account we are definitely aware of this guy now)
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, TRUE ) )
{
TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT );
// is he close enough to see that gridno if he turns his head?
sDistVisible = DistanceVisible( pSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, pCorpse->def.bLevel, pSoldier );
if (PythSpacesAway( pSoldier->sGridNo, sGridNo ) <= sDistVisible )
{
// and we can trace a line of sight to his x,y coordinates?
// (taking into account we are definitely aware of this guy now)
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, (UINT8) sDistVisible, TRUE ) )
{
TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT );
pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_ROTTINGCORPSE;
pSoldier->usQuoteSaidFlags |= SOLDIER_QUOTE_SAID_ROTTINGCORPSE;
BeginMultiPurposeLocator( sGridNo, pCorpse->def.bLevel, FALSE );
BeginMultiPurposeLocator( sGridNo, pCorpse->def.bLevel, FALSE );
// Slide to...
SlideToLocation( 0, sGridNo );
// Slide to...
SlideToLocation( 0, sGridNo );
return;
}
}
}
}
return;
}
}
}
}
}