[go: up one dir, main page]

File: robotmain.h

package info (click to toggle)
colobot 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 415,516 kB
  • sloc: cpp: 129,242; ansic: 8,872; python: 2,158; sh: 672; awk: 91; xml: 35; makefile: 31
file content (745 lines) | stat: -rw-r--r-- 25,486 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
/*
 * This file is part of the Colobot: Gold Edition source code
 * Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
 * http://epsitec.ch; http://colobot.info; http://github.com/colobot
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://gnu.org/licenses
 */

/**
 * \file level/robotmain.h
 * \brief CRobotMain - main class of Colobot game engine
 */

#pragma once

#include "app/pausemanager.h"

#include "common/error.h"
#include "common/event.h"
#include "common/singleton.h"

#include "graphics/engine/camera.h"
#include "graphics/engine/particle.h"

#include "level/build_type.h"
#include "level/level_category.h"
#include "level/mainmovie.h"
#include "level/research_type.h"

#include "object/drive_type.h"
#include "object/mission_type.h"
#include "object/object_type.h"
#include "object/tool_type.h"

#include <deque>
#include <stdexcept>

enum Phase
{
    PHASE_WELCOME1,
    PHASE_WELCOME2,
    PHASE_WELCOME3,
    PHASE_PLAYER_SELECT,
    PHASE_APPEARANCE,
    PHASE_MAIN_MENU,
    PHASE_LEVEL_LIST,
    PHASE_MOD_LIST,
    PHASE_SIMUL,
    PHASE_SETUPd,
    PHASE_SETUPg,
    PHASE_SETUPp,
    PHASE_SETUPc,
    PHASE_SETUPs,
    PHASE_SETUPds,
    PHASE_SETUPgs,
    PHASE_SETUPps,
    PHASE_SETUPcs,
    PHASE_SETUPss,
    PHASE_WRITEs,
    PHASE_READ,
    PHASE_READs,
    PHASE_WIN,
    PHASE_LOST,
    PHASE_QUIT_SCREEN,
    PHASE_SATCOM,
};
std::string PhaseToString(Phase phase);
bool IsInSimulationConfigPhase(Phase phase);
bool IsPhaseWithWorld(Phase phase);
bool IsMainMenuPhase(Phase phase);


class CEventQueue;
class CSoundInterface;
class CLevelParserLine;
class CInput;
class CObjectManager;
class CSceneEndCondition;
class CAudioChangeCondition;
class CScoreboard;
class CPlayerProfile;
class CSettings;
class COldObject;
class CPauseManager;
struct ActivePause;

namespace Gfx
{
class CEngine;
class CLightManager;
class CWater;
class CCloud;
class CLightning;
class CPlanet;
class CTerrain;
class CModelManager;
}

namespace Ui
{
class CMainUserInterface;
class CMainShort;
class CMainMap;
class CInterface;
class CDisplayText;
class CDisplayInfo;
class CDebugMenu;
}

struct NewScriptName
{
    ObjectType  type = OBJECT_NULL;
    std::string name = "";

    NewScriptName(ObjectType type, const std::string& name) : type(type), name(name) {}
};


const int MAXSHOWLIMIT      = 5;
const int MAXSHOWPARTI      = 200;
const float SHOWLIMITTIME   = 20.0f;

const int MAXSCENE = 999;

struct ShowLimit
{
    bool            used = false;
    Math::Vector    pos;
    float           radius = 0.0f;
    int             total = 0;
    int             parti[MAXSHOWPARTI] = {};
    CObject*        link = nullptr;
    float           duration = 0.0f;
    float           time = 0.0f;
};

struct MinMax
{
    int min = -1;
    int max = -1;
};

struct Viewpoint
{
    Math::Vector    eye{};
    Math::Vector    look{};
    int             button = 13; // 13 is the camera button
};

const int SATCOM_HUSTON     = 0;
const int SATCOM_SAT        = 1;
const int SATCOM_OBJECT     = 2;
const int SATCOM_LOADING    = 3;
const int SATCOM_PROG       = 4;
const int SATCOM_SOLUCE     = 5;
const int SATCOM_MAX        = 6;

/**
 * \brief Main class managing the game world
 *
 * This is the main class of the whole game engine. It's main job is to manage main parts of the gameplay,
 * like loading levels and checking for win conditions, but it's also a place where all things that don't fit
 * elsewhere have landed.
 *
 * \todo In the future, it would be nice to refactor this class to remove as much unrelated stuff as possible
 *
 * \nosubgrouping
 */
class CRobotMain : public CSingleton<CRobotMain>
{
public:
    CRobotMain();
    virtual ~CRobotMain();

    Gfx::CCamera* GetCamera();
    Gfx::CTerrain* GetTerrain();
    Ui::CInterface* GetInterface();
    Ui::CDisplayText* GetDisplayText();
    CPauseManager* GetPauseManager();

    /**
     * \name Phase management
     */
    //@{
    void        ChangePhase(Phase phase);
    bool        ProcessEvent(Event &event);
    Phase       GetPhase();
    //@}

    //! Load the scene for appearance customization
    void        ScenePerso();

    void        SetMovieLock(bool lock);
    bool        GetMovieLock();
    bool        GetInfoLock();
    void        SetSatComLock(bool lock);
    bool        GetSatComLock();
    void        SetEditLock(bool lock, bool edit);
    bool        GetEditLock();
    void        SetEditFull(bool full);
    bool        GetEditFull();
    void        SetFriendAim(bool friendAim);
    bool        GetFriendAim();

    //! \name Simulation speed management
    //@{
    void        SetSpeed(float speed);
    float       GetSpeed();
    //@}

    //! \brief Create the shortcuts at the top of the screen, if they should be visible
    //! \see CMainShort::CreateShortcuts
    bool        CreateShortcuts();
    //! \brief Update the shortcuts at the top of the screen
    //! \see CMainShort::UpdateShortcuts
    void        UpdateShortcuts();
    //! Find the astronaut (::OBJECT_HUMAN) object
    CObject*    SearchHuman();
    /**
     * \brief Select an object
     * \param obj Object to select
     * \param displayError If true and the object is currently in error state, automatically display the error message
     *
     * \note This function automatically adds objects to selection history (see PushToSelectionHistory())
     */
    bool        SelectObject(CObject* obj, bool displayError=true);
    //! Return the object that was selected at the start of the scene
    CObject*    GetSelectObject();
    //! Deselect currently selected object
    //! \return Object that was deselected
    CObject*    DeselectAll();

    void        ResetObject();
    void        UpdateAudio(bool frame);
    void        SetMissionResultFromScript(Error result, float delay);
    Error       CheckEndMission(bool frame);
    Error       ProcessEndMissionTake();
    Error       ProcessEndMissionTakeForGroup(std::vector<CSceneEndCondition*>& endTakes);
    const std::map<std::string, MinMax>& GetObligatoryTokenList();
    void        UpdateMap();
    bool        GetShowMap();

    MainMovieType GetMainMovie();

    void        FlushDisplayInfo();
    void        StartDisplayInfo(int index, bool movie);
    void        StartDisplayInfo(const std::string& filename, int index);
    void        StopDisplayInfo();
    char*       GetDisplayInfoName(int index);

    void        StartSuspend();
    void        StopSuspend();

    float       GetGameTime();

    const std::string& GetScriptName();
    const std::string& GetScriptFile();
    bool        GetTrainerPilot();
    bool        GetPlusTrainer();
    bool        GetPlusExplorer();
    bool        GetFixScene();
    bool        GetShowSoluce();
    bool        GetSceneSoluce();
    bool        GetShowAll();
    bool        GetRadar();
    MissionType GetMissionType();

    int         GetGamerFace();
    int         GetGamerGlasses();
    bool        GetGamerOnlyHead();
    float       GetPersoAngle();

    void        SetLevel(LevelCategory cat, int chap, int rank);
    LevelCategory GetLevelCategory();
    int         GetLevelChap();
    int         GetLevelRank();
    std::string GetCustomLevelDir();
    void        SetReadScene(std::string path);
    void        UpdateChapterPassed();

    void        StartMusic();
    void        UpdatePause(PauseType pause);
    void        UpdatePauseMusic(PauseMusic music);
    void        ClearInterface();
    void        ChangeColor();

