Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
GameClient Class Referenceabstract

#include <GameClient.h>

Inherits SubsystemInterface, and Snapshot.

Inherited by W3DGameClient.

Public Member Functions

 GameClient ()
 
virtual ~GameClient ()
 
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)
 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 DrawablefindDrawableByID (const DrawableID id)
 Given an ID, return the associated drawable.
 
void setDrawableIDCounter (DrawableID nextDrawableID)
 
DrawableID getDrawableIDCounter (void)
 
virtual DrawablefirstDrawable (void)
 
virtual GameMessage::Type evaluateContextCommand (Drawable *draw, const Coord3D *pos, CommandTranslator::CommandEvaluateType cmdType)
 
void addTextBearingDrawable (Drawable *tbd)
 
void flushTextBearingDrawables (void)
 
void updateFakeDrawables (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 Drawablefriend_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)
 Returns the current simulation frame number.
 
virtual void setTeamColor (Int red, Int green, Int blue)=0
 
virtual void adjustLOD (Int adj)=0
 
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 DrawablegetDrawableList (void)
 
void resetRenderedObjectCount ()
 
UnsignedInt getRenderedObjectCount () const
 
void incrementRenderedObjectCount ()
 
virtual void notifyTerrainObjectMoved (Object *obj)=0
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Types

enum  { MAX_CLIENT_TRANSLATORS = 32 }
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 
DrawableID allocDrawableID (void)
 Returns a new unique drawable id.
 

Protected Attributes

UnsignedInt m_frame
 Simulation frame number from server.
 
Drawablem_drawableList
 All of the drawables in the world.
 
DrawablePtrVector m_drawableVector
 
DrawableID m_nextDrawableID
 For allocating drawable id's.
 
TranslatorID m_translators [MAX_CLIENT_TRANSLATORS]
 translators we have used
 
UnsignedInt m_numTranslators
 number of translators in m_translators[]
 
CommandTranslatorm_commandTranslator
 the command translator on the message stream
 
- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

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.

Definition at line 85 of file GameClient.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
MAX_CLIENT_TRANSLATORS 

Definition at line 174 of file GameClient.h.

Constructor & Destructor Documentation

◆ GameClient()

GameClient::GameClient ( )

Definition at line 98 of file GameClient.cpp.

◆ ~GameClient()

GameClient::~GameClient ( )
virtual
Todo
: TheTerrainVisual used to be the first thing destroyed.

Definition at line 125 of file GameClient.cpp.

Member Function Documentation

◆ addDrawableToLookupTable()

void GameClient::addDrawableToLookupTable ( Drawable * draw)

add drawable ID to hash lookup table

Add drawable to lookup table for fast id searching

Definition at line 857 of file GameClient.cpp.

◆ addScorch()

virtual void GameClient::addScorch ( const Coord3D * pos,
Real radius,
Scorches type )
pure virtual

Implemented in W3DGameClient.

◆ addTextBearingDrawable()

void GameClient::addTextBearingDrawable ( Drawable * tbd)

Definition at line 989 of file GameClient.cpp.

◆ adjustLOD()

virtual void GameClient::adjustLOD ( Int adj)
pure virtual
Todo
hack for evaluation, remove.

Implemented in W3DGameClient.

◆ allocateShadows()

void GameClient::allocateShadows ( void )
virtual

create shadow resources if not already present. Used by Options screen.

create shadow resources if not already present. Used by Options screen.

Definition at line 1048 of file GameClient.cpp.

◆ allocDrawableID()

DrawableID GameClient::allocDrawableID ( void )
protected

Returns a new unique drawable id.


Return a new unique object id.

Todo
Find unused value in current set

Definition at line 486 of file GameClient.cpp.

◆ assignSelectedDrawablesToGroup()

void GameClient::assignSelectedDrawablesToGroup ( Int group)
virtual

assign all selected drawables to the specified group

Definition at line 928 of file GameClient.cpp.

◆ crc()

void GameClient::crc ( Xfer * xfer)
protectedvirtual

CRC

Implements Snapshot.

Definition at line 1610 of file GameClient.cpp.

◆ createRayEffectByTemplate()

virtual void GameClient::createRayEffectByTemplate ( const Coord3D * start,
const Coord3D * end,
const ThingTemplate * tmpl )
pure virtual

