Planeshift
psEngine Class Reference

psEngine This is the main class that contains all the object. More...

#include <psengine.h>

Public Types

enum  LoadState {
  LS_NONE, LS_LOAD_SCREEN, LS_INIT_ENGINE, LS_REQUEST_WORLD,
  LS_SETTING_CHARACTERS, LS_CREATE_GUI, LS_DONE, LS_ERROR
}
 

Public Member Functions

void AddLoadingWindowMsg (const csString &msg)
 
void AdjustBrightnessCorrectionDown ()
 Adjust brightness down and inform user. More...
 
void AdjustBrightnessCorrectionUp ()
 Adjust brightness up and inform user. More...
 
bool BackgroundWorldLoading ()
 Whether or not we're background loading. More...
 
void Cleanup ()
 Clean up stuff. More...
 
void Disconnect ()
 Formally disconnects a client and allows time for an info box to be shown. More...
 
void FatalError (const char *msg)
 Shortcut to pawsQuitInfoBox. More...
 
const char * FindCommonString (unsigned int cstr_id)
 FindCommonString. More...
 
csStringID FindCommonStringId (const char *str)
 FindCommonStringId. More...
 
void FinishFrame ()
 Wait to finish drawing the current frame. More...
 
void ForceRefresh ()
 Force the next frame to get drawn. Used when updating LoadWindow. More...
 
ActionHandlerGetActionHandler ()
 
AutoexecGetAutoexec ()
 
float GetBrightnessCorrection ()
 Get the current brightness correlation value. More...
 
psCelClientGetCelClient ()
 
psCharControllerGetCharControl ()
 
psClientCharManagerGetCharManager ()
 
psChatBubblesGetChatBubbles ()
 
CmdHandlerGetCmdHandler ()
 
iConfigManager * GetConfig ()
 
psCSSetupGetCSSetup ()
 
int GetDuelConfirm () const
 Simply returns the duel confirmation setting. More...
 
psEffectManagerGetEffectManager ()
 
iEngine * GetEngine ()
 
iEventNameRegistry * GetEventNameRegistry ()
 
float getFPS ()
 
iGraphics2D * GetG2D ()
 
iGraphics3D * GetG3D ()
 
const char * GetGuildName ()
 Get GuildName. More...
 
psInventoryCacheGetInventoryCache (void)
 get the inventory cache More...
 
float GetKFactor ()
 
iEvent * GetLastEvent ()
 
int getLimitFPS ()
 
iBgLoader * GetLoader ()
 
const char * GetMainPlayerName ()
 Get the main character's name. More...
 
psMainWidgetGetMainWidget ()
 
bool GetMarriageProposal () const
 Simply returns if marriage proposals should be read or automatically ignored. More...
 
ModeHandlerGetModeHandler ()
 
psMouseBindsGetMouseBinds ()
 
ClientMsgHandlerGetMsgHandler ()
 
csStringHashReversible * GetMsgStrings ()
 Get the message strings/common string table. More...
 
bool GetMuteSoundsOnFocusLoss (void) const
 Gets whether sounds should be muted when the application loses focus. More...
 
psNetManagerGetNetManager ()
 
int GetNumChars ()
 Get the number of characters this player should have. More...
 
iObjectRegistry * GetObjectRegistry ()
 
psOptionsGetOptions ()
 
psCameraGetPSCamera ()
 
float GetRandom ()
 
csRandomGen & GetRandomGen ()
 
iSceneManipulate * GetSceneManipulator ()
 
psSlotManagerGetSlotManager ()
 
ClientSongManagerGetSongManager ()
 
iSoundManager * GetSoundManager ()
 
bool GetSoundStatus ()
 Get the status of the sound plugin, if available or not. More...
 
const char * GetTargetPetitioner ()
 
iTextureManager * GetTextureManager ()
 
size_t GetTime ()
 
iVFS * GetVFS ()
 
iVirtualClock * GetVirtualClock ()
 
iDocumentSystem * GetXMLParser ()
 
ZoneHandlerGetZoneHandler ()
 
bool HasLoadedMap () const
 Checks if the client has loaded its map. More...
 
bool Initialize (int level)
 Creates and loads other interfaces. More...
 
bool IsGameLoaded ()
 check if the game has been loaded or not More...
 
