Colobot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CRobotMain Class Reference

Main class managing the game world. More...

#include <src/level/robotmain.h>

Inheritance diagram for CRobotMain:
Inheritance graph
[legend]

Public Member Functions

 CRobotMain ()
 Constructor of robot application. More...
 
virtual ~CRobotMain ()
 Destructor of robot application. More...
 
Gfx::CCameraGetCamera ()
 
Gfx::CTerrainGetTerrain ()
 
Ui::CInterfaceGetInterface ()
 
Ui::CDisplayTextGetDisplayText ()
 
CPauseManagerGetPauseManager ()
 
void ScenePerso ()
 Load the scene for apperance customization. More...
 
void SetMovieLock (bool lock)
 Management of the lock mode for movies. More...
 
bool GetMovieLock ()
 
bool GetInfoLock ()
 
void SetSatComLock (bool lock)
 Management of the blocking of the call of SatCom. More...
 
bool GetSatComLock ()
 
void SetEditLock (bool lock, bool edit)
 Management of the lock mode for the edition. More...
 
bool GetEditLock ()
 
void SetEditFull (bool full)
 Management of the fullscreen mode during editing. More...
 
bool GetEditFull ()
 
void SetFriendAim (bool friendAim)
 Indicates whether mouse is on an friend object, on which we should not shoot. More...
 
bool GetFriendAim ()
 
bool CreateShortcuts ()
 Create the shortcuts at the top of the screen, if they should be visible. More...
 
void UpdateShortcuts ()
 Update the shortcuts at the top of the screen. More...
 
CObjectSearchHuman ()
 Find the astronaut (OBJECT_HUMAN) object. More...
 
bool SelectObject (CObject *obj, bool displayError=true)
 Select an object. More...
 
CObjectGetSelectObject ()
 Return the object that was selected at the start of the scene. More...
 
CObjectDeselectAll ()
 
void ResetObject ()
 Resets all objects to their original position. More...
 
void UpdateAudio (bool frame)
 Updates the audiotracks. More...
 
void SetMissionResultFromScript (Error result, float delay)
 Set mission result from LevelController script. More...
 
Error CheckEndMission (bool frame)
 Checks if the mission is over. More...
 
Error ProcessEndMissionTake ()
 
Error ProcessEndMissionTakeForGroup (std::vector< CSceneEndCondition *> &endTakes)
 
const std::map< std::string, MinMax > & GetObligatoryTokenList ()
 Returns the list instructions required in CBot program in level. More...
 
void UpdateMap ()
 Updates the map. More...
 
bool GetShowMap ()
 Indicates whether the mini-map is visible. More...
 
MainMovieType GetMainMovie ()
 Returns the type of current movie. More...
 
void FlushDisplayInfo ()
 Clears the display of instructions. More...
 
void StartDisplayInfo (int index, bool movie)
 
void StartDisplayInfo (const std::string &filename, int index)
 Beginning of the displaying of instructions. More...
 
void StopDisplayInfo ()
 End of displaying of instructions. More...
 
char * GetDisplayInfoName (int index)
 Returns the name of the text display. More...
 
void StartSuspend ()
 Beginning of a dialogue during the game. More...
 
void StopSuspend ()
 End of dialogue during the game. More...
 
float GetGameTime ()
 Returns the absolute time of the game. More...
 
const std::string & GetScriptName ()
 
const std::string & GetScriptFile ()
 
bool GetTrainerPilot ()
 Indicates whether it is possible to control a driving robot. More...
 
bool GetFixScene ()
 Indicates whether the scene is fixed, without interaction. More...
 
bool GetShowSoluce ()
 
bool GetSceneSoluce ()
 
bool GetShowAll ()
 
bool GetRadar ()
 
MissionType GetMissionType ()
 
int GetGamerFace ()
 Returns the representation to use for the player. More...
 
int GetGamerGlasses ()
 Returns the representation to use for the player. More...
 
bool GetGamerOnlyHead ()
 Returns the mode with just the head. More...
 
float GetPersoAngle ()
 Returns the angle of presentation. More...
 
void SetLevel (LevelCategory cat, int chap, int rank)
 
LevelCategory GetLevelCategory ()
 
int GetLevelChap ()
 
int GetLevelRank ()
 
std::string GetCustomLevelDir ()
 Returns folder name of the scene that user selected to play. More...
 
void SetReadScene (std::string path)
 
void UpdateChapterPassed ()
 
void StartMusic ()
 Starts music with a mission. More...
 
void UpdatePause (PauseType pause)
 
void UpdatePauseMusic (PauseMusic music)
 
void ClearInterface ()
 Removes hilite and tooltip. More...
 
void ChangeColor ()
 Change the colors and textures. More...
 
bool FreeSpace (Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu)
 Calculates a free space. More...
 
bool FlatFreeSpace (Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu)
 Calculates a flat free space. More...
 
void SaveAllScript ()
 Saves all programs of all the robots. More...
 
void SaveOneScript (CObject *obj)
 Saves all programs of the robot. More...
 
bool SaveFileStack (CObject *obj, FILE *file, int objRank)
 Saves the stack of the program in execution of a robot. More...
 
bool ReadFileStack (CObject *obj, FILE *file, int objRank)
 Resumes the execution stack of the program in a robot. More...
 