create effect needing start and end location

Implemented in W3DGameClient.

◆ destroyDrawable()

void GameClient::destroyDrawable ( Drawable * draw)
virtual

Destroy the given drawable.


Destroy the drawable immediately.

Definition at line 823 of file GameClient.cpp.

◆ evaluateContextCommand()

GameMessage::Type GameClient::evaluateContextCommand ( Drawable * draw,
const Coord3D * pos,
CommandTranslator::CommandEvaluateType cmdType )
virtual

Definition at line 1009 of file GameClient.cpp.

◆ findDrawableByID()

Drawable * GameClient::findDrawableByID ( const DrawableID id)
inlinevirtual

Given an ID, return the associated drawable.


Given an object id, return the associated object. This method is the primary interface for accessing objects, and should be used instead of pointers to "attach" objects to each other.

Definition at line 239 of file GameClient.h.

◆ firstDrawable()

virtual Drawable * GameClient::firstDrawable ( void )
inlinevirtual

Definition at line 110 of file GameClient.h.

◆ flushTextBearingDrawables()

void GameClient::flushTextBearingDrawables ( void )

Definition at line 995 of file GameClient.cpp.

◆ friend_createDrawable()

virtual Drawable * GameClient::friend_createDrawable ( const ThingTemplate * thing,
DrawableStatus statusBits = DRAWABLE_STATUS_NONE )
pure virtual

Implemented in W3DGameClient.

◆ getDrawableIDCounter()

DrawableID GameClient::getDrawableIDCounter ( void )
inline

Definition at line 108 of file GameClient.h.

◆ getDrawableList()

virtual Drawable * GameClient::getDrawableList ( void )
inlinevirtual

Definition at line 149 of file GameClient.h.

◆ getFrame()

virtual UnsignedInt GameClient::getFrame ( void )
inlinevirtual

Returns the current simulation frame number.

Definition at line 138 of file GameClient.h.

◆ getRayEffectData()

void GameClient::getRayEffectData ( Drawable * draw,
RayEffectData * effectData )
virtual

get ray effect data for a drawable

Get the ray effect data for a drawable

Definition at line 1023 of file GameClient.cpp.

◆ getRenderedObjectCount()

UnsignedInt GameClient::getRenderedObjectCount ( ) const
inline

Definition at line 152 of file GameClient.h.

◆ incrementRenderedObjectCount()

void GameClient::incrementRenderedObjectCount ( )
inline

Definition at line 153 of file GameClient.h.

◆ init()

void GameClient::init ( void )
virtual

Initialize resources.

Initialize resources for the game client

Implements SubsystemInterface.

Reimplemented in W3DGameClient.

Definition at line 249 of file GameClient.cpp.

◆ iterateDrawablesInRegion()

void GameClient::iterateDrawablesInRegion ( Region3D * region,
GameClientFuncPtr userFunc,
void * userData )
virtual

Calls userFunc for each drawable contained within the region.


Call the given callback function for each object contained within the given region.

Definition at line 781 of file GameClient.cpp.

◆ loadMap()

Bool GameClient::loadMap ( AsciiString mapName)
virtual

load a map into our scene

Load a map into the game interface

Definition at line 892 of file GameClient.cpp.

◆ loadPostProcess()

void GameClient::loadPostProcess ( void )
protectedvirtual

Load post process

Implements Snapshot.

Definition at line 1592 of file GameClient.cpp.

◆ notifyTerrainObjectMoved()

virtual void GameClient::notifyTerrainObjectMoved ( Object * obj)
pure virtual

Implemented in W3DGameClient.

◆ preloadAssets()

void GameClient::preloadAssets ( TimeOfDay timeOfDay)
virtual

preload assets

Preload assets for the currently loaded map. Those assets include all the damage states for every building loaded, as well as any faction units/structures we can build and all their damage states

Definition at line 1060 of file GameClient.cpp.

◆ registerDrawable()

void GameClient::registerDrawable ( Drawable * draw)
virtual

Given a drawable, register it with the GameClient and give it a unique ID.


Given a drawable, register it with the GameClient and give it a unique ID.

Definition at line 497 of file GameClient.cpp.

◆ releaseShadows()

void GameClient::releaseShadows ( void )
virtual

frees all shadow resources used by this module - used by Options screen.

