Skip to content

Commit 53c4a78

Browse files
authored
[GEN][ZH] Fix black terrain in World Builder without RTS_DEBUG (#1190)
1 parent a6f7655 commit 53c4a78

File tree

24 files changed

+52
-34
lines changed

24 files changed

+52
-34
lines changed

Core/GameEngine/Include/Common/GameDefines.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@
4040
#ifndef ENABLE_GAMETEXT_SUBSTITUTES
4141
#define ENABLE_GAMETEXT_SUBSTITUTES (1) // The code can provide substitute texts when labels and strings are missing in the STR or CSF translation file
4242
#endif
43+
44+
// Previously the configurable shroud sat behind #if defined(RTS_DEBUG)
45+
// Enable the configurable shroud to properly draw the terrain in World Builder without RTS_DEBUG compiled in.
46+
// Disable the configurable shroud to make shroud hacking a bit less accessible in Release game builds.
47+
#ifndef ENABLE_CONFIGURABLE_SHROUD
48+
#define ENABLE_CONFIGURABLE_SHROUD (1) // When enabled, the GlobalData contains a field to turn on/off the shroud, otherwise shroud is always enabled
49+
#endif

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

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

5353
// ----------------------------------------------------------------------------------------------
5454
#include "Lib/BaseType.h"
55+
#include "Common/GameDefines.h"
5556

5657
// ----------------------------------------------------------------------------------------------
5758
#if defined(RTS_DEBUG)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,16 @@ class GlobalData : public SubsystemInterface
465465
Int m_playStats; ///< Int whether we want to log play stats or not, if <= 0 then we don't log
466466

467467
Bool m_TiVOFastMode; ///< When true, the client speeds up the framerate... set by HOTKEY!
468-
469468

469+
#if defined(RTS_DEBUG) || ENABLE_CONFIGURABLE_SHROUD
470+
Bool m_shroudOn;
471+
#endif
470472

471473
#if defined(RTS_DEBUG)
472474
Bool m_wireframe;
473475
Bool m_stateMachineDebug;
474476
Bool m_useCameraConstraints;
475477
Bool m_specialPowerUsesDelay;
476-
Bool m_shroudOn;
477478
Bool m_fogOfWarOn;
478479
Bool m_jabberOn;
479480
Bool m_munkeeOn;

Generals/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"

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ Int parseNoFX(char *args[], int)
718718
return 1;
719719
}
720720

721-
#if defined(RTS_DEBUG)
721+
#if defined(RTS_DEBUG) && ENABLE_CONFIGURABLE_SHROUD
722722
Int parseNoShroud(char *args[], int)
723723
{
724724
TheWritableGlobalData->m_shroudOn = FALSE;
@@ -1277,7 +1277,9 @@ static CommandLineParam paramsForEngineInit[] =
12771277
{ "-vTune", parseVTune },
12781278
{ "-selectTheUnselectable", parseSelectAll },
12791279
{ "-RunAhead", parseRunAhead },
1280+
#if ENABLE_CONFIGURABLE_SHROUD
12801281
{ "-noshroud", parseNoShroud },
1282+
#endif
12811283
{ "-forceBenchmark", parseForceBenchmark },
12821284
{ "-buildmapcache", parseBuildMapCache },
12831285
{ "-noshadowvolumes", parseNoShadows },

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,14 @@ GlobalData::GlobalData()
545545

546546
m_TiVOFastMode = FALSE;
547547

548+
#if defined(RTS_DEBUG) || ENABLE_CONFIGURABLE_SHROUD
549+
m_shroudOn = TRUE;
550+
#endif
551+
548552
#if defined(RTS_DEBUG)
549553
m_wireframe = 0;
550554
m_stateMachineDebug = FALSE;
551555
m_useCameraConstraints = TRUE;
552-
m_shroudOn = TRUE;
553556
m_fogOfWarOn = FALSE;
554557
m_jabberOn = FALSE;
555558
m_munkeeOn = FALSE;

Generals/Code/GameEngine/Source/GameClient/GameClient.cpp

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

615615
if (!freezeTime)
616616
{
617-
#if defined(RTS_DEBUG)
617+
#if ENABLE_CONFIGURABLE_SHROUD
618618
if (TheGlobalData->m_shroudOn)
619619
#else
620620
if (true)
@@ -645,7 +645,7 @@ void GameClient::update( void )
645645
while (draw)
646646
{ // update() could free the Drawable, so go ahead and grab 'next'
647647
Drawable* next = draw->getNextDrawable();
648-
#if defined(RTS_DEBUG)
648+
#if ENABLE_CONFIGURABLE_SHROUD
649649
if (TheGlobalData->m_shroudOn)
650650
#else
651651
if (true)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ void InGameUI::createCommandHint( const GameMessage *msg )
24832483
{
24842484
const Object* obj = draw->getObject();
24852485
Int localPlayerIndex = ThePlayerList ? ThePlayerList->getLocalPlayer()->getPlayerIndex() : 0;
2486-
#if defined(RTS_DEBUG)
2486+
#if ENABLE_CONFIGURABLE_SHROUD
24872487
ObjectShroudStatus ss = (!obj || !TheGlobalData->m_shroudOn) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);
24882488
#else
24892489
ObjectShroudStatus ss = (!obj) ? OBJECTSHROUD_CLEAR : obj->getShroudedStatus(localPlayerIndex);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain )
12631263
//-------------------------------------------------------------------------------------------------
12641264
void W3DRadar::clearShroud()
12651265
{
1266-
#if defined(RTS_DEBUG)
1266+
#if ENABLE_CONFIGURABLE_SHROUD
12671267
if (!TheGlobalData->m_shroudOn)
12681268
return;
12691269
#endif
@@ -1283,7 +1283,7 @@ void W3DRadar::clearShroud()
12831283
//-------------------------------------------------------------------------------------------------
12841284
void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting)
12851285
{
1286-
#if defined(RTS_DEBUG)
1286+
#if ENABLE_CONFIGURABLE_SHROUD
12871287
if (!TheGlobalData->m_shroudOn)
12881288
return;
12891289
#endif
@@ -1420,7 +1420,7 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height )
14201420
TheDisplay->drawImage( m_overlayImage, ul.x, ul.y, lr.x, lr.y );
14211421

14221422
// draw the shroud image
1423-
#if defined(RTS_DEBUG)
1423+
#if ENABLE_CONFIGURABLE_SHROUD
14241424
if( TheGlobalData->m_shroudOn )
14251425
#else
14261426
if (true)

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

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

102-
#if defined(RTS_DEBUG)
102+
#if ENABLE_CONFIGURABLE_SHROUD
103103
if (TheGlobalData->m_shroudOn)
104104
m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,());
105105
else
@@ -753,7 +753,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I
753753

754754
if (drawInfo)
755755
{
756-
#if defined(RTS_DEBUG)
756+
#if ENABLE_CONFIGURABLE_SHROUD
757757
if (!TheGlobalData->m_shroudOn)
758758
ss = OBJECTSHROUD_CLEAR;
759759
#endif

0 commit comments

Comments
 (0)