ScummVM API documentation
game.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 WATCHMAKER_GAME_H
23 #define WATCHMAKER_GAME_H
24 
25 #include "common/random.h"
26 #include "watchmaker/3d/loader.h"
27 #include "watchmaker/fonts.h"
28 #include "watchmaker/game_options.h"
29 #include "watchmaker/ll/ll_ffile.h"
30 #include "watchmaker/saveload.h"
31 #include "watchmaker/schedule.h"
32 #include "watchmaker/work_dirs.h"
33 
34 namespace Watchmaker {
35 
36 class sdl_wrapper;
37 class Renderer;
38 
39 struct GameVars {
40 private:
41  int32 CurRoom = 0;
42 
43 public:
44  void setCurRoomId(int32 room) {
45  CurRoom = room;
46  }
47  int32 getCurRoomId() const {
48  return CurRoom;
49  }
50 };
51 
52 class MeshModifiers;
53 class RoomManager;
54 class CameraMan;
55 
56 class WGame {
57  bool g_bReady = false, g_bActive = false;
58  //bool g_bSkipActive = false;
59  const char *CharName[32] = {};
60  uint32 LoadChar;
61  MeshModifiers *_meshModifiers;
62 
63 public:
65  Renderer *_renderer;
66  WorkDirs workDirs;
67  GameOptions gameOptions;
68  Init init;
69  sdl_wrapper *sdl;
70  GameVars _gameVars;
71  GameRect _gameRect;
72  Fonts _fonts;
73  MessageSystem _messageSystem;
74  RoomManager *_roomManager;
75  CameraMan *_cameraMan;
76  WGame();
77  ~WGame();
78 
79  SRoom &getCurRoom() {
80  return init.Room[_gameVars.getCurRoomId()];
81  }
82 
83  Common::SharedPtr<Common::SeekableReadStream> resolveFile(const char *path, bool noFastFile = false);
84 
85  void configLoaderFlags() {
86  // TODO: Add back some of the configurability from the argument parsing.
87  LoadChar = 3;
88  LoaderFlags = T3D_STATIC_SET0;
89  LoaderFlags |= T3D_OUTDOORLIGHTS;
90  LoaderFlags |= T3D_PRELOADBASE;
91  LoaderFlags |= T3D_STATIC_SET1;
92 
93  if (!(LoaderFlags & T3D_DEBUGMODE)) {
94  LoadChar = 3;
95  LoadChar |= 16777212;
96  }
97  }
98 
99  int StartPlayingGame(const Common::String &LoaderName_override);
100  bool LoadAndSetup(const Common::String &name, uint8 lite);
101  void LoadMisc();
102  void UpdateAll();
103  void initCharNames();
104  void CleanUpAndPostQuit();
105 
106  bool CheckAndLoadMoglieSupervisoreModel(int32 c);
107 
108  void GameLoop();
109 
110  // TODO: These might belong elsewhere after some refactoring:
111  void addMeshModifier(const Common::String &name, int16 com, void *p);
112  void loadMeshModifiers(Common::SeekableReadStream &stream);
113 };
114 
115 extern WGame *_vm;
116 
117 } // End of namespace Watchmaker
118 
119 #endif // WATCHMAKER_GAME_H
Definition: 2d_stuff.h:30
Definition: str.h:59
Definition: random.h:44
Definition: sdl_wrapper.h:32
Definition: ll_mesh.h:73
Definition: stream.h:745
Definition: globvar.h:199
Definition: work_dirs.h:30
Definition: struct.h:121
Definition: fonts.h:37
Definition: loader.h:79
Definition: globvar.h:33
Definition: schedule.h:38
Definition: game.h:56
Definition: renderer.h:45
Definition: game_options.h:31
Definition: game.h:39
Definition: do_camera.h:31