    bool        FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
    bool        FlatFreeSpace(Math::Vector &center, float minFlat, float minRadius, float maxRadius, float space, CObject *exclu);
    //! \name In-world indicators
    //@{
    float       GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
    void        HideDropZone(CObject* metal);
    void        ShowDropZone(CObject* metal, CObject* transporter);
    void        FlushShowLimit(int i);
    void        SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos,
                             float radius, float duration=SHOWLIMITTIME);
    void        StartShowLimit();
    void        FrameShowLimit(float rTime);
    //@}

    void        SaveAllScript();
    void        SaveOneScript(CObject *obj);
    bool        SaveFileStack(CObject *obj, std::ostream &ostr);
    bool        ReadFileStack(CObject *obj, std::istream &istr);

    //! Return list of scripts to load to robot created in BotFactory
    std::vector<std::string> GetNewScriptNames(ObjectType type);

    //! Return the scoreboard manager
    //! Note: this may return nullptr if the scoreboard is not enabled!
    CScoreboard* GetScoreboard();

    void        SelectPlayer(std::string playerName);
    CPlayerProfile* GetPlayerProfile();

    /**
     * \name Saved game read/write
     */
    //@{
    bool        IOIsBusy();
    bool        IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, const std::string& info, bool emergencySave = false);
    void        IOWriteSceneFinished();
    CObject*    IOReadScene(std::string filename, std::string filecbot);
    void        IOWriteObject(CLevelParserLine *line, CObject* obj, const std::string& programDir, int objRank);
    CObject*    IOReadObject(CLevelParserLine *line, const std::string& programDir, const std::string& objCounterText, float objectProgress, int objRank = -1);
    //@}

    int         CreateSpot(Math::Vector pos, Gfx::Color color);

    //! Find the currently selected object
    CObject*    GetSelect();

    void        DisplayError(Error err, CObject* pObj, float time=10.0f);
    void        DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);

    void        UpdateCustomLevelList();
    std::string GetCustomLevelName(int id);
    const std::vector<std::string>& GetCustomLevelList();

    //! Returns true if the game is on the loading screen
    bool        IsLoading();

    void        StartMissionTimer();

    /**
     * \name Autosave management
     */
    //@{
    void        SetAutosave(bool enable);
    bool        GetAutosave();
    void        SetAutosaveInterval(int interval);
    int         GetAutosaveInterval();
    void        SetAutosaveSlots(int slots);
    int         GetAutosaveSlots();
    //@}

    //! Enable mode where completing mission closes the game
    void        SetExitAfterMission(bool exit);

    //! Load saved game (used by command line argument)
    void        LoadSaveFromDirName(const std::string& gameDir);

    //! Returns true if player can interact with things manually
    bool        CanPlayerInteract();

    /**
     * \name Team definition management
     */
    //@{
    //! Returns team name for the given team id
    const std::string& GetTeamName(int id);

    //! Returns true if team-specific colored texture is available
    bool        IsTeamColorDefined(int id);
    //@}

    /**
     * \name EnableBuild/EnableResearch/DoneResearch
     * Management of enabled buildings, enabled researches, and completed researches
     */
    //@{
    /**
     * \brief Get enabled buildings
     * \return Bitmask of BuildType values
     */
    int         GetEnableBuild();
    /**
     * \brief Set enabled buildings
     * \param enableBuild Bitmask of BuildType values
     */
    void        SetEnableBuild(int enableBuild);

    /**
     * \brief Get enabled researches
     * \return Bitmask of ResearchType values
     */
    int         GetEnableResearch();
    /**
     * \brief Set enabled researches
     * \param enableResearch Bitmask of ResearchType values
     */
    void        SetEnableResearch(int enableResearch);
    /**
     * \brief Get done researches
     * \param team Team to get researches for
     * \return Bitmask of ResearchType values
     */
    int         GetDoneResearch(int team = 0);
    /**
     * \brief Set done researches
     * \param doneResearch Bitmask of ResearchType values
     * \param team Team to set researches for
     */
    void        SetDoneResearch(int doneResearch, int team = 0);

    //! \brief Check if the given building is enabled
    bool        IsBuildingEnabled(BuildType type);
    //! \brief Check if the given building is enabled
    bool        IsBuildingEnabled(ObjectType type);
    //! \brief Check if the given research is enabled
    bool        IsResearchEnabled(ResearchType type);
    //! \brief Check if the given research is done
    bool        IsResearchDone(ResearchType type, int team);
    //! \brief Mark given research as done
    void        MarkResearchDone(ResearchType type, int team);

    /**
     * \brief Check if all requirements to build this object are met (EnableBuild + DoneResearch)
     * \return true if the building can be built, false otherwise
     * \see CanBuildError() for a version which returns a specific reason for the build being denied
     */
    inline bool CanBuild(ObjectType type, int team)
    {
        return CanBuildError(type, team) == ERR_OK;
    }
    /**
     * \brief Check if all requirements to build this object are met (EnableBuild + DoneResearch)
     * \return One of Error values - ::ERR_OK if the building can be built, ::ERR_BUILD_DISABLED or ::ERR_BUILD_RESEARCH otherwise
     * \see CanBuild() for a version which returns a boolean
     */
    Error       CanBuildError(ObjectType type, int team);

    /**
     * \brief Check if all requirements to build this object in BotFactory are met (DoneResearch)
     * \return true if the robot can be built, false otherwise
     * \see CanFactoryError() for a version which returns a specific reason for the build being denied
     */
    inline bool CanFactory(ObjectType type, int team)
    {
        return CanFactoryError(type, team) == ERR_OK;
    }
    /**
     * \brief Check if all requirements to build this object in BotFactory are met (DoneResearch)
     * \return One of Error values - ::ERR_OK if the robot can be built, ::ERR_BUILD_DISABLED or ::ERR_BUILD_RESEARCH otherwise
     * \see CanFactory() for a version which returns a boolean
     */
    Error       CanFactoryError(ObjectType type, int team);
    //@}

    void        CutObjectLink(CObject* object);

    //! Returns global magnifyDamage setting
    float       GetGlobalMagnifyDamage();

    //! Returns global NuclearCell capacity Setting
    float       GetGlobalNuclearCapacity();
    //! Returns global PowerCell capacity setting
    float       GetGlobalCellCapacity();

    void        StartDetectEffect(COldObject* object, CObject* target);

    //! Enable crash sphere debug rendering
    void SetDebugCrashSpheres(bool draw);
    //! Check if crash sphere debug rendering is enabled
    bool GetDebugCrashSpheres();

    //! Returns a set of all team IDs in the current level
    std::set<int> GetAllTeams();
    //! Returns a set of all team IDs in the current level that are still active
    std::set<int> GetAllActiveTeams();

