From a57d9455f3c976cbc2fc9fe9a7d0a5d6fd056710 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 1 Oct 2017 11:08:38 +0000 Subject: [PATCH] Dynamic dialogue boxes cause less issues when scrolling git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8486 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/DynamicDialogueWidget.cpp | 15 ++++++++++++++- Tactical/DynamicDialogue.cpp | 15 ++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Laptop/DynamicDialogueWidget.cpp b/Laptop/DynamicDialogueWidget.cpp index 199530299..4e9cd599e 100644 --- a/Laptop/DynamicDialogueWidget.cpp +++ b/Laptop/DynamicDialogueWidget.cpp @@ -319,6 +319,18 @@ void RefreshBoxes( ) // also halt dialogue if sector inventory is open if ( guiCurrentScreen == GAME_SCREEN || guiCurrentScreen == MAP_SCREEN && !fShowMapInventoryPool ) { + // if we are scrolling, don't redraw the boxes as often + if (gfScrollPending || gfScrollInertia) + { + UINT32 timepassednotdisplaying = max(0, GetJA2Clock() - lasttimenhere); + + if (timepassednotdisplaying < 100) + { + lasttimenhere = GetJA2Clock(); + return; + } + } + // refresh all boxes, and while you're at it, check wether there are any BOOLEAN fFound = FALSE; for ( UINT8 i = 0; i < MYBOX_NUMBER; ++i ) @@ -344,7 +356,8 @@ void RefreshBoxes( ) else { // boxes are active, thus we have to refresh them - fMapPanelDirty = TRUE; + if (guiCurrentScreen == MAP_SCREEN) + fMapPanelDirty = TRUE; } } else diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 811c5d13e..611338583 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -1239,14 +1239,7 @@ void AddOpinionEvent( UINT8 usProfileA, UINT8 usProfileB, UINT8 usEvent, BOOLEAN // if this option is turned on, a small message will show us how opinions have changed if ( gGameExternalOptions.fDynamicOpinionsShowChange ) { - if ( gDynamicOpinionEvent[usEvent].sOpinionModifier >= 0 ) - { - ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, L"%s: %s +%d", gMercProfiles[usProfileA].zNickname, gMercProfiles[usProfileB].zNickname, gDynamicOpinionEvent[usEvent].sOpinionModifier ); - } - else - { - ScreenMsg( FONT_MCOLOR_RED, MSG_INTERFACE, L"%s: %s %d", gMercProfiles[usProfileA].zNickname, gMercProfiles[usProfileB].zNickname, gDynamicOpinionEvent[usEvent].sOpinionModifier ); - } + ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, gDynamicOpinionEvent[usEvent].sOpinionModifier >= 0 ? L"%s: %s +%d" : L"%s: %s %d", gMercProfiles[usProfileA].zNickname, gMercProfiles[usProfileB].zNickname, gDynamicOpinionEvent[usEvent].sOpinionModifier ); } // if dialogue is allowed, set up dialogue @@ -1743,7 +1736,7 @@ void HandleDynamicOpinionOnContractExtension( UINT8 ubCode, UINT8 usProfile ) if ( pSoldierWhoGotPaid->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) return; - // determine the remaining length of his contract BEFORE it go renewed + // determine the remaining length of his contract BEFORE it got renewed INT32 oldcontract = pSoldierWhoGotPaid->iEndofContractTime; if ( ubCode == EXTENDED_CONTRACT_BY_1_DAY ) oldcontract -= 1440; @@ -1752,7 +1745,7 @@ void HandleDynamicOpinionOnContractExtension( UINT8 ubCode, UINT8 usProfile ) else if ( ubCode == EXTENDED_CONTRACT_BY_2_WEEKS ) oldcontract -= 14 * 1440; - // someones contract got extended. Other mercs who have less time on their contract will be annoyed by this, as they feel they shoul be paid first + // someones contract got extended. Other mercs who have less time on their contract will be annoyed by this, as they feel they should have been paid first SOLDIERTYPE* pSoldier = NULL; UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; @@ -2158,7 +2151,7 @@ void HandleDynamicOpinionChange( SOLDIERTYPE* pSoldier, UINT8 usEvent, BOOLEAN f break; } - UINT8 usEventUsed; // it is possible that the individaul event is switched + UINT8 usEventUsed; // it is possible that the individual event is switched SOLDIERTYPE* pTeamSoldier = NULL; UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID;