Colobot
robotmain.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
27 #include "app/pausemanager.h"
28 
29 #include "common/error.h"
30 #include "common/singleton.h"
31 
32 #include "level/build_type.h"
33 #include "level/level_category.h"
34 #include "level/mainmovie.h"
35 #include "level/research_type.h"
36 
37 #include "graphics/engine/camera.h"
39 
40 #include "object/drive_type.h"
41 #include "object/mission_type.h"
42 #include "object/object_type.h"
43 #include "object/tool_type.h"
44 
45 #include <deque>
46 #include <stdexcept>
47 
48 enum Phase
49 {
50  PHASE_WELCOME1,
51  PHASE_WELCOME2,
52  PHASE_WELCOME3,
53  PHASE_PLAYER_SELECT,
54  PHASE_APPERANCE,
55  PHASE_MAIN_MENU,
56  PHASE_LEVEL_LIST,
57  PHASE_SIMUL,
58  PHASE_SETUPd,
59  PHASE_SETUPg,
60  PHASE_SETUPp,
61  PHASE_SETUPc,
62  PHASE_SETUPs,
63  PHASE_SETUPds,
64  PHASE_SETUPgs,
65  PHASE_SETUPps,
66  PHASE_SETUPcs,
67  PHASE_SETUPss,
68  PHASE_WRITEs,
69  PHASE_READ,
70  PHASE_READs,
71  PHASE_WIN,
72  PHASE_LOST,
73  PHASE_QUIT_SCREEN,
74 };
75 std::string PhaseToString(Phase phase);
76 bool IsInSimulationConfigPhase(Phase phase);
77 bool IsPhaseWithWorld(Phase phase);
78 bool IsMainMenuPhase(Phase phase);
79 
80 
81 class CController;
82 class CEventQueue;
83 class CSoundInterface;
84 class CLevelParserLine;
85 class CInput;
86 class CObjectManager;
87 class CSceneEndCondition;
89 class CPlayerProfile;
90 class CSettings;
91 class COldObject;
92 class CPauseManager;
93 struct ActivePause;
94 
95 namespace Gfx
96 {
97 class CEngine;
98 class CLightManager;
99 class CWater;
100 class CCloud;
101 class CLightning;
102 class CPlanet;
103 class CTerrain;
104 class CModelManager;
105 }
106 
107 namespace Ui
108 {
109 class CMainUserInterface;
110 class CMainShort;
111 class CMainMap;
112 class CInterface;
113 class CDisplayText;
114 class CDisplayInfo;
115 }
116 
118 {
119  ObjectType type = OBJECT_NULL;
120  std::string name = "";
121 };
122 
123 
124 const int MAXSHOWLIMIT = 5;
125 const int MAXSHOWPARTI = 200;
126 const float SHOWLIMITTIME = 20.0f;
127 
128 const int MAXSCENE = 999;
129 
130 struct ShowLimit
131 {
132  bool used = false;
133  Math::Vector pos;
134  float radius = 0.0f;
135  int total = 0;
136  int parti[MAXSHOWPARTI] = {};
137  CObject* link = nullptr;
138  float duration = 0.0f;
139  float time = 0.0f;
140 };
141 
142 
143 const int SATCOM_HUSTON = 0;
144 const int SATCOM_SAT = 1;
145 const int SATCOM_OBJECT = 2;
146 const int SATCOM_LOADING = 3;
147 const int SATCOM_PROG = 4;
148 const int SATCOM_SOLUCE = 5;
149 const int SATCOM_MAX = 6;
150 
151 class CRobotMain : public CSingleton<CRobotMain>
152 {
153 public:
154  CRobotMain();
155  virtual ~CRobotMain();
156 
157  Gfx::CCamera* GetCamera();
158  Gfx::CTerrain* GetTerrain();
159  Ui::CInterface* GetInterface();
160  Ui::CDisplayText* GetDisplayText();
161 
162  void CreateConfigFile();
163  void LoadConfigFile();
164 
165  void ResetAfterDeviceChanged();
166 
167  void ChangePhase(Phase phase);
168  bool ProcessEvent(Event &event);
169  Phase GetPhase();
170 
171  bool CreateShortcuts();
172  void ScenePerso();
173 
174  void SetMovieLock(bool lock);
175  bool GetMovieLock();
176  bool GetInfoLock();
177  void SetSatComLock(bool lock);
178  bool GetSatComLock();
179  void SetEditLock(bool lock, bool edit);
180  bool GetEditLock();
181  void SetEditFull(bool full);
182  bool GetEditFull();
183  bool GetFreePhoto();
184  void SetFriendAim(bool friendAim);
185  bool GetFriendAim();
186 
187  void SetTracePrecision(float factor);
188  float GetTracePrecision();
189 
190  void SetSpeed(float speed);
191  float GetSpeed();
192 
193  void UpdateShortcuts();
194  void SelectHuman();
195  CObject* SearchHuman();
196  CObject* SearchToto();
197  CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
198  bool SelectObject(CObject* pObj, bool displayError=true);
200  CObject* DeselectAll();
201 
202  void ResetObject();
203  void UpdateAudio(bool frame);
204  void SetEndMission(Error result, float delay);
205  Error CheckEndMission(bool frame);
206  Error CheckEndMissionForGroup(std::vector<CSceneEndCondition*>& endTakes);
207  int GetObligatoryToken();
208  char* GetObligatoryToken(int i);
209  int IsObligatoryToken(const char* token);
210  bool IsProhibitedToken(const char* token);
211  void UpdateMap();
212  bool GetShowMap();
213 
214  MainMovieType GetMainMovie();
215 
216  void FlushDisplayInfo();
217  void StartDisplayInfo(int index, bool movie);
218  void StartDisplayInfo(const std::string& filename, int index);
219  void StopDisplayInfo();
220  char* GetDisplayInfoName(int index);
221  int GetDisplayInfoPosition(int index);
222  void SetDisplayInfoPosition(int index, int pos);
223 
224  void StartSuspend();
225  void StopSuspend();
226 
227  float GetGameTime();
228 
229  char* GetTitle();
230  char* GetResume();
231  char* GetScriptName();
232  char* GetScriptFile();
233  bool GetTrainerPilot();
234  bool GetFixScene();
235  bool GetInterfaceGlint();
236  bool GetSoluce4();
237  bool GetMovies();
238  bool GetShowSoluce();
239  bool GetSceneSoluce();
240  bool GetShowAll();
241  bool GetRadar();
242  MissionType GetMissionType();
243 
244  int GetGamerFace();
245  int GetGamerGlasses();
246  bool GetGamerOnlyHead();
247  float GetPersoAngle();
248 
249  void SetLevel(LevelCategory cat, int chap, int rank);
250  LevelCategory GetLevelCategory();
251  int GetLevelChap();
252  int GetLevelRank();
253  std::string GetCustomLevelDir();
254  void SetReadScene(std::string path);
255  void UpdateChapterPassed();
256 
257  void StartMusic();
258  void UpdatePause(PauseType pause);
259  void ClearInterface();
260  void ChangeColor();
261 
262  float SearchNearestObject(Math::Vector center, CObject *exclu);
263  bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
264  bool FlatFreeSpace(Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu);
265  float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
266  void HideDropZone(CObject* metal);
267  void ShowDropZone(CObject* metal, CObject* transporter);
268  void FlushShowLimit(int i);
269  void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
270  float radius, float duration=SHOWLIMITTIME);
271  void StartShowLimit();
272  void FrameShowLimit(float rTime);
273 
274  void SaveAllScript();
275  void SaveOneScript(CObject *pObj);
276  bool SaveFileStack(CObject *pObj, FILE *file, int objRank);
277  bool ReadFileStack(CObject *pObj, FILE *file, int objRank);
278 
279  void FlushNewScriptName();
280  void AddNewScriptName(ObjectType type, const std::string& name);
281  std::string GetNewScriptName(ObjectType type, int rank);
282 
283  void SelectPlayer(std::string playerName);
284  CPlayerProfile* GetPlayerProfile();
285 
286  bool IOIsBusy();
287  bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, const std::string& info, bool emergencySave = false);
288  void IOWriteSceneFinished();
289  CObject* IOReadScene(std::string filename, std::string filecbot);
290  void IOWriteObject(CLevelParserLine *line, CObject* obj, const std::string& programDir, int objRank);
291  CObject* IOReadObject(CLevelParserLine *line, const std::string& programDir, const std::string& objCounterText, float objectProgress, int objRank = -1);
292 
293  int CreateSpot(Math::Vector pos, Gfx::Color color);
294 
295  CObject* GetSelect();
296 
297  void DisplayError(Error err, CObject* pObj, float time=10.0f);
298  void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);
299 
300  void UpdateCustomLevelList();
301  std::string GetCustomLevelName(int id);
302  const std::vector<std::string>& GetCustomLevelList();
303 
305  bool IsLoading();
306 
307  void StartMissionTimer();
308 
309  void SetAutosave(bool enable);
310  bool GetAutosave();
311  void SetAutosaveInterval(int interval);
312  int GetAutosaveInterval();
313  void SetAutosaveSlots(int slots);
314  int GetAutosaveSlots();
315 
317  void SetExitAfterMission(bool exit);
318 
320  bool CanPlayerInteract();
321 
323  const std::string& GetTeamName(int id);
324 
326  bool IsTeamColorDefined(int id);
327 
329 
330  int GetEnableBuild();
331  void SetEnableBuild(int enableBuild);
333 
335  int GetEnableResearch();
336  void SetEnableResearch(int enableResearch);
338 
340  int GetDoneResearch(int team);
341  void SetDoneResearch(int doneResearch, int team);
343 
345 
346  bool IsBuildingEnabled(BuildType type);
347  bool IsBuildingEnabled(ObjectType type);
349  bool IsResearchEnabled(ResearchType type);
352  bool IsResearchDone(ResearchType type, int team);
354  void MarkResearchDone(ResearchType type, int team);
355 
357 
358  bool CanBuild(ObjectType type, int team);
359  Error CanBuildError(ObjectType type, int team);
361 
363 
364  bool CanFactory(ObjectType type, int team);
365  Error CanFactoryError(ObjectType type, int team);
367 
368  void RemoveFromSelectionHistory(CObject* object);
369 
371  float GetGlobalMagnifyDamage();
372 
373  void StartDetectEffect(COldObject* object, CObject* target);
374 
375  bool IsSelectable(CObject* pObj);
376 
377 protected:
378  bool EventFrame(const Event &event);
379  bool EventObject(const Event &event);
380  void InitEye();
381 
382  void ShowSaveIndicator(bool show);
383 
384  void CreateScene(bool soluce, bool fixScene, bool resetObject);
385  void ResetCreate();
386 
387  void LevelLoadingError(const std::string& error, const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);
388 
389  Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length);
390  int CreateLight(Math::Vector direction, Gfx::Color color);
391  void HiliteClear();
392  void HiliteObject(Math::Point pos);
393  void HiliteFrame(float rTime);
394  void CreateTooltip(Math::Point pos, const std::string& text);
395  void ClearTooltip();
397  void ChangeCamera();
398  void RemoteCamera(float pan, float zoom, float rTime);
399  void KeyCamera(EventType event, InputSlot key);
400  void AbortMovie();
401  void SelectOneObject(CObject* pObj, bool displayError=true);
402  void HelpObject();
403  bool DeselectObject();
404  void DeleteAllObjects();
405  void UpdateInfoText();
406  CObject* SearchObject(ObjectType type);
407  void StartDisplayVisit(EventType event);
408  void FrameVisit(float rTime);
409  void StopDisplayVisit();
410  void ExecuteCmd(char *cmd);
411  void UpdateSpeedLabel();
412 
413  int AutosaveRotate(bool freeOne);
414  void Autosave();
415  bool DestroySelectedObject();
416  void PushToSelectionHistory(CObject* obj);
417  CObject* PopFromSelectionHistory();
418 
419  void CreateCodeBattleInterface();
420  void DestroyCodeBattleInterface();
421  void SetCodeBattleSpectatorMode(bool mode);
422 
423 
424 protected:
425  CController* m_ctrl = nullptr;
426  CApplication* m_app = nullptr;
427  CEventQueue* m_eventQueue = nullptr;
428  Gfx::CEngine* m_engine = nullptr;
429  Gfx::CParticle* m_particle = nullptr;
430  Gfx::CWater* m_water = nullptr;
431  Gfx::CCloud* m_cloud = nullptr;
432  Gfx::CLightning* m_lightning = nullptr;
433  Gfx::CPlanet* m_planet = nullptr;
434  Gfx::COldModelManager* m_oldModelManager = nullptr;
435  Gfx::CLightManager* m_lightMan = nullptr;
436  CSoundInterface* m_sound = nullptr;
437  CPauseManager* m_pause = nullptr;
438  CInput* m_input = nullptr;
439  std::unique_ptr<CObjectManager> m_objMan;
440  std::unique_ptr<CMainMovie> m_movie;
441  std::unique_ptr<Gfx::CModelManager> m_modelManager;
442  std::unique_ptr<Gfx::CTerrain> m_terrain;
443  std::unique_ptr<Gfx::CCamera> m_camera;
444  std::unique_ptr<Ui::CMainUserInterface> m_ui;
445  std::unique_ptr<Ui::CMainShort> m_short;
446  std::unique_ptr<Ui::CMainMap> m_map;
447  std::unique_ptr<Ui::CInterface> m_interface;
448  std::unique_ptr<Ui::CDisplayInfo> m_displayInfo;
449  std::unique_ptr<Ui::CDisplayText> m_displayText;
450  std::unique_ptr<CSettings> m_settings;
451 
453  std::unique_ptr<CPlayerProfile> m_playerProfile;
454 
455 
457  float m_time = 0.0f;
459  float m_gameTime = 0.0f;
461  float m_gameTimeAbsolute = 0.0f;
462 
463  LevelCategory m_levelCategory;
464  int m_levelChap = 0;
465  int m_levelRank = 0;
466  std::string m_sceneReadPath;
467 
468  float m_winDelay = 0.0f;
469  float m_lostDelay = 0.0f;
470  bool m_fixScene = false; // scene fixed, no interraction
471  CObject* m_base = nullptr; // OBJECT_BASE exists in mission
472  CObject* m_selectObject = nullptr;
473 
474  Phase m_phase = PHASE_WELCOME1;
475  ActivePause* m_userPause = nullptr;
476  int m_cameraRank = 0;
477  Gfx::Color m_color;
478  bool m_freePhoto = false;
479  ActivePause* m_freePhotoPause = nullptr;
480  bool m_cmdEdit = false;
481  ActivePause* m_cmdEditPause = nullptr;
482  bool m_selectInsect = false;
483  bool m_showSoluce = false;
484  bool m_showAll = false;
485  bool m_cheatRadar = false;
486  bool m_shortCut = false;
487  std::string m_audioTrack;
488  bool m_audioRepeat = false;
489  std::string m_satcomTrack;
490  bool m_satcomRepeat = false;
491  std::string m_editorTrack;
492  bool m_editorRepeat = false;
493  int m_movieInfoIndex = 0;
494 
495  CObject* m_controller = nullptr;
496 
497  MissionType m_missionType = MISSION_NORMAL;
498  bool m_immediatSatCom = false; // SatCom immediately?
499  bool m_beginSatCom = false; // messages SatCom poster?
500  bool m_lockedSatCom = false; // SatCom locked?
501  bool m_movieLock = false; // movie in progress?
502  bool m_satComLock = false; // call of SatCom is possible?
503  bool m_editLock = false; // edition in progress?
504  bool m_editFull = false; // edition in full screen?
505  bool m_hilite = false;
506  bool m_trainerPilot = false; // remote trainer?
507  bool m_friendAim = false;
508  bool m_resetCreate = false;
509  bool m_mapShow = false;
510  bool m_mapImage = false;
511  char m_mapFilename[100] = {};
512 
513  ActivePause* m_suspend = nullptr;
514  Gfx::CameraType m_suspendInitCamera = Gfx::CAM_TYPE_NULL;
515 
516  Math::Point m_tooltipPos;
517  std::string m_tooltipName;
518  float m_tooltipTime = 0.0f;
519 
520  char m_infoFilename[SATCOM_MAX][100] = {}; // names of text files
521  CObject* m_infoObject = nullptr;
522  int m_infoIndex = 0;
523  int m_infoPos[SATCOM_MAX] = {};
524  int m_infoUsed = 0;
525  ActivePause* m_satcomMoviePause = nullptr;
526 
527  char m_title[100] = {};
528  char m_resume[500] = {};
529  char m_scriptName[100] = {};
530  char m_scriptFile[100] = {};
531  int m_endingWinRank = 0;
532  int m_endingLostRank = 0;
533  bool m_winTerminate = false;
534 
535  float m_globalMagnifyDamage = 0.0f;
536 
537  bool m_exitAfterMission = false;
538 
539  bool m_codeBattleInit = false;
540  bool m_codeBattleStarted = false;
543 
544  std::map<int, std::string> m_teamNames;
545 
546  std::vector<NewScriptName> m_newScriptName;
547 
548  float m_cameraPan = 0.0f;
549  float m_cameraZoom = 0.0f;
550 
551  EventType m_visitLast = EVENT_NULL;
552  CObject* m_visitObject = nullptr;
553  CObject* m_visitArrow = nullptr;
554  float m_visitTime = 0.0f;
555  float m_visitParticle = 0.0f;
556  Math::Vector m_visitPos;
557  Math::Vector m_visitPosArrow;
558  ActivePause* m_visitPause = nullptr;
559 
560  std::vector<std::unique_ptr<CSceneEndCondition>> m_endTake;
561  long m_endTakeResearch = 0;
562  float m_endTakeWinDelay = 0.0f;
563  float m_endTakeLostDelay = 0.0f;
564 
565  std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;
566 
567  int m_obligatoryTotal = 0;
568  char m_obligatoryToken[100][20] = {};
569  int m_prohibitedTotal = 0;
570  char m_prohibitedToken[100][20] = {};
571 
573  int m_build = 0;
577  std::map<int, int> m_researchDone;
578 
579  Error m_missionResult = ERR_OK;
580 
581  ShowLimit m_showLimit[MAXSHOWLIMIT];
582 
583  Gfx::Color m_colorRefBot;
584  std::map<int, Gfx::Color> m_colorNewBot;
585  Gfx::Color m_colorRefAlien;
586  Gfx::Color m_colorNewAlien;
587  Gfx::Color m_colorRefGreen;
588  Gfx::Color m_colorNewGreen;
589  Gfx::Color m_colorRefWater;
590  Gfx::Color m_colorNewWater;
591  float m_colorShiftWater = 0.0f;
592 
593  bool m_missionTimerEnabled = false;
594  bool m_missionTimerStarted = false;
595  float m_missionTimer = 0.0f;
596 
597  bool m_autosave = false;
598  int m_autosaveInterval = 0;
599  int m_autosaveSlots = 0;
600  float m_autosaveLast = 0.0f;
601 
602  int m_shotSaving = 0;
603 
604  std::deque<CObject*> m_selectionHistory;
605 };
const std::string & GetTeamName(int id)
Returns team name for the given team id.
Definition: robotmain.cpp:5763
void AddNewScriptName(ObjectType type, const std::string &name)
Adds a script name.
Definition: robotmain.cpp:4463
void StartDisplayVisit(EventType event)
Start of the visit instead of an error.
Definition: robotmain.cpp:1584
CameraType
Type of camera.
Definition: camera.h:46
void SetFriendAim(bool friendAim)
Indicates whether mouse is on an friend object, on which we should not shoot.
Definition: robotmain.cpp:5522
Definition: pausemanager.h:45
CSingleton base class for singletons.
void StartMusic()
Starts music with a mission.
Definition: robotmain.cpp:5546
float SearchNearestObject(Math::Vector center, CObject *exclu)
Calculates the distance to the nearest object.
Definition: robotmain.cpp:3993
void StopSuspend()
End of dialogue during the game.
Definition: robotmain.cpp:1558
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu)
Calculates a free space.
Definition: robotmain.cpp:4042
ParticleType
Definition: particle.h:63
bool IsResearchEnabled(ResearchType type)
Returns true if the given research is enabled.
Definition: robotmain.cpp:5833
void SetSpeed(float speed)
Changes game speed.
Definition: robotmain.cpp:5391
Definition: displaytext.h:51
bool GetShowMap()
Indicates whether the mini-map is visible.
Definition: robotmain.cpp:5441
void IOWriteSceneFinished()
Notifies the user that scene write is finished.
Definition: robotmain.cpp:4732
void SetTracePrecision(float factor)
Management of the precision of drawing the ground.
Definition: robotmain.cpp:5534
MainMovieType GetMainMovie()
Returns the type of current movie.
Definition: robotmain.cpp:1415
void StopDisplayInfo()
End of displaying of instructions.
Definition: robotmain.cpp:1494
std::string GetCustomLevelDir()
Returns folder name of the scene that user selected to play.
Definition: robotmain.cpp:5373
Definition: robotmain.h:130
bool IsResearchDone(ResearchType type, int team)
Returns true if the given research is done.
Definition: robotmain.cpp:5838
void InitEye()
Initializes the view.
Definition: robotmain.cpp:2388
InputSlot
Available slots for input bindings NOTE: When adding new values, remember to also update keyTable in ...
Definition: key.h:76
bool DeselectObject()
Deselects the selected object.
Definition: robotmain.cpp:1858
void RemoteCamera(float pan, float zoom, float rTime)
Panned with the camera if a button is pressed.
Definition: robotmain.cpp:2336
Definition: robotmain.h:107
void SelectOneObject(CObject *pObj, bool displayError=true)
Selects an object, without attending to deselect the rest.
Definition: robotmain.cpp:1765
Camera handling - CCamera class.
int m_build
Enabled buildings.
Definition: robotmain.h:573
void StartDisplayInfo(int index, bool movie)
Definition: robotmain.cpp:1435
bool m_codeBattleSpectator
Code battle spectator mode, hides object UI, changes camera to CAM_TYPE_PLANE and allows for switchin...
Definition: robotmain.h:542
void HiliteClear()
Removes setting evidence of the object with the mouse hovers over.
Definition: robotmain.cpp:2042
int CreateSpot(Math::Vector pos, Gfx::Color color)
Creates a light spot.
Definition: robotmain.cpp:3813
bool IsSelectable(CObject *pObj)
Indicates whether an object is selectable.
Definition: robotmain.cpp:2000
void KeyCamera(EventType event, InputSlot key)
Remote control the camera using the arrow keys.
Definition: robotmain.cpp:2277
bool CanBuild(ObjectType type, int team)
Retruns true if all requirements to build this object are met (EnableBuild + DoneResearch) ...
Definition: robotmain.cpp:5875
Audio change condition.
Definition: scene_conditions.h:96
float m_gameTime
Playing time since level start.
Definition: robotmain.h:459
void FrameVisit(float rTime)
Move the arrow to visit.
Definition: robotmain.cpp:1677
Definition: singleton.h:30
void ClearInterface()
Removes hilite and tooltip.
Definition: robotmain.cpp:5584
int GetGamerFace()
Returns the representation to use for the player.
Definition: robotmain.cpp:5327
Manager for static models.
Definition: oldmodelmanager.h:55
void CreateTooltip(Math::Point pos, const std::string &text)
Creates a tooltip.
Definition: robotmain.cpp:2144
std::string GetNewScriptName(ObjectType type, int rank)
Seeks a script name for a given type.
Definition: robotmain.cpp:4472
Definition: old_object.h:77
bool CreateShortcuts()
Creates interface shortcuts to the units.
Definition: robotmain.cpp:5426
void SetEditLock(bool lock, bool edit)
Management of the lock mode for the edition.
Definition: robotmain.cpp:5479
CObject * GetSelectObject()
Returns the object that default was select after the creation of a scene.
Definition: robotmain.cpp:1744
Global event queue.
Definition: event.h:840
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
void ExecuteCmd(char *cmd)
Executes a command.
Definition: robotmain.cpp:1112
ObjectType enum.
Definition: parserline.h:37
int GetObligatoryToken()
Returns the number of instructions required.
Definition: robotmain.cpp:5207
void FlushNewScriptName()
Empty the list.
Definition: robotmain.cpp:4457
void ChangeCamera()
Change the mode of the camera.
Definition: robotmain.cpp:2213
Definition: robotmain.h:151
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
int CreateLight(Math::Vector direction, Gfx::Color color)
Creates a directional light.
Definition: robotmain.cpp:3792
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME)
Specifies the boundaries to show.
Definition: robotmain.cpp:4299
Particle engine.
Definition: particle.h:223
void UpdateMap()
Updates the map.
Definition: robotmain.cpp:5435
bool IsTeamColorDefined(int id)
Returns true if team-specific colored texture is available.
Definition: robotmain.cpp:5769
bool FlatFreeSpace(Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu)
Calculates a flat free space.
Definition: robotmain.cpp:4107
float GetPersoAngle()
Returns the angle of presentation.
Definition: robotmain.cpp:5345
CObject * DeselectAll()
Deselects everything, and returns the object that was selected.
Definition: robotmain.cpp:1751
bool IsLoading()
Returns true if the game is on the loading screen.
Definition: robotmain.cpp:5615
CObject * SearchNearest(Math::Vector pos, CObject *pExclu)
Returns the nearest selectable object from a given position.
Definition: robotmain.cpp:1912
virtual ~CRobotMain()
Destructor of robot application.
Definition: robotmain.cpp:273
float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu)
Calculates the maximum radius of a free space.
Definition: robotmain.cpp:4180
Definition: settings.h:31
CObject * IOReadObject(CLevelParserLine *line, const std::string &programDir, const std::string &objCounterText, float objectProgress, int objRank=-1)
Resumes the game.
Definition: robotmain.cpp:4739
Planet manager.
Definition: planet.h:49
CMainMovie - control over movie sequences.
bool SaveFileStack(CObject *pObj, FILE *file, int objRank)
Saves the stack of the program in execution of a robot.
Definition: robotmain.cpp:4426
float GetGlobalMagnifyDamage()
Returns global magnifyDamage setting.
Definition: robotmain.cpp:5936
void ScenePerso()
Load the scene for the character.
Definition: robotmain.cpp:2726
Scene end condition.
Definition: scene_conditions.h:73
void IOWriteObject(CLevelParserLine *line, CObject *obj, const std::string &programDir, int objRank)
Writes an object into the backup file.
Definition: robotmain.cpp:4504
bool GetGamerOnlyHead()
Returns the mode with just the head.
Definition: robotmain.cpp:5339
CObject * SearchToto()
Returns the object toto.
Definition: robotmain.cpp:1906
bool IOIsBusy()
Seeks if an object occupies in a spot, to prevent a backup of the game.
Definition: robotmain.cpp:4489
void FlushShowLimit(int i)
Erases the boundaries shown.
Definition: robotmain.cpp:4283
2D point
Definition: point.h:50
void CreateConfigFile()
Creates the file colobot.ini at the first time.
Definition: robotmain.cpp:319
bool CanPlayerInteract()
Returns true if player can interact with things manually.
Definition: robotmain.cpp:5753
bool IsProhibitedToken(const char *token)
Checks if an instruction is not part of the banned list.
Definition: robotmain.cpp:5230
void SelectHuman()
Selects the human.
Definition: robotmain.cpp:1894
Main application.
Definition: app.h:191
void ShowDropZone(CObject *metal, CObject *transporter)
Shows the buildable area when a cube of metal is deposited.
Definition: robotmain.cpp:4209
void UpdateInfoText()
Updates the text information.
Definition: robotmain.cpp:2372
void HiliteObject(Math::Point pos)
Highlights the object with the mouse hovers over.
Definition: robotmain.cpp:2064
int GetDisplayInfoPosition(int index)
Returns the name of the text display.
Definition: robotmain.cpp:1528
void StartSuspend()
Beginning of a dialogue during the game.
Definition: robotmain.cpp:1541
void ChangePhase(Phase phase)
Changes phase.
Definition: robotmain.cpp:383
Entry point into CRobotMain.
Definition: controller.h:40
void SetSatComLock(bool lock)
Management of the blocking of the call of SatCom.
Definition: robotmain.cpp:5468
long m_researchEnable
Available researches.
Definition: robotmain.h:575
Camera moving in 3D scene.
Definition: camera.h:134
void ResetCreate()
Resets all objects to their original position.
Definition: robotmain.cpp:4941
void SetExitAfterMission(bool exit)
Enable mode where completing mission closes the game.
Definition: robotmain.cpp:5748
int GetDoneResearch(int team)
Get/set done researches.
Definition: robotmain.cpp:5797
Management of pause modes.
Terrain loader/generator and manager.
Definition: terrain.h:145
Error CheckEndMission(bool frame)
Checks if the mission is over.
Definition: robotmain.cpp:5031
bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, const std::string &info, bool emergencySave=false)
Saves the current game.
Definition: robotmain.cpp:4586
bool IsBuildingEnabled(BuildType type)
Returns true if the given building is enabled.
Definition: robotmain.cpp:5808
Namespace for (new) graphics code.
Definition: app.h:49
void FrameShowLimit(float rTime)
Advances the boundaries shown.
Definition: robotmain.cpp:4346
Definition: player_profile.h:57
The graphics engine.
Definition: engine.h:620
bool ProcessEvent(Event &event)
Processes an event.
Definition: robotmain.cpp:641
bool GetTrainerPilot()
Indicates whether it is possible to control a driving robot.
Definition: robotmain.cpp:5242
CObject * DetectObject(Math::Point pos)
Detects the object aimed by the mouse.
Definition: robotmain.cpp:1953
CObject * SearchHuman()
Returns the object human.
Definition: robotmain.cpp:1900
std::unique_ptr< CPlayerProfile > m_playerProfile
Progress of loaded player.
Definition: robotmain.h:453
bool EventObject(const Event &event)
Makes the event for all robots.
Definition: robotmain.cpp:2693
void HiliteFrame(float rTime)
Highlights the object with the mouse hovers over.
Definition: robotmain.cpp:2127
void SetMovieLock(bool lock)
Management of the lock mode for movies.
Definition: robotmain.cpp:5448
void StartShowLimit()
Mount the boundaries of the selected object.
Definition: robotmain.cpp:4335
void AbortMovie()
Cancels the current movie.
Definition: robotmain.cpp:2356
ObjectType
Type of game object.
Definition: object_type.h:33
void HelpObject()
Displays help for an object.
Definition: robotmain.cpp:2200
Water manager/renderer.
Definition: water.h:74
CObject * GetSelect()
Returns the selected object.
Definition: robotmain.cpp:1936
CRobotMain()
Constructor of robot application.
Definition: robotmain.cpp:123
void CreateScene(bool soluce, bool fixScene, bool resetObject)
Creates the whole scene.
Definition: robotmain.cpp:2761
bool DestroySelectedObject()
Deletes the selected object.
Definition: robotmain.cpp:2024
void HideDropZone(CObject *metal)
Hides buildable area when a cube of metal is taken up.
Definition: robotmain.cpp:4193
Invalid event / no event.
Definition: event.h:47
Particle rendering - CParticle class (aka particle)
3D (3x1) vector
Definition: vector.h:53
float m_gameTimeAbsolute
Playing time since level start, not dependent on simulation speed.
Definition: robotmain.h:461
void ResetObject()
Resets all objects to their original position.
Definition: robotmain.cpp:4934
bool SelectObject(CObject *pObj, bool displayError=true)
Selects the object aimed by the mouse.
Definition: robotmain.cpp:1819
bool CanFactory(ObjectType type, int team)
Retruns true if all requirements to create this object in BotFactory are met (DoneResearch) ...
Definition: robotmain.cpp:5903
Undefined.
Definition: camera.h:49
void SaveAllScript()
Saves all programs of all the robots.
Definition: robotmain.cpp:4406
void UpdateAudio(bool frame)
Updates the audiotracks.
Definition: robotmain.cpp:4978
bool ReadFileStack(CObject *pObj, FILE *file, int objRank)
Resumes the execution stack of the program in a robot.
Definition: robotmain.cpp:4441
RGBA color.
Definition: color.h:39
int GetEnableResearch()
Get/set enabled researches.
Definition: robotmain.cpp:5787
void SaveOneScript(CObject *pObj)
Saves all programs of the robot.
Definition: robotmain.cpp:4415
Manages CObject instances.
Definition: object_manager.h:148
void StopDisplayVisit()
End of the visit instead of an error.
Definition: robotmain.cpp:1707
EventType
Type of event message.
Definition: event.h:41
int IsObligatoryToken(const char *token)
Checks if an instruction is part of the obligatory list.
Definition: robotmain.cpp:5219
void ChangeColor()
Change the colors and textures.
Definition: robotmain.cpp:3838
float m_time
Time since level start, including pause and intro movie.
Definition: robotmain.h:457
Event sent by system, interface or game.
Definition: event.h:709
Definition: pausemanager.h:60
void SelectPlayer(std::string playerName)
Changes current player.
Definition: robotmain.cpp:4919
char * GetDisplayInfoName(int index)
Returns the name of the text display.
Definition: robotmain.cpp:1522
void SetDisplayInfoPosition(int index, int pos)
Returns the name of the text display.
Definition: robotmain.cpp:1534
Definition: interface.h:58
Base class for all 3D in-game objects.
Definition: object.h:59
float GetGameTime()
Returns the absolute time of the game.
Definition: robotmain.cpp:1577
void DeleteAllObjects()
Quickly removes all objects.
Definition: robotmain.cpp:1876
bool EventFrame(const Event &event)
Advances the entire scene.
Definition: robotmain.cpp:2396
int GetEnableBuild()
Get/set enabled buildings.
Definition: robotmain.cpp:5777
int GetGamerGlasses()
Returns the representation to use for the player.
Definition: robotmain.cpp:5333
Sound plugin interface.
Definition: sound.h:57
void MarkResearchDone(ResearchType type, int team)
Marks research as done.
Definition: robotmain.cpp:5849
void FlushDisplayInfo()
Clears the display of instructions.
Definition: robotmain.cpp:1422
void SetEditFull(bool full)
Management of the fullscreen mode during editing.
Definition: robotmain.cpp:5504
bool GetFixScene()
Indicates whether the scene is fixed, without interaction.
Definition: robotmain.cpp:5248
Definition: robotmain.h:117
Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length)
Calculates the point of arrival of the camera.
Definition: robotmain.cpp:2715
std::map< int, int > m_researchDone
Done researches for each team.
Definition: robotmain.h:577
Management of mouse, keyboard and joystick.
Definition: input.h:68
void ClearTooltip()
Clears the previous tooltip.
Definition: robotmain.cpp:2193
void UpdateShortcuts()
Updates all the shortcuts.
Definition: robotmain.cpp:1738
CObject * IOReadScene(std::string filename, std::string filecbot)
Resumes some part of the game.
Definition: robotmain.cpp:4809