Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
maindialog.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // *
4 // * This program is free software: you can redistribute it and/or modify
5 // * it under the terms of the GNU General Public License as published by
6 // * the Free Software Foundation, either version 3 of the License, or
7 // * (at your option) any later version.
8 // *
9 // * This program is distributed in the hope that it will be useful,
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // * GNU General Public License for more details.
13 // *
14 // * You should have received a copy of the GNU General Public License
15 // * along with this program. If not, see http://www.gnu.org/licenses/.
16 
17 // maindialog.h
18 
19 #pragma once
20 
21 
22 #include "graphics/core/color.h"
23 
24 #include "object/robotmain.h"
25 
26 #include "app/pausemanager.h"
27 
28 #include <boost/filesystem.hpp>
29 #include <boost/algorithm/string.hpp>
30 
31 #include <vector>
32 
33 namespace fs = boost::filesystem;
34 
35 
36 class CEventQueue;
37 class CSoundInterface;
38 
39 namespace Gfx {
40 class CEngine;
41 class CParticle;
42 }
43 
44 namespace Ui {
45 
46 class CInterface;
47 class CWindow;
48 class CControl;
49 
50 
51 const int USERLISTMAX = 100;
52 const int MAXSCENE = 1000;
53 
54 
55 struct SceneInfo
56 {
57  char numTry;
58  char bPassed;
59 };
60 
61 struct GamerPerso
62 {
63  int face; // face
64  int glasses; // glasses
65  Gfx::Color colorHair; // hair color
66  Gfx::Color colorCombi; // spacesuit volor
67  Gfx::Color colorBand; // strips color
68 };
69 
70 
71 
73 {
74 public:
75  CMainDialog();
76  ~CMainDialog();
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 SetUserDir(char *base, int rank);
102  void BuildSceneName(std::string &filename, char *base, int rank);
103  void BuildResumeName(char *filename, char *base, int rank);
104  std::string & GetFilesDir();
105 
106  void StartAbort();
107  void StartDeleteObject();
108  void StartDeleteGame(char *gamer);
109  void StartQuit();
110  void StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCancel);
111  void FrameDialog(float rTime);
112  void StopDialog();
113  bool IsDialog();
114 
115  void StartSuspend();
116  void StopSuspend();
117 
118  void SetupMemorize();
119  void SetupRecall();
120 
121  bool ReadGamerInfo();
122  bool WriteGamerInfo();
123  void SetGamerInfoTry(int rank, int numTry);
124  int GetGamerInfoTry(int rank);
125  void SetGamerInfoPassed(int rank, bool bPassed);
126  bool GetGamerInfoPassed(int rank);
127  bool NextMission();
128 
129  void WriteGamerPerso(char *gamer);
130  void ReadGamerPerso(char *gamer);
131  void SetGamerFace(char *gamer, int face);
132  int GetGamerFace(char *gamer);
133  int GetGamerFace();
134  int GetGamerGlasses();
135  bool GetGamerOnlyHead();
136  float GetPersoAngle();
137  Gfx::Color GetGamerColorHair();
138  Gfx::Color GetGamerColorCombi();
139  Gfx::Color GetGamerColorBand();
140 
141  void AllMissionUpdate();
142  void ShowSoluceUpdate();
143 
144 protected:
145  void GlintMove();
146  void FrameParticle(float rTime);
147  void NiceParticle(Math::Point mouse, bool bPress);
148  void ReadNameList();
149  void UpdateNameList();
150  void UpdateNameEdit();
151  void UpdateNameControl();
152  void UpdateNameFace();
153  void NameSelect();
154  void NameCreate();
155  void NameDelete();
156  void UpdatePerso();
157  void CameraPerso();
158  void FixPerso(int rank, int index);
159  void ColorPerso();
160  void DefPerso();
161  bool IsIOReadScene();
162  void IOReadName();
163  void IOReadList();
164  void IOUpdateList();
165  void IODeleteScene();
166  bool IOWriteScene();
167  bool IOReadScene();
168  int GetChapPassed();
169  void UpdateSceneChap(int &chap);
170  void UpdateSceneList(int chap, int &sel);
171  void UpdateSceneResume(int rank);
172  void UpdateDisplayDevice();
173  void UpdateDisplayMode();
174  void ChangeDisplay();
175  void UpdateApply();
176  void UpdateSetupButtons();
177  void ChangeSetupButtons();
178  void ChangeSetupQuality(int quality);
179  void UpdateKey();
180  void ChangeKey(EventType event);
181 
182 protected:
183  CApplication* m_app;
184  CRobotMain* m_main;
185  CEventQueue* m_eventQueue;
186  Gfx::CEngine* m_engine;
187  CInterface* m_interface;
188  Gfx::CParticle* m_particle;
189  Gfx::CCamera* m_camera;
190  CSoundInterface* m_sound;
191  CPauseManager* m_pause;
192 
193  Phase m_phase; // copy of CRobotMain
194  Phase m_phaseSetup; // tab selected
195  Phase m_phaseTerm; // phase trainer/scene/proto
196  float m_phaseTime;
197 
198  GamerPerso m_perso; // perso: description
199  GamerPerso m_persoCopy; // perso: copy for cancellation
200  int m_persoTab; // perso: tab selected
201  float m_persoAngle; // perso: angle of presentation
202 
203  std::string m_sceneDir; // scene folder
204  std::string m_savegameDir; // savegame folder
205  std::string m_publicDir; // program folder
206  std::string m_userDir; // user 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_setupSelDevice;
233  int m_setupSelMode;
234  bool m_setupFull;
235 
236  bool m_bTooltip; // tooltips to be displayed?
237  bool m_bGlint; // reflections on buttons?
238  bool m_bRain; // rain in the interface?
239  bool m_bSoluce4; // solutions in program 4?
240  bool m_bMovies; // cinematics?
241  bool m_bNiceReset; // for CTaskReset
242  bool m_bHimselfDamage; // for shots
243  bool m_bCameraScroll; // for CCamera
244  bool m_bCameraInvertX; // for CCamera
245  bool m_bCameraInvertY; // for CCamera
246  bool m_bEffect; // for CCamera
247 
248  Math::Point m_glintMouse;
249  float m_glintTime;
250 
251  int m_loadingCounter;
252 
253  bool m_bDialog; // this dialogue?
254  bool m_bDialogFire; // setting on fire?
255  bool m_bDialogDelete;
256  Math::Point m_dialogPos;
257  Math::Point m_dialogDim;
258  float m_dialogParti;
259  float m_dialogTime;
260  PauseType m_bInitPause;
261  Gfx::CameraType m_initCamera;
262 
263  int m_partiPhase[10];
264  float m_partiTime[10];
265  Math::Point m_partiPos[10];
266 
267  SceneInfo m_sceneInfo[MAXSCENE];
268 
269  std::vector<fs::path> m_saveList;
270 };
271 
272 } // namespace Ui
273 
CameraType
Type of camera.
Definition: camera.h:42
Definition: maindialog.h:72
Definition: maindialog.h:61
CRobotMain - main class of Colobot game engine.
Global event queue.
Definition: event.h:764
Definition: robotmain.h:196
Particle engine.
Definition: particle.h:266
Definition: maindialog.h:55
Color structs and related functions.
2D point
Definition: point.h:46
Main application.
Definition: app.h:201
Camera moving in 3D scene.
Definition: camera.h:130
Management of pause modes.
The graphics engine.
Definition: engine.h:682
RGBA color.
Definition: color.h:35
EventType
Type of event message.
Definition: event.h:35
Event sent by system, interface or game.
Definition: event.h:686
Definition: pausemanager.h:42
Definition: interface.h:56
Sound plugin interface.
Definition: sound.h:149