std::vector< std::string > GetNewScriptNames (ObjectType type)
 Return list of scripts to load to robot created in BotFactory. More...
 
CScoreboardGetScoreboard ()
 
void SelectPlayer (std::string playerName)
 Changes current player. More...
 
CPlayerProfileGetPlayerProfile ()
 
int CreateSpot (Math::Vector pos, Gfx::Color color)
 Creates a light spot. More...
 
CObjectGetSelect ()
 Find the currently selected object. More...
 
void DisplayError (Error err, CObject *pObj, float time=10.0f)
 
void DisplayError (Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f)
 
void UpdateCustomLevelList ()
 
std::string GetCustomLevelName (int id)
 
const std::vector< std::string > & GetCustomLevelList ()
 
bool IsLoading ()
 Returns true if the game is on the loading screen. More...
 
void StartMissionTimer ()
 
void SetExitAfterMission (bool exit)
 Enable mode where completing mission closes the game. More...
 
bool CanPlayerInteract ()
 Returns true if player can interact with things manually. More...
 
void RemoveFromSelectionHistory (CObject *object)
 
float GetGlobalMagnifyDamage ()
 Returns global magnifyDamage setting. More...
 
void StartDetectEffect (COldObject *object, CObject *target)
 
void SetDebugCrashSpheres (bool draw)
 Enable crash sphere debug rendering. More...
 
bool GetDebugCrashSpheres ()
 Check if crash sphere debug rendering is enabled. More...
 
std::set< int > GetAllTeams ()
 Returns a set of all team IDs in the current level. More...
 
std::set< int > GetAllActiveTeams ()
 Returns a set of all team IDs in the current level that are still active. More...
 

Protected Member Functions

bool EventFrame (const Event &event)
 Advances the entire scene. More...
 
bool EventObject (const Event &event)
 Makes the event for all robots. More...
 
void InitEye ()
 Initializes the view. More...
 
void ShowSaveIndicator (bool show)
 
void CreateScene (bool soluce, bool fixScene, bool resetObject)
 Creates the whole scene. More...
 
void ResetCreate ()
 Resets all objects to their original position. More...
 
void LevelLoadingError (const std::string &error, const std::runtime_error &exception, Phase exitPhase=PHASE_LEVEL_LIST)
 
int CreateLight (Math::Vector direction, Gfx::Color color)
 Creates a directional light. More...
 
void HiliteClear ()
 Removes setting evidence of the object with the mouse hovers over. More...
 
void HiliteObject (Math::Point pos)
 Highlights the object with the mouse hovers over. More...
 
void HiliteFrame (float rTime)
 Highlights the object with the mouse hovers over. More...
 
void CreateTooltip (Math::Point pos, const std::string &text)
 Creates a tooltip. More...
 
void ClearTooltip ()
 Clears the previous tooltip. More...
 
CObjectDetectObject (Math::Point pos)
 Detects the object aimed by the mouse. More...
 
void ChangeCamera ()
 Change the mode of the camera. More...
 
void AbortMovie ()
 Cancels the current movie. More...
 
void SelectOneObject (CObject *obj, bool displayError=true)
 Select an object, without deselecting the previous one. More...
 
void HelpObject ()
 Displays help for an object. More...
 
bool DeselectObject ()
 Switch to previous object. More...
 
void DeleteAllObjects ()
 Quickly removes all objects. More...
 
void UpdateInfoText ()
 Updates the text information. More...
 
void StartDisplayVisit (EventType event)
 Start of the visit instead of an error. More...
 
void FrameVisit (float rTime)
 Move the arrow to visit. More...
 
void StopDisplayVisit ()
 End of the visit instead of an error. More...
 
void ExecuteCmd (const std::string &cmd)
 Executes a command. More...
 
void UpdateSpeedLabel ()
 
void AutosaveRotate ()
 
void Autosave ()
 
void QuickSave ()
 
void QuickLoad ()
 
bool DestroySelectedObject ()
 Deletes the selected object. More...
 
void PushToSelectionHistory (CObject *obj)
 
CObjectPopFromSelectionHistory ()
 
void UpdateDebugCrashSpheres ()
 
void PushToCommandHistory (std::string cmd)
 Adds element to the beginning of command history. More...
 

Protected Attributes

CApplicationm_app = nullptr
 
CEventQueuem_eventQueue = nullptr
 
Gfx::CEnginem_engine = nullptr
 
Gfx::CParticlem_particle = nullptr
 
Gfx::CWaterm_water = nullptr
 
Gfx::CCloudm_cloud = nullptr
 
Gfx::CLightningm_lightning = nullptr
 
Gfx::CPlanetm_planet = nullptr
 
Gfx::COldModelManagerm_oldModelManager = nullptr
 
Gfx::CLightManagerm_lightMan = nullptr
 
CSoundInterfacem_sound = nullptr
 
CInputm_input = nullptr
 
std::unique_ptr< CObjectManagerm_objMan
 
std::unique_ptr< CMainMoviem_movie
 
std::unique_ptr< CPauseManagerm_pause
 
std::unique_ptr< Gfx::CModelManagerm_modelManager
 
std::unique_ptr< Gfx::CTerrainm_terrain
 
std::unique_ptr< Gfx::CCameram_camera
 
std::unique_ptr< Ui::CMainUserInterfacem_ui
 
