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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef MUTATIONOFJB_GAME_H
24 #define MUTATIONOFJB_GAME_H
25 
26 #include "mutationofjb/assets.h"
27 #include "mutationofjb/gamescreen.h"
28 #include "mutationofjb/tasks/taskmanager.h"
29 
30 #include "common/language.h"
31 #include "common/ptr.h"
32 #include "common/random.h"
33 #include "common/scummsys.h"
34 
35 namespace Common {
36 class String;
37 }
38 
39 namespace MutationOfJB {
40 
41 class Command;
42 class MutationOfJBEngine;
43 class Script;
44 class Room;
45 class SayTask;
46 struct GameData;
47 struct Door;
48 struct Static;
49 struct Bitmap;
50 
51 class Game {
52 public:
53 	Game(MutationOfJBEngine *vm);
54 	MutationOfJBEngine &getEngine();
55 
56 	Common::RandomSource &getRandomSource();
57 	GameData &getGameData();
58 	Room &getRoom();
59 	Script *getGlobalScript() const;
60 	Script *getLocalScript() const;
61 
62 	void changeScene(uint8 sceneId, bool partB);
63 	Script *changeSceneDelayScript(uint8 sceneId, bool partB, bool runDelayedScriptStartup = false);
64 
65 	bool startActionSection(ActionInfo::Action action, const Common::String &entity1Name, const Common::String &entity2Name = Common::String());
66 
67 	bool isCurrentSceneMap() const;
68 
69 	void update();
70 
71 	GameScreen &getGameScreen();
72 
73 	static uint8 colorFromString(const char *colorStr);
74 
75 	TaskManager &getTaskManager();
76 	Assets &getAssets();
77 
78 	Graphics::Screen &getScreen();
79 
80 	TaskPtr getActiveSayTask() const;
81 	void setActiveSayTask(const TaskPtr &sayTask);
82 
83 	bool loadSaveAllowed() const;
84 
85 	Common::Language getLanguage() const;
86 
87 	void switchToPartB();
88 
89 private:
90 	bool loadGameData(bool partB);
91 	void runActiveCommand();
92 	void startCommand(Command *cmd);
93 	Script *changeSceneLoadScript(uint8 sceneId, bool partB);
94 
95 	MutationOfJBEngine *_vm;
96 	Common::RandomSource _randomSource;
97 
98 	GameData *_gameData;
99 	Script *_globalScript;
100 	Script *_localScript;
101 	Script *_delayedLocalScript;
102 	bool _runDelayedScriptStartup;
103 	Room *_room;
104 	GameScreen _gui;
105 
106 	ScriptExecutionContext _scriptExecCtx;
107 
108 	TaskManager _taskManager;
109 	Assets _assets;
110 	TaskPtr _activeSayTask;
111 };
112 
113 }
114 
115 #endif
116