Skip to content

Commit 39fde6a

Browse files
committed
[ZH] Fix black terrain in World Builder without RTS_DEBUG
1 parent 0485787 commit 39fde6a

File tree

13 files changed

+37
-19
lines changed

13 files changed

+37
-19
lines changed

Core/GameEngine/Include/Common/GameDefines.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@
3232
#ifndef ENABLE_GAMETEXT_SUBSTITUTES
3333
#define ENABLE_GAMETEXT_SUBSTITUTES (1) // The code can provide substitute texts when labels and strings are missing in the STR or CSF translation file
3434
#endif
35+
36+
// Originally the configurable shroud sat behind #if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
37+
// Disable RTS_CONFIGURABLE_SHROUD to make shroud hacking a bit more difficult in Release game builds.
38+
// Enable RTS_CONFIGURABLE_SHROUD to properly draw the terrain in World Builder without RTS_DEBUG compiled in.
39+
#ifndef RTS_CONFIGURABLE_SHROUD
40+
#define RTS_CONFIGURABLE_SHROUD (1) // When enabled, the GlobalData contains a field to turn on/off the shroud, otherwise shroud is always enabled
41+
#endif

GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
// ----------------------------------------------------------------------------------------------
6060
#include "Lib/BaseType.h"
61+
#include "Common/GameDefines.h"
6162

6263
// ----------------------------------------------------------------------------------------------
6364
#if defined(RTS_INTERNAL) || defined(RTS_DEBUG)

GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "Common/SubsystemInterface.h"
4040
#include "GameClient/Color.h"
4141
#include "Common/STLTypedefs.h"
42-
#include "Common/GameCommon.h"
4342
#include "Common/Money.h"
4443

4544
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
@@ -460,12 +459,14 @@ class GlobalData : public SubsystemInterface
460459
Bool m_TiVOFastMode; ///< When true, the client speeds up the framerate... set by HOTKEY!
461460

462461

462+
#if RTS_CONFIGURABLE_SHROUD
463+
Bool m_shroudOn;
464+
#endif
463465

464466
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
465467
Bool m_wireframe;
466468
Bool m_stateMachineDebug;
467469
Bool m_useCameraConstraints;
468-
Bool m_shroudOn;
469470
Bool m_fogOfWarOn;
470471
Bool m_jabberOn;
471472
Bool m_munkeeOn;

GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ class STLSpecialAlloc;
111111
#include "Common/SubsystemInterface.h"
112112

113113
#include "Common/GameCommon.h"
114-
#include "Common/GameDefines.h"
115114
#include "Common/GameMemory.h"
116115
#include "Common/GameType.h"
117116
#include "Common/GlobalData.h"

GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ Int parseNoFX(char *args[], int)
729729
return 1;
730730
}
731731