bool IsLoggedIn ()
 Logged in? More...
 
bool LoadConfirmationSettings ()
 Confirmation settings for marriage proposals and duels are read from /planeshift/userdata/options/confirmation.xml. More...
 
bool LoadCustomPawsWidgets (const char *filename)
 Loads custom paws widgets that are specified as a list in an xml file. More...
 
void LoadError (bool value)
 Sets the LoadError value. More...
 
void LoadGame ()
 Load game calls LoadWorld and also load characters, cameras, items, etc. More...
 
bool LoadingError ()
 Checks if the client had any errors during the loading state. More...
 
bool LoadPawsWidget (const char *title, const char *filename)
 Loads a widget. More...
 
bool LoadSoundSettings (bool forceDef)
 Loads and applies the sound settings. More...
 
void MuteAllSounds (void)
 Mute all sounds. More...
 
bool Process2D (iEvent &Event)
 
bool Process3D (iEvent &Event)
 
bool ProcessFrame (iEvent &Event)
 
bool ProcessLogic (iEvent &Event)
 Everything is event base for csApp based system. More...
 
 psEngine (iObjectRegistry *object_reg, psCSSetup *CSSetup)
 Default constructor. It calls csApp constructor. More...
 
void QuitClient ()
 Quits client. More...
 
void RegisterDelayedLoader (DelayedLoader *obj)
 
void ResetBrightnessCorrection ()
 Reset brightness and inform user. More...
 
void ResetEngine ()
 Resets the engine to a state in which we can login again, without requiring a reload of the entire application or CS stuff. More...
 
void SetBrightnessCorrection (float B)
 Set the current brightness correlation value. More...
 
void SetDuelConfirm (int confirmType)
 Sets the duel confirm type and updates the confirmation settings XML. More...
 
void SetGuildName (const char *name)
 Set Guild Name here for use with Entity labels. More...
 
void SetKFactor (float K)
 
void setLimitFPS (int)
 
void SetLoadedMap (bool value)
 Sets the HasLoadedMap value. More...
 
void SetLoggedIn (bool v)
 
void SetMarriageProposal (bool ignore)
 Sets if marriage proposals should be ignored and updates the confirmation settings XML. More...
 
void SetMuteSoundsOnFocusLoss (bool value)
 Sets whether sounds should be muted when the application loses focus. More...
 
void SetNumChars (int chars)
 Set the number of characters this player has. More...
 
void SetTargetPetitioner (const char *pet)
 Access the player's petitioner target. More...
 
void StartLoad ()
 Tell the engine to start the load proceedure. More...
 
bool toggleFPS ()
 
void UnmuteAllSounds (void)
 Unmute all sounds. More...
 
void UnregisterDelayedLoader (DelayedLoader *obj)
 
void UpdateLights ()
 
void UpdatePerFrame ()
 Do anything that needs to happen after the frame is rendered each time. More...
 
bool UpdateWindowTitleInformations ()
 Update the window title with the current informations. More...
 
void WriteConfirmationSettings ()
 Confirmation settings for marriage proposals and duels are written to /planeshift/userdata/options/confirmation.xml. More...
 
virtual ~psEngine ()
 Destructor. More...
 

Public Attributes

LoadState loadstate
 
SlotNameHash slotName
 

Static Public Attributes

static csString hwRenderer
 
static csString hwVersion
 
static csString playerName
 

Detailed Description

psEngine This is the main class that contains all the object.

This class responsible for the whole game functionality.

Definition at line 94 of file psengine.h.

Member Enumeration Documentation

Enumerator
LS_NONE 
LS_LOAD_SCREEN 
LS_INIT_ENGINE 
LS_REQUEST_WORLD 
LS_SETTING_CHARACTERS 
LS_CREATE_GUI 
LS_DONE 
LS_ERROR 

Definition at line 97 of file psengine.h.

Constructor & Destructor Documentation

psEngine::psEngine ( iObjectRegistry *  object_reg,
psCSSetup CSSetup 
)

Default constructor. It calls csApp constructor.

virtual psEngine::~psEngine ( )
virtual

Destructor.

Member Function Documentation

void psEngine::AddLoadingWindowMsg ( const csString &  msg)
void psEngine::AdjustBrightnessCorrectionDown ( )