std::unique_ptr< Ui::CMainShortm_short
 
std::unique_ptr< Ui::CMainMapm_map
 
std::unique_ptr< Ui::CInterfacem_interface
 
std::unique_ptr< Ui::CDisplayInfom_displayInfo
 
std::unique_ptr< Ui::CDisplayTextm_displayText
 
std::unique_ptr< Ui::CDebugMenum_debugMenu
 
std::unique_ptr< CSettingsm_settings
 
std::unique_ptr< CPlayerProfilem_playerProfile
 Progress of loaded player. More...
 
float m_time = 0.0f
 Time since level start, including pause and intro movie. More...
 
float m_gameTime = 0.0f
 Playing time since level start. More...
 
float m_gameTimeAbsolute = 0.0f
 Playing time since level start, not dependent on simulation speed. More...
 
LevelCategory m_levelCategory
 
int m_levelChap = 0
 
int m_levelRank = 0
 
std::string m_levelFile = ""
 if set, loads this file instead of building from category/chap/rank More...
 
std::string m_sceneReadPath
 
float m_winDelay = 0.0f
 
float m_lostDelay = 0.0f
 
bool m_fixScene = false
 
CObjectm_base = nullptr
 
CObjectm_selectObject = nullptr
 
Phase m_phase = PHASE_WELCOME1
 
ActivePausem_userPause = nullptr
 
ActivePausem_focusPause = nullptr
 
ActivePausem_freePhotoPause = nullptr
 
bool m_cmdEdit = false
 
ActivePausem_cmdEditPause = nullptr
 
bool m_cheatSelectInsect = false
 
bool m_cheatShowSoluce = false
 
bool m_cheatAllMission = false
 
bool m_cheatRadar = false
 
bool m_shortCut = false
 
std::string m_audioTrack
 
bool m_audioRepeat = false
 
std::string m_satcomTrack
 
bool m_satcomRepeat = false
 
std::string m_editorTrack
 
bool m_editorRepeat = false
 
int m_movieInfoIndex = 0
 
CObjectm_controller = nullptr
 
MissionType m_missionType = MISSION_NORMAL
 
bool m_immediatSatCom = false
 
bool m_beginSatCom = false
 
bool m_lockedSatCom = false
 
bool m_movieLock = false
 
bool m_satComLock = false
 
bool m_editLock = false
 
bool m_editFull = false
 
bool m_hilite = false
 
bool m_cheatTrainerPilot = false
 
bool m_friendAim = false
 
bool m_resetCreate = false
 
bool m_mapShow = false
 
bool m_mapImage = false
 
char m_mapFilename [100] = {}
 
ActivePausem_suspend = nullptr
 
Math::Point m_tooltipPos
 
std::string m_tooltipName
 
float m_tooltipTime = 0.0f
 
char m_infoFilename [SATCOM_MAX][100] = {}
 
CObjectm_infoObject = nullptr
 
int m_infoUsed = 0
 
ActivePausem_satcomMoviePause = nullptr
 
std::string m_scriptName = ""
 
std::string m_scriptFile = ""
 
std::string m_endingWin = ""
 
std::string m_endingLost = ""
 
bool m_winTerminate = false
 
float m_globalMagnifyDamage = 0.0f
 
bool m_exitAfterMission = false
 
bool m_codeBattleInit = false
 
bool m_codeBattleStarted = false
 
bool m_codeBattleSpectator = true
 Code battle spectator mode, hides object UI, changes camera to CAM_TYPE_PLANE and allows for switching to free camera by clicking outside of any object. More...
 
std::map< int, std::string > m_teamNames
 
std::vector< NewScriptNamem_newScriptName
 
EventType m_visitLast = EVENT_NULL
 
CObjectm_visitObject = nullptr
 
CObjectm_visitArrow = nullptr
 
float m_visitTime = 0.0f
 
float m_visitParticle = 0.0f
 
Math::Vector m_visitPos
 
Math::Vector m_visitPosArrow
 
ActivePausem_visitPause = nullptr
 
std::vector< std::unique_ptr< CSceneEndCondition > > m_endTake
 
bool m_endTakeImmediat = false
 If true, the mission ends immediately after completing the requirements without requiring SpaceShip takeoff. More...
 
long m_endTakeResearch = 0
 
float m_endTakeTimeout = -1.0f
 
bool m_endTakeTeamImmediateWin = false
 
float m_endTakeWinDelay = 0.0f
 
float m_endTakeLostDelay = 0.0f
 
std::map< int, bool > m_teamFinished
 Set to true for teams that have already finished. More...
 
std::vector< std::unique_ptr< CAudioChangeCondition > > m_audioChange
 
std::unique_ptr< CScoreboardm_scoreboard
 
std::map< std::string, MinMaxm_obligatoryTokens
 
int m_build = 0
 Enabled buildings. More...
 
long m_researchEnable = 0
 Available researches. More...
 
std::map< int, int > m_researchDone
 Done researches for each team. More...
 
Error m_missionResult = ERR_OK
 
bool m_missionResultFromScript = false
 true if m_missionResult has been set by LevelController script, this disables normal EndMissionTake processing More...
 
ShowLimit m_showLimit [MAXSHOWLIMIT]
 
std::map< int, Gfx::Colorm_colorNewBot
 
