From 986d28019327ccac224d8a409026855c39a1cec3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 28 May 2023 16:32:12 +0300 Subject: [PATCH] Enable bigger squad sizes for 720p resolution (#160) --- GameInitOptionsScreen.cpp | 4 ++-- SaveLoadGame.cpp | 2 +- SaveLoadScreen.cpp | 2 +- Tactical/Interface Panels.cpp | 14 ++++++++++++-- TileEngine/Radar Screen.cpp | 13 +++++++++---- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp index 1a063ae2..fcad1e9d 100644 --- a/GameInitOptionsScreen.cpp +++ b/GameInitOptionsScreen.cpp @@ -4153,7 +4153,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) @@ -4173,7 +4173,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) btn->uiFlags|=(BUTTON_CLICKED_ON); UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index eeb71e54..5c245e84 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -4926,7 +4926,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) } if ((gGameOptions.ubSquadSize == 8 && iResolution < _800x600) || - (gGameOptions.ubSquadSize == 10 && iResolution < _1024x768)) + (gGameOptions.ubSquadSize == 10 && iResolution < _1280x720)) { FileClose( hFile ); return(FALSE); diff --git a/SaveLoadScreen.cpp b/SaveLoadScreen.cpp index ac9228f1..5fe319ff 100644 --- a/SaveLoadScreen.cpp +++ b/SaveLoadScreen.cpp @@ -2512,7 +2512,7 @@ void DoneFadeOutForSaveLoadScreen( void ) NextLoopCheckForEnoughFreeHardDriveSpace(); } else if ((gGameOptions.ubSquadSize == 8 && iResolution < _800x600) || - (gGameOptions.ubSquadSize == 10 && iResolution < _1024x768)) + (gGameOptions.ubSquadSize == 10 && iResolution < _1280x720)) { DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SQUAD_SIZE_RES_ERROR], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, FailedLoadingGameCallBack ); NextLoopCheckForEnoughFreeHardDriveSpace(); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index e3b27cd9..e3757a03 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -5199,7 +5199,7 @@ BOOLEAN InitializeTEAMPanel( ) if (iResolution >= _640x480 && iResolution < _800x600) FilenameForBPP("INTERFACE\\bottom_bar.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) + else if (iResolution < _1280x720) { if (gGameOptions.ubSquadSize > 6) { @@ -5240,6 +5240,16 @@ BOOLEAN InitializeTEAMPanel( ) memset( gfTEAM_HandInvDispText, 0, sizeof( gfTEAM_HandInvDispText ) ); + // Offset button coordinates to correct positions if squadsize is 10 + if (iResolution == _1280x720) + { + UINT16 offset = 223; + TM_ENDTURN_X = xResOffset + (xResSize - 131) + offset; + TM_ROSTERMODE_X = xResOffset + (xResSize - 131) + offset; + TM_DISK_X = xResOffset + (xResSize - 131) + offset; + INTERFACE_CLOCK_TM_X = xResOffset + (xResSize - 86) + offset; + LOCATION_NAME_TM_X = xResOffset + (xResSize - 92) + offset; + } // Create buttons CHECKF( CreateTEAMPanelButtons( ) ); @@ -5358,7 +5368,7 @@ BOOLEAN ShutdownTEAMPanel( ) if( fRenderRadarScreen == FALSE ) { // start rendering radar region again, - fRenderRadarScreen = TRUE; + fRenderRadarScreen = TRUE; // remove squad panel CreateDestroyMouseRegionsForSquadList( ); diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index b2bcb1a6..b27ce927 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -82,13 +82,14 @@ void InitRadarScreenCoords( ) { RADAR_WINDOW_STRAT_X = UI_BOTTOM_X + 1182; RADAR_WINDOW_STRAT_Y = UI_BOTTOM_Y + 9; + RADAR_WINDOW_TM_X = xResOffset + (xResSize - 97) + 223; } else { RADAR_WINDOW_STRAT_X = xResOffset + (xResSize - 97); RADAR_WINDOW_STRAT_Y = (SCREEN_HEIGHT - 107); + RADAR_WINDOW_TM_X = xResOffset + (xResSize - 97); } - RADAR_WINDOW_TM_X = xResOffset + (xResSize - 97); RADAR_WINDOW_SM_X = xResOffset + (xResSize - 97); RADAR_WINDOW_TM_Y = (INTERFACE_START_Y + 13); @@ -767,9 +768,13 @@ BOOLEAN CreateDestroyMouseRegionsForSquadList( void ) CHECKF(AddVideoObject(&VObjectDesc, &uiHandle)); GetVideoObject(&hHandle, uiHandle); - - BltVideoObject( guiSAVEBUFFER , hHandle, 0,(xResOffset + xResSize - 102 - 1), gsVIEWPORT_END_Y, VO_BLT_SRCTRANSPARENCY,NULL ); - RestoreExternBackgroundRect ((xResOffset + xResSize - 102 - 1), gsVIEWPORT_END_Y, 102,( INT16 ) ( SCREEN_HEIGHT - gsVIEWPORT_END_Y ) ); + INT32 xCoord = (xResOffset + xResSize - 102 - 1); + if (isWidescreenUI()) + { + xCoord += 224; + } + BltVideoObject( guiSAVEBUFFER, hHandle, 0, xCoord, gsVIEWPORT_END_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + RestoreExternBackgroundRect(xCoord, gsVIEWPORT_END_Y, 102,( INT16 ) ( SCREEN_HEIGHT - gsVIEWPORT_END_Y ) ); for( sCounter = 0; sCounter < NUMBER_OF_SQUADS; sCounter++ ) {