From 6bf05babcbc24e2f92771b7c46b7a49b93fa0fd3 Mon Sep 17 00:00:00 2001 From: Wanne Date: Wed, 27 May 2009 12:43:45 +0000 Subject: [PATCH] - Added Ultra Dynamic Tooltips by Telpscorei (to see the changes, search the code for //SCORE) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2896 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 4 +++ GameSettings.h | 4 +++ Tactical/SoldierTooltips.cpp | 49 ++++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index b92f395d..8d60e728 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -639,6 +639,10 @@ void LoadGameExternalOptions() // Soldier tool tips gGameExternalOptions.gfAllowSoldierToolTips = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_SOLDIER_TOOL_TIPS",0); + //SCORE: Settings for UDT + gGameExternalOptions.gfAllowUDTRange = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_RANGE",0); + gGameExternalOptions.gfAllowUDTDetail = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_DETAIL",0); + gGameExternalOptions.ubUDTModifier = (UINT8) iniReader.ReadInteger("JA2 Tactical Settings", "UDT_MODIFIER", 50); // ShadoWarrior: Tooltip changes (start) gGameExternalOptions.ubSoldierTooltipDetailLevel = (UINT8) iniReader.ReadInteger("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DETAIL_LEVEL", 1, 0, 4); diff --git a/GameSettings.h b/GameSettings.h index a358f4ce..eaf7ac5e 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -464,6 +464,10 @@ typedef struct BOOLEAN fEnableSoldierTooltipBigSlot6; BOOLEAN fEnableSoldierTooltipBigSlot7; // ShadoWarrior: Tooltip changes (end) + //SCORE: UDT related + BOOLEAN gfAllowUDTRange; + BOOLEAN gfAllowUDTDetail; + INT8 ubUDTModifier; //Kaiden MERC Deaths Externalized: BOOLEAN gfMercsDieOnAssignment; diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index 58295fb3..1b4be4e4 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -20,6 +20,7 @@ #include "local.h" #include "vsurface.h" #include "line.h" +#include "los.h" #endif //forward declarations of common classes to eliminate includes @@ -88,7 +89,14 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) return; } - if ( gGameExternalOptions.fEnableDynamicSoldierTooltips ) + // SCORE: If UDT range, we work it out as half actual LOS + if ( gGameExternalOptions.gfAllowUDTRange ) + { + uiMaxTooltipDistance = (UINT32)( MercPtrs[ gusSelectedSoldier ]->GetMaxDistanceVisible(MercPtrs[ gusUIFullTargetID ]->sGridNo, 0, CALC_FROM_WANTED_DIR) * (gGameExternalOptions.ubUDTModifier)); + uiMaxTooltipDistance /= 100; + } + //SCORE: Otherwise if we're using dynamics then do this + else if ( gGameExternalOptions.fEnableDynamicSoldierTooltips ) { OBJECTTYPE* pObject = &(MercPtrs[gusSelectedSoldier]->inv[HANDPOS]); for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end(); ++iter) { @@ -104,8 +112,13 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // set detail level to (at least) Full ubTooltipDetailLevel = MAX(DL_Full,ubTooltipDetailLevel); } - else - { + } + //SCORE: removed to enable scopes to affect range of tooltips. + //else + //{ + //If we're using original settings and no scope, we do this + if (gGameExternalOptions.fEnableDynamicSoldierTooltips && fMercIsUsingScope == 0 && !gGameExternalOptions.gfAllowUDTRange) + { // add 10% to max tooltip viewing distance per level of the merc uiMaxTooltipDistance *= 1 + (MercPtrs[ gusSelectedSoldier ]->stats.bExpLevel / 10); @@ -119,7 +132,31 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // if night reduce max tooltip viewing distance by a factor of 4 if merc is not wearing NVG uiMaxTooltipDistance >>= 2; } + } + //SCORE: Dynamic detail, otherwise do what we usually do + if ( gGameExternalOptions.gfAllowUDTDetail ) + { + //Check range. Less than a third? Full. Less than 2 thirds? Basic. Otherwise Limited. + if ( iRangeToTarget <= (INT32)(uiMaxTooltipDistance / 3) ) + { + ubTooltipDetailLevel = DL_Full; + } + else if ( iRangeToTarget <= (INT32)((uiMaxTooltipDistance / 3)*2) ) + { + ubTooltipDetailLevel = DL_Basic; + } + else if ( iRangeToTarget <= (INT32)uiMaxTooltipDistance ) + { + ubTooltipDetailLevel = DL_Limited; + } + else + { + return; + } + } + else + { if ( iRangeToTarget <= (INT32)(uiMaxTooltipDistance / 2) ) { // at under half the maximum view distance set tooltip detail to (at least) Basic @@ -136,8 +173,10 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) if ( ubTooltipDetailLevel < DL_Full ) return; } - } // fMercIsUsingScope is false - } // gGameExternalOptions.fEnableDynamicSoldierTooltips + } + //} // fMercIsUsingScope is false + // gGameExternalOptions.fEnableDynamicSoldierTooltips + // WANNE: Check if enemy soldier is in line of sight but only if player has not choosen debug details