diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 3df8fb3090..6f90600630 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -67,3 +67,8 @@ #define USE_OBSOLETE_GENERALS_CODE (1) #endif #endif + +#define MIN_DISPLAY_BIT_DEPTH 16 +#define DEFAULT_DISPLAY_BIT_DEPTH 32 +#define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for +#define DEFAULT_DISPLAY_HEIGHT 600 // The standard resolution this game was designed for diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 8c07362066..24f9e0e342 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -614,8 +614,8 @@ GlobalData::GlobalData() m_chipSetType = 0; m_headless = FALSE; m_windowed = 0; - m_xResolution = 800; - m_yResolution = 600; + m_xResolution = DEFAULT_DISPLAY_WIDTH; + m_yResolution = DEFAULT_DISPLAY_HEIGHT; m_maxShellScreens = 0; m_useCloudMap = FALSE; m_use3WayTerrainBlends = 1; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 749af7a749..d9604767f3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -180,8 +180,8 @@ void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); GameWindow *win = NULL; - Real x = (Real)TheDisplay->getWidth() / 800; - Real y = (Real)TheDisplay->getHeight() / 600; + Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; + Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index d4c8f7a870..47f8c34a92 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -836,7 +836,7 @@ static void setDefaults( void ) for( Int i = 0; i < numResolutions; ++i ) { Int xres,yres,bitDepth; TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth); - if (xres == 800 && yres == 600) //keep track of default mode in case we need it. + if (xres == DEFAULT_DISPLAY_WIDTH && yres == DEFAULT_DISPLAY_HEIGHT) //keep track of default mode in case we need it. { defaultResIndex=i; break; } @@ -1648,12 +1648,15 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // get resolution from saved preferences file AsciiString selectedResolution = (*pref) ["Resolution"]; - Int selectedXRes=800,selectedYRes=600; + Int selectedXRes=DEFAULT_DISPLAY_WIDTH; + Int selectedYRes=DEFAULT_DISPLAY_HEIGHT; Int selectedResIndex=-1; if (!selectedResolution.isEmpty()) { //try to parse 2 integers out of string if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2) - { selectedXRes=800; selectedYRes=600; + { + selectedXRes=DEFAULT_DISPLAY_WIDTH; + selectedYRes=DEFAULT_DISPLAY_HEIGHT; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 832bb8d128..4c0f2ba862 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -456,8 +456,8 @@ void ResetBattleHonorInsertion(void) } void InsertBattleHonor(GameWindow *list, const Image *image, Bool enabled, Int itemData, Int& row, Int& column, UnicodeString text = UnicodeString::TheEmptyString) { - Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / 800.0f); - Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / 600.0f); + Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH); + Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT); static Int enabledColor = 0xFFFFFFFF; static Int disabledColor = GameMakeColor(80, 80, 80, 255); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 4e7a823b83..55d3e677ff 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -812,7 +812,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonQuickMatchID) { GameSpyMiscPreferences mPref; - if ((TheDisplay->getWidth() != 800 || TheDisplay->getHeight() != 600) && mPref.getQuickMatchResLocked()) + if ((TheDisplay->getWidth() != DEFAULT_DISPLAY_WIDTH || TheDisplay->getHeight() != DEFAULT_DISPLAY_HEIGHT) && mPref.getQuickMatchResLocked()) { GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:QuickMatch800x600")); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 8ff34f43ef..ccc41f9eec 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -187,7 +187,7 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution/800.0f; + Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index ce4b96074d..bfeb1a8665 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -4029,8 +4029,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplyer; - multiplyer.x = TheDisplay->getWidth() / 800; - multiplyer.y = TheDisplay->getHeight() / 600; + multiplyer.x = TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; + multiplyer.y = TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 27efffe271..ab36bebd4c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -108,7 +108,7 @@ static void advancePosition(GameWindow *window, const Image *image, UnsignedInt } static Int Width = size.x + image->getImageWidth(); - static Int x = -800; + static Int x = -DEFAULT_DISPLAY_WIDTH; static Int y = pos.y - (image->getImageHeight()/2); static UnsignedInt m_startTime = timeGetTime(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index 52d50b30e1..a7411a238f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -150,7 +150,7 @@ void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; // figure out how many boxes we draw for this slider Int numBoxes = 0; @@ -229,8 +229,8 @@ void W3DGadgetHorizontalSliderImageDrawB( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; - Real yMulti = INT_TO_REAL(TheDisplay->getHeight())/ 600; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; + Real yMulti = INT_TO_REAL(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; // get image offset xOffset = instData->m_imageOffset.x; yOffset = instData->m_imageOffset.y; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f3beace861..64652df3d5 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -110,10 +110,6 @@ static void drawFramerateBar(void); // DEFINE AND ENUMS /////////////////////////////////////////////////////////// -#define DEFAULT_DISPLAY_BIT_DEPTH 32 -#define MIN_DISPLAY_BIT_DEPTH 16 -#define MIN_DISPLAY_RESOLUTION_X 800 -#define MIN_DISPLAY_RESOLUTION_Y 600 #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT @@ -432,7 +428,7 @@ inline Bool isResolutionSupported(const ResolutionDescClass &res) { static const Int minBitDepth = 24; - return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth; + return res.Width >= DEFAULT_DISPLAY_WIDTH && res.BitDepth >= minBitDepth; } /*Return number of screen modes supported by the current device*/ @@ -701,15 +697,15 @@ void W3DDisplay::init( void ) // if the custom resolution did not succeed. This is unlikely to happen but is possible // if the user writes an unsupported resolution in the Option Preferences or if the // graphics adapter does not support the minimum display resolution to begin with. - Int xres = MIN_DISPLAY_RESOLUTION_X; - Int yres = MIN_DISPLAY_RESOLUTION_Y; + Int xres = DEFAULT_DISPLAY_WIDTH; + Int yres = DEFAULT_DISPLAY_HEIGHT; Int bitDepth = DEFAULT_DISPLAY_BIT_DEPTH; Int displayModeCount = getDisplayModeCount(); Int displayModeIndex = 0; for (; displayModeIndex < displayModeCount; ++displayModeIndex) { getDisplayModeDescription(displayModeIndex, &xres, &yres, &bitDepth); - if (xres * yres >= MIN_DISPLAY_RESOLUTION_X * MIN_DISPLAY_RESOLUTION_Y) + if (xres * yres >= DEFAULT_DISPLAY_WIDTH * DEFAULT_DISPLAY_HEIGHT) break; // Is good enough. Use it. } TheWritableGlobalData->m_xResolution = xres; diff --git a/Generals/Code/Main/WinMain.cpp b/Generals/Code/Main/WinMain.cpp index 15f0c7ec23..777467536f 100644 --- a/Generals/Code/Main/WinMain.cpp +++ b/Generals/Code/Main/WinMain.cpp @@ -76,9 +76,6 @@ const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; const char *gAppPrefix = ""; /// So WB can have a different debug log file name. -#define DEFAULT_XRESOLUTION 800 -#define DEFAULT_YRESOLUTION 600 - static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; @@ -579,7 +576,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); - ::BitBlt(dc, 0, 0, DEFAULT_XRESOLUTION, DEFAULT_YRESOLUTION, tmpDC, 0, 0, SRCCOPY); + ::BitBlt(dc, 0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT, tmpDC, 0, 0, SRCCOPY); ::SelectObject(tmpDC, savBitmap); ::DeleteDC(tmpDC); ::RestoreDC(dc, savContext); @@ -661,8 +658,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWindowed ) { DWORD windowStyle; - Int startWidth = DEFAULT_XRESOLUTION, - startHeight = DEFAULT_YRESOLUTION; + Int startWidth = DEFAULT_DISPLAY_WIDTH, + startHeight = DEFAULT_DISPLAY_HEIGHT; // register the window class @@ -688,8 +685,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin AdjustWindowRect (&rect, windowStyle, FALSE); if (runWindowed) { // Makes the normal debug 800x600 window center in the screen. - startWidth = DEFAULT_XRESOLUTION; - startHeight= DEFAULT_YRESOLUTION; + startWidth = DEFAULT_DISPLAY_WIDTH; + startHeight= DEFAULT_DISPLAY_HEIGHT; } gInitializing = true; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index ed0d16e478..be4b8962e2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -619,8 +619,8 @@ GlobalData::GlobalData() m_chipSetType = 0; m_headless = FALSE; m_windowed = 0; - m_xResolution = 800; - m_yResolution = 600; + m_xResolution = DEFAULT_DISPLAY_WIDTH; + m_yResolution = DEFAULT_DISPLAY_HEIGHT; m_maxShellScreens = 0; m_useCloudMap = FALSE; m_use3WayTerrainBlends = 1; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 97d3d60008..dac78ae7b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -180,8 +180,8 @@ void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); GameWindow *win = NULL; - Real x = (Real)TheDisplay->getWidth() / 800; - Real y = (Real)TheDisplay->getHeight() / 600; + Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; + Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 598c97d23b..2f4a306071 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -880,7 +880,7 @@ static void setDefaults( void ) for( Int i = 0; i < numResolutions; ++i ) { Int xres,yres,bitDepth; TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth); - if (xres == 800 && yres == 600) //keep track of default mode in case we need it. + if (xres == DEFAULT_DISPLAY_WIDTH && yres == DEFAULT_DISPLAY_HEIGHT) //keep track of default mode in case we need it. { defaultResIndex=i; break; } @@ -1715,12 +1715,15 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // get resolution from saved preferences file AsciiString selectedResolution = (*pref) ["Resolution"]; - Int selectedXRes=800,selectedYRes=600; + Int selectedXRes=DEFAULT_DISPLAY_WIDTH; + Int selectedYRes=DEFAULT_DISPLAY_HEIGHT; Int selectedResIndex=-1; if (!selectedResolution.isEmpty()) { //try to parse 2 integers out of string if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2) - { selectedXRes=800; selectedYRes=600; + { + selectedXRes=DEFAULT_DISPLAY_WIDTH; + selectedYRes=DEFAULT_DISPLAY_HEIGHT; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 8636b21aa5..c712371c0d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -468,8 +468,8 @@ void ResetBattleHonorInsertion(void) } void InsertBattleHonor(GameWindow *list, const Image *image, Bool enabled, Int itemData, Int& row, Int& column, UnicodeString text = UnicodeString::TheEmptyString, Int extra = 0) { - Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / 800.0f); - Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / 600.0f); + Int width = MAX_BATTLE_HONOR_IMAGE_WIDTH * (TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH); + Int height = MAX_BATTLE_HONOR_IMAGE_HEIGHT * (TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT); static Int enabledColor = 0xFFFFFFFF; static Int disabledColor = GameMakeColor(80, 80, 80, 255); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index ebc97fc14d..05c84eba2c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -829,7 +829,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonQuickMatchID) { GameSpyMiscPreferences mPref; - if ((TheDisplay->getWidth() != 800 || TheDisplay->getHeight() != 600) && mPref.getQuickMatchResLocked()) + if ((TheDisplay->getWidth() != DEFAULT_DISPLAY_WIDTH || TheDisplay->getHeight() != DEFAULT_DISPLAY_HEIGHT) && mPref.getQuickMatchResLocked()) { GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:QuickMatch800x600")); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 6a8f6f7fec..6ab0a30fe6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -191,7 +191,7 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution/800.0f; + Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; if (adjustFactor<1.0f) adjustFactor = 1.0f; if (adjustFactor>2.0f) adjustFactor = 2.0f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index e841924b50..13c79c4f71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -4183,8 +4183,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplier; - multiplier.x = (float)TheDisplay->getWidth() / 800.0f; - multiplier.y = (float)TheDisplay->getHeight() / 600.0f; + multiplier.x = (Real)TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; + multiplier.y = (Real)TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 6614498dd4..346bc44fac 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -108,7 +108,7 @@ static void advancePosition(GameWindow *window, const Image *image, UnsignedInt } static Int Width = size.x + image->getImageWidth(); - static Int x = -800; + static Int x = -DEFAULT_DISPLAY_WIDTH; static Int y = pos.y - (image->getImageHeight()/2); static UnsignedInt m_startTime = timeGetTime(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index 680cd8d705..292166ccb7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -150,7 +150,7 @@ void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; // figure out how many boxes we draw for this slider Int numBoxes = 0; @@ -229,8 +229,8 @@ void W3DGadgetHorizontalSliderImageDrawB( GameWindow *window, SliderData *s = (SliderData *)window->winGetUserData(); - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / 800; - Real yMulti = INT_TO_REAL(TheDisplay->getHeight())/ 600; + Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; + Real yMulti = INT_TO_REAL(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; // get image offset xOffset = instData->m_imageOffset.x; yOffset = instData->m_imageOffset.y; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 889ccd8c92..7185abb8da 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -111,10 +111,6 @@ static void drawFramerateBar(void); // DEFINE AND ENUMS /////////////////////////////////////////////////////////// -#define DEFAULT_DISPLAY_BIT_DEPTH 32 -#define MIN_DISPLAY_BIT_DEPTH 16 -#define MIN_DISPLAY_RESOLUTION_X 800 -#define MIN_DISPLAY_RESOLUTION_Y 600 #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT @@ -481,7 +477,7 @@ inline Bool isResolutionSupported(const ResolutionDescClass &res) { static const Int minBitDepth = 24; - return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth; + return res.Width >= DEFAULT_DISPLAY_WIDTH && res.BitDepth >= minBitDepth; } /*Return number of screen modes supported by the current device*/ @@ -751,15 +747,15 @@ void W3DDisplay::init( void ) // if the custom resolution did not succeed. This is unlikely to happen but is possible // if the user writes an unsupported resolution in the Option Preferences or if the // graphics adapter does not support the minimum display resolution to begin with. - Int xres = MIN_DISPLAY_RESOLUTION_X; - Int yres = MIN_DISPLAY_RESOLUTION_Y; + Int xres = DEFAULT_DISPLAY_WIDTH; + Int yres = DEFAULT_DISPLAY_HEIGHT; Int bitDepth = DEFAULT_DISPLAY_BIT_DEPTH; Int displayModeCount = getDisplayModeCount(); Int displayModeIndex = 0; for (; displayModeIndex < displayModeCount; ++displayModeIndex) { getDisplayModeDescription(displayModeIndex, &xres, &yres, &bitDepth); - if (xres * yres >= MIN_DISPLAY_RESOLUTION_X * MIN_DISPLAY_RESOLUTION_Y) + if (xres * yres >= DEFAULT_DISPLAY_WIDTH * DEFAULT_DISPLAY_HEIGHT) break; // Is good enough. Use it. } TheWritableGlobalData->m_xResolution = xres; diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 2ce8ca4c69..320e1e071d 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -79,9 +79,6 @@ const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; const char *gAppPrefix = ""; /// So WB can have a different debug log file name. -#define DEFAULT_XRESOLUTION 800 -#define DEFAULT_YRESOLUTION 600 - static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; @@ -601,7 +598,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); - ::BitBlt(dc, 0, 0, DEFAULT_XRESOLUTION, DEFAULT_YRESOLUTION, tmpDC, 0, 0, SRCCOPY); + ::BitBlt(dc, 0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT, tmpDC, 0, 0, SRCCOPY); ::SelectObject(tmpDC, savBitmap); ::DeleteDC(tmpDC); ::RestoreDC(dc, savContext); @@ -683,8 +680,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWindowed ) { DWORD windowStyle; - Int startWidth = DEFAULT_XRESOLUTION, - startHeight = DEFAULT_YRESOLUTION; + Int startWidth = DEFAULT_DISPLAY_WIDTH, + startHeight = DEFAULT_DISPLAY_HEIGHT; // register the window class @@ -710,8 +707,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin AdjustWindowRect (&rect, windowStyle, FALSE); if (runWindowed) { // Makes the normal debug 800x600 window center in the screen. - startWidth = DEFAULT_XRESOLUTION; - startHeight= DEFAULT_YRESOLUTION; + startWidth = DEFAULT_DISPLAY_WIDTH; + startHeight= DEFAULT_DISPLAY_HEIGHT; } gInitializing = true;