Adjust brightness down and inform user.

void psEngine::AdjustBrightnessCorrectionUp ( )

Adjust brightness up and inform user.

bool psEngine::BackgroundWorldLoading ( )
inline

Whether or not we're background loading.

Definition at line 618 of file psengine.h.

void psEngine::Cleanup ( )

Clean up stuff.

Needs to be called before the engine is destroyed, since some objects owned by the engine require the engine during their destruction.

void psEngine::Disconnect ( )

Formally disconnects a client and allows time for an info box to be shown.

void psEngine::FatalError ( const char *  msg)

Shortcut to pawsQuitInfoBox.

Parameters
msgMessage to display before quiting
const char* psEngine::FindCommonString ( unsigned int  cstr_id)

FindCommonString.

Parameters
cstr_idThe id of the common string to find.
csStringID psEngine::FindCommonStringId ( const char *  str)

FindCommonStringId.

Parameters
[in]strThe string we are looking for
Returns
The id of the common string or csInvalidStringID if not found
void psEngine::FinishFrame ( )
inline

Wait to finish drawing the current frame.

Definition at line 153 of file psengine.h.

void psEngine::ForceRefresh ( )
inline

Force the next frame to get drawn. Used when updating LoadWindow.

Definition at line 553 of file psengine.h.

ActionHandler* psEngine::GetActionHandler ( )
inline

Definition at line 285 of file psengine.h.

Autoexec* psEngine::GetAutoexec ( )
inline

Definition at line 310 of file psengine.h.

float psEngine::GetBrightnessCorrection ( )
inline

Get the current brightness correlation value.

Definition at line 352 of file psengine.h.

psCelClient* psEngine::GetCelClient ( )
inline

Definition at line 261 of file psengine.h.

psCharController* psEngine::GetCharControl ( )
inline

Definition at line 289 of file psengine.h.

psClientCharManager* psEngine::GetCharManager ( )
inline

Definition at line 257 of file psengine.h.

psChatBubbles* psEngine::GetChatBubbles ( )
inline

Definition at line 273 of file psengine.h.

CmdHandler* psEngine::GetCmdHandler ( )
inline

Definition at line 245 of file psengine.h.

iConfigManager* psEngine::GetConfig ( )
inline

< config file

Definition at line 215 of file psengine.h.

psCSSetup* psEngine::GetCSSetup ( )
inline

Definition at line 302 of file psengine.h.

int psEngine::GetDuelConfirm ( ) const
inline

Simply returns the duel confirmation setting.

Returns
duelConfirmation

Definition at line 425 of file psengine.h.

psEffectManager* psEngine::GetEffectManager ( )
inline

Definition at line 269 of file psengine.h.

iEngine* psEngine::GetEngine ( )
inline

Definition at line 187 of file psengine.h.

iEventNameRegistry* psEngine::GetEventNameRegistry ( )
inline

Definition at line 183 of file psengine.h.

float psEngine::getFPS ( )
inline

Definition at line 399 of file psengine.h.

iGraphics2D* psEngine::GetG2D ( )
inline

Definition at line 195 of file psengine.h.

iGraphics3D* psEngine::GetG3D ( )
inline

Definition at line 191 of file psengine.h.

const char* psEngine::GetGuildName ( )
inline

Get GuildName.

Definition at line 565 of file psengine.h.

psInventoryCache* psEngine::GetInventoryCache ( void  )
inline

get the inventory cache

Definition at line 612 of file psengine.h.

float psEngine::GetKFactor ( )
inline

Definition at line 379 of file psengine.h.

iEvent* psEngine::GetLastEvent ( )
inline

Definition at line 388 of file psengine.h.

int psEngine::getLimitFPS ( )
inline

Definition at line 395 of file psengine.h.

iBgLoader* psEngine::GetLoader ( )
inline

Definition at line 219 of file psengine.h.

const char* psEngine::GetMainPlayerName ( )

Get the main character's name.

psMainWidget* psEngine::GetMainWidget ( )
inline

Definition at line 265 of file psengine.h.

bool psEngine::GetMarriageProposal ( ) const
inline

Simply returns if marriage proposals should be read or automatically ignored.

Returns
marriageProposal

Definition at line 443 of file psengine.h.

ModeHandler* psEngine::GetModeHandler ( )
inline

