Skip to content
Closed
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 GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ThingFactory : public SubsystemInterface
/** request a new drawable using the given template.
this will throw an exception on failure; it will never return null.
*/
Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
Drawable *newDrawable(const ThingTemplate *tmplate, DrawableStatusInt statusBits = DRAWABLE_STATUS_DEFAULT );

static void parseObjectDefinition( INI* ini, const AsciiString& name, const AsciiString& reskinFrom );

Expand Down
9 changes: 6 additions & 3 deletions GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,17 @@ enum StealthLookType CPP_11(: Int)
// ------------------------------------------------------------------------------------------------
/** Drawable status bits */
// ------------------------------------------------------------------------------------------------
enum DrawableStatus CPP_11(: Int)
typedef UnsignedInt DrawableStatusInt;
enum DrawableStatus CPP_11(: DrawableStatusInt)
{
DRAWABLE_STATUS_NONE = 0x00000000, ///< no status
DRAWABLE_STATUS_DRAWS_IN_MIRROR = 0x00000001, ///< drawable can reflect
DRAWABLE_STATUS_SHADOWS = 0x00000002, ///< use setShadowsEnabled() access method
DRAWABLE_STATUS_TINT_COLOR_LOCKED = 0x00000004, ///< drawable tint color is "locked" and won't fade to normal
DRAWABLE_STATUS_NO_STATE_PARTICLES = 0x00000008, ///< do *not* auto-create particle systems based on model condition
DRAWABLE_STATUS_NO_SAVE = 0x00000010, ///< do *not* save this drawable (UI fluff only). ignored (error, actually) if attached to an object

DRAWABLE_STATUS_DEFAULT = DRAWABLE_STATUS_SHADOWS,
};

enum TintStatus CPP_11(: Int)
Expand Down Expand Up @@ -291,7 +294,7 @@ class Drawable : public Thing,

public:

Drawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
Drawable( const ThingTemplate *thing, DrawableStatusInt statusBits = DRAWABLE_STATUS_DEFAULT );

void onDestroy( void ); ///< run from GameClient::destroyDrawable
void onLevelStart(); ///< run from GameLogic::startNewGame
Expand Down Expand Up @@ -669,7 +672,7 @@ class Drawable : public Thing,

DynamicAudioEventInfo *m_customSoundAmbientInfo; ///< If not NULL, info about the ambient sound to attach to this object

UnsignedInt m_status; ///< status bits (see DrawableStatus enum)
DrawableStatusInt m_status; ///< status bits (see DrawableStatus enum)
UnsignedInt m_tintStatus; ///< tint color status bits (see TintStatus enum)
UnsignedInt m_prevTintStatus;///< for edge testing with m_tintStatus

Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class GameClient : public SubsystemInterface,

virtual void iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr userFunc, void *userData ); ///< Calls userFunc for each drawable contained within the region

virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ) = 0;
virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusInt statusBits = DRAWABLE_STATUS_DEFAULT ) = 0;
virtual void destroyDrawable( Drawable *draw ); ///< Destroy the given drawable

virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec
}

//=============================================================================
Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatus statusBits)
Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatusInt statusBits)
{
if (tmplate == NULL)
throw ERROR_BAD_ARG;
Expand Down
9 changes: 8 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void Drawable::saturateRGB(RGBColor& color, Real factor)
* graphical side of a logical object, whereas GameLogic objects encapsulate
* behaviors and physics. */
//-------------------------------------------------------------------------------------------------
Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBits )
Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusInt statusBits )
: Thing( thingTemplate )
{

Expand Down Expand Up @@ -493,6 +493,13 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit
(*m)->onObjectCreated();
}

// TheSuperHackers @bugfix Match the shadow states of all draw modules with this drawable.
const Bool shadowsEnabled = getShadowsEnabled();
for (DrawModule** dm = getDrawModules(); *dm; ++dm)
{
(*dm)->setShadowsEnabled(shadowsEnabled);
}

m_groupNumber = NULL;
m_captionDisplayString = NULL;
m_drawableInfo.m_drawable = this;
Expand Down
24 changes: 17 additions & 7 deletions GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,17 @@


