2015-03-15 16:52:55 -04:00
|
|
|
/* 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.
|
2015-05-09 18:04:13 +02:00
|
|
|
*
|
2015-03-15 16:52:55 -04:00
|
|
|
* 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.
|
2015-05-09 18:04:13 +02:00
|
|
|
*
|
2015-03-15 16:52:55 -04:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-05-17 18:20:01 +02:00
|
|
|
#ifndef SHERLOCK_SHERLOCK_H
|
|
|
|
#define SHERLOCK_SHERLOCK_H
|
2015-03-15 16:52:55 -04:00
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/array.h"
|
|
|
|
#include "common/endian.h"
|
|
|
|
#include "common/hash-str.h"
|
2015-05-05 07:00:24 +02:00
|
|
|
#include "common/serializer.h"
|
2015-03-17 23:09:04 -04:00
|
|
|
#include "common/random.h"
|
|
|
|
#include "common/savefile.h"
|
|
|
|
#include "common/util.h"
|
2020-08-06 23:12:13 +05:30
|
|
|
|
2015-03-15 16:52:55 -04:00
|
|
|
#include "engines/engine.h"
|
2020-08-06 23:12:13 +05:30
|
|
|
|
2015-03-15 21:25:07 -04:00
|
|
|
#include "sherlock/animation.h"
|
2015-03-15 18:42:24 -04:00
|
|
|
#include "sherlock/debugger.h"
|
2015-03-15 21:25:07 -04:00
|
|
|
#include "sherlock/events.h"
|
2015-06-14 14:13:55 +02:00
|
|
|
#include "sherlock/fixed_text.h"
|
2015-03-20 22:01:52 -04:00
|
|
|
#include "sherlock/inventory.h"
|
2015-03-15 16:52:55 -04:00
|
|
|
#include "sherlock/journal.h"
|
2015-04-15 08:22:40 -05:00
|
|
|
#include "sherlock/map.h"
|
2015-05-24 01:20:42 +02:00
|
|
|
#include "sherlock/music.h"
|
2015-03-19 19:49:42 -04:00
|
|
|
#include "sherlock/people.h"
|
2015-03-15 16:52:55 -04:00
|
|
|
#include "sherlock/resources.h"
|
2015-04-21 18:25:06 -05:00
|
|
|
#include "sherlock/saveload.h"
|
2015-03-18 23:01:47 -04:00
|
|
|
#include "sherlock/scene.h"
|
2015-03-16 23:52:08 -04:00
|
|
|
#include "sherlock/screen.h"
|
2015-03-15 21:25:07 -04:00
|
|
|
#include "sherlock/sound.h"
|
2015-03-15 16:52:55 -04:00
|
|
|
#include "sherlock/talk.h"
|
2015-03-23 20:34:34 -04:00
|
|
|
#include "sherlock/user_interface.h"
|
2020-08-26 16:41:04 +05:30
|
|
|
#include "sherlock/detection.h"
|
2015-03-15 16:52:55 -04:00
|
|
|
|
|
|
|
namespace Sherlock {
|
|
|
|
|
|
|
|
enum {
|
2015-05-31 23:28:28 +02:00
|
|
|
kDebugLevelScript = 1 << 0,
|
|
|
|
kDebugLevelAdLibDriver = 2 << 0,
|
2015-06-02 16:42:31 +02:00
|
|
|
kDebugLevelMT32Driver = 3 << 0,
|
|
|
|
kDebugLevelMusic = 4 << 0
|
2015-03-15 16:52:55 -04:00
|
|
|
};
|
|
|
|
|
2016-03-10 21:51:47 -05:00
|
|
|
#define SHERLOCK_SCREEN_WIDTH _vm->_screen->width()
|
|
|
|
#define SHERLOCK_SCREEN_HEIGHT _vm->_screen->height()
|
|
|
|
#define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.width()
|
2015-05-25 11:04:34 -04:00
|
|
|
#define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480)
|
2015-06-11 08:32:31 -04:00
|
|
|
#define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101)
|
2015-07-26 16:40:34 -04:00
|
|
|
#define MAX_BGSHAPES (IS_SERRATED_SCALPEL ? 64 : 150)
|
2015-03-15 16:52:55 -04:00
|
|
|
|
2015-06-27 07:36:25 -04:00
|
|
|
#define COL_INFO_FOREGROUND (IS_SERRATED_SCALPEL ? (byte)Scalpel::INFO_FOREGROUND : (byte)Tattoo::INFO_FOREGROUND)
|
|
|
|
#define COL_PEN_COLOR (IS_SERRATED_SCALPEL ? (byte)Scalpel::PEN_COLOR : (byte)Tattoo::PEN_COLOR)
|
2015-07-27 20:32:32 -04:00
|
|
|
#define COL_PEN_HIGHLIGHT (IS_SERRATED_SCALPEL ? 15 : 129)
|
2015-06-25 21:36:26 -04:00
|
|
|
|
2015-03-15 16:52:55 -04:00
|
|
|
class Resource;
|
|
|
|
|
|
|
|
class SherlockEngine : public Engine {
|
|
|
|
private:
|
2015-09-13 15:29:29 -04:00
|
|
|
\
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Main loop for displaying a scene and handling all that occurs within it
|
|
|
|
*/
|
2015-03-22 09:02:31 -04:00
|
|
|
void sceneLoop();
|
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Handle all player input
|
|
|
|
*/
|
2015-03-22 09:02:31 -04:00
|
|
|
void handleInput();
|
2015-03-15 17:50:10 -04:00
|
|
|
protected:
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Does basic initialization of the game engine
|
|
|
|
*/
|
2015-03-15 17:50:10 -04:00
|
|
|
virtual void initialize();
|
2015-03-15 18:42:24 -04:00
|
|
|
|
|
|
|
virtual void showOpening() = 0;
|
2015-03-18 22:32:41 -04:00
|
|
|
|
|
|
|
virtual void startScene() {}
|
2015-04-22 07:08:01 -05:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Returns a list of features the game itself supports
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
bool hasFeature(EngineFeature f) const override;
|
2015-07-24 21:47:05 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load game configuration esttings
|
|
|
|
*/
|
|
|
|
virtual void loadConfig();
|
2015-03-15 16:52:55 -04:00
|
|
|
public:
|
|
|
|
const SherlockGameDescription *_gameDescription;
|
2015-03-15 21:25:07 -04:00
|
|
|
Animation *_animation;
|
2015-03-15 18:42:24 -04:00
|
|
|
Debugger *_debugger;
|
2015-03-21 20:25:15 -04:00
|
|
|
Events *_events;
|
2015-06-14 14:13:55 +02:00
|
|
|
FixedText *_fixedText;
|
2015-03-20 22:01:52 -04:00
|
|
|
Inventory *_inventory;
|
2015-03-15 16:52:55 -04:00
|
|
|
Journal *_journal;
|
2015-04-15 08:22:40 -05:00
|
|
|
Map *_map;
|
2015-05-24 01:20:42 +02:00
|
|
|
Music *_music;
|
2015-03-19 19:49:42 -04:00
|
|
|
People *_people;
|
2015-03-15 16:52:55 -04:00
|
|
|
Resources *_res;
|
2015-04-21 18:25:06 -05:00
|
|
|
SaveManager *_saves;
|
2015-03-18 23:01:47 -04:00
|
|
|
Scene *_scene;
|
2015-03-15 17:25:21 -04:00
|
|
|
Screen *_screen;
|
2015-03-15 21:25:07 -04:00
|
|
|
Sound *_sound;
|
2015-03-15 16:52:55 -04:00
|
|
|
Talk *_talk;
|
2015-03-23 20:34:34 -04:00
|
|
|
UserInterface *_ui;
|
2015-03-17 23:09:04 -04:00
|
|
|
Common::RandomSource _randomSource;
|
2015-03-15 16:52:55 -04:00
|
|
|
Common::Array<bool> _flags;
|
2015-03-15 23:16:38 -04:00
|
|
|
bool _useEpilogue2;
|
2015-04-22 06:25:04 -05:00
|
|
|
int _loadGameSlot;
|
2015-04-22 07:08:01 -05:00
|
|
|
bool _canLoadSave;
|
2015-05-14 19:53:03 -04:00
|
|
|
bool _showOriginalSavesDialog;
|
2015-05-18 20:57:27 +02:00
|
|
|
bool _interactiveFl;
|
2015-09-13 15:29:29 -04:00
|
|
|
bool _isScreenDoubled;
|
2015-03-15 16:52:55 -04:00
|
|
|
public:
|
|
|
|
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
|
2020-02-09 12:05:32 +01:00
|
|
|
~SherlockEngine() override;
|
2015-03-15 16:52:55 -04:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Main method for running the game
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
Common::Error run() override;
|
2015-03-15 16:52:55 -04:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Returns true if a savegame can be loaded
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
bool canLoadGameStateCurrently() override;
|
2015-05-19 07:37:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the game can be saved
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
bool canSaveGameStateCurrently() override;
|
2015-05-19 07:37:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the GMM to load a savegame
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
Common::Error loadGameState(int slot) override;
|
2015-05-19 07:37:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the GMM to save the game
|
|
|
|
*/
|
2020-02-04 22:13:33 -08:00
|
|
|
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
|
2015-05-19 07:37:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the engine when sound settings are updated
|
|
|
|
*/
|
2020-02-09 12:05:32 +01:00
|
|
|
void syncSoundSettings() override;
|
2015-05-19 07:37:55 -04:00
|
|
|
|
2015-07-24 21:47:05 -04:00
|
|
|
/**
|
|
|
|
* Saves game configuration information
|
|
|
|
*/
|
|
|
|
virtual void saveConfig();
|
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Returns whether the version is a demo
|
|
|
|
*/
|
2015-05-18 18:30:31 -04:00
|
|
|
virtual bool isDemo() const;
|
2015-04-22 07:08:01 -05:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Returns the Id of the game
|
|
|
|
*/
|
2015-05-09 09:17:30 -04:00
|
|
|
GameType getGameID() const;
|
2015-03-15 16:52:55 -04:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Returns the platform the game's datafiles are for
|
|
|
|
*/
|
|
|
|
Common::Platform getPlatform() const;
|
2015-03-17 23:09:04 -04:00
|
|
|
|
2015-06-06 17:50:57 -04:00
|
|
|
/**
|
|
|
|
* Return the game's language
|
|
|
|
*/
|
|
|
|
Common::Language getLanguage() const;
|
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Return a random number
|
|
|
|
*/
|
2015-03-17 23:09:04 -04:00
|
|
|
int getRandomNumber(int limit) { return _randomSource.getRandomNumber(limit - 1); }
|
2015-03-20 22:01:52 -04:00
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Read the state of a global flag
|
|
|
|
* @remarks If a negative value is specified, it will return the inverse value
|
|
|
|
* of the positive flag number
|
|
|
|
*/
|
2015-03-20 22:01:52 -04:00
|
|
|
bool readFlags(int flagNum);
|
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Sets a global flag to either true or false depending on whether the specified
|
|
|
|
* flag is positive or negative
|
|
|
|
*/
|
2015-03-20 22:01:52 -04:00
|
|
|
void setFlags(int flagNum);
|
2015-03-30 21:07:01 -04:00
|
|
|
|
2015-06-11 08:32:31 -04:00
|
|
|
/**
|
|
|
|
* Set a global flag to 0 or 1 depending on whether the passed flag is negative or positive.
|
|
|
|
* @remarks We don't use the global setFlags method because we don't want to check scene flags
|
|
|
|
*/
|
|
|
|
void setFlagsDirect(int flagNum);
|
|
|
|
|
2015-05-19 07:37:55 -04:00
|
|
|
/**
|
|
|
|
* Synchronize the data for a savegame
|
|
|
|
*/
|
2015-06-07 19:18:14 -04:00
|
|
|
void synchronize(Serializer &s);
|
2015-03-15 16:52:55 -04:00
|
|
|
};
|
|
|
|
|
2015-05-17 07:20:06 -04:00
|
|
|
#define IS_ROSE_TATTOO (_vm->getGameID() == GType_RoseTattoo)
|
|
|
|
#define IS_SERRATED_SCALPEL (_vm->getGameID() == GType_SerratedScalpel)
|
2015-06-16 09:59:27 +03:00
|
|
|
#define IS_3DO (_vm->getPlatform() == Common::kPlatform3DO)
|
2015-05-17 07:20:06 -04:00
|
|
|
|
2015-03-15 16:52:55 -04:00
|
|
|
} // End of namespace Sherlock
|
|
|
|
|
|
|
|
#endif
|