732-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
732+
#if RTS_CONFIGURABLE_SHROUD && (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
733733
Int parseNoShroud(char *args[], int)
734734
{
735735
if (TheWritableGlobalData)
@@ -1284,6 +1284,11 @@ static CommandLineParam params[] =
12841284
// Number of frames between each CRC that is written to replay files in singleplayer games.
12851285
{ "-ReplayCRCInterval", parseReplayCRCInterval },
12861286
#endif
1287+
1288+
#if RTS_CONFIGURABLE_SHROUD && (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
1289+
{ "-noshroud", parseNoShroud },
1290+
#endif
1291+
12871292
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
12881293
{ "-saveAllStats", parseSaveAllStats },
12891294
{ "-noDraw", parseNoDraw },
@@ -1322,7 +1327,6 @@ static CommandLineParam params[] =
13221327
{ "-vTune", parseVTune },
13231328
{ "-selectTheUnselectable", parseSelectAll },
13241329
{ "-RunAhead", parseRunAhead },
1325-
{ "-noshroud", parseNoShroud },
13261330
{ "-forceBenchmark", parseForceBenchmark },
13271331
{ "-buildmapcache", parseBuildMapCache },
13281332
{ "-noshadowvolumes", parseNoShadows },

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ GlobalData* GlobalData::m_theOriginal = NULL;
488488
{ "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) },
489489
{ "PlayStats", INI::parseInt, NULL, offsetof( GlobalData, m_playStats ) },
490490

491+
#if RTS_CONFIGURABLE_SHROUD && (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
492+
{ "ShroudOn", INI::parseBool, NULL, offsetof( GlobalData, m_shroudOn ) },
493+
#endif
494+
491495
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
492496
{ "DisableCameraFade", INI::parseBool, NULL, offsetof( GlobalData, m_disableCameraFade ) },
493497
{ "DisableScriptedInputDisabling", INI::parseBool, NULL, offsetof( GlobalData, m_disableScriptedInputDisabling ) },
@@ -497,7 +501,6 @@ GlobalData* GlobalData::m_theOriginal = NULL;
497501
{ "Wireframe", INI::parseBool, NULL, offsetof( GlobalData, m_wireframe ) },
498502
{ "StateMachineDebug", INI::parseBool, NULL, offsetof( GlobalData, m_stateMachineDebug ) },
499503
{ "UseCameraConstraints", INI::parseBool, NULL, offsetof( GlobalData, m_useCameraConstraints ) },
500-
{ "ShroudOn", INI::parseBool, NULL, offsetof( GlobalData, m_shroudOn ) },
501504
{ "FogOfWarOn", INI::parseBool, NULL, offsetof( GlobalData, m_fogOfWarOn ) },
502505
{ "ShowCollisionExtents", INI::parseBool, NULL, offsetof( GlobalData, m_showCollisionExtents ) },
503506
{ "ShowAudioLocations", INI::parseBool, NULL, offsetof( GlobalData, m_showAudioLocations ) },
@@ -548,11 +551,14 @@ GlobalData::GlobalData()
548551
#endif
549552
m_TiVOFastMode = FALSE;
550553

554+
#if RTS_CONFIGURABLE_SHROUD
555+
m_shroudOn = TRUE;
556+
#endif
557+
551558
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
552559
m_wireframe = 0;
553560
m_stateMachineDebug = FALSE;
554561
m_useCameraConstraints = TRUE;
555-
m_shroudOn = TRUE;
556562
m_fogOfWarOn = FALSE;
557563
m_jabberOn = FALSE;
558564
m_munkeeOn = FALSE;

GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ void GameClient::update( void )
660660

661661
if (!freezeTime)
662662
{
663-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
663+
#if RTS_CONFIGURABLE_SHROUD
664664
if (TheGlobalData->m_shroudOn)
665665
#else
666666
if (true)
@@ -691,7 +691,7 @@ void GameClient::update( void )
691691
while (draw)
692692
{ // update() could free the Drawable, so go ahead and grab 'next'
693693
Drawable* next = draw->getNextDrawable();
694-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
694+
#if RTS_CONFIGURABLE_SHROUD
695695
if (TheGlobalData->m_shroudOn)
696696
#else
697697
if (true)

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,7 @@ void InGameUI::createCommandHint( const GameMessage *msg )
25482548
{
25492549
const Object* obj = draw->getObject();
25502550
Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0;
2551-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
2551+
#if RTS_CONFIGURABLE_SHROUD
25522552
ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);
25532553
#else
25542554
ObjectShroudStatus ss = (!obj) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain )
12551255
//-------------------------------------------------------------------------------------------------
12561256
void W3DRadar::clearShroud()
12571257
{
1258-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
1258+
#if RTS_CONFIGURABLE_SHROUD
12591259
if (!TheGlobalData->m_shroudOn)
12601260
return;
12611261
#endif
@@ -1275,7 +1275,7 @@ void W3DRadar::clearShroud()
12751275
//-------------------------------------------------------------------------------------------------
12761276
void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting)
12771277
{
1278-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
1278+
#if RTS_CONFIGURABLE_SHROUD
12791279
if (!TheGlobalData->m_shroudOn)
12801280
return;
12811281
#endif
@@ -1412,7 +1412,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height )
14121412
TheDisplay->drawImage( m_overlayImage, ul.x, ul.y, lr.x, lr.y );
14131413

14141414
// draw the shroud image
1415-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
1415+
#if RTS_CONFIGURABLE_SHROUD
14161416
if( TheGlobalData->m_shroudOn )
14171417
#else
14181418
if (true)

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ BaseHeightMapRenderObjClass::BaseHeightMapRenderObjClass(void)
320320
#ifdef DO_ROADS
321321
m_roadBuffer = NEW W3DRoadBuffer;
322322
#endif
323-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
323+
#if RTS_CONFIGURABLE_SHROUD
324324
if (TheGlobalData->m_shroudOn)
325325
m_shroud = NEW W3DShroud;
326326
#else

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ RTS3DScene::RTS3DScene()
105105
m_scratchLight = NEW_REF( LightClass, (LightClass::DIRECTIONAL) );
106106
// REF_PTR_SET(m_globalLight[lightIndex], pLight);
107107

108-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
108+
#if RTS_CONFIGURABLE_SHROUD
109109
if (TheGlobalData->m_shroudOn)
110110
m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,());
111111
else
@@ -790,7 +790,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I
790790

791791
if (drawInfo)
792792
{
793-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
793+
#if RTS_CONFIGURABLE_SHROUD
794794
if (!TheGlobalData->m_shroudOn)
795795
ss = OBJECTSHROUD_CLEAR;
796796
#endif

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ static void drawablePostDraw( Drawable *draw, void *userData )
994994

995995
Object* obj = draw->getObject();
996996
Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0;
997-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
997+
#if RTS_CONFIGURABLE_SHROUD
998998
ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);
999999
#else
10001000
ObjectShroudStatus ss = (!obj) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);

GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ BOOL CWorldBuilderApp::InitInstance()
433433
DEBUG_ASSERTCRASH(!TheGlobalData->m_useHalfHeightMap, ("TheGlobalData->m_useHalfHeightMap : Don't use this setting in WB."));
434434
TheWritableGlobalData->m_useHalfHeightMap = false;
435435

436-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
437-
// WB never uses the shroud.
436+
#if RTS_CONFIGURABLE_SHROUD
437+
// WB never uses the shroud. With shroud, terrain is black.
438438
TheWritableGlobalData->m_shroudOn = FALSE;
439439
#endif
440440

0 commit comments

Comments
 (0)