From 3ef41189b288f7601d15a5c1ee0916e071c6ca24 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Thu, 16 Jan 2020 12:32:21 +0000 Subject: [PATCH] New option BACKGROUND_TOOLTIP_DETAILS (TRUE by default) can be used to enable or disable showing background details in laptop. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8732 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 3 +- GameSettings.h | 2 ++ Laptop/IMP Background.cpp | 67 ++++++++++++++++++++------------------- Laptop/personnel.cpp | 2 +- 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index f39bff1e4..e501ac813 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1945,7 +1945,8 @@ void LoadGameExternalOptions() gGameExternalOptions.fCampaignHistoryWebSite = iniReader.ReadBoolean("Laptop Settings", "CAMPAIGN_HISTORY", TRUE); gGameExternalOptions.usReportsToLoad = iniReader.ReadInteger("Laptop Settings", "CAMPAIGN_HISTORY_MAX_REPORTS", -1, -1, 100); - + + gGameExternalOptions.fBackgroundTooltipDetails = iniReader.ReadBoolean("Laptop Settings", "BACKGROUND_TOOLTIP_DETAILS", TRUE); //################# Bobby Ray Settings ################## diff --git a/GameSettings.h b/GameSettings.h index 0c285932c..78e1320ab 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -951,6 +951,8 @@ typedef struct BOOLEAN fCampaignHistoryWebSite; // if set to FALSE, the website won't be displayed, and thus the data cannot be seen INT16 usReportsToLoad; // number of reports to read when loading a game, older reports will be lost. This is irreversible. -1: read all (default) + BOOLEAN fBackgroundTooltipDetails; + // CPT: Cover System Settings UINT8 ubStealthTraitCoverValue; UINT8 ubStealthEffectiveness; diff --git a/Laptop/IMP Background.cpp b/Laptop/IMP Background.cpp index d32184ac7..99436dc22 100644 --- a/Laptop/IMP Background.cpp +++ b/Laptop/IMP Background.cpp @@ -468,68 +468,69 @@ void AssignBackgroundHelpText( UINT16 ubNumber, MOUSE_REGION* pMouseregion ) swprintf( apStr, L"" ); - if ( ubNumber ) + if (!ubNumber) + return; + + swprintf(atStr, zBackground[ubNumber].szName); + wcscat(apStr, atStr); + wcscat(apStr, L"\n"); + + swprintf(atStr, zBackground[ubNumber].szDescription); + wcscat(apStr, atStr); + wcscat(apStr, L"\n"); + + // ability description + if (gGameExternalOptions.fBackgroundTooltipDetails) { - swprintf(atStr, zBackground[ ubNumber ].szName ); - wcscat( apStr, atStr ); - wcscat( apStr, L"\n" ); - - swprintf(atStr, zBackground[ ubNumber ].szDescription ); - wcscat( apStr, atStr ); - wcscat( apStr, L"\n" ); - - // ability description - for ( UINT8 i = 0; i < BACKGROUND_FLAG_MAX; ++i) + for (UINT8 i = 0; i < BACKGROUND_FLAG_MAX; ++i) { // some properties are hidden - if ( ((UINT64)1 << i) & BACKGROUND_HIDDEN_FLAGS ) + if (((UINT64)1 << i) & BACKGROUND_HIDDEN_FLAGS) continue; - if ( zBackground[ ubNumber ].uiFlags & ((UINT64)1 << i) ) + if (zBackground[ubNumber].uiFlags & ((UINT64)1 << i)) { - swprintf(atStr, szBackgroundText_Flags[ i ] ); - wcscat( apStr, atStr ); + swprintf(atStr, szBackgroundText_Flags[i]); + wcscat(apStr, atStr); } } UINT8 strused = 0; - for ( UINT8 i = 0; i < BG_MAX; ++i) + for (UINT8 i = 0; i < BG_MAX; ++i) { if (BG_DISLIKEBG == i && zBackground[ubNumber].value[i]) { - swprintf( atStr, szBackgroundText_Value[strused] ); - wcscat( apStr, atStr ); + swprintf(atStr, szBackgroundText_Value[strused]); + wcscat(apStr, atStr); } - else if ( BG_TRACKER_ABILITY == i && zBackground[ubNumber].value[i] ) + else if (BG_TRACKER_ABILITY == i && zBackground[ubNumber].value[i]) { - swprintf( atStr, szBackgroundText_Value[strused], (UINT16)((gSkillTraitValues.usSVTrackerMaxRange * zBackground[ubNumber].value[i]) / 100) ); - wcscat( apStr, atStr ); + swprintf(atStr, szBackgroundText_Value[strused], (UINT16)((gSkillTraitValues.usSVTrackerMaxRange * zBackground[ubNumber].value[i]) / 100)); + wcscat(apStr, atStr); } - else if ( BG_SMOKERTYPE == i ) + else if (BG_SMOKERTYPE == i) { - if ( zBackground[ubNumber].value[i] == 1 ) - swprintf( atStr, szBackgroundText_Value[strused] ); + if (zBackground[ubNumber].value[i] == 1) + swprintf(atStr, szBackgroundText_Value[strused]); else - swprintf( atStr, szBackgroundText_Value[strused + 1] ); + swprintf(atStr, szBackgroundText_Value[strused + 1]); - wcscat( apStr, L" " ); - wcscat( apStr, atStr ); - wcscat( apStr, L"\n" ); + wcscat(apStr, L" "); + wcscat(apStr, atStr); + wcscat(apStr, L"\n"); // smoke has 2 texts, so extra increase of counter is needed ++strused; } - else if ( zBackground[ ubNumber ].value[i] ) + else if (zBackground[ubNumber].value[i]) { - swprintf( atStr, szBackgroundText_Value[strused], zBackground[ubNumber].value[i] > 0 ? L"+" : L"", zBackground[ubNumber].value[i] ); - wcscat( apStr, atStr ); + swprintf(atStr, szBackgroundText_Value[strused], zBackground[ubNumber].value[i] > 0 ? L"+" : L"", zBackground[ubNumber].value[i]); + wcscat(apStr, atStr); } ++strused; } } - else - return; // Set region help text SetRegionFastHelpText( pMouseregion, apStr ); diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 0db096e3b..4e09db10f 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -1664,7 +1664,7 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) // Background // display background - if ( UsingBackGroundSystem() ) + if (UsingBackGroundSystem()) { UINT8 loc = 21; UINT8 regionnr = 12;