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.
|
2004-04-09 12:36:06 +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
|
2005-01-09 16:06:29 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-09 12:36:06 +00:00
|
|
|
* 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.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
2006-02-09 12:19:53 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-04-15 16:41:20 +00:00
|
|
|
#ifndef KYRA_KYRA_H
|
|
|
|
#define KYRA_KYRA_H
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2006-09-23 00:42:35 +00:00
|
|
|
#include "engines/engine.h"
|
2005-10-05 16:40:51 +00:00
|
|
|
#include "common/rect.h"
|
2007-05-05 12:18:02 +00:00
|
|
|
#include "common/array.h"
|
2007-06-22 23:03:12 +00:00
|
|
|
#include "common/events.h"
|
2005-10-12 19:15:32 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
#include "kyra/util.h"
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
namespace Kyra {
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-09-17 20:21:40 +00:00
|
|
|
struct GameFlags {
|
|
|
|
Common::Language lang;
|
|
|
|
Common::Platform platform;
|
|
|
|
bool isDemo;
|
|
|
|
bool useAltShapeHeader; // alternative shape header (uses 2 bytes more, those are unused though)
|
|
|
|
bool isTalkie;
|
2007-02-12 18:01:51 +00:00
|
|
|
bool useHiResOverlay;
|
2006-09-17 20:21:40 +00:00
|
|
|
byte gameID;
|
2004-11-11 13:37:35 +00:00
|
|
|
};
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
struct Rect {
|
|
|
|
int x, y;
|
|
|
|
int x2, y2;
|
|
|
|
};
|
|
|
|
|
2004-11-11 13:37:35 +00:00
|
|
|
enum {
|
2006-05-01 00:25:41 +00:00
|
|
|
GI_KYRA1 = 0,
|
2006-05-12 23:57:53 +00:00
|
|
|
GI_KYRA2 = 1,
|
|
|
|
GI_KYRA3 = 2
|
2004-10-15 06:06:47 +00:00
|
|
|
};
|
|
|
|
|
2006-02-14 01:19:30 +00:00
|
|
|
// TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable
|
|
|
|
// in the future we maybe merge some flags and/or create new ones
|
|
|
|
enum kDebugLevels {
|
2007-07-29 16:33:11 +00:00
|
|
|
kDebugLevelScriptFuncs = 1 << 0, // prints debug output of o#_* functions
|
2006-02-14 01:19:30 +00:00
|
|
|
kDebugLevelScript = 1 << 1, // prints debug output of "ScriptHelper" functions
|
|
|
|
kDebugLevelSprites = 1 << 2, // prints debug output of "Sprites" functions
|
|
|
|
kDebugLevelScreen = 1 << 3, // prints debug output of "Screen" functions
|
|
|
|
kDebugLevelSound = 1 << 4, // prints debug output of "Sound" functions
|
|
|
|
kDebugLevelAnimator = 1 << 5, // prints debug output of "ScreenAnimator" functions
|
2007-07-29 16:33:11 +00:00
|
|
|
kDebugLevelMain = 1 << 6, // prints debug output of common "KyraEngine(_v#)" functions && "TextDisplayer" functions
|
2006-02-14 01:19:30 +00:00
|
|
|
kDebugLevelGUI = 1 << 7, // prints debug output of "KyraEngine*" gui functions
|
|
|
|
kDebugLevelSequence = 1 << 8, // prints debug output of "SeqPlayer" functions
|
2007-07-29 16:33:11 +00:00
|
|
|
kDebugLevelMovie = 1 << 9, // prints debug output of movie specific funtions
|
|
|
|
kDebugLevelTimer = 1 << 10 // prints debug output of "TimerManager" functions
|
2006-02-14 01:19:30 +00:00
|
|
|
};
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
class Screen;
|
|
|
|
class Resource;
|
|
|
|
class Sound;
|
|
|
|
class Movie;
|
|
|
|
class TextDisplayer;
|
|
|
|
class StaticResource;
|
2007-07-29 16:33:11 +00:00
|
|
|
class TimerManager;
|
|
|
|
class ScriptHelper;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2004-04-09 12:36:06 +00:00
|
|
|
class KyraEngine : public Engine {
|
2004-10-15 06:06:47 +00:00
|
|
|
public:
|
2006-11-09 14:38:16 +00:00
|
|
|
KyraEngine(OSystem *system, const GameFlags &flags);
|
2006-05-20 15:02:39 +00:00
|
|
|
virtual ~KyraEngine();
|
2007-07-29 16:31:29 +00:00
|
|
|
|
|
|
|
bool quit() const { return _quitFlag; }
|
|
|
|
|
|
|
|
uint8 game() const { return _flags.gameID; }
|
|
|
|
const GameFlags &gameFlags() const { return _flags; }
|
|
|
|
|
|
|
|
// access to Kyra specific functionallity
|
2005-08-19 22:12:09 +00:00
|
|
|
Resource *resource() { return _res; }
|
2007-07-29 16:31:29 +00:00
|
|
|
virtual Screen *screen() = 0;
|
2006-01-02 22:58:59 +00:00
|
|
|
TextDisplayer *text() { return _text; }
|
2006-01-13 23:06:04 +00:00
|
|
|
Sound *sound() { return _sound; }
|
2006-03-18 14:43:18 +00:00
|
|
|
StaticResource *staticres() { return _staticres; }
|
2007-07-29 16:33:11 +00:00
|
|
|
TimerManager *timer() { return _timer; }
|
2007-07-29 16:31:29 +00:00
|
|
|
|
2006-01-03 19:03:09 +00:00
|
|
|
uint32 tickLength() const { return _tickLength; }
|
2005-12-22 18:14:52 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
virtual Movie *createWSAMovie() = 0;
|
2006-05-28 06:07:54 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
Common::RandomSource _rnd;
|
|
|
|
|
|
|
|
// quit handling
|
|
|
|
virtual void quitGame();
|
2007-03-18 18:27:52 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// game flag handling
|
2007-01-31 23:48:12 +00:00
|
|
|
int setGameFlag(int flag);
|
2007-07-29 16:31:29 +00:00
|
|
|
int queryGameFlag(int flag) const;
|
2007-01-31 23:48:12 +00:00
|
|
|
int resetGameFlag(int flag);
|
2005-11-11 22:17:06 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// delay functionallity
|
|
|
|
virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
|
|
|
|
virtual void delay(uint32 millis, bool update = false, bool isMainLoop = false);
|
|
|
|
virtual void delayWithTicks(int ticks);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
protected:
|
|
|
|
virtual int go() = 0;
|
|
|
|
virtual int init();
|
2006-08-26 22:17:30 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// quit Handling
|
2005-08-19 22:12:09 +00:00
|
|
|
bool _quitFlag;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// intern
|
2005-08-19 22:12:09 +00:00
|
|
|
Resource *_res;
|
2006-01-13 23:06:04 +00:00
|
|
|
Sound *_sound;
|
2006-01-02 22:58:59 +00:00
|
|
|
TextDisplayer *_text;
|
2006-03-18 14:43:18 +00:00
|
|
|
StaticResource *_staticres;
|
2007-07-29 16:33:11 +00:00
|
|
|
TimerManager *_timer;
|
|
|
|
ScriptHelper *_scriptInterpreter;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// game speed
|
|
|
|
bool _skipFlag;
|
|
|
|
uint16 _tickLength;
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 _gameSpeed;
|
2005-12-22 18:14:52 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// detection
|
|
|
|
GameFlags _flags;
|
|
|
|
int _lang;
|
2007-01-29 18:15:14 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// opcode
|
|
|
|
virtual void setupOpcodeTable() = 0;
|
|
|
|
Common::Array<const Opcode*> _opcodes;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// game flags
|
|
|
|
uint8 _flagsTable[100]; // TODO: check this value
|
2005-12-24 18:00:35 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// input
|
|
|
|
Common::Point getMousePos() const;
|
2007-07-29 16:33:11 +00:00
|
|
|
|
|
|
|
// pathfinder
|
|
|
|
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
|
|
|
|
int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end);
|
|
|
|
int getFacingFromPointToPoint(int x, int y, int toX, int toY);
|
|
|
|
int getOppositeFacingDirection(int dir);
|
|
|
|
void changePosTowardsFacing(int &x, int &y, int facing);
|
|
|
|
int getMoveTableSize(int *moveTable);
|
|
|
|
virtual bool lineIsPassable(int x, int y) = 0;
|
|
|
|
|
|
|
|
static const int8 _addXPosTable[];
|
|
|
|
static const int8 _addYPosTable[];
|
2004-04-09 12:36:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Kyra
|
|
|
|
|
|
|
|
#endif
|
2007-04-15 16:41:20 +00:00
|
|
|
|