29 #include "common/error.h" 36 #include "level/build_type.h" 37 #include "level/level_category.h" 39 #include "level/research_type.h" 41 #include "object/drive_type.h" 42 #include "object/mission_type.h" 44 #include "object/tool_type.h" 77 std::string PhaseToString(Phase phase);
78 bool IsInSimulationConfigPhase(Phase phase);
79 bool IsPhaseWithWorld(Phase phase);
80 bool IsMainMenuPhase(Phase phase);
110 class CMainUserInterface;
122 std::string name =
"";
126 const int MAXSHOWLIMIT = 5;
127 const int MAXSHOWPARTI = 200;
128 const float SHOWLIMITTIME = 20.0f;
130 const int MAXSCENE = 999;
138 int parti[MAXSHOWPARTI] = {};
140 float duration = 0.0f;
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;
171 void ChangePhase(Phase phase);
172 bool ProcessEvent(
Event &event);
175 bool CreateShortcuts();
178 void SetMovieLock(
bool lock);
181 void SetSatComLock(
bool lock);
182 bool GetSatComLock();
183 void SetEditLock(
bool lock,
bool edit);
185 void SetEditFull(
bool full);
187 void SetFriendAim(
bool friendAim);
190 void SetSpeed(
float speed);
193 void UpdateShortcuts();
198 bool SelectObject(
CObject* obj,
bool displayError=
true);
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();
212 MainMovieType GetMainMovie();
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);
225 const std::string& GetScriptName();
226 const std::string& GetScriptFile();
227 bool GetTrainerPilot();
229 bool GetShowSoluce();
230 bool GetSceneSoluce();
233 MissionType GetMissionType();
236 int GetGamerGlasses();
237 bool GetGamerOnlyHead();
238 float GetPersoAngle();
240 void SetLevel(LevelCategory cat,
int chap,
int rank);
241 LevelCategory GetLevelCategory();
244 std::string GetCustomLevelDir();
245 void SetReadScene(std::string path);
246 void UpdateChapterPassed();
250 void UpdatePauseMusic(PauseMusic music);
251 void ClearInterface();
255 bool FreeSpace(
Math::Vector ¢er,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
256 bool FlatFreeSpace(
Math::Vector ¢er,
float minFlat,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
258 void HideDropZone(
CObject* metal);
260 void FlushShowLimit(
int i);
262 float radius,
float duration=SHOWLIMITTIME);
263 void StartShowLimit();
264 void FrameShowLimit(
float rTime);
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);
271 void FlushNewScriptName();
272 void AddNewScriptName(
ObjectType type,
const std::string& name);
273 std::string GetNewScriptName(
ObjectType type,
int rank);
275 void SelectPlayer(std::string playerName);
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);
283 CObject* IOReadObject(
CLevelParserLine *line,
const std::string& programDir,
const std::string& objCounterText,
float objectProgress,
int objRank = -1);
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);
292 void UpdateCustomLevelList();
293 std::string GetCustomLevelName(
int id);
294 const std::vector<std::string>& GetCustomLevelList();
299 void StartMissionTimer();
301 void SetAutosave(
bool enable);
303 void SetAutosaveInterval(
int interval);
304 int GetAutosaveInterval();
305 void SetAutosaveSlots(
int slots);
306 int GetAutosaveSlots();
309 void SetExitAfterMission(
bool exit);
312 bool CanPlayerInteract();
315 const std::string& GetTeamName(
int id);
318 bool IsTeamColorDefined(
int id);
322 int GetEnableBuild();
323 void SetEnableBuild(
int enableBuild);
327 int GetEnableResearch();
328 void SetEnableResearch(
int enableResearch);
332 int GetDoneResearch(
int team);
333 void SetDoneResearch(
int doneResearch,
int team);
338 bool IsBuildingEnabled(BuildType type);
341 bool IsResearchEnabled(ResearchType type);
344 bool IsResearchDone(ResearchType type,
int team);
346 void MarkResearchDone(ResearchType type,
int team);
351 Error CanBuildError(
ObjectType type,
int team);
357 Error CanFactoryError(
ObjectType type,
int team);
360 void RemoveFromSelectionHistory(
CObject*
object);
363 float GetGlobalMagnifyDamage();
367 bool IsSelectable(
CObject* obj);
369 void SetDebugCrashSpheres(
bool draw);
371 bool GetDebugCrashSpheres();
374 bool EventFrame(
const Event &event);
375 bool EventObject(
const Event &event);
378 void ShowSaveIndicator(
bool show);
380 void CreateScene(
bool soluce,
bool fixScene,
bool resetObject);
383 void LevelLoadingError(
const std::string& error,
const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);
388 void HiliteFrame(
float rTime);
389 void CreateTooltip(
Math::Point pos,
const std::string& text);
394 void SelectOneObject(
CObject* obj,
bool displayError=
true);
396 bool DeselectObject();
397 void DeleteAllObjects();
398 void UpdateInfoText();
400 void FrameVisit(
float rTime);
401 void StopDisplayVisit();
402 void ExecuteCmd(
const std::string& cmd);
403 void UpdateSpeedLabel();
405 void AutosaveRotate();
407 bool DestroySelectedObject();
408 void PushToSelectionHistory(
CObject* obj);
409 CObject* PopFromSelectionHistory();
411 void CreateCodeBattleInterface();
412 void DestroyCodeBattleInterface();
413 void SetCodeBattleSpectatorMode(
bool mode);
414 void UpdateDebugCrashSpheres();
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;
452 float m_gameTime = 0.0f;
454 float m_gameTimeAbsolute = 0.0f;
456 LevelCategory m_levelCategory;
460 std::string m_levelFile =
"";
461 std::string m_sceneReadPath;
463 float m_winDelay = 0.0f;
464 float m_lostDelay = 0.0f;
465 bool m_fixScene =
false;
467 CObject* m_selectObject =
nullptr;
469 Phase m_phase = PHASE_WELCOME1;
473 bool m_cmdEdit =
false;
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;
488 CObject* m_controller =
nullptr;
490 MissionType m_missionType = MISSION_NORMAL;
491 bool m_immediatSatCom =
false;
492 bool m_beginSatCom =
false;
493 bool m_lockedSatCom =
false;
494 bool m_movieLock =
false;
495 bool m_satComLock =
false;
496 bool m_editLock =
false;
497 bool m_editFull =
false;
498 bool m_hilite =
false;
499 bool m_trainerPilot =
false;
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] = {};
509 std::string m_tooltipName;
510 float m_tooltipTime = 0.0f;
512 char m_infoFilename[SATCOM_MAX][100] = {};
513 CObject* m_infoObject =
nullptr;
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;
523 float m_globalMagnifyDamage = 0.0f;
525 bool m_exitAfterMission =
false;
527 bool m_codeBattleInit =
false;
528 bool m_codeBattleStarted =
false;
530 bool m_codeBattleSpectator =
true;
532 std::map<int, std::string> m_teamNames;
534 std::vector<NewScriptName> m_newScriptName;
537 CObject* m_visitObject =
nullptr;
538 CObject* m_visitArrow =
nullptr;
539 float m_visitTime = 0.0f;
540 float m_visitParticle = 0.0f;
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;
552 std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;
554 std::map<std::string, MinMax> m_obligatoryTokens;
559 long m_researchEnable = 0;
563 Error m_missionResult = ERR_OK;
565 bool m_missionResultFromScript =
false;
569 std::map<int, Gfx::Color> m_colorNewBot;
573 float m_colorShiftWater = 0.0f;
575 bool m_missionTimerEnabled =
false;
576 bool m_missionTimerStarted =
false;
577 float m_missionTimer = 0.0f;
579 bool m_autosave =
false;
580 int m_autosaveInterval = 0;
581 int m_autosaveSlots = 0;
582 float m_autosaveLast = 0.0f;
584 int m_shotSaving = 0;
586 std::deque<CObject*> m_selectionHistory;
587 bool m_debugCrashSpheres;
Definition: pausemanager.cpp:31
CSingleton base class for singletons.
ParticleType
Definition: particle.h:63
Definition: displaytext.h:51
Definition: robotmain.h:132
Definition: robotmain.h:108
Camera handling - CCamera class.
Audio change condition.
Definition: scene_conditions.h:97
Definition: singleton.h:30
Manager for static models.
Definition: oldmodelmanager.h:54
Definition: old_object.h:79
Global event queue.
Definition: event.h:866
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
PauseType
Definition: pausemanager.h:35
Definition: parserline.h:37
Definition: robotmain.h:159
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Particle engine.
Definition: particle.h:223
Definition: settings.h:32
Planet manager.
Definition: planet.h:49
CMainMovie - control over movie sequences.
Scene end condition.
Definition: scene_conditions.h:73
2D point
Definition: point.h:50
Main application.
Definition: app.h:180
Camera moving in 3D scene.
Definition: camera.h:128
Management of pause modes.
Terrain loader/generator and manager.
Definition: terrain.h:147
Namespace for (new) graphics code.
Definition: app.h:49
Definition: player_profile.h:58
The graphics engine.
Definition: engine.h:585
std::unique_ptr< CPlayerProfile > m_playerProfile
Progress of loaded player.
Definition: robotmain.h:446
Event types, structs and event queue.
ObjectType
Type of game object.
Definition: object_type.h:33
Water manager/renderer.
Definition: water.h:72
Definition: robotmain.h:144
Invalid event / no event.
Definition: event.h:47
Particle rendering - CParticle class (aka particle)
3D (3x1) vector
Definition: vector.h:53
RGBA color.
Definition: color.h:39
Manages CObject instances.
Definition: object_manager.h:148
EventType
Type of event message.
Definition: event.h:41
Event sent by system, interface or game.
Definition: event.h:735
Definition: pausemanager.h:71
Definition: interface.h:59
Base class for all 3D in-game objects.
Definition: object.h:63
Sound plugin interface.
Definition: sound.h:60
Definition: robotmain.h:119
std::map< int, int > m_researchDone
Done researches for each team.
Definition: robotmain.h:561