mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Tweaked tunnel vision penalty calculation
- If both body items and weapon have tunnel vision penalties, use their maximum, not their sum git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8134 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+15
-16
@@ -11526,16 +11526,19 @@ INT16 GetTotalVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
UINT8 bonus = 0;
|
||||
UINT8 bonus_body = 0;
|
||||
UINT8 bonus_gun = 0;
|
||||
UINT16 usItem;
|
||||
INVTYPE *pItem;
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
// CHRISL:
|
||||
for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++)
|
||||
for (int i = BODYPOSSTART; i < BODYPOSFINAL; ++i)
|
||||
{
|
||||
// Okay, it's time for some optimization here
|
||||
if (pSoldier->inv[i].exists() == true) {
|
||||
if (pSoldier->inv[i].exists() == true)
|
||||
{
|
||||
usItem = pSoldier->inv[i].usItem;
|
||||
pItem = &(Item[usItem]);
|
||||
|
||||
@@ -11552,7 +11555,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
|
||||
if ( !IsWeapon(usItem) )
|
||||
{
|
||||
bonus = __max( bonus, pItem->percenttunnelvision );
|
||||
bonus_body = __max( bonus_body, pItem->percenttunnelvision );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11567,7 +11570,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
pItem = &(Item[usItem]);
|
||||
|
||||
if ( IsWeapon(usItem) ) //if not a weapon, then it was added already above
|
||||
bonus += Item[usItem].percenttunnelvision;
|
||||
bonus_gun += Item[usItem].percenttunnelvision;
|
||||
|
||||
if ( gGameExternalOptions.fScopeModes && pSoldier )
|
||||
{
|
||||
@@ -11576,7 +11579,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
// add boni only from non-scope items
|
||||
if(iter->exists() && !IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) )
|
||||
{
|
||||
bonus += Item[iter->usItem].percenttunnelvision;
|
||||
bonus_gun += Item[iter->usItem].percenttunnelvision;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11589,7 +11592,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
// only use scope mode if gun is in hand, otherwise an error might occur!
|
||||
if ( (&pSoldier->inv[HANDPOS]) == pObj && ObjList[pSoldier->bScopeMode] != NULL && pSoldier->bScopeMode != USE_ALT_WEAPON_HOLD )
|
||||
// now apply the bonus from the scope we use
|
||||
bonus += Item[ObjList[pSoldier->bScopeMode]->usItem].percenttunnelvision;
|
||||
bonus_gun += Item[ObjList[pSoldier->bScopeMode]->usItem].percenttunnelvision;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -11598,13 +11601,16 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
if(iter->exists() )
|
||||
{
|
||||
bonus += Item[iter->usItem].percenttunnelvision;
|
||||
bonus_gun += Item[iter->usItem].percenttunnelvision;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: it would be unreasonable to apply helmet penalties if we already look through a scope, so have those separated
|
||||
bonus = max( bonus_body, bonus_gun );
|
||||
|
||||
// SANDRO - STOMP traits - Scouting tunnel vision reduction with binoculars and similar
|
||||
if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) && pSoldier->pathing.bLevel == 0 )
|
||||
{
|
||||
@@ -11619,13 +11625,12 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HEADROCK HAM 3.2: Further increase tunnel-vision for cowering characters.
|
||||
// SANDRO - this calls many sub-functions over and over, we should at least skip this for civilians and such
|
||||
if ((gGameExternalOptions.ubCoweringReducesSightRange == 1 || gGameExternalOptions.ubCoweringReducesSightRange == 3) &&
|
||||
IS_MERC_BODY_TYPE(pSoldier) && (pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == gbPlayerNum) )
|
||||
{
|
||||
|
||||
|
||||
// Make sure character is cowering.
|
||||
if ( CoweringShockLevel(pSoldier) && gGameExternalOptions.ubMaxSuppressionShock > 0 &&
|
||||
bonus < 100 )
|
||||
@@ -11641,13 +11646,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
/*// Flugente: drugs can alter our vision
|
||||
if ( pSoldier->drugs.bDrugSideEffect[ DRUG_TYPE_TUNNELVISION ] )
|
||||
{
|
||||
bonus = __min(100, bonus + 25);
|
||||
} */
|
||||
|
||||
if ( !PTR_OURTEAM ) // Madd: adjust tunnel vision by difficulty level
|
||||
if ( !PTR_OURTEAM && gGameOptions.ubDifficultyLevel ) // Madd: adjust tunnel vision by difficulty level
|
||||
bonus /= gGameOptions.ubDifficultyLevel;
|
||||
|
||||
return __min(100, bonus);
|
||||
|
||||
+15
-17
@@ -1204,6 +1204,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
INT8 bLightLevel;
|
||||
BOOLEAN sideViewLimit = FALSE;
|
||||
SOLDIERTYPE* pSubject = SimpleFindSoldier( sSubjectGridNo, bLevel );
|
||||
INT16 tunnelVisionInPercent = 0;
|
||||
|
||||
if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER)
|
||||
{
|
||||
@@ -1271,27 +1272,19 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
||||
|
||||
// Lesh: and this
|
||||
if ( (sDistVisible == 0) && fLimitedVision )
|
||||
return(0);
|
||||
|
||||
if ( sDistVisible != STRAIGHT )
|
||||
{
|
||||
INT16 tunnelVisionInPercent = GetPercentTunnelVision(pSoldier);
|
||||
|
||||
if ( tunnelVisionInPercent > 0)
|
||||
{
|
||||
sideViewLimit = TRUE;
|
||||
sDistVisible = sDistVisible * (100 - tunnelVisionInPercent ) / 100 ;
|
||||
}
|
||||
}
|
||||
|
||||
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"sDistVisible: %d", GetPercentTunnelVision(pSoldier) );
|
||||
if ( sDistVisible == 0 && fLimitedVision )
|
||||
return 0;
|
||||
|
||||
if ( sDistVisible == ANGLE && (pSoldier->bTeam == OUR_TEAM || pSoldier->aiData.bAlertStatus >= STATUS_RED ) )
|
||||
{
|
||||
sDistVisible = STRAIGHT;
|
||||
}
|
||||
|
||||
if ( sDistVisible != STRAIGHT || ( fLimitedVision && (bFacingDir != bSubjectDir) ) )
|
||||
{
|
||||
tunnelVisionInPercent = GetPercentTunnelVision( pSoldier );
|
||||
}
|
||||
|
||||
sDistVisible *= 2;
|
||||
|
||||
if ( pSoldier->usAnimState == RUNNING )
|
||||
@@ -1302,6 +1295,13 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
sDistVisible = (INT16) (sDistVisible * ANGLE_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: we only apply tunnelvision now, after we've possibly extended the sight range, which results in finer differentiation of effects
|
||||
if ( tunnelVisionInPercent > 0 )
|
||||
{
|
||||
sideViewLimit = TRUE;
|
||||
sDistVisible = sDistVisible * (100 - tunnelVisionInPercent) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1352,8 +1352,6 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
IS_MERC_BODY_TYPE(pSoldier) && (pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == gbPlayerNum) &&
|
||||
gGameExternalOptions.ubMaxSuppressionShock > 0 && sDistVisible > 0 )
|
||||
{
|
||||
|
||||
|
||||
// Make sure character is cowering.
|
||||
if ( CoweringShockLevel(pSoldier) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user