App::cGameModeManager class

The implementation of IGameModeManager; this should only be used for extending and detouring.

Base classes

class IGameModeManager
A manager that takes care of game modes; check IGameMode for more information.
class IMessageListener
An interface that can receive messages sent through the app.
class IVirtual
A default interface that provides a virtual destructor, it should only be used internally.

Public types

struct ModeEntry

Constructors, destructors, conversion operators

cGameModeManager()
~cGameModeManager() virtual

Public functions

auto HandleMessage(uint32_t messageID, void* msg) -> bool override
Called every time a message is received.
auto AddRef() -> int override
auto Release() -> int override
auto Initialize() -> bool override
auto Dispose() -> bool override
auto func14h() -> bool override
auto InitializeModes() -> bool override
Calls the IGameMode::Initialize() method on all the modes in this manager.
auto ClearActiveMode() -> bool override
Sets the active game mode to nullptr.
auto AddGameMode(IGameMode* pMode, uint32_t modeID, const char* pName) -> void override
Adds the given game mode to this manager under the modeID specified.
auto RemoveGameMode(uint32_t modeID) -> bool override
Removes the game mode with the ID specified from this manager.
auto SetActiveMode(uint32_t modeID) -> bool override
Sets the active game mode to be the one with the specified ID.
auto GetActiveMode() -> IGameMode* override
Returns the game mode that is currently in action.
auto GetGameMode(uint32_t modeID) -> IGameMode* override
Gets the game mode in this manager with the specified ID.
auto GetModeIDAt(size_t index) -> uint32_t override
Gets the modeID at the specified index.
auto GetActiveModeID() -> uint32_t override
Gets the modeID of the currently active IGameMode.
auto GetModeCount() -> size_t override
Gets the number of game modes contained in this manager.
auto SetActiveModeAt(size_t index) -> bool override
Sets the active game mode to be the one at the specified index.
auto GetGameModeAt(size_t index) -> IGameMode* override
Gets the IGameMode at the specified index.
auto func48h(int) -> int override
auto SetActiveModeByName(const char* pName) -> bool override
Sets the active game mode to be the one with the specified name.
auto GetCameraManager() -> ICameraManager* override
Gets the ICameraManager instance used in this mode manager, and that manages the active camera of the active game mode.
auto SetViewer(cViewer* pViewer) -> void override
Sets the Viewer instance that is used for rendering the main game frame.
auto GetViewer() -> cViewer* override
Returns the Viewer instance that is being used for rendering the main game frame.

Public variables

int mnRefCount
bool field_10
eastl::vector<ModeEntry> mEntries
int mnActiveIndex
ICameraManagerPtr mpCameraMgr
cViewer* mpViewer

Function documentation

bool App::cGameModeManager::HandleMessage(uint32_t messageID, void* msg) override

Called every time a message is received.

Parameters
messageID The ID of the message received.
msg The data of the message received, it might be nullptr.
Returns Whether the message was handled or not.

Only the messages with an ID this listener signed up for will call this event.

bool App::cGameModeManager::ClearActiveMode() override

Sets the active game mode to nullptr.

Returns True if there was an active context, false otherwise.

The IGameMode::OnExit() method will be called on the active context, and the messages 0x212D3E7 and 0x22D1ADC will be generated.

void App::cGameModeManager::AddGameMode(IGameMode* pMode, uint32_t modeID, const char* pName) override

Adds the given game mode to this manager under the modeID specified.

Parameters
pMode The IGameMode to add.
modeID The ID that uniquely identifies this game mode, and that can be used to access it.
pName The name of this mode.

bool App::cGameModeManager::RemoveGameMode(uint32_t modeID) override

Removes the game mode with the ID specified from this manager.

Parameters
modeID The ID of the mode to remove.
Returns True if the game mode was removed, false if it was not in this manager.

This will call the IGameMode::Dispose() method on the mode.

bool App::cGameModeManager::SetActiveMode(uint32_t modeID) override

Sets the active game mode to be the one with the specified ID.

Parameters
modeID The ID of the game mode to set as active.
Returns True if the mode was found and set active, false otherwise.

If there's already an active mode, the method IGameMode::OnExit(). The method IGameMode::OnEnter() will be called on the mode with the specified ID. A message with ID 0x22D1ADC will be generated.

IGameMode* App::cGameModeManager::GetGameMode(uint32_t modeID) override

Gets the game mode in this manager with the specified ID.

Parameters
modeID The ID of the mode.
Returns The IGameMode with that ID, or nullptr if there is none.

uint32_t App::cGameModeManager::GetModeIDAt(size_t index) override

Gets the modeID at the specified index.

Parameters
index The index of the game modes array.
Returns The ID of the game mode at that index, or 0 if the index is out of bounds.

uint32_t App::cGameModeManager::GetActiveModeID() override

Gets the modeID of the currently active IGameMode.

Returns The ID of the active game mode, or 0 if no mode is active.

bool App::cGameModeManager::SetActiveModeAt(size_t index) override

Sets the active game mode to be the one at the specified index.

Parameters
index The index of the game mode to set as active.
Returns True if the mode was found and set active, false otherwise.

If there's already an active mode, the method IGameMode::OnExit() will be called on it. The method IGameMode::OnEnter() will be called on the mode at the specified index. A message with ID 0x22D1ADC will be generated.

IGameMode* App::cGameModeManager::GetGameModeAt(size_t index) override

Gets the IGameMode at the specified index.

Parameters
index The index of the game modes array.
Returns A pointer to the IGameMode at that index, or nullptr if the index is out of bounds.

bool App::cGameModeManager::SetActiveModeByName(const char* pName) override

Sets the active game mode to be the one with the specified name.

Parameters
pName The name of the game mode to set as active.
Returns True if the mode was found and set active, false otherwise.

If there's already an active mode, the method IGameMode::OnExit() will be called on it. The method IGameMode::OnEnter() will be called on the moed at the specified index. A message with ID 0x22D1ADC will be generated.

void App::cGameModeManager::SetViewer(cViewer* pViewer) override

Sets the Viewer instance that is used for rendering the main game frame.

Parameters
pViewer The Viewer instance.