Gfx::Color m_colorNewAlien
 
Gfx::Color m_colorNewGreen
 
Gfx::Color m_colorNewWater
 
float m_colorShiftWater = 0.0f
 
bool m_missionTimerEnabled = false
 
bool m_missionTimerStarted = false
 
float m_missionTimer = 0.0f
 
bool m_autosave = false
 
int m_autosaveInterval = 0
 
int m_autosaveSlots = 0
 
float m_autosaveLast = 0.0f
 
int m_shotSaving = 0
 
std::deque< CObject * > m_selectionHistory
 
bool m_debugCrashSpheres
 
std::deque< std::string > m_commandHistory
 Cheat console command history. More...
 
int m_commandHistoryIndex
 Index of currently selected element in command history. More...
 
std::vector< Viewpointm_viewpoints
 Vector of available viewpoints. More...
 

Phase management

void ChangePhase (Phase phase)
 Changes phase. More...
 
bool ProcessEvent (Event &event)
 Processes an event. More...
 
Phase GetPhase ()
 Changes phase. More...
 

Simulation speed management

void SetSpeed (float speed)
 Changes game speed. More...
 
float GetSpeed ()
 Changes game speed. More...
 

In-world indicators

float GetFlatZoneRadius (Math::Vector center, float maxRadius, CObject *exclu)
 Calculates the maximum radius of a free space. More...
 
void HideDropZone (CObject *metal)
 Hides buildable area when a cube of metal is taken up. More...
 
void ShowDropZone (CObject *metal, CObject *transporter)
 Shows the buildable area when a cube of metal is deposited. More...
 
void FlushShowLimit (int i)
 Erases the boundaries shown. More...
 
void SetShowLimit (int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME)
 Specifies the boundaries to show. More...
 
void StartShowLimit ()
 Mount the boundaries of the selected object. More...
 
void FrameShowLimit (float rTime)
 Advances the boundaries shown. More...
 

Saved game read/write

bool IOIsBusy ()
 Seeks if an object occupies in a spot, to prevent a backup of the game. More...
 
bool IOWriteScene (std::string filename, std::string filecbot, std::string filescreenshot, const std::string &info, bool emergencySave=false)
 Saves the current game. More...
 
void IOWriteSceneFinished ()
 Notifies the user that scene write is finished. More...
 
CObjectIOReadScene (std::string filename, std::string filecbot)
 Resumes some part of the game. More...
 
void IOWriteObject (CLevelParserLine *line, CObject *obj, const std::string &programDir, int objRank)
 Writes an object into the backup file. More...
 
CObjectIOReadObject (CLevelParserLine *line, const std::string &programDir, const std::string &objCounterText, float objectProgress, int objRank=-1)
 Resumes the game. More...
 

Autosave management

void SetAutosave (bool enable)
 
bool GetAutosave ()
 
void SetAutosaveInterval (int interval)
 
int GetAutosaveInterval ()
 
void SetAutosaveSlots (int slots)
 
int GetAutosaveSlots ()
 

Team definition management

const std::string & GetTeamName (int id)
 Returns team name for the given team id. More...
 
bool IsTeamColorDefined (int id)
 Returns true if team-specific colored texture is available. More...
 

EnableBuild/EnableResearch/DoneResearch

Management of enabled buildings, enabled researches, and completed researches

int GetEnableBuild ()
 Get enabled buildings. More...
 
void SetEnableBuild (int enableBuild)
 Set enabled buildings. More...
 
int GetEnableResearch ()
 Get enabled researches. More...
 
void SetEnableResearch (int enableResearch)
 Set enabled researches. More...
 
int GetDoneResearch (int team=0)
 Get done researches. More...
 
void SetDoneResearch (int doneResearch, int team=0)
 Set done researches. More...
 
bool IsBuildingEnabled (BuildType type)
 Check if the given building is enabled. More...
 
bool IsBuildingEnabled (ObjectType type)
 Check if the given building is enabled. More...
 
bool IsResearchEnabled (ResearchType type)
 Check if the given research is enabled. More...
 
bool IsResearchDone (ResearchType type, int team)
 Check if the given research is done. More...
 
void MarkResearchDone (ResearchType type, int team)
 Mark given research as done. More...
 
bool CanBuild (ObjectType type, int team)
 Check if all requirements to build this object are met (EnableBuild + DoneResearch) More...
 
Error CanBuildError (ObjectType type, int team)
 Check if all requirements to build this object are met (EnableBuild + DoneResearch) More...
 
bool CanFactory (ObjectType type, int team)
 Check if all requirements to build this object in BotFactory are met (DoneResearch) More...
 
Error CanFactoryError (ObjectType type, int team)
 Check if all requirements to build this object in BotFactory are met (DoneResearch) More...
 

Code battle interface

void CreateCodeBattleInterface ()
 
void UpdateCodeBattleInterface ()
 
void ApplyCodeBattleInterface ()
 
void DestroyCodeBattleInterface ()
 
void SetCodeBattleSpectatorMode (bool mode)
 
std::string GetNextFromCommandHistory ()
 Returns next/previous element from command history and updates index. More...
 
std::string GetPreviousFromCommandHistory ()
 Returns next/previous element from command history and updates index. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CSingleton< CRobotMain >
static CRobotMainGetInstance ()
 
static CRobotMainGetInstancePointer ()
 
static bool IsCreated ()
 
- Static Protected Attributes inherited from CSingleton< CRobotMain >
static CRobotMainm_instance
 

Detailed Description

Main class managing the game world.

This is the main class of the whole game engine. It's main job is to manage main parts of the gameplay, like loading levels and checking for win conditions, but it's also a place where all things that don't fit elsewhere have landed.

Todo:
In the future, it would be nice to refactor this class to remove as much unrelated stuff as possible

Constructor & Destructor Documentation

◆ CRobotMain()

CRobotMain::CRobotMain ( )

Constructor of robot application.

◆ ~CRobotMain()

CRobotMain::~CRobotMain ( )
virtual

Destructor of robot application.

Member Function Documentation

◆ ChangePhase()

void CRobotMain::ChangePhase ( Phase  phase)

Changes phase.

◆ ProcessEvent()

bool CRobotMain::ProcessEvent ( Event event)

Processes an event.

◆ GetPhase()

Phase CRobotMain::GetPhase ( )

Changes phase.

◆ ScenePerso()

void CRobotMain::ScenePerso ( )

Load the scene for apperance customization.

◆ SetMovieLock()

void CRobotMain::SetMovieLock ( bool  lock)

Management of the lock mode for movies.

◆ SetSatComLock()

void CRobotMain::SetSatComLock ( bool  lock)

Management of the blocking of the call of SatCom.

◆ SetEditLock()

void CRobotMain::SetEditLock ( bool  lock,
bool  edit 
)

Management of the lock mode for the edition.

◆ SetEditFull()

void CRobotMain::SetEditFull ( bool  full)

Management of the fullscreen mode during editing.

◆ SetFriendAim()

void CRobotMain::SetFriendAim ( bool  friendAim)

Indicates whether mouse is on an friend object, on which we should not shoot.

◆ SetSpeed()

void CRobotMain::SetSpeed ( float  speed)

Changes game speed.

◆ GetSpeed()

float CRobotMain::GetSpeed ( )

Changes game speed.

◆ CreateShortcuts()

bool CRobotMain::CreateShortcuts ( )

Create the shortcuts at the top of the screen, if they should be visible.

See also
CMainShort::CreateShortcuts

◆ UpdateShortcuts()

void CRobotMain::UpdateShortcuts ( )

Update the shortcuts at the top of the screen.

See also
CMainShort::UpdateShortcuts

◆ SearchHuman()

CObject * CRobotMain::SearchHuman ( )

Find the astronaut (OBJECT_HUMAN) object.

◆ SelectObject()

bool CRobotMain::SelectObject ( CObject obj,
bool  displayError = true 
)

Select an object.

Parameters
objObject to select
displayErrorIf true and the object is currently in error state, automatically display the error message
Note
This function automatically adds objects to selection history (see PushToSelectionHistory())

◆ GetSelectObject()

CObject * CRobotMain::GetSelectObject ( )

Return the object that was selected at the start of the scene.

◆ DeselectAll()

CObject * CRobotMain::DeselectAll ( )

Deselect currently selected object

Returns
Object that was deselected

◆ ResetObject()

void CRobotMain::ResetObject ( )

Resets all objects to their original position.

◆ UpdateAudio()

void CRobotMain::UpdateAudio ( bool  frame)

Updates the audiotracks.

◆ SetMissionResultFromScript()

void CRobotMain::SetMissionResultFromScript ( Error  result,
float  delay 
)

Set mission result from LevelController script.

◆ CheckEndMission()

Error CRobotMain::CheckEndMission ( bool  frame)

Checks if the mission is over.

◆ ProcessEndMissionTake()

Error CRobotMain::ProcessEndMissionTake ( )

Process EndMissionTake commands, result is stored in m_missionResult If return value is different than ERR_MISSION_NOTERM, assume the mission is finished and pass on the result

◆ GetObligatoryTokenList()

const std::map< std::string, MinMax > & CRobotMain::GetObligatoryTokenList ( )

Returns the list instructions required in CBot program in level.

◆ UpdateMap()

void CRobotMain::UpdateMap ( )

Updates the map.

◆ GetShowMap()

bool CRobotMain::GetShowMap ( )

Indicates whether the mini-map is visible.

◆ GetMainMovie()

MainMovieType CRobotMain::GetMainMovie ( )

Returns the type of current movie.

◆ FlushDisplayInfo()

void CRobotMain::FlushDisplayInfo ( )

Clears the display of instructions.

◆ StartDisplayInfo() [1/2]

void CRobotMain::StartDisplayInfo ( int  index,
bool  movie 
)

Beginning of the displaying of instructions. index: SATCOM_*

◆ StartDisplayInfo() [2/2]

void CRobotMain::StartDisplayInfo ( const std::string &  filename,
int  index 
)

Beginning of the displaying of instructions.

◆ StopDisplayInfo()

void CRobotMain::StopDisplayInfo ( )

End of displaying of instructions.

◆ GetDisplayInfoName()

char * CRobotMain::GetDisplayInfoName ( int  index)

Returns the name of the text display.

◆ StartSuspend()

void CRobotMain::StartSuspend ( )

Beginning of a dialogue during the game.

◆ StopSuspend()

void CRobotMain::StopSuspend ( )

End of dialogue during the game.

◆ GetGameTime()

float CRobotMain::GetGameTime ( )

Returns the absolute time of the game.

◆ GetTrainerPilot()

bool CRobotMain::GetTrainerPilot ( )

Indicates whether it is possible to control a driving robot.

◆ GetFixScene()

bool CRobotMain::GetFixScene ( )

Indicates whether the scene is fixed, without interaction.

◆ GetGamerFace()

int CRobotMain::GetGamerFace ( )

Returns the representation to use for the player.

◆ GetGamerGlasses()

int CRobotMain::GetGamerGlasses ( )

Returns the representation to use for the player.

◆ GetGamerOnlyHead()

bool CRobotMain::GetGamerOnlyHead ( )

Returns the mode with just the head.

◆ GetPersoAngle()

float CRobotMain::GetPersoAngle ( )

Returns the angle of presentation.

◆ GetCustomLevelDir()

std::string CRobotMain::GetCustomLevelDir ( )

Returns folder name of the scene that user selected to play.

◆ StartMusic()

void CRobotMain::StartMusic ( )

Starts music with a mission.

◆ ClearInterface()

void CRobotMain::ClearInterface ( )

Removes hilite and tooltip.

◆ ChangeColor()

void CRobotMain::ChangeColor ( )

Change the colors and textures.

◆ FreeSpace()

bool CRobotMain::FreeSpace ( Math::Vector center,
float  minRadius,
float  maxRadius,
float  space,
CObject exclu 
)

Calculates a free space.

◆ FlatFreeSpace()

bool CRobotMain::FlatFreeSpace ( Math::Vector center,
float  minFlat,
float  minRadius,
float  maxRadius,
float  space,
CObject exclu 
)

Calculates a flat free space.

◆ GetFlatZoneRadius()

float CRobotMain::GetFlatZoneRadius ( Math::Vector  center,
float  maxRadius,
CObject exclu 
)

Calculates the maximum radius of a free space.

◆ HideDropZone()

void CRobotMain::HideDropZone ( CObject metal)

Hides buildable area when a cube of metal is taken up.

◆ ShowDropZone()

void CRobotMain::ShowDropZone ( CObject metal,
CObject transporter 
)

Shows the buildable area when a cube of metal is deposited.

◆ FlushShowLimit()

void CRobotMain::FlushShowLimit ( int  i)

Erases the boundaries shown.

◆ SetShowLimit()

void CRobotMain::SetShowLimit ( int  i,
Gfx::ParticleType  parti,
CObject obj,
Math::Vector  pos,
float  radius,
float  duration = SHOWLIMITTIME 
)

Specifies the boundaries to show.

◆ StartShowLimit()

void CRobotMain::StartShowLimit ( )

Mount the boundaries of the selected object.

◆ FrameShowLimit()

void CRobotMain::FrameShowLimit ( float  rTime)

Advances the boundaries shown.

◆ SaveAllScript()

void CRobotMain::SaveAllScript ( )

Saves all programs of all the robots.

◆ SaveOneScript()

void CRobotMain::SaveOneScript ( CObject obj)

Saves all programs of the robot.

◆ SaveFileStack()

bool CRobotMain::SaveFileStack ( CObject obj,
FILE *  file,
int  objRank 
)

Saves the stack of the program in execution of a robot.

◆ ReadFileStack()

bool CRobotMain::ReadFileStack ( CObject obj,
FILE *  file,
int  objRank 
)

Resumes the execution stack of the program in a robot.

◆ GetNewScriptNames()

std::vector< std::string > CRobotMain::GetNewScriptNames ( ObjectType  type)

Return list of scripts to load to robot created in BotFactory.

◆ GetScoreboard()

CScoreboard * CRobotMain::GetScoreboard ( )

Return the scoreboard manager Note: this may return nullptr if the scoreboard is not enabled!

◆ SelectPlayer()

void CRobotMain::SelectPlayer ( std::string  playerName)

Changes current player.

◆ IOIsBusy()

bool CRobotMain::IOIsBusy ( )

Seeks if an object occupies in a spot, to prevent a backup of the game.

◆ IOWriteScene()

bool CRobotMain::IOWriteScene ( std::string  filename,
std::string  filecbot,
std::string  filescreenshot,
const std::string &  info,
bool  emergencySave = false 
)

Saves the current game.

◆ IOWriteSceneFinished()

void CRobotMain::IOWriteSceneFinished ( )

Notifies the user that scene write is finished.

◆ IOReadScene()

CObject * CRobotMain::IOReadScene ( std::string  filename,
std::string  filecbot 
)

Resumes some part of the game.

◆ IOWriteObject()

void CRobotMain::IOWriteObject ( CLevelParserLine line,
CObject obj,
const std::string &  programDir,
int  objRank 
)

Writes an object into the backup file.

◆ IOReadObject()

CObject * CRobotMain::IOReadObject ( CLevelParserLine line,
const std::string &  programDir,
const std::string &  objCounterText,
float  objectProgress,
int  objRank = -1 
)

Resumes the game.

◆ CreateSpot()

int CRobotMain::CreateSpot ( Math::Vector  pos,
Gfx::Color  color 
)

Creates a light spot.

◆ GetSelect()

CObject * CRobotMain::GetSelect ( )

Find the currently selected object.

◆ IsLoading()

