Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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-2016, 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/event.h"
31 #include "common/singleton.h"
32 
33 #include "graphics/engine/camera.h"
35 
36 #include "level/build_type.h"
37 #include "level/level_category.h"
38 #include "level/mainmovie.h"
39 #include "level/research_type.h"
40 
41 #include "object/drive_type.h"
42 #include "object/mission_type.h"
43 #include "object/object_type.h"
44 #include "object/tool_type.h"
45 
46 #include <deque>
47 #include <stdexcept>
48 
49 enum Phase
50 {
51  PHASE_WELCOME1,
52  PHASE_WELCOME2,
53  PHASE_WELCOME3,
54  PHASE_PLAYER_SELECT,
55  PHASE_APPERANCE,
56  PHASE_MAIN_MENU,
57  PHASE_LEVEL_LIST,
58  PHASE_SIMUL,
59  PHASE_SETUPd,
60  PHASE_SETUPg,
61  PHASE_SETUPp,
62  PHASE_SETUPc,
63  PHASE_SETUPs,
64  PHASE_SETUPds,
65  PHASE_SETUPgs,
66  PHASE_SETUPps,
67  PHASE_SETUPcs,
68  PHASE_SETUPss,
69  PHASE_WRITEs,
70  PHASE_READ,
71  PHASE_READs,
72  PHASE_WIN,
73  PHASE_LOST,
74  PHASE_QUIT_SCREEN,
75  PHASE_SATCOM,
76 };
77 std::string PhaseToString(Phase phase);
78 bool IsInSimulationConfigPhase(Phase phase);
79 bool IsPhaseWithWorld(Phase phase);
80 bool IsMainMenuPhase(Phase phase);
81 
82 
83 class CEventQueue;
84 class CSoundInterface;
85 class CLevelParserLine;
86 class CInput;
87 class CObjectManager;
88 class CSceneEndCondition;
90 class CPlayerProfile;
91 class CSettings;
92 class COldObject;
93 class CPauseManager;
94 struct ActivePause;
95 
96 namespace Gfx
97 {
98 class CEngine;
99 class CLightManager;
100 class CWater;
101 class CCloud;
102 class CLightning;
103 class CPlanet;
104 class CTerrain;
105 class CModelManager;
106 }
107 
108 namespace Ui
109 {
110 class CMainUserInterface;
111 class CMainShort;
112 class CMainMap;
113 class CInterface;
114 class CDisplayText;
115 class CDisplayInfo;
116 class CDebugMenu;
117 }
118 
120 {
121  ObjectType type = OBJECT_NULL;
122  std::string name = "";
123 };
124 
125 
126 const int MAXSHOWLIMIT = 5;
127 const int MAXSHOWPARTI = 200;
128 const float SHOWLIMITTIME = 20.0f;
129 
130 const int MAXSCENE = 999;
131 
132 struct ShowLimit
133 {
134  bool used = false;
135  Math::Vector pos;
136  float radius = 0.0f;
137  int total = 0;
138  int parti[MAXSHOWPARTI] = {};
139  CObject* link = nullptr;
140  float duration = 0.0f;
141  float time = 0.0f;
142 };
143 
144 struct MinMax
145 {
146  int min = -1;
147  int max = -1;
148 };
149 
150 
151 const int SATCOM_HUSTON = 0;
152 const int SATCOM_SAT = 1;
153 const int SATCOM_OBJECT = 2;
154 const int SATCOM_LOADING = 3;
155 const int SATCOM_PROG = 4;
156 const int SATCOM_SOLUCE = 5;
157 const int SATCOM_MAX = 6;
158 
159 class CRobotMain : public CSingleton<CRobotMain>
160 {
161 public:
162  CRobotMain();
163  virtual ~CRobotMain();
164 
165  Gfx::CCamera* GetCamera();
166  Gfx::CTerrain* GetTerrain();
167  Ui::CInterface* GetInterface();
168  Ui::CDisplayText* GetDisplayText();
169  CPauseManager* GetPauseManager();
170 
171  void ChangePhase(Phase phase);
172  bool ProcessEvent(Event &event);
173  Phase GetPhase();
174 
175  bool CreateShortcuts();
176  void ScenePerso();
177 
178  void SetMovieLock(bool lock);
179  bool GetMovieLock();
180  bool GetInfoLock();
181  void SetSatComLock(bool lock);
182  bool GetSatComLock();
183  void SetEditLock(bool lock, bool edit);
184  bool GetEditLock();
185  void SetEditFull(bool full);
186  bool GetEditFull();
187  void SetFriendAim(bool friendAim);
188  bool GetFriendAim();
189 
190  void SetSpeed(float speed);
191  float GetSpeed();
192 
193  void UpdateShortcuts();
194  void SelectHuman();
195  CObject* SearchHuman();
196  CObject* SearchToto();
198  bool SelectObject(CObject* obj, bool displayError=true);
200  CObject* DeselectAll();
201 
202  void ResetObject();
203  void UpdateAudio(bool frame);
204  void SetMissionResultFromScript(Error result, float delay);
205  Error CheckEndMission(bool frame);
206  Error ProcessEndMissionTake();
207  Error ProcessEndMissionTakeForGroup(std::vector<CSceneEndCondition*>& endTakes);
208  const std::map<std::string, MinMax>& GetObligatoryTokenList();
209  void UpdateMap();
210  bool GetShowMap();
211 
212  MainMovieType GetMainMovie();
213 
214  void FlushDisplayInfo();
215  void StartDisplayInfo(int index, bool movie);
216  void StartDisplayInfo(const std::string& filename, int index);
217  void StopDisplayInfo();
218  char* GetDisplayInfoName(int index);
219 
220  void StartSuspend();
221  void StopSuspend();
222 
223  float GetGameTime();
224 
225  const std::string& GetScriptName();
226  const std::string& GetScriptFile();
227  bool GetTrainerPilot();
228  bool GetFixScene();
229  bool GetShowSoluce();
230  bool GetSceneSoluce();
231  bool GetShowAll();
232  bool GetRadar();
233  MissionType GetMissionType();
234 
235  int GetGamerFace();
236  int GetGamerGlasses();
237  bool GetGamerOnlyHead();
238  float GetPersoAngle();
239 
240  void SetLevel(LevelCategory cat, int chap, int rank);
241  LevelCategory GetLevelCategory();
242  int GetLevelChap();
243  int GetLevelRank();
244  std::string GetCustomLevelDir();
245  void SetReadScene(std::string path);
246  void UpdateChapterPassed();
247 
248  void StartMusic();
249  void UpdatePause(PauseType pause);
250  void UpdatePauseMusic(PauseMusic music);
251  void ClearInterface();
252  void ChangeColor();
253 
254  float SearchNearestObject(Math::Vector center, CObject *exclu);
255  bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
256  bool FlatFreeSpace(Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu);
257  float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
258  void HideDropZone(CObject* metal);
259  void ShowDropZone(CObject* metal, CObject* transporter);
260  void FlushShowLimit(int i);
261  void SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos,
262  float radius, float duration=SHOWLIMITTIME);
263  void StartShowLimit();
264  void FrameShowLimit(float rTime);
265 
266  void SaveAllScript();
267  void SaveOneScript(CObject *obj);
268  bool SaveFileStack(CObject *obj, FILE *file, int objRank);
269  bool ReadFileStack(CObject *obj, FILE *file, int objRank);
270 
271  void FlushNewScriptName();
272  void AddNewScriptName(ObjectType type, const std::string& name);
273  std::string GetNewScriptName(ObjectType type, int rank);
274 
275  void SelectPlayer(std::string playerName);
276  CPlayerProfile* GetPlayerProfile();
277 
278  bool IOIsBusy();
279  bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, const std::string& info, bool emergencySave = false);
280  void IOWriteSceneFinished();
281  CObject* IOReadScene(std::string filename, std::string filecbot);
282  void IOWriteObject(CLevelParserLine *line, CObject* obj, const std::string& programDir, int objRank);
283  CObject* IOReadObject(CLevelParserLine *line, const std::string& programDir, const std::string& objCounterText, float objectProgress, int objRank = -1);
284 
285  int CreateSpot(Math::Vector pos, Gfx::Color color);
286 
287  CObject* GetSelect();
288 
289  void DisplayError(Error err, CObject* pObj, float time=10.0f);
290  void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);
291 
292  void UpdateCustomLevelList();
293  std::string GetCustomLevelName(int id);
294  const std::vector<std::string>& GetCustomLevelList();
295 
297  bool IsLoading();
298 
299  void StartMissionTimer();
300 
301  void SetAutosave(bool enable);
302  bool GetAutosave();
303  void SetAutosaveInterval(int interval);
304  int GetAutosaveInterval();
305  void SetAutosaveSlots(int slots);
306  int GetAutosaveSlots();
307 
309  void SetExitAfterMission(bool exit);
310 
312  bool CanPlayerInteract();
313 
315  const std::string& GetTeamName(int id);
316 
318  bool IsTeamColorDefined(int id);
319 
321 
322  int GetEnableBuild();
323  void SetEnableBuild(int enableBuild);
325 
327  int GetEnableResearch();
328  void SetEnableResearch(int enableResearch);
330 
332  int GetDoneResearch(int team);
333  void SetDoneResearch(int doneResearch, int team);
335 
337 
338  bool IsBuildingEnabled(BuildType type);
339  bool IsBuildingEnabled(ObjectType type);
341  bool IsResearchEnabled(ResearchType type);
344  bool IsResearchDone(ResearchType type, int team);
346  void MarkResearchDone(ResearchType type, int team);
347 
349 
350  bool CanBuild(ObjectType type, int team);
351  Error CanBuildError(ObjectType type, int team);
353 
355 
356  bool CanFactory(ObjectType type, int team);
357  Error CanFactoryError(ObjectType type, int team);
359 
360  void RemoveFromSelectionHistory(CObject* object);
361 
363  float GetGlobalMagnifyDamage();
364 
365  void StartDetectEffect(COldObject* object, CObject* target);
366 
367  bool IsSelectable(CObject* obj);
368 
369  void SetDebugCrashSpheres(bool draw);
370 
371  bool GetDebugCrashSpheres();
372 
373 protected:
374  bool EventFrame(const Event &event);
375  bool EventObject(const Event &event);
376  void InitEye();
377 
378  void ShowSaveIndicator(bool show);
379 
380  void CreateScene(bool soluce, bool fixScene, bool resetObject);
381  void ResetCreate();
382 
383  void LevelLoadingError(const std::string& error, const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);
384 
385  int CreateLight(Math::Vector direction, Gfx::Color color);
386  void HiliteClear();
387  void HiliteObject(Math::Point pos);
388  void HiliteFrame(float rTime);
389  void CreateTooltip(Math::Point pos, const std::string& text);
390  void ClearTooltip();
392  void ChangeCamera();
393  void AbortMovie();
394  void SelectOneObject(CObject* obj, bool displayError=true);
395  void HelpObject();
396  bool DeselectObject();
397  void DeleteAllObjects();
398  void UpdateInfoText();
399  void StartDisplayVisit(EventType event);
400  void FrameVisit(float rTime);
401  void StopDisplayVisit();
402  void ExecuteCmd(const std::string& cmd);
403  void UpdateSpeedLabel();
404 
405  void AutosaveRotate();
406  void Autosave();
407  bool DestroySelectedObject();
408  void PushToSelectionHistory(CObject* obj);
409  CObject* PopFromSelectionHistory();
410 
411  void CreateCodeBattleInterface();
412  void DestroyCodeBattleInterface();
413  void SetCodeBattleSpectatorMode(bool mode);
414  void UpdateDebugCrashSpheres();
415 
416 
417 protected:
418  CApplication* m_app = nullptr;
419  CEventQueue* m_eventQueue = nullptr;
420  Gfx::CEngine* m_engine = nullptr;
421  Gfx::CParticle* m_particle = nullptr;
422  Gfx::CWater* m_water = nullptr;
423  Gfx::CCloud* m_cloud = nullptr;
424  Gfx::CLightning* m_lightning = nullptr;
425  Gfx::CPlanet* m_planet = nullptr;
426  Gfx::COldModelManager* m_oldModelManager = nullptr;
427  Gfx::CLightManager* m_lightMan = nullptr;
428  CSoundInterface* m_sound = nullptr;
429  CInput* m_input = nullptr;
430  std::unique_ptr<CObjectManager> m_objMan;
431  std::unique_ptr<CMainMovie> m_movie;
432  std::unique_ptr<CPauseManager> m_pause;
433  std::unique_ptr<Gfx::CModelManager> m_modelManager;
434  std::unique_ptr<Gfx::CTerrain> m_terrain;
435  std::unique_ptr<Gfx::CCamera> m_camera;
436  std::unique_ptr<Ui::CMainUserInterface> m_ui;
437  std::unique_ptr<Ui::CMainShort> m_short;
438  std::unique_ptr<Ui::CMainMap> m_map;
439  std::unique_ptr<Ui::CInterface> m_interface;
440  std::unique_ptr<Ui::CDisplayInfo> m_displayInfo;
441  std::unique_ptr<Ui::CDisplayText> m_displayText;
442  std::unique_ptr<Ui::CDebugMenu> m_debugMenu;
443  std::unique_ptr<CSettings> m_settings;
444 
446  std::unique_ptr<CPlayerProfile> m_playerProfile;
447 
448 
450  float m_time = 0.0f;
452  float m_gameTime = 0.0f;
454  float m_gameTimeAbsolute = 0.0f;
455 
456  LevelCategory m_levelCategory;
457  int m_levelChap = 0;
458  int m_levelRank = 0;
460  std::string m_levelFile = "";
461  std::string m_sceneReadPath;
462 
463  float m_winDelay = 0.0f;
464  float m_lostDelay = 0.0f;
465  bool m_fixScene = false; // scene fixed, no interraction
466  CObject* m_base = nullptr; // OBJECT_BASE exists in mission
467  CObject* m_selectObject = nullptr;
468 
469  Phase m_phase = PHASE_WELCOME1;
470  ActivePause* m_userPause = nullptr;
471  ActivePause* m_focusPause = nullptr;
472  ActivePause* m_freePhotoPause = nullptr;
473  bool m_cmdEdit = false;
474  ActivePause* m_cmdEditPause = nullptr;
475  bool m_selectInsect = false;
476  bool m_showSoluce = false;
477  bool m_showAll = false;
478  bool m_cheatRadar = false;
479  bool m_shortCut = false;
480  std::string m_audioTrack;
481  bool m_audioRepeat = false;
482  std::string m_satcomTrack;
483  bool m_satcomRepeat = false;
484  std::string m_editorTrack;
485  bool m_editorRepeat = false;
486  int m_movieInfoIndex = 0;
487 
488  CObject* m_controller = nullptr;
489 
490  MissionType m_missionType = MISSION_NORMAL;
491  bool m_immediatSatCom = false; // SatCom immediately?
492  bool m_beginSatCom = false; // messages SatCom poster?
493  bool m_lockedSatCom = false; // SatCom locked?
494  bool m_movieLock = false; // movie in progress?
495  bool m_satComLock = false; // call of SatCom is possible?
496  bool m_editLock = false; // edition in progress?
497  bool m_editFull = false; // edition in full screen?
498  bool m_hilite = false;
499  bool m_trainerPilot = false; // remote trainer?
500  bool m_friendAim = false;
501  bool m_resetCreate = false;
502  bool m_mapShow = false;
503  bool m_mapImage = false;
504  char m_mapFilename[100] = {};
505 
506  ActivePause* m_suspend = nullptr;
507 
508  Math::Point m_tooltipPos;
509  std::string m_tooltipName;
510  float m_tooltipTime = 0.0f;
511 
512  char m_infoFilename[SATCOM_MAX][100] = {}; // names of text files
513  CObject* m_infoObject = nullptr;
514  int m_infoUsed = 0;
515  ActivePause* m_satcomMoviePause = nullptr;
516 
517  std::string m_scriptName = "";
518  std::string m_scriptFile = "";
519  std::string m_endingWin = "";
520  std::string m_endingLost = "";
521  bool m_winTerminate = false;
522 
523  float m_globalMagnifyDamage = 0.0f;
524 
525  bool m_exitAfterMission = false;
526 
527  bool m_codeBattleInit = false;
528  bool m_codeBattleStarted = false;
531 
532  std::map<int, std::string> m_teamNames;
533 
534  std::vector<NewScriptName> m_newScriptName;
535 
536  EventType m_visitLast = EVENT_NULL;
537  CObject* m_visitObject = nullptr;
538  CObject* m_visitArrow = nullptr;
539  float m_visitTime = 0.0f;
540  float m_visitParticle = 0.0f;
541  Math::Vector m_visitPos;
542  Math::Vector m_visitPosArrow;
543  ActivePause* m_visitPause = nullptr;
544 
545  std::vector<std::unique_ptr<CSceneEndCondition>> m_endTake;
547  bool m_endTakeImmediat = false;
548  long m_endTakeResearch = 0;
549  float m_endTakeWinDelay = 0.0f;
550  float m_endTakeLostDelay = 0.0f;
551 
552  std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;
553 
554  std::map<std::string, MinMax> m_obligatoryTokens;
555 
557  int m_build = 0;
561  std::map<int, int> m_researchDone;
562 
563  Error m_missionResult = ERR_OK;
566 
567  ShowLimit m_showLimit[MAXSHOWLIMIT];
568 
569  std::map<int, Gfx::Color> m_colorNewBot;
570  Gfx::Color m_colorNewAlien;
571  Gfx::Color m_colorNewGreen;
572  Gfx::Color m_colorNewWater;
573  float m_colorShiftWater = 0.0f;
574 
575  bool m_missionTimerEnabled = false;
576  bool m_missionTimerStarted = false;
577  float m_missionTimer = 0.0f;
578 
579  bool m_autosave = false;
580  int m_autosaveInterval = 0;
581  int m_autosaveSlots = 0;
582  float m_autosaveLast = 0.0f;
583 
584  int m_shotSaving = 0;
585 
586  std::deque<CObject*> m_selectionHistory;
587  bool m_debugCrashSpheres;
588 };
const std::string & GetTeamName(int id)
Returns team name for the given team id.
Definition: robotmain.cpp:5574
void AddNewScriptName(ObjectType type, const std::string &name)
Adds a script name.
Definition: robotmain.cpp:4443
void StartDisplayVisit(EventType event)
Start of the visit instead of an error.
Definition: robotmain.cpp:1607
void SetFriendAim(bool friendAim)
Indicates whether mouse is on an friend object, on which we should not shoot.
Definition: robotmain.cpp:5387
Definition: pausemanager.cpp:31
CSingleton base class for singletons.
void StartMusic()
Starts music with a mission.
Definition: robotmain.cpp:5399
float SearchNearestObject(Math::Vector center, CObject *exclu)
Calculates the distance to the nearest object.
Definition: robotmain.cpp:3973
void StopSuspend()
End of dialogue during the game.
Definition: robotmain.cpp:1578
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu)
Calculates a free space.
Definition: robotmain.cpp:4022
ParticleType
Definition: particle.h:63
bool IsResearchEnabled(ResearchType type)
Returns true if the given research is enabled.
Definition: robotmain.cpp:5644
void SetSpeed(float speed)
Changes game speed.
Definition: robotmain.cpp:5262
Definition: displaytext.h:51
bool GetShowMap()
Indicates whether the mini-map is visible.
Definition: robotmain.cpp:5312
void IOWriteSceneFinished()
Notifies the user that scene write is finished.
Definition: robotmain.cpp:4685
MainMovieType GetMainMovie()
Returns the type of current movie.
Definition: robotmain.cpp:1452
void StopDisplayInfo()
End of displaying of instructions.
Definition: robotmain.cpp:1526
std::string GetCustomLevelDir()
Returns folder name of the scene that user selected to play.
Definition: robotmain.cpp:5244
bool m_missionResultFromScript
true if m_missionResult has been set by LevelController script, this disables normal EndMissionTake p...
Definition: robotmain.h:565
Definition: robotmain.h:132
bool IsResearchDone(ResearchType type, int team)
Returns true if the given research is done.
Definition: robotmain.cpp:5649
void InitEye()
Initializes the view.
Definition: robotmain.cpp:2346
bool SelectObject(CObject *obj, bool displayError=true)
Selects the object aimed by the mouse.
Definition: robotmain.cpp:1847
bool DeselectObject()
Deselects the selected object.
Definition: robotmain.cpp:1886
Definition: robotmain.h:108
CObject * SearchNearest(Math::Vector pos, CObject *exclu)
Returns the nearest selectable object from a given position.
Definition: robotmain.cpp:1940
Camera handling - CCamera class.
int m_build
Enabled buildings.
Definition: robotmain.h:557
void StartDisplayInfo(int index, bool movie)
Definition: robotmain.cpp:1470
bool m_codeBattleSpectator
Code battle spectator mode, hides object UI, changes camera to CAM_TYPE_PLANE and allows for switchin...
Definition: robotmain.h:530
void HiliteClear()
Removes setting evidence of the object with the mouse hovers over.
Definition: robotmain.cpp:2066
int CreateSpot(Math::Vector pos, Gfx::Color color)
Creates a light spot.
Definition: robotmain.cpp:3796
bool CanBuild(ObjectType type, int team)
Retruns true if all requirements to build this object are met (EnableBuild + DoneResearch) ...
Definition: robotmain.cpp:5686
Audio change condition.
Definition: scene_conditions.h:97
float m_gameTime
Playing time since level start.
Definition: robotmain.h:452
void FrameVisit(float rTime)
Move the arrow to visit.
Definition: robotmain.cpp:1706
Definition: singleton.h:30
void ClearInterface()
Removes hilite and tooltip.
Definition: robotmain.cpp:5438
int GetGamerFace()
Returns the representation to use for the player.
Definition: robotmain.cpp:5196
Manager for static models.
Definition: oldmodelmanager.h:54
void CreateTooltip(Math::Point pos, const std::string &text)
Creates a tooltip.
Definition: robotmain.cpp:2168
std::string GetNewScriptName(ObjectType type, int rank)
Seeks a script name for a given type.
Definition: robotmain.cpp:4452
Definition: old_object.h:79
bool CreateShortcuts()
Creates interface shortcuts to the units.
Definition: robotmain.cpp:5297
void SaveOneScript(CObject *obj)
Saves all programs of the robot.
Definition: robotmain.cpp:4395
void SetEditLock(bool lock, bool edit)
Management of the lock mode for the edition.
Definition: robotmain.cpp:5350
CObject * GetSelectObject()
Returns the object that default was select after the creation of a scene.
Definition: robotmain.cpp:1773
void SetMissionResultFromScript(Error result, float delay)
Set mission result from LevelController script.
Definition: robotmain.cpp:4923
Global event queue.
Definition: event.h:866
void ExecuteCmd(const std::string &cmd)
Executes a command.
Definition: robotmain.cpp:1148
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
PauseType
Definition: pausemanager.h:35
ObjectType enum.
Definition: parserline.h:37
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME)
Specifies the boundaries to show.
Definition: robotmain.cpp:4279
std::string m_levelFile
if set, loads this file instead of building from category/chap/rank
Definition: robotmain.h:460
void FlushNewScriptName()
Empty the list.
Definition: robotmain.cpp:4437
void ChangeCamera()
Change the mode of the camera.
Definition: robotmain.cpp:2237
Definition: robotmain.h:159
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:3775
Particle engine.
Definition: particle.h:223
bool IsSelectable(CObject *obj)
Indicates whether an object is selectable.
Definition: robotmain.cpp:2024
void UpdateMap()
Updates the map.
Definition: robotmain.cpp:5306
bool IsTeamColorDefined(int id)
Returns true if team-specific colored texture is available.
Definition: robotmain.cpp:5580
bool FlatFreeSpace(Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu)
Calculates a flat free space.
Definition: robotmain.cpp:4087
float GetPersoAngle()
Returns the angle of presentation.
Definition: robotmain.cpp:5214
CObject * DeselectAll()
Deselects everything, and returns the object that was selected.
Definition: robotmain.cpp:1780
bool IsLoading()
Returns true if the game is on the loading screen.
Definition: robotmain.cpp:5469
virtual ~CRobotMain()
Destructor of robot application.
Definition: robotmain.cpp:280
float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu)
Calculates the maximum radius of a free space.
Definition: robotmain.cpp:4160
Definition: settings.h:32
CObject * IOReadObject(CLevelParserLine *line, const std::string &programDir, const std::string &objCounterText, float objectProgress, int objRank=-1)
Resumes the game.
Definition: robotmain.cpp:4692
Planet manager.
Definition: planet.h:49
CMainMovie - control over movie sequences.
float GetGlobalMagnifyDamage()
Returns global magnifyDamage setting.
Definition: robotmain.cpp:5747
void ScenePerso()
Load the scene for the character.
Definition: robotmain.cpp:2676
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:4484
void SelectOneObject(CObject *obj, bool displayError=true)
Selects an object, without attending to deselect the rest.
Definition: robotmain.cpp:1794
bool GetGamerOnlyHead()
Returns the mode with just the head.
Definition: robotmain.cpp:5208
const std::map< std::string, MinMax > & GetObligatoryTokenList()
Returns the list instructions required in CBot program in level.
Definition: robotmain.cpp:5130
CObject * SearchToto()
Returns the object toto.
Definition: robotmain.cpp:1934
bool IOIsBusy()
Seeks if an object occupies in a spot, to prevent a backup of the game.
Definition: robotmain.cpp:4469
void FlushShowLimit(int i)
Erases the boundaries shown.
Definition: robotmain.cpp:4263
2D point
Definition: point.h:50
bool CanPlayerInteract()
Returns true if player can interact with things manually.
Definition: robotmain.cpp:5564
void SelectHuman()
Selects the human.
Definition: robotmain.cpp:1922
Main application.
Definition: app.h:152
void ShowDropZone(CObject *metal, CObject *transporter)
Shows the buildable area when a cube of metal is deposited.
Definition: robotmain.cpp:4189
void UpdateInfoText()
Updates the text information.
Definition: robotmain.cpp:2330
void HiliteObject(Math::Point pos)
Highlights the object with the mouse hovers over.
Definition: robotmain.cpp:2088
void StartSuspend()
Beginning of a dialogue during the game.
Definition: robotmain.cpp:1558
void ChangePhase(Phase phase)
Changes phase.
Definition: robotmain.cpp:361
void SetSatComLock(bool lock)
Management of the blocking of the call of SatCom.
Definition: robotmain.cpp:5339
long m_researchEnable
Available researches.
Definition: robotmain.h:559
Camera moving in 3D scene.
Definition: camera.h:128
void ResetCreate()
Resets all objects to their original position.
Definition: robotmain.cpp:4870
void SetExitAfterMission(bool exit)
Enable mode where completing mission closes the game.
Definition: robotmain.cpp:5559
int GetDoneResearch(int team)
Get/set done researches.
Definition: robotmain.cpp:5608
Management of pause modes.
Terrain loader/generator and manager.
Definition: terrain.h:147
bool ReadFileStack(CObject *obj, FILE *file, int objRank)
Resumes the execution stack of the program in a robot.
Definition: robotmain.cpp:4421
Error CheckEndMission(bool frame)
Checks if the mission is over.
Definition: robotmain.cpp:5049
bool SaveFileStack(CObject *obj, FILE *file, int objRank)
Saves the stack of the program in execution of a robot.
Definition: robotmain.cpp:4406
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:4539
bool IsBuildingEnabled(BuildType type)
Returns true if the given building is enabled.
Definition: robotmain.cpp:5619
Namespace for (new) graphics code.
Definition: app.h:49
void FrameShowLimit(float rTime)
Advances the boundaries shown.
Definition: robotmain.cpp:4326
Definition: player_profile.h:58
The graphics engine.
Definition: engine.h:585
bool ProcessEvent(Event &event)
Processes an event.
Definition: robotmain.cpp:647
bool GetTrainerPilot()
Indicates whether it is possible to control a driving robot.
Definition: robotmain.cpp:5136
CObject * DetectObject(Math::Point pos)
Detects the object aimed by the mouse.
Definition: robotmain.cpp:1976
CObject * SearchHuman()
Returns the object human.
Definition: robotmain.cpp:1928
std::unique_ptr< CPlayerProfile > m_playerProfile
Progress of loaded player.
Definition: robotmain.h:446
Event types, structs and event queue.
bool EventObject(const Event &event)
Makes the event for all robots.
Definition: robotmain.cpp:2653
void HiliteFrame(float rTime)
Highlights the object with the mouse hovers over.
Definition: robotmain.cpp:2151
void SetMovieLock(bool lock)
Management of the lock mode for movies.
Definition: robotmain.cpp:5319
void StartShowLimit()
Mount the boundaries of the selected object.
Definition: robotmain.cpp:4315
void AbortMovie()
Cancels the current movie.
Definition: robotmain.cpp:2304
ObjectType
Type of game object.
Definition: object_type.h:33
void HelpObject()
Displays help for an object.
Definition: robotmain.cpp:2224
Water manager/renderer.
Definition: water.h:72
CObject * GetSelect()
Returns the selected object.
Definition: robotmain.cpp:1964
CRobotMain()
Constructor of robot application.
Definition: robotmain.cpp:131
void CreateScene(bool soluce, bool fixScene, bool resetObject)
Creates the whole scene.
Definition: robotmain.cpp:2711
Definition: robotmain.h:144
bool DestroySelectedObject()
Deletes the selected object.
Definition: robotmain.cpp:2048
void HideDropZone(CObject *metal)
Hides buildable area when a cube of metal is taken up.
Definition: robotmain.cpp:4173
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:454
void ResetObject()
Resets all objects to their original position.
Definition: robotmain.cpp:4863
bool CanFactory(ObjectType type, int team)
Retruns true if all requirements to create this object in BotFactory are met (DoneResearch) ...
Definition: robotmain.cpp:5714
void SaveAllScript()
Saves all programs of all the robots.
Definition: robotmain.cpp:4386
void UpdateAudio(bool frame)
Updates the audiotracks.
Definition: robotmain.cpp:4907
RGBA color.
Definition: color.h:39
int GetEnableResearch()
Get/set enabled researches.
Definition: robotmain.cpp:5598
Manages CObject instances.
Definition: object_manager.h:148
void StopDisplayVisit()
End of the visit instead of an error.
Definition: robotmain.cpp:1736
EventType
Type of event message.
Definition: event.h:41
void ChangeColor()
Change the colors and textures.
Definition: robotmain.cpp:3821
float m_time
Time since level start, including pause and intro movie.
Definition: robotmain.h:450
Event sent by system, interface or game.
Definition: event.h:735
Definition: pausemanager.h:71
void SelectPlayer(std::string playerName)
Changes current player.
Definition: robotmain.cpp:4848
char * GetDisplayInfoName(int index)
Returns the name of the text display.
Definition: robotmain.cpp:1551
Error ProcessEndMissionTake()
Definition: robotmain.cpp:4960
Definition: interface.h:59
Base class for all 3D in-game objects.
Definition: object.h:63
bool m_endTakeImmediat
If true, the mission ends immediately after completing the requirements without requiring SpaceShip t...
Definition: robotmain.h:547
float GetGameTime()
Returns the absolute time of the game.
Definition: robotmain.cpp:1600
void DeleteAllObjects()
Quickly removes all objects.
Definition: robotmain.cpp:1904
bool EventFrame(const Event &event)
Advances the entire scene.
Definition: robotmain.cpp:2354
int GetEnableBuild()
Get/set enabled buildings.
Definition: robotmain.cpp:5588
int GetGamerGlasses()
Returns the representation to use for the player.
Definition: robotmain.cpp:5202
Sound plugin interface.
Definition: sound.h:60
void MarkResearchDone(ResearchType type, int team)
Marks research as done.
Definition: robotmain.cpp:5660
void FlushDisplayInfo()
Clears the display of instructions.
Definition: robotmain.cpp:1459
void SetEditFull(bool full)
Management of the fullscreen mode during editing.
Definition: robotmain.cpp:5375
bool GetFixScene()
Indicates whether the scene is fixed, without interaction.
Definition: robotmain.cpp:5142
Definition: robotmain.h:119
std::map< int, int > m_researchDone
Done researches for each team.
Definition: robotmain.h:561
Management of mouse, keyboard and joystick.
Definition: input.h:71
void ClearTooltip()
Clears the previous tooltip.
Definition: robotmain.cpp:2217
void UpdateShortcuts()
Updates all the shortcuts.
Definition: robotmain.cpp:1767
CObject * IOReadScene(std::string filename, std::string filecbot)
Resumes some part of the game.
Definition: robotmain.cpp:4738