2009-12-29 23:18:24 +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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MOHAWK_MYST_H
|
|
|
|
#define MOHAWK_MYST_H
|
|
|
|
|
|
|
|
#include "mohawk/console.h"
|
|
|
|
#include "mohawk/mohawk.h"
|
2010-02-17 19:59:08 +00:00
|
|
|
#include "mohawk/resource_cache.h"
|
2010-11-18 05:47:16 +00:00
|
|
|
#include "mohawk/myst_scripts.h"
|
2009-12-29 23:18:24 +00:00
|
|
|
|
2010-12-04 11:54:08 +00:00
|
|
|
#include "common/random.h"
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
#include "gui/saveload.h"
|
|
|
|
|
|
|
|
namespace Mohawk {
|
|
|
|
|
|
|
|
class MohawkEngine_Myst;
|
|
|
|
class VideoManager;
|
|
|
|
class MystGraphics;
|
|
|
|
class MystScriptParser;
|
|
|
|
class MystConsole;
|
2010-12-26 14:31:03 +00:00
|
|
|
class MystGameState;
|
2009-12-30 23:02:14 +00:00
|
|
|
class MystOptionsDialog;
|
2010-11-29 20:51:04 +00:00
|
|
|
class MystResource;
|
2010-11-29 20:55:31 +00:00
|
|
|
class MystResourceType8;
|
2010-12-19 07:02:02 +00:00
|
|
|
class MystResourceType13;
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
// Engine Debug Flags
|
|
|
|
enum {
|
|
|
|
kDebugVariable = (1 << 0),
|
|
|
|
kDebugSaveLoad = (1 << 1),
|
|
|
|
kDebugView = (1 << 2),
|
|
|
|
kDebugHint = (1 << 3),
|
|
|
|
kDebugResource = (1 << 4),
|
|
|
|
kDebugINIT = (1 << 5),
|
|
|
|
kDebugEXIT = (1 << 6),
|
|
|
|
kDebugScript = (1 << 7),
|
2010-02-17 19:59:08 +00:00
|
|
|
kDebugHelp = (1 << 8),
|
|
|
|
kDebugCache = (1 << 9)
|
2009-12-29 23:18:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Myst Stacks
|
|
|
|
enum {
|
|
|
|
kChannelwoodStack = 0, // Channelwood Age
|
|
|
|
kCreditsStack, // Credits
|
|
|
|
kDemoStack, // Demo Main Menu
|
|
|
|
kDniStack, // D'ni
|
|
|
|
kIntroStack, // Intro
|
|
|
|
kMakingOfStack, // Making Of Myst
|
|
|
|
kMechanicalStack, // Mechanical Age
|
|
|
|
kMystStack, // Myst Island
|
|
|
|
kSeleniticStack, // Selenitic Age
|
|
|
|
kDemoSlidesStack, // Demo Slideshow
|
|
|
|
kDemoPreviewStack, // Demo Myst Library Preview
|
|
|
|
kStoneshipStack // Stoneship Age
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 kMasterpieceOnly = 0xFFFF;
|
|
|
|
|
|
|
|
struct MystCondition {
|
|
|
|
uint16 var;
|
|
|
|
uint16 numStates;
|
|
|
|
uint16 *values;
|
|
|
|
};
|
|
|
|
|
|
|
|
// View Sound Action Type
|
|
|
|
enum {
|
|
|
|
kMystSoundActionConditional = -4,
|
|
|
|
kMystSoundActionContinue = -1,
|
|
|
|
kMystSoundActionChangeVolume = -2,
|
|
|
|
kMystSoundActionStop = -3
|
|
|
|
// Other positive values are PlayNewSound of that id
|
|
|
|
};
|
|
|
|
|
2011-01-09 15:31:08 +00:00
|
|
|
// View flags
|
|
|
|
enum {
|
|
|
|
kMystZipDestination = (1 << 0)
|
|
|
|
};
|
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
struct MystView {
|
|
|
|
uint16 flags;
|
|
|
|
|
|
|
|
// Image Data
|
|
|
|
uint16 conditionalImageCount;
|
|
|
|
MystCondition *conditionalImages;
|
|
|
|
uint16 mainImage;
|
|
|
|
|
|
|
|
// Sound Data
|
|
|
|
int16 sound;
|
|
|
|
uint16 soundVolume;
|
|
|
|
uint16 soundVar;
|
|
|
|
uint16 soundCount;
|
|
|
|
int16 *soundList;
|
|
|
|
uint16 *soundListVolume;
|
|
|
|
|
|
|
|
// Script Resources
|
|
|
|
uint16 scriptResCount;
|
|
|
|
struct ScriptResource {
|
|
|
|
uint16 type;
|
|
|
|
uint16 id; // Not used by type 3
|
|
|
|
// TODO: Type 3 has more. Maybe use a union?
|
|
|
|
uint16 var; // Used by type 3 only
|
|
|
|
uint16 count; // Used by type 3 only
|
|
|
|
uint16 u0; // Used by type 3 only
|
|
|
|
int16 *resource_list; // Used by type 3 only
|
|
|
|
} *scriptResources;
|
|
|
|
|
|
|
|
// Resource ID's
|
|
|
|
uint16 rlst;
|
|
|
|
uint16 hint;
|
|
|
|
uint16 init;
|
|
|
|
uint16 exit;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MystCursorHint {
|
|
|
|
uint16 id;
|
|
|
|
int16 cursor;
|
|
|
|
|
|
|
|
MystCondition variableHint;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MohawkEngine_Myst : public MohawkEngine {
|
|
|
|
protected:
|
|
|
|
Common::Error run();
|
|
|
|
|
|
|
|
public:
|
|
|
|
MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription *gamedesc);
|
|
|
|
virtual ~MohawkEngine_Myst();
|
|
|
|
|
2010-11-30 15:07:00 +00:00
|
|
|
Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
|
2010-02-17 19:59:08 +00:00
|
|
|
|
2010-11-23 22:32:39 +00:00
|
|
|
Common::String wrapMovieFilename(const Common::String &movieName, uint16 stack);
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
void reloadSaveList();
|
|
|
|
|
2011-01-07 19:26:31 +00:00
|
|
|
void changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound);
|
2010-11-29 20:59:17 +00:00
|
|
|
void changeToCard(uint16 card, bool updateScreen);
|
2009-12-29 23:18:24 +00:00
|
|
|
uint16 getCurCard() { return _curCard; }
|
|
|
|
uint16 getCurStack() { return _curStack; }
|
|
|
|
void setMainCursor(uint16 cursor);
|
2010-11-29 20:56:21 +00:00
|
|
|
uint16 getMainCursor() { return _mainCursor; }
|
2010-12-02 21:15:47 +00:00
|
|
|
void checkCursorHints();
|
2010-12-18 08:07:16 +00:00
|
|
|
MystResource *updateCurrentResource();
|
2011-01-08 12:34:41 +00:00
|
|
|
bool skippableWait(uint32 duration);
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
bool _tweaksEnabled;
|
|
|
|
bool _needsUpdate;
|
|
|
|
|
|
|
|
MystView _view;
|
|
|
|
MystGraphics *_gfx;
|
2010-12-26 14:31:03 +00:00
|
|
|
MystGameState *_gameState;
|
2009-12-29 23:18:24 +00:00
|
|
|
MystScriptParser *_scriptParser;
|
2010-11-29 20:49:42 +00:00
|
|
|
Common::Array<MystResource*> _resources;
|
2010-11-29 20:53:14 +00:00
|
|
|
MystResource *_dragResource;
|
2010-12-04 11:54:08 +00:00
|
|
|
Common::RandomSource *_rnd;
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
bool _showResourceRects;
|
2010-11-29 20:51:04 +00:00
|
|
|
MystResource *loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent);
|
2009-12-29 23:18:24 +00:00
|
|
|
void setResourceEnabled(uint16 resourceId, bool enable);
|
2010-12-11 17:00:22 +00:00
|
|
|
void redrawArea(uint16 var, bool update = true);
|
2011-01-03 20:40:07 +00:00
|
|
|
void redrawResource(MystResourceType8 *resource, bool update = true);
|
2010-11-29 20:56:39 +00:00
|
|
|
void drawResourceImages();
|
|
|
|
void drawCardBackground();
|
2010-11-29 20:58:10 +00:00
|
|
|
uint16 getCardBackgroundId();
|
2009-12-29 23:18:24 +00:00
|
|
|
|
2010-02-17 19:59:08 +00:00
|
|
|
void setCacheState(bool state) { _cache.enabled = state; }
|
2011-01-03 20:40:07 +00:00
|
|
|
bool getCacheState() { return _cache.enabled; }
|
2010-02-17 19:59:08 +00:00
|
|
|
|
2009-12-29 23:18:24 +00:00
|
|
|
GUI::Debugger *getDebugger() { return _console; }
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-12-07 18:15:07 +00:00
|
|
|
bool canLoadGameStateCurrently();
|
|
|
|
bool canSaveGameStateCurrently();
|
2009-12-29 23:18:24 +00:00
|
|
|
Common::Error loadGameState(int slot);
|
|
|
|
Common::Error saveGameState(int slot, const char *desc);
|
|
|
|
bool hasFeature(EngineFeature f) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
MystConsole *_console;
|
|
|
|
GUI::SaveLoadChooser *_loadDialog;
|
|
|
|
MystOptionsDialog *_optionsDialog;
|
2010-11-30 14:45:31 +00:00
|
|
|
MystScriptParser *_prevStack;
|
2010-02-17 19:59:08 +00:00
|
|
|
ResourceCache _cache;
|
|
|
|
void cachePreload(uint32 tag, uint16 id);
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
uint16 _curStack;
|
|
|
|
uint16 _curCard;
|
|
|
|
|
|
|
|
bool _runExitScript;
|
|
|
|
|
|
|
|
void loadCard();
|
|
|
|
void unloadCard();
|
|
|
|
void runInitScript();
|
|
|
|
void runExitScript();
|
|
|
|
|
|
|
|
void loadHelp(uint16 id);
|
|
|
|
|
|
|
|
void loadResources();
|
|
|
|
void drawResourceRects();
|
|
|
|
void checkCurrentResource();
|
|
|
|
int16 _curResource;
|
2010-12-19 07:02:02 +00:00
|
|
|
MystResourceType13 *_hoverResource;
|
2009-12-29 23:18:24 +00:00
|
|
|
|
|
|
|
uint16 _cursorHintCount;
|
|
|
|
MystCursorHint *_cursorHints;
|
|
|
|
void loadCursorHints();
|
|
|
|
uint16 _currentCursor;
|
2010-02-17 19:59:08 +00:00
|
|
|
uint16 _mainCursor; // Also defines the current page being held (white, blue, red, or none)
|
2009-12-29 23:18:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Mohawk
|
|
|
|
|
|
|
|
#endif
|