Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
maindialog.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.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 
20 // maindialog.h
21 
22 #pragma once
23 
24 
25 #include "graphics/core/color.h"
26 
27 #include "object/robotmain.h"
28 
29 #include "app/pausemanager.h"
30 
31 #include <vector>
32 
33 
34 class CEventQueue;
35 class CSoundInterface;
36 
37 namespace Gfx {
38 class CEngine;
39 class CParticle;
40 }
41 
42 namespace Ui {
43 
44 class CInterface;
45 class CWindow;
46 class CControl;
47 
48 
49 const int USERLISTMAX = 100;
50 const int MAXSCENE = 1000;
51 
52 
53 struct SceneInfo
54 {
55  int numTry;
56  bool bPassed;
57 };
58 
59 struct GamerPerso
60 {
61  int face; // face
62  int glasses; // glasses
63  Gfx::Color colorHair; // hair color
64  Gfx::Color colorCombi; // spacesuit volor
65  Gfx::Color colorBand; // strips color
66 };
67 
68 
69 
71 {
72 public:
73  CMainDialog();
74  ~CMainDialog();
75 
76  void Create();
77 
78  bool EventProcess(const Event &event);
79  void ChangePhase(Phase phase);
80 
81  void SetSceneRead(const char* name);
82  void SetStackRead(const char* name);
83  void SetSceneName(const char* name);
84  void SetSceneRank(int rank);
85  std::string & GetSceneRead();
86  std::string & GetStackRead();
87  char* GetSceneName();
88  int GetSceneRank();
89  const char* GetSceneDir();
90  bool GetSceneSoluce();
91  std::string & GetSavegameDir();
92  std::string & GetPublicDir();
93 
94  bool GetTooltip();
95  bool GetGlint();
96  bool GetSoluce4();
97  bool GetMovies();
98  bool GetNiceReset();
99  bool GetHimselfDamage();
100 
101  void BuildScenePath(std::string &filename, char *base, int rank, bool sceneFile = true);
102  void BuildResumeName(char *filename, char *base, int rank);
103  std::string & GetFilesDir();
104 
105  void StartAbort();
106  void StartDeleteObject();
107  void StartDeleteGame(char *gamer);
108  void StartQuit();
109  void StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCancel);
110  void FrameDialog(float rTime);
111  void StopDialog();
112  bool IsDialog();
113 
114  void StartSuspend();
115  void StopSuspend();
116 
117  void SetupMemorize();
118  void SetupRecall();
119 
120  bool ReadGamerInfo();
121  bool WriteGamerInfo();
122  void SetGamerInfoTry(int rank, int numTry);
123  int GetGamerInfoTry(int rank);
124  void SetGamerInfoPassed(int rank, bool bPassed);
125  bool GetGamerInfoPassed(int rank);
126  bool NextMission();
127 
128  void WriteGamerPerso(char *gamer);
129  void ReadGamerPerso(char *gamer);
130  void SetGamerFace(char *gamer, int face);
131  int GetGamerFace(char *gamer);
132  int GetGamerFace();
133  int GetGamerGlasses();
134  bool GetGamerOnlyHead();
135  float GetPersoAngle();
136  Gfx::Color GetGamerColorHair();
137  Gfx::Color GetGamerColorCombi();
138  Gfx::Color GetGamerColorBand();
139 
140  void AllMissionUpdate();
141  void ShowSoluceUpdate();
142 
143  std::string& GetUserLevelName(int id);
144 
145  void MakeSaveScreenshot(const std::string& name);
146 
147 protected:
148  void GlintMove();
149  void FrameParticle(float rTime);
150  void NiceParticle(Math::Point mouse, bool bPress);
151  void ReadNameList();
152  void UpdateNameList();
153  void UpdateNameEdit();
154  void UpdateNameControl();
155  void UpdateNameFace();
156  void NameSelect();
157  void NameCreate();
158  void NameDelete();
159  void UpdatePerso();
160  void CameraPerso();
161  void FixPerso(int rank, int index);
162  void ColorPerso();
163  void DefPerso();
164  bool IsIOReadScene();
165  void IOReadName();
166  void IOReadList();
167  void IOUpdateList();
168  void IODeleteScene();
169  bool IOWriteScene();
170  bool IOReadScene();
171  int GetChapPassed();
172  void UpdateSceneChap(int &chap);
173  void UpdateSceneList(int chap, int &sel);
174  void UpdateSceneResume(int rank);
175  void UpdateDisplayMode();
176  void ChangeDisplay();
177  void UpdateApply();
178  void UpdateSetupButtons();
179  void ChangeSetupButtons();
180  void ChangeSetupQuality(int quality);
181  void UpdateKey();
182  void ChangeKey(EventType event);
183 
184 protected:
185  CApplication* m_app;
186  CRobotMain* m_main;
187  CEventQueue* m_eventQueue;
188  Gfx::CEngine* m_engine;
189  CInterface* m_interface;
190  Gfx::CParticle* m_particle;
191  Gfx::CCamera* m_camera;
192  CSoundInterface* m_sound;
193  CPauseManager* m_pause;
194 
195  Phase m_phase; // copy of CRobotMain
196  Phase m_phaseSetup; // tab selected
197  Phase m_phaseTerm; // phase trainer/scene/proto
198  float m_phaseTime;
199 
200  GamerPerso m_perso; // perso: description
201  GamerPerso m_persoCopy; // perso: copy for cancellation
202  int m_persoTab; // perso: tab selected
203  float m_persoAngle; // perso: angle of presentation
204 
205  std::string m_savegameDir; // savegame folder
206  std::string m_publicDir; // program folder
207  std::string m_filesDir; // case files
208 
209  int m_index; // 0..4
210  int m_chap[10]; // selected chapter (0..8)
211  int m_sel[10]; // chosen mission (0..98)
212  int m_maxList;
213  int m_accessChap;
214  std::string m_sceneRead; // name of the scene to read
215  std::string m_stackRead; // name of the scene to read
216  char m_sceneName[20]; // name of the scene to play
217  int m_sceneRank; // rank of the scene to play
218  bool m_bSceneSoluce; // shows the solution
219  bool m_bSimulSetup; // adjustment during the game
220  bool m_accessEnable;
221  bool m_accessMission;
222  bool m_accessUser;
223  bool m_bDeleteGamer;
224 
225  int m_userTotal;
226 
227  std::vector<std::string> m_userList;
228 
229  int m_shotDelay; // number of frames before copy
230  std::string m_shotName; // generate a file name
231 
232  int m_setupSelMode;
233  bool m_setupFull;
234 
235  bool m_bTooltip; // tooltips to be displayed?
236  bool m_bGlint; // reflections on buttons?
237  bool m_bRain; // rain in the interface?
238  bool m_bSoluce4; // solutions in program 4?
239  bool m_bMovies; // cinematics?
240  bool m_bNiceReset; // for CTaskReset
241  bool m_bHimselfDamage; // for shots
242  bool m_bCameraScroll; // for CCamera
243  bool m_bCameraInvertX; // for CCamera
244  bool m_bCameraInvertY; // for CCamera
245  bool m_bEffect; // for CCamera
246  bool m_bBlood; // for CCamera
247  bool m_bAutosave;
248 
249  Math::Point m_glintMouse;
250  float m_glintTime;
251 
252  int m_loadingCounter;
253 
254  bool m_bDialog; // this dialogue?
255  bool m_bDialogFire; // setting on fire?
256  bool m_bDialogDelete;
257  Math::Point m_dialogPos;
258  Math::Point m_dialogDim;
259  float m_dialogParti;
260  float m_dialogTime;
261  PauseType m_bInitPause;
262  Gfx::CameraType m_initCamera;
263 
264  int m_partiPhase[10];
265  float m_partiTime[10];
266  Math::Point m_partiPos[10];
267 
268  SceneInfo m_sceneInfo[MAXSCENE];
269 
270  std::vector<std::string> m_saveList;
271 };
272 
273 } // namespace Ui
274 
CameraType
Type of camera.
Definition: camera.h:45
Definition: maindialog.h:70
Definition: controller.h:32
Definition: maindialog.h:59
CRobotMain - main class of Colobot game engine.
Global event queue.
Definition: event.h:751
Definition: robotmain.h:172
Particle engine.
Definition: particle.h:268
Definition: maindialog.h:53
Color structs and related functions.
2D point
Definition: point.h:49
Main application.
Definition: app.h:187
Camera moving in 3D scene.
Definition: camera.h:133
Management of pause modes.
Namespace for (new) graphics code.
Definition: app.h:49
The graphics engine.
Definition: engine.h:684
RGBA color.
Definition: color.h:38
EventType
Type of event message.
Definition: event.h:38
Event sent by system, interface or game.
Definition: event.h:678
Definition: pausemanager.h:44
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:151