protected:
    bool        EventFrame(const Event &event);
    bool        EventObject(const Event &event);
    void        InitEye();

    void        ShowSaveIndicator(bool show);

    void        CreateScene(bool soluce, bool fixScene, bool resetObject);
    void        ResetCreate();

    void        LevelLoadingError(const std::string& error, const std::runtime_error& exception, Phase exitPhase = PHASE_LEVEL_LIST);

    int         CreateLight(Math::Vector direction, Gfx::Color color);
    void        HiliteClear();
    void        HiliteObject(Math::Point pos);
    void        HiliteFrame(float rTime);
    void        CreateTooltip(Math::Point pos, const std::string& text);
    void        ClearTooltip();
    CObject*    DetectObject(Math::Point pos);
    void        ChangeCamera();
    void        AbortMovie();
    //! \brief Select an object, without deselecting the previous one
    void        SelectOneObject(CObject* obj, bool displayError=true);
    void        HelpObject();
    //! \brief Switch to previous object
    //! \see PopFromSelectionHistory()
    bool        DeselectObject();
    void        DeleteAllObjects();
    void        UpdateInfoText();
    void        StartDisplayVisit(EventType event);
    void        FrameVisit(float rTime);
    void        StopDisplayVisit();
    void        ExecuteCmd(const std::string& cmd);
    void        UpdateSpeedLabel();

    void        AutosaveRotate();
    void        Autosave();
    void        QuickSave();
    void        QuickLoad();
    bool        DestroySelectedObject();
    void        PushToSelectionHistory(CObject* obj);
    CObject*    PopFromSelectionHistory();

    //! \name Code battle interface
    //@{
    void        CreateCodeBattleInterface();
    void        UpdateCodeBattleInterface();
    void        ApplyCodeBattleInterface();
    void        DestroyCodeBattleInterface();
    void        SetCodeBattleSpectatorMode(bool mode);
    //@}

    void        UpdateDebugCrashSpheres();

    //! Adds element to the beginning of command history
    void        PushToCommandHistory(std::string cmd);
    //! Returns next/previous element from command history and updates index
    //@{
    std::string    GetNextFromCommandHistory();
    std::string    GetPreviousFromCommandHistory();
    //@}

