Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.

This commit is contained in:
LFeenanEA
2025-02-27 17:34:39 +00:00
parent 2e338c00cb
commit 3d0ee53a05
6072 changed files with 2283311 additions and 0 deletions

View File

@@ -0,0 +1,225 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Anim2D.h /////////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, July 2002
// Desc: A collection of 2D images to make animation
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __ANIM_2D_H_
#define __ANIM_2D_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/Snapshot.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class Image;
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
enum Anim2DMode
{
ANIM_2D_INVALID = 0,
ANIM_2D_ONCE,
ANIM_2D_ONCE_BACKWARDS,
ANIM_2D_LOOP,
ANIM_2D_LOOP_BACKWARDS,
ANIM_2D_PING_PONG,
ANIM_2D_PING_PONG_BACKWARDS,
// dont' forget to add new animation mode names to Anim2DModeNames[] below
ANIM_2D_NUM_MODES // keep this last please
};
#ifdef DEFINE_ANIM_2D_MODE_NAMES
static char *Anim2DModeNames[] =
{
"NONE",
"ONCE",
"ONCE_BACKWARDS",
"LOOP",
"LOOP_BACKWARDS",
"PING_PONG",
"PING_PONG_BACKWARDS",
NULL
};
#endif
// ------------------------------------------------------------------------------------------------
/** A template of a 2D animation */
// ------------------------------------------------------------------------------------------------
class Anim2DTemplate : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(Anim2DTemplate, "Anim2DTemplate")
public:
Anim2DTemplate( AsciiString name );
//virtual ~Anim2DTemplate( void );
AsciiString getName( void ) const { return m_name; }
const Image *getFrame( UnsignedShort frameNumber ) const;
UnsignedShort getNumFrames( void ) const { return m_numFrames; }
UnsignedShort getNumFramesBetweenUpdates( void ) const { return m_framesBetweenUpdates; }
Anim2DMode getAnimMode( void ) const { return m_animMode; }
Bool isRandomizedStartFrame( void ) const { return m_randomizeStartFrame; }
// list access for use by the Anim2DCollection only
void friend_setNextTemplate( Anim2DTemplate *animTemplate ) { m_nextTemplate = animTemplate; }
Anim2DTemplate *friend_getNextTemplate( void ) const { return m_nextTemplate; };
// INI methods
const FieldParse *getFieldParse( void ) const { return s_anim2DFieldParseTable; }
void storeImage( const Image *image ); ///< store image in next available slot
void allocateImages( UnsignedShort numFrames ); ///< allocate the array of image pointers to use
protected:
static void parseImage( INI *ini, void *instance, void *store, const void *userData );
static void parseNumImages( INI *ini, void *instance, void *store, const void *userData );
static void parseImageSequence( INI *ini, void *instance, void *store, const void *userData );
protected:
enum { NUM_FRAMES_INVALID = 0 }; ///< initialization value for num frames
Anim2DTemplate* m_nextTemplate; ///< next animation in collections animation list
AsciiString m_name; ///< name of this 2D animation
const Image** m_images; ///< array of image pointers that make up this animation
UnsignedShort m_numFrames; ///< total number of frames in this animation
UnsignedShort m_framesBetweenUpdates; ///< frames between frame updates
Anim2DMode m_animMode; ///< the animation mode
Bool m_randomizeStartFrame; ///< randomize animation instance start frames
protected:
static const FieldParse s_anim2DFieldParseTable[]; ///< the parse table for INI definition
};
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
enum Anim2DStatus
{
ANIM_2D_STATUS_NONE = 0x00,
ANIM_2D_STATUS_FROZEN = 0x01,
ANIM_2D_STATUS_REVERSED = 0x02, // used for ping pong direction tracking
ANIM_2D_STATUS_COMPLETE = 0x04, // set when uni-directional things reach their last frame
};
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
class Anim2D : public MemoryPoolObject,
public Snapshot
{
friend class Anim2DCollection;
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Anim2D, "Anim2D" );
public:
Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem );
// virtual destructor prototype provided by memory pool object
UnsignedShort getCurrentFrame( void ) const { return m_currentFrame; } ///< get our current frame #
void setCurrentFrame( UnsignedShort frame ); ///< set the current frame #
void randomizeCurrentFrame( void ); ///< randomize the current frame #
void reset( void ); ///< reset the current frame to the "start"
void setStatus( UnsignedByte statusBits ); ///< set status bit(s)
void clearStatus( UnsignedByte statusBits ); ///< clear status bit(s)
UnsignedByte getStatus( void ) const { return m_status; } ///< return status bits(s)
void setAlpha( Real alpha ) { m_alpha = alpha; } ///< set alpha value
Real getAlpha( void ) const { return m_alpha; } ///< return the current alpha value
//Allows you to play a segment of an animation.
void setMinFrame( UnsignedShort frame ) { m_minFrame = frame; }
void setMaxFrame( UnsignedShort frame ) { m_maxFrame = frame; }
// info about the size of the current frame
UnsignedInt getCurrentFrameWidth( void ) const; ///< return natural width of image in the current frame
UnsignedInt getCurrentFrameHeight( void ) const; ///< return natural height of image in the current frame
const Anim2DTemplate *getAnimTemplate( void ) const { return m_template; } ///< return our template
void draw( Int x, Int y ); ///< draw iamge at location using natural width/height
void draw( Int x, Int y, Int width, Int height ); ///< draw image at location using forced width/height
protected:
// snapshot methods
virtual void crc( Xfer *xfer ) { }
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void ) { }
void tryNextFrame( void ); ///< we've just drawn ... try to update our frame if necessary
UnsignedShort m_currentFrame; ///< current frame of our animation
UnsignedInt m_lastUpdateFrame; ///< last frame we updated on
Anim2DTemplate *m_template; ///< pointer back to the template that defines this animation
UnsignedByte m_status; ///< status bits (see Anim2DStatus)
UnsignedShort m_minFrame; ///< min animation frame used inclusively.
UnsignedShort m_maxFrame; ///< max animation frame used inclusively.
UnsignedInt m_framesBetweenUpdates; ///< duration between each frame.
Real m_alpha;
Anim2DCollection *m_collectionSystem; ///< system collection (if any) we're registered with
Anim2D *m_collectionSystemNext; ///< system instance tracking list
Anim2D *m_collectionSystemPrev; ///< system instance tracking list
};
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
class Anim2DCollection : public SubsystemInterface
{
public:
Anim2DCollection( void );
virtual ~Anim2DCollection( void );
virtual void init( void ); ///< initialize system
virtual void reset( void ) { }; ///< reset system
virtual void update( void ); ///< update system
Anim2DTemplate *findTemplate( const AsciiString& name ); ///< find animation template
Anim2DTemplate *newTemplate( const AsciiString& name ); ///< allocate a new template to be loaded
void registerAnimation( Anim2D *anim ); ///< register animation with system
void unRegisterAnimation( Anim2D *anim ); ///< un-register animation from system
Anim2DTemplate* getTemplateHead() const { return m_templateList; }
Anim2DTemplate* getNextTemplate( Anim2DTemplate *animTemplate ) const;
protected:
Anim2DTemplate *m_templateList; ///< list of available animation templates
Anim2D *m_instanceList; ///< list of all the anim 2D instance we're tracking
};
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern Anim2DCollection *TheAnim2DCollection;
#endif // end __ANIM_2D_H_

View File

@@ -0,0 +1,228 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: AnimateWindowManager.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Mar 2002
//
// Filename: AnimateWindowManager.h
//
// author: Chris Huybregts
//
// purpose: The Animate Window class will be used by registering a window with
// the manager with stating what kind of animation to do. Then on every
// update, we'll move the windows.
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __ANIMATEWINDOWMANAGER_H_
#define __ANIMATEWINDOWMANAGER_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
#include "Common/GameMemory.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class GameWindow;
class ProcessAnimateWindowSlideFromBottom;
class ProcessAnimateWindowSlideFromBottomTimed;
class ProcessAnimateWindowSlideFromTop;
class ProcessAnimateWindowSlideFromLeft;
class ProcessAnimateWindowSlideFromRight;
class ProcessAnimateWindowSlideFromRightFast;
class ProcessAnimateWindowSpiral;
class ProcessAnimateWindowSlideFromTopFast;
class ProcessAnimateWindowSideSelect;
class ProcessAnimateWindow;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
enum AnimTypes
{
WIN_ANIMATION_NONE = 0,
WIN_ANIMATION_SLIDE_RIGHT,
WIN_ANIMATION_SLIDE_RIGHT_FAST,
WIN_ANIMATION_SLIDE_LEFT,
WIN_ANIMATION_SLIDE_TOP,
WIN_ANIMATION_SLIDE_BOTTOM,
WIN_ANIMATION_SPIRAL,
WIN_ANIMATION_SLIDE_BOTTOM_TIMED,
WIN_ANIMATION_SLIDE_TOP_FAST,
WIN_ANIMATION_COUNT
} ;
//-----------------------------------------------------------------------------
class AnimateWindow : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AnimateWindow, "AnimateWindow")
public:
AnimateWindow( void );
//~AnimateWindow( void );
void setAnimData( ICoord2D startPos, ICoord2D endPos, ICoord2D curPos, ICoord2D restPos, Coord2D vel, UnsignedInt startTime, UnsignedInt endTime);
ICoord2D getStartPos( void ); ///< Get the Start Position 2D coord
ICoord2D getCurPos( void ); ///< Get the Current Position 2D coord
ICoord2D getEndPos( void ); ///< Get the End Position 2D coord
ICoord2D getRestPos( void ); ///< Get the Rest Position 2D coord
GameWindow *getGameWindow( void ); ///< Get the GameWindow that will be animating
AnimTypes getAnimType( void ); ///< Get the Animation type
UnsignedInt getDelay( void ); ///< Get the Time Delay
Coord2D getVel( void ); ///< Get the Velocity Position 2D coord
UnsignedInt getStartTime( void ); ///< Get the start time of the time-based anim
UnsignedInt getEndTime( void ); ///< Get the end time of the time-based anim
void setStartPos( ICoord2D starPos); ///< Set the Start Position 2D coord
void setCurPos( ICoord2D curPos); ///< Set the Current Position 2D coord
void setEndPos( ICoord2D endPos); ///< Set the End Position 2D coord
void setRestPos( ICoord2D restPos); ///< Set the Rest Position 2D coord
void setGameWindow( GameWindow *win); ///< Set the GameWindow that will be animating
void setAnimType( AnimTypes animType); ///< Set the Animation type
void setDelay( UnsignedInt delay); ///< Set the Time Delay
void setVel( Coord2D vel); ///< Set the Velocity Position 2D coord
void setStartTime( UnsignedInt t); ///< Set the start time of the time-based anim
void setEndTime( UnsignedInt t); ///< Set the end time of the time-based anim
void setFinished(Bool finished); ///< Set if the animation has finished
Bool isFinished( void ); ///< Return if the animation has finished or not.
void setNeedsToFinish( Bool needsToFinish); ///< set if we need this animation to finish for the manager to return true
Bool needsToFinish( void ); ///< set if the animation has finished
private:
UnsignedInt m_delay; ///< Holds the delay time in which the animation will start (in milliseconds)
ICoord2D m_startPos; ///< Holds the starting position of the animation
///<(usuall is also the end position of the animation when the animation is reversed)
ICoord2D m_endPos; ///< Holds the target End Position (usually is the same as the rest position)
ICoord2D m_curPos; ///< It's Current Position
ICoord2D m_restPos; ///< When the Manager Resets, It sets the window's position to this position
GameWindow *m_win; ///< the window that this animation is happening on
Coord2D m_vel; ///< the Velocity of the animation
UnsignedInt m_startTime; ///< time we started the time-based anim
UnsignedInt m_endTime; ///< time we should end the time-based anim
AnimTypes m_animType; ///< The type of animation that will happen
Bool m_needsToFinish; ///< Flag to tell the manager if we need to finish before it's done with it's animation
Bool m_isFinished; ///< We're finished
};
//-----------------------------------------------------------------------------
typedef std::list<AnimateWindow *> AnimateWindowList;
//-----------------------------------------------------------------------------
class AnimateWindowManager : public SubsystemInterface
{
public:
AnimateWindowManager( void );
~AnimateWindowManager( void );
// Inhertited from subsystem ====================================================================
virtual void init( void );
virtual void reset( void );
virtual void update( void );
//===============================================================================================
void registerGameWindow(GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt ms = 0, UnsignedInt delayMs = 0); // Registers a new window to animate.
Bool isFinished( void ); ///< Are all the animations that need to be finished, finished?
void reverseAnimateWindow( void ); ///< tell each animation type to setup the windows to run in reverse
void resetToRestPosition( void ); ///< Reset all windows to their rest position
Bool isReversed( void ); ///< Returns whether or not we're in our reversed state.
Bool isEmpty( void );
private:
AnimateWindowList m_winList; ///< A list of AnimationWindows that we don't care if their finished animating
AnimateWindowList m_winMustFinishList; ///< A list of AnimationWindows that we do care about
Bool m_needsUpdate; ///< If we're done animating all our monitored windows, then this will be false
Bool m_reverse; ///< Are we in a reverse state?
ProcessAnimateWindowSlideFromRight *m_slideFromRight; ///< Holds the process in which the windows slide from the right
ProcessAnimateWindowSlideFromRightFast *m_slideFromRightFast;
ProcessAnimateWindowSlideFromTop *m_slideFromTop; ///< Holds the process in which the windows slide from the Top
ProcessAnimateWindowSlideFromLeft *m_slideFromLeft; ///< Holds the process in which the windows slide from the Left
ProcessAnimateWindowSlideFromBottom *m_slideFromBottom; ///< Holds the process in which the windows slide from the Bottom
ProcessAnimateWindowSpiral *m_spiral; ///< Holds the process in which the windows Spiral onto the screen
ProcessAnimateWindowSlideFromBottomTimed *m_slideFromBottomTimed; ///< Holds the process in which the windows slide from the Bottom in a time-based fashion
ProcessAnimateWindowSlideFromTopFast *m_slideFromTopFast; ///< holds the process in wich the windows slide from the top,fast
ProcessAnimateWindow *getProcessAnimate( AnimTypes animType); ///< returns the process for the kind of animation we need.
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
inline ICoord2D AnimateWindow::getStartPos( void ) { return m_startPos; };
inline ICoord2D AnimateWindow::getCurPos( void ) { return m_curPos; };
inline ICoord2D AnimateWindow::getEndPos( void ) { return m_endPos; };
inline ICoord2D AnimateWindow::getRestPos( void ) { return m_restPos; };
inline GameWindow *AnimateWindow::getGameWindow( void ){ return m_win; };
inline AnimTypes AnimateWindow::getAnimType( void ) { return m_animType; };
inline UnsignedInt AnimateWindow::getDelay( void ) { return m_delay; };
inline Coord2D AnimateWindow::getVel( void ) { return m_vel; };
inline UnsignedInt AnimateWindow::getStartTime( void ) { return m_startTime; };
inline UnsignedInt AnimateWindow::getEndTime( void ) { return m_endTime; };
inline void AnimateWindow::setStartPos( ICoord2D startPos) { m_startPos = startPos; };
inline void AnimateWindow::setCurPos( ICoord2D curPos) { m_curPos = curPos; };
inline void AnimateWindow::setEndPos( ICoord2D endPos) { m_endPos = endPos; };
inline void AnimateWindow::setRestPos( ICoord2D restPos) { m_restPos = restPos; };
inline void AnimateWindow::setGameWindow( GameWindow *win) { m_win = win; };
inline void AnimateWindow::setAnimType( AnimTypes animType) { m_animType = animType; };
inline void AnimateWindow::setDelay( UnsignedInt delay) { m_delay = delay; };
inline void AnimateWindow::setVel( Coord2D vel) { m_vel = vel; };
inline void AnimateWindow::setStartTime( UnsignedInt t ) { m_startTime = t; }
inline void AnimateWindow::setEndTime( UnsignedInt t ) { m_endTime = t; }
inline void AnimateWindow::setFinished( Bool finished) { m_isFinished = finished; };
inline Bool AnimateWindow::isFinished( void ) { return m_isFinished; };
inline void AnimateWindow::setNeedsToFinish( Bool needsToFinish) { m_needsToFinish = needsToFinish; };
inline Bool AnimateWindow::needsToFinish( void ) { return m_needsToFinish; };
inline Bool AnimateWindowManager::isFinished( void ) { return !m_needsUpdate; };
inline Bool AnimateWindowManager::isReversed( void ) { return m_reverse; };
inline Bool AnimateWindowManager::isEmpty( void ){return (m_winList.size() == 0 && m_winMustFinishList.size() == 0); }
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __ANIMATEWINDOWMANAGER_H_

View File

@@ -0,0 +1,40 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: CDCheck.h ////////////////////////////////////////////////////////////////////////////////
// Author: Matt Campbell, January 2003
// Description: check for CD, popping up an in-game message box at game start.
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __CDCHECK_H_
#define __CDCHECK_H_
typedef void (*gameStartCallback) (void);
Bool IsFirstCDPresent(void);
void CheckForCDAtGameStart( gameStartCallback callback );
#endif //__CDCHECK_H_

View File

@@ -0,0 +1,168 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: CampaignManager.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Jul 2002
//
// Filename: CampaignManager.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __CAMPAIGN_MANAGER_H_
#define __CAMPAIGN_MANAGER_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Common/Snapshot.h"
#include "Common/AudioEventRTS.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AsciiString;
class Image;
enum{ MAX_OBJECTIVE_LINES = 5 };
enum{ MAX_DISPLAYED_UNITS = 3 };
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class Mission : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Mission, "Mission" )
public:
Mission( void );
//~Mission( void );
public:
AsciiString m_name;
AsciiString m_mapName;
AsciiString m_nextMission;
AsciiString m_movieLabel;
AsciiString m_missionObjectivesLabel[MAX_OBJECTIVE_LINES];
AudioEventRTS m_briefingVoice;
AsciiString m_locationNameLabel;
AsciiString m_unitNames[MAX_DISPLAYED_UNITS];
Int m_voiceLength;
};
class Campaign : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Campaign, "Campaign" )
public:
Campaign( void );
//~Campaign( void );
Mission *newMission( AsciiString name );
Mission *getNextMission( Mission *current);
Mission *getMission( AsciiString missionName);
AsciiString getFinalVictoryMovie( void );
public:
typedef std::list< Mission* > MissionList; ///< list of Shell Menu schemes
typedef MissionList::iterator MissionListIt;
AsciiString m_name;
AsciiString m_firstMission;
AsciiString m_campaignNameLabel; ///< campaign name label from string manager
MissionList m_missions;
AsciiString m_finalMovieName;
};
class CampaignManager : public Snapshot
{
public:
CampaignManager( void );
~CampaignManager( void );
// snapshot methods
virtual void crc( Xfer *xfer ) { }
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void ) { }
void init( void );
Campaign *getCurrentCampaign( void ); ///< Returns a point to the current Campaign
Mission *getCurrentMission( void ); ///< Returns a point to the current mission
Mission *gotoNextMission( void ); ///< Set the next mission as the current Mission, and returns a point to it
void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaing and Mission we're on
void setCampaign( AsciiString campaign ); ///< sets the campaign and set's it's first mission
AsciiString getCurrentMap( void ); ///< Get the map located in m_currentMission;
enum { INVALID_MISSION_NUMBER = -1 };
Int getCurrentMissionNumber( void ); ///< get mission number for the currently loaded level if we are in a campaign
const FieldParse *getFieldParse( void ) const { return m_campaignFieldParseTable; } ///< returns the parsing fields
static const FieldParse m_campaignFieldParseTable[]; ///< the parse table
static void parseMissionPart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the Mission Part
Campaign *newCampaign(AsciiString name);
Bool isVictorious( void ) { return m_victorious; }
void SetVictorious( Bool victory ) { m_victorious = victory; }
void setRankPoints( Int rankPoints ) { m_currentRankPoints = rankPoints; }
Int getRankPoints() const { return m_currentRankPoints; }
GameDifficulty getGameDifficulty() const { return m_difficulty; }
void setGameDifficulty(GameDifficulty d) { m_difficulty = d; }
private:
typedef std::list< Campaign* > CampaignList; ///< list of Shell Menu schemes
typedef CampaignList::iterator CampaignListIt;
CampaignList m_campaignList; ///< Our List of Campaigns
Campaign *m_currentCampaign; ///< Our current Campaign
Mission *m_currentMission; ///< our Current Mission
Bool m_victorious;
Int m_currentRankPoints;
GameDifficulty m_difficulty;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
extern CampaignManager *TheCampaignManager;
#endif // __CAMPAIGN_MANAGER_H_

View File

@@ -0,0 +1,95 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// ClientRandomValue.h
// Random number generation system
// Author: Michael S. Booth, January 1998
// Split out into separate Logic/Client/Audio headers by MDC Sept 2002
#pragma once
#ifndef _CLIENT_RANDOM_VALUE_H_
#define _CLIENT_RANDOM_VALUE_H_
#include "Lib/BaseType.h"
// do NOT use these functions directly, rather use the macros below
extern Int GetGameClientRandomValue( int lo, int hi, char *file, int line );
extern Real GetGameClientRandomValueReal( Real lo, Real hi, char *file, int line );
// use these macros to access the random value functions
#define GameClientRandomValue( lo, hi ) GetGameClientRandomValue( lo, hi, __FILE__, __LINE__ )
#define GameClientRandomValueReal( lo, hi ) GetGameClientRandomValueReal( lo, hi, __FILE__, __LINE__ )
//--------------------------------------------------------------------------------------------------------------
class CColorAlphaDialog;
class DebugWindowDialog;
/**
* A GameClientRandomVariable represents a distribution of random values
* from which discrete values can be retrieved.
*/
class GameClientRandomVariable
{
public:
// NOTE: This class cannot have a constructor or destructor due to its use within unions
/**
* CONSTANT represents a single, constant, value.
* UNIFORM represents a uniform distribution of random values.
* GAUSSIAN represents a normally distributed set of random values.
* TRIANGULAR represents a distribution of random values in the shape
* of a triangle, with the peak probability midway between low and high.
* LOW_BIAS represents a distribution of random values with
* maximum probability at low, and zero probability at high.
* HIGH_BIAS represents a distribution of random values with
* zero probability at low, and maximum probability at high.
*/
enum DistributionType
{
CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS
};
static const char *DistributionTypeNames[];
/// define the range of random values, and the distribution of values
void setRange( Real low, Real high, DistributionType type = UNIFORM );
Real getValue( void ) const; ///< return a value from the random distribution
inline Real getMinimumValue( void ) const { return m_low; }
inline Real getMaximumValue( void ) const { return m_high; }
inline DistributionType getDistributionType( void ) const { return m_type; }
protected:
DistributionType m_type; ///< the kind of random distribution
Real m_low, m_high; ///< the range of random values
// These two friends are for particle editing.
friend CColorAlphaDialog;
friend DebugWindowDialog;
};
//--------------------------------------------------------------------------------------------------------------
#endif // _CLIENT_RANDOM_VALUE_H_

View File

@@ -0,0 +1,84 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Color.h //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: Color.h
//
// Created: Colin Day, July 2001
//
// Desc: Management of color representations
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __COLOR_H_
#define __COLOR_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
enum { GAME_COLOR_UNDEFINED = 0x00FFFFFF }; // this is white with zero alpha... safe to use!
/** @todo we need real color representation, this is just palce holder so we
can more easily identify sections of the code that need it */
typedef Int Color;
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
inline Color GameMakeColor( UnsignedByte red, UnsignedByte green, UnsignedByte blue, UnsignedByte alpha )
{
return (alpha << 24) | (red << 16) | (green << 8) | (blue);
}
extern void GameGetColorComponents( Color color,
UnsignedByte *red,
UnsignedByte *green,
UnsignedByte *blue,
UnsignedByte *alpha );
extern void GameGetColorComponentsReal( Color color, Real *red, Real *green, Real *blue, Real *alpha );
extern Color GameDarkenColor( Color color, Int percent = 10 );
#endif // __COLOR_H_

View File

@@ -0,0 +1,128 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: CommandXlat.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_CommandXlat
#define _H_CommandXlat
#include "GameClient/InGameUI.h"
enum GUICommandType;
//-----------------------------------------------------------------------------
class CommandTranslator : public GameMessageTranslator
{
public:
CommandTranslator();
~CommandTranslator();
enum CommandEvaluateType { DO_COMMAND, DO_HINT, EVALUATE_ONLY };
GameMessage::Type evaluateForceAttack( Drawable *draw, const Coord3D *pos, CommandEvaluateType type );
GameMessage::Type evaluateContextCommand( Drawable *draw, const Coord3D *pos, CommandEvaluateType type );
private:
Int m_objective;
Bool m_teamExists; ///< is there a currently selected "team"?
// these are for determining if a drag occurred or it wasjust a sloppy click
ICoord2D m_mouseRightDragAnchor; // the location of a possible mouse drag start
ICoord2D m_mouseRightDragLift; // the location of a possible mouse drag end
UnsignedInt m_mouseRightDown; // when the mouse down happened
UnsignedInt m_mouseRightUp; // when the mouse up happened
GameMessage::Type createMoveToLocationMessage( Drawable *draw, const Coord3D *dest, CommandEvaluateType commandType );
GameMessage::Type createAttackMessage( Drawable *draw, Drawable *other, CommandEvaluateType commandType );
GameMessage::Type createEnterMessage( Drawable *enter, CommandEvaluateType commandType );
GameMessage::Type issueMoveToLocationCommand( const Coord3D *pos, Drawable *drawableInWay, CommandEvaluateType commandType );
GameMessage::Type issueAttackCommand( Drawable *target, CommandEvaluateType commandType, GUICommandType command = (GUICommandType)0 );
GameMessage::Type issueSpecialPowerCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos, Object* ignoreSelObj );
GameMessage::Type issueFireWeaponCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos );
GameMessage::Type issueCombatDropCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos );
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
};
enum FilterTypes
{
FT_NULL_FILTER=0,
// The following are screen filter shaders, that modify the rendered viewport after it is drawn.
FT_VIEW_BW_FILTER, //filter to apply a black & white filter to the screen.
FT_VIEW_MOTION_BLUR_FILTER, //filter to apply motion blur filter to screen.
FT_VIEW_CROSSFADE, ///<filter to apply a cross blend between previous/current views.
FT_MAX
};
enum FilterModes
{
FM_NULL_MODE = 0,
// These apply to FT_VIEW_BW_FILTER
FM_VIEW_BW_BLACK_AND_WHITE, // BW Filter to black & white
FM_VIEW_BW_RED_AND_WHITE, // BW Filter to red & white
FM_VIEW_BW_GREEN_AND_WHITE, // BW Filter to green & white
// These apply to FT_VIEW_CROSSFADE
FM_VIEW_CROSSFADE_CIRCLE, // Fades from previous to current view using expanding circle.
FM_VIEW_CROSSFADE_FB_MASK, // Fades from previous to current using mask stored in framebuffer alpha.
// These apply to FT_VIEW_MOTION_BLUR_FILTER
FM_VIEW_MB_IN_AND_OUT_ALPHA, // Motion blur filter in and out alpha blur
FM_VIEW_MB_IN_AND_OUT_SATURATE, // Motion blur filter in and out saturated blur
FM_VIEW_MB_IN_ALPHA, // Motion blur filter in alpha blur
FM_VIEW_MB_OUT_ALPHA, // Motion blur filter out alpha blur
FM_VIEW_MB_IN_SATURATE, // Motion blur filter in saturated blur
FM_VIEW_MB_OUT_SATURATE, // Motion blur filter out saturated blur
FM_VIEW_MB_END_PAN_ALPHA, // Moton blur on screen pan (for camera tracks object mode)
// NOTE: This has to be the last entry in this enum.
// Add new entries before this one. jba.
FM_VIEW_MB_PAN_ALPHA, // Moton blur on screen pan (for camera tracks object mode)
};
class PickAndPlayInfo
{
public:
PickAndPlayInfo::PickAndPlayInfo(); //INITIALIZE THE CONSTRUCTOR IN CPP
Bool m_air; //Are we attacking an airborned target?
Drawable *m_drawTarget; //Do we have an override draw target?
WeaponSlotType *m_weaponSlot; //Are we forcing a specific weapon slot? NULL if unspecified.
SpecialPowerType m_specialPowerType; //Which special power are use using? SPECIAL_INVALID if unspecified.
};
extern void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type msgType, PickAndPlayInfo *info = NULL );
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,107 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: ControlBarResizer.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Sep 2002
//
// Filename: ControlBarResizer.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __CONTROL_BAR_RESIZER_H_
#define __CONTROL_BAR_RESIZER_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class ResizerWindow
{
public:
ResizerWindow( void );
AsciiString m_name;
ICoord2D m_defaultSize;
ICoord2D m_defaultPos;
ICoord2D m_altSize;
ICoord2D m_altPos;
};
class ControlBarResizer
{
public:
ControlBarResizer( void );
~ControlBarResizer( void );
void init( void );
// parse Functions for the INI file
const FieldParse *getFieldParse() const { return m_controlBarResizerParseTable; } ///< returns the parsing fields
static const FieldParse m_controlBarResizerParseTable[]; ///< the parse table
ResizerWindow *findResizerWindow( AsciiString name ); ///< attempt to find the control bar scheme by it's name
ResizerWindow *newResizerWindow( AsciiString name ); ///< create a new control bar scheme and return it.
void sizeWindowsDefault( void );
void sizeWindowsAlt( void );
typedef std::list< ResizerWindow *> ResizerWindowList;
ResizerWindowList m_resizerWindowsList;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __CONTROL_BAR_RESIZER_H_

View File

@@ -0,0 +1,291 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: ControlBarScheme.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Apr 2002
//
// Filename: ControlBarScheme.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __CONTROL_BAR_SCHEME_H_
#define __CONTROL_BAR_SCHEME_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "GameClient/Color.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AsciiString;
class playerTemplate;
class Image;
enum TimeOfDay;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#define MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS 6
#define CONTROL_BAR_SCHEME_FOREGROUND_IMAGE_LAYERS 3
// Class that holds the images the control bar will draw
//-----------------------------------------------------------------------------
class ControlBarSchemeImage
{
public:
ControlBarSchemeImage( void );
~ControlBarSchemeImage( void );
AsciiString m_name; ///< Name of the image
ICoord2D m_position; ///< the position we'll draw it at
ICoord2D m_size; ///< the size of the image needed when we draw it
Image *m_image; ///< the actual pointer to the mapped image
// m_layer is where the image will get drawn, everything in layer 0-2 gets drawn during the forground draw
// the layers 3-5 gets drawn during the background draw
Int m_layer; //layer means how deep the image will be drawn, it's a number between 0-5 with 0 being on top
};
// Class that will hold the information needed for the animations
//-----------------------------------------------------------------------------
class ControlBarSchemeAnimation
{
public:
ControlBarSchemeAnimation( void );
~ControlBarSchemeAnimation( void );
/// Enum that will contain all the kinds of animations we have... make sure in ControlBarScheme.cpp there's a
/// mapping for it for the INI translation
enum
{
CB_ANIM_SLIDE_RIGHT = 0,
CB_ANIM_MAX
};
AsciiString m_name; ///< Current animation name
Int m_animType; ///< Type of animation that this will follow
ControlBarSchemeImage *m_animImage; ///< Pointer of the image that this animation will act on
UnsignedInt m_animDuration; ///< Contians how long the animation should take based off game frames
ICoord2D m_finalPos; ///< The final position when we hit the m_animDuration frame
UnsignedInt getCurrentFrame(void) { return m_currentFrame; }
void setCurrentFrame( UnsignedInt currentFrame ) { m_currentFrame = currentFrame; }
ICoord2D getStartPos( void ) { return m_startPos; }
void setStartPos(ICoord2D startPos) { m_startPos = startPos; }
private:
ICoord2D m_startPos; ///< set when we first begin an animation
UnsignedInt m_currentFrame; ///< This is the last frame (a value between 0 and m_animDuration)
};
// Class that each scheme will have. Contains all information about that scheme
//-----------------------------------------------------------------------------
class ControlBarScheme
{
public:
ControlBarScheme( void );
~ControlBarScheme( void );
void init( void );
void update( void );
void drawForeground( Coord2D multi, ICoord2D offset ); ///< draw function to be called within a w3d draw procedure for the foreground
void drawBackground( Coord2D multi, ICoord2D offset ); ///< draw function to be called within a w3d draw procedure for the background
void reset( void );
void addAnimation( ControlBarSchemeAnimation *schemeAnim );
void addImage( ControlBarSchemeImage *schemeImage);
void updateAnim (ControlBarSchemeAnimation * anim);
AsciiString m_name; ///< it's name
ICoord2D m_ScreenCreationRes; ///< Used to determine what screen res this will look the best on
AsciiString m_side; ///< contain what faction type this command bar was made for (used when selecting command bar by template
Image *m_buttonQueueImage; ///< We'll probably want each one to have it's own image.
Image *m_rightHUDImage; ///< We'll probably want each one to have it's own right HUD image.
Color m_buildUpClockColor; ///< we can setup the color for the buildup clock if we want
Color m_borderBuildColor; ///< we can setup the color for the button border colors
Color m_borderActionColor; ///< we can setup the color for the button border colors
Color m_borderUpgradeColor; ///< we can setup the color for the button border colors
Color m_borderSystemColor; ///< we can setup the color for the button border colors
Color m_commandBarBorderColor;
Image *m_optionsButtonEnable;
Image *m_optionsButtonHightlited;
Image *m_optionsButtonPushed;
Image *m_optionsButtonDisabled;
Image *m_idleWorkerButtonEnable;
Image *m_idleWorkerButtonHightlited;
Image *m_idleWorkerButtonPushed;
Image *m_idleWorkerButtonDisabled;
Image *m_buddyButtonEnable;
Image *m_buddyButtonHightlited;
Image *m_buddyButtonPushed;
Image *m_buddyButtonDisabled;
Image *m_beaconButtonEnable;
Image *m_beaconButtonHightlited;
Image *m_beaconButtonPushed;
Image *m_beaconButtonDisabled;
Image *m_genBarButtonIn;
Image *m_genBarButtonOn;
Image *m_toggleButtonUpIn;
Image *m_toggleButtonUpOn;
Image *m_toggleButtonUpPushed;
Image *m_toggleButtonDownIn;
Image *m_toggleButtonDownOn;
Image *m_toggleButtonDownPushed;
Image *m_generalButtonEnable;
Image *m_generalButtonHightlited;
Image *m_generalButtonPushed;
Image *m_generalButtonDisabled;
Image *m_uAttackButtonEnable;
Image *m_uAttackButtonHightlited;
Image *m_uAttackButtonPushed;
Image *m_minMaxButtonEnable;
Image *m_minMaxButtonHightlited;
Image *m_minMaxButtonPushed;
Image *m_genArrow;
ICoord2D m_moneyUL;
ICoord2D m_moneyLR;
ICoord2D m_minMaxUL;
ICoord2D m_minMaxLR;
ICoord2D m_generalUL;
ICoord2D m_generalLR;
ICoord2D m_uAttackUL;
ICoord2D m_uAttackLR;
ICoord2D m_optionsUL;
ICoord2D m_optionsLR;
ICoord2D m_workerUL;
ICoord2D m_workerLR;
ICoord2D m_chatUL;
ICoord2D m_chatLR;
ICoord2D m_beaconUL;
ICoord2D m_beaconLR;
ICoord2D m_powerBarUL;
ICoord2D m_powerBarLR;
Image *m_expBarForeground;
Image *m_commandMarkerImage;
typedef std::list< ControlBarSchemeImage* > ControlBarSchemeImageList;
ControlBarSchemeImageList m_layer[MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS];
typedef std::list< ControlBarSchemeAnimation* > ControlBarSchemeAnimationList;
ControlBarSchemeAnimationList m_animations;
};
class ControlBarSchemeManager
{
public:
ControlBarSchemeManager( void );
~ControlBarSchemeManager( void );
void init( void ); ///< Initialize from the INI files
void update( void ); ///< move the animations if we have any
void drawForeground( ICoord2D offset ); ///< draw function to be called within a w3d draw procedure for the foreground
void drawBackground( ICoord2D offset ); ///< draw function to be called within a w3d draw procedure for the background
void setControlBarSchemeByPlayer(Player *p); ///< Based off the playerTemplate, pick the right scheme for the control bar
void setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt, Bool useSmall = FALSE);
void setControlBarScheme(AsciiString schemeName); ///< SchemeName must be a valid INI entry
// parse Functions for the INI file
const FieldParse *getFieldParse() const { return m_controlBarSchemeFieldParseTable; } ///< returns the parsing fields
static const FieldParse m_controlBarSchemeFieldParseTable[]; ///< the parse table
static void parseImagePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
static void parseAnimatingPart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the animation part of the INI file
static void parseAnimatingPartImage( INI* ini, void *instance, void *store, const void *userData ); ///< parse the image part of the animation part :)
ControlBarScheme *findControlBarScheme( AsciiString name ); ///< attempt to find the control bar scheme by it's name
ControlBarScheme *newControlBarScheme( AsciiString name ); ///< create a new control bar scheme and return it.
void preloadAssets( TimeOfDay timeOfDay ); ///< preload the assets
private:
ControlBarScheme *m_currentScheme; ///< the current scheme that everythign uses
Coord2D m_multiplyer;
typedef std::list< ControlBarScheme* > ControlBarSchemeList; ///< list of control bar schemes
ControlBarSchemeList m_schemeList;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __CONTROL_BAR_SCHEME_H_

View File

@@ -0,0 +1,166 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Credits.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Dec 2002
//
// Filename: Credits.h
//
// author: Chris Huybregts
//
// purpose: header file for the credits
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __CREDITS_H_
#define __CREDITS_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "GameClient/FontDesc.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class DisplayString;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
enum
{
CREDIT_STYLE_TITLE = 0,
CREDIT_STYLE_POSITION,
CREDIT_STYLE_NORMAL,
CREDIT_STYLE_COLUMN,
CREDIT_STYLE_BLANK, ///< Keep this second to last
MAX_CREDIT_STYLES ///< Keep this last
};
enum{ CREDIT_SPACE_OFFSET = 2 };
static const LookupListRec CreditStyleNames[] =
{
{ "TITLE", CREDIT_STYLE_TITLE },
{ "MINORTITLE", CREDIT_STYLE_POSITION },
{ "NORMAL", CREDIT_STYLE_NORMAL },
{ "COLUMN", CREDIT_STYLE_COLUMN },
{ NULL, 0 }// keep this last!
};
class CreditsLine
{
public:
CreditsLine();
~CreditsLine();
// parsing variables
Int m_style;
UnicodeString m_text;
UnicodeString m_secondText;
Bool m_useSecond;
Bool m_done;
// drawing variables
DisplayString *m_displayString;
DisplayString *m_secondDisplayString;
ICoord2D m_pos;
Int m_height;
Int m_color;
};
class CreditsManager: public SubsystemInterface
{
public:
CreditsManager(void);
~CreditsManager(void);
void init(void );
void load(void );
void reset( void );
void update( void );
void draw( void );
const FieldParse *getFieldParse() const { return m_creditsFieldParseTable; } ///< returns the parsing fields
static const FieldParse m_creditsFieldParseTable[]; ///< the parse table
static void parseBlank( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
static void parseText( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
Bool isFinished( void ) { return m_isFinished; }
void addBlank( void );
void addText( AsciiString text );
private:
UnicodeString getUnicodeString(AsciiString str);
typedef std::list<CreditsLine *> CreditsLineList;
CreditsLineList m_creditLineList;
CreditsLineList::iterator m_creditLineListIt;
CreditsLineList m_displayedCreditLineList;
Int m_scrollRate; // in pixels
Int m_scrollRatePerFrames;
Bool m_scrollDown; // if TRUE text will come from the top to the bottom if False, it will go from the bottom up
Color m_titleColor;
Color m_positionColor;
Color m_normalColor;
Int m_currentStyle;
Bool m_isFinished;
Int m_framesSinceStarted;
Int m_normalFontHeight;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
extern CreditsManager *TheCredits;
#endif // __CREDITS_H_

View File

@@ -0,0 +1,156 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//----------------------------------------------------------------------------
//
// Project: Generals
//
// Module: Debug
//
// File name: GameClient/DebugDisplay.h
//
// Created: 11/13/01 TR
//
//----------------------------------------------------------------------------
#pragma once
#ifndef __GAMECLIENT_DEBUGDISPLAY_H
#define __GAMECLIENT_DEBUGDISPLAY_H
//----------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------
#include "Lib/BaseType.h"
#include <stdio.h>
//----------------------------------------------------------------------------
// Forward References
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Type Defines
//----------------------------------------------------------------------------
//===============================
// DebugDisplayInterface
//===============================
class DebugDisplayInterface
{
public:
enum Color
{
WHITE,
BLACK,
YELLOW,
RED,
GREEN,
BLUE,
NUM_COLORS
};
virtual ~DebugDisplayInterface() {};
virtual void printf( Char *format, ...) = 0; ///< Print formatted text at current cursor position
virtual void setCursorPos( Int x, Int y ) = 0; ///< Set new cursor position
virtual Int getCursorXPos( void ) = 0; ///< Get current X position of cursor
virtual Int getCursorYPos( void ) = 0; ///< Get current Y position of cursor
virtual Int getWidth( void ) = 0; ///< Get character width of display
virtual Int getHeight( void ) = 0; ///< Get character height of display
virtual void setTextColor( Color color ) = 0; ///< Set text color
virtual void setRightMargin( Int rightPos ) = 0; ///< Set right margin position
virtual void setLeftMargin( Int leftPos ) = 0; ///< Set left margin position
virtual void reset( void ) = 0; ///< Reset back to default settings
protected:
virtual void drawText( Int x, Int y, Char *text ) = 0; ///< Render null ternimated string at current cursor position
};
//===============================
// DebugDisplay
//===============================
class DebugDisplay : public DebugDisplayInterface
{
public:
DebugDisplay();
virtual ~DebugDisplay() {};
virtual void printf( Char *format, ...); ///< Print formatted text at current cursor position
virtual void setCursorPos( Int x, Int y ); ///< Set new cursor position
virtual Int getCursorXPos( void ); ///< Get current X position of cursor
virtual Int getCursorYPos( void ); ///< Get current Y position of cursor
virtual Int getWidth( void ); ///< Get character width of display
virtual Int getHeight( void ); ///< Get character height of display
virtual void setTextColor( Color color ); ///< set text color
virtual void setRightMargin( Int rightPos ); ///< set right margin position
virtual void setLeftMargin( Int leftPos ); ///< set left margin position
virtual void reset( void ); ///< Reset back to default settings
protected:
Color m_textColor; ///< Color to render text in
Int m_xPos; ///< Current X position of cursor
Int m_yPos; ///< Current Y position of cursor
Int m_width; ///< Character width of display
Int m_height; ///< Character height of display
Int m_rightMargin;///< Right margin position
Int m_leftMargin; ///< Left margin position
};
// displayers
#if defined(_DEBUG) || defined(_INTERNAL)
extern void AudioDebugDisplay( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp );
#endif
//----------------------------------------------------------------------------
// Inlining
//----------------------------------------------------------------------------
#endif // __GAMECLIENT_DEBUGDISPLAY_H

View File

@@ -0,0 +1,40 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Diplomacy.h /////////////////////////////////////////////////////////////////////////////
// Author: Matthew D. Campbell, Sept 2002
//////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __DIPLOMACY_H__
#define __DIPLOMACY_H__
void PopulateInGameDiplomacyPopup( void );
void UpdateDiplomacyBriefingText(AsciiString newText, Bool clear);
typedef std::list<AsciiString> BriefingList;
BriefingList* GetBriefingTextList(void);
#endif // #ifndef __DIPLOMACY_H__

View File

@@ -0,0 +1,83 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __DISCONNECTDIALOG_H
#define __DISCONNECTDIALOG_H
#include "GameNetwork/DisconnectManager.h"
enum DisconnectMenuStateType {
DISCONNECTMENUSTATETYPE_SCREENON,
DISCONNECTMENUSTATETYPE_SCREENOFF
};
class DisconnectMenu {
public:
DisconnectMenu();
virtual ~DisconnectMenu();
void init();
void attachDisconnectManager(DisconnectManager *disconnectManager);
void showScreen();
void hideScreen();
Bool isScreenVisible( void ) { return m_menuState == DISCONNECTMENUSTATETYPE_SCREENON; }
void showPlayerControls(Int slot);
void hidePlayerControls(Int slot);
void showPacketRouterTimeout();
void hidePacketRouterTimeout();
void setPlayerName(Int playerNum, UnicodeString name);
void setPlayerTimeoutTime(Int playerNum, time_t newTime);
void setPacketRouterTimeoutTime(time_t newTime);
void sendChat(UnicodeString text);
void showChat(UnicodeString text);
void quitGame();
void removePlayer(Int slot, UnicodeString playerName);
void voteForPlayer(Int slot);
void updateVotes(Int slot, Int votes);
protected:
DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager.
DisconnectMenuStateType m_menuState; ///< The current state of the menu screen.
static char *m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window.
static char *m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window.
static char *m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window.
static char *m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window.
static char *m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window.
static char *m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window.
static char *m_textDisplayControlName; ///< name of the text display listbox control window.
};
extern DisconnectMenu *TheDisconnectMenu;
#endif // #ifndef __DISCONNECTDIALOG_H

View File

@@ -0,0 +1,235 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Display.h ////////////////////////////////////////////////////////////
// The graphics display singleton
// Author: Michael S. Booth, March 2001
#pragma once
#ifndef _GAME_DISPLAY_H_
#define _GAME_DISPLAY_H_
#include <stdio.h>
#include "Common/SubsystemInterface.h"
#include "View.h"
#include "GameClient/Color.h"
#include "GameClient/GameFont.h"
class View;
struct ShroudLevel
{
Short m_currentShroud; ///< A Value of 1 means shrouded. 0 is not. Negative is the count of people looking.
Short m_activeShroudLevel;///< A Value of 0 means passive shroud. Positive is the count of people shrouding.
};
class VideoBuffer;
class VideoStreamInterface;
class DebugDisplayInterface;
class Radar;
class Image;
class DisplayString;
enum StaticGameLODLevel;
/**
* The Display class implements the Display interface
*/
class Display : public SubsystemInterface
{
public:
enum DrawImageMode
{
DRAW_IMAGE_SOLID,
DRAW_IMAGE_GRAYSCALE, //draw image without blending and ignoring alpha
DRAW_IMAGE_ALPHA, //alpha blend the image into frame buffer
DRAW_IMAGE_ADDITIVE //additive blend the image into frame buffer
};
typedef void (DebugDisplayCallback)( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp = NULL );
Display();
virtual ~Display();
virtual void init( void ) { }; ///< Initialize
virtual void reset( void ); ///< Reset system
virtual void update( void ); ///< Update system
//---------------------------------------------------------------------------------------
// Display attribute methods
virtual void setWidth( UnsignedInt width ); ///< Sets the width of the display
virtual void setHeight( UnsignedInt height ); ///< Sets the height of the display
virtual UnsignedInt getWidth( void ) { return m_width; } ///< Returns the width of the display
virtual UnsignedInt getHeight( void ) { return m_height; } ///< Returns the height of the display
virtual void setBitDepth( UnsignedInt bitDepth ) { m_bitDepth = bitDepth; }
virtual UnsignedInt getBitDepth( void ) { return m_bitDepth; }
virtual void setWindowed( Bool windowed ) { m_windowed = windowed; } ///< set windowd/fullscreen flag
virtual Bool getWindowed( void ) { return m_windowed; } ///< return widowed/fullscreen flag
virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ); ///<sets screen resolution/mode
virtual Int getDisplayModeCount(void) {return 0;} ///<return number of display modes/resolutions supported by video card.
virtual void getDisplayModeDescription(Int modeIndex, Int *xres, Int *yres, Int *bitDepth) {} ///<return description of mode
virtual void setGamma(Real gamma, Real bright, Real contrast, Bool calibrate) {};
virtual Bool testMinSpecRequirements(Bool *videoPassed, Bool *cpuPassed, Bool *memPassed,StaticGameLODLevel *idealVideoLevel=NULL, Real *cpuTime=NULL) {*videoPassed=*cpuPassed=*memPassed=true; return true;}
virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) = 0;
#if defined(_DEBUG) || defined(_INTERNAL)
virtual void dumpAssetUsage(const char* mapname) = 0;
#endif
//---------------------------------------------------------------------------------------
// View management
virtual void attachView( View *view ); ///< Attach the given view to the world
virtual View *getFirstView( void ) { return m_viewList; } ///< Return the first view of the world
virtual View *getNextView( View *view )
{
if( view )
return view->getNextView();
return NULL;
}
virtual void drawViews( void ); ///< Render all views of the world
virtual void updateViews ( void ); ///< Updates state of world views
virtual VideoBuffer* createVideoBuffer( void ) = 0; ///< Create a video buffer that can be used for this display
//---------------------------------------------------------------------------------------
// Drawing management
virtual void setClipRegion( IRegion2D *region ) = 0; ///< Set clip rectangle for 2D draw operations.
virtual Bool isClippingEnabled( void ) = 0;
virtual void enableClipping( Bool onoff ) = 0;
virtual void draw( void ); ///< Redraw the entire display
virtual void setTimeOfDay( TimeOfDay tod ) = 0; ///< Set the time of day for this display
virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius,Real attenuationWidth,
UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime//, Bool donut = FALSE
) = 0;
/// draw a line on the display in pixel coordinates with the specified color
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
Real lineWidth, UnsignedInt lineColor ) = 0;
/// draw a line on the display in pixel coordinates with the specified 2 colors
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) = 0;
/// draw a rect border on the display in pixel coordinates with the specified color
virtual void drawOpenRect( Int startX, Int startY, Int width, Int height,
Real lineWidth, UnsignedInt lineColor ) = 0;
/// draw a filled rect on the display in pixel coords with the specified color
virtual void drawFillRect( Int startX, Int startY, Int width, Int height,
UnsignedInt color ) = 0;
/// Draw a percentage of a rectange, much like a clock
virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0;
virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0;
/// draw an image fit within the screen coordinates
virtual void drawImage( const Image *image, Int startX, Int startY,
Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA) = 0;
/// draw a video buffer fit within the screen coordinates
virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY,
Int endX, Int endY ) = 0;
/// FullScreen video playback
virtual void playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength );
virtual void playMovie( AsciiString movieName );
virtual void stopMovie( void );
virtual Bool isMoviePlaying(void);
/// Register debug display callback
virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = NULL );
virtual DebugDisplayCallback *getDebugDisplayCallback();
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting ) = 0; ///< set shroud
virtual void clearShroud() = 0; ///< empty the entire shroud
virtual void setBorderShroudLevel(UnsignedByte level) = 0; ///<color that will appear in unused border terrain.
#if defined(_DEBUG) || defined(_INTERNAL)
virtual void dumpModelAssets(const char *path) = 0; ///< dump all used models/textures to a file.
#endif
virtual void preloadModelAssets( AsciiString model ) = 0; ///< preload model asset
virtual void preloadTextureAssets( AsciiString texture ) = 0; ///< preload texture asset
virtual void takeScreenShot(void) = 0; ///< saves screenshot to a file
virtual void toggleMovieCapture(void) = 0; ///< starts saving frames to an avi or frame sequence
virtual void toggleLetterBox(void) = 0; ///< enabled letter-boxed display
virtual void enableLetterBox(Bool enable) = 0; ///< forces letter-boxed display on/off
virtual Bool isLetterBoxFading( void ) { return FALSE; } ///< returns true while letterbox fades in/out
virtual void setCinematicText( AsciiString string ) { m_cinematicText = string; }
virtual void setCinematicFont( GameFont *font ) { m_cinematicFont = font; }
virtual void setCinematicTextFrames( Int frames ) { m_cinematicTextFrames = frames; }
virtual Real getAverageFPS( void ) = 0; ///< returns the average FPS.
virtual Int getLastFrameDrawCalls( void ) = 0; ///< returns the number of draw calls issued in the previous frame
protected:
virtual void deleteViews( void ); ///< delete all views
UnsignedInt m_width, m_height; ///< Dimensions of the display
UnsignedInt m_bitDepth; ///< bit depth of the display
Bool m_windowed; ///< TRUE when windowed, FALSE when fullscreen
View *m_viewList; ///< All of the views into the world
// Cinematic text data
AsciiString m_cinematicText; ///< string of the cinematic text that should be displayed
GameFont *m_cinematicFont; ///< font for cinematic text
Int m_cinematicTextFrames; ///< count of how long the cinematic text should be displayed
// Video playback data
VideoBuffer *m_videoBuffer; ///< Video playback buffer
VideoStreamInterface *m_videoStream; ///< Video stream;
AsciiString m_currentlyPlayingMovie; ///< The currently playing video. Used to notify TheScriptEngine of completed videos.
// Debug display data
DebugDisplayInterface *m_debugDisplay; ///< Actual debug display
DebugDisplayCallback *m_debugDisplayCallback; ///< Code to update the debug display
void *m_debugDisplayUserData; ///< Data for debug display update handler
Real m_letterBoxFadeLevel; ///<tracks the current alpha level for fading letter-boxed mode in/out.
Bool m_letterBoxEnabled; ///<current state of letterbox
UnsignedInt m_letterBoxFadeStartTime; ///< time of letterbox fade start
Int m_movieHoldTime; ///< time that we hold on the last frame of the movie
Int m_copyrightHoldTime; ///< time that the copyright must be on the screen
UnsignedInt m_elapsedMovieTime; ///< used to make sure we show the stuff long enough
UnsignedInt m_elapsedCopywriteTime; ///< Hold on the last frame until both have expired
DisplayString *m_copyrightDisplayString;///< this'll hold the display string
};
// the singleton
extern Display *TheDisplay;
extern void StatDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL );
//Added By Saad
//Necessary for display resolution confirmation dialog box
//Holds the previous and current display settings
typedef struct _DisplaySettings
{
Int xRes; //Resolution width
Int yRes; //Resolution height
Int bitDepth; //Color Depth
Bool windowed; //Window mode TRUE: we're windowed, FALSE: we're not windowed
} DisplaySettings;
#endif // _GAME_DISPLAY_H_

View File

@@ -0,0 +1,131 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: DisplayString.h //////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: DisplayString.h
//
// Created: Colin Day, July 2001
//
// Desc: Contstuct for holding double byte game string data and being
// able to draw that text to the screen.
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __DISPLAYSTRING_H_
#define __DISPLAYSTRING_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "GameClient/GameFont.h"
#include "GameClient/Color.h"
#include "Common/AsciiString.h"
#include "Common/UnicodeString.h"
#include "Common/GameMemory.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
class DisplayStringManager;
// TYPE DEFINES ///////////////////////////////////////////////////////////////
// DisplayString --------------------------------------------------------------
/** String representation that can also has additional information and
* methods for drawing to the screen */
//-----------------------------------------------------------------------------
class DisplayString : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( DisplayString, "DisplayString" )
public:
friend DisplayStringManager;
DisplayString( void );
// virtual ~DisplayString( void ); // destructor defined by memory pool
virtual void setText( UnicodeString text ); ///< set text for this string
virtual UnicodeString getText( void ); ///< get text for this string
virtual Int getTextLength( void ); ///< return number of chars in string
virtual void notifyTextChanged( void ); ///< called when text has changed
virtual void reset( void ); ///< reset all contents of string
virtual void setFont( GameFont *font ); ///< set a font for display
virtual GameFont *getFont( void ); ///< return font in string
virtual void setWordWrap( Int wordWrap ) = 0; ///< Set the width that we want to start wrapping text
virtual void setWordWrapCentered( Bool isCentered ) = 0; ///< If this is set to true, the text on a new line is centered
virtual void draw( Int x, Int y, Color color, Color dropColor ) = 0; ///< render text
virtual void draw( Int x, Int y, Color color, Color dropColor, Int xDrop, Int yDrop ) = 0; ///< render text with the drop shadow being at the offsets passed in
virtual void getSize( Int *width, Int *height ) = 0; ///< get render size
virtual Int getWidth( Int charPos = -1 ) = 0; ///< get text with up to charPos characters, 1- = all characters
virtual void setUseHotkey( Bool useHotkey, Color hotKeyColor ) = 0;
virtual void setClipRegion( IRegion2D *region ); ///< clip text in this region
virtual void removeLastChar( void ); ///< remove the last character
virtual void appendChar( WideChar c ); ///< append character to end
DisplayString *next( void ); ///< return next string
protected:
UnicodeString m_textString;
GameFont *m_font; ///< font to display this string with
DisplayString *m_next; ///< for the display string factory list ONLY
DisplayString *m_prev; ///< for the display string factory list ONLY
}; // end DisplayString
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
inline UnicodeString DisplayString::getText( void ) { return m_textString; }
inline Int DisplayString::getTextLength( void ) { return m_textString.getLength(); }
inline void DisplayString::setFont( GameFont *font ) { m_font = font; }
inline GameFont *DisplayString::getFont( void ) { return m_font; }
inline void DisplayString::setClipRegion( IRegion2D *region ) {}
inline void DisplayString::notifyTextChanged( void ) {}
inline DisplayString *DisplayString::next( void ) { return m_next; }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __DISPLAYSTRING_H_

View File

@@ -0,0 +1,71 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: DisplayStringManager.h ///////////////////////////////////////////////////////////////////
// Created: Colin Day, July 2001
// Desc: Access for creating game managed display strings
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __DISPLAYSTRINGMANAGER_H_
#define __DISPLAYSTRINGMANAGER_H_
#include "Common/SubsystemInterface.h"
#include "GameClient/DisplayString.h"
//-------------------------------------------------------------------------------------------------
/** Factory for managing and creating display strings */
//-------------------------------------------------------------------------------------------------
class DisplayStringManager : public SubsystemInterface
{
public:
DisplayStringManager( void );
virtual ~DisplayStringManager( void );
virtual void init( void ) {} ///< initialize the factory
virtual void reset( void ) {} ///< reset system
virtual void update( void ) {}; ///< update anything we need to in our strings
virtual DisplayString *newDisplayString( void ) = 0; ///< allocate new display string
virtual void freeDisplayString( DisplayString *string ) = 0; ///< free string
virtual DisplayString *getGroupNumeralString( Int numeral ) = 0;
virtual DisplayString *getFormationLetterString( void ) = 0;
protected:
void link( DisplayString *string ); ///< link display string to list
void unLink( DisplayString *string ); ///< unlink display string from list
DisplayString *m_stringList; ///< list of all display strings
DisplayString *m_currentCheckpoint; ///< current checkpoint of strings to be freed
};
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern DisplayStringManager *TheDisplayStringManager; ///< singleton extern
#endif // __DISPLAYSTRINGMANAGER_H_

View File

@@ -0,0 +1,68 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: DrawGroupInfo.h //////////////////////////////////////////////////////////////////////////
// AudioEventRTS structure
// Author: John K. McDonald, March 2002
#pragma once
#ifndef _H_DRAWGROUPINFO_
#define _H_DRAWGROUPINFO_
struct DrawGroupInfo
{
AsciiString m_fontName;
Int m_fontSize;
Bool m_fontIsBold;
Bool m_usePlayerColor;
Color m_colorForText;
Color m_colorForTextDropShadow;
Int m_dropShadowOffsetX;
Int m_dropShadowOffsetY;
union
{
Int m_pixelOffsetX;
Real m_percentOffsetX;
};
Bool m_usingPixelOffsetX;
union
{
Int m_pixelOffsetY;
Real m_percentOffsetY;
};
Bool m_usingPixelOffsetY;
DrawGroupInfo();
static const FieldParse s_fieldParseTable[]; ///< the parse table for INI definition
const FieldParse *getFieldParse( void ) const { return s_fieldParseTable; }
};
extern DrawGroupInfo *TheDrawGroupInfo;
#endif /* _H_DRAWGROUPINFO */

View File

@@ -0,0 +1,752 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Drawable.h ///////////////////////////////////////////////////////////////////////////////
// Simple base drawable
// Author: Michael S. Booth, March 2001
#pragma once
#ifndef _DRAWABLE_H_
#define _DRAWABLE_H_
#include "Common/AudioEventRTS.h"
#include "Common/GameType.h"
#include "Common/ModelState.h"
#include "Common/ModuleFactory.h"
#include "Common/Thing.h"
#include "Common/Geometry.h"
#include "GameClient/Color.h"
#include "WWMath/Matrix3D.h"
#include "GameClient/DrawableInfo.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class PositionalSound;
class ThingTemplate;
class Particle;
class DisplayString;
class FXList;
class DrawModule;
class ClientUpdateModule;
class View;
class Locomotor;
class Anim2D;
class Shadow;
class ModuleInfo;
class Anim2DTemplate;
class Image;
enum BodyDamageType;
// this is a very worthwhile performance win. left conditionally defined for now, just
// in case, but probably should be made permanent soon. (srj)
#define DIRTY_CONDITION_FLAGS
#define DEFAULT_TINT_COLOR_FADE_RATE (0.6f) // fast fade
#define DEF_ATTACK_FRAMES (1)
#define DEF_SUSTAIN_FRAMES (1)
#define DEF_DECAY_FRAMES (4)
#define SUSTAIN_INDEFINITELY (0xfffffffe) // forever and ever, amen.
//-----------------------------------------------------------------------------
//@TODO -- The drawable icon system needs to be implemented in a proper manner -- KM
// Fact 1: Every drawable in the world shouldn't have to have a pointer
// and frame counter for every possible icon type. It should be a dynamic vector.
// Fact 2: It's polling every frame for every object on screen for every possible icon condition...
// KM : I moved this into Drawable.cpp so I don't have to recompile the entire project
// each time I add a new icon, and made the arrays dynamic...
// CD: No so good, core engine components should not be made dynamic in this way
enum DrawableIconType
{
/** NOTE: This enum MUST appear in the same order as TheDrawableIconNames array to be
* indexed correctly using that array */
ICON_INVALID = -1,
ICON_FIRST = 0,
ICON_DEFAULT_HEAL = ICON_FIRST,
ICON_STRUCTURE_HEAL,
ICON_VEHICLE_HEAL,
#ifdef ALLOW_DEMORALIZE
ICON_DEMORALIZED,
#else
ICON_DEMORALIZED_OBSOLETE,
#endif
ICON_BOMB_TIMED,
ICON_BOMB_REMOTE,
ICON_DISABLED,
ICON_BATTLEPLAN_BOMBARD,
ICON_BATTLEPLAN_HOLDTHELINE,
ICON_BATTLEPLAN_SEARCHANDDESTROY,
ICON_EMOTICON,
ICON_ENTHUSIASTIC,
ICON_ENTHUSIASTIC_SUBLIMINAL,
ICON_CARBOMB,
MAX_ICONS ///< keep this last
};
//-----------------------------------------------------------------------------
class DrawableIconInfo : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(DrawableIconInfo, "DrawableIconInfo" )
public:
Anim2D* m_icon[MAX_ICONS];
UnsignedInt m_keepTillFrame[MAX_ICONS];
DrawableIconInfo();
//~DrawableIconInfo();
void clear();
void killIcon(DrawableIconType t);
};
//-----------------------------------------------------------------------------
struct TWheelInfo
{
Real m_frontLeftHeightOffset; ///< Height offsets for tires due to suspension sway
Real m_frontRightHeightOffset;
Real m_rearLeftHeightOffset;
Real m_rearRightHeightOffset;
Real m_wheelAngle; ///< Wheel angle. 0 = straight, >0 left, <0 right.
Int m_framesAirborneCounter; ///< Counter.
Int m_framesAirborne; ///< How many frames it was in the air.
};
//-----------------------------------------------------------------------------
class DrawableLocoInfo : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(DrawableLocoInfo, "DrawableLocoInfo" )
public:
Real m_pitch; ///< pitch of the entire drawable
Real m_pitchRate; ///< rate of change of pitch
Real m_roll; ///< roll of the entire drawable
Real m_rollRate; ///< rate of change of roll
Real m_yaw; ///< yaw for entire drawable
Real m_accelerationPitch; ///< pitch of the drawable due to impact/acceleration
Real m_accelerationPitchRate; ///< rate of change of pitch
Real m_accelerationRoll; ///< roll of the entire drawable
Real m_accelerationRollRate; ///< rate of change of roll
Real m_overlapZVel; ///< fake Z velocity
Real m_overlapZ; ///< current height (additional)
Real m_wobble; ///< for wobbling
TWheelInfo m_wheelInfo; ///< Wheel offset & angle info for a wheeled type locomotor.
DrawableLocoInfo();
};
//-----------------------------------------------------------------------------
//* TintEnvelope handles the fading of the tint color up, down stable etc...
//* assumes that 0,0,0, is the color for the AT REST state, used as decay target
//* works like an ADSR envelope,
//* except that SUSTAIN and RELEASE are randomly (or never) triggered, externally
class TintEnvelope : public MemoryPoolObject, public Snapshot
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(TintEnvelope, "TintEnvelope" )
public:
TintEnvelope(void);
void update(void); ///< does all the work
void play(const RGBColor *peak,
UnsignedInt atackFrames = DEF_ATTACK_FRAMES,
UnsignedInt decayFrames = DEF_DECAY_FRAMES,
UnsignedInt sustainAtPeak = DEF_SUSTAIN_FRAMES ); // ask MLorenzen
void sustain(void) { m_envState = ENVELOPE_STATE_SUSTAIN; }
void release(void) { m_envState = ENVELOPE_STATE_DECAY; }
void rest(void) { m_envState = ENVELOPE_STATE_REST; } // goes away now!
Bool isEffective() const { return m_affect; }
const Vector3* getColor() const { return &m_currentColor; }
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
private:
void setAttackFrames(UnsignedInt frames);
void setDecayFrames( UnsignedInt frames);
void setPeakColor( const RGBColor *peak) {m_peakColor = Vector3( peak->red, peak->green, peak->blue );};
void setPeakColor( Real r, Real g, Real b ) {m_peakColor.Set( r, g, b );};
enum EnvelopeStatesEnum
{
ENVELOPE_STATE_REST,
ENVELOPE_STATE_ATTACK,
ENVELOPE_STATE_DECAY,
ENVELOPE_STATE_SUSTAIN ///< RELEASE IS THE LOGICAL COMPLIMENT TO SUSTAIN
};
Vector3 m_attackRate; ///< step amount to make tint turn on slow or fast
Vector3 m_decayRate; ///< step amount to make tint turn off slow or fast
Vector3 m_peakColor; ///< um, the peak color, what color we are headed toward during attack
Vector3 m_currentColor; ///< um, the current color, how we are colored, now
UnsignedInt m_sustainCounter;
Byte m_envState; ///< a randomly switchable SUSTAIN state, release is compliment
Bool m_affect; ///< set TRUE if this has any effect (has a non 0,0,0 color).
};
EMPTY_DTOR(TintEnvelope)
//-----------------------------------------------------------------------------
enum StealthLookType
{
STEALTHLOOK_NONE, ///< unit is not stealthed at all
STEALTHLOOK_VISIBLE_FRIENDLY, ///< unit is stealthed-but-visible due to friendly status
STEALTHLOOK_DISGUISED_ENEMY, ///< we can have units that are disguised (instead of invisible)
STEALTHLOOK_VISIBLE_DETECTED, ///< unit is stealthed and invisible, but a second material pass
///< is added to reveal the invisible unit as with heat vision
STEALTHLOOK_VISIBLE_FRIENDLY_DETECTED, ///< unit is stealthed-but-visible due to being detected,
///< and rendered in heatvision effect second material pass
STEALTHLOOK_INVISIBLE ///< unit is stealthed-and-invisible
};
// ------------------------------------------------------------------------------------------------
/** Drawable status bits */
// ------------------------------------------------------------------------------------------------
enum DrawableStatus
{
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
};
enum TintStatus
{
TINT_STATUS_DISABLED = 0x00000001,///< drawable tint color is deathly dark grey
TINT_STATUS_IRRADIATED = 0x00000002,///< drawable tint color is sickly green
TINT_STATUS_POISONED = 0x00000004,///< drawable tint color is open-sore red
};
//-----------------------------------------------------------------------------
//Keep this enum in sync with the TerrainDecalTextureName array in drawable.cpp
//
// Note: these values are saved in save files, so you MUST NOT REMOVE OR CHANGE
// existing values!
//
enum TerrainDecalType
{
#ifdef ALLOW_DEMORALIZE
TERRAIN_DECAL_DEMORALIZED = 0,
#else
TERRAIN_DECAL_DEMORALIZED_OBSOLETE = 0,
#endif
TERRAIN_DECAL_HORDE,
TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE,
TERRAIN_DECAL_HORDE_VEHICLE,
TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE_VEHICLE,
TERRAIN_DECAL_CRATE,
TERRAIN_DECAL_NONE,
TERRAIN_DECAL_MAX ///< keep this last
};
//-----------------------------------------------------------------------------
const Int DRAWABLE_FRAMES_PER_FLASH = LOGICFRAMES_PER_SECOND / 2;
//-----------------------------------------------------------------------------
/**
* A Drawable is a graphical entity which is generally associated
* with a GameLogic object. Drawables are managed by TheGameClient.
*/
class Drawable : public Thing,
public Snapshot
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(Drawable, "Drawable" )
public:
Drawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
void onDestroy( void ); ///< run from GameClient::destroyDrawable
Drawable *getNextDrawable( void ) const { return m_nextDrawable; } ///< return the next drawable in the global list
Drawable *getPrevDrawable( void ) const { return m_prevDrawable; } ///< return the prev drawable in the global list
DrawableID getID( void ) const; ///< return this drawable's unique ID
void friend_bindToObject( Object *obj ); ///< bind this drawable to an object ID. for use ONLY by GameLogic!
void setIndicatorColor(Color color);
void setTintStatus( TintStatus statusBits ) { BitSet( m_tintStatus, statusBits ); };
void clearTintStatus( TintStatus statusBits ) { BitClear( m_tintStatus, statusBits ); };
Bool testTintStatus( TintStatus statusBits ) const { return BitTest( m_tintStatus, statusBits ); };
TintEnvelope *getColorTintEnvelope( void ) { return m_colorTintEnvelope; }
void setColorTintEnvelope( TintEnvelope &source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; }
void setTerrainDecal(TerrainDecalType type); ///<decal that is to appear under the drawable
void setTerrainDecalSize(Real x, Real y);
void setTerrainDecalFadeTarget(Real target, Real rate = 0.1f);
inline Object *getObject( void ) { return m_object; } ///< return object ID bound to this drawble
inline const Object *getObject( void ) const { return m_object; } ///< return object ID bound to this drawble
inline DrawableInfo *getDrawableInfo(void) {return &m_drawableInfo;}
void setDrawableHidden( Bool hidden ); ///< hide or unhide drawable
//
// note that this is not necessarily the 'get' reflection of setDrawableHidden, since drawables
// can spontaneously hide via stealth. (srj)
//
inline Bool isDrawableEffectivelyHidden() const { return m_hidden || m_hiddenByStealth; }
void setSelectable( Bool selectable ); ///< Changes the drawables selectability
Bool isSelectable( void ) const;
Bool isMassSelectable( void ) const;
void setStealthLook(StealthLookType look);
StealthLookType getStealthLook() const { return m_stealthLook; }
void updateDrawableClipStatus( UnsignedInt shotsRemaining, UnsignedInt maxShots, WeaponSlotType slot ); ///< This will do the show/hide work if ProjectileBoneFeedbackEnabled is set.
void updateDrawableSupplyStatus( Int maxSupply, Int currentSupply ); ///< This will do visual feedback on Supplies carried
void notifyDrawableDependencyCleared();///< If any of your draw modules were waiting for something, it's ready now.
// Override.
void setPosition( const Coord3D *pos );
void reactToGeometryChange();
const GeometryInfo& getDrawableGeometryInfo() const;
void reactToBodyDamageStateChange(BodyDamageType newState);
const Real getScale (void) const ;
// access to modules
//---------------------------------------------------------------------------
// since most things don't have CU modules, we allow this to be null!
ClientUpdateModule** getClientUpdateModules() { return (ClientUpdateModule**)getModuleList(MODULETYPE_CLIENT_UPDATE); }
ClientUpdateModule const** getClientUpdateModules() const { return (ClientUpdateModule const**)getModuleList(MODULETYPE_CLIENT_UPDATE); }
ClientUpdateModule* findClientUpdateModule( NameKeyType key );
DrawModule** getDrawModules();
DrawModule const** getDrawModules() const;
//---------------------------------------------------------------------------
void setDrawableStatus( DrawableStatus bit ) { BitSet( m_status, bit ); }
void clearDrawableStatus( DrawableStatus bit ) { BitClear( m_status, bit ); }
inline Bool testDrawableStatus( DrawableStatus bit ) const { return (m_status & bit) != 0; }
void setShroudClearFrame( UnsignedInt frame ) { m_shroudClearFrame = frame; }
UnsignedInt getShroudClearFrame( void ) { return m_shroudClearFrame; }
void setShadowsEnabled(Bool enable);
Bool getShadowsEnabled() const { return BitTest(m_status, DRAWABLE_STATUS_SHADOWS); }
void releaseShadows(void); ///< frees all shadow resources used by this module - used by Options screen.
void allocateShadows(void); ///< create shadow resources if not already present. Used by Options screen.
void setFullyObscuredByShroud(Bool fullyObscured);
inline Bool getFullyObscuredByShroud(void) {return m_drawableFullyObscuredByShroud;}
Bool getDrawsInMirror() const { return BitTest(m_status, DRAWABLE_STATUS_DRAWS_IN_MIRROR) || isKindOf(KINDOF_CAN_CAST_REFLECTIONS); }
void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = FALSE ); ///< flash a drawable in the color specified for a short time
void colorTint( const RGBColor *color ); ///< tint this drawable the color specified
void setTintEnvelope( const RGBColor *color, Real attack, Real decay ); ///< how to transition color
void flashAsSelected( const RGBColor *color = NULL ); ///< drawable takes care of the details if you spec no color
/// Return true if drawable has been marked as "selected"
Bool isSelected( void ) const { return m_selected; }
void onSelected(); ///< Work unrelated to selection that must happen at time of selection
void onUnselected(); ///< Work unrelated to selection that must happen at time of unselection
//---------------------------------------------------------------------------
// an "instance" matrix defines the local transform of the Drawable, and is concatenated with the global transform
void setInstanceMatrix( const Matrix3D *instance ); ///< set the Drawable's instance transform
const Matrix3D *getInstanceMatrix( void ) const { return &m_instance; } ///< get drawable instance transform
inline Bool isInstanceIdentity() const { return m_instanceIsIdentity; }
inline Real getInstanceScale( void ) const { return m_instanceScale; } ///< get scale that will be applied to instance matrix
void setInstanceScale(Real value) { m_instanceScale = value;} ///< set scale that will be applied to instance matrix before rendering.
const Matrix3D *getTransformMatrix( void ) const; ///< return the world transform
void draw( View *view ); ///< render the drawable to the given view
void updateDrawable(); ///< update the drawable
void drawIconUI( void ); ///< draw "icon"(s) needed on drawable (health bars, veterency, etc)
void startAmbientSound();
void stopAmbientSound( void );
void enableAmbientSound( Bool enable );
void setTimeOfDay( TimeOfDay tod );
void prependToList(Drawable **pListHead);
void removeFromList(Drawable **pListHead);
void setID( DrawableID id ); ///< set this drawable's unique ID
inline const ModelConditionFlags& getModelConditionFlags( void ) const { return m_conditionState; }
//
// NOTE: avoid repeated calls to the set and clear for the condition state as they
// reconstruct and load models which is expensive ... wrap up all our bit flags to
// set and clear into one function call
//
void clearModelConditionState( ModelConditionFlagType a ) { clearAndSetModelConditionState(a, MODELCONDITION_INVALID); }
void setModelConditionState( ModelConditionFlagType a ) { clearAndSetModelConditionState(MODELCONDITION_INVALID, a); }
void clearAndSetModelConditionState( ModelConditionFlagType clr, ModelConditionFlagType set );
void clearModelConditionFlags( const ModelConditionFlags& clr ) { ModelConditionFlags empty; clearAndSetModelConditionFlags(clr, empty); }
void setModelConditionFlags( const ModelConditionFlags& set ) { ModelConditionFlags empty; clearAndSetModelConditionFlags(empty, set); }
void clearAndSetModelConditionFlags( const ModelConditionFlags& clr, const ModelConditionFlags& set );
void replaceModelConditionFlags( const ModelConditionFlags &flags, Bool forceReplace = FALSE );
void attachToParticleSystem( Particle *p ); ///< attach this Drawable to a particle system
void detachFromParticleSystem( void ); ///< detach this from any particle system
Bool handleWeaponFireFX(
WeaponSlotType wslot,
Int specificBarrelToUse,
const FXList* fxl,
Real weaponSpeed,
Real recoilAmount,
Real recoilAngle,
const Coord3D* victimPos,
Real damageRadius
);
Int getBarrelCount(WeaponSlotType wslot) const;
// when our Object changes teams, it calls us to let us know, so
// we can update our model, etc., if necessary. NOTE, we don't guarantee
// that the new team is different from the old team, nor do we guarantee
// that the team is nonnull.
void changedTeam();
const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : NULL; }
// this method must ONLY be called from the client, NEVER From the logic, not even indirectly.
Bool clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform);
/**
Find the bone(s) with the given name and return their positions and/or transforms in the given arrays.
We look for a bone named "boneNamePrefixQQ", where QQ is 01, 02, 03, etc, starting at the
value of "startIndex". Want to look for just a specific boneName with no numeric suffix?
just pass zero (0) for startIndex. (no, we never look for "boneNamePrefix00".)
We copy up to 'maxBones' into the array(s), and return the total count found.
NOTE: this returns the positions and transform for the "ideal" model... that is,
at its default rotation and scale, located at (0,0,0). You'll have to concatenate
an Object's position and transform onto these in order to move 'em into "world space"!
NOTE: this isn't very fast. Please call it sparingly and cache the result.
*/
Int getPristineBonePositions(const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const;
Int getCurrentClientBonePositions(const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const;
// this is a special-purpose call for W3DModelDraw. (srj)
Bool getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const;
Bool getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = NULL) const;
/**
This call says, "I want the current animation (if any) to take n frames to complete a single cycle".
If it's a looping anim, each loop will take n frames. someday, we may want to add the option to insert
"pad" frames at the start and/or end, but for now, we always just "stretch" the animation to fit.
Note that you must call this AFTER setting the condition codes.
*/
void setAnimationLoopDuration(UnsignedInt numFrames);
/**
similar to the above, but assumes that the current state is a "ONCE",
and is smart about transition states... if there is a transition state
"inbetween", it is included in the completion time.
*/
void setAnimationCompletionTime(UnsignedInt numFrames);
void updateSubObjects();
void showSubObject( const AsciiString& name, Bool show );
#ifdef ALLOW_ANIM_INQUIRIES
// srj sez: not sure if this is a good idea, for net sync reasons...
Real getAnimationScrubScalar( void ) const; // lorenzen // returns 0 to 1... where are we between start and finish?
#endif
UnsignedInt getExpirationDate() const { return m_expirationDate; }
void setExpirationDate(UnsignedInt frame) { m_expirationDate = frame; }
//
// *ONLY* the InGameUI should do the actual drawable selection and de-selection
//
void friend_setSelected( void ); ///< mark drawable as "selected"
void friend_clearSelected( void ); ///< clear drawable's "selected"
Vector3 * getAmbientLight( void ); ///< get color value to add to ambient light when drawing
void setAmbientLight( Vector3 *ambient ); ///< set color value to add to ambient light when drawing
const Vector3 * getTintColor( void ) const; ///< get FX color value to add to ALL LIGHTS when drawing
const Vector3 * getSelectionColor( void ) const; ///< get FX color value to add to ALL LIGHTS when drawing
inline TerrainDecalType getTerrainDecalType( void ) const { return m_terrainDecalType; }
inline void setDrawableOpacity( Real value ) { m_explicitOpacity = value; } ///< set alpha/opacity value used to override defaults when drawing.
// note that this is not the 'get' inverse of setDrawableOpacity, since stealthing can also affect the effective opacity!
inline Real getEffectiveOpacity() const { return m_explicitOpacity * m_effectiveStealthOpacity; } ///< get alpha/opacity value used to override defaults when drawing.
void setEffectiveOpacity( Real pulseFactor, Real explicitOpacity = -1.0f );
// this is for the heatvision effect which operates completely independently of the stealth opacity effects. Draw() does the fading every frame.
inline Real getHeatVisionOpacity() const { return m_heatVisionOpacity; } ///< get alpha/opacity value used to render add'l heatvision rendering pass.
void setHeatVisionOpacity( Real op ) { m_heatVisionOpacity = op; }; ///< set alpha/opacity value used to render add'l heatvision rendering pass.
// both of these assume that you are starting at one extreme 100% or 0% opacity and are trying to go to the other!! -- amit
void fadeOut( UnsignedInt frames ); ///< fade object out...how gradually this is done is determined by frames
void fadeIn( UnsignedInt frames ); ///< fade object in...how gradually this is done is determined by frames
void preloadAssets( TimeOfDay timeOfDay ); ///< preload the assets
Bool isVisible(); ///< for limiting tree sway, etc to visible objects
Bool getShouldAnimate( Bool considerPower ) const;
void friend_setParticle( Particle *particle ) { m_particle = particle; }
// flash drawable methods ---------------------------------------------------------
Int getFlashCount( void ) { return m_flashCount; }
void setFlashCount( Int count ) { m_flashCount = count; }
void setFlashColor( Color color ) { m_flashColor = color; }
void saturateRGB(RGBColor& color, Real factor);// not strictly for flash color, but it is the only practical use for this
//---------------------------------------------------------------------------------
// caption text methods -----------------------------------------------------------
void setCaptionText( const UnicodeString& captionText );
void clearCaptionText( void );
UnicodeString getCaptionText( void );
//---------------------------------------------------------------------------------
DrawableIconInfo* getIconInfo(); ///< lazily allocates, if necessary
void killIcon(DrawableIconType t) { if (m_iconInfo) m_iconInfo->killIcon(t); }
Bool hasIconInfo() const { return m_iconInfo != NULL; }
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
void xferDrawableModules( Xfer *xfer );
void startAmbientSound(BodyDamageType dt, TimeOfDay tod);
Drawable *asDrawableMeth() { return this; }
const Drawable *asDrawableMeth() const { return this; }
inline Module** getModuleList(ModuleType i)
{
Module** m = m_modules[i - FIRST_DRAWABLE_MODULE_TYPE];
return m;
}
inline Module* const* getModuleList(ModuleType i) const
{
Module** m = m_modules[i - FIRST_DRAWABLE_MODULE_TYPE];
return m;
}
void applyPhysicsXform(Matrix3D* mtx);
struct PhysicsXformInfo
{
Real m_totalPitch; ///< Current total pitch for this frame.
Real m_totalRoll; ///< Current total roll for this frame.
Real m_totalYaw; ///< Current total yaw for this frame
Real m_totalZ;
PhysicsXformInfo() : m_totalPitch(0), m_totalRoll(0), m_totalYaw(0), m_totalZ(0) { }
};
Bool calcPhysicsXform(PhysicsXformInfo& info);
void calcPhysicsXformThrust(const Locomotor *locomotor, PhysicsXformInfo& info);
void calcPhysicsXformHoverOrWings(const Locomotor *locomotor, PhysicsXformInfo& info);
void calcPhysicsXformTreads(const Locomotor *locomotor, PhysicsXformInfo& info);
void calcPhysicsXformWheels(const Locomotor *locomotor, PhysicsXformInfo& info);
const AudioEventRTS& getAmbientSoundByDamage(BodyDamageType dt);
#ifdef _DEBUG
void validatePos() const;
#endif
virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle);
void updateHiddenStatus();
private:
// note, these are lazily allocated!
TintEnvelope* m_selectionFlashEnvelope; ///< used for selection flash, works WITH m_colorTintEnvelope
TintEnvelope* m_colorTintEnvelope; ///< house color flashing, etc... works WITH m_selectionFlashEnvelope
// this used to use m_ambientLight... but this replaces it
// int most places. It works harder to change the drawable's
// color, by tinting all four scene lights, not just ambient
// zero = no effect
// 1 = full effect
TerrainDecalType m_terrainDecalType; ///<current decal in use by m_terrainDecal
Real m_explicitOpacity; ///< opacity level. 1.0f == Solid/Opaque.
Real m_stealthOpacity; ///< <<minimum>> opacity due to stealth. pulse is between opaque and this
Real m_effectiveStealthOpacity; ///< opacity actually used to render with, after the pulse and stuff.
Real m_decalOpacityFadeTarget;
Real m_decalOpacityFadeRate;
Real m_decalOpacity;
Object *m_object; ///< object (if any) that this drawable represents
Particle *m_particle; ///< particle (if any) that this Drawable is associated with
DrawableID m_id; ///< this drawable's unique ID
Drawable *m_nextDrawable;
Drawable *m_prevDrawable; ///< list links
UnsignedInt 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
enum FadingMode
{
FADING_NONE,
FADING_IN,
FADING_OUT
};
FadingMode m_fadeMode;
UnsignedInt m_timeElapsedFade; ///< for how many frames have i been fading
UnsignedInt m_timeToFade; ///< how slowly am I fading
UnsignedInt m_shroudClearFrame; ///< Last frame the local player saw this drawable "OBJECTSHROUD_CLEAR"
DrawableLocoInfo* m_locoInfo; // lazily allocated
DynamicAudioEventRTS* m_ambientSound; ///< sound module for ambient sound (lazily allocated)
Bool m_ambientSoundEnabled;
Module** m_modules[NUM_DRAWABLE_MODULE_TYPES];
StealthLookType m_stealthLook;
Int m_flashCount; ///< number of times to flash the drawable
Color m_flashColor; ///< color to flash the drawable
Matrix3D m_instance; ///< The instance matrix that holds the initial/default position & orientation
Real m_instanceScale; ///< the uniform scale factor applied to the instance matrix before it is sent to W3D.
DrawableInfo m_drawableInfo; ///< structure pointed to by W3D render objects so they know which drawable they belong to.
ModelConditionFlags m_conditionState; ///< The Drawables current behavior state
Real m_lastConstructDisplayed; ///< last construct percent used to make the string
DisplayString* m_constructDisplayString; ///< string to display construction % complete
DisplayString* m_captionDisplayString; ///< string to display caption
DisplayString* m_groupNumber; ///< string to display the group number of this drawable
UnsignedInt m_expirationDate; ///< if nonzero, Drawable should destroy itself at this frame
DrawableIconInfo* m_iconInfo; ///< lazily allocated!
Real m_heatVisionOpacity; ///< drawable draws for everybody in the heatvision special effect
// --------- BYTE-SIZED THINGS GO HERE
Byte m_selected; ///< drawable is selected or not
Bool m_hidden; ///< drawable is "hidden" or not (overrides stealth effects)
Bool m_hiddenByStealth; ///< drawable is hidden due to stealth
Bool m_instanceIsIdentity; ///< If true, instance matrix can be skipped
Bool m_drawableFullyObscuredByShroud; ///<drawable is hidden by shroud/fog
#ifdef DIRTY_CONDITION_FLAGS
mutable Bool m_isModelDirty; ///< if true, must call replaceModelConditionState() before drawing or accessing drawmodule info
#endif
//*******************************************
//Perhaps we can move this out of Drawable???
public:
static void killStaticImages();
#ifdef DIRTY_CONDITION_FLAGS
// only for StDrawableDirtyStuffLocker!
static void friend_lockDirtyStuffForIteration();
static void friend_unlockDirtyStuffForIteration();
#endif
//For now, you can only have one emoticon at a time. Changing it will clear the previous one.
void clearEmoticon();
void setEmoticon( const AsciiString &name, Int duration );
void drawUIText( void ); ///< draw the group number of this unit // public so gameclient can call
private:
// "icon" drawing methods **************
void drawConstructPercent( const IRegion2D *healthBarRegion ); ///< display % construction complete
void drawCaption( const IRegion2D *healthBarRegion ); ///< draw caption
void drawAmmo( const IRegion2D *healthBarRegion ); ///< draw icons
void drawContained( const IRegion2D *healthBarRegion ); ///< draw icons
void drawVeterancy( const IRegion2D *healthBarRegion ); ///< draw veterency information
void drawEmoticon( const IRegion2D* healthBarRegion );
void drawHealthBar( const IRegion2D* healthBarRegion ); ///< draw heath bar
void drawHealing( const IRegion2D* healthBarRegion ); ///< draw icons
void drawEnthusiastic( const IRegion2D* healthBarRegin ); ///< draw icons
#ifdef ALLOW_DEMORALIZE
void drawDemoralized( const IRegion2D* healthBarRegion ); ///< draw icons
#endif
void drawBombed( const IRegion2D* healthBarRegion ); ///< draw icons
void drawDisabled( const IRegion2D* healthBarRegion ); ///< draw icons
void drawBattlePlans( const IRegion2D* healthBarRegion ); ///< Icons rendering for active battle plan statii
Bool drawsAnyUIText( void );
static Bool s_staticImagesInited;
static const Image* s_veterancyImage[LEVEL_COUNT];
static const Image* s_fullAmmo;
static const Image* s_emptyAmmo;
static const Image* s_fullContainer;
static const Image* s_emptyContainer;
static Anim2DTemplate** s_animationTemplates;
#ifdef DIRTY_CONDITION_FLAGS
static Int s_modelLockCount;
#endif
static void initStaticImages();
//*******************************************
};
#ifdef DIRTY_CONDITION_FLAGS
class StDrawableDirtyStuffLocker
{
public:
StDrawableDirtyStuffLocker()
{
Drawable::friend_lockDirtyStuffForIteration();
}
~StDrawableDirtyStuffLocker()
{
Drawable::friend_unlockDirtyStuffForIteration();
}
};
#endif
#endif // _DRAWABLE_H_

View File

@@ -0,0 +1,59 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: DrawableInfo.h ///////////////////////////////////////////////////////////////////////////////
// Simple structure used to bind W3D renderObjects to our own Drawables.
// Author: Mark Wilczynski, August 2002
#pragma once
#ifndef _DRAWABLEINFO_H_
#define _DRAWABLEINFO_H_
#include "Common/GameType.h"
class Drawable;
class GhostObject;
class Object;
struct DrawableInfo
{
enum ExtraRenderFlags
{ ERF_IS_NORMAL=0,
ERF_IS_OCCLUDED= 0x00000001,
ERF_POTENTIAL_OCCLUDER= 0x00000002,
ERF_POTENTIAL_OCCLUDEE= 0x00000004,
ERF_IS_TRANSLUCENT= 0x00000008,
ERF_IS_NON_OCCLUDER_OR_OCCLUDEE = 0x00000010,
ERF_DELAYED_RENDER = ERF_IS_TRANSLUCENT|ERF_POTENTIAL_OCCLUDEE,
};
DrawableInfo(void) : m_shroudStatusObjectID(INVALID_ID), m_drawable(NULL), m_ghostObject(NULL), m_flags(ERF_IS_NORMAL) {}
ObjectID m_shroudStatusObjectID; ///<since we sometimes have drawables without objects, this points to a parent object from which we pull shroud status.
Drawable *m_drawable; ///<pointer back to drawable containing this DrawableInfo
GhostObject *m_ghostObject; ///<pointer to ghostObject for this drawable used for fogged versions.
Int m_flags; ///<extra render settings flags that are tied to render objects with drawables.
};
#endif // _DRAWABLEINFO_H_

View File

@@ -0,0 +1,24 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,55 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//// EstablishConnectionsMenu.h /////////////////////////
#include "GameNetwork/NetworkDefs.h"
#include "GameNetwork/NAT.h"
enum EstablishConnectionsMenuStateType {
ESTABLISHCONNECTIONSMENUSTATETYPE_SCREENON,
ESTABLISHCONNECTIONSMENUSTATETYPE_SCREENOFF
};
class EstablishConnectionsMenu {
public:
EstablishConnectionsMenu();
virtual ~EstablishConnectionsMenu();
void initMenu();
void endMenu();
void abortGame();
void setPlayerName(Int slot, UnicodeString name);
void setPlayerStatus(Int slot, NATConnectionState state);
protected:
EstablishConnectionsMenuStateType m_menuState;
static char *m_playerReadyControlNames[MAX_SLOTS];
static char *m_playerNameControlNames[MAX_SLOTS];
static char *m_playerStatusControlNames[MAX_SLOTS];
};
extern EstablishConnectionsMenu *TheEstablishConnectionsMenu;

View File

@@ -0,0 +1,179 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameClient/Eva.h /////////////////////////////////////////////////////////////////////////
// Author: John K. McDonald, Jr.
// DO NOT DISTRIBUTE
#pragma once
#ifndef __EVA_H__
#define __EVA_H__
#include "Common/SubsystemInterface.h"
#include "Common/AudioEventRTS.h"
class Player;
//------------------------------------------------------------------------------------ Eva Messages
// Keep in sync with TheEvaMessageNames AND Eva::s_shouldPlayFuncs
enum EvaMessage
{
EVA_FIRST = 0,
EVA_LowPower = EVA_FIRST,
EVA_InsufficientFunds,
EVA_SuperweaponDetected_ParticleCannon,
EVA_SuperweaponDetected_Nuke,
EVA_SuperweaponDetected_ScudStorm,
EVA_SuperweaponLaunched_ParticleCannon,
EVA_SuperweaponLaunched_Nuke,
EVA_SuperweaponLaunched_ScudStorm,
EVA_BuldingLost,
EVA_BaseUnderAttack,
EVA_AllyUnderAttack,
EVA_BeaconDetected,
EVA_UnitLost,
EVA_GeneralLevelUp,
EVA_VehicleStolen,
EVA_BuildingStolen,
EVA_CashStolen,
EVA_UpgradeComplete,
EVA_BuildingBeingStolen,
EVA_COUNT,
};
extern const char *TheEvaMessageNames[];
//------------------------------------------------------------------------------------ EvaCheckInfo
struct EvaSideSounds
{
AsciiString m_side;
std::vector<AsciiString> m_soundNames;
static const FieldParse s_evaSideSounds[]; ///< the parse table for INI definition
const FieldParse *getFieldParse( void ) const { return s_evaSideSounds; }
};
//------------------------------------------------------------------------------------ EvaCheckInfo
class EvaCheckInfo : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(EvaCheckInfo, "EvaCheckInfo")
public:
EvaMessage m_message;
UnsignedInt m_framesBetweenChecks;
UnsignedInt m_framesToExpire;
UnsignedInt m_priority; // higher priority is more important, and will be played in preference to lower preference
std::vector<EvaSideSounds> m_evaSideSounds;
EvaCheckInfo();
static const FieldParse s_evaEventInfo[]; ///< the parse table for INI definition
const FieldParse *getFieldParse( void ) const { return s_evaEventInfo; }
};
EMPTY_DTOR(EvaCheckInfo)
//---------------------------------------------------------------------------------------- EvaCheck
struct EvaCheck
{
enum { TRIGGEREDON_NOT = (UnsignedInt)-1 };
enum { NEXT_CHECK_NOW = 0 };
const EvaCheckInfo *m_evaInfo;
UnsignedInt m_triggeredOnFrame;
UnsignedInt m_timeForNextCheck;
Bool m_alreadyPlayed;
EvaCheck();
};
//-------------------------------------------------------------------------------- ShouldPlayStruct
typedef Bool (*ShouldPlayFunc)( Player *localPlayer );
//--------------------------------------------------------------------------------------------- Eva
class Eva : public SubsystemInterface
{
private:
static const ShouldPlayFunc s_shouldPlayFuncs[];
typedef std::vector<EvaCheckInfo *> EvaCheckInfoPtrVec;
typedef EvaCheckInfoPtrVec::iterator EvaCheckInfoPtrVecIt;
EvaCheckInfoPtrVec m_allCheckInfos;
typedef std::vector<EvaCheck> EvaCheckVec;
typedef EvaCheckVec::iterator EvaCheckVecIt;
// This list contains things that either want to play,
// or have played and are waiting till they are allowed to check again to play.
EvaCheckVec m_checks;
// This is the one speech we're allowed to be playing. If its playing, it always has priority
AudioEventRTS m_evaSpeech;
Player *m_localPlayer;
// Variables for condition checks go here.
Int m_previousBuildingCount;
Int m_previousUnitCount;
mutable EvaMessage m_messageBeingTested; // Used by the generic hooks so they can figure out which flag to test.
Bool m_shouldPlay[EVA_COUNT]; // These aren't all used, but some of them are.
Bool m_enabled;
public:
Eva();
virtual ~Eva();
public: // From SubsystemInterface
virtual void init();
virtual void reset();
virtual void update();
static EvaMessage nameToMessage(const AsciiString& name);
static AsciiString messageToName(EvaMessage message);
EvaCheckInfo *newEvaCheckInfo(AsciiString name);
const EvaCheckInfo *getEvaCheckInfo(AsciiString name);
void setShouldPlay(EvaMessage messageToPlay);
void setEvaEnabled(Bool enabled);
protected: // Note: These are all protected. They should *NEVER* be made public. They are for internal use only
Bool isTimeForCheck(EvaMessage messageToTest, UnsignedInt currentFrame) const;
Bool messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) const;
// As soon as you want the logic of these to be public, make a logical representation and have these call that instead.
static Bool shouldPlayLowPower( Player *localPlayer );
static Bool shouldPlayGenericHandler( Player * );
void playMessage(EvaMessage messageToTest, UnsignedInt currentFrame);
void processPlayingMessages(UnsignedInt currentFrame);
};
extern Eva *TheEva;
#endif /* __EVA_H__ */

View File

@@ -0,0 +1,74 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: ExtendedMessageBox.h /////////////////////////////////////////////////////////////////////
// Author: Matt Campbell, January 2003
// Description: We go quiet in 1 day, gold in 15. Poor time to rewrite message boxes, so
// we get this file instead. Phooey.
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __EXTENDEDMESSAGEBOX_H_
#define __EXTENDEDMESSAGEBOX_H_
#include "GameClient/GameWindowManager.h"
// return codes for message box callbacks
enum MessageBoxReturnType {
MB_RETURN_CLOSE,
MB_RETURN_KEEPOPEN
};
typedef MessageBoxReturnType (* MessageBoxFunc)( void *userData );
// WindowExMessageBoxData ---------------------------------------------------------
/** Data attached to each extended Message box window */
//-----------------------------------------------------------------------------
struct WindowExMessageBoxData
{
MessageBoxFunc yesCallback; ///<Function pointer to the Yes Button Callback
MessageBoxFunc noCallback; ///<Function pointer to the No Button Callback
MessageBoxFunc okCallback; ///<Function pointer to the Ok Button Callback
MessageBoxFunc cancelCallback; ///<Function pointer to the Cancel Button Callback
void *userData;
};
GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData,
MessageBoxFunc yesCallback, MessageBoxFunc noCallback);
GameWindow *ExMessageBoxYesNoCancel (UnicodeString titleString,UnicodeString bodyString, void *userData,
MessageBoxFunc yesCallback, MessageBoxFunc noCallback, MessageBoxFunc cancelCallback);
GameWindow *ExMessageBoxOkCancel (UnicodeString titleString,UnicodeString bodyString, void *userData,
MessageBoxFunc okCallback, MessageBoxFunc cancelCallback);
GameWindow *ExMessageBoxOk (UnicodeString titleString,UnicodeString bodyString, void *userData,
MessageBoxFunc okCallback);
GameWindow *ExMessageBoxCancel (UnicodeString titleString,UnicodeString bodyString, void *userData,
MessageBoxFunc cancelCallback);
#endif //__EXTENDEDMESSAGEBOX_H_

View File

@@ -0,0 +1,225 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: FXList.h /////////////////////////////////////////////////////////////////////////////////
// Author: Steven Johnson, December 2001
// Desc: General Effects Descriptions
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _FXList_H_
#define _FXList_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameMemory.h"
#include "Common/NameKeyGenerator.h"
#include "Common/STLTypedefs.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class FXNugget;
class FXList;
class FXListStore;
class INI;
class Object;
class Matrix3D;
//-------------------------------------------------------------------------------------------------
/**
An FXNugget encapsulates a particular type of audio/video effect. FXNuggets are virtually
never used on their own, but rather, as a component of an FXList (see below).
Important notes:
-- FXNugget is an ABC; all the implementations are (currently) located in FXList.cpp,
thought they will probably be spread out more as we add more implementations.
-- As part of an FXList, an FXNugget is shared between multiple units. The implication is that
an FXNugget should not require private data storage to do what it needs to do, aside from stuff
initialized at FXNugget instantiation time (eg, parameters from an INI file). To help
enforce this, all it's methods are declared 'const'. If you can't implement what you
need within this framework, please *don't* simply de-const things, because it could lead to very
strange side-effects. Instead, the system will have to be enhanced to allow for multiple instances
of each FXNugget.
-- an individual FXNugget is generally not directly accessible to anyone outside of the
FXList system; in fact, it could probably be a private class, but isn't, mainly for coding convenience.
-- Unlike most other game systems, FXNuggets can't be overridden by subsequent INI file
loads. This isn't really a problem, because all you really need to do to "override" one is to
specify a different one.
*/
class FXNugget : public MemoryPoolObject
{
MEMORY_POOL_GLUE_ABC(FXNugget)
public:
FXNugget() { }
//virtual ~FXNugget() { }
/**
The main guts of the system: actually perform the sound and/or video effects
needed. Note that primary and/or secondary can be null, so you must check for this.
*/
virtual void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f) const = 0;
/**
the object-based version... by default, just call the location-based implementation.
Note that primary and/or secondary can be null, so you must check for this.
*/
virtual void doFXObj(const Object* primary, const Object* secondary = NULL) const;
private:
};
EMPTY_DTOR(FXNugget)
//-------------------------------------------------------------------------------------------------
/**
An FXList is a way of encapsulating a particular set of audio/video effect(s).
Lots of other game systems (eg, DamageFX) use FXLists to abstract AV effects into data files
(rather than hardcoding them, which would be suboptimal).
Important notes:
-- an FXList is specified solely by name, and the only parameters it receives when performing
its AV effects are a primary (and optional secondary) object position.
-- There is no inheritance or overriding of FXLists; if you need an FXList that is nearly-but-not-quite
identical to an existing one, you must simply make an entirely new FXList. Realistically, this shouldn't
be a problem, since they are pretty simple to specify, and don't consume a lot of memory.
-- an FXList is shared between multiple units. To help
enforce this, all it's methods are declared 'const'. If you can't implement the stuff you
need within this framework, please *don't* simply de-const things, because it could lead to very
strange side-effects. Instead, the system will have to be enhanced to allow for multiple instances
of each FXNugget.
-- Unlike most other game systems, FXList can't be overridden by subsequent INI file
loads. This isn't really a problem, because all you really need to do to "override" one is to
specify a different one.
*/
class FXList
{
public:
FXList();
virtual ~FXList();
/**
Toss the contents.
*/
void clear();
/**
add a nugget to the list. It belongs to the FXList, who is responsible for freeing it.
*/
void addFXNugget(FXNugget *fxn)
{
m_nuggets.push_back(fxn);
}
/// inline convenience method to avoid having to check for null.
inline static void doFXPos(const FXList* fx, const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f)
{
if (fx) fx->doFXPos(primary, primaryMtx, primarySpeed, secondary, overrideRadius);
}
/// inline convenience method to avoid having to check for null.
inline static void doFXObj(const FXList* fx, const Object* primary, const Object* secondary = NULL)
{
if (fx)
{
fx->doFXObj(primary, secondary);
//if (fx->) // here we need to cal doFXRicochet, if fx calls for it
}
}
protected:
/**
The main guts of the system: actually perform the sound and/or video effects
needed. Note that primary and/or secondary can be null, so you must check for this.
*/
void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f) const;
/**
the object-based version... by default, just call the location-based implementation.
Note that primary and/or secondary can be null, so you must check for this.
*/
void doFXObj(const Object* primary, const Object* secondary = NULL) const;
private:
typedef std::list< FXNugget* > FXNuggetList;
FXNuggetList m_nuggets;
};
//-------------------------------------------------------------------------------------------------
/**
The "store" used to hold all the FXLists in existence.
*/
class FXListStore : public SubsystemInterface
{
public:
FXListStore();
~FXListStore();
void init() { }
void reset() { }
void update() { }
/**
return the FXList with the given namekey.
return NULL if no such FXList exists.
*/
const FXList *findFXList( const char* name ) const;
static void parseFXListDefinition(INI* ini);
private:
// use the hashing function for Ints.
typedef std::hash_map< NameKeyType, FXList, rts::hash<NameKeyType>, rts::equal_to<NameKeyType> > FXListMap;
FXListMap m_fxmap;
};
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern FXListStore *TheFXListStore;
#endif // _FXList_H_

View File

@@ -0,0 +1,43 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: FontDesc.h ///////////////////////////////////////////////////////////////////////////////
// Simple structure used to hold font descriptions.
// Author: Mark Wilczynski, October 2002
#pragma once
#ifndef _FONTDESC_H_
#define _FONTDESC_H_
#include "Common/GameType.h"
struct FontDesc
{
FontDesc(void);
AsciiString name; ///<name of font
Int size; ///<point size
Bool bold; ///<is bold?
};
#endif // _FONTDESC_H_

View File

@@ -0,0 +1,384 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GUICallbacks.h ///////////////////////////////////////////////////////////////////////////
// Created: Colin Day, June 2001
// Desc: GUI Callbacks header
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GUICALLBACKS_H_
#define __GUICALLBACKS_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
//=================================================================================================
// Shell Menus //
//=================================================================================================
// Main Menu --------------------------------------------------------------------------------------
extern void MainMenuInit( WindowLayout *layout, void *userData );
extern void MainMenuUpdate( WindowLayout *layout, void *userData );
extern void MainMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType MainMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Single Player Menu -----------------------------------------------------------------------------
extern void SinglePlayerMenuInit( WindowLayout *layout, void *userData );
extern void SinglePlayerMenuUpdate( WindowLayout *layout, void *userData );
extern void SinglePlayerMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Options Menu -----------------------------------------------------------------------------------
extern void OptionsMenuInit( WindowLayout *layout, void *userData );
extern void OptionsMenuUpdate( WindowLayout *layout, void *userData );
extern void OptionsMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType OptionsMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Map Select Menu --------------------------------------------------------------------------------
extern void MapSelectMenuInit( WindowLayout *layout, void *userData );
extern void MapSelectMenuUpdate( WindowLayout *layout, void *userData );
extern void MapSelectMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Replay Menu --------------------------------------------------------------------------------
extern void ReplayMenuInit( WindowLayout *layout, void *userData );
extern void ReplayMenuUpdate( WindowLayout *layout, void *userData );
extern void ReplayMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType ReplayMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Credits Menu --------------------------------------------------------------------------------
extern void CreditsMenuInit( WindowLayout *layout, void *userData );
extern void CreditsMenuUpdate( WindowLayout *layout, void *userData );
extern void CreditsMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType CreditsMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Score Screen --------------------------------------------------------------------------------
extern void ScoreScreenInit( WindowLayout *layout, void *userData );
extern void ScoreScreenUpdate( WindowLayout *layout, void *userData );
extern void ScoreScreenShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType ScoreScreenInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Save/Load Menu ----------------------------------------------------------------------------------
extern void SaveLoadMenuInit( WindowLayout *layout, void *userData );
extern void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData );
extern void SaveLoadMenuUpdate( WindowLayout *layout, void *userData );
extern void SaveLoadMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType SaveLoadMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Popup Communicator ------------------------------------------------------------------------------
extern void PopupCommunicatorInit( WindowLayout *layout, void *userData );
extern void PopupCommunicatorUpdate( WindowLayout *layout, void *userData );
extern void PopupCommunicatorShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType PopupCommunicatorInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// SkirmishGameOptionsMenu
extern void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData );
extern void SkirmishGameOptionsMenuUpdate( WindowLayout *layout, void *userData );
extern void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType SkirmishGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// SkirmishMapSelectMenu
extern void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData );
extern void SkirmishMapSelectMenuUpdate( WindowLayout *layout, void *userData );
extern void SkirmishMapSelectMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType SkirmishMapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Keyboard Options Menu ---------------------------------------------------------------------------
extern void KeyboardOptionsMenuInit( WindowLayout *layout, void *userData );
extern void KeyboardOptionsMenuUpdate( WindowLayout *layout, void *userData );
extern void KeyboardOptionsMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Lan Lobby Menu ----------------------------------------------------------------------------------
extern void LanLobbyMenuInit( WindowLayout *layout, void *userData );
extern void LanLobbyMenuUpdate( WindowLayout *layout, void *userData );
extern void LanLobbyMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType LanLobbyMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Lan Game Options Menu ---------------------------------------------------------------------------
extern void LanGameOptionsMenuInit( WindowLayout *layout, void *userData );
extern void LanGameOptionsMenuUpdate( WindowLayout *layout, void *userData );
extern void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType LanGameOptionsMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Lan Map Select Menu -----------------------------------------------------------------------------
extern void LanMapSelectMenuInit( WindowLayout *layout, void *userData );
extern void LanMapSelectMenuUpdate( WindowLayout *layout, void *userData );
extern void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Lan Map Select Menu -----------------------------------------------------------------------------
extern void GameInfoWindowInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// (Patch) Download Menu ----------------------------------------------------------------------------------
extern void DownloadMenuInit( WindowLayout *layout, void *userData );
extern void DownloadMenuUpdate( WindowLayout *layout, void *userData );
extern void DownloadMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Popup host Game Internet -----------------------------------------------------------------------------------
extern void DifficultySelectInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType DifficultySelectInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
//=================================================================================================
// WOL UI //
//=================================================================================================
// WOL Ladder Screen ---------------------------------------------------------------------------------
extern void WOLLadderScreenInit( WindowLayout *layout, void *userData );
extern void WOLLadderScreenUpdate( WindowLayout *layout, void *userData );
extern void WOLLadderScreenShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLLadderScreenInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Login Menu ---------------------------------------------------------------------------------
extern void WOLLoginMenuInit( WindowLayout *layout, void *userData );
extern void WOLLoginMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLLoginMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLLoginMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Locale Select Popup ---------------------------------------------------------------------------------
extern void WOLLocaleSelectInit( WindowLayout *layout, void *userData );
extern void WOLLocaleSelectUpdate( WindowLayout *layout, void *userData );
extern void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLLocaleSelectInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Message Window ------------------------------------------------------------------------------
extern void WOLMessageWindowInit( WindowLayout *layout, void *userData );
extern void WOLMessageWindowUpdate( WindowLayout *layout, void *userData );
extern void WOLMessageWindowShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLMessageWindowInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Quick Match Menu ----------------------------------------------------------------------------
extern void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData );
extern void WOLQuickMatchMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLQuickMatchMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLQuickMatchMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Welcome Menu --------------------------------------------------------------------------------
extern void WOLWelcomeMenuInit( WindowLayout *layout, void *userData );
extern void WOLWelcomeMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLWelcomeMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Welcome Menu --------------------------------------------------------------------------------
extern void WOLStatusMenuInit( WindowLayout *layout, void *userData );
extern void WOLStatusMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLStatusMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLStatusMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Quickmatch Score Screen --------------------------------------------------------------------------------
extern void WOLQMScoreScreenInit( WindowLayout *layout, void *userData );
extern void WOLQMScoreScreenUpdate( WindowLayout *layout, void *userData );
extern void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLQMScoreScreenInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Lobby Menu ---------------------------------------------------------------------------------
extern void WOLLobbyMenuInit( WindowLayout *layout, void *userData );
extern void WOLLobbyMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLLobbyMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Game Setup Menu ---------------------------------------------------------------------------------
extern void WOLGameSetupMenuInit( WindowLayout *layout, void *userData );
extern void WOLGameSetupMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLGameSetupMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Custom Score Screen --------------------------------------------------------------------------------
extern void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData );
extern void WOLCustomScoreScreenUpdate( WindowLayout *layout, void *userData );
extern void WOLCustomScoreScreenShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLCustomScoreScreenInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Map Select Overlay ---------------------------------------------------------------------------------
extern void WOLMapSelectMenuInit( WindowLayout *layout, void *userData );
extern void WOLMapSelectMenuUpdate( WindowLayout *layout, void *userData );
extern void WOLMapSelectMenuShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLMapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Buddy Overlay ---------------------------------------------------------------------------------
extern void WOLBuddyOverlayInit( WindowLayout *layout, void *userData );
extern void WOLBuddyOverlayUpdate( WindowLayout *layout, void *userData );
extern void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType WOLBuddyOverlayInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// WOL Buddy Overlay Right Click menu callbacks --------------------------------------------------------------
extern void WOLBuddyOverlayRCMenuInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// GameSpy Player Info Overlay ---------------------------------------------------------------------------------
extern void GameSpyPlayerInfoOverlayInit( WindowLayout *layout, void *userData );
extern void GameSpyPlayerInfoOverlayUpdate( WindowLayout *layout, void *userData );
extern void GameSpyPlayerInfoOverlayShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GameSpyPlayerInfoOverlayInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Popup host Game Internet -----------------------------------------------------------------------------------
extern void PopupHostGameInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType PopupHostGameInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Popup InGame Message Box -----------------------------------------------------------------------------------
extern void InGamePopupMessageInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType InGamePopupMessageInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Popup join Game Internet -----------------------------------------------------------------------------------
extern void PopupJoinGameInit( WindowLayout *layout, void *userData );
extern WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Network Direct ConnectWindow ---------------------------------------------------------------------------------
extern void NetworkDirectConnectInit( WindowLayout *layout, void *userData );
extern void NetworkDirectConnectUpdate( WindowLayout *layout, void *userData );
extern void NetworkDirectConnectShutdown( WindowLayout *layout, void *userData );
extern WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType NetworkDirectConnectInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
//=================================================================================================
// IME UI //
//=================================================================================================
// IME Candidate Window
extern WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData );
extern void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData );
//=================================================================================================
// In Game UI //
//=================================================================================================
// Control Bar ------------------------------------------------------------------------------------
extern WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType ControlBarInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern void ToggleControlBar( Bool immediate = TRUE );
extern void HideControlBar( Bool immediate = TRUE );
extern void ShowControlBar( Bool immediate = TRUE );
// Replay Controls --------------------------------------------------------------------------------
extern WindowMsgHandledType ReplayControlSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType ReplayControlInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// InGame Chat Controls --------------------------------------------------------------------------------
extern WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType InGameChatInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
enum InGameChatType
{
INGAME_CHAT_ALLIES,
INGAME_CHAT_EVERYONE,
INGAME_CHAT_PLAYERS
};
extern void ToggleInGameChat( Bool immediate = TRUE );
extern void HideInGameChat( Bool immediate = TRUE );
extern void ShowInGameChat( Bool immediate = TRUE );
void ResetInGameChat( void );
void SetInGameChatType( InGameChatType chatType );
Bool IsInGameChatActive();
// Diplomacy Controls --------------------------------------------------------------------------------
WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
WindowMsgHandledType DiplomacyInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
void ToggleDiplomacy( Bool immediate = TRUE );
void HideDiplomacy( Bool immediate = TRUE );
void ResetDiplomacy( void );
// Generals Exp Points --------------------------------------------------------------------------------
WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// IdleWorker Controls --------------------------------------------------------------------------------
WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Disconnect Menu --------------------------------------------------------------------------------
extern void ShowDisconnectWindow( void );
extern void HideDisconnectWindow( void );
extern WindowMsgHandledType DisconnectControlSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType DisconnectControlInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Establish Connections Window -------------------------------------------------------------------
extern void ShowEstablishConnectionsWindow( void );
extern void HideEstablishConnectionsWindow( void );
extern WindowMsgHandledType EstablishConnectionsControlSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType EstablishConnectionsControlInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// The in game quit menu --------------------------------------------------------------------------
extern void destroyQuitMenu();
extern void ToggleQuitMenu( void );
extern void HideQuitMenu( void );
extern WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Message of the Day -----------------------------------------------------------------------------
extern WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
// Message Box --------------------------------------------------------------------------------
extern WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 );
#endif // __GUICALLBACKS_H_

View File

@@ -0,0 +1,55 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GUICommandTranslator.h ///////////////////////////////////////////////////////////////////
// Author: Colin Day, March 2002
// Desc: Translator for commands activated from the selection GUI, such as special unit
// actions, that require additional clicks in the world like selecting a target
// object or location
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GUICOMMANDTRANSLATOR_H_
#define __GUICOMMANDTRANSLATOR_H_
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "GameClient/InGameUI.h"
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
class GUICommandTranslator : public GameMessageTranslator
{
public:
GUICommandTranslator( void );
~GUICommandTranslator( void );
virtual GameMessageDisposition translateGameMessage( const GameMessage *msg );
};
#endif // end __GUICOMMANDTRANSLATOR_H_

View File

@@ -0,0 +1,538 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Gadget.h /////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: Gadget.h
//
// Created: Colin Day, June 2001
//
// Desc: Game GUI user interface gadget controls
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGET_H_
#define __GADGET_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
#include "GameClient/Image.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
enum
{
GADGET_SIZE = 16,
HORIZONTAL_SLIDER_THUMB_WIDTH = 13,
HORIZONTAL_SLIDER_THUMB_HEIGHT = 16,
ENTRY_TEXT_LEN = 256,
STATIC_TEXT_LEN = 256,
};
// for listboxes
enum
{
TEXT_X_OFFSET = 5,
TEXT_Y_OFFSET = 2,
TEXT_WIDTH_OFFSET = 7,
TOTAL_OUTLINE_HEIGHT = 2 // Sum of heights of tom and bottom outline
};
enum
{
LISTBOX_TEXT = 1,
LISTBOX_IMAGE = 2
};
// Gadget window styles, keep in same order as WindowStyleNames[]
enum
{
GWS_PUSH_BUTTON = 0x00000001,
GWS_RADIO_BUTTON = 0x00000002,
GWS_CHECK_BOX = 0x00000004,
GWS_VERT_SLIDER = 0x00000008,
GWS_HORZ_SLIDER = 0x00000010,
GWS_SCROLL_LISTBOX = 0x00000020,
GWS_ENTRY_FIELD = 0x00000040,
GWS_STATIC_TEXT = 0x00000080,
GWS_PROGRESS_BAR = 0x00000100,
GWS_USER_WINDOW = 0x00000200,
GWS_MOUSE_TRACK = 0x00000400,
GWS_ANIMATED = 0x00000800,
GWS_TAB_STOP = 0x00001000,
GWS_TAB_CONTROL = 0x00002000,
GWS_TAB_PANE = 0x00004000,
GWS_COMBO_BOX = 0x00008000,
GWS_ALL_SLIDER = GWS_VERT_SLIDER | GWS_HORZ_SLIDER, // for convenience
GWS_GADGET_WINDOW = GWS_PUSH_BUTTON |
GWS_RADIO_BUTTON |
GWS_TAB_CONTROL |
GWS_CHECK_BOX |
GWS_VERT_SLIDER |
GWS_HORZ_SLIDER |
GWS_SCROLL_LISTBOX |
GWS_ENTRY_FIELD |
GWS_STATIC_TEXT |
GWS_COMBO_BOX |
GWS_PROGRESS_BAR,
};
// Gadget paramaters
enum
{
GP_DONT_UPDATE = 0x00000001,
};
// Gadget game messages (sent to their owners)
enum GadgetGameMessage
{
// Generic messages supported by all gadgets
GGM_LEFT_DRAG = 16384,
GGM_SET_LABEL,
GGM_GET_LABEL,
GGM_FOCUS_CHANGE,
GGM_RESIZED,
GGM_CLOSE, // This is the message that's passed to a window if it's registered as a"right Click Menu"
// Button messages
GBM_MOUSE_ENTERING,
GBM_MOUSE_LEAVING,
GBM_SELECTED,
GBM_SELECTED_RIGHT, // Right click selection
GBM_SET_SELECTION,
// Slider messages
GSM_SLIDER_TRACK,
GSM_SET_SLIDER,
GSM_SET_MIN_MAX,
GSM_SLIDER_DONE,
// Listbox messages
GLM_ADD_ENTRY,
GLM_DEL_ENTRY,
GLM_DEL_ALL,
GLM_SELECTED,
GLM_DOUBLE_CLICKED,
GLM_RIGHT_CLICKED,
// GLM_SET_INSERTPOS, // Not used since we now use multi column listboxes
GLM_SET_SELECTION,
GLM_GET_SELECTION,
GLM_TOGGLE_MULTI_SELECTION,
GLM_GET_TEXT,
// GLM_SET_TEXT, // Not used Removed just to make sure
GLM_SET_UP_BUTTON,
GLM_SET_DOWN_BUTTON,
GLM_SET_SLIDER,
GLM_SCROLL_BUFFER,
GLM_UPDATE_DISPLAY,
GLM_GET_ITEM_DATA,
GLM_SET_ITEM_DATA,
//ComboBox Messages
GCM_ADD_ENTRY,
GCM_DEL_ENTRY,
GCM_DEL_ALL,
GCM_SELECTED,
GCM_GET_TEXT,
GCM_SET_TEXT,
GCM_EDIT_DONE,
GCM_GET_ITEM_DATA,
GCM_SET_ITEM_DATA,
GCM_GET_SELECTION,
GCM_SET_SELECTION,
GCM_UPDATE_TEXT,
// Entry field messages
GEM_GET_TEXT,
GEM_SET_TEXT,
GEM_EDIT_DONE,
GEM_UPDATE_TEXT, //added so the parent will maintain real life status of the edit box.
// Slider messages
GPM_SET_PROGRESS,
};
// border types
enum
{
BORDER_CORNER_UL = 0,
BORDER_CORNER_UR,
BORDER_CORNER_LL,
BORDER_CORNER_LR,
BORDER_VERTICAL_LEFT,
BORDER_VERTICAL_LEFT_SHORT,
BORDER_VERTICAL_RIGHT,
BORDER_VERTICAL_RIGHT_SHORT,
BORDER_HORIZONTAL_TOP,
BORDER_HORIZONTAL_TOP_SHORT,
BORDER_HORIZONTAL_BOTTOM,
BORDER_HORIZONTAL_BOTTOM_SHORT,
NUM_BORDER_PIECES
};
// GadgetMsg ------------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _GadgetMsg
{
GameWindow *window; // Originator of message
Int data; // Data field
Int data2; // Data field
} GadgetMsgStruct, *GadgetMsg;
// SliderMsg ------------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _SliderMsg
{
GameWindow *window; // Originator of message
Int minVal; // Minimum slider value
Int maxVal; // Maximum slider value
Int position; // Current position of the slider
} SliderMsgStruct, *SliderMsg;
// ListboxMsg -----------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _ListboxMsg
{
GameWindow *window; // Originator of message
Int position; // Position of the entry
} ListboxMsgStruct, *ListboxMsg;
// SliderData -----------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _SliderData
{
Int minVal; // Minimum slider value
Int maxVal; // Maximum slider value
// The following fields are for internal use and
// should not be initialized by the user
Real numTicks; // Number of ticks between min and max
Int position; // Current position of the slider
} SliderData;
// EntryData ------------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _EntryData
{
DisplayString *text; ///< the entry text
DisplayString *sText; ///< for displaying 'secret' text
DisplayString *constructText; ///< for foriegn text construction
Bool secretText; ///< If TRUE text appears as astericks
Bool numericalOnly; ///< If TRUE only numbers are allowed as input
Bool alphaNumericalOnly; ///< If TRUE only numbers and letters are allowed as input
Bool aSCIIOnly; ///< If TRUE ascii allowed as input
Short maxTextLen; ///< Max length of edit text
// Colin: The very notion of entry width makes no sense to me since
// we already have a gadget width, and the max characters for
// an entry box so I am removing this.
// Short entryWidth; ///< Width, in pixels, of the entry box
// The following fields are for internal use and
// should not be initialized by the user
Bool receivedUnichar; // If TRUE system just processed a UniChar
Bool drawTextFromStart; // if FALSE, make sure end of text is visible
GameWindow *constructList; // Listbox for construct list.
UnsignedShort charPos; // Position of current character
UnsignedShort conCharPos; // Position of current contruct character
} EntryData;
// TextData -------------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _TextData
{
DisplayString *text; ///< the text data
Bool centered;
} TextData;
// ListEntryCell --------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _ListEntryCell
{
Int cellType; // Holds either LISTBOX_TEXT or LISTBOX_IMAGE
Color color; // use this color
void *data; // pointer to either a DisplayString or an image
void *userData; // Attach user data to the cell
Int width; // Used if this is an image and we don't want to use the default
Int height; // used if this is an image and we don't want ot use the default
} ListEntryCell;
// ListEntryRow ---------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _ListEntryRow
{
// The following fields are for internal use and
// should not be initialized by the user
Int listHeight; // calculated total Height at the bottom of this entry
Byte height; // Maintain the height of the row
ListEntryCell *cell; // Holds the array of ListEntry Cells
} ListEntryRow;
// ListboxData ----------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _ListboxData
{
Short listLength; // Max Number of entries in the list
Short columns; // Number of Columns each line has
Int *columnWidthPercentage; // Holds the percentage value of each column in an Int array;
Bool autoScroll; // If add exceeds number of lines in display
// scroll up automatically
Bool autoPurge; // If add exceeds number of entries in list
// delete top entry automatically
Bool scrollBar; // Automatically create the up/down/slider buttons
Bool multiSelect; // Allow for multiple selections
Bool forceSelect; // Do not allow users to unselect from a listbox
Bool scrollIfAtEnd; // If we're looking at the bottom of the listbox when a new entry is added,
// scroll up automatically
Bool audioFeedback; // Audio click feedback?
//
// The following fields are for internal use and should not be initialized
// by the user
//
Int *columnWidth; // Pointer to array of column widths based off of user input
ListEntryRow *listData; // Pointer to an array of ListEntryRows that we create when we first create the List
GameWindow *upButton; // Child window for up arrow
GameWindow *downButton; // Child window for down arrow
GameWindow *slider; // Child window for slider bar
Int totalHeight; // total height of all entries
Short endPos; // End Insertion position
Short insertPos; // Insertion position
Int selectPos; // Position of current selected entry (for SINGLE select)
Int *selections; // Pointer to array of selections (for MULTI select)
Short displayHeight; // Height in pixels of listbox display region
// this is computed based on the existance
// of a title or not.
UnsignedInt doubleClickTime; //
Short displayPos; // Position of current display entry in pixels
} ListboxData;
// ComboBoxData ---------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _ComboBoxData
{
Bool isEditable; // Determines if the Combo box is a combo box or a dropdown box
Int maxDisplay; // Holds the count for the maximum displayed in the lisbox before the slider appears
Int maxChars; // Holds how many characters can be in the listbox/edit box.
Bool asciiOnly; // Used to notify the Text Entry box if it is suppose to allow only ascii characters
Bool lettersAndNumbersOnly; // Used to notify the Text Entry Box if it is to only allow letters and numbers
ListboxData *listboxData; // Needed for the listbox component of the combo box
EntryData *entryData; // Needed for the text entry component of the combo box
//
// The following fields are for internal use and should not be initialized
// by the user
//
Bool dontHide; // A flag we'll use that'll determine if we hide the listbox or not when selected
Int entryCount; // Current number of entries.
GameWindow *dropDownButton; // Child window for drop down button
GameWindow *editBox; // Child window for edit box
GameWindow *listBox; // Child window for list box
} ComboBoxData;
// RadioButtonData ------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef struct _RadioButtonData
{
Int screen; ///< screen identifier
Int group; ///< group identifier
} RadioButtonData;
// PushButtonData -------------------------------------------------------------
//-----------------------------------------------------------------------------
#define NO_CLOCK 0
#define NORMAL_CLOCK 1
#define INVERSE_CLOCK 2
typedef struct _PushButtonData
{
UnsignedByte drawClock; ///< We only want to draw the clock if, well, we want to
Int percentClock; ///< The percentage of the clock we want to draw
Color colorClock; ///< The color to display the clock at
Bool drawBorder; ///< We only want to draw the border if we want to
Color colorBorder; ///< The color for the border around the button
void *userData; ///< random additional data we can set
const Image *overlayImage; ///< An overlay image (like a veterancy symbol)
AsciiString altSound; ///< use an alternitive sound if one is set
} PushButtonData;
// TabControlData ------------------------------------------------------------
//-----------------------------------------------------------------------------
enum //Tab Position
{
TP_CENTER,//Orientation
TP_TOPLEFT,
TP_BOTTOMRIGHT,
TP_TOP_SIDE,//... on which side
TP_RIGHT_SIDE,
TP_LEFT_SIDE,
TP_BOTTOM_SIDE
};
enum
{
NUM_TAB_PANES = 8,//(MAX_DRAW_DATA - 1)
};
typedef struct _TabControlData
{
//Set in editor
Int tabOrientation;
Int tabEdge;
Int tabWidth;
Int tabHeight;
Int tabCount;
GameWindow *subPanes[NUM_TAB_PANES];
Bool subPaneDisabled[NUM_TAB_PANES];//tabCount will control how many even exist. Individual ones can be disabled
Int paneBorder;
//Working computations
Int activeTab;
Int tabsLeftLimit;
Int tabsRightLimit;
Int tabsTopLimit;
Int tabsBottomLimit;
} TabControlData;
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
extern WindowMsgHandledType GadgetPushButtonSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetCheckBoxSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetTabControlInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetTabControlSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetStaticTextInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
extern Bool InitializeEntryGadget( void );
extern Bool ShutdownEntryGadget( void );
// Entry Gadget Functions
extern void InformEntry( WideChar c );
// list box stuff
extern Int GetListboxTopEntry( ListboxData list );
#endif // __GADGET_H_

View File

@@ -0,0 +1,144 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetCheckBox.h /////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetCheckBox.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for checkboxes
//
// CheckBox IMAGE/COLOR organization
// When control is enabled:
// enabledDrawData[ 0 ] is the background image for the whole enabled control
// enabledDrawData[ 1 ] is the enabled, unselected check box
// enabledDrawData[ 2 ] is the enabled, selected check box
//
// When control is disabled:
// disabledDrawData[ 0 ] is the background image for the whole disabled control
// disabledDrawData[ 1 ] is the disabled, unselected check box
// disabledDrawData[ 2 ] si the disabled, selected check box
//
// When control is hilited (mouse over it and enabled)
// hiliteDrawData[ 0 ] is the background image for the whole hilited control
// hiliteDrawData[ 1 ] is the hilited, unselected check box
// hiliteDrawData[ 2 ] is the hilited, selected check box
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETCHECKBOX_H_
#define __GADGETCHECKBOX_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text );
extern Bool GadgetCheckBoxIsChecked( GameWindow *g );
extern void GadgetCheckBoxSetChecked( GameWindow *g, Bool isChecked);
inline void GadgetCheckBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetCheckBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetCheckBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetCheckBoxSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetCheckBoxSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline void GadgetCheckBoxSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetCheckBoxSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); }
inline void GadgetCheckBoxSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); }
inline const Image *GadgetCheckBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetCheckBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetCheckBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetCheckBoxGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline Color GadgetCheckBoxGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline const Image *GadgetCheckBoxGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline Color GadgetCheckBoxGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); }
inline Color GadgetCheckBoxGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); }
inline void GadgetCheckBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetCheckBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetCheckBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetCheckBoxSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetCheckBoxSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline void GadgetCheckBoxSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetCheckBoxSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); }
inline void GadgetCheckBoxSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); }
inline const Image *GadgetCheckBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetCheckBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetCheckBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetCheckBoxGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline Color GadgetCheckBoxGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline const Image *GadgetCheckBoxGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline Color GadgetCheckBoxGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); }
inline Color GadgetCheckBoxGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); }
inline void GadgetCheckBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetCheckBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetCheckBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetCheckBoxSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetCheckBoxSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline void GadgetCheckBoxSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetCheckBoxSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); }
inline void GadgetCheckBoxSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); }
inline const Image *GadgetCheckBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetCheckBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetCheckBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetCheckBoxGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline Color GadgetCheckBoxGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline const Image *GadgetCheckBoxGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline Color GadgetCheckBoxGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); }
inline Color GadgetCheckBoxGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETCHECKBOX_H_

View File

@@ -0,0 +1,198 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetComboBox.h //////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetComboBox.h
//
// Created: Chris Huybregts, November 2001
//
// Desc: Helpful interface for ComboBoxes
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETCOMBOBOX_H_
#define __GADGETCOMBOBOX_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/Gadget.h"
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font );
extern UnicodeString GadgetComboBoxGetText( GameWindow *comboBox );
extern void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text );
extern Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color );
extern void GadgetComboBoxReset( GameWindow *comboBox );
extern void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide = FALSE );
extern void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex );
extern void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data );
extern void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index );
extern Int GadgetComboBoxGetLength( GameWindow *comboBox );
extern void GadgetComboBoxHideList( GameWindow *comboBox );
// Functions that set the ComboBoxData Paramaters
extern void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly );
extern void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly );
extern void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars );
extern void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay );
extern void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable );
//setup all the Font Colors
extern void GadgetComboBoxSetEnabledTextColors( GameWindow *comboBox,Color color, Color borderColor );
extern void GadgetComboBoxSetDisabledTextColors( GameWindow *comboBox,Color color, Color borderColor );
extern void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor );
extern void GadgetComboBoxSetIMECompositeTextColors( GameWindow *comboBox, Color color, Color borderColor );
//
// you can use this to set the colors for the list box all at once, note that
// it will also automatically change the colors for any attached slider
// and those slider buttons and thumb as well as the drop down button and edit box.
//
extern void GadgetComboBoxSetColors( GameWindow *comboBox,
Color enabledColor,
Color enabledBorderColor,
Color enabledSelectedItemColor,
Color enabledSelectedItemBorderColor,
Color disabledColor,
Color disabledBorderColor,
Color disabledSelectedItemColor,
Color disabledSelectedItemBorderColor,
Color hiliteColor,
Color hiliteBorderColor,
Color hiliteSelectedItemColor,
Color hiliteSelectedItemBorderColor );
inline void GadgetComboBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetComboBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetComboBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetComboBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetComboBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetComboBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); }
inline void GadgetComboBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetComboBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline const Image *GadgetComboBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetComboBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetComboBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetComboBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetComboBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image *GadgetComboBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline const Image *GadgetComboBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); }
inline Color GadgetComboBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetComboBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline void GadgetComboBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetComboBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetComboBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetComboBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetComboBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetComboBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); }
inline void GadgetComboBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetComboBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline const Image *GadgetComboBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetComboBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetComboBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetComboBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetComboBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image *GadgetComboBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline const Image *GadgetComboBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); }
inline Color GadgetComboBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetComboBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline void GadgetComboBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetComboBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetComboBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetComboBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetComboBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetComboBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); }
inline void GadgetComboBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetComboBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline const Image *GadgetComboBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetComboBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetComboBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetComboBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetComboBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image *GadgetComboBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline const Image *GadgetComboBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline Color GadgetComboBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetComboBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline GameWindow *GadgetComboBoxGetDropDownButton( GameWindow *g )
{
ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData();
if( comboBoxData && comboBoxData->dropDownButton )
return comboBoxData->dropDownButton;
return NULL;
}
inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g )
{
ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData();
if( comboBoxData && comboBoxData->listBox)
return comboBoxData->listBox;
return NULL;
}
inline GameWindow *GadgetComboBoxGetEditBox( GameWindow *g )
{
ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData();
if( comboBoxData && comboBoxData->editBox)
return comboBoxData->editBox;
return NULL;
}
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETLISTBOX_H_

View File

@@ -0,0 +1,213 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetListBox.h //////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetListBox.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for ListBoxes
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETLISTBOX_H_
#define __GADGETLISTBOX_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/Gadget.h"
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
typedef struct _RightClickStruct
{
Int mouseX;
Int mouseY;
Int pos;
} RightClickStruct;
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column);
extern void GadgetListboxCreateScrollbar( GameWindow *listbox );
extern void GadgetListBoxAddMultiSelect( GameWindow *listbox );
extern void GadgetListBoxRemoveMultiSelect( GameWindow *listbox );
extern void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength );
extern Int GadgetListBoxGetListLength( GameWindow *listbox );
extern Int GadgetListBoxGetNumEntries( GameWindow *listbox );
extern Int GadgetListBoxGetNumColumns( GameWindow *listbox );
extern Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column );
extern void GadgetListBoxSetFont( GameWindow *listbox, GameFont *font );
extern UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column = 0);
extern UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column = 0);
extern Int GadgetListBoxAddEntryText( GameWindow *listbox, UnicodeString text, Color color, Int row, Int column = -1, Bool overwrite = TRUE);
extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image,
Int row, Int column = -1,
Bool overwrite = TRUE, Color color = 0xFFFFFFFF );
extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image,
Int row, Int column,
Int hight, Int width,
Bool overwrite = TRUE, Color color = 0xFFFFFFFF );
extern void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex );
extern void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount = 1 );
extern void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList );
extern void GadgetListBoxReset( GameWindow *listbox );
extern void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column = 0);
extern void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column = 0);
extern bool GadgetListBoxIsFull(GameWindow *window);
extern Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window );
extern void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos );
extern Int GadgetListBoxGetTopVisibleEntry( GameWindow *window );
extern void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos );
extern void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable );
//
// you can use this to set the colors for the list box all at once, note that
// it will also automatically change the colors for any attached slider
// and those slider buttons and thumb
//
extern void GadgetListBoxSetColors( GameWindow *listbox,
Color enabledColor,
Color enabledBorderColor,
Color enabledSelectedItemColor,
Color enabledSelectedItemBorderColor,
Color disabledColor,
Color disabledBorderColor,
Color disabledSelectedItemColor,
Color disabledSelectedItemBorderColor,
Color hiliteColor,
Color hiliteBorderColor,
Color hiliteSelectedItemColor,
Color hiliteSelectedItemBorderColor );
inline void GadgetListBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetListBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetListBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetListBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetListBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); }
inline void GadgetListBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetListBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetListBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetListBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline const Image *GadgetListBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); }
inline Color GadgetListBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetListBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline void GadgetListBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetListBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetListBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetListBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetListBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); }
inline void GadgetListBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetListBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetListBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetListBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline const Image *GadgetListBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); }
inline Color GadgetListBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetListBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline void GadgetListBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetListBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetListBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetListBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetListBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); }
inline void GadgetListBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetListBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline const Image *GadgetListBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetListBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetListBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline const Image *GadgetListBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline Color GadgetListBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetListBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline GameWindow *GadgetListBoxGetSlider( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->slider )
return listData->slider;
return NULL;
}
inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->upButton )
return listData->upButton;
return NULL;
}
inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g )
{
ListboxData *listData = (ListboxData *)g->winGetUserData();
if( listData && listData->downButton )
return listData->downButton;
return NULL;
}
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETLISTBOX_H_

View File

@@ -0,0 +1,146 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetProgressBar.h //////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetProgressBar.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for ProgressBars
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETPROGRESSBAR_H_
#define __GADGETPROGRESSBAR_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
extern void GadgetProgressBarSetProgress( GameWindow *g, Int progress );
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
inline void GadgetProgressBarSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetProgressBarSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetProgressBarSetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetProgressBarSetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetProgressBarSetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetProgressBarSetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetProgressBarSetEnabledBarColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 4, color ); }
inline void GadgetProgressBarSetEnabledBarBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 4, color ); }
inline void GadgetProgressBarSetEnabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); }
inline void GadgetProgressBarSetEnabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); }
inline void GadgetProgressBarSetEnabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); }
inline void GadgetProgressBarSetEnabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 7, image ); }
inline Color GadgetProgressBarGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetProgressBarGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetProgressBarGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline const Image * GadgetProgressBarGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image * GadgetProgressBarGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image * GadgetProgressBarGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline Color GadgetProgressBarGetEnabledBarColor( GameWindow *g ) { return g->winGetEnabledColor( 4 ); }
inline Color GadgetProgressBarGetEnabledBarBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 4 ); }
inline const Image * GadgetProgressBarGetEnabledBarImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 4 ); }
inline const Image * GadgetProgressBarGetEnabledBarImageRight( GameWindow *g ) { return g->winGetEnabledImage( 5 ); }
inline const Image * GadgetProgressBarGetEnabledBarImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 6 ); }
inline const Image * GadgetProgressBarGetEnabledBarImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 7 ); }
//-----------------------------------------------------------------------------
inline void GadgetProgressBarSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetProgressBarSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetProgressBarSetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetProgressBarSetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetProgressBarSetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetProgressBarSetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetProgressBarSetDisabledBarColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 4, color ); }
inline void GadgetProgressBarSetDisabledBarBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 4, color ); }
inline void GadgetProgressBarSetDisabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); }
inline void GadgetProgressBarSetDisabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); }
inline void GadgetProgressBarSetDisabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); }
inline void GadgetProgressBarSetDisabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 7, image ); }
inline Color GadgetProgressBarGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetProgressBarGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetProgressBarGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline const Image * GadgetProgressBarGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image * GadgetProgressBarGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image * GadgetProgressBarGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline Color GadgetProgressBarGetDisabledBarColor( GameWindow *g ) { return g->winGetDisabledColor( 4 ); }
inline Color GadgetProgressBarGetDisabledBarBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 4 ); }
inline const Image * GadgetProgressBarGetDisabledBarImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 4 ); }
inline const Image * GadgetProgressBarGetDisabledBarImageRight( GameWindow *g ) { return g->winGetDisabledImage( 5 ); }
inline const Image * GadgetProgressBarGetDisabledBarImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 6 ); }
inline const Image * GadgetProgressBarGetDisabledBarImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 7 ); }
//-----------------------------------------------------------------------------
inline void GadgetProgressBarSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetProgressBarSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetProgressBarSetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetProgressBarSetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetProgressBarSetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetProgressBarSetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetProgressBarSetHiliteBarColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 4, color ); }
inline void GadgetProgressBarSetHiliteBarBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 4, color ); }
inline void GadgetProgressBarSetHiliteBarImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); }
inline void GadgetProgressBarSetHiliteBarImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); }
inline void GadgetProgressBarSetHiliteBarImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); }
inline void GadgetProgressBarSetHiliteBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 7, image ); }
inline Color GadgetProgressBarGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetProgressBarGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetProgressBarGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline const Image * GadgetProgressBarGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image * GadgetProgressBarGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image * GadgetProgressBarGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline Color GadgetProgressBarGetHiliteBarColor( GameWindow *g ) { return g->winGetHiliteColor( 4 ); }
inline Color GadgetProgressBarGetHiliteBarBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 4 ); }
inline const Image * GadgetProgressBarGetHiliteBarImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline const Image * GadgetProgressBarGetHiliteBarImageRight( GameWindow *g ) { return g->winGetHiliteImage( 5 ); }
inline const Image * GadgetProgressBarGetHiliteBarImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 6 ); }
inline const Image * GadgetProgressBarGetHiliteBarImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 7 ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETPROGRESSBAR_H_

View File

@@ -0,0 +1,177 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetPushButton.h ///////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetPushButton.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for PushButtons
//
// PushButton IMAGE/COLOR organization
// When control is enabled:
// enabledDrawData[ 0 ] is the background image for the whole enabled control
// enabledDrawData[ 1 ] is the enabled, selected button graphic
//
// When control is disabled:
// disabledDrawData[ 0 ] is the background image for the whole disabled control
// disabledDrawData[ 1 ] is the disabled, but selected button graphic
//
// When control is hilited (mouse over it and enabled)
// hiliteDrawData[ 0 ] is the background image for the whole hilited control
// hiliteDrawData[ 1 ] is the hilited, selected button graphic
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETPUSHBUTTON_H_
#define __GADGETPUSHBUTTON_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked );
Bool GadgetCheckLikeButtonIsChecked( GameWindow *g );
void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initiallyChecked );
void GadgetButtonSetText( GameWindow *g, UnicodeString text );
void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ); //Darkens the progress
void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ); //Darkens the remaining portion.
void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image );
void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE );
void GadgetButtonSetData(GameWindow *g, void *data);
void *GadgetButtonGetData(GameWindow *g);
void GadgetButtonSetAltSound( GameWindow *g, AsciiString altSound );
inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );}
inline void GadgetButtonSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetButtonSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );}
inline void GadgetButtonSetEnabledSelectedColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetButtonSetEnabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline const Image *GadgetButtonGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetButtonGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetButtonGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetButtonGetEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline Color GadgetButtonGetEnabledSelectedColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetButtonGetEnabledSelectedBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );}
inline void GadgetButtonSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetButtonSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );}
inline void GadgetButtonSetDisabledSelectedColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetButtonSetDisabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline const Image *GadgetButtonGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetButtonGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetButtonGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetButtonGetDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline Color GadgetButtonGetDisabledSelectedColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetButtonGetDisabledSelectedBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );}
inline void GadgetButtonSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetButtonSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );}
inline void GadgetButtonSetHiliteSelectedColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetButtonSetHiliteSelectedBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline const Image *GadgetButtonGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetButtonGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetButtonGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetButtonGetHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline Color GadgetButtonGetHiliteSelectedColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetButtonGetHiliteSelectedBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline const Image *GadgetButtonGetLeftHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetButtonGetMiddleHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline const Image *GadgetButtonGetRightHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline const Image *GadgetButtonGetLeftHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline const Image *GadgetButtonGetMiddleHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); }
inline const Image *GadgetButtonGetRightHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 6 ); }
inline void GadgetButtonSetLeftHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetButtonSetMiddleHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetButtonSetRightHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); }
inline void GadgetButtonSetLeftHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetButtonSetMiddleHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); }
inline void GadgetButtonSetRightHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); }
inline const Image *GadgetButtonGetLeftDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetButtonGetMiddleDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline const Image *GadgetButtonGetRightDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 4 ); }
inline const Image *GadgetButtonGetLeftDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline const Image *GadgetButtonGetMiddleDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 5 ); }
inline const Image *GadgetButtonGetRightDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 6 ); }
inline void GadgetButtonSetLeftDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetButtonSetMiddleDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetButtonSetRightDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); }
inline void GadgetButtonSetLeftDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetButtonSetMiddleDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); }
inline void GadgetButtonSetRightDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); }
inline const Image *GadgetButtonGetLeftEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetButtonGetMiddleEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline const Image *GadgetButtonGetRightEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 4 ); }
inline const Image *GadgetButtonGetLeftEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline const Image *GadgetButtonGetMiddleEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 5 ); }
inline const Image *GadgetButtonGetRightEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 6 ); }
inline void GadgetButtonSetLeftEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetButtonSetMiddleEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetButtonSetRightEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); }
inline void GadgetButtonSetLeftEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetButtonSetMiddleEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); }
inline void GadgetButtonSetRightEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETPUSHBUTTON_H_

View File

@@ -0,0 +1,152 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetRadioButton.h //////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetRadioButton.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for RadioButtons
//
// RadioButton IMAGE/COLOR organization
// When control is enabled:
// enabledDrawData[ 0 ] is the background image for the whole enabled control
// enabledDrawData[ 1 ] is the enabled, unselected radio box
// enabledDrawData[ 2 ] is the enabled, selected radio box
//
// When control is disabled:
// disabledDrawData[ 0 ] is the background image for the whole disabled control
// disabledDrawData[ 1 ] is the disabled, unselected radio box
// disabledDrawData[ 2 ] si the disabled, selected radio box
//
// When control is hilited (mouse over it and enabled)
// hiliteDrawData[ 0 ] is the background image for the whole hilited control
// hiliteDrawData[ 1 ] is the hilited, unselected radio box
// hiliteDrawData[ 2 ] is the hilited, selected radio box
//
// GadgetRadioGetEnabledImage // LEFT
// GadgetRadioGetEnabledUncheckedBoxImage // Middle
// GadgetRadioGetEnabledCheckedBoxImage // right
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETRADIOBUTTON_H_
#define __GADGETRADIOBUTTON_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern void GadgetRadioSetText( GameWindow *g, UnicodeString text );
extern void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg );
extern void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen );
inline void GadgetRadioSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetRadioSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetRadioSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline void GadgetRadioSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetRadioSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); }
inline void GadgetRadioSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); }
inline void GadgetRadioSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetRadioSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); }
inline void GadgetRadioSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); }
inline const Image *GadgetRadioGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetRadioGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetRadioGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
inline const Image *GadgetRadioGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline Color GadgetRadioGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); }
inline Color GadgetRadioGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); }
inline const Image *GadgetRadioGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline Color GadgetRadioGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); }
inline Color GadgetRadioGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); }
inline void GadgetRadioSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetRadioSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetRadioSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline void GadgetRadioSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetRadioSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); }
inline void GadgetRadioSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); }
inline void GadgetRadioSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetRadioSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); }
inline void GadgetRadioSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); }
inline const Image *GadgetRadioGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetRadioGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetRadioGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
inline const Image *GadgetRadioGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline Color GadgetRadioGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); }
inline Color GadgetRadioGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); }
inline const Image *GadgetRadioGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline Color GadgetRadioGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); }
inline Color GadgetRadioGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); }
inline void GadgetRadioSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetRadioSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetRadioSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline void GadgetRadioSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetRadioSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); }
inline void GadgetRadioSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); }
inline void GadgetRadioSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetRadioSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); }
inline void GadgetRadioSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); }
inline const Image *GadgetRadioGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetRadioGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetRadioGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
inline const Image *GadgetRadioGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline Color GadgetRadioGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); }
inline Color GadgetRadioGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); }
inline const Image *GadgetRadioGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline Color GadgetRadioGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); }
inline Color GadgetRadioGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); }
inline const Image *GadgetRadioGetSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline const Image *GadgetRadioGetSelectedUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); }
inline const Image *GadgetRadioGetSelectedCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETRADIOBUTTON_H_

View File

@@ -0,0 +1,445 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetSlider.h ///////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetSlider.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for Sliders
//
// Slider Sliders are constructed of 4 pieces, two end pieces,
// a repeating center, and a smaller repeating center pieces
// to fill small seams. Since there are vertical sliders
// and horizontal sliders, the LEFT end of a horizontal
// slider is stored in the same place as the TOP end for a
// vertical slider. The RIGHT end of a horizontal is
// also equivalent to the BOTTOM end of a vertical one.
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETSLIDER_H_
#define __GADGETSLIDER_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
#include "GameClient/GameWindowManager.h"
#include "GameClient/GadgetPushButton.h"
#include "GameClient/Gadget.h"
#include "GameClient/Image.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
enum{
HORIZONTAL_SLIDER_THUMB_POSITION = HORIZONTAL_SLIDER_THUMB_HEIGHT *2/3
};
// INLINING ///////////////////////////////////////////////////////////////////
inline void GadgetSliderGetMinMax( GameWindow *g, Int *min, Int *max )
{
SliderData *sData = (SliderData *)g->winGetUserData();
*max = sData->maxVal;
*min = sData->minVal;
}
inline GameWindow *GadgetSliderGetThumb( GameWindow *g ) { return g->winGetChild(); }
inline void GadgetSliderSetPosition( GameWindow *win, Int pos )
{
TheWindowManager->winSendSystemMsg( win,
GSM_SET_SLIDER,
pos,
0 );
}
inline Int GadgetSliderGetPosition( GameWindow *win )
{
SliderData *sData = (SliderData *)win->winGetUserData();
if (sData)
{
return sData->position;
}
return -1;
}
// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center
inline void GadgetSliderSetEnabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter )
{
g->winSetEnabledImage( 0, left );
g->winSetEnabledImage( 1, right );
g->winSetEnabledImage( 2, center );
g->winSetEnabledImage( 3, smallCenter );
}
inline void GadgetSliderSetEnabledImageLeft( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); }
inline void GadgetSliderSetEnabledImageTop( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); }
inline void GadgetSliderSetEnabledImageRight( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); }
inline void GadgetSliderSetEnabledImageBottom( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); }
inline void GadgetSliderSetEnabledImageCenter( GameWindow *g, const Image *center ) { g->winSetEnabledImage( 2, center ); }
inline void GadgetSliderSetEnabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetEnabledImage( 3, smallCenter ); }
inline void GadgetSliderSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetSliderSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline const Image *GadgetSliderGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline const Image *GadgetSliderGetEnabledImageTop( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline const Image *GadgetSliderGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetSliderGetEnabledImageBottom( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetSliderGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image *GadgetSliderGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline Color GadgetSliderGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetSliderGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center
inline void GadgetSliderSetDisabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter )
{
g->winSetDisabledImage( 0, left );
g->winSetDisabledImage( 1, right );
g->winSetDisabledImage( 2, center );
g->winSetDisabledImage( 3, smallCenter );
}
inline void GadgetSliderSetDisabledImageLeft( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); }
inline void GadgetSliderSetDisabledImageTop( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); }
inline void GadgetSliderSetDisabledImageRight( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); }
inline void GadgetSliderSetDisabledImageBottom( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); }
inline void GadgetSliderSetDisabledImageCenter( GameWindow *g, const Image *center ) { g->winSetDisabledImage( 2, center ); }
inline void GadgetSliderSetDisabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetDisabledImage( 3, smallCenter ); }
inline void GadgetSliderSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetSliderSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline const Image *GadgetSliderGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline const Image *GadgetSliderGetDisabledImageTop( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline const Image *GadgetSliderGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetSliderGetDisabledImageBottom( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetSliderGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image *GadgetSliderGetDisabledImageSmallCenter( GameWindow *g ){ return g->winGetDisabledImage( 3 ); }
inline Color GadgetSliderGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetSliderGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center
inline void GadgetSliderSetHiliteImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter )
{
g->winSetHiliteImage( 0, left );
g->winSetHiliteImage( 1, right );
g->winSetHiliteImage( 2, center );
g->winSetHiliteImage( 3, smallCenter );
}
inline void GadgetSliderSetHiliteImageLeft( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); }
inline void GadgetSliderSetHiliteImageTop( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); }
inline void GadgetSliderSetHiliteImageRight( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); }
inline void GadgetSliderSetHiliteImageBottom( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); }
inline void GadgetSliderSetHiliteImageCenter( GameWindow *g, const Image *center ) { g->winSetHiliteImage( 2, center ); }
inline void GadgetSliderSetHiliteImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetHiliteImage( 3, smallCenter ); }
inline void GadgetSliderSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetSliderSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline const Image *GadgetSliderGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline const Image *GadgetSliderGetHiliteImageTop( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline const Image *GadgetSliderGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetSliderGetHiliteImageBottom( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetSliderGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image *GadgetSliderGetHiliteImageSmallCenter( GameWindow *g ){ return g->winGetHiliteImage( 3 ); }
inline Color GadgetSliderGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetSliderGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
///////////////////////////////////////////////////////////////////////////////
// Functions to set the images and colors for the slider thumb
///////////////////////////////////////////////////////////////////////////////
// enabled
inline void GadgetSliderSetEnabledThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledImage( thumb, image );
}
inline void GadgetSliderSetEnabledThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledColor( thumb, color );
}
inline void GadgetSliderSetEnabledThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledBorderColor( thumb, color );
}
inline void GadgetSliderSetEnabledSelectedThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledSelectedImage( thumb, image );
}
inline void GadgetSliderSetEnabledSelectedThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledSelectedColor( thumb, color );
}
inline void GadgetSliderSetEnabledSelectedThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetEnabledSelectedBorderColor( thumb, color );
}
inline const Image *GadgetSliderGetEnabledThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetEnabledThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetEnabledThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline const Image *GadgetSliderGetEnabledSelectedThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledSelectedImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetEnabledSelectedThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledSelectedColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetEnabledSelectedThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetEnabledSelectedBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
// disabled
inline void GadgetSliderSetDisabledThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledImage( thumb, image );
}
inline void GadgetSliderSetDisabledThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledColor( thumb, color );
}
inline void GadgetSliderSetDisabledThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledBorderColor( thumb, color );
}
inline void GadgetSliderSetDisabledSelectedThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledSelectedImage( thumb, image );
}
inline void GadgetSliderSetDisabledSelectedThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledSelectedColor( thumb, color );
}
inline void GadgetSliderSetDisabledSelectedThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetDisabledSelectedBorderColor( thumb, color );
}
inline const Image *GadgetSliderGetDisabledThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetDisabledThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetDisabledThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline const Image *GadgetSliderGetDisabledSelectedThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledSelectedImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetDisabledSelectedThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledSelectedColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetDisabledSelectedThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetDisabledSelectedBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
// hilite
inline void GadgetSliderSetHiliteThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteImage( thumb, image );
}
inline void GadgetSliderSetHiliteThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteColor( thumb, color );
}
inline void GadgetSliderSetHiliteThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteBorderColor( thumb, color );
}
inline void GadgetSliderSetHiliteSelectedThumbImage( GameWindow *g, const Image *image )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteSelectedImage( thumb, image );
}
inline void GadgetSliderSetHiliteSelectedThumbColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteSelectedColor( thumb, color );
}
inline void GadgetSliderSetHiliteSelectedThumbBorderColor( GameWindow *g, Color color )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
GadgetButtonSetHiliteSelectedBorderColor( thumb, color );
}
inline const Image *GadgetSliderGetHiliteThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetHiliteThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetHiliteThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline const Image *GadgetSliderGetHiliteSelectedThumbImage( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteSelectedImage( thumb );
else
return NULL;
}
inline Color GadgetSliderGetHiliteSelectedThumbColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteSelectedColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
inline Color GadgetSliderGetHiliteSelectedThumbBorderColor( GameWindow *g )
{
GameWindow *thumb = g->winGetChild();
if( thumb )
return GadgetButtonGetHiliteSelectedBorderColor( thumb );
else
return WIN_COLOR_UNDEFINED;
}
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETSLIDER_H_

View File

@@ -0,0 +1,106 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetStaticText.h ///////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetStaticText.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for StaticTexts
//
// StaticText IMAGE/COLOR organization
// When control is enabled:
// enabledDrawData[ 0 ] is the background image for the whole enabled control
//
// When control is disabled:
// disabledDrawData[ 0 ] is the background image for the whole disabled control
//
// When control is hilited (mouse over it and enabled)
// hiliteDrawData[ 0 ] is the background image for the whole hilited control
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETSTATICTEXT_H_
#define __GADGETSTATICTEXT_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern void GadgetStaticTextSetText( GameWindow *window, UnicodeString text );
extern UnicodeString GadgetStaticTextGetText( GameWindow *window );
extern void GadgetStaticTextSetFont( GameWindow *window, GameFont *font );
// text colors
// enabled background
inline void GadgetStaticTextSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetStaticTextSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetStaticTextSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline const Image *GadgetStaticTextGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline Color GadgetStaticTextGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetStaticTextGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
// disabled background
inline void GadgetStaticTextSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetStaticTextSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetStaticTextSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline const Image *GadgetStaticTextGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline Color GadgetStaticTextGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetStaticTextGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
// hilite if we choose to use it
inline void GadgetStaticTextSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetStaticTextSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetStaticTextSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline const Image *GadgetStaticTextGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline Color GadgetStaticTextGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetStaticTextGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETSTATICTEXT_H_

View File

@@ -0,0 +1,279 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: C:\projects\RTS\code\gameengine\Include\GameClient\GadgetTabControl.h
//
// Created: Graham Smallwood, November 2001
//
// Desc: Helpful interface for TabControls
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETTABCONTROL_H_
#define __GADGETTABCONTROL_H_
enum
{
GTC_BACKGROUND = 0,
GTC_TAB_0,
GTC_TAB_1,
GTC_TAB_2,
GTC_TAB_3,
GTC_TAB_4,
GTC_TAB_5,
GTC_TAB_6,
GTC_TAB_7
};
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
extern void GadgetTabControlComputeTabRegion( GameWindow *tabControl );///< Recalc the tab positions based on userData
extern void GadgetTabControlCreateSubPanes( GameWindow *tabControl);///< Create (destroy old) Windows attached to userData as Panes
extern void GadgetTabControlComputeSubPaneSize( GameWindow *tabControl, Int *width, Int *height, Int *x, Int *y );///<Helper to calc subPanes' dependent size
extern void GadgetTabControlShowSubPane( GameWindow *tabControl, Int whichPane);///< Show specified SubPane
extern void GadgetTabControlResizeSubPanes( GameWindow *tabControl );///<Parent's size has changed, resize panes
extern void GadgetTabControlFixupSubPaneList( GameWindow *tabControl );///<In game creation finished, hook up Children to SubPane array
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
inline void GadgetTabControlSetEnabledImageTabZero( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_0, image ); }
inline void GadgetTabControlSetEnabledColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_0, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_0, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabZero( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_0 ); }
inline Color GadgetTabControlGetEnabledColorTabZero( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_0 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabZero( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_0 ); }
inline void GadgetTabControlSetEnabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_1, image ); }
inline void GadgetTabControlSetEnabledColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_1, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_1, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabOne( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_1 ); }
inline Color GadgetTabControlGetEnabledColorTabOne( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_1 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabOne( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_1 ); }
inline void GadgetTabControlSetEnabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_2, image ); }
inline void GadgetTabControlSetEnabledColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_2, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_2, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabTwo( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_2 ); }
inline Color GadgetTabControlGetEnabledColorTabTwo( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_2 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabTwo( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_2 ); }
inline void GadgetTabControlSetEnabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_3, image ); }
inline void GadgetTabControlSetEnabledColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_3, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_3, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabThree( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_3 ); }
inline Color GadgetTabControlGetEnabledColorTabThree( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_3 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabThree( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_3 ); }
inline void GadgetTabControlSetEnabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_4, image ); }
inline void GadgetTabControlSetEnabledColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_4, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_4, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabFour( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_4 ); }
inline Color GadgetTabControlGetEnabledColorTabFour( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_4 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabFour( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_4 ); }
inline void GadgetTabControlSetEnabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_5, image ); }
inline void GadgetTabControlSetEnabledColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_5, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_5, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabFive( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_5 ); }
inline Color GadgetTabControlGetEnabledColorTabFive( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_5 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabFive( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_5 ); }
inline void GadgetTabControlSetEnabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_6, image ); }
inline void GadgetTabControlSetEnabledColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_6, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_6, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabSix( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_6 ); }
inline Color GadgetTabControlGetEnabledColorTabSix( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_6 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabSix( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_6 ); }
inline void GadgetTabControlSetEnabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_7, image ); }
inline void GadgetTabControlSetEnabledColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_7, color ); }
inline void GadgetTabControlSetEnabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_7, color ); }
inline const Image *GadgetTabControlGetEnabledImageTabSeven( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_7 ); }
inline Color GadgetTabControlGetEnabledColorTabSeven( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_7 ); }
inline Color GadgetTabControlGetEnabledBorderColorTabSeven( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_7 ); }
inline void GadgetTabControlSetEnabledImageBackground( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_BACKGROUND, image ); }
inline void GadgetTabControlSetEnabledColorBackground( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_BACKGROUND, color ); }
inline void GadgetTabControlSetEnabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_BACKGROUND, color ); }
inline const Image *GadgetTabControlGetEnabledImageBackground( GameWindow *g ) { return g->winGetEnabledImage( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetEnabledColorBackground( GameWindow *g ) { return g->winGetEnabledColor( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetEnabledBorderColorBackground( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_BACKGROUND ); }
inline void GadgetTabControlSetDisabledImageTabZero( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_0, image ); }
inline void GadgetTabControlSetDisabledColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_0, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_0, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabZero( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_0 ); }
inline Color GadgetTabControlGetDisabledColorTabZero( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_0 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabZero( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_0 ); }
inline void GadgetTabControlSetDisabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_1, image ); }
inline void GadgetTabControlSetDisabledColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_1, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_1, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabOne( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_1 ); }
inline Color GadgetTabControlGetDisabledColorTabOne( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_1 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabOne( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_1 ); }
inline void GadgetTabControlSetDisabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_2, image ); }
inline void GadgetTabControlSetDisabledColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_2, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_2, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabTwo( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_2 ); }
inline Color GadgetTabControlGetDisabledColorTabTwo( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_2 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabTwo( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_2 ); }
inline void GadgetTabControlSetDisabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_3, image ); }
inline void GadgetTabControlSetDisabledColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_3, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_3, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabThree( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_3 ); }
inline Color GadgetTabControlGetDisabledColorTabThree( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_3 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabThree( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_3 ); }
inline void GadgetTabControlSetDisabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_4, image ); }
inline void GadgetTabControlSetDisabledColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_4, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_4, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabFour( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_4 ); }
inline Color GadgetTabControlGetDisabledColorTabFour( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_4 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabFour( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_4 ); }
inline void GadgetTabControlSetDisabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_5, image ); }
inline void GadgetTabControlSetDisabledColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_5, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_5, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabFive( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_5 ); }
inline Color GadgetTabControlGetDisabledColorTabFive( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_5 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabFive( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_5 ); }
inline void GadgetTabControlSetDisabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_6, image ); }
inline void GadgetTabControlSetDisabledColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_6, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_6, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabSix( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_6 ); }
inline Color GadgetTabControlGetDisabledColorTabSix( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_6 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabSix( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_6 ); }
inline void GadgetTabControlSetDisabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_7, image ); }
inline void GadgetTabControlSetDisabledColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_7, color ); }
inline void GadgetTabControlSetDisabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_7, color ); }
inline const Image *GadgetTabControlGetDisabledImageTabSeven( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_7 ); }
inline Color GadgetTabControlGetDisabledColorTabSeven( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_7 ); }
inline Color GadgetTabControlGetDisabledBorderColorTabSeven( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_7 ); }
inline void GadgetTabControlSetDisabledImageBackground( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_BACKGROUND, image ); }
inline void GadgetTabControlSetDisabledColorBackground( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_BACKGROUND, color ); }
inline void GadgetTabControlSetDisabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_BACKGROUND, color ); }
inline const Image *GadgetTabControlGetDisabledImageBackground( GameWindow *g ) { return g->winGetDisabledImage( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetDisabledColorBackground( GameWindow *g ) { return g->winGetDisabledColor( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetDisabledBorderColorBackground( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_BACKGROUND ); }
inline void GadgetTabControlSetHiliteImageTabZero( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_0, image ); }
inline void GadgetTabControlSetHiliteColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_0, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_0, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabZero( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_0 ); }
inline Color GadgetTabControlGetHiliteColorTabZero( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_0 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabZero( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_0 ); }
inline void GadgetTabControlSetHiliteImageTabOne( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_1, image ); }
inline void GadgetTabControlSetHiliteColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_1, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_1, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabOne( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_1 ); }
inline Color GadgetTabControlGetHiliteColorTabOne( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_1 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabOne( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_1 ); }
inline void GadgetTabControlSetHiliteImageTabTwo( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_2, image ); }
inline void GadgetTabControlSetHiliteColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_2, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_2, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabTwo( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_2 ); }
inline Color GadgetTabControlGetHiliteColorTabTwo( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_2 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabTwo( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_2 ); }
inline void GadgetTabControlSetHiliteImageTabThree( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_3, image ); }
inline void GadgetTabControlSetHiliteColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_3, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_3, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabThree( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_3 ); }
inline Color GadgetTabControlGetHiliteColorTabThree( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_3 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabThree( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_3 ); }
inline void GadgetTabControlSetHiliteImageTabFour( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_4, image ); }
inline void GadgetTabControlSetHiliteColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_4, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_4, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabFour( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_4 ); }
inline Color GadgetTabControlGetHiliteColorTabFour( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_4 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabFour( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_4 ); }
inline void GadgetTabControlSetHiliteImageTabFive( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_5, image ); }
inline void GadgetTabControlSetHiliteColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_5, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_5, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabFive( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_5 ); }
inline Color GadgetTabControlGetHiliteColorTabFive( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_5 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabFive( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_5 ); }
inline void GadgetTabControlSetHiliteImageTabSix( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_6, image ); }
inline void GadgetTabControlSetHiliteColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_6, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_6, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabSix( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_6 ); }
inline Color GadgetTabControlGetHiliteColorTabSix( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_6 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabSix( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_6 ); }
inline void GadgetTabControlSetHiliteImageTabSeven( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_7, image ); }
inline void GadgetTabControlSetHiliteColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_7, color ); }
inline void GadgetTabControlSetHiliteBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_7, color ); }
inline const Image *GadgetTabControlGetHiliteImageTabSeven( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_7 ); }
inline Color GadgetTabControlGetHiliteColorTabSeven( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_7 ); }
inline Color GadgetTabControlGetHiliteBorderColorTabSeven( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_7 ); }
inline void GadgetTabControlSetHiliteImageBackground( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_BACKGROUND, image ); }
inline void GadgetTabControlSetHiliteColorBackground( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_BACKGROUND, color ); }
inline void GadgetTabControlSetHiliteBorderColorBackground( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_BACKGROUND, color ); }
inline const Image *GadgetTabControlGetHiliteImageBackground( GameWindow *g ) { return g->winGetHiliteImage( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetHiliteColorBackground( GameWindow *g ) { return g->winGetHiliteColor( GTC_BACKGROUND ); }
inline Color GadgetTabControlGetHiliteBorderColorBackground( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_BACKGROUND ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETTABCONTROL_H_

View File

@@ -0,0 +1,129 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GadgetTextEntry.h ////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GadgetTextEntry.h
//
// Created: Colin Day, June 2001
//
// Desc: Helpful interface for TextEntrys
//
// TextEntry IMAGE/COLOR organization
//
// note that windows that have an outlined text field will use the color
// for the outline specified with the TextBorder... functions
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GADGETTEXTENTRY_H_
#define __GADGETTEXTENTRY_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/GameWindowManager.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
class GameWindow;
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
inline void GadgetTextEntrySetText( GameWindow *g, UnicodeString text )
{
TheWindowManager->winSendSystemMsg( g, GEM_SET_TEXT, (WindowMsgData)&text, 0 );
}
extern UnicodeString GadgetTextEntryGetText( GameWindow *textentry ); ///< Get the text from the text entry field
extern void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ); ///< set font for window and edit text display strings
inline void GadgetTextEntrySetTextColor( GameWindow *g, Color color )
{
Color back = g->winGetEnabledTextBorderColor();
g->winSetEnabledTextColors(color,back);
g->winSetDisabledTextColors(GameDarkenColor(color, 25),back);
}
// text colors
// enabled
inline void GadgetTextEntrySetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); }
inline void GadgetTextEntrySetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); }
inline void GadgetTextEntrySetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); }
inline void GadgetTextEntrySetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); }
inline void GadgetTextEntrySetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); }
inline void GadgetTextEntrySetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); }
inline const Image *GadgetTextEntryGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); }
inline const Image *GadgetTextEntryGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); }
inline const Image *GadgetTextEntryGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); }
inline const Image *GadgetTextEntryGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); }
inline Color GadgetTextEntryGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); }
inline Color GadgetTextEntryGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); }
// disabled
inline void GadgetTextEntrySetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); }
inline void GadgetTextEntrySetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); }
inline void GadgetTextEntrySetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); }
inline void GadgetTextEntrySetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); }
inline void GadgetTextEntrySetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); }
inline void GadgetTextEntrySetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); }
inline const Image *GadgetTextEntryGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); }
inline const Image *GadgetTextEntryGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); }
inline const Image *GadgetTextEntryGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); }
inline const Image *GadgetTextEntryGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); }
inline Color GadgetTextEntryGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); }
inline Color GadgetTextEntryGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); }
// hilite
inline void GadgetTextEntrySetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); }
inline void GadgetTextEntrySetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); }
inline void GadgetTextEntrySetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); }
inline void GadgetTextEntrySetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); }
inline void GadgetTextEntrySetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); }
inline void GadgetTextEntrySetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); }
inline const Image *GadgetTextEntryGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); }
inline const Image *GadgetTextEntryGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); }
inline const Image *GadgetTextEntryGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); }
inline const Image *GadgetTextEntryGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); }
inline Color GadgetTextEntryGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); }
inline Color GadgetTextEntryGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); }
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GADGETTEXTENTRY_H_

View File

@@ -0,0 +1,230 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// GameClient.h ///////////////////////////////////////////////////////////////
// GameClient singleton class - defines interface to GameClient methods and drawables
// Author: Michael S. Booth, March 2001
#pragma once
#ifndef _GAME_INTERFACE_H_
#define _GAME_INTERFACE_H_
#include "common/GameType.h"
#include "Common/MessageStream.h" // for GameMessageTranslator
#include "Common/Snapshot.h"
#include "Common/STLTypedefs.h"
#include "Common/SubsystemInterface.h"
#include "GameClient/CommandXlat.h"
#include "GameClient/Drawable.h"
// forward declarations
class AsciiString;
class Display;
class DisplayStringManager;
class Drawable;
class FontLibrary;
class GameWindowManager;
class InGameUI;
class Keyboard;
class Mouse;
class ParticleSystemManager;
class TerrainVisual;
class ThingTemplate;
class VideoPlayerInterface;
struct RayEffectData;
/// Function pointers for use by GameClient callback functions.
typedef void (*GameClientFuncPtr)( Drawable *draw, void *userData );
typedef std::hash_map<DrawableID, Drawable *, rts::hash<DrawableID>, rts::equal_to<DrawableID> > DrawablePtrHash;
typedef DrawablePtrHash::iterator DrawablePtrHashIt;
//-----------------------------------------------------------------------------
/** The Client message dispatcher, this is the last "translator" on the message
* stream before the messages go to the network for processing. It gives
* the client itself the opportunity to respond to any messages on the stream
* or create new ones to pass along to the network and logic */
class GameClientMessageDispatcher : public GameMessageTranslator
{
public:
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
virtual ~GameClientMessageDispatcher() { }
};
//-----------------------------------------------------------------------------
/**
* The GameClient class is used to instantiate a singleton which
* implements the interface to all GameClient operations such as Drawable access and user-interface functions.
*/
class GameClient : public SubsystemInterface,
public Snapshot
{
public:
GameClient();
virtual ~GameClient();
// subsystem methods
virtual void init( void ); ///< Initialize resources
virtual void update( void ); ///< Updates the GUI, display, audio, etc
virtual void reset( void ); ///< reset system
virtual void setFrame( UnsignedInt frame ) { m_frame = frame; } ///< Set the GameClient's internal frame number
virtual void registerDrawable( Drawable *draw ); ///< Given a drawable, register it with the GameClient and give it a unique ID
void addDrawableToLookupTable( Drawable *draw ); ///< add drawable ID to hash lookup table
void removeDrawableFromLookupTable( Drawable *draw ); ///< remove drawable ID from hash lookup table
virtual Drawable *findDrawableByID( const DrawableID id ); ///< Given an ID, return the associated drawable
void setDrawableIDCounter( DrawableID nextDrawableID ) { m_nextDrawableID = nextDrawableID; }
DrawableID getDrawableIDCounter( void ) { return m_nextDrawableID; }
virtual Drawable *firstDrawable( void ) { return m_drawableList; }
virtual GameMessage::Type evaluateContextCommand( Drawable *draw,
const Coord3D *pos,
CommandTranslator::CommandEvaluateType cmdType );
void addTextBearingDrawable( Drawable *tbd );
void flushTextBearingDrawables( void);
virtual void removeFromRayEffects( Drawable *draw ); ///< remove the drawable from the ray effect system if present
virtual void getRayEffectData( Drawable *draw, RayEffectData *effectData ); ///< get ray effect data for a drawable
virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ) = 0; ///< create effect needing start and end location
virtual void addScorch(const Coord3D *pos, Real radius, Scorches type) = 0;
virtual Bool loadMap( AsciiString mapName ); ///< load a map into our scene
virtual void unloadMap( AsciiString mapName ); ///< unload the specified map from our scene
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 void destroyDrawable( Drawable *draw ); ///< Destroy the given drawable
virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now
virtual void selectDrawablesInGroup( Int group ); ///< select all drawables belong to the specifies group
virtual void assignSelectedDrawablesToGroup( Int group ); ///< assign all selected drawables to the specified group
//---------------------------------------------------------------------------------------
virtual UnsignedInt getFrame( void ) { return m_frame; } ///< Returns the current simulation frame number
//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ) = 0; ///< @todo superhack for demo, remove!!!
virtual void adjustLOD( Int adj ) = 0; ///< @todo hack for evaluation, remove.
virtual void releaseShadows(void); ///< frees all shadow resources used by this module - used by Options screen.
virtual void allocateShadows(void); ///< create shadow resources if not already present. Used by Options screen.
virtual void preloadAssets( TimeOfDay timeOfDay ); ///< preload assets
virtual Drawable *getDrawableList( void ) { return m_drawableList; }
void resetRenderedObjectCount() { m_renderedObjectCount = 0; }
UnsignedInt getRenderedObjectCount() const { return m_renderedObjectCount; }
void incrementRenderedObjectCount() { m_renderedObjectCount++; }
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
// @todo Should there be a separate GameClient frame counter?
UnsignedInt m_frame; ///< Simulation frame number from server
Drawable *m_drawableList; ///< All of the drawables in the world
DrawablePtrHash m_drawableHash; ///< Used for DrawableID lookups
DrawableID m_nextDrawableID; ///< For allocating drawable id's
DrawableID allocDrawableID( void ); ///< Returns a new unique drawable id
enum { MAX_CLIENT_TRANSLATORS = 32 };
TranslatorID m_translators[ MAX_CLIENT_TRANSLATORS ]; ///< translators we have used
UnsignedInt m_numTranslators; ///< number of translators in m_translators[]
CommandTranslator *m_commandTranslator; ///< the command translator on the message stream
private:
UnsignedInt m_renderedObjectCount; ///< Keeps track of the number of rendered objects -- resets each frame.
//---------------------------------------------------------------------------
virtual Display *createGameDisplay( void ) = 0; ///< Factory for Display classes. Called during init to instantiate TheDisplay.
virtual InGameUI *createInGameUI( void ) = 0; ///< Factory for InGameUI classes. Called during init to instantiate TheInGameUI
virtual GameWindowManager *createWindowManager( void ) = 0; ///< Factory to window manager
virtual FontLibrary *createFontLibrary( void ) = 0; ///< Factory for font library
virtual DisplayStringManager *createDisplayStringManager( void ) = 0; ///< Factory for display strings
virtual VideoPlayerInterface *createVideoPlayer( void ) = 0;///< Factory for video device
virtual TerrainVisual *createTerrainVisual( void ) = 0; ///< Factory for TerrainVisual classes. Called during init to instance TheTerrainVisual
virtual Keyboard *createKeyboard( void ) = 0; ///< factory for the keyboard
virtual Mouse *createMouse( void ) = 0; ///< factory for the mouse
virtual void setFrameRate(Real msecsPerFrame) = 0;
// ----------------------------------------------------------------------------------------------
struct DrawableTOCEntry
{
AsciiString name;
UnsignedShort id;
};
typedef std::list< DrawableTOCEntry > DrawableTOCList;
typedef DrawableTOCList::iterator DrawableTOCListIterator;
DrawableTOCList m_drawableTOC; ///< the drawable TOC
void addTOCEntry( AsciiString name, UnsignedShort id ); ///< add a new name/id TOC pair
DrawableTOCEntry *findTOCEntryByName( AsciiString name ); ///< find DrawableTOC by name
DrawableTOCEntry *findTOCEntryById( UnsignedShort id ); ///< find DrawableTOC by id
void xferDrawableTOC( Xfer *xfer ); ///< save/load drawable TOC for current state of map
typedef std::list< Drawable* > TextBearingDrawableList;
typedef TextBearingDrawableList::iterator TextBearingDrawableListIterator;
TextBearingDrawableList m_textBearingDrawableList; ///< the drawables that have registered here during drawablepostdraw
};
//Kris: Try not to use this if possible. In every case I found in the code base, the status was always Drawable::SELECTED.
// There is another iterator already in game that stores JUST selected drawables. Take a look at the efficient
// example, InGameUI::getAllSelectedDrawables().
#define BEGIN_ITERATE_DRAWABLES_WITH_STATUS(STATUS, DRAW) \
do \
{ \
Drawable* _xq_nextDrawable; \
for (Drawable* DRAW = TheGameClient->firstDrawable(); DRAW != NULL; DRAW = _xq_nextDrawable ) \
{ \
_xq_nextDrawable = DRAW->getNextDrawable(); \
if (DRAW->getStatusFlags() & (STATUS)) \
{
#define END_ITERATE_DRAWABLES \
} \
} \
} while (0);
// the singleton
extern GameClient *TheGameClient;
#endif // _GAME_INTERFACE_H_

View File

@@ -0,0 +1,111 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameFont.h ///////////////////////////////////////////////////////////////////////////////
// Created: Colin Day, June 2001
// Desc: Game representations for fonts
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEFONT_H_
#define __GAMEFONT_H_
#include "Common/SubsystemInterface.h"
#include "Lib/BaseType.h"
#include "Common/AsciiString.h"
#include "Common/GameMemory.h"
//-------------------------------------------------------------------------------------------------
/** A font for use in the device independent game */
//-------------------------------------------------------------------------------------------------
class GameFont : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(GameFont, "GameFont")
public:
GameFont* next; ///< for library use
AsciiString nameString;
Int pointSize; ///< point size of font
Int height; ///< pixel height of font
void* fontData; ///< font data to be filled out for device specific font
Bool bold; ///< is this font bold
};
EMPTY_DTOR(GameFont)
//-------------------------------------------------------------------------------------------------
/** Interface to access fonts for the system */
//-------------------------------------------------------------------------------------------------
class FontLibrary : public SubsystemInterface
{
public:
public:
FontLibrary( void );
virtual ~FontLibrary( void );
virtual void init( void );
virtual void reset( void );
virtual void update( void ) { }
GameFont *getFont( AsciiString name, Int pointSize, Bool bold ); ///< get a font pointer
GameFont *firstFont( void ); ///< return first font
GameFont *nextFont( GameFont *font ); ///< get next font in library
Int getCount( void ); ///< return how many fonts are loaded in this lib
protected:
void deleteAllFonts( void ); ///< delete all fonts in this library
void linkFont( GameFont *font ); ///< add to font list
void unlinkFont( GameFont *font ); ///< remove font from list
/// load the font data pointer based on everything else we already have set
virtual Bool loadFontData( GameFont *font ) = 0;
/// release the font data pointer
virtual void releaseFontData( GameFont *font ) { };
GameFont *m_fontList; ///< list of fonts we have loaded
Int m_count; ///< number of unique fonts loaded in this lib
};
// INLINING ///////////////////////////////////////////////////////////////////////////////////////
inline Int FontLibrary::getCount( void ) { return m_count; }
inline GameFont *FontLibrary::firstFont( void ) { return m_fontList; }
inline GameFont *FontLibrary::nextFont( GameFont *font )
{
if( font )
return font->next;
return NULL;
}
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern FontLibrary *TheFontLibrary; ///< font library external
#endif // __GAMEFONT_H_

View File

@@ -0,0 +1,46 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameInfoWindow.h ///////////////////////////////////////////////////////////////////////////
// Created: Chris Huybregts, Feb 2002
// Desc: Game Info Window Header
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEINFOWINDOW_H_
#define __GAMEINFOWINDOW_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "GameClient/GameWindow.h"
#include "GameNetwork/LANGameInfo.h"
// Function Stubs for GameInfoWindow
extern void CreateLANGameInfoWindow( GameWindow *sizeAndPosWin );
extern void DestroyGameInfoWindow(void);
extern void RefreshGameInfoWindow(GameInfo *gameInfo, UnicodeString gameName);
extern void HideGameInfoWindow(Bool hide);
#endif // __GAMEINFOWINDOW_H_

View File

@@ -0,0 +1,96 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//----------------------------------------------------------------------------
//
// Project: RTS 3
//
// File name: GameClient/GameText.h
//
// Created: 11/07/01
//
//----------------------------------------------------------------------------
#pragma once
#ifndef __GAMECLIENT_GAMETEXT_H_
#define __GAMECLIENT_GAMETEXT_H_
//----------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Forward References
//----------------------------------------------------------------------------
class AsciiString;
class UnicodeString;
//----------------------------------------------------------------------------
// Type Defines
//----------------------------------------------------------------------------
typedef std::vector<AsciiString> AsciiStringVec;
//===============================
// GameTextInterface
//===============================
/** Game text interface object for localised text.
*/
//===============================
class GameTextInterface : public SubsystemInterface
{
public:
virtual ~GameTextInterface() {};
virtual UnicodeString fetch( const Char *label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text
virtual UnicodeString fetch( AsciiString label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text
// This function is not performance tuned.. Its really only for Worldbuilder. jkmcd
virtual AsciiStringVec& getStringsWithLabelPrefix(AsciiString label) = 0;
virtual void initMapStringFile( const AsciiString& filename ) = 0;
};
extern GameTextInterface *TheGameText;
extern GameTextInterface* CreateGameTextInterface( void );
//----------------------------------------------------------------------------
// Inlining
//----------------------------------------------------------------------------
#endif // __GAMECLIENT_GAMETEXT_H_

View File

@@ -0,0 +1,487 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameWindow.h /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GameWindow.h
//
// Created: Colin Day, June 2001
//
// Desc: Header for game windowing system for generic windows and GUI
// elements
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEWINDOW_H_
#define __GAMEWINDOW_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "Common/GameMemory.h"
#include "GameClient/Image.h"
#include "GameClient/DisplayString.h"
#include "GameClient/WinInstanceData.h"
#include "GameClient/Color.h"
///////////////////////////////////////////////////////////////////////////////
// FORWARD REFERENCES /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class GameWindow;
class WindowLayout;
class GameFont;
struct GameWindowEditData;
///////////////////////////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
enum { WIN_COLOR_UNDEFINED = GAME_COLOR_UNDEFINED };
// WindowMsgData --------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef UnsignedInt WindowMsgData;
//-----------------------------------------------------------------------------
enum WindowMsgHandledType { MSG_IGNORED, MSG_HANDLED };
// callback types -------------------------------------------------------------
typedef void (*GameWinMsgBoxFunc)( void ); //used for the Message box callbacks.
typedef void (*GameWinDrawFunc)( GameWindow *,
WinInstanceData * );
typedef void (*GameWinTooltipFunc)( GameWindow *,
WinInstanceData *,
UnsignedInt );
typedef WindowMsgHandledType (*GameWinInputFunc)( GameWindow *,
UnsignedInt,
WindowMsgData,
WindowMsgData );
typedef WindowMsgHandledType (*GameWinSystemFunc)( GameWindow *,
UnsignedInt,
WindowMsgData,
WindowMsgData );
enum
{
WIN_MAX_WINDOWS = 576,
CURSOR_MOVE_TOL_SQ = 4,
TOOLTIP_DELAY = 10,
WIN_TOOLTIP_LEN = 64, // max length of tooltip text
};
// macros for easier conversion -----------------------------------------------
#define SHORTTOLONG(a, b) ((UnsignedShort)(a) | ((UnsignedShort)(b) << 16))
#define LOLONGTOSHORT(a) ((a) & 0x0000FFFF)
#define HILONGTOSHORT(b) (((b) & 0xFFFF0000) >> 16)
// Game window messages -------------------------------------------------------
//-----------------------------------------------------------------------------
enum GameWindowMessage
{
GWM_NONE = 0,
GWM_CREATE, GWM_DESTROY,
GWM_ACTIVATE, GWM_ENABLE,
GWM_LEFT_DOWN, GWM_LEFT_UP,
GWM_LEFT_DOUBLE_CLICK, GWM_LEFT_DRAG,
GWM_MIDDLE_DOWN, GWM_MIDDLE_UP,
GWM_MIDDLE_DOUBLE_CLICK, GWM_MIDDLE_DRAG,
GWM_RIGHT_DOWN, GWM_RIGHT_UP,
GWM_RIGHT_DOUBLE_CLICK, GWM_RIGHT_DRAG,
GWM_MOUSE_ENTERING, GWM_MOUSE_LEAVING,
GWM_WHEEL_UP, GWM_WHEEL_DOWN,
GWM_CHAR, GWM_SCRIPT_CREATE,
// note that GWM_MOUSE_POS is only actually propogated to windows if the static
// sendMousePosMessages is set to true in the window manager file. See the
// comment on the static declaration for addtional info
GWM_INPUT_FOCUS, GWM_MOUSE_POS,
GWM_IME_CHAR, GWM_IME_STRING
};
// WinInputReturnCode ------------------------------------------------------
/** These return codes are returned when after processing events through
* the window system */
//-----------------------------------------------------------------------------
enum WinInputReturnCode
{
WIN_INPUT_NOT_USED = 0,
WIN_INPUT_USED,
};
#define GWM_USER 32768
// Window status flags --------------------------------------------------------
//-----------------------------------------------------------------------------
enum
{
// when you edit this, remember to edit WindowStatusNames[]
WIN_STATUS_NONE = 0x00000000, // No status bits set at all
WIN_STATUS_ACTIVE = 0x00000001, // At the top of the window list
WIN_STATUS_TOGGLE = 0x00000002, // If set, click to toggle
WIN_STATUS_DRAGABLE = 0x00000004, // Window can be dragged
WIN_STATUS_ENABLED = 0x00000008, // Window can receive input
WIN_STATUS_HIDDEN = 0x00000010, // Window is hidden, no input
WIN_STATUS_ABOVE = 0x00000020, // Window is always above others
WIN_STATUS_BELOW = 0x00000040, // Window is always below others
WIN_STATUS_IMAGE = 0x00000080, // Window is drawn with images
WIN_STATUS_TAB_STOP = 0x00000100, // Window is a tab stop
WIN_STATUS_NO_INPUT = 0x00000200, // Window does not take input
WIN_STATUS_NO_FOCUS = 0x00000400, // Window does not take focus
WIN_STATUS_DESTROYED = 0x00000800, // Window has been destroyed
WIN_STATUS_BORDER = 0x00001000, // Window will be drawn with Borders & Corners
WIN_STATUS_SMOOTH_TEXT = 0x00002000, // Window text will be drawn with smoothing
WIN_STATUS_ONE_LINE = 0x00004000, // Window text will be drawn on only one line
WIN_STATUS_NO_FLUSH = 0x00008000, // Window images will not be unloaded when window is hidden
WIN_STATUS_SEE_THRU = 0x00010000, // Will not draw, but it NOT hidden ... does not apply to children
WIN_STATUS_RIGHT_CLICK = 0x00020000, // Window pays attention to right clicks
WIN_STATUS_WRAP_CENTERED = 0x00040000, // Text will be centered on each word wrap or \n
WIN_STATUS_CHECK_LIKE = 0x00080000, // Make push buttons "check-like" with dual state
WIN_STATUS_HOTKEY_TEXT = 0x00100000, // Make push buttons "check-like" with dual state
WIN_STATUS_USE_OVERLAY_STATES = 0x00200000, // Push buttons will use the global automatic rendering overlay for disabled, hilited, and pushed.
WIN_STATUS_NOT_READY = 0x00400000, // A disabled button that is available -- but not yet (power charge, fire delay).
WIN_STATUS_FLASHING = 0x00800000, // Used for buttons that do cameo flashes.
WIN_STATUS_ALWAYS_COLOR = 0x01000000, // Never render these buttons using greyscale renderer when button disabled.
// when you edit this, remember to edit WindowStatusNames[]
};
// Message Box Button flags --------------------------------------------------------
//-----------------------------------------------------------------------------
enum
{
MSG_BOX_YES = 0x01, //Display the yes button
MSG_BOX_NO = 0x02, //Display the No button
MSG_BOX_OK = 0x08, //Display the Ok button
MSG_BOX_CANCEL = 0x04, //Display the Cancel button
};
// WindowMessageBoxData ---------------------------------------------------------
/** Data attached to each Message box window */
//-----------------------------------------------------------------------------
struct WindowMessageBoxData
{
GameWinMsgBoxFunc yesCallback; ///<Function pointer to the Yes Button Callback
GameWinMsgBoxFunc noCallback;///<Function pointer to the No Button Callback
GameWinMsgBoxFunc okCallback;///<Function pointer to the Ok Button Callback
GameWinMsgBoxFunc cancelCallback;///<Function pointer to the Cancel Button Callback
};
// GameWindowEditData ---------------------------------------------------------
/** Data attached to each window specifically for the editor */
//-----------------------------------------------------------------------------
struct GameWindowEditData
{
AsciiString systemCallbackString; ///< string for callback
AsciiString inputCallbackString; ///< string for callback
AsciiString tooltipCallbackString; ///< string for callback
AsciiString drawCallbackString; ///< string for callback
};
// GameWindow -----------------------------------------------------------------
/** Class definition for a game window. These are the basic elements of the
* whole windowing sytem, all windows are GameWindows, as are all GUI controls
* etc. */
//-----------------------------------------------------------------------------
class GameWindow : public MemoryPoolObject
{
MEMORY_POOL_GLUE_ABC( GameWindow ) ///< this abstract class needs memory pool hooks
friend class GameWindowManager;
public:
GameWindow( void );
// already defined by MPO.
// virtual ~GameWindow( void );
/// draw border for this window only, NO child windows or anything
virtual void winDrawBorder( void ) = 0;
Int winSetWindowId( Int id ); ///< set id for this window
Int winGetWindowId( void ); ///< return window id for this window
Int winSetSize( Int width, Int height ); ///< set size
Int winGetSize( Int *width, Int *height ); ///< return size
Int winActivate( void ); ///< pop window to top of list and activate
Int winBringToTop( void ); ///< bring this window to the top of the win list
Int winEnable( Bool enable ); /**< enable/disable a window, a disbled
window can be seen but accepts no input */
Int winHide( Bool hide ); ///< hide/unhide a window
Bool winIsHidden( void ); ///< is this window hidden/
UnsignedInt winSetStatus( UnsignedInt status ); ///< set status bits
UnsignedInt winClearStatus( UnsignedInt status ); ///< clear status bits
UnsignedInt winGetStatus( void ); ///< get status bits
UnsignedInt winGetStyle( void ); ///< get style bits
Int winNextTab( void ); ///< advance focus to next window
Int winPrevTab( void ); ///< change focus to previous window
Int winSetPosition( Int x, Int y ); ///< set window position
Int winGetPosition( Int *x, Int *y ); ///< get window position
Int winGetScreenPosition( Int *x, Int *y ); ///< get screen coordinates
Int winGetRegion( IRegion2D *region ); ///< get window region
Int winSetCursorPosition( Int x, Int y ); ///< set window cursor position
Int winGetCursorPosition( Int *x, Int *y ); ///< get window cursor position
// --------------------------------------------------------------------------
// new methods for setting images
Int winSetEnabledImage( Int index, const Image *image );
Int winSetEnabledColor( Int index, Color color );
Int winSetEnabledBorderColor( Int index, Color color );
const Image *winGetEnabledImage( Int index ) { return m_instData.m_enabledDrawData[ index ].image; }
Color winGetEnabledColor( Int index ) { return m_instData.m_enabledDrawData[ index ].color; }
Color winGetEnabledBorderColor( Int index ) { return m_instData.m_enabledDrawData[ index ].borderColor; }
Int winSetDisabledImage( Int index, const Image *image );
Int winSetDisabledColor( Int index, Color color );
Int winSetDisabledBorderColor( Int index, Color color );
const Image *winGetDisabledImage( Int index ) { return m_instData.m_disabledDrawData[ index ].image; }
Color winGetDisabledColor( Int index ) { return m_instData.m_disabledDrawData[ index ].color; }
Color winGetDisabledBorderColor( Int index ) { return m_instData.m_disabledDrawData[ index ].borderColor; }
Int winSetHiliteImage( Int index, const Image *image );
Int winSetHiliteColor( Int index, Color color );
Int winSetHiliteBorderColor( Int index, Color color );
const Image *winGetHiliteImage( Int index ) { return m_instData.m_hiliteDrawData[ index ].image; }
Color winGetHiliteColor( Int index ) { return m_instData.m_hiliteDrawData[ index ].color; }
Color winGetHiliteBorderColor( Int index ) { return m_instData.m_hiliteDrawData[ index ].borderColor; }
// --------------------------------------------------------------------------
// draw methods and data
Int winDrawWindow( void ); ///< draws the default background
void winSetDrawOffset( Int x, Int y ); ///< set offset for drawing background image data
void winGetDrawOffset( Int *x, Int *y ); ///< get draw offset
void winSetHiliteState( Bool state ); ///< set hilite state
void winSetTooltip( UnicodeString tip ); ///< set tooltip text
Int getTooltipDelay() { return m_instData.m_tooltipDelay; } ///< get tooltip delay
void setTooltipDelay(Int delay) { m_instData.m_tooltipDelay = delay; } ///< set tooltip delay
//-----------------------------------------------------------------------------
// text methods
virtual Int winSetText( UnicodeString newText ); ///< set text string
UnicodeString winGetText( void ); ///< get text string
Int winGetTextLength(); ///< get number of chars in text string
GameFont *winGetFont( void ); ///< get the font being used by this window
virtual void winSetFont( GameFont *font ); ///< set font for window
void winSetEnabledTextColors( Color color, Color borderColor );
void winSetDisabledTextColors( Color color, Color borderColor );
void winSetIMECompositeTextColors( Color color, Color borderColor );
void winSetHiliteTextColors( Color color, Color borderColor );
Color winGetEnabledTextColor( void );
Color winGetEnabledTextBorderColor( void );
Color winGetDisabledTextColor( void );
Color winGetDisabledTextBorderColor( void );
Color winGetIMECompositeTextColor( void );
Color winGetIMECompositeBorderColor( void );
Color winGetHiliteTextColor( void );
Color winGetHiliteTextBorderColor( void );
// window instance data
Int winSetInstanceData( WinInstanceData *data ); ///< copy over instance data
WinInstanceData *winGetInstanceData( void ); ///< get instance data
void *winGetUserData( void ); ///< get the window user data
void winSetUserData( void *userData ); ///< set the user data
// heirarchy methods
Int winSetParent( GameWindow *parent ); ///< set parent
GameWindow *winGetParent( void ); ///< get parent
Bool winIsChild( GameWindow *child ); ///< verifies parent
GameWindow *winGetChild( void ); ///< get the child window
Int winSetOwner( GameWindow *owner ); ///< set owner
GameWindow *winGetOwner( void ); ///< get window's owner
void winSetNext( GameWindow *next ); ///< set next pointer
void winSetPrev( GameWindow *prev ); ///< set prev pointer
GameWindow *winGetNext( void ); ///< get next window in window list
GameWindow *winGetPrev( void ); ///< get previous window in window list
// these are for interacting with a group of windows as a shell "screen"
void winSetNextInLayout( GameWindow *next ); ///< set next in layout
void winSetPrevInLayout( GameWindow *prev ); ///< set prev in layout
void winSetLayout( WindowLayout *layout ); ///< set layout
WindowLayout *winGetLayout( void ); ///< get layout layout
GameWindow *winGetNextInLayout( void ); ///< get next window in layout
GameWindow *winGetPrevInLayout( void ); ///< get prev window in layout
// setting the callbacks ----------------------------------------------------
Int winSetSystemFunc( GameWinSystemFunc system ); ///< set system
Int winSetInputFunc( GameWinInputFunc input ); ///< set input
Int winSetDrawFunc( GameWinDrawFunc draw ); ///< set draw
Int winSetTooltipFunc( GameWinTooltipFunc tooltip ); ///< set tooltip
Int winSetCallbacks( GameWinInputFunc input,
GameWinDrawFunc draw,
GameWinTooltipFunc tooltip ); ///< set draw, input, tooltip
// pick correlation ---------------------------------------------------------
Bool winPointInWindow( Int x, Int y ); /**is point inside this window?
also return TRUE if point is in
a child */
/** given a piont, return the child window which contains the mouse pointer,
if the point is not in a chilc, the function returns the 'window' paramater
back to the caller */
GameWindow *winPointInChild( Int x, Int y, Bool ignoreEnableCheck = FALSE, Bool playDisabledSound = FALSE );
/** finds the child which contains the mouse pointer - reguardless of
the enabled status of the child */
GameWindow *winPointInAnyChild( Int x, Int y, Bool ignoreHidden, Bool ignoreEnableCheck = FALSE );
// get the callbacks for a window -------------------------------------------
GameWinInputFunc winGetInputFunc( void );
GameWinSystemFunc winGetSystemFunc( void );
GameWinDrawFunc winGetDrawFunc( void );
GameWinTooltipFunc winGetTooltipFunc( void );
// editor access only -------------------------------------------------------
void winSetEditData( GameWindowEditData *editData );
GameWindowEditData *winGetEditData( void );
protected:
/// 'images' should be taken care of when we hide ourselves or are destroyed
void freeImages( void ) { }
Bool isEnabled( void ); ///< see if we and our parents are enabled
void normalizeWindowRegion( void ); ///< put UL corner in window region.lo
GameWindow *findFirstLeaf( void ); ///< return first leaf of branch
GameWindow *findLastLeaf( void ); ///< return last leaf of branch
GameWindow *findPrevLeaf( void ); ///< return prev leav in tree
GameWindow *findNextLeaf( void ); ///< return next leaf in tree
// **************************************************************************
Int m_status; // Status bits for this window
ICoord2D m_size; // Width and height of the window
IRegion2D m_region; // Current region occupied by window.
// Low x,y is the window's origin
Int m_cursorX; // window cursor X position if any
Int m_cursorY; // window cursor Y position if any
void *m_userData; // User defined data area
WinInstanceData m_instData; // Class data, varies by window type
void *m_inputData; // Client data
// user defined callbacks
GameWinInputFunc m_input; ///< callback for input
GameWinSystemFunc m_system; ///< callback for system messages
GameWinDrawFunc m_draw; ///< callback for drawing
GameWinTooltipFunc m_tooltip; ///< callback for tooltip execution
GameWindow *m_next, *m_prev; // List of sibling windows
GameWindow *m_parent; // Window which contains this window
GameWindow *m_child; // List of windows within this window
//
// the following are for "layout screens" and ONLY apply to root/parent
// windows in a layout, any children of a window that is part of a layout
// does NOT have layout screen information
//
GameWindow *m_nextLayout; ///< next in layout
GameWindow *m_prevLayout; ///< prev in layout
WindowLayout *m_layout; ///< layout this window is a part of
// game window edit data for the GUIEditor only
GameWindowEditData *m_editData;
}; // end class GameWindow
// ModalWindow ----------------------------------------------------------------
//-----------------------------------------------------------------------------
class ModalWindow : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ModalWindow, "ModalWindow" )
public:
GameWindow *window; // Pointer to Modal Window
ModalWindow *next; // Next Window Pointer
};
EMPTY_DTOR(ModalWindow)
// Errors returned by window functions
enum
{
WIN_ERR_OK = 0, // No Error
WIN_ERR_GENERAL_FAILURE = -1, // General library failure
WIN_ERR_INVALID_WINDOW = -2, // Window parameter was invalid
WIN_ERR_INVALID_PARAMETER = -3, // Parameter was invalid
WIN_ERR_MOUSE_CAPTURED = -4, // Mouse already captured
WIN_ERR_KEYBOARD_CAPTURED = -5, // Keyboard already captured
WIN_ERR_OUT_OF_WINDOWS = -6 // Too many windows have been created
};
// Input capture/release flags
enum
{
WIN_CAPTURE_MOUSE = 0x00000001, // capture mouse
WIN_CAPTURE_KEYBOARD = 0x00000002, // capture keyboard
WIN_CAPTURE_ALL = 0xFFFFFFFF, // capture keyboard and mouse
};
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
extern void GameWinDefaultDraw( GameWindow *window,
WinInstanceData *instData );
extern WindowMsgHandledType GameWinDefaultSystem( GameWindow *window,
UnsignedInt msg,
WindowMsgData mData1,
WindowMsgData mData2 );
extern WindowMsgHandledType GameWinDefaultInput( GameWindow *window,
UnsignedInt msg,
WindowMsgData mData1,
WindowMsgData mData2 );
extern WindowMsgHandledType GameWinBlockInput( GameWindow *window,
UnsignedInt msg,
WindowMsgData mData1,
WindowMsgData mData2 );
extern void GameWinDefaultTooltip( GameWindow *window,
WinInstanceData *instData,
UnsignedInt mouse );
extern const char *WindowStatusNames[];
extern const char *WindowStyleNames[];
#endif // __GAMEWINDOW_H_

View File

@@ -0,0 +1,69 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameWindowGlobal.h ///////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GameWindowGlobal.h
//
// Created: Colin Day, June 2001
//
// Desc: These are some global functions that every game using this
// window system must implement for their current technology
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEWINDOWGLOBAL_H_
#define __GAMEWINDOWGLOBAL_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "GameClient/Image.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#endif // __GAMEWINDOWGLOBAL_H_

View File

@@ -0,0 +1,89 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameWindowID.h ///////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: GameWindowID.h
//
// Created: Colin Day, July 2001
//
// Desc: Game window ID definitions, this is so we can uniquely
// identify any window in the game and pass messages from
// anywhere to anywhere else instantly
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEWINDOWID_H_
#define __GAMEWINDOWID_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
#define GWID_INVALID 0
#define GWID_SIDEBAR 100
#define GWID_SIDEBAR_1 101
#define GWID_SIDEBAR_2 102
#define GWID_SIDEBAR_3 103
#define GWID_SIDEBAR_4 104
#define GWID_SIDEBAR_5 105
#define GWID_SIDEBAR_6 106
#define GWID_SIDEBAR_7 107
#define GWID_SIDEBAR_8 108
#define GWID_SIDEBAR_9 109
#define GWID_SIDEBAR_10 110
#define GWID_SIDEBAR_11 111
#define GWID_SIDEBAR_12 112
#define GWID_SIDEBAR_TAB_1 151
#define GWID_SIDEBAR_TAB_2 152
#define GWID_SIDEBAR_TAB_3 153
#define GWID_SIDEBAR_TAB_4 154
#define GWID_SIDEBAR_RADAR 175
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __GAMEWINDOWID_H_

View File

@@ -0,0 +1,385 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameWindowManager.h //////////////////////////////////////////////////////////////////////
// Created: Colin Day, June 2001
// Desc: The game window manager is the interface for interacting with
// the windowing system for purposes of any menus, or GUI
// controls.
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAMEWINDOWMANAGER_H_
#define __GAMEWINDOWMANAGER_H_
#include "Common/STLTypedefs.h"
#include "Common/SubsystemInterface.h"
#include "GameClient/WindowLayout.h"
#include "GameClient/KeyDefs.h"
#include "GameClient/Gadget.h"
class GameWindow;
//-------------------------------------------------------------------------------------------------
/** Window layout info is a structure that can be passed to the load function of
* a window script. After the script is loaded, this parameter (if present)
* will contain information about the script file at a global level such
* as what file version was loaded, global layout callbacks, etc */
//-------------------------------------------------------------------------------------------------
enum { MAX_LAYOUT_FUNC_LEN = 256 };
typedef std::list <GameWindow *> GameWindowList;
class WindowLayoutInfo
{
public:
WindowLayoutInfo();
UnsignedInt version; ///< file version that was loaded
WindowLayoutInitFunc init; ///< init method (if specified)
WindowLayoutUpdateFunc update; ///< update method (if specified)
WindowLayoutShutdownFunc shutdown; ///< shutdown method (if specified)
AsciiString initNameString; ///< init method in flavor of string name
AsciiString updateNameString; ///< update method in string flavor
AsciiString shutdownNameString; ///< shutdown method in string flavor, mmm!
std::list<GameWindow *> windows; ///< list of top-level windows in the layout
};
//-------------------------------------------------------------------------------------------------
/** There exists a singleton GameWindowManager that defines how we can
* interact with the game windowing system */
//-------------------------------------------------------------------------------------------------
class GameWindowManager : public SubsystemInterface
{
friend class GameWindow;
public:
GameWindowManager( void );
virtual ~GameWindowManager( void );
//-----------------------------------------------------------------------------------------------
virtual void init( void ); ///< initialize function
virtual void reset( void ); ///< reset the system
virtual void update( void ); ///< update method, called once per frame
virtual GameWindow *allocateNewWindow( void ) = 0; ///< new game window
void linkWindow( GameWindow *window ); ///< link into master list
void unlinkWindow( GameWindow *window ); ///< unlink from master list
void unlinkChildWindow( GameWindow *window ); ///< remove child from parent list
void insertWindowAheadOf( GameWindow *window, GameWindow *aheadOf ); ///< add window to list 'ahead of'
virtual GameWinDrawFunc getPushButtonImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getPushButtonDrawFunc( void ) = 0;
virtual GameWinDrawFunc getCheckBoxImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getCheckBoxDrawFunc( void ) = 0;
virtual GameWinDrawFunc getRadioButtonImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getRadioButtonDrawFunc( void ) = 0;
virtual GameWinDrawFunc getTabControlImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getTabControlDrawFunc( void ) = 0;
virtual GameWinDrawFunc getListBoxImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getListBoxDrawFunc( void ) = 0;
virtual GameWinDrawFunc getComboBoxImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getComboBoxDrawFunc( void ) = 0;
virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getHorizontalSliderDrawFunc( void ) = 0;
virtual GameWinDrawFunc getVerticalSliderImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getVerticalSliderDrawFunc( void ) = 0;
virtual GameWinDrawFunc getProgressBarImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getProgressBarDrawFunc( void ) = 0;
virtual GameWinDrawFunc getStaticTextImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getStaticTextDrawFunc( void ) = 0;
virtual GameWinDrawFunc getTextEntryImageDrawFunc( void ) = 0;
virtual GameWinDrawFunc getTextEntryDrawFunc( void ) = 0;
//---------------------------------------------------------------------------
virtual GameWinDrawFunc getDefaultDraw( void ); ///< return default draw func
virtual GameWinSystemFunc getDefaultSystem( void ); ///< return default system func
virtual GameWinInputFunc getDefaultInput( void ); ///< return default input func
virtual GameWinTooltipFunc getDefaultTooltip( void ); ///< return default tooltip func
//---------------------------------------------------------------------------
// MessageBox creation
virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags,
UnicodeString titleString, UnicodeString bodyString,
GameWinMsgBoxFunc yesCallback,
GameWinMsgBoxFunc noCallback,
GameWinMsgBoxFunc okCallback,
GameWinMsgBoxFunc cancelCallback );
virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags,
UnicodeString titleString, UnicodeString bodyString,
GameWinMsgBoxFunc yesCallback,
GameWinMsgBoxFunc noCallback,
GameWinMsgBoxFunc okCallback,
GameWinMsgBoxFunc cancelCallback, Bool useLogo );
//---------------------------------------------------------------------------
// gadget creation
virtual GameWindow *gogoGadgetPushButton( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetCheckbox( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetRadioButton( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
RadioButtonData *rData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetTabControl( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
TabControlData *rData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetListBox( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
ListboxData *listboxData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetSlider( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
SliderData *sliderData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetProgressBar( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetStaticText( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
TextData *textData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetTextEntry( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
EntryData *entryData,
GameFont *defaultFont, Bool defaultVisual );
virtual GameWindow *gogoGadgetComboBox( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
WinInstanceData *instData,
ComboBoxData *comboBoxDataTemplate,
GameFont *defaultFont, Bool defaultVisual );
/** Use this method to assign the default images to gadgets as
* they area created */
virtual void assignDefaultGadgetLook( GameWindow *gadget,
GameFont *defaultFont,
Bool assignVisual );
//---------------------------------------------------------------------------
// Creating windows
/// create new window(s) from .wnd file ... see definition for what is returned
virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = NULL );
/// create new window(s) from .wnd file and wrap in a WindowLayout
virtual WindowLayout *winCreateLayout( AsciiString filename );
/// free temporary strings to make the memory leak manager happy.
virtual void freeStaticStrings(void);
/// create a new window by setting up parameters and callbacks
virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status,
Int x, Int y, Int width, Int height,
GameWinSystemFunc system,
WinInstanceData *instData = NULL );
//---------------------------------------------------------------------------
// Manipulating windows in the system
virtual Int winDestroy( GameWindow *window ); ///< destroy this window
virtual Int winDestroyAll( void ); ///< destroy all windows in the system
virtual GameWindow *winGetWindowList( void ); ///< get head of master list
/// hide all windows in a certain range of id's (inclusinve );
virtual void hideWindowsInRange( GameWindow *baseWindow, Int first, Int last,
Bool hideFlag );
/// enable all windows in a range of id's (inclusive)
virtual void enableWindowsInRange( GameWindow *baseWindow, Int first, Int last,
Bool enableFlag );
/// this gets called from winHide() when a window hides itself
virtual void windowHiding( GameWindow *window );
virtual void winRepaint( void ); ///< draw GUI in reverse order
virtual void winNextTab( GameWindow *window ); ///< give keyboard focus to the next window in the tab list
virtual void winPrevTab( GameWindow *window ); ///< give keyboard focus to the previous window in the tab list
virtual void registerTabList( GameWindowList tabList ); ///< we have to register a Tab List
virtual void clearTabList( void ); ///< we's gotz ta clear the tab list yo!
// --------------------------------------------------------------------------
/// process a single mouse event
virtual WinInputReturnCode winProcessMouseEvent( GameWindowMessage msg,
ICoord2D *mousePos,
void *data );
/// process a singke key event
virtual WinInputReturnCode winProcessKey( UnsignedByte key,
UnsignedByte state );
// --------------------------------------------------------------------------
virtual GameWindow *winGetFocus( void ); ///< return window that has the focus
virtual Int winSetFocus( GameWindow *window ); ///< set this window as has focus
virtual void winSetGrabWindow( GameWindow *window ); ///< set the grab window
virtual GameWindow *winGetGrabWindow( void ); ///< who is currently 'held' by mouse
virtual void winSetLoneWindow( GameWindow *window ); ///< set the open window
virtual Bool isEnabled( GameWindow *win ); ///< is window or parents enabled
virtual Bool isHidden( GameWindow *win ); ///< is parent or parents hidden
virtual void addWindowToParent( GameWindow *window, GameWindow *parent );
virtual void addWindowToParentAtEnd( GameWindow *window, GameWindow *parent );
/// sends a system message to specified window
virtual WindowMsgHandledType winSendSystemMsg( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
/// sends an input message to the specified window
virtual WindowMsgHandledType winSendInputMsg( GameWindow *window, UnsignedInt msg,
WindowMsgData mData1, WindowMsgData mData2 );
/** get the window pointer from id, starting at 'window' and searching
down the heirarchy. If 'window' is NULL then all windows will
be searched */
virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id );
virtual Int winCapture( GameWindow *window ); ///< captures the mouse
virtual Int winRelease( GameWindow *window ); ///< release mouse capture
virtual GameWindow *winGetCapture( void ); ///< current mouse capture settings
virtual Int winSetModal( GameWindow *window ); ///< put at top of modal stack
virtual Int winUnsetModal( GameWindow *window ); /**< take window off modal stack, if window is
not at top of stack and error will occur */
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// The following public functions you should implement change the guts
// for to work with your application. Rather than draw images, or do string
// operations with native methods, the game window system will always call
// these methods to get the work done it needs
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
/// draw image, coord are in screen and should be kepth within that box specified
virtual void winDrawImage( const Image *image, Int startX, Int startY, Int endX, Int endY, Color color = 0xFFFFFFFF );
/// draw filled rect, coords are absolute screen coords
virtual void winFillRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY );
/// draw rect outline, coords are absolute screen coords
virtual void winOpenRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY );
/// draw line, coords are absolute screen coords
virtual void winDrawLine( Color color, Real width, Int startX, Int startY, Int endX, Int endY );
/// Make a color representation out of RGBA components
virtual Color winMakeColor( UnsignedByte red, UnsignedByte green, UnsignedByte blue, UnsignedByte alpha );
/** Find an image reference and return a pointer to its image, you may
recreate all Image structs to suit your project */
virtual const Image *winFindImage( const char *name );
virtual Int winFontHeight( GameFont *font ); ///< get height of font in pixels
virtual Int winIsDigit( Int c ); ///< is character a digit
virtual Int winIsAscii( Int c ); ///< is character a digit
virtual Int winIsAlNum( Int c ); ///< is character alpha-numeric
virtual void winFormatText( GameFont *font, UnicodeString text, Color color,
Int x, Int y, Int width, Int height );
virtual void winGetTextSize( GameFont *font, UnicodeString text,
Int *width, Int *height, Int maxWidth );
virtual UnicodeString winTextLabelToText( AsciiString label ); ///< convert localizable text label to real text
virtual GameFont *winFindFont( AsciiString fontName, Int pointSize, Bool bold ); ///< get a font given a name
/// @todo just for testing, remov this
Bool initTestGUI( void );
virtual GameWindow *getWindowUnderCursor( Int x, Int y, Bool ignoreEnabled = FALSE ); ///< find the top window at the given coordinates
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
protected:
void processDestroyList( void ); ///< process windows waiting to be killed
Int drawWindow( GameWindow *window ); ///< draw this window
void dumpWindow( GameWindow *window ); ///< for debugging
GameWindow *m_windowList; // list of all top level windows
GameWindow *m_windowTail; // last in windowList
GameWindow *m_destroyList; // list of windows to destroy
GameWindow *m_currMouseRgn; // window that mouse is over
GameWindow *m_mouseCaptor; // window that captured mouse
GameWindow *m_keyboardFocus; // window that has input focus
ModalWindow *m_modalHead; // top of windows in the modal stack
GameWindow *m_grabWindow; // window that grabbed the last down event
GameWindow *m_loneWindow; // Set if we just opened a Lone Window
GameWindowList m_tabList; // we have to register a tab list to make a tab list.
const Image *m_cursorBitmap;
UnsignedInt m_captureFlags;
}; // end GameWindowManager
// INLINE /////////////////////////////////////////////////////////////////////////////////////////
inline GameWinDrawFunc GameWindowManager::getDefaultDraw( void ) { return GameWinDefaultDraw; }
inline GameWinSystemFunc GameWindowManager::getDefaultSystem( void ) { return GameWinDefaultSystem; }
inline GameWinInputFunc GameWindowManager::getDefaultInput( void ) { return GameWinDefaultInput; }
inline GameWinTooltipFunc GameWindowManager::getDefaultTooltip( void ) { return GameWinDefaultTooltip; }
// EXTERN /////////////////////////////////////////////////////////////////////////////////////////
extern GameWindowManager *TheWindowManager; ///< singleton extern definition
extern UnsignedInt WindowLayoutCurrentVersion; ///< current version of our window layouts
// this function lets us generically pass button selections to our parent, we may
// frequently want to do this because we want windows grouped on child windows for
// convenience, but only want one logical system procedure responding to them all
extern WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window,
UnsignedInt msg,
WindowMsgData mData1,
WindowMsgData mData2 );
extern WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window,
UnsignedInt msg,
WindowMsgData mData1,
WindowMsgData mData2 );
#endif // __GAMEWINDOWMANAGER_H_

View File

@@ -0,0 +1,697 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameWindowTransitions.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Dec 2002
//
// Filename: GameWindowTransitions.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GAME_WINDOW_TRANSITIONS_H_
#define __GAME_WINDOW_TRANSITIONS_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class GameWindow;
class Image;
class DisplayString;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
enum
{
TRANSITION_FLASH = 0,
BUTTON_TRANSITION_FLASH,
WIN_FADE_TRANSITION,
WIN_SCALE_UP_TRANSITION,
MAINMENU_SCALE_UP_TRANSITION,
TEXT_TYPE_TRANSITION,
SCREEN_FADE_TRANSITION,
COUNT_UP_TRANSITION,
FULL_FADE_TRANSITION,
TEXT_ON_FRAME_TRANSITION,
MAINMENU_MEDIUM_SCALE_UP_TRANSITION,
MAINMENU_SMALL_SCALE_DOWN_TRANSITION,
CONTROL_BAR_ARROW_TRANSITION,
SCORE_SCALE_UP_TRANSITION,
REVERSE_SOUND_TRANSITION,
MAX_TRANSITION_WINDOW_STYLES ///< Keep this last
};
static const LookupListRec TransitionStyleNames[] =
{
{ "FLASH", TRANSITION_FLASH },
{ "BUTTONFLASH", BUTTON_TRANSITION_FLASH },
{ "WINFADE", WIN_FADE_TRANSITION },
{ "WINSCALEUP", WIN_SCALE_UP_TRANSITION },
{ "MAINMENUSCALEUP", MAINMENU_SCALE_UP_TRANSITION },
{ "TYPETEXT", TEXT_TYPE_TRANSITION },
{ "SCREENFADE", SCREEN_FADE_TRANSITION },
{ "COUNTUP", COUNT_UP_TRANSITION },
{ "FULLFADE", FULL_FADE_TRANSITION },
{ "TEXTONFRAME", TEXT_ON_FRAME_TRANSITION },
{ "MAINMENUMEDIUMSCALEUP", MAINMENU_MEDIUM_SCALE_UP_TRANSITION },
{ "MAINMENUSMALLSCALEDOWN", MAINMENU_SMALL_SCALE_DOWN_TRANSITION },
{ "CONTROLBARARROW", CONTROL_BAR_ARROW_TRANSITION },
{ "SCORESCALEUP", SCORE_SCALE_UP_TRANSITION },
{ "REVERSESOUND", REVERSE_SOUND_TRANSITION },
{ NULL, 0 }// keep this last!
};
// base class for the transitions
// inherit off of this adding in all the values
class Transition
{
public:
Transition ( void );
virtual ~Transition( void );
virtual void init( GameWindow *win ) = 0;
virtual void update( Int frame ) = 0;
virtual void reverse( void ) = 0;
virtual void draw( void ) = 0;
virtual void skip( void ) = 0;
Bool isFinished( void ) { return m_isFinished; }
Int getFrameLength( void ){ return m_frameLength; }
protected:
Int m_frameLength; // how many frames does this thing take.
Bool m_isFinished; // when we finish we set this
Bool m_isForward;
Bool m_isReversed; // when we reverse we set this
GameWindow *m_win;
};
//-----------------------------------------------------------------------------
class TextOnFrameTransition : public Transition
{
public:
TextOnFrameTransition ( void );
virtual ~TextOnFrameTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
TEXTONFRAMETRANSITION_START = 0,
TEXTONFRAMETRANSITION_END = 1 // Max text type we'll allow.
};
};
//-----------------------------------------------------------------------------
class ReverseSoundTransition : public Transition
{
public:
ReverseSoundTransition ( void );
virtual ~ReverseSoundTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
REVERSESOUNDTRANSITION_START = 0,
REVERSESOUNDTRANSITION_FIRESOUND = 1,
REVERSESOUNDTRANSITION_END = 2 // Max text type we'll allow.
};
};
//-----------------------------------------------------------------------------
class FullFadeTransition : public Transition
{
public:
FullFadeTransition ( void );
virtual ~FullFadeTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
FULLFADETRANSITION_START = 0,
FULLFADETRANSITION_END = 10 // Max text type we'll allow.
};
ICoord2D m_pos;
ICoord2D m_size;
Real m_percent;
Int m_drawState;
};
//-----------------------------------------------------------------------------
class ControlBarArrowTransition : public Transition
{
public:
ControlBarArrowTransition ( void );
virtual ~ControlBarArrowTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
CONTROLBARARROWTRANSITION_START = 0,
CONTROLBARARROWTRANSITION_BEGIN_FADE = 16,
CONTROLBARARROWTRANSITION_END = 22 // Max text type we'll allow.
};
ICoord2D m_pos;
ICoord2D m_incrementPos;
ICoord2D m_size;
Real m_percent;
Real m_fadePercent;
Int m_drawState;
const Image* m_arrowImage;
};
//-----------------------------------------------------------------------------
class ScreenFadeTransition : public Transition
{
public:
ScreenFadeTransition ( void );
virtual ~ScreenFadeTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
SCREENFADETRANSITION_START = 0,
SCREENFADETRANSITION_END = 30 // Max text type we'll allow.
};
ICoord2D m_pos;
ICoord2D m_size;
Real m_percent;
Int m_drawState;
};
//-----------------------------------------------------------------------------
class CountUpTransition : public Transition
{
public:
CountUpTransition ( void );
virtual ~CountUpTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
COUNTUPTRANSITION_START = 0,
COUNTUPTRANSITION_END = 30 // Max text type we'll allow.
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
UnicodeString m_fullText;
UnicodeString m_partialText;
Int m_intValue;
Int m_currentValue;
enum{
COUNT_ONES = 1,
COUNT_100S = 100,
COUNT_1000S = 1000
};
Int m_countState;
};
//-----------------------------------------------------------------------------
class TextTypeTransition : public Transition
{
public:
TextTypeTransition ( void );
virtual ~TextTypeTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
TEXTTYPETRANSITION_START = 0,
TEXTTYPETRANSITION_END = 30 // Max text type we'll allow.
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
UnicodeString m_fullText;
UnicodeString m_partialText;
DisplayString *m_dStr;
};
//-----------------------------------------------------------------------------
class MainMenuScaleUpTransition : public Transition
{
public:
MainMenuScaleUpTransition ( void );
virtual ~MainMenuScaleUpTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
MAINMENUSCALEUPTRANSITION_START = 0,
MAINMENUSCALEUPTRANSITION_END = 5
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
ICoord2D m_growPos;
ICoord2D m_growSize;
ICoord2D m_incrementPos;
ICoord2D m_incrementSize;
GameWindow *m_growWin;
};
//-----------------------------------------------------------------------------
class MainMenuMediumScaleUpTransition : public Transition
{
public:
MainMenuMediumScaleUpTransition ( void );
virtual ~MainMenuMediumScaleUpTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
MAINMENUMEDIUMSCALEUPTRANSITION_START = 0,
MAINMENUMEDIUMSCALEUPTRANSITION_END = 3
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
ICoord2D m_growPos;
ICoord2D m_growSize;
ICoord2D m_incrementSize;
GameWindow *m_growWin;
};
//-----------------------------------------------------------------------------
class MainMenuSmallScaleDownTransition : public Transition
{
public:
MainMenuSmallScaleDownTransition ( void );
virtual ~MainMenuSmallScaleDownTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
MAINMENUSMALLSCALEDOWNTRANSITION_START = 0,
MAINMENUSMALLSCALEDOWNTRANSITION_1 = 1,
MAINMENUSMALLSCALEDOWNTRANSITION_2 = 2,
MAINMENUSMALLSCALEDOWNTRANSITION_3 = 3,
MAINMENUSMALLSCALEDOWNTRANSITION_4 = 4,
MAINMENUSMALLSCALEDOWNTRANSITION_5 = 5,
MAINMENUSMALLSCALEDOWNTRANSITION_END
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
ICoord2D m_growPos;
ICoord2D m_growSize;
ICoord2D m_incrementSize;
GameWindow *m_growWin;
};
//-----------------------------------------------------------------------------
class ScaleUpTransition : public Transition
{
public:
ScaleUpTransition ( void );
virtual ~ScaleUpTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
SCALEUPTRANSITION_START = 0,
SCALEUPTRANSITION_1 = 1,
SCALEUPTRANSITION_2 = 2,
SCALEUPTRANSITION_3 = 3,
SCALEUPTRANSITION_4 = 4,
SCALEUPTRANSITION_5 = 5,
// SCALEUPTRANSITION_6 = 6,
// SCALEUPTRANSITION_7 = 7,
// SCALEUPTRANSITION_8 = 8,
// SCALEUPTRANSITION_9 = 9,
// SCALEUPTRANSITION_10 = 10,
// SCALEUPTRANSITION_11 = 11,
// SCALEUPTRANSITION_12 = 12,
// SCALEUPTRANSITION_13 = 13,
// SCALEUPTRANSITION_14 = 14,
// SCALEUPTRANSITION_15 = 15,
// SCALEUPTRANSITION_16 = 16,
// SCALEUPTRANSITION_17 = 17,
// SCALEUPTRANSITION_18 = 18,
// SCALEUPTRANSITION_19 = 19,
SCALEUPTRANSITION_END
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
ICoord2D m_centerPos;
ICoord2D m_incrementSize;
};
//-----------------------------------------------------------------------------
class ScoreScaleUpTransition : public Transition
{
public:
ScoreScaleUpTransition ( void );
virtual ~ScoreScaleUpTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
SCORESCALEUPTRANSITION_START = 0,
SCORESCALEUPTRANSITION_1 = 1,
SCORESCALEUPTRANSITION_2 = 2,
SCORESCALEUPTRANSITION_3 = 3,
SCORESCALEUPTRANSITION_4 = 4,
SCORESCALEUPTRANSITION_5 = 5,
SCORESCALEUPTRANSITION_END
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
ICoord2D m_centerPos;
ICoord2D m_incrementSize;
};
//-----------------------------------------------------------------------------
class FadeTransition : public Transition
{
public:
FadeTransition ( void );
virtual ~FadeTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
FADETRANSITION_START = 0,
FADETRANSITION_FADE_IN_1 = 1,
FADETRANSITION_FADE_IN_2 = 2,
FADETRANSITION_FADE_IN_3 = 3,
FADETRANSITION_FADE_IN_4 = 4,
FADETRANSITION_FADE_IN_5 = 5,
FADETRANSITION_FADE_IN_6 = 6,
FADETRANSITION_FADE_IN_7 = 7,
FADETRANSITION_FADE_IN_8 = 8,
FADETRANSITION_FADE_IN_9 = 9,
FADETRANSITION_END
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
};
//-----------------------------------------------------------------------------
class FlashTransition : public Transition
{
public:
FlashTransition ( void );
virtual ~FlashTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
FLASHTRANSITION_START = 0,
FLASHTRANSITION_FADE_IN_1 = 1,
FLASHTRANSITION_FADE_IN_2 = 2,
FLASHTRANSITION_FADE_IN_3 = 3,
FLASHTRANSITION_FADE_TO_BACKGROUND_1 = 4,
FLASHTRANSITION_FADE_TO_BACKGROUND_2 = 5,
FLASHTRANSITION_FADE_TO_BACKGROUND_3 = 6,
FLASHTRANSITION_FADE_TO_BACKGROUND_4 = 7,
FLASHTRANSITION_END
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
};
//-----------------------------------------------------------------------------
class ButtonFlashTransition : public Transition
{
public:
ButtonFlashTransition ( void );
virtual ~ButtonFlashTransition( void );
virtual void init( GameWindow *win );
virtual void update( Int frame );
virtual void reverse( void );
virtual void draw( void );
virtual void skip( void );
protected:
enum{
BUTTONFLASHTRANSITION_START = 0,
BUTTONFLASHTRANSITION_FADE_IN_1 = 1,
BUTTONFLASHTRANSITION_FADE_IN_2 = 2,
BUTTONFLASHTRANSITION_FADE_IN_3 = 3,
BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_1 =4,
BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_2 = 5,
BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_3 = 6,
BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_4 = 7,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_1 = 11,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_2 = BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_1 +1,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_1 = BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_2 +1,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_2 = BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_1 +1,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_3 = BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_2 +1,
BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_4 = BUTTONFLASHTRANSITION_FADE_TO_GRADE_OUT_3 + 1,
BUTTONFLASHTRANSITION_END, // this is the end of the sequence, we need some special defines... well put them below here
BUTTONFLASHTRANSITION_SHOW_BACKGROUND
};
ICoord2D m_pos;
ICoord2D m_size;
Int m_drawState;
Image *m_gradient;
};
//-----------------------------------------------------------------------------
class TransitionWindow
{
public:
TransitionWindow( void );
~TransitionWindow( void );
Bool init( void );
void update( Int frame );
Bool isFinished( void );
void reverse( Int totalFrames );
Int getTotalFrames( void );
void skip( void );
void draw( void );
// INI parsed vars
AsciiString m_winName;
Int m_frameDelay; // what frame number we start on
Int m_style; // the style we'll be using
// standard vars
NameKeyType m_winID;
GameWindow *m_win;
Transition *m_transition; // each window is allowed one trasition
Int m_currentFrameDelay; // this will change based on if we're going forward or backwards
};
//-----------------------------------------------------------------------------
class TransitionGroup
{
public:
TransitionGroup( void );
~TransitionGroup( void );
void init( void );
void update( void );
Bool isFinished( void );
void reverse( void );
void draw( void );
void skip ( void );
AsciiString getName( void ) { return m_name; }
void setName( AsciiString name){ m_name = name; }
void addWindow( TransitionWindow *transWin );
Bool isReversed( void );
Bool isFireOnce( void ) { return m_fireOnce; }
Bool m_fireOnce;
private:
typedef std::list<TransitionWindow *> TransitionWindowList;
TransitionWindowList m_transitionWindowList;
Int m_directionMultiplier;
Int m_currentFrame; ///< maintain how long we've spent on this transition;
AsciiString m_name;
};
//-----------------------------------------------------------------------------
class GameWindowTransitionsHandler: public SubsystemInterface
{
public:
GameWindowTransitionsHandler(void);
~GameWindowTransitionsHandler( void );
void init(void );
void load(void );
void reset( void );
void update( void );
void draw( void );
Bool isFinished( void );
const FieldParse *getFieldParse() const { return m_gameWindowTransitionsFieldParseTable; } ///< returns the parsing fields
static const FieldParse m_gameWindowTransitionsFieldParseTable[]; ///< the parse table
static void parseWindow( INI* ini, void *instance, void *store, const void *userData );
void setGroup(AsciiString groupName, Bool immidiate = FALSE); // THis will be the next group to fire off.
void reverse( AsciiString groupName );// reverse the animations for the current group.
void remove( AsciiString groupName, Bool skipPending = FALSE );// remove the animation from the current or pending groups.
TransitionGroup *getNewGroup( AsciiString name );
private:
TransitionGroup *findGroup( AsciiString groupName );
typedef std::list<TransitionGroup *> TransitionGroupList;
TransitionGroupList m_transitionGroupList;
TransitionGroup *m_currentGroup;
TransitionGroup *m_pendingGroup;
TransitionGroup *m_drawGroup;
TransitionGroup *m_secondaryDrawGroup; // needed to draw the last frame of the previvous draw group once more.
};
void PushButtonImageDrawThree(GameWindow *window, Int alpha );
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
extern GameWindowTransitionsHandler *TheTransitionHandler;
#endif // __GAME_WINDOW_TRANSITIONS_H_

View File

@@ -0,0 +1,123 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GlobalLanguage.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Aug 2002
//
// Filename: GlobalLanguage.h
//
// author: Chris Huybregts
//
// purpose: With workingwith different languages, we need some options that
// change. Essentially, this is the global data that's unique to languages
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GLOBAL_LANGUAGE_H_
#define __GLOBAL_LANGUAGE_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Common/SubsystemInterface.h"
#include "Common/STLTypedefs.h"
#include "GameClient/FontDesc.h"
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AsciiString;
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class GlobalLanguage : public SubsystemInterface
{
public:
GlobalLanguage();
virtual ~GlobalLanguage();
void init();
void reset();
void update() { }
AsciiString m_unicodeFontName;
AsciiString m_unicodeFontFileName;
Bool m_useHardWrap;
Int m_militaryCaptionSpeed;
FontDesc m_copyrightFont;
FontDesc m_messageFont;
FontDesc m_militaryCaptionTitleFont;
FontDesc m_militaryCaptionFont;
FontDesc m_superweaponCountdownNormalFont;
FontDesc m_superweaponCountdownReadyFont;
FontDesc m_namedTimerCountdownNormalFont;
FontDesc m_namedTimerCountdownReadyFont;
FontDesc m_drawableCaptionFont;
FontDesc m_defaultWindowFont;
FontDesc m_defaultDisplayStringFont;
FontDesc m_tooltipFontName;
FontDesc m_nativeDebugDisplay;
FontDesc m_drawGroupInfoFont;
FontDesc m_creditsTitleFont;
FontDesc m_creditsPositionFont;
FontDesc m_creditsNormalFont;
Real m_resolutionFontSizeAdjustment;
//UnicodeString m_unicodeFontNameUStr;
Int adjustFontSize(Int theFontSize); // Adjusts font size for resolution. jba.
typedef std::list<AsciiString> StringList; // Used for our font file names that we want to load
typedef StringList::iterator StringListIt;
StringList m_localFonts; // List of the font filenames that are in our local directory
static void parseFontFileName( INI *ini, void *instance, void *store, const void* userData );
static void parseFontDesc(INI *ini, void *instance, void *store, const void* userData);
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
extern GlobalLanguage *TheGlobalLanguageData;
#endif // __GLOBAL_LANGUAGE_H_

View File

@@ -0,0 +1,90 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GraphDraw.h //////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Aug 2002
//
// Filename: GraphDraw.h
//
// author: John McDonald
//
// purpose: Contains the functions to queue up and display a single graph for
// each frame. Note: This class is presently only intended for use by
// the Performance timers, all though it could be easily adapted for
// other purposes.
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __GRAPHDRAW_H__
#define __GRAPHDRAW_H__
#include "Common/PerfTimer.h"
#include "Common/STLTypedefs.h"
#ifdef PERF_TIMERS
typedef std::pair<AsciiString, Real> PairAsciiStringReal;
typedef std::vector<PairAsciiStringReal> VecGraphEntries;
typedef VecGraphEntries::iterator VecGraphEntriesIt;
enum { MAX_GRAPH_VALUES = 36 };
enum { BAR_HEIGHT = 14 };
enum { BAR_SPACE = 2 };
class DisplayString;
class GraphDraw
{
public:
GraphDraw();
virtual ~GraphDraw();
void addEntry(AsciiString str, Real val);
// Called during begin/end
void render();
void clear();
protected:
VecGraphEntries m_graphEntries;
DisplayString *m_displayStrings[MAX_GRAPH_VALUES];
};
extern GraphDraw *TheGraphDraw;
#endif /* PERF_TIMERS */
#endif /* __GRAPHDRAW_H__ */

View File

@@ -0,0 +1,119 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: HeaderTemplate.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Aug 2002
//
// Filename: HeaderTemplate.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __HEADER_TEMPLATE_H_
#define __HEADER_TEMPLATE_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Common/STLTypedefs.h"
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Common/AsciiString.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class GameFont;
struct FieldParse;
class INI;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class HeaderTemplate
{
public:
HeaderTemplate( void );
~HeaderTemplate( void );
GameFont *m_font;
AsciiString m_name;
AsciiString m_fontName;
Int m_point;
Bool m_bold;
};
class HeaderTemplateManager
{
public:
HeaderTemplateManager( void );
~HeaderTemplateManager( void );
void init( void );
const FieldParse *getFieldParse( void ) const { return m_headerFieldParseTable; } ///< Return the field parse info
static const FieldParse m_headerFieldParseTable[];
HeaderTemplate *findHeaderTemplate( AsciiString name );
HeaderTemplate *newHeaderTemplate( AsciiString name );
GameFont *getFontFromTemplate( AsciiString name );
HeaderTemplate *getFirstHeader( void );
HeaderTemplate *getNextHeader( HeaderTemplate *ht );
void headerNotifyResolutionChange(void);
private:
void populateGameFonts( void );
typedef std::list< HeaderTemplate* > HeaderTemplateList;
typedef HeaderTemplateList::iterator HeaderTemplateListIt;
HeaderTemplateList m_headerTemplateList;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
extern HeaderTemplateManager *TheHeaderTemplateManager;
#endif // __HEADER_TEMPLATE_H_

View File

@@ -0,0 +1,43 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: HintSpy.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_HintSpy
#define _H_HintSpy
#include "GameClient/InGameUI.h"
//-----------------------------------------------------------------------------
class HintSpyTranslator : public GameMessageTranslator
{
public:
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
virtual ~HintSpyTranslator() { }
};
#endif

View File

@@ -0,0 +1,118 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: HotKey.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Sep 2002
//
// Filename: HotKey.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __HOT_KEY_H_
#define __HOT_KEY_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Common/SubsystemInterface.h"
#include "Common/MessageStream.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AsciiString;
class GameWindow;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class HotKeyTranslator : public GameMessageTranslator
{
public:
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
virtual ~HotKeyTranslator() { }
};
//-----------------------------------------------------------------------------
class HotKey
{
public:
HotKey( void );
GameWindow *m_win;
AsciiString m_key;
// we may need a checkmark system.
};
//-----------------------------------------------------------------------------
class HotKeyManager : public SubsystemInterface
{
public:
HotKeyManager( void );
~HotKeyManager( void );
// Inherited from subsystem interface -----------------------------------------------------------
virtual void init( void ); ///< Initialize the Hotkey system
virtual void update( void ) {} ///< A No-op for us
virtual void reset( void ); ///< Reset
//-----------------------------------------------------------------------------------------------
void addHotKey( GameWindow *win, const AsciiString& key);
Bool executeHotKey( const AsciiString& key); // called fromt eh HotKeyTranslator
AsciiString searchHotKey( const AsciiString& label);
AsciiString searchHotKey( const UnicodeString& uStr );
private:
typedef std::map<AsciiString, HotKey> HotKeyMap;
HotKeyMap m_hotKeyMap;
};
extern HotKeyManager *TheHotKeyManager;
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __HOT_KEY_H_

View File

@@ -0,0 +1,121 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//----------------------------------------------------------------------------
//
// Project: Generals
//
// Module: IME
//
// File name: GameClient/IMEManager.h
//
// Created: 11/14/01 TR
//
//----------------------------------------------------------------------------
#pragma once
#ifndef __GAMECLIENT_IMEMANAGER_H
#define __GAMECLIENT_IMEMANAGER_H
//----------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
#include "Common/UnicodeString.h"
//----------------------------------------------------------------------------
// Forward References
//----------------------------------------------------------------------------
class GameWindow;
class UnicodeString;
//----------------------------------------------------------------------------
// Type Defines
//----------------------------------------------------------------------------
//===============================
// IMEManagerInterface
//===============================
class IMEManagerInterface : public SubsystemInterface
{
public:
virtual ~IMEManagerInterface() {};
virtual void attach( GameWindow *window ) = 0; ///< attach IME to specified window
virtual void detatch( void ) = 0; ///< detatch IME from current window
virtual void enable( void ) = 0; ///< Enable IME
virtual void disable( void ) = 0; ///< Disable IME
virtual Bool isEnabled( void ) = 0; ///< Is IME enabled
virtual Bool isAttachedTo( GameWindow *window ) = 0; ///< Is the manager currently attached to the window
virtual GameWindow* getWindow( void ) = 0; ///< Returns the window we are currently attached to
virtual Bool isComposing( void ) = 0; ///< Manager is currently composing new input string
virtual void getCompositionString( UnicodeString &string ) = 0; ///< Return the current composition string
virtual Int getCompositionCursorPosition( void ) =0; ///< Returns the composition cursor position
virtual Int getIndexBase( void ) = 0; ///< Get index base for candidate list
virtual Int getCandidateCount() = 0; ///< Returns the total number of candidates
virtual UnicodeString*getCandidate( Int index ) = 0; ///< Returns the candidate string
virtual Int getSelectedCandidateIndex() = 0; ///< Returns the indexed of the currently selected candidate
virtual Int getCandidatePageSize() = 0; ///< Returns the page size for the candidates list
virtual Int getCandidatePageStart() = 0; ///< Returns the index of the first visibel candidate
/// Checks for and service IME messages. Returns TRUE if message serviced
virtual Bool serviceIMEMessage( void *windowsHandle,
UnsignedInt message,
Int wParam,
Int lParam ) = 0;
virtual Int result( void ) = 0; ///< result return value of last serviced IME message
};
extern IMEManagerInterface *TheIMEManager;
extern IMEManagerInterface *CreateIMEManagerInterface( void );
//----------------------------------------------------------------------------
// Inlining
//----------------------------------------------------------------------------
#endif // __GAMECLIENT_IMEMANAGER_H

View File

@@ -0,0 +1,172 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Image.h //////////////////////////////////////////////////////////////////////////////////
// Created: Colin Day, June 2001
// Desc: High level representation of images, this is currently being
// written so we have a way to refer to images in the windows GUI.
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __IMAGE_H_
#define __IMAGE_H_
#include "Common/AsciiString.h"
#include "Common/GameMemory.h"
#include "Common/SubsystemInterface.h"
struct FieldParse;
class INI;
//-------------------------------------------------------------------------------------------------
/** Image status bits. Keep in sync with imageStatusNames[] */
//-------------------------------------------------------------------------------------------------
typedef enum
{
IMAGE_STATUS_NONE = 0x00000000,
IMAGE_STATUS_ROTATED_90_CLOCKWISE = 0x00000001, // image should be treated as rotated
IMAGE_STATUS_RAW_TEXTURE = 0x00000002, // image struct contains raw texture data
} ImageStatus;
#ifdef DEFINE_IMAGE_STATUS_NAMES
static const char *imageStatusNames[] =
{
"ROTATED_90_CLOCKWISE",
"RAW_TEXTURE",
NULL
};
#endif // end DEFINE_IMAGE_STATUS_NAMES
//-------------------------------------------------------------------------------------------------
/** Image bitmap information */
//-------------------------------------------------------------------------------------------------
class Image : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Image, "Image" );
public:
Image( void );
// virtual desctructor defined by memory pool object
void setName( AsciiString name ); ///< set image name
AsciiString getName( void ) const; ///< return name
void setFilename( AsciiString filename ); ///< set filename
AsciiString getFilename( void ) const; ///< return filename
void setUV( Region2D *uv ); ///< set UV coord range
const Region2D *getUV( void ) const; ///< get UV coords
void setTextureWidth( Int width ); ///< set width of texture page this image is on
void setTextureHeight( Int height ); ///< set height of texture page this image is on
const ICoord2D *getTextureSize( void ) const; ///< return the texture size defined
void setImageSize( ICoord2D *size ); ///< set image width and height
const ICoord2D *getImageSize( void ) const; ///< get size
Int getImageWidth( void ) const; ///< get width
Int getImageHeight( void ) const; ///< get height
void setRawTextureData( void *data ); ///< set raw texture data
const void *getRawTextureData( void ) const; ///< get raw texture data
UnsignedInt setStatus( UnsignedInt bit ); ///< set status bit
UnsignedInt clearStatus( UnsignedInt bit ); ///< clear status bit
UnsignedInt getStatus( void ) const; ///< get status bits
// for parsing from INI
const FieldParse *getFieldParse( void ) const { return m_imageFieldParseTable; }
static void parseImageCoords( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parseImageStatus( INI* ini, void *instance, void *store, const void* /*userData*/ );
protected:
friend class ImageCollection;
AsciiString m_name; ///< name for this image
AsciiString m_filename; ///< texture filename this image is in
ICoord2D m_textureSize; ///< size of the texture this image is a part of
Region2D m_UVCoords; ///< texture UV coords for image
ICoord2D m_imageSize; ///< dimensions of image
void *m_rawTextureData; ///< raw texture data
UnsignedInt m_status; ///< status bits from ImageStatus
Image *m_next; ///< for maintaining lists as collections
static const FieldParse m_imageFieldParseTable[]; ///< the parse table for INI definition
}; // end Image
//-------------------------------------------------------------------------------------------------
/** A collection of images */
//-------------------------------------------------------------------------------------------------
class ImageCollection : public SubsystemInterface
{
public:
ImageCollection( void );
virtual ~ImageCollection( void );
virtual void init( void ) { }; ///< initialize system
virtual void reset( void ) { }; ///< reset system
virtual void update( void ) { }; ///< update system
void load( Int textureSize ); ///< load images
const Image *findImageByName( const AsciiString& name ); ///< find image based on name
const Image *findImageByFilename( const AsciiString& name ); ///< find image based on filename
Image *firstImage( void ); ///< return first image in list
Image *nextImage( Image *image ); ///< return next image
Image *newImage( void ); ///< return a new, linked image
protected:
Image *m_imageList; ///< the image list
}; // end ImageCollection
// INLINING ///////////////////////////////////////////////////////////////////////////////////////
inline void Image::setName( AsciiString name ) { m_name = name; }
inline AsciiString Image::getName( void ) const { return m_name; }
inline void Image::setFilename( AsciiString name ) { m_filename = name; }
inline AsciiString Image::getFilename( void ) const { return m_filename; }
inline Image *ImageCollection::firstImage( void ) { return m_imageList; }
inline void Image::setUV( Region2D *uv ) { if( uv ) m_UVCoords = *uv; }
inline const Region2D *Image::getUV( void ) const { return &m_UVCoords; }
inline void Image::setTextureWidth( Int width ) { m_textureSize.x = width; }
inline void Image::setTextureHeight( Int height ) { m_textureSize.y = height; }
inline void Image::setImageSize( ICoord2D *size ) { m_imageSize = *size; }
inline const ICoord2D *Image::getImageSize( void ) const { return &m_imageSize; }
inline const ICoord2D *Image::getTextureSize( void ) const { return &m_textureSize; }
inline Int Image::getImageWidth( void ) const { return m_imageSize.x; }
inline Int Image::getImageHeight( void ) const { return m_imageSize.y; }
inline void Image::setRawTextureData( void *data ) { m_rawTextureData = data; }
inline const void *Image::getRawTextureData( void ) const { return m_rawTextureData; }
inline UnsignedInt Image::getStatus( void ) const { return m_status; }
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern ImageCollection *TheMappedImageCollection; ///< mapped images
#endif // __IMAGE_H_

View File

@@ -0,0 +1,842 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: InGameUI.h ///////////////////////////////////////////////////////////////////////////////
// Defines the in-game user interface singleton
// Author: Michael S. Booth, March 2001
// Colin Day August 2001, or so
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _IN_GAME_UI_H_
#define _IN_GAME_UI_H_
#include "Common/GameCommon.h"
#include "Common/GameType.h"
#include "Common/MessageStream.h" // for GameMessageTranslator
#include "Common/SpecialPowerType.h"
#include "Common/STLTypedefs.h"
#include "Common/SubsystemInterface.h"
#include "Common/UnicodeString.h"
#include "GameClient/DisplayString.h"
#include "GameClient/Mouse.h"
#include "GameClient/RadiusDecal.h"
#include "GameClient/View.h"
#include "Common/Snapshot.h"
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
class Drawable;
class Object;
class ThingTemplate;
class GameWindow;
class VideoBuffer;
class VideoStreamInterface;
class CommandButton;
class SpecialPowerTemplate;
class WindowLayout;
class Anim2DTemplate;
class Anim2D;
class Shadow;
enum LegalBuildCode;
enum KindOfType;
enum ShadowType;
enum CanAttackResult;
// ------------------------------------------------------------------------------------------------
enum RadiusCursorType
{
RADIUSCURSOR_NONE = 0,
RADIUSCURSOR_ATTACK_DAMAGE_AREA,
RADIUSCURSOR_ATTACK_SCATTER_AREA,
RADIUSCURSOR_ATTACK_CONTINUE_AREA,
RADIUSCURSOR_GUARD_AREA,
RADIUSCURSOR_EMERGENCY_REPAIR,
RADIUSCURSOR_FRIENDLY_SPECIALPOWER,
RADIUSCURSOR_OFFENSIVE_SPECIALPOWER,
RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA,
RADIUSCURSOR_PARTICLECANNON,
RADIUSCURSOR_A10STRIKE,
RADIUSCURSOR_CARPETBOMB,
RADIUSCURSOR_DAISYCUTTER,
RADIUSCURSOR_PARADROP,
RADIUSCURSOR_SPYSATELLITE,
RADIUSCURSOR_NUCLEARMISSILE,
RADIUSCURSOR_EMPPULSE,
RADIUSCURSOR_ARTILLERYBARRAGE,
RADIUSCURSOR_NAPALMSTRIKE,
RADIUSCURSOR_CLUSTERMINES,
RADIUSCURSOR_SCUDSTORM,
RADIUSCURSOR_ANTHRAXBOMB,
RADIUSCURSOR_AMBUSH,
RADIUSCURSOR_RADAR,
RADIUSCURSOR_SPYDRONE,
RADIUSCURSOR_COUNT // keep last
};
#ifdef DEFINE_RADIUSCURSOR_NAMES
static const char *TheRadiusCursorNames[] =
{
"NONE",
"ATTACK_DAMAGE_AREA",
"ATTACK_SCATTER_AREA",
"ATTACK_CONTINUE_AREA",
"GUARD_AREA",
"EMERGENCY_REPAIR",
"FRIENDLY_SPECIALPOWER", //green
"OFFENSIVE_SPECIALPOWER", //red
"SUPERWEAPON_SCATTER_AREA",//red
"PARTICLECANNON",
"A10STRIKE",
"CARPETBOMB",
"DAISYCUTTER",
"PARADROP",
"SPYSATELLITE",
"NUCLEARMISSILE",
"EMPPULSE",
"ARTILLERYBARRAGE",
"NAPALMSTRIKE",
"CLUSTERMINES",
"SCUDSTORM",
"ANTHRAXBOMB",
"AMBUSH",
"RADAR",
"SPYDRONE",
NULL
};
#endif
// ------------------------------------------------------------------------------------------------
/** For keeping track in the UI of how much build progress has been done */
// ------------------------------------------------------------------------------------------------
enum { MAX_BUILD_PROGRESS = 64 }; ///< interface can support building this many different units
struct BuildProgress
{
const ThingTemplate *m_thingTemplate;
Real m_percentComplete;
GameWindow *m_control;
};
// TYPE DEFINES ///////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------------
typedef std::list<Drawable *> DrawableList;
typedef std::list<Drawable *>::iterator DrawableListIt;
typedef std::list<Drawable *>::const_iterator DrawableListCIt;
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
class SuperweaponInfo : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(SuperweaponInfo, "SuperweaponInfo")
private:
// not saved
DisplayString * m_nameDisplayString; ///< display string used to render the message
DisplayString * m_timeDisplayString; ///< display string used to render the message
Color m_color;
const SpecialPowerTemplate* m_powerTemplate;
public:
SuperweaponInfo(
ObjectID id,
UnsignedInt timestamp,
Bool hiddenByScript,
Bool hiddenByScience,
Bool ready,
const AsciiString& superweaponNormalFont,
Int superweaponNormalPointSize,
Bool superweaponNormalBold,
Color c,
const SpecialPowerTemplate* spt
);
const SpecialPowerTemplate* getSpecialPowerTemplate() const { return m_powerTemplate; }
void setFont(const AsciiString& superweaponNormalFont, Int superweaponNormalPointSize, Bool superweaponNormalBold);
void setText(const UnicodeString& name, const UnicodeString& time);
void drawName(Int x, Int y, Color color, Color dropColor);
void drawTime(Int x, Int y, Color color, Color dropColor);
Real getHeight() const;
// saved & public
AsciiString m_powerName;
ObjectID m_id;
UnsignedInt m_timestamp; ///< seconds shown in display string
Bool m_hiddenByScript;
Bool m_hiddenByScience;
Bool m_ready; ///< Stores if we were ready last draw, since readyness can change without time changing
// not saved, but public
Bool m_forceUpdateText;
};
// ------------------------------------------------------------------------------------------------
typedef std::list<SuperweaponInfo *> SuperweaponList;
typedef std::map<AsciiString, SuperweaponList> SuperweaponMap;
// ------------------------------------------------------------------------------------------------
// Popup message box
class PopupMessageData : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(PopupMessageData, "PopupMessageData")
public:
UnicodeString message;
Int x;
Int y;
Int width;
Color textColor;
Bool pause;
Bool pauseMusic;
WindowLayout* layout;
};
EMPTY_DTOR(PopupMessageData)
// ------------------------------------------------------------------------------------------------
class NamedTimerInfo : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NamedTimerInfo, "NamedTimerInfo")
public:
AsciiString m_timerName; ///< Timer name, needed on Load to reconstruct Map.
UnicodeString timerText; ///< timer text
DisplayString* displayString; ///< display string used to render the message
UnsignedInt timestamp; ///< seconds shown in display string
Color color;
Bool isCountdown;
};
EMPTY_DTOR(NamedTimerInfo)
// ------------------------------------------------------------------------------------------------
typedef std::map<AsciiString, NamedTimerInfo *> NamedTimerMap;
typedef NamedTimerMap::iterator NamedTimerMapIt;
// ------------------------------------------------------------------------------------------------
enum {MAX_SUBTITLE_LINES = 4}; ///< The maximum number of lines a subtitle can have
// ------------------------------------------------------------------------------------------------
// Floating Text Data
class FloatingTextData : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(FloatingTextData, "FloatingTextData")
public:
FloatingTextData(void);
//~FloatingTextData(void);
Color m_color; ///< It's current color
UnicodeString m_text; ///< the text we're displaying
DisplayString* m_dString; ///< The display string
Coord3D m_pos3D; ///< the 3d position in game coords
Int m_frameTimeOut; ///< when we want this thing to disappear
Int m_frameCount; ///< how many frames have we been displaying text?
};
typedef std::list<FloatingTextData *> FloatingTextList;
typedef FloatingTextList::iterator FloatingTextListIt;
enum
{
DEFAULT_FLOATING_TEXT_TIMEOUT = LOGICFRAMES_PER_SECOND/3,
};
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------------
enum WorldAnimationOptions
{
WORLD_ANIM_NO_OPTIONS = 0x00000000,
WORLD_ANIM_FADE_ON_EXPIRE = 0x00000001,
WORLD_ANIM_PLAY_ONCE_AND_DESTROY = 0x00000002,
};
// ------------------------------------------------------------------------------------------------
class WorldAnimationData
{
public:
WorldAnimationData( void );
~WorldAnimationData( void ) { }
Anim2D *m_anim; ///< the animation instance
Coord3D m_worldPos; ///< position in the world
UnsignedInt m_expireFrame; ///< frame we expire on
WorldAnimationOptions m_options; ///< options
Real m_zRisePerSecond; ///< Z units to rise per second
};
typedef std::list< WorldAnimationData *> WorldAnimationList;
typedef WorldAnimationList::iterator WorldAnimationListIterator;
// ------------------------------------------------------------------------------------------------
/** Basic functionality common to all in-game user interfaces */
// ------------------------------------------------------------------------------------------------
class InGameUI : public SubsystemInterface, public Snapshot
{
friend class Drawable; // for selection/deselection transactions
public: // ***************************************************************************************
enum SelectionRules
{
SELECTION_ANY, //Only one of the selected units has to qualify
SELECTION_ALL, //All selected units have to qualify
};
enum ActionType
{
ACTIONTYPE_NONE,
ACTIONTYPE_ATTACK_OBJECT,
ACTIONTYPE_GET_REPAIRED_AT,
ACTIONTYPE_DOCK_AT,
ACTIONTYPE_GET_HEALED_AT,
ACTIONTYPE_REPAIR_OBJECT,
ACTIONTYPE_RESUME_CONSTRUCTION,
ACTIONTYPE_ENTER_OBJECT,
ACTIONTYPE_HIJACK_VEHICLE,
ACTIONTYPE_CONVERT_OBJECT_TO_CARBOMB,
ACTIONTYPE_CAPTURE_BUILDING,
ACTIONTYPE_DISABLE_VEHICLE_VIA_HACKING,
#ifdef ALLOW_SURRENDER
ACTIONTYPE_PICK_UP_PRISONER,
#endif
ACTIONTYPE_STEAL_CASH_VIA_HACKING,
ACTIONTYPE_DISABLE_BUILDING_VIA_HACKING,
ACTIONTYPE_MAKE_DEFECTOR,
ACTIONTYPE_SET_RALLY_POINT,
ACTIONTYPE_COMBATDROP_INTO,
//Keep last.
NUM_ACTIONTYPES
};
InGameUI( void );
virtual ~InGameUI( void );
// Inherited from subsystem interface -----------------------------------------------------------
virtual void init( void ); ///< Initialize the in-game user interface
virtual void update( void ); ///< Update the UI by calling preDraw(), draw(), and postDraw()
virtual void reset( void ); ///< Reset
//-----------------------------------------------------------------------------------------------
// interface for the popup messages
virtual void popupMessage( const AsciiString& message, Int x, Int y, Int width, Bool pause, Bool pauseMusic);
virtual void popupMessage( const AsciiString& message, Int x, Int y, Int width, Color textColor, Bool pause, Bool pauseMusic);
PopupMessageData *getPopupMessageData( void ) { return m_popupMessageData; }
void clearPopupMessageData( void );
// interface for messages to the user
// srj sez: passing as const-ref screws up varargs for some reason. dunno why. just pass by value.
virtual void messageColor( const RGBColor *rgbColor, UnicodeString format, ... ); ///< display a colored message to the user
virtual void message( UnicodeString format, ... ); ///< display a message to the user
virtual void message( AsciiString stringManagerLabel, ... );///< display a message to the user
virtual void toggleMessages( void ) { m_messagesOn = 1 - m_messagesOn; } ///< toggle messages on/off
virtual Bool isMessagesOn( void ) { return m_messagesOn; } ///< are the display messages on
void freeMessageResources( void ); ///< free resources for the ui messages
Color getMessageColor(Bool altColor) { return (altColor)?m_messageColor2:m_messageColor1; }
// interface for military style messages
virtual void militarySubtitle( const AsciiString& label, Int duration ); // time in milliseconds
virtual void removeMilitarySubtitle( void );
// for can't build messages
virtual void displayCantBuildMessage( LegalBuildCode lbc ); ///< display message to use as to why they can't build here
// interface for graphical "hints" which provide visual feedback for user-interface commands
virtual void beginAreaSelectHint( const GameMessage *msg ); ///< Used by HintSpy. An area selection is occurring, start graphical "hint"
virtual void endAreaSelectHint( const GameMessage *msg ); ///< Used by HintSpy. An area selection had occurred, finish graphical "hint"
virtual void createMoveHint( const GameMessage *msg ); ///< A move command has occurred, start graphical "hint"
virtual void createAttackHint( const GameMessage *msg ); ///< An attack command has occurred, start graphical "hint"
virtual void createForceAttackHint( const GameMessage *msg ); ///< A force attack command has occurred, start graphical "hint"
virtual void createMouseoverHint( const GameMessage *msg ); ///< An object is mouse hovered over, start hint if any
virtual void createCommandHint( const GameMessage *msg ); ///< Used by HintSpy. Someone is selected so generate the right Cursor for the potential action
virtual void createGarrisonHint( const GameMessage *msg ); ///< A garrison command has occurred, start graphical "hint"
virtual void addSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate);
virtual Bool removeSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate);
virtual void objectChangedTeam(const Object *obj, Int oldPlayerIndex, Int newPlayerIndex); // notification for superweapons, etc
virtual void setSuperweaponDisplayEnabledByScript( Bool enable ); ///< Set the superweapon display enabled or disabled
virtual Bool getSuperweaponDisplayEnabledByScript( void ) const; ///< Get the current superweapon display status
virtual void hideObjectSuperweaponDisplayByScript(const Object *obj);
virtual void showObjectSuperweaponDisplayByScript(const Object *obj);
void addNamedTimer( const AsciiString& timerName, const UnicodeString& text, Bool isCountdown );
void removeNamedTimer( const AsciiString& timerName );
void showNamedTimerDisplay( Bool show );
// mouse mode interface
virtual void setScrolling( Bool isScrolling ); ///< set right-click scroll mode
virtual Bool isScrolling( void ); ///< are we scrolling?
virtual void setSelecting( Bool isSelecting ); ///< set drag select mode
virtual Bool isSelecting( void ); ///< are we selecting?
virtual void setScrollAmount( Coord2D amt ); ///< set scroll amount
virtual Coord2D getScrollAmount( void ); ///< get scroll amount
// gui command interface
virtual void setGUICommand( const CommandButton *command ); ///< the command has been clicked in the UI and needs additional data
virtual const CommandButton *getGUICommand( void ) const; ///< get the pending gui command
// build interface
virtual void placeBuildAvailable( const ThingTemplate *build, Drawable *buildDrawable ); ///< built thing being placed
virtual const ThingTemplate *getPendingPlaceType( void ); ///< get item we're trying to place
virtual const ObjectID getPendingPlaceSourceObjectID( void ); ///< get producing object
virtual void setPlacementStart( const ICoord2D *start ); ///< placement anchor point (for choosing angles)
virtual void setPlacementEnd( const ICoord2D *end ); ///< set target placement point (for choosing angles)
virtual Bool isPlacementAnchored( void ); ///< is placement arrow anchor set
virtual void getPlacementPoints( ICoord2D *start, ICoord2D *end );///< get the placemnt arrow points
virtual Real getPlacementAngle( void ); ///< placement angle of drawable at cursor when placing down structures
// Drawable selection mechanisms
virtual void selectDrawable( Drawable *draw ); ///< Mark given Drawable as "selected"
virtual void deselectDrawable( Drawable *draw ); ///< Clear "selected" status from Drawable
virtual void deselectAllDrawables( Bool postMsg = true ); ///< Clear the "select" flag from all drawables
virtual Int getSelectCount( void ) { return m_selectCount; } ///< Get count of currently selected drawables
virtual Int getMaxSelectCount( void ) { return m_maxSelectCount; } ///< Get the max number of selected drawables
virtual UnsignedInt getFrameSelectionChanged( void ) { return m_frameSelectionChanged; } ///< Get the max number of selected drawables
virtual const DrawableList *getAllSelectedDrawables( void ) const; ///< Return the list of all the currently selected Drawable IDs.
virtual const DrawableList *getAllSelectedLocalDrawables( void ); ///< Return the list of all the currently selected Drawable IDs owned by the current player.
virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any)
virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected
virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list
virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of
virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of
virtual void setRadiusCursor(RadiusCursorType r, const SpecialPowerTemplate* sp, WeaponSlotType wslot);
virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, NULL, PRIMARY_WEAPON); }
virtual void setInputEnabled( Bool enable ); ///< Set the input enabled or disabled
virtual Bool getInputEnabled( void ) { return m_inputEnabled; } ///< Get the current input status
virtual void disregardDrawable( Drawable *draw ); ///< Drawable is being destroyed, clean up any UI elements associated with it
virtual void preDraw( void ); ///< Logic which needs to occur before the UI renders
virtual void draw( void ) = 0; ///< Render the in-game user interface
virtual void postDraw( void ); ///< Logic which needs to occur after the UI renders
/// Ingame video playback
virtual void playMovie( const AsciiString& movieName );
virtual void stopMovie( void );
virtual VideoBuffer* videoBuffer( void );
/// Ingame cameo video playback
virtual void playCameoMovie( const AsciiString& movieName );
virtual void stopCameoMovie( void );
virtual VideoBuffer* cameoVideoBuffer( void );
// mouse over information
virtual DrawableID getMousedOverDrawableID( void ) const; ///< Get drawble ID of drawable under cursor
/// Set the ingame flag as to if we have the Quit menu up or not
virtual void setQuitMenuVisible( Bool t ) { m_isQuitMenuVisible = t; }
virtual Bool isQuitMenuVisible( void ) const { return m_isQuitMenuVisible; }
// INI file parsing
virtual const FieldParse* getFieldParse( void ) const { return s_fieldParseTable; }
//Provides a global way to determine whether or not we can issue orders to what we have selected.
Bool areSelectedObjectsControllable() const;
//Wrapper function that includes any non-attack canSelectedObjectsXXX checks.
Bool canSelectedObjectsNonAttackInteractWithObject( const Object *objectToInteractWith, SelectionRules rule ) const;
//Wrapper function that checks a specific action.
CanAttackResult getCanSelectedObjectsAttack( ActionType action, const Object *objectToInteractWith, SelectionRules rule, Bool additionalChecking = FALSE ) const;
Bool canSelectedObjectsDoAction( ActionType action, const Object *objectToInteractWith, SelectionRules rule, Bool additionalChecking = FALSE ) const;
Bool canSelectedObjectsDoSpecialPower( const CommandButton *command, const Object *objectToInteractWith, const Coord3D *position, SelectionRules rule, UnsignedInt commandOptions, Object* ignoreSelObj ) const;
Bool canSelectedObjectsEffectivelyUseWeapon( const CommandButton *command, const Object *objectToInteractWith, const Coord3D *position, SelectionRules rule ) const;
Bool canSelectedObjectsOverrideSpecialPowerDestination( const Coord3D *loc, SelectionRules rule, SpecialPowerType spType = SPECIAL_INVALID ) const;
// Selection Methods
virtual Int selectMatchingUnits(); ///< selects matching units
virtual Int selectAcrossScreen(); ///< selects matching units across screen
virtual Int selectAcrossMap(); ///< selects matching units across map
virtual Int selectAcrossRegion( IRegion2D *region ); // -1 = no locally-owned selection, 0+ = # of units selected
virtual void buildRegion( const ICoord2D *anchor, const ICoord2D *dest, IRegion2D *region ); ///< builds a region around the specified coordinates
virtual Bool getDisplayedMaxWarning( void ) { return m_displayedMaxWarning; }
virtual void setDisplayedMaxWarning( Bool selected ) { m_displayedMaxWarning = selected; }
// Floating Test Methods
virtual void addFloatingText(const UnicodeString& text,const Coord3D * pos, Color color);
// Drawable caption stuff
AsciiString getDrawableCaptionFontName( void ) { return m_drawableCaptionFont; }
Int getDrawableCaptionPointSize( void ) { return m_drawableCaptionPointSize; }
Bool isDrawableCaptionBold( void ) { return m_drawableCaptionBold; }
Color getDrawableCaptionColor( void ) { return m_drawableCaptionColor; }
inline Bool shouldMoveRMBScrollAnchor( void ) { return m_moveRMBScrollAnchor; }
Bool isClientQuiet( void ) const { return m_clientQuiet; }
Bool isInWaypointMode( void ) const { return m_waypointMode; }
Bool isInForceAttackMode( void ) const { return m_forceAttackMode; }
Bool isInForceMoveToMode( void ) const { return m_forceMoveToMode; }
Bool isInPreferSelectionMode( void ) const { return m_preferSelection; }
void setClientQuiet( Bool enabled ) { m_clientQuiet = enabled; }
void setWaypointMode( Bool enabled ) { m_waypointMode = enabled; }
void setForceMoveMode( Bool enabled ) { m_forceMoveToMode = enabled; }
void setForceAttackMode( Bool enabled ) { m_forceAttackMode = enabled; }
void setPreferSelectionMode( Bool enabled ) { m_preferSelection = enabled; }
void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; }
Bool isInAttackMoveToMode( void ) const { return m_attackMoveToMode; }
void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; }
void setCameraRotateLeft( Bool set ) { m_cameraRotatingLeft = set; }
void setCameraRotateRight( Bool set ) { m_cameraRotatingRight = set; }
void setCameraZoomIn( Bool set ) { m_cameraZoomingIn = set; }
void setCameraZoomOut( Bool set ) { m_cameraZoomingOut = set; }
Bool isCameraRotatingLeft() const { return m_cameraRotatingLeft; }
Bool isCameraRotatingRight() const { return m_cameraRotatingRight; }
Bool isCameraZoomingIn() const { return m_cameraZoomingIn; }
Bool isCameraZoomingOut() const { return m_cameraZoomingOut; }
void resetCamera();
virtual void addIdleWorker( Object *obj );
virtual void removeIdleWorker( Object *obj, Int playerNumber );
virtual void selectNextIdleWorker( void );
virtual void recreateControlBar( void );
virtual void disableTooltipsUntil(UnsignedInt frameNum);
virtual void clearTooltipsDisabled();
virtual Bool areTooltipsDisabled() const;
Bool getDrawRMBScrollAnchor() const { return m_drawRMBScrollAnchor; }
Bool getMoveRMBScrollAnchor() const { return m_moveRMBScrollAnchor; }
void setDrawRMBScrollAnchor(Bool b) { m_drawRMBScrollAnchor = b; }
void setMoveRMBScrollAnchor(Bool b) { m_moveRMBScrollAnchor = b; }
private:
virtual Int getIdleWorkerCount( void );
virtual Object *findIdleWorker( Object *obj);
virtual void showIdleWorkerLayout( void );
virtual void hideIdleWorkerLayout( void );
virtual void updateIdleWorker( void );
virtual void resetIdleWorker( void );
public:
void registerWindowLayout(WindowLayout *layout); // register a layout for updates
void unregisterWindowLayout(WindowLayout *layout); // stop updates for this layout
public:
// World 2D animation methods
void addWorldAnimation( Anim2DTemplate *animTemplate,
const Coord3D *pos,
WorldAnimationOptions options,
Real durationInSeconds,
Real zRisePerSecond );
#if defined(_DEBUG) || defined(_INTERNAL)
virtual void DEBUG_addFloatingText(const AsciiString& text,const Coord3D * pos, Color color);
#endif
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
protected:
// ----------------------------------------------------------------------------------------------
// Protected Types ------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
enum HintType
{
MOVE_HINT = 0,
ATTACK_HINT,
#ifdef _DEBUG
DEBUG_HINT,
#endif
NUM_HINT_TYPES // keep this one last
};
// mouse mode interface
enum MouseMode
{
MOUSEMODE_DEFAULT = 0,
MOUSEMODE_BUILD_PLACE,
MOUSEMODE_GUI_COMMAND,
MOUSEMODE_MAX
};
enum { MAX_MOVE_HINTS = 256 };
struct MoveHintStruct
{
Coord3D pos; ///< World coords of destination point
UnsignedInt sourceID; ///< id of who will move to this point
UnsignedInt frame; ///< frame the command was issued on
};
struct UIMessage
{
UnicodeString fullText; ///< the whole text message
DisplayString *displayString; ///< display string used to render the message
UnsignedInt timestamp; ///< logic frame message was created on
Color color; ///< color to render this in
};
enum { MAX_UI_MESSAGES = 6 };
struct MilitarySubtitleData
{
UnicodeString subtitle; ///< The complete subtitle to be drawn, each line is separated by L"\n"
UnsignedInt index; ///< the current index that we are at through the sibtitle
ICoord2D position; ///< Where on the screen the subtitle should be drawn
DisplayString *displayStrings[MAX_SUBTITLE_LINES]; ///< We'll only allow MAX_SUBTITLE_LINES worth of display strings
UnsignedInt currentDisplayString; ///< contains the current display string we're on. (also lets us know the last display string allocated
UnsignedInt lifetime; ///< the Lifetime of the Military Subtitle in frames
Bool blockDrawn; ///< True if the block is drawn false if it's blank
UnsignedInt blockBeginFrame; ///< The frame at which the block started it's current state
ICoord2D blockPos; ///< where the upper left of the block should begin
UnsignedInt incrementOnFrame; ///< if we're currently on a frame greater then this, increment our position
Color color; ///< what color should we display the military subtitles
};
typedef std::list<Object *> ObjectList;
typedef std::list<Object *>::iterator ObjectListIt;
// ----------------------------------------------------------------------------------------------
// Protected Methods ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
void destroyPlacementIcons( void ); ///< Destroy placement icons
void handleBuildPlacements( void ); ///< handle updating of placement icons based on mouse pos
void handleRadiusCursor(); ///< handle updating of "radius cursors" that follow the mouse pos
void incrementSelectCount( void ) { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables
void decrementSelectCount( void ) { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables
virtual View *createView( void ) = 0; ///< Factory for Views
void evaluateSoloNexus( Drawable *newlyAddedDrawable = NULL );
/// expire a hint from of the specified type at the hint index
void expireHint( HintType type, UnsignedInt hintIndex );
void createControlBar( void ); ///< create the control bar user interface
void createReplayControl( void ); ///< create the replay control window
void setMouseCursor(Mouse::MouseCursor c);
void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = NULL ); ///< internal workhorse for adding plain text for messages
void removeMessageAtIndex( Int i ); ///< remove the message at index i
void updateFloatingText( void ); ///< Update function to move our floating text
void drawFloatingText( void ); ///< Draw all our floating text
void clearFloatingText( void ); ///< clear the floating text list
void clearWorldAnimations( void ); ///< delete all world animations
void updateAndDrawWorldAnimations( void ); ///< update and draw visible world animations
SuperweaponInfo* findSWInfo(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate);
// ----------------------------------------------------------------------------------------------
// Protected Data THAT IS SAVED/LOADED ----------------------------------------------------------
// ----------------------------------------------------------------------------------------------
Bool m_superweaponHiddenByScript;
Bool m_inputEnabled; /// sort of
// ----------------------------------------------------------------------------------------------
// Protected Data -------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
std::list<WindowLayout *> m_windowLayouts;
AsciiString m_currentlyPlayingMovie; ///< Used to push updates to TheScriptEngine
DrawableList m_selectedDrawables; ///< A list of all selected drawables.
DrawableList m_selectedLocalDrawables; ///< A list of all selected drawables owned by the local player
Bool m_isDragSelecting; ///< If TRUE, an area selection is in progress
IRegion2D m_dragSelectRegion; ///< if isDragSelecting is TRUE, this contains select region
Bool m_displayedMaxWarning; ///< keeps the warning from being shown over and over
MoveHintStruct m_moveHint[ MAX_MOVE_HINTS ];
Int m_nextMoveHint;
const CommandButton * m_pendingGUICommand; ///< GUI command that needs additional interaction from the user
BuildProgress m_buildProgress[ MAX_BUILD_PROGRESS ]; ///< progress for building units
const ThingTemplate * m_pendingPlaceType; ///< type of built thing we're trying to place
ObjectID m_pendingPlaceSourceObjectID; ///< source object of the thing constructing the item
Drawable ** m_placeIcon; ///< array for drawables to appear at the cursor when building in the world
Bool m_placeAnchorInProgress; ///< is place angle interface for placement active
ICoord2D m_placeAnchorStart; ///< place angle anchor start
ICoord2D m_placeAnchorEnd; ///< place angle anchor end
Int m_selectCount; ///< Number of objects currently "selected"
Int m_maxSelectCount; ///< Max number of objects to select
UnsignedInt m_frameSelectionChanged; ///< Frame when the selection last changed.
// Video playback data
VideoBuffer* m_videoBuffer; ///< video playback buffer
VideoStreamInterface* m_videoStream; ///< Video stream;
// Video playback data
VideoBuffer* m_cameoVideoBuffer;///< video playback buffer
VideoStreamInterface* m_cameoVideoStream;///< Video stream;
// message data
UIMessage m_uiMessages[ MAX_UI_MESSAGES ];/**< messages to display to the user, the
array is organized with newer messages at
index 0, and increasing to older ones */
// superweapon timer data
SuperweaponMap m_superweapons[MAX_PLAYER_COUNT];
Coord2D m_superweaponPosition;
Real m_superweaponFlashDuration;
// superweapon timer font info
AsciiString m_superweaponNormalFont;
Int m_superweaponNormalPointSize;
Bool m_superweaponNormalBold;
AsciiString m_superweaponReadyFont;
Int m_superweaponReadyPointSize;
Bool m_superweaponReadyBold;
Int m_superweaponLastFlashFrame; ///< for flashing the text when the weapon is ready
Color m_superweaponFlashColor;
Bool m_superweaponUsedFlashColor;
NamedTimerMap m_namedTimers;
Coord2D m_namedTimerPosition;
Real m_namedTimerFlashDuration;
Int m_namedTimerLastFlashFrame;
Color m_namedTimerFlashColor;
Bool m_namedTimerUsedFlashColor;
Bool m_showNamedTimers;
AsciiString m_namedTimerNormalFont;
Int m_namedTimerNormalPointSize;
Bool m_namedTimerNormalBold;
Color m_namedTimerNormalColor;
AsciiString m_namedTimerReadyFont;
Int m_namedTimerReadyPointSize;
Bool m_namedTimerReadyBold;
Color m_namedTimerReadyColor;
// Drawable caption data
AsciiString m_drawableCaptionFont;
Int m_drawableCaptionPointSize;
Bool m_drawableCaptionBold;
Color m_drawableCaptionColor;
UnsignedInt m_tooltipsDisabledUntil;
// Military Subtitle data
MilitarySubtitleData * m_militarySubtitle; ///< The pointer to subtitle class, if it's present then draw it.
Bool m_isScrolling;
Bool m_isSelecting;
MouseMode m_mouseMode;
Int m_mouseModeCursor;
DrawableID m_mousedOverDrawableID;
Coord2D m_scrollAmt;
Bool m_isQuitMenuVisible;
Bool m_messagesOn;
Color m_messageColor1;
Color m_messageColor2;
ICoord2D m_messagePosition;
AsciiString m_messageFont;
Int m_messagePointSize;
Bool m_messageBold;
Int m_messageDelayMS;
RGBAColorInt m_militaryCaptionColor; ///< color for the military-style caption
ICoord2D m_militaryCaptionPosition; ///< position for the military-style caption
AsciiString m_militaryCaptionTitleFont;
Int m_militaryCaptionTitlePointSize;
Bool m_militaryCaptionTitleBold;
AsciiString m_militaryCaptionFont;
Int m_militaryCaptionPointSize;
Bool m_militaryCaptionBold;
Bool m_militaryCaptionRandomizeTyping;
Int m_militaryCaptionDelayMS;
Int m_militaryCaptionSpeed;
RadiusDecalTemplate m_radiusCursors[RADIUSCURSOR_COUNT];
RadiusDecal m_curRadiusCursor;
RadiusCursorType m_curRcType;
//Floating Text Data
FloatingTextList m_floatingTextList; ///< Our list of floating text
UnsignedInt m_floatingTextTimeOut; ///< Ini value of our floating text timeout
Real m_floatingTextMoveUpSpeed; ///< INI value of our Move up speed
Real m_floatingTextMoveVanishRate; ///< INI value of our move vanish rate
PopupMessageData * m_popupMessageData;
Color m_popupMessageColor;
Bool m_waypointMode; ///< are we in waypoint plotting mode?
Bool m_forceAttackMode; ///< are we in force attack mode?
Bool m_forceMoveToMode; ///< are we in force move mode?
Bool m_attackMoveToMode; ///< are we in attack move mode?
Bool m_preferSelection; ///< the shift key has been depressed.
Bool m_cameraRotatingLeft;
Bool m_cameraRotatingRight;
Bool m_cameraZoomingIn;
Bool m_cameraZoomingOut;
Bool m_drawRMBScrollAnchor;
Bool m_moveRMBScrollAnchor;
Bool m_clientQuiet; ///< When the user clicks exit,restart, etc. this is set true
///< to skip some client sounds/fx during shutdown
// World Animation Data
WorldAnimationList m_worldAnimationList; ///< the list of world animations
// Idle worker animation
ObjectList m_idleWorkers[MAX_PLAYER_COUNT];
GameWindow * m_idleWorkerWin;
Int m_currentIdleWorkerDisplay;
DrawableID m_soloNexusSelectedDrawableID; ///< The drawable of the nexus, if only one angry mob is selected, otherwise, null
// ----------------------------------------------------------------------------------------------
// STATIC Protected Data -------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
static const FieldParse s_fieldParseTable[];
};
// the singleton
extern InGameUI *TheInGameUI;
#endif // _IN_GAME_UI_H_

View File

@@ -0,0 +1,260 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: KeyDefs.h ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: KeyDefs.h
//
// Created: Mike Morrison, 1995
// Colin Day, June 2001
//
// Desc: Basic keyboard key definitions.
//
/** @todo NOTE: These key definitions are currently tied directly to the
* Direct Input key codes, therefore making these definitions device
* dependent even though this code lives on the device INdependent side
* of the engine. In the future to be truly device independent we
* need to define our own key codes, and have a translation between
* what we read from the device to our own system*/
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __KEYDEFS_H_
#define __KEYDEFS_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
#include <stdlib.h>
#ifndef DIRECTINPUT_VERSION
# define DIRECTINPUT_VERSION 0x800
#endif
#include <dinput.h>
// USER INCLUDES //////////////////////////////////////////////////////////////
// FORWARD REFERENCES /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#ifndef DIK_OEM_102
#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */
#endif
#ifndef DIK_KANA
#define DIK_KANA 0x70 /* (Japanese keyboard) */
#endif
#ifndef DIK_CONVERT
#define DIK_CONVERT 0x79 /* (Japanese keyboard) */
#endif
#ifndef DIK_NOCONVERT
#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */
#endif
#ifndef DIK_YEN
#define DIK_YEN 0x7D /* (Japanese keyboard) */
#endif
#ifndef DIK_CIRCUMFLEX
#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */
#endif
#ifndef DIK_KANJI
#define DIK_KANJI 0x94 /* (Japanese keyboard) */
#endif
//=============================================================================
/** The key tables */
//=============================================================================
enum KeyDefType
{
// keypad keys ----------------------------------------------------------------
KEY_KP0 = DIK_NUMPAD0,
KEY_KP1 = DIK_NUMPAD1,
KEY_KP2 = DIK_NUMPAD2,
KEY_KP3 = DIK_NUMPAD3,
KEY_KP4 = DIK_NUMPAD4,
KEY_KP5 = DIK_NUMPAD5,
KEY_KP6 = DIK_NUMPAD6,
KEY_KP7 = DIK_NUMPAD7,
KEY_KP8 = DIK_NUMPAD8,
KEY_KP9 = DIK_NUMPAD9,
KEY_KPDEL = DIK_NUMPADPERIOD,
KEY_KPSTAR = DIK_NUMPADSTAR,
KEY_KPMINUS = DIK_NUMPADMINUS,
KEY_KPPLUS = DIK_NUMPADPLUS,
// regular keys ---------------------------------------------------------------
KEY_ESC = DIK_ESCAPE,
KEY_BACKSPACE = DIK_BACK,
KEY_ENTER = DIK_RETURN,
KEY_SPACE = DIK_SPACE,
KEY_TAB = DIK_TAB,
KEY_F1 = DIK_F1,
KEY_F2 = DIK_F2,
KEY_F3 = DIK_F3,
KEY_F4 = DIK_F4,
KEY_F5 = DIK_F5,
KEY_F6 = DIK_F6,
KEY_F7 = DIK_F7,
KEY_F8 = DIK_F8,
KEY_F9 = DIK_F9,
KEY_F10 = DIK_F10,
KEY_F11 = DIK_F11,
KEY_F12 = DIK_F12,
KEY_A = DIK_A,
KEY_B = DIK_B,
KEY_C = DIK_C,
KEY_D = DIK_D,
KEY_E = DIK_E,
KEY_F = DIK_F,
KEY_G = DIK_G,
KEY_H = DIK_H,
KEY_I = DIK_I,
KEY_J = DIK_J,
KEY_K = DIK_K,
KEY_L = DIK_L,
KEY_M = DIK_M,
KEY_N = DIK_N,
KEY_O = DIK_O,
KEY_P = DIK_P,
KEY_Q = DIK_Q,
KEY_R = DIK_R,
KEY_S = DIK_S,
KEY_T = DIK_T,
KEY_U = DIK_U,
KEY_V = DIK_V,
KEY_W = DIK_W,
KEY_X = DIK_X,
KEY_Y = DIK_Y,
KEY_Z = DIK_Z,
KEY_1 = DIK_1,
KEY_2 = DIK_2,
KEY_3 = DIK_3,
KEY_4 = DIK_4,
KEY_5 = DIK_5,
KEY_6 = DIK_6,
KEY_7 = DIK_7,
KEY_8 = DIK_8,
KEY_9 = DIK_9,
KEY_0 = DIK_0,
KEY_MINUS = DIK_MINUS,
KEY_EQUAL = DIK_EQUALS,
KEY_LBRACKET = DIK_LBRACKET,
KEY_RBRACKET = DIK_RBRACKET,
KEY_SEMICOLON = DIK_SEMICOLON,
KEY_APOSTROPHE = DIK_APOSTROPHE,
KEY_TICK = DIK_GRAVE,
KEY_BACKSLASH = DIK_BACKSLASH,
KEY_COMMA = DIK_COMMA,
KEY_PERIOD = DIK_PERIOD,
KEY_SLASH = DIK_SLASH,
// special keys ---------------------------------------------------------------
KEY_SYSREQ = DIK_SYSRQ,
KEY_CAPS = DIK_CAPSLOCK,
KEY_NUM = DIK_NUMLOCK,
KEY_SCROLL = DIK_SCROLL,
KEY_LCTRL = DIK_LCONTROL,
KEY_LALT = DIK_LALT,
KEY_LSHIFT = DIK_LSHIFT,
KEY_RSHIFT = DIK_RSHIFT,
KEY_UP = DIK_UPARROW,
KEY_DOWN = DIK_DOWNARROW,
KEY_LEFT = DIK_LEFTARROW,
KEY_RIGHT = DIK_RIGHTARROW,
KEY_RALT = DIK_RALT,
KEY_RCTRL = DIK_RCONTROL,
KEY_HOME = DIK_HOME,
KEY_END = DIK_END,
KEY_PGUP = DIK_PGUP,
KEY_PGDN = DIK_PGDN,
KEY_INS = DIK_INSERT,
KEY_DEL = DIK_DELETE,
KEY_KPENTER = DIK_NUMPADENTER,
KEY_KPSLASH = DIK_NUMPADSLASH,
KEY_102 = DIK_OEM_102,
// Japanese keyboard keys -----------------------------------------------------
KEY_KANA = DIK_KANA,
KEY_CONVERT = DIK_CONVERT,
KEY_NOCONVERT = DIK_NOCONVERT,
KEY_YEN = DIK_YEN,
KEY_CIRCUMFLEX = DIK_CIRCUMFLEX,
KEY_KANJI = DIK_KANJI,
// specials -------------------------------------------------------------------
KEY_NONE = 0x00, ///< to report end of key stream
KEY_LOST = 0xFF ///< to report lost keyboard focus
}; // end KeyDefType
// state for keyboard IO ------------------------------------------------------
enum
{
KEY_STATE_NONE = 0x0000, // No modifier state
KEY_STATE_UP = 0x0001, // Key is up (default state)
KEY_STATE_DOWN = 0x0002, // Key is down
KEY_STATE_LCONTROL = 0x0004, // Left control is pressed
KEY_STATE_RCONTROL = 0x0008, // Right control is pressed
KEY_STATE_LSHIFT = 0x0010, // left shift is pressed
KEY_STATE_RSHIFT = 0x0020, // right shift is pressed
KEY_STATE_LALT = 0x0040, // left alt is pressed
KEY_STATE_RALT = 0x0080, // right alt is pressed
KEY_STATE_AUTOREPEAT = 0x0100, // Key is down due to autorepeat (only seen in conjunction with KEY_STATE_DOWN)
KEY_STATE_CAPSLOCK = 0x0200, // Caps Lock key is on.
KEY_STATE_SHIFT2 = 0x0400, // Alternate shift key is pressed (I think this is for foreign keyboards..)
// modifier combinations when left/right isn't a factor
KEY_STATE_CONTROL = (KEY_STATE_LCONTROL | KEY_STATE_RCONTROL),
KEY_STATE_SHIFT = (KEY_STATE_LSHIFT | KEY_STATE_RSHIFT | KEY_STATE_SHIFT2 ),
KEY_STATE_ALT = (KEY_STATE_LALT | KEY_STATE_RALT)
}; // end KeyStateType
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __KEYDEFS_H_

View File

@@ -0,0 +1,172 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Keyboard.h ///////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: Keyboard.h
//
// Created: Mike Morrison, 1995
// Colin Day, June 2001
//
// Desc: Basic keyboard
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __KEYBOARD_H_
#define __KEYBOARD_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Common/SubsystemInterface.h"
#include "GameClient/KeyDefs.h"
#include "Lib/BaseType.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// TYPE DEFINITIONS ///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// KeyboardIO -----------------------------------------------------------------
/** Holds a single keyboard event */
//-----------------------------------------------------------------------------
struct KeyboardIO
{
enum StatusType
{
STATUS_UNUSED = 0x00, // Key has not been used
STATUS_USED = 0x01 // Key has been eaten
};
UnsignedByte key; // key data
UnsignedByte status; // StatusType, above
UnsignedShort state; // KEY_STATE_* in KeyDefs.h
UnsignedInt sequence; // sequence info from DirectX used for order
}; // end KeyboardIO
// class Keyboard =============================================================
/** Keyboard singleton to interface with the keyboard */
//=============================================================================
class Keyboard : public SubsystemInterface
{
enum { KEY_REPEAT_DELAY = 10 };
public:
Keyboard( void );
virtual ~Keyboard( void );
// you may extend the functionanilty of these for your device
virtual void init( void ); /**< initialize the keyboard, only extend this
functionality, do not replace */
virtual void reset( void ); ///< Reset keyboard system
virtual void update( void ); /**< gather current state of all keys, extend
this functionality, do not replace */
virtual Bool getCapsState( void ) = 0; ///< get state of caps lock key, return TRUE if down
virtual void createStreamMessages( void ); /**< given state of device, create
messages and put them on the
stream for the raw state. */
// simplified versions where the caller doesn't care which key type was pressed.
Bool isShift();
Bool isCtrl();
Bool isAlt();
Int getModifierFlags() { return m_modifiers; }
// access methods for key data
void resetKeys( void ); ///< reset the state of the keys
KeyboardIO *getFirstKey( void ); ///< get first key ready for processing
void setKeyStatusData( UnsignedByte key,
KeyboardIO::StatusType data ); ///< set key status
WideChar translateKey( WideChar keyCode ); ///< translte key code to printable UNICODE char
WideChar getPrintableKey( UnsignedByte key, Int state );
enum { MAX_KEY_STATES = 3};
protected:
/** get the key data for a single key, KEY_NONE should be returned when
no key data is available to get anymore, you must implement this for your device */
virtual void getKey( KeyboardIO *key ) = 0;
// internal methods to update the key states
void initKeyNames( void ); ///< initialize the key names table
void updateKeys( void ); ///< update the state of our key data
Bool checkKeyRepeat( void ); ///< check for repeating keys
UnsignedByte getKeyStatusData( UnsignedByte key ); ///< get key status
Bool getKeyStateBit( UnsignedByte key, Int bit ); ///< get key state bit
UnsignedInt getKeySequenceData( UnsignedByte key ); ///< get key sequence
void setKeyStateData( UnsignedByte key, UnsignedByte data ); ///< get key state
UnsignedShort m_modifiers;
// internal keyboard data members
//Bool m_capsState; // 1 if caps lock is on
//Bool m_shiftState; // 1 if either shift key is pressed
//Bool m_shift2State; // 1 if secondary shift key is pressed
//Bool m_lShiftState; // 1 if left state is down
//Bool m_rShiftState; // 1 if right shift is down
//Bool m_lControlState; // 1 if left control is down
//Bool m_rControlState; // 1 if right control is down
//Bool m_lAltState; // 1 if left alt is down
//Bool m_rAltState; // 1 if right alt is down
UnsignedByte m_shift2Key; // what key is the secondary shift key
enum { NUM_KEYS = 256 };
KeyboardIO m_keys[ NUM_KEYS ]; ///< the keys
KeyboardIO m_keyStatus[ NUM_KEYS ]; ///< the key status flags
enum { KEY_NAMES_COUNT = 256 };
struct
{
WideChar stdKey;
WideChar shifted;
WideChar shifted2;
} m_keyNames[ KEY_NAMES_COUNT ];
UnsignedInt m_inputFrame; ///< frame input was gathered on
}; // end Keyboard
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
extern Keyboard *TheKeyboard;
#endif // __KEYBOARD_H_

View File

@@ -0,0 +1,94 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __LANGUAGEFILTER_H
#define __LANGUAGEFILTER_H
#include "Common/STLTypedefs.h"
#include "Common/AsciiString.h"
#include "Common/UnicodeString.h"
class File;
struct AsciiStringLessThan
{
Bool operator()(AsciiString a, AsciiString b) const
{
return (a.compareNoCase(b) < 0);
}
};
struct UnicodeStringLessThan
{
Bool operator()(UnicodeString a, UnicodeString b) const
{
return (a.compareNoCase(b) < 0);
}
};
struct UnicodeStringsEqual
{
Bool operator()(UnicodeString a, UnicodeString b) const
{
Bool retval = (a.compareNoCase(b) == 0);
DEBUG_LOG(("Comparing %ls with %ls, return value is ", a.str(), b.str()));
if (retval) {
DEBUG_LOG(("true.\n"));
} else {
DEBUG_LOG(("false.\n"));
}
return retval;
}
};
typedef std::map<UnicodeString, Bool, UnicodeStringLessThan> LangMap;
typedef std::map<UnicodeString, Bool, UnicodeStringLessThan>::iterator LangMapIter;
static const int LANGUAGE_XOR_KEY = 0x5555;
static const char BadWordFileName[] = "langdata.dat";
class LanguageFilter : public SubsystemInterface {
public:
LanguageFilter();
~LanguageFilter();
void init();
void reset();
void update();
void filterLine(UnicodeString &line);
protected:
Bool readWord(File *file1, UnsignedShort *buf);
void unHaxor(UnicodeString &word);
LangMap m_wordList;
LangMap m_subWordList;
};
extern LanguageFilter *TheLanguageFilter;
LanguageFilter * createLanguageFilter();
#endif //#define __LANGUAGEFILTER_H

View File

@@ -0,0 +1,91 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Line2D.h /////////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, January 2002
// Desc: 2D line helping stuff
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __LINE2D_H_
#define __LINE2D_H_
typedef std::vector<ICoord2D> Coord2DVector;
typedef std::vector<ICoord3D> Coord3DVector;
// PROTOTYPES /////////////////////////////////////////////////////////////////////////////////////
extern Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2,
IRegion2D *clipRegion );
///< IntersectLine2D will take two segments delimited by ab and cd and will return whether
///< they intersect within the length of ab. They will also return the intersection point out
///< intersection if it is non-NULL.
extern Bool IntersectLine2D( const Coord2D *a, const Coord2D *b,
const Coord2D *c, const Coord2D *d,
Coord2D *intersection = NULL);
///< PointInsideRect2D will return true iff inputPoint lies iside of the rectangle specified
///< by bl, tl, br, tr.
extern Bool PointInsideRect2D( const Coord2D *bl, const Coord2D *tl,
const Coord2D *br, const Coord2D *tr,
const Coord2D *inputPoint);
///< Checks if a point is inside a perfect rectangle (top left and bottom right)
extern Bool Coord3DInsideRect2D( const Coord3D *inputPoint, const Coord2D *tl, const Coord2D *br );
///< Scales a rect by a factor either growing or shrinking it.
extern void ScaleRect2D( Coord2D *tl, Coord2D *br, Real scaleFactor );
/** PointInsideRect3D will return true iff inputPoint lies iside of the rectangle specified
by bl, tl, br, tr. It does not actually consider the Z value, it is merely a convenience function
for calling PointInsideRect2D */
extern Bool PointInsideRect3D( const Coord3D *bl, const Coord3D *tl,
const Coord3D *br, const Coord3D *tr,
const Coord3D *inputPoint);
///< This function will take the ptToTest and will perform even-odd checking against the area.
///< If the area is not closed, it will be closed for this check.
extern Bool PointInsideArea2D( const Coord2D *ptToTest,
const Coord2D *area,
Int numPointsInArea);
///< This function will take the ptToTest and will perform even-odd checking against the area.
///< The area and the ptToTest will be flattened first, so a 2-D check will be sufficient.
///< This function is only for convenience so that points do not need to first be flattened.
extern Bool PointInsideArea2D( const Coord3D *ptToTest,
const Coord3D *area,
Int numPointsInArea);
///< This function will find the shortest distance between the given segment (ab) and the pt.
///< It will also give the intersection points on the segment (ab) if desired.
///< outU will return the U value determined. This is a shortcut for panning
extern void ShortestDistancePointToSegment2D( const Coord2D *a, const Coord2D *b, const Coord2D *pt,
Real *outDistance, Coord2D *outPosition, Real *outU );
#endif // __LINE2D_H_

View File

@@ -0,0 +1,248 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: LoadScreen.h /////////////////////////////////////////////////////////////////////////////////
// Author: Chris Huybregts, March 2002
// Desc: The file will hold the LoadScreen Base class and it's derived classes
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _LOADSCREEN_H_
#define _LOADSCREEN_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
#include "GameClient/GameWindow.h"
#include "GameNetwork/GameInfo.h"
#include "GameClient/CampaignManager.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
class VideoBuffer;
class VideoStreamInterface;
///////////////////////////////////////////////////////////////////////////////////////////////////
// Class LoadScreen is the parent class for each other kind of load screen
///////////////////////////////////////////////////////////////////////////////////////////////////
class LoadScreen
{
public:
LoadScreen( void );
virtual ~LoadScreen( void );
virtual void init( GameInfo *game ) = 0; ///< Init the loadscreen
virtual void reset( void ) = 0; ///< Reset the system
virtual void update( void ) = 0; ///< Update the state of the slider bars
virtual void update( Int percent ); ///< Update the state of the slider bars
virtual void processProgress(Int playerId, Int percentage) = 0;
virtual void setProgressRange( Int min, Int max ) = 0;
protected:
void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
private:
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// class SinglePlayerLoadScreen is to be used only when we're loading a single player mission
///////////////////////////////////////////////////////////////////////////////////////////////////
class SinglePlayerLoadScreen : public LoadScreen
{
public:
SinglePlayerLoadScreen( void );
virtual ~SinglePlayerLoadScreen( void );
virtual void init( GameInfo *game ); ///< Init the loadscreen
virtual void reset( void ); ///< Reset the system
virtual void update( void )
{
DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
};
virtual void update(Int percent); ///< Update the state of the progress bar
virtual void processProgress(Int playerId, Int percentage)
{
DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
}
virtual void setProgressRange( Int min, Int max );
private:
GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
GameWindow *m_percent;
GameWindow *m_objectiveWin;
GameWindow *m_objectiveLines[MAX_OBJECTIVE_LINES];
GameWindow *m_unitDesc[MAX_DISPLAYED_UNITS];
GameWindow *m_location;
Int m_currentObjectiveLine;
Int m_currentObjectiveLineCharacter;
Int m_currentObjectiveWidthOffset;
Bool m_finishedObjectiveText;
UnicodeString m_unicodeObjectiveLines[MAX_OBJECTIVE_LINES];
VideoBuffer *m_videoBuffer;
VideoStreamInterface *m_videoStream;
void moveWindows( Int frame );
AudioEventRTS m_ambientLoop;
AudioHandle m_ambientLoopHandle;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// class ShellGameLoadScreen is to be used for the Shell Game loadscreen
//// ///////////////////////////////////////////////////////////////////////////////////////////////
class ShellGameLoadScreen : public LoadScreen
{
public:
ShellGameLoadScreen( void );
virtual ~ShellGameLoadScreen( void );
virtual void init( GameInfo *game ); ///< Init the loadscreen
virtual void reset( void ); ///< Reset the system
virtual void update( void )
{
DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
};
virtual void update(Int percent); ///< Update the state of the progress bar
virtual void processProgress(Int playerId, Int percentage)
{
DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
}
virtual void setProgressRange( Int min, Int max ) { }
private:
GameWindow *m_progressBar ; ///< Pointer to the Progress Bar on the window
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
//// ///////////////////////////////////////////////////////////////////////////////////////////////
class MultiPlayerLoadScreen : public LoadScreen
{
public:
MultiPlayerLoadScreen( void );
virtual ~MultiPlayerLoadScreen( void );
virtual void init( GameInfo *game ); ///< Init the loadscreen
virtual void reset( void ); ///< Reset the system
virtual void update( void )
{
DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
};
virtual void update(Int percent); ///< Update the state of the progress bar
void processProgress(Int playerId, Int percentage);
virtual void setProgressRange( Int min, Int max ) { }
private:
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
GameWindow *m_mapPreview;
GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
//// ///////////////////////////////////////////////////////////////////////////////////////////////
class GameSpyLoadScreen : public LoadScreen
{
public:
GameSpyLoadScreen( void );
virtual ~GameSpyLoadScreen( void );
virtual void init( GameInfo *game ); ///< Init the loadscreen
virtual void reset( void ); ///< Reset the system
virtual void update( void )
{
DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
};
virtual void update(Int percent); ///< Update the state of the progress bar
void processProgress(Int playerId, Int percentage);
virtual void setProgressRange( Int min, Int max ) { }
private:
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerFavoriteFactions[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerTotalDisconnects[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerWin[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerWinLosses[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerRank[MAX_SLOTS]; ///< pointer array to all the static text player sides
GameWindow *m_playerOfficerMedal[MAX_SLOTS]; ///< pointer array to all the static text player munkees
GameWindow *m_mapPreview;
GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// class MapTransferLoadScreen is to be used for map transfers before multiplayer game load screens
//// ///////////////////////////////////////////////////////////////////////////////////////////////
class MapTransferLoadScreen : public LoadScreen
{
public:
MapTransferLoadScreen( void );
virtual ~MapTransferLoadScreen( void );
virtual void init( GameInfo *game ); ///< Init the loadscreen
virtual void reset( void ); ///< Reset the system
virtual void update( void )
{
DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
};
virtual void update(Int percent); ///< Update the state of the progress bar
virtual void processProgress(Int playerId, Int percentage)
{
DEBUG_CRASH(("Call processProgress(Int, Int, AsciiString) instead."));
}
void processProgress(Int playerId, Int percentage, AsciiString stateStr);
virtual void setProgressRange( Int min, Int max ) { }
void processTimeout(Int secondsLeft);
void setCurrentFilename(AsciiString filename);
private:
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
GameWindow *m_progressText[MAX_SLOTS]; ///< pointer array to all the static text player sides
Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
Int m_oldProgress[MAX_SLOTS]; ///< old vals, so we can call processProgress() every frame and not touch the GUI
GameWindow *m_fileNameText;
GameWindow *m_timeoutText;
Int m_oldTimeout; ///< old val, so we can call processTimeout() every frame and not touch the GUI
};
#endif //_LOADSCREEN_H_

View File

@@ -0,0 +1,78 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: LookAtXlat.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_LookAtXlat
#define _H_LookAtXlat
#include "GameClient/InGameUI.h"
//-----------------------------------------------------------------------------
class LookAtTranslator : public GameMessageTranslator
{
public:
LookAtTranslator();
~LookAtTranslator();
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
virtual const ICoord2D* getRMBScrollAnchor(void); // get m_anchor ICoord2D if we're RMB scrolling
Bool hasMouseMovedRecently( void );
void setCurrentPos( const ICoord2D& pos );
void resetModes(); //Used when disabling input, so when we reenable it we aren't stuck in a mode.
private:
enum
{
MAX_VIEW_LOCS = 8
};
enum
{
SCROLL_NONE = 0,
SCROLL_RMB,
SCROLL_KEY,
SCROLL_SCREENEDGE
};
ICoord2D m_anchor;
ICoord2D m_originalAnchor;
ICoord2D m_currentPos;
Bool m_isScrolling; // set to true if we are in the act of RMB scrolling
Bool m_isRotating; // set to true if we are in the act of MMB rotating
Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation
Bool m_isChangingFOV; // set to true if we are in the act of changing the field of view
UnsignedInt m_timestamp; // set when button goes down
DrawableID m_lastPlaneID;
ViewLocation m_viewLocation[ MAX_VIEW_LOCS ];
Int m_scrollType;
void setScrolling( Int );
void stopScrolling( void );
UnsignedInt m_lastMouseMoveFrame;
};
extern LookAtTranslator *TheLookAtTranslator;
#endif

View File

@@ -0,0 +1,135 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: MapUtil.h /////////////////////////////////////////////////////////
// Author: Matt Campbell, December 2001
// Description: Map utility/convenience routines
////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __MAPUTIL_H__
#define __MAPUTIL_H__
#include "Common/AsciiString.h"
#include "Common/UnicodeString.h"
#include "Common/STLTypedefs.h"
class GameWindow;
class AsciiString;
struct Coord3D;
struct FileInfo;
class Image;
class DataChunkInput;
struct DataChunkInfo;
// This matches the windows timestamp.
enum { SUPPLY_TECH_SIZE = 15};
typedef std::list <ICoord2D> ICoord2DList;
class TechAndSupplyImages
{
public:
ICoord2DList m_techPosList;
ICoord2DList m_supplyPosList;
};
struct WinTimeStamp
{
UnsignedInt m_lowTimeStamp;
UnsignedInt m_highTimeStamp;
};
class WaypointMap : public std::map<AsciiString, Coord3D>
{
public:
void update( void ); ///< returns the number of multiplayer start spots found
Int m_numStartSpots;
};
typedef std::list <Coord3D> Coord3DList;
class MapMetaData
{
public:
UnicodeString m_displayName;
Region3D m_extent;
Int m_numPlayers;
Bool m_isMultiplayer;
Bool m_isOfficial;
UnsignedInt m_filesize;
UnsignedInt m_CRC;
WinTimeStamp m_timestamp;
WaypointMap m_waypoints;
Coord3DList m_supplyPositions;
Coord3DList m_techPositions;
AsciiString m_fileName;
};
class MapCache : public std::map<AsciiString, MapMetaData>
{
public:
MapCache() {}
void updateCache( void );
AsciiString getMapDir() const;
AsciiString getUserMapDir() const;
AsciiString getMapExtension() const;
const MapMetaData *findMap(AsciiString mapName);
// allow us to create a set of shippable maps to be in mapcache.ini. For use with -buildMapCache.
void addShippingMap(AsciiString mapName) { mapName.toLower(); m_allowedMaps.insert(mapName); }
private:
Bool clearUnseenMaps( AsciiString dirName );
void loadStandardMaps(void);
Bool loadUserMaps(void); // returns true if we needed to (re)parse a map
// Bool addMap( AsciiString dirName, AsciiString fname, WinTimeStamp timestamp,
// UnsignedInt filesize, Bool isOfficial ); ///< returns true if it had to (re)parse the map
Bool addMap( AsciiString dirName, AsciiString fname, FileInfo *fileInfo, Bool isOfficial); ///< returns true if it had to (re)parse the map
void writeCacheINI( Bool userDir );
static const char * m_mapCacheName;
std::map<AsciiString, Bool> m_seen;
std::set<AsciiString> m_allowedMaps;
};
extern MapCache *TheMapCache;
extern TechAndSupplyImages TheSupplyAndTechImageLocations;
Int populateMapListbox( GameWindow *listbox, Bool useSystemMaps, Bool isMultiplayer, AsciiString mapToSelect = AsciiString::TheEmptyString ); /// Read a list of maps from the run directory and fill in the listbox. Return the selected index
Int populateMapListboxNoReset( GameWindow *listbox, Bool useSystemMaps, Bool isMultiplayer, AsciiString mapToSelect = AsciiString::TheEmptyString ); /// Read a list of maps from the run directory and fill in the listbox. Return the selected index
Bool isValidMap( AsciiString mapName, Bool isMultiplayer ); /// Validate a map
Image *getMapPreviewImage( AsciiString mapName );
AsciiString getDefaultMap( Bool isMultiplayer ); /// Find a valid map
Bool parseMapPreviewChunk(DataChunkInput &file, DataChunkInfo *info, void *userData);
void findDrawPositions( Int startX, Int startY, Int width, Int height, Region3D extent,
ICoord2D *ul, ICoord2D *lr );
Bool WouldMapTransfer( const AsciiString& mapName );
#endif // __MAPUTIL_H__

View File

@@ -0,0 +1,51 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: MessageBox.h /////////////////////////////////////////////////////////////////////////////
// Author: Chris Huybregts, November 2001
// Description: Message Box file containing user aliases
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __MESSAGEBOX_H_
#define __MESSAGEBOX_H_
#include "GameClient/GameWindowManager.h"
GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons
GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons
GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Yes,No and Cancel buttons
GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Ok and Cancel buttons
GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback);///< convenience function for displaying a Message box with Ok button
GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Cancel button
#endif //__MESSAGEBOX_H_

View File

@@ -0,0 +1,379 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: MetaEvent.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_MetaEvent
#define _H_MetaEvent
#include "Common/SubsystemInterface.h"
#include "GameClient/InGameUI.h"
enum MappableKeyCategories
{
CATEGORY_CONTROL = 0,
CATEGORY_INFORMATION,
CATEGORY_INTERFACE,
CATEGORY_SELECTION,
CATEGORY_TAUNT,
CATEGORY_TEAM,
CATEGORY_MISC,
CATEGORY_DEBUG,
CATEGORY_NUM_CATEGORIES // keep this last
};
static const LookupListRec CategoryListName[] =
{
{"CONTROL", CATEGORY_CONTROL},
{"INFORMATION", CATEGORY_INFORMATION},
{"INTERFACE", CATEGORY_INTERFACE},
{"SELECTION", CATEGORY_SELECTION},
{"TAUNT", CATEGORY_TAUNT},
{"TEAM", CATEGORY_TEAM},
{"MISC", CATEGORY_MISC},
{"DEBUG", CATEGORY_DEBUG},
{NULL, 0}// keep this last
};
// -------------------------------------------------------------------------------
// the keys we allow to be mapped to Meta-events.
// note that this is a subset of all the keys available;
// in particular, "modifier" keys and keypad keys aren't
// available. Note that MappableKeyType is a SUBSET of
// KeyDefType; this is extremely important to maintain!
enum MappableKeyType
{
MK_ESC = KEY_ESC,
MK_BACKSPACE = KEY_BACKSPACE,
MK_ENTER = KEY_ENTER,
MK_SPACE = KEY_SPACE,
MK_TAB = KEY_TAB,
MK_F1 = KEY_F1,
MK_F2 = KEY_F2,
MK_F3 = KEY_F3,
MK_F4 = KEY_F4,
MK_F5 = KEY_F5,
MK_F6 = KEY_F6,
MK_F7 = KEY_F7,
MK_F8 = KEY_F8,
MK_F9 = KEY_F9,
MK_F10 = KEY_F10,
MK_F11 = KEY_F11,
MK_F12 = KEY_F12,
MK_A = KEY_A,
MK_B = KEY_B,
MK_C = KEY_C,
MK_D = KEY_D,
MK_E = KEY_E,
MK_F = KEY_F,
MK_G = KEY_G,
MK_H = KEY_H,
MK_I = KEY_I,
MK_J = KEY_J,
MK_K = KEY_K,
MK_L = KEY_L,
MK_M = KEY_M,
MK_N = KEY_N,
MK_O = KEY_O,
MK_P = KEY_P,
MK_Q = KEY_Q,
MK_R = KEY_R,
MK_S = KEY_S,
MK_T = KEY_T,
MK_U = KEY_U,
MK_V = KEY_V,
MK_W = KEY_W,
MK_X = KEY_X,
MK_Y = KEY_Y,
MK_Z = KEY_Z,
MK_1 = KEY_1,
MK_2 = KEY_2,
MK_3 = KEY_3,
MK_4 = KEY_4,
MK_5 = KEY_5,
MK_6 = KEY_6,
MK_7 = KEY_7,
MK_8 = KEY_8,
MK_9 = KEY_9,
MK_0 = KEY_0,
MK_KP1 = KEY_KP1,
MK_KP2 = KEY_KP2,
MK_KP3 = KEY_KP3,
MK_KP4 = KEY_KP4,
MK_KP5 = KEY_KP5,
MK_KP6 = KEY_KP6,
MK_KP7 = KEY_KP7,
MK_KP8 = KEY_KP8,
MK_KP9 = KEY_KP9,
MK_KP0 = KEY_KP0,
MK_MINUS = KEY_MINUS,
MK_EQUAL = KEY_EQUAL,
MK_LBRACKET = KEY_LBRACKET,
MK_RBRACKET = KEY_RBRACKET,
MK_SEMICOLON = KEY_SEMICOLON,
MK_APOSTROPHE = KEY_APOSTROPHE,
MK_TICK = KEY_TICK,
MK_BACKSLASH = KEY_BACKSLASH,
MK_COMMA = KEY_COMMA,
MK_PERIOD = KEY_PERIOD,
MK_SLASH = KEY_SLASH,
MK_UP = KEY_UP,
MK_DOWN = KEY_DOWN,
MK_LEFT = KEY_LEFT,
MK_RIGHT = KEY_RIGHT,
MK_HOME = KEY_HOME,
MK_END = KEY_END,
MK_PGUP = KEY_PGUP,
MK_PGDN = KEY_PGDN,
MK_INS = KEY_INS,
MK_DEL = KEY_DEL,
MK_KPSLASH = KEY_KPSLASH,
MK_NONE = KEY_NONE
};
static const LookupListRec KeyNames[] =
{
{ "KEY_ESC", MK_ESC },
{ "KEY_BACKSPACE", MK_BACKSPACE },
{ "KEY_ENTER", MK_ENTER },
{ "KEY_SPACE", MK_SPACE },
{ "KEY_TAB", MK_TAB },
{ "KEY_F1", MK_F1 },
{ "KEY_F2", MK_F2 },
{ "KEY_F3", MK_F3 },
{ "KEY_F4", MK_F4 },
{ "KEY_F5", MK_F5 },
{ "KEY_F6", MK_F6 },
{ "KEY_F7", MK_F7 },
{ "KEY_F8", MK_F8 },
{ "KEY_F9", MK_F9 },
{ "KEY_F10", MK_F10 },
{ "KEY_F11", MK_F11 },
{ "KEY_F12", MK_F12 },
{ "KEY_A", MK_A },
{ "KEY_B", MK_B },
{ "KEY_C", MK_C },
{ "KEY_D", MK_D },
{ "KEY_E", MK_E },
{ "KEY_F", MK_F },
{ "KEY_G", MK_G },
{ "KEY_H", MK_H },
{ "KEY_I", MK_I },
{ "KEY_J", MK_J },
{ "KEY_K", MK_K },
{ "KEY_L", MK_L },
{ "KEY_M", MK_M },
{ "KEY_N", MK_N },
{ "KEY_O", MK_O },
{ "KEY_P", MK_P },
{ "KEY_Q", MK_Q },
{ "KEY_R", MK_R },
{ "KEY_S", MK_S },
{ "KEY_T", MK_T },
{ "KEY_U", MK_U },
{ "KEY_V", MK_V },
{ "KEY_W", MK_W },
{ "KEY_X", MK_X },
{ "KEY_Y", MK_Y },
{ "KEY_Z", MK_Z },
{ "KEY_1", MK_1 },
{ "KEY_2", MK_2 },
{ "KEY_3", MK_3 },
{ "KEY_4", MK_4 },
{ "KEY_5", MK_5 },
{ "KEY_6", MK_6 },
{ "KEY_7", MK_7 },
{ "KEY_8", MK_8 },
{ "KEY_9", MK_9 },
{ "KEY_0", MK_0 },
{ "KEY_KP1", MK_KP1 },
{ "KEY_KP2", MK_KP2 },
{ "KEY_KP3", MK_KP3 },
{ "KEY_KP4", MK_KP4 },
{ "KEY_KP5", MK_KP5 },
{ "KEY_KP6", MK_KP6 },
{ "KEY_KP7", MK_KP7 },
{ "KEY_KP8", MK_KP8 },
{ "KEY_KP9", MK_KP9 },
{ "KEY_KP0", MK_KP0 },
{ "KEY_MINUS", MK_MINUS },
{ "KEY_EQUAL", MK_EQUAL },
{ "KEY_LBRACKET", MK_LBRACKET },
{ "KEY_RBRACKET", MK_RBRACKET },
{ "KEY_SEMICOLON", MK_SEMICOLON },
{ "KEY_APOSTROPHE", MK_APOSTROPHE },
{ "KEY_TICK", MK_TICK },
{ "KEY_BACKSLASH", MK_BACKSLASH },
{ "KEY_COMMA", MK_COMMA },
{ "KEY_PERIOD", MK_PERIOD },
{ "KEY_SLASH", MK_SLASH },
{ "KEY_UP", MK_UP },
{ "KEY_DOWN", MK_DOWN },
{ "KEY_LEFT", MK_LEFT },
{ "KEY_RIGHT", MK_RIGHT },
{ "KEY_HOME", MK_HOME },
{ "KEY_END", MK_END },
{ "KEY_PGUP", MK_PGUP },
{ "KEY_PGDN", MK_PGDN },
{ "KEY_INS", MK_INS },
{ "KEY_DEL", MK_DEL },
{ "KEY_KPSLASH", MK_KPSLASH },
{ "KEY_NONE", MK_NONE },
{ NULL, 0 } // keep this last!
};
// -------------------------------------------------------------------------------
enum MappableKeyTransition
{
DOWN,
UP,
DOUBLEDOWN // if a key transition is repeated immediately, we generate this.
};
static const LookupListRec TransitionNames[] =
{
{ "DOWN", DOWN },
{ "UP", UP },
{ "DOUBLEDOWN", DOUBLEDOWN },
{ NULL, 0 }// keep this last!
};
// -------------------------------------------------------------------------------
// an easier-to-type subset of the KEY_STATE stuff.
enum MappableKeyModState
{
NONE = 0,
CTRL = KEY_STATE_LCONTROL,
ALT = KEY_STATE_LALT,
SHIFT = KEY_STATE_LSHIFT,
CTRL_ALT = CTRL|ALT,
SHIFT_CTRL = SHIFT|CTRL,
SHIFT_ALT = SHIFT|ALT,
SHIFT_ALT_CTRL = SHIFT|ALT|CTRL
};
static const LookupListRec ModifierNames[] =
{
{ "NONE", NONE },
{ "CTRL", CTRL },
{ "ALT", ALT },
{ "SHIFT", SHIFT },
{ "CTRL_ALT", CTRL_ALT },
{ "SHIFT_CTRL", SHIFT_CTRL },
{ "SHIFT_ALT", SHIFT_ALT },
{ "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL },
{ NULL, 0 }// keep this last!
};
// -------------------------------------------------------------------------------
// CommandUsableInType sets in what state the commands are allowed.
enum CommandUsableInType
{
COMMANDUSABLE_NONE = 0,
COMMANDUSABLE_SHELL = (1 << 0),
COMMANDUSABLE_GAME = (1 << 1)
};
static const char* TheCommandUsableInNames[] =
{
"SHELL",
"GAME",
NULL
};
// -------------------------------------------------------------------------------
class MetaMapRec : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(MetaMapRec, "MetaMapRec")
public:
MetaMapRec* m_next;
GameMessage::Type m_meta; ///< the meta-event to emit
MappableKeyType m_key; ///< the key we want
MappableKeyTransition m_transition; ///< the state of the key
MappableKeyModState m_modState; ///< the required state of the ctrl-alt-shift keys
CommandUsableInType m_usableIn; ///< the allowed place the command can be used in
// Next fields are added for Key mapping Dialog
MappableKeyCategories m_category; ///< This is the catagory the key falls under
UnicodeString m_description; ///< The description string for the keys
UnicodeString m_displayName; ///< The display name of our command
};
EMPTY_DTOR(MetaMapRec)
//-----------------------------------------------------------------------------
class MetaEventTranslator : public GameMessageTranslator
{
private:
Int m_lastKeyDown; // really a MappableKeyType
Int m_lastModState; // really a MappableKeyModState
enum { NUM_MOUSE_BUTTONS = 3 };
ICoord2D m_mouseDownPosition[NUM_MOUSE_BUTTONS];
Bool m_nextUpShouldCreateDoubleClick[NUM_MOUSE_BUTTONS];
public:
MetaEventTranslator();
~MetaEventTranslator();
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
};
//-----------------------------------------------------------------------------
class MetaMap : public SubsystemInterface
{
friend class MetaEventTranslator;
private:
MetaMapRec *m_metaMaps;
protected:
GameMessage::Type findGameMessageMetaType(const char* name);
MetaMapRec *getMetaMapRec(GameMessage::Type t);
public:
MetaMap();
~MetaMap();
void init() { }
void reset() { }
void update() { }
static void parseMetaMap(INI* ini);
const MetaMapRec *getFirstMetaMapRec() const { return m_metaMaps; }
};
extern MetaMap *TheMetaMap;
#endif

View File

@@ -0,0 +1,64 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: AnimatedParticleSysBoneClientUpdate.h //////////////////////////////////////////////////////////////////
// Author: Mark Lorenzen, October 2002
// Desc: client update module to translate particle systems with animation
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __ANIMPARTICLESYSBONEUPDATE_H_
#define __ANIMPARTICLESYSBONEUPDATE_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/ClientUpdateModule.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class Thing;
class AnimatedParticleSysBoneClientUpdate : public ClientUpdateModule
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( AnimatedParticleSysBoneClientUpdate, "AnimatedParticleSysBoneClientUpdate" )
MAKE_STANDARD_MODULE_MACRO( AnimatedParticleSysBoneClientUpdate );
public:
AnimatedParticleSysBoneClientUpdate( Thing *thing, const ModuleData* moduleData );
// virtual destructor prototype provided by memory pool declaration
/// the client update callback
virtual void clientUpdate( void );
protected:
UnsignedInt m_life;
};
#endif // __ANIMPARTICLESYSBONEUPDATE_H_

View File

@@ -0,0 +1,80 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: BeaconClientUpdate.h ////////////////////////////////////////////////////////////////////
// Author: Matthew D. Campbell, August 2002
// Desc: Beacon client update module
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __BEACONCLIENTUPDATE_H_
#define __BEACONCLIENTUPDATE_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/ClientUpdateModule.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class Thing;
class ParticleSystem;
//-------------------------------------------------------------------------------------------------
class BeaconClientUpdateModuleData : public ClientUpdateModuleData
{
public:
UnsignedInt m_framesBetweenRadarPulses;
UnsignedInt m_radarPulseDuration;
BeaconClientUpdateModuleData();
~BeaconClientUpdateModuleData();
static void buildFieldParse(MultiIniFieldParse& p);
};
//-------------------------------------------------------------------------------------------------
/** The tree way client update module */
//-------------------------------------------------------------------------------------------------
class BeaconClientUpdate : public ClientUpdateModule
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( BeaconClientUpdate, "BeaconClientUpdate" )
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( BeaconClientUpdate, BeaconClientUpdateModuleData );
public:
BeaconClientUpdate( Thing *thing, const ModuleData* moduleData );
// virtual destructor prototype provided by memory pool declaration
/// the client update callback
virtual void clientUpdate( void );
void hideBeacon( void );
protected:
ParticleSystemID m_particleSystemID;
UnsignedInt m_lastRadarPulse;
};
#endif // __BEACONCLIENTUPDATE_H_

View File

@@ -0,0 +1,75 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: SwayClientUpdate.h ////////////////////////////////////////////////////////////////////
// Author: Matthew D. Campbell, May 2002
// Desc: Tree sway client update module
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __SWAYCLIENTUPDATE_H_
#define __SWAYCLIENTUPDATE_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/ClientUpdateModule.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class Thing;
//-------------------------------------------------------------------------------------------------
/** The tree way client update module */
//-------------------------------------------------------------------------------------------------
class SwayClientUpdate : public ClientUpdateModule
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( SwayClientUpdate, "SwayClientUpdate" )
MAKE_STANDARD_MODULE_MACRO( SwayClientUpdate );
public:
SwayClientUpdate( Thing *thing, const ModuleData* moduleData );
// virtual destructor prototype provided by memory pool declaration
/// the client update callback
virtual void clientUpdate( void );
void stopSway( void ) { m_swaying = false; }
protected:
Real m_curValue;
Real m_curAngle;
Real m_curDelta;
Real m_curAngleLimit;
Real m_leanAngle; ///<Angle that the tree leans away from the wind.
Short m_curVersion;
Bool m_swaying;
Bool m_unused;
void updateSway(void);
};
#endif // __SWAYCLIENTUPDATE_H_

View File

@@ -0,0 +1,378 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Mouse.h //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: Mouse.h
//
// Created: Michael S. Booth, January 1995
// Colin Day, June 2001
//
// Desc: Basic mouse structure layout
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __MOUSE_H_
#define __MOUSE_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
#include "Common/AsciiString.h"
#include "Common/UnicodeString.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
enum MouseButtonState
{
MBS_Up = 0,
MBS_Down,
MBS_DoubleClick,
};
#define MOUSE_MOVE_RELATIVE 0
#define MOUSE_MOVE_ABSOLUTE 1
// In frames
#define CLICK_SENSITIVITY 15
// In pixels
#define CLICK_DISTANCE_DELTA 10
#define CLICK_DISTANCE_DELTA_SQUARED (CLICK_DISTANCE_DELTA*CLICK_DISTANCE_DELTA)
//
#define MOUSE_WHEEL_DELTA 120
#define MOUSE_NONE 0x00
#define MOUSE_OK 0x01
#define MOUSE_FAILED 0x80
#define MOUSE_LOST 0xFF
#define MOUSE_EVENT_NONE 0x00
class DisplayString;
#define MAX_2D_CURSOR_ANIM_FRAMES 21
#define MAX_2D_CURSOR_DIRECTIONS 8
// MouseIO --------------------------------------------------------------------
/** @todo this mouse structure needs to be revisited to allow for devices
with more than 3 buttons */
//-----------------------------------------------------------------------------
struct MouseIO
{
ICoord2D pos; ///< mouse pointer position
UnsignedInt time; ///< The time that this message was posted.
Int wheelPos; /**< mouse wheel position, 0 is no event, + is up/away from
user while - is down/toward user */
ICoord2D deltaPos; ///< overall change in mouse pointer this frame
MouseButtonState leftState; // button state: Up, Down, DoubleClick (Which is also down)
Int leftEvent; // Most important event this frame
Int leftFrame; // last frame button state changed
MouseButtonState rightState;
Int rightEvent;
Int rightFrame;
MouseButtonState middleState;
Int middleEvent;
Int middleFrame;
};
class CursorInfo
{
public:
CursorInfo();
AsciiString cursorName;
AsciiString cursorText;
RGBAColorInt cursorTextColor;
RGBAColorInt cursorTextDropColor;
AsciiString textureName;
AsciiString imageName;
AsciiString W3DModelName;
AsciiString W3DAnimName;
Real W3DScale;
Bool loop;
ICoord2D hotSpotPosition;
Int numFrames;
Real fps; //frames per ms.
Int numDirections; //number of directions for cursors like scrolling/panning.
};
// Mouse ----------------------------------------------------------------------
/** Class interface for working with a mouse pointing device */
//-----------------------------------------------------------------------------
class Mouse : public SubsystemInterface
{
public: // enumerations and types
// ----------------------------------------------------------------------------------------------
/** If you update this enum make sure you update CursorININames[] */
// ----------------------------------------------------------------------------------------------
enum MouseCursor
{
// ***** dont forget to update CursorININames[] *****
// ***** dont forget to update CursorININames[] *****
// ***** dont forget to update CursorININames[] *****
INVALID_MOUSE_CURSOR = -1,
NONE = 0,
FIRST_CURSOR,
NORMAL = FIRST_CURSOR,
ARROW,
SCROLL,
CROSS,
MOVETO,
ATTACKMOVETO,
ATTACK_OBJECT,
FORCE_ATTACK_OBJECT,
FORCE_ATTACK_GROUND,
BUILD_PLACEMENT,
INVALID_BUILD_PLACEMENT,
GENERIC_INVALID,
SELECTING,
// ***** dont forget to update CursorININames[] *****
ENTER_FRIENDLY,
ENTER_AGGRESSIVELY,
SET_RALLY_POINT,
GET_REPAIRED,
GET_HEALED,
DO_REPAIR,
RESUME_CONSTRUCTION,
CAPTUREBUILDING,
// ***** dont forget to update CursorININames[] *****
SNIPE_VEHICLE,
LASER_GUIDED_MISSILES,
TANKHUNTER_TNT_ATTACK,
STAB_ATTACK,
PLACE_REMOTE_CHARGE,
// ***** dont forget to update CursorININames[] *****
PLACE_TIMED_CHARGE,
DEFECTOR,
#ifdef ALLOW_DEMORALIZE
DEMORALIZE,
#endif
DOCK,
// ***** dont forget to update CursorININames[] *****
#ifdef ALLOW_SURRENDER
PICK_UP_PRISONER,
RETURN_TO_PRISON,
#endif
FIRE_FLAME,
#ifdef ALLOW_SURRENDER
FIRE_TRANQ_DARTS,
FIRE_STUN_BULLETS,
#endif
FIRE_BOMB,
PLACE_BEACON,
// ***** dont forget to update CursorININames[] *****
DISGUISE_AS_VEHICLE,
WAYPOINT,
OUTRANGE,
STAB_ATTACK_INVALID,
PLACE_CHARGE_INVALID,
HACK,
PARTICLE_UPLINK_CANNON,
// ***** dont forget to update CursorININames[] *****
NUM_MOUSE_CURSORS // keep this last
};
enum RedrawMode
{
RM_WINDOWS=0, //default Windows cursor - very fast.
RM_W3D, //W3D model tied to frame rate.
RM_POLYGON, //alpha blended polygon tied to frame rate.
RM_DX8, //hardware cursor independent of frame rate.
RM_MAX // keep this last.
};
static const char *RedrawModeName[RM_MAX];
CursorInfo m_cursorInfo[NUM_MOUSE_CURSORS];
public:
Mouse( void );
virtual ~Mouse( void );
// you may need to extend these for your device
virtual void parseIni(void); ///< parse ini settings associated with mouse (do this before init()).
virtual void init( void ); ///< init mouse, extend this functionality, do not replace
virtual void reset( void ); ///< Reset the system
virtual void update( void ); ///< update the state of the mouse position and buttons
virtual void initCursorResources(void)=0; ///< needed so Win32 cursors can load resources before D3D device created.
virtual void createStreamMessages( void ); /**< given state of device, create
messages and put them on the
stream for the raw state. */
virtual void draw( void ); ///< draw the mouse
virtual void setPosition( Int x, Int y ); ///< set the mouse position
virtual void setCursor( MouseCursor cursor ) = 0; ///< set mouse cursor
virtual void capture( void ) = 0; ///< capture the mouse
virtual void releaseCapture( void ) = 0; ///< release mouse capture
// access methods for the mouse data
const MouseIO *getMouseStatus( void ) { return &m_currMouse; } ///< get current mouse status
Int getCursorTooltipDelay() { return m_tooltipDelay; }
void setCursorTooltipDelay(Int delay) { m_tooltipDelay = delay; }
void setCursorTooltip( UnicodeString tooltip, Int tooltipDelay = -1, const RGBColor *color = NULL, Real width = 1.0f ); ///< set tooltip string at cursor
void setMouseText( UnicodeString text, const RGBAColorInt *color, const RGBAColorInt *dropColor ); ///< set the cursor text, *NOT* the tooltip text
virtual void setMouseLimits( void ); ///< update the limit extents the mouse can move in
MouseCursor getMouseCursor(void) { return m_currentCursor; } ///< get the current mouse cursor image type
virtual void setRedrawMode(RedrawMode mode) {m_currentRedrawMode=mode;} ///<set cursor drawing method.
virtual RedrawMode getRedrawMode(void) { return m_currentRedrawMode; } //get cursor drawing method
virtual void setVisibility(Bool visible) { m_visible = visible; } // set visibility for load screens, etc
inline Bool getVisibility(void) { return m_visible; } // get visibility state
void drawTooltip( void ); ///< draw the tooltip text
void drawCursorText( void ); ///< draw the mouse cursor text
Int getCursorIndex( const AsciiString& name );
void resetTooltipDelay( void );
void mouseNotifyResolutionChange(void);
Bool isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt previousMouseClick, UnsignedInt currentMouseClick);
AsciiString m_tooltipFontName; ///< tooltip font
Int m_tooltipFontSize; ///< tooltip font
Bool m_tooltipFontIsBold; ///< tooltip font
Bool m_tooltipAnimateBackground; ///< animate the background with the text
Int m_tooltipFillTime; ///< milliseconds to animate tooltip
Int m_tooltipDelayTime; ///< milliseconds to wait before showing tooltip
Real m_tooltipWidth; ///< default tooltip width in screen width %
Real m_lastTooltipWidth;
RGBAColorInt m_tooltipColorText;
RGBAColorInt m_tooltipColorHighlight;
RGBAColorInt m_tooltipColorShadow;
RGBAColorInt m_tooltipColorBackground;
RGBAColorInt m_tooltipColorBorder;
RedrawMode m_currentRedrawMode; ///< mouse cursor drawing method
Bool m_useTooltipAltTextColor; ///< draw tooltip text with house colors?
Bool m_useTooltipAltBackColor; ///< draw tooltip backgrounds with house colors?
Bool m_adjustTooltipAltColor; ///< adjust house colors (darker/brighter) for tooltips?
Bool m_orthoCamera; ///< use an ortho camera for 3D cursors?
Real m_orthoZoom; ///< uniform zoom to apply to 3D cursors when using ortho cameras
UnsignedInt m_dragTolerance;
UnsignedInt m_dragTolerance3D;
UnsignedInt m_dragToleranceMS;
protected:
/// you must implement getting a buffered mouse event from you device here
virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush ) = 0;
//-----------------------------------------------------------------------------------------------
// internal methods
void updateMouseData( ); ///< update the mouse with the current device data
void processMouseEvent( Int eventToProcess ); ///< combine mouse events into final data
void checkForDrag( void ); ///< check for mouse drag
void moveMouse( Int x, Int y, Int relOrAbs ); ///< move mouse by delta or absolute
//---------------------------------------------------------------------------
// internal mouse data members
UnsignedByte m_numButtons; ///< number of buttons on this mouse
UnsignedByte m_numAxes; ///< number of axes this mouse has
Bool m_forceFeedback; ///< set to TRUE if mouse supprots force feedback
UnicodeString m_tooltipString; ///< tooltip text
DisplayString *m_tooltipDisplayString; ///< tooltipDisplayString
Bool m_displayTooltip; /**< when the mouse has been still long enough this will be
set to TRUE indicating it's Ok to fire off a tooltip */
Bool m_isTooltipEmpty;
enum { NUM_MOUSE_EVENTS = 256 };
MouseIO m_mouseEvents[ NUM_MOUSE_EVENTS ]; ///< for event list
MouseIO m_currMouse; ///< for current mouse data
MouseIO m_prevMouse; ///< for previous mouse data
Int m_minX; ///< mouse is locked to this region
Int m_maxX; ///< mouse is locked to this region
Int m_minY; ///< mouse is locked to this region
Int m_maxY; ///< mouse is locked to this region
UnsignedInt m_inputFrame; ///< frame input was gathered on
UnsignedInt m_deadInputFrame; ///< Frame which last input occured
Bool m_inputMovesAbsolute; /**< if TRUE, when processing mouse position
chanages the movement will be done treating
the coords as ABSOLUTE positions and NOT
relative coordinate changes */
Bool m_visible; // visibility status
MouseCursor m_currentCursor; ///< current mouse cursor
DisplayString *m_cursorTextDisplayString; ///< text to display on the cursor (if specified)
RGBAColorInt m_cursorTextColor; ///< color of the cursor text
RGBAColorInt m_cursorTextDropColor; ///< color of the cursor text drop shadow
Int m_tooltipDelay; ///< millisecond delay for tooltips
Int m_highlightPos;
UnsignedInt m_highlightUpdateStart;
UnsignedInt m_stillTime;
RGBAColorInt m_tooltipTextColor;
RGBAColorInt m_tooltipBackColor;
Int m_eventsThisFrame;
}; // end class Mouse
// INLINING ///////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////
extern Mouse *TheMouse; ///< extern mouse singleton definition
#endif // _MOUSE_H_

View File

@@ -0,0 +1,825 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// ParticleSys.h //////////////////////////////////////////////////////////////////////////////////
// Particle System type definitions
// Author: Michael S. Booth, November 2001
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _PARTICLE_SYS_H_
#define _PARTICLE_SYS_H_
#include <stdio.h>
#include "Common/AsciiString.h"
#include "Common/GameMemory.h"
#include "Common/GameType.h"
#include "Common/Snapshot.h"
#include "Common/SubsystemInterface.h"
#include "GameClient/ClientRandomValue.h"
#include "WWMath/Matrix3D.h" ///< @todo Replace with our own matrix library
#include "Common/STLTypedefs.h"
/// @todo Once the client framerate is decoupled, the frame counters within will have to become time-based
class Particle;
class ParticleSystem;
class ParticleSystemManager;
class Drawable;
class Object;
struct FieldParse;
class INI;
class DebugWindowDialog; // really ParticleEditorDialog
class RenderInfoClass; // ick
enum ParticleSystemID
{
INVALID_PARTICLE_SYSTEM_ID = 0
};
#define MAX_VOLUME_PARTICLE_DEPTH ( 16 )
#define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing!
#define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 )
//--------------------------------------------------------------------------------------------------------------
enum { MAX_KEYFRAMES=8 };
struct Keyframe
{
Real value;
UnsignedInt frame;
};
struct RGBColorKeyframe
{
RGBColor color;
UnsignedInt frame;
};
enum ParticlePriorityType
{
INVALID_PRIORITY = 0,
PARTICLE_PRIORITY_LOWEST = 1,
// FLUFF = PARTICLE_PRIORITY_LOWEST, ///< total and absolute fluff
// DEBRIS, ///< debris related particles
// NATURE, ///< neato effects we just might see in the world
// WEAPON, ///< Weapons firing and flying in the air
// DAMAGE, ///< taking damage/dying explosions
// SPECIAL, ///< super special top priority like a superweapon
WEAPON_EXPLOSION = PARTICLE_PRIORITY_LOWEST,
SCORCHMARK,
DUST_TRAIL,
BUILDUP,
DEBRIS_TRAIL,
UNIT_DAMAGE_FX,
DEATH_EXPLOSION,
SEMI_CONSTANT,
CONSTANT,
WEAPON_TRAIL,
AREA_EFFECT,
CRITICAL, ///< super special top priority like a superweapon
ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc
// !!! *Noting* goes here ... special is the top priority !!!
PARTICLE_PRIORITY_HIGHEST = ALWAYS_RENDER,
NUM_PARTICLE_PRIORITIES ///< Keep this last
};
/**
* This structure is filled out and passed to the constructor of a Particle to initialize it
*/
class ParticleInfo : public Snapshot
{
public:
ParticleInfo( void );
Coord3D m_vel; ///< initial velocity
Coord3D m_pos; ///< initial position
Coord3D m_emitterPos; ///< position of the emitter
Real m_velDamping; ///< velocity damping coefficient
Real m_angleX; ///< initial angle around X axis
Real m_angleY; ///< initial angle around Y axis
Real m_angleZ; ///< initial angle around Z axis
Real m_angularRateX; ///< initial angle around X axis
Real m_angularRateY; ///< initial angle around Y axis
Real m_angularRateZ; ///< initial angle around Z axis
Real m_angularDamping; ///< angular velocity damping coefficient
UnsignedInt m_lifetime; ///< lifetime of this particle
Real m_size; ///< size of the particle
Real m_sizeRate; ///< rate of change of size
Real m_sizeRateDamping; ///< damping of size change rate
Keyframe m_alphaKey[ MAX_KEYFRAMES ];
RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ];
Real m_colorScale; ///< color "scaling" coefficient
Real m_windRandomness; ///< multiplier for wind randomness per particle
Bool m_particleUpTowardsEmitter; ///< if this is true, then the 0.0 Z rotation should actually
///< correspond to the direction of the emitter.
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
};
/**
* An individual particle created by a ParticleSystem.
* NOTE: Particles cannot exist without a parent particle system.
*/
class Particle : public MemoryPoolObject,
public ParticleInfo
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Particle, "ParticlePool" )
public:
Particle( ParticleSystem *system, const ParticleInfo *data );
Bool update( void ); ///< update this particle's behavior - return false if dead
void doWindMotion( void ); ///< do wind motion (if present) from particle system
void applyForce( const Coord3D *force ); ///< add the given acceleration
void detachDrawable( void ) { m_drawable = NULL; } ///< detach the Drawable pointer from this particle
inline const Coord3D *getPosition( void ) { return &m_pos; }
inline Real getSize( void ) { return m_size; }
inline Real getAngle( void ) { return m_angleZ; }
inline Real getAlpha( void ) { return m_alpha; }
inline const RGBColor *getColor( void ) { return &m_color; }
inline void setColor( RGBColor *color ) { m_color = *color; }
Bool isInvisible( void ); ///< return true if this particle is invisible
inline Bool isCulled (void) {return m_isCulled;} ///< return true if the particle falls off the edge of the screen
inline void setIsCulled (Bool enable) { m_isCulled = enable;} ///< set particle to not visible because it's outside view frustum
void controlParticleSystem( ParticleSystem *sys ) { m_systemUnderControl = sys; }
void detachControlledParticleSystem( void ) { m_systemUnderControl = NULL; }
// get priority of this particle ... which is the priority of the system it belongs to
ParticlePriorityType getPriority( void );
UnsignedInt getPersonality(void) { return m_personality; };
void setPersonality(UnsignedInt p) { m_personality = p; };
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
void computeAlphaRate( void ); ///< compute alpha rate to get to next key
void computeColorRate( void ); ///< compute color change to get to next key
public:
Particle * m_systemNext;
Particle * m_systemPrev;
Particle * m_overallNext;
Particle * m_overallPrev;
protected:
ParticleSystem * m_system; ///< the particle system this particle belongs to
UnsignedInt m_personality; ///< each new particle assigned a number one higher than the previous
// most of the particle data is derived from ParticleInfo
Coord3D m_accel; ///< current acceleration
Coord3D m_lastPos; ///< previous position
UnsignedInt m_lifetimeLeft; ///< lifetime remaining, if zero -> destroy
UnsignedInt m_createTimestamp; ///< frame this particle was created
Real m_alpha; ///< current alpha of this particle
Real m_alphaRate; ///< current rate of alpha change
Int m_alphaTargetKey; ///< next index into key array
RGBColor m_color; ///< current color of this particle
RGBColor m_colorRate; ///< current rate of color change
Int m_colorTargetKey; ///< next index into key array
Drawable * m_drawable; ///< drawable associated with this particle
Bool m_isCulled; ///< status of particle relative to screen bounds
public:
Bool m_inSystemList;
Bool m_inOverallList;
union
{
ParticleSystem * m_systemUnderControl; ///< the particle system attached to this particle (not the system that created us)
ParticleSystemID m_systemUnderControlID; ///< id of system attached to this particle (not the system that created us);
};
};
//--------------------------------------------------------------------------------------------------------------
#ifdef DEFINE_PARTICLE_SYSTEM_NAMES
/**** NOTE: These MUST be kept in sync with the enumerations below *****/
static char *ParticleShaderTypeNames[] =
{
"NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL
};
static char *ParticleTypeNames[] =
{
"NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", NULL
};
static char *EmissionVelocityTypeNames[] =
{
"NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL
};
static char *EmissionVolumeTypeNames[] =
{
"NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL
};
//"NONE", "FLUFF", "DEBRIS", "NATURE", "WEAPON", "DAMAGE", "SPECIAL"
static char *ParticlePriorityNames[] =
{
"NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL
};
static char *WindMotionNames[] =
{
"NONE", "Unused", "PingPong", "Circular", NULL
};
#endif
/**
* All of the properties of a particle system, used by both ParticleSystemTemplates
* and ParticleSystem classes.
*/
class ParticleSystemInfo : public Snapshot
{
public:
ParticleSystemInfo(); ///< to set defaults.
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
Bool m_isOneShot; ///< if true, destroy system after one burst has occurred
enum ParticleShaderType
{
INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY
}
m_shaderType; ///< how this particle is rendered
enum ParticleType
{
INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak?
}
m_particleType;
AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name
GameClientRandomVariable m_angleX; ///< initial angle around X axis
GameClientRandomVariable m_angleY; ///< initial angle around Y axis
GameClientRandomVariable m_angleZ; ///< initial angle around Z axis
GameClientRandomVariable m_angularRateX; ///< initial angle around X axis
GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis
GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis
GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient
GameClientRandomVariable m_velDamping; ///< velocity damping factor
GameClientRandomVariable m_lifetime; ///< lifetime of emitted particles
UnsignedInt m_systemLifetime; ///< lifetime of the particle system
GameClientRandomVariable m_startSize; ///< initial size of emitted particles
GameClientRandomVariable m_startSizeRate; ///< change in start size of emitted particles
GameClientRandomVariable m_sizeRate; ///< rate of change of size
GameClientRandomVariable m_sizeRateDamping; ///< damping of size change
UnsignedInt m_volumeParticleDepth; ///< how many layers deep to draw the particle, if >1
struct RandomKeyframe
{
GameClientRandomVariable var; ///< the range of values at this keyframe
UnsignedInt frame; ///< the frame number
};
RandomKeyframe m_alphaKey[ MAX_KEYFRAMES ];
RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ]; ///< color of particle
typedef Int Color;
void tintAllColors( Color tintColor );
GameClientRandomVariable m_colorScale; ///< color coefficient
GameClientRandomVariable m_burstDelay; ///< time between particle emissions
GameClientRandomVariable m_burstCount; ///< number of particles emitted per burst
GameClientRandomVariable m_initialDelay; ///< delay before particles begin emitting
Coord3D m_driftVelocity; ///< additional velocity added to all particles
Real m_gravity; ///< gravity acceleration (global Z) for particles in this system
AsciiString m_slaveSystemName; ///< if non-empty, create a system whose particles track this system's
Coord3D m_slavePosOffset; ///< positional offset of slave particles relative to master's
AsciiString m_attachedSystemName; ///< if non-empty, create a system attached to each particle of this system
//-------------------------------------------------------
// The direction and speed at which particles are emitted
enum EmissionVelocityType
{
INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD
}
m_emissionVelocityType;
ParticlePriorityType m_priority;
union
{
struct
{
GameClientRandomVariable x; ///< initial speed of particle along X axis
GameClientRandomVariable y; ///< initial speed of particle along Y axis
GameClientRandomVariable z; ///< initial speed of particle along Z axis
}
ortho;
struct
{
GameClientRandomVariable speed; ///< initial speed of particle along random radial direction
}
spherical, hemispherical;
struct
{
GameClientRandomVariable radial; ///< initial speed of particle in the disk
GameClientRandomVariable normal; ///< initial speed of particle perpendicular to disk
}
cylindrical;
struct
{
GameClientRandomVariable speed; ///< speed outward from emission volume
GameClientRandomVariable otherSpeed; ///< speed along "other" axis, such as cylinder length
}
outward;
}
m_emissionVelocity;
//----------------------------------------------------------
// The volume of space where particles are initially created
// Note that the volume is relative to the system's position and orientation
enum EmissionVolumeType
{
INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER
}
m_emissionVolumeType; ///< the type of volume where particles are created
union emissionVolumeUnion
{
// point just uses system's position
// line
struct
{
Coord3D start, end;
}
line;
// box
struct
{
Coord3D halfSize;
}
box;
// sphere
struct
{
Real radius;
}
sphere;
// cylinder
struct
{
Real radius;
Real length;
}
cylinder;
}
m_emissionVolume; ///< the dimensions of the emission volume
Bool m_isEmissionVolumeHollow; ///< if true, only create particles at boundary of volume
Bool m_isGroundAligned; ///< if true, align with the ground. if false, then do the normal billboarding.
Bool m_isEmitAboveGroundOnly; ///< if true, only emit particles when the system is above ground.
Bool m_isParticleUpTowardsEmitter; ///< if true, align the up direction to be towards the emitter.
enum WindMotion
{
WIND_MOTION_INVALID = 0,
WIND_MOTION_NOT_USED,
WIND_MOTION_PING_PONG,
WIND_MOTION_CIRCULAR
};
WindMotion m_windMotion; ///< motion of the wind angle updating
Real m_windAngle; ///< angle of the "wind" associated with this system
Real m_windAngleChange; ///< current how fast the angle changes (higher=faster change)
Real m_windAngleChangeMin; ///< min for angle change
Real m_windAngleChangeMax; ///< max for angle change
Real m_windMotionStartAngle; ///< (for ping pong) angle 1 of the ping pong
Real m_windMotionStartAngleMin; ///< (for ping pong) min angle for angle 1
Real m_windMotionStartAngleMax; ///< (for ping pong) max angle for angle 1
Real m_windMotionEndAngle; ///< (for ping pong) angle 2 of the ping pong
Real m_windMotionEndAngleMin; ///< (for ping pong) min angle for angle 2
Real m_windMotionEndAngleMax; ///< (for ping pong) max angel for angle 2
Byte m_windMotionMovingToEndAngle; ///< (for ping pong) TRUE if we're moving "towards" the end angle
};
/**
* A ParticleSystemTemplate, used by the ParticleSystemManager to instantiate ParticleSystems.
*/
class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystemInfo
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystemTemplate, "ParticleSystemTemplatePool" )
public:
ParticleSystemTemplate( const AsciiString &name );
AsciiString getName( void ) const { return m_name; }
// This function was made const because of update modules' module data being all const.
ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-NULL, it is a slave system for use
const FieldParse *getFieldParse( void ) const { return m_fieldParseTable; } ///< Parsing from INI access
static void parseRGBColorKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parseRandomKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parseRandomRGBColor( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parseRandomRGBColorRate( INI* ini, void *instance, void *store, const void* /*userData*/ );
protected:
friend class ParticleSystemManager; ///< @todo remove this friendship
friend class ParticleSystem; ///< @todo remove this friendship
// These friendships are naughty but necessary for particle editing.
friend class DebugWindowDialog; ///< @todo remove this friendship when no longer editing particles
friend void _updateAsciiStringParmsToSystem(ParticleSystemTemplate *particleTemplate);
friend void _updateAsciiStringParmsFromSystem(ParticleSystemTemplate *particleTemplate);
friend void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ );
static const FieldParse m_fieldParseTable[]; ///< the parse table for INI definition
protected:
AsciiString m_name; ///< the name of this template
// This has to be mutable because of the delayed initialization thing in createSlaveSystem
mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-NULL, use this to create a slave system
// template attribute data inherited from ParticleSystemInfo class
};
/**
* A particle system, responsible for creating Particles.
* If a particle system has finished, but still has particles "in the air", it must wait
* before destroying itself in order to ensure everything can be cleaned up if the system
* is reset.
*/
class ParticleSystem : public MemoryPoolObject,
public ParticleSystemInfo
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystem, "ParticleSystemPool" )
public:
ParticleSystem( const ParticleSystemTemplate *sysTemplate,
ParticleSystemID id,
Bool createSlaves ); ///< create a particle system from a template and assign it this ID
inline ParticleSystemID getSystemID( void ) const { return m_systemID; } ///< get unique system ID
void setPosition( const Coord3D *pos ); ///< set the position of the particle system
void getPosition( Coord3D *pos ); ///< get the position of the particle system
void setLocalTransform( const Matrix3D *matrix ); ///< set the system's local transform
void rotateLocalTransformX( Real x ); ///< rotate local transform matrix
void rotateLocalTransformY( Real y ); ///< rotate local transform matrix
void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix
const Coord3D *getDriftVelocity( void ) { return &m_driftVelocity; } ///< get the drift velocity of the system
void attachToDrawable( const Drawable *draw ); ///< attach this particle system to a Drawable
void attachToObject( const Object *obj ); ///< attach this particle system to an Object
virtual Bool update( Int localPlayerIndex ); ///< update this particle system, return false if dead
void updateWindMotion( void ); ///< update wind motion
void setControlParticle( Particle *p ); ///< set control particle
void start( void ); ///< (re)start a stopped particle system
void stop( void ); ///< stop a particle system from emitting
void destroy( void ); ///< stop emitting, and wait for particles to die, then destroy self
void setVelocityMultiplier( const Coord3D *value ) { m_velCoeff = *value; } ///< set the velocity multiplier coefficient
const Coord3D *getVelocityMultiplier( void ) { return &m_velCoeff; } ///< get the velocity multiplier coefficient
void setBurstCountMultiplier( Real value ) { m_countCoeff = value; }
Real getBurstCountMultiplier( void ) { return m_countCoeff; }
void setBurstDelayMultiplier( Real value ) { m_delayCoeff = value; }
Real getBurstDelayMultiplier( void ) { return m_delayCoeff; }
void setSizeMultiplier( Real value ) { m_sizeCoeff = value; }
Real getSizeMultiplier( void ) { return m_sizeCoeff; }
/// Force a burst of particles to be emitted immediately.
void trigger (void) { m_burstDelayLeft = 0; m_delayLeft = 0;}
void setInitialDelay( UnsignedInt delay ) { m_delayLeft = delay; }
AsciiString getParticleTypeName( void ) { return m_particleTypeName; } ///< return the name of the particles
Bool isUsingDrawables( void ) { return (m_particleType == DRAWABLE) ? true : false; }
Bool isUsingStreak( void ) { return (m_particleType == STREAK) ? true : false; }
UnsignedInt getVolumeParticleDepth( void ) { return ( m_particleType == VOLUME_PARTICLE ) ? OPTIMUM_VOLUME_PARTICLE_DEPTH : 0; }
Bool shouldBillboard( void ) { return !m_isGroundAligned; }
ParticleShaderType getShaderType( void ) { return m_shaderType; }
void setSlave( ParticleSystem *slave ); ///< set a slave system for us
ParticleSystem *getSlave( void ) { return m_slaveSystem; }
void setMaster( ParticleSystem *master ); ///< make this a slave with a master
ParticleSystem *getMaster( void ) { return m_masterSystem; }
const Coord3D *getSlavePositionOffset( void ) { return &m_slavePosOffset; }
void setSystemLifetime( UnsignedInt frames ) { m_systemLifetimeLeft = frames; }; ///< not the particle life, the system!... Lorenzen
void setLifetimeRange( Real min, Real max );
Bool isSystemForever() const {return m_isForever;}
UnsignedInt getStartFrame( void ) { return m_startTimestamp; } ///< return frame when this system was created
Bool isDestroyed( void ) const { return m_isDestroyed; }
void setSaveable( Bool b );
Bool isSaveable( void ) const { return m_isSaveable; }
/// called when the particle this system is controlled by dies
void detachControlParticle( Particle *p ) { m_controlParticle = NULL; }
/// called to merge two systems info. If slaveNeedsFullPromotion is true, then the slave needs to be aware of how many particles
/// to generate as well.
static ParticleInfo mergeRelatedParticleSystems( ParticleSystem *masterParticleSystem, ParticleSystem *slaveParticleSystem, Bool slaveNeedsFullPromotion);
/// @todo Const this (MSB)
const ParticleSystemTemplate *getTemplate( void ) { return m_template; } ///< get the template used to create this system
// @todo Const this jkmcd
Particle *getFirstParticle( void ) { return m_systemParticlesHead; }
void addParticle( Particle *particleToAdd );
/// when a particle dies, it calls this method - ONLY FOR USE BY PARTICLE
void removeParticle( Particle *p );
UnsignedInt getParticleCount( void ) const { return m_particleCount; }
inline ObjectID getAttachedObject( void ) { return m_attachedToObjectID; }
inline DrawableID getAttachedDrawable( void ) { return m_attachedToDrawableID; }
// Access to dynamically changing part of a particle system.
void setEmissionVolumeSphereRadius( Real newRadius ) { if (m_emissionVolumeType == SPHERE) m_emissionVolume.sphere.radius = newRadius; }
void setEmissionVolumeCylinderRadius( Real newRadius ) { if (m_emissionVolumeType == CYLINDER) m_emissionVolume.cylinder.radius = newRadius; }
EmissionVolumeType getEmisionVolumeType() const { return m_emissionVolumeType; }
ParticlePriorityType getPriority() const { return m_priority; }
// Access to wind motoin
Real getWindAngle( void ) { return m_windAngle; }
WindMotion getWindMotion( void ) { return m_windMotion; }
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
virtual Particle *createParticle( const ParticleInfo *data,
ParticlePriorityType priority,
Bool forceCreate = FALSE ); ///< factory method for particles
const ParticleInfo *generateParticleInfo( Int particleNum, Int particleCount ); ///< generate a new, random set of ParticleInfo
const Coord3D *computeParticlePosition( void ); ///< compute a position based on emission properties
const Coord3D *computeParticleVelocity( const Coord3D *pos ); ///< compute a velocity vector based on emission properties
const Coord3D *computePointOnUnitSphere( void ); ///< compute a random point on a unit sphere
protected:
Particle * m_systemParticlesHead;
Particle * m_systemParticlesTail;
UnsignedInt m_particleCount; ///< current count of particles for this system
ParticleSystemID m_systemID; ///< unique id given to this system from the particle system manager
DrawableID m_attachedToDrawableID; ///< if non-zero, system is parented to this Drawable
ObjectID m_attachedToObjectID; ///< if non-zero, system is parented to this Object
Matrix3D m_localTransform; ///< local orientation & position of system
Matrix3D m_transform; ///< composite transform of parent Drawable and local
UnsignedInt m_burstDelayLeft; ///< when zero, emit a particle burst
UnsignedInt m_delayLeft; ///< decremented until zero
UnsignedInt m_startTimestamp; ///< timestamp when this particle system was (re)started
UnsignedInt m_systemLifetimeLeft; ///< lifetime remaining for entire particle system
UnsignedInt m_personalityStore; ///< increments each time it is aggigned to each new particle
///< so that each particle gets an ever greater number
Real m_accumulatedSizeBonus; ///< For a system that wants to make particles start bigger and bigger. StartSizeRate
Coord3D m_velCoeff; ///< scalar value multiplied by all velocity parameters
Real m_countCoeff; ///< scalar value multiplied by burst count
Real m_delayCoeff; ///< scalar value multiplied by burst delay
Real m_sizeCoeff; ///< scalar value multiplied by initial size
Coord3D m_pos; ///< this is the position to emit at.
Coord3D m_lastPos; ///< this is the previous position we emitted at.
ParticleSystem * m_slaveSystem; ///< if non-NULL, another system this one has control of
ParticleSystemID m_slaveSystemID; ///< id of slave system (if present)
ParticleSystem * m_masterSystem; ///< if non-NULL, the system that controls this one
ParticleSystemID m_masterSystemID; ///< master system id (if present);
const ParticleSystemTemplate * m_template; ///< the template this system was constructed from
Particle * m_controlParticle; ///< if non-NULL, this system is controlled by this particle
Bool m_isLocalIdentity; ///< if true, the matrix can be ignored
Bool m_isIdentity; ///< if true, the matrix can be ignored
Bool m_isForever; ///< System has infinite lifetime
Bool m_isStopped; ///< if stopped, do not emit particles
Bool m_isDestroyed; ///< are we destroyed and waiting for particles to die
Bool m_isFirstPos; ///< true if this system hasn't been drawn before.
Bool m_isSaveable; ///< true if this system should be saved/loaded
// the actual particle system data is inherited from ParticleSystemInfo
};
//--------------------------------------------------------------------------------------------------------------
/**
* The particle system manager, responsible for maintaining all ParticleSystems
*/
class ParticleSystemManager : public SubsystemInterface,
public Snapshot
{
public:
typedef std::list<ParticleSystem*> ParticleSystemList;
typedef std::list<ParticleSystem*>::iterator ParticleSystemListIt;
typedef std::hash_map<AsciiString, ParticleSystemTemplate *, rts::hash<AsciiString>, rts::equal_to<AsciiString> > TemplateMap;
ParticleSystemManager( void );
virtual ~ParticleSystemManager();
virtual void init( void ); ///< initialize the manager
virtual void reset( void ); ///< reset the manager and all particle systems
virtual void update( void ); ///< update all particle systems
virtual Int getOnScreenParticleCount( void ) = 0; ///< returns the number of particles on screen
virtual void setOnScreenParticleCount(int count);
ParticleSystemTemplate *findTemplate( const AsciiString &name ) const;
ParticleSystemTemplate *findParentTemplate( const AsciiString &name, int parentNum ) const;
ParticleSystemTemplate *newTemplate( const AsciiString &name );
/// given a template, instantiate a particle system
ParticleSystem *createParticleSystem( const ParticleSystemTemplate *sysTemplate,
Bool createSlaves = TRUE );
/** given a template, instantiate a particle system.
if attachTo is not null, attach the particle system to the given object.
return the particle system's ID, NOT its pointer.
*/
ParticleSystemID createAttachedParticleSystemID( const ParticleSystemTemplate *sysTemplate,
Object* attachTo,
Bool createSlaves = TRUE );
/// find a particle system given a unique system identifier
ParticleSystem *findParticleSystem( ParticleSystemID id );
/// destroy the particle system with the given id (if it still exists)
void destroyParticleSystemByID(ParticleSystemID id);
/// return iterators to the particle system template
TemplateMap::iterator beginParticleSystemTemplate() { return m_templateMap.begin(); }
TemplateMap::iterator endParticleSystemTemplate() { return m_templateMap.end(); }
TemplateMap::const_iterator beginParticleSystemTemplate() const { return m_templateMap.begin(); }
TemplateMap::const_iterator endParticleSystemTemplate() const { return m_templateMap.end(); }
/// destroy attached systems to object
void destroyAttachedSystems( Object *obj );
void setLocalPlayerIndex(Int index) {m_localPlayerIndex=index;}
void addParticle( Particle *particleToAdd, ParticlePriorityType priority );
void removeParticle( Particle *particleToRemove );
Int removeOldestParticles( UnsignedInt count, ParticlePriorityType priorityCap );
UnsignedInt getParticleCount( void ) const { return m_particleCount; }
UnsignedInt getFieldParticleCount( void ) const { return m_fieldParticleCount; }
UnsignedInt getParticleSystemCount( void ) const { return m_particleSystemCount; }
// @todo const this jkmcd
ParticleSystemList &getAllParticleSystems( void ) { return m_allParticleSystemList; }
virtual void doParticles(RenderInfoClass &rinfo) = 0;
virtual void queueParticleRender() = 0;
virtual void preloadAssets( TimeOfDay timeOfDay );
// these are only for use by partcle systems to link and unlink themselves
void friend_addParticleSystem( ParticleSystem *particleSystemToAdd );
void friend_removeParticleSystem( ParticleSystem *particleSystemToRemove );
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
Particle *m_allParticlesHead[ NUM_PARTICLE_PRIORITIES ];
Particle *m_allParticlesTail[ NUM_PARTICLE_PRIORITIES ];
ParticleSystemID m_uniqueSystemID; ///< unique system ID to assign to each system created
ParticleSystemList m_allParticleSystemList;
UnsignedInt m_particleCount;
UnsignedInt m_fieldParticleCount; ///< this does not need to be xfered, since it is evaluated every frame
UnsignedInt m_particleSystemCount;
Int m_onScreenParticleCount; ///< number of particles displayed on screen per frame
UnsignedInt m_lastLogicFrameUpdate;
Int m_localPlayerIndex; ///<used to tell particle systems which particles can be skipped due to player shroud status
private:
TemplateMap m_templateMap; ///< a hash map of all particle system templates
};
/// The particle system manager singleton
extern ParticleSystemManager *TheParticleSystemManager;
class DebugDisplayInterface;
extern void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL );
#endif // _PARTICLE_SYS_H_

View File

@@ -0,0 +1,47 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: PlaceEventTranslator.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_PlaceEventTranslator
#define _H_PlaceEventTranslator
#include "GameClient/InGameUI.h"
//-----------------------------------------------------------------------------
class PlaceEventTranslator : public GameMessageTranslator
{
private:
UnsignedInt m_frameOfUpButton;
public:
PlaceEventTranslator();
~PlaceEventTranslator();
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
};
#endif

View File

@@ -0,0 +1,266 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: ProcessAnimateWindow.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Mar 2002
//
// Filename: ProcessAnimateWindow.h
//
// author: Chris Huybregts
//
// purpose: If a new animation is wanted to be added for the windows, All you
// have to do is create a new class derived from ProcessAnimateWindow.
// Then setup each of the virtual classes to process an AnimateWindow
// class. The Update adn reverse functions get called every frame
// by the shell and will continue to process the AdminWin until the
// isFinished flag on the adminWin is set to true.
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __PROCESSANIMATEWINDOW_H_
#define __PROCESSANIMATEWINDOW_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "Lib/BaseType.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AnimateWindow;
class GameWindow;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class ProcessAnimateWindow
{
public:
ProcessAnimateWindow( void ){};
virtual ~ProcessAnimateWindow( void ){};
virtual void initAnimateWindow( AnimateWindow *animWin ) = 0;
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 ) = 0;
virtual Bool updateAnimateWindow( AnimateWindow *animWin ) = 0;
virtual Bool reverseAnimateWindow( AnimateWindow *animWin ) = 0;
virtual void setMaxDuration(UnsignedInt maxDuration) { }
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromRight : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromRight( void );
virtual ~ProcessAnimateWindowSlideFromRight( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromLeft : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromLeft( void );
virtual ~ProcessAnimateWindowSlideFromLeft( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromTop : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromTop( void );
virtual ~ProcessAnimateWindowSlideFromTop( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromTopFast : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromTopFast( void );
virtual ~ProcessAnimateWindowSlideFromTopFast( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromBottom : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromBottom( void );
virtual ~ProcessAnimateWindowSlideFromBottom( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSpiral : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSpiral( void );
virtual ~ProcessAnimateWindowSpiral( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Real m_deltaTheta;
Int m_maxR;
};
//-----------------------------------------------------------------------------
class ProcessAnimateWindowSlideFromBottomTimed : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromBottomTimed( void );
virtual ~ProcessAnimateWindowSlideFromBottomTimed( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
virtual void setMaxDuration(UnsignedInt maxDuration) { m_maxDuration = maxDuration; }
private:
UnsignedInt m_maxDuration;
};
class ProcessAnimateWindowSlideFromRightFast : public ProcessAnimateWindow
{
public:
ProcessAnimateWindowSlideFromRightFast( void );
virtual ~ProcessAnimateWindowSlideFromRightFast( void );
virtual void initAnimateWindow( AnimateWindow *animWin );
virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
virtual Bool updateAnimateWindow( AnimateWindow *animWin );
virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
private:
Coord2D m_maxVel; // top speed windows travel in x and y
Int m_slowDownThreshold; // when widnows get this close to their resting
// positions they start to slow down
Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
Real m_speedUpRatio; // how fast the windows speed up
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __PROCESSANIMATEWINDOW_H_

View File

@@ -0,0 +1,95 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: RadiusDecal.h ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _RadiusDecal_H_
#define _RadiusDecal_H_
#include "Common/GameCommon.h"
#include "Common/GameType.h"
#include "GameClient/Color.h"
enum ShadowType;
class Player;
class Shadow;
class RadiusDecalTemplate;
// ------------------------------------------------------------------------------------------------
class RadiusDecal
{
friend class RadiusDecalTemplate;
private:
const RadiusDecalTemplate* m_template;
Shadow* m_decal;
Bool m_empty;
public:
RadiusDecal();
RadiusDecal(const RadiusDecal& that);
RadiusDecal& operator=(const RadiusDecal& that);
~RadiusDecal();
void xferRadiusDecal( Xfer *xfer );
// please note: it is very important, for game/net sync reasons, to ensure that
// isEmpty() returns the same value, regardless of whether this decal will
// be visible to the local player or not.
Bool isEmpty() const { return m_empty; }
void clear();
void update();
void setPosition(const Coord3D& pos);
void setOpacity( const Real o );
};
// ------------------------------------------------------------------------------------------------
class RadiusDecalTemplate
{
friend class RadiusDecal;
private:
AsciiString m_name;
ShadowType m_shadowType;
Real m_minOpacity;
Real m_maxOpacity;
UnsignedInt m_opacityThrobTime;
Color m_color;
Bool m_onlyVisibleToOwningPlayer;
public:
RadiusDecalTemplate();
Bool valid() const { return m_name.isNotEmpty(); }
void xferRadiusDecalTemplate( Xfer *xfer );
// please note: it is very important, for game/net sync reasons, to ensure that
// a valid radiusdecal is created, even if will not be visible to the local player,
// since some logic makes decisions based on this.
void createRadiusDecal(const Coord3D& pos, Real radius, const Player* owningPlayer, RadiusDecal& result) const;
static void parseRadiusDecalTemplate(INI* ini, void *instance, void * store, const void* /*userData*/);
};
#endif

View File

@@ -0,0 +1,96 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: RayEffect.h //////////////////////////////////////////////////////////////////////////////
// Created: Colin Day, May 2001
// Desc: Ray effect manager
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __RAYEFFECT_H_
#define __RAYEFFECT_H_
// INCLUDE ////////////////////////////////////////////////////////////////////////////////////////
#include "Lib/BaseType.h"
#include "Common/SubsystemInterface.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class Drawable;
//-------------------------------------------------------------------------------------------------
/** Data the ray effect system keeps for an entry */
//-------------------------------------------------------------------------------------------------
struct RayEffectData
{
const Drawable *draw; ///< the drawable
Coord3D startLoc; ///< start location for ray
Coord3D endLoc; ///< end location for ray
}; // end RayEffectData
//-------------------------------------------------------------------------------------------------
/** This class maintains all the ray effects visible in the world */
//-------------------------------------------------------------------------------------------------
class RayEffectSystem : public SubsystemInterface
{
public:
RayEffectSystem( void );
~RayEffectSystem( void );
virtual void init( void );
virtual void reset( void );
virtual void update( void ) { }
/// add a ray effect entry for this drawable
void addRayEffect( const Drawable *draw, const Coord3D *startLoc, const Coord3D *endLoc );
/// given a drawable, remove its effect from the system
void deleteRayEffect( const Drawable *draw );
/** given a drawable, if it is in the ray effect system list retrieve
the ray effect data for its entry */
void getRayEffectData( const Drawable *draw, RayEffectData *effectData );
protected:
/// find an effect data entry based on the drawable
RayEffectData *findEntry( const Drawable *draw );
enum
{
MAX_RAY_EFFECTS = 128
};
RayEffectData m_effectData[ MAX_RAY_EFFECTS ]; ///< all the ray effects
}; // end RayEffectSystem
// EXTERN /////////////////////////////////////////////////////////////////////////////////////////
extern RayEffectSystem *TheRayEffects; ///< the ray effects singleton external
#endif // $label

View File

@@ -0,0 +1,105 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: GameClient/ContextSensitiveTranslator.h //////////////////////////////////////////////////
// Contains the SelectionInfo structure and the contextCommandForNewSelection
// Author: John McDonald, Jr, October 2002
#pragma once
#ifndef __SELECTIONINFO_H__
#define __SELECTIONINFO_H__
#include "GameClient/InGameUI.h"
// This structure gives you a rough idea about the counts of the kinds of guys in the
// current selection, and in the selection that would be made.
struct SelectionInfo
{
Int currentCountEnemies;
Int currentCountCivilians;
Int currentCountMine;
Int currentCountMineInfantry;
Int currentCountMineBuildings;
Int currentCountFriends;
Int newCountEnemies;
Int newCountCivilians;
Int newCountMine;
Int newCountMineBuildings;
Int newCountFriends;
Int newCountGarrisonableBuildings;
Int newCountCrates;
Bool selectEnemies;
Bool selectCivilians;
Bool selectMine;
Bool selectMineBuildings;
Bool selectFriends;
SelectionInfo();
};
//-------------------------------------------------------------------------------------------------
struct PickDrawableStruct
{
// List to fill with Drawables. This should be provided by the caller.
DrawableList *drawableListToFill;
Bool forceAttackMode;
// Note, this is OR'd with the things we are attempting to select.
KindOfMaskType kindofsToMatch;
PickDrawableStruct();
};
//-------------------------------------------------------------------------------------------------
extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedDrawables,
const DrawableList *newlySelectedDrawables,
SelectionInfo *outSelectionInfo,
Bool selectionIsPoint);
//-------------------------------------------------------------------------------------------------
// Returns ORed picktypes.
extern UnsignedInt getPickTypesForContext(Bool forceAttackMode);
//-------------------------------------------------------------------------------------------------
// Returns ORed picktypes based on the current selection.
extern UnsignedInt getPickTypesForCurrentSelection(Bool forceAttackMode);
//-------------------------------------------------------------------------------------------------
// expects ORed picktypes.
extern void translatePickTypesToKindof(UnsignedInt pickTypes, KindOfMaskType& outmask);
//-------------------------------------------------------------------------------------------------
// Given a drawable, add it to an stl list. Useful for iterateDrawablesInRegion.
// userData should be a pointer to a PickDrawableStruct, which is defined in
// above.
extern Bool addDrawableToList( Drawable *draw, void *userData );
#endif /* __SELECTIONINFO_H__ */

View File

@@ -0,0 +1,79 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: SelectionXlat.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_SelectionXlat
#define _H_SelectionXlat
#include "GameClient/InGameUI.h"
class ThingTemplate;
typedef std::map<const ThingTemplate *, int> SelectCountMap;
typedef SelectCountMap::iterator SelectCountMapIt;
//-----------------------------------------------------------------------------
class SelectionTranslator : public GameMessageTranslator
{
// this is an evil friend wrapper due to the current limitations of Drawable iterators.
friend Bool selectFriendsWrapper( Drawable *draw, void *userData );
friend Bool killThemKillThemAllWrapper( Drawable *draw, void *userData );
private:
Bool m_leftMouseButtonIsDown;
Bool m_dragSelecting;
UnsignedInt m_lastGroupSelTime;
Int m_lastGroupSelGroup;
ICoord2D m_selectFeedbackAnchor; // Note: Used for drawing feedback only.
ICoord2D m_deselectFeedbackAnchor; // Note: Used for drawing feedback only.
Bool m_displayedMaxWarning; // did we already display a warning about selecting too many units?
UnsignedInt m_lastClick; ///< timer used for checking double click for type selection
SelectCountMap m_selectCountMap;
Coord3D m_deselectDownCameraPosition;
Bool selectFriends( Drawable *draw, GameMessage *createTeamMsg, Bool dragSelecting );
Bool killThemKillThemAll( Drawable *draw, GameMessage *killThemAllMsg );
public:
SelectionTranslator();
~SelectionTranslator();
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
//Added By Sadullah Nader
//added for fix to the drag selection when entering control bar
//changes the mode of drag selecting to it's opposite
void setDragSelecting(Bool dragSelect);
void setLeftMouseButton(Bool state);
};
Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting );
extern SelectionTranslator *TheSelectionTranslator;
#endif

View File

@@ -0,0 +1,218 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Shadow.h /////////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Modified: Mark Wilczynski, February 2002
// Desc: Shadow descriptions
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __SHADOW_H_
#define __SHADOW_H_
//
// skeleton definition of shadow types
//
// shadow bit flags, keep this in sync with TheShadowNames
enum ShadowType
{
SHADOW_NONE = 0x00000000,
SHADOW_DECAL = 0x00000001, //shadow decal applied via modulate blend
SHADOW_VOLUME = 0x00000002,
SHADOW_PROJECTION = 0x00000004,
SHADOW_DYNAMIC_PROJECTION = 0x00000008, //extra setting for shadows which need dynamic updates
SHADOW_DIRECTIONAL_PROJECTION = 0x00000010, //extra setting for shadow decals that rotate with sun direction
SHADOW_ALPHA_DECAL = 0x00000020, //not really for shadows but for other decal uses. Alpha blended.
SHADOW_ADDITIVE_DECAL = 0x00000040 //not really for shadows but for other decal uses. Additive blended.
};
#ifdef DEFINE_SHADOW_NAMES
static const char* TheShadowNames[] =
{
"SHADOW_DECAL",
"SHADOW_VOLUME",
"SHADOW_PROJECTION",
"SHADOW_DYNAMIC_PROJECTION",
"SHADOW_DIRECTIONAL_PROJECTION",
"SHADOW_ALPHA_DECAL",
"SHADOW_ADDITIVE_DECAL",
NULL
};
#endif // end DEFINE_SHADOW_NAMES
#define MAX_SHADOW_LIGHTS 1 //maximum number of shadow casting light sources in scene - support for more than 1 has been dropped from most code.
class RenderObjClass; //forward reference
class RenderCost; //forward reference
//Interface to all shadow objects.
class Shadow
{
public:
struct ShadowTypeInfo
{
char m_ShadowName[64]; //when set, overrides the default model shadow (used mostly for Decals).
ShadowType m_type; //type of shadow
Bool allowUpdates; //whether to update the shadow image when object/light moves.
Bool allowWorldAlign; //whether to align shadow to world geometry or draw as horizontal decal.
Real m_sizeX; //world size of decal projection
Real m_sizeY; //world size of decal projection
Real m_offsetX; //world shift along x axis
Real m_offsetY; //world shift along y axis
};
Shadow(void) : m_diffuse(0xffffffff), m_color(0xffffffff), m_opacity (0x000000ff), m_localAngle(0.0f) {}
///<if this is set, then no render will occur, even if enableShadowRender() is enabled. Used by Shroud.
void enableShadowInvisible(Bool isEnabled);
void enableShadowRender(Bool isEnabled);
Bool isRenderEnabled(void) {return m_isEnabled;}
Bool isInvisibleEnabled(void) {return m_isInvisibleEnabled;}
virtual void release(void)=0; ///<release this shadow from suitable manager.
void setOpacity(Int value); ///<adjust opacity of decal/shadow
void setColor(Color value);///<adjust ARGB color of decal/shadow
void setAngle(Real angle); ///<adjust orientation around z-axis
void setPosition(Real x, Real y, Real z);
void setSize(Real sizeX, Real sizeY)
{
m_decalSizeX = sizeX;
m_decalSizeY = sizeY;
if (sizeX == 0)
m_oowDecalSizeX = 0;
else
m_oowDecalSizeX = 1.0f/sizeX ;
if (sizeY == 0)
m_oowDecalSizeY = 0;
else
m_oowDecalSizeY = 1.0f/sizeY ;
};
#if defined(_DEBUG) || defined(_INTERNAL)
virtual void getRenderCost(RenderCost & rc) const = 0;
#endif
protected:
Bool m_isEnabled; /// toggle to turn rendering of this shadow on/off.
Bool m_isInvisibleEnabled; /// if set, overrides and causes no rendering.
UnsignedInt m_opacity; ///< value between 0 (transparent) and 255 (opaque)
UnsignedInt m_color; ///< color in ARGB format. (Alpha is ignored).
ShadowType m_type; /// type of projection
Int m_diffuse; /// diffuse color used to tint/fade shadow.
Real m_x,m_y,m_z; /// world position of shadow center when not bound to robj/drawable.
Real m_oowDecalSizeX; /// 1/(world space extent of texture in x direction)
Real m_oowDecalSizeY; /// 1/(world space extent of texture in y direction)
Real m_decalSizeX; /// 1/(world space extent of texture in x direction)
Real m_decalSizeY; /// 1/(world space extent of texture in y direction)
Real m_localAngle; /// yaw or rotation around z-axis of shadow image when not bound to robj/drawable.
};
inline void Shadow::enableShadowRender(Bool isEnabled)
{
m_isEnabled=isEnabled;
}
inline void Shadow::enableShadowInvisible(Bool isEnabled)
{
m_isInvisibleEnabled=isEnabled;
}
///@todo: Pull these out so casting, etc. is only done for visible decals.
inline void Shadow::setOpacity(Int value)
{
m_opacity=value;
if (m_type & SHADOW_ALPHA_DECAL)
{
m_diffuse = (m_color & 0x00ffffff) + (value << 24);
// m_diffuse = m_color | (value << 24);ML changed
}
else
{
if (m_type & SHADOW_ADDITIVE_DECAL)
{
Real fvalue=(Real)m_opacity/255.0f;
m_diffuse=REAL_TO_INT(((Real)(m_color & 0xff) * fvalue))
|REAL_TO_INT(((Real)((m_color >> 8) & 0xff) * fvalue))
|REAL_TO_INT(((Real)((m_color >> 16) & 0xff) * fvalue));
}
}
}
inline void Shadow::setColor(Color value)
{
m_color = value & 0x00ffffff; //filter out alpha
if (m_type & SHADOW_ALPHA_DECAL)
{
m_diffuse=m_color | (m_opacity << 24);
}
else
{
if (m_type & SHADOW_ADDITIVE_DECAL)
{
Real fvalue=(Real)m_opacity/255.0f;
m_diffuse=REAL_TO_INT(((Real)(m_color & 0xff) * fvalue))
|REAL_TO_INT(((Real)((m_color >> 8) & 0xff) * fvalue))
|REAL_TO_INT(((Real)((m_color >> 16) & 0xff) * fvalue));
}
}
}
inline void Shadow::setPosition(Real x, Real y, Real z)
{
m_x=x; m_y=y; m_z=z;
}
inline void Shadow::setAngle(Real angle)
{
m_localAngle=angle;
}
class Drawable; //forward ref.
class ProjectedShadowManager
{
public:
virtual ~ProjectedShadowManager() { };
virtual Shadow *addDecal(RenderObjClass *, Shadow::ShadowTypeInfo *shadowInfo)=0; ///<add a non-shadow decal
virtual Shadow *addDecal(Shadow::ShadowTypeInfo *shadowInfo)=0; ///<add a non-shadow decal which does not follow an object.
};
extern ProjectedShadowManager *TheProjectedShadowManager;
#endif // __SHADOW_H_

View File

@@ -0,0 +1,205 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Shell.h //////////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, September 2001
// Description: Shell menu representations
//
// Using The Shell:
// ----------------
//
// The Shell makes use of the window layouts to represent screens. You can push and
// pop screens on the stack so that you don't have to keep track of how you got
// to which screen.
//
// Here is what happens when you push a layout on the shell stack:
// 1) The layout name is stored as a "pending push"
// 2) The top of the stack has the Shutdown() method run
// 3) The Shutdown() method (or other mechanisms like Update()) will call
// Shell::shutdownComplete() when the shutdown process for that layout is "complete"
// 4) Shell::shutdownComplete() sees the "pending push" in the shell
// 5) "Pending push" layout is then loaded from disk and the pending push state is cleared
// 6) The new layout is put on the top of the stack
// 7) The new layout Init() method is called
//
// Here is what happens when you pop the top of the stack
// 1) The stack sets a "pending pop" as in progress
// 2) The top layout of the stack has the Shutdown() method called
// 3) The Shutdown() method (or other mechanisms like Update()) will call
// Shell::shutdownComplete() when the shutdown process for that layout is "complete"
// 4) Shell::shutdownComplete() sees the "pending pop" in the shell
// 5) The "pending pop" layout is then destroyed and removed from the stack
// 6) The new top of the stack has the Init() method run
//
// Window Layouts and the Shell:
// -----------------------------
//
// Window Layouts in the shell need the following functions to work property, these
// can be assigned from the GUIEdit window layout tool:
//
// - Init() [OPTIONAL]
// This is called as a result of a push or pop operation (see above for more info)
// The window layout is loaded from disk and then this Init()
// method is run. All shell layout Init() methods should show
// the layout windows. At this point you could move windows
// to starting positions, set a state that the Update() method looks at to
// "animate" the windows to the desired positions.
//
// - Update() [OPTIONAL]
// This is called once at a rate of "shellUpdateDelay" for EVERY screen on the shell
// stack. It does not matter if the screen is on the top, or is hidden, or
// anything, this is always called. Each update is run starting with the screen
// at the top of the stack and progressing to the bottom of the stack.
// States could be set in the Init() or Shutdown() methods of the layout
// that the Update() looks at and reacts to appropriately if desired.
//
// - Shutdown() [REQUIRED]
// This is called when a layout is popped off the stack, or when a new layout
// is pushed on top of this one (see above for more detail on what happens
// during the push/pop process). You can switch into a "shutdown" state and
// animate the layout appropriately in the Update() method for the layout.
// When shutdown is actually complete you should hide the all windows in
// the layout and then you are REQUIRED to notify the shell by calling
// the Shell::shutdownComplete() method.
//
// Shutdown() is also required to be able to handle the paramater "immediatePop".
// If this paramater is TRUE it means that when control returns from the
// shutdown function that the layout will immediately be popped off the
// stack. We need to be able to handle this when in code we want to
// traverse back down the stack rapidly (like when we lose connection to
// an online service, we might pop all the way back to the login screen)
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __SHELL_H_
#define __SHELL_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class WindowLayout;
class AnimateWindowManager;
class GameWindow;
class ShellMenuSchemeManager;
enum AnimTypes;
//-------------------------------------------------------------------------------------------------
/** This is the interface to the shell system to load, display, and
* manage screen menu shell system layouts */
//-------------------------------------------------------------------------------------------------
class Shell : public SubsystemInterface
{
public:
Shell( void );
~Shell( void );
// Inhertited from subsystem ====================================================================
virtual void init( void );
virtual void reset( void );
virtual void update( void );
//===============================================================================================
void showShellMap(Bool useShellMap ); ///< access function to turn on and off the shell map
void hide( Bool hide ); ///< show/hide all shell layouts
// pseudo-stack operations for manipulating layouts
void push( AsciiString filename, Bool shutdownImmediate = FALSE ); ///< load new screen on top, optionally doing an immediate shutdown
void pop( void ); ///< pop top layout
void popImmediate( void ); ///< pop now, don't wait for shutdown
void showShell( Bool runInit = TRUE ); ///< init the top of stack
void hideShell( void ); ///< shutdown the top of stack
WindowLayout *top( void ); ///< return top layout
void shutdownComplete( WindowLayout *layout, Bool impendingPush = FALSE ); ///< layout has completed shutdown
WindowLayout *findScreenByFilename( AsciiString filename ); ///< find screen
inline Bool isShellActive( void ) { return m_isShellActive; } ///< Returns true if the shell is active
inline Int getScreenCount(void) { return m_screenCount; } ///< Return the current number of screens
void registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS = 0);
Bool isAnimFinished( void );
void reverseAnimatewindow( void );
Bool isAnimReversed( void );
void loadScheme( AsciiString name );
ShellMenuSchemeManager *getShellMenuSchemeManager( void ) { return m_schemeManager; }
WindowLayout *getSaveLoadMenuLayout( void ); ///< create if necessary and return layout for save load menu
WindowLayout *getPopupReplayLayout( void ); ///< create if necessary and return layout for replay save menu
WindowLayout *getOptionsLayout( Bool create ); ///< return layout for options menu, create if necessary and we are allowed to.
void destroyOptionsLayout( void ); ///< destroy the shell's options layout.
protected:
void linkScreen( WindowLayout *screen ); ///< link screen to list
void unlinkScreen( WindowLayout *screen ); ///< remove screen from list
void doPush( AsciiString layoutFile ); ///< workhorse for push action
void doPop( Bool impendingPush ); ///< workhorse for pop action
enum { MAX_SHELL_STACK = 16 }; ///< max simultaneous shell screens
WindowLayout *m_screenStack[ MAX_SHELL_STACK ]; ///< the screen layout stack
Int m_screenCount; ///< # of screens in screen stack
WindowLayout *m_background; ///< The Background layout if the 3d shell isn't running
Bool m_clearBackground; ///< Flag if we're going to clear the background or not
Bool m_pendingPush; ///< TRUE when a push is pending
Bool m_pendingPop; ///< TRUE when a pop is pending
AsciiString m_pendingPushName; ///< layout name to be pushed
Bool m_isShellActive; ///< TRUE when the shell is active
Bool m_shellMapOn; ///< TRUE when the shell map is on
AnimateWindowManager *m_animateWindowManager; ///< The animate Window Manager
ShellMenuSchemeManager *m_schemeManager; ///< The Shell Scheme Manager
//
// we keep a pointer to this layout so that we can simply just hide/unhide this
// window layout. Why you ask? Well, as the result of pressing a button to start
// a save game load a super large set of operations will happen as the game
// loads. One of those operations is the destruction of the menu, which although
// it just destroys the windows and puts them on a destroyed list, that destroyed
// list is also processed before we are out of our own window procedure.
// This is a prime example why it's easier to just deal with windows by hiding and
// un-hiding them rather than actually creating and destroying them.
//
WindowLayout *m_saveLoadMenuLayout; ///< save/load menu layout
WindowLayout *m_popupReplayLayout; ///< replay save menu layout
WindowLayout *m_optionsLayout; ///< options menu layout
}; // end class Shell
// INLINING ///////////////////////////////////////////////////////////////////////////////////////
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern Shell *TheShell; ///< the shell external interface
#endif // __SHELL_H_

View File

@@ -0,0 +1,87 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// ShellHooks.h
// Author: Matthew D. Campbell, October 2002
#pragma once
#ifndef SHELLHOOKS_H
#define SHELLHOOKS_H
//
// This enumeration holds all the shell script hooks that we currently have, If you are going to
// add more, it's important to keep the enum lined up with the names in TheShellHookNames located
// in Scripts.cpp.
//
enum
{
SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED = 0,
SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_SELECTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_SELECTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_SELECTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_SELECTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_SELECTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_HIGHLIGHTED,
SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_UNHIGHLIGHTED,
SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGIN,
SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGOUT,
SHELL_SCRIPT_HOOK_GENERALS_ONLINE_ENTERED_FROM_GAME,
SHELL_SCRIPT_HOOK_OPTIONS_OPENED,
SHELL_SCRIPT_HOOK_OPTIONS_CLOSED,
SHELL_SCRIPT_HOOK_SKIRMISH_OPENED,
SHELL_SCRIPT_HOOK_SKIRMISH_CLOSED,
SHELL_SCRIPT_HOOK_SKIRMISH_ENTERED_FROM_GAME,
SHELL_SCRIPT_HOOK_LAN_OPENED,
SHELL_SCRIPT_HOOK_LAN_CLOSED,
SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME,
SHELL_SCRIPT_HOOK_TOTAL // Keep this guy last!
};
extern char *TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell.
void SignalUIInteraction(Int interaction);
#endif SHELLHOOKS_H

View File

@@ -0,0 +1,157 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: ShellMenuScheme.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Jul 2002
//
// Filename: ShellMenuScheme.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __SHELL_MENU_SCHEME_H_
#define __SHELL_MENU_SCHEME_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "GameClient/Color.h"
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class Image;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class ShellMenuSchemeLine
{
public:
ShellMenuSchemeLine( void );
~ShellMenuSchemeLine( void );
ICoord2D m_startPos;
ICoord2D m_endPos;
Int m_width;
Color m_color;
};
class ShellMenuSchemeImage
{
public:
ShellMenuSchemeImage( void );
~ShellMenuSchemeImage( void );
AsciiString m_name; ///< Name of the image
ICoord2D m_position; ///< the position we'll draw it at
ICoord2D m_size; ///< the size of the image needed when we draw it
Image *m_image; ///< the actual pointer to the mapped image
};
class ShellMenuScheme
{
public:
ShellMenuScheme( void );
~ShellMenuScheme( void );
void draw( void );
void addImage( ShellMenuSchemeImage* schemeImage );
void addLine( ShellMenuSchemeLine* schemeLine );
AsciiString m_name;
typedef std::list< ShellMenuSchemeImage* > ShellMenuSchemeImageList;
typedef ShellMenuSchemeImageList::iterator ShellMenuSchemeImageListIt;
ShellMenuSchemeImageList m_imageList;
typedef std::list< ShellMenuSchemeLine* > ShellMenuSchemeLineList;
typedef ShellMenuSchemeLineList::iterator ShellMenuSchemeLineListIt;
ShellMenuSchemeLineList m_lineList;
};
class ShellMenuSchemeManager
{
public:
ShellMenuSchemeManager( void );
~ShellMenuSchemeManager( void );
void init( void );
void update( void );
void setShellMenuScheme( AsciiString name );
void draw( void );
// parse Functions for the INI file
const FieldParse *getFieldParse() const { return m_shellMenuSchemeFieldParseTable; } ///< returns the parsing fields
static const FieldParse m_shellMenuSchemeFieldParseTable[]; ///< the parse table
static void parseImagePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
static void parseLinePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the line part of the INI file
ShellMenuScheme *newShellMenuScheme(AsciiString name);
private:
typedef std::list< ShellMenuScheme* > ShellMenuSchemeList; ///< list of Shell Menu schemes
typedef ShellMenuSchemeList::iterator ShellMenuSchemeListIt;
ShellMenuSchemeList m_schemeList;
ShellMenuScheme *m_currentScheme;
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __SHELL_MENU_SCHEME_H_

View File

@@ -0,0 +1,66 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Statistics.h
/*---------------------------------------------------------------------------*/
/* EA Pacific */
/* Confidential Information */
/* Copyright (C) 2001 - All Rights Reserved */
/* DO NOT DISTRIBUTE */
/*---------------------------------------------------------------------------*/
/* Project: RTS3 */
/* File name: Statistics.h */
/* Created: John K. McDonald, Jr., 4/2/2002 */
/* Desc: Common statistical functions */
/* Revision History: */
/* 4/2/2002 : Initial creation */
/*---------------------------------------------------------------------------*/
#pragma once
#ifndef _H_STATISTICS_
#define _H_STATISTICS_
// INCLUDES ///////////////////////////////////////////////////////////////////
#include "Lib/Basetype.h"
// DEFINES ////////////////////////////////////////////////////////////////////
// TYPE DEFINES ///////////////////////////////////////////////////////////////
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////
// valueToRun is the value (between 0 and maxValueForVal) to test.
// mu is designates the steepness of the curve.
// The return value is a value in [-1, 1]
extern Real MuLaw(Real valueToRun, Real maxValueForVal, Real mu);
// valueToNormalize is a value in minRange..maxRange
// minRange is the smallest value the range contains
// maxRange is the largest value the range contains
// the return is a value in [0, 1].
extern Real Normalize(Real valueToNormalize, Real minRange, Real maxRange);
// same as Normalize, except that output will be in the range [outRangeMin, outRangeMax]
extern Real NormalizeToRange(Real valueToNormalize, Real minRange, Real maxRange, Real outRangeMin, Real outRangeMax);
#endif /* _H_STATISTICS_ */

View File

@@ -0,0 +1,233 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: TerrainRoads.h ///////////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Terrain road descriptions
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __TERRAINROADS_H_
#define __TERRAINROADS_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameMemory.h"
#include "Common/SubsystemInterface.h"
#include "GameLogic/Module/BodyModule.h"
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
struct FieldParse;
class AsciiString;
// ------------------------------------------------------------------------------------------------
/** Bridges have 4 towers around it that the player can attack or use to repair the bridge */
// ------------------------------------------------------------------------------------------------
enum BridgeTowerType
{
BRIDGE_TOWER_FROM_LEFT = 0,
BRIDGE_TOWER_FROM_RIGHT,
BRIDGE_TOWER_TO_LEFT,
BRIDGE_TOWER_TO_RIGHT,
BRIDGE_MAX_TOWERS ///< keep this last
};
// ------------------------------------------------------------------------------------------------
enum { MAX_BRIDGE_BODY_FX = 3 };
//-------------------------------------------------------------------------------------------------
/** Terrain road description, good for roads and bridges */
//-------------------------------------------------------------------------------------------------
class TerrainRoadType : public MemoryPoolObject
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( TerrainRoadType, "TerrainRoadType" )
public:
TerrainRoadType( void );
// destructor prototypes defined by memory pool object
inline AsciiString getName( void ) { return m_name; }
inline AsciiString getTexture( void ) { return m_texture; }
inline Bool isBridge( void ) { return m_isBridge; }
inline UnsignedInt getID( void ) { return m_id; }
inline Real getRoadWidth( void ) { return m_roadWidth; }
inline Real getRoadWidthInTexture( void ) { return m_roadWidthInTexture; }
inline Real getBridgeScale( void ) { return m_bridgeScale; }
inline AsciiString getScaffoldObjectName( void ) { return m_scaffoldObjectName; }
inline AsciiString getScaffoldSupportObjectName( void ) { return m_scaffoldSupportObjectName; }
inline RGBColor getRadarColor( void ) { return m_radarColor; }
inline AsciiString getBridgeModel( void ) { return m_bridgeModelName; }
inline AsciiString getBridgeModelNameDamaged( void ) { return m_bridgeModelNameDamaged; }
inline AsciiString getBridgeModelNameReallyDamaged( void ) { return m_bridgeModelNameReallyDamaged; }
inline AsciiString getBridgeModelNameBroken( void ) { return m_bridgeModelNameBroken; }
inline AsciiString getTextureDamaged( void ) { return m_textureDamaged; }
inline AsciiString getTextureReallyDamaged( void ) { return m_textureReallyDamaged; }
inline AsciiString getTextureBroken( void ) { return m_textureBroken; }
inline AsciiString getTowerObjectName( BridgeTowerType tower ) { return m_towerObjectName[ tower ]; }
inline AsciiString getDamageToSoundString( BodyDamageType state ) { return m_damageToSoundString[ state ]; }
inline AsciiString getDamageToOCLString( BodyDamageType state, Int index ) { return m_damageToOCLString[ state ][ index ]; }
inline AsciiString getDamageToFXString( BodyDamageType state, Int index ) { return m_damageToFXString[ state ][ index ]; }
inline AsciiString getRepairedToSoundString( BodyDamageType state ) { return m_repairedToSoundString[ state ]; }
inline AsciiString getRepairedToOCLString( BodyDamageType state, Int index ) { return m_repairedToOCLString[ state ][ index ]; }
inline AsciiString getRepairedToFXString( BodyDamageType state, Int index ) { return m_repairedToFXString[ state ][ index ]; }
inline Real getTransitionEffectsHeight( void ) { return m_transitionEffectsHeight; }
inline Int getNumFXPerType( void ) { return m_numFXPerType; }
// friend access methods to be used by the road collection only!
inline void friend_setName( AsciiString name ) { m_name = name; }
inline void friend_setTexture( AsciiString texture ) { m_texture = texture; }
inline void friend_setBridge( Bool isBridge ) { m_isBridge = isBridge; }
inline void friend_setID( UnsignedInt id ) { m_id = id; }
inline void friend_setNext( TerrainRoadType *next ) { m_next = next; }
inline TerrainRoadType *friend_getNext( void ) { return m_next; }
inline void friend_setRoadWidth( Real width ) { m_roadWidth = width; }
inline void friend_setRoadWidthInTexture( Real width ) { m_roadWidthInTexture = width; }
inline void friend_setBridgeScale( Real scale ) { m_bridgeScale = scale; }
inline void friend_setScaffoldObjectName( AsciiString name ) { m_scaffoldObjectName = name; }
inline void friend_setScaffoldSupportObjectName( AsciiString name ) { m_scaffoldSupportObjectName = name; }
inline void friend_setBridgeModelName( AsciiString name ) { m_bridgeModelName = name; }
inline void friend_setBridgeModelNameDamaged( AsciiString name ) { m_bridgeModelNameDamaged = name; }
inline void friend_setBridgeModelNameReallyDamaged( AsciiString name ) { m_bridgeModelNameReallyDamaged = name; }
inline void friend_setBridgeModelNameBroken( AsciiString name ) { m_bridgeModelNameBroken = name; }
inline void friend_setTextureDamaged( AsciiString texture ) { m_textureDamaged = texture; }
inline void friend_setTextureReallyDamaged( AsciiString texture ) { m_textureReallyDamaged = texture; }
inline void friend_setTextureBroken( AsciiString texture ) { m_textureBroken = texture; }
inline void friend_setTowerObjectName( BridgeTowerType tower, AsciiString name ) { m_towerObjectName[ tower ] = name; }
inline void friend_setDamageToSoundString( BodyDamageType state, AsciiString s ) { m_damageToSoundString[ state ] = s; }
inline void friend_setDamageToOCLString( BodyDamageType state, Int index, AsciiString s ) { m_damageToOCLString[ state ][ index ] = s; }
inline void friend_setDamageToFXString( BodyDamageType state, Int index, AsciiString s ) { m_damageToFXString[ state ][ index ] = s; }
inline void friend_setRepairedToSoundString( BodyDamageType state, AsciiString s ) { m_repairedToSoundString[ state ] = s; }
inline void friend_setRepairedToOCLString( BodyDamageType state, Int index, AsciiString s ) { m_repairedToOCLString[ state ][ index ] = s; }
inline void friend_setRepairedToFXString( BodyDamageType state, Int index, AsciiString s ) { m_repairedToFXString[ state ][ index ] = s; }
inline void friend_setTransitionEffectsHeight( Real height ) { m_transitionEffectsHeight = height; }
inline void friend_setNumFXPerType( Int num ) { m_numFXPerType = num; }
/// get the parsing table for INI
const FieldParse *getRoadFieldParse( void ) { return m_terrainRoadFieldParseTable; }
const FieldParse *getBridgeFieldParse( void ) { return m_terrainBridgeFieldParseTable; }
protected:
AsciiString m_name; ///< entry name
Bool m_isBridge; ///< true if entry is for a bridge
UnsignedInt m_id; ///< unique id
TerrainRoadType *m_next; ///< next in road list
// for parsing from INI
static const FieldParse m_terrainRoadFieldParseTable[]; ///< the parse table for INI definition
static const FieldParse m_terrainBridgeFieldParseTable[]; ///< the parse table for INI definition
static void parseTransitionToOCL( INI *ini, void *instance, void *store, const void *userData );
static void parseTransitionToFX( INI *ini, void *instance, void *store, const void *userData );
//
// *note* I would union the road and bridge data, but unions can't have a copy
// constructor such as the AsciiString does
//
// road data
Real m_roadWidth; ///< width of road
Real m_roadWidthInTexture; ///< width of road in the texture
// bridge data
Real m_bridgeScale; ///< scale for bridge
AsciiString m_scaffoldObjectName; ///< scaffold object name
AsciiString m_scaffoldSupportObjectName; ///< scaffold support object name
RGBColor m_radarColor; ///< color for this bridge on the radar
AsciiString m_bridgeModelName; ///< model name for bridge
AsciiString m_texture; ///< texture filename
AsciiString m_bridgeModelNameDamaged; ///< model name for bridge
AsciiString m_textureDamaged; ///< model name for bridge
AsciiString m_bridgeModelNameReallyDamaged; ///< model name for bridge
AsciiString m_textureReallyDamaged; ///< model name for bridge
AsciiString m_bridgeModelNameBroken; ///< model name for bridge
AsciiString m_textureBroken; ///< model name for bridge
AsciiString m_towerObjectName[ BRIDGE_MAX_TOWERS ]; ///< object names for the targetable towers on the bridge
//
// the following strings are for repair/damage transition events, what sounds to
// play and a collection of OCL and FX lists to play over the bridge area
//
AsciiString m_damageToSoundString[ BODYDAMAGETYPE_COUNT ];
AsciiString m_damageToOCLString[ BODYDAMAGETYPE_COUNT ][ MAX_BRIDGE_BODY_FX ];
AsciiString m_damageToFXString[ BODYDAMAGETYPE_COUNT ][ MAX_BRIDGE_BODY_FX ];
AsciiString m_repairedToSoundString[ BODYDAMAGETYPE_COUNT ];
AsciiString m_repairedToOCLString[ BODYDAMAGETYPE_COUNT ][ MAX_BRIDGE_BODY_FX ];
AsciiString m_repairedToFXString[ BODYDAMAGETYPE_COUNT ][ MAX_BRIDGE_BODY_FX ];
Real m_transitionEffectsHeight;
Int m_numFXPerType; ///< for *each* fx/ocl we will make this many of them on the bridge area
};
//-------------------------------------------------------------------------------------------------
/** Collection of all roads and bridges */
//-------------------------------------------------------------------------------------------------
class TerrainRoadCollection : public SubsystemInterface
{
public:
TerrainRoadCollection( void );
~TerrainRoadCollection( void );
void init() { }
void reset() { }
void update() { }
TerrainRoadType *findRoad( AsciiString name ); ///< find road with matching name
TerrainRoadType *newRoad( AsciiString name ); ///< allocate new road, assing name, and link to list
TerrainRoadType *firstRoad( void ) { return m_roadList; } ///< return first road
TerrainRoadType *nextRoad( TerrainRoadType *road ); ///< get next road
TerrainRoadType *findBridge( AsciiString name ); ///< find bridge with matching name
TerrainRoadType *newBridge( AsciiString name ); ///< allocate new bridge, assign name, and link
TerrainRoadType *firstBridge( void ) { return m_bridgeList; } ///< return first bridge
TerrainRoadType *nextBridge( TerrainRoadType *bridge ); ///< get next bridge
TerrainRoadType *findRoadOrBridge( AsciiString name ); ///< search roads and bridges
protected:
TerrainRoadType *m_roadList; ///< list of available roads
TerrainRoadType *m_bridgeList; ///< list of available bridges
static UnsignedInt m_idCounter; ///< unique id counter when allocating roads/bridges
};
// EXTERNAL ////////////////////////////////////////////////////////////////////////////////////////
extern TerrainRoadCollection *TheTerrainRoads;
#endif // __TERRAINROADS_H_

View File

@@ -0,0 +1,177 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: TerrainVisual.h //////////////////////////////////////////////////////////////////////////
// Interface for visual representation of terrain on the client
// Author: Colin Day, April 2001
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __TERRAINVISUAL_H_
#define __TERRAINVISUAL_H_
#include "Common/Terrain.h"
#include "Common/Snapshot.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class TerrainType;
class WaterHandle;
class Matrix3D;
class Object;
class Drawable;
//-------------------------------------------------------------------------------------------------
/** LOD values for terrain, keep this in sync with TerrainLODNames[] */
//-------------------------------------------------------------------------------------------------
typedef enum _TerrainLOD
{
TERRAIN_LOD_INVALID = 0,
TERRAIN_LOD_MIN = 1, // note that this is less than max
TERRAIN_LOD_STRETCH_NO_CLOUDS = 2,
TERRAIN_LOD_HALF_CLOUDS = 3,
TERRAIN_LOD_NO_CLOUDS = 4,
TERRAIN_LOD_STRETCH_CLOUDS = 5,
TERRAIN_LOD_NO_WATER = 6,
TERRAIN_LOD_MAX = 7, // note that this is larger than min
TERRAIN_LOD_AUTOMATIC = 8,
TERRAIN_LOD_DISABLE = 9,
TERRAIN_LOD_NUM_TYPES // keep this last
} TerrainLOD;
#ifdef DEFINE_TERRAIN_LOD_NAMES
static char * TerrainLODNames[] =
{
"NONE",
"MIN",
"STRETCH_NO_CLOUDS",
"HALF_CLOUDS",
"NO_CLOUDS",
"STRETCH_CLOUDS",
"NO_WATER",
"MAX",
"AUTOMATIC",
"DISABLE",
NULL
};
#endif // end DEFINE_TERRAIN_LOD_NAMES
//-------------------------------------------------------------------------------------------------
/** Device independent implementation for visual terrain */
//-------------------------------------------------------------------------------------------------
class TerrainVisual : public Snapshot,
public SubsystemInterface
{
public:
enum {NumSkyboxTextures = 5};
TerrainVisual();
virtual ~TerrainVisual();
virtual void init( void );
virtual void reset( void );
virtual void update( void );
virtual Bool load( AsciiString filename );
/// get color of texture on the terrain at location specified
virtual void getTerrainColorAt( Real x, Real y, RGBColor *pColor ) = 0;
/// get the terrain tile type at the world location in the (x,y) plane ignoring Z
virtual TerrainType *getTerrainTile( Real x, Real y ) = 0;
/** intersect the ray with the terrain, if a hit occurs TRUE is returned
and the result point on the terrain is returned in "result" */
virtual Bool intersectTerrain( Coord3D *rayStart,
Coord3D *rayEnd,
Coord3D *result ) { return FALSE; }
//
// water methods
//
virtual void enableWaterGrid( Bool enable ) = 0;
/// set min/max height values allowed in water grid pointed to by waterTable
virtual void setWaterGridHeightClamps( const WaterHandle *waterTable, Real minZ, Real maxZ ) = 0;
/// adjust fallof parameters for grid change method
virtual void setWaterAttenuationFactors( const WaterHandle *waterTable, Real a, Real b, Real c, Real range ) = 0;
/// set the water table position and orientation in world space
virtual void setWaterTransform( const WaterHandle *waterTable, Real angle, Real x, Real y, Real z ) = 0;
virtual void setWaterTransform( const Matrix3D *transform ) = 0;
/// get water transform parameters
virtual void getWaterTransform( const WaterHandle *waterTable, Matrix3D *transform ) = 0;
/// water grid resolution spacing
virtual void setWaterGridResolution( const WaterHandle *waterTable, Real gridCellsX, Real gridCellsY, Real cellSize ) = 0;
virtual void getWaterGridResolution( const WaterHandle *waterTable, Real *gridCellsX, Real *gridCellsY, Real *cellSize ) = 0;
/// adjust the water grid in world coords by the delta
virtual void changeWaterHeight( Real x, Real y, Real delta ) = 0;
/// adjust the velocity at a water grid point corresponding to the world x,y
virtual void addWaterVelocity( Real worldX, Real worldY, Real velocity, Real preferredHeight ) = 0;
/// get height of water grid at specified position
virtual Bool getWaterGridHeight( Real worldX, Real worldY, Real *height) = 0;
/// set detail of terrain tracks.
virtual void setTerrainTracksDetail(void)=0;
virtual void setShoreLineDetail(void)=0;
/// Add a bib for an object at location.
virtual void addFactionBib(Object *factionBuilding, Bool highlight, Real extra = 0)=0;
/// Remove a bib.
virtual void removeFactionBib(Object *factionBuilding)=0;
/// Add a bib for a drawable at location.
virtual void addFactionBibDrawable(Drawable *factionBuilding, Bool highlight, Real extra = 0)=0;
/// Remove a bib.
virtual void removeFactionBibDrawable(Drawable *factionBuilding)=0;
virtual void removeAllBibs(void)=0;
virtual void removeBibHighlighting(void)=0;
//
// Modify height.
//
virtual void setRawMapHeight(const ICoord2D *gridPos, Int height)=0;
/// Replace the skybox texture
virtual void replaceSkyboxTextures(const AsciiString *oldTexName[NumSkyboxTextures], const AsciiString *newTexName[NumSkyboxTextures])=0;
protected:
// snapshot methods
virtual void crc( Xfer *xfer );
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void );
AsciiString m_filenameString; ///< file with terrain data
}; // end class TerrainVisual
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern TerrainVisual *TheTerrainVisual; ///< singleton extern
#endif // end __TERRAINVISUAL_H_

View File

@@ -0,0 +1,317 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//----------------------------------------------------------------------------
//
// Project: Generals
//
// File name: GameClient/VideoPlayer.h
//
// Created: 10/22/01
//
//----------------------------------------------------------------------------
#pragma once
#ifndef __GAMECLIENT_VIDEOPLAYER_H_
#define __GAMECLIENT_VIDEOPLAYER_H_
//----------------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------------
#include <lib/BaseType.h>
#include "WWMath/rect.h"
#include "Common/SubsystemInterface.h"
#include "Common/AsciiString.h"
#include "Common/INI.h"
#include "Common/STLTypedefs.h"
//----------------------------------------------------------------------------
// Forward References
//----------------------------------------------------------------------------
struct Video;
class VideoPlayer;
//----------------------------------------------------------------------------
// Type Defines
//----------------------------------------------------------------------------
typedef std::vector<Video> VecVideo;
typedef std::vector<Video>::iterator VecVideoIt;
//----------------------------------------------------------------------------
// Video (Struct)
//----------------------------------------------------------------------------
struct Video
{
AsciiString m_filename; ///< should be filled with the filename on disk
AsciiString m_internalName; ///< should be our internal reference name
AsciiString m_commentForWB;
};
//===============================
// VideoBuffer
//===============================
/**
* Video buffer interface class. The VideoPlayer uses this buffer abstraction
* in order to be able to render a video stream.
*/
//===============================
class VideoBuffer
{
public:
// Enumeration of buffer pixel formats
enum Type
{
TYPE_UNKNOWN,
TYPE_R8G8B8,
TYPE_X8R8G8B8,
TYPE_R5G6B5,
TYPE_X1R5G5B5,
NUM_TYPES
};
protected:
UnsignedInt m_xPos; ///< X pixel buffer offset
UnsignedInt m_yPos; ///< Y pixel buffer offset
UnsignedInt m_width; ///< Buffer visible width
UnsignedInt m_height; ///< Buffer height
UnsignedInt m_textureWidth; ///< Buffer visible width
UnsignedInt m_textureHeight;///< Buffer height
UnsignedInt m_pitch; ///< buffer pitch
Type m_format; ///< buffer pixel format
public:
VideoBuffer( Type format );
virtual ~VideoBuffer() {};
virtual Bool allocate( UnsignedInt width, UnsignedInt Height ) = 0; ///< Allocate buffer
virtual void free( void ) = 0; ///< Free the buffer
virtual void* lock( void ) = 0; ///< Returns memory pointer to start of buffer
virtual void unlock( void ) = 0; ///< Release buffer
virtual Bool valid( void ) = 0; ///< Is the buffer valid to use
UnsignedInt xPos( void ) { return m_xPos;};///< X pixel offset to draw into
UnsignedInt yPos( void ) { return m_yPos;};///< Y pixel offset to draw into
void setPos( UnsignedInt x, UnsignedInt y ) { m_xPos = x; m_yPos = y;}; ///< Set the x and y buffer offset
UnsignedInt width( void ) { return m_width;}; ///< Returns pixel width of visible texture
UnsignedInt height( void ) { return m_height;}; ///< Returns pixel height of visible texture
UnsignedInt textureWidth( void ) { return m_textureWidth;}; ///< Returns pixel width of texture
UnsignedInt textureHeight( void ) { return m_textureHeight;}; ///< Returns pixel height of texture
UnsignedInt pitch( void ) { return m_pitch;}; ///< Returns buffer pitch in bytes
Type format( void ) { return m_format;}; ///< Returns buffer pixel format
RectClass Rect( Real x1, Real y1, Real x2, Real y2 );
};
//===============================
// VideoStreamInterface
//===============================
/**
* Video stream interface class.
*/
//===============================
class VideoStreamInterface
{
friend class VideoPlayerInterface;
protected:
virtual ~VideoStreamInterface(){}; ///< only VideoPlayerInterfaces can create these
public:
virtual VideoStreamInterface* next( void ) = 0; ///< Returns next open stream
virtual void update( void ) = 0; ///< Update stream
virtual void close( void ) = 0; ///< Close and free stream
virtual Bool isFrameReady( void ) = 0; ///< Is the frame ready to be displayed
virtual void frameDecompress( void ) = 0; ///< Render current frame in to buffer
virtual void frameRender( VideoBuffer *buffer ) = 0; ///< Render current frame in to buffer
virtual void frameNext( void ) = 0; ///< Advance to next frame
virtual Int frameIndex( void ) = 0; ///< Returns zero based index of current frame
virtual Int frameCount( void ) = 0; ///< Returns the total number of frames in the stream
virtual void frameGoto( Int index ) = 0; ///< Go to the spcified frame index
virtual Int height( void ) = 0; ///< Return the height of the video
virtual Int width( void ) = 0; ///< Return the width of the video
};
//===============================
// VideoStream
//===============================
class VideoStream : public VideoStreamInterface
{
friend class VideoPlayer;
protected:
VideoPlayer *m_player; ///< Video player we were created with
VideoStream *m_next; ///< Next open stream
VideoStream(); ///< only VideoPlayer can create these
virtual ~VideoStream();
public:
virtual VideoStreamInterface* next( void ); ///< Returns next open stream
virtual void update( void ); ///< Update stream
virtual void close( void ); ///< Close and free stream
virtual Bool isFrameReady( void ); ///< Is the frame ready to be displayed
virtual void frameDecompress( void ); ///< Render current frame in to buffer
virtual void frameRender( VideoBuffer *buffer ); ///< Render current frame in to buffer
virtual void frameNext( void ); ///< Advance to next frame
virtual Int frameIndex( void ); ///< Returns zero based index of current frame
virtual Int frameCount( void ); ///< Returns the total number of frames in the stream
virtual void frameGoto( Int index ); ///< Go to the spcified frame index
virtual Int height( void ); ///< Return the height of the video
virtual Int width( void ); ///< Return the width of the video
};
//===============================
// VideoPlayerInterface
//===============================
/**
* Interface for video playback.
*/
//===============================
class VideoPlayerInterface : public SubsystemInterface
{
public:
virtual void init( void ) = 0; ///< Initialize video playback
virtual void reset( void ) = 0; ///< Reset video playback
virtual void update( void ) = 0; ///< Services all video tasks. Should be called frequently
virtual void deinit( void ) = 0; ///< Close down player
virtual ~VideoPlayerInterface() {};
// service
virtual void loseFocus( void ) = 0; ///< Should be called when application loses focus
virtual void regainFocus( void ) = 0; ///< Should be called when application regains focus
virtual VideoStreamInterface* open( AsciiString movieTitle ) = 0; ///< Open video file for playback
virtual VideoStreamInterface* load( AsciiString movieTitle ) = 0; ///< Load video file in to memory for playback
virtual VideoStreamInterface* firstStream( void ) = 0; ///< Return the first open/loaded video stream
virtual void closeAllStreams( void ) = 0; ///< Close all open streams
virtual void addVideo( Video* videoToAdd ) = 0; ///< Add a video to the list of videos we can play
virtual void removeVideo( Video* videoToRemove ) = 0; ///< Remove a video to the list of videos we can play
virtual Int getNumVideos( void ) = 0; ///< Retrieve info about the number of videos currently listed
virtual const Video* getVideo( AsciiString movieTitle ) = 0; ///< Retrieve info about a movie based on internal name
virtual const Video* getVideo( Int index ) = 0; ///< Retrieve info about a movie based on index
virtual const FieldParse *getFieldParse( void ) const = 0; ///< Return the field parse info
virtual void notifyVideoPlayerOfNewProvider( Bool nowHasValid ) = 0; ///< Notify the video player that they can now ask for an audio handle, or they need to give theirs up.
};
//===============================
// VideoPlayer
//===============================
/**
* Common video playback code.
*/
//===============================
class VideoPlayer : public VideoPlayerInterface
{
protected:
VecVideo mVideosAvailableForPlay;
VideoStream *m_firstStream;
static const FieldParse m_videoFieldParseTable[];
public:
// subsytem requirements
virtual void init( void ); ///< Initialize video playback code
virtual void reset( void ); ///< Reset video playback
virtual void update( void ); ///< Services all audio tasks. Should be called frequently
virtual void deinit( void ); ///< Close down player
VideoPlayer();
~VideoPlayer();
// service
virtual void loseFocus( void ); ///< Should be called when application loses focus
virtual void regainFocus( void ); ///< Should be called when application regains focus
virtual VideoStreamInterface* open( AsciiString movieTitle ); ///< Open video file for playback
virtual VideoStreamInterface* load( AsciiString movieTitle ); ///< Load video file in to memory for playback
virtual VideoStreamInterface* firstStream( void ); ///< Return the first open/loaded video stream
virtual void closeAllStreams( void ); ///< Close all open streams
virtual void addVideo( Video* videoToAdd ); ///< Add a video to the list of videos we can play
virtual void removeVideo( Video* videoToRemove ); ///< Remove a video to the list of videos we can play
virtual Int getNumVideos( void ); ///< Retrieve info about the number of videos currently listed
virtual const Video* getVideo( AsciiString movieTitle ); ///< Retrieve info about a movie based on internal name
virtual const Video* getVideo( Int index ); ///< Retrieve info about a movie based on index
virtual const FieldParse *getFieldParse( void ) const { return m_videoFieldParseTable; } ///< Return the field parse info
virtual void notifyVideoPlayerOfNewProvider( Bool nowHasValid ) { }
// Implementation specific
void remove( VideoStream *stream ); ///< remove stream from active list
};
extern VideoPlayerInterface *TheVideoPlayer;
//----------------------------------------------------------------------------
// Inlining
//----------------------------------------------------------------------------
#endif // __GAMECLIENT_VIDEOPLAYER_H_

View File

@@ -0,0 +1,325 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// View.h /////////////////////////////////////////////////////////////////////////////////////////
// A "view", or window, into the World
// Author: Michael S. Booth, February 2001
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef _VIEW_H_
#define _VIEW_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameType.h"
#include "Common/Snapshot.h"
#include "Lib/BaseType.h"
#include "WW3D2/ColType.h" ///< we don't generally do this, but we need the W3D collision types
#define DEFAULT_VIEW_WIDTH 640
#define DEFAULT_VIEW_HEIGHT 480
#define DEFAULT_VIEW_ORIGIN_X 0
#define DEFAULT_VIEW_ORIGIN_Y 0
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
class Drawable;
class ViewLocation;
class Thing;
class Waypoint;
class LookAtTranslator;
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
enum PickType
{
PICK_TYPE_TERRAIN = COLLISION_TYPE_0,
PICK_TYPE_SELECTABLE = COLLISION_TYPE_1,
PICK_TYPE_SHRUBBERY = COLLISION_TYPE_2,
PICK_TYPE_MINES = COLLISION_TYPE_3, // mines aren't normally selectable, but workers/dozers need to
PICK_TYPE_FORCEATTACKABLE = COLLISION_TYPE_4,
PICK_TYPE_ALL_DRAWABLES = (PICK_TYPE_SELECTABLE | PICK_TYPE_SHRUBBERY | PICK_TYPE_MINES | PICK_TYPE_FORCEATTACKABLE)
};
// ------------------------------------------------------------------------------------------------
/** The implementation of common view functionality. */
// ------------------------------------------------------------------------------------------------
class View : public Snapshot
{
public:
/// Add an impulse force to shake the camera
enum CameraShakeType
{
SHAKE_SUBTLE = 0,
SHAKE_NORMAL,
SHAKE_STRONG,
SHAKE_SEVERE,
SHAKE_CINE_EXTREME, //Added for cinematics ONLY
SHAKE_CINE_INSANE, //Added for cinematics ONLY
SHAKE_COUNT
};
public:
View( void );
virtual ~View( void );
virtual void init( void );
virtual void reset( void );
virtual UnsignedInt getID( void ) { return m_id; }
virtual void setZoomLimited( Bool limit ) { m_zoomLimited = limit; } ///< limit the zoom height
virtual Bool isZoomLimited( void ) { return m_zoomLimited; } ///< get status of zoom limit
/// pick drawable given the screen pixel coords. If force attack, picks bridges as well.
virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ) = 0;
/// all drawables in the 2D screen region will call the 'callback'
virtual Int iterateDrawablesInRegion( IRegion2D *screenRegion,
Bool (*callback)( Drawable *draw, void *userData ),
void *userData ) = 0;
/** project the 4 corners of this view into the world and return each point as a parameter,
the world points are at the requested Z */
virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
Coord3D *bottomLeft, Coord3D *bottomRight,
Real z );
virtual void setWidth( Int width ) { m_width = width; }
virtual Int getWidth( void ) { return m_width; }
virtual void setHeight( Int height ) { m_height = height; }
virtual Int getHeight( void ) { return m_height; }
virtual void setOrigin( Int x, Int y) { m_originX=x; m_originY=y;} ///< Sets location of top-left view corner on display
virtual void getOrigin( Int *x, Int *y) { *x=m_originX; *y=m_originY;} ///< Return location of top-left view corner on display
virtual void forceRedraw() = 0;
virtual void lookAt( const Coord3D *o ); ///< Center the view on the given coordinate
virtual void initHeightForMap( void ) {}; ///< Init the camera height for the map at the current position.
virtual void scrollBy( Coord2D *delta ); ///< Shift the view by the given delta
virtual void moveCameraTo(const Coord3D *o, Int frames, Int shutter, Bool orient) { lookAt( o ); }
virtual void moveCameraAlongWaypointPath(Waypoint *way, Int frames, Int shutter, Bool orient) { }
virtual Bool isCameraMovementFinished( void ) { return TRUE; }
virtual void cameraModFinalZoom(Real finalZoom){}; ///< Final zoom for current camera movement.
virtual void cameraModRollingAverage(Int framesToAverage){}; ///< Number of frames to average movement for current camera movement.
virtual void cameraModFinalTimeMultiplier(Int finalMultiplier){}; ///< Final time multiplier for current camera movement.
virtual void cameraModFinalPitch(Real finalPitch){}; ///< Final pitch for current camera movement.
virtual void cameraModFreezeTime(void){ } ///< Freezes time during the next camera movement.
virtual void cameraModFreezeAngle(void){ } ///< Freezes time during the next camera movement.
virtual void cameraModLookToward(Coord3D *pLoc){} ///< Sets a look at point during camera movement.
virtual void cameraModFinalLookToward(Coord3D *pLoc){} ///< Sets a look at point during camera movement.
virtual void cameraModFinalMoveTo(Coord3D *pLoc){ }; ///< Sets a final move to.
virtual enum FilterModes getViewFilterMode(void) {return (enum FilterModes)0;} ///< Turns on viewport special effect (black & white mode)
virtual enum FilterTypes getViewFilterType(void) {return (enum FilterTypes)0;} ///< Turns on viewport special effect (black & white mode)
virtual Bool setViewFilterMode(enum FilterModes filterMode) { return FALSE; } ///< Turns on viewport special effect (black & white mode)
virtual void setViewFilterPos(const Coord3D *pos) { }; ///< Passes a position to the special effect filter.
virtual Bool setViewFilter( enum FilterTypes filter) { return FALSE;} ///< Turns on viewport special effect (black & white mode)
virtual void setFadeParameters(Int fadeFrames, Int direction) { };
virtual void set3DWireFrameMode(Bool enable) { };
virtual void resetCamera(const Coord3D *location, Int frames) {}; ///< Move camera to location, and reset to default angle & zoom.
virtual void rotateCamera(Real rotations, Int frames) {}; ///< Rotate camera about current viewpoint.
virtual void rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMilliseconds) {}; ///< Rotate camera to face an object, and hold on it
virtual void rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds) {}; ///< Rotate camera to face a location.
virtual Bool isTimeFrozen(void){ return false;} ///< Freezes time during the next camera movement.
virtual Int getTimeMultiplier(void) {return 1;}; ///< Get the time multiplier.
virtual void setTimeMultiplier(Int multiple) {}; ///< Set the time multiplier.
virtual void setDefaultView(Real pitch, Real angle, Real maxHeight) {};
virtual void zoomCamera( Real finalZoom, Int milliseconds ) {};
virtual void pitchCamera( Real finalPitch, Int milliseconds ) {};
virtual void setAngle( Real angle ); ///< Rotate the view around the up axis to the given angle
virtual Real getAngle( void ) { return m_angle; }
virtual void setPitch( Real angle ); ///< Rotate the view around the horizontal axis to the given angle
virtual Real getPitch( void ) { return m_pitchAngle; } ///< Return current camera pitch
virtual void setAngleAndPitchToDefault( void ); ///< Set the view angle back to default
virtual void getPosition(Coord3D *pos) { *pos=m_pos;} ///< Returns position camera is looking at (z will be zero)
virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position
virtual Real getZoom() { return m_zoom; }
virtual void setZoom(Real z) { }
virtual Real getHeightAboveGround() { return m_heightAboveGround; }
virtual void setHeightAboveGround(Real z) { m_heightAboveGround = z; }
virtual void zoomIn( void ); ///< Zoom in, closer to the ground, limit to min
virtual void zoomOut( void ); ///< Zoom out, farther away from the ground, limit to max
virtual void setZoomToDefault( void ) { } ///< Set zoom to default value
virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value
virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height
// for debugging
virtual Real getTerrainHeightUnderCamera() { return m_terrainHeightUnderCamera; }
virtual void setTerrainHeightUnderCamera(Real z) { m_terrainHeightUnderCamera = z; }
virtual Real getCurrentHeightAboveGround() { return m_currentHeightAboveGround; }
virtual void setCurrentHeightAboveGround(Real z) { m_currentHeightAboveGround = z; }
virtual void setFieldOfView( Real angle ) { m_FOV = angle; } ///< Set the horizontal field of view angle
virtual Real getFieldOfView( void ) { return m_FOV; } ///< Get the horizontal field of view angle
virtual Bool worldToScreen( const Coord3D *w, ICoord2D *s ) = 0; ///< Transform world coordinate "w" into screen coordinate "s"
virtual void screenToWorld( const ICoord2D *s, Coord3D *w ) = 0; ///< Transform screen coordinate "s" into world coordinate "w"
virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) = 0; ///< transform screen coord to a point on the 3D terrain
virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) = 0; ///< transform screen point to world point at the specified world Z value
virtual void getLocation ( ViewLocation *location ); ///< write the view's current location in to the view location object
virtual void setLocation ( const ViewLocation *location ); ///< set the view's current location from to the view location object
virtual void drawView( void ) = 0; ///< Render the world visible in this view.
virtual void updateView(void) = 0; ///<called once per frame to determine the final camera and object transforms
virtual ObjectID getCameraLock() const { return m_cameraLock; }
virtual void setCameraLock(ObjectID id) { m_cameraLock = id; m_lockDist = 0.0f; m_lockType = LOCK_FOLLOW; }
virtual void snapToCameraLock( void ) { m_snapImmediate = TRUE; }
enum CameraLockType { LOCK_FOLLOW, LOCK_TETHER };
virtual void setSnapMode( CameraLockType lockType, Real lockDist ) { m_lockType = lockType; m_lockDist = lockDist; }
virtual Drawable *getCameraLockDrawable() const { return m_cameraLockDrawable; }
virtual void setCameraLockDrawable(Drawable *drawable) { m_cameraLockDrawable = drawable; m_lockDist = 0.0f; }
virtual void setMouseLock( Bool mouseLocked ) { m_mouseLocked = mouseLocked; } ///< lock/unlock the mouse input to the tactical view
virtual Bool isMouseLocked( void ) { return m_mouseLocked; } ///< is the mouse input locked to the tactical view?
/// Add an impulse force to shake the camera
virtual void shake( const Coord3D *epicenter, CameraShakeType shakeType ) { };
virtual Real getFXPitch( void ) const { return 1.0f; } ///< returns the FX pitch angle
virtual void forceCameraConstraintRecalc(void) {}
virtual void setGuardBandBias( const Coord2D *gb ) = 0;
protected:
friend class Display;
// snapshot methods
virtual void crc( Xfer *xfer ) { }
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess( void ) { }
void setPosition( const Coord3D *pos ) { m_pos = *pos; }
const Coord3D *getPosition( void ) const { return &m_pos; }
virtual View *prependViewToList( View *list ); ///< Prepend this view to the given list, return the new list
virtual View *getNextView( void ) { return m_next; } ///< Return next view in the set
// **********************************************************************************************
View *m_next; ///< List links used by the Display class
UnsignedInt m_id; ///< Rhe ID of this view
static UnsignedInt m_idNext; ///< Used for allocating view ID's for all views
Coord3D m_pos; ///< Position of this view, in world coordinates
Int m_width, m_height; ///< Dimensions of the view
Int m_originX, m_originY; ///< Location of top/left view corner
Real m_angle; ///< Angle at which view has been rotated about the Z axis
Real m_pitchAngle; ///< Rotation of view direction around horizontal (X) axis
Real m_maxZoom; ///< Largest zoom value (minimum actual zoom)
Real m_minZoom; ///< Smallest zoom value (maximum actual zoom)
Real m_maxHeightAboveGround;
Real m_minHeightAboveGround;
Real m_zoom; ///< Current zoom value
Real m_heightAboveGround; ///< User's desired height above ground
Bool m_zoomLimited; ///< Camera restricted in zoom height
Real m_defaultAngle;
Real m_defaultPitchAngle;
Real m_currentHeightAboveGround; ///< Cached value for debugging
Real m_terrainHeightUnderCamera; ///< Cached value for debugging
ObjectID m_cameraLock; ///< if nonzero, id of object that the camera should follow
Drawable *m_cameraLockDrawable; ///< if nonzero, drawble of object that camera should follow.
CameraLockType m_lockType; ///< are we following or just tethering?
Real m_lockDist; ///< how far can we be when tethered?
Real m_FOV; ///< the current field of view angle
Bool m_mouseLocked; ///< is the mouse input locked to the tactical view?
Bool m_okToAdjustHeight; ///< Should we attempt to adjust camera height?
Bool m_snapImmediate; ///< Should we immediately snap to the object we're following?
Coord2D m_guardBandBias; ///< Exttra beefy margins so huge thins can stay "on-screen"
};
// ------------------------------------------------------------------------------------------------
/** Used to save and restore view position */
// ------------------------------------------------------------------------------------------------
class ViewLocation
{
friend class View;
friend class LookAtTranslator;
protected:
Bool m_valid; ///< Is this location valid
Coord3D m_pos; ///< Position of this view, in world coordinates
Real m_angle; ///< Angle at which view has been rotated about the Z axis
Real m_pitch; ///< Angle at which view has been rotated about the Y axis
Real m_zoom; ///< Current zoom value
public:
ViewLocation()
{
m_valid = FALSE;
//Added By Sadullah Nader
//Initialization(s) inserted
m_pos.zero();
m_angle = m_pitch = m_zoom = 0.0;
//
}
const Coord3D& getPosition() const { return m_pos; }
Bool isValid() const { return m_valid; }
Real getAngle() const { return m_angle; }
Real getPitch() const { return m_pitch; }
Real getZoom() const { return m_zoom; }
void init(Real x, Real y, Real z, Real angle, Real pitch, Real zoom)
{
m_pos.x = x;
m_pos.y = y;
m_pos.z = z;
m_angle = angle;
m_pitch = pitch;
m_zoom = zoom;
m_valid = true;
}
};
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern View *TheTacticalView; ///< the main tactical interface to the game world
#endif // _VIEW_H_

View File

@@ -0,0 +1,117 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Water.h //////////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Water settings
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __WATER_H_
#define __WATER_H_
// INLCLUDES //////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameType.h"
#include "Common/Overridable.h"
#include "Common/Override.h"
//-------------------------------------------------------------------------------------------------
struct FieldParse;
//-------------------------------------------------------------------------------------------------
/** This structures keeps the settings for how our water will look */
//-------------------------------------------------------------------------------------------------
class WaterSetting
{
public:
WaterSetting( void );
virtual ~WaterSetting( void );
/// Get the INI parsing table for loading
const FieldParse *getFieldParse( void ) { return m_waterSettingFieldParseTable; }
static const FieldParse m_waterSettingFieldParseTable[]; ///< the parse table for INI definition
AsciiString m_skyTextureFile;
AsciiString m_waterTextureFile;
Int m_waterRepeatCount;
Real m_skyTexelsPerUnit; //texel density of sky plane (higher value repeats texture more).
RGBAColorInt m_vertex00Diffuse;
RGBAColorInt m_vertex10Diffuse;
RGBAColorInt m_vertex11Diffuse;
RGBAColorInt m_vertex01Diffuse;
RGBAColorInt m_waterDiffuseColor;
RGBAColorInt m_transparentWaterDiffuse;
Real m_uScrollPerMs;
Real m_vScrollPerMs;
};
//-------------------------------------------------------------------------------------------------
/** This structure keeps the transparency and vertex settings, which are the same regardless of the
time of day. They can be overridden on a per-map basis. */
//-------------------------------------------------------------------------------------------------
class WaterTransparencySetting : public Overridable
{
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( WaterTransparencySetting, "WaterTransparencySetting" )
public:
Real m_transparentWaterDepth;
Real m_minWaterOpacity;
AsciiString m_skyboxTextureN;
AsciiString m_skyboxTextureE;
AsciiString m_skyboxTextureS;
AsciiString m_skyboxTextureW;
AsciiString m_skyboxTextureT;
public:
WaterTransparencySetting()
{
m_transparentWaterDepth = 3.0f;
m_minWaterOpacity = 1.0f;
m_skyboxTextureN = "TSMorningN.tga";
m_skyboxTextureE = "TSMorningE.tga";
m_skyboxTextureS = "TSMorningS.tga";
m_skyboxTextureW = "TSMorningW.tga";
m_skyboxTextureT = "TSMorningT.tga";
}
static const FieldParse m_waterTransparencySettingFieldParseTable[]; ///< the parse table for INI definition
/// Get the INI parsing table for loading
const FieldParse *getFieldParse( void ) const { return m_waterTransparencySettingFieldParseTable; }
};
EMPTY_DTOR(WaterTransparencySetting)
// EXTERNAL ///////////////////////////////////////////////////////////////////////////////////////
extern WaterSetting WaterSettings[ TIME_OF_DAY_COUNT ];
extern OVERRIDE<WaterTransparencySetting> TheWaterTransparency;
#endif // __WATER_H_

View File

@@ -0,0 +1,221 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: WinInstanceData.h ////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// Project: RTS3
//
// File name: WinInstanceData.h
//
// Created: Colin Day, July 2001
//
// Desc: The game window instance dat
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __WININSTANCEDATA_H_
#define __WININSTANCEDATA_H_
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "GameClient/DisplayString.h"
#include "GameClient/GameFont.h"
#include "GameClient/Image.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////
class GameWindow;
class VideoBuffer;
// TYPE DEFINES ///////////////////////////////////////////////////////////////
#define WIN_STATE_HILITED 0x00000002 // Mouse is over window or has focus
#define WIN_STATE_SELECTED 0x00000004 // Window has been selected
enum
{
MAX_WINDOW_NAME_LEN = 64,
/** how many elements there are for each of the draw states for the inst
* data of a window, note if you increase this you must update the parsing
* tables make sure you can parse the new fields from the window scrip
* files */
MAX_DRAW_DATA = 9,
MAX_TEXT_LABEL = 128 ///< max length of text label
};
// WinDrawData ----------------------------------------------------------------
//-----------------------------------------------------------------------------
struct WinDrawData
{
const Image *image;
Color color;
Color borderColor;
};
// TextDrawData ---------------------------------------------------------------
//-----------------------------------------------------------------------------
struct TextDrawData
{
Color color; ///< the text color
Color borderColor; ///< outline color
};
// WinInstanceData ------------------------------------------------------------
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
//-----------------------------------------------------------------------------
class WinInstanceData
{
public:
WinInstanceData( void ); ///< constructor automatically runs init()
virtual ~WinInstanceData( void );
void init( void ); ///< initialize default values if desired
// setting text
void setTooltipText( UnicodeString tip ); ///< set tooltip text
void setText( UnicodeString text ); ///< set instance text text
// a couple of nice access methods
UnicodeString getTooltipText( void ); ///< get tooltip text
UnicodeString getText( void ); ///< get instance text
Int getTextLength( void ); ///< get number of chars in instance text
Int getTooltipTextLength( void ); ///< get number of chars in tooltip text
UnsignedInt getStyle( void ); ///< return window style
UnsignedInt getStatus( void ); ///< return widnow status
UnsignedInt getState( void ); ///< return window state
GameWindow *getOwner( void ); ///< return window owner
GameFont *getFont( void ); ///< return window font
DisplayString *getTextDisplayString( void ); ///< return the text display string
DisplayString *getTooltipDisplayString( void ); ///< return the tooltip display string
void setVideoBuffer( VideoBuffer * videoBuffer ); ///< set the videobuffer to display a video frame
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
/** @todo you may want to make these data members protected, they are public
because of the legacy of porting all this code in from Nox, but they
really should be protected and have the rest of the code use access
functions to edit them */
Int m_id; // Id of the window (used mainly for scripts)
Int m_state; // Flags indicating state of window
UnsignedInt m_style; // Flags indicating style of window
UnsignedInt m_status; // Status bits for this window (mirrored in GameWindow)
GameWindow *m_owner;
WinDrawData m_enabledDrawData[ MAX_DRAW_DATA ]; ///< image/color info for enabled state
WinDrawData m_disabledDrawData[ MAX_DRAW_DATA ]; ///< image/color info for disabled state
WinDrawData m_hiliteDrawData[ MAX_DRAW_DATA ]; ///< image/color info for hilite state
TextDrawData m_enabledText; ///< enabled text colors
TextDrawData m_disabledText; ///< disabled text colors
TextDrawData m_hiliteText; ///< hilite text colors
TextDrawData m_imeCompositeText;///< IME composite text colors
ICoord2D m_imageOffset; // dx, dy for blitting bkgnd images
GameFont *m_font; // font which this window should use
AsciiString m_textLabelString; ///< text label from window file if present
AsciiString m_decoratedNameString; ///< window text name from GUIEdit
AsciiString m_tooltipString; ///< tooltip Label from window file if present
AsciiString m_headerTemplateName; ///< name of the template we're going to base our font off of.
Int m_tooltipDelay; ///< desired delay before showing tooltip
DisplayString *m_text; ///< generic text for any window to display
DisplayString *m_tooltip; ///< tooltip for display
//NOTE Video Buffer cannot be transfered to another window.
VideoBuffer *m_videoBuffer; ///< Each window can be made to play a video in it.
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
// NOTE if you add data to this make sure you update winSetInstanceData()
protected:
};
///////////////////////////////////////////////////////////////////////////////
// INLINING ///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
inline UnsignedInt WinInstanceData::getStyle( void ) { return m_style; }
inline UnsignedInt WinInstanceData::getStatus( void ) { return m_status; }
inline UnsignedInt WinInstanceData::getState( void ) { return m_state; }
inline GameWindow *WinInstanceData::getOwner( void ) { return m_owner; }
inline GameFont *WinInstanceData::getFont( void ) { return m_font; }
inline DisplayString *WinInstanceData::getTextDisplayString( void ) { return m_text; }
inline DisplayString *WinInstanceData::getTooltipDisplayString( void ) { return m_tooltip; }
inline UnicodeString WinInstanceData::getTooltipText( void )
{
if( m_tooltip )
return m_tooltip->getText();
return UnicodeString::TheEmptyString;
}
inline UnicodeString WinInstanceData::getText( void )
{
if( m_text )
return m_text->getText();
return UnicodeString::TheEmptyString;
}
inline Int WinInstanceData::getTextLength( void )
{
if( m_text )
return m_text->getTextLength();
return 0;
}
inline Int WinInstanceData::getTooltipTextLength( void )
{
if( m_tooltip )
return m_tooltip->getTextLength();
return 0;
}
// EXTERNALS //////////////////////////////////////////////////////////////////
#endif // __WININSTANCEDATA_H_

View File

@@ -0,0 +1,126 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: WindowLayout.h ///////////////////////////////////////////////////////////////////////////
// Created: Colin Day, September 2001
// Desc: Encapsulation of all windows loaded from a .wnd file for
// purposes of a "shell" layout screen
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __WINDOWLAYOUT_H_
#define __WINDOWLAYOUT_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/GameMemory.h"
#include "GameClient/GameWindow.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class GameWindow;
class WindowLayout;
// TYPE DEFINES ///////////////////////////////////////////////////////////////////////////////////
typedef void (*WindowLayoutInitFunc)( WindowLayout *layout, void *userData );
typedef void (*WindowLayoutUpdateFunc)( WindowLayout *layout, void *userData );
typedef void (*WindowLayoutShutdownFunc)( WindowLayout *layout, void *userData );
//-------------------------------------------------------------------------------------------------
/** The representation of a screen layout loaded from a .wnd layout
* script file */
//-------------------------------------------------------------------------------------------------
class WindowLayout : public MemoryPoolObject
{
// memory pool for screen layouts
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( WindowLayout, "WindowLayoutPool" );
public:
WindowLayout( void );
// ~WindowLayout( void ); ///< defined by memory pool glue
// manipulating screen properties ---------------------------------------------------------------
AsciiString getFilename( void ); ///< return source window filename
Bool load( AsciiString filename ); ///< create windows and load from .wnd file
void hide( Bool hide ); ///< hide/unhide all windows on this screen
Bool isHidden( void ); ///< return visible state of screen
void bringForward( void ); ///< bring all windows in this screen forward
// manipulating window lists --------------------------------------------------------------------
void addWindow( GameWindow *window ); ///< add window to screen
void removeWindow( GameWindow *window ); ///< remove window from screen
void destroyWindows( void ); ///< destroy all windows in this screen
GameWindow *getFirstWindow( void ); ///< get first window in list for screen
// accessing layout callbacks ------------------------------------------------------------------
void runInit( void *userData = NULL ); ///< run the init method if available
void runUpdate( void *userData = NULL ); ///< run the update method if available
void runShutdown( void *userData = NULL ); ///< run the shutdown method if available
void setInit( WindowLayoutInitFunc init ); ///< set the init callback
void setUpdate( WindowLayoutUpdateFunc update ); ///< set the update callback
void setShutdown( WindowLayoutShutdownFunc shutdown); ///< set the shutdown callback
protected:
// internal helpers -----------------------------------------------------------------------------
GameWindow *findWindow( GameWindow *window ); ///< find window in this layout
//===============================================================================================
// protected data ===============================================================================
//===============================================================================================
AsciiString m_filenameString; ///< layout filename
GameWindow *m_windowList; ///< list of windows in this layout
GameWindow *m_windowTail; ///< end of m_windowList
Int m_windowCount; ///< how man windows are in the list
Bool m_hidden; ///< visible state of this screen
//
// These are callbacks you can attach to a "layout file" ... they are not
// automatically called when using the WindowManager to load and create
// the layout. You can incorporate when and where init, shutdown and update should
// be called for any system or code that is uses these window layouts
//
WindowLayoutInitFunc m_init; ///< init callback
WindowLayoutUpdateFunc m_update; ///< update callback
WindowLayoutShutdownFunc m_shutdown; ///< shutdown callback
}; // end class WindowLayout
// INLINING ///////////////////////////////////////////////////////////////////////////////////////
inline AsciiString WindowLayout::getFilename( void ) { return m_filenameString; }
inline GameWindow *WindowLayout::getFirstWindow( void ) { return m_windowList; }
inline Bool WindowLayout::isHidden( void ) { return m_hidden; }
inline void WindowLayout::runInit( void *userData ) { if( m_init ) m_init( this, userData ); }
inline void WindowLayout::runUpdate( void *userData ) { if( m_update ) m_update( this, userData ); }
inline void WindowLayout::runShutdown( void *userData ) { if( m_shutdown ) m_shutdown( this, userData ); }
inline void WindowLayout::setInit( WindowLayoutInitFunc init ) { m_init = init; }
inline void WindowLayout::setUpdate( WindowLayoutUpdateFunc update ) { m_update = update; }
inline void WindowLayout::setShutdown( WindowLayoutShutdownFunc shutdown ) {m_shutdown = shutdown;}
#endif // __WINDOWLAYOUT_H_

View File

@@ -0,0 +1,187 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: WindowVideoManager.h /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Mar 2002
//
// Filename: WindowVideoManager.h
//
// author: Chris Huybregts
//
// purpose:
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __WINDOWVIDEOMANAGER_H_
#define __WINDOWVIDEOMANAGER_H_
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class GameWindow;
class AsciiString;
class VideoStreamInterface;
class VideoBuffer;
//-----------------------------------------------------------------------------
// TYPE DEFINES ///////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
enum WindowVideoPlayType
{
WINDOW_PLAY_MOVIE_ONCE = 0,
WINDOW_PLAY_MOVIE_LOOP,
WINDOW_PLAY_MOVIE_SHOW_LAST_FRAME,
WINDOW_PLAY_MOVIE_COUNT
};
enum WindowVideoStates
{
WINDOW_VIDEO_STATE_START = 0,
WINDOW_VIDEO_STATE_STOP,
WINDOW_VIDEO_STATE_PAUSE,
WINDOW_VIDEO_STATE_PLAY,
WINDOW_VIDEO_STATE_HIDDEN,
WINDOW_VIDEO_STATE_COUNT
};
class WindowVideo
{
public:
WindowVideo( void );
~WindowVideo( void );
VideoStreamInterface *getVideoStream( void );
VideoBuffer *getVideoBuffer( void );
GameWindow *getWin( void );
AsciiString getMovieName( void );
WindowVideoPlayType getPlayType ( void );
WindowVideoStates getState( void );
void setPlayType(WindowVideoPlayType playType);
void setWindowState( WindowVideoStates state );
void init( GameWindow *win, AsciiString movieName, WindowVideoPlayType playType,VideoBuffer *videoBuffer,
VideoStreamInterface *videoStream);
private:
WindowVideoPlayType m_playType;
GameWindow *m_win;
VideoBuffer *m_videoBuffer;
VideoStreamInterface *m_videoStream;
AsciiString m_movieName;
WindowVideoStates m_state;
};
class WindowVideoManager : public SubsystemInterface
{
public:
WindowVideoManager( void );
~WindowVideoManager( void );
// Inhertited from subsystem ====================================================================
virtual void init( void );
virtual void reset( void );
virtual void update( void );
//===============================================================================================
void playMovie( GameWindow *win, AsciiString movieName, WindowVideoPlayType playType );
void hideMovie( GameWindow *win ); ///< If the window becomes hidden while we're playing, stop the movie but test to see if we should resume
void pauseMovie( GameWindow *win ); ///< Pause a movie and display it's current frame
void resumeMovie( GameWindow *win ); ///< If a movie has been stopped, resume it.
void stopMovie( GameWindow *win ); ///< Stop a movie
void stopAndRemoveMovie( GameWindow *win ); ///< Stop a movie, and remove it from the manager
void stopAllMovies( void ); ///< Stop all playing movies
void pauseAllMovies( void ); ///< Pauses all movies on their current frame
void resumeAllMovies( void ); ///< Resume Playing all movies
Int getWinState( GameWindow *win ); ///< return the current state of the window.
private:
typedef const GameWindow* ConstGameWindowPtr;
// use special class for hashing, since std::hash won't compile for arbitrary ptrs
struct hashConstGameWindowPtr
{
size_t operator()(ConstGameWindowPtr p) const
{
std::hash<UnsignedInt> hasher;
return hasher((UnsignedInt)p);
}
};
typedef std::hash_map< ConstGameWindowPtr, WindowVideo *, hashConstGameWindowPtr, std::equal_to<ConstGameWindowPtr> > WindowVideoMap;
WindowVideoMap m_playingVideos; ///< List of currently playin Videos
//WindowVideoMap m_pausedVideos; ///< List of currently paused Videos
Bool m_stopAllMovies; ///< Maintains is we're in a stop all Movies State
Bool m_pauseAllMovies; ///< Maintains if we're in a pause all movies state
};
//-----------------------------------------------------------------------------
// INLINING ///////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
inline VideoStreamInterface *WindowVideo::getVideoStream( void ){ return m_videoStream; };
inline VideoBuffer *WindowVideo::getVideoBuffer( void ){ return m_videoBuffer; };
inline GameWindow *WindowVideo::getWin( void ){ return m_win; };
inline AsciiString WindowVideo::getMovieName( void ){ return m_movieName; };
inline WindowVideoPlayType WindowVideo::getPlayType ( void ){ return m_playType; };
inline WindowVideoStates WindowVideo::getState( void ){ return m_state; };
inline void WindowVideo::setPlayType(WindowVideoPlayType playType){ m_playType = playType; };
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#endif // __WINDOWVIDEOMANAGER_H_

View File

@@ -0,0 +1,46 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: WindowXlat.h ///////////////////////////////////////////////////////////
// Author: Steven Johnson, Dec 2001
#pragma once
#ifndef _H_WindowXlat
#define _H_WindowXlat
#include "GameClient/InGameUI.h"
//-----------------------------------------------------------------------------
class WindowTranslator : public GameMessageTranslator
{
private:
// nothing
public:
WindowTranslator();
~WindowTranslator();
virtual GameMessageDisposition translateGameMessage(const GameMessage *msg);
};
#endif