29 #include "common/error.h" 32 #include "level/build_type.h" 33 #include "level/level_category.h" 35 #include "level/research_type.h" 40 #include "object/drive_type.h" 41 #include "object/mission_type.h" 43 #include "object/tool_type.h" 75 std::string PhaseToString(Phase phase);
76 bool IsInSimulationConfigPhase(Phase phase);
77 bool IsPhaseWithWorld(Phase phase);
78 bool IsMainMenuPhase(Phase phase);
109 class CMainUserInterface;
120 std::string name =
"";
124 const int MAXSHOWLIMIT = 5;
125 const int MAXSHOWPARTI = 200;
126 const float SHOWLIMITTIME = 20.0f;
128 const int MAXSCENE = 999;
136 int parti[MAXSHOWPARTI] = {};
138 float duration = 0.0f;
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;
162 void CreateConfigFile();
163 void LoadConfigFile();
165 void ResetAfterDeviceChanged();
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);
184 void SetFriendAim(
bool friendAim);
187 void SetTracePrecision(
float factor);
188 float GetTracePrecision();
190 void SetSpeed(
float speed);
193 void UpdateShortcuts();
198 bool SelectObject(
CObject* pObj,
bool displayError=
true);
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);
214 MainMovieType GetMainMovie();
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);
231 char* GetScriptName();
232 char* GetScriptFile();
233 bool GetTrainerPilot();
235 bool GetInterfaceGlint();
238 bool GetShowSoluce();
239 bool GetSceneSoluce();
242 MissionType GetMissionType();
245 int GetGamerGlasses();
246 bool GetGamerOnlyHead();
247 float GetPersoAngle();
249 void SetLevel(LevelCategory cat,
int chap,
int rank);
250 LevelCategory GetLevelCategory();
253 std::string GetCustomLevelDir();
254 void SetReadScene(std::string path);
255 void UpdateChapterPassed();
258 void UpdatePause(PauseType pause);
259 void ClearInterface();
263 bool FreeSpace(
Math::Vector ¢er,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
264 bool FlatFreeSpace(
Math::Vector ¢er,
float minFlat,
float minRadius,
float maxRadius,
float space,
CObject *exclu);
266 void HideDropZone(
CObject* metal);
268 void FlushShowLimit(
int i);
270 float radius,
float duration=SHOWLIMITTIME);
271 void StartShowLimit();
272 void FrameShowLimit(
float rTime);
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);
279 void FlushNewScriptName();
280 void AddNewScriptName(
ObjectType type,
const std::string& name);
281 std::string GetNewScriptName(
ObjectType type,
int rank);
283 void SelectPlayer(std::string playerName);
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);
291 CObject* IOReadObject(
CLevelParserLine *line,
const std::string& programDir,
const std::string& objCounterText,
float objectProgress,
int objRank = -1);
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);
300 void UpdateCustomLevelList();
301 std::string GetCustomLevelName(
int id);
302 const std::vector<std::string>& GetCustomLevelList();
307 void StartMissionTimer();
309 void SetAutosave(
bool enable);
311 void SetAutosaveInterval(
int interval);
312 int GetAutosaveInterval();
313 void SetAutosaveSlots(
int slots);
314 int GetAutosaveSlots();
317 void SetExitAfterMission(
bool exit);
320 bool CanPlayerInteract();
323 const std::string& GetTeamName(
int id);
326 bool IsTeamColorDefined(
int id);
330 int GetEnableBuild();
331 void SetEnableBuild(
int enableBuild);
335 int GetEnableResearch();
336 void SetEnableResearch(
int enableResearch);
340 int GetDoneResearch(
int team);
341 void SetDoneResearch(
int doneResearch,
int team);
346 bool IsBuildingEnabled(BuildType type);
349 bool IsResearchEnabled(ResearchType type);
352 bool IsResearchDone(ResearchType type,
int team);
354 void MarkResearchDone(ResearchType type,
int team);
359 Error CanBuildError(
ObjectType type,
int team);
365 Error CanFactoryError(
ObjectType type,
int team);
368 void RemoveFromSelectionHistory(
CObject*
object);
371 float GetGlobalMagnifyDamage();
375 bool IsSelectable(
CObject* pObj);
378 bool EventFrame(
const Event &event);
379 bool EventObject(
const Event &event);
382 void ShowSaveIndicator(
bool show);
384 void CreateScene(
bool soluce,
bool fixScene,
bool resetObject);
387 void LevelLoadingError(
const std::string& error,
const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);
393 void HiliteFrame(
float rTime);
394 void CreateTooltip(
Math::Point pos,
const std::string& text);
398 void RemoteCamera(
float pan,
float zoom,
float rTime);
401 void SelectOneObject(
CObject* pObj,
bool displayError=
true);
403 bool DeselectObject();
404 void DeleteAllObjects();
405 void UpdateInfoText();
408 void FrameVisit(
float rTime);
409 void StopDisplayVisit();
410 void ExecuteCmd(
char *cmd);
411 void UpdateSpeedLabel();
413 int AutosaveRotate(
bool freeOne);
415 bool DestroySelectedObject();
416 void PushToSelectionHistory(
CObject* obj);
417 CObject* PopFromSelectionHistory();
419 void CreateCodeBattleInterface();
420 void DestroyCodeBattleInterface();
421 void SetCodeBattleSpectatorMode(
bool mode);
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;
459 float m_gameTime = 0.0f;
461 float m_gameTimeAbsolute = 0.0f;
463 LevelCategory m_levelCategory;
466 std::string m_sceneReadPath;
468 float m_winDelay = 0.0f;
469 float m_lostDelay = 0.0f;
470 bool m_fixScene =
false;
472 CObject* m_selectObject =
nullptr;
474 Phase m_phase = PHASE_WELCOME1;
476 int m_cameraRank = 0;
478 bool m_freePhoto =
false;
480 bool m_cmdEdit =
false;
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;
495 CObject* m_controller =
nullptr;
497 MissionType m_missionType = MISSION_NORMAL;
498 bool m_immediatSatCom =
false;
499 bool m_beginSatCom =
false;
500 bool m_lockedSatCom =
false;
501 bool m_movieLock =
false;
502 bool m_satComLock =
false;
503 bool m_editLock =
false;
504 bool m_editFull =
false;
505 bool m_hilite =
false;
506 bool m_trainerPilot =
false;
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] = {};
517 std::string m_tooltipName;
518 float m_tooltipTime = 0.0f;
520 char m_infoFilename[SATCOM_MAX][100] = {};
521 CObject* m_infoObject =
nullptr;
523 int m_infoPos[SATCOM_MAX] = {};
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;
535 float m_globalMagnifyDamage = 0.0f;
537 bool m_exitAfterMission =
false;
539 bool m_codeBattleInit =
false;
540 bool m_codeBattleStarted =
false;
542 bool m_codeBattleSpectator =
true;
544 std::map<int, std::string> m_teamNames;
546 std::vector<NewScriptName> m_newScriptName;
548 float m_cameraPan = 0.0f;
549 float m_cameraZoom = 0.0f;
552 CObject* m_visitObject =
nullptr;
553 CObject* m_visitArrow =
nullptr;
554 float m_visitTime = 0.0f;
555 float m_visitParticle = 0.0f;
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;
565 std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;
567 int m_obligatoryTotal = 0;
568 char m_obligatoryToken[100][20] = {};
569 int m_prohibitedTotal = 0;
570 char m_prohibitedToken[100][20] = {};
575 long m_researchEnable = 0;
579 Error m_missionResult = ERR_OK;
584 std::map<int, Gfx::Color> m_colorNewBot;
591 float m_colorShiftWater = 0.0f;
593 bool m_missionTimerEnabled =
false;
594 bool m_missionTimerStarted =
false;
595 float m_missionTimer = 0.0f;
597 bool m_autosave =
false;
598 int m_autosaveInterval = 0;
599 int m_autosaveSlots = 0;
600 float m_autosaveLast = 0.0f;
602 int m_shotSaving = 0;
604 std::deque<CObject*> m_selectionHistory;
CameraType
Type of camera.
Definition: camera.h:46
Definition: pausemanager.h:45
CSingleton base class for singletons.
ParticleType
Definition: particle.h:63
Definition: displaytext.h:51
Definition: robotmain.h:130
InputSlot
Available slots for input bindings NOTE: When adding new values, remember to also update keyTable in ...
Definition: key.h:76
Definition: robotmain.h:107
Camera handling - CCamera class.
Audio change condition.
Definition: scene_conditions.h:96
Definition: singleton.h:30
Manager for static models.
Definition: oldmodelmanager.h:55
Definition: old_object.h:77
Global event queue.
Definition: event.h:840
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
Definition: parserline.h:37
Definition: robotmain.h:151
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Particle engine.
Definition: particle.h:223
Definition: settings.h:31
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:191
Entry point into CRobotMain.
Definition: controller.h:40
Camera moving in 3D scene.
Definition: camera.h:134
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:620
std::unique_ptr< CPlayerProfile > m_playerProfile
Progress of loaded player.
Definition: robotmain.h:453
ObjectType
Type of game object.
Definition: object_type.h:33
Water manager/renderer.
Definition: water.h:74
Math::Vector LookatPoint(const Math::Vector &eye, float angleH, float angleV, float length)
Calculates the end point.
Definition: geometry.h:603
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:49
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:709
Definition: pausemanager.h:60
Definition: interface.h:58
Base class for all 3D in-game objects.
Definition: object.h:59
Sound plugin interface.
Definition: sound.h:57
Definition: robotmain.h:117
std::map< int, int > m_researchDone
Done researches for each team.
Definition: robotmain.h:577