protected:
    CApplication*       m_app = nullptr;
    CEventQueue*        m_eventQueue = nullptr;
    Gfx::CEngine*       m_engine = nullptr;
    Gfx::CParticle*     m_particle = nullptr;
    Gfx::CWater*        m_water = nullptr;
    Gfx::CCloud*        m_cloud = nullptr;
    Gfx::CLightning*    m_lightning = nullptr;
    Gfx::CPlanet*       m_planet = nullptr;
    Gfx::COldModelManager* m_oldModelManager = nullptr;
    Gfx::CLightManager* m_lightMan = nullptr;
    CSoundInterface*    m_sound = nullptr;
    CInput*             m_input = nullptr;
    std::unique_ptr<CObjectManager> m_objMan;
    std::unique_ptr<CMainMovie> m_movie;
    std::unique_ptr<CPauseManager> m_pause;
    std::unique_ptr<Gfx::CModelManager> m_modelManager;
    std::unique_ptr<Gfx::CTerrain> m_terrain;
    std::unique_ptr<Gfx::CCamera> m_camera;
    std::unique_ptr<Ui::CMainUserInterface> m_ui;
    std::unique_ptr<Ui::CMainShort> m_short;
    std::unique_ptr<Ui::CMainMap> m_map;
    std::unique_ptr<Ui::CInterface> m_interface;
    std::unique_ptr<Ui::CDisplayInfo> m_displayInfo;
    std::unique_ptr<Ui::CDisplayText> m_displayText;
    std::unique_ptr<Ui::CDebugMenu> m_debugMenu;
    std::unique_ptr<CSettings> m_settings;

    //! Progress of loaded player
    std::unique_ptr<CPlayerProfile> m_playerProfile;


    //! Time since level start, including pause and intro movie
    float           m_time = 0.0f;
    //! Playing time since level start
    float           m_gameTime = 0.0f;
    //! Playing time since level start, not dependent on simulation speed
    float           m_gameTimeAbsolute = 0.0f;

    LevelCategory   m_levelCategory;
    int             m_levelChap = 0;
    int             m_levelRank = 0;
    //! if set, loads this file instead of building from category/chap/rank
    std::string     m_levelFile = "";
    std::string     m_sceneReadPath;

    float           m_winDelay = 0.0f;
    float           m_lostDelay = 0.0f;
    bool            m_fixScene = false;        // scene fixed, no interraction
    CObject*        m_base = nullptr;        // OBJECT_BASE exists in mission
    CObject*        m_selectObject = nullptr;

    Phase           m_phase = PHASE_WELCOME1;
    ActivePause*    m_userPause = nullptr;
    ActivePause*    m_focusPause = nullptr;
    ActivePause*    m_freePhotoPause = nullptr;
    bool            m_cmdEdit = false;
    ActivePause*    m_cmdEditPause = nullptr;
    bool            m_cheatSelectInsect = false;
    bool            m_cheatShowSoluce = false;
    bool            m_cheatAllMission = false;
    bool            m_cheatRadar = false;
    bool            m_shortCut = false;
    std::string     m_audioTrack;
    bool            m_audioRepeat = false;
    std::string     m_satcomTrack;
    bool            m_satcomRepeat = false;
    std::string     m_editorTrack;
    bool            m_editorRepeat = false;
    int             m_movieInfoIndex = 0;

    CObject*        m_controller = nullptr;

    MissionType     m_missionType = MISSION_NORMAL;
    bool            m_immediatSatCom = false;  // SatCom immediately?
    bool            m_beginSatCom = false;     // messages SatCom poster?
    bool            m_lockedSatCom = false;    // SatCom locked?
    bool            m_movieLock = false;       // movie in progress?
    bool            m_satComLock = false;      // call of SatCom is possible?
    bool            m_editLock = false;        // edition in progress?
    bool            m_editFull = false;        // edition in full screen?
    bool            m_hilite = false;
    bool            m_cheatTrainerPilot = false;    // remote trainer?
    bool            m_friendAim = false;
    bool            m_resetCreate = false;
    bool            m_mapShow = false;
    bool            m_mapImage = false;
    char            m_mapFilename[100] = {};

    ActivePause*    m_suspend = nullptr;

    Math::Point     m_tooltipPos;
    std::string     m_tooltipName;
    float           m_tooltipTime = 0.0f;

    char            m_infoFilename[SATCOM_MAX][100] = {}; // names of text files
    CObject*        m_infoObject = nullptr;
    int             m_infoUsed = 0;
    ActivePause*    m_satcomMoviePause = nullptr;

    std::string     m_scriptName = "";
    std::string     m_scriptFile = "";
    std::string     m_endingWin = "";
    std::string     m_endingLost = "";
    bool            m_winTerminate = false;

    float           m_globalMagnifyDamage = 0.0f;

    float           m_globalNuclearCapacity = 10.0f;
    float           m_globalCellCapacity = 1.0f;

    bool            m_exitAfterMission = false;

    bool            m_codeBattleInit = false;
    bool            m_codeBattleStarted = false;
    //! Code battle spectator mode, hides object UI, changes camera to CAM_TYPE_PLANE and allows for switching to free camera by clicking outside of any object
    bool            m_codeBattleSpectator = true;

    std::map<int, std::string> m_teamNames;

    std::vector<NewScriptName> m_newScriptName;

    EventType       m_visitLast = EVENT_NULL;
    CObject*        m_visitObject = nullptr;
    CObject*        m_visitArrow = nullptr;
    float           m_visitTime = 0.0f;
    float           m_visitParticle = 0.0f;
    Math::Vector    m_visitPos;
    Math::Vector    m_visitPosArrow;
    ActivePause*    m_visitPause = nullptr;

    std::vector<std::unique_ptr<CSceneEndCondition>> m_endTake;
    //! If true, the mission ends immediately after completing the requirements without requiring SpaceShip takeoff
    bool            m_endTakeImmediat = false;
    long            m_endTakeResearch = 0;
    float           m_endTakeTimeout = -1.0f;
    bool            m_endTakeTeamImmediateWin = false;
    float           m_endTakeWinDelay = 0.0f;
    float           m_endTakeLostDelay = 0.0f;
    //! Set to true for teams that have already finished
    std::map<int, bool> m_teamFinished;

    std::vector<std::unique_ptr<CAudioChangeCondition>> m_audioChange;

    //! The scoreboard
    //! If the scoreboard is not enabled for this level, this will be null
    std::unique_ptr<CScoreboard> m_scoreboard;

    std::map<std::string, MinMax> m_obligatoryTokens;

    //! Enabled buildings
    int             m_build = 0;
    //! Available researches
    long            m_researchEnable = 0;
    //! Done researches for each team
    std::map<int, int>  m_researchDone;

    Error           m_missionResult = ERR_OK;
    //! true if m_missionResult has been set by LevelController script, this disables normal EndMissionTake processing
    bool            m_missionResultFromScript = false;

    ShowLimit       m_showLimit[MAXSHOWLIMIT];

    std::map<int, Gfx::Color> m_colorNewBot;
    Gfx::Color      m_colorNewAlien;
    Gfx::Color      m_colorNewGreen;
    Gfx::Color      m_colorNewWater;
    float           m_colorShiftWater = 0.0f;

    bool            m_missionTimerEnabled = false;
    bool            m_missionTimerStarted = false;
    float           m_missionTimer = 0.0f;

    bool            m_autosave = false;
    int             m_autosaveInterval = 0;
    int             m_autosaveSlots = 0;
    float           m_autosaveLast = 0.0f;

    int             m_shotSaving = 0;

    std::deque<CObject*> m_selectionHistory;
    bool            m_debugCrashSpheres;

    //! Cheat console command history
    std::deque<std::string> m_commandHistory;
    //! Index of currently selected element in command history
    int             m_commandHistoryIndex;

    //! Vector of available viewpoints
    std::vector<Viewpoint> m_viewpoints;
};