Definition at line 281 of file psengine.h.

psMouseBinds* psEngine::GetMouseBinds ( )
ClientMsgHandler* psEngine::GetMsgHandler ( )
inline

Definition at line 241 of file psengine.h.

csStringHashReversible* psEngine::GetMsgStrings ( )

Get the message strings/common string table.

bool psEngine::GetMuteSoundsOnFocusLoss ( void  ) const
inline

Gets whether sounds should be muted when the application loses focus.

Returns
true if sounds should be muted, false otherwise

Definition at line 573 of file psengine.h.

psNetManager* psEngine::GetNetManager ( )
inline

Definition at line 298 of file psengine.h.

int psEngine::GetNumChars ( )
inline

Get the number of characters this player should have.

Definition at line 541 of file psengine.h.

iObjectRegistry* psEngine::GetObjectRegistry ( )
inline

Definition at line 179 of file psengine.h.

psOptions* psEngine::GetOptions ( )
inline

Definition at line 277 of file psengine.h.

psCamera* psEngine::GetPSCamera ( )
inline

Definition at line 294 of file psengine.h.

float psEngine::GetRandom ( )
inline

Definition at line 236 of file psengine.h.

csRandomGen& psEngine::GetRandomGen ( )
inline

Definition at line 232 of file psengine.h.

iSceneManipulate* psEngine::GetSceneManipulator ( )
inline

Definition at line 223 of file psengine.h.

psSlotManager* psEngine::GetSlotManager ( )
inline

Definition at line 249 of file psengine.h.

ClientSongManager* psEngine::GetSongManager ( )
inline

Definition at line 253 of file psengine.h.

iSoundManager* psEngine::GetSoundManager ( )
inline

Definition at line 227 of file psengine.h.

bool psEngine::GetSoundStatus ( )
inline

Get the status of the sound plugin, if available or not.

Definition at line 606 of file psengine.h.

const char* psEngine::GetTargetPetitioner ( )
inline

Definition at line 323 of file psengine.h.

iTextureManager* psEngine::GetTextureManager ( )
inline

Definition at line 199 of file psengine.h.

size_t psEngine::GetTime ( )
iVFS* psEngine::GetVFS ( )
inline

Definition at line 203 of file psengine.h.

iVirtualClock* psEngine::GetVirtualClock ( )
inline

Definition at line 207 of file psengine.h.

iDocumentSystem* psEngine::GetXMLParser ( )
inline

Definition at line 211 of file psengine.h.

ZoneHandler* psEngine::GetZoneHandler ( )
inline

Definition at line 306 of file psengine.h.

bool psEngine::HasLoadedMap ( ) const
inline

Checks if the client has loaded its map.

Definition at line 470 of file psengine.h.

bool psEngine::Initialize ( int  level)

Creates and loads other interfaces.

There are 2 levels for the setup.

Parameters
levelThe level we want to load At level 0:
  • Various Crystal Space plugins are loaded.
  • Crash/Dump system intialized.
  • Sound manager is loaded.
  • Log system loaded.
  • PAWS windowing system and skins setup.
At level 1:
Returns
True if the level was successful in loading/setting up all components.
bool psEngine::IsGameLoaded ( )
inline

check if the game has been loaded or not

Definition at line 173 of file psengine.h.

bool psEngine::IsLoggedIn ( )
inline

Logged in?

Definition at line 521 of file psengine.h.

bool psEngine::LoadConfirmationSettings ( )

Confirmation settings for marriage proposals and duels are read from /planeshift/userdata/options/confirmation.xml.

Loads confimration settings for duels and marriages

Returns
True on success, False otherwise
bool psEngine::LoadCustomPawsWidgets ( const char *  filename)

Loads custom paws widgets that are specified as a list in an xml file.

Parameters
filenameThe xml file that holds the list of custom widgets.
void psEngine::LoadError ( bool  value)
inline

Sets the LoadError value.

Definition at line 488 of file psengine.h.

void psEngine::LoadGame ( )

Load game calls LoadWorld and also load characters, cameras, items, etc.

bool psEngine::LoadingError ( )
inline

Checks if the client had any errors during the loading state.

Definition at line 482 of file psengine.h.

bool psEngine::LoadPawsWidget ( const char *  title,
const char *  filename 
)

