ScummVM API documentation
game_manager.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TITANIC_GAME_MANAGER_H
23 #define TITANIC_GAME_MANAGER_H
24 
25 #include "common/scummsys.h"
26 #include "titanic/game_state.h"
27 #include "titanic/input_handler.h"
28 #include "titanic/input_translator.h"
29 #include "titanic/support/time_event_info.h"
30 #include "titanic/true_talk/true_talk_manager.h"
31 #include "titanic/sound/music_room.h"
32 #include "titanic/sound/sound.h"
33 
34 namespace Titanic {
35 
36 class CBackgroundSoundMaker;
37 class CGameView;
38 class CMovie;
39 class CMovieClip;
40 class CProjectItem;
41 class CRoomItem;
42 class CScreenManager;
43 class CTreeItem;
44 class CViewItem;
45 class CVideoSurface;
46 class SimpleFile;
47 
48 class CGameManager {
49 private:
50  CTrueTalkManager _trueTalkManager;
51  CTimeEventInfoList _timers;
52  CTreeItem *_treeItem;
53  CBackgroundSoundMaker *_soundMaker;
54  CMovie *_movie;
55  CRoomItem *_movieRoom;
56  int _transitionCtr;
57  CVideoSurface *_movieSurface;
58  uint _lastDiskTicksCount;
59  uint _tickCount2;
60 private:
64  void frameMessage(CRoomItem *room);
65 
69  void updateMovies();
70 
74  void roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom);
75 public:
76  CProjectItem *_project;
77  CGameView *_gameView;
78  CGameState _gameState;
79  Rect _bounds;
80  CInputHandler _inputHandler;
81  CInputTranslator _inputTranslator;
82  CTreeItem *_dragItem;
83  CSound _sound;
84  CMusicRoom _musicRoom;
85 public:
86  CGameManager(CProjectItem *project, CGameView *gameView, Audio::Mixer *mixer);
87  ~CGameManager();
88 
92  void destroyTreeItem();
93 
97  void save(SimpleFile *file);
98 
102  void load(SimpleFile *file);
103 
107  void preLoad();
108 
112  void postLoad(CProjectItem *project);
113 
117  void preSave(CProjectItem *project);
118 
122  void postSave();
123 
127  void updateDiskTicksCount();
128 
132  CViewItem *getView() { return _gameState._gameLocation.getView(); }
133 
137  CNodeItem *getNode() { return _gameState._gameLocation.getNode(); }
138 
142  CRoomItem *getRoom() { return _gameState._gameLocation.getRoom(); }
143 
147  void lockInputHandler() { _inputHandler.incLockCount(); }
148 
152  void unlockInputHandler() { _inputHandler.decLockCount(); }
153 
157  void playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom);
158 
162  void update();
163 
167  void roomChange();
168 
172  bool isntTransitioning() const { return !_transitionCtr; }
173 
177  void incTransitions() { ++_transitionCtr; }
178 
182  void decTransitions() { --_transitionCtr; }
183 
188  void addDirtyRect(const Rect &r);
189 
193  void markAllDirty();
194 
199 
203  void addTimer(CTimeEventInfo *timer) { _timers.push_back(timer); }
204 
208  void stopTimer(uint id) { _timers.stop(id); }
209 
213  void setTimerPersisent(uint id, bool flag) {
214  _timers.setPersisent(id, flag);
215  }
216 
220  CTrueTalkManager *getTalkManager() { return &_trueTalkManager; }
221 
227 };
228 
229 } // End of namespace Titanic
230 
231 #endif /* TITANIC_GAME_MANAGER_H */
Definition: true_talk_manager.h:44
void incTransitions()
Definition: game_manager.h:177
Definition: input_translator.h:32
CNodeItem * getNode()
Definition: game_manager.h:137
Definition: movie_clip.h:41
void playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom)
void addDirtyRect(const Rect &r)
bool isntTransitioning() const
Definition: game_manager.h:172
CTrueTalkManager * getTalkManager()
Definition: game_manager.h:220
CScreenManager * setScreenManager() const
CViewItem * getView()
Definition: game_manager.h:132
CViewItem * getView()
void postLoad(CProjectItem *project)
void unlockInputHandler()
Definition: game_manager.h:152
void lockInputHandler()
Definition: game_manager.h:147
Definition: simple_file.h:49
Definition: room_item.h:33
Definition: node_item.h:29
Definition: game_state.h:60
Definition: screen_manager.h:49
void decTransitions()
Definition: game_manager.h:182
void save(SimpleFile *file)
Definition: mixer.h:59
Definition: tree_item.h:37
Definition: game_manager.h:48
void addTimer(CTimeEventInfo *timer)
Definition: game_manager.h:203
Definition: movie.h:43
Definition: game_view.h:36
Definition: rect.h:35
void preSave(CProjectItem *project)
void setPersisent(uint id, bool flag)
Definition: arm.h:30
Definition: string.h:40
Definition: input_handler.h:35
CNodeItem * getNode()
Definition: project_item.h:84
void load(SimpleFile *file)
Definition: time_event_info.h:33
Definition: sound.h:60
Definition: video_surface.h:43
void setTimerPersisent(uint id, bool flag)
Definition: game_manager.h:213
CRoomItem * getRoom()
void push_back(const t_T &element)
Definition: list.h:140
Definition: background_sound_maker.h:29
Definition: music_room.h:33
Definition: time_event_info.h:102
CRoomItem * getRoom()
Definition: game_manager.h:142
void stopTimer(uint id)
Definition: game_manager.h:208
Definition: view_item.h:32