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 <boost/filesystem.hpp>
27 #include <boost/algorithm/string.hpp>
28 
29 #include <vector>
30 
31 namespace fs = boost::filesystem;
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  char numTry;
56  char 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  bool EventProcess(const Event &event);
77  void ChangePhase(Phase phase);
78 
79  void SetSceneRead(const char* name);
80  void SetStackRead(const char* name);
81  void SetSceneName(const char* name);
82  void SetSceneRank(int rank);
83  std::string & GetSceneRead();
84  std::string & GetStackRead();
85  char* GetSceneName();
86  int GetSceneRank();
87  const char* GetSceneDir();
88  bool GetSceneSoluce();
89  std::string & GetSavegameDir();
90  std::string & GetPublicDir();
91 
92  bool GetTooltip();
93  bool GetGlint();
94  bool GetSoluce4();
95  bool GetMovies();
96  bool GetNiceReset();
97  bool GetHimselfDamage();
98 
99  void SetUserDir(char *base, int rank);
100  void BuildSceneName(std::string &filename, char *base, int rank);
101  void BuildResumeName(char *filename, char *base, int rank);
102  std::string & GetFilesDir();
103 
104  void StartAbort();
105  void StartDeleteObject();
106  void StartDeleteGame(char *gamer);
107  void StartQuit();
108  void StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCancel);
109  void FrameDialog(float rTime);
110  void StopDialog();
111  bool IsDialog();
112 
113  void StartSuspend();
114  void StopSuspend();
115 
116  void SetupMemorize();
117  void SetupRecall();
118 
119  bool ReadGamerInfo();
120  bool WriteGamerInfo();
121  void SetGamerInfoTry(int rank, int numTry);
122  int GetGamerInfoTry(int rank);
123  void SetGamerInfoPassed(int rank, bool bPassed);
124  bool GetGamerInfoPassed(int rank);
125  bool NextMission();
126 
127  void WriteGamerPerso(char *gamer);
128  void ReadGamerPerso(char *gamer);
129  void SetGamerFace(char *gamer, int face);
130  int GetGamerFace(char *gamer);
131  int GetGamerFace();
132  int GetGamerGlasses();
133  bool GetGamerOnlyHead();
134  float GetPersoAngle();
135  Gfx::Color GetGamerColorHair();
136  Gfx::Color GetGamerColorCombi();
137  Gfx::Color GetGamerColorBand();
138 
139  void AllMissionUpdate();
140  void ShowSoluceUpdate();
141 
142 protected:
143  void GlintMove();
144  void FrameParticle(float rTime);
145  void NiceParticle(Math::Point mouse, bool bPress);
146  void ReadNameList();
147  void UpdateNameList();
148  void UpdateNameEdit();
149  void UpdateNameControl();
150  void UpdateNameFace();
151  void NameSelect();
152  void NameCreate();
153  void NameDelete();
154  void UpdatePerso();
155  void CameraPerso();
156  void FixPerso(int rank, int index);
157  void ColorPerso();
158  void DefPerso();
159  bool IsIOReadScene();
160  void IOReadName();
161  void IOReadList();
162  void IOUpdateList();
163  void IODeleteScene();
164  bool IOWriteScene();
165  bool IOReadScene();
166  int GetChapPassed();
167  void UpdateSceneChap(int &chap);
168  void UpdateSceneList(int chap, int &sel);
169  void UpdateSceneResume(int rank);
170  void UpdateDisplayDevice();
171  void UpdateDisplayMode();
172  void ChangeDisplay();
173  void UpdateApply();
174  void UpdateSetupButtons();
175  void ChangeSetupButtons();
176  void ChangeSetupQuality(int quality);
177  void UpdateKey();
178  void ChangeKey(EventType event);
179 
180 protected:
181  CApplication* m_app;
182  CRobotMain* m_main;
183  CEventQueue* m_eventQueue;
184  Gfx::CEngine* m_engine;
185  CInterface* m_interface;
186  Gfx::CParticle* m_particle;
187  Gfx::CCamera* m_camera;
188  CSoundInterface* m_sound;
189 
190  Phase m_phase; // copy of CRobotMain
191  Phase m_phaseSetup; // tab selected
192  Phase m_phaseTerm; // phase trainer/scene/proto
193  float m_phaseTime;
194 
195  GamerPerso m_perso; // perso: description
196  GamerPerso m_persoCopy; // perso: copy for cancellation
197  int m_persoTab; // perso: tab selected
198  float m_persoAngle; // perso: angle of presentation
199 
200  std::string m_sceneDir; // scene folder
201  std::string m_savegameDir; // savegame folder
202  std::string m_publicDir; // program folder
203  std::string m_userDir; // user folder
204  std::string m_filesDir; // case files
205 
206  int m_index; // 0..4
207  int m_chap[10]; // selected chapter (0..8)
208  int m_sel[10]; // chosen mission (0..98)
209  int m_maxList;
210  int m_accessChap;
211  std::string m_sceneRead; // name of the scene to read
212  std::string m_stackRead; // name of the scene to read
213  char m_sceneName[20]; // name of the scene to play
214  int m_sceneRank; // rank of the scene to play
215  bool m_bSceneSoluce; // shows the solution
216  bool m_bSimulSetup; // adjustment during the game
217  bool m_accessEnable;
218  bool m_accessMission;
219  bool m_accessUser;
220  bool m_bDeleteGamer;
221 
222  int m_userTotal;
223 
224  std::vector<std::string> m_userList;
225 
226  int m_shotDelay; // number of frames before copy
227  std::string m_shotName; // generate a file name
228 
229  int m_setupSelDevice;
230  int m_setupSelMode;
231  bool m_setupFull;
232 
233  bool m_bTooltip; // tooltips to be displayed?
234  bool m_bGlint; // reflections on buttons?
235  bool m_bRain; // rain in the interface?
236  bool m_bSoluce4; // solutions in program 4?
237  bool m_bMovies; // cinematics?
238  bool m_bNiceReset; // for CTaskReset
239  bool m_bHimselfDamage; // for shots
240  bool m_bCameraScroll; // for CCamera
241  bool m_bCameraInvertX; // for CCamera
242  bool m_bCameraInvertY; // for CCamera
243  bool m_bEffect; // for CCamera
244 
245  Math::Point m_glintMouse;
246  float m_glintTime;
247 
248  int m_loadingCounter;
249 
250  bool m_bDialog; // this dialogue?
251  bool m_bDialogFire; // setting on fire?
252  bool m_bDialogDelete;
253  Math::Point m_dialogPos;
254  Math::Point m_dialogDim;
255  float m_dialogParti;
256  float m_dialogTime;
257  bool m_bInitPause;
258  Gfx::CameraType m_initCamera;
259 
260  int m_partiPhase[10];
261  float m_partiTime[10];
262  Math::Point m_partiPos[10];
263 
264  SceneInfo m_sceneInfo[MAXSCENE];
265 
266  std::vector<fs::path> m_saveList;
267 };
268 
269 } // namespace Ui
270 
CameraType
Type of camera.
Definition: camera.h:42
Definition: maindialog.h:70
Definition: maindialog.h:59
CRobotMain - main class of Colobot game engine.
Global event queue.
Definition: event.h:765
Definition: robotmain.h:191
Particle engine.
Definition: particle.h:266
Definition: maindialog.h:53
Color structs and related functions.
2D point
Definition: point.h:46
Main application.
Definition: app.h:200
Camera moving in 3D scene.
Definition: camera.h:130
The graphics engine.
Definition: engine.h:681
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:687
Definition: interface.h:56
Sound plugin interface.
Definition: sound.h:149