Loads a widget.

Parameters
titleTitle to show in the logs if an error occurs
filenameXML file
Returns
Append this to a var and check it after all loading is done
bool psEngine::LoadSoundSettings ( bool  forceDef)

Loads and applies the sound settings.

Parameters
forceDefTrue if you want to load the default settings
Returns
true if it was successfully done
void psEngine::MuteAllSounds ( void  )

Mute all sounds.

bool psEngine::Process2D ( iEvent &  Event)
bool psEngine::Process3D ( iEvent &  Event)
bool psEngine::ProcessFrame ( iEvent &  Event)
bool psEngine::ProcessLogic ( iEvent &  Event)

Everything is event base for csApp based system.

This method is called when any event is triggered such as when a button is pushed, mouse move, or keyboard pressed.

void psEngine::QuitClient ( )

Quits client.

void psEngine::RegisterDelayedLoader ( DelayedLoader obj)
inline

Definition at line 623 of file psengine.h.

void psEngine::ResetBrightnessCorrection ( )

Reset brightness and inform user.

void psEngine::ResetEngine ( )

Resets the engine to a state in which we can login again, without requiring a reload of the entire application or CS stuff.

void psEngine::SetBrightnessCorrection ( float  B)

Set the current brightness correlation value.

void psEngine::SetDuelConfirm ( int  confirmType)
inline

Sets the duel confirm type and updates the confirmation settings XML.

Sets duel confirm type

Parameters
confirmTypeUpdates duelConfirmation with this value

Definition at line 416 of file psengine.h.

void psEngine::SetGuildName ( const char *  name)
inline

Set Guild Name here for use with Entity labels.

Definition at line 559 of file psengine.h.

void psEngine::SetKFactor ( float  K)
inline

Definition at line 383 of file psengine.h.

void psEngine::setLimitFPS ( int  )
void psEngine::SetLoadedMap ( bool  value)
inline

Sets the HasLoadedMap value.

Definition at line 476 of file psengine.h.

void psEngine::SetLoggedIn ( bool  v)
inline

Definition at line 525 of file psengine.h.

void psEngine::SetMarriageProposal ( bool  ignore)
inline

Sets if marriage proposals should be ignored and updates the confirmation settings XML.

Sets if marriage proposals should be ignored

Parameters
ignoreUpdates marriageProposal with this value

Definition at line 434 of file psengine.h.

void psEngine::SetMuteSoundsOnFocusLoss ( bool  value)
inline

Sets whether sounds should be muted when the application loses focus.

Parameters
valuetrue if sounds should be muted, false otherwise

Definition at line 580 of file psengine.h.

void psEngine::SetNumChars ( int  chars)
inline

Set the number of characters this player has.

Used to wait for full loading of characters in selection screen.

Definition at line 535 of file psengine.h.

void psEngine::SetTargetPetitioner ( const char *  pet)
inline

Access the player's petitioner target.

Definition at line 318 of file psengine.h.

void psEngine::StartLoad ( )
inline

Tell the engine to start the load proceedure.

Definition at line 341 of file psengine.h.

bool psEngine::toggleFPS ( )
inline

Definition at line 404 of file psengine.h.

void psEngine::UnmuteAllSounds ( void  )

Unmute all sounds.

void psEngine::UnregisterDelayedLoader ( DelayedLoader obj)
inline

Definition at line 627 of file psengine.h.

void psEngine::UpdateLights ( )
void psEngine::UpdatePerFrame ( )

Do anything that needs to happen after the frame is rendered each time.

bool psEngine::UpdateWindowTitleInformations ( )

Update the window title with the current informations.

void psEngine::WriteConfirmationSettings ( )

Confirmation settings for marriage proposals and duels are written to /planeshift/userdata/options/confirmation.xml.

Writes confirmation settings for duels and marriages

Member Data Documentation

csString psEngine::hwRenderer
static

Definition at line 632 of file psengine.h.

csString psEngine::hwVersion
static

Definition at line 633 of file psengine.h.

LoadState psEngine::loadstate

Definition at line 345 of file psengine.h.

csString psEngine::playerName
static

Definition at line 634 of file psengine.h.

SlotNameHash psEngine::slotName

Definition at line 509 of file psengine.h.


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