Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class GameLODManager

const char *getStaticGameLODLevelName(StaticGameLODLevel level);
const char *getDynamicGameLODLevelName(DynamicGameLODLevel level);
StaticGameLODLevel findStaticLODLevel(void); ///< calculate the optimal static LOD level for this system.
StaticGameLODLevel getRecommendedStaticLODLevel(void); ///< calculate the optimal static LOD level for this system.
Bool setStaticLODLevel(StaticGameLODLevel level); ///< set the current static LOD level.
StaticGameLODLevel getStaticLODLevel(void) { return m_currentStaticLOD;}
DynamicGameLODLevel findDynamicLODLevel(Real averageFPS); ///<given an average fps, return the optimal dynamic LOD.
Expand Down
10 changes: 5 additions & 5 deletions Generals/Code/GameEngine/Source/Common/GameLOD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ const char *GameLODManager::getStaticGameLODLevelName(StaticGameLODLevel level)

/**Function which calculates the recommended LOD level for current hardware
configuration.*/
StaticGameLODLevel GameLODManager::findStaticLODLevel(void)
StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void)
{
//Check if we have never done the test on current system
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
Expand Down Expand Up @@ -687,15 +687,15 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level)
Int GameLODManager::getRecommendedTextureReduction(void)
{
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
findStaticLODLevel(); //it was never tested, so test now.
getRecommendedStaticLODLevel(); //it was never tested, so test now.

if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);

if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);

return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction;
return getLevelTextureReduction(m_idealDetailLevel);
}

Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ extern void DoResolutionDialog();
static Bool ignoreSelected = FALSE;
WindowLayout *OptionsLayout = NULL;

enum Detail CPP_11(: Int)
{
HIGHDETAIL = 0,
MEDIUMDETAIL,
LOWDETAIL,
CUSTOMDETAIL,
};


OptionPreferences::OptionPreferences( void )
{
Expand Down Expand Up @@ -946,25 +938,9 @@ static void setDefaults( void )

//-------------------------------------------------------------------------------------------------
// LOD
if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE)) {
TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel());
switch (TheGameLODManager->getStaticLODLevel())
{
case STATIC_GAME_LOD_LOW:
GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL);
break;
case STATIC_GAME_LOD_MEDIUM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL);
break;
case STATIC_GAME_LOD_HIGH:
GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL);
break;
case STATIC_GAME_LOD_CUSTOM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL);
break;
default:
DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) );
};
if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE))
{
GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getRecommendedStaticLODLevel());
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1131,7 +1107,7 @@ static void saveOptions( void )
//-------------------------------------------------------------------------------------------------
// Custom game detail settings.
GadgetComboBoxGetSelectedPos( comboBoxDetail, &index );
if (index == CUSTOMDETAIL)
if (index == STATIC_GAME_LOD_CUSTOM)
{
//-------------------------------------------------------------------------------------------------
// Texture resolution slider
Expand Down Expand Up @@ -1200,27 +1176,8 @@ static void saveOptions( void )
// LOD
if (comboBoxDetail && comboBoxDetail->winGetEnabled())
{
Bool levelChanged=FALSE;
GadgetComboBoxGetSelectedPos( comboBoxDetail, &index );

//The levels stored by the LOD Manager are inverted compared to GUI so find correct one:
switch (index) {
case HIGHDETAIL:
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_HIGH);
break;
case MEDIUMDETAIL:
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_MEDIUM);
break;
case LOWDETAIL:
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_LOW);
break;
case CUSTOMDETAIL:
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_CUSTOM);
break;
default:
DEBUG_ASSERTCRASH(FALSE,("LOD passed in was %d, %d is not a supported LOD",index,index));
break;
}
const Bool levelChanged = TheGameLODManager->setStaticLODLevel((StaticGameLODLevel)index);

if (levelChanged)
(*pref)["StaticGameLOD"] = TheGameLODManager->getStaticGameLODLevelName(TheGameLODManager->getStaticLODLevel());
Expand Down Expand Up @@ -1567,23 +1524,7 @@ static void acceptAdvancedOptions()
static void cancelAdvancedOptions()
{
//restore the detail selection back to initial state
switch (TheGameLODManager->getStaticLODLevel())
{
case STATIC_GAME_LOD_LOW:
GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL);
break;
case STATIC_GAME_LOD_MEDIUM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL);
break;
case STATIC_GAME_LOD_HIGH:
GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL);
break;
case STATIC_GAME_LOD_CUSTOM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL);
break;
default:
DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) );
};
GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel());

WinAdvancedDisplay->winHide(TRUE);
}
Expand Down Expand Up @@ -1894,35 +1835,22 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex );

// set the display detail
// TheSuperHackers @tweak xezon 24/09/2025 The Detail Combo Box now has the same value order as StaticGameLODLevel for simplicity.
GadgetComboBoxReset(comboBoxDetail);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Low"), color);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color);
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color);
static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count");

//Check if level was never set and default to setting most suitable for system.
if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN)
TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel());

switch (TheGameLODManager->getStaticLODLevel())
{
case STATIC_GAME_LOD_LOW:
GadgetComboBoxSetSelectedPos(comboBoxDetail, LOWDETAIL);
break;
case STATIC_GAME_LOD_MEDIUM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, MEDIUMDETAIL);
break;
case STATIC_GAME_LOD_HIGH:
GadgetComboBoxSetSelectedPos(comboBoxDetail, HIGHDETAIL);
break;
case STATIC_GAME_LOD_CUSTOM:
GadgetComboBoxSetSelectedPos(comboBoxDetail, CUSTOMDETAIL);
break;
default:
DEBUG_ASSERTCRASH(FALSE,("Tried to set comboBoxDetail to a value of %d ", TheGameLODManager->getStaticLODLevel()) );
};
{
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}

Int txtFact=TheGameLODManager->getCurrentTextureReduction();
GadgetComboBoxSetSelectedPos(comboBoxDetail, (Int)TheGameLODManager->getStaticLODLevel());

GadgetSliderSetPosition( sliderTextureResolution, 2-txtFact);

Expand Down Expand Up @@ -2239,7 +2167,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg,
{
Int index;
GadgetComboBoxGetSelectedPos( comboBoxDetail, &index );
if(index != CUSTOMDETAIL)
if(index != STATIC_GAME_LOD_CUSTOM)
break;

showAdvancedOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ void finishSinglePlayerInit( void )
if (!TheGameLODManager->didMemPass()) {
useLowRes = TRUE;
}
if (TheGameLODManager->findStaticLODLevel()==STATIC_GAME_LOD_LOW) {
if (TheGameLODManager->getRecommendedStaticLODLevel()==STATIC_GAME_LOD_LOW) {
useLowRes = TRUE;
}
if (TheGameLODManager->getStaticLODLevel()==STATIC_GAME_LOD_LOW) {
Expand Down Expand Up @@ -1715,7 +1715,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos);
stats.surrenders[ptIdx] += TheGameInfo->haveWeSurrendered() || !TheVictoryConditions->getEndFrame();

AsciiString systemSpec;
systemSpec.format("LOD%d", TheGameLODManager->findStaticLODLevel());
systemSpec.format("LOD%d", TheGameLODManager->getRecommendedStaticLODLevel());
stats.systemSpec = systemSpec.str();

stats.techCaptured[ptIdx] += s->getTotalTechBuildingsCaptured();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,9 @@ void W3DDisplay::init( void )

//Check if level was never set and default to setting most suitable for system.
if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN)
TheGameLODManager->setStaticLODLevel(TheGameLODManager->findStaticLODLevel());
{
TheGameLODManager->setStaticLODLevel(TheGameLODManager->getRecommendedStaticLODLevel());
}
else
{ //Static LOD level was applied during GameLOD manager init except for texture reduction
//which needs to be applied here.
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class GameLODManager

const char *getStaticGameLODLevelName(StaticGameLODLevel level);
const char *getDynamicGameLODLevelName(DynamicGameLODLevel level);
StaticGameLODLevel findStaticLODLevel(void); ///< calculate the optimal static LOD level for this system.
StaticGameLODLevel getRecommendedStaticLODLevel(void); ///< calculate the optimal static LOD level for this system.
Bool setStaticLODLevel(StaticGameLODLevel level); ///< set the current static LOD level.
StaticGameLODLevel getStaticLODLevel(void) { return m_currentStaticLOD;}
DynamicGameLODLevel findDynamicLODLevel(Real averageFPS); ///<given an average fps, return the optimal dynamic LOD.
Expand Down
10 changes: 5 additions & 5 deletions GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ const char *GameLODManager::getStaticGameLODLevelName(StaticGameLODLevel level)

/**Function which calculates the recommended LOD level for current hardware
configuration.*/
StaticGameLODLevel GameLODManager::findStaticLODLevel(void)
StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void)
{
//Check if we have never done the test on current system
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
Expand Down Expand Up @@ -692,15 +692,15 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level)
Int GameLODManager::getRecommendedTextureReduction(void)
{
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
findStaticLODLevel(); //it was never tested, so test now.
getRecommendedStaticLODLevel(); //it was never tested, so test now.

if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);

if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
return m_staticGameLODInfo[STATIC_GAME_LOD_LOW].m_textureReduction;
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);

return m_staticGameLODInfo[m_idealDetailLevel].m_textureReduction;
return getLevelTextureReduction(m_idealDetailLevel);
}

Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level)
Expand Down
Loading
Loading