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;
121 std::string name =
"";
125 const int MAXSHOWLIMIT = 5;
126 const int MAXSHOWPARTI = 200;
127 const float SHOWLIMITTIME = 20.0f;
129 const int MAXSCENE = 999;
137 int parti[MAXSHOWPARTI] = {};
139 float duration = 0.0f;
144 const int SATCOM_HUSTON = 0;
145 const int SATCOM_SAT = 1;
146 const int SATCOM_OBJECT = 2;
147 const int SATCOM_LOADING = 3;
148 const int SATCOM_PROG = 4;
149 const int SATCOM_SOLUCE = 5;
150 const int SATCOM_MAX = 6;
164 void ResetAfterVideoConfigChanged();
165 void ReloadAllTextures();
167 void ChangePhase(Phase phase);
168 bool ProcessEvent(
Event &event);
171 bool CreateShortcuts();
174 void SetMovieLock(
bool lock);
177 void SetSatComLock(
bool lock);
178 bool GetSatComLock();
179 void SetEditLock(
bool lock,
bool edit);
181 void SetEditFull(
bool full);
183 void SetFriendAim(
bool friendAim);
186 void SetSpeed(
float speed);
189 void UpdateShortcuts();
194 bool SelectObject(
CObject* obj,
bool displayError=
true);
199 void UpdateAudio(
bool frame);
200 void SetEndMission(Error result,
float delay);
201 Error CheckEndMission(
bool frame);
202 Error CheckEndMissionForGroup(std::vector<CSceneEndCondition*>& endTakes);
203 int GetObligatoryToken();
204 char* GetObligatoryToken(
int i);
205 int IsObligatoryToken(
const char* token);
206 bool IsProhibitedToken(
const char* token);
210 MainMovieType GetMainMovie();
212 void FlushDisplayInfo();
213 void StartDisplayInfo(
int index,
bool movie);
214 void StartDisplayInfo(
const std::string& filename,
int index);
215 void StopDisplayInfo();
216 char* GetDisplayInfoName(
int index);
223 const std::string& GetScriptName();
224 const std::string& GetScriptFile();
225 bool GetTrainerPilot();
227 bool GetShowSoluce();
228 bool GetSceneSoluce();
231 MissionType GetMissionType();
234 int GetGamerGlasses();
235 bool GetGamerOnlyHead();
236 float GetPersoAngle();
238 void SetLevel(LevelCategory cat,
int chap,
int rank);
239 LevelCategory GetLevelCategory();
242 std::string GetCustomLevelDir();
243 void SetReadScene(std::string path);
244 void UpdateChapterPassed();
248 void UpdatePauseMusic(PauseMusic music);
249 void ClearInterface();
253 bool FreeSpace(
Math::Vector ¢er,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
254 bool FlatFreeSpace(
Math::Vector ¢er,
float minFlat,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
256 void HideDropZone(
CObject* metal);
258 void FlushShowLimit(
int i);
260 float radius,
float duration=SHOWLIMITTIME);
261 void StartShowLimit();
262 void FrameShowLimit(
float rTime);
264 void SaveAllScript();
265 void SaveOneScript(
CObject *obj);
266 bool SaveFileStack(
CObject *obj, FILE *file,
int objRank);
267 bool ReadFileStack(
CObject *obj, FILE *file,
int objRank);
269 void FlushNewScriptName();
270 void AddNewScriptName(
ObjectType type,
const std::string& name);
271 std::string GetNewScriptName(
ObjectType type,
int rank);
273 void SelectPlayer(std::string playerName);
277 bool IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot,
const std::string& info,
bool emergencySave =
false);
278 void IOWriteSceneFinished();
279 CObject* IOReadScene(std::string filename, std::string filecbot);
281 CObject* IOReadObject(
CLevelParserLine *line,
const std::string& programDir,
const std::string& objCounterText,
float objectProgress,
int objRank = -1);
287 void DisplayError(Error err,
CObject* pObj,
float time=10.0f);
288 void DisplayError(Error err,
Math::Vector goal,
float height=15.0f,
float dist=60.0f,
float time=10.0f);
290 void UpdateCustomLevelList();
291 std::string GetCustomLevelName(
int id);
292 const std::vector<std::string>& GetCustomLevelList();
297 void StartMissionTimer();
299 void SetAutosave(
bool enable);
301 void SetAutosaveInterval(
int interval);
302 int GetAutosaveInterval();
303 void SetAutosaveSlots(
int slots);
304 int GetAutosaveSlots();
307 void SetExitAfterMission(
bool exit);
310 bool CanPlayerInteract();
313 const std::string& GetTeamName(
int id);
316 bool IsTeamColorDefined(
int id);
320 int GetEnableBuild();
321 void SetEnableBuild(
int enableBuild);
325 int GetEnableResearch();
326 void SetEnableResearch(
int enableResearch);
330 int GetDoneResearch(
int team);
331 void SetDoneResearch(
int doneResearch,
int team);
336 bool IsBuildingEnabled(BuildType type);
339 bool IsResearchEnabled(ResearchType type);
342 bool IsResearchDone(ResearchType type,
int team);
344 void MarkResearchDone(ResearchType type,
int team);
349 Error CanBuildError(
ObjectType type,
int team);
355 Error CanFactoryError(
ObjectType type,
int team);
358 void RemoveFromSelectionHistory(
CObject*
object);
361 float GetGlobalMagnifyDamage();
365 bool IsSelectable(
CObject* obj);
368 bool EventFrame(
const Event &event);
369 bool EventObject(
const Event &event);
372 void ShowSaveIndicator(
bool show);
374 void CreateScene(
bool soluce,
bool fixScene,
bool resetObject);
377 void LevelLoadingError(
const std::string& error,
const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);
382 void HiliteFrame(
float rTime);
383 void CreateTooltip(
Math::Point pos,
const std::string& text);
387 void RemoteCamera(
float pan,
float zoom,
float rTime);
390 void SelectOneObject(
CObject* obj,
bool displayError=
true);
392 bool DeselectObject();
393 void DeleteAllObjects();
394 void UpdateInfoText();
396 void FrameVisit(
float rTime);
397 void StopDisplayVisit();
398 void ExecuteCmd(
char *cmd);
399 void UpdateSpeedLabel();
401 int AutosaveRotate(
bool freeOne);
403 bool DestroySelectedObject();
404 void PushToSelectionHistory(
CObject* obj);
405 CObject* PopFromSelectionHistory();
407 void CreateCodeBattleInterface();
408 void DestroyCodeBattleInterface();
409 void SetCodeBattleSpectatorMode(
bool mode);
410 void UpdateDebugCrashSpheres();
425 CInput* m_input =
nullptr;
426 std::unique_ptr<CObjectManager> m_objMan;
427 std::unique_ptr<CMainMovie> m_movie;
428 std::unique_ptr<CPauseManager> m_pause;
429 std::unique_ptr<Gfx::CModelManager> m_modelManager;
430 std::unique_ptr<Gfx::CTerrain> m_terrain;
431 std::unique_ptr<Gfx::CCamera> m_camera;
432 std::unique_ptr<Ui::CMainUserInterface> m_ui;
433 std::unique_ptr<Ui::CMainShort> m_short;
434 std::unique_ptr<Ui::CMainMap> m_map;
435 std::unique_ptr<Ui::CInterface> m_interface;
436 std::unique_ptr<Ui::CDisplayInfo> m_displayInfo;
437 std::unique_ptr<Ui::CDisplayText> m_displayText;
438 std::unique_ptr<CSettings> m_settings;
447 float m_gameTime = 0.0f;
449 float m_gameTimeAbsolute = 0.0f;
451 LevelCategory m_levelCategory;
454 std::string m_sceneReadPath;
456 float m_winDelay = 0.0f;
457 float m_lostDelay = 0.0f;
458 bool m_fixScene =
false;
460 CObject* m_selectObject =
nullptr;
462 Phase m_phase = PHASE_WELCOME1;
466 bool m_cmdEdit =
false;
468 bool m_selectInsect =
false;
469 bool m_showSoluce =
false;
470 bool m_showAll =
false;
471 bool m_cheatRadar =
false;
472 bool m_shortCut =
false;
473 std::string m_audioTrack;
474 bool m_audioRepeat =
false;
475 std::string m_satcomTrack;
476 bool m_satcomRepeat =
false;
477 std::string m_editorTrack;
478 bool m_editorRepeat =
false;
479 int m_movieInfoIndex = 0;
481 CObject* m_controller =
nullptr;
483 MissionType m_missionType = MISSION_NORMAL;
484 bool m_immediatSatCom =
false;
485 bool m_beginSatCom =
false;
486 bool m_lockedSatCom =
false;
487 bool m_movieLock =
false;
488 bool m_satComLock =
false;
489 bool m_editLock =
false;
490 bool m_editFull =
false;
491 bool m_hilite =
false;
492 bool m_trainerPilot =
false;
493 bool m_friendAim =
false;
494 bool m_resetCreate =
false;
495 bool m_mapShow =
false;
496 bool m_mapImage =
false;
497 char m_mapFilename[100] = {};
503 std::string m_tooltipName;
504 float m_tooltipTime = 0.0f;
506 char m_infoFilename[SATCOM_MAX][100] = {};
507 CObject* m_infoObject =
nullptr;
511 std::string m_scriptName =
"";
512 std::string m_scriptFile =
"";
513 int m_endingWinRank = 0;
514 int m_endingLostRank = 0;
515 bool m_winTerminate =
false;
517 float m_globalMagnifyDamage = 0.0f;
519 bool m_exitAfterMission =
false;
521 bool m_codeBattleInit =
false;
522 bool m_codeBattleStarted =
false;
524 bool m_codeBattleSpectator =
true;
526 std::map<int, std::string> m_teamNames;
528 std::vector<NewScriptName> m_newScriptName;
530 float m_cameraPan = 0.0f;
531 float m_cameraZoom = 0.0f;
534 CObject* m_visitObject =
nullptr;
535 CObject* m_visitArrow =
nullptr;
536 float m_visitTime = 0.0f;
537 float m_visitParticle = 0.0f;
542 std::vector<std::unique_ptr<CSceneEndCondition>> m_endTake;
543 long m_endTakeResearch = 0;
544 float m_endTakeWinDelay = 0.0f;
545 float m_endTakeLostDelay = 0.0f;
547 std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;
549 int m_obligatoryTotal = 0;
550 char m_obligatoryToken[100][20] = {};
551 int m_prohibitedTotal = 0;
552 char m_prohibitedToken[100][20] = {};
557 long m_researchEnable = 0;
561 Error m_missionResult = ERR_OK;
566 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;
CameraType
Type of camera.
Definition: camera.h:44
Definition: pausemanager.cpp:30
CSingleton base class for singletons.
ParticleType
Definition: particle.h:63
Definition: displaytext.h:51
Definition: robotmain.h:131
InputSlot
Available slots for input bindings NOTE: When adding new values, remember to also update keyTable in ...
Definition: key.h:79
Definition: robotmain.h:108
Camera handling - CCamera class.
Audio change condition.
Definition: scene_conditions.h:96
Definition: singleton.h:30
Manager for static models.
Definition: oldmodelmanager.h:54
Definition: old_object.h:79
Global event queue.
Definition: event.h:830
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
PauseType
Definition: pausemanager.h:35
Definition: parserline.h:37
Definition: robotmain.h:152
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:130
Management of pause modes.
Terrain loader/generator and manager.
Definition: terrain.h:145
Namespace for (new) graphics code.
Definition: app.h:49
Definition: player_profile.h:57
The graphics engine.
Definition: engine.h:619
std::unique_ptr< CPlayerProfile > m_playerProfile
Progress of loaded player.
Definition: robotmain.h:441
Event types, structs and event queue.
ObjectType
Type of game object.
Definition: object_type.h:33
Water manager/renderer.
Definition: water.h:72
Invalid event / no event.
Definition: event.h:47
Particle rendering - CParticle class (aka particle)
3D (3x1) vector
Definition: vector.h:53
Undefined.
Definition: camera.h:47
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:699
Definition: pausemanager.h:70
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:118
std::map< int, int > m_researchDone
Done researches for each team.
Definition: robotmain.h:559