frees all shadow resources used by this module - used by Options screen.

Definition at line 1040 of file GameClient.cpp.

◆ removeDrawableFromLookupTable()

void GameClient::removeDrawableFromLookupTable ( Drawable * draw)

remove drawable ID from hash lookup table

Remove drawable from lookup table of fast id searching

Definition at line 877 of file GameClient.cpp.

◆ removeFromRayEffects()

void GameClient::removeFromRayEffects ( Drawable * draw)
virtual

remove the drawable from the ray effect system if present

remove the drawble from the ray effects sytem if present

Definition at line 1032 of file GameClient.cpp.

◆ reset()

void GameClient::reset ( void )
virtual

reset system

Reset the game client for a new game

Implements SubsystemInterface.

Reimplemented in W3DGameClient.

Definition at line 450 of file GameClient.cpp.

◆ resetRenderedObjectCount()

void GameClient::resetRenderedObjectCount ( )
inline

Definition at line 151 of file GameClient.h.

◆ selectDrawablesInGroup()

void GameClient::selectDrawablesInGroup ( Int group)
virtual

select all drawables belong to the specifies group

Definition at line 951 of file GameClient.cpp.

◆ setDrawableIDCounter()

void GameClient::setDrawableIDCounter ( DrawableID nextDrawableID)
inline

Definition at line 107 of file GameClient.h.

◆ setFrame()

virtual void GameClient::setFrame ( UnsignedInt frame)
inlinevirtual

Set the GameClient's internal frame number.

Definition at line 99 of file GameClient.h.

◆ setTeamColor()

virtual void GameClient::setTeamColor ( Int red,
Int green,
Int blue )
pure virtual
Todo
superhack for demo, remove!!!

Implemented in W3DGameClient.

◆ setTimeOfDay()

void GameClient::setTimeOfDay ( TimeOfDay tod)
virtual

Tell all the drawables what time of day it is now.

Reimplemented in W3DGameClient.

Definition at line 915 of file GameClient.cpp.

◆ unloadMap()

void GameClient::unloadMap ( AsciiString mapName)
virtual

unload the specified map from our scene

Unload a map from the game interface

Definition at line 907 of file GameClient.cpp.

◆ update()

void GameClient::update ( void )
virtual

Updates the GUI, display, audio, etc.


Redraw all views, update the GUI, play sound effects, etc.

Implements SubsystemInterface.

Reimplemented in W3DGameClient.

Definition at line 513 of file GameClient.cpp.

◆ updateFakeDrawables()

void GameClient::updateFakeDrawables ( void )

Helper function to update fake GLA structures to become visible to certain players. We should only call this during critical moments, such as changing teams, changing to observer, etc.

Definition at line 803 of file GameClient.cpp.

◆ xfer()

void GameClient::xfer ( Xfer * xfer)
protectedvirtual

Xfer method for Game Client Version History: 1: Initial 2: Adding mission briefing history 3: Added block markers around drawable data, no version checking is done and therefore this version breaks compatibility with previous versions. (CBD)

Implements Snapshot.

Definition at line 1362 of file GameClient.cpp.

Member Data Documentation

◆ m_commandTranslator

CommandTranslator* GameClient::m_commandTranslator
protected

the command translator on the message stream

Definition at line 177 of file GameClient.h.

◆ m_drawableList

Drawable* GameClient::m_drawableList
protected

All of the drawables in the world.

Definition at line 167 of file GameClient.h.

◆ m_drawableVector

DrawablePtrVector GameClient::m_drawableVector
protected

Definition at line 169 of file GameClient.h.

◆ m_frame

UnsignedInt GameClient::m_frame
protected

Simulation frame number from server.

Definition at line 165 of file GameClient.h.

◆ m_nextDrawableID

DrawableID GameClient::m_nextDrawableID
protected

For allocating drawable id's.

Definition at line 171 of file GameClient.h.

◆ m_numTranslators

UnsignedInt GameClient::m_numTranslators
protected

number of translators in m_translators[]

Definition at line 176 of file GameClient.h.

◆ m_translators

TranslatorID GameClient::m_translators[MAX_CLIENT_TRANSLATORS]
protected

translators we have used

Definition at line 175 of file GameClient.h.


The documentation for this class was generated from the following files: