Colobot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CRobotMain Class Reference
Inheritance diagram for CRobotMain:
Inheritance graph
[legend]

Public Member Functions

 CRobotMain ()
 Constructor of robot application.
 
virtual ~CRobotMain ()
 Destructor of robot application.
 
Gfx::CCameraGetCamera ()
 
Gfx::CTerrainGetTerrain ()
 
Ui::CInterfaceGetInterface ()
 
Ui::CDisplayTextGetDisplayText ()
 
void CreateConfigFile ()
 Creates the file colobot.ini at the first time.
 
void LoadConfigFile ()
 
void ResetAfterDeviceChanged ()
 
void ChangePhase (Phase phase)
 Changes phase.
 
bool ProcessEvent (Event &event)
 Processes an event.
 
Phase GetPhase ()
 
bool CreateShortcuts ()
 Creates interface shortcuts to the units.
 
void ScenePerso ()
 Load the scene for the character.
 
void SetMovieLock (bool lock)
 Management of the lock mode for movies.
 
bool GetMovieLock ()
 
bool GetInfoLock ()
 
void SetSatComLock (bool lock)
 Management of the blocking of the call of SatCom.
 
bool GetSatComLock ()
 
void SetEditLock (bool lock, bool edit)
 Management of the lock mode for the edition.
 
bool GetEditLock ()
 
void SetEditFull (bool full)
 Management of the fullscreen mode during editing.
 
bool GetEditFull ()
 
bool GetFreePhoto ()
 
void SetFriendAim (bool friendAim)
 Indicates whether mouse is on an friend object, on which we should not shoot.
 
bool GetFriendAim ()
 
void SetTracePrecision (float factor)
 Management of the precision of drawing the ground.
 
float GetTracePrecision ()
 
void SetSpeed (float speed)
 Changes game speed.
 
float GetSpeed ()
 
void UpdateShortcuts ()
 Updates all the shortcuts.
 
void SelectHuman ()
 Selects the human.
 
CObjectSearchHuman ()
 Returns the object human.
 
CObjectSearchToto ()
 Returns the object toto.
 
CObjectSearchNearest (Math::Vector pos, CObject *pExclu)
 Returns the nearest selectable object from a given position.
 
bool SelectObject (CObject *pObj, bool displayError=true)
 Selects the object aimed by the mouse.
 
CObjectGetSelectObject ()
 Returns the object that default was select after the creation of a scene.
 
CObjectDeselectAll ()
 Deselects everything, and returns the object that was selected.
 
void ResetObject ()
 Resets all objects to their original position.
 
void UpdateAudio (bool frame)
 Updates the audiotracks.
 
void SetEndMission (Error result, float delay)
 
Error CheckEndMission (bool frame)
 Checks if the mission is over.
 
Error CheckEndMissionForGroup (std::vector< CSceneEndCondition * > &endTakes)
 
int GetObligatoryToken ()
 Returns the number of instructions required.
 
char * GetObligatoryToken (int i)
 Returns the name of a required instruction.
 
int IsObligatoryToken (const char *token)
 Checks if an instruction is part of the obligatory list.
 
bool IsProhibitedToken (const char *token)
 Checks if an instruction is not part of the banned list.
 
void UpdateMap ()
 Updates the map.
 
bool GetShowMap ()
 Indicates whether the mini-map is visible.
 
MainMovieType GetMainMovie ()
 Returns the type of current movie.
 
void FlushDisplayInfo ()
 Clears the display of instructions.
 
void StartDisplayInfo (int index, bool movie)
 
void StartDisplayInfo (const std::string &filename, int index)
 Beginning of the displaying of instructions.
 
void StopDisplayInfo ()
 End of displaying of instructions.
 
char * GetDisplayInfoName (int index)
 Returns the name of the text display.
 
int GetDisplayInfoPosition (int index)
 Returns the name of the text display.
 
void SetDisplayInfoPosition (int index, int pos)
 Returns the name of the text display.
 
void StartSuspend ()
 Beginning of a dialogue during the game.
 
void StopSuspend ()
 End of dialogue during the game.
 
float GetGameTime ()
 Returns the absolute time of the game.
 
char * GetTitle ()
 
char * GetResume ()
 
char * GetScriptName ()
 
char * GetScriptFile ()
 
bool GetTrainerPilot ()
 Indicates whether it is possible to control a driving robot.
 
bool GetFixScene ()
 Indicates whether the scene is fixed, without interaction.
 
bool GetInterfaceGlint ()
 
bool GetSoluce4 ()
 
bool GetMovies ()
 
bool GetShowSoluce ()
 
bool GetSceneSoluce ()
 
bool GetShowAll ()
 
bool GetRadar ()
 
MissionType GetMissionType ()
 
int GetGamerFace ()
 Returns the representation to use for the player.
 
int GetGamerGlasses ()
 Returns the representation to use for the player.
 
bool GetGamerOnlyHead ()
 Returns the mode with just the head.
 
float GetPersoAngle ()
 Returns the angle of presentation.
 
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.
 
void SetReadScene (std::string path)
 
void UpdateChapterPassed ()
 
void StartMusic ()
 Starts music with a mission.
 
void UpdatePause (PauseType pause)
 
void ClearInterface ()
 Removes hilite and tooltip.
 
void ChangeColor ()
 Change the colors and textures.
 
float SearchNearestObject (Math::Vector center, CObject *exclu)
 Calculates the distance to the nearest object.
 
bool FreeSpace (Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu)
 Calculates a free space.
 
bool FlatFreeSpace (Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu)
 Calculates a flat free space.
 
float GetFlatZoneRadius (Math::Vector center, float maxRadius, CObject *exclu)
 Calculates the maximum radius of a free space.
 
void HideDropZone (CObject *metal)
 Hides buildable area when a cube of metal is taken up.
 
void ShowDropZone (CObject *metal, CObject *transporter)
 Shows the buildable area when a cube of metal is deposited.
 
void FlushShowLimit (int i)
 Erases the boundaries shown.
 
void SetShowLimit (int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME)
 Specifies the boundaries to show.
 
void StartShowLimit ()
 Mount the boundaries of the selected object.
 
void FrameShowLimit (float rTime)
 Advances the boundaries shown.
 
void SaveAllScript ()
 Saves all programs of all the robots.
 
void SaveOneScript (CObject *pObj)
 Saves all programs of the robot.
 
bool SaveFileStack (CObject *pObj, FILE *file, int objRank)
 Saves the stack of the program in execution of a robot.
 
bool ReadFileStack (CObject *pObj, FILE *file, int objRank)
 Resumes the execution stack of the program in a robot.
 
void FlushNewScriptName ()
 Empty the list.
 
void AddNewScriptName (ObjectType type, const std::string &name)
 Adds a script name.
 
std::string GetNewScriptName (ObjectType type, int rank)
 Seeks a script name for a given type.
 
void SelectPlayer (std::string playerName)
 Changes current player.
 
CPlayerProfileGetPlayerProfile ()
 
bool IOIsBusy ()
 Seeks if an object occupies in a spot, to prevent a backup of the game.
 
bool IOWriteScene (std::string filename, std::string filecbot, std::string filescreenshot, const std::string &info, bool emergencySave=false)
 Saves the current game.
 
void IOWriteSceneFinished ()
 Notifies the user that scene write is finished.
 
CObjectIOReadScene (std::string filename, std::string filecbot)
 Resumes some part of the game.
 
void IOWriteObject (CLevelParserLine *line, CObject *obj, const std::string &programDir, int objRank)
 Writes an object into the backup file.
 
CObjectIOReadObject (CLevelParserLine *line, const std::string &programDir, const std::string &objCounterText, float objectProgress, int objRank=-1)
 Resumes the game.
 
int CreateSpot (Math::Vector pos, Gfx::Color color)
 Creates a light spot.
 
CObjectGetSelect ()
 Returns the selected object.
 
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.
 
void StartMissionTimer ()
 
void SetAutosave (bool enable)
 
bool GetAutosave ()
 
void SetAutosaveInterval (int interval)
 
int GetAutosaveInterval ()
 
void SetAutosaveSlots (int slots)
 
int GetAutosaveSlots ()
 
void SetExitAfterMission (bool exit)
 Enable mode where completing mission closes the game.
 
bool CanPlayerInteract ()
 Returns true if player can interact with things manually.
 
const std::string & GetTeamName (int id)
 Returns team name for the given team id.
 
bool IsTeamColorDefined (int id)
 Returns true if team-specific colored texture is available.
 
bool IsResearchEnabled (ResearchType type)
 Returns true if the given research is enabled.
 
bool IsResearchDone (ResearchType type, int team)
 Returns true if the given research is done.
 
void MarkResearchDone (ResearchType type, int team)
 Marks research as done.
 
void RemoveFromSelectionHistory (CObject *object)
 
float GetGlobalMagnifyDamage ()
 Returns global magnifyDamage setting.
 
void StartDetectEffect (COldObject *object, CObject *target)
 
bool IsSelectable (CObject *pObj)
 Indicates whether an object is selectable.
 
int GetEnableBuild ()
 Get/set enabled buildings.
 
void SetEnableBuild (int enableBuild)
 
int GetEnableResearch ()
 Get/set enabled researches.
 
void SetEnableResearch (int enableResearch)
 
int GetDoneResearch (int team)
 Get/set done researches.
 
void SetDoneResearch (int doneResearch, int team)
 
bool IsBuildingEnabled (BuildType type)
 Returns true if the given building is enabled.
 
bool IsBuildingEnabled (ObjectType type)
 
bool CanBuild (ObjectType type, int team)
 Retruns true if all requirements to build this object are met (EnableBuild + DoneResearch)
 
Error CanBuildError (ObjectType type, int team)
 
bool CanFactory (ObjectType type, int team)
 Retruns true if all requirements to create this object in BotFactory are met (DoneResearch)
 
Error CanFactoryError (ObjectType type, int team)
 

Protected Member Functions

bool EventFrame (const Event &event)
 Advances the entire scene.
 
bool EventObject (const Event &event)
 Makes the event for all robots.
 
void InitEye ()
 Initializes the view.
 
void ShowSaveIndicator (bool show)
 
void CreateScene (bool soluce, bool fixScene, bool resetObject)
 Creates the whole scene.
 
void ResetCreate ()
 Resets all objects to their original position.
 
void LevelLoadingError (const std::string &error, const std::runtime_error &exception, Phase exitPhase=PHASE_LEVEL_LIST)
 
Math::Vector LookatPoint (Math::Vector eye, float angleH, float angleV, float length)
 Calculates the point of arrival of the camera.
 
int CreateLight (Math::Vector direction, Gfx::Color color)
 Creates a directional light.
 
void HiliteClear ()
 Removes setting evidence of the object with the mouse hovers over.
 
void HiliteObject (Math::Point pos)
 Highlights the object with the mouse hovers over.
 
void HiliteFrame (float rTime)
 Highlights the object with the mouse hovers over.
 
void CreateTooltip (Math::Point pos, const std::string &text)
 Creates a tooltip.
 
void ClearTooltip ()
 Clears the previous tooltip.
 
CObjectDetectObject (Math::Point pos)
 Detects the object aimed by the mouse.
 
void ChangeCamera ()
 Change the mode of the camera.
 
void RemoteCamera (float pan, float zoom, float rTime)
 Panned with the camera if a button is pressed.
 
void KeyCamera (EventType event, InputSlot key)
 Remote control the camera using the arrow keys.
 
void AbortMovie ()
 Cancels the current movie.
 
void SelectOneObject (CObject *pObj, bool displayError=true)
 Selects an object, without attending to deselect the rest.
 
void HelpObject ()
 Displays help for an object.
 
bool DeselectObject ()
 Deselects the selected object.
 
void DeleteAllObjects ()
 Quickly removes all objects.
 
void UpdateInfoText ()
 Updates the text information.
 
CObjectSearchObject (ObjectType type)
 
void StartDisplayVisit (EventType event)
 Start of the visit instead of an error.
 
void FrameVisit (float rTime)
 Move the arrow to visit.
 
void StopDisplayVisit ()
 End of the visit instead of an error.
 
void ExecuteCmd (char *cmd)
 Executes a command.
 
void UpdateSpeedLabel ()
 
int AutosaveRotate (bool freeOne)
 
void Autosave ()
 
bool DestroySelectedObject ()
 Deletes the selected object.
 
void PushToSelectionHistory (CObject *obj)
 
CObjectPopFromSelectionHistory ()
 
void CreateCodeBattleInterface ()
 
void DestroyCodeBattleInterface ()
 
void SetCodeBattleSpectatorMode (bool mode)
 

Protected Attributes

CControllerm_ctrl = nullptr
 
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
 
CPauseManagerm_pause = nullptr
 
CInputm_input = nullptr
 
std::unique_ptr< CObjectManagerm_objMan
 
std::unique_ptr< CMainMoviem_movie
 
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< CSettingsm_settings
 
std::unique_ptr< CPlayerProfilem_playerProfile
 Progress of loaded player.
 
float m_time = 0.0f
 Time since level start, including pause and intro movie.
 
float m_gameTime = 0.0f
 Playing time since level start.
 
float m_gameTimeAbsolute = 0.0f
 Playing time since level start, not dependent on simulation speed.
 
LevelCategory m_levelCategory
 
int m_levelChap = 0
 
int m_levelRank = 0
 
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
 
int m_cameraRank = 0
 
Gfx::Color m_color
 
bool m_freePhoto = false
 
ActivePausem_freePhotoPause = nullptr
 
bool m_cmdEdit = false
 
ActivePausem_cmdEditPause = nullptr
 
bool m_selectInsect = false
 
bool m_showSoluce = false
 
bool m_showAll = 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_trainerPilot = false
 
bool m_friendAim = false
 
bool m_resetCreate = false
 
bool m_mapShow = false
 
bool m_mapImage = false
 
char m_mapFilename [100] = {}
 
ActivePausem_suspend = nullptr
 
Gfx::CameraType m_suspendInitCamera = Gfx::CAM_TYPE_NULL
 
Math::Point m_tooltipPos
 
std::string m_tooltipName
 
float m_tooltipTime = 0.0f
 
char m_infoFilename [SATCOM_MAX][100] = {}
 
CObjectm_infoObject = nullptr
 
int m_infoIndex = 0
 
int m_infoPos [SATCOM_MAX] = {}
 
int m_infoUsed = 0
 
ActivePausem_satcomMoviePause = nullptr
 
char m_title [100] = {}
 
char m_resume [500] = {}
 
char m_scriptName [100] = {}
 
char m_scriptFile [100] = {}
 
int m_endingWinRank = 0
 
int m_endingLostRank = 0
 
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.
 
std::map< int, std::string > m_teamNames
 
std::vector< NewScriptNamem_newScriptName
 
float m_cameraPan = 0.0f
 
float m_cameraZoom = 0.0f
 
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
 
long m_endTakeResearch = 0
 
float m_endTakeWinDelay = 0.0f
 
float m_endTakeLostDelay = 0.0f
 
std::vector< std::unique_ptr< CAudioChangeCondition > > m_audioChange
 
int m_obligatoryTotal = 0
 
char m_obligatoryToken [100][20] = {}
 
int m_prohibitedTotal = 0
 
char m_prohibitedToken [100][20] = {}
 
int m_build = 0
 Enabled buildings.
 
long m_researchEnable = 0
 Available researches.
 
std::map< int, int > m_researchDone
 Done researches for each team.
 
Error m_missionResult = ERR_OK
 
ShowLimit m_showLimit [MAXSHOWLIMIT]
 
Gfx::Color m_colorRefBot
 
std::map< int, Gfx::Colorm_colorNewBot
 
Gfx::Color m_colorRefAlien
 
Gfx::Color m_colorNewAlien
 
Gfx::Color m_colorRefGreen
 
Gfx::Color m_colorNewGreen
 
Gfx::Color m_colorRefWater
 
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
 

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 = nullptr
 

Member Function Documentation

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

Beginning of the displaying of instructions. index: SATCOM_*


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