2007-05-30 21:56:52 +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.
|
2003-12-16 02:10:15 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-12-16 02:10:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-20 18:04:13 +00:00
|
|
|
#ifndef SWORD1_H
|
|
|
|
#define SWORD1_H
|
2004-01-11 15:47:41 +00:00
|
|
|
|
2006-09-23 00:42:35 +00:00
|
|
|
#include "engines/engine.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/error.h"
|
|
|
|
#include "common/keyboard.h"
|
|
|
|
#include "common/rect.h"
|
2003-12-16 02:10:15 +00:00
|
|
|
#include "common/util.h"
|
2004-10-21 12:43:49 +00:00
|
|
|
#include "sword1/sworddefs.h"
|
2010-11-08 12:22:58 +00:00
|
|
|
#include "sword1/console.h"
|
2003-12-16 02:10:15 +00:00
|
|
|
|
2009-11-24 22:10:14 +00:00
|
|
|
/**
|
|
|
|
* This is the namespace of the Sword1 engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: ???
|
|
|
|
*
|
2010-10-15 12:48:19 +00:00
|
|
|
* Games using this engine:
|
|
|
|
* - Broken Sword: The Shadow of the Templars
|
2009-11-24 22:10:14 +00:00
|
|
|
*/
|
2004-01-11 15:47:41 +00:00
|
|
|
namespace Sword1 {
|
|
|
|
|
2004-08-31 07:52:47 +00:00
|
|
|
enum {
|
|
|
|
GF_DEMO = 1 << 0
|
|
|
|
};
|
|
|
|
|
2004-11-09 04:06:10 +00:00
|
|
|
enum ControlPanelMode {
|
|
|
|
CP_NORMAL = 0,
|
|
|
|
CP_DEATHSCREEN,
|
|
|
|
CP_THEEND,
|
|
|
|
CP_NEWGAME
|
|
|
|
};
|
|
|
|
|
2004-01-11 15:47:41 +00:00
|
|
|
class Screen;
|
|
|
|
class Sound;
|
|
|
|
class Logic;
|
|
|
|
class Mouse;
|
2003-12-16 02:10:15 +00:00
|
|
|
class ResMan;
|
|
|
|
class ObjectMan;
|
2004-01-11 15:47:41 +00:00
|
|
|
class Menu;
|
|
|
|
class Music;
|
|
|
|
class Control;
|
2003-12-16 02:10:15 +00:00
|
|
|
|
|
|
|
struct SystemVars {
|
2003-12-30 22:57:52 +00:00
|
|
|
bool runningFromCd;
|
2003-12-16 02:10:15 +00:00
|
|
|
uint32 currentCD; // starts at zero, then either 1 or 2 depending on section being played
|
|
|
|
uint32 justRestoredGame; // see main() in sword.c & New_screen() in gtm_core.c
|
|
|
|
|
2004-11-09 04:06:10 +00:00
|
|
|
uint8 controlPanelMode; // 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
|
2003-12-20 09:12:54 +00:00
|
|
|
bool forceRestart;
|
2003-12-22 11:23:40 +00:00
|
|
|
bool wantFade; // when true => fade during scene change, else cut.
|
2003-12-16 02:10:15 +00:00
|
|
|
uint8 playSpeech;
|
2004-01-11 15:47:41 +00:00
|
|
|
uint8 showText;
|
|
|
|
uint8 language;
|
2004-11-15 02:48:30 +00:00
|
|
|
bool isDemo;
|
2009-02-28 10:46:33 +00:00
|
|
|
Common::Platform platform;
|
2003-12-16 02:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SwordEngine : public Engine {
|
|
|
|
public:
|
2006-04-15 20:36:41 +00:00
|
|
|
SwordEngine(OSystem *syst);
|
2003-12-16 02:10:15 +00:00
|
|
|
virtual ~SwordEngine();
|
|
|
|
static SystemVars _systemVars;
|
2009-11-02 21:54:57 +00:00
|
|
|
void reinitialize();
|
2009-03-03 20:05:00 +00:00
|
|
|
|
2004-08-31 07:52:47 +00:00
|
|
|
uint32 _features;
|
2008-11-18 16:31:55 +00:00
|
|
|
|
|
|
|
bool mouseIsActive();
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2009-02-28 10:46:33 +00:00
|
|
|
static bool isMac() { return _systemVars.platform == Common::kPlatformMacintosh; }
|
|
|
|
static bool isPsx() { return _systemVars.platform == Common::kPlatformPSX; }
|
2009-06-08 12:37:24 +00:00
|
|
|
static bool isPc() { return _systemVars.platform == Common::kPlatformPC; }
|
2008-11-18 16:31:55 +00:00
|
|
|
|
2003-12-16 02:10:15 +00:00
|
|
|
protected:
|
2008-11-04 16:11:40 +00:00
|
|
|
// Engine APIs
|
2009-03-01 04:30:55 +00:00
|
|
|
Common::Error init();
|
|
|
|
Common::Error go();
|
|
|
|
virtual Common::Error run() {
|
|
|
|
Common::Error err;
|
|
|
|
err = init();
|
2011-04-18 15:39:31 +00:00
|
|
|
if (err.getCode() != Common::kNoError)
|
2009-03-01 04:30:55 +00:00
|
|
|
return err;
|
|
|
|
return go();
|
|
|
|
}
|
2008-11-04 16:11:40 +00:00
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
|
|
|
virtual void syncSoundSettings();
|
2009-03-02 22:37:09 +00:00
|
|
|
|
2010-11-08 12:22:58 +00:00
|
|
|
GUI::Debugger *getDebugger() { return _console; }
|
|
|
|
|
2008-11-18 16:31:55 +00:00
|
|
|
Common::Error loadGameState(int slot);
|
|
|
|
bool canLoadGameStateCurrently();
|
2009-03-03 20:05:00 +00:00
|
|
|
Common::Error saveGameState(int slot, const char *desc);
|
2008-11-18 16:31:55 +00:00
|
|
|
bool canSaveGameStateCurrently();
|
2008-11-04 16:11:40 +00:00
|
|
|
|
2003-12-16 02:10:15 +00:00
|
|
|
private:
|
2004-12-08 04:38:39 +00:00
|
|
|
void delay(int32 amount);
|
2003-12-20 09:12:54 +00:00
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
void checkCdFiles();
|
|
|
|
void checkCd();
|
2004-12-10 17:55:03 +00:00
|
|
|
void showFileErrorMsg(uint8 type, bool *fileExists);
|
|
|
|
void flagsToBool(bool *dest, uint8 flags);
|
2009-03-03 20:05:00 +00:00
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
void reinitRes(); //Reinits the resources after a GMM load
|
2009-03-03 20:05:00 +00:00
|
|
|
|
2010-11-08 12:22:58 +00:00
|
|
|
SwordConsole *_console;
|
|
|
|
|
2009-11-02 21:54:57 +00:00
|
|
|
uint8 mainLoop();
|
2003-12-16 02:10:15 +00:00
|
|
|
|
2007-11-28 15:00:41 +00:00
|
|
|
Common::Point _mouseCoord;
|
|
|
|
uint16 _mouseState;
|
2007-06-22 22:00:46 +00:00
|
|
|
Common::KeyState _keyPressed;
|
2003-12-16 02:10:15 +00:00
|
|
|
|
|
|
|
ResMan *_resMan;
|
|
|
|
ObjectMan *_objectMan;
|
2004-01-11 15:47:41 +00:00
|
|
|
Screen *_screen;
|
|
|
|
Mouse *_mouse;
|
|
|
|
Logic *_logic;
|
|
|
|
Sound *_sound;
|
|
|
|
Menu *_menu;
|
|
|
|
Music *_music;
|
|
|
|
Control *_control;
|
2004-12-10 17:55:03 +00:00
|
|
|
static const uint8 _cdList[TOTAL_SECTIONS];
|
2006-11-12 19:05:51 +00:00
|
|
|
static const CdFile _pcCdFileList[];
|
|
|
|
static const CdFile _macCdFileList[];
|
2009-02-28 10:46:33 +00:00
|
|
|
static const CdFile _psxCdFileList[];
|
2003-12-16 02:27:53 +00:00
|
|
|
};
|
2004-01-11 15:47:41 +00:00
|
|
|
|
|
|
|
} // End of namespace Sword1
|
|
|
|
|
|
|
|
#endif //BSSWORD1_H
|