aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb/game.h
blob: adb5bf5c48ef6a8e5bee304587a7d64ae070d8f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef MUTATIONOFJB_GAME_H
#define MUTATIONOFJB_GAME_H

#include "mutationofjb/assets.h"
#include "mutationofjb/gamescreen.h"
#include "mutationofjb/script.h"
#include "mutationofjb/tasks/taskmanager.h"

#include "common/ptr.h"
#include "common/random.h"
#include "common/scummsys.h"

namespace Common {
class String;
}

namespace MutationOfJB {

class Command;
class MutationOfJBEngine;
class Script;
class Room;
class SayTask;
struct GameData;
struct Door;
struct Static;
struct Bitmap;

class Game {
public:
	Game(MutationOfJBEngine *vm);
	Common::RandomSource &getRandomSource();
	GameData &getGameData();
	Room &getRoom();
	Script *getGlobalScript() const;
	Script *getLocalScript() const;

	void changeScene(uint8 sceneId, bool partB);
	Script *changeSceneDelayScript(uint8 sceneId, bool partB);

	bool startActionSection(ActionInfo::Action action, const Common::String &entity1Name, const Common::String &entity2Name = Common::String());

	bool isCurrentSceneMap() const;

	void update();

	GameScreen &getGameScreen();

	ActionInfo::Action getCurrentAction() const;
	void setCurrentAction(ActionInfo::Action);

	static uint8 colorFromString(const char *colorStr);

	TaskManager &getTaskManager();
	Assets &getAssets();

	Graphics::Screen &getScreen();

	TaskPtr getActiveSayTask() const;
	void setActiveSayTask(const TaskPtr &sayTask);

	bool loadSaveAllowed() const;

private:
	bool loadGameData(bool partB);
	void runActiveCommand();
	void startCommand(Command *cmd);
	Script *changeSceneLoadScript(uint8 sceneId, bool partB);

	MutationOfJBEngine *_vm;
	Common::RandomSource _randomSource;

	GameData *_gameData;
	Script *_globalScript;
	Script *_localScript;
	Script *_delayedLocalScript;
	Room *_room;
	GameScreen _gui;
	ActionInfo::Action _currentAction;

	ScriptExecutionContext _scriptExecCtx;

	TaskManager _taskManager;
	Assets _assets;
	TaskPtr _activeSayTask;
};

}

#endif