bool CRobotMain::IsLoading ( )

Returns true if the game is on the loading screen.

◆ SetExitAfterMission()

void CRobotMain::SetExitAfterMission ( bool  exit)

Enable mode where completing mission closes the game.

◆ CanPlayerInteract()

bool CRobotMain::CanPlayerInteract ( )

Returns true if player can interact with things manually.

◆ GetTeamName()

const std::string & CRobotMain::GetTeamName ( int  id)

Returns team name for the given team id.

◆ IsTeamColorDefined()

bool CRobotMain::IsTeamColorDefined ( int  id)

Returns true if team-specific colored texture is available.

◆ GetEnableBuild()

int CRobotMain::GetEnableBuild ( )

Get enabled buildings.

Returns
Bitmask of BuildType values

◆ SetEnableBuild()

void CRobotMain::SetEnableBuild ( int  enableBuild)

Set enabled buildings.

Parameters
enableBuildBitmask of BuildType values

◆ GetEnableResearch()

int CRobotMain::GetEnableResearch ( )

Get enabled researches.

Returns
Bitmask of ResearchType values

◆ SetEnableResearch()

void CRobotMain::SetEnableResearch ( int  enableResearch)

Set enabled researches.

Parameters
enableResearchBitmask of ResearchType values

◆ GetDoneResearch()

int CRobotMain::GetDoneResearch ( int  team = 0)

Get done researches.

Parameters
teamTeam to get researches for
Returns
Bitmask of ResearchType values

◆ SetDoneResearch()

void CRobotMain::SetDoneResearch ( int  doneResearch,
int  team = 0 
)

Set done researches.

Parameters
doneResearchBitmask of ResearchType values
teamTeam to set researches for

◆ IsBuildingEnabled() [1/2]

bool CRobotMain::IsBuildingEnabled ( BuildType  type)

Check if the given building is enabled.

◆ IsBuildingEnabled() [2/2]

bool CRobotMain::IsBuildingEnabled ( ObjectType  type)

Check if the given building is enabled.

◆ IsResearchEnabled()

bool CRobotMain::IsResearchEnabled ( ResearchType  type)

Check if the given research is enabled.

◆ IsResearchDone()

bool CRobotMain::IsResearchDone ( ResearchType  type,
int  team 
)

Check if the given research is done.

◆ MarkResearchDone()

void CRobotMain::MarkResearchDone ( ResearchType  type,
int  team 
)

Mark given research as done.

◆ CanBuild()

bool CRobotMain::CanBuild ( ObjectType  type,
int  team 
)
inline

Check if all requirements to build this object are met (EnableBuild + DoneResearch)

Returns
true if the building can be built, false otherwise
See also
CanBuildError() for a version which returns a specific reason for the build being denied

◆ CanBuildError()

Error CRobotMain::CanBuildError ( ObjectType  type,
int  team 
)

Check if all requirements to build this object are met (EnableBuild + DoneResearch)

Returns
One of Error values - ERR_OK if the building can be built, ERR_BUILD_DISABLED or ERR_BUILD_RESEARCH otherwise
See also
CanBuild() for a version which returns a boolean

◆ CanFactory()

bool CRobotMain::CanFactory ( ObjectType  type,
int  team 
)
inline

Check if all requirements to build this object in BotFactory are met (DoneResearch)

Returns
true if the robot can be built, false otherwise
See also
CanFactoryError() for a version which returns a specific reason for the build being denied

◆ CanFactoryError()

Error CRobotMain::CanFactoryError ( ObjectType  type,
int  team 
)

Check if all requirements to build this object in BotFactory are met (DoneResearch)

Returns
One of Error values - ERR_OK if the robot can be built, ERR_BUILD_DISABLED or ERR_BUILD_RESEARCH otherwise
See also
CanFactory() for a version which returns a boolean

◆ GetGlobalMagnifyDamage()

float CRobotMain::GetGlobalMagnifyDamage ( )

Returns global magnifyDamage setting.

◆ SetDebugCrashSpheres()

void CRobotMain::SetDebugCrashSpheres ( bool  draw)

Enable crash sphere debug rendering.

◆ GetDebugCrashSpheres()

bool CRobotMain::GetDebugCrashSpheres ( )

Check if crash sphere debug rendering is enabled.

◆ GetAllTeams()

std::set< int > CRobotMain::GetAllTeams ( )

Returns a set of all team IDs in the current level.

◆ GetAllActiveTeams()

std::set< int > CRobotMain::GetAllActiveTeams ( )

Returns a set of all team IDs in the current level that are still active.

◆ EventFrame()

bool CRobotMain::EventFrame ( const Event event)
protected

Advances the entire scene.

◆ EventObject()

bool CRobotMain::EventObject ( const Event event)
protected

Makes the event for all robots.

◆ InitEye()

void CRobotMain::InitEye ( )
protected

Initializes the view.

◆ CreateScene()

void CRobotMain::CreateScene ( bool  soluce,
bool  fixScene,
bool  resetObject 
)
protected

Creates the whole scene.

Note: This feature may be changed in next releases, Places new viewpoint, which can be selected later in (currently only in Code Battle) UI. Usage: View eye=x; y; z lookat=x; y; z

◆ ResetCreate()

void CRobotMain::ResetCreate ( )
protected

Resets all objects to their original position.

◆ CreateLight()

int CRobotMain::CreateLight ( Math::Vector  direction,
Gfx::Color  color 
)
protected

Creates a directional light.

◆ HiliteClear()

void CRobotMain::HiliteClear ( )
protected

Removes setting evidence of the object with the mouse hovers over.

◆ HiliteObject()

void CRobotMain::HiliteObject ( Math::Point  pos)
protected

Highlights the object with the mouse hovers over.

◆ HiliteFrame()

void CRobotMain::HiliteFrame ( float  rTime)
protected

Highlights the object with the mouse hovers over.

◆ CreateTooltip()

void CRobotMain::CreateTooltip ( Math::Point  pos,
const std::string &  text 
)
protected

Creates a tooltip.

◆ ClearTooltip()

void CRobotMain::ClearTooltip ( )
protected

Clears the previous tooltip.

◆ DetectObject()

CObject * CRobotMain::DetectObject ( Math::Point  pos)
protected

Detects the object aimed by the mouse.

◆ ChangeCamera()

void CRobotMain::ChangeCamera ( )
protected

Change the mode of the camera.

◆ AbortMovie()

void CRobotMain::AbortMovie ( )
protected

Cancels the current movie.

◆ SelectOneObject()

void CRobotMain::SelectOneObject ( CObject obj,
bool  displayError = true 
)
protected

Select an object, without deselecting the previous one.

Selects an object, without attending to deselect the rest.

◆ HelpObject()

void CRobotMain::HelpObject ( )
protected

Displays help for an object.

◆ DeselectObject()

bool CRobotMain::DeselectObject ( )
protected

Switch to previous object.

See also
PopFromSelectionHistory()

◆ DeleteAllObjects()

void CRobotMain::DeleteAllObjects ( )
protected

Quickly removes all objects.

◆ UpdateInfoText()

void CRobotMain::UpdateInfoText ( )
protected

Updates the text information.

◆ StartDisplayVisit()

void CRobotMain::StartDisplayVisit ( EventType  event)
protected

Start of the visit instead of an error.

◆ FrameVisit()

void CRobotMain::FrameVisit ( float  rTime)
protected

Move the arrow to visit.

◆ StopDisplayVisit()

void CRobotMain::StopDisplayVisit ( )
protected

End of the visit instead of an error.

◆ ExecuteCmd()

void CRobotMain::ExecuteCmd ( const std::string &  cmd)
protected

Executes a command.

◆ DestroySelectedObject()

bool CRobotMain::DestroySelectedObject ( )
protected

Deletes the selected object.

◆ PushToCommandHistory()

void CRobotMain::PushToCommandHistory ( std::string  cmd)
protected

Adds element to the beginning of command history.

◆ GetNextFromCommandHistory()

std::string CRobotMain::GetNextFromCommandHistory ( )
protected

Returns next/previous element from command history and updates index.

◆ GetPreviousFromCommandHistory()

std::string CRobotMain::GetPreviousFromCommandHistory ( )
protected

Returns next/previous element from command history and updates index.

Member Data Documentation

◆ m_playerProfile

std::unique_ptr<CPlayerProfile> CRobotMain::m_playerProfile
protected

Progress of loaded player.

◆ m_time

float CRobotMain::m_time = 0.0f
protected

Time since level start, including pause and intro movie.

◆ m_gameTime

float CRobotMain::m_gameTime = 0.0f
protected

Playing time since level start.

◆ m_gameTimeAbsolute

float CRobotMain::m_gameTimeAbsolute = 0.0f
protected

Playing time since level start, not dependent on simulation speed.

◆ m_levelFile

std::string CRobotMain::m_levelFile = ""
protected

if set, loads this file instead of building from category/chap/rank

◆ m_codeBattleSpectator

bool CRobotMain::m_codeBattleSpectator = true
protected

Code battle spectator mode, hides object UI, changes camera to CAM_TYPE_PLANE and allows for switching to free camera by clicking outside of any object.

◆ m_endTakeImmediat

bool CRobotMain::m_endTakeImmediat = false
protected

If true, the mission ends immediately after completing the requirements without requiring SpaceShip takeoff.

◆ m_teamFinished

std::map<int, bool> CRobotMain::m_teamFinished
protected

Set to true for teams that have already finished.

◆ m_scoreboard

std::unique_ptr<CScoreboard> CRobotMain::m_scoreboard
protected

The scoreboard If the scoreboard is not enabled for this level, this will be null

◆ m_build

int CRobotMain::m_build = 0
protected

Enabled buildings.

◆ m_researchEnable

long CRobotMain::m_researchEnable = 0
protected

Available researches.

◆ m_researchDone

std::map<int, int> CRobotMain::m_researchDone
protected

Done researches for each team.

◆ m_missionResultFromScript

bool CRobotMain::m_missionResultFromScript = false
protected

true if m_missionResult has been set by LevelController script, this disables normal EndMissionTake processing

◆ m_commandHistory

std::deque<std::string> CRobotMain::m_commandHistory
protected

Cheat console command history.

◆ m_commandHistoryIndex

int CRobotMain::m_commandHistoryIndex
protected

Index of currently selected element in command history.

◆ m_viewpoints

std::vector<Viewpoint> CRobotMain::m_viewpoints
protected

Vector of available viewpoints.


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