2014-12-23 04:49:35 +00: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.
|
|
|
|
*
|
|
|
|
* 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 XEEN_XEEN_H
|
|
|
|
#define XEEN_XEEN_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/error.h"
|
|
|
|
#include "common/random.h"
|
|
|
|
#include "common/savefile.h"
|
|
|
|
#include "common/serializer.h"
|
|
|
|
#include "common/util.h"
|
|
|
|
#include "engines/engine.h"
|
2015-01-13 05:16:26 +00:00
|
|
|
#include "xeen/combat.h"
|
2014-12-23 04:49:35 +00:00
|
|
|
#include "xeen/debugger.h"
|
2015-01-03 01:25:14 +00:00
|
|
|
#include "xeen/dialogs.h"
|
2014-12-25 08:29:38 +00:00
|
|
|
#include "xeen/events.h"
|
2015-01-05 13:11:16 +00:00
|
|
|
#include "xeen/files.h"
|
2015-01-03 13:19:14 +00:00
|
|
|
#include "xeen/interface.h"
|
2015-01-05 13:11:16 +00:00
|
|
|
#include "xeen/map.h"
|
2015-01-02 22:14:57 +00:00
|
|
|
#include "xeen/party.h"
|
2015-01-02 21:01:41 +00:00
|
|
|
#include "xeen/saves.h"
|
2014-12-25 08:29:38 +00:00
|
|
|
#include "xeen/screen.h"
|
2015-01-19 16:32:57 +00:00
|
|
|
#include "xeen/scripts.h"
|
2014-12-26 03:37:20 +00:00
|
|
|
#include "xeen/sound.h"
|
2015-01-26 02:19:59 +00:00
|
|
|
#include "xeen/spells.h"
|
2015-01-26 04:59:16 +00:00
|
|
|
#include "xeen/town.h"
|
2014-12-23 04:49:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the namespace of the Xeen engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: In Development
|
|
|
|
*
|
|
|
|
* Games using this engine:
|
|
|
|
* - Might & Magic 4: Clouds of Xeen
|
|
|
|
* - Might & Magic 5: Dark Side of Xeen
|
|
|
|
* - Might & Magic: World of Xeen
|
|
|
|
* - Might & Magic: Swords of Xeen
|
|
|
|
*/
|
|
|
|
namespace Xeen {
|
|
|
|
|
|
|
|
enum {
|
|
|
|
GType_Clouds = 1,
|
2014-12-25 06:02:51 +00:00
|
|
|
GType_DarkSide = 2,
|
|
|
|
GType_WorldOfXeen = 3,
|
2014-12-23 04:49:35 +00:00
|
|
|
GType_Swords = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
enum XeenDebugChannels {
|
|
|
|
kDebugPath = 1 << 0,
|
|
|
|
kDebugScripts = 1 << 1,
|
|
|
|
kDebugGraphics = 1 << 2,
|
|
|
|
kDebugSound = 1 << 3
|
|
|
|
};
|
|
|
|
|
2014-12-31 08:50:24 +00:00
|
|
|
enum Mode {
|
2015-01-24 01:44:02 +00:00
|
|
|
MODE_FF = -1,
|
2014-12-31 08:50:24 +00:00
|
|
|
MODE_0 = 0,
|
2015-01-03 01:25:14 +00:00
|
|
|
MODE_1 = 1,
|
2015-01-04 00:08:30 +00:00
|
|
|
MODE_2 = 2,
|
|
|
|
MODE_3 = 3,
|
|
|
|
MODE_4 = 4,
|
|
|
|
MODE_5 = 5,
|
|
|
|
MODE_6 = 6,
|
|
|
|
MODE_7 = 7,
|
|
|
|
MODE_8 = 8,
|
2015-01-05 13:11:16 +00:00
|
|
|
MODE_9 = 9,
|
|
|
|
MODE_17 = 17
|
2014-12-31 08:50:24 +00:00
|
|
|
};
|
|
|
|
|
2014-12-23 04:49:35 +00:00
|
|
|
struct XeenGameDescription;
|
|
|
|
|
|
|
|
#define XEEN_SAVEGAME_VERSION 1
|
|
|
|
#define GAME_FRAME_TIME 50
|
|
|
|
|
2015-01-03 13:19:14 +00:00
|
|
|
class XeenEngine : public Engine {
|
2014-12-23 04:49:35 +00:00
|
|
|
private:
|
|
|
|
const XeenGameDescription *_gameDescription;
|
|
|
|
Common::RandomSource _randomSource;
|
|
|
|
int _loadSaveSlot;
|
2015-01-02 05:15:08 +00:00
|
|
|
|
|
|
|
void showIntro();
|
|
|
|
|
|
|
|
void showMainMenu();
|
2015-01-05 13:11:16 +00:00
|
|
|
|
|
|
|
void play();
|
|
|
|
|
|
|
|
void pleaseWait();
|
2015-01-19 16:32:57 +00:00
|
|
|
|
|
|
|
void gameLoop();
|
2014-12-25 06:02:51 +00:00
|
|
|
protected:
|
2014-12-23 04:49:35 +00:00
|
|
|
/**
|
|
|
|
* Play the game
|
|
|
|
*/
|
2014-12-25 06:02:51 +00:00
|
|
|
virtual void playGame();
|
|
|
|
private:
|
|
|
|
void initialize();
|
2014-12-23 04:49:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronize savegame data
|
|
|
|
*/
|
|
|
|
void synchronize(Common::Serializer &s);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Support method that generates a savegame name
|
|
|
|
* @param slot Slot number
|
|
|
|
*/
|
|
|
|
Common::String generateSaveName(int slot);
|
|
|
|
|
|
|
|
// Engine APIs
|
|
|
|
virtual Common::Error run();
|
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
|
|
|
public:
|
2015-01-13 05:16:26 +00:00
|
|
|
Combat *_combat;
|
2014-12-23 04:49:35 +00:00
|
|
|
Debugger *_debugger;
|
2014-12-25 08:29:38 +00:00
|
|
|
EventsManager *_events;
|
2015-01-05 13:11:16 +00:00
|
|
|
FileManager *_files;
|
2015-01-03 13:19:14 +00:00
|
|
|
Interface *_interface;
|
2015-01-05 13:11:16 +00:00
|
|
|
Map *_map;
|
2015-01-19 16:32:57 +00:00
|
|
|
Party *_party;
|
2015-01-02 21:01:41 +00:00
|
|
|
SavesManager *_saves;
|
2014-12-25 08:29:38 +00:00
|
|
|
Screen *_screen;
|
2015-01-19 16:32:57 +00:00
|
|
|
Scripts *_scripts;
|
2014-12-26 03:37:20 +00:00
|
|
|
SoundManager *_sound;
|
2015-01-26 02:19:59 +00:00
|
|
|
Spells *_spells;
|
2015-01-26 04:59:16 +00:00
|
|
|
Town *_town;
|
2015-01-24 01:44:02 +00:00
|
|
|
Treasure _treasure;
|
2014-12-31 08:50:24 +00:00
|
|
|
Mode _mode;
|
|
|
|
GameEvent _gameEvent;
|
|
|
|
Common::SeekableReadStream *_eventData;
|
2015-01-02 22:27:59 +00:00
|
|
|
Roster _roster;
|
2015-01-03 13:19:14 +00:00
|
|
|
bool _dangerSenseAllowed;
|
|
|
|
bool _noDirectionSense;
|
2015-01-07 00:09:07 +00:00
|
|
|
bool _moveMonsters;
|
2015-01-14 13:48:16 +00:00
|
|
|
int _openDoor;
|
2015-01-24 01:44:02 +00:00
|
|
|
bool _startupWindowActive;
|
2014-12-23 04:49:35 +00:00
|
|
|
public:
|
|
|
|
XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc);
|
|
|
|
virtual ~XeenEngine();
|
|
|
|
|
|
|
|
uint32 getFeatures() const;
|
|
|
|
Common::Language getLanguage() const;
|
|
|
|
Common::Platform getPlatform() const;
|
|
|
|
uint16 getVersion() const;
|
|
|
|
uint32 getGameID() const;
|
|
|
|
uint32 getGameFeatures() const;
|
|
|
|
|
|
|
|
int getRandomNumber(int maxNumber);
|
|
|
|
|
2015-01-23 03:05:36 +00:00
|
|
|
int getRandomNumber(int minNumber, int maxNumber);
|
|
|
|
|
2014-12-23 04:49:35 +00:00
|
|
|
/**
|
|
|
|
* Load a savegame
|
|
|
|
*/
|
|
|
|
virtual Common::Error loadGameState(int slot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the game
|
|
|
|
*/
|
|
|
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if a savegame can currently be loaded
|
|
|
|
*/
|
|
|
|
bool canLoadGameStateCurrently();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the game can currently be saved
|
|
|
|
*/
|
|
|
|
bool canSaveGameStateCurrently();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read in a savegame header
|
|
|
|
*/
|
|
|
|
static bool readSavegameHeader(Common::InSaveFile *in, XeenSavegameHeader &header);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write out a savegame header
|
|
|
|
*/
|
|
|
|
void writeSavegameHeader(Common::OutSaveFile *out, XeenSavegameHeader &header);
|
2015-01-27 02:35:50 +00:00
|
|
|
|
|
|
|
static Common::String printMil(uint value);
|
|
|
|
|
|
|
|
static Common::String printK(uint value);
|
2014-12-23 04:49:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Xeen
|
|
|
|
|
|
|
|
#endif /* XEEN_XEEN_H */
|