ScummVM API documentation
base_engine.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/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_BASE_ENGINE_H
29#define WINTERMUTE_BASE_ENGINE_H
30
31#include "common/str.h"
32#include "common/singleton.h"
33#include "common/random.h"
34#include "common/language.h"
35
36#include "engines/wintermute/detection.h"
37
38namespace Wintermute {
39
40class BaseFileManager;
41class BaseRegistry;
42class BaseGame;
43class BaseSoundMgr;
44class BaseRenderer;
45class SystemClassRegistry;
46class Timer;
47class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
48 void init();
49 BaseFileManager *_fileManager;
50 Common::String _gameId;
51 Common::String _targetName;
52 BaseGame *_gameRef;
53 // We need random numbers
55 SystemClassRegistry *_classReg;
56 Common::Language _language;
57 WMETargetExecutable _targetExecutable;
58 uint32 _flags;
59public:
60 BaseEngine();
61 ~BaseEngine() override;
62 static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang, WMETargetExecutable targetExecutable, uint32 flags);
63
64 void setGameRef(BaseGame *game) { _gameRef = game; }
65
66 Common::RandomSource *getRandomSource() { return _rnd; }
67 uint32 randInt(int from, int to);
68
69 SystemClassRegistry *getClassRegistry() { return _classReg; }
70 BaseGame *getGameRef() { return _gameRef; }
71 BaseFileManager *getFileManager() { return _fileManager; }
72 BaseSoundMgr *getSoundMgr();
73 static BaseRenderer *getRenderer();
74 static const Timer *getTimer();
75 static const Timer *getLiveTimer();
76 static void LOG(bool res, const char *fmt, ...);
77 Common::String getGameTargetName() const { return _targetName; }
78 Common::String getGameId() const { return _gameId; }
79 Common::Language getLanguage() const { return _language; }
80 uint32 getFlags() const { return _flags; }
81 WMETargetExecutable getTargetExecutable() const {
82 return _targetExecutable;
83 }
84 static bool isFoxTailCheck(WMETargetExecutable t, WMETargetExecutable v1=FOXTAIL_OLDEST_VERSION, WMETargetExecutable v2=FOXTAIL_LATEST_VERSION) {
85 return t >= v1 && t <= v2;
86 }
87 bool isFoxTail(WMETargetExecutable v1=FOXTAIL_OLDEST_VERSION, WMETargetExecutable v2=FOXTAIL_LATEST_VERSION) const {
88 return isFoxTailCheck(_targetExecutable, v1, v2);
89 }
90 void addFlags(uint32 flags) { _flags |= flags; }
91};
92
93} // End of namespace Wintermute
94
95#endif
Definition: random.h:44
Definition: singleton.h:42
Definition: str.h:59
Definition: base_engine.h:47
Definition: base_file_manager.h:39
Definition: base_game.h:79
Definition: base_renderer.h:53
Definition: base_sound_manager.h:38
Definition: sys_class_registry.h:59
Language
Definition: language.h:45