diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 7428d4ad..d09db645 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -2628,6 +2628,8 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve else { // WANNE - MP: We have to re-initialize the correct interface + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); if((UsingNewInventorySystem() == true)) { InitNewInventorySystem(); @@ -2824,6 +2826,8 @@ void reapplySETTINGS() gGameOptions.ubSquadSize = 6; // WANNE - MP: We have to re-initialize the correct interface + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); if((UsingNewInventorySystem() == true) && IsNIVModeValid(true)) { InitNewInventorySystem(); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 131dc407..b737aa3d 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -182,6 +182,7 @@ extern void BeginLoadScreen( void ); extern void EndLoadScreen(); extern CPostalService gPostalService; +extern void initMapViewAndBorderCoordinates(void); //Global variable used #ifdef JA2BETAVERSION @@ -4803,6 +4804,8 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) gGameOptions.ubAttachmentSystem = SaveGameHeader.sInitialGameOptions.ubAttachmentSystem; } + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); if((UsingNewInventorySystem() == true)) { if(IsNIVModeValid(true) == FALSE){ diff --git a/Standard Gaming Platform/Types.h b/Standard Gaming Platform/Types.h index 1386ce8e..dd727b41 100644 --- a/Standard Gaming Platform/Types.h +++ b/Standard Gaming Platform/Types.h @@ -95,6 +95,15 @@ typedef CHAR8 SGPFILENAME[SGPFILENAME_LEN]; #define NULL 0 #endif +typedef struct +{ + INT32 x; + INT32 y; + INT32 width; + INT32 height; + +} SGPRectangle; + typedef struct { INT32 iLeft; diff --git a/Standard Gaming Platform/vobject.cpp b/Standard Gaming Platform/vobject.cpp index 8d91b5e7..baf76e85 100644 --- a/Standard Gaming Platform/vobject.cpp +++ b/Standard Gaming Platform/vobject.cpp @@ -507,6 +507,10 @@ BOOLEAN BltVideoObject( UINT32 uiDestVSurface, return( TRUE ); } +BOOLEAN BltVideoObject(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usRegionIndex, SGPRectangle Region, UINT32 fBltFlags, blt_fx* pBltFx) +{ + return BltVideoObject(uiDestVSurface, hSrcVObject, usRegionIndex, Region.x, Region.y, fBltFlags, pBltFx); +} // ******************************************************************************* // Video Object Manipulation Functions // ******************************************************************************* diff --git a/Standard Gaming Platform/vobject.h b/Standard Gaming Platform/vobject.h index 8c97ec93..98e1ca20 100644 --- a/Standard Gaming Platform/vobject.h +++ b/Standard Gaming Platform/vobject.h @@ -175,6 +175,7 @@ BOOLEAN BltVideoObject( UINT32 uiDestVSurface, INT32 iDestY, UINT32 fBltFlags, blt_fx *pBltFx ); +BOOLEAN BltVideoObject(UINT32 uiDestVSurface, HVOBJECT hSrcVObject, UINT16 usRegionIndex, SGPRectangle Region, UINT32 fBltFlags, blt_fx* pBltFx); BOOLEAN BltVideoObjectFromIndex( UINT32 uiDestVSurface, UINT32 uiSrcVObject, diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index d07b35e8..a6657123 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -88,6 +88,7 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +extern int POP_UP_BOX_X; #include "MilitiaSquads.h" // HEADROCK HAM 3.5: Include Facility data @@ -15410,7 +15411,7 @@ void CreateAssignmentsBox( void ) // will create attribute pop up menu for mapscreen assignments - AssignmentPosition.iX = (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + OrigAssignmentPosition.iX; + AssignmentPosition.iX = POP_UP_BOX_X; if( giBoxY != 0 ) { diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 33097813..e848d4d3 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -279,6 +279,7 @@ enum }; extern void CreateDestroyMapInvButton(); +extern void DestroyMapCharInvIOregions(); //Autoresolve sets this variable which defaults to -1 when not needed. INT16 gsEnemyGainedControlOfSectorID = -1; @@ -593,7 +594,14 @@ void EnterAutoResolveMode( UINT8 ubSectorX, UINT8 ubSectorY ) //Set up mapscreen for removal SetPendingNewScreen( AUTORESOLVE_SCREEN ); - CreateDestroyMapInvButton(); + if (isWidescreenUI()) + { + DestroyMapCharInvIOregions(); + } + else + { + CreateDestroyMapInvButton(); + } RenderButtons(); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1"); diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index 2f9ac728..87368176 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -92,6 +92,7 @@ #include "PostalService.h" extern CPostalService gPostalService; +extern void initMapViewAndBorderCoordinates(void); class OBJECTTYPE; class SOLDIERTYPE; @@ -583,6 +584,8 @@ fFirstTimeInMapScreen = TRUE; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: set initial inventory coords"); if( gubScreenCount == 0 ) { + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); if((UsingNewInventorySystem() == true)) { InitNewInventorySystem(); diff --git a/Strategic/Map Screen Interface Border.cpp b/Strategic/Map Screen Interface Border.cpp index 97ea523a..04fa25c7 100644 --- a/Strategic/Map Screen Interface Border.cpp +++ b/Strategic/Map Screen Interface Border.cpp @@ -39,31 +39,9 @@ #include "ub_config.h" #endif -// HEADROCK HAM 4: Now defining X/Y coordinates for Map Bottom buttons. Some day perhaps variable coordinates? -UINT16 MAP_BORDER_TOWN_BTN_X; -UINT16 MAP_BORDER_TOWN_BTN_Y; -UINT16 MAP_BORDER_MINE_BTN_X; -UINT16 MAP_BORDER_MINE_BTN_Y; -UINT16 MAP_BORDER_TEAMS_BTN_X; -UINT16 MAP_BORDER_TEAMS_BTN_Y; -UINT16 MAP_BORDER_AIRSPACE_BTN_X; -UINT16 MAP_BORDER_AIRSPACE_BTN_Y; -UINT16 MAP_BORDER_ITEM_BTN_X; -UINT16 MAP_BORDER_ITEM_BTN_Y; -UINT16 MAP_BORDER_MILITIA_BTN_X; -UINT16 MAP_BORDER_MILITIA_BTN_Y; -UINT16 MAP_BORDER_DISEASE_BTN_X; // Flugente: disease -UINT16 MAP_BORDER_DISEASE_BTN_Y; - -//UINT16 MAP_BORDER_WEATHER_BTN_X; // Flugente: weather // WANNE: Dynamic X position -UINT16 MAP_BORDER_WEATHER_BTN_Y; -//UINT16 MAP_BORDER_INTEL_BTN_X; // Flugente: intel // WANNE: Dynamic X position -UINT16 MAP_BORDER_INTEL_BTN_Y; - -UINT16 MAP_LEVEL_MARKER_X; -UINT16 MAP_LEVEL_MARKER_Y; -UINT16 MAP_LEVEL_MARKER_DELTA; -UINT16 MAP_LEVEL_MARKER_WIDTH; +extern UINT16 UI_BOTTOM_X; +extern UINT16 UI_BOTTOM_Y; +extern UILayout_Map UI_MAP; // extern to anchored button in winbart97 extern GUI_BUTTON *gpAnchoredButton; @@ -150,6 +128,10 @@ BOOLEAN LoadMapBorderGraphics( void ) { FilenameForBPP( "INTERFACE\\MBS.sti", VObjectDesc.ImageFile ); } + else if (iResolution == _1280x720) + { + FilenameForBPP("INTERFACE\\MBS_1280x720.sti", VObjectDesc.ImageFile); + } else if (iResolution < _1024x768) { FilenameForBPP( "INTERFACE\\MBS_800x600.sti", VObjectDesc.ImageFile ); @@ -201,9 +183,9 @@ void RenderMapBorder( void ) // get and blt border GetVideoObject(&hHandle, guiMapBorder ); - BltVideoObject( guiSAVEBUFFER, hHandle, 0, xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 0, UI_MAP.BorderRegion.x, UI_MAP.BorderRegion.y, VO_BLT_SRCTRANSPARENCY, NULL ); - RestoreExternBackgroundRect( xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset, SCREEN_HEIGHT - 121 - 2 * yResOffset); + RestoreExternBackgroundRect(UI_MAP.BorderRegion.x, UI_MAP.BorderRegion.y, SCREEN_WIDTH, SCREEN_HEIGHT - 121); // show the level marker DisplayCurrentLevelMarker( ); @@ -229,8 +211,8 @@ void RenderMapBorderEtaPopUp( void ) GetVideoObject(&hHandle, guiMapBorderEtaPopUp ); // coordinates should depend on the actual ETA display - UINT16 xVal = (CLOCK_ETA_X - 10) ; - UINT16 yVal = (CLOCK_Y_START - 7); + UINT16 xVal = (UI_MAP.ETA.Clock_X - 10) ; + UINT16 yVal = (UI_MAP.ETA.Start_Y - 7); if (iResolution >= _640x480 && iResolution < _800x600) BltVideoObject( FRAME_BUFFER , hHandle, 0, xVal, yVal, VO_BLT_SRCTRANSPARENCY,NULL ); @@ -253,37 +235,37 @@ BOOLEAN CreateButtonsForMapBorder( void ) // towns giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,5,-1,14,-1 ); - giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], MAP_BORDER_TOWN_BTN_X, MAP_BORDER_TOWN_BTN_Y, + giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], UI_MAP.Button.Town.iX, UI_MAP.Button.Town.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTownCallback); // mines giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,4,-1,13,-1 ); - giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], MAP_BORDER_MINE_BTN_X, MAP_BORDER_MINE_BTN_Y, + giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], UI_MAP.Button.Mine.iX, UI_MAP.Button.Mine.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMineCallback); // people giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,3,-1,12,-1 ); - giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], MAP_BORDER_TEAMS_BTN_X, MAP_BORDER_TEAMS_BTN_Y, + giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], UI_MAP.Button.Teams.iX, UI_MAP.Button.Teams.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTeamCallback); // militia giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,8,-1,17,-1 ); - giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], MAP_BORDER_MILITIA_BTN_X, MAP_BORDER_MILITIA_BTN_Y, + giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], UI_MAP.Button.Militia.iX, UI_MAP.Button.Militia.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMilitiaCallback); // airspace giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,2,-1,11,-1 ); - giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], MAP_BORDER_AIRSPACE_BTN_X, MAP_BORDER_AIRSPACE_BTN_Y, + giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], UI_MAP.Button.Airspace.iX, UI_MAP.Button.Airspace.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnAircraftCallback); // items giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,1,-1,10,-1 ); - giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_ITEM_BTN_X, MAP_BORDER_ITEM_BTN_Y, + giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], UI_MAP.Button.Inventory.iX, UI_MAP.Button.Inventory.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnItemCallback); @@ -302,7 +284,7 @@ BOOLEAN CreateButtonsForMapBorder( void ) SetButtonCursor(giMapBorderButtons[ MAP_BORDER_ITEM_BTN ], MSYS_NO_CURSOR ); SetButtonCursor(giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ], MSYS_NO_CURSOR ); - UINT16 nextButtonX = MAP_BORDER_DISEASE_BTN_X - 43; + UINT16 nextButtonX = UI_MAP.Button.Disease.iX - 43; // Flugente: disease if ( gGameExternalOptions.fDisease && gGameExternalOptions.fDiseaseStrategic ) @@ -315,7 +297,7 @@ BOOLEAN CreateButtonsForMapBorder( void ) if ( giMapBorderButtonsImage[MAP_BORDER_DISEASE_BTN] < 0 ) giMapBorderButtonsImage[MAP_BORDER_DISEASE_BTN] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti", -1, 2, -1, 11, -1 ); - giMapBorderButtons[MAP_BORDER_DISEASE_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_DISEASE_BTN], nextButtonX, MAP_BORDER_DISEASE_BTN_Y, + giMapBorderButtons[MAP_BORDER_DISEASE_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_DISEASE_BTN], nextButtonX, UI_MAP.Button.Disease.iY, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnDiseaseCallback ); @@ -341,7 +323,7 @@ BOOLEAN CreateButtonsForMapBorder( void ) x = MAP_BORDER_DISEASE_BTN_X; */ - giMapBorderButtons[MAP_BORDER_WEATHER_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_WEATHER_BTN], nextButtonX, MAP_BORDER_WEATHER_BTN_Y, + giMapBorderButtons[MAP_BORDER_WEATHER_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_WEATHER_BTN], nextButtonX, UI_MAP.Button.Weather_Y, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnWeatherCallback ); @@ -367,7 +349,7 @@ BOOLEAN CreateButtonsForMapBorder( void ) x = MAP_BORDER_WEATHER_BTN_X; */ - giMapBorderButtons[MAP_BORDER_INTEL_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_INTEL_BTN], nextButtonX, MAP_BORDER_INTEL_BTN_Y, + giMapBorderButtons[MAP_BORDER_INTEL_BTN] = QuickCreateButton( giMapBorderButtonsImage[MAP_BORDER_INTEL_BTN], nextButtonX, UI_MAP.Button.Intel_Y, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, (GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIntelCallback ); @@ -469,6 +451,24 @@ void DeleteMapBorderButtons( void ) } } +void DisableMapBorderButtons(void) +{ + for (int i = 0; i < NUM_MAP_BORDER_BTNS; ++i) + { + if (giMapBorderButtons[i] != -1) + DisableButton( giMapBorderButtons[i] ); + } +} + +void EnableMapBorderButtons(void) +{ + for (int i = 0; i < NUM_MAP_BORDER_BTNS; ++i) + { + if (giMapBorderButtons[i] != -1) + EnableButton(giMapBorderButtons[i]); + } +} + // callbacks void BtnMilitiaCallback(GUI_BUTTON *btn,INT32 reason) { @@ -860,9 +860,9 @@ void DisplayCurrentLevelMarker( void ) // it's actually a white rectangle, not a green arrow! GetVideoObject(&hHandle, guiLEVELMARKER ); - BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( guiSAVEBUFFER , hHandle, 0, UI_MAP.LevelMarkerArea.x + 1, UI_MAP.LevelMarkerArea.y + (UI_MAP.LevelMarkerArea.height * ( INT16 )iCurrentMapSectorZ ), VO_BLT_SRCTRANSPARENCY,NULL ); - RestoreExternBackgroundRect(MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), 55, 9); + RestoreExternBackgroundRect(UI_MAP.LevelMarkerArea.x + 1, UI_MAP.LevelMarkerArea.y + (UI_MAP.LevelMarkerArea.height * ( INT16 )iCurrentMapSectorZ ), 55, 9); } void CreateMouseRegionsForLevelMarkers( void ) @@ -872,8 +872,11 @@ void CreateMouseRegionsForLevelMarkers( void ) for( sCounter = 0; sCounter < 4 ; ++sCounter ) { - MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, - MSYS_NO_CALLBACK, LevelMarkerBtnCallback ); + const auto tlx = UI_MAP.LevelMarkerArea.x; + const auto tly = UI_MAP.LevelMarkerArea.y + UI_MAP.LevelMarkerArea.height * sCounter; + const auto brx = tlx + UI_MAP.LevelMarkerArea.width; + const auto bry = tly + UI_MAP.LevelMarkerArea.height; + MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], tlx, tly, brx, bry, MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, LevelMarkerBtnCallback ); MSYS_SetRegionUserData(&LevelMouseRegions[sCounter],0,sCounter); @@ -1439,32 +1442,78 @@ void MapBorderButtonOn( UINT8 ubBorderButtonIndex ) ButtonList[ giMapBorderButtons[ ubBorderButtonIndex ] ]->uiFlags |= BUTTON_CLICKED_ON; } + // HEADROCK HAM 4: Init the coordinates for all Map Border buttons void InitMapBorderButtonCoordinates() { - UINT32 buttonOffset = 155; // 160 + if (isWidescreenUI()) + { + // Map border buttons are located in the map bottom ui bar for widescreen UI + const UINT16 firstColumn = UI_BOTTOM_X + 746; + const UINT16 secondColumn = UI_BOTTOM_X + 788; + const UINT16 thirdColumn = UI_BOTTOM_X + 831; + const UINT16 fourthColumn = UI_BOTTOM_X + 874; + const UINT16 fifthColumn = UI_BOTTOM_X + 917; + const UINT16 sixthColumn = UI_BOTTOM_X + 960; + const UINT16 firstRow = UI_BOTTOM_Y + 1; //SCREEN_HEIGHT - 115; + const UINT16 SecondRow = UI_BOTTOM_Y + 38; //SCREEN_HEIGHT - 78; + + + UI_MAP.Button.Town = { firstColumn, firstRow }; + UI_MAP.Button.Mine = { secondColumn, firstRow }; + UI_MAP.Button.Teams = { fifthColumn, firstRow }; + UI_MAP.Button.Militia = { sixthColumn, firstRow }; + UI_MAP.Button.Airspace = { firstColumn, SecondRow}; + UI_MAP.Button.Inventory = { secondColumn, SecondRow }; + UI_MAP.Button.Disease = { thirdColumn, SecondRow }; + UI_MAP.Button.Weather_Y = SecondRow; + UI_MAP.Button.Intel_Y = SecondRow; + UI_MAP.LevelMarkerArea = { UI_BOTTOM_X + 840, UI_BOTTOM_Y, 55, 8 }; + } + else if (iResolution < _800x600) + { + const UINT16 xOffset = 43; + UI_MAP.Button.Town = { UI_MAP.BorderRegion.x + 35, UI_MAP.BorderRegion.y + 325 }; + UI_MAP.Button.Mine = { UI_MAP.Button.Town.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Teams = { UI_MAP.Button.Mine.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Militia = { UI_MAP.Button.Teams.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Airspace = { UI_MAP.Button.Militia.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Inventory = { UI_MAP.Button.Airspace.iX + xOffset, UI_MAP.Button.Town.iY }; - MAP_BORDER_TOWN_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) - 152; - MAP_BORDER_TOWN_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_MINE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) - 109; - MAP_BORDER_MINE_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_TEAMS_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) - 66; - MAP_BORDER_TEAMS_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_AIRSPACE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 20; - MAP_BORDER_AIRSPACE_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_ITEM_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 63; - MAP_BORDER_ITEM_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_MILITIA_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) - 23; - MAP_BORDER_MILITIA_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_DISEASE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 190; - MAP_BORDER_DISEASE_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - //MAP_BORDER_WEATHER_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 233; // WANNE: Dynamic X position - MAP_BORDER_WEATHER_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - //MAP_BORDER_INTEL_BTN_X = xResOffset + MAP_BORDER_X + ( ( SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset ) / 2 ) + 276; // WANNE: Dynamic X position - MAP_BORDER_INTEL_BTN_Y = ( SCREEN_HEIGHT - yResOffset - buttonOffset ); + UI_MAP.Button.Disease = { UI_MAP.BorderRegion.x + 361, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Weather_Y = UI_MAP.Button.Town.iY; + UI_MAP.Button.Intel_Y = UI_MAP.Button.Town.iY; + UI_MAP.LevelMarkerArea = { UI_MAP.BorderRegion.x + 303, UI_MAP.Button.Town.iY, 55, 8 }; - MAP_LEVEL_MARKER_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 114; - MAP_LEVEL_MARKER_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_LEVEL_MARKER_DELTA = 8; - MAP_LEVEL_MARKER_WIDTH = 55; + } + else if (iResolution < _1024x768) + { + const UINT16 xOffset = 43; + UI_MAP.Button.Town = { UI_MAP.BorderRegion.x + 115, UI_MAP.BorderRegion.y + 444 }; + UI_MAP.Button.Mine = { UI_MAP.Button.Town.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Teams = { UI_MAP.Button.Mine.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Militia = { UI_MAP.Button.Teams.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Airspace = { UI_MAP.Button.Militia.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Inventory = { UI_MAP.Button.Airspace.iX + xOffset, UI_MAP.Button.Town.iY }; + + UI_MAP.Button.Disease = { UI_MAP.BorderRegion.x + 450, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Weather_Y = UI_MAP.Button.Town.iY; + UI_MAP.Button.Intel_Y = UI_MAP.Button.Town.iY; + UI_MAP.LevelMarkerArea = { UI_MAP.BorderRegion.x + 383, UI_MAP.Button.Town.iY, 55, 8 }; + } + else + { + const UINT16 xOffset = 43; + UI_MAP.Button.Town = { UI_MAP.BorderRegion.x + 228, UI_MAP.BorderRegion.y + 612 }; + UI_MAP.Button.Mine = { UI_MAP.Button.Town.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Teams = { UI_MAP.Button.Mine.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Militia = { UI_MAP.Button.Teams.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Airspace = { UI_MAP.Button.Militia.iX + xOffset, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Inventory = { UI_MAP.Button.Airspace.iX + xOffset, UI_MAP.Button.Town.iY }; + + UI_MAP.Button.Disease = { UI_MAP.BorderRegion.x + 560, UI_MAP.Button.Town.iY }; + UI_MAP.Button.Weather_Y = UI_MAP.Button.Town.iY; + UI_MAP.Button.Intel_Y = UI_MAP.Button.Town.iY; + UI_MAP.LevelMarkerArea = { UI_MAP.BorderRegion.x + 495, UI_MAP.Button.Town.iY, 55, 8 }; + } } diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index 2c0465f0..c17ef7b1 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -35,10 +35,6 @@ enum{ // HEADROCK HAM 4: Turned these into EXTERNS to allow dynamic modification //#define MAP_LEVEL_MARKER_X (MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 114)) //MAP_BORDER_X + MAP_BORDER_X_OFFSET + 384 //(SCREEN_WIDTH - 75) //565 -extern UINT16 MAP_LEVEL_MARKER_X; -extern UINT16 MAP_LEVEL_MARKER_Y; -extern UINT16 MAP_LEVEL_MARKER_DELTA; -extern UINT16 MAP_LEVEL_MARKER_WIDTH; extern BOOLEAN fShowTownFlag; extern BOOLEAN fShowMineFlag; @@ -108,4 +104,7 @@ void MapBorderButtonOn( UINT8 ubBorderButtonIndex ); // HEADROCK HAM 4: Initialize coordinates for Map Border buttons void InitMapBorderButtonCoordinates(); +void DisableMapBorderButtons(void); +void EnableMapBorderButtons(void); + #endif \ No newline at end of file diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 3f4a53a0..f1a730c4 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -59,10 +59,40 @@ #include "connect.h" -/* CHRISL: Adjusted settings to allow new Map_Screen_Bottom_800x600.sti to work. This is needed if we -want to have the new inventory panel not overlap the message text area. */ -#define MAP_BOTTOM_X 0 -#define MAP_BOTTOM_Y (SCREEN_HEIGHT - 121) //359 + +struct UILayout_BottomButtons +{ + SGPPoint CompressTime; + SGPPoint CompressLess; + SGPPoint Laptop; + SGPPoint Options; + SGPPoint Tactical; + SGPPoint ScrollUp; + SGPPoint ScrollDown; +}; +struct UILayout_BottomTexts +{ + SGPRectangle BalanceTitle; + SGPRectangle IncomeTitle; + SGPRectangle ExpensesTitle; + SGPRectangle CurrentBalance; + SGPRectangle CurrentIncome; + SGPRectangle CurrentExpenses; + SGPRectangle CompressTime; + SGPRectangle LoadedSector; +}; +struct BottomUILayout +{ + SGPRectangle Region; + UILayout_BottomButtons Button; + UILayout_BottomTexts Text; +}; + +BottomUILayout UI_BOTTOM; +UINT16 UI_BOTTOM_X; +UINT16 UI_BOTTOM_Y; +UINT16 MAP_BOTTOM_LAPTOP_X; +UINT16 MAP_BOTTOM_LAPTOP_Y; //#define MESSAGE_SCROLL_AREA_START_X (SCREEN_WIDTH - 534) //330 //#define MESSAGE_SCROLL_AREA_END_X (SCREEN_WIDTH - 522) //344 @@ -240,6 +270,10 @@ void HandleLoadOfMapBottomGraphics( void ) { FilenameForBPP( "INTERFACE\\map_screen_bottom.sti", VObjectDesc.ImageFile ); } + else if (iResolution == _1280x720) + { + FilenameForBPP("INTERFACE\\map_screen_bottom_1280x720.sti", VObjectDesc.ImageFile); + } else if (iResolution < _1024x768) { FilenameForBPP( "INTERFACE\\map_screen_bottom_800x600.sti", VObjectDesc.ImageFile ); @@ -315,7 +349,7 @@ void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenFullRender ) // get and blt panel GetVideoObject(&hHandle, guiMAPBOTTOMPANEL ); - BltVideoObject( guiSAVEBUFFER , hHandle, 0, xResOffset + MAP_BOTTOM_X, MAP_BOTTOM_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( guiSAVEBUFFER , hHandle, 0, UI_BOTTOM.Region.x, UI_BOTTOM.Region.y, VO_BLT_SRCTRANSPARENCY,NULL ); // WANNE - MP: Radarmap image should be displayed on every sector in multiplayer game if( GetSectorFlagStatus( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE @@ -337,8 +371,7 @@ void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenFullRender ) // dirty buttons MarkButtonsDirty( ); - // TODO.RW.ARSP: Check: Is the height 121 OK? - RestoreExternBackgroundRect( xResOffset + MAP_BOTTOM_X, MAP_BOTTOM_Y, SCREEN_WIDTH - MAP_BOTTOM_X - 2 * xResOffset, 121 ); + RestoreExternBackgroundRect(UI_BOTTOM.Region); // re render radar map RenderRadarScreen( ); @@ -392,20 +425,20 @@ BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ) { // laptop guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,6,-1,15,-1 ); - guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], xResOffset + (xResSize - 184), (SCREEN_HEIGHT - 70), + guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], UI_BOTTOM.Button.Laptop.iX, UI_BOTTOM.Button.Laptop.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnLaptopCallback); // tactical guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,7,-1,16,-1 ); - guiMapBottomExitButtons[ MAP_EXIT_TO_TACTICAL ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ], xResOffset + (xResSize - 144), (SCREEN_HEIGHT - 70), - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, - (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalCallback); + guiMapBottomExitButtons[ MAP_EXIT_TO_TACTICAL ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ], UI_BOTTOM.Button.Tactical.iX, UI_BOTTOM.Button.Tactical.iY, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalCallback); // options guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,18,-1,19,-1 ); - guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], xResOffset + (xResSize - 182), (SCREEN_HEIGHT - 108), + guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], UI_BOTTOM.Button.Options.iX, UI_BOTTOM.Button.Options.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnOptionsFromMapScreenCallback); @@ -421,12 +454,12 @@ BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ) // time compression buttons guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 ); - guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], xResOffset + (xResSize - 112), (SCREEN_HEIGHT - 24), + guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], UI_BOTTOM.Button.CompressTime.iX, UI_BOTTOM.Button.CompressTime.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2 , (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressMoreMapScreenCallback); guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 ); - guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], xResOffset + (xResSize - 174), (SCREEN_HEIGHT - 24), + guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], UI_BOTTOM.Button.CompressLess.iX, UI_BOTTOM.Button.CompressLess.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressLessMapScreenCallback); @@ -443,10 +476,10 @@ BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void ) guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); - guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], xResOffset + (xResSize - 306), (SCREEN_HEIGHT - 109), + guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], UI_BOTTOM.Button.ScrollUp.iX, UI_BOTTOM.Button.ScrollUp.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpMapScreenCallback); - guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], xResOffset + (xResSize - 306), (SCREEN_HEIGHT - 28), + guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], UI_BOTTOM.Button.ScrollDown.iX, UI_BOTTOM.Button.ScrollDown.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownMapScreenCallback); @@ -630,7 +663,13 @@ void DrawNameOfLoadedSector( void ) GetSectorIDString( sSelMapX, sSelMapY, ( INT8 )( iCurrentMapSectorZ ),sString, TRUE ); ReduceStringLength( sString, 80, COMPFONT ); - VarFindFontCenterCoordinates( xResOffset + (xResSize - 92), (SCREEN_HEIGHT - 55), 80, 16, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates( + UI_BOTTOM.Text.LoadedSector.x, + UI_BOTTOM.Text.LoadedSector.y, + UI_BOTTOM.Text.LoadedSector.width, + UI_BOTTOM.Text.LoadedSector.height, + COMPFONT, &sFontX, &sFontY, sString + ); mprintf( sFontX, sFontY, L"%s", sString ); } @@ -975,7 +1014,7 @@ void DisplayCompressMode( void ) } // ABCDEFG - RestoreExternBackgroundRect( xResOffset + (xResSize - 151), (SCREEN_HEIGHT - 24), 63, 13 ); + RestoreExternBackgroundRect(UI_BOTTOM.Text.CompressTime); SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); SetFont( COMPFONT ); @@ -1001,7 +1040,7 @@ void DisplayCompressMode( void ) SetFontForeground( usColor ); SetFontBackground( FONT_BLACK ); - FindFontCenterCoordinates( xResOffset + (xResSize - 151), (SCREEN_HEIGHT - 24), 33, 13, sString, COMPFONT, &sX, &sY ); + FindFontCenterCoordinates(UI_BOTTOM.Text.CompressTime.x, UI_BOTTOM.Text.CompressTime.y, 33, 13, sString, COMPFONT, &sX, &sY ); mprintf( sX, sY, sString ); @@ -1011,7 +1050,11 @@ void DisplayCompressMode( void ) void CreateCompressModePause( void ) { - MSYS_DefineRegion( &gMapPauseRegion, xResOffset + (xResSize - 153), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 118), (SCREEN_HEIGHT - 13), MSYS_PRIORITY_HIGH, + const auto tlx = UI_BOTTOM.Text.CompressTime.x; + const auto tly = UI_BOTTOM.Text.CompressTime.y; + const auto brx = tlx + UI_BOTTOM.Text.CompressTime.width; + const auto bry = tly + UI_BOTTOM.Text.CompressTime.height; + MSYS_DefineRegion( &gMapPauseRegion, tlx, tly, brx, bry, MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressModeClickCallback ); SetRegionFastHelpText( &gMapPauseRegion, pMapScreenBottomFastHelp[ 7 ] ); @@ -1043,12 +1086,21 @@ void DeleteMessageSliderBar( void ) 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( &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 + 16), MESSAGE_SCROLL_AREA_START_Y-16, MESSAGE_SCROLL_AREA_END_X-22, MESSAGE_SCROLL_AREA_END_Y+12, - MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); + MSYS_DefineRegion( &gMapMessageRegion, + UI_BOTTOM.Region.x + 16, + MESSAGE_SCROLL_AREA_START_Y-16, + MESSAGE_SCROLL_AREA_END_X-22, + MESSAGE_SCROLL_AREA_END_Y+12, + MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK + ); } @@ -1462,12 +1514,7 @@ void DisplayCurrentBalanceTitleForMapBottom( void ) swprintf( sString, L"%s", pMapScreenBottomText[ 0 ] ); // center it - // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen - //VarFindFontCenterCoordinates( (1024 - 637), (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); - // CHRISL: Use this if we want to display from the left edge - //VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); - // HEADROCK HAM 3.6: The balance/income box has been moved to the right side, near the laptop button. - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 111), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates(UI_BOTTOM.Text.BalanceTitle.x, UI_BOTTOM.Text.BalanceTitle.y, UI_BOTTOM.Text.BalanceTitle.width, UI_BOTTOM.Text.BalanceTitle.height, COMPFONT, &sFontX, &sFontY, sString ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1475,12 +1522,7 @@ void DisplayCurrentBalanceTitleForMapBottom( void ) swprintf( sString, L"%s", zMarksMapScreenText[ 2 ] ); // center it - // CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen - //VarFindFontCenterCoordinates( (1024 - 637), (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); - // CHRISL: Use this if we want to display from the left edge - //VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); - // HEADROCK HAM 3.6: The balance/income box has been moved to the right side, near the laptop button. - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 74), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates(UI_BOTTOM.Text.IncomeTitle.x, UI_BOTTOM.Text.IncomeTitle.y, UI_BOTTOM.Text.IncomeTitle.width, UI_BOTTOM.Text.IncomeTitle.height, COMPFONT, &sFontX, &sFontY, sString ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1489,7 +1531,7 @@ void DisplayCurrentBalanceTitleForMapBottom( void ) // HEADROCK HAM 3.6: Projected expenses for today, with facilities (and in the future, merc contracts) taken into // account. - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 37), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates(UI_BOTTOM.Text.ExpensesTitle.x, UI_BOTTOM.Text.ExpensesTitle.y, UI_BOTTOM.Text.ExpensesTitle.width, UI_BOTTOM.Text.ExpensesTitle.height, COMPFONT, &sFontX, &sFontY, sString ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1520,7 +1562,13 @@ void DisplayCurrentBalanceForMapBottom( void ) InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 95), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates( + UI_BOTTOM.Text.CurrentBalance.x, + UI_BOTTOM.Text.CurrentBalance.y, + UI_BOTTOM.Text.CurrentBalance.width, + UI_BOTTOM.Text.CurrentBalance.height, + COMPFONT, &sFontX, &sFontY, sString + ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1549,16 +1597,31 @@ void CreateDestroyMouseRegionMasksForTimeCompressionButtons( void ) if( ( fDisabled ) && ( fCreated == FALSE ) ) { // mask over compress more button - MSYS_DefineRegion( &gTimeCompressionMask[ 0 ], xResOffset + (xResSize - 112), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 112) + 13, (SCREEN_HEIGHT - 24) + 16, MSYS_PRIORITY_HIGHEST - 1, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback ); + MSYS_DefineRegion( &gTimeCompressionMask[ 0 ], + UI_BOTTOM.Button.CompressTime.iX, + UI_BOTTOM.Button.CompressTime.iY, + UI_BOTTOM.Button.CompressTime.iX + 13, + UI_BOTTOM.Button.CompressTime.iY + 16, + MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback + ); // mask over compress less button - MSYS_DefineRegion( &gTimeCompressionMask[ 1 ], xResOffset + (xResSize - 174), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 174) + 13, (SCREEN_HEIGHT - 24) + 16, MSYS_PRIORITY_HIGHEST - 1, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback ); + MSYS_DefineRegion( &gTimeCompressionMask[ 1 ], + UI_BOTTOM.Button.CompressLess.iX, + UI_BOTTOM.Button.CompressLess.iY, + UI_BOTTOM.Button.CompressLess.iX + 13, + UI_BOTTOM.Button.CompressLess.iY + 16, + MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback + ); // mask over pause game button - MSYS_DefineRegion( &gTimeCompressionMask[ 2 ], xResOffset + (xResSize - 153), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 153) + 118, (SCREEN_HEIGHT - 13), MSYS_PRIORITY_HIGHEST - 1, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback ); + MSYS_DefineRegion( &gTimeCompressionMask[ 2 ], + UI_BOTTOM.Text.CompressTime.x, + UI_BOTTOM.Text.CompressTime.y, + UI_BOTTOM.Text.CompressTime.width, + UI_BOTTOM.Text.CompressTime.height, + MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback + ); RemoveMouseRegionForPauseOfClock(); fCreated = TRUE; } @@ -1618,7 +1681,13 @@ void DisplayProjectedDailyMineIncome( void ) InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 58), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates( + UI_BOTTOM.Text.CurrentIncome.x, + UI_BOTTOM.Text.CurrentIncome.y, + UI_BOTTOM.Text.CurrentIncome.width, + UI_BOTTOM.Text.CurrentIncome.height, + COMPFONT, &sFontX, &sFontY, sString + ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -1669,7 +1738,13 @@ void DisplayProjectedDailyExpenses( void ) InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - VarFindFontCenterCoordinates( xResOffset + (xResSize - 278), (SCREEN_HEIGHT - 21), 78, 10, COMPFONT, &sFontX, &sFontY, sString ); + VarFindFontCenterCoordinates( + UI_BOTTOM.Text.CurrentExpenses.x, + UI_BOTTOM.Text.CurrentExpenses.y, + UI_BOTTOM.Text.CurrentExpenses.width, + UI_BOTTOM.Text.CurrentExpenses.height, + COMPFONT, &sFontX, &sFontY, sString + ); // print it mprintf( sFontX, sFontY, L"%s", sString ); @@ -2066,10 +2141,74 @@ void ChangeCurrentMapscreenMessageIndex( UINT8 ubNewMessageIndex ) fMapScreenBottomDirty = TRUE; } + void InitMapScreenInterfaceBottomCoords( void ) { - // HEADROCK HAM 3.6: Message window is now as wide as possible. - MESSAGE_SCROLL_AREA_START_X = xResOffset + xResSize - 307; - MESSAGE_SCROLL_AREA_END_X = xResOffset + xResSize - 293; -} + if (isWidescreenUI()) + { + UI_BOTTOM.Region = { 0, (SCREEN_HEIGHT - 116), 1280, 116 }; + const auto x = UI_BOTTOM.Region.x; + const auto y = UI_BOTTOM.Region.y; + const auto width = UI_BOTTOM.Region.width; + const auto height = UI_BOTTOM.Region.height; + UI_BOTTOM.Text.CompressTime = { x + 1129, y + 94, 34, 13 }; + UI_BOTTOM.Text.BalanceTitle = { x + 1002, y + 5, 78, 10 }; + UI_BOTTOM.Text.IncomeTitle = { x + 1002, y + 42, 78, 10 }; + UI_BOTTOM.Text.ExpensesTitle = { x + 1002, y + 79, 78, 10 }; + UI_BOTTOM.Text.CurrentBalance= { x + 1002, y + 22, 78, 10 }; + UI_BOTTOM.Text.CurrentIncome= { x + 1002, y + 59, 78, 10 }; + UI_BOTTOM.Text.CurrentExpenses= { x + 1002, y + 96, 78, 10 }; + UI_BOTTOM.Text.LoadedSector = { x + (width - 92), y + (height - 55), 80, 16, }; + UI_BOTTOM.Button.CompressTime = { x + 1168, y + 94 }; + UI_BOTTOM.Button.CompressLess = { x + 1106, y + 94 }; + UI_BOTTOM.Button.Laptop = { x + 1096, y + 48 }; + UI_BOTTOM.Button.Options = { x + 1098, y + 10 }; + UI_BOTTOM.Button.Tactical = { x + 1136, y + 48 }; + UI_BOTTOM.Button.ScrollUp = { x + 718, y + 9 }; + UI_BOTTOM.Button.ScrollDown = { x + 718, y + 90 }; + + // For external use + UI_BOTTOM_X = x; + UI_BOTTOM_Y = y; + MAP_BOTTOM_LAPTOP_X = UI_BOTTOM.Button.Laptop.iX; + MAP_BOTTOM_LAPTOP_Y = UI_BOTTOM.Button.Laptop.iY; + + // HEADROCK HAM 3.6: Message window is now as wide as possible. + MESSAGE_SCROLL_AREA_START_X = x + 718; + MESSAGE_SCROLL_AREA_END_X = x + 732; + } + else + { + UI_BOTTOM.Region = { xResOffset, (SCREEN_HEIGHT - 121), xResSize, 121 }; + const auto x = UI_BOTTOM.Region.x; + const auto y = UI_BOTTOM.Region.y; + const auto width = UI_BOTTOM.Region.width; + const auto height = UI_BOTTOM.Region.height; + UI_BOTTOM.Text.CompressTime = { x + width - 153, y + 96, 34, 13 }; + UI_BOTTOM.Text.BalanceTitle = { x + width - 278, y + 10, 78, 10 }; + UI_BOTTOM.Text.IncomeTitle = { x + width - 278, y + 47, 78, 10 }; + UI_BOTTOM.Text.ExpensesTitle = { x + width - 278, y + 84, 78, 10 }; + UI_BOTTOM.Text.CurrentBalance = { x + width - 278, y + height - 94, 78, 10 }; + UI_BOTTOM.Text.CurrentIncome = { x + width - 278, y + height - 57, 78, 10 }; + UI_BOTTOM.Text.CurrentExpenses = { x + width - 278, y + height - 20, 78, 10 }; + UI_BOTTOM.Text.LoadedSector = { x + (width - 92), y + (height - 55), 80, 16, }; + + UI_BOTTOM.Button.CompressTime = { x + (width - 112), y + 97 }; + UI_BOTTOM.Button.CompressLess = { x + (width - 174), y + 97 }; + UI_BOTTOM.Button.Laptop = { x + (width - 184), y + 51 }; + UI_BOTTOM.Button.Options = { x + (width - 182), y + 13 }; + UI_BOTTOM.Button.Tactical = { x + (width - 144), y + 51 }; + UI_BOTTOM.Button.ScrollUp = { x + (width - 306), y + 12 }; + UI_BOTTOM.Button.ScrollDown = { x + (width - 306), y + 93 }; + + UI_BOTTOM_X = x; + UI_BOTTOM_Y = y; + MAP_BOTTOM_LAPTOP_X = UI_BOTTOM.Button.Laptop.iX; + MAP_BOTTOM_LAPTOP_Y = UI_BOTTOM.Button.Laptop.iY; + + // HEADROCK HAM 3.6: Message window is now as wide as possible. + MESSAGE_SCROLL_AREA_START_X = xResOffset + xResSize - 307; + MESSAGE_SCROLL_AREA_END_X = xResOffset + xResSize - 293; + } +} diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 62ec5839..3c239101 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -49,12 +49,63 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +extern UILayout_Map UI_MAP; // Flugente: external sector data extern SECTOR_EXT_DATA SectorExternalData[256][4]; extern void SetLastTimePlayerWasInSector(INT16 sMapX, INT16 sMapY, INT8 sMapZ); // Flugente: set last time sector was visited +UINT16 MAPINV_NEXT_X; +UINT16 MAPINV_PREV_X; +UINT16 MAPINV_ARROW_Y; +UINT16 MAPINV_ZOOM_X; +UINT16 MAPINV_ZOOM_Y; +UINT16 MAPINV_STACK_X; +UINT16 MAPINV_STACK_Y; +UINT16 MAPINV_SORT_AMMO_X; +UINT16 MAPINV_SORT_AMMO_Y; +UINT16 MAPINV_SORT_ATT_X; +UINT16 MAPINV_SORT_ATT_Y; +UINT16 MAPINV_EJECT_AMMO_X; +UINT16 MAPINV_EJECT_AMMO_Y; +UINT16 MAPINV_FILTER_X; +UINT16 MAPINV_FILTER_Y; +UINT16 MAPINV_FILTER_AMMO_X; +UINT16 MAPINV_FILTER_AMMO_Y; +UINT16 MAPINV_FILTER_GUN_X; +UINT16 MAPINV_FILTER_GUN_Y; +UINT16 MAPINV_FILTER_EXPLOSIVE_X; +UINT16 MAPINV_FILTER_EXPLOSIVE_Y; +UINT16 MAPINV_FILTER_MELEE_X; +UINT16 MAPINV_FILTER_MELEE_Y; +UINT16 MAPINV_FILTER_ARMOR_X; +UINT16 MAPINV_FILTER_ARMOR_Y; +UINT16 MAPINV_FILTER_LBE_X; +UINT16 MAPINV_FILTER_LBE_Y; +UINT16 MAPINV_FILTER_KIT_X; +UINT16 MAPINV_FILTER_KIT_Y; +UINT16 MAPINV_FILTER_MISC1_X; +UINT16 MAPINV_FILTER_MISC1_Y; +UINT16 MAPINV_FILTER_MISC2_X; +UINT16 MAPINV_FILTER_MISC2_Y; +UINT16 MAPINV_FILTER_SAVE_TEMPLATE_X; +UINT16 MAPINV_FILTER_SAVE_TEMPLATE_Y; +UINT16 MAPINV_FILTER_LOAD_TEMPLATE_X; +UINT16 MAPINV_FILTER_LOAD_TEMPLATE_Y; +UINT16 MAPINV_DONE_X; +UINT16 MAPINV_DONE_y; +UINT16 MAPINV_ITEMPOOL_X; +UINT16 MAPINV_ITEMPOOL_Y; +UINT16 MAPINV_PAGE_X; +UINT16 MAPINV_PAGE_Y; +UINT16 MAPINV_SECTOR_X; +UINT16 MAPINV_SECTOR_Y; +UINT16 MAPINV_LOC_STR_X; +UINT16 MAPINV_LOC_STR_Y; +UINT16 MAPINV_ITEMPOOL_STR_X; +UINT16 MAPINV_ITEMPOOL_STR_Y; + //dnl ch51 081009 UINT8 gInventoryPoolIndex = '0'; std::vector pInventoryPoolListQ[INVPOOLLISTNUM]; @@ -355,6 +406,7 @@ BOOLEAN MapInventoryFilterMenuPopup_OptionOff( void ); void MapInventoryFilterToggle( UINT32 uiFlags ); void MapInventoryFilterSet( UINT32 uiFlags ); void HandleSetFilterButtons(); +void InitMapInventoryCoordinates(void); //dnl ch75 271013 ClearAllItemPools and RefreshItemPools are relocated from "Handle Items.cpp" void ClearAllItemPools() @@ -394,29 +446,22 @@ BOOLEAN LoadInventoryPoolGraphic( void ) if (iResolution >= _640x480 && iResolution < _800x600) { - MAP_INV_SLOT_COLS = 8; - MAP_INVENTORY_POOL_SLOT_COUNT = 40; - MAP_INVENTORY_POOL_SLOT_START_X = 269 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 51 + yResOffset; sprintf( VObjectDesc.ImageFile, "INTERFACE\\sector_inventory.sti" ); } + else if (iResolution == _1280x720) + { + sprintf(VObjectDesc.ImageFile, "INTERFACE\\sector_inventory_1280x720.sti"); + } else if (iResolution < _1024x768) { - MAP_INV_SLOT_COLS = 11; - MAP_INVENTORY_POOL_SLOT_COUNT = 77; - MAP_INVENTORY_POOL_SLOT_START_X = (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + 278 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 62 + yResOffset; sprintf( VObjectDesc.ImageFile, "INTERFACE\\sector_inventory_800x600.sti" ); } else { - MAP_INV_SLOT_COLS = 17; - MAP_INVENTORY_POOL_SLOT_COUNT = MAP_INVENTORY_POOL_MAX_SLOTS; - MAP_INVENTORY_POOL_SLOT_START_X = (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + 282 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 50 + yResOffset; sprintf( VObjectDesc.ImageFile, "INTERFACE\\sector_inventory_1024x768.sti" ); } + // add to V-object index CHECKF(AddVideoObject(&VObjectDesc, &guiMapInventoryPoolBackground)); @@ -428,6 +473,8 @@ BOOLEAN LoadInventoryPoolGraphic( void ) sprintf( VObjectDesc.ImageFile, "INTERFACE\\Attachment_Asterisks.sti" ); CHECKF(AddVideoObject(&VObjectDesc, &guiAttachmentAsterisks)); + + ResetMapInventoryOffsets(); return( TRUE ); } @@ -467,7 +514,7 @@ void BlitInventoryPoolGraphic( void ) // blit inventory pool graphic to the screen GetVideoObject(&hHandle, guiMapInventoryPoolBackground); - BltVideoObject( guiSAVEBUFFER , hHandle, 0,(SCREEN_WIDTH - INTERFACE_WIDTH)/2 + INVEN_POOL_X, yResOffset + INVEN_POOL_Y , VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( guiSAVEBUFFER , hHandle, 0, UI_MAP.BorderRegion.x, UI_MAP.BorderRegion.y, VO_BLT_SRCTRANSPARENCY,NULL ); // HEADROCK HAM 5: Draw inventory slots BlitInventoryPoolSlotGraphics(); @@ -500,7 +547,7 @@ void BlitInventoryPoolGraphic( void ) HandleButtonStatesWhileMapInventoryActive( ); // Invalidate - RestoreExternBackgroundRect(xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset, SCREEN_HEIGHT - 121 - 2 * yResOffset); + RestoreExternBackgroundRect(UI_MAP.BorderRegion.x, UI_MAP.BorderRegion.y, SCREEN_WIDTH, SCREEN_HEIGHT - 121); return; } @@ -853,7 +900,14 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen ) } // destroy buttons for map border - DeleteMapBorderButtons( ); + if (isWidescreenUI()) + { + DisableMapBorderButtons(); + } + else + { + DeleteMapBorderButtons( ); + } // delete map level markers regions DeleteMouseRegionsForLevelMarkers( ); @@ -893,12 +947,18 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen ) if(gGameExternalOptions.fEnableInventoryPoolQ)//dnl ch51 081009 SwitchToInventoryPoolQ(0); - // check fi we are in fact leaving mapscreen + // check if we are in fact leaving mapscreen if( fExitFromMapScreen == FALSE ) { // recreate mapborder buttons - CreateButtonsForMapBorder( ); - + if (isWidescreenUI()) + { + EnableMapBorderButtons(); + } + else + { + CreateButtonsForMapBorder(); + } // recreate map level markers regions CreateMouseRegionsForLevelMarkers( ); } @@ -965,7 +1025,6 @@ void CreateDestroyMapInventoryPoolButtons( BOOLEAN fExitFromMapScreen ) // do our handling here HandleMapSectorInventory( ); - } @@ -1420,7 +1479,10 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // access description box directly if CTRL is pressed for stack items else if((twItem->object.ubNumberOfObjects == 1 || _KeyDown( CTRL )) && fValidPointer) { - fShowInventoryFlag = TRUE; + if (!isWidescreenUI()) + { + fShowInventoryFlag = TRUE; + } if (InItemDescriptionBox( )) { @@ -1762,14 +1824,16 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) void CreateMapInventoryButtons( void ) { + InitMapInventoryCoordinates(); + guiMapInvenArrowButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" , 10, 1, -1, 3, -1 ); - guiMapInvenArrowButton[ 0 ] = QuickCreateButton( guiMapInvenArrowButtonImage[ 0 ], (MAP_INV_X_OFFSET + 559), (SCREEN_HEIGHT - 144 - yResOffset), + guiMapInvenArrowButton[ 0 ] = QuickCreateButton( guiMapInvenArrowButtonImage[ 0 ], MAPINV_NEXT_X, MAPINV_ARROW_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)MapInventoryPoolNextBtn ); guiMapInvenArrowButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9, 0, -1, 2, -1 ); - guiMapInvenArrowButton[ 1 ] = QuickCreateButton( guiMapInvenArrowButtonImage[ 1 ], (MAP_INV_X_OFFSET + 487), (SCREEN_HEIGHT - 144 - yResOffset), + guiMapInvenArrowButton[ 1 ] = QuickCreateButton( guiMapInvenArrowButtonImage[ 1 ], MAPINV_PREV_X, MAPINV_ARROW_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)MapInventoryPoolPrevBtn ); @@ -1783,7 +1847,7 @@ void CreateMapInventoryButtons( void ) if (iResolution >= _800x600 ) { guiMapInvenZoomButtonImage = LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 0, 0, -1, 1, -1 ); - guiMapInvenZoomButton = QuickCreateButton( guiMapInvenZoomButtonImage, INVEN_POOL_X+10 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenZoomButton = QuickCreateButton( guiMapInvenZoomButtonImage, MAPINV_ZOOM_X, MAPINV_ZOOM_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolZoomBtn ); @@ -1797,7 +1861,7 @@ void CreateMapInventoryButtons( void ) // HEADROCK HAM 5: Stack and Merge button guiMapInvenSortButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 16, 14, -1, 15, -1 ); - guiMapInvenSortButton[ 0 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 0 ], INVEN_POOL_X+50 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenSortButton[ 0 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 0 ], MAPINV_STACK_X, MAPINV_STACK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolStackAndMergeBtn ); @@ -1805,7 +1869,7 @@ void CreateMapInventoryButtons( void ) // HEADROCK HAM 5: Sort Ammo Button guiMapInvenSortButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 4, 2, -1, 3, -1 ); - guiMapInvenSortButton[ 1 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 1 ], INVEN_POOL_X+80 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenSortButton[ 1 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 1 ], MAPINV_SORT_AMMO_X, MAPINV_SORT_AMMO_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolSortAmmoBtn ); @@ -1813,15 +1877,15 @@ void CreateMapInventoryButtons( void ) // HEADROCK HAM 5: Sort Attachments Button guiMapInvenSortButtonImage[ 2 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 10, 8, -1, 9, -1 ); - guiMapInvenSortButton[ 2 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 2 ], INVEN_POOL_X+110 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenSortButton[ 2 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 2 ], MAPINV_SORT_ATT_X, MAPINV_SORT_ATT_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolSortAttachmentsBtn ); SetButtonFastHelpText( guiMapInvenSortButton[ 2 ], pMapScreenInvenButtonHelpText[ 6 ] ); - // HEADROCK HAM 5: Sort Attachments Button + // HEADROCK HAM 5: Eject Ammo Button guiMapInvenSortButtonImage[ 3 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 13, 11, -1, 12, -1 ); - guiMapInvenSortButton[ 3 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 3 ], INVEN_POOL_X+140 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenSortButton[ 3 ] = QuickCreateButton( guiMapInvenSortButtonImage[ 3 ], MAPINV_EJECT_AMMO_X, MAPINV_EJECT_AMMO_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolEjectAmmoBtn ); @@ -1829,7 +1893,7 @@ void CreateMapInventoryButtons( void ) // HEADROCK HAM 5: Filter Toggle Button guiMapInvenFilterButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 7, 5, -1, 6, -1 ); - guiMapInvenFilterButton[ 0 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 0 ], INVEN_POOL_X+185 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 0 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 0 ], MAPINV_FILTER_X, MAPINV_FILTER_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1841,7 +1905,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[0] = TRUE; guiMapInvenFilterButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 20, 20, -1, 21, -1 ); - guiMapInvenFilterButton[ 1 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 1 ], INVEN_POOL_X+214 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 1 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 1 ], MAPINV_FILTER_GUN_X, MAPINV_FILTER_GUN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1853,7 +1917,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[1] = TRUE; guiMapInvenFilterButtonImage[ 2 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 22, 22, -1, 23, -1 ); - guiMapInvenFilterButton[ 2 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 2 ], INVEN_POOL_X+214 + xResOffset, INVEN_POOL_Y + 24 + yResOffset, + guiMapInvenFilterButton[ 2 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 2 ], MAPINV_FILTER_AMMO_X, MAPINV_FILTER_AMMO_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1865,7 +1929,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[2] = TRUE; guiMapInvenFilterButtonImage[ 3 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 24, 24, -1, 25, -1 ); - guiMapInvenFilterButton[ 3 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 3 ], INVEN_POOL_X+243 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 3 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 3 ], MAPINV_FILTER_EXPLOSIVE_X, MAPINV_FILTER_EXPLOSIVE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1877,7 +1941,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[3] = TRUE; guiMapInvenFilterButtonImage[ 4 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 26, 26, -1, 27, -1 ); - guiMapInvenFilterButton[ 4 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 4 ], INVEN_POOL_X+243 + xResOffset, INVEN_POOL_Y + 24 + yResOffset, + guiMapInvenFilterButton[ 4 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 4 ], MAPINV_FILTER_MELEE_X, MAPINV_FILTER_MELEE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1889,7 +1953,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[4] = TRUE; guiMapInvenFilterButtonImage[ 5 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 28, 28, -1, 29, -1 ); - guiMapInvenFilterButton[ 5 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 5 ], INVEN_POOL_X+272 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 5 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 5 ], MAPINV_FILTER_ARMOR_X, MAPINV_FILTER_ARMOR_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1901,7 +1965,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[5] = TRUE; guiMapInvenFilterButtonImage[ 6 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 30, 30, -1, 31, -1 ); - guiMapInvenFilterButton[ 6 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 6 ], INVEN_POOL_X+272 + xResOffset, INVEN_POOL_Y + 24 + yResOffset, + guiMapInvenFilterButton[ 6 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 6 ], MAPINV_FILTER_LBE_X, MAPINV_FILTER_LBE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1913,7 +1977,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[6] = TRUE; guiMapInvenFilterButtonImage[ 7 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 32, 32, -1, 33, -1 ); - guiMapInvenFilterButton[ 7 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 7 ], INVEN_POOL_X+301 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 7 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 7 ], MAPINV_FILTER_KIT_X, MAPINV_FILTER_KIT_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1925,7 +1989,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[7] = TRUE; guiMapInvenFilterButtonImage[ 8 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 34, 34, -1, 35, -1 ); - guiMapInvenFilterButton[ 8 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 8 ], INVEN_POOL_X+301 + xResOffset, INVEN_POOL_Y + 24 + yResOffset, + guiMapInvenFilterButton[ 8 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 8 ], MAPINV_FILTER_MISC1_X, MAPINV_FILTER_MISC1_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtn ); @@ -1938,7 +2002,7 @@ void CreateMapInventoryButtons( void ) // Flugente: toggle button for move item display guiMapInvenFilterButtonImage[ 9 ]= LoadButtonImage( "INTERFACE\\sector_inventory_buttons.sti" , 36, 36, -1, 37, -1 ); - guiMapInvenFilterButton[ 9 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 9 ], INVEN_POOL_X+336 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[ 9 ] = QuickCreateButton( guiMapInvenFilterButtonImage[ 9 ], MAPINV_FILTER_MISC2_X, MAPINV_FILTER_MISC2_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryPoolFilterBtnMoveItemDisplay ); @@ -1956,7 +2020,7 @@ void CreateMapInventoryButtons( void ) { // Flugente: gear templates guiMapInvenFilterButtonImage[10] = LoadButtonImage("INTERFACE\\sector_inventory_buttons.sti", 40, 40, -1, 40, -1); - guiMapInvenFilterButton[10] = QuickCreateButton(guiMapInvenFilterButtonImage[10], INVEN_POOL_X + 371 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[10] = QuickCreateButton(guiMapInvenFilterButtonImage[10], MAPINV_FILTER_SAVE_TEMPLATE_X, MAPINV_FILTER_SAVE_TEMPLATE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryWriteEquipmentTemplate); @@ -1964,7 +2028,7 @@ void CreateMapInventoryButtons( void ) guiMapInvenFilterButtonDefined[10] = TRUE; guiMapInvenFilterButtonImage[11] = LoadButtonImage("INTERFACE\\sector_inventory_buttons.sti", 42, 42, -1, 42, -1); - guiMapInvenFilterButton[11] = QuickCreateButton(guiMapInvenFilterButtonImage[11], INVEN_POOL_X + 406 + xResOffset, INVEN_POOL_Y + 10 + yResOffset, + guiMapInvenFilterButton[11] = QuickCreateButton(guiMapInvenFilterButtonImage[11], MAPINV_FILTER_LOAD_TEMPLATE_X, MAPINV_FILTER_LOAD_TEMPLATE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, NULL, (GUI_CALLBACK)MapInventoryReadEquipmentTemplate); @@ -3145,7 +3209,7 @@ void DisplayPagesForMapInventoryPool( void ) swprintf( sString, L"%d / %d", iCurrentInventoryPoolPage + 1, iLastInventoryPoolPage + 1 ); // grab centered coords - FindFontCenterCoordinates(MAP_INVENTORY_POOL_PAGE_X, MAP_INVENTORY_POOL_PAGE_Y - yResOffset, MAP_INVENTORY_POOL_PAGE_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); + FindFontCenterCoordinates(MAPINV_PAGE_X, MAPINV_PAGE_Y, MAP_INVENTORY_POOL_PAGE_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); mprintf( sX, sY, sString ); @@ -3207,7 +3271,7 @@ void DrawNumberOfIventoryPoolItems( void ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // grab centered coords - FindFontCenterCoordinates(MAP_INVENTORY_POOL_NUMBER_X, MAP_INVENTORY_POOL_PAGE_Y - yResOffset, MAP_INVENTORY_POOL_NUMBER_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); + FindFontCenterCoordinates(MAPINV_ITEMPOOL_X, MAPINV_ITEMPOOL_Y, MAP_INVENTORY_POOL_NUMBER_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); mprintf( sX, sY, sString ); @@ -3221,7 +3285,7 @@ void CreateMapInventoryPoolDoneButton( void ) { // create done button guiMapInvenDoneButtonImage= LoadButtonImage( "INTERFACE\\done_button.sti" , -1, 0, -1, 1, -1 ); - guiMapInvenDoneButton = QuickCreateButton( guiMapInvenDoneButtonImage, MAP_INV_X_OFFSET + 587 , (yResSize - 147 + yResOffset), + guiMapInvenDoneButton = QuickCreateButton( guiMapInvenDoneButtonImage, MAPINV_DONE_X , MAPINV_DONE_y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)MapInventoryPoolDoneBtn ); @@ -3260,7 +3324,7 @@ void DisplayCurrentSector( void ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // grab centered coords - FindFontCenterCoordinates(MAP_INVENTORY_POOL_LOC_X, MAP_INVENTORY_POOL_PAGE_Y - yResOffset, MAP_INVENTORY_POOL_LOC_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); + FindFontCenterCoordinates(MAPINV_SECTOR_X, MAPINV_SECTOR_Y, MAP_INVENTORY_POOL_LOC_WIDTH ,MAP_INVENTORY_POOL_PAGE_HEIGHT ,sString , MAP_SCREEN_FONT, &sX, &sY); mprintf( sX, sY, sString ); @@ -3420,12 +3484,12 @@ void DrawTextOnMapInventoryBackground( void ) SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); //Calculate the height of the string, as it needs to be vertically centered. - usStringHeight = DisplayWrappedString(MAP_INV_X_OFFSET + 268, (SCREEN_HEIGHT - 138 - yResOffset), 53, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 0 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED | DONT_DISPLAY_TEXT ); - DisplayWrappedString(MAP_INV_X_OFFSET + 268, (UINT16)((SCREEN_HEIGHT - 138 - yResOffset) - (usStringHeight / 2) ), 53, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 0 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED ); + usStringHeight = DisplayWrappedString(MAPINV_LOC_STR_X, MAPINV_LOC_STR_Y, 53, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 0 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED | DONT_DISPLAY_TEXT ); + DisplayWrappedString(MAPINV_LOC_STR_X, MAPINV_LOC_STR_Y - (usStringHeight / 2) , 53, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 0 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED ); //Calculate the height of the string, as it needs to be vertically centered. - usStringHeight = DisplayWrappedString( MAP_INV_X_OFFSET + 369, (SCREEN_HEIGHT - 138 - yResOffset), 65, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 1 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED | DONT_DISPLAY_TEXT ); - DisplayWrappedString(MAP_INV_X_OFFSET + 369, (UINT16)((SCREEN_HEIGHT - 138 - yResOffset) - (usStringHeight / 2) ), 65, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 1 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED ); + usStringHeight = DisplayWrappedString(MAPINV_ITEMPOOL_STR_X, MAPINV_ITEMPOOL_STR_Y, 65, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 1 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED | DONT_DISPLAY_TEXT ); + DisplayWrappedString(MAPINV_ITEMPOOL_STR_X, MAPINV_ITEMPOOL_STR_Y - (usStringHeight / 2), 65, 1, MAP_IVEN_FONT, FONT_BEIGE, pMapInventoryStrings[ 1 ], FONT_BLACK, FALSE, RIGHT_JUSTIFIED ); // item filter buttons included in 640x480 /*if (iResolution < _800x600) @@ -3973,16 +4037,21 @@ BOOLEAN LoadInventoryPoolQ (UINT8 ubSaveGameID) UINT32 uiNumBytesRead; HWFILE hFile = 0; - if(MAP_INVENTORY_POOL_SLOT_COUNT <= 0) - { - if (iResolution >= _640x480 && iResolution < _800x600) - MAP_INVENTORY_POOL_SLOT_COUNT = 40; - else if (iResolution < _1024x768) - MAP_INVENTORY_POOL_SLOT_COUNT = 77; - else - MAP_INVENTORY_POOL_SLOT_COUNT = 170; - } - + //if(MAP_INVENTORY_POOL_SLOT_COUNT <= 0) + //{ + // if (iResolution >= _640x480 && iResolution < _800x600) + // MAP_INVENTORY_POOL_SLOT_COUNT = 40; + // else if (iResolution == _1280x720) + // { + // MAP_INVENTORY_POOL_SLOT_COUNT = MAP_INVENTORY_POOL_MAX_SLOTS; + // } + // else if (iResolution < _1024x768) + // MAP_INVENTORY_POOL_SLOT_COUNT = 77; + // else + // MAP_INVENTORY_POOL_SLOT_COUNT = 170; + //} + ResetMapInventoryOffsets(); + ret = FALSE; CreateSavedGameFileNameFromNumber(ubSaveGameID, tmpbuf); strcat(tmpbuf, ".IPQ"); @@ -4049,16 +4118,21 @@ BOOLEAN SaveInventoryPoolQ(UINT8 ubSaveGameID) UINT32 uiNumBytesWritten; HWFILE hFile; - if(MAP_INVENTORY_POOL_SLOT_COUNT <= 0) - { - if (iResolution >= _640x480 && iResolution < _800x600) - MAP_INVENTORY_POOL_SLOT_COUNT = 40; - else if (iResolution < _1024x768) - MAP_INVENTORY_POOL_SLOT_COUNT = 77; - else - MAP_INVENTORY_POOL_SLOT_COUNT = 170; - } - + //if(MAP_INVENTORY_POOL_SLOT_COUNT <= 0) + //{ + // if (iResolution >= _640x480 && iResolution < _800x600) + // MAP_INVENTORY_POOL_SLOT_COUNT = 40; + // else if (iResolution == _1280x720) + // { + // MAP_INVENTORY_POOL_SLOT_COUNT = MAP_INVENTORY_POOL_MAX_SLOTS; + // } + // else if (iResolution < _1024x768) + // MAP_INVENTORY_POOL_SLOT_COUNT = 77; + // else + // MAP_INVENTORY_POOL_SLOT_COUNT = 170; + //} + ResetMapInventoryOffsets(); + ret = FALSE; CreateSavedGameFileNameFromNumber(ubSaveGameID, tmpbuf); strcat(tmpbuf, ".IPQ"); @@ -4452,12 +4526,11 @@ void ResetMapInventoryOffsets( void ) { ////////////////////////////////////////////// // ZOOM OFF - - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() ||iResolution >= _1024x768) { - MAP_INV_SLOT_COLS = 8; - MAP_INVENTORY_POOL_SLOT_START_X = 269 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 51 + yResOffset; + MAP_INV_SLOT_COLS = 17; + MAP_INVENTORY_POOL_SLOT_START_X = UI_MAP.BorderRegion.x + 25; + MAP_INVENTORY_POOL_SLOT_START_Y = UI_MAP.BorderRegion.y + 51; } else if (iResolution >= _800x600 && iResolution < _1024x768) { @@ -4465,12 +4538,18 @@ void ResetMapInventoryOffsets( void ) MAP_INVENTORY_POOL_SLOT_START_X = 278 + xResOffset; MAP_INVENTORY_POOL_SLOT_START_Y = 62 + yResOffset; } - else if (iResolution >= _1024x768) + else { - MAP_INV_SLOT_COLS = 17; - MAP_INVENTORY_POOL_SLOT_START_X = 282 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 50 + yResOffset; + MAP_INV_SLOT_COLS = 8; + MAP_INVENTORY_POOL_SLOT_START_X = 269 + xResOffset; + MAP_INVENTORY_POOL_SLOT_START_Y = 51 + yResOffset; } + //else if (iResolution >= _1024x768) + //{ + // MAP_INV_SLOT_COLS = 17; + // MAP_INVENTORY_POOL_SLOT_START_X = 282 + xResOffset; + // MAP_INVENTORY_POOL_SLOT_START_Y = 50 + yResOffset; + //} MAP_INVENTORY_POOL_SLOT_COUNT = GetInventorySlotCount( FALSE ); ITEMDESC_ITEM_STATUS_HEIGHT_INV_POOL = 20; @@ -4493,11 +4572,11 @@ void ResetMapInventoryOffsets( void ) //////////////////////////////////// // ZOOM ON - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - MAP_INV_SLOT_COLS = 3; - MAP_INVENTORY_POOL_SLOT_START_X = 269 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 51 + yResOffset; + MAP_INV_SLOT_COLS = 8; + MAP_INVENTORY_POOL_SLOT_START_X = UI_MAP.BorderRegion.x + 25; + MAP_INVENTORY_POOL_SLOT_START_Y = UI_MAP.BorderRegion.y + 51; } else if (iResolution >= _800x600 && iResolution < _1024x768) { @@ -4505,12 +4584,18 @@ void ResetMapInventoryOffsets( void ) MAP_INVENTORY_POOL_SLOT_START_X = 278 + xResOffset; MAP_INVENTORY_POOL_SLOT_START_Y = 62 + yResOffset; } - else if (iResolution >= _1024x768) + else { - MAP_INV_SLOT_COLS = 8; - MAP_INVENTORY_POOL_SLOT_START_X = 282 + xResOffset; - MAP_INVENTORY_POOL_SLOT_START_Y = 50 + yResOffset; + MAP_INV_SLOT_COLS = 3; + MAP_INVENTORY_POOL_SLOT_START_X = 269 + xResOffset; + MAP_INVENTORY_POOL_SLOT_START_Y = 51 + yResOffset; } + //else if (iResolution >= _1024x768) + //{ + // MAP_INV_SLOT_COLS = 8; + // MAP_INVENTORY_POOL_SLOT_START_X = 282 + xResOffset; + // MAP_INVENTORY_POOL_SLOT_START_Y = 50 + yResOffset; + //} MAP_INVENTORY_POOL_SLOT_COUNT = GetInventorySlotCount( TRUE ); ITEMDESC_ITEM_STATUS_HEIGHT_INV_POOL = 40; @@ -4672,32 +4757,32 @@ UINT16 GetInventorySlotCount( BOOLEAN fZoomed ) { if (!fZoomed) { - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - return 40; + return MAP_INVENTORY_POOL_MAX_SLOTS; } - if (iResolution >= _800x600 && iResolution < _1024x768) + else if (iResolution >= _800x600 && iResolution < _1024x768) { return 77; } - if (iResolution >= _1024x768) + else { - return MAP_INVENTORY_POOL_MAX_SLOTS; + return 40; } } else { - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - return 6; + return 40; } - if (iResolution >= _800x600 && iResolution < _1024x768) + else if (iResolution >= _800x600 && iResolution < _1024x768) { return 15; } - if (iResolution >= _1024x768) + else { - return 40; + return 6; } } @@ -6239,3 +6324,158 @@ void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::v HandleItemCooldownFunctions( &(pWorldItem[ uiCount ].object), tickspassed * ( fUndo ? -NUM_SEC_PER_TACTICAL_TURN : NUM_SEC_PER_TACTICAL_TURN ), (sMapZ > 0) ); } } + + +void InitMapInventoryCoordinates(void) +{ + if (isWidescreenUI()) + { + MAPINV_NEXT_X = UI_MAP.BorderRegion.x + 679; + MAPINV_PREV_X = UI_MAP.BorderRegion.x + 607; + MAPINV_ARROW_Y = UI_MAP.BorderRegion.y + 19; + + MAPINV_ZOOM_X = UI_MAP.BorderRegion.x + 10; + MAPINV_ZOOM_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_STACK_X = UI_MAP.BorderRegion.x + 50; + MAPINV_STACK_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_SORT_AMMO_X = UI_MAP.BorderRegion.x + 80; + MAPINV_SORT_AMMO_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_SORT_ATT_X = UI_MAP.BorderRegion.x + 110; + MAPINV_SORT_ATT_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_EJECT_AMMO_X = UI_MAP.BorderRegion.x + 140; + MAPINV_EJECT_AMMO_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_X = UI_MAP.BorderRegion.x + 185; + MAPINV_FILTER_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_GUN_X = UI_MAP.BorderRegion.x + 214; + MAPINV_FILTER_GUN_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_AMMO_X = UI_MAP.BorderRegion.x + 214; + MAPINV_FILTER_AMMO_Y = UI_MAP.BorderRegion.y + 24; + + MAPINV_FILTER_EXPLOSIVE_X = UI_MAP.BorderRegion.x + 243; + MAPINV_FILTER_EXPLOSIVE_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_MELEE_X = UI_MAP.BorderRegion.x + 243; + MAPINV_FILTER_MELEE_Y = UI_MAP.BorderRegion.y + 24; + + MAPINV_FILTER_ARMOR_X = UI_MAP.BorderRegion.x + 272; + MAPINV_FILTER_ARMOR_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_LBE_X = UI_MAP.BorderRegion.x + 272; + MAPINV_FILTER_LBE_Y = UI_MAP.BorderRegion.y + 24; + + MAPINV_FILTER_KIT_X = UI_MAP.BorderRegion.x + 301; + MAPINV_FILTER_KIT_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_MISC1_X = UI_MAP.BorderRegion.x + 301; + MAPINV_FILTER_MISC1_Y = UI_MAP.BorderRegion.y + 24; + + MAPINV_FILTER_MISC2_X = UI_MAP.BorderRegion.x + 336; + MAPINV_FILTER_MISC2_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_SAVE_TEMPLATE_X = UI_MAP.BorderRegion.x + 371; + MAPINV_FILTER_SAVE_TEMPLATE_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_FILTER_LOAD_TEMPLATE_X = UI_MAP.BorderRegion.x + 406; + MAPINV_FILTER_LOAD_TEMPLATE_Y = UI_MAP.BorderRegion.y + 10; + + MAPINV_DONE_X = UI_MAP.BorderRegion.x + 706; + MAPINV_DONE_y = UI_MAP.BorderRegion.y + 15; + + MAPINV_ITEMPOOL_X = UI_MAP.BorderRegion.x + 558; + MAPINV_ITEMPOOL_Y = UI_MAP.BorderRegion.y + 19; + + MAPINV_PAGE_X = UI_MAP.BorderRegion.x + 626; + MAPINV_PAGE_Y = UI_MAP.BorderRegion.y + 19; + + MAPINV_SECTOR_X = UI_MAP.BorderRegion.x + 447; + MAPINV_SECTOR_Y = UI_MAP.BorderRegion.y + 19; + + MAPINV_LOC_STR_X = MAPINV_SECTOR_X - 19; + MAPINV_LOC_STR_Y = UI_MAP.BorderRegion.y + 15; + + MAPINV_ITEMPOOL_STR_X = MAPINV_ITEMPOOL_X - 19; + MAPINV_ITEMPOOL_STR_Y = UI_MAP.BorderRegion.y + 15; + } + else + { + MAPINV_NEXT_X = MAP_INV_X_OFFSET + 559; + MAPINV_PREV_X = MAP_INV_X_OFFSET + 487; + MAPINV_ARROW_Y = SCREEN_HEIGHT - 144 - yResOffset; + + MAPINV_ZOOM_X = INVEN_POOL_X + 10 + xResOffset; + MAPINV_ZOOM_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_STACK_X = INVEN_POOL_X + 50 + xResOffset; + MAPINV_STACK_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_SORT_AMMO_X = INVEN_POOL_X + 80 + xResOffset; + MAPINV_SORT_AMMO_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_SORT_ATT_X = INVEN_POOL_X + 110 + xResOffset; + MAPINV_SORT_ATT_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_EJECT_AMMO_X = INVEN_POOL_X + 140 + xResOffset; + MAPINV_EJECT_AMMO_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_X = INVEN_POOL_X + 185 + xResOffset; + MAPINV_FILTER_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_GUN_X = INVEN_POOL_X + 214 + xResOffset; + MAPINV_FILTER_GUN_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_AMMO_X = INVEN_POOL_X + 214 + xResOffset; + MAPINV_FILTER_AMMO_Y = INVEN_POOL_Y + 24 + yResOffset; + + MAPINV_FILTER_EXPLOSIVE_X = INVEN_POOL_X + 243 + xResOffset; + MAPINV_FILTER_EXPLOSIVE_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_MELEE_X = INVEN_POOL_X + 243 + xResOffset; + MAPINV_FILTER_MELEE_Y = INVEN_POOL_Y + 24 + yResOffset; + + MAPINV_FILTER_ARMOR_X = INVEN_POOL_X + 272 + xResOffset; + MAPINV_FILTER_ARMOR_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_LBE_X = INVEN_POOL_X + 272 + xResOffset; + MAPINV_FILTER_LBE_Y = INVEN_POOL_Y + 24 + yResOffset; + + MAPINV_FILTER_KIT_X = INVEN_POOL_X + 301 + xResOffset; + MAPINV_FILTER_KIT_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_MISC1_X = INVEN_POOL_X + 301 + xResOffset; + MAPINV_FILTER_MISC1_Y = INVEN_POOL_Y + 24 + yResOffset; + + MAPINV_FILTER_MISC2_X = INVEN_POOL_X + 336 + xResOffset; + MAPINV_FILTER_MISC2_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_SAVE_TEMPLATE_X = INVEN_POOL_X + 371 + xResOffset; + MAPINV_FILTER_SAVE_TEMPLATE_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_FILTER_LOAD_TEMPLATE_X = INVEN_POOL_X + 406 + xResOffset; + MAPINV_FILTER_LOAD_TEMPLATE_Y = INVEN_POOL_Y + 10 + yResOffset; + + MAPINV_DONE_X = MAP_INV_X_OFFSET + 587; + MAPINV_DONE_y = yResSize - 147 + yResOffset; + + MAPINV_ITEMPOOL_X = MAP_INVENTORY_POOL_NUMBER_X; + MAPINV_ITEMPOOL_Y = MAP_INVENTORY_POOL_PAGE_Y - yResOffset; + + MAPINV_PAGE_X = MAP_INVENTORY_POOL_PAGE_X; + MAPINV_PAGE_Y = MAP_INVENTORY_POOL_PAGE_Y - yResOffset; + + MAPINV_SECTOR_X = MAP_INVENTORY_POOL_LOC_X; + MAPINV_SECTOR_Y = MAP_INVENTORY_POOL_PAGE_Y - yResOffset; + + MAPINV_LOC_STR_X = MAP_INV_X_OFFSET + 268; + MAPINV_LOC_STR_Y = (SCREEN_HEIGHT - 138 - yResOffset); + + MAPINV_ITEMPOOL_STR_X = MAP_INV_X_OFFSET + 369; + MAPINV_ITEMPOOL_STR_Y = (SCREEN_HEIGHT - 138 - yResOffset); + } +} diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 733cbb07..1a26a29d 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -66,6 +66,7 @@ extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH]; extern UINT8 gMilitiaGroupId; extern UINT8 gNewMilitiaGroupId; extern PathStPtr gpMilitiaPreviousMercPath; +extern UILayout_Map UI_MAP; UINT16 MAP_GRID_X; UINT16 MAP_GRID_Y; @@ -274,8 +275,6 @@ UINT16 MAP_LEVEL_STRING_Y; #define WEST_OFFSET_Y 0 #define WEST_TO_SOUTH_OFFSET_Y 0 #define EAST_TO_NORTH_OFFSET_Y 0 -#define RED_WEST_OFF_X -MAP_GRID_X -#define RED_EAST_OFF_X MAP_GRID_X #define RED_NORTH_OFF_Y -21 #define RED_SOUTH_OFF_Y 21 @@ -621,8 +620,8 @@ void DrawIconL(INT32 MAP_GRID_X2, INT32 MAP_GRID_Y2, INT32 i ) { HVOBJECT hHandle; - INT16 sX = (UINT16)(MAP_VIEW_START_X + MAP_GRID_X + (MAP_GRID_X2 * MAP_GRID_X) / 10); - INT16 sY = (UINT16)(MAP_VIEW_START_Y + MAP_GRID_Y + ((MAP_GRID_Y2 * MAP_GRID_Y) / 10) + 1); + const UINT16 sX = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX + (MAP_GRID_X2 * UI_MAP.GridSize.iX) / 10; + const UINT16 sY = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY + ((MAP_GRID_Y2 * UI_MAP.GridSize.iY) / 10) + 1; INT8 ubVidObjIndex = 1; @@ -658,7 +657,11 @@ void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow ) else SetFontForeground(MAP_INDEX_COLOR); - FindFontCenterCoordinates(((INT16)(MAP_HORT_INDEX_X+( iCount - 1) *MAP_GRID_X)), MAP_HORT_INDEX_Y, MAP_GRID_X, MAP_HORT_HEIGHT, pMapHortIndex[iCount], MAP_FONT, &usX, &usY); + const auto left = UI_MAP.Numbers.x + UI_MAP.Numbers.width * (iCount - 1); + const auto top = UI_MAP.Numbers.y; + const auto width = UI_MAP.Numbers.width; + const auto height = UI_MAP.Numbers.height; + FindFontCenterCoordinates(left, top, width, height, pMapHortIndex[iCount], MAP_FONT, &usX, &usY); mprintf(usX,usY,pMapHortIndex[iCount]); if ( fDrawCursors && (iCount == sSelMapY) && ( GetSelectedDestChar() == -1) && !fPlotForHelicopter && !fPlotForMilitia ) @@ -668,12 +671,16 @@ void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow ) else SetFontForeground(MAP_INDEX_COLOR); - FindFontCenterCoordinates(MAP_VERT_INDEX_X, ((INT16)(MAP_VERT_INDEX_Y+ ( iCount - 1) *MAP_GRID_Y)), MAP_HORT_HEIGHT, MAP_GRID_Y, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); + const auto vertLeft = UI_MAP.Alphabet.x; + const auto vertTop = UI_MAP.Alphabet.y + UI_MAP.Alphabet.height * (iCount - 1); + const auto vertWidth = UI_MAP.Alphabet.width; + const auto vertHeight = UI_MAP.Alphabet.height; + FindFontCenterCoordinates(vertLeft, vertTop, vertWidth, vertHeight, pMapVertIndex[iCount], MAP_FONT, &usX, &usY); mprintf(usX,usY,pMapVertIndex[iCount]); } - InvalidateRegion(MAP_VERT_INDEX_X, MAP_VERT_INDEX_Y,MAP_VERT_INDEX_X+MAP_HORT_HEIGHT, MAP_VERT_INDEX_Y+( iCount - 1 ) * MAP_GRID_Y ); - InvalidateRegion(MAP_HORT_INDEX_X, MAP_HORT_INDEX_Y,MAP_HORT_INDEX_X + ( iCount - 1) * MAP_GRID_X, MAP_HORT_INDEX_Y+ MAP_HORT_HEIGHT); + InvalidateRegion(UI_MAP.Alphabet.x, UI_MAP.Alphabet.y, UI_MAP.Alphabet.x+ UI_MAP.Alphabet.width, UI_MAP.Alphabet.y + UI_MAP.Alphabet.height * ( iCount - 1 ) ); + InvalidateRegion(UI_MAP.Numbers.x, UI_MAP.Numbers.y, UI_MAP.Numbers.x + ( iCount - 1) * UI_MAP.Numbers.width, UI_MAP.Numbers.y + UI_MAP.Numbers.height); SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } @@ -944,10 +951,10 @@ void fillMapColoursForSamSiteAirSpace( INT32( &colorMap )[ MAXIMUM_VALID_Y_COORD UINT32 DrawMap(void) { - MapScreenRect.iLeft = MAP_VIEW_START_X + MAP_GRID_X - 2; - MapScreenRect.iTop = MAP_VIEW_START_Y + MAP_GRID_Y - 1; - MapScreenRect.iRight = MAP_VIEW_START_X + MAP_VIEW_WIDTH - 1 + MAP_GRID_X; - MapScreenRect.iBottom = MAP_VIEW_START_Y + MAP_VIEW_HEIGHT - 10 + MAP_GRID_Y; + MapScreenRect.iLeft = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX - 2; + MapScreenRect.iTop = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY - 1; + MapScreenRect.iRight = UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width - 1 + UI_MAP.GridSize.iX; + MapScreenRect.iBottom = UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 10 + UI_MAP.GridSize.iY; if (!iCurrentMapSectorZ) { // Aboveground sectors @@ -961,7 +968,7 @@ UINT32 DrawMap(void) UINT32 uiSrcPitchBYTES; UINT8 *pSrcBuf = LockVideoSurface(guiBIGMAP, &uiSrcPitchBYTES); - Blt8BPPDataTo16BPPBufferHalf(pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf, uiSrcPitchBYTES, MAP_VIEW_START_X + 1, MAP_VIEW_START_Y); + Blt8BPPDataTo16BPPBufferHalf(pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf, uiSrcPitchBYTES, UI_MAP.ViewRegion.x + 1, UI_MAP.ViewRegion.y); UnLockVideoSurface(guiBIGMAP); UnLockVideoSurface(guiSAVEBUFFER); @@ -1123,8 +1130,8 @@ UINT32 DrawMap(void) void GetScreenXYFromMapXY( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY ) { - *psX = ( sMapX * MAP_GRID_X ) + MAP_VIEW_START_X; - *psY = ( sMapY * MAP_GRID_Y ) + MAP_VIEW_START_Y; + *psX = ( sMapX * UI_MAP.GridSize.iX ) + UI_MAP.ViewRegion.x; + *psY = ( sMapY * UI_MAP.GridSize.iY ) + UI_MAP.ViewRegion.y; } @@ -1174,8 +1181,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); wcscpy( sStringA, L""); } - usX = (UINT16) (MAP_VIEW_START_X + MAP_GRID_X + (pTownPoints[ bTown ].x * MAP_GRID_X) / 10); - usY = (UINT16) (MAP_VIEW_START_Y + MAP_GRID_Y + ((pTownPoints[ bTown ].y * MAP_GRID_Y) / 10) + 1); + usX = (UINT16) (UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX + (pTownPoints[ bTown ].x * UI_MAP.GridSize.iX) / 10); + usY = (UINT16) (UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY + ((pTownPoints[ bTown ].y * UI_MAP.GridSize.iY) / 10) + 1); // red for low loyalty, green otherwise SetFontForeground( ( UINT8 ) ( fLoyaltyTooLowToTrainMilitia ? FONT_MCOLOR_RED : FONT_MCOLOR_LTGREEN ) ); @@ -1205,7 +1212,7 @@ void DrawTownLabels(STR16 pString, STR16 pStringA, UINT16 usFirstX, UINT16 usFir SetFont( MapTownLabelsFont ); // if within view region...render, else don't - if( ( usFirstX > MAP_VIEW_START_X + MAP_VIEW_WIDTH )||( usFirstX < MAP_VIEW_START_X )|| (usFirstY < MAP_VIEW_START_Y ) || ( usFirstY > MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) ) + if( ( usFirstX > UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width)||( usFirstX < UI_MAP.ViewRegion.x)|| (usFirstY < UI_MAP.ViewRegion.y) || ( usFirstY > UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height) ) { return; } @@ -1226,7 +1233,7 @@ void DrawTownLabels(STR16 pString, STR16 pStringA, UINT16 usFirstX, UINT16 usFir VarFindFontCenterCoordinates(( INT16 )( usFirstX ), ( INT16 )usFirstY, StringPixLength( pString, MapTownLabelsFont), 0, MapTownLabelsFont, &sSecondX, &sSecondY, pStringA); // make sure we don't go past left edge (Grumm) - sPastEdge = (MAP_VIEW_START_X + 23) - sSecondX; + sPastEdge = (UI_MAP.ViewRegion.x + 23) - sSecondX; if (sPastEdge > 0) sSecondX += sPastEdge; @@ -1481,20 +1488,20 @@ void ShowUncertainNumberEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) UINT8 iconOffsetX = 0; UINT8 iconOffsetY = 0; - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - iconOffsetX = 2; - iconOffsetY = 9; + iconOffsetX = 12; + iconOffsetY = 13; } - else if (iResolution < _1024x768) + else if (iResolution >= _800x600 && iResolution < _1024x768) { iconOffsetX = 8; iconOffsetY = 12; } else { - iconOffsetX = 12; - iconOffsetY = 13; + iconOffsetX = 2; + iconOffsetY = 9; } // grab the x and y postions @@ -1505,13 +1512,13 @@ void ShowUncertainNumberEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) GetVideoObject(&hIconHandle, guiCHARICONS); // check if we are zoomed in...need to offset in case for scrolling purposes - sXPosition = ( INT16 )( iconOffsetX + ( MAP_VIEW_START_X + ( sSectorX * MAP_GRID_X + 1 ) ) - 1 ); - sYPosition = ( INT16 )( ( ( iconOffsetY + ( yResOffset + sSectorY * MAP_GRID_Y ) + 1 ) ) ); + sXPosition = ( INT16 )( iconOffsetX + (UI_MAP.ViewRegion.x + ( sSectorX * UI_MAP.GridSize.iX + 1 ) ) - 1 ); + sYPosition = ( INT16 )( ( ( iconOffsetY + (UI_MAP.ViewRegion.y + sSectorY * UI_MAP.GridSize.iY ) + 1 ) ) ); sYPosition -= 2; // small question mark BltVideoObject(guiSAVEBUFFER, hIconHandle, SMALL_QUESTION_MARK, sXPosition, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( sXPosition ,sYPosition, sXPosition + DMAP_GRID_X, sYPosition + DMAP_GRID_Y ); + InvalidateRegion( sXPosition ,sYPosition, sXPosition + UI_MAP.GridSize.iX + 1, sYPosition + UI_MAP.GridSize.iY + 1); } void ShowTeamAndVehicles(INT32 fShowFlags) @@ -1576,10 +1583,10 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) sScreenX += 1; // compensate for original BIG_MAP blit being done at MAP_VIEW_START_X + 1 - clip.iLeft = 2 * ( sScreenX - ( MAP_VIEW_START_X + 1 ) ); - clip.iTop = 2 * ( sScreenY - MAP_VIEW_START_Y ); - clip.iRight = clip.iLeft + ( 2 * MAP_GRID_X ); - clip.iBottom = clip.iTop + ( 2 * MAP_GRID_Y ); + clip.iLeft = 2 * ( sScreenX - (UI_MAP.ViewRegion.x + 1 ) ); + clip.iTop = 2 * ( sScreenY - UI_MAP.ViewRegion.y); + clip.iRight = clip.iLeft + ( 2 * UI_MAP.GridSize.iX ); + clip.iBottom = clip.iTop + ( 2 * UI_MAP.GridSize.iY ); if( iColor == MAP_SHADE_BLACK ) { @@ -1587,7 +1594,7 @@ BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ) sScreenY -= 1; // simply shade darker - ShadowVideoSurfaceRect( guiSAVEBUFFER, sScreenX, sScreenY, sScreenX + MAP_GRID_X - 1, sScreenY + MAP_GRID_Y - 1 ); + ShadowVideoSurfaceRect( guiSAVEBUFFER, sScreenX, sScreenY, sScreenX + UI_MAP.GridSize.iX - 1, sScreenY + UI_MAP.GridSize.iY - 1 ); } else if ( iColor < MAP_SHADE_MAX ) { @@ -1658,10 +1665,10 @@ BOOLEAN ShadeMapElements(const INT32(&colorMap)[ MAXIMUM_VALID_Y_COORDINATE ][ M // compensate for original BIG_MAP blit being done at MAP_VIEW_START_X + 1 SGPRect clip; - clip.iLeft = 2 * (sScreenX - (MAP_VIEW_START_X + 1)); - clip.iTop = 2 * (sScreenY - MAP_VIEW_START_Y); - clip.iRight = clip.iLeft + (2 * MAP_GRID_X); - clip.iBottom = clip.iTop + (2 * MAP_GRID_Y); + clip.iLeft = 2 * (sScreenX - (UI_MAP.ViewRegion.x + 1)); + clip.iTop = 2 * (sScreenY - UI_MAP.ViewRegion.y); + clip.iRight = clip.iLeft + (2 * UI_MAP.GridSize.iX); + clip.iBottom = clip.iTop + (2 * UI_MAP.GridSize.iY); const auto iColor = colorMap[y][x]; @@ -1672,8 +1679,8 @@ BOOLEAN ShadeMapElements(const INT32(&colorMap)[ MAXIMUM_VALID_Y_COORDINATE ][ M auto X1 = sScreenX; auto Y1 = sScreenY; - auto X2 = sScreenX + MAP_GRID_X - 1; - auto Y2 = sScreenY + MAP_GRID_Y - 1; + auto X2 = sScreenX + UI_MAP.GridSize.iX - 1; + auto Y2 = sScreenY + UI_MAP.GridSize.iY - 1; #ifdef _DEBUG if (X1 < 0) X1 = 0; @@ -1746,23 +1753,23 @@ BOOLEAN ShadeMapElements(const INT32(&colorMap)[ MAXIMUM_VALID_Y_COORDINATE ][ M void InitializeMilitiaPopup(void) { - UINT16 xVal = 330 + xResOffset; - UINT16 yVal = 25 + yResOffset; + const UINT16 xVal = 330 + xResOffset; + const UINT16 yVal = 25 + yResOffset; - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - MAP_MILITIA_BOX_POS_X = xVal; - MAP_MILITIA_BOX_POS_Y = yVal; + MAP_MILITIA_BOX_POS_X = xVal + 190; + MAP_MILITIA_BOX_POS_Y = yVal + 285; } - else if (iResolution < _1024x768) + else if (iResolution >= _800x600) { MAP_MILITIA_BOX_POS_X = xVal + 77; MAP_MILITIA_BOX_POS_Y = yVal + 116; } else { - MAP_MILITIA_BOX_POS_X = xVal + 190; - MAP_MILITIA_BOX_POS_Y = yVal + 285; + MAP_MILITIA_BOX_POS_X = xVal; + MAP_MILITIA_BOX_POS_Y = yVal; } } @@ -1779,6 +1786,8 @@ BOOLEAN InitializePalettesForMap( void ) if (iResolution >= _640x480 && iResolution < _800x600) strcpy(vs_desc.ImageFile, "INTERFACE\\b_map.pcx"); + else if (iResolution == _1280x720) + strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_1280x720.pcx"); else if (iResolution < _1024x768) strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_800x600.pcx"); else @@ -2582,8 +2591,8 @@ BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath iX=(pNode->uiSectorId%MAP_WORLD_X); iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + iX=(iX*UI_MAP.GridSize.iX) + UI_MAP.ViewRegion.x; + iY=(iY*UI_MAP.GridSize.iY) + UI_MAP.ViewRegion.y; iArrowX=iX; iArrowY=iY; @@ -2813,8 +2822,8 @@ BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath { iX=(pNode->uiSectorId%MAP_WORLD_X); iY=(pNode->uiSectorId/MAP_WORLD_X); - iX=(iX*MAP_GRID_X)+MAP_VIEW_START_X; - iY=(iY*MAP_GRID_Y)+MAP_VIEW_START_Y; + iX=(iX*UI_MAP.GridSize.iX) + UI_MAP.ViewRegion.x; + iY=(iY*UI_MAP.GridSize.iY) + UI_MAP.ViewRegion.y; iArrowX=iX; iArrowY=iY; @@ -2917,10 +2926,10 @@ BOOLEAN TracePathRoute(BOOLEAN fCheckFlag, BOOLEAN fForceUpDate, PathStPtr pPath if(!fUTurnFlag) { BltVideoObject(FRAME_BUFFER, hMapHandle, (UINT16)iArrow, iArrowX, iArrowY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * MAP_GRID_X, iArrowY + 2 * MAP_GRID_Y ); + InvalidateRegion( iArrowX, iArrowY, iArrowX + 2 * UI_MAP.GridSize.iX, iArrowY + 2 * UI_MAP.GridSize.iY ); } - InvalidateRegion( iX, iY, iX + 2 * MAP_GRID_X, iY + 2 * MAP_GRID_Y ); + InvalidateRegion( iX, iY, iX + 2 * UI_MAP.GridSize.iX, iY + 2 * UI_MAP.GridSize.iY ); fUTurnFlag=FALSE; } @@ -3091,23 +3100,23 @@ BOOLEAN TraceCharAnimatedRoute( PathStPtr pPath, BOOLEAN fCheckFlag, BOOLEAN fFo iX = (pCurrentNode->uiSectorId % MAP_WORLD_X); iY = (pCurrentNode->uiSectorId / MAP_WORLD_X); - iX = (iX*MAP_GRID_X) + MAP_VIEW_START_X; - iY = (iY*MAP_GRID_Y) + MAP_VIEW_START_Y; + iX = (iX*UI_MAP.GridSize.iX) + UI_MAP.ViewRegion.x; + iY = (iY*UI_MAP.GridSize.iY) + UI_MAP.ViewRegion.y; - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - iArrowX = iX - 4; - iArrowY = iY - 4; + iArrowX = iX - 6; + iArrowY = iY - 6; } - else if (iResolution < _1024x768) + else if (iResolution >= _800x600) { iArrowX = iX - 5; iArrowY = iY - 5; } - else + else { - iArrowX = iX - 6; - iArrowY = iY - 6; + iArrowX = iX - 4; + iArrowY = iY - 4; } // Find the next node @@ -3313,21 +3322,21 @@ BOOLEAN IsTheCursorAllowedToHighLightThisSector( INT16 sSectorX, INT16 sSectorY void RestoreBackgroundForMapGrid( INT16 sMapX, INT16 sMapY ) { // screen values - INT16 sX = (sMapX * MAP_GRID_X) + MAP_VIEW_START_X; - INT16 sY = (sMapY * MAP_GRID_Y) + MAP_VIEW_START_Y; + INT16 sX = (sMapX * UI_MAP.GridSize.iX) + UI_MAP.ViewRegion.x; + INT16 sY = (sMapY * UI_MAP.GridSize.iY) + UI_MAP.ViewRegion.y; // restore background - RestoreExternBackgroundRect( sX, sY ,DMAP_GRID_X ,DMAP_GRID_Y ); + RestoreExternBackgroundRect( sX, sY , UI_MAP.GridSize.iX + 1, UI_MAP.GridSize.iY + 1); } void ClipBlitsToMapViewRegion( void ) { // the standard mapscreen rectangle doesn't work for clipping while zoomed... - SGPRect ZoomedMapScreenClipRect={ MAP_VIEW_START_X + MAP_GRID_X, - MAP_VIEW_START_Y + MAP_GRID_Y - 1, - MAP_VIEW_START_X + MAP_VIEW_WIDTH + MAP_GRID_X, - MAP_VIEW_START_Y + MAP_VIEW_HEIGHT + MAP_GRID_Y - 10 }; + SGPRect ZoomedMapScreenClipRect={ UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX, + UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY - 1, + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width + UI_MAP.GridSize.iX, + UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height + UI_MAP.GridSize.iY - 10 }; SGPRect *pRectToUse; pRectToUse = &MapScreenRect; @@ -3480,8 +3489,8 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) int tYD = sDest / MAP_WORLD_X; // Find sector's top-left pixel on the screen. - INT16 sSectorPosX = MAP_VIEW_START_X + (sX * MAP_GRID_X); - INT16 sSectorPosY = MAP_VIEW_START_Y + (sY * MAP_GRID_Y); + INT16 sSectorPosX = UI_MAP.ViewRegion.x + (sX * UI_MAP.GridSize.iX); + INT16 sSectorPosY = UI_MAP.ViewRegion.y + (sY * UI_MAP.GridSize.iY); // This is the sectorID in plain 0-256. Most of the functions will use this instead of sSource and sDest. INT16 sSourceSector = SECTOR( tXS, tYS ); @@ -3591,7 +3600,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) if( !( iDirection % 2 ) ) { // guys exiting north or south from this sector. Center the arrow. - sOffsetX = (MAP_GRID_X / 2); + sOffsetX = (UI_MAP.GridSize.iX / 2); if( fEntering > 0 ) { @@ -3621,14 +3630,14 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) else { // going south - sOffsetY = MAP_GRID_Y; + sOffsetY = UI_MAP.GridSize.iY; } } else { // guys exiting east or west from this sector. Center the arrow. - sOffsetY = (MAP_GRID_Y / 2); + sOffsetY = (UI_MAP.GridSize.iY / 2); if( fEntering > 0 ) { @@ -3653,7 +3662,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY ) if( iDirection == 1 ) { // going east - sOffsetX = MAP_GRID_X; + sOffsetX = UI_MAP.GridSize.iX; } else { @@ -4031,7 +4040,7 @@ void ShowNonPlayerGroupsInMotion( INT16 sX, INT16 sY, UINT8 usTeam ) if (sDeltaY < 0) { ubDirection = 0; - sOffsetX = (MAP_GRID_X / 2); + sOffsetX = (UI_MAP.GridSize.iX / 2); sOffsetY = 0; iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth / 2); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight); @@ -4039,22 +4048,22 @@ void ShowNonPlayerGroupsInMotion( INT16 sX, INT16 sY, UINT8 usTeam ) else if (sDeltaX > 0) { ubDirection = 1; - sOffsetX = MAP_GRID_X; - sOffsetY = (MAP_GRID_Y / 2); + sOffsetX = UI_MAP.GridSize.iX; + sOffsetY = (UI_MAP.GridSize.iY / 2); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight / 2); } else if (sDeltaY > 0) { ubDirection = 2; - sOffsetX = (MAP_GRID_X / 2); - sOffsetY = MAP_GRID_Y; + sOffsetX = (UI_MAP.GridSize.iX / 2); + sOffsetY = UI_MAP.GridSize.iY; iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth / 2); } else if (sDeltaX < 0) { ubDirection = 3; sOffsetX = 0; - sOffsetY = (MAP_GRID_Y / 2); + sOffsetY = (UI_MAP.GridSize.iY / 2); iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight / 2); } @@ -4064,8 +4073,8 @@ void ShowNonPlayerGroupsInMotion( INT16 sX, INT16 sY, UINT8 usTeam ) iconOffsetY -= 1; } - iX = MAP_VIEW_START_X+( sX * MAP_GRID_X ) + sOffsetX + iconOffsetX; - iY = MAP_VIEW_START_Y + ( sY * MAP_GRID_Y ) + sOffsetY + iconOffsetY; + iX = UI_MAP.ViewRegion.x+( sX * UI_MAP.GridSize.iX ) + sOffsetX + iconOffsetX; + iY = UI_MAP.ViewRegion.y + ( sY * UI_MAP.GridSize.iY ) + sOffsetY + iconOffsetY; // Flugente: depending on which team's direction we show there is an offset to the images // Note that we also need a x or y offset if multiple teamsare moving in the same sector, but currently that won't happen @@ -4143,7 +4152,7 @@ void ShowMilitiaInMotion( INT16 sX, INT16 sY ) if ( StrategicMap[sector].usFlags & MILITIA_MOVE_NORTH ) { ubDirection = 4; - sOffsetX = (MAP_GRID_X / 2); + sOffsetX = (UI_MAP.GridSize.iX / 2); sOffsetY = 0; iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth / 2); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight); @@ -4151,22 +4160,22 @@ void ShowMilitiaInMotion( INT16 sX, INT16 sY ) else if ( StrategicMap[sector].usFlags & MILITIA_MOVE_EAST ) { ubDirection = 5; - sOffsetX = MAP_GRID_X; - sOffsetY = (MAP_GRID_Y / 2); + sOffsetX = UI_MAP.GridSize.iX; + sOffsetY = (UI_MAP.GridSize.iY / 2); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight / 2); } else if ( StrategicMap[sector].usFlags & MILITIA_MOVE_SOUTH ) { ubDirection = 6; - sOffsetX = (MAP_GRID_X / 2); - sOffsetY = MAP_GRID_Y; + sOffsetX = (UI_MAP.GridSize.iX / 2); + sOffsetY = UI_MAP.GridSize.iY; iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth / 2); } else if ( StrategicMap[sector].usFlags & MILITIA_MOVE_WEST ) { ubDirection = 7; sOffsetX = 0; - sOffsetY = (MAP_GRID_Y / 2); + sOffsetY = (UI_MAP.GridSize.iY / 2); iconOffsetX = -(hIconHandle->pETRLEObject[ubDirection].usWidth); iconOffsetY = -(hIconHandle->pETRLEObject[ubDirection].usHeight / 2); } @@ -4176,8 +4185,8 @@ void ShowMilitiaInMotion( INT16 sX, INT16 sY ) iconOffsetY -= 1; } - iX = MAP_VIEW_START_X+( sX * MAP_GRID_X ) + sOffsetX + iconOffsetX; - iY = MAP_VIEW_START_Y + ( sY * MAP_GRID_Y ) + sOffsetY + iconOffsetY; + iX = UI_MAP.ViewRegion.x+( sX * UI_MAP.GridSize.iX ) + sOffsetX + iconOffsetX; + iY = UI_MAP.ViewRegion.y + ( sY * UI_MAP.GridSize.iY ) + sOffsetY + iconOffsetY; BltVideoObject(guiSAVEBUFFER, hIconHandle, ubDirection , ( INT16 ) iX, ( INT16 ) iY , VO_BLT_SRCTRANSPARENCY, NULL ); @@ -4225,19 +4234,19 @@ void DisplayDistancesForHelicopter( void ) if ( GetMouseMapXY( &sMapX, &sMapY ) && ( sMapY >= 13 ) ) { - sYPosition = MAP_HELICOPTER_UPPER_ETA_POPUP_Y; + sYPosition = UI_MAP.HeliETA.Upper_Popup_Y; } else { - sYPosition = MAP_HELICOPTER_ETA_POPUP_Y; + sYPosition = UI_MAP.HeliETA.PopupBox.y; } if( ( sOldYPosition != 0 ) && ( sOldYPosition != sYPosition ) ) { if( !gGameExternalOptions.fAlternativeHelicopterFuelSystem ) - RestoreExternBackgroundRect( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, MAP_HELICOPTER_ETA_POPUP_HEIGHT ); + RestoreExternBackgroundRect(UI_MAP.HeliETA.PopupBox.x, sOldYPosition, UI_MAP.HeliETA.PopupBox.width + 20, UI_MAP.HeliETA.PopupBox.height); else - RestoreExternBackgroundRect( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT ); + RestoreExternBackgroundRect(UI_MAP.HeliETA.PopupBox.x, sOldYPosition, UI_MAP.HeliETA .PopupBox.width + 20, UI_MAP.HeliETA.Alternate_Height); } sOldYPosition = sYPosition; @@ -4249,14 +4258,16 @@ void DisplayDistancesForHelicopter( void ) else GetVideoObject( &hHandle, guiMapBorderHeliSectors ); - if (iResolution >= _640x480 && iResolution < _800x600) - imageIndex = 0; - else if (iResolution < _1024x768) + if (isWidescreenUI() || iResolution >= _1024x768) + { + imageIndex = 2; + } + else if (iResolution >= _800x600) imageIndex = 1; else - imageIndex = 2; + imageIndex = 0; - BltVideoObject( FRAME_BUFFER, hHandle, imageIndex, MAP_HELICOPTER_ETA_POPUP_X, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( FRAME_BUFFER, hHandle, imageIndex, UI_MAP.HeliETA.PopupBox.x, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL ); sTotalCanTravel = ( INT16 )GetTotalDistanceHelicopterCanTravel( ); sDistanceToGo = ( INT16 )DistanceOfIntendedHelicopterPath( ); @@ -4280,7 +4291,7 @@ void DisplayDistancesForHelicopter( void ) SetFontBackground( FONT_BLACK ); swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_TOTAL_DISTANCE ] ); - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5, sString ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5, sString ); /* if ( IsSectorOutOfTheWay( sMapX, sMapY ) ) @@ -4294,27 +4305,27 @@ void DisplayDistancesForHelicopter( void ) } swprintf( sString, L"%d", sTotalOfTrip ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, MAP_HELICOPTER_ETA_POPUP_Y + 5, MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, UI_MAP.HeliETA.PopupBox.y + 5, UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, sYPosition + 5, sString ); SetFontForeground( FONT_LTGREEN ); swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_SAFE ] ); - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + GetFontHeight( MAP_FONT ), sString ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + GetFontHeight( MAP_FONT ), sString ); swprintf( sString, L"%d", sNumSafeSectors ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 2 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 2 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + GetFontHeight( MAP_FONT ) ), sString ); swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_UNSAFE ] ); - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 2 * GetFontHeight( MAP_FONT ), sString ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 2 * GetFontHeight( MAP_FONT ), sString ); swprintf( sString, L"%d", sNumUnSafeSectors ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 2 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 2 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 2 * GetFontHeight( MAP_FONT ) ), sString ); swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_TOTAL_COST ] ); - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ), sString ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ), sString ); // calculate the cost of the trip based on the number of safe and unsafe sectors it will pass through // HEADROCK HAM 3.5: Externalized Base Cost. Also includes hourly-calculated facility modifier. @@ -4328,13 +4339,13 @@ void DisplayDistancesForHelicopter( void ) swprintf( sString, L"%d", uiTripCost ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 3 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 3 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ) ), sString ); SetFontForeground( FONT_LTGREEN ); swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_ETA ] ); - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ), sString ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ), sString ); // get travel time for the last path segment iTime = GetPathTravelTimeDuringPlotting( pTempHelicopterPath ); @@ -4343,38 +4354,38 @@ void DisplayDistancesForHelicopter( void ) iTime += GetPathTravelTimeDuringPlotting( pVehicleList[ iHelicopterVehicleId ].pMercPath ); swprintf( sString, L"%d%s %d%s", iTime / 60, gsTimeStrings[0], iTime % 60, gsTimeStrings[1] ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) ( sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ) ), sString ); // show # of passengers aboard the chopper - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_PASSENGERS ] ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_PASSENGERS ] ); swprintf( sString, L"%d", GetNumberOfPassengersInHelicopter() ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 5 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 5 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ) ), sString ); // show remaining fuel - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 6 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_REMAINING_FUEL ] ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 6 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_REMAINING_FUEL ] ); swprintf( sString, L"%d", sRemainingFuel ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 6 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 6 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); if( sRemainingFuel < sDistToRefuelSite ) SetFontForeground( FONT_LTRED ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 6 * GetFontHeight( MAP_FONT ) ), sString ); SetFontForeground( FONT_LTGREEN ); // show distance to the nearest refuel site - mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 7 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_DISTANCE_TO_REFUEL_SITE ] ); + mprintf(UI_MAP.HeliETA.PopupBox.x + 5, sYPosition + 5 + 7 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_DISTANCE_TO_REFUEL_SITE ] ); swprintf( sString, L"%d", sDistToRefuelSite ); - FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 7 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY ); + FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 7 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY ); if( sRemainingFuel < sDistToRefuelSite ) SetFontForeground( FONT_LTRED ); mprintf( sX, ( INT16 ) ( sYPosition + 5 + 7 * GetFontHeight( MAP_FONT ) ), sString ); SetFontForeground( FONT_LTGREEN ); if( !gGameExternalOptions.fAlternativeHelicopterFuelSystem ) - InvalidateRegion( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_X + MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, sOldYPosition + MAP_HELICOPTER_ETA_POPUP_HEIGHT ); + InvalidateRegion(UI_MAP.HeliETA.PopupBox.x, sOldYPosition, UI_MAP.HeliETA.PopupBox.x + UI_MAP.HeliETA.PopupBox.width + 20, sOldYPosition + UI_MAP.HeliETA.PopupBox.height); else - InvalidateRegion( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_X + MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, sOldYPosition + MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT ); + InvalidateRegion(UI_MAP.HeliETA.PopupBox.x, sOldYPosition, UI_MAP.HeliETA.PopupBox.x + UI_MAP.HeliETA.PopupBox.width + 20, sOldYPosition + UI_MAP.HeliETA.Alternate_Height); } @@ -4455,10 +4466,10 @@ void DisplayPositionOfHelicopter( void ) } // grab min and max locations to interpolate sub sector position - minX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubSectorX ); - maxX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubNextX ); - minY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubSectorY ); - maxY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubNextY ); + minX = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX * ( pGroup->ubSectorX ); + maxX = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX * ( pGroup->ubNextX ); + minY = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY * ( pGroup->ubSectorY ); + maxY = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY * ( pGroup->ubNextY ); AssertMsg( ( minX >= 0 ) && ( minX < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid minX = %d", minX ) ); AssertMsg( ( maxX >= 0 ) && ( maxX < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid maxX = %d", maxX ) ); @@ -4501,7 +4512,7 @@ void DisplayPositionOfHelicopter( void ) SetFontForeground( FONT_WHITE ); SetFontBackground( FONT_BLACK ); - mprintf( x + (MAP_GRID_X / 2) - 4, y + (MAP_GRID_Y / 2) - 4, sString ); + mprintf( x + (UI_MAP.GridSize.iX / 2) - 4, y + (UI_MAP.GridSize.iY / 2) - 4, sString ); InvalidateRegion( x, y, x + usIconWidth, y + usIconHeight ); @@ -4555,10 +4566,10 @@ void DisplayPositionOfEnemyHelicopter() UINT8 sector_y = SECTORY( sector ); // grab min and max locations to interpolate sub sector position - minX = MAP_VIEW_START_X + MAP_GRID_X * (sector_x); - maxX = MAP_VIEW_START_X + MAP_GRID_X * (sector_x); - minY = MAP_VIEW_START_Y + MAP_GRID_Y * (sector_y); - maxY = MAP_VIEW_START_Y + MAP_GRID_Y * (sector_y); + minX = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX * (sector_x); + maxX = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX * (sector_x); + minY = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY * (sector_y); + maxY = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY * (sector_y); AssertMsg( (minX >= 0) && (minX < SCREEN_WIDTH), String( "DisplayPositionOfHelicopter: Invalid minX = %d", minX ) ); AssertMsg( (maxX >= 0) && (maxX < SCREEN_WIDTH), String( "DisplayPositionOfHelicopter: Invalid maxX = %d", maxX ) ); @@ -4611,8 +4622,8 @@ void DisplayDestinationOfHelicopter( void ) sMapX = sSector % MAP_WORLD_X; sMapY = sSector / MAP_WORLD_X; - x = MAP_VIEW_START_X + ( MAP_GRID_X * sMapX ) + 1; - y = MAP_VIEW_START_Y + ( MAP_GRID_Y * sMapY ) + 3; + x = UI_MAP.ViewRegion.x + ( UI_MAP.GridSize.iX * sMapX ) + 1; + y = UI_MAP.ViewRegion.y + ( UI_MAP.GridSize.iY * sMapY ) + 3; AssertMsg( ( x >= 0 ) && ( x < (UINT32)SCREEN_WIDTH ), String( "DisplayDestinationOfHelicopter: Invalid x = %d. Dest %d,%d", x, sMapX, sMapY ) ); AssertMsg( ( y >= 0 ) && ( y < (UINT32)SCREEN_HEIGHT ), String( "DisplayDestinationOfHelicopter: Invalid y = %d. Dest %d,%d", y, sMapX, sMapY ) ); @@ -4626,8 +4637,8 @@ void DisplayDestinationOfHelicopter( void ) if (iResolution >= _800x600) { - x = x + (MAP_GRID_X / 2) - 10; - y = y + 1 + (MAP_GRID_Y / 2) - 10; + x = x + (UI_MAP.GridSize.iX / 2) - 10; + y = y + 1 + (UI_MAP.GridSize.iY / 2) - 10; } InvalidateRegion( x, y, x + HELI_SHADOW_ICON_WIDTH, y + HELI_SHADOW_ICON_HEIGHT ); @@ -4726,12 +4737,12 @@ void BlitMineIcon( INT16 sMapX, INT16 sMapY ) GetVideoObject( &hHandle, guiMINEICON ); pDestBuf2 = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, MAP_VIEW_START_X+MAP_GRID_X - 1, MAP_VIEW_START_Y+MAP_GRID_Y - 1, MAP_VIEW_WIDTH+1,MAP_VIEW_HEIGHT-9 ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, UI_MAP.ViewRegion.x+UI_MAP.GridSize.iX - 1, UI_MAP.ViewRegion.y+UI_MAP.GridSize.iY - 1, UI_MAP.ViewRegion.width+1,UI_MAP.ViewRegion.height-9 ); UnLockVideoSurface(guiSAVEBUFFER); GetScreenXYFromMapXY( ( INT16 )( sMapX ), ( INT16 )( sMapY ), &sScreenX, &sScreenY ); // when not zoomed, the x,y returned is the top left CORNER of the map square in question - BltVideoObject( guiSAVEBUFFER, hHandle, 1, sScreenX + MAP_GRID_X / 4, sScreenY + MAP_GRID_Y / 4, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 1, sScreenX + UI_MAP.GridSize.iX / 4, sScreenY + UI_MAP.GridSize.iY / 4, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -4745,12 +4756,12 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) GetScreenXYFromMapXY( ( INT16 )( sMapX ), ( INT16 )( sMapY ), &sScreenX, &sScreenY ); // set coordinates for start of mine text - sScreenX += MAP_GRID_X / 2; // centered around middle of mine square - sScreenY += MAP_GRID_Y + 1; // slightly below + sScreenX += UI_MAP.GridSize.iX / 2; // centered around middle of mine square + sScreenY += UI_MAP.GridSize.iY + 1; // slightly below // show detailed mine info (name, production rate, daily production) - SetFontDestBuffer( guiSAVEBUFFER, MAP_VIEW_START_X, MAP_VIEW_START_Y, MAP_VIEW_START_X+MAP_VIEW_WIDTH+MAP_GRID_X, MAP_VIEW_START_Y+MAP_VIEW_HEIGHT+7, FALSE ); + SetFontDestBuffer( guiSAVEBUFFER, UI_MAP.ViewRegion.x, UI_MAP.ViewRegion.y, UI_MAP.ViewRegion.x+UI_MAP.ViewRegion.width+UI_MAP.GridSize.iX, UI_MAP.ViewRegion.y+UI_MAP.ViewRegion.height+7, FALSE ); // HEADROCK HAM 5: Variable Font INT32 MapMineLabelsFont; @@ -4851,7 +4862,7 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) } } - SetFontDestBuffer( FRAME_BUFFER, MAP_VIEW_START_X, MAP_VIEW_START_Y, MAP_VIEW_START_X+MAP_VIEW_WIDTH+MAP_GRID_X, MAP_VIEW_START_Y+MAP_VIEW_HEIGHT+7, FALSE ); + SetFontDestBuffer( FRAME_BUFFER, UI_MAP.ViewRegion.x, UI_MAP.ViewRegion.y, UI_MAP.ViewRegion.x+UI_MAP.ViewRegion.width+UI_MAP.GridSize.iX, UI_MAP.ViewRegion.y+UI_MAP.ViewRegion.height+7, FALSE ); } @@ -4861,7 +4872,7 @@ void AdjustXForLeftMapEdge(STR16 wString, INT16 *psX, INT32 iFont) INT16 sStartingX, sPastEdge; sStartingX = *psX - (StringPixLengthArg( iFont, wcslen(wString), wString ) / 2); - sPastEdge = (MAP_VIEW_START_X + 23) - sStartingX; + sPastEdge = (UI_MAP.ViewRegion.x + 23) - sStartingX; if (sPastEdge > 0) *psX += sPastEdge; @@ -4895,8 +4906,8 @@ void BlitTownGridMarkers( void ) { // get location on screen GetScreenXYFromMapXY( ( INT16 )( pTownLocationsList[ iCounter ] % MAP_WORLD_X ), ( INT16 )( pTownLocationsList[ iCounter ] / MAP_WORLD_X ), &sScreenX, &sScreenY ); - sWidth = MAP_GRID_X - 1; - sHeight= MAP_GRID_Y; + sWidth = UI_MAP.GridSize.iX - 1; + sHeight= UI_MAP.GridSize.iY; sScreenX += 2; @@ -4955,8 +4966,8 @@ void BlitMineGridMarkers( void ) // get location on screen //GetScreenXYFromMapXY( ( INT16 )( gMineLocation[ iCounter ].sSectorX ), ( INT16 )( gMineLocation[ iCounter ].sSectorY ), &sScreenX, &sScreenY ); GetScreenXYFromMapXY( ( INT16 )( gMineStatus[ iCounter ].sSectorX ), ( INT16 )( gMineStatus[ iCounter ].sSectorY ), &sScreenX, &sScreenY ); - sWidth = MAP_GRID_X; - sHeight= MAP_GRID_Y; + sWidth = UI_MAP.GridSize.iX; + sHeight= UI_MAP.GridSize.iY; // draw rectangle RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); @@ -5025,14 +5036,14 @@ void DisplayLevelString( void ) return; } - SetFontDestBuffer( guiSAVEBUFFER, xResOffset + MAP_VIEW_START_X, MAP_VIEW_START_Y, xResOffset + MAP_VIEW_START_X+MAP_VIEW_WIDTH+MAP_GRID_X, MAP_VIEW_START_Y+MAP_VIEW_HEIGHT+7, FALSE ); + SetFontDestBuffer( guiSAVEBUFFER, UI_MAP.ViewRegion.x, UI_MAP.ViewRegion.y, UI_MAP.ViewRegion.x+UI_MAP.ViewRegion.width+UI_MAP.GridSize.iX, UI_MAP.ViewRegion.y+UI_MAP.ViewRegion.height+7, FALSE ); SetFont( MAP_FONT ); SetFontForeground( MAP_INDEX_COLOR ); SetFontBackground( FONT_BLACK ); swprintf( sString, L"%s %d", sMapLevelString[ 0 ], iCurrentMapSectorZ ); - mprintf( MAP_LEVEL_STRING_X, MAP_LEVEL_STRING_Y, sString ); + mprintf(UI_MAP.LevelString.iX, UI_MAP.LevelString.iY, sString ); SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } @@ -6611,7 +6622,7 @@ BOOLEAN ShadeUndergroundMapElem( INT16 sSectorX, INT16 sSectorY ) sScreenX += 1; - ShadowVideoSurfaceRect( guiSAVEBUFFER, sScreenX, sScreenY, sScreenX + MAP_GRID_X - 2, sScreenY + MAP_GRID_Y - 2 ); + ShadowVideoSurfaceRect( guiSAVEBUFFER, sScreenX, sScreenY, sScreenX + UI_MAP.GridSize.iX - 2, sScreenY + UI_MAP.GridSize.iY - 2 ); return( TRUE ); } @@ -6673,6 +6684,12 @@ void HandleLowerLevelMapBlit( void ) offsetY = yVal; imageIndex = 0; } + else if (iResolution == _1280x720) + { + offsetX = xVal + 21; + offsetY = yVal + 17; + imageIndex = 2; + } else if (iResolution < _1024x768) { offsetX = xVal + 8; @@ -6687,7 +6704,7 @@ void HandleLowerLevelMapBlit( void ) } // handle the blt of the sublevel - BltVideoObject( guiSAVEBUFFER, hHandle, imageIndex, MAP_VIEW_START_X + offsetX, MAP_VIEW_START_Y + offsetY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, imageIndex, UI_MAP.ViewRegion.x + offsetX, UI_MAP.ViewRegion.y + offsetY, VO_BLT_SRCTRANSPARENCY, NULL ); // handle shading of sublevels ShadeSubLevelsNotVisited( ); @@ -7138,8 +7155,8 @@ void ShowSAMSitesOnStrategicMap( void ) MapSAMSiteFont = FONT14ARIAL; } - INT16 sLabelX = sX + (MAP_GRID_X / 2); - INT16 sLabelY = sY + MAP_GRID_Y + 2; + INT16 sLabelX = sX + (UI_MAP.GridSize.iX / 2); + INT16 sLabelY = sY + UI_MAP.GridSize.iY + 2; wcscpy( wString, pLandTypeStrings[ SAM_SITE ] ); @@ -7147,8 +7164,8 @@ void ShowSAMSitesOnStrategicMap( void ) sLabelX -= StringPixLength( wString, MapSAMSiteFont) / 2; // if within view region...render, else don't - if( ( sLabelX > MAP_VIEW_START_X + MAP_VIEW_WIDTH ) || ( sLabelX < MAP_VIEW_START_X ) || - ( sLabelY > MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) || ( sLabelY < MAP_VIEW_START_Y ) ) + if( ( sLabelX > UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width ) || ( sLabelX < UI_MAP.ViewRegion.x ) || + ( sLabelY > UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height ) || ( sLabelY < UI_MAP.ViewRegion.y ) ) { continue; } @@ -7206,17 +7223,17 @@ void ShowSAMSitesOnStrategicMap( void ) MapHeliSiteFont = FONT14ARIAL; } - INT16 sLabelX = sX + (MAP_GRID_X / 2); + INT16 sLabelX = sX + (UI_MAP.GridSize.iX / 2); INT16 sLabelY; if ( IsThisSectorASAMSector( sSectorX, sSectorY, 0 ) ) { if (iResolution <= _800x600 ) - sLabelY = sY + MAP_GRID_Y + 10; + sLabelY = sY + UI_MAP.GridSize.iY + 10; else - sLabelY = sY + MAP_GRID_Y + 16; + sLabelY = sY + UI_MAP.GridSize.iY + 16; } else - sLabelY = sY + MAP_GRID_Y + 2; + sLabelY = sY + UI_MAP.GridSize.iY + 2; wcscpy( wString, pLandTypeStrings[ REFUEL_SITE ] ); @@ -7224,8 +7241,8 @@ void ShowSAMSitesOnStrategicMap( void ) sLabelX -= StringPixLength( wString, MapHeliSiteFont) / 2; // if within view region...render, else don't - if( ( sLabelX > MAP_VIEW_START_X + MAP_VIEW_WIDTH ) || ( sLabelX < MAP_VIEW_START_X ) || - ( sLabelY > MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) || ( sLabelY < MAP_VIEW_START_Y ) ) + if( ( sLabelX > UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width ) || ( sLabelX < UI_MAP.ViewRegion.x ) || + ( sLabelY > UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height ) || ( sLabelY < UI_MAP.ViewRegion.y ) ) { continue; } @@ -7284,8 +7301,8 @@ void BlitSAMGridMarkers( void ) // get location on screen GetScreenXYFromMapXY( gpSamSectorX[ iCounter ], gpSamSectorY[ iCounter ], &sScreenX, &sScreenY ); - sWidth = MAP_GRID_X; - sHeight= MAP_GRID_Y; + sWidth = UI_MAP.GridSize.iX; + sHeight= UI_MAP.GridSize.iY; // draw rectangle RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); @@ -7302,8 +7319,8 @@ void BlitSAMGridMarkers( void ) // get location on screen GetScreenXYFromMapXY( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ], &sScreenX, &sScreenY ); - sWidth = MAP_GRID_X; - sHeight= MAP_GRID_Y; + sWidth = UI_MAP.GridSize.iX; + sHeight= UI_MAP.GridSize.iY; // draw rectangle RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + sWidth, sScreenY + sHeight - 1, usColor, pDestBuf ); @@ -7416,8 +7433,8 @@ void ShowDiseaseOnMap() if ( pSectorInfo && ((pSectorInfo->usInfectionFlag & SECTORDISEASE_DIAGNOSED_PLAYER) || gubFact[FACT_DISEASE_WHODATA_ACCESS] ) ) { - sXCorner = (INT16)( MAP_VIEW_START_X + ( sMapX * MAP_GRID_X ) ); - sYCorner = (INT16)( MAP_VIEW_START_Y + ( sMapY * MAP_GRID_Y ) ); + sXCorner = (INT16)( UI_MAP.ViewRegion.x + ( sMapX * UI_MAP.GridSize.iX ) ); + sYCorner = (INT16)( UI_MAP.ViewRegion.y + ( sMapY * UI_MAP.GridSize.iY ) ); if ( pSectorInfo->usNumCorpses > 0 ) { @@ -7425,7 +7442,7 @@ void ShowDiseaseOnMap() swprintf( sString, L"%d", pSectorInfo->usNumCorpses ); - FindFontCenterCoordinates( sXCorner, sYCorner, MAP_GRID_X, MAP_GRID_Y, sString, MapItemsFont, &usXPos, &usYPos ); + FindFontCenterCoordinates( sXCorner, sYCorner, UI_MAP.GridSize.iX, UI_MAP.GridSize.iY, sString, MapItemsFont, &usXPos, &usYPos ); mprintf( usXPos, usYPos, sString ); } @@ -7439,7 +7456,7 @@ void ShowDiseaseOnMap() sYCorner += GetFontHeight( MapItemsFont ); - FindFontCenterCoordinates( sXCorner, sYCorner, MAP_GRID_X, MAP_GRID_Y, sString, MapItemsFont, &usXPos, &usYPos ); + FindFontCenterCoordinates( sXCorner, sYCorner, UI_MAP.GridSize.iX, UI_MAP.GridSize.iY, sString, MapItemsFont, &usXPos, &usYPos ); mprintf( usXPos, usYPos, sString ); } @@ -7492,12 +7509,12 @@ void ShowItemsOnMap( void ) if ( uiItemCnt > 0 ) { - sXCorner = ( INT16 )( MAP_VIEW_START_X + ( sMapX * MAP_GRID_X ) ); - sYCorner = ( INT16 )( MAP_VIEW_START_Y + ( sMapY * MAP_GRID_Y ) ); + sXCorner = ( INT16 )( UI_MAP.ViewRegion.x + ( sMapX * UI_MAP.GridSize.iX ) ); + sYCorner = ( INT16 )( UI_MAP.ViewRegion.y + ( sMapY * UI_MAP.GridSize.iY ) ); swprintf( sString, L"%d", uiItemCnt ); - FindFontCenterCoordinates( sXCorner, sYCorner, MAP_GRID_X, MAP_GRID_Y, sString, MapItemsFont, &usXPos, &usYPos ); + FindFontCenterCoordinates( sXCorner, sYCorner, UI_MAP.GridSize.iX, UI_MAP.GridSize.iY, sString, MapItemsFont, &usXPos, &usYPos ); // sXPos -= StringPixLength( sString, MAP_FONT ) / 2; gprintfdirty( usXPos, usYPos, sString ); @@ -7527,27 +7544,27 @@ void DrawMapBoxIcon( HVOBJECT hIconHandle, UINT16 usVOIndex, INT16 sMapX, INT16 return; } - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI() || iResolution >= _1024x768) { - iconSize = 3; + iconSize = 6; } - else if (iResolution < _1024x768) + else if (iResolution >= _800x600) { iconSize = 4; } else { - iconSize = 6; + iconSize = 3; } iColumnNumber = ubIconPosition % MERC_ICONS_PER_LINE; iRowNumber = ubIconPosition / MERC_ICONS_PER_LINE; - iX = MAP_VIEW_START_X + ( sMapX * MAP_GRID_X ) + iconOffsetX + ( iconSize * iColumnNumber ); - iY = MAP_VIEW_START_Y + ( sMapY * MAP_GRID_Y ) + iconOffsetY + ( iconSize * iRowNumber ); + iX = UI_MAP.ViewRegion.x + ( sMapX * UI_MAP.GridSize.iX ) + iconOffsetX + ( iconSize * iColumnNumber ); + iY = UI_MAP.ViewRegion.y + ( sMapY * UI_MAP.GridSize.iY ) + iconOffsetY + ( iconSize * iRowNumber ); BltVideoObject( guiSAVEBUFFER, hIconHandle, usVOIndex , iX, iY, VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( iX, iY, iX + DMAP_GRID_X, iY + DMAP_GRID_Y ); + InvalidateRegion( iX, iY, iX + UI_MAP.GridSize.iX + 1, iY + UI_MAP.GridSize.iY + 1); } @@ -7599,8 +7616,8 @@ void DrawBullseye() if (iResolution >= _800x600) { - sX = sX + MAP_GRID_X / 2 - 10; - sY = sY + 1 + MAP_GRID_Y / 2 - 10; + sX = sX + UI_MAP.GridSize.iX / 2 - 10; + sY = sY + 1 + UI_MAP.GridSize.iY / 2 - 10; } BltVideoObject( guiSAVEBUFFER, hHandle, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -7616,7 +7633,7 @@ void HideExistenceOfUndergroundMapSector( UINT8 ubSectorX, UINT8 ubSectorY ) GetScreenXYFromMapXY( ubSectorX, ubSectorY, &sScreenX, &sScreenY ); // fill it with near black - ColorFillVideoSurfaceArea( guiSAVEBUFFER, sScreenX + 1, sScreenY, sScreenX + MAP_GRID_X, sScreenY + MAP_GRID_Y - 1, gusUndergroundNearBlack ); + ColorFillVideoSurfaceArea( guiSAVEBUFFER, sScreenX + 1, sScreenY, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, gusUndergroundNearBlack ); } @@ -8686,8 +8703,8 @@ void ShowIntelOnMap() UINT8 sector_y = SECTORY( sector ); // grab min and max locations to interpolate sub sector position - x0 = MAP_VIEW_START_X + MAP_GRID_X * ( sector_x ); - y0 = MAP_VIEW_START_Y + MAP_GRID_Y * ( sector_y ); + x0 = UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX * ( sector_x ); + y0 = UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY * ( sector_y ); AssertMsg( ( x0 >= 0 ) && ( x0 < SCREEN_WIDTH ), String( "ShowIntelOnMap: Invalid minX = %d", x0 ) ); AssertMsg( ( y0 >= 0 ) && ( y0 < SCREEN_HEIGHT ), String( "ShowIntelOnMap: Invalid minY = %d", y0 ) ); @@ -8714,7 +8731,7 @@ void ShowIntelOnMap() // restore clip blits RestoreClipRegionToFullScreen(); - FindFontCenterCoordinates( x0, y0, MAP_GRID_X, MAP_GRID_Y, gMapIntelData[sector].shorttext, MapItemsFont, &usXPos, &usYPos ); + FindFontCenterCoordinates( x0, y0, UI_MAP.GridSize.iX, UI_MAP.GridSize.iY, gMapIntelData[sector].shorttext, MapItemsFont, &usXPos, &usYPos ); mprintf( usXPos, usYPos, gMapIntelData[sector].shorttext ); } diff --git a/Strategic/Map Screen Interface Map.h b/Strategic/Map Screen Interface Map.h index 100e1bb6..2077ae18 100644 --- a/Strategic/Map Screen Interface Map.h +++ b/Strategic/Map Screen Interface Map.h @@ -305,20 +305,9 @@ extern UINT16 MAP_LEVEL_STRING_X; extern UINT16 MAP_LEVEL_STRING_Y; -// zoomed in grid sizes -#define MAP_GRID_ZOOM_X MAP_GRID_X*2 -#define MAP_GRID_ZOOM_Y MAP_GRID_Y*2 - // number of units wide #define WORLD_MAP_X 18 // WANNE: 18 darf nicht geändert werden! -// dirty regions for the map -#define DMAP_GRID_X ( MAP_GRID_X + 1 ) -#define DMAP_GRID_Y ( MAP_GRID_Y + 1 ) -#define DMAP_GRID_ZOOM_X ( MAP_GRID_ZOOM_X+1) -#define DMAP_GRID_ZOOM_Y ( MAP_GRID_ZOOM_Y+1) - - // Orta position on the map #define ORTA_SECTOR_X 4 #define ORTA_SECTOR_Y 11 diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index fd716b24..42958652 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -63,6 +63,11 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +extern int CHAR_BAR_INFO_X; +extern int CHAR_BAR_INFO_Y; +extern UILayout_Map UI_MAP; +extern UILayout_CharPanelIconRegion UI_CHAR_Icon; +extern UILayout_CharList UI_CHARLIST; // marke strogg more mercs extern UINT8 FIRSTmercTOdisplay = 0 ; @@ -870,7 +875,7 @@ void RestoreBackgroundForAssignmentGlowRegionList( void ) INT16 yHeight = GetRefreshHeightForMercList(); // restore background - RestoreExternBackgroundRect( 66 + xResOffset, Y_START - 1, 118 + 1 - 67, yHeight ); + RestoreExternBackgroundRect(UI_CHARLIST.xAssignment, UI_CHARLIST.y - 1, UI_CHARLIST.widthAssignment + 1, yHeight); // ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!! fTeamPanelDirty = TRUE; @@ -897,7 +902,7 @@ void RestoreBackgroundForDestinationGlowRegionList( void ) INT16 yHeight = GetRefreshHeightForMercList(); // restore background - RestoreExternBackgroundRect( 182 + xResOffset, Y_START - 1, 217 + 1 - 182, yHeight ); + RestoreExternBackgroundRect(UI_CHARLIST.xETA, UI_CHARLIST.y - 1, UI_CHARLIST.widthETA + 1, yHeight ); // ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!! fTeamPanelDirty = TRUE; @@ -927,7 +932,7 @@ void RestoreBackgroundForContractGlowRegionList( void ) INT16 yHeight = GetRefreshHeightForMercList(); // restore background - RestoreExternBackgroundRect( 222 + xResOffset, Y_START - 1, 250 + 1 - 222, yHeight ) ; + RestoreExternBackgroundRect(UI_CHARLIST.xTimeRemaining, UI_CHARLIST.y - 1, UI_CHARLIST.widthTimeRemaining + 1, yHeight ) ; // ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!! fTeamPanelDirty = TRUE; @@ -961,7 +966,7 @@ void RestoreBackgroundForSleepGlowRegionList( void ) INT16 yHeight = GetRefreshHeightForMercList(); // restore background - RestoreExternBackgroundRect( 123 + xResOffset, Y_START - 1, 142 + 1 - 123, yHeight ) ; + RestoreExternBackgroundRect(UI_CHARLIST.xSleep, UI_CHARLIST.y - 1, UI_CHARLIST.widthSleep + 1, yHeight ) ; // ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!! fTeamPanelDirty = TRUE; @@ -1351,7 +1356,7 @@ void HandleDisplayOfSelectedMercArrows( void ) HVOBJECT hHandle; UINT8 ubCount = 0; - UINT16 selectedCharArrowX = xResOffset + 1; + UINT16 selectedCharArrowX = UI_CHARLIST.Region.x + 1; // blit an arrow by the name of each merc in a selected list if( bSelectedInfoChar == -1 ) @@ -1377,7 +1382,8 @@ void HandleDisplayOfSelectedMercArrows( void ) // now blit one by the selected merc // marke strogg more mercs - sYPosition = Y_START+( ( bSelectedInfoChar - FIRSTmercTOdisplay ) * ( Y_SIZE + 2 ) ) - 1; + const auto y = UI_CHARLIST.y; + sYPosition = y + ( ( bSelectedInfoChar - FIRSTmercTOdisplay ) * ( Y_SIZE + 2 ) ) - 1; GetVideoObject( &hHandle, guiSelectedCharArrow ); BltVideoObject( guiSAVEBUFFER , hHandle, 0,selectedCharArrowX, sYPosition , VO_BLT_SRCTRANSPARENCY,NULL ); @@ -1393,7 +1399,7 @@ void HandleDisplayOfSelectedMercArrows( void ) // are they in the selected list or int he same mvt group as this guy if( ( IsEntryInSelectedListSet( ubCount + FIRSTmercTOdisplay ) == TRUE ) || ( ( GetSelectedDestChar() != - 1 ) ? ( ( Menptr[ gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID ].ubGroupID != 0 ) ? ( Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ].ubGroupID == Menptr[ gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID ].ubGroupID ) : FALSE ) : FALSE ) ) { - sYPosition = Y_START+( ubCount * ( Y_SIZE + 2) ) - 1; + sYPosition = y + ( ubCount * ( Y_SIZE + 2) ) - 1; GetVideoObject( &hHandle, guiSelectedCharArrow ); BltVideoObject( guiSAVEBUFFER , hHandle, 0,selectedCharArrowX, sYPosition , VO_BLT_SRCTRANSPARENCY,NULL ); @@ -1886,8 +1892,13 @@ void HandleGroupAboutToArrive( void ) void CreateMapStatusBarsRegion( void ) { - MSYS_DefineRegion( &gMapStatusBarsRegion, BAR_INFO_X + xResOffset - 3, BAR_INFO_Y + yResOffset - 42,(INT16)( BAR_INFO_X + xResOffset + 17), (INT16)(BAR_INFO_Y + yResOffset), MSYS_PRIORITY_HIGH + 5, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_DefineRegion( &gMapStatusBarsRegion, + CHAR_BAR_INFO_X - 3, + CHAR_BAR_INFO_Y - 42, + CHAR_BAR_INFO_X + 17, + CHAR_BAR_INFO_Y, + MSYS_PRIORITY_HIGH + 5, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK) + ; return; } @@ -2159,7 +2170,7 @@ void UpdateMapScreenAssignmentPositions( void ) else { // marke strogg more mercs - giBoxY = ( Y_START + ( bSelectedAssignChar - FIRSTmercTOdisplay ) * ( Y_SIZE + 2 ) ); + giBoxY = (UI_CHARLIST.y + ( bSelectedAssignChar - FIRSTmercTOdisplay ) * ( Y_SIZE + 2 ) ); } AssignmentPosition.iY = giBoxY; @@ -2319,7 +2330,7 @@ void UpdateMapScreenMilitiaControlPositions( void ) } else { - giBoxY = ( Y_START + ( bSelectedAssignChar ) * ( Y_SIZE + 2 ) ); + giBoxY = (UI_CHARLIST.y + ( bSelectedAssignChar ) * ( Y_SIZE + 2 ) ); } MilitiaControlPosition.iY = giBoxY; @@ -3730,7 +3741,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) void CreatePopUpBoxForMovementBox( void ) { - SGPPoint MovePosition = {450 + xResOffset, 100 + yResOffset}; + SGPPoint MovePosition = { UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, UI_MAP.ViewRegion.y + 100 }; SGPPoint Position; SGPRect Dimensions; @@ -3795,15 +3806,15 @@ void CreatePopUpBoxForMovementBox( void ) GetBoxSize( ghMoveBox, &Dimensions ); // adjust position to try to keep it in the map area as best as possible - if ( Position.iX + Dimensions.iRight >= ( MAP_VIEW_START_X + MAP_VIEW_WIDTH ) ) + if ( Position.iX + Dimensions.iRight >= (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) ) { - Position.iX = max( MAP_VIEW_START_X, ( MAP_VIEW_START_X + MAP_VIEW_WIDTH ) - Dimensions.iRight ); + Position.iX = max(UI_MAP.ViewRegion.x, (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) - Dimensions.iRight ); SetBoxPosition( ghMoveBox, Position ); } - if ( Position.iY + Dimensions.iBottom >= ( MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) ) + if ( Position.iY + Dimensions.iBottom >= (UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height) ) { - Position.iY = max( MAP_VIEW_START_Y, ( MAP_VIEW_START_Y + MAP_VIEW_HEIGHT ) - Dimensions.iBottom ); + Position.iY = max( UI_MAP.ViewRegion.y, (UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height) - Dimensions.iBottom ); SetBoxPosition( ghMoveBox, Position ); } } @@ -5643,14 +5654,26 @@ void CreateDestroyInsuranceMouseRegionForMercs( BOOLEAN fCreate ) if( ( fCreated == FALSE ) && ( fCreate == TRUE ) ) { - MSYS_DefineRegion( &gContractIconRegion, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + yResOffset, CHAR_ICON_X + xResOffset + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + yResOffset + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + const auto x = UI_CHAR_Icon.x; + const auto y = UI_CHAR_Icon.y; + const auto width = UI_CHAR_Icon.width; + const auto height = UI_CHAR_Icon.height; + const auto spacing = UI_CHAR_Icon.spacing; - MSYS_DefineRegion( &gInsuranceIconRegion, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + CHAR_ICON_SPACING + yResOffset, CHAR_ICON_X + xResOffset + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + CHAR_ICON_SPACING + yResOffset + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_DefineRegion( &gContractIconRegion, + x, y, x + width, y + height, + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK + ); - MSYS_DefineRegion( &gDepositIconRegion, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ) + yResOffset, CHAR_ICON_X + xResOffset + CHAR_ICON_WIDTH, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ) + yResOffset + CHAR_ICON_HEIGHT, - MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_DefineRegion( &gInsuranceIconRegion, + x, y + spacing, x + width, y + height + spacing, + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK + ); + + MSYS_DefineRegion( &gDepositIconRegion, + x, y + ( 2 * spacing), x + width, y + ( 2 * spacing) + height, + MSYS_PRIORITY_HIGH - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK + ); fCreated = TRUE; } @@ -6708,14 +6731,14 @@ void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSecto //Convert the sector value into screen values. GetScreenXYFromMapXY( sSectorX, sSectorY, &sScreenX, &sScreenY ); // make sure we are on the border - if( sScreenX < MAP_GRID_X ) + if( sScreenX < UI_MAP.GridSize.iX) { - sScreenX = MAP_GRID_X; + sScreenX = UI_MAP.GridSize.iX; } sScreenY--; //Carterism ritual - if( sScreenY < MAP_GRID_Y ) + if( sScreenY < UI_MAP.GridSize.iY ) { - sScreenY = MAP_GRID_Y; + sScreenY = UI_MAP.GridSize.iY; } uiTimer = GetJA2Clock(); @@ -6738,13 +6761,13 @@ void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSecto } } - RestoreExternBackgroundRect( (INT16)(sScreenX + 1), (INT16)(sScreenY - 1), MAP_GRID_X , MAP_GRID_Y ); + RestoreExternBackgroundRect( (INT16)(sScreenX + 1), (INT16)(sScreenY - 1), UI_MAP.GridSize.iX , UI_MAP.GridSize.iY ); // blit object to frame buffer BltVideoObject( FRAME_BUFFER, hHandle, ubFrame, sScreenX, sScreenY, VO_BLT_SRCTRANSPARENCY, NULL ); // invalidate region on frame buffer - InvalidateRegion( sScreenX, sScreenY - 1, sScreenX + MAP_GRID_X , sScreenY + MAP_GRID_Y ); + InvalidateRegion( sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX , sScreenY + UI_MAP.GridSize.iY ); } diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 3cc22a4c..f285cd2e 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -61,6 +61,7 @@ extern void InitializeTacticalStatusAtBattleStart(); extern BOOLEAN gfDelayAutoResolveStart; extern BOOLEAN gfTransitionMapscreenToAutoResolve; +extern UILayout_Map UI_MAP; #ifdef JA2BETAVERSION extern BOOLEAN gfExitViewer; @@ -1052,8 +1053,8 @@ void DoTransitionFromMapscreenToPreBattleInterface() uiStartTime = GetJA2Clock(); GetScreenXYFromMapXY( gubPBSectorX, gubPBSectorY, &sStartLeft, &sStartTop ); - sStartLeft += MAP_GRID_X / 2; - sStartTop += MAP_GRID_Y / 2; + sStartLeft += UI_MAP.GridSize.iX / 2; + sStartTop += UI_MAP.GridSize.iY / 2; sEndLeft = 131 + xResOffset; sEndTop = 180 + yResOffset; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index f129c3f8..16fe2906 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -179,193 +179,127 @@ extern INT8 gbCompatibleApplyItem; void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB #endif -// CHRISL: Reclassify all coordinates as int variables and declare their values in an initialization function. -int TOWN_INFO_X; -int TOWN_INFO_Y; +struct UILayout_CharStatusBars +{ + INT32 x; + INT32 y; + INT32 offset; +}; +struct UILayout_CharPanelButtons +{ + SGPPoint Up; + SGPPoint Down; + SGPPoint Contract; +}; + +struct UILayout_CharPanelTextLocations +{ + SGPRectangle CurrentAssignment; + SGPRectangle CurrentHealth; + SGPRectangle CurrentHitpoints; + SGPRectangle CurrentMorale; + SGPRectangle Pay; + SGPRectangle Salary; + SGPRectangle TimeRemaining; + SGPRectangle Medical; + SGPPoint Assignment; + SGPPoint Attributes; + SGPPoint Attributes2; + SGPPoint Health; + SGPPoint Morale; + SGPPoint Condition; + int CurrentAssignment_Y2; +}; + +struct UILayout_CharPanelAttributes +{ + SGPPoint AGL; + SGPPoint DEX; + SGPPoint STR; + SGPPoint LDR; + SGPPoint WIS; + SGPPoint LVL; + SGPPoint MRK; + SGPPoint MEC; + SGPPoint EXP; + SGPPoint MED; + int width; + int height; +}; + +struct UILayout_CharPanel +{ + SGPRectangle Region; + SGPRectangle FacePicture; + SGPRectangle FullName; + SGPRectangle NickName; + SGPRectangle HandItem; + UILayout_CharStatusBars Statusbars; + UILayout_CharPanelButtons Button; + UILayout_CharPanelTextLocations Text; + UILayout_CharPanelAttributes Attr; + UILayout_CharPanelIconRegion Icon; +}; + +struct UILayout_CharInvButtons +{ + SGPRectangle Trashcan; + SGPPoint Done; +}; + +struct UILayout_CharInvText +{ + SGPPoint Armor; + SGPPoint ArmorLabel; + SGPPoint ArmorPercent; + SGPPoint Weight; + SGPPoint WeightLabel; + SGPPoint WeightPercent; + SGPPoint Camo; + SGPPoint CamoLabel; + SGPPoint CamoPercent; + INT32 PercentWidth; + INT32 PercentHeight; +}; + +struct UILayout_CharInv +{ + SGPRectangle Region; + SGPPoint BodyPanel; + UILayout_CharInvButtons Button; + UILayout_CharInvText Text; +}; + +UILayout_Map UI_MAP; +UILayout_CharPanel UI_CHARPANEL; +UILayout_CharPanelIconRegion UI_CHAR_Icon; +UILayout_CharInv UI_CHARINV; +int UI_CHARINV_REGION_X; +int UI_CHARINV_REGION_Y; +int UI_CHARINV_REGION_W; +int UI_CHARINV_REGION_H; + +UILayout_CharList UI_CHARLIST; +extern UINT16 MAP_BOTTOM_LAPTOP_X; +extern UINT16 MAP_BOTTOM_LAPTOP_Y; + +int CHAR_BAR_INFO_X; +int CHAR_BAR_INFO_Y; int PLAYER_INFO_X; int PLAYER_INFO_Y; - // item description int MAP_ITEMDESC_START_X; int MAP_ITEMDESC_START_Y; - -int INV_REGION_X; int INV_REGION_Y; -int INV_REGION_WIDTH; -int INV_REGION_HEIGHT; -int INV_BTN_X; -int INV_BTN_Y; -int INV_BDROP_X; -int INV_BDROP_Y; - -int MAP_ARMOR_LABEL_X; -int MAP_ARMOR_LABEL_Y; -int MAP_ARMOR_X; -int MAP_ARMOR_Y; -int MAP_ARMOR_PERCENT_X; -int MAP_ARMOR_PERCENT_Y; - -int MAP_WEIGHT_LABEL_X; -int MAP_WEIGHT_LABEL_Y; -int MAP_WEIGHT_X; -int MAP_WEIGHT_Y; -int MAP_WEIGHT_PERCENT_X; -int MAP_WEIGHT_PERCENT_Y; - -int MAP_CAMMO_LABEL_X; -int MAP_CAMMO_LABEL_Y; -int MAP_CAMMO_X; -int MAP_CAMMO_Y; -int MAP_CAMMO_PERCENT_X; -int MAP_CAMMO_PERCENT_Y; - -int MAP_PERCENT_WIDTH; -int MAP_PERCENT_HEIGHT; - int MAP_INV_STATS_TITLE_FONT_COLOR; -int MAP_INV_STATS_TEXT_FONT_COLOR; - -int PLAYER_INFO_FACE_START_X; -int PLAYER_INFO_FACE_START_Y; -int PLAYER_INFO_FACE_END_X; -int PLAYER_INFO_FACE_END_Y; - -int INV_BODY_X; -int INV_BODY_Y; - -int NAME_X; -int NAME_WIDTH; - -int ASSIGN_X; -int ASSIGN_WIDTH; -int SLEEP_X; -int SLEEP_WIDTH; -int LOC_X; -int LOC_WIDTH; -int DEST_ETA_X; -int DEST_ETA_WIDTH; -int TIME_REMAINING_X; -int TIME_REMAINING_WIDTH; - -int CLOCK_Y_START; - -int DEST_PLOT_X; -int DEST_PLOT_Y; - -int CLOCK_ETA_X; -int CLOCK_HOUR_X_START; -int CLOCK_MIN_X_START; - -// contract -int CONTRACT_X; -int CONTRACT_Y; - -// trash can -int TRASH_CAN_X; -int TRASH_CAN_Y; -int TRASH_CAN_WIDTH; -int TRASH_CAN_HEIGHT; - // keyring int MAP_KEYRING_X; int MAP_KEYRING_Y; - -//Text offsets -int Y_OFFSET; - // The boxes defines -int TRAIN_Y_OFFSET; -int TRAIN_X_OFF; -int TRAIN_WID; -int TRAIN_HEIG; -int STRING_X_OFFSET; -int STRING_Y_OFFSET; int POP_UP_BOX_X; -int POP_UP_BOX_Y; -int POP_UP_BOX_WIDTH; -int POP_UP_BOX_HEIGHT; -int MOUSE_PTR_Y_OFFSET; -int POP_UP_Y_OFFSET; -int TRAIN_TEXT_Y_OFFSET; -// char stat positions -int STR_X; -int STR_Y; -int DEX_X; -int DEX_Y; -int AGL_X; -int AGL_Y; -int LDR_X; -int LDR_Y; -int WIS_X; -int WIS_Y; -int LVL_X; -int LVL_Y; -int MRK_X; -int MRK_Y; -int MEC_X; -int MEC_Y; -int EXP_X; -int EXP_Y; -int MED_X; -int MED_Y; - -int STAT_WID; -int STAT_HEI; - -int PIC_NAME_X; -int PIC_NAME_Y; -int PIC_NAME_WID; -int PIC_NAME_HEI; -int CHAR_NAME_X; -int CHAR_NAME_Y; -int CHAR_NAME_WID; -int CHAR_NAME_HEI; -int CHAR_LOC_X; -int CHAR_LOC_Y; -int CHAR_LOC_WID; -int CHAR_LOC_HEI; -int CHAR_TIME_REMAINING_X; -int CHAR_TIME_REMAINING_Y; -int CHAR_TIME_REMAINING_WID; -int CHAR_TIME_REMAINING_HEI; -int CHAR_SALARY_X; -int CHAR_SALARY_Y; -int CHAR_SALARY_WID; -int CHAR_SALARY_HEI; -int CHAR_MEDICAL_X; -int CHAR_MEDICAL_Y; -int CHAR_MEDICAL_WID; -int CHAR_MEDICAL_HEI; -int CHAR_ASSIGN_X; -int CHAR_ASSIGN1_Y; -int CHAR_ASSIGN2_Y; -int CHAR_ASSIGN_WID; -int CHAR_ASSIGN_HEI; -int CHAR_HP_X; -int CHAR_HP_Y; -int CHAR_HP_WID; -int CHAR_HP_HEI; -int CHAR_MORALE_X; -int CHAR_MORALE_Y; -int CHAR_MORALE_WID; -int CHAR_MORALE_HEI; - -int CROSS_X; -int CROSS_Y; -int CROSS_HEIGHT; -int CROSS_WIDTH; -int CHAR_PAY_X; -int CHAR_PAY_Y; -int CHAR_PAY_HEI; -int CHAR_PAY_WID; -int SOLDIER_PIC_X; -int SOLDIER_PIC_Y; -int SOLDIER_HAND_X; -int SOLDIER_HAND_Y; - // OJW: MP POSITIONS int MP_BTN_Y; int MP_ROWSTART_Y; @@ -477,6 +411,8 @@ SGPPoint gMapSortButtons[ MAX_SORT_METHODS ]={ {216,113}, }; + + // map screen's inventory panel pockets - top right corner coordinates INV_REGION_DESC gMapScreenInvPocketXY[NUM_INV_SLOTS]; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS INV_REGION_DESC gSCamoXY; @@ -591,8 +527,9 @@ extern void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); extern void SwapGoggles(SOLDIERTYPE *pTeamSoldier); // HEADROCK HAM B2.8: Function to switch team's goggles uniformly extern void SwapGogglesUniformly(SOLDIERTYPE *pTeamSoldier, BOOLEAN fToNightVision); - extern void InternalMAPBeginItemPointer( SOLDIERTYPE *pSoldier ); +extern BOOLEAN ValidSelectableCharForNextOrPrev(INT32 iNewCharSlot); + UINT32 guiCHARLIST; UINT32 guiCHARINFO; @@ -953,6 +890,8 @@ void MAPBeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ); void CreateDestroyMapInvButton(); void PrevInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ); void NextInventoryMapBtnCallback( GUI_BUTTON *btn, INT32 reason ); +void CreateMapCharInvIOregions(); +void DestroyMapCharInvIOregions(); // check if cursor needs to be set to checkmark or to the walking guy? void UpdateCursorIfInLastSector( void ); @@ -1063,6 +1002,7 @@ void DumpSectorDifficultyInfo( void ); void DumpItemsList( void ); #endif + BOOLEAN IsMercInActiveSector(SOLDIERTYPE * pSoldier) { if(pSoldier->sSectorX != sSelMapX) @@ -1153,658 +1093,764 @@ void BeginDeleteAllCallBack( UINT8 bExitValue ) #endif } -// CHRISL: New functions to handle initialization of inventory coordinates + +void InitializeInvPanelCoords() +{ + { + //UI_CHARPANEL.Region = { + // UI_MAP.BorderRegion.x - 261, + // 0, + // 261, 106 + //}; + const auto x = UI_CHARPANEL.Region.x; + const auto y = UI_CHARPANEL.Region.y; + + UI_CHARPANEL.FacePicture = { + x + 9, + y + 20, + 60, 63 + }; + + UI_CHARPANEL.NickName = { + x + 8, + y + 69, + 52, + 6 + }; + + UI_CHARPANEL.FullName = { + x + 14, + y + 5, + 150, + 6 + }; + + UI_CHARPANEL.HandItem = { + x + 4, + y + 81, + 59, 20 + }; + + UI_CHARPANEL.Statusbars = { x + 66, y + 61, 6 }; + // For extern use + CHAR_BAR_INFO_X = UI_CHARPANEL.Statusbars.x; + CHAR_BAR_INFO_Y = UI_CHARPANEL.Statusbars.y; + + UI_CHARPANEL.Button.Up = { x + 67, y + 68 }; + UI_CHARPANEL.Button.Down = { x + 67, y + 87 }; + UI_CHARPANEL.Button.Contract = { x + 185, y + 50 }; + + UI_CHARPANEL.Text.Assignment = { x + 220, y + 4 }; + UI_CHARPANEL.Text.Attributes = { x + 88, y + 22 }; + UI_CHARPANEL.Text.Attributes2 = { x + 133, y + 22 }; + UI_CHARPANEL.Text.Health = { x + 87, y + 80 }; + UI_CHARPANEL.Text.Morale = { x + 87, y + 94 }; + UI_CHARPANEL.Text.Condition = { x + 87, y + 80 }; + + UI_CHARPANEL.Icon = { + x + 187, + y + 64, + 10, 10, 13 + }; + // For extern use + UI_CHAR_Icon = UI_CHARPANEL.Icon; + + { + const int x1 = x + 112; + const int x2 = x + 159; + const int y1 = y + 22; + const int yOffset = 10; + // First column + UI_CHARPANEL.Attr.AGL = { x1, y1 }; + UI_CHARPANEL.Attr.DEX = { x1, y1 + yOffset }; + UI_CHARPANEL.Attr.STR = { x1, y1 + yOffset * 2 }; + UI_CHARPANEL.Attr.LDR = { x1, y1 + yOffset * 3 }; + UI_CHARPANEL.Attr.WIS = { x1, y1 + yOffset * 4 }; + // Second column + UI_CHARPANEL.Attr.LVL = { x2, y1 }; + UI_CHARPANEL.Attr.MRK = { x2, y1 + yOffset }; + UI_CHARPANEL.Attr.MEC = { x2, y1 + yOffset * 2 }; + UI_CHARPANEL.Attr.EXP = { x2, y1 + yOffset * 3 }; + UI_CHARPANEL.Attr.MED = { x2, y1 + yOffset * 4 }; + UI_CHARPANEL.Attr.width = 15; + UI_CHARPANEL.Attr.height = GetFontHeight(CHAR_FONT); + } + UI_CHARPANEL.Text.CurrentHitpoints = { + x + 133, + y + 80, + 42, 10 + }; + + UI_CHARPANEL.Text.CurrentMorale = { + x + 133, + y + 94, + 42, 7 + }; + + UI_CHARPANEL.Text.Pay = { + x + 150, + y + 84, + 45, GetFontHeight(CHAR_FONT) + }; + + UI_CHARPANEL.Text.TimeRemaining = { + x + 207, + y + 65, + 51, GetFontHeight(CHAR_FONT) + }; + + UI_CHARPANEL.Text.Salary = { + UI_CHARPANEL.Text.TimeRemaining.x, + y + 79, + UI_CHARPANEL.Text.TimeRemaining.width - 8, + UI_CHARPANEL.Text.TimeRemaining.height + }; + + UI_CHARPANEL.Text.Medical = { + UI_CHARPANEL.Text.TimeRemaining.x, + y + 93, + UI_CHARPANEL.Text.TimeRemaining.width - 8, + UI_CHARPANEL.Text.TimeRemaining.height + }; + + UI_CHARPANEL.Text.CurrentAssignment = { + x + 182, + y + 18, + 79, 10 + }; + UI_CHARPANEL.Text.CurrentAssignment_Y2 = y + 31; + } + // END Charpanel + + // BEGIN Strategic merc inventory + { + //UI_CHARINV.Region = { + // UI_MAP.BorderRegion.x - 262, + // UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + // 262, 490 + //}; + const auto x = UI_CHARINV.Region.x; + const auto y = UI_CHARINV.Region.y; + // For extern use + PLAYER_INFO_X = x; + PLAYER_INFO_Y = y; + UI_CHARINV_REGION_X = UI_CHARINV.Region.x; + UI_CHARINV_REGION_Y = UI_CHARINV.Region.y; + UI_CHARINV_REGION_W = UI_CHARINV.Region.width; + UI_CHARINV_REGION_H = UI_CHARINV.Region.height; + + // item description region + MAP_ITEMDESC_START_X = x; + MAP_ITEMDESC_START_Y = y; + + UI_CHARINV.Button.Done = {x + 226, y + 19}; + UI_CHARINV.Button.Trashcan = { x + 209, y + 59, 28, 22 }; + + UI_CHARINV.Text.Armor = { x + 137, y + 79 }; + UI_CHARINV.Text.ArmorLabel = { x + 136, y + 69 }; + UI_CHARINV.Text.ArmorPercent = { x + 158, y + 79 }; + + UI_CHARINV.Text.Weight = { x + 188, y + 113 }; + UI_CHARINV.Text.WeightLabel = { x + 185, y + 102 }; + UI_CHARINV.Text.WeightPercent = { x + 208, y + 113 }; + + UI_CHARINV.Text.Camo = { x + 223, y + 113 }; + UI_CHARINV.Text.CamoLabel = { x + 223, y + 102 }; + UI_CHARINV.Text.CamoPercent = { x + 243, y + 113 }; + + UI_CHARINV.Text.PercentWidth = 20; + UI_CHARINV.Text.PercentHeight = 10; + + UI_CHARINV.BodyPanel = { x + 31, y + 8 }; + + // X, Y Location of Map screen's Camouflage region + gSCamoXY.sX = UI_CHARINV.BodyPanel.iX; + gSCamoXY.sY = UI_CHARINV.BodyPanel.iY; + + //For extern use + MAP_KEYRING_X = x + 186; + MAP_KEYRING_Y = y + 19; + + + gMapScreenInvPocketXY[0].sX = x + 131; gMapScreenInvPocketXY[0].sY = y + 9; // HELMETPOS + gMapScreenInvPocketXY[1].sX = x + 131; gMapScreenInvPocketXY[1].sY = y + 37; // VESTPOS + gMapScreenInvPocketXY[2].sX = x + 131; gMapScreenInvPocketXY[2].sY = y + 97; // LEGPOS + gMapScreenInvPocketXY[3].sX = x + 14; gMapScreenInvPocketXY[3].sY = y + 9; // HEAD1POS + gMapScreenInvPocketXY[4].sX = x + 14; gMapScreenInvPocketXY[4].sY = y + 32; // HEAD2POS + gMapScreenInvPocketXY[5].sX = x + 14; gMapScreenInvPocketXY[5].sY = y + 86; // HANDPOS + gMapScreenInvPocketXY[6].sX = x + 14; gMapScreenInvPocketXY[6].sY = y + 110; // SECONDHANDPOS + gMapScreenInvPocketXY[7].sX = x + 186; gMapScreenInvPocketXY[7].sY = y + 156; // VESTPOCK + gMapScreenInvPocketXY[8].sX = x + 29; gMapScreenInvPocketXY[8].sY = y + 256; // LTHIGHPOCK + gMapScreenInvPocketXY[9].sX = x + 112; gMapScreenInvPocketXY[9].sY = y + 256; // RTHIGHPOCK + gMapScreenInvPocketXY[10].sX = x + 194; gMapScreenInvPocketXY[10].sY = y + 256; // CPACKPOCK + gMapScreenInvPocketXY[11].sX = x + 173; gMapScreenInvPocketXY[11].sY = y + 439; // BPACKPOCK + gMapScreenInvPocketXY[12].sX = x + 95; gMapScreenInvPocketXY[12].sY = y + 156; // GUNSLINGPOCKPOS + gMapScreenInvPocketXY[13].sX = x + 36; gMapScreenInvPocketXY[13].sY = y + 156; // KNIFEPOCKPOS + gMapScreenInvPocketXY[14].sX = x + 186; gMapScreenInvPocketXY[14].sY = y + 336; // BIGPOCK1 + gMapScreenInvPocketXY[15].sX = x + 186; gMapScreenInvPocketXY[15].sY = y + 360; // BIGPOCK2 + gMapScreenInvPocketXY[16].sX = x + 186; gMapScreenInvPocketXY[16].sY = y + 384; // BIGPOCK3 + gMapScreenInvPocketXY[17].sX = x + 98; gMapScreenInvPocketXY[17].sY = y + 379; // BIGPOCK4 + gMapScreenInvPocketXY[18].sX = x + 98; gMapScreenInvPocketXY[18].sY = y + 403; // BIGPOCK5 + gMapScreenInvPocketXY[19].sX = x + 98; gMapScreenInvPocketXY[19].sY = y + 427; // BIGPOCK6 + gMapScreenInvPocketXY[20].sX = x + 98; gMapScreenInvPocketXY[20].sY = y + 451; // BIGPOCK7 + gMapScreenInvPocketXY[21].sX = x + 202; gMapScreenInvPocketXY[21].sY = y + 188; // MEDPOCK1 + gMapScreenInvPocketXY[22].sX = x + 202; gMapScreenInvPocketXY[22].sY = y + 212; // MEDPOCK2 + gMapScreenInvPocketXY[23].sX = x + 29; gMapScreenInvPocketXY[23].sY = y + 336; // MEDPOCK3 + gMapScreenInvPocketXY[24].sX = x + 112; gMapScreenInvPocketXY[24].sY = y + 336; // MEDPOCK4 + gMapScreenInvPocketXY[25].sX = x + 22; gMapScreenInvPocketXY[25].sY = y + 188; // SMALLPOCK1 + gMapScreenInvPocketXY[26].sX = x + 58; gMapScreenInvPocketXY[26].sY = y + 188; // SMALLPOCK2 + gMapScreenInvPocketXY[27].sX = x + 94; gMapScreenInvPocketXY[27].sY = y + 188; // SMALLPOCK3 + gMapScreenInvPocketXY[28].sX = x + 130; gMapScreenInvPocketXY[28].sY = y + 188; // SMALLPOCK4 + gMapScreenInvPocketXY[29].sX = x + 166; gMapScreenInvPocketXY[29].sY = y + 188; // SMALLPOCK5 + gMapScreenInvPocketXY[30].sX = x + 22; gMapScreenInvPocketXY[30].sY = y + 212; // SMALLPOCK6 + gMapScreenInvPocketXY[31].sX = x + 58; gMapScreenInvPocketXY[31].sY = y + 212; // SMALLPOCK7 + gMapScreenInvPocketXY[32].sX = x + 94; gMapScreenInvPocketXY[32].sY = y + 212; // SMALLPOCK8 + gMapScreenInvPocketXY[33].sX = x + 130; gMapScreenInvPocketXY[33].sY = y + 212; // SMALLPOCK9 + gMapScreenInvPocketXY[34].sX = x + 166; gMapScreenInvPocketXY[34].sY = y + 212; // SMALLPOCK10 + gMapScreenInvPocketXY[35].sX = x + 18; gMapScreenInvPocketXY[35].sY = y + 288; // SMALLPOCK11 + gMapScreenInvPocketXY[36].sX = x + 54; gMapScreenInvPocketXY[36].sY = y + 288; // SMALLPOCK12 + gMapScreenInvPocketXY[37].sX = x + 18; gMapScreenInvPocketXY[37].sY = y + 312; // SMALLPOCK13 + gMapScreenInvPocketXY[38].sX = x + 54; gMapScreenInvPocketXY[38].sY = y + 312; // SMALLPOCK14 + gMapScreenInvPocketXY[39].sX = x + 100; gMapScreenInvPocketXY[39].sY = y + 288; // SMALLPOCK15 + gMapScreenInvPocketXY[40].sX = x + 136; gMapScreenInvPocketXY[40].sY = y + 288; // SMALLPOCK16 + gMapScreenInvPocketXY[41].sX = x + 100; gMapScreenInvPocketXY[41].sY = y + 312; // SMALLPOCK17 + gMapScreenInvPocketXY[42].sX = x + 136; gMapScreenInvPocketXY[42].sY = y + 312; // SMALLPOCK18 + gMapScreenInvPocketXY[43].sX = x + 183; gMapScreenInvPocketXY[43].sY = y + 288; // SMALLPOCK19 + gMapScreenInvPocketXY[44].sX = x + 219; gMapScreenInvPocketXY[44].sY = y + 288; // SMALLPOCK20 + gMapScreenInvPocketXY[45].sX = x + 183; gMapScreenInvPocketXY[45].sY = y + 312; // SMALLPOCK21 + gMapScreenInvPocketXY[46].sX = x + 219; gMapScreenInvPocketXY[46].sY = y + 312; // SMALLPOCK22 + gMapScreenInvPocketXY[47].sX = x + 26; gMapScreenInvPocketXY[47].sY = y + 379; // SMALLPOCK23 + gMapScreenInvPocketXY[48].sX = x + 26; gMapScreenInvPocketXY[48].sY = y + 403; // SMALLPOCK24 + gMapScreenInvPocketXY[49].sX = x + 26; gMapScreenInvPocketXY[49].sY = y + 427; // SMALLPOCK25 + gMapScreenInvPocketXY[50].sX = x + 26; gMapScreenInvPocketXY[50].sY = y + 451; // SMALLPOCK26 + gMapScreenInvPocketXY[51].sX = x + 62; gMapScreenInvPocketXY[51].sY = y + 379; // SMALLPOCK27 + gMapScreenInvPocketXY[52].sX = x + 62; gMapScreenInvPocketXY[52].sY = y + 403; // SMALLPOCK28 + gMapScreenInvPocketXY[53].sX = x + 62; gMapScreenInvPocketXY[53].sY = y + 427; // SMALLPOCK29 + gMapScreenInvPocketXY[54].sX = x + 62; gMapScreenInvPocketXY[54].sY = y + 451; // SMALLPOCK30 + } + // END Strategic merc inventory + + // BEGIN Character list + { + //UI_CHARLIST.Region = { 0, 0, 254, 600 }; + const auto x = UI_CHARLIST.Region.x; + + UI_CHARLIST.y = UI_CHARLIST.Region.y + 26; + UI_CHARLIST.yOffset = 2; + UI_CHARLIST.Title = { x, UI_CHARLIST.Region.y + 5 - 113 }; // 113 comes from gMapSortButtons y-coordinate + UI_CHARLIST.xName = x + 4; + UI_CHARLIST.widthName = 51; + UI_CHARLIST.xAssignment = x + 60; + UI_CHARLIST.widthAssignment = 51; + UI_CHARLIST.xSleep = x + 116; + UI_CHARLIST.widthSleep = 19; + UI_CHARLIST.xLocation = x + 140; + UI_CHARLIST.widthLocation = 32; + UI_CHARLIST.xETA = x + 177; + UI_CHARLIST.widthETA = 33; + UI_CHARLIST.xTimeRemaining = x + 215; + UI_CHARLIST.widthTimeRemaining = 28; + + //For extern use + POP_UP_BOX_X = x + 120; + } + MAP_INV_STATS_TITLE_FONT_COLOR = 6; +} + BOOLEAN InitializeInvPanelCoordsOld() { - PLAYER_INFO_Y = yResOffset + 107; - TOWN_INFO_Y = yResOffset + 1; - - - PLAYER_INFO_X = xResOffset + 0; - TOWN_INFO_X = xResOffset + 0; - MAP_ITEMDESC_START_X = xResOffset + 0; - INV_BDROP_X = xResOffset + 0; - MAP_WEIGHT_LABEL_X = xResOffset + 173; - MAP_ARMOR_LABEL_X = xResOffset + 208; - MAP_ARMOR_X = xResOffset + 209; - MAP_ARMOR_PERCENT_X = xResOffset + 229; - MAP_WEIGHT_X = xResOffset + 176; - MAP_WEIGHT_PERCENT_X = xResOffset + 196; - MAP_CAMMO_LABEL_X = xResOffset + 178; - MAP_CAMMO_X = xResOffset + 176; - MAP_CAMMO_PERCENT_X = xResOffset + 196; - PLAYER_INFO_FACE_START_X = xResOffset + 9; - PLAYER_INFO_FACE_END_X = xResOffset + 60; - INV_BODY_X = xResOffset + 71; - NAME_X = xResOffset + 4; - ASSIGN_X = xResOffset + 60; - SLEEP_X = xResOffset + 116; - LOC_X = xResOffset + 140; - DEST_ETA_X = xResOffset + 177; - TIME_REMAINING_X = xResOffset + 215; - CONTRACT_X = xResOffset + 185; - TRASH_CAN_X = xResOffset + 176; - MAP_KEYRING_X = xResOffset + 217; //218/165 on Inventory_Bottom_Panel.sti - POP_UP_BOX_X = xResOffset + 120; - STR_X = xResOffset + 112; - LVL_X = xResOffset + 159; - CHAR_HP_X = xResOffset + 133; - CROSS_X = xResOffset + 195; - CHAR_PAY_X = xResOffset + 150; - SOLDIER_PIC_X = xResOffset + 9; - SOLDIER_HAND_X = xResOffset + 6; - CHAR_MORALE_X = xResOffset + 133; - PIC_NAME_X = xResOffset + 8; - CHAR_NAME_X = xResOffset + 14; - CHAR_LOC_X = xResOffset + 76; - CHAR_ASSIGN_X = xResOffset + 182; - CHAR_TIME_REMAINING_X = xResOffset + 207; - - // Inventory slots - gMapScreenInvPocketXY[HELMETPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[HELMETPOS].sY = PLAYER_INFO_Y + 9; // HELMETPOS - gMapScreenInvPocketXY[VESTPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[VESTPOS].sY = PLAYER_INFO_Y + 38; // VESTPOS - gMapScreenInvPocketXY[LEGPOS].sX = PLAYER_INFO_X + 204; gMapScreenInvPocketXY[LEGPOS].sY = PLAYER_INFO_Y + 98; // LEGPOS, - gMapScreenInvPocketXY[HEAD1POS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HEAD1POS].sY = PLAYER_INFO_Y + 9; // HEAD1POS - gMapScreenInvPocketXY[HEAD2POS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HEAD2POS].sY = PLAYER_INFO_Y + 33; // HEAD2POS - gMapScreenInvPocketXY[HANDPOS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[HANDPOS].sY = PLAYER_INFO_Y + 87; // HANDPOS, - gMapScreenInvPocketXY[SECONDHANDPOS].sX = PLAYER_INFO_X + 21; gMapScreenInvPocketXY[SECONDHANDPOS].sY = PLAYER_INFO_Y + 111; // SECONDHANDPOS - gMapScreenInvPocketXY[BIGPOCK1POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK1POS].sY = PLAYER_INFO_Y + 144; // BIGPOCK1 - gMapScreenInvPocketXY[BIGPOCK2POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK2POS].sY = PLAYER_INFO_Y + 168; // BIGPOCK2 - gMapScreenInvPocketXY[BIGPOCK3POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK3POS].sY = PLAYER_INFO_Y + 192; // BIGPOCK3 - gMapScreenInvPocketXY[BIGPOCK4POS].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[BIGPOCK4POS].sY = PLAYER_INFO_Y + 216; // BIGPOCK4 - gMapScreenInvPocketXY[SMALLPOCK1POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK1POS].sY = PLAYER_INFO_Y + 144; // SMALLPOCK1 - gMapScreenInvPocketXY[SMALLPOCK2POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK2POS].sY = PLAYER_INFO_Y + 168; // SMALLPOCK2 - gMapScreenInvPocketXY[SMALLPOCK3POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK3POS].sY = PLAYER_INFO_Y + 192; // SMALLPOCK3 - gMapScreenInvPocketXY[SMALLPOCK4POS].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[SMALLPOCK4POS].sY = PLAYER_INFO_Y + 216; // SMALLPOCK4 - gMapScreenInvPocketXY[SMALLPOCK5POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK5POS].sY = PLAYER_INFO_Y + 144; // SMALLPOCK5 - gMapScreenInvPocketXY[SMALLPOCK6POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK6POS].sY = PLAYER_INFO_Y + 168; // SMALLPOCK6 - gMapScreenInvPocketXY[SMALLPOCK7POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK7POS].sY = PLAYER_INFO_Y + 192; // SMALLPOCK7 - gMapScreenInvPocketXY[SMALLPOCK8POS].sX = PLAYER_INFO_X + 60; gMapScreenInvPocketXY[SMALLPOCK8POS].sY = PLAYER_INFO_Y + 216; // SMALLPOCK8 - - // item description - NAME_WIDTH = 51; - ASSIGN_WIDTH = 51; - SLEEP_WIDTH = 19; - LOC_WIDTH = 32; - DEST_ETA_WIDTH = 33; - TIME_REMAINING_WIDTH = 28; - CHAR_HP_WID = 42; - CHAR_MORALE_WID = 42; - PIC_NAME_WID = 52; - CHAR_NAME_WID = 150; - CHAR_TIME_REMAINING_WID = 51; - MAP_ITEMDESC_START_Y = PLAYER_INFO_Y; - INV_REGION_X = PLAYER_INFO_X; - INV_REGION_Y = PLAYER_INFO_Y; - INV_REGION_WIDTH = 261; - INV_REGION_HEIGHT = 359-94; - INV_BTN_X = PLAYER_INFO_X + 217; - INV_BTN_Y = PLAYER_INFO_Y + 210; - INV_BDROP_Y = 0; // Not used in old inventory - MAP_ARMOR_LABEL_Y = yResOffset + 180; - MAP_ARMOR_Y = yResOffset + 189; - MAP_ARMOR_PERCENT_Y = yResOffset + 190; - MAP_WEIGHT_LABEL_Y = yResOffset + 256; - MAP_WEIGHT_Y = yResOffset + 266; - MAP_WEIGHT_PERCENT_Y = yResOffset + 266; - MAP_CAMMO_LABEL_Y = yResOffset + 283; - MAP_CAMMO_Y = yResOffset + 292; - MAP_CAMMO_PERCENT_Y = yResOffset + 293; - MAP_PERCENT_WIDTH = 20; - MAP_PERCENT_HEIGHT = 10; - MAP_INV_STATS_TITLE_FONT_COLOR = 6; - MAP_INV_STATS_TEXT_FONT_COLOR = 5; - PLAYER_INFO_FACE_START_Y = yResOffset + 17; - PLAYER_INFO_FACE_END_Y = yResOffset + 76; - INV_BODY_Y = yResOffset + 116; - - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI()) { - CLOCK_Y_START = (MAP_BORDER_Y_OFFSET + 298); + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 262, + UI_MAP.BorderRegion.y, + 262, 106 + }; - DEST_PLOT_X = (MAP_BORDER_X_OFFSET + 463); - DEST_PLOT_Y = (MAP_BORDER_Y_OFFSET + 345); + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; - CLOCK_ETA_X = (MAP_BORDER_X_OFFSET + 484) + xResOffset; - CLOCK_HOUR_X_START = (MAP_BORDER_X_OFFSET + 518) + xResOffset; - CLOCK_MIN_X_START = (MAP_BORDER_X_OFFSET + 538) + xResOffset; + UI_CHARLIST.Region = { 0, 0, 254, 600 }; } - else if (iResolution < _1024x768) + else if (iResolution >= _1024x768) { - CLOCK_Y_START = (MAP_BORDER_Y_OFFSET + 298 + 120); + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 262, + UI_MAP.BorderRegion.y, + 262, 106 + }; - DEST_PLOT_X = (MAP_BORDER_X_OFFSET + 463 + 80); - DEST_PLOT_Y = (MAP_BORDER_Y_OFFSET + 345 + 120); + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; - CLOCK_ETA_X = (MAP_BORDER_X_OFFSET + 484 + 80) + xResOffset; - CLOCK_HOUR_X_START = (MAP_BORDER_X_OFFSET + 518 + 80) + xResOffset; - CLOCK_MIN_X_START = (MAP_BORDER_X_OFFSET + 538 + 80) + xResOffset; + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 540 }; + } + else if (iResolution >= _800x600) + { + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 260, + UI_MAP.BorderRegion.y, + 262, 106 + }; + + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 373 + }; + + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 372 }; } else { - CLOCK_Y_START = (MAP_BORDER_Y_OFFSET + 298 + 285); + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 260, + UI_MAP.BorderRegion.y, + 262, 106 + }; - DEST_PLOT_X = (MAP_BORDER_X_OFFSET + 463 + 180); - DEST_PLOT_Y = (MAP_BORDER_Y_OFFSET + 345 + 285); + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 252 + }; - CLOCK_ETA_X = (MAP_BORDER_X_OFFSET + 484 + 180) + xResOffset; - CLOCK_HOUR_X_START = (MAP_BORDER_X_OFFSET + 518 + 180) + xResOffset; - CLOCK_MIN_X_START = (MAP_BORDER_X_OFFSET + 538 + 180) + xResOffset; + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 254 }; } - // contract - CONTRACT_Y = yResOffset + 50; + { + //UI_CHARPANEL.Region = { + // UI_MAP.BorderRegion.x - 261, + // 0, + // 261, 106 + //}; + const auto x = UI_CHARPANEL.Region.x; + const auto y = UI_CHARPANEL.Region.y; - // trash can - TRASH_CAN_Y = 211 + PLAYER_INFO_Y; - TRASH_CAN_WIDTH = 193 - 165; - TRASH_CAN_HEIGHT = 239 - 217; + UI_CHARPANEL.FacePicture = { + x + 9, + y + 20, + 60, 63 + }; - // keyring - MAP_KEYRING_Y = yResOffset + 271; + UI_CHARPANEL.NickName = { + x + 8, + y + 69, + 52, + 6 + }; - //Text offsets - Y_OFFSET = 2; + UI_CHARPANEL.FullName = { + x + 14, + y + 5, + 150, + 6 + }; - // The boxes defines - TRAIN_Y_OFFSET = 53; - TRAIN_X_OFF = 65; - TRAIN_WID = 80; - TRAIN_HEIG = 47; - STRING_X_OFFSET = 10; - STRING_Y_OFFSET = 5; - POP_UP_BOX_Y = yResOffset + 0; - POP_UP_BOX_WIDTH = 60; - POP_UP_BOX_HEIGHT = 100; - MOUSE_PTR_Y_OFFSET = 3; - POP_UP_Y_OFFSET = 3; - TRAIN_TEXT_Y_OFFSET = 4; + UI_CHARPANEL.HandItem = { + x + 6, + y + 81, + 59, 20 + }; - // char stat positions - STR_Y = yResOffset + 42; - DEX_X = STR_X; - DEX_Y = yResOffset + 32; - AGL_X = STR_X; - AGL_Y = yResOffset + 22; - LDR_X = STR_X; - LDR_Y = yResOffset + 52; - WIS_X = STR_X; - WIS_Y = yResOffset + 62; - LVL_Y = AGL_Y; - MRK_X = LVL_X; - MRK_Y = DEX_Y; - MEC_X = LVL_X; - MEC_Y = STR_Y; - EXP_X = LVL_X; - EXP_Y = LDR_Y; - MED_X = LVL_X; - MED_Y = WIS_Y; + UI_CHARPANEL.Statusbars = { x + 66, y + 61, 6 }; + // For extern use + CHAR_BAR_INFO_X = UI_CHARPANEL.Statusbars.x; + CHAR_BAR_INFO_Y = UI_CHARPANEL.Statusbars.y; - STAT_WID = 15; - STAT_HEI = GetFontHeight(CHAR_FONT); + UI_CHARPANEL.Button.Up = { x + 67, y + 68 }; + UI_CHARPANEL.Button.Down = { x + 67, y + 87 }; + UI_CHARPANEL.Button.Contract = { x + 185, y + 50 }; - PIC_NAME_Y = yResOffset + 66 + 3; - PIC_NAME_HEI = yResOffset + 75 - PIC_NAME_Y; - CHAR_NAME_Y = yResOffset + 2 + 3; - CHAR_NAME_HEI = yResOffset + 11 - CHAR_NAME_Y; - CHAR_LOC_Y = yResOffset + 84; - CHAR_LOC_WID = 16; - CHAR_LOC_HEI = 9; - CHAR_TIME_REMAINING_Y = yResOffset + 65; - CHAR_TIME_REMAINING_HEI = GetFontHeight(CHAR_FONT); - CHAR_SALARY_X = CHAR_TIME_REMAINING_X; - CHAR_SALARY_Y = yResOffset + 79; - CHAR_SALARY_WID = CHAR_TIME_REMAINING_WID - 8; - CHAR_SALARY_HEI = CHAR_TIME_REMAINING_HEI; - CHAR_MEDICAL_X = CHAR_TIME_REMAINING_X; - CHAR_MEDICAL_Y = yResOffset + 93; - CHAR_MEDICAL_WID = CHAR_TIME_REMAINING_WID - 8; - CHAR_MEDICAL_HEI = CHAR_TIME_REMAINING_HEI; - CHAR_ASSIGN1_Y = yResOffset + 18; - CHAR_ASSIGN2_Y = yResOffset + 31; - CHAR_ASSIGN_WID = 257 - 178; - CHAR_ASSIGN_HEI = 39 - 29; - CHAR_MORALE_HEI = yResOffset + 101 - CHAR_MORALE_Y; - CHAR_HP_Y = yResOffset + 77 + 3; - CHAR_HP_HEI = yResOffset + 90 - CHAR_HP_Y; - CHAR_MORALE_Y = yResOffset + 91 + 3; - CROSS_Y = yResOffset + 83; - CROSS_HEIGHT = 20; - CROSS_WIDTH = 20; - CHAR_PAY_Y = yResOffset + 80 + 4; - CHAR_PAY_HEI = GetFontHeight(CHAR_FONT); - CHAR_PAY_WID = CROSS_X-CHAR_PAY_X; - SOLDIER_PIC_Y = yResOffset + 20; - SOLDIER_HAND_Y = yResOffset + 81; + UI_CHARPANEL.Text.Assignment = { x + 220, y + 4 }; + UI_CHARPANEL.Text.Attributes = { x + 88, y + 22 }; + UI_CHARPANEL.Text.Attributes2 = { x + 133, y + 22 }; + UI_CHARPANEL.Text.Health = { x + 87, y + 80 }; + UI_CHARPANEL.Text.Morale = { x + 87, y + 94 }; + UI_CHARPANEL.Text.Condition = { x + 87, y + 80 }; - gSCamoXY.sX = INV_BODY_X; - gSCamoXY.sY = INV_BODY_Y; // X, Y Location of Map screen's Camouflage region + UI_CHARPANEL.Icon = { + x + 187, + y + 64, + 10, 10, 13 + }; + // For extern use + UI_CHAR_Icon = UI_CHARPANEL.Icon; + + { + const int x1 = x + 112; + const int x2 = x + 159; + const int y1 = y + 22; + const int yOffset = 10; + // First column + UI_CHARPANEL.Attr.AGL = { x1, y1 }; + UI_CHARPANEL.Attr.DEX = { x1, y1 + yOffset }; + UI_CHARPANEL.Attr.STR = { x1, y1 + yOffset * 2 }; + UI_CHARPANEL.Attr.LDR = { x1, y1 + yOffset * 3 }; + UI_CHARPANEL.Attr.WIS = { x1, y1 + yOffset * 4 }; + // Second column + UI_CHARPANEL.Attr.LVL = { x2, y1 }; + UI_CHARPANEL.Attr.MRK = { x2, y1 + yOffset }; + UI_CHARPANEL.Attr.MEC = { x2, y1 + yOffset * 2 }; + UI_CHARPANEL.Attr.EXP = { x2, y1 + yOffset * 3 }; + UI_CHARPANEL.Attr.MED = { x2, y1 + yOffset * 4 }; + UI_CHARPANEL.Attr.width = 15; + UI_CHARPANEL.Attr.height = GetFontHeight(CHAR_FONT); + } + UI_CHARPANEL.Text.CurrentHitpoints = { + x + 133, + y + 80, + 42, 10 + }; + + UI_CHARPANEL.Text.CurrentMorale = { + x + 133, + y + 94, + 42, 7 + }; + + UI_CHARPANEL.Text.Pay = { + x + 150, + y + 84, + 45, GetFontHeight(CHAR_FONT) + }; + + UI_CHARPANEL.Text.TimeRemaining = { + x + 207, + y + 65, + 51, GetFontHeight(CHAR_FONT) + }; + + UI_CHARPANEL.Text.Salary = { + UI_CHARPANEL.Text.TimeRemaining.x, + y + 79, + UI_CHARPANEL.Text.TimeRemaining.width - 8, + UI_CHARPANEL.Text.TimeRemaining.height + }; + + UI_CHARPANEL.Text.Medical = { + UI_CHARPANEL.Text.TimeRemaining.x, + y + 93, + UI_CHARPANEL.Text.TimeRemaining.width - 8, + UI_CHARPANEL.Text.TimeRemaining.height + }; + + UI_CHARPANEL.Text.CurrentAssignment = { + x + 182, + y + 18, + 79, 10 + }; + UI_CHARPANEL.Text.CurrentAssignment_Y2 = y + 31; + } + // END Charpanel + + // BEGIN Strategic merc inventory + { + //UI_CHARINV.Region = { + // UI_MAP.BorderRegion.x - 262, + // UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + // 262, 490 + //}; + const auto x = UI_CHARINV.Region.x; + const auto y = UI_CHARINV.Region.y; + // For extern use + PLAYER_INFO_X = x; + PLAYER_INFO_Y = y; + + // item description region + MAP_ITEMDESC_START_X = x; + MAP_ITEMDESC_START_Y = y; + + UI_CHARINV.Button.Done = { x + 217, y + 210 }; + UI_CHARINV.Button.Trashcan = { x + 177, y + 210, 29, 24 }; + + UI_CHARINV.Text.Armor = { x + 210, y + 81 }; + UI_CHARINV.Text.ArmorLabel = { x + 209, y + 71 }; + UI_CHARINV.Text.ArmorPercent = { x + 231, y + 81 }; + + UI_CHARINV.Text.Weight = { x + 177, y + 158 }; + UI_CHARINV.Text.WeightLabel = { x + 174, y + 147 }; + UI_CHARINV.Text.WeightPercent = { x + 197, y + 158 }; + + UI_CHARINV.Text.Camo = { x + 177, y + 185 }; + UI_CHARINV.Text.CamoLabel = { x + 177, y + 174 }; + UI_CHARINV.Text.CamoPercent = { x + 197, y + 185 }; + + UI_CHARINV.Text.PercentWidth = 20; + UI_CHARINV.Text.PercentHeight = 10; + + UI_CHARINV.BodyPanel = { x + 71, y + 9 }; + + // X, Y Location of Map screen's Camouflage region + gSCamoXY.sX = UI_CHARINV.BodyPanel.iX; + gSCamoXY.sY = UI_CHARINV.BodyPanel.iY; + + + //For extern use + MAP_KEYRING_X = x + 218; + MAP_KEYRING_Y = y + 165; + + + // Inventory slots + gMapScreenInvPocketXY[HELMETPOS].sX = x + 204; gMapScreenInvPocketXY[HELMETPOS].sY = y + 9; // HELMETPOS + gMapScreenInvPocketXY[VESTPOS].sX = x + 204; gMapScreenInvPocketXY[VESTPOS].sY = y + 38; // VESTPOS + gMapScreenInvPocketXY[LEGPOS].sX = x + 204; gMapScreenInvPocketXY[LEGPOS].sY = y + 98; // LEGPOS, + gMapScreenInvPocketXY[HEAD1POS].sX = x + 21; gMapScreenInvPocketXY[HEAD1POS].sY = y + 9; // HEAD1POS + gMapScreenInvPocketXY[HEAD2POS].sX = x + 21; gMapScreenInvPocketXY[HEAD2POS].sY = y + 33; // HEAD2POS + gMapScreenInvPocketXY[HANDPOS].sX = x + 21; gMapScreenInvPocketXY[HANDPOS].sY = y + 87; // HANDPOS, + gMapScreenInvPocketXY[SECONDHANDPOS].sX = x + 21; gMapScreenInvPocketXY[SECONDHANDPOS].sY = y + 111; // SECONDHANDPOS + gMapScreenInvPocketXY[BIGPOCK1POS].sX = x + 98; gMapScreenInvPocketXY[BIGPOCK1POS].sY = y + 144; // BIGPOCK1 + gMapScreenInvPocketXY[BIGPOCK2POS].sX = x + 98; gMapScreenInvPocketXY[BIGPOCK2POS].sY = y + 168; // BIGPOCK2 + gMapScreenInvPocketXY[BIGPOCK3POS].sX = x + 98; gMapScreenInvPocketXY[BIGPOCK3POS].sY = y + 192; // BIGPOCK3 + gMapScreenInvPocketXY[BIGPOCK4POS].sX = x + 98; gMapScreenInvPocketXY[BIGPOCK4POS].sY = y + 216; // BIGPOCK4 + gMapScreenInvPocketXY[SMALLPOCK1POS].sX = x + 22; gMapScreenInvPocketXY[SMALLPOCK1POS].sY = y + 144; // SMALLPOCK1 + gMapScreenInvPocketXY[SMALLPOCK2POS].sX = x + 22; gMapScreenInvPocketXY[SMALLPOCK2POS].sY = y + 168; // SMALLPOCK2 + gMapScreenInvPocketXY[SMALLPOCK3POS].sX = x + 22; gMapScreenInvPocketXY[SMALLPOCK3POS].sY = y + 192; // SMALLPOCK3 + gMapScreenInvPocketXY[SMALLPOCK4POS].sX = x + 22; gMapScreenInvPocketXY[SMALLPOCK4POS].sY = y + 216; // SMALLPOCK4 + gMapScreenInvPocketXY[SMALLPOCK5POS].sX = x + 60; gMapScreenInvPocketXY[SMALLPOCK5POS].sY = y + 144; // SMALLPOCK5 + gMapScreenInvPocketXY[SMALLPOCK6POS].sX = x + 60; gMapScreenInvPocketXY[SMALLPOCK6POS].sY = y + 168; // SMALLPOCK6 + gMapScreenInvPocketXY[SMALLPOCK7POS].sX = x + 60; gMapScreenInvPocketXY[SMALLPOCK7POS].sY = y + 192; // SMALLPOCK7 + gMapScreenInvPocketXY[SMALLPOCK8POS].sX = x + 60; gMapScreenInvPocketXY[SMALLPOCK8POS].sY = y + 216; // SMALLPOCK8 + } + // END Strategic merc inventory + + // BEGIN Character list + { + //UI_CHARLIST.Region = { 0, 0, 254, 600 }; + const auto x = UI_CHARLIST.Region.x; + + UI_CHARLIST.y = UI_CHARLIST.Region.y + 26; + UI_CHARLIST.yOffset = 2; + UI_CHARLIST.Title = { x, UI_CHARLIST.Region.y + 5 - 113 }; // 113 comes from gMapSortButtons y-coordinate + UI_CHARLIST.xName = x + 4; + UI_CHARLIST.widthName = 51; + UI_CHARLIST.xAssignment = x + 60; + UI_CHARLIST.widthAssignment = 51; + UI_CHARLIST.xSleep = x + 116; + UI_CHARLIST.widthSleep = 19; + UI_CHARLIST.xLocation = x + 140; + UI_CHARLIST.widthLocation = 32; + UI_CHARLIST.xETA = x + 177; + UI_CHARLIST.widthETA = 33; + UI_CHARLIST.xTimeRemaining = x + 215; + UI_CHARLIST.widthTimeRemaining = 28; + + //For extern use + POP_UP_BOX_X = x + 120; + } + MAP_INV_STATS_TITLE_FONT_COLOR = 6; //OJW - MP interface changes InitializeMPCoordinates(); - - return ( TRUE ); + + return TRUE; } + + BOOLEAN InitializeInvPanelCoordsNew() { - PLAYER_INFO_Y = yResOffset + 107; - TOWN_INFO_Y = yResOffset + 1; - - PLAYER_INFO_X = xResOffset + 0; - TOWN_INFO_X = xResOffset + 0; - MAP_ITEMDESC_START_X = xResOffset + 0; - MAP_ARMOR_LABEL_X = xResOffset + 136; - MAP_ARMOR_X = xResOffset + 138; - MAP_ARMOR_PERCENT_X = xResOffset + 158; - MAP_WEIGHT_LABEL_X = xResOffset + 185; - MAP_WEIGHT_X = xResOffset + 188; - MAP_WEIGHT_PERCENT_X = xResOffset + 208; - MAP_CAMMO_LABEL_X = xResOffset + 226; - MAP_CAMMO_X = xResOffset + 224; - MAP_CAMMO_PERCENT_X = xResOffset + 244; - PLAYER_INFO_FACE_START_X = xResOffset + 9; - PLAYER_INFO_FACE_END_X = xResOffset + 60; - INV_BODY_X = xResOffset + 31; - NAME_X = xResOffset + 4; - ASSIGN_X = xResOffset + 60; - SLEEP_X = xResOffset + 116; - LOC_X = xResOffset + 140; - DEST_ETA_X = xResOffset + 177; - TIME_REMAINING_X = xResOffset + 215; - CONTRACT_X = xResOffset + 185; - TRASH_CAN_X = xResOffset + 209; - MAP_KEYRING_X = xResOffset + 186; //184/19 on Inventory_Bottom_Panel.sti - POP_UP_BOX_X = xResOffset + 120; - STR_X = xResOffset + 112; - LVL_X = xResOffset + 159; - PIC_NAME_X = xResOffset + 8; - CHAR_NAME_X = xResOffset + 14; - CHAR_LOC_X = xResOffset + 76; - CHAR_TIME_REMAINING_X = xResOffset + 207; - CHAR_ASSIGN_X = xResOffset + 182; - CHAR_HP_X = xResOffset + 133; - CHAR_MORALE_X = xResOffset + 133; - CROSS_X = xResOffset + 195; - CHAR_PAY_X = xResOffset + 150; - SOLDIER_PIC_X = xResOffset + 9; - SOLDIER_HAND_X = xResOffset + 6; - - // Inventory slots - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI()) { - gMapScreenInvPocketXY[0].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[0].sY = PLAYER_INFO_Y + 9; // HELMETPOS - gMapScreenInvPocketXY[1].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[1].sY = PLAYER_INFO_Y + 38; // VESTPOS - gMapScreenInvPocketXY[2].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[2].sY = PLAYER_INFO_Y + 97; // LEGPOS - gMapScreenInvPocketXY[3].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[3].sY = PLAYER_INFO_Y + 9; // HEAD1POS - gMapScreenInvPocketXY[4].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[4].sY = PLAYER_INFO_Y + 32; // HEAD2POS - gMapScreenInvPocketXY[5].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[5].sY = PLAYER_INFO_Y + 86; // HANDPOS - gMapScreenInvPocketXY[6].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[6].sY = PLAYER_INFO_Y + 110; // SECONDHANDPOS - gMapScreenInvPocketXY[7].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[7].sY = PLAYER_INFO_Y + 134; // VESTPOCK - gMapScreenInvPocketXY[8].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[8].sY = PLAYER_INFO_Y + 197; // LTHIGHPOCK - gMapScreenInvPocketXY[9].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[9].sY = PLAYER_INFO_Y + 197; // RTHIGHPOCK - gMapScreenInvPocketXY[10].sX = PLAYER_INFO_X + 194; gMapScreenInvPocketXY[10].sY = PLAYER_INFO_Y + 197; // CPACKPOCK - gMapScreenInvPocketXY[11].sX = PLAYER_INFO_X + 173; gMapScreenInvPocketXY[11].sY = PLAYER_INFO_Y + 332; // BPACKPOCK - gMapScreenInvPocketXY[12].sX = PLAYER_INFO_X + 95; gMapScreenInvPocketXY[12].sY = PLAYER_INFO_Y + 134; // GUNSLINGPOCKPOS - gMapScreenInvPocketXY[13].sX = PLAYER_INFO_X + 36; gMapScreenInvPocketXY[13].sY = PLAYER_INFO_Y + 134; // KNIFEPOCKPOS - gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 260; // BIGPOCK1 - gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 281; // BIGPOCK2 - gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 302; // BIGPOCK3 - gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 281; // BIGPOCK4 - gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 302; // BIGPOCK5 - gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 323; // BIGPOCK6 - gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 344; // BIGPOCK7 - gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 155; // MEDPOCK1 - gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 176; // MEDPOCK2 - gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 260; // MEDPOCK3 - gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 111; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 260; // MEDPOCK4 - gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 155; // SMALLPOCK1 - gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 155; // SMALLPOCK2 - gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 155; // SMALLPOCK3 - gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 155; // SMALLPOCK4 - gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 155; // SMALLPOCK5 - gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 176; // SMALLPOCK6 - gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 176; // SMALLPOCK7 - gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 176; // SMALLPOCK8 - gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 176; // SMALLPOCK9 - gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 176; // SMALLPOCK10 - gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 218; // SMALLPOCK11 - gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 218; // SMALLPOCK12 - gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 239; // SMALLPOCK13 - gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 239; // SMALLPOCK14 - gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 218; // SMALLPOCK15 - gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 218; // SMALLPOCK16 - gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 239; // SMALLPOCK17 - gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 239; // SMALLPOCK18 - gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 218; // SMALLPOCK19 - gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 218; // SMALLPOCK20 - gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 239; // SMALLPOCK21 - gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 239; // SMALLPOCK22 - gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 281; // SMALLPOCK23 - gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 302; // SMALLPOCK24 - gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 323; // SMALLPOCK25 - gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 344; // SMALLPOCK26 - gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 281; // SMALLPOCK27 - gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 302; // SMALLPOCK28 - gMapScreenInvPocketXY[53].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[53].sY = PLAYER_INFO_Y + 323; // SMALLPOCK29 - gMapScreenInvPocketXY[54].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[54].sY = PLAYER_INFO_Y + 344; // SMALLPOCK30 + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 262, + UI_MAP.BorderRegion.y, + 262, 106 + }; + + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; + + UI_CHARLIST.Region = { 0, 0, 254, 600 }; + } + else if (iResolution >= _1024x768) + { + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 260, + UI_MAP.BorderRegion.y, + 262, 106 + }; + + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; + + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 540}; + } + else if (iResolution >= _800x600) + { + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 260, + UI_MAP.BorderRegion.y, + 262, 106 + }; + + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; + + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 372 }; } else { - gMapScreenInvPocketXY[0].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[0].sY = PLAYER_INFO_Y + 9; // HELMETPOS - gMapScreenInvPocketXY[1].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[1].sY = PLAYER_INFO_Y + 37; // VESTPOS - gMapScreenInvPocketXY[2].sX = PLAYER_INFO_X + 131; gMapScreenInvPocketXY[2].sY = PLAYER_INFO_Y + 97; // LEGPOS - gMapScreenInvPocketXY[3].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[3].sY = PLAYER_INFO_Y + 9; // HEAD1POS - gMapScreenInvPocketXY[4].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[4].sY = PLAYER_INFO_Y + 32; // HEAD2POS - gMapScreenInvPocketXY[5].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[5].sY = PLAYER_INFO_Y + 86; // HANDPOS - gMapScreenInvPocketXY[6].sX = PLAYER_INFO_X + 14; gMapScreenInvPocketXY[6].sY = PLAYER_INFO_Y + 110; // SECONDHANDPOS - gMapScreenInvPocketXY[7].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[7].sY = PLAYER_INFO_Y + 156; // VESTPOCK - gMapScreenInvPocketXY[8].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[8].sY = PLAYER_INFO_Y + 256; // LTHIGHPOCK - gMapScreenInvPocketXY[9].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[9].sY = PLAYER_INFO_Y + 256; // RTHIGHPOCK - gMapScreenInvPocketXY[10].sX = PLAYER_INFO_X + 194; gMapScreenInvPocketXY[10].sY = PLAYER_INFO_Y + 256; // CPACKPOCK - gMapScreenInvPocketXY[11].sX = PLAYER_INFO_X + 173; gMapScreenInvPocketXY[11].sY = PLAYER_INFO_Y + 439; // BPACKPOCK - gMapScreenInvPocketXY[12].sX = PLAYER_INFO_X + 95; gMapScreenInvPocketXY[12].sY = PLAYER_INFO_Y + 156; // GUNSLINGPOCKPOS - gMapScreenInvPocketXY[13].sX = PLAYER_INFO_X + 36; gMapScreenInvPocketXY[13].sY = PLAYER_INFO_Y + 156; // KNIFEPOCKPOS - gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 336; // BIGPOCK1 - gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 360; // BIGPOCK2 - gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 186; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 384; // BIGPOCK3 - gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 379; // BIGPOCK4 - gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 403; // BIGPOCK5 - gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 427; // BIGPOCK6 - gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 98; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 451; // BIGPOCK7 - gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 188; // MEDPOCK1 - gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 202; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 212; // MEDPOCK2 - gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 29; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 336; // MEDPOCK3 - gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 112; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 336; // MEDPOCK4 - gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 188; // SMALLPOCK1 - gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 188; // SMALLPOCK2 - gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 188; // SMALLPOCK3 - gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 188; // SMALLPOCK4 - gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 188; // SMALLPOCK5 - gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 22; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 212; // SMALLPOCK6 - gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 58; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 212; // SMALLPOCK7 - gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 94; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 212; // SMALLPOCK8 - gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 130; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 212; // SMALLPOCK9 - gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 166; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 212; // SMALLPOCK10 - gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 288; // SMALLPOCK11 - gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 288; // SMALLPOCK12 - gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 18; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 312; // SMALLPOCK13 - gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 54; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 312; // SMALLPOCK14 - gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 288; // SMALLPOCK15 - gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 288; // SMALLPOCK16 - gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 100; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 312; // SMALLPOCK17 - gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 136; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 312; // SMALLPOCK18 - gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 288; // SMALLPOCK19 - gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 288; // SMALLPOCK20 - gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 183; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 312; // SMALLPOCK21 - gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 219; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 312; // SMALLPOCK22 - gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 379; // SMALLPOCK23 - gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 403; // SMALLPOCK24 - gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 427; // SMALLPOCK25 - gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 26; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 451; // SMALLPOCK26 - gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 379; // SMALLPOCK27 - gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 403; // SMALLPOCK28 - gMapScreenInvPocketXY[53].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[53].sY = PLAYER_INFO_Y + 427; // SMALLPOCK29 - gMapScreenInvPocketXY[54].sX = PLAYER_INFO_X + 62; gMapScreenInvPocketXY[54].sY = PLAYER_INFO_Y + 451; // SMALLPOCK30 + UI_CHARPANEL.Region = { + UI_MAP.BorderRegion.x - 260, + UI_MAP.BorderRegion.y, + 262, 106 + }; + + UI_CHARINV.Region = { + UI_CHARPANEL.Region.x, + UI_CHARPANEL.Region.y + UI_CHARPANEL.Region.height, + 262, 490 + }; + UI_CHARLIST.Region = { UI_CHARINV.Region.x, UI_CHARINV.Region.y, 262, 254 }; } - // item description - MAP_ITEMDESC_START_Y = PLAYER_INFO_Y; - INV_REGION_X = PLAYER_INFO_X; - INV_REGION_Y = PLAYER_INFO_Y; - INV_REGION_WIDTH = 261; - INV_REGION_HEIGHT = 490; - INV_BTN_X = PLAYER_INFO_X + 226; - INV_BTN_Y = PLAYER_INFO_Y + 19; - INV_BDROP_X = PLAYER_INFO_X + 220; - INV_BDROP_Y = PLAYER_INFO_Y + 441; - - MAP_ARMOR_LABEL_Y = yResOffset + 177; - MAP_ARMOR_Y = yResOffset + 187; - MAP_ARMOR_PERCENT_Y = yResOffset + 188; - - MAP_WEIGHT_LABEL_Y = yResOffset + 209; - MAP_WEIGHT_Y = yResOffset + 219; - MAP_WEIGHT_PERCENT_Y = yResOffset + 219; - - MAP_CAMMO_LABEL_Y = yResOffset + 209; - MAP_CAMMO_Y = yResOffset + 219; - MAP_CAMMO_PERCENT_Y = yResOffset + 219; - - MAP_PERCENT_WIDTH = 20; - MAP_PERCENT_HEIGHT = 10; - - MAP_INV_STATS_TITLE_FONT_COLOR = 6; - MAP_INV_STATS_TEXT_FONT_COLOR = 5; - - PLAYER_INFO_FACE_START_Y = yResOffset + 17; - PLAYER_INFO_FACE_END_Y = yResOffset + 76; - - INV_BODY_Y = 8 + PLAYER_INFO_Y; - NAME_WIDTH = 51; - - ASSIGN_WIDTH = 51; - SLEEP_WIDTH = 19; - LOC_WIDTH = 32; - DEST_ETA_WIDTH = 33; - TIME_REMAINING_WIDTH = 28; - - // contract - CONTRACT_Y = yResOffset + 50; - - // trash can - TRASH_CAN_Y = 59 + PLAYER_INFO_Y; - TRASH_CAN_WIDTH = 193 - 165; - TRASH_CAN_HEIGHT = 239 - 217; - - // keyring - MAP_KEYRING_Y = yResOffset + 126; - - //Text offsets - Y_OFFSET = 2; - - // The boxes defines - TRAIN_Y_OFFSET = 53; - TRAIN_X_OFF = 65; - TRAIN_WID = 80; - TRAIN_HEIG = 47; - STRING_X_OFFSET = 10; - STRING_Y_OFFSET = 5; - POP_UP_BOX_Y = yResOffset + 0; - POP_UP_BOX_WIDTH = 60; - POP_UP_BOX_HEIGHT = 100; - MOUSE_PTR_Y_OFFSET = 3; - POP_UP_Y_OFFSET = 3; - TRAIN_TEXT_Y_OFFSET = 4; - - // char stat positions - STR_Y = yResOffset + 42; - DEX_X = STR_X; - DEX_Y = yResOffset + 32; - AGL_X = STR_X; - AGL_Y = yResOffset + 22; - LDR_X = STR_X; - LDR_Y = yResOffset + 52; - WIS_X = STR_X; - WIS_Y = yResOffset + 62; - LVL_Y = AGL_Y; - MRK_X = LVL_X; - MRK_Y = DEX_Y; - MEC_X = LVL_X; - MEC_Y = STR_Y; - EXP_X = LVL_X; - EXP_Y = LDR_Y; - MED_X = LVL_X; - MED_Y = WIS_Y; - - STAT_WID = 15; - STAT_HEI = GetFontHeight(CHAR_FONT); - - PIC_NAME_Y = yResOffset + 66 + 3; - PIC_NAME_WID = 52; - PIC_NAME_HEI = yResOffset + 75 - PIC_NAME_Y; - CHAR_NAME_Y = yResOffset + 2 + 3; - CHAR_NAME_WID = 150; - CHAR_NAME_HEI = yResOffset + 11 - CHAR_NAME_Y; - CHAR_LOC_Y = yResOffset + 84; - CHAR_LOC_WID = 16; - CHAR_LOC_HEI = 9; - - CHAR_TIME_REMAINING_Y = yResOffset + 65; - CHAR_TIME_REMAINING_WID = 51; - CHAR_TIME_REMAINING_HEI = GetFontHeight(CHAR_FONT); - CHAR_SALARY_X = CHAR_TIME_REMAINING_X; - CHAR_SALARY_Y = yResOffset + 79; - CHAR_SALARY_WID = CHAR_TIME_REMAINING_WID - 8; - CHAR_SALARY_HEI = CHAR_TIME_REMAINING_HEI; - CHAR_MEDICAL_X = CHAR_TIME_REMAINING_X; - CHAR_MEDICAL_Y = yResOffset + 93; - CHAR_MEDICAL_WID = CHAR_TIME_REMAINING_WID - 8; - CHAR_MEDICAL_HEI = CHAR_TIME_REMAINING_HEI; - CHAR_ASSIGN1_Y = yResOffset + 18; - CHAR_ASSIGN2_Y = yResOffset + 31; - CHAR_ASSIGN_WID = 257 - 178; - CHAR_ASSIGN_HEI = 39 - 29; - CHAR_HP_Y = yResOffset + 77 + 3; - CHAR_HP_WID = 42; - CHAR_HP_HEI = yResOffset + 90 - CHAR_HP_Y; - CHAR_MORALE_Y = yResOffset + 91 + 3; - CHAR_MORALE_WID = 42; - CHAR_MORALE_HEI = yResOffset + 101 - CHAR_MORALE_Y; - - CROSS_Y = yResOffset + 83; - CROSS_HEIGHT = 20; - CROSS_WIDTH = 20; - CHAR_PAY_Y = yResOffset + 80 + 4; - CHAR_PAY_HEI = GetFontHeight(CHAR_FONT); - CHAR_PAY_WID = CROSS_X-CHAR_PAY_X; - SOLDIER_PIC_Y = yResOffset + 20; - SOLDIER_HAND_Y = yResOffset + 81; - - gSCamoXY.sX = INV_BODY_X; - gSCamoXY.sY = INV_BODY_Y; // X, Y Location of Map screen's Camouflage region + InitializeInvPanelCoords(); //OJW - MP interface changes InitializeMPCoordinates(); - return ( TRUE ); + return TRUE; } void InitializeMPCoordinates() { //OJW - MP interface changes - if (iResolution >= _640x480 && iResolution < _800x600) + const auto x = UI_CHARLIST.Region.x; + const auto y = UI_CHARLIST.Region.y; + if (isWidescreenUI()) { - MP_BTN_Y = 268 + yResOffset; + MP_BTN_Y = y + 507; } - else if (iResolution < _1024x768) + else if (iResolution >= _1024x768) { - MP_BTN_Y = 386 + yResOffset; + MP_BTN_Y = 448 + y; + } + else if (iResolution >= _800x600) + { + MP_BTN_Y = 280 + y; } else { - MP_BTN_Y = 554 + yResOffset; + MP_BTN_Y = 162 + y; } - + MP_ROWSTART_Y = MP_BTN_Y + 21; - MP_PLAYER_X = 5 + xResOffset; - MP_PLAYER_W = 75 + yResOffset; - MP_TEAM_X = 84 + xResOffset; - MP_TEAM_W = 40 + yResOffset; - MP_COMPASS_X = 130 + xResOffset; - MP_COMPASS_W = 19 + yResOffset; - MP_GAMEINFO_X = 154 + xResOffset; - MP_GAMEINFO_W = 81 + yResOffset; - + MP_PLAYER_X = 5 + x; + MP_PLAYER_W = 75 + x; + MP_TEAM_X = 84 + x; + MP_TEAM_W = 40 + x; + MP_COMPASS_X = 130 + x; + MP_COMPASS_W = 19 + x; + MP_GAMEINFO_X = 154 + x; + MP_GAMEINFO_W = 81 + x; // End of MP interface changes } + BOOLEAN InitializeInvPanelCoordsVehicle( ) { InitializeInvPanelCoordsNew(); + const auto x = UI_CHARINV.Region.x; + const auto y = UI_CHARINV.Region.y; // Inventory slots if (iResolution >= _640x480 && iResolution < _800x600) { - gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 89; - gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 89; - gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 89; - gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 110; - gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 110; - gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 110; - gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 131; - gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 131; - gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 131; - gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 152; - gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 152; - gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 152; - gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 173; - gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 173; - gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 173; - gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 194; - gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 194; - gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 194; - gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 215; - gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 215; - gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 215; - gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 236; - gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 236; - gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 236; - gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 257; - gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 257; - gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 257; - gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 278; - gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 278; - gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 278; - gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 299; - gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 299; - gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 299; - gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 320; - gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 320; - gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 320; - gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 341; - gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 341; - gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 341; + gMapScreenInvPocketXY[14].sX = x + 37; gMapScreenInvPocketXY[14].sY = y + 89; + gMapScreenInvPocketXY[15].sX = x + 104; gMapScreenInvPocketXY[15].sY = y + 89; + gMapScreenInvPocketXY[16].sX = x + 171; gMapScreenInvPocketXY[16].sY = y + 89; + gMapScreenInvPocketXY[17].sX = x + 37; gMapScreenInvPocketXY[17].sY = y + 110; + gMapScreenInvPocketXY[18].sX = x + 104; gMapScreenInvPocketXY[18].sY = y + 110; + gMapScreenInvPocketXY[19].sX = x + 171; gMapScreenInvPocketXY[19].sY = y + 110; + gMapScreenInvPocketXY[20].sX = x + 37; gMapScreenInvPocketXY[20].sY = y + 131; + gMapScreenInvPocketXY[21].sX = x + 104; gMapScreenInvPocketXY[21].sY = y + 131; + gMapScreenInvPocketXY[22].sX = x + 171; gMapScreenInvPocketXY[22].sY = y + 131; + gMapScreenInvPocketXY[23].sX = x + 37; gMapScreenInvPocketXY[23].sY = y + 152; + gMapScreenInvPocketXY[24].sX = x + 104; gMapScreenInvPocketXY[24].sY = y + 152; + gMapScreenInvPocketXY[25].sX = x + 171; gMapScreenInvPocketXY[25].sY = y + 152; + gMapScreenInvPocketXY[26].sX = x + 37; gMapScreenInvPocketXY[26].sY = y + 173; + gMapScreenInvPocketXY[27].sX = x + 104; gMapScreenInvPocketXY[27].sY = y + 173; + gMapScreenInvPocketXY[28].sX = x + 171; gMapScreenInvPocketXY[28].sY = y + 173; + gMapScreenInvPocketXY[29].sX = x + 37; gMapScreenInvPocketXY[29].sY = y + 194; + gMapScreenInvPocketXY[30].sX = x + 104; gMapScreenInvPocketXY[30].sY = y + 194; + gMapScreenInvPocketXY[31].sX = x + 171; gMapScreenInvPocketXY[31].sY = y + 194; + gMapScreenInvPocketXY[32].sX = x + 37; gMapScreenInvPocketXY[32].sY = y + 215; + gMapScreenInvPocketXY[33].sX = x + 104; gMapScreenInvPocketXY[33].sY = y + 215; + gMapScreenInvPocketXY[34].sX = x + 171; gMapScreenInvPocketXY[34].sY = y + 215; + gMapScreenInvPocketXY[35].sX = x + 37; gMapScreenInvPocketXY[35].sY = y + 236; + gMapScreenInvPocketXY[36].sX = x + 104; gMapScreenInvPocketXY[36].sY = y + 236; + gMapScreenInvPocketXY[37].sX = x + 171; gMapScreenInvPocketXY[37].sY = y + 236; + gMapScreenInvPocketXY[38].sX = x + 37; gMapScreenInvPocketXY[38].sY = y + 257; + gMapScreenInvPocketXY[39].sX = x + 104; gMapScreenInvPocketXY[39].sY = y + 257; + gMapScreenInvPocketXY[40].sX = x + 171; gMapScreenInvPocketXY[40].sY = y + 257; + gMapScreenInvPocketXY[41].sX = x + 37; gMapScreenInvPocketXY[41].sY = y + 278; + gMapScreenInvPocketXY[42].sX = x + 104; gMapScreenInvPocketXY[42].sY = y + 278; + gMapScreenInvPocketXY[43].sX = x + 171; gMapScreenInvPocketXY[43].sY = y + 278; + gMapScreenInvPocketXY[44].sX = x + 37; gMapScreenInvPocketXY[44].sY = y + 299; + gMapScreenInvPocketXY[45].sX = x + 104; gMapScreenInvPocketXY[45].sY = y + 299; + gMapScreenInvPocketXY[46].sX = x + 171; gMapScreenInvPocketXY[46].sY = y + 299; + gMapScreenInvPocketXY[47].sX = x + 37; gMapScreenInvPocketXY[47].sY = y + 320; + gMapScreenInvPocketXY[48].sX = x + 104; gMapScreenInvPocketXY[48].sY = y + 320; + gMapScreenInvPocketXY[49].sX = x + 171; gMapScreenInvPocketXY[49].sY = y + 320; + gMapScreenInvPocketXY[50].sX = x + 37; gMapScreenInvPocketXY[50].sY = y + 341; + gMapScreenInvPocketXY[51].sX = x + 104; gMapScreenInvPocketXY[51].sY = y + 341; + gMapScreenInvPocketXY[52].sX = x + 171; gMapScreenInvPocketXY[52].sY = y + 341; } else { - gMapScreenInvPocketXY[14].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[14].sY = PLAYER_INFO_Y + 156; - gMapScreenInvPocketXY[15].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[15].sY = PLAYER_INFO_Y + 156; - gMapScreenInvPocketXY[16].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[16].sY = PLAYER_INFO_Y + 156; - gMapScreenInvPocketXY[17].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[17].sY = PLAYER_INFO_Y + 180; - gMapScreenInvPocketXY[18].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[18].sY = PLAYER_INFO_Y + 180; - gMapScreenInvPocketXY[19].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[19].sY = PLAYER_INFO_Y + 180; - gMapScreenInvPocketXY[20].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[20].sY = PLAYER_INFO_Y + 204; - gMapScreenInvPocketXY[21].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[21].sY = PLAYER_INFO_Y + 204; - gMapScreenInvPocketXY[22].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[22].sY = PLAYER_INFO_Y + 204; - gMapScreenInvPocketXY[23].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[23].sY = PLAYER_INFO_Y + 228; - gMapScreenInvPocketXY[24].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[24].sY = PLAYER_INFO_Y + 228; - gMapScreenInvPocketXY[25].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[25].sY = PLAYER_INFO_Y + 228; - gMapScreenInvPocketXY[26].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[26].sY = PLAYER_INFO_Y + 252; - gMapScreenInvPocketXY[27].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[27].sY = PLAYER_INFO_Y + 252; - gMapScreenInvPocketXY[28].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[28].sY = PLAYER_INFO_Y + 252; - gMapScreenInvPocketXY[29].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[29].sY = PLAYER_INFO_Y + 276; - gMapScreenInvPocketXY[30].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[30].sY = PLAYER_INFO_Y + 276; - gMapScreenInvPocketXY[31].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[31].sY = PLAYER_INFO_Y + 276; - gMapScreenInvPocketXY[32].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[32].sY = PLAYER_INFO_Y + 300; - gMapScreenInvPocketXY[33].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[33].sY = PLAYER_INFO_Y + 300; - gMapScreenInvPocketXY[34].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[34].sY = PLAYER_INFO_Y + 300; - gMapScreenInvPocketXY[35].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[35].sY = PLAYER_INFO_Y + 324; - gMapScreenInvPocketXY[36].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[36].sY = PLAYER_INFO_Y + 324; - gMapScreenInvPocketXY[37].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[37].sY = PLAYER_INFO_Y + 324; - gMapScreenInvPocketXY[38].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[38].sY = PLAYER_INFO_Y + 348; - gMapScreenInvPocketXY[39].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[39].sY = PLAYER_INFO_Y + 348; - gMapScreenInvPocketXY[40].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[40].sY = PLAYER_INFO_Y + 348; - gMapScreenInvPocketXY[41].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[41].sY = PLAYER_INFO_Y + 372; - gMapScreenInvPocketXY[42].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[42].sY = PLAYER_INFO_Y + 372; - gMapScreenInvPocketXY[43].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[43].sY = PLAYER_INFO_Y + 372; - gMapScreenInvPocketXY[44].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[44].sY = PLAYER_INFO_Y + 396; - gMapScreenInvPocketXY[45].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[45].sY = PLAYER_INFO_Y + 396; - gMapScreenInvPocketXY[46].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[46].sY = PLAYER_INFO_Y + 396; - gMapScreenInvPocketXY[47].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[47].sY = PLAYER_INFO_Y + 420; - gMapScreenInvPocketXY[48].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[48].sY = PLAYER_INFO_Y + 420; - gMapScreenInvPocketXY[49].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[49].sY = PLAYER_INFO_Y + 420; - gMapScreenInvPocketXY[50].sX = PLAYER_INFO_X + 37; gMapScreenInvPocketXY[50].sY = PLAYER_INFO_Y + 444; - gMapScreenInvPocketXY[51].sX = PLAYER_INFO_X + 104; gMapScreenInvPocketXY[51].sY = PLAYER_INFO_Y + 444; - gMapScreenInvPocketXY[52].sX = PLAYER_INFO_X + 171; gMapScreenInvPocketXY[52].sY = PLAYER_INFO_Y + 444; + gMapScreenInvPocketXY[14].sX = x + 37; gMapScreenInvPocketXY[14].sY = y + 156; + gMapScreenInvPocketXY[15].sX = x + 104; gMapScreenInvPocketXY[15].sY = y + 156; + gMapScreenInvPocketXY[16].sX = x + 171; gMapScreenInvPocketXY[16].sY = y + 156; + gMapScreenInvPocketXY[17].sX = x + 37; gMapScreenInvPocketXY[17].sY = y + 180; + gMapScreenInvPocketXY[18].sX = x + 104; gMapScreenInvPocketXY[18].sY = y + 180; + gMapScreenInvPocketXY[19].sX = x + 171; gMapScreenInvPocketXY[19].sY = y + 180; + gMapScreenInvPocketXY[20].sX = x + 37; gMapScreenInvPocketXY[20].sY = y + 204; + gMapScreenInvPocketXY[21].sX = x + 104; gMapScreenInvPocketXY[21].sY = y + 204; + gMapScreenInvPocketXY[22].sX = x + 171; gMapScreenInvPocketXY[22].sY = y + 204; + gMapScreenInvPocketXY[23].sX = x + 37; gMapScreenInvPocketXY[23].sY = y + 228; + gMapScreenInvPocketXY[24].sX = x + 104; gMapScreenInvPocketXY[24].sY = y + 228; + gMapScreenInvPocketXY[25].sX = x + 171; gMapScreenInvPocketXY[25].sY = y + 228; + gMapScreenInvPocketXY[26].sX = x + 37; gMapScreenInvPocketXY[26].sY = y + 252; + gMapScreenInvPocketXY[27].sX = x + 104; gMapScreenInvPocketXY[27].sY = y + 252; + gMapScreenInvPocketXY[28].sX = x + 171; gMapScreenInvPocketXY[28].sY = y + 252; + gMapScreenInvPocketXY[29].sX = x + 37; gMapScreenInvPocketXY[29].sY = y + 276; + gMapScreenInvPocketXY[30].sX = x + 104; gMapScreenInvPocketXY[30].sY = y + 276; + gMapScreenInvPocketXY[31].sX = x + 171; gMapScreenInvPocketXY[31].sY = y + 276; + gMapScreenInvPocketXY[32].sX = x + 37; gMapScreenInvPocketXY[32].sY = y + 300; + gMapScreenInvPocketXY[33].sX = x + 104; gMapScreenInvPocketXY[33].sY = y + 300; + gMapScreenInvPocketXY[34].sX = x + 171; gMapScreenInvPocketXY[34].sY = y + 300; + gMapScreenInvPocketXY[35].sX = x + 37; gMapScreenInvPocketXY[35].sY = y + 324; + gMapScreenInvPocketXY[36].sX = x + 104; gMapScreenInvPocketXY[36].sY = y + 324; + gMapScreenInvPocketXY[37].sX = x + 171; gMapScreenInvPocketXY[37].sY = y + 324; + gMapScreenInvPocketXY[38].sX = x + 37; gMapScreenInvPocketXY[38].sY = y + 348; + gMapScreenInvPocketXY[39].sX = x + 104; gMapScreenInvPocketXY[39].sY = y + 348; + gMapScreenInvPocketXY[40].sX = x + 171; gMapScreenInvPocketXY[40].sY = y + 348; + gMapScreenInvPocketXY[41].sX = x + 37; gMapScreenInvPocketXY[41].sY = y + 372; + gMapScreenInvPocketXY[42].sX = x + 104; gMapScreenInvPocketXY[42].sY = y + 372; + gMapScreenInvPocketXY[43].sX = x + 171; gMapScreenInvPocketXY[43].sY = y + 372; + gMapScreenInvPocketXY[44].sX = x + 37; gMapScreenInvPocketXY[44].sY = y + 396; + gMapScreenInvPocketXY[45].sX = x + 104; gMapScreenInvPocketXY[45].sY = y + 396; + gMapScreenInvPocketXY[46].sX = x + 171; gMapScreenInvPocketXY[46].sY = y + 396; + gMapScreenInvPocketXY[47].sX = x + 37; gMapScreenInvPocketXY[47].sY = y + 420; + gMapScreenInvPocketXY[48].sX = x + 104; gMapScreenInvPocketXY[48].sY = y + 420; + gMapScreenInvPocketXY[49].sX = x + 171; gMapScreenInvPocketXY[49].sY = y + 420; + gMapScreenInvPocketXY[50].sX = x + 37; gMapScreenInvPocketXY[50].sY = y + 444; + gMapScreenInvPocketXY[51].sX = x + 104; gMapScreenInvPocketXY[51].sY = y + 444; + gMapScreenInvPocketXY[52].sX = x + 171; gMapScreenInvPocketXY[52].sY = y + 444; } return ( TRUE ); @@ -1832,30 +1878,6 @@ BOOLEAN SetInfoChar( UINT8 ubID ) } -//silversurfer: not used anywhere -/*void DisplayDestinationOfCurrentDestMerc( void ) -{ - // will display the dest of the current dest merc - CHAR16 sString[ 32 ]; - INT16 sX, sY; - INT16 sSector; - - SetFont( MAP_SCREEN_FONT ); - - sSector = GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[ bSelectedDestChar ].usSolID] ); - - SetBoxForeground(ghVehicleBox, FONT_LTGREEN); - SetBoxBackground(ghVehicleBox, FONT_BLACK); - - swprintf( sString, L"%s%s", pMapVertIndex[ sSector / MAP_WORLD_X ], pMapHortIndex[ sSector % MAP_WORLD_X ] ); - FindFontCenterCoordinates(DEST_PLOT_X, DEST_PLOT_Y ,70 ,GetFontHeight( MAP_SCREEN_FONT ) ,sString , MAP_SCREEN_FONT, &sX, &sY); - - RestoreExternBackgroundRect( DEST_PLOT_X, DEST_PLOT_Y ,70 ,GetFontHeight( MAP_SCREEN_FONT ) ); - mprintf( sX, sY, sString ); -}*/ - - - void ContractBoxGlow( void ) { /* Why not? @@ -1957,27 +1979,32 @@ void ContractListRegionBoxGlow( UINT16 usCount ) sYAdd = 0; // y start position of box - usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE) + sYAdd ); + usY = ( UI_CHARLIST.yOffset * usCount - 1 ) + (UI_CHARLIST.y + (usCount * Y_SIZE) + sYAdd ); // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, TIME_REMAINING_X, usY, TIME_REMAINING_X + TIME_REMAINING_WIDTH, usY + GetFontHeight( MAP_SCREEN_FONT ) + 2, usColor, pDestBuf ); - InvalidateRegion(TIME_REMAINING_X - 1, usY, TIME_REMAINING_X + TIME_REMAINING_WIDTH + 1, usY + GetFontHeight( MAP_SCREEN_FONT ) + 3 ); + + const auto x = UI_CHARLIST.xTimeRemaining; + const auto width = UI_CHARLIST.widthTimeRemaining; + RectangleDraw( TRUE, x, usY, x + width, usY + GetFontHeight( MAP_SCREEN_FONT ) + 2, usColor, pDestBuf ); + InvalidateRegion(x - 1, usY, x + width + 1, usY + GetFontHeight( MAP_SCREEN_FONT ) + 3 ); UnLockVideoSurface( FRAME_BUFFER ); } void GlowFace( void ) { - static INT32 iColorNum =10; - static BOOLEAN fDelta=FALSE; - static BOOLEAN fOldFaceGlow = FALSE; - UINT16 usColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - + static INT32 iColorNum =10; + static BOOLEAN fDelta=FALSE; + static BOOLEAN fOldFaceGlow = FALSE; + const auto xStart = UI_CHARPANEL.FacePicture.x; + const auto yStart = UI_CHARPANEL.FacePicture.y; + const auto xEnd = UI_CHARPANEL.FacePicture.x + UI_CHARPANEL.FacePicture.width; + const auto yEnd = UI_CHARPANEL.FacePicture.y + UI_CHARPANEL.FacePicture.height; + const auto Width = UI_CHARPANEL.FacePicture.width; + const auto Height = UI_CHARPANEL.FacePicture.height; // not glowing right now, leave if( fShowFaceHightLight == FALSE ) @@ -1987,7 +2014,7 @@ void GlowFace( void ) if( fOldFaceGlow == TRUE ) { - RestoreExternBackgroundRect( xResOffset + 9, yResOffset + 18, 52, ( UINT16 )( 46 ) ); + RestoreExternBackgroundRect(xStart, yStart, Width + 1, Height + 1); } fOldFaceGlow = FALSE; @@ -2013,20 +2040,22 @@ void GlowFace( void ) iColorNum--; // glow contract box - usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + UINT16 usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, xResOffset + 9, yResOffset + 18, xResOffset + 60, yResOffset + 63 , usColor, pDestBuf ); - InvalidateRegion( xResOffset + 9, yResOffset + 18, xResOffset + 61, yResOffset + 64 ); + + RectangleDraw( TRUE, xStart, yStart, xEnd, yEnd, usColor, pDestBuf ); + InvalidateRegion(xStart, yStart, xEnd + 1 , yEnd + 1 ); UnLockVideoSurface( FRAME_BUFFER ); // restore background if((iColorNum==0)||(iColorNum==1)) - RestoreExternBackgroundRect( xResOffset + 9, yResOffset + 18, 61 - 9 , ( UINT16 )( 64 - 18 ) ); + RestoreExternBackgroundRect(xStart, yStart, Width + 1, Height + 1); } - +// Draws the pulsating red rectangle around the character panel inventory slot void GlowItem( void ) { static INT32 iColorNum =10; @@ -2072,18 +2101,24 @@ void GlowItem( void ) iColorNum--; // restore background + const auto x = UI_CHARPANEL.HandItem.x; + const auto y = UI_CHARPANEL.HandItem.y; + const auto width = UI_CHARPANEL.HandItem.width; + const auto height = UI_CHARPANEL.HandItem.height; if((iColorNum==0)||(iColorNum==1)) { - RestoreExternBackgroundRect( xResOffset + 3, yResOffset + 80, (65 - 3 ), ( UINT16 )( 105 - 80 ) ); + RestoreExternBackgroundRect(x, y, width + 1, height + 1 ); RenderHandPosItem(); } - // glow contract box usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, xResOffset + 3, yResOffset + 80, xResOffset + 64, yResOffset + 104 , usColor, pDestBuf ); - InvalidateRegion( xResOffset + 3, yResOffset + 80, xResOffset + 65, yResOffset + 105 ); + + const auto xEnd = x + width; + const auto yEnd = y + height; + RectangleDraw( TRUE, x, y, xEnd, yEnd, usColor, pDestBuf ); + InvalidateRegion(x, y, xEnd + 1, yEnd + 1); UnLockVideoSurface( FRAME_BUFFER ); } @@ -2094,10 +2129,10 @@ void GlowTrashCan( void ) static INT32 iColorNum =10; static BOOLEAN fDelta=FALSE; static BOOLEAN fOldTrashCanGlow = FALSE; - UINT16 usColor; - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - + const auto x = UI_CHARINV.Button.Trashcan.x; + const auto y = UI_CHARINV.Button.Trashcan.y; + const auto width = UI_CHARINV.Button.Trashcan.width; + const auto height = UI_CHARINV.Button.Trashcan.height; if( fShowInventoryFlag == FALSE ) { @@ -2112,7 +2147,7 @@ void GlowTrashCan( void ) if( fOldTrashCanGlow == TRUE ) { - RestoreExternBackgroundRect( TRASH_CAN_X, TRASH_CAN_Y, ( UINT16 )( TRASH_CAN_WIDTH + 2 ), ( UINT16 )( TRASH_CAN_HEIGHT + 2 ) ); + RestoreExternBackgroundRect(x, y, ( UINT16 )(width + 2 ), ( UINT16 )(height + 2 ) ); } fOldTrashCanGlow = FALSE; @@ -2127,16 +2162,17 @@ void GlowTrashCan( void ) fOldTrashCanGlow = TRUE; // glow contract box - usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + UINT16 usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); + UINT32 uiDestPitchBYTES; + UINT8* pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - RectangleDraw( TRUE, TRASH_CAN_X, TRASH_CAN_Y , TRASH_CAN_X + TRASH_CAN_WIDTH, TRASH_CAN_Y + TRASH_CAN_HEIGHT , usColor, pDestBuf ); - InvalidateRegion( TRASH_CAN_X, TRASH_CAN_Y, TRASH_CAN_X + TRASH_CAN_WIDTH + 1, TRASH_CAN_Y + TRASH_CAN_HEIGHT + 1 ); + RectangleDraw( TRUE, x, y, x + width, y + height, usColor, pDestBuf ); + InvalidateRegion( x, y, x + width + 1, y + height + 1 ); UnLockVideoSurface( FRAME_BUFFER ); // restore background if((iColorNum==0)||(iColorNum==1)) - RestoreExternBackgroundRect( TRASH_CAN_X, TRASH_CAN_Y, ( UINT16 )( TRASH_CAN_WIDTH + 2 ), ( UINT16 )( TRASH_CAN_HEIGHT + 2 ) ); + RestoreExternBackgroundRect( x, y, ( UINT16 )( width + 2 ), ( UINT16 )( height + 2 ) ); } @@ -2175,7 +2211,7 @@ void DrawFace( INT16 sCharNumber ) fReDrawFace = FALSE; // render their face - RenderSoldierFace( pSoldier, SOLDIER_PIC_X, SOLDIER_PIC_Y, TRUE ); + RenderSoldierFace( pSoldier, UI_CHARPANEL.FacePicture.x, UI_CHARPANEL.FacePicture.y, TRUE ); return; } @@ -2187,8 +2223,8 @@ void RenderHandPosItem( void ) SOLDIERTYPE *pSoldier = NULL; // renders the inventory item in char's right hand - // ARM: if already in the inventory panel, don't show the item again here, seeing it twice is confusing - if ( fShowInventoryFlag ) + // ARM: if already in the inventory panel, don't show the item again here, seeing it twice is confusing. Same for widescreen UI, where the inventory panel is always visible. + if ( fShowInventoryFlag || isWidescreenUI()) { return; } @@ -2218,36 +2254,40 @@ void RenderHandPosItem( void ) SetFontForeground(CHAR_INFO_PANEL_BLOCK_COLOR); SetFontBackground(FONT_BLACK); - INVRenderItem( guiSAVEBUFFER, pSoldier, &(pSoldier->inv[HANDPOS]), SOLDIER_HAND_X, SOLDIER_HAND_Y, 58, 23, DIRTYLEVEL2, NULL, 0, FALSE, 0); + INVRenderItem( guiSAVEBUFFER, pSoldier, &(pSoldier->inv[HANDPOS]), UI_CHARPANEL.HandItem.x, UI_CHARPANEL.HandItem.y, 58, 23, DIRTYLEVEL2, NULL, 0, FALSE, 0); } void RenderIconsForUpperLeftCornerPiece( INT8 bCharNumber ) { - HVOBJECT hHandle; + const auto x = UI_CHARPANEL.Icon.x; + const auto y = UI_CHARPANEL.Icon.y; + const auto height = UI_CHARPANEL.Icon.height; + const auto spacing = UI_CHARPANEL.Icon.spacing; + HVOBJECT hHandle; GetVideoObject(&hHandle, guiULICONS); // if merc is an AIM merc if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { // finite contract length icon - BltVideoObject( guiSAVEBUFFER, hHandle, 0, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ); } // if merc has life insurance if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].usLifeInsurance > 0 ) { // draw life insurance icon - BltVideoObject( guiSAVEBUFFER, hHandle, 2, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + CHAR_ICON_SPACING + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 2, x, y + spacing, VO_BLT_SRCTRANSPARENCY, NULL ); } // if merc has a medical deposit if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].usMedicalDeposit > 0 ) { // draw medical deposit icon - BltVideoObject( guiSAVEBUFFER, hHandle, 1, CHAR_ICON_X + xResOffset, CHAR_ICON_CONTRACT_Y + ( 2 * CHAR_ICON_SPACING ) + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( guiSAVEBUFFER, hHandle, 1, x, y + ( 2 * spacing), VO_BLT_SRCTRANSPARENCY, NULL ); } } @@ -2276,7 +2316,11 @@ void DrawPay(INT16 sCharNumber) swprintf( sString, L"%d", uiSalary ); // right justify salary - FindFontRightCoordinates(CHAR_PAY_X,CHAR_PAY_Y , CHAR_PAY_WID,CHAR_PAY_HEI ,sString , CHAR_FONT, &usX, &usY); + const auto x = UI_CHARPANEL.Text.Pay.x; + const auto y = UI_CHARPANEL.Text.Pay.y; + const auto w = UI_CHARPANEL.Text.Pay.width; + const auto h = UI_CHARPANEL.Text.Pay.height; + FindFontRightCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); // draw salary DrawString(sString,usX, usY, CHAR_FONT); @@ -2325,20 +2369,20 @@ void DrawCharBars( void ) } // current health - DrawLifeUIBarEx( pSoldier, BAR_INFO_X + xResOffset, BAR_INFO_Y + yResOffset,3,42, TRUE, FRAME_BUFFER ); + DrawLifeUIBarEx( pSoldier, UI_CHARPANEL.Statusbars.x, UI_CHARPANEL.Statusbars.y, 3, 42, TRUE, FRAME_BUFFER ); // robot doesn't have energy/fuel if ( !AM_A_ROBOT( pSoldier ) ) { // current energy/fuel - DrawBreathUIBarEx( pSoldier, BAR_INFO_X + xResOffset + 6, BAR_INFO_Y + yResOffset,3,42, TRUE, FRAME_BUFFER ); + DrawBreathUIBarEx( pSoldier, UI_CHARPANEL.Statusbars.x + UI_CHARPANEL.Statusbars.offset, UI_CHARPANEL.Statusbars.y, 3,42, TRUE, FRAME_BUFFER ); } // vehicles and robot don't have morale if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) { // draw morale bar - DrawMoraleUIBarEx( pSoldier, BAR_INFO_X + xResOffset + 12, BAR_INFO_Y + yResOffset,3,42, TRUE, FRAME_BUFFER ); + DrawMoraleUIBarEx( pSoldier, UI_CHARPANEL.Statusbars.x + UI_CHARPANEL.Statusbars.offset*2, UI_CHARPANEL.Statusbars.y, 3,42, TRUE, FRAME_BUFFER ); } } @@ -2391,8 +2435,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(STR_X, STR_Y ,STAT_WID ,STAT_HEI ,sString, CHAR_FONT, &usX, &usY); - DrawString(sString,usX, STR_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.STR.iX, + UI_CHARPANEL.Attr.STR.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString, CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.STR.iY,CHAR_FONT ); // dexterity swprintf( sString, L"%d", pSoldier->stats.bDexterity + pSoldier->bExtraDexterity ); @@ -2423,8 +2473,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(DEX_X,DEX_Y ,STAT_WID ,STAT_HEI ,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, DEX_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.DEX.iX, + UI_CHARPANEL.Attr.DEX.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.DEX.iY,CHAR_FONT ); // agility swprintf( sString, L"%d", pSoldier->stats.bAgility + pSoldier->bExtraAgility ); @@ -2455,8 +2511,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(AGL_X,AGL_Y,STAT_WID ,STAT_HEI ,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, AGL_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.AGL.iX, + UI_CHARPANEL.Attr.AGL.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.AGL.iY,CHAR_FONT ); // wisdom swprintf( sString, L"%d", pSoldier->stats.bWisdom + pSoldier->bExtraWisdom ); @@ -2487,8 +2549,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates( WIS_X,WIS_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, WIS_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.WIS.iX, + UI_CHARPANEL.Attr.WIS.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.WIS.iY,CHAR_FONT ); // leadership swprintf( sString, L"%d", pSoldier->stats.bLeadership ); @@ -2515,8 +2583,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(LDR_X,LDR_Y,STAT_WID,STAT_HEI, sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, LDR_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.LDR.iX, + UI_CHARPANEL.Attr.LDR.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.LDR.iY,CHAR_FONT ); // experience level swprintf( sString, L"%d", pSoldier->stats.bExpLevel + pSoldier->bExtraExpLevel ); @@ -2542,8 +2616,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(LVL_X,LVL_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, LVL_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.LVL.iX, + UI_CHARPANEL.Attr.LVL.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.LVL.iY,CHAR_FONT ); // marksmanship swprintf( sString, L"%d", pSoldier->stats.bMarksmanship ); @@ -2570,8 +2650,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(MRK_X,MRK_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, MRK_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.MRK.iX, + UI_CHARPANEL.Attr.MRK.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.MRK.iY,CHAR_FONT ); // mechanical swprintf( sString, L"%d", pSoldier->stats.bMechanical ); @@ -2598,8 +2684,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(MEC_X,MEC_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, MEC_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.MEC.iX, + UI_CHARPANEL.Attr.MEC.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.MEC.iY,CHAR_FONT ); // explosives swprintf( sString, L"%d", pSoldier->stats.bExplosive ); @@ -2626,8 +2718,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(EXP_X,EXP_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, EXP_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.EXP.iX, + UI_CHARPANEL.Attr.EXP.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString,usX, UI_CHARPANEL.Attr.EXP.iY,CHAR_FONT ); // medical swprintf( sString, L"%d", pSoldier->stats.bMedical ); @@ -2654,8 +2752,14 @@ void DrawCharStats( INT16 sCharNum ) } // right justify - FindFontRightCoordinates(MED_X,MED_Y,STAT_WID ,STAT_HEI,sString , CHAR_FONT, &usX, &usY); - DrawString(sString,usX, MED_Y,CHAR_FONT ); + FindFontRightCoordinates( + UI_CHARPANEL.Attr.MED.iX, + UI_CHARPANEL.Attr.MED.iY, + UI_CHARPANEL.Attr.width, + UI_CHARPANEL.Attr.height, + sString , CHAR_FONT, &usX, &usY + ); + DrawString(sString, usX, UI_CHARPANEL.Attr.MED.iY, CHAR_FONT ); SetFontForeground(CHAR_TEXT_FONT_COLOR); @@ -2670,7 +2774,10 @@ void DrawCharHealth( INT16 sCharNum ) CHAR16 sString[9]; INT16 usX, usY; SOLDIERTYPE *pSoldier = NULL; - + const auto x = UI_CHARPANEL.Text.CurrentHitpoints.x; + const auto y = UI_CHARPANEL.Text.CurrentHitpoints.y; + const auto width = UI_CHARPANEL.Text.CurrentHitpoints.width; + const auto height = UI_CHARPANEL.Text.CurrentHitpoints.height; pSoldier = &Menptr[gCharactersList[sCharNum].usSolID]; @@ -2678,7 +2785,7 @@ void DrawCharHealth( INT16 sCharNum ) { // find starting X coordinate by centering all 3 substrings together, then print them separately (different colors)! swprintf( sString, L"%d/%d", pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); - FindFontCenterCoordinates(CHAR_HP_X, CHAR_HP_Y, CHAR_HP_WID, CHAR_HP_HEI, sString, CHAR_FONT, &usX, &usY); + FindFontCenterCoordinates(x, y, width, height, sString, CHAR_FONT, &usX, &usY); if ( pSoldier->stats.bLifeMax > 0 ) @@ -2712,14 +2819,14 @@ void DrawCharHealth( INT16 sCharNum ) // current life swprintf( sString, L"%d", pSoldier->stats.bLife ); - DrawString( sString, usX, CHAR_HP_Y, CHAR_FONT ); + DrawString( sString, usX, y, CHAR_FONT ); usX += StringPixLength( sString, CHAR_FONT ); // slash SetFontForeground(CHAR_TEXT_FONT_COLOR); wcscpy( sString, L"/" ); - DrawString( sString, usX, CHAR_HP_Y, CHAR_FONT ); + DrawString( sString, usX, y, CHAR_FONT ); usX += StringPixLength( sString, CHAR_FONT ); if (gGameOptions.fNewTraitSystem && pSoldier->ubCriticalStatDamage[DAMAGED_STAT_HEALTH] > 0) @@ -2744,15 +2851,15 @@ void DrawCharHealth( INT16 sCharNum ) // maximum life swprintf( sString, L"%d", pSoldier->stats.bLifeMax ); - DrawString( sString, usX, CHAR_HP_Y, CHAR_FONT ); + DrawString( sString, usX, y, CHAR_FONT ); } else { // POW - health unknown SetFontForeground(CHAR_TEXT_FONT_COLOR); swprintf( sString, pPOWStrings[ 1 ] ); - FindFontCenterCoordinates(CHAR_HP_X, CHAR_HP_Y, CHAR_HP_WID, CHAR_HP_HEI, sString, CHAR_FONT, &usX, &usY); - DrawString(sString, usX, CHAR_HP_Y, CHAR_FONT); + FindFontCenterCoordinates(x, y, width, height, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, y, CHAR_FONT); } @@ -2818,7 +2925,7 @@ void DrawCharacterInfo(INT16 sCharNumber) wcscpy(sString, gMercProfiles[usMercProfileID].zNickname); } - FindFontCenterCoordinates(PIC_NAME_X, PIC_NAME_Y, PIC_NAME_WID, PIC_NAME_HEI, sString, CHAR_FONT, &usX, &usY); + FindFontCenterCoordinates(UI_CHARPANEL.NickName.x, UI_CHARPANEL.NickName.y, UI_CHARPANEL.NickName.width, UI_CHARPANEL.NickName.height, sString, CHAR_FONT, &usX, &usY); DrawString(sString, usX, usY, CHAR_FONT); @@ -2845,7 +2952,7 @@ void DrawCharacterInfo(INT16 sCharNumber) } - FindFontCenterCoordinates(CHAR_NAME_X, CHAR_NAME_Y, CHAR_NAME_WID, CHAR_NAME_HEI, sString, CHAR_FONT, &usX, &usY); + FindFontCenterCoordinates(UI_CHARPANEL.FullName.x, UI_CHARPANEL.FullName.y, UI_CHARPANEL.FullName.width, UI_CHARPANEL.FullName.height, sString, CHAR_FONT, &usX, &usY); DrawString(sString, usX, usY, CHAR_FONT); @@ -2864,9 +2971,14 @@ void DrawCharacterInfo(INT16 sCharNumber) wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] ); } - FindFontCenterCoordinates( CHAR_ASSIGN_X, CHAR_ASSIGN1_Y, CHAR_ASSIGN_WID, CHAR_ASSIGN_HEI, sString, CHAR_FONT, &usX, &usY ); - DrawString( sString, usX, usY, CHAR_FONT ); - + { + const auto x = UI_CHARPANEL.Text.CurrentAssignment.x; + const auto y = UI_CHARPANEL.Text.CurrentAssignment.y; + const auto w = UI_CHARPANEL.Text.CurrentAssignment.width; + const auto h = UI_CHARPANEL.Text.CurrentAssignment.height; + FindFontCenterCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, usY, CHAR_FONT); + } // second assignment line @@ -2937,7 +3049,11 @@ void DrawCharacterInfo(INT16 sCharNumber) if ( wcslen( sString ) > 0 ) { - FindFontCenterCoordinates(CHAR_ASSIGN_X, CHAR_ASSIGN2_Y ,CHAR_ASSIGN_WID ,CHAR_ASSIGN_HEI ,sString , CHAR_FONT, &usX, &usY); + const auto x = UI_CHARPANEL.Text.CurrentAssignment.x; + const auto y = UI_CHARPANEL.Text.CurrentAssignment_Y2; + const auto w = UI_CHARPANEL.Text.CurrentAssignment.width; + const auto h = UI_CHARPANEL.Text.CurrentAssignment.height; + FindFontCenterCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); DrawString(sString, usX, usY, CHAR_FONT ); } @@ -3042,9 +3158,14 @@ void DrawCharacterInfo(INT16 sCharNumber) SetFontBackground(FONT_BLACK); // center and draw - FindFontCenterCoordinates(CHAR_TIME_REMAINING_X, CHAR_TIME_REMAINING_Y, CHAR_TIME_REMAINING_WID, CHAR_TIME_REMAINING_HEI, sString, CHAR_FONT, &usX, &usY); - DrawString(sString,usX,usY, CHAR_FONT); - + { + const auto x = UI_CHARPANEL.Text.TimeRemaining.x; + const auto y = UI_CHARPANEL.Text.TimeRemaining.y; + const auto w = UI_CHARPANEL.Text.TimeRemaining.width; + const auto h = UI_CHARPANEL.Text.TimeRemaining.height; + FindFontCenterCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, usY, CHAR_FONT); + } // salary if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) @@ -3073,10 +3194,14 @@ void DrawCharacterInfo(INT16 sCharNumber) // insert commas and dollar sign InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - - FindFontRightCoordinates(CHAR_SALARY_X, CHAR_SALARY_Y, CHAR_SALARY_WID, CHAR_SALARY_HEI, sString, CHAR_FONT, &usX, &usY); - DrawString(sString,usX,usY, CHAR_FONT); - + { + const auto x = UI_CHARPANEL.Text.Salary.x; + const auto y = UI_CHARPANEL.Text.Salary.y; + const auto w = UI_CHARPANEL.Text.Salary.width; + const auto h = UI_CHARPANEL.Text.Salary.height; + FindFontRightCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, usY, CHAR_FONT); + } // medical deposit if( gMercProfiles[ Menptr[ gCharactersList[ sCharNumber ].usSolID ].ubProfile ].sMedicalDepositAmount > 0 ) @@ -3086,9 +3211,14 @@ void DrawCharacterInfo(INT16 sCharNumber) // insert commas and dollar sign InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - - FindFontRightCoordinates(CHAR_MEDICAL_X, CHAR_MEDICAL_Y, CHAR_MEDICAL_WID, CHAR_MEDICAL_HEI, sString, CHAR_FONT, &usX, &usY); - DrawString(sString,usX,CHAR_MEDICAL_Y, CHAR_FONT); + { + const auto x = UI_CHARPANEL.Text.Medical.x; + const auto y = UI_CHARPANEL.Text.Medical.y; + const auto w = UI_CHARPANEL.Text.Medical.width; + const auto h = UI_CHARPANEL.Text.Medical.height; + FindFontRightCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, y, CHAR_FONT); + } } /* @@ -3118,9 +3248,14 @@ void DrawCharacterInfo(INT16 sCharNumber) swprintf( sString, pPOWStrings[ 1 ] ); } - FindFontCenterCoordinates(CHAR_MORALE_X, CHAR_MORALE_Y, CHAR_MORALE_WID, CHAR_MORALE_HEI, sString, CHAR_FONT, &usX, &usY); - DrawString(sString,usX,CHAR_MORALE_Y, CHAR_FONT); - + { + const auto x = UI_CHARPANEL.Text.CurrentMorale.x; + const auto y = UI_CHARPANEL.Text.CurrentMorale.y; + const auto w = UI_CHARPANEL.Text.CurrentMorale.width; + const auto h = UI_CHARPANEL.Text.CurrentMorale.height; + FindFontCenterCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY); + DrawString(sString, usX, y, CHAR_FONT); + } return; } @@ -3186,123 +3321,155 @@ void DisplayCharacterInfo( void ) //pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); + const auto STAT_WIDTH = UI_CHARPANEL.Attr.width; + const auto STAT_HEIGHT = UI_CHARPANEL.Attr.height; // AGI if (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (AGL_Y-1); - ClipRect.iBottom = (AGL_Y-1) + STAT_HEI; - ClipRect.iLeft = AGL_X; - ClipRect.iRight = AGL_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.AGL.iX; + const auto y = UI_CHARPANEL.Attr.AGL.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // DEX if (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (DEX_Y-1); - ClipRect.iBottom = (DEX_Y-1) + STAT_HEI; - ClipRect.iLeft = DEX_X; - ClipRect.iRight = DEX_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.DEX.iX; + const auto y = UI_CHARPANEL.Attr.DEX.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // STR if (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (STR_Y-1); - ClipRect.iBottom = (STR_Y-1) + STAT_HEI; - ClipRect.iLeft = STR_X; - ClipRect.iRight = STR_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.STR.iX; + const auto y = UI_CHARPANEL.Attr.STR.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // WIS if (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (WIS_Y-1); - ClipRect.iBottom = (WIS_Y-1) + STAT_HEI; - ClipRect.iLeft = WIS_X; - ClipRect.iRight = WIS_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.WIS.iX; + const auto y = UI_CHARPANEL.Attr.WIS.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // MRK if (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (MRK_Y-1); - ClipRect.iBottom = (MRK_Y-1) + STAT_HEI; - ClipRect.iLeft = MRK_X; - ClipRect.iRight = MRK_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.MRK.iX; + const auto y = UI_CHARPANEL.Attr.MRK.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // LDR if (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (LDR_Y-1); - ClipRect.iBottom = (LDR_Y-1) + STAT_HEI; - ClipRect.iLeft = LDR_X; - ClipRect.iRight = LDR_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.LDR.iX; + const auto y = UI_CHARPANEL.Attr.LDR.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // MECH if (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (MEC_Y-1); - ClipRect.iBottom = (MEC_Y-1) + STAT_HEI; - ClipRect.iLeft = MEC_X; - ClipRect.iRight = MEC_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.MEC.iX; + const auto y = UI_CHARPANEL.Attr.MEC.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // EXPLO if (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (EXP_Y-1); - ClipRect.iBottom = (EXP_Y-1) + STAT_HEI; - ClipRect.iLeft = EXP_X; - ClipRect.iRight = EXP_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.EXP.iX; + const auto y = UI_CHARPANEL.Attr.EXP.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // MED if (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (MED_Y-1); - ClipRect.iBottom = (MED_Y-1) + STAT_HEI; - ClipRect.iLeft = MED_X; - ClipRect.iRight = MED_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.MED.iX; + const auto y = UI_CHARPANEL.Attr.MED.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } // EXPLEVEL if (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain) { - ubBarWidth = (STAT_WID * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, pSoldier->stats.bExpLevel); - ubBarWidth = __max(0, __min(ubBarWidth, STAT_WID)); - ClipRect.iTop = (LVL_Y-1); - ClipRect.iBottom = (LVL_Y-1) + STAT_HEI; - ClipRect.iLeft = LVL_X; - ClipRect.iRight = LVL_X + ubBarWidth; + const auto x = UI_CHARPANEL.Attr.LVL.iX; + const auto y = UI_CHARPANEL.Attr.LVL.iY; + + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, pSoldier->stats.bExpLevel); + ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); + ClipRect.iTop = (y-1); + ClipRect.iBottom = (y-1) + STAT_HEIGHT; + ClipRect.iLeft = x; + ClipRect.iRight = x + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); } @@ -3477,7 +3644,7 @@ void DisplayGroundEta( void ) SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); - mprintf( CLOCK_ETA_X, CLOCK_Y_START, pEtaString[ 0 ] ); + mprintf(UI_MAP.ETA.Clock_X, UI_MAP.ETA.Start_Y, pEtaString[ 0 ] ); // if less than one day if( ( iTotalTime / ( 60 * 24 ) ) < 1 ) @@ -3505,7 +3672,6 @@ void HighLightAssignLine() static BOOLEAN fDelta=FALSE; static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1; INT16 usCount = 0; - UINT16 usX; UINT16 usY; INT16 usVehicleCount = 0; @@ -3541,34 +3707,37 @@ void HighLightAssignLine() else iColorNum--; - usY = ( Y_OFFSET * giAssignHighLine - 1 ) + ( Y_START + ( giAssignHighLine * Y_SIZE ) ); + const auto yStart = UI_CHARLIST.y; + const auto yOffset = UI_CHARLIST.yOffset; + usY = (yOffset * giAssignHighLine - 1 ) + (yStart + ( giAssignHighLine * Y_SIZE ) ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); // marke strogg more mercs + const auto usX = UI_CHARLIST.xAssignment; + const auto width = UI_CHARLIST.widthAssignment; for( usCount = 0; usCount < maxNumberOfMercVisibleInStrategyList; usCount++ ) { if( IsCharacterSelectedForAssignment( usCount ) == TRUE ) { - usX=ASSIGN_X; - usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); + usY=(yOffset * usCount-1)+(yStart +(usCount*Y_SIZE)); usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); LineDraw(TRUE, usX, usY, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); - LineDraw(TRUE, usX+ASSIGN_WIDTH, usY, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, usX + width, usY, usX + width, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); if( ( usCount == 0 ) || ( usCount != 0 ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount - 1 ) ) ) : 0 ) ) { - LineDraw( TRUE, usX, usY, usX+ASSIGN_WIDTH, usY, usColor,pDestBuf); + LineDraw( TRUE, usX, usY, usX + width, usY, usColor,pDestBuf); } if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount + 1 ) ) ) : 0) ) { - LineDraw(TRUE, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX + width, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); } - InvalidateRegion( usX, usY, usX+ASSIGN_WIDTH+1, usY+GetFontHeight(MAP_SCREEN_FONT)+3); + InvalidateRegion( usX, usY, usX + width + 1, usY+GetFontHeight(MAP_SCREEN_FONT)+3); } } @@ -3585,7 +3754,6 @@ void HighLightDestLine() static BOOLEAN fDelta=FALSE; static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1; UINT16 usCount = 0; - UINT16 usX; UINT16 usY; //UINT16 usVehicleCont = 0; @@ -3625,32 +3793,33 @@ void HighLightDestLine() SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); // marke strogg more mercs + const auto usX = UI_CHARLIST.xETA; + const auto width = UI_CHARLIST.widthETA; for( usCount = 0; usCount < maxNumberOfMercVisibleInStrategyList; usCount++ ) { if( CharacterIsGettingPathPlotted( usCount ) == TRUE ) { - usX=DEST_ETA_X-4; - usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); + usY=(UI_CHARLIST.yOffset*usCount-1)+(UI_CHARLIST.y +(usCount*Y_SIZE)); usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); if( ( usCount == 0 ) || ( usCount != 0 ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount - 1 ) ) ) : 0 )) { - LineDraw( TRUE, usX+4, usY, usX+DEST_ETA_WIDTH+4, usY, usColor,pDestBuf); + LineDraw( TRUE, usX, usY, usX + width, usY, usColor,pDestBuf); } if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount + 1 ) ) ) : 0) ) { - LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+DEST_ETA_WIDTH+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX + width, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); } - LineDraw(TRUE, usX+4, usY, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); - LineDraw(TRUE, usX+DEST_ETA_WIDTH+4, usY, usX+DEST_ETA_WIDTH+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, usX, usY, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, usX+ width, usY, usX + width, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); - InvalidateRegion( usX, usY, usX + DEST_ETA_WIDTH + 5, usY + GetFontHeight(MAP_SCREEN_FONT)+3 ); + InvalidateRegion( usX - 4, usY, usX + width + 1, usY + GetFontHeight(MAP_SCREEN_FONT)+3 ); } } - //InvalidateRegion( usX+4, usY, DEST_ETA_WIDTH-10, usY+GetFontHeight(MAP_SCREEN_FONT)+3); + //InvalidateRegion( usX+4, usY, width-10, usY+GetFontHeight(MAP_SCREEN_FONT)+3); //InvalidateRegion( usX+10, usY, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+3); UnLockVideoSurface( FRAME_BUFFER ); } @@ -3666,7 +3835,6 @@ void HighLightSleepLine() static BOOLEAN fDelta=FALSE; static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1; UINT16 usCount = 0; - UINT16 usX, usX2; UINT16 usY; //UINT16 usVehicleCount = 0; @@ -3705,31 +3873,33 @@ void HighLightSleepLine() pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); -// marke strogg more mercs Ok, we have to watch for to use only 18 display lines insedead of MAX_CHARACTER_COUNT + // marke strogg more mercs Ok, we have to watch for to use only 18 display lines insedead of MAX_CHARACTER_COUNT + const auto x = UI_CHARLIST.xSleep; + const auto xEnd = UI_CHARLIST.xSleep + UI_CHARLIST.widthSleep; + const auto y = UI_CHARLIST.y; + const auto yOffset = UI_CHARLIST.yOffset; + for( usCount = 0; usCount < maxNumberOfMercVisibleInStrategyList; usCount++ ) { if( IsCharacterSelectedForSleep( usCount ) == TRUE ) { - usX=SLEEP_X-4; - usX2 = SLEEP_X + SLEEP_WIDTH; - - usY=(Y_OFFSET*usCount-1)+(Y_START+(usCount*Y_SIZE)); + usY=(yOffset*usCount-1)+(y +(usCount*Y_SIZE)); usColor=Get16BPPColor( FROMRGB( GlowColorsA[iColorNum].ubRed, GlowColorsA[iColorNum].ubGreen, GlowColorsA[iColorNum].ubBlue ) ); if( ( usCount == 0 ) || ( usCount != 0 ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount - 1 ) ) ) : 0 ) ) { - LineDraw( TRUE, usX+4, usY, usX2, usY, usColor,pDestBuf); + LineDraw( TRUE, x, usY, xEnd, usY, usColor,pDestBuf); } if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount + 1 ) ) ) : 0) ) { - LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX2, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, x, usY+GetFontHeight(MAP_SCREEN_FONT)+2, xEnd, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); } - LineDraw(TRUE, usX+ 4, usY, usX + 4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); - LineDraw(TRUE, usX2, usY, usX2, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, x, usY, x, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); + LineDraw(TRUE, xEnd, usY, xEnd, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf); - InvalidateRegion( usX, usY, usX2 + 5, usY + GetFontHeight(MAP_SCREEN_FONT)+3 ); + InvalidateRegion( x - 4, usY, xEnd + 5, usY + GetFontHeight(MAP_SCREEN_FONT)+3 ); } } UnLockVideoSurface( FRAME_BUFFER ); @@ -4561,10 +4731,14 @@ UINT32 MapScreenHandle(void) } else { - CreateDestroyMapInvButton(); - // define our progress bar - //CreateProgressBar( 0, 118, 183, 522, 202 ); - + if (isWidescreenUI()) + { + CreateMapCharInvIOregions(); + } + else + { + CreateDestroyMapInvButton(); + } } return( MAP_SCREEN ); } @@ -4637,63 +4811,17 @@ UINT32 MapScreenHandle(void) { vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI()) + { + strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_1280x720.pcx"); + } + else if (iResolution < _800x600) { // ------------ // 336 x 288 (size without the black area on top and left // Important: The size (including black area on top and left) of the PCX file has to be an even number for width and height, // otherwise the blitting method which shrinks the image by 50% does not work. // ------------ - - MAP_GRID_X = 21; // Horizontal size of a square - MAP_GRID_Y = 18; // Vertical size of a square - - MAP_BORDER_X_OFFSET = (((SCREEN_WIDTH - 261) - 380) / 2); // 380: Width of the MBS.sti file - MAP_BORDER_Y_OFFSET = (((SCREEN_HEIGHT - 121) - 360) / 2); // 360: Height of the MBS.sti file - - MAP_VIEW_START_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 9); // 9: Constant, do not change it. - MAP_VIEW_START_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 10); // 10: Constant, do not change it. - - // Maus Area (Ist die reine Größe der Karte/2 (ohne dem schwarzen Rand (links und oben)) - MAP_VIEW_WIDTH = 336; // Width of the map (without the black area on the left) - MAP_VIEW_HEIGHT = 288 + 10; // Height of the map (without the black area on the top) + constant value of 10 - - - MAP_FONT = BLOCKFONT2; - - // The postion of the map numbers (1-16) above the map (horizontal) - MAP_HORT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 31); - MAP_HORT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 11); - MAP_HORT_HEIGHT = GetFontHeight(MAP_FONT); - - // The position of the latters (A-P) on the left side of the map (vertical) - MAP_VERT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 15); - MAP_VERT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 29); - - MAP_VERT_WIDTH = GetFontHeight(MAP_FONT); - - ETA_FONT = BLOCKFONT2; - - // standard ETA box - CLOCK_Y_START = 300; - DEST_PLOT_X = 420; - DEST_PLOT_Y = 345; - CLOCK_ETA_X = 440; - CLOCK_HOUR_X_START = 478; - CLOCK_MIN_X_START = 494; - - // Helicopter ETA box - MAP_HELICOPTER_ETA_POPUP_X = (400 + iScreenWidthOffset); - MAP_HELICOPTER_ETA_POPUP_Y = (250 + iScreenHeightOffset); - MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset); - MAP_HELICOPTER_ETA_POPUP_WIDTH = 120; - MAP_HELICOPTER_ETA_POPUP_HEIGHT = 68; - MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 74; - - // Map Level string - MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 208); - MAP_LEVEL_STRING_Y = (SCREEN_HEIGHT - 175); - strcpy(vs_desc.ImageFile, "INTERFACE\\b_map.pcx"); } else if (iResolution < _1024x768) @@ -4701,52 +4829,6 @@ UINT32 MapScreenHandle(void) // ------------ // 480 x 400 // ------------ - - MAP_GRID_X = 30; - MAP_GRID_Y = 25; - - MAP_BORDER_X_OFFSET = (SCREEN_WIDTH - 800)/ 2 +(((800 - 261) - 540) / 2); - MAP_BORDER_Y_OFFSET = (SCREEN_HEIGHT - 600)/ 2 +(((600 - 121) - 480) / 2); - - MAP_VIEW_START_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 9); - MAP_VIEW_START_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 10); - - MAP_VIEW_WIDTH = 480; - MAP_VIEW_HEIGHT = 400 + 10 + 7; - - // The numbers on the horizontal line - MAP_FONT = BLOCKFONT2; - - MAP_HORT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 38); - MAP_HORT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 15); - MAP_HORT_HEIGHT = GetFontHeight(MAP_FONT); - - MAP_VERT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 19); - MAP_VERT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 36); - MAP_VERT_WIDTH = GetFontHeight(MAP_FONT); - - ETA_FONT = BLOCKFONT2; - - // standard ETA box - CLOCK_Y_START = (250 + iScreenHeightOffset + 108); - DEST_PLOT_X = (400 + iScreenWidthOffset + 10); - DEST_PLOT_Y = (250 + iScreenHeightOffset + 148) - yResOffset; - CLOCK_ETA_X = (400 + iScreenWidthOffset + 30); - CLOCK_HOUR_X_START = (400 + iScreenWidthOffset + 68); - CLOCK_MIN_X_START = (400 + iScreenWidthOffset + 84); - - // Helicopter ETA box - MAP_HELICOPTER_ETA_POPUP_X = (400 + iScreenWidthOffset); - MAP_HELICOPTER_ETA_POPUP_Y = (250 + iScreenHeightOffset + 58); - MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset - 40); - MAP_HELICOPTER_ETA_POPUP_WIDTH = 120; - MAP_HELICOPTER_ETA_POPUP_HEIGHT = 68; - MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 74; - - // Map Level string - MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 800)/ 2 + (800 - 208 - 80); - MAP_LEVEL_STRING_Y = (SCREEN_WIDTH - 600)/ 2 + (600 - 175); - strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_800x600.pcx"); } else @@ -4754,300 +4836,256 @@ UINT32 MapScreenHandle(void) // ------------ // 688 x 560 // ------------ - - MAP_GRID_X = 43; - MAP_GRID_Y = 35; - - MAP_BORDER_X_OFFSET = (SCREEN_WIDTH - 1024)/ 2 +(((1024 - 261) - 764) / 2); - MAP_BORDER_Y_OFFSET = (SCREEN_HEIGHT - 768)/ 2 +(((768 - 121) - 648) / 2); - - MAP_VIEW_START_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 9); - MAP_VIEW_START_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 10); - - MAP_VIEW_WIDTH = 688; - MAP_VIEW_HEIGHT = 560 + 10 + 17; - - MAP_FONT = FONT12ARIAL; - - MAP_HORT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 53); - MAP_HORT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 19); - MAP_HORT_HEIGHT = GetFontHeight(MAP_FONT); - - MAP_VERT_INDEX_X = (MAP_BORDER_X + MAP_BORDER_X_OFFSET + 24); - MAP_VERT_INDEX_Y = (MAP_BORDER_Y + MAP_BORDER_Y_OFFSET + 44); - MAP_VERT_WIDTH = GetFontHeight(MAP_FONT); - - ETA_FONT = FONT12ARIAL; - - // standard ETA box - CLOCK_Y_START = (250 + iScreenHeightOffset + 190); - DEST_PLOT_X = (400 + iScreenWidthOffset + 10); - DEST_PLOT_Y = (250 + iScreenHeightOffset + 240); - CLOCK_ETA_X = (400 + iScreenWidthOffset + 30); - CLOCK_HOUR_X_START = (400 + iScreenWidthOffset + 68); - CLOCK_MIN_X_START = (400 + iScreenWidthOffset + 84); - - // Helicopter ETA box - MAP_HELICOPTER_ETA_POPUP_X = (400 + iScreenWidthOffset); - MAP_HELICOPTER_ETA_POPUP_Y = (250 + iScreenHeightOffset + 120); - MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset - 100); - MAP_HELICOPTER_ETA_POPUP_WIDTH = 120; - MAP_HELICOPTER_ETA_POPUP_HEIGHT = 76; - MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 97; - - // Map Level string - MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 1024)/ 2 + (1024 - 208 - 187); - MAP_LEVEL_STRING_Y = (SCREEN_HEIGHT - 768)/ 2 + (768 - 175); - strcpy(vs_desc.ImageFile, "INTERFACE\\b_map_1024x768.pcx"); } - + initMapViewAndBorderCoordinates(); LoadMapBorderGraphics( ); - //fInterfacePanelDirty=DIRTYLEVEL2; - //RenderTacticalInterface(); + //fInterfacePanelDirty=DIRTYLEVEL2; + //RenderTacticalInterface(); - // Grab the Map image + // Grab the Map image - CHECKF(AddVideoSurface(&vs_desc, &guiBIGMAP)); + CHECKF(AddVideoSurface(&vs_desc, &guiBIGMAP)); - vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; - strcpy(vs_desc.ImageFile, "INTERFACE\\popupbackground.pcx"); - CHECKF(AddVideoSurface(&vs_desc, &guiPOPUPTEX)); + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + strcpy(vs_desc.ImageFile, "INTERFACE\\popupbackground.pcx"); + CHECKF(AddVideoSurface(&vs_desc, &guiPOPUPTEX)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\SAM.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSAMICON)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\SAM.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSAMICON)); - // VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - // FilenameForBPP("INTERFACE\\s_map.sti", VObjectDesc.ImageFile); - // CHECKF( AddVideoObject( &VObjectDesc, &guiMAP ) ); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\mapcursr.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCURSORS)); + // VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + // FilenameForBPP("INTERFACE\\s_map.sti", VObjectDesc.ImageFile); + // CHECKF( AddVideoObject( &VObjectDesc, &guiMAP ) ); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\mapcursr.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCURSORS)); - // HEADROCK HAM 5: New pathing arrows may replace the above eventually, but for now a separate variable will do. - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // HEADROCK HAM 5: New pathing arrows may replace the above eventually, but for now a separate variable will do. + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\map_pathing_arrows_640.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) - FilenameForBPP("INTERFACE\\map_pathing_arrows_800.sti", VObjectDesc.ImageFile); - else - FilenameForBPP("INTERFACE\\map_pathing_arrows_1024.sti", VObjectDesc.ImageFile); + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\map_pathing_arrows_1024.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) + FilenameForBPP("INTERFACE\\map_pathing_arrows_800.sti", VObjectDesc.ImageFile); + else + FilenameForBPP("INTERFACE\\map_pathing_arrows_640.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapPathingArrows)); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapPathingArrows)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_1.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel1)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_1.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel1)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_2.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel2)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel2)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\Mine_3.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel3)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Mine_3.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSubLevel3)); - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\addonslcp.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiCORNERADDONS)); + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\addonslcp.sti", VObjectDesc.ImageFile); + //CHECKF(AddVideoObject(&VObjectDesc, &guiCORNERADDONS)); - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\mapborder.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPBORDER)); + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + //FilenameForBPP("INTERFACE\\mapborder.sti", VObjectDesc.ImageFile); + //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPBORDER)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\sleepicon.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiSleepIcon)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\sleepicon.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSleepIcon)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\charinfo.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARINFO)); - /*strcpy(vs_desc.ImageFile, "INTERFACE\\playlist3.pcx"); - CHECKF(AddVideoSurface( &vs_desc, &guiCHARLIST ));*/ + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\charinfo.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARINFO)); + /*strcpy(vs_desc.ImageFile, "INTERFACE\\playlist3.pcx"); + CHECKF(AddVideoSurface( &vs_desc, &guiCHARLIST ));*/ - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (!is_networked) - { - if (iResolution >= _640x480 && iResolution < _800x600) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + if (!is_networked) { - FilenameForBPP("INTERFACE\\newgoldpiece3.sti", VObjectDesc.ImageFile ); - } - else if (iResolution < _1024x768) - { - FilenameForBPP("INTERFACE\\newgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); + if (iResolution == _1280x720) + { + FilenameForBPP("INTERFACE\\newgoldpiece3_1280x720.sti", VObjectDesc.ImageFile); + } + else if (iResolution >= _1024x768) + { + FilenameForBPP("INTERFACE\\newgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); + } + else if (iResolution >= _800x600) + { + FilenameForBPP("INTERFACE\\newgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); + } + else + { + FilenameForBPP("INTERFACE\\newgoldpiece3.sti", VObjectDesc.ImageFile ); + } } else { - FilenameForBPP("INTERFACE\\newgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); - } - } - else - { - // OJW - 20081204 - change mapscreen interface for MP games - if (iResolution >= _640x480 && iResolution < _800x600) - { - FilenameForBPP("INTERFACE\\mpgoldpiece3.sti", VObjectDesc.ImageFile ); - } - else if (iResolution < _1024x768) - { - FilenameForBPP("INTERFACE\\mpgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); + // OJW - 20081204 - change mapscreen interface for MP games + if (iResolution == _1280x720) + { + FilenameForBPP("INTERFACE\\mpgoldpiece3_1280x720.sti", VObjectDesc.ImageFile); + } + else if (iResolution >= _1024x768) + { + FilenameForBPP("INTERFACE\\mpgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); + } + else if (iResolution >= _800x600) + { + FilenameForBPP("INTERFACE\\mpgoldpiece3_800x600.sti", VObjectDesc.ImageFile ); + } + else + { + FilenameForBPP("INTERFACE\\mpgoldpiece3.sti", VObjectDesc.ImageFile ); + } } + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARLIST)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\boxes_1024x768.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) + FilenameForBPP("INTERFACE\\boxes_800x600.sti", VObjectDesc.ImageFile); else - { - FilenameForBPP("INTERFACE\\mpgoldpiece3_1024x768.sti", VObjectDesc.ImageFile ); - } - } - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARLIST)); + FilenameForBPP("INTERFACE\\boxes.sti", VObjectDesc.ImageFile); - //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - //FilenameForBPP("INTERFACE\\mapbordercorner.sti", VObjectDesc.ImageFile); - //CHECKF(AddVideoObject(&VObjectDesc, &guiMAPCORNER)); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARICONS)); - // VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - // FilenameForBPP("INTERFACE\\popup.sti", VObjectDesc.ImageFile); - // CHECKF(AddVideoObject(&VObjectDesc, &guiPOPUPBORDERS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\boxes.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) - FilenameForBPP("INTERFACE\\boxes_800x600.sti", VObjectDesc.ImageFile); - else - FilenameForBPP("INTERFACE\\boxes_1024x768.sti", VObjectDesc.ImageFile); - - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARICONS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\incross.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCROSS)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\incross.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCROSS)); - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - FilenameForBPP( "INTERFACE\\IntelMapSymbols.sti", VObjectDesc.ImageFile ); - CHECKF( AddVideoObject( &VObjectDesc, &guiINTEL ) ); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - { - FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); - } - else if (iResolution < _1024x768) - { - FilenameForBPP("INTERFACE\\mapinv_800x600.sti", VObjectDesc.ImageFile); - } - else - { - FilenameForBPP("INTERFACE\\mapinv_1024x768.sti", VObjectDesc.ImageFile); - } - - if(!AddVideoObject(&VObjectDesc, &guiMAPINV)) - { - FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMAPINV)); - } - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\map_inv_2nd_gun_cover.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapInvSecondHandBlockout)); - - // the upper left corner piece icons - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\top_left_corner_icons.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiULICONS)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\map_item.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiORTAICON)); - - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\prison.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiTIXAICON)); - - for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) - { VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - - if ( gfIconTown[iCounter2] == TRUE ) + FilenameForBPP( "INTERFACE\\IntelMapSymbols.sti", VObjectDesc.ImageFile ); + CHECKF( AddVideoObject( &VObjectDesc, &guiINTEL ) ); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + if (isWidescreenUI() || iResolution >= _1024x768) { - strcpy(VObjectDesc.ImageFile, gHiddenIcon[iCounter2].IconSti); + FilenameForBPP("INTERFACE\\mapinv_1024x768.sti", VObjectDesc.ImageFile); + } + else if (iResolution >= _800x600) + { + FilenameForBPP("INTERFACE\\mapinv_800x600.sti", VObjectDesc.ImageFile); } else { - FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); } - - if (!FileExists(VObjectDesc.ImageFile)) + + if(!AddVideoObject(&VObjectDesc, &guiMAPINV)) { - FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + FilenameForBPP("INTERFACE\\mapinv.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMAPINV)); } + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\map_inv_2nd_gun_cover.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapInvSecondHandBlockout)); + + // the upper left corner piece icons + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\top_left_corner_icons.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiULICONS)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\map_item.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiORTAICON)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\prison.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTIXAICON)); + + for( iCounter2 = 1; iCounter2 < NUM_TOWNS; iCounter2++ ) + { + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + + if ( gfIconTown[iCounter2] == TRUE ) + { + strcpy(VObjectDesc.ImageFile, gHiddenIcon[iCounter2].IconSti); + } + else + { + FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + } + + if (!FileExists(VObjectDesc.ImageFile)) + { + FilenameForBPP("INTERFACE\\PRISON.sti", VObjectDesc.ImageFile); + } - CHECKF(AddVideoObject(&VObjectDesc, &guiIcon2[iCounter2])); - } + CHECKF(AddVideoObject(&VObjectDesc, &guiIcon2[iCounter2])); + } - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - // HEADROCK HAM 5.4: Larger icons for merc movement - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\merc_between_sector_icons_640.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) - FilenameForBPP("INTERFACE\\merc_between_sector_icons_800.sti", VObjectDesc.ImageFile); - else - FilenameForBPP("INTERFACE\\merc_between_sector_icons_1024.sti", VObjectDesc.ImageFile); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // HEADROCK HAM 5.4: Larger icons for merc movement + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\merc_between_sector_icons_1024.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) + FilenameForBPP("INTERFACE\\merc_between_sector_icons_800.sti", VObjectDesc.ImageFile); + else + FilenameForBPP("INTERFACE\\merc_between_sector_icons_640.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONS)); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARBETWEENSECTORICONS)); - // HEADROCK HAM 5.1: Enemies between sectors - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + // HEADROCK HAM 5.1: Enemies between sectors + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\enemy_between_sector_icons_640.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) - FilenameForBPP("INTERFACE\\enemy_between_sector_icons_800.sti", VObjectDesc.ImageFile); - else - FilenameForBPP("INTERFACE\\enemy_between_sector_icons_1024.sti", VObjectDesc.ImageFile); + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\enemy_between_sector_icons_1024.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) + FilenameForBPP("INTERFACE\\enemy_between_sector_icons_800.sti", VObjectDesc.ImageFile); + else + FilenameForBPP("INTERFACE\\enemy_between_sector_icons_640.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiENEMYBETWEENSECTORICONS)); + CHECKF(AddVideoObject(&VObjectDesc, &guiENEMYBETWEENSECTORICONS)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\GreenArr.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiLEVELMARKER)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\GreenArr.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLEVELMARKER)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - // HEADROCK HAM 5: Resolution-dependent icon - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_640.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) - FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_800.sti", VObjectDesc.ImageFile); - else - FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_1024.sti", VObjectDesc.ImageFile); + // HEADROCK HAM 5: Resolution-dependent icon + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_1024.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) + FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_800.sti", VObjectDesc.ImageFile); + else + FilenameForBPP("INTERFACE\\Helicopter_Map_Icon_640.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiHelicopterIcon)); + CHECKF(AddVideoObject(&VObjectDesc, &guiHelicopterIcon)); - if ( iResolution >= _640x480 && iResolution < _800x600 ) - FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_640.sti", VObjectDesc.ImageFile ); - else if ( iResolution < _1024x768 ) - FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_800.sti", VObjectDesc.ImageFile ); - else - FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_1024.sti", VObjectDesc.ImageFile ); + if (isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_1024.sti", VObjectDesc.ImageFile ); + else if ( iResolution >= _800x600) + FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_800.sti", VObjectDesc.ImageFile ); + else + FilenameForBPP( "INTERFACE\\Helicopter_Map_Icon_Enemy_640.sti", VObjectDesc.ImageFile ); - CHECKF( AddVideoObject( &VObjectDesc, &guiEnemyHelicopterIcon ) ); + CHECKF( AddVideoObject( &VObjectDesc, &guiEnemyHelicopterIcon ) ); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\eta_pop_up.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderEtaPopUp)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\eta_pop_up.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderEtaPopUp)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\pos2.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\pos2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors)); - VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - FilenameForBPP("INTERFACE\\pos2_alternate.sti", VObjectDesc.ImageFile); - CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectorsAlternate)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\pos2_alternate.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectorsAlternate)); VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\secondary_gun_hidden.sti", VObjectDesc.ImageFile); @@ -5064,12 +5102,12 @@ UINT32 MapScreenHandle(void) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite.sti" ); - else if (iResolution < _1024x768) + if (isWidescreenUI() || iResolution >= _1024x768) + sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite_1024x768.sti" ); + else if (iResolution >= _800x600) sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite_800x600.sti" ); else - sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite_1024x768.sti" ); + sprintf( VObjectDesc.ImageFile, "INTERFACE\\hilite.sti" ); AddVideoObject( &VObjectDesc, &guiSectorLocatorGraphicID ); @@ -5186,17 +5224,40 @@ UINT32 MapScreenHandle(void) // set up regions - MSYS_DefineRegion( &gMapViewRegion, MAP_VIEW_START_X + MAP_GRID_X, MAP_VIEW_START_Y + MAP_GRID_Y,MAP_VIEW_START_X + MAP_VIEW_WIDTH+MAP_GRID_X-1, MAP_VIEW_START_Y + MAP_VIEW_HEIGHT-1 + 8, MSYS_PRIORITY_HIGH - 3, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_DefineRegion( &gMapViewRegion, + UI_MAP.ViewRegion.x + UI_MAP.GridSize.iX, + UI_MAP.ViewRegion.y + UI_MAP.GridSize.iY, + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width+UI_MAP.GridSize.iX-1, + UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height-1 + 8, + MSYS_PRIORITY_HIGH - 3, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK + ); - MSYS_DefineRegion( &gCharInfoHandRegion, ((INT16)( xResOffset + 4 )), ((INT16)( yResOffset + 81 )) ,((INT16)( xResOffset + 62 )), ((INT16)( yResOffset + 103 )), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, ItemRegionMvtCallback , ItemRegionBtnCallback ); + // No enter or exit merc inventory in strategic map on widescreen UI + if (!isWidescreenUI()) + { + MSYS_DefineRegion(&gCharInfoHandRegion, + UI_CHARPANEL.HandItem.x, + UI_CHARPANEL.HandItem.y, + UI_CHARPANEL.HandItem.x + UI_CHARPANEL.HandItem.width, + UI_CHARPANEL.HandItem.y + UI_CHARPANEL.HandItem.height, + MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, ItemRegionMvtCallback, ItemRegionBtnCallback + ); + } + MSYS_DefineRegion( &gCharInfoFaceRegion, + UI_CHARPANEL.FacePicture.x, + UI_CHARPANEL.FacePicture.y, + UI_CHARPANEL.FacePicture.x + UI_CHARPANEL.FacePicture.width, + UI_CHARPANEL.FacePicture.y + UI_CHARPANEL.FacePicture.height, + MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, FaceRegionBtnCallback + ); - MSYS_DefineRegion( &gCharInfoFaceRegion, (INT16) PLAYER_INFO_FACE_START_X, (INT16) PLAYER_INFO_FACE_START_Y, (INT16) PLAYER_INFO_FACE_END_X, (INT16) PLAYER_INFO_FACE_END_Y, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, FaceRegionBtnCallback ); - - MSYS_DefineRegion(&gMPanelRegion, INV_REGION_X, INV_REGION_Y, INV_REGION_X+INV_REGION_WIDTH, INV_REGION_Y+INV_REGION_HEIGHT, MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK,InvmaskRegionBtnCallBack); + MSYS_DefineRegion(&gMPanelRegion, + UI_CHARINV.Region.x, + UI_CHARINV.Region.y, + UI_CHARINV.Region.x + UI_CHARINV.Region.width, + UI_CHARINV.Region.y + UI_CHARINV.Region.height, + MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK,InvmaskRegionBtnCallBack + ); // screen mask for animated cursors MSYS_DefineRegion( &gMapScreenMaskRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_LOW, CURSOR_NORMAL, MSYS_NO_CALLBACK, MapScreenMarkRegionBtnCallback); @@ -5210,9 +5271,12 @@ UINT32 MapScreenHandle(void) giMapContractButtonImage = LoadButtonImage( "INTERFACE\\contractbutton.sti" ,-1,0,-1,1,-1 ); // buttonmake - giMapContractButton= QuickCreateButton( giMapContractButtonImage, CONTRACT_X + 5, CONTRACT_Y - 1, - BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, - (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ContractButtonCallback); + giMapContractButton= QuickCreateButton( giMapContractButtonImage, + UI_CHARPANEL.Button.Contract.iX + 5, + UI_CHARPANEL.Button.Contract.iY - 1, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ContractButtonCallback + ); SpecifyButtonText( giMapContractButton, pContractButtonString[ 0 ] ); SpecifyButtonFont( giMapContractButton, MAP_SCREEN_FONT ); @@ -5248,14 +5312,16 @@ UINT32 MapScreenHandle(void) CreateMapStatusBarsRegion( ); // Add region - MSYS_AddRegion( &gMapViewRegion); - MSYS_AddRegion( &gCharInfoFaceRegion); - MSYS_AddRegion( &gMPanelRegion); + MSYS_AddRegion( &gMapViewRegion ); + MSYS_AddRegion( &gCharInfoFaceRegion ); + MSYS_AddRegion( &gMPanelRegion ); + MSYS_AddRegion( &gMapMercWeightRegion ); + MSYS_AddRegion( &gMapMercCamoRegion ); - if ( !gfFadeOutDone && !gfFadeIn ) - { - MSYS_SetCurrentCursor(SCREEN_CURSOR); - } + if ( !gfFadeOutDone && !gfFadeIn ) + { + MSYS_SetCurrentCursor(SCREEN_CURSOR); + } MSYS_DisableRegion(&gMPanelRegion); // create contract box @@ -5277,13 +5343,17 @@ UINT32 MapScreenHandle(void) CreateMercRemoveAssignBox( ); // test message - // TestMessageSystem( ); + // TestMessageSystem( ); // fill in ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( RGB_NEAR_BLACK ) ); ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( RGB_NEAR_BLACK ) ); + if (isWidescreenUI()) + { + CreateMapCharInvIOregions(); + } if( ( fFirstTimeInMapScreen == TRUE ) && ( AnyMercsHired( ) == FALSE ) ) { // render both panels for the restore @@ -5512,10 +5582,12 @@ UINT32 MapScreenHandle(void) HandlePreBattleInterfaceWithInventoryPanelUp( ); // create destroy trash can region - CreateDestroyTrashCanRegion( ); - - // update these buttons - UpdateStatusOfMapSortButtons( ); + if (!isWidescreenUI()) + { + CreateDestroyTrashCanRegion(); + // update these buttons + UpdateStatusOfMapSortButtons( ); + } // if in inventory mode, make sure it's still ok CheckForInventoryModeCancellation(); @@ -6037,8 +6109,8 @@ void SetDayAlternate(STR16 pStringA, ...) String[3]=L' '; String[4]=0; - uiX=CLOCK_HOUR_X_START-9; - uiY=CLOCK_Y_START; + uiX= UI_MAP.ETA.Hour_X - 9; + uiY= UI_MAP.ETA.Start_Y; SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); @@ -6069,8 +6141,8 @@ void SetHourAlternate(STR16 pStringA, ...) String[2]=gsTimeStrings[ 0 ][ 0 ]; String[3]=L' '; String[4]= 0; - uiX=CLOCK_MIN_X_START-5; - uiY=CLOCK_Y_START; + uiX = UI_MAP.ETA.Min_X - 5; + uiY = UI_MAP.ETA.Start_Y; DrawString(String, uiX, uiY, ETA_FONT); SetFont( ETA_FONT ); @@ -6101,8 +6173,8 @@ void SetClockHour(STR16 pStringA, ...) String[2]=gsTimeStrings[ 0 ][ 0 ]; String[3]=L' '; String[4]=0; - uiX=CLOCK_HOUR_X_START-8; - uiY=CLOCK_Y_START; + uiX = UI_MAP.ETA.Hour_X - 8; + uiY = UI_MAP.ETA.Start_Y; SetFont( ETA_FONT ); SetFontForeground( FONT_LTGREEN ); @@ -6134,17 +6206,20 @@ void SetClockMin(STR16 pStringA, ...) SetFontForeground( FONT_LTGREEN ); SetFontBackground( FONT_BLACK ); - mprintf( CLOCK_MIN_X_START-5, CLOCK_Y_START, String ); + mprintf(UI_MAP.ETA.Min_X - 5, UI_MAP.ETA.Start_Y, String ); } void DrawName(STR16 pName, INT16 sRowIndex, INT32 iFont) { INT16 usX=0; INT16 usY=0; - - FindFontCenterCoordinates((short)NAME_X + 1, (short)(Y_START+(sRowIndex*Y_SIZE)), (short)NAME_WIDTH, (short)Y_SIZE, pName, (long)iFont, &usX, &usY); + const auto x = UI_CHARLIST.xName + 1; + const auto y = UI_CHARLIST.y + (sRowIndex * Y_SIZE); + const auto yOffset = UI_CHARLIST.yOffset; + const auto width = UI_CHARLIST.widthName; + FindFontCenterCoordinates(x, y, width, (short)Y_SIZE, pName, (long)iFont, &usX, &usY); - DrawString( pName, (UINT16)usX, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), iFont); + DrawString( pName, (UINT16)usX, ((UINT16)(usY+(yOffset*sRowIndex+1))), iFont); } @@ -6157,7 +6232,7 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) GetMapscreenMercAssignmentString( MercPtrs[ gCharactersList[ sCharNumber ].usSolID ], sString ); - FindFontCenterCoordinates((short)ASSIGN_X + 1, (short)(Y_START+(sRowIndex*Y_SIZE)), (short)ASSIGN_WIDTH, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); + FindFontCenterCoordinates((short)UI_CHARLIST.xAssignment + 1, (short)(UI_CHARLIST.y + (sRowIndex*Y_SIZE)), (short)UI_CHARLIST.widthAssignment, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ sCharNumber ].usSolID ]; @@ -6245,18 +6320,18 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) } } - ubBarWidth = (ASSIGN_WIDTH * ubProgress) / usMaxProgress; - ubBarWidth = __max(0, __min(ubBarWidth, ASSIGN_WIDTH)); - ClipRect.iTop = (usY+(Y_OFFSET*sRowIndex+1))-1; + ubBarWidth = (UI_CHARLIST.widthAssignment * ubProgress) / usMaxProgress; + ubBarWidth = __max(0, __min(ubBarWidth, UI_CHARLIST.widthAssignment)); + ClipRect.iTop = (usY+(UI_CHARLIST.yOffset *sRowIndex+1))-1; ClipRect.iBottom = ClipRect.iTop + Y_SIZE; - ClipRect.iLeft = ASSIGN_X+2; - ClipRect.iRight = ASSIGN_X + ubBarWidth; + ClipRect.iLeft = UI_CHARLIST.xAssignment + 2; + ClipRect.iRight = UI_CHARLIST.xAssignment + ubBarWidth; Blt16BPPBufferHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, usColor ); UnLockVideoSurface( uiDestBuffer ); } - DrawString(sString, (UINT16)usX, ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), iFont); + DrawString(sString, (UINT16)usX, ((UINT16)(usY+(UI_CHARLIST.yOffset *sRowIndex+1))), iFont); } @@ -6268,10 +6343,10 @@ void DrawLocation(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) GetMapscreenMercLocationString( MercPtrs[ gCharactersList[ sCharNumber ].usSolID ], sString ); - FindFontCenterCoordinates((short)LOC_X + 1, (short)(Y_START+(sRowIndex*Y_SIZE)), (short)LOC_WIDTH, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); + FindFontCenterCoordinates((short)UI_CHARLIST.xLocation + 1, (short)(UI_CHARLIST.y + (sRowIndex*Y_SIZE)), (short)UI_CHARLIST.widthLocation, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); // draw string - DrawString( sString,((UINT16)(usX)), ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), ((UINT32)iFont)); + DrawString( sString,((UINT16)(usX)), ((UINT16)(usY+(UI_CHARLIST.yOffset *sRowIndex+1))), ((UINT32)iFont)); } @@ -6288,9 +6363,9 @@ void DrawDestination(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) return; } - FindFontCenterCoordinates((short)DEST_ETA_X + 1, (short)(Y_START+(sRowIndex*Y_SIZE)), (short)DEST_ETA_WIDTH, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); + FindFontCenterCoordinates((short)UI_CHARLIST.xETA + 1, (short)(UI_CHARLIST.y + (sRowIndex*Y_SIZE)), (short)UI_CHARLIST.widthETA, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); - DrawString( sString,((UINT16)(usX)), ((UINT16)(usY+(Y_OFFSET*sRowIndex+1))), ((UINT32)iFont)); + DrawString( sString,((UINT16)(usX)), ((UINT16)(usY+(UI_CHARLIST.yOffset *sRowIndex+1))), ((UINT32)iFont)); } @@ -6312,9 +6387,9 @@ void DrawTimeRemaining( INT16 sCharNumber, INT32 iFont, UINT8 ubFontColor ) SetFont(iFont); SetFontForeground( ubFontColor ); - FindFontCenterCoordinates((short)TIME_REMAINING_X + 1, (short)(Y_START+(sCharNumber*Y_SIZE)), (short)TIME_REMAINING_WIDTH, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); + FindFontCenterCoordinates((short)UI_CHARLIST.xTimeRemaining + 1, (short)(UI_CHARLIST.y + (sCharNumber*Y_SIZE)), (short)UI_CHARLIST.widthTimeRemaining, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); - DrawString(sString,((UINT16)(usX)), ((UINT16)(usY+(Y_OFFSET*sCharNumber+1))), ((UINT32)iFont)); + DrawString(sString,((UINT16)(usX)), ((UINT16)(usY+(UI_CHARLIST.yOffset *sCharNumber+1))), ((UINT32)iFont)); } @@ -6460,7 +6535,10 @@ UINT32 HandleMapUI( ) // Get Input from keyboard GetMapKeyboardInput( &uiNewEvent ); - CreateDestroyMapInvButton(); + if (!isWidescreenUI()) + { + CreateDestroyMapInvButton(); + } // Get mouse PollLeftButtonInMapView( &uiNewEvent ); @@ -8545,10 +8623,12 @@ INT32 iCounter2 = 0; DestroyMouseRegionsForTeamList( ); MSYS_RemoveRegion( &gMapViewRegion ); - MSYS_RemoveRegion( &gCharInfoFaceRegion); + MSYS_RemoveRegion( &gCharInfoFaceRegion ); MSYS_RemoveRegion( &gCharInfoHandRegion ); - MSYS_RemoveRegion( &gMPanelRegion); + MSYS_RemoveRegion( &gMPanelRegion ); MSYS_RemoveRegion( &gMapScreenMaskRegion ); + MSYS_RemoveRegion( &gMapMercWeightRegion ); + MSYS_RemoveRegion( &gMapMercCamoRegion ); fInMapMode = FALSE; // remove team panel sort button @@ -8569,7 +8649,14 @@ INT32 iCounter2 = 0; HandleShutDownOfMapScreenWhileExternfaceIsTalking( ); fShowInventoryFlag = FALSE; - CreateDestroyMapInvButton(); + if (isWidescreenUI()) + { + DestroyMapCharInvIOregions(); + } + else + { + CreateDestroyMapInvButton(); + } // no longer can we show assignments menu fShowAssignmentMenu = FALSE; @@ -8639,6 +8726,7 @@ INT32 iCounter2 = 0; fShowInventoryFlag = FALSE; CreateDestroyTrashCanRegion( ); + DeleteKeyRingPopup(); if ( !fDuringFade ) { @@ -8827,10 +8915,10 @@ BOOLEAN GetMapXY( INT16 sX, INT16 sY, INT16 *psMapWorldX, INT16 *psMapWorldY ) INT16 sMapX, sMapY; // Subtract start of map view - sMapX = sX - MAP_VIEW_START_X;//+2*MAP_GRID_X; - sMapY = sY - MAP_VIEW_START_Y; + sMapX = sX - UI_MAP.ViewRegion.x;//+2*UI_MAP.GridSize.iX; + sMapY = sY - UI_MAP.ViewRegion.y; - if ( sMapX < MAP_GRID_X || sMapY < MAP_GRID_Y ) + if ( sMapX < UI_MAP.GridSize.iX || sMapY < UI_MAP.GridSize.iY ) { return( FALSE ); } @@ -8840,13 +8928,13 @@ BOOLEAN GetMapXY( INT16 sX, INT16 sY, INT16 *psMapWorldX, INT16 *psMapWorldY ) return (FALSE); } - if ( sMapX > MAP_VIEW_WIDTH+MAP_GRID_X-1 || sMapY > MAP_VIEW_HEIGHT+7/* +MAP_VIEW_HEIGHT */ ) + if ( sMapX > UI_MAP.ViewRegion.width+UI_MAP.GridSize.iX-1 || sMapY > UI_MAP.ViewRegion.height+7/* +UI_MAP.ViewArea.height */ ) { return( FALSE ); } - *psMapWorldX = ( sMapX / MAP_GRID_X ); - *psMapWorldY = ( sMapY / MAP_GRID_Y ); + *psMapWorldX = ( sMapX / UI_MAP.GridSize.iX ); + *psMapWorldY = ( sMapY / UI_MAP.GridSize.iY ); return( TRUE ); } @@ -8880,8 +8968,8 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f if(gbPixelDepth==16) { // DB Need to add a radar color for 8-bit - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + MAP_GRID_X, sScreenY + MAP_GRID_Y - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + DMAP_GRID_X + 1, sScreenY + DMAP_GRID_Y - 1 ); + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); } RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); @@ -8915,7 +9003,7 @@ void PollWheelInMapView(UINT32 *puiNewEvent) if (gMapMessageScrollBarRegion.WheelState > 0) { MapScreenMsgScrollUp(1); - } +} else { MapScreenMsgScrollDown(1); @@ -8923,7 +9011,7 @@ void PollWheelInMapView(UINT32 *puiNewEvent) ResetWheelState(&gMapMessageScrollBarRegion); } } - + } void PollLeftButtonInMapView( UINT32 *puiNewEvent ) @@ -9194,103 +9282,124 @@ void PopupText( STR16 pFontString, ... ) } -/* -void BtnINVCallback(GUI_BUTTON *btn,INT32 reason) +void CreateMapCharInvIOregions() { - if (!(btn->uiFlags & BUTTON_ENABLED)) - return; - - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { - if(fMapInventoryItem) - return; - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - fCharacterInfoPanelDirty = TRUE; - } - btn->uiFlags|=(BUTTON_CLICKED_ON); - } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if(btn->uiFlags & BUTTON_CLICKED_ON) - { - btn->uiFlags&= ~(BUTTON_CLICKED_ON); - - if(!fMapInventoryItem) - { - fShowInventoryFlag = FALSE; - } - - // set help text for item glow region - if( fShowInventoryFlag ) - { - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); - } + // CHRISL: Setup default coords + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); + if ((UsingNewInventorySystem() == true)) + InitializeInvPanelCoordsNew(); else - { - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); - } + InitializeInvPanelCoordsOld(); + InitInvSlotInterface(gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE); + MSYS_EnableRegion(&gMPanelRegion); + MSYS_EnableRegion(&gMapMercWeightRegion); + MSYS_EnableRegion(&gMapMercCamoRegion); + + // dirty character info panel ( Why? ARM ) + fCharacterInfoPanelDirty = TRUE; fTeamPanelDirty = TRUE; - } - } + fResetMapCoords = TRUE; + + // Create trashcan and keyring buttons + fShowInventoryFlag = TRUE; + CreateDestroyTrashCanRegion(); + // Remove map inventory button, since widescreen res always has character inventory visible + RemoveButton(giMapInvDoneButton); + fShowInventoryFlag = FALSE; +} + + +void DestroyMapCharInvIOregions() +{ + ShutdownInvSlotInterface(); + + fTeamPanelDirty = TRUE; + MSYS_DisableRegion(&gMPanelRegion); + MSYS_DisableRegion(&gMapMercWeightRegion); + MSYS_DisableRegion(&gMapMercCamoRegion); + + RemoveTeamPanelSortButtonsForMapScreen(); } -*/ void CreateDestroyMapInvButton() { - static BOOLEAN fOldShowInventoryFlag=FALSE; + static BOOLEAN fOldShowInventoryFlag=FALSE; + if( fShowInventoryFlag && !fOldShowInventoryFlag ) + { + // create inventory button + fOldShowInventoryFlag=TRUE; + //giMapInvButtonImage= LoadButtonImage( "INTERFACE\\mapinv.sti" ,-1,1,-1,2,-1 ); + //giMapInvButton= QuickCreateButton( giMapInvButtonImage, INV_BTN_X-1, INV_BTN_Y, + // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + // BUTTON_NO_CALLBACK, (GUI_CALLBACK)BtnINVCallback); + // disable allmouse regions in this space + fTeamPanelDirty=TRUE; - if( fShowInventoryFlag && !fOldShowInventoryFlag ) - { - // create inventory button - fOldShowInventoryFlag=TRUE; - //giMapInvButtonImage= LoadButtonImage( "INTERFACE\\mapinv.sti" ,-1,1,-1,2,-1 ); - //giMapInvButton= QuickCreateButton( giMapInvButtonImage, INV_BTN_X-1, INV_BTN_Y, - // BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, - // BUTTON_NO_CALLBACK, (GUI_CALLBACK)BtnINVCallback); - // disable allmouse regions in this space - fTeamPanelDirty=TRUE; + // CHRISL: Setup default coords + // Have to initialize map UI Coordinates, because inventory panel layout location depends on them. + initMapViewAndBorderCoordinates(); + if((UsingNewInventorySystem() == true)) + InitializeInvPanelCoordsNew(); + else + InitializeInvPanelCoordsOld(); - // CHRISL: Setup default coords - if((UsingNewInventorySystem() == true)) - InitializeInvPanelCoordsNew(); - else - InitializeInvPanelCoordsOld(); + InitInvSlotInterface( gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE ); + MSYS_EnableRegion(&gMPanelRegion); + MSYS_EnableRegion(&gMapMercWeightRegion); + MSYS_EnableRegion(&gMapMercCamoRegion); - InitInvSlotInterface( gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE ); - MSYS_EnableRegion(&gMPanelRegion); - - // switch hand region help text to "Exit Inventory" - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); + // switch hand region help text to "Exit Inventory" + SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 2 ] ); - // reset inventory item help text - memset( gubMAP_HandInvDispText, 0, sizeof( gubMAP_HandInvDispText ) ); + // reset inventory item help text + memset( gubMAP_HandInvDispText, 0, sizeof( gubMAP_HandInvDispText ) ); - // dirty character info panel ( Why? ARM ) - fCharacterInfoPanelDirty=TRUE; - fResetMapCoords=TRUE; - } - else if( !fShowInventoryFlag && fOldShowInventoryFlag ) - { - // destroy inventory button - ShutdownInvSlotInterface( ); - fOldShowInventoryFlag=FALSE; - //RemoveButton( giMapInvButton ); - //UnloadButtonImage( giMapInvButtonImage ); - fTeamPanelDirty=TRUE; - MSYS_DisableRegion(&gMPanelRegion); + // dirty character info panel ( Why? ARM ) + fCharacterInfoPanelDirty=TRUE; + fResetMapCoords=TRUE; + } + else if( !fShowInventoryFlag && fOldShowInventoryFlag ) + { + // destroy inventory button + ShutdownInvSlotInterface( ); + fOldShowInventoryFlag=FALSE; + //RemoveButton( giMapInvButton ); + //UnloadButtonImage( giMapInvButtonImage ); + fTeamPanelDirty=TRUE; + MSYS_DisableRegion(&gMPanelRegion); + MSYS_DisableRegion(&gMapMercWeightRegion); + MSYS_DisableRegion(&gMapMercCamoRegion); - // switch hand region help text to "Enter Inventory" - SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); + // switch hand region help text to "Enter Inventory" + SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] ); - // force immediate reblit of item in HANDPOS now that it's not blitted while in inventory mode - fCharacterInfoPanelDirty=TRUE; - } + // force immediate reblit of item in HANDPOS now that it's not blitted while in inventory mode + fCharacterInfoPanelDirty=TRUE; + } } +void BltEmptyCharInvPanel() +{ + UINT32 uiDestPitchBYTES; + UINT16* pDestBuf; + HVOBJECT hCharListHandle; + + UINT8 stiIndex = 0; + if (UsingNewInventorySystem()) + { + stiIndex = 1; + } + + pDestBuf = (UINT16*)LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); + GetVideoObject(&hCharListHandle, guiMAPINV); + Blt8BPPDataTo16BPPBufferTransparent(pDestBuf, uiDestPitchBYTES, hCharListHandle, UI_CHARINV.Region.x, UI_CHARINV.Region.y, stiIndex); + UnLockVideoSurface(guiSAVEBUFFER); +} + void BltCharInvPanel() { @@ -9303,13 +9412,21 @@ void BltCharInvPanel() UINT8 disOpt = 0; // make sure we're here legally - Assert( MapCharacterHasAccessibleInventory( bSelectedInfoChar ) ); + // In widescreen UI, draw an empty inv panel if no accessible inventory + const BOOLEAN isAccessibleInventory = MapCharacterHasAccessibleInventory(bSelectedInfoChar); + if (isWidescreenUI() && !isAccessibleInventory) + { + BltEmptyCharInvPanel(); + return; + } + else + { + Assert(isAccessibleInventory); + } GetSoldier( &pSoldier, gCharactersList[bSelectedInfoChar].usSolID ); + Assert(pSoldier); - - pDestBuf = (UINT16*)LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES); - GetVideoObject(&hCharListHandle, guiMAPINV); // CHRISL: Changed last parameter so we can display graphic based on inventory system used if((UsingNewInventorySystem() == true) && gGameExternalOptions.fVehicleInventory && (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) { @@ -9339,11 +9456,18 @@ void BltCharInvPanel() InitInventorySoldier(gMapScreenInvPocketXY, MAPInvMoveCallback, MAPInvClickCallback, FALSE, FALSE); } - Blt8BPPDataTo16BPPBufferTransparent( pDestBuf, uiDestPitchBYTES, hCharListHandle, PLAYER_INFO_X, PLAYER_INFO_Y, disOpt); + + pDestBuf = (UINT16*)LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); + GetVideoObject(&hCharListHandle, guiMAPINV); + Blt8BPPDataTo16BPPBufferTransparent( pDestBuf, uiDestPitchBYTES, hCharListHandle, UI_CHARINV.Region.x, UI_CHARINV.Region.y, disOpt); UnLockVideoSurface( guiSAVEBUFFER ); - Assert( pSoldier ); - CreateDestroyMapInvButton(); + + if (!isWidescreenUI()) + { + CreateDestroyMapInvButton(); + } + if (gfCheckForMouseOverItem) { @@ -9367,7 +9491,7 @@ void BltCharInvPanel() } } - RenderInvBodyPanel(pSoldier, INV_BODY_X, INV_BODY_Y ); + RenderInvBodyPanel(pSoldier, UI_CHARINV.BodyPanel.iX, UI_CHARINV.BodyPanel.iY); // reset font destination buffer to the save buffer SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); @@ -9388,49 +9512,50 @@ void BltCharInvPanel() SetFontForeground( MAP_INV_STATS_TITLE_FONT_COLOR ); // CHRISL: Only display next three values if we're a merc -// if(!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) if(!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) { // print armor/weight/camo labels - mprintf( MAP_ARMOR_LABEL_X, MAP_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); + mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] ); #ifdef CHINESE - mprintf( MAP_ARMOR_PERCENT_X, MAP_ARMOR_PERCENT_Y, ChineseSpecString1 ); + mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 ); #else - mprintf( MAP_ARMOR_PERCENT_X, MAP_ARMOR_PERCENT_Y, L"%%" ); + mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" ); #endif - mprintf( MAP_WEIGHT_LABEL_X, MAP_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); + mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] ); #ifdef CHINESE - mprintf( MAP_WEIGHT_PERCENT_X, MAP_WEIGHT_PERCENT_Y, ChineseSpecString1 ); + mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 ); #else - mprintf( MAP_WEIGHT_PERCENT_X, MAP_WEIGHT_PERCENT_Y, L"%%" ); + mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" ); #endif - mprintf( MAP_CAMMO_LABEL_X, MAP_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); + mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] ); #ifdef CHINESE - mprintf( MAP_CAMMO_PERCENT_X, MAP_CAMMO_PERCENT_Y, ChineseSpecString1 ); + mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 ); #else - mprintf( MAP_CAMMO_PERCENT_X, MAP_CAMMO_PERCENT_Y, L"%%" ); + mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" ); #endif + const auto width = UI_CHARINV.Text.PercentWidth; + const auto height = UI_CHARINV.Text.PercentHeight; // display armor value swprintf( sString, L"%3d", ArmourPercent( pSoldier ) ); - FindFontRightCoordinates(MAP_ARMOR_X, MAP_ARMOR_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + FindFontRightCoordinates( UI_CHARINV.Text.Armor.iX, UI_CHARINV.Text.Armor.iY, width, height, sString, BLOCKFONT2, &usX, &usY ); mprintf( usX, usY, sString ); // Display weight value swprintf( sString, L"%3d", CalculateCarriedWeight( pSoldier ) ); - FindFontRightCoordinates(MAP_WEIGHT_X, MAP_WEIGHT_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + FindFontRightCoordinates(UI_CHARINV.Text.Weight.iX, UI_CHARINV.Text.Weight.iY, width, height, sString, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, sString ); ApplyEquipmentBonuses(pSoldier); // Display camo value swprintf( sString, L"%3d", max(0, min(max((pSoldier->bCamo + pSoldier->wornCamo), max((pSoldier->urbanCamo+pSoldier->wornUrbanCamo), max((pSoldier->desertCamo+pSoldier->wornDesertCamo), (pSoldier->snowCamo+pSoldier->wornSnowCamo)))),100)) ); - FindFontRightCoordinates(MAP_CAMMO_X, MAP_CAMMO_Y, MAP_PERCENT_WIDTH, MAP_PERCENT_HEIGHT, sString, BLOCKFONT2, &usX, &usY); + FindFontRightCoordinates(UI_CHARINV.Text.Camo.iX, UI_CHARINV.Text.Camo.iY, width, height, sString, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, sString ); if( fCharacterInfoPanelDirty ) @@ -9513,7 +9638,11 @@ void BltCharInvPanel() if( InKeyRingPopup( ) ) { // shade the background - ShadowVideoSurfaceRect( guiSAVEBUFFER , PLAYER_INFO_X, PLAYER_INFO_Y, PLAYER_INFO_X + 261, PLAYER_INFO_Y + ( 359 - 107 )); + const auto x = UI_CHARINV.Region.x; + const auto y = UI_CHARINV.Region.y; + const auto width = UI_CHARINV.Region.width; + const auto height = UI_CHARINV.Region.height; + ShadowVideoSurfaceRect( guiSAVEBUFFER , x, y, x + width, y + height); } else { @@ -9619,7 +9748,15 @@ void MAPInvMoveCallback( MOUSE_REGION *pRegion, INT32 iReason ) } // make sure we're here legally - Assert( MapCharacterHasAccessibleInventory( bSelectedInfoChar ) ); + const BOOLEAN isLegal = MapCharacterHasAccessibleInventory(bSelectedInfoChar); + if (!isLegal && isWidescreenUI()) + { + return; + } + else + { + Assert(isLegal); + } GetSoldier( &pSoldier, gCharactersList[ bSelectedInfoChar ].usSolID ); @@ -9696,7 +9833,15 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) // make sure we're here legally - Assert( MapCharacterHasAccessibleInventory( bSelectedInfoChar ) ); + const BOOLEAN isLegal = MapCharacterHasAccessibleInventory(bSelectedInfoChar); + if (!isLegal && isWidescreenUI()) + { + return; + } + else + { + Assert(isLegal); + } GetSoldier( &pSoldier, gCharactersList[ bSelectedInfoChar ].usSolID ); @@ -10232,30 +10377,30 @@ void RenderAttributeStringsForUpperLeftHandCorner( UINT32 uiBufferToRenderTo ) SetFontDestBuffer( uiBufferToRenderTo, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); // assignment strings - DrawString( pUpperLeftMapScreenStrings[ 0 ], (UINT16)(xResOffset + 220 - StringPixLength( pUpperLeftMapScreenStrings[0], CHAR_FONT)/2), yResOffset + 6, CHAR_FONT); + DrawString( pUpperLeftMapScreenStrings[ 0 ], (UINT16)(UI_CHARPANEL.Text.Assignment.iX - StringPixLength( pUpperLeftMapScreenStrings[0], CHAR_FONT)/2), UI_CHARPANEL.Text.Assignment.iY, CHAR_FONT); // vehicles and robot don't have attributes, contracts, or morale if ( ( pSoldier == NULL ) || ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) ) { // health - DrawString(pUpperLeftMapScreenStrings[ 2 ], xResOffset + 87, yResOffset + 80, CHAR_FONT); + DrawString(pUpperLeftMapScreenStrings[ 2 ], UI_CHARPANEL.Text.Health.iX, UI_CHARPANEL.Text.Health.iY, CHAR_FONT); for( iCounter = 0; iCounter < 5; iCounter++ ) { - DrawString(pShortAttributeStrings[ iCounter ], xResOffset + 88, ( INT16 )( yResOffset + 22 + iCounter * 10 ) ,CHAR_FONT ); - DrawString(pShortAttributeStrings[ iCounter + 5 ] ,xResOffset + 133, ( INT16 )( yResOffset + 22 + iCounter * 10 ), CHAR_FONT ); + DrawString(pShortAttributeStrings[ iCounter ], UI_CHARPANEL.Text.Attributes.iX, ( INT16 )(UI_CHARPANEL.Text.Attributes.iY + iCounter * 10 ) ,CHAR_FONT ); + DrawString(pShortAttributeStrings[ iCounter + 5 ] , UI_CHARPANEL.Text.Attributes2.iX, ( INT16 )(UI_CHARPANEL.Text.Attributes2.iY + iCounter * 10 ), CHAR_FONT ); } // contract //DrawString(pUpperLeftMapScreenStrings[ 1 ], 194, 52, CHAR_FONT); // morale - DrawString(pUpperLeftMapScreenStrings[ 3 ], xResOffset + 87, yResOffset + 94, CHAR_FONT); + DrawString(pUpperLeftMapScreenStrings[ 3 ], UI_CHARPANEL.Text.Morale.iX, UI_CHARPANEL.Text.Morale.iY, CHAR_FONT); } else { // condition - DrawString(pUpperLeftMapScreenStrings[ 4 ], xResOffset + 87, yResOffset + 80, CHAR_FONT); + DrawString(pUpperLeftMapScreenStrings[ 4 ], UI_CHARPANEL.Text.Condition.iX, UI_CHARPANEL.Text.Condition.iY, CHAR_FONT); } // restore buffer @@ -10529,42 +10674,84 @@ void BlitBackgroundToSaveBuffer( void ) void CreateMouseRegionsForTeamList( void ) { // will create mouse regions for assignments, path plotting, character info selection - INT16 sCounter = 0; - INT16 sYAdd = 0; // the info region...is the background for the list itself - // OJW - MP int max_rows = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; if (is_networked) max_rows = 7; // check this value is correct / unhardcode it - for( sCounter = 0; sCounter < max_rows; sCounter++ ) + const auto xName = UI_CHARLIST.xName; + const auto xEndName = xName + UI_CHARLIST.widthName; + const auto xAssignment= UI_CHARLIST.xAssignment; + const auto xEndAssignment = xAssignment + UI_CHARLIST.widthAssignment; + const auto xLocation= UI_CHARLIST.xLocation; + const auto xEndLocation= xLocation + UI_CHARLIST.widthLocation; + const auto xETA= UI_CHARLIST.xETA; + const auto xEndETA= xETA + UI_CHARLIST.widthETA; + const auto xTime= UI_CHARLIST.xTimeRemaining; + const auto xEndTime= xTime+ UI_CHARLIST.widthTimeRemaining; + const auto xSleep= UI_CHARLIST.xSleep; + const auto xEndSleep= xSleep+ UI_CHARLIST.widthSleep; + + const auto y = UI_CHARLIST.y; + + for(INT16 sCounter = 0; sCounter < max_rows; sCounter++ ) { - sYAdd = 0; - + const auto yStart = y + (sCounter) * (Y_SIZE + 2); + const auto yEnd = y + (sCounter + 1) * (Y_SIZE + 2); // name region - MSYS_DefineRegion( &gTeamListNameRegion[ sCounter ], NAME_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), NAME_X + NAME_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL, - MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListNameRegion[ sCounter ], + xName, + yStart, + xEndName, + yEnd, + MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack + ); // assignment region - MSYS_DefineRegion( &gTeamListAssignmentRegion[ sCounter ], ASSIGN_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), ASSIGN_X + ASSIGN_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListAssignmentRegion[ sCounter ], + xAssignment, + yStart, + xEndAssignment, + yEnd, + MSYS_PRIORITY_NORMAL + 1, MSYS_NO_CURSOR, TeamListAssignmentRegionMvtCallBack, TeamListAssignmentRegionBtnCallBack + ); // location region (same function as name regions, so uses the same callbacks) - MSYS_DefineRegion( &gTeamListLocationRegion[ sCounter ], LOC_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), LOC_X + LOC_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListLocationRegion[ sCounter ], + xLocation, + yStart, + xEndLocation, + yEnd, + MSYS_PRIORITY_NORMAL + 1, MSYS_NO_CURSOR, TeamListInfoRegionMvtCallBack, TeamListInfoRegionBtnCallBack + ); // destination region - MSYS_DefineRegion( &gTeamListDestinationRegion[ sCounter ], DEST_ETA_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd ), DEST_ETA_X + DEST_ETA_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListDestinationRegion[ sCounter ], + xETA, + yStart, + xEndETA, + yEnd, + MSYS_PRIORITY_NORMAL + 1, MSYS_NO_CURSOR, TeamListDestinationRegionMvtCallBack, TeamListDestinationRegionBtnCallBack + ); // contract region - MSYS_DefineRegion( &gTeamListContractRegion[ sCounter ], TIME_REMAINING_X , ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), TIME_REMAINING_X + TIME_REMAINING_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListContractRegion[ sCounter ], + xTime, + yStart, + xEndTime, + yEnd, + MSYS_PRIORITY_NORMAL + 1, MSYS_NO_CURSOR, TeamListContractRegionMvtCallBack, TeamListContractRegionBtnCallBack + ); // sleep region - MSYS_DefineRegion( &gTeamListSleepRegion[ sCounter ], SLEEP_X, ( INT16 )( Y_START + ( sCounter ) * ( Y_SIZE + 2 ) + sYAdd), SLEEP_X + SLEEP_WIDTH, ( INT16 )( yResOffset + 145 + ( sCounter + 1 ) * ( Y_SIZE + 2 ) + sYAdd ), MSYS_PRIORITY_NORMAL + 1, - MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack ); + MSYS_DefineRegion( &gTeamListSleepRegion[ sCounter ], + xSleep, + yStart, + xEndSleep, + yEnd, + MSYS_PRIORITY_NORMAL + 1, MSYS_NO_CURSOR, TeamListSleepRegionMvtCallBack, TeamListSleepRegionBtnCallBack + ); MSYS_SetRegionUserData(&gTeamListNameRegion[sCounter],0,sCounter); @@ -10595,7 +10782,7 @@ void DestroyMouseRegionsForTeamList( void ) for( sCounter = 0; sCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCounter++ ) { - MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]); + MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListAssignmentRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListSleepRegion[ sCounter ]); MSYS_RemoveRegion( &gTeamListDestinationRegion[ sCounter ]); @@ -10850,7 +11037,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) return; } - if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) + if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay, FALSE )) @@ -10913,7 +11100,10 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // select this character ChangeSelectedInfoChar( ( INT8 ) iValue+ FIRSTmercTOdisplay, TRUE ); - RequestToggleMercInventoryPanel(); + if (!isWidescreenUI()) + { + RequestToggleMercInventoryPanel(); + } // highlight giDestHighLine = -1; @@ -11002,7 +11192,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) return; } - if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) + if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay, FALSE )) @@ -11241,7 +11431,7 @@ void TeamListDestinationRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) return; } - if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) + if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay , FALSE )) @@ -11551,7 +11741,7 @@ void TeamListContractRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // marke strogg more mercs must add skipped mercs FIRSTmercTOdisplay iValue = MSYS_GetRegionUserData( pRegion, 0 ); - if( gCharactersList[ iValue ].fValid == TRUE ) + if( gCharactersList[ iValue ].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) { @@ -11862,71 +12052,100 @@ void RenderMapRegionBackground( void ) } -void RenderTeamRegionBackground( void ) +void RenderTeamRegionBackgroundWideScreen(void) { - HVOBJECT hHandle; - // renders to save buffer when dirty flag set - if( fTeamPanelDirty == FALSE ) + if (fTeamPanelDirty == FALSE) { // not dirty, leave return; } - // show inventory or the team list? - if(fShowInventoryFlag == FALSE ) - { - GetVideoObject(&hHandle, guiCHARLIST); - BltVideoObject( guiSAVEBUFFER , hHandle, 0,PLAYER_INFO_X, PLAYER_INFO_Y , VO_BLT_SRCTRANSPARENCY,NULL ); - } - else - { - BltCharInvPanel(); - } - - if ( !fShowInventoryFlag ) - { - // if we are not in inventory mode, show character list - HandleHighLightingOfLinesInTeamPanel( ); - - DisplayCharacterList(); - } + // show inventory and the team list + HVOBJECT hHandle; + GetVideoObject(&hHandle, guiCHARLIST); + BltVideoObject(guiSAVEBUFFER, hHandle, 0, UI_CHARLIST.Region, VO_BLT_SRCTRANSPARENCY, NULL); + HandleHighLightingOfLinesInTeamPanel(); + DisplayCharacterList(); fDrawCharacterList = FALSE; - + + // display arrows by selected people - HandleDisplayOfSelectedMercArrows( ); - DisplayIconsForMercsAsleep( ); + HandleDisplayOfSelectedMercArrows(); + DisplayIconsForMercsAsleep(); // reset dirty flag fTeamPanelDirty = FALSE; gfRenderPBInterface = TRUE; // mark all pop ups as dirty - MarkAllBoxesAsAltered( ); + MarkAllBoxesAsAltered(); // restore background for area - if(fShowInventoryFlag == TRUE && UsingNewInventorySystem() == false) - { - RestoreExternBackgroundRect( 0 + xResOffset, 107 + yResOffset, 261, SCREEN_HEIGHT - 107 - 121 - yResOffset); - } - else if(fShowInventoryFlag == TRUE && iResolution >= _640x480 && iResolution < _800x600) - { - RestoreExternBackgroundRect( 0 + xResOffset, 107 + yResOffset, 261, SCREEN_HEIGHT - 107 - yResOffset ); - } - else if(fShowInventoryFlag == TRUE && iResolution < _1024x768) - { - RestoreExternBackgroundRect( 0 + xResOffset, 107 + yResOffset, 261, SCREEN_HEIGHT - 107 - yResOffset ); - } - else if(fShowInventoryFlag == FALSE || iResolution >= _1024x768) - { - RestoreExternBackgroundRect( 0 + xResOffset, 107 + yResOffset, 261, SCREEN_HEIGHT - 107 - 121 - yResOffset ); - } - + RestoreExternBackgroundRect(UI_CHARLIST.Region); + MapscreenMarkButtonsDirty(); } +void RenderCharacterInventoryWideScreen(void) +{ + if (!gfItemDescTransformPopupVisible) + { + BltCharInvPanel(); + RestoreExternBackgroundRect(UI_CHARINV.Region); + } +} + + +void RenderTeamRegionBackground( void ) +{ + if (isWidescreenUI()) + { + RenderTeamRegionBackgroundWideScreen(); + RenderCharacterInventoryWideScreen(); + } + else + { + // renders to save buffer when dirty flag set + if (fTeamPanelDirty == FALSE) + { + // not dirty, leave + return; + } + + // show inventory or the team list? + if (fShowInventoryFlag == FALSE) + { + HVOBJECT hHandle; + GetVideoObject(&hHandle, guiCHARLIST); + BltVideoObject(guiSAVEBUFFER, hHandle, 0, UI_CHARLIST.Region, VO_BLT_SRCTRANSPARENCY, NULL); + HandleHighLightingOfLinesInTeamPanel(); + DisplayCharacterList(); + HandleDisplayOfSelectedMercArrows(); + DisplayIconsForMercsAsleep(); + RestoreExternBackgroundRect(UI_CHARLIST.Region); + } + else + { + BltCharInvPanel(); + RestoreExternBackgroundRect(UI_CHARINV.Region); + } + + fDrawCharacterList = FALSE; + + // reset dirty flag + fTeamPanelDirty = FALSE; + gfRenderPBInterface = TRUE; + + // mark all pop ups as dirty + MarkAllBoxesAsAltered(); + MapscreenMarkButtonsDirty(); + } +} + + void RenderCharacterInfoBackground( void ) { HVOBJECT hHandle; @@ -11941,7 +12160,7 @@ void RenderCharacterInfoBackground( void ) // the upleft hand corner character info panel GetVideoObject(&hHandle, guiCHARINFO); - BltVideoObject( guiSAVEBUFFER , hHandle, 0,TOWN_INFO_X, TOWN_INFO_Y , VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject(guiSAVEBUFFER, hHandle, 0, UI_CHARPANEL.Region.x, UI_CHARPANEL.Region.y, VO_BLT_SRCTRANSPARENCY, NULL); UpdateHelpTextForMapScreenMercIcons( ); @@ -11969,7 +12188,7 @@ void RenderCharacterInfoBackground( void ) MarkAllBoxesAsAltered( ); // restore background for area - RestoreExternBackgroundRect( xResOffset + 0, yResOffset + 0, 261, 107 ); + RestoreExternBackgroundRect(UI_CHARPANEL.Region); } void DetermineIfContractMenuCanBeShown( void ) @@ -13332,18 +13551,35 @@ void CreateDestroyTrashCanRegion( void ) fCreated = TRUE; // trash can - MSYS_DefineRegion( &gTrashCanRegion, TRASH_CAN_X, TRASH_CAN_Y, TRASH_CAN_X + TRASH_CAN_WIDTH, TRASH_CAN_Y + TRASH_CAN_HEIGHT , MSYS_PRIORITY_HIGHEST - 4 , - MSYS_NO_CURSOR, TrashCanMoveCallback, TrashCanBtnCallback ); + MSYS_DefineRegion( &gTrashCanRegion, + UI_CHARINV.Button.Trashcan.x, + UI_CHARINV.Button.Trashcan.y, + UI_CHARINV.Button.Trashcan.x + UI_CHARINV.Button.Trashcan.width, + UI_CHARINV.Button.Trashcan.y + UI_CHARINV.Button.Trashcan.height, + MSYS_PRIORITY_HIGHEST - 4 , MSYS_NO_CURSOR, TrashCanMoveCallback, TrashCanBtnCallback + ); // region for detailed merc weight - MSYS_DefineRegion(&gMapMercWeightRegion, (MAP_WEIGHT_X + 2), (MAP_WEIGHT_Y), (MAP_WEIGHT_X + 28), (MAP_WEIGHT_Y + 10), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NULL); + MSYS_DefineRegion(&gMapMercWeightRegion, + UI_CHARINV.Text.Weight.iX + 2, + UI_CHARINV.Text.Weight.iY, + UI_CHARINV.Text.Weight.iX + 28, + UI_CHARINV.Text.Weight.iY + 10, + MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NULL + ); // region for detailed merc camo - MSYS_DefineRegion(&gMapMercCamoRegion, (MAP_CAMMO_X + 2), (MAP_CAMMO_Y), (MAP_CAMMO_X + 28), (MAP_CAMMO_Y + 10), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MAPInvMoveCamoCallback); + MSYS_DefineRegion(&gMapMercCamoRegion, + UI_CHARINV.Text.Camo.iX + 2, + UI_CHARINV.Text.Camo.iY, + UI_CHARINV.Text.Camo.iX + 28, + UI_CHARINV.Text.Camo.iY + 10, + MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MAPInvMoveCamoCallback + ); // done inventory button define giMapInvButtonDoneImage = LoadButtonImage( "INTERFACE\\done_button2.sti" ,-1,0,-1,1,-1 ); - giMapInvDoneButton = QuickCreateButton( giMapInvButtonDoneImage, INV_BTN_X, INV_BTN_Y, + giMapInvDoneButton = QuickCreateButton( giMapInvButtonDoneImage, UI_CHARINV.Button.Done.iX, UI_CHARINV.Button.Done.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, ( GUI_CALLBACK )BtnGenericMouseMoveButtonCallback, ( GUI_CALLBACK)DoneInventoryMapBtnCallback ); @@ -13487,7 +13723,14 @@ void HandlePreBattleInterfaceWithInventoryPanelUp( void ) // kill inventory panel fShowInventoryFlag = FALSE; - CreateDestroyMapInvButton(); + if (isWidescreenUI()) + { + DestroyMapCharInvIOregions(); + } + else + { + CreateDestroyMapInvButton(); + } } } @@ -13783,7 +14026,7 @@ void CreateDestroyMapCharacterScrollButtons( void ) giCharInfoButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); // set the button value - giCharInfoButton[ 0 ] = QuickCreateButton( giCharInfoButtonImage[ 0 ], xResOffset + 67, yResOffset + 69, + giCharInfoButton[ 0 ] = QuickCreateButton( giCharInfoButtonImage[ 0 ], UI_CHARPANEL.Button.Up.iX, UI_CHARPANEL.Button.Up.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PrevInventoryMapBtnCallback ); @@ -13791,7 +14034,7 @@ void CreateDestroyMapCharacterScrollButtons( void ) giCharInfoButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); // set the button value - giCharInfoButton[ 1 ] = QuickCreateButton( giCharInfoButtonImage[ 1 ], xResOffset + 67, yResOffset + 87, + giCharInfoButton[ 1 ] = QuickCreateButton( giCharInfoButtonImage[ 1 ], UI_CHARPANEL.Button.Down.iX, UI_CHARPANEL.Button.Down.iY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextInventoryMapBtnCallback ); @@ -13975,7 +14218,7 @@ void AddTeamPanelSortButtonsForMapScreen( void ) { giMapSortButtonImage[ iCounter ] = LoadButtonImage( filename, -1, iImageIndex[ iCounter ] , -1, iImageIndex[ iCounter ] + 6 , -1 ); - giMapSortButton[ iCounter ]= QuickCreateButton( giMapSortButtonImage[ iCounter ], ( INT16 )( xResOffset + gMapSortButtons[ iCounter ].iX ), ( INT16 )( yResOffset + gMapSortButtons[ iCounter ].iY ), + giMapSortButton[ iCounter ]= QuickCreateButton( giMapSortButtonImage[ iCounter ], ( INT16 )(UI_CHARLIST.Title.iX + gMapSortButtons[ iCounter ].iX ), ( INT16 )(UI_CHARLIST.Title.iY + gMapSortButtons[ iCounter ].iY ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 5, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)MapSortBtnCallback ); @@ -14001,7 +14244,7 @@ void AddMPButtonsForMapScreen( void ) if (iCounter < MAX_MP_BUTTONS) { - UINT16 xButtonPos = gMapMPButtonsX[ iCounter ] + xResOffset; + UINT16 xButtonPos = gMapMPButtonsX[ iCounter ] + UI_CHARLIST.Region.x; // buttonmake giMapMPButton[ iCounter ]= QuickCreateButton( giMapMPButtonImage[ iCounter ], ( INT16 )( xButtonPos ), ( INT16 )( MP_BTN_Y ), @@ -14351,11 +14594,14 @@ void RemoveTeamPanelSortButtonsForMapScreen( void ) for( iCounter = 0; iCounter < MAX_SORT_METHODS; iCounter++ ) { - UnloadButtonImage( giMapSortButtonImage[ iCounter ] ); - RemoveButton( giMapSortButton[ iCounter ] ); + if (giMapSortButtonImage[iCounter] != -1) + { + UnloadButtonImage(giMapSortButtonImage[iCounter]); + RemoveButton(giMapSortButton[iCounter]); - giMapSortButtonImage[ iCounter ] = -1; - giMapSortButton[ iCounter ] = -1; + giMapSortButtonImage[iCounter] = -1; + giMapSortButton[iCounter] = -1; + } } return; } @@ -14469,8 +14715,7 @@ void DisplayIconsForMercsAsleep( void ) pSoldier = MercPtrs[ gCharactersList[ iCounter + FIRSTmercTOdisplay ].usSolID ]; if( pSoldier->bActive && pSoldier->flags.fMercAsleep && CanChangeSleepStatusForSoldier( pSoldier ) ) { - //BltVideoObject( guiSAVEBUFFER , hHandle, 0, 125, ( INT16 )( Y_START+(iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); - BltVideoObject( guiSAVEBUFFER , hHandle, 0, SLEEP_X + 2, ( INT16 )( Y_START+(iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( guiSAVEBUFFER , hHandle, 0, UI_CHARLIST.xSleep + 2, ( INT16 )(UI_CHARLIST.y + (iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); } } } @@ -14482,32 +14727,36 @@ void DisplayIconsForMercsAsleep( void ) // mapscreen and we have new email to read. void CheckForAndRenderNewMailOverlay() { + const UINT16 xOffset = 7; + const UINT16 yOffset = 6; + const auto x = MAP_BOTTOM_LAPTOP_X + xOffset; + const auto y = MAP_BOTTOM_LAPTOP_Y + yOffset; + if( fNewMailFlag ) { if( GetJA2Clock() % 1000 < 667 ) { if( ButtonList[ guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] ]->uiFlags & BUTTON_CLICKED_ON ) { - BltVideoObjectFromIndex( FRAME_BUFFER, guiNewMailIcons, 1, xResOffset + (xResSize - 175), (SCREEN_HEIGHT - 62), VO_BLT_SRCTRANSPARENCY, NULL ); - InvalidateRegion( xResOffset + (xResSize - 175), (SCREEN_HEIGHT - 62), xResOffset + (xResSize - 160), (SCREEN_HEIGHT - 52 )); + BltVideoObjectFromIndex(FRAME_BUFFER, guiNewMailIcons, 1, x + 2, y + 2, VO_BLT_SRCTRANSPARENCY, NULL); + InvalidateRegion(x, y, x + 25 - xOffset, y + 15 - yOffset); } else { //button is up, so draw the icon normally - //BltVideoObjectFromIndex( FRAME_BUFFER, guiNewMailIcons, 0, 464, 417, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObjectFromIndex( FRAME_BUFFER, guiNewMailIcons, 0, xResOffset + (xResSize - 176), (SCREEN_HEIGHT - 63), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiNewMailIcons, 0, x + 1, y + 1, VO_BLT_SRCTRANSPARENCY, NULL ); if( !(ButtonList[ guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] ]->uiFlags & BUTTON_ENABLED ) ) { UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; - SGPRect area = { xResOffset + (xResSize - 177), (SCREEN_HEIGHT - 63), xResOffset + (xResSize - 163), (SCREEN_HEIGHT - 55) }; + SGPRect area = { x + 2, y + 1, x + 25 - xOffset, y + 15 - yOffset }; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); Blt16BPPBufferHatchRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &area ); UnLockVideoSurface( FRAME_BUFFER ); } - InvalidateRegion( xResOffset + (xResSize - 177), (SCREEN_HEIGHT - 63), xResOffset + (xResSize - 159), (SCREEN_HEIGHT - 50) ); + InvalidateRegion(x, y, x + 25 - xOffset, y + 15 - yOffset); } } else @@ -14576,9 +14825,12 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ) { SOLDIERTYPE *pSoldier = NULL; - - Assert( bCharNumber >= 0 ); - Assert( bCharNumber < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ); + //Assert( bCharNumber >= 0 ); + //Assert( bCharNumber < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ); + if (bCharNumber < 0 || bCharNumber > giMAXIMUM_NUMBER_OF_PLAYER_SLOTS) + { + return(FALSE); + } // invalid character slot selected? if( gCharactersList[ bCharNumber ].fValid == FALSE ) @@ -16481,7 +16733,7 @@ void RestoreMapSectorCursor( INT16 sMapX, INT16 sMapY ) sScreenY -= 1; - RestoreExternBackgroundRect( sScreenX, sScreenY, DMAP_GRID_X, DMAP_GRID_Y ); + RestoreExternBackgroundRect( sScreenX, sScreenY, UI_MAP.GridSize.iX + 1, UI_MAP.GridSize.iY + 1); } void RequestToggleMercInventoryPanel( void ) @@ -17206,3 +17458,236 @@ bool placeItemInVehicle(SOLDIERTYPE *pSoldier, OBJECTTYPE &item) { return (item.ubNumberOfObjects == 0); } + +bool isWidescreenUI(void) +{ + return (iResolution == _1280x720); +} + + +void initMapViewAndBorderCoordinates(void) +{ + if (isWidescreenUI()) + { + MAP_FONT = FONT12ARIAL; + ETA_FONT = BLOCKFONT2; + + UI_MAP.GridSize = { 43, 35 }; + UI_MAP.BorderRegion = {SCREEN_WIDTH - 764, 0, 764, 605}; // mbs_1280x720.sti + + UI_MAP.ViewRegion = { + UI_MAP.BorderRegion.x + 9, + UI_MAP.BorderRegion.y + 10, + UI_MAP.GridSize.iX * MAXIMUM_VALID_X_COORDINATE, + UI_MAP.GridSize.iY * MAXIMUM_VALID_Y_COORDINATE + 27 + }; + + // Strategic map numbers and letters. Numbers are on the horizontal line. + UI_MAP.Numbers = { + UI_MAP.BorderRegion.x + 53, + UI_MAP.BorderRegion.y + 19, + UI_MAP.GridSize.iX, + GetFontHeight(MAP_FONT) + }; + + UI_MAP.Alphabet = { + UI_MAP.BorderRegion.x + 24, + UI_MAP.BorderRegion.y + 44, + GetFontHeight(MAP_FONT), + UI_MAP.GridSize.iY + }; + + UI_MAP.LevelString = { + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, + UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 25 + }; + + // standard ETA box + UI_MAP.ETA.Clock_X = UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2; + UI_MAP.ETA.Start_Y = UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 15; + UI_MAP.ETA.Hour_X = UI_MAP.ETA.Clock_X + 38; + UI_MAP.ETA.Min_X = UI_MAP.ETA.Clock_X + 54; + + + // Helicopter ETA box + UI_MAP.HeliETA.PopupBox = { + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, + UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 100, + 120, + 76 + }; + UI_MAP.HeliETA.Upper_Popup_Y = (50 + iScreenHeightOffset - 100); + UI_MAP.HeliETA.Alternate_Height = 97; + } + else if (iResolution < _800x600) + { + MAP_FONT = BLOCKFONT2; + ETA_FONT = BLOCKFONT2; + + UI_MAP.GridSize = { 21, 18 }; + UI_MAP.BorderRegion = { + SCREEN_WIDTH - xResOffset - 380, + yResOffset, + 380, + 360 + }; + + UI_MAP.ViewRegion = { + UI_MAP.BorderRegion.x + 9, + UI_MAP.BorderRegion.y + 10, + UI_MAP.GridSize.iX * MAXIMUM_VALID_X_COORDINATE, + UI_MAP.GridSize.iY * MAXIMUM_VALID_Y_COORDINATE + 10 + }; + + // Strategic map numbers and letters. Numbers are on the horizontal line. + UI_MAP.Numbers = { + UI_MAP.BorderRegion.x + 31, + UI_MAP.BorderRegion.y + 11, + UI_MAP.GridSize.iX, + GetFontHeight(MAP_FONT) + }; + + UI_MAP.Alphabet = { + UI_MAP.BorderRegion.x + 15, + UI_MAP.BorderRegion.y + 29, + GetFontHeight(MAP_FONT), + UI_MAP.GridSize.iY + }; + + UI_MAP.LevelString = { + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, + (SCREEN_HEIGHT - 175) + }; + + // standard ETA box + UI_MAP.ETA.Clock_X = UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2; + UI_MAP.ETA.Start_Y = UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 15; + UI_MAP.ETA.Hour_X = UI_MAP.ETA.Clock_X + 38; + UI_MAP.ETA.Min_X = UI_MAP.ETA.Clock_X + 54; + + + // Helicopter ETA box + UI_MAP.HeliETA.PopupBox = { + (400 + iScreenWidthOffset), + (250 + iScreenHeightOffset), + 120, + 68 + }; + UI_MAP.HeliETA.Upper_Popup_Y = (50 + iScreenHeightOffset); + UI_MAP.HeliETA.Alternate_Height = 74; + } + else if (iResolution < _1024x768) + { + MAP_FONT = BLOCKFONT2; + ETA_FONT = BLOCKFONT2; + + UI_MAP.GridSize = { 30, 25 }; + UI_MAP.BorderRegion = { + SCREEN_WIDTH - xResOffset - 540, + yResOffset, + 540, + 479 + }; + + UI_MAP.ViewRegion = { + UI_MAP.BorderRegion.x + 9, + UI_MAP.BorderRegion.y + 10, + UI_MAP.GridSize.iX * MAXIMUM_VALID_X_COORDINATE, + UI_MAP.GridSize.iY * MAXIMUM_VALID_Y_COORDINATE + 17 + }; + + // Strategic map numbers and letters. Numbers are on the horizontal line. + UI_MAP.Numbers = { + UI_MAP.BorderRegion.x + 38, + UI_MAP.BorderRegion.y + 15, + UI_MAP.GridSize.iX, + GetFontHeight(MAP_FONT) + }; + + UI_MAP.Alphabet = { + UI_MAP.BorderRegion.x + 19, + UI_MAP.BorderRegion.y + 36, + GetFontHeight(MAP_FONT), + UI_MAP.GridSize.iY + }; + + UI_MAP.LevelString = { + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, + UI_MAP.ViewRegion.y + (600 - 175) + }; + + // standard ETA box + UI_MAP.ETA.Clock_X = UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2; + UI_MAP.ETA.Start_Y = UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 15; + UI_MAP.ETA.Hour_X = UI_MAP.ETA.Clock_X + 38; + UI_MAP.ETA.Min_X = UI_MAP.ETA.Clock_X + 54; + + + // Helicopter ETA box + UI_MAP.HeliETA.PopupBox = { + (400 + iScreenWidthOffset), + (250 + iScreenHeightOffset + 58), + 120, + 68 + }; + UI_MAP.HeliETA.Upper_Popup_Y = (50 + iScreenHeightOffset - 40); + UI_MAP.HeliETA.Alternate_Height = 74; + } + else + { + MAP_FONT = FONT12ARIAL; + ETA_FONT = FONT12ARIAL; + + UI_MAP.GridSize = { 43, 35 }; + UI_MAP.BorderRegion = { + SCREEN_WIDTH - xResOffset - 764, + yResOffset, + 764, + 647 + }; + + UI_MAP.ViewRegion = { + UI_MAP.BorderRegion.x + 9, + UI_MAP.BorderRegion.y + 10, + UI_MAP.GridSize.iX * MAXIMUM_VALID_X_COORDINATE, + UI_MAP.GridSize.iY * MAXIMUM_VALID_Y_COORDINATE + 27 + }; + + // Strategic map numbers and letters. Numbers are on the horizontal line. + UI_MAP.Numbers = { + UI_MAP.BorderRegion.x + 53, + UI_MAP.BorderRegion.y + 19, + UI_MAP.GridSize.iX, + GetFontHeight(MAP_FONT) + }; + + UI_MAP.Alphabet = { + UI_MAP.BorderRegion.x + 24, + UI_MAP.BorderRegion.y + 44, + GetFontHeight(MAP_FONT), + UI_MAP.GridSize.iY + }; + + UI_MAP.LevelString = { + UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, + UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 25 + }; + + // standard ETA box + UI_MAP.ETA.Clock_X = UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2; + UI_MAP.ETA.Start_Y = UI_MAP.ViewRegion.y + UI_MAP.ViewRegion.height - 15; + UI_MAP.ETA.Hour_X = UI_MAP.ETA.Clock_X + 38; + UI_MAP.ETA.Min_X = UI_MAP.ETA.Clock_X + 54; + + + // Helicopter ETA box + UI_MAP.HeliETA.PopupBox = { + (400 + iScreenWidthOffset), + (250 + iScreenHeightOffset + 120), + 120, + 76 + }; + UI_MAP.HeliETA.Upper_Popup_Y = (50 + iScreenHeightOffset - 100); + UI_MAP.HeliETA.Alternate_Height = 97; + } +} \ No newline at end of file diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index e7203b5f..01a70728 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -52,6 +52,76 @@ extern INT8 NUM_TOWNS; #define FIRST_TOWN OMERTA //#define PALACE NUM_TOWNS +struct UILayout_CharPanelIconRegion +{ + INT32 x; + INT32 y; + INT32 width; + INT32 height; + INT32 spacing; +}; + +struct UILayout_MapBorderButtons +{ + SGPPoint Town; + SGPPoint Mine; + SGPPoint Teams; + SGPPoint Militia; + SGPPoint Airspace; + SGPPoint Inventory; + SGPPoint Disease; + UINT16 Weather_Y; // Dynamic x position + UINT16 Intel_Y; // Dynamic x position +}; + +struct UILayout_ETA +{ + int Start_Y; + int Clock_X; + int Hour_X; + int Min_X; +}; + +struct UILayout_HeliETA +{ + SGPRectangle PopupBox; + int Upper_Popup_Y; + int Alternate_Height; +}; + +struct UILayout_Map +{ + SGPRectangle BorderRegion; + SGPRectangle ViewRegion; + SGPRectangle Alphabet; + SGPRectangle Numbers; + SGPRectangle LevelMarkerArea; + SGPPoint LevelString; + SGPPoint GridSize; + UILayout_MapBorderButtons Button; + UILayout_ETA ETA; + UILayout_HeliETA HeliETA; +}; + +struct UILayout_CharList +{ + SGPRectangle Region; + SGPPoint Title; + int y; + int yOffset; + int xName; + int widthName; + int xAssignment; + int widthAssignment; + int xSleep; + int widthSleep; + int xLocation; + int widthLocation; + int xETA; + int widthETA; + int xTimeRemaining; + int widthTimeRemaining; +}; extern BOOLEAN fCharacterInfoPanelDirty; extern BOOLEAN fTeamPanelDirty; @@ -105,6 +175,7 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ); BOOLEAN InitializeInvPanelCoordsOld( ); BOOLEAN InitializeInvPanelCoordsNew( ); BOOLEAN InitializeInvPanelCoordsVehicle( ); +void initMapViewAndBorderCoordinates(void); // HEADROCK HAM 3.6: Calculate daily cost for all mercs who have one. INT32 GetTotalContractExpenses ( void ); @@ -154,4 +225,6 @@ void ConvertMinTimeToETADayHourMinString( UINT32 uiTimeInMin, STR16 sString ); // Flugente: bandaging during retreat void RetreatBandageCallback( UINT8 ubResult ); +bool isWidescreenUI(void); + #endif \ No newline at end of file diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 3ae6070d..abe22e0d 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -101,6 +101,7 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +extern INV_REGION_DESC gMapScreenInvPocketXY[NUM_INV_SLOTS]; // ARRAY FOR INV PANEL INTERFACE ITEM POSITIONS //CHRISL: Moved to Interface Items.h for EDB //#define ITEMDESC_FONT BLOCKFONT2 @@ -1652,7 +1653,6 @@ void RenderInvBodyPanel( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ) else { BltVideoObjectFromIndex( guiSAVEBUFFER, guiBodyInvVO[ pSoldier->ubBodyType ][ bSubImageIndex ], 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL ); - } } @@ -2642,38 +2642,6 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe if ( fDirtyLevel == DIRTYLEVEL2 ) { // CHECK FOR COMPATIBILITY WITH MAGAZINES - -/* OLD VERSION OF GUN/AMMO MATCH HIGHLIGHTING - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - UINT16 usLineColor; - - if ( ( Item [ pSoldier->inv[ HANDPOS ].usItem ].usItemClass & IC_GUN ) && ( Item[ pObject->usItem ].usItemClass & IC_AMMO ) ) - { - // CHECK - if (Weapon[pSoldier->inv[ HANDPOS ].usItem].ubCalibre == Magazine[Item[pObject->usItem].ubClassIndex].ubCalibre ) - { - // IT's an OK calibre ammo, do something! - // Render Item with specific color - //fOutline = TRUE; - //sOutlineColor = Get16BPPColor( FROMRGB( 96, 104, 128 ) ); - //sOutlineColor = Get16BPPColor( FROMRGB( 20, 20, 120 ) ); - - // Draw rectangle! - pDestBuf = LockVideoSurface( guiSAVEBUFFER, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); - - //usLineColor = Get16BPPColor( FROMRGB( 255, 255, 0 ) ); - usLineColor = Get16BPPColor( FROMRGB( 230, 215, 196 ) ); - RectangleDraw( TRUE, (sX+1), (sY+1), (sX + gSMInvData[ sPocket ].sWidth - 2 ),( sY + gSMInvData[ sPocket ].sHeight - 2 ), usLineColor, pDestBuf ); - - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); - - UnLockVideoSurface( guiSAVEBUFFER ); - } - } -*/ - if ( gbCompatibleAmmo[ sPocket ] ) { fOutline = TRUE; @@ -2693,8 +2661,9 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } else { - newX = !UsingNewInventorySystem( ) ? (14 + xResOffset) : (6 + xResOffset); - newY = !UsingNewInventorySystem( ) ? (218 + yResOffset) : (217 + yResOffset); + newX = gMapScreenInvPocketXY[SECONDHANDPOS].sX - 10; + newY = gMapScreenInvPocketXY[SECONDHANDPOS].sY; + BltVideoObjectFromIndex( guiSAVEBUFFER, guiMapInvSecondHandBlockout, UsingNewInventorySystem(), newX, newY, VO_BLT_SRCTRANSPARENCY, NULL ); RestoreExternBackgroundRect( newX, newY, 102, 24 ); } @@ -9755,7 +9724,10 @@ BOOLEAN InitSectorStackPopup( SOLDIERTYPE *pSoldier, WORLDITEM *pInventoryPoolLi fInterfacePanelDirty = DIRTYLEVEL2; gfInSectorStackPopup = TRUE; - fShowInventoryFlag = TRUE; + if (!isWidescreenUI()) + { + fShowInventoryFlag = TRUE; + } //Restrict mouse cursor to panel aRect.iLeft = sInvX + sOffSetX; diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index f45de1e9..cc58d6a3 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -80,6 +80,10 @@ //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; +extern int UI_CHARINV_REGION_X; +extern int UI_CHARINV_REGION_Y; +extern int UI_CHARINV_REGION_W; +extern int UI_CHARINV_REGION_H; /* @@ -1538,7 +1542,14 @@ BOOLEAN InitializeSMPanelCoordsOld() //dnl INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); //dnl INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); - INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); + if (isWidescreenUI()) + { + INTERFACE_CLOCK_X = SCREEN_WIDTH - 86; + } + else + { + INTERFACE_CLOCK_X = SCREEN_WIDTH - xResOffset - 86; + } INTERFACE_CLOCK_Y = SCREEN_HEIGHT - 24; LOCATION_NAME_X = xResOffset + (xResSize - 92); LOCATION_NAME_Y = ( 65 + INTERFACE_START_Y ); @@ -1898,7 +1909,14 @@ BOOLEAN InitializeSMPanelCoordsNew() //dnl INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); //dnl INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); - INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); + if (isWidescreenUI()) + { + INTERFACE_CLOCK_X = SCREEN_WIDTH - 86; + } + else + { + INTERFACE_CLOCK_X = SCREEN_WIDTH - xResOffset - 86; + } INTERFACE_CLOCK_Y = SCREEN_HEIGHT - 24; LOCATION_NAME_X = xResOffset + (xResSize - 92); LOCATION_NAME_Y = ( 89 + INTERFACE_START_Y ); @@ -7345,8 +7363,8 @@ void KeyRingItemPanelButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) // want the inv done button shutdown and the region behind the keyring shaded //ForceButtonUnDirty( giMapInvDoneButton ); // shade the background - ShadowVideoSurfaceRect( FRAME_BUFFER , 0, 107, 261, 359 ); - InvalidateRegion( 0, 107, 261, 359 ); + ShadowVideoSurfaceRect( FRAME_BUFFER, UI_CHARINV_REGION_X, UI_CHARINV_REGION_Y, UI_CHARINV_REGION_X + UI_CHARINV_REGION_W, UI_CHARINV_REGION_Y + UI_CHARINV_REGION_H); + InvalidateRegion(UI_CHARINV_REGION_X, UI_CHARINV_REGION_Y, UI_CHARINV_REGION_X + UI_CHARINV_REGION_W, UI_CHARINV_REGION_Y + UI_CHARINV_REGION_H); } //CHRISL: In OIV mode, we don't want to offset the keyring popup. diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 40839e4e..bf953ebe 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -84,6 +84,8 @@ //const UINT32 INTERFACE_START_Y = ( SCREEN_HEIGHT - INTERFACE_HEIGHT ); //const UINT32 INV_INTERFACE_START_Y = ( SCREEN_HEIGHT - INV_INTERFACE_HEIGHT ); +extern UILayout_Map UI_MAP; + int INTERFACE_WIDTH;// = 640; int INTERFACE_HEIGHT;// = 120; int INV_INTERFACE_HEIGHT;// = 140; @@ -889,7 +891,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) } //SetButtonSavedRect( iActionIcons[ WALK_ICON ] ); - if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) + if (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { SetButtonFastHelpText( iActionIcons[ WALK_ICON ], TacticalStr[ DRIVE_POPUPTEXT ] ); } @@ -4563,9 +4565,9 @@ void BeginMapUIMessage( UINT8 ubPosition, STR16 pFontString, ... ) // WDS - bug fix: VideoOverlayDesc must be initialized! - 07/16/2007 memset( &VideoOverlayDesc, 0, sizeof( VIDEO_OVERLAY_DESC ) ); // Set Overlay - VideoOverlayDesc.sLeft = 20 + MAP_VIEW_START_X + ( MAP_VIEW_WIDTH - gusUIMessageWidth ) / 2; + VideoOverlayDesc.sLeft = 20 + UI_MAP.ViewRegion.x + (UI_MAP.ViewRegion.width - gusUIMessageWidth ) / 2; - VideoOverlayDesc.sTop = MAP_VIEW_START_Y + ( MAP_VIEW_HEIGHT - gusUIMessageHeight ) / 2; + VideoOverlayDesc.sTop = UI_MAP.ViewRegion.y + (UI_MAP.ViewRegion.height - gusUIMessageHeight ) / 2; if( ubPosition == MSG_MAP_UI_POSITION_UPPER ) { diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index 9b4c02ed..540e2bfc 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -30,7 +30,8 @@ extern BOOLEAN AreInMeanwhile(); #include "connect.h" extern INT32 iCurrentMapSectorZ; - +extern UINT16 UI_BOTTOM_X; +extern UINT16 UI_BOTTOM_Y; void AdjustWorldCenterFromRadarCoords( INT16 sRadarX, INT16 sRadarY ); @@ -80,10 +81,18 @@ MOUSE_REGION gRadarRegionSquadList[ NUMBER_OF_SQUADS ]; void InitRadarScreenCoords( ) { + if (isWidescreenUI()) + { + RADAR_WINDOW_STRAT_X = UI_BOTTOM_X + 1182; + RADAR_WINDOW_STRAT_Y = UI_BOTTOM_Y + 9; + } + else + { + RADAR_WINDOW_STRAT_X = xResOffset + (xResSize - 97); + RADAR_WINDOW_STRAT_Y = (SCREEN_HEIGHT - 107); + } RADAR_WINDOW_TM_X = xResOffset + (xResSize - 97); RADAR_WINDOW_SM_X = xResOffset + (xResSize - 97); - RADAR_WINDOW_STRAT_X = xResOffset + (xResSize - 97); - RADAR_WINDOW_STRAT_Y = (SCREEN_HEIGHT - 107); RADAR_WINDOW_TM_Y = (INTERFACE_START_Y + 13); RADAR_WINDOW_SM_Y = ((UsingNewInventorySystem() == false)) ? (INV_INTERFACE_START_Y + 33) : (INV_INTERFACE_START_Y + 116); diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index 1ad556d9..a35f7099 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -674,6 +674,11 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 return(TRUE); } +BOOLEAN RestoreExternBackgroundRect(SGPRectangle rect) +{ + return RestoreExternBackgroundRect(rect.x, rect.y, rect.width, rect.height); +} + BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) { diff --git a/TileEngine/Render Dirty.h b/TileEngine/Render Dirty.h index b1407b16..e3171deb 100644 --- a/TileEngine/Render Dirty.h +++ b/TileEngine/Render Dirty.h @@ -120,6 +120,7 @@ BOOLEAN SaveBackgroundRects(void); BOOLEAN InvalidateBackgroundRects(void); BOOLEAN UpdateSaveBuffer(void); BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight ); +BOOLEAN RestoreExternBackgroundRect(SGPRectangle rect); void SetBackgroundRectFilled( UINT32 uiBackgroundID ); BOOLEAN EmptyBackgroundRects( void ); diff --git a/Utils/message.cpp b/Utils/message.cpp index d244896c..6616aa07 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -1047,7 +1047,10 @@ void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ... ) // HEADROCK HAM 3.6: Allow for longer lines. // Lejardo ARSProject MAP_LINE_WIDTH = (INTERFACE_WIDTH - 330); - + if (iResolution == _1280x720) + { + MAP_LINE_WIDTH = 685; + } pStringWrapperHead=LineWrap(uiFont, MAP_LINE_WIDTH, &usLineWidthIfWordIsWiderThenWidth, DestString); pStringWrapper=pStringWrapperHead; if(!pStringWrapper) @@ -1136,14 +1139,20 @@ void DisplayStringsInMapScreenMessageList( void ) UINT8 ubLinesPrinted; INT16 sY; UINT16 usSpacing; - + UINT16 MessageStartX = (SCREEN_WIDTH - INTERFACE_WIDTH) / 2; + UINT16 MessageEndX = MessageStartX + (INTERFACE_WIDTH - 330); + if (iResolution == _1280x720) + { + MessageStartX = 0; + MessageEndX = 705; + } //SetFontDestBuffer( FRAME_BUFFER, 17, 360 + 6, 407, 360 + 101, FALSE ); // CHRISL: Change both X paramters so they dynamically generate from right edge of screen //SetFontDestBuffer( FRAME_BUFFER, (SCREEN_WIDTH - 509), (SCREEN_HEIGHT - 114), (SCREEN_WIDTH - 233), (SCREEN_HEIGHT - 114) + 101, FALSE ); // CHRISL: Use this setup if we want message box on the left side // HEADROCK HAM 3.6: Message window now as wide as possible. The money screen has been moved to the right side. - SetFontDestBuffer( FRAME_BUFFER, (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + 17, (SCREEN_HEIGHT - 114), (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + (INTERFACE_WIDTH - 330), (SCREEN_HEIGHT - 114) + 101, FALSE ); + SetFontDestBuffer( FRAME_BUFFER, MessageStartX + 17, (SCREEN_HEIGHT - 114), MessageEndX, (SCREEN_HEIGHT - 114) + 101, FALSE ); SetFont( MAP_SCREEN_MESSAGE_FONT ); // no longer supports variable fonts SetFontBackground( FONT_BLACK ); @@ -1177,7 +1186,7 @@ void DisplayStringsInMapScreenMessageList( void ) // CHRISL: Change X parameter to dynamically generate from right edge of screen //mprintf_coded( (SCREEN_WIDTH - 506), sY, gMapScreenMessageList[ ubCurrentStringIndex ]->pString16 ); // CHRISL: Use this line if we want to display from the left edge - mprintf_coded( (SCREEN_WIDTH - INTERFACE_WIDTH)/2 + 20, sY, gMapScreenMessageList[ ubCurrentStringIndex ]->pString16 ); + mprintf_coded(MessageStartX + 20, sY, gMapScreenMessageList[ ubCurrentStringIndex ]->pString16 ); sY = sY + usSpacing;