Skip to content

Commit 285ed43

Browse files
committed
Replicate in Generals
1 parent 1364e1f commit 285ed43

File tree

2 files changed

+41
-13
lines changed

2 files changed

+41
-13
lines changed

Generals/Code/GameEngine/Include/Common/GameLOD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class GameLODManager
203203
void applyStaticLODLevel(StaticGameLODLevel level);
204204
void applyDynamicLODLevel(DynamicGameLODLevel level);
205205
void refreshCustomStaticLODLevel(void); ///<grabs current globaldata values and makes them the custom detail setting.
206+
StaticGameLODLevel getRecommendedTextureLODLevel();
206207

207208
static const FieldParse m_staticGameLODFieldParseTable[];
208209
StaticGameLODLevel m_currentStaticLOD; ///< current value of static LOD.

Generals/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,23 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
555555
StaticGameLODInfo *lodInfo=&m_staticGameLODInfo[level];
556556
StaticGameLODInfo *prevLodInfo=&prevLodBackup;
557557

558-
Int requestedTextureReduction = 0;
559-
Bool requestedTrees = m_memPassed; //only use trees if memory requirement passed.
558+
Int requestedTextureReduction;
559+
Bool requestedTrees;
560560
if (level == STATIC_GAME_LOD_CUSTOM)
561-
{ requestedTextureReduction = lodInfo->m_textureReduction;
561+
{
562+
requestedTextureReduction = lodInfo->m_textureReduction;
562563
requestedTrees = lodInfo->m_useTrees;
563564
}
564565
else
565-
if (level >= STATIC_GAME_LOD_LOW)
566-
{ //normal non-custom level gets texture reduction based on recommendation
567-
requestedTextureReduction = getRecommendedTextureReduction();
566+
{
567+
//normal non-custom level gets texture reduction based on recommendation
568+
StaticGameLODLevel textureLevel = getRecommendedTextureLODLevel();
569+
if (textureLevel == STATIC_GAME_LOD_UNKNOWN)
570+
textureLevel = level;
571+
requestedTextureReduction = getLevelTextureReduction(textureLevel);
572+
573+
//only use trees if memory requirement passed.
574+
requestedTrees = m_memPassed;
568575
}
569576

570577
if (TheGlobalData)
@@ -717,16 +724,36 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level)
717724

718725
Int GameLODManager::getRecommendedTextureReduction(void)
719726
{
720-
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
721-
getRecommendedStaticLODLevel(); //it was never tested, so test now.
727+
StaticGameLODLevel level = getRecommendedTextureLODLevel();
728+
729+
if (level == STATIC_GAME_LOD_UNKNOWN)
730+
{
731+
level = getStaticLODLevel();
732+
}
733+
return getLevelTextureReduction(level);
734+
}
722735

723-
if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
724-
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);
736+
StaticGameLODLevel GameLODManager::getRecommendedTextureLODLevel()
737+
{
738+
// TheSuperHackers @bugfix xezon 24/09/2025 Disables the recommended static LOD level for texture reduction
739+
// because the benchmark code always generates a low level for it. Can revisit if the benchmarking is changed.
740+
constexpr const Bool UseRecommendedStaticLODLevel = FALSE;
725741

726-
if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
727-
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);
742+
StaticGameLODLevel level = STATIC_GAME_LOD_LOW;
728743

729-
return getLevelTextureReduction(m_idealDetailLevel);
744+
// Force low res textures if user has less than 256 MB.
745+
if (m_memPassed)
746+
{
747+
if constexpr (UseRecommendedStaticLODLevel)
748+
{
749+
level = getRecommendedStaticLODLevel();
750+
}
751+
else
752+
{
753+
level = STATIC_GAME_LOD_UNKNOWN;
754+
}
755+
}
756+
return level;
730757
}
731758

732759
Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level)

0 commit comments

Comments
 (0)