Skip to content

Commit b8c0927

Browse files
committed
[ZH] Fix black terrain in World Builder without RTS_DEBUG
1 parent 8a73a6c commit b8c0927

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 ///////////////////////////////////////////////////////////////////////////
@@ -482,12 +481,14 @@ class GlobalData : public SubsystemInterface
482481
Bool m_TiVOFastMode; ///< When true, the client speeds up the framerate... set by HOTKEY!
483482

484483

484+
#if RTS_CONFIGURABLE_SHROUD
485+
Bool m_shroudOn;
486+
#endif
485487

486488
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
487489
Bool m_wireframe;
488490
Bool m_stateMachineDebug;
489491
Bool m_useCameraConstraints;
490-
Bool m_shroudOn;
491492
Bool m_fogOfWarOn;
492493
Bool m_jabberOn;
493494
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
@@ -723,7 +723,7 @@ Int parseNoFX(char *args[], int)
723723
return 1;
724724
}
725725

726-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
726+
#if RTS_CONFIGURABLE_SHROUD && (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
727727
Int parseNoShroud(char *args[], int)
728728
{
729729
TheWritableGlobalData->m_shroudOn = FALSE;
@@ -1244,6 +1244,11 @@ static CommandLineParam paramsForEngineInit[] =
12441244
// Number of frames between each CRC that is written to replay files in singleplayer games.
12451245
{ "-ReplayCRCInterval", parseReplayCRCInterval },
12461246
#endif
1247+
1248+
#if RTS_CONFIGURABLE_SHROUD && (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
1249+
{ "-noshroud", parseNoShroud },
1250+
#endif
1251+
12471252
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL))
12481253
{ "-saveAllStats", parseSaveAllStats },
12491254
{ "-noDraw", parseNoDraw },
@@ -1282,7 +1287,6 @@ static CommandLineParam paramsForEngineInit[] =
12821287
{ "-vTune", parseVTune },
12831288
{ "-selectTheUnselectable", parseSelectAll },
12841289
{ "-RunAhead", parseRunAhead },
1285-
{ "-noshroud", parseNoShroud },
12861290
{ "-forceBenchmark", parseForceBenchmark },
12871291
{ "-buildmapcache", parseBuildMapCache },
12881292
{ "-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
@@ -657,7 +657,7 @@ void GameClient::update( void )
657657

658658
if (!freezeTime)
659659
{
660-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
660+
#if RTS_CONFIGURABLE_SHROUD
661661
if (TheGlobalData->m_shroudOn)
662662
#else
663663
if (true)
@@ -688,7 +688,7 @@ void GameClient::update( void )
688688
while (draw)
689689
{ // update() could free the Drawable, so go ahead and grab 'next'
690690
Drawable* next = draw->getNextDrawable();
691-
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
691+
#if RTS_CONFIGURABLE_SHROUD
692692
if (TheGlobalData->m_shroudOn)
693693
#else
694694
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

0 commit comments

Comments
 (0)