// ------------------------------------------------------------------------------------------------
static const Real placementOpacity = 0.45f;
static const RGBColor illegalBuildColor = { 1.0, 0.0, 0.0 };

// TheSuperHackers @info Note that the placement objects no longer draw shadows after a bug was
// fixed in the drawable. If you want shadows, add it here, but beware that shadows on translucent
// models may look a bit odd.
static const UnsignedInt PlacementDrawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES;

// TheSuperHackers @tweak Changes the placement object opacity from 0.45 to increase its visibility
// because they no longer cast dark shadows and are less visible that way.
static const Real PlacementOpacity = 0.60f;

static const RGBColor IllegalBuildColor = { 1.0, 0.0, 0.0 };

//-------------------------------------------------------------------------------------------------
/// The InGameUI singleton instance.
Expand Down Expand Up @@ -1523,8 +1532,9 @@ void InGameUI::handleBuildPlacements( void )
BuildAssistant::IGNORE_STEALTHED,
builderObject,
NULL );

if( lbc != LBC_OK )
m_placeIcon[ 0 ]->colorTint( &illegalBuildColor );
m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor );
else
m_placeIcon[ 0 ]->colorTint( NULL );

Expand Down Expand Up @@ -1585,7 +1595,7 @@ void InGameUI::handleBuildPlacements( void )

if( m_placeIcon[ i ] == NULL )
m_placeIcon[ i ] = TheThingFactory->newDrawable( m_pendingPlaceType,
DRAWABLE_STATUS_NO_STATE_PARTICLES );
PlacementDrawableStatus );

}

Expand Down Expand Up @@ -1613,7 +1623,7 @@ void InGameUI::handleBuildPlacements( void )
m_placeIcon[ i ]->setPosition( &tileBuildInfo->positions[ i ] );

// set opacity for the drawble
m_placeIcon[ i ]->setDrawableOpacity( placementOpacity );
m_placeIcon[ i ]->setDrawableOpacity( PlacementOpacity );

// set the drawable angle
m_placeIcon[ i ]->setOrientation( angle );
Expand Down Expand Up @@ -3111,7 +3121,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD
// TheInGameUI->deselectAllDrawables();

// create a drawble of what we are building to be "attached" at the cursor
draw = TheThingFactory->newDrawable( build, DRAWABLE_STATUS_NO_STATE_PARTICLES );
draw = TheThingFactory->newDrawable( build, PlacementDrawableStatus );
if (sourceObject)
{
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
Expand All @@ -3136,7 +3146,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD
draw->setOrientation( angle );

// set the build icon attached to the cursor to be "see-thru"
draw->setDrawableOpacity( placementOpacity );
draw->setDrawableOpacity( PlacementOpacity );

// set the "icon" in the icon array at the first index
DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) {
// Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003]
// This way there is no logic object to slow down partition manager and core logic stuff.
Drawable *draw = TheThingFactory->newDrawable(thingTemplate, DRAWABLE_STATUS_NONE);
Drawable *draw = TheThingFactory->newDrawable(thingTemplate);
if (draw) {
draw->setOrientation(angle);
draw->setPosition( &pos );
Expand Down Expand Up @@ -1887,8 +1887,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
if (thingTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) {
// Opt trees and props just get drawables to tell the client about it, then deleted. jba [6/5/2003]
// This way there is no logic object to slow down partition manager and core logic stuff.

Drawable *draw = TheThingFactory->newDrawable(thingTemplate, DRAWABLE_STATUS_NONE);
Drawable *draw = TheThingFactory->newDrawable(thingTemplate);
if (draw) {
draw->setOrientation(angle);
draw->setPosition( &pos );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class W3DGameClient : public GameClient
virtual ~W3DGameClient();

/// given a type, create a drawable
virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusInt statusBits = DRAWABLE_STATUS_DEFAULT );

virtual void init( void ); ///< initialize resources
virtual void update( void ); ///< per frame update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void W3DGameClient::reset( void )
* in the GameLogic and GameClient themselves */
//-------------------------------------------------------------------------------------------------
Drawable *W3DGameClient::friend_createDrawable( const ThingTemplate *tmplate,
DrawableStatus statusBits )
DrawableStatusInt statusBits )
{
Drawable *draw = NULL;

Expand Down
Loading