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/fonts.h"
27 #include "watchmaker/schedule.h"
28 #include "watchmaker/3d/loader.h"
29 #include "watchmaker/game_options.h"
30 #include "watchmaker/ll/ll_ffile.h"
31 #include "watchmaker/saveload.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 
55 class WGame {
56  bool g_bReady = false, g_bActive = false;
57  //bool g_bSkipActive = false;
58  const char *CharName[32] = {};
59  uint32 LoadChar;
60  MeshModifiers *_meshModifiers;
61 
62 public:
64  Renderer *_renderer;
65  WorkDirs workDirs;
66  GameOptions gameOptions;
67  Init init;
68  sdl_wrapper *sdl;
69  GameVars _gameVars;
70  GameRect _gameRect;
71  Fonts _fonts;
72  MessageSystem _messageSystem;
73  RoomManager *_roomManager;
74  WGame();
75  ~WGame();
76 
77  SRoom &getCurRoom() {
78  return init.Room[_gameVars.getCurRoomId()];
79  }
80 
81  Common::SharedPtr<Common::SeekableReadStream> resolveFile(const char *path, bool noFastFile = false);
82 
83  void configLoaderFlags() {
84  // TODO: Add back some of the configurability from the argument parsing.
85  LoadChar = 3;
86  LoaderFlags = T3D_STATIC_SET0;
87  LoaderFlags |= T3D_OUTDOORLIGHTS;
88  LoaderFlags |= T3D_PRELOADBASE;
89  LoaderFlags |= T3D_STATIC_SET1;
90 
91  if (!(LoaderFlags & T3D_DEBUGMODE)) {
92  LoadChar = 3;
93  LoadChar |= 16777212;
94  }
95  }
96 
97  int StartPlayingGame(const Common::String &LoaderName_override);
98  bool LoadAndSetup(const Common::String &name, uint8 lite);
99  void LoadMisc();
100  void UpdateAll();
101  void initCharNames();
102  void CleanUpAndPostQuit();
103 
104  bool CheckAndLoadMoglieSupervisoreModel(int32 c);
105 
106  void GameLoop();
107 
108  // TODO: These might belong elsewhere after some refactoring:
109  void addMeshModifier(const Common::String &name, int16 com, void *p);
110  void loadMeshModifiers(Common::SeekableReadStream &stream);
111 };
112 
113 extern WGame *_vm;
114 
115 } // End of namespace Watchmaker
116 
117 #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:55
Definition: renderer.h:45
Definition: game_options.h:31
Definition: game.h:39