From 79bd483fe40d56723ca24f52f8b3c6e24fe7b914 Mon Sep 17 00:00:00 2001 From: Shadooow Date: Fri, 10 Sep 2021 20:53:57 +0000 Subject: [PATCH] allowed mouse wheel to work in map screen message log area git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9165 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface Bottom.cpp | 5 +++++ Strategic/mapscreen.cpp | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 324e4c24b..41c61a719 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -162,6 +162,7 @@ UINT32 guiMapBottomTimeButtonsImage[ 2 ]; // mouse regions MOUSE_REGION gMapMessageScrollBarRegion; +MOUSE_REGION gMapMessageRegion; MOUSE_REGION gMapPauseRegion; MOUSE_REGION gTimeCompressionMask[ 3 ]; @@ -1045,12 +1046,16 @@ void CreateMapScreenBottomMessageScrollBarRegion( void ) MSYS_DefineRegion( &gMapMessageScrollBarRegion, MESSAGE_SCROLL_AREA_START_X, MESSAGE_SCROLL_AREA_START_Y, MESSAGE_SCROLL_AREA_END_X, MESSAGE_SCROLL_AREA_END_Y, MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenMessageScrollBarCallBack ); + + MSYS_DefineRegion(&gMapMessageRegion, (INT16)(xResOffset + 4), MESSAGE_SCROLL_AREA_START_Y, MESSAGE_SCROLL_AREA_END_X, MESSAGE_SCROLL_AREA_END_Y, + MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); } void DeleteMapScreenBottomMessageScrollRegion( void ) { MSYS_RemoveRegion( &gMapMessageScrollBarRegion ); + MSYS_RemoveRegion(&gMapMessageRegion); } diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index d7288f086..8c34dd678 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -613,6 +613,7 @@ MOUSE_REGION gMapScreenMaskRegion; MOUSE_REGION gTrashCanRegion; MOUSE_REGION gMapMercWeightRegion; MOUSE_REGION gMapMercCamoRegion; +extern MOUSE_REGION gMapMessageRegion; // mouse regions for team info panel MOUSE_REGION gTeamListNameRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; @@ -718,6 +719,7 @@ extern BOOLEAN gfMilitiaPopupCreated; // PROTOTYPES // basic input void GetMapKeyboardInput( UINT32 *puiNewEvent ); +void PollWheelInMapView(UINT32 *puiNewEvent); void PollLeftButtonInMapView( UINT32 *puiNewEvent ); void PollRightButtonInMapView( UINT32 *puiNewEvent ); @@ -6467,6 +6469,7 @@ UINT32 HandleMapUI( ) // Get mouse PollLeftButtonInMapView( &uiNewEvent ); PollRightButtonInMapView( &uiNewEvent ); + PollWheelInMapView(&uiNewEvent); // Switch on event switch( uiNewEvent ) @@ -8886,6 +8889,26 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f UnLockVideoSurface( FRAME_BUFFER ); } +void PollWheelInMapView(UINT32 *puiNewEvent) +{ + gMapMessageRegion.WheelState = gMapMessageRegion.WheelState * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1); + + if (gMapMessageRegion.uiFlags & MSYS_MOUSE_IN_AREA) + { + if (gMapMessageRegion.WheelState != 0) + { + if (gMapMessageRegion.WheelState > 0) + { + MapScreenMsgScrollUp(1); + } + else + { + MapScreenMsgScrollDown(1); + } + ResetWheelState(&gMapMessageRegion); + } + } +} void PollLeftButtonInMapView( UINT32 *puiNewEvent ) {