From f0c6b73e24b844d56153ea8f26636acf38ae8fa9 Mon Sep 17 00:00:00 2001 From: Kriplo Date: Wed, 27 Nov 2013 21:05:12 +0000 Subject: [PATCH] Brief: //dnl ch78 - Some mapeditor cosmetic and CTD fixes. Details: - Fix sticky tooltip if perform scroll or go to 'Sector Summary' window. - Fix accidental mercid delete from textbox if press any key while in 'Profile ID mode'. - Fix CTD from release if several time swap from RND to any other item button. - Disable some enabled buttons and mouse area from taskbar when 'Sector Summary' windows is active. - Checkbox toggles from Mercs bar now remember their state after switching to another taskbar option. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6657 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/Editor Taskbar Utils.cpp | 20 ++++++++++++++------ Editor/EditorItems.cpp | 4 ++-- Editor/EditorMercs.cpp | 4 ++-- Editor/Sector Summary.cpp | 11 +++++++++++ Editor/editscreen.cpp | 7 ++++++- TileEngine/renderworld.cpp | 3 ++- 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp index 78f64cdf9..dbe913bb8 100644 --- a/Editor/Editor Taskbar Utils.cpp +++ b/Editor/Editor Taskbar Utils.cpp @@ -45,14 +45,12 @@ #include "Soldier Find.h" #include "lighting.h" #include "Keys.h" - #include "InterfaceItemImages.h" + #include "renderworld.h"//dnl ch78 271113 #endif void RenderEditorInfo(); -//extern ITEM_POOL *gpItemPool;//dnl ch26 210909 - //editor icon storage vars INT32 giEditMercDirectionIcons[2]; UINT32 guiMercInventoryPanel; @@ -91,7 +89,7 @@ void DisableEditorRegion( INT8 bRegionID ) switch( bRegionID ) { case BASE_TERRAIN_TILE_REGION_ID: - case 1: case 2: case 3: case 4: case 5: case 6: case 7: + case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8://dnl ch78 261113 MSYS_DisableRegion( &TerrainTileButtonRegion[ bRegionID ] ); break; case ITEM_REGION_ID: @@ -345,6 +343,17 @@ void DoTaskbar(void) SetMercEditingMode( MERC_TEAMMODE ); fBuildingShowRoofs = FALSE; UpdateRoofsView(); + //dnl ch78 261113 + if(gfShowPlayers) + ClickEditorButton(MERCS_PLAYERTOGGLE); + if(gfShowEnemies) + ClickEditorButton(MERCS_ENEMYTOGGLE); + if(gfShowCreatures) + ClickEditorButton(MERCS_CREATURETOGGLE); + if(gfShowRebels) + ClickEditorButton(MERCS_REBELTOGGLE); + if(gfShowCivilians) + ClickEditorButton(MERCS_CIVILIANTOGGLE); break; case TASK_TERRAIN: ClickEditorButton( TAB_TERRAIN ); @@ -1052,9 +1061,8 @@ void ProcessEditorRendering() //It is set to false when before we save the buffer, so the buttons don't get //rendered with hilites, in case the mouse is over one. gfRenderHilights = TRUE; - if(!gfSummaryWindowActive)//dnl ch77 131113 + if(!gfSummaryWindowActive && !gfScrollInertia)//dnl ch77 131113 //dnl ch78 271113 RenderButtonsFastHelp(); } - #endif diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index b5c9b6dbe..88a3b2d96 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -323,8 +323,8 @@ void InitEditorItemsInfo(UINT32 uiItemType) return; } //Allocate memory to store all the item pointers. - eInfo.pusItemIndex = (UINT16*)MemAlloc( sizeof(UINT16) * eInfo.sNumItems ); - + if(eInfo.sNumItems)//dnl ch78 271113 + eInfo.pusItemIndex = (UINT16*)MemAlloc( sizeof(UINT16) * eInfo.sNumItems ); //Disable the appropriate scroll buttons based on the saved scroll index if applicable //Left most scroll position DetermineItemsScrolling(); diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 981da0a56..80136a2fe 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -1773,7 +1773,7 @@ void SetupTextInputForMercProfile() INT16 sNum; InitTextInputModeWithScheme( DEFAULT_SCHEME ); - + AddUserInputField(NULL);//dnl ch78 271113 to avoid automatic textbox selection and enable shortcut keys while not typing sNum = gpSelected->pDetailedPlacement->ubProfile; if( sNum == NO_PROFILE ) str[0] = '\0'; @@ -1887,7 +1887,7 @@ void ExtractAndUpdateMercProfile() //if the string is blank, returning -1, then set the value to NO_PROFILE //because ubProfile is unsigned. - sNum = (INT16)min( GetNumericStrictValueFromField( 0 ), NUM_PROFILES-1 );//dnl ch54 101009 + sNum = (INT16)min(GetNumericStrictValueFromField(1), NUM_PROFILES-1);//dnl ch54 101009 //dnl ch78 271113 if( sNum == -1 ) { gpSelected->pDetailedPlacement->ubProfile = NO_PROFILE; diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index 8201c2adb..ce502644c 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -40,6 +40,8 @@ #include "GameVersion.h" #include "Campaign Types.h" #include "GameSettings.h" + #include "EditorTerrain.h"//dnl ch78 261113 + #include "Render Dirty.h"//dnl ch78 271113 #endif #include @@ -271,6 +273,10 @@ void CreateSummaryWindow() DisableEditorTaskbar(); DisableAllTextFields(); + //dnl ch78 261113 + HideTerrainTileButtons(); + DisableEditorRegion(ITEM_REGION_ID); + RestoreBackgroundRects(); GetCurrentWorldSector( &gsSectorX, &gsSectorY ); gsSelSectorX = gsSectorX; @@ -480,6 +486,11 @@ void DestroySummaryWindow() KillTextInputMode(); EnableEditorTaskbar(); EnableAllTextFields(); + //dnl ch78 261113 + if(iCurrentTaskbar == TASK_TERRAIN) + ShowTerrainTileButtons(); + else if(iCurrentTaskbar == TASK_ITEMS) + EnableEditorRegion(ITEM_REGION_ID); if( gpWorldItemsSummaryArray ) { diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 27762e165..8b4e448e7 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -2168,6 +2168,10 @@ void HandleKeyboardShortcuts( ) gfRenderWorld = TRUE; } break; +#ifdef dnlTEST + case '\'': + break; +#endif default: iCurrentAction = ACTION_NULL; break; @@ -4614,7 +4618,8 @@ UINT32 EditScreenHandle( void ) // If editing mercs, handle that stuff ProcessMercEditing(); - EnsureStatusOfEditorButtons(); + if(!gfSummaryWindowActive)//dnl ch78 261113 + EnsureStatusOfEditorButtons(); // Handle scrolling of the map if needed if( !gfGotoGridNoUI && !gfKeyboardItemCreationUI && iDrawMode != DRAW_MODE_SHOW_TILESET && !gfSummaryWindowActive && diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 73b63d858..985cb42d0 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -3778,9 +3778,10 @@ void ScrollWorld( ) // If here, set scroll pending to false gfScrollPending = FALSE; - // INcrement scroll intertia gfScrollInertia++; + if(gfScrollInertia == 1)//dnl ch78 271113 + RestoreBackgroundRects(); // Now we actually begin our scrolling HandleScrollDirections( ScrollFlags, sScrollXStep, sScrollYStep, &sTempRenderCenterX, &sTempRenderCenterY, FALSE );