RigsofRods
Soft-body Physics Simulation
|
Central game state manager. More...
#include <GameContext.h>
Public Member Functions | |
GameContext () | |
~GameContext () | |
Message queue | |
void | PushMessage (Message m) |
Doesn't guarantee order! Use ChainMessage() if order matters. More... | |
void | ChainMessage (Message m) |
Add to last pushed message's chain. More... | |
bool | HasMessages () |
Message | PopMessage () |
Terrain | |
bool | LoadTerrain (std::string const &filename_part) |
void | UnloadTerrain () |
const TerrainPtr & | GetTerrain () |
Actors | |
ActorPtr | SpawnActor (ActorSpawnRequest &rq) |
void | ModifyActor (ActorModifyRequest &rq) |
void | DeleteActor (ActorPtr actor) |
void | UpdateActors () |
ActorManager * | GetActorManager () |
const ActorPtr & | FetchPrevVehicleOnList () |
const ActorPtr & | FetchNextVehicleOnList () |
ActorPtr | FindActorByCollisionBox (std::string const &ev_src_instance_name, std::string const &box_name) |
void | RespawnLastActor () |
void | SpawnPreselectedActor (std::string const &preset_vehicle, std::string const &preset_veh_config) |
needs Character to exist More... | |
const ActorPtr & | GetPlayerActor () |
const ActorPtr & | GetPrevPlayerActor () |
void | SetPrevPlayerActor (ActorPtr actor) |
void | ChangePlayerActor (ActorPtr actor) |
void | ShowLoaderGUI (int type, const Ogre::String &instance, const Ogre::String &box) |
void | OnLoaderGuiCancel () |
GUI callback. More... | |
void | OnLoaderGuiApply (RoR::LoaderType type, CacheEntryPtr entry, std::string sectionconfig) |
GUI callback. More... | |
Characters | |
| |
void | CreatePlayerCharacter () |
Terrain must be loaded. More... | |
Character * | GetPlayerCharacter () |
CharacterFactory * | GetCharacterFactory () |
Savegames | |
void | LoadScene (std::string const &filename) |
Matching terrain must be already loaded. More... | |
void | SaveScene (std::string const &filename) |
std::string | GetQuicksaveFilename () |
For currently loaded terrain (cvar 'sim_terrain_name') More... | |
std::string | ExtractSceneName (std::string const &filename) |
std::string | ExtractSceneTerrain (std::string const &filename) |
Returns terrain filename. More... | |
void | HandleSavegameHotkeys () |
Gameplay feats (misc.) | |
RaceSystem & | GetRaceSystem () |
RepairMode & | GetRepairMode () |
SceneMouse & | GetSceneMouse () |
void | TeleportPlayer (float x, float z) |
void | UpdateGlobalInputEvents () |
void | UpdateSimInputEvents (float dt) |
void | UpdateSkyInputEvents (float dt) |
void | UpdateCommonInputEvents (float dt) |
void | UpdateAirplaneInputEvents (float dt) |
void | UpdateBoatInputEvents (float dt) |
void | UpdateTruckInputEvents (float dt) |
Private Attributes | |
GameMsgQueue | m_msg_queue |
Message * | m_msg_chain_end = nullptr |
std::mutex | m_msg_mutex |
TerrainPtr | m_terrain |
ActorManager | m_actor_manager |
ActorPtr | m_player_actor |
Actor (vehicle or machine) mounted and controlled by player. More... | |
ActorPtr | m_prev_player_actor |
Previous actor (vehicle or machine) mounted and controlled by player. More... | |
ActorPtr | m_last_spawned_actor |
Last actor spawned by user and still alive. More... | |
CacheEntryPtr | m_last_cache_selection |
Vehicle/load. More... | |
CacheEntryPtr | m_last_skin_selection |
CacheEntryPtr | m_last_tuneup_selection |
Ogre::String | m_last_section_config |
ActorSpawnRequest | m_current_selection |
Context of the loader UI. More... | |
CacheEntryPtr | m_dummy_cache_selection |
CharacterFactory | m_character_factory |
RaceSystem | m_race_system |
RepairMode | m_recovery_mode |
Aka 'advanced repair' or 'interactive reset'. More... | |
SceneMouse | m_scene_mouse |
Mouse interaction with scene. More... | |
Ogre::Timer | m_timer |
Ogre::Vector3 | prev_pos = Ogre::Vector3::ZERO |
Friends | |
class | AppContext |
Central game state manager.
RoR's gameplay is quite simple in structure, it consists of:
Terrain
. this includes static collision objects (or intrusion detection objects), managed by TerrainObjectManager
.ActorManager
. They collide with static terrain and each other. this includes 'fixes' - actors with partially fixed position.CharacterFactory
. they have simplified physics and can climb objects. For convenience and to help manage interactions, this class provides methods to manipulate these elements.CAUTION: PushMessage() doesn't guarantee order of processing: if message handler generates additional messages, it moves the original message at the end of the queue. To illustrate:
Message chaining is for situations where message order must be preserved.
Definition at line 95 of file GameContext.h.
GameContext::GameContext | ( | ) |
Definition at line 52 of file GameContext.cpp.
GameContext::~GameContext | ( | ) |
Definition at line 57 of file GameContext.cpp.
void GameContext::ChainMessage | ( | Message | m | ) |
Add to last pushed message's chain.
Definition at line 72 of file GameContext.cpp.
void GameContext::ChangePlayerActor | ( | ActorPtr | actor | ) |
Definition at line 466 of file GameContext.cpp.
void GameContext::CreatePlayerCharacter | ( | ) |
Terrain must be loaded.
Definition at line 819 of file GameContext.cpp.
void GameContext::DeleteActor | ( | ActorPtr | actor | ) |
Definition at line 417 of file GameContext.cpp.
std::string GameContext::ExtractSceneName | ( | std::string const & | filename | ) |
std::string GameContext::ExtractSceneTerrain | ( | std::string const & | filename | ) |
Returns terrain filename.
Definition at line 86 of file Savegame.cpp.
const ActorPtr & GameContext::FetchNextVehicleOnList | ( | ) |
Definition at line 574 of file GameContext.cpp.
const ActorPtr & GameContext::FetchPrevVehicleOnList | ( | ) |
Definition at line 569 of file GameContext.cpp.
ActorPtr GameContext::FindActorByCollisionBox | ( | std::string const & | ev_src_instance_name, |
std::string const & | box_name | ||
) |
Definition at line 584 of file GameContext.cpp.
|
inline |
|
inline |
|
inline |
Character * GameContext::GetPlayerCharacter | ( | ) |
Definition at line 872 of file GameContext.cpp.
|
inline |
std::string GameContext::GetQuicksaveFilename | ( | ) |
For currently loaded terrain (cvar 'sim_terrain_name')
Definition at line 55 of file Savegame.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
void GameContext::HandleSavegameHotkeys | ( | ) |
Definition at line 98 of file Savegame.cpp.
bool GameContext::HasMessages | ( | ) |
Definition at line 89 of file GameContext.cpp.
void GameContext::LoadScene | ( | std::string const & | filename | ) |
Matching terrain must be already loaded.
Definition at line 63 of file Savegame.cpp.
bool GameContext::LoadTerrain | ( | std::string const & | filename_part | ) |
void GameContext::ModifyActor | ( | ActorModifyRequest & | rq | ) |
Definition at line 357 of file GameContext.cpp.
void GameContext::OnLoaderGuiApply | ( | RoR::LoaderType | type, |
CacheEntryPtr | entry, | ||
std::string | sectionconfig | ||
) |
GUI callback.
Definition at line 683 of file GameContext.cpp.
void GameContext::OnLoaderGuiCancel | ( | ) |
GUI callback.
Definition at line 667 of file GameContext.cpp.
Message GameContext::PopMessage | ( | ) |
void GameContext::PushMessage | ( | Message | m | ) |
Doesn't guarantee order! Use ChainMessage() if order matters.
Definition at line 65 of file GameContext.cpp.
void GameContext::RespawnLastActor | ( | ) |
Definition at line 590 of file GameContext.cpp.
void GameContext::SaveScene | ( | std::string const & | filename | ) |
void GameContext::SetPrevPlayerActor | ( | ActorPtr | actor | ) |
void GameContext::ShowLoaderGUI | ( | int | type, |
const Ogre::String & | instance, | ||
const Ogre::String & | box | ||
) |
Definition at line 639 of file GameContext.cpp.
ActorPtr GameContext::SpawnActor | ( | ActorSpawnRequest & | rq | ) |
Definition at line 190 of file GameContext.cpp.
void GameContext::SpawnPreselectedActor | ( | std::string const & | preset_vehicle, |
std::string const & | preset_veh_config | ||
) |
needs Character
to exist
Definition at line 603 of file GameContext.cpp.
void GameContext::TeleportPlayer | ( | float | x, |
float | z | ||
) |
Definition at line 880 of file GameContext.cpp.
void GameContext::UnloadTerrain | ( | ) |
Definition at line 176 of file GameContext.cpp.
void GameContext::UpdateActors | ( | ) |
Definition at line 579 of file GameContext.cpp.
void GameContext::UpdateAirplaneInputEvents | ( | float | dt | ) |
Definition at line 1537 of file GameContext.cpp.
void GameContext::UpdateBoatInputEvents | ( | float | dt | ) |
Definition at line 1725 of file GameContext.cpp.
void GameContext::UpdateCommonInputEvents | ( | float | dt | ) |
Definition at line 1255 of file GameContext.cpp.
void GameContext::UpdateGlobalInputEvents | ( | ) |
Definition at line 918 of file GameContext.cpp.
void GameContext::UpdateSimInputEvents | ( | float | dt | ) |
Definition at line 1033 of file GameContext.cpp.
void GameContext::UpdateSkyInputEvents | ( | float | dt | ) |
Definition at line 1191 of file GameContext.cpp.
void GameContext::UpdateTruckInputEvents | ( | float | dt | ) |
Definition at line 1785 of file GameContext.cpp.
|
friend |
Definition at line 97 of file GameContext.h.
|
private |
Definition at line 192 of file GameContext.h.
|
private |
Definition at line 205 of file GameContext.h.
|
private |
Context of the loader UI.
Definition at line 201 of file GameContext.h.
|
private |
Definition at line 202 of file GameContext.h.
|
private |
Vehicle/load.
Definition at line 197 of file GameContext.h.
|
private |
Definition at line 200 of file GameContext.h.
|
private |
Definition at line 198 of file GameContext.h.
|
private |
Last actor spawned by user and still alive.
Definition at line 195 of file GameContext.h.
|
private |
Definition at line 199 of file GameContext.h.
|
private |
Definition at line 185 of file GameContext.h.
|
private |
Definition at line 186 of file GameContext.h.
|
private |
Definition at line 184 of file GameContext.h.
|
private |
Actor (vehicle or machine) mounted and controlled by player.
Definition at line 193 of file GameContext.h.
|
private |
Previous actor (vehicle or machine) mounted and controlled by player.
Definition at line 194 of file GameContext.h.
|
private |
Definition at line 208 of file GameContext.h.
|
private |
Aka 'advanced repair' or 'interactive reset'.
Definition at line 209 of file GameContext.h.
|
private |
Mouse interaction with scene.
Definition at line 210 of file GameContext.h.
|
private |
Definition at line 189 of file GameContext.h.
|
private |
Definition at line 211 of file GameContext.h.
|
private |
Definition at line 212 of file GameContext.h.