mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Fixed bug where wrong chance to hit was displayed by completing AXP's previous bugfix.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1280 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+1
-1
@@ -611,7 +611,7 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate )
|
||||
#ifndef _DEBUG
|
||||
//load up some info from the 'mainmenu.edt' file. This makes sure the file is present. The file is
|
||||
// 'marked' with a code that identifies the testers
|
||||
iStartLoc = MAINMENU_RECORD_SIZE * cnt;
|
||||
INT32 iStartLoc = MAINMENU_RECORD_SIZE * cnt;
|
||||
if( !LoadEncryptedDataFromFile(MAINMENU_TEXT_FILE, zText, iStartLoc, MAINMENU_RECORD_SIZE ) )
|
||||
{
|
||||
//the file was not able to be loaded properly
|
||||
|
||||
@@ -458,7 +458,7 @@ INT8 CalcCoverForGridNoBasedOnTeamKnownEnemies( SOLDIERTYPE *pSoldier, INT16 sTa
|
||||
}
|
||||
|
||||
// if actual LOS check fails, then chance to hit is 0, ignore this guy
|
||||
if( SoldierToVirtualSoldierLineOfSightTest( pOpponent, sTargetGridNo, pSoldier->bLevel, bStance, TRUE ) == 0 )
|
||||
if( SoldierToVirtualSoldierLineOfSightTest( pOpponent, sTargetGridNo, pSoldier->bLevel, bStance, TRUE, CALC_FROM_WANTED_DIR ) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -954,7 +954,7 @@ INT8 CalcIfSoldierCanSeeGridNo( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOL
|
||||
}
|
||||
|
||||
// Lesh: changed 2-nd parameter in DistanceVisible function call
|
||||
usSightLimit = DistanceVisible( pSoldier, (SoldierHasLimitedVision(pSoldier) ? pSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sTargetGridNo, fRoof );
|
||||
usSightLimit = pSoldier->GetMaxDistanceVisible(sTargetGridNo, fRoof, CALC_FROM_WANTED_DIR);
|
||||
|
||||
|
||||
//
|
||||
|
||||
+10
-10
@@ -183,13 +183,13 @@ void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLev
|
||||
{
|
||||
if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) )
|
||||
{
|
||||
if ( QuoteExp_WitnessDeidrannaDeath[ pTeamSoldier->ubProfile ] )
|
||||
if ( QuoteExp_WitnessDeidrannaDeath[ pTeamSoldier->ubProfile ] )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE ) )
|
||||
{
|
||||
TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_DEIDRANNA );
|
||||
}
|
||||
TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_DEIDRANNA );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -472,13 +472,13 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLe
|
||||
{
|
||||
if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) )
|
||||
{
|
||||
if ( QuoteExp_WitnessQueenBugDeath[ pTeamSoldier->ubProfile ] )
|
||||
if ( QuoteExp_WitnessQueenBugDeath[ pTeamSoldier->ubProfile ] )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE ) )
|
||||
{
|
||||
TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_QUEEN );
|
||||
}
|
||||
TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_QUEEN );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5028,7 +5028,7 @@ void TestPotentialOwner( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE )
|
||||
{
|
||||
if ( SoldierToSoldierLineOfSightTest( pSoldier, gpTempSoldier, TRUE ) )
|
||||
if ( SoldierToSoldierLineOfSightTest( pSoldier, gpTempSoldier, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
MakeNPCGrumpyForMinorOffense( pSoldier, gpTempSoldier );
|
||||
}
|
||||
|
||||
@@ -4808,7 +4808,7 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent )
|
||||
|
||||
if ( fValidTalkableGuy )
|
||||
{
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, sTargetGridNo, pSoldier->bLevel, 3, TRUE ) )
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, sTargetGridNo, pSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
//. ATE: Make range far, so we alternate cursors...
|
||||
guiNewUICursor = TALK_OUT_RANGE_A_UICURSOR;
|
||||
@@ -5595,7 +5595,7 @@ BOOLEAN HandleTalkInit( )
|
||||
if ( !(( pTSoldier->bTeam == MILITIA_TEAM ) && ( CheckIfRadioIsEquipped() )) ) //lal
|
||||
{
|
||||
// Check LOS!
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->bLevel, 3, TRUE ) )
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, pTSoldier->sGridNo, pTSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
if ( pTSoldier->ubProfile != NO_PROFILE )
|
||||
{
|
||||
@@ -6279,7 +6279,7 @@ BOOLEAN ValidQuickExchangePosition( )
|
||||
{
|
||||
if ( PythSpacesAway( pSoldier->sGridNo, pOverSoldier->sGridNo ) == 1 )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pOverSoldier->sGridNo, pOverSoldier->bLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pOverSoldier->sGridNo, pOverSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// ATE:
|
||||
// Check that the path is good!
|
||||
|
||||
@@ -5100,7 +5100,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos )
|
||||
}
|
||||
|
||||
// Check LOS....
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, gpItemPointerSoldier->sGridNo, gpItemPointerSoldier->bLevel, 3, TRUE ) )
|
||||
if ( !SoldierTo3DLocationLineOfSightTest( pSoldier, gpItemPointerSoldier->sGridNo, gpItemPointerSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ void CheckForDisabledForGiveItem( )
|
||||
sDist = PythSpacesAway( gpSMCurrentMerc->sGridNo, pSoldier->sGridNo );
|
||||
|
||||
// Check LOS....
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
if ( sDist <= PASSING_ITEM_DISTANCE_NOTOKLIFE )
|
||||
{
|
||||
@@ -598,7 +598,7 @@ void CheckForDisabledForGiveItem( )
|
||||
sDist = PythSpacesAway( MercPtrs[ ubSrcSoldier ]->sGridNo, sDestGridNo );
|
||||
|
||||
// Check LOS....
|
||||
if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubSrcSoldier ], sDestGridNo, bDestLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubSrcSoldier ], sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// UNCONSCIOUS GUYS ONLY 1 tile AWAY
|
||||
if ( MercPtrs[ gusSMCurrentMerc ]->bLife < CONSCIOUSNESS )
|
||||
|
||||
+25
-13
@@ -6557,6 +6557,8 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
||||
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);
|
||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// Okay, it's time for some optimization here too
|
||||
@@ -6570,7 +6572,7 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true) )
|
||||
{
|
||||
bns += BonusReduceMore( pItem->visionrangebonus, pObj->ItemData.Generic.bStatus[0] );
|
||||
}
|
||||
@@ -6578,7 +6580,7 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
//AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
if ( WeaponReady(pSoldier) || gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6612,6 +6614,8 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
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);
|
||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6625,7 +6629,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
{
|
||||
bns += BonusReduceMore(
|
||||
NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ),
|
||||
@@ -6634,7 +6638,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6656,6 +6660,8 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
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);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6670,7 +6676,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
{
|
||||
bns += BonusReduceMore(
|
||||
NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ),
|
||||
@@ -6679,7 +6685,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6703,6 +6709,8 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
|
||||
// Snap: Scale the bonus with the light level
|
||||
|
||||
//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);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6717,7 +6725,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
{
|
||||
bns += BonusReduceMore( idiv( pItem->dayvisionrangebonus
|
||||
* (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ),
|
||||
@@ -6726,7 +6734,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6750,6 +6758,8 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
|
||||
// Snap: Scale the bonus with the light level
|
||||
|
||||
//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);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6764,7 +6774,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
{
|
||||
bns += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus
|
||||
* (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ),
|
||||
@@ -6773,7 +6783,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6840,8 +6850,9 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
OBJECTTYPE *pInv = &(pSoldier->inv[HANDPOS]);
|
||||
usItem = pInv->usItem;
|
||||
@@ -6866,6 +6877,7 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
if ( (i == HANDPOS || i == SECONDHANDPOS) &&
|
||||
@@ -6874,7 +6886,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && WeaponReady(pSoldier) ) )
|
||||
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) )
|
||||
{
|
||||
if (Item[pSoldier->inv[i].usItem].thermaloptics)
|
||||
return TRUE;
|
||||
@@ -6882,7 +6894,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( WeaponReady(pSoldier) )
|
||||
if ( usingGunScope == true )
|
||||
{
|
||||
for (int i=0; i < MAX_ATTACHMENTS; i++)
|
||||
{
|
||||
|
||||
+4
-4
@@ -1320,7 +1320,7 @@ BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue )
|
||||
{
|
||||
// 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, 0, 0, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// Update status...
|
||||
if ( fUpdateValue )
|
||||
@@ -1336,7 +1336,7 @@ BOOLEAN AllMercsLookForDoor( INT16 sGridNo, BOOLEAN fUpdateValue )
|
||||
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
|
||||
// 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, usNewGridNo, 0, 0, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, usNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// Update status...
|
||||
if ( fUpdateValue )
|
||||
@@ -1376,7 +1376,7 @@ BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue )
|
||||
sGridNo = pDoorStatus->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, 0, 0, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// OK, here... update perceived value....
|
||||
if ( fUpdateValue )
|
||||
@@ -1395,7 +1395,7 @@ BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue )
|
||||
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
|
||||
// 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, usNewGridNo, 0, 0, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, usNewGridNo, 0, 0, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// Update status...
|
||||
if ( fUpdateValue )
|
||||
|
||||
+17
-16
@@ -1759,11 +1759,11 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE
|
||||
ubTreeReduction = gubTreeSightReduction[ gAnimControl[pEndSoldier->usAnimState].ubEndHeight ];
|
||||
}
|
||||
|
||||
if (iTileSightLimit == -1) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel );
|
||||
if (iTileSightLimit == CALC_FROM_ALL_DIRS || iTileSightLimit == CALC_FROM_WANTED_DIR) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel, iTileSightLimit );
|
||||
}
|
||||
else if (iTileSightLimit == 255) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel );
|
||||
else if (iTileSightLimit == NO_DISTANCE_LIMIT) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( pEndSoldier->sGridNo, pEndSoldier->bLevel, CALC_FROM_ALL_DIRS );
|
||||
}
|
||||
|
||||
return( LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) CenterX( pEndSoldier->sGridNo ), (FLOAT) CenterY( pEndSoldier->sGridNo ), dEndZPos, iTileSightLimit, ubTreeReduction, bAware, bEffectiveCamo + bEffectiveStealth, fSmell, NULL ) );
|
||||
@@ -1789,9 +1789,10 @@ INT16 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT16 sEndGridNo
|
||||
sXPos = sXPos * CELL_X_SIZE + (CELL_X_SIZE / 2);
|
||||
sYPos = sYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2);
|
||||
|
||||
// We don't want to consider distance limits here so pass in tile sight limit of 255
|
||||
//ADB changed from 255 to 511 to handle new LOS test
|
||||
// We don't want to consider distance limits here so pass in tile sight limit of 255( + 256)
|
||||
// and consider trees as little as possible
|
||||
iRet = LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, 255, 0, TRUE, 0, FALSE, &sWindowGridNo );
|
||||
iRet = LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, 511, 0, TRUE, 0, FALSE, &sWindowGridNo );
|
||||
|
||||
return( sWindowGridNo );
|
||||
}
|
||||
@@ -1832,11 +1833,11 @@ INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16 sGr
|
||||
sXPos = sXPos * CELL_X_SIZE + (CELL_X_SIZE / 2);
|
||||
sYPos = sYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2);
|
||||
|
||||
if (iTileSightLimit == -1) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel );
|
||||
if (iTileSightLimit == CALC_FROM_ALL_DIRS || iTileSightLimit == CALC_FROM_WANTED_DIR) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel, iTileSightLimit );
|
||||
}
|
||||
else if (iTileSightLimit == 255) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel );
|
||||
else if (iTileSightLimit == NO_DISTANCE_LIMIT) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel, CALC_FROM_ALL_DIRS );
|
||||
}
|
||||
|
||||
return( LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, iTileSightLimit, gubTreeSightReduction[ANIM_STAND], bAware, 0, HasThermalOptics( pStartSoldier), NULL ) );
|
||||
@@ -1879,11 +1880,11 @@ INT32 SoldierToVirtualSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16
|
||||
sXPos = sXPos * CELL_X_SIZE + (CELL_X_SIZE / 2);
|
||||
sYPos = sYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2);
|
||||
|
||||
if (iTileSightLimit == -1) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel );
|
||||
if (iTileSightLimit == CALC_FROM_ALL_DIRS || iTileSightLimit == CALC_FROM_WANTED_DIR) {
|
||||
iTileSightLimit = pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel, iTileSightLimit );
|
||||
}
|
||||
else if (iTileSightLimit == 255) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel );
|
||||
else if (iTileSightLimit == NO_DISTANCE_LIMIT) {
|
||||
iTileSightLimit = 255 + pStartSoldier->GetMaxDistanceVisible( sGridNo, bLevel, CALC_FROM_ALL_DIRS );
|
||||
}
|
||||
|
||||
return( LineOfSightTest( (FLOAT) CenterX( pStartSoldier->sGridNo ), (FLOAT) CenterY( pStartSoldier->sGridNo ), dStartZPos, (FLOAT) sXPos, (FLOAT) sYPos, dEndZPos, iTileSightLimit, gubTreeSightReduction[ANIM_STAND], bAware, 0, HasThermalOptics( pStartSoldier), NULL ) );
|
||||
@@ -1918,10 +1919,10 @@ INT32 LocationToLocationLineOfSightTest( INT16 sStartGridNo, INT8 bStartLevel, I
|
||||
sEndXPos = sEndXPos * CELL_X_SIZE + (CELL_X_SIZE / 2);
|
||||
sEndYPos = sEndYPos * CELL_Y_SIZE + (CELL_Y_SIZE / 2);
|
||||
|
||||
if (iTileSightLimit == -1) {
|
||||
if (iTileSightLimit == CALC_FROM_ALL_DIRS || iTileSightLimit == CALC_FROM_WANTED_DIR) {
|
||||
iTileSightLimit = MaxNormalDistanceVisible();
|
||||
}
|
||||
else if (iTileSightLimit == 255) {
|
||||
else if (iTileSightLimit == NO_DISTANCE_LIMIT) {
|
||||
iTileSightLimit = 255 + MaxNormalDistanceVisible();
|
||||
}
|
||||
return( LineOfSightTest( (FLOAT)sStartXPos, (FLOAT)sStartYPos, dStartZPos, (FLOAT) sEndXPos, (FLOAT) sEndYPos, dEndZPos, iTileSightLimit, gubTreeSightReduction[ANIM_STAND], bAware, 0, FALSE, NULL ) );
|
||||
|
||||
+8
-4
@@ -61,16 +61,20 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel
|
||||
INT8 ChanceToGetThrough( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ );
|
||||
INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usHandItem, INT16 sHitBy, BOOLEAN fBuckshot, BOOLEAN fFake );
|
||||
|
||||
INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, INT8 bAware, int iTileSightLimit = -1, UINT8 ubAimLocation = LOS_POS );
|
||||
INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bCubeLevel, INT8 bAware, int ubSightLimit = -1 );
|
||||
INT32 SoldierToVirtualSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bStance, INT8 bAware, int iTileSightLimit = -1 );
|
||||
#define CALC_FROM_ALL_DIRS -1
|
||||
#define CALC_FROM_WANTED_DIR -2
|
||||
#define NO_DISTANCE_LIMIT -3
|
||||
|
||||
INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, INT8 bAware, int iTileSightLimit = CALC_FROM_ALL_DIRS, UINT8 ubAimLocation = LOS_POS );
|
||||
INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bCubeLevel, INT8 bAware, int ubSightLimit = CALC_FROM_ALL_DIRS );
|
||||
INT32 SoldierToVirtualSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bStance, INT8 bAware, int iTileSightLimit = CALC_FROM_ALL_DIRS );
|
||||
UINT8 SoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier );
|
||||
UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, UINT8 ubAimLocation );
|
||||
UINT8 AISoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier );
|
||||
UINT8 AISoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bCubeLevel );
|
||||
UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT16 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT8 ubTargetID );
|
||||
INT16 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT16 sEndGridNo );
|
||||
INT32 LocationToLocationLineOfSightTest( INT16 sStartGridNo, INT8 bStartLevel, INT16 sEndGridNo, INT8 bEndLevel, INT8 bAware, int iTileSightLimit = -1 );
|
||||
INT32 LocationToLocationLineOfSightTest( INT16 sStartGridNo, INT8 bStartLevel, INT16 sEndGridNo, INT8 bEndLevel, INT8 bAware, int iTileSightLimit = CALC_FROM_ALL_DIRS );
|
||||
|
||||
BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * pdZPos );
|
||||
|
||||
|
||||
@@ -1016,7 +1016,7 @@ void HandleShadingOfLinesForMilitiaControlMenu( void )
|
||||
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||
{
|
||||
// Check LOS!
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->bLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
UnShadeStringInBox( ghMilitiaControlBox, MILCON_MENU_ATTACK );
|
||||
UnShadeStringInBox( ghMilitiaControlBox, MILCON_MENU_HOLD );
|
||||
|
||||
@@ -1279,7 +1279,7 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam )
|
||||
{
|
||||
// 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 ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
MakeCorpseVisible( pSoldier, pCorpse );
|
||||
return;
|
||||
@@ -1335,7 +1335,7 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier )
|
||||
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 ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
TacticalCharacterDialogue( pSoldier, QUOTE_HEADSHOT );
|
||||
|
||||
|
||||
@@ -7092,7 +7092,7 @@ BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier )
|
||||
sDestGridNo = pShopkeeper->sGridNo;
|
||||
bDestLevel = pShopkeeper->bLevel;
|
||||
// If he has LOS...
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sDestGridNo, bDestLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
// Get range to shopkeeper
|
||||
uiRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sDestGridNo );
|
||||
|
||||
@@ -2958,14 +2958,14 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo,
|
||||
|
||||
// TO LOS check to killed
|
||||
// Can we see location of killer?
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, pKillerSoldier->sGridNo, pKillerSoldier->bLevel, (UINT8)3, TRUE ) == 0 )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, pKillerSoldier->sGridNo, pKillerSoldier->bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Can we see location of killed?
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, (UINT8)3, TRUE ) == 0 )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -3023,7 +3023,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier
|
||||
gfLastMercTalkedAboutKillingID = pKilledSoldier->ubID;
|
||||
|
||||
// Can we see location?
|
||||
fCanWeSeeLocation = ( SoldierTo3DLocationLineOfSightTest( pKillerSoldier, sGridNo, bLevel, (UINT8)3, TRUE ) != 0 );
|
||||
fCanWeSeeLocation = ( SoldierTo3DLocationLineOfSightTest( pKillerSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) != 0 );
|
||||
|
||||
|
||||
// Are we killing mike?
|
||||
@@ -3084,7 +3084,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier
|
||||
if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) )
|
||||
{
|
||||
// Can we see location?
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) )
|
||||
{
|
||||
ubMercsInSector[ ubNumMercs ] = (UINT8)cnt;
|
||||
ubNumMercs++;
|
||||
|
||||
@@ -3322,7 +3322,7 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
||||
// if we SEE this particular oppponent, and he DOESN'T see us... and he COULD see us...
|
||||
if ( (pSoldier->bOppList[ cnt ] == SEEN_CURRENTLY) &&
|
||||
pEnemy->bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY &&
|
||||
PythSpacesAway( pSoldier->sGridNo, pEnemy->sGridNo ) < DistanceVisible( pEnemy, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, pSoldier->sGridNo, pSoldier->bLevel ) )
|
||||
PythSpacesAway( pSoldier->sGridNo, pEnemy->sGridNo ) < pEnemy->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel ) )
|
||||
{
|
||||
// AGILITY (5): Soldier snuck 1 square past unaware enemy
|
||||
StatChange( pSoldier, AGILAMT, 5, FALSE );
|
||||
|
||||
@@ -427,7 +427,7 @@ public:
|
||||
void CopyOldInventoryToNew();
|
||||
void CopyNewInventoryToOld();
|
||||
|
||||
INT16 GetMaxDistanceVisible(INT16 sGridNo = -1, INT8 bLevel = -1);
|
||||
INT16 GetMaxDistanceVisible(INT16 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1);
|
||||
|
||||
// Note: Place all non-POD items at the end (after endOfPOD)
|
||||
// The format of this structure affects what is written into and read from various
|
||||
|
||||
+18
-3
@@ -3649,11 +3649,21 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
|
||||
iChance -= iPenalty;
|
||||
}
|
||||
|
||||
//ADB we need to calculate the distance visible and SoldierTo...LOSTests that we want to
|
||||
//calculate it when firing, so the scope can be accounted for when the weapon is raised
|
||||
//I consider this a hack to change the global, but passing a var alllll the way down to GetVisionBonus was worse
|
||||
//if anyone wants to change it go for it, I don't know what usAnimState should be set
|
||||
|
||||
//store old flag
|
||||
UINT32 oldFlag = gAnimControl[ pSoldier->usAnimState ].uiFlags;
|
||||
//add the necessary bits to the flag
|
||||
gAnimControl[ pSoldier->usAnimState ].uiFlags |= (ANIM_FIREREADY | ANIM_FIRE);
|
||||
|
||||
// 0verhaul: Changed to take expanded range from shooting at different levels into account
|
||||
//ADB this change does nothing - either way it is random - we don't know what level we are shooting to, which is
|
||||
//what the last parameter is, and the soldier's current level is as good a guess as ground level.
|
||||
//so if you really want to fix this, pass in a value
|
||||
sDistVis = DistanceVisible( pSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, pSoldier->bTargetLevel );
|
||||
sDistVis = pSoldier->GetMaxDistanceVisible(sGridNo, pSoldier->bTargetLevel, CALC_FROM_ALL_DIRS );
|
||||
|
||||
// CJC August 13 2002: Wow, this has been wrong the whole time. bTargetCubeLevel seems to be generally set to 2 -
|
||||
// but if a character is shooting at an enemy in a particular spot, then we should be using the target position on the body.
|
||||
@@ -3668,15 +3678,20 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
|
||||
// best to use team knowledge as well, in case of spotting for someone else
|
||||
// 0verhaul: Why not use the distance visible as the max for line of sight testing?
|
||||
//ADB because A) the bullet can travel farther than I can see and B) I might have a spotter
|
||||
|
||||
//We are firing a gun, and so the gun will be pointed and the scope will be used, even if it isn't now, so don't forget that we are in a firing animation
|
||||
if (ubTargetID != NOBODY && pSoldier->bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY)
|
||||
{
|
||||
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, 255, pSoldier->bAimShotLocation );
|
||||
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation );
|
||||
}
|
||||
if (iSightRange == -1) // didn't do a bodypart-based test
|
||||
{
|
||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, 255 );
|
||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT );
|
||||
}
|
||||
|
||||
//restore old flag
|
||||
gAnimControl[ pSoldier->usAnimState ].uiFlags = oldFlag;
|
||||
|
||||
if ( iSightRange > (sDistVis * CELL_X_SIZE) )
|
||||
{
|
||||
// shooting beyond max normal vision... penalize such distance at double (also later we halve the remaining chance)
|
||||
|
||||
+18
-13
@@ -1082,7 +1082,7 @@ INT16 MaxNormalDistanceVisible( void )
|
||||
return( STRAIGHT * 2 );
|
||||
}
|
||||
|
||||
INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT16 sGridNo, INT8 bLevel)
|
||||
INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT16 sGridNo, INT8 bLevel, int calcAsType)
|
||||
{
|
||||
if (sGridNo == -1) {
|
||||
return MaxNormalDistanceVisible();
|
||||
@@ -1091,7 +1091,12 @@ INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT16 sGridNo, INT8 bLevel)
|
||||
bLevel = this->bLevel;
|
||||
}
|
||||
|
||||
return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
||||
if (calcAsType == CALC_FROM_ALL_DIRS) {
|
||||
return DistanceVisible( this, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
||||
}
|
||||
else {
|
||||
return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
||||
}
|
||||
}
|
||||
|
||||
INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, INT16 sSubjectGridNo, INT8 bLevel )
|
||||
@@ -1227,8 +1232,6 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
sDistVisible += sDistVisible * GetTotalVisionRangeBonus(pSoldier, bLightLevel) / 100;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// give one step better vision for people with nightops
|
||||
if (HAS_SKILL_TRAIT( pSoldier, NIGHTOPS ))
|
||||
@@ -1305,7 +1308,7 @@ void EndMuzzleFlash( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
if ( pOtherSoldier->sGridNo != NOWHERE )
|
||||
{
|
||||
if ( PythSpacesAway( pOtherSoldier->sGridNo, pSoldier->sGridNo ) > DistanceVisible( pOtherSoldier, (SoldierHasLimitedVision(pSoldier) ? pOtherSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, pSoldier->sGridNo, pSoldier->bLevel ) )
|
||||
if ( PythSpacesAway( pOtherSoldier->sGridNo, pSoldier->sGridNo ) > pOtherSoldier->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel, CALC_FROM_WANTED_DIR ) )
|
||||
{
|
||||
// if this guy can no longer see us, change to seen this turn
|
||||
HandleManNoLongerSeen( pOtherSoldier, pSoldier, &(pOtherSoldier->bOppList[ pSoldier->ubID ]), &(gbPublicOpplist[ pOtherSoldier->bTeam ][ pSoldier->ubID ] ) );
|
||||
@@ -1844,7 +1847,12 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
||||
bAware = TRUE;
|
||||
|
||||
// then we look for him full viewing distance in EVERY direction
|
||||
sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->bLevel );
|
||||
|
||||
//ADB the comment above says EVERY direction but the code used to be:
|
||||
//sDistVisible = DistanceVisible(pSoldier, (SoldierHasLimitedVision(pSoldier) ? pSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), 0, pOpponent->sGridNo, pOpponent->bLevel, pOpponent );
|
||||
//if the code below says CALC_FROM_ALL_DIRS, then the opponent will NOT be greyed out if a merc sees him and a second merc turns away from him
|
||||
//calcing from the wanted dir will make the opponent be greyed out, which I think is the intended effect
|
||||
sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->bLevel, CALC_FROM_WANTED_DIR );
|
||||
//if (pSoldier->ubID == 0)
|
||||
//sprintf(gDebugStr,"ALREADY KNOW: ME %d him %d val %d",pSoldier->ubID,pOpponent->ubID,pSoldier->bOppList[pOpponent->ubID]);
|
||||
}
|
||||
@@ -1872,7 +1880,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
||||
{
|
||||
// and we can trace a line of sight to his x,y coordinates
|
||||
// must use the REAL opplist value here since we may or may not know of him
|
||||
if (SoldierToSoldierLineOfSightTest(pSoldier,pOpponent,bAware,(UINT8)sDistVisible))
|
||||
if (SoldierToSoldierLineOfSightTest(pSoldier,pOpponent,bAware,sDistVisible))
|
||||
{
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->bLevel,MANLOOKSFORMAN,ubCaller);
|
||||
bSuccess = TRUE;
|
||||
@@ -5651,7 +5659,6 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
||||
INT16 sNoiseX, sNoiseY;
|
||||
INT8 bHadToTurn = FALSE, bSourceSeen = FALSE;
|
||||
INT8 bOldOpplist;
|
||||
INT16 sDistVisible;
|
||||
INT8 bDirection;
|
||||
BOOLEAN fMuzzleFlash = FALSE;
|
||||
|
||||
@@ -5689,7 +5696,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
||||
}
|
||||
}
|
||||
|
||||
sDistVisible = pSoldier->GetMaxDistanceVisible( sGridNo, bLevel );
|
||||
int sDistVisible = pSoldier->GetMaxDistanceVisible(sGridNo, bLevel, CALC_FROM_WANTED_DIR );
|
||||
|
||||
if ( fMuzzleFlash )
|
||||
{
|
||||
@@ -6536,7 +6543,7 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT
|
||||
}
|
||||
}
|
||||
|
||||
if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE ) != 0)
|
||||
if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE, CALC_FROM_WANTED_DIR ) != 0)
|
||||
{
|
||||
fSeesAttacker = TRUE;
|
||||
}
|
||||
@@ -6788,15 +6795,13 @@ INT8 GetHighestVisibleWatchedLoc( UINT8 ubID )
|
||||
INT8 bLoop;
|
||||
INT8 bHighestLoc = -1;
|
||||
INT8 bHighestPoints = 0;
|
||||
INT16 sDistVisible;
|
||||
|
||||
for ( bLoop = 0; bLoop < NUM_WATCHED_LOCS; bLoop++ )
|
||||
{
|
||||
if ( gsWatchedLoc[ ubID ][ bLoop ] != NOWHERE && gubWatchedLocPoints[ ubID ][ bLoop ] > bHighestPoints )
|
||||
{
|
||||
sDistVisible = DistanceVisible( MercPtrs[ ubID ], (SoldierHasLimitedVision(MercPtrs[ ubID ]) ? MercPtrs[ ubID ]->bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, gsWatchedLoc[ ubID ][ bLoop ], gbWatchedLocLevel[ ubID ][ bLoop ] );
|
||||
// look at standing height
|
||||
if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubID ], gsWatchedLoc[ ubID ][ bLoop ], gbWatchedLocLevel[ ubID ][ bLoop ], 3, TRUE, sDistVisible ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubID ], gsWatchedLoc[ ubID ][ bLoop ], gbWatchedLocLevel[ ubID ][ bLoop ], 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
{
|
||||
bHighestLoc = bLoop;
|
||||
bHighestPoints = gubWatchedLocPoints[ ubID ][ bLoop ];
|
||||
|
||||
@@ -2804,7 +2804,7 @@ void ManChecksOnFriends(SOLDIERTYPE *pSoldier)
|
||||
|
||||
// if we can see far enough to see this friend
|
||||
// and can trace a line of sight to his x,y coordinates
|
||||
if (SoldierToSoldierLineOfSightTest(pSoldier, pFriend, TRUE))
|
||||
if (SoldierToSoldierLineOfSightTest(pSoldier, pFriend, TRUE, CALC_FROM_ALL_DIRS))
|
||||
{
|
||||
// if my friend is in battle or something is clearly happening there
|
||||
if ((pFriend->bAlertStatus >= STATUS_RED) || pFriend->bUnderFire || (pFriend->bLife < OKLIFE))
|
||||
|
||||
@@ -1034,7 +1034,7 @@ INT16 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK,
|
||||
bLevel = *pbNoiseLevel;
|
||||
|
||||
// if we are not NEAR the noise gridno...
|
||||
if ( pSoldier->bLevel != bLevel || PythSpacesAway( pSoldier->sGridNo, sGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, bLevel, 0, FALSE ) == 0 )
|
||||
if ( pSoldier->bLevel != bLevel || PythSpacesAway( pSoldier->sGridNo, sGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, bLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 )
|
||||
// if we are NOT there (at the noise gridno)
|
||||
// if (sGridNo != pSoldier->sGridNo)
|
||||
{
|
||||
|
||||
@@ -848,7 +848,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
// if soldier is not already facing in that direction,
|
||||
// and the opponent is close enough that he could possibly be seen
|
||||
// note, have to change this to use the level returned from ClosestKnownOpponent
|
||||
sDistVisible = DistanceVisible( pSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sClosestOpponent, 0 );
|
||||
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0 );
|
||||
|
||||
if ((pSoldier->bDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "Dialogue Control.h"
|
||||
#endif
|
||||
|
||||
extern BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNewStance );
|
||||
extern BOOLEAN gfHiddenInterrupt;
|
||||
extern BOOLEAN gfUseAlternateQueenPosition;
|
||||
|
||||
@@ -3161,7 +3160,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
// if soldier is not already facing in that direction,
|
||||
// and the opponent is close enough that he could possibly be seen
|
||||
// note, have to change this to use the level returned from ClosestKnownOpponent
|
||||
sDistVisible = DistanceVisible( pSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sClosestOpponent, 0 );
|
||||
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0, CALC_FROM_ALL_DIRS );
|
||||
|
||||
if ((pSoldier->bDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
|
||||
{
|
||||
|
||||
@@ -229,7 +229,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN
|
||||
// if any "misc. noise" was also heard recently
|
||||
if (pSoldier->sNoiseGridno != NOWHERE)
|
||||
{
|
||||
if ( pSoldier->bNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, pSoldier->sNoiseGridno ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, pSoldier->sNoiseGridno, pSoldier->bNoiseLevel, 0, FALSE, 255 ) == 0 )
|
||||
if ( pSoldier->bNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, pSoldier->sNoiseGridno ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, pSoldier->sNoiseGridno, pSoldier->bNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 )
|
||||
{
|
||||
// calculate how far this noise was, and its relative "importance"
|
||||
iDistAway = SpacesAway(pSoldier->sGridNo,pSoldier->sNoiseGridno);
|
||||
@@ -258,7 +258,7 @@ INT16 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN
|
||||
if (*psNoiseGridNo != NOWHERE)
|
||||
{
|
||||
// if we are NOT there (at the noise gridno)
|
||||
if ( *pbNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, *psNoiseGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, *psNoiseGridNo, *pbNoiseLevel, 0, FALSE, 255 ) == 0 )
|
||||
if ( *pbNoiseLevel != pSoldier->bLevel || PythSpacesAway( pSoldier->sGridNo, *psNoiseGridNo ) >= 6 || SoldierTo3DLocationLineOfSightTest( pSoldier, *psNoiseGridNo, *pbNoiseLevel, 0, FALSE, NO_DISTANCE_LIMIT ) == 0 )
|
||||
{
|
||||
// calculate how far this noise was, and its relative "importance"
|
||||
iDistAway = SpacesAway(pSoldier->sGridNo,*psNoiseGridNo);
|
||||
|
||||
Reference in New Issue
Block a user