From 7f08865ec5f6ff350282a219cdccd26714f33f59 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 1 Sep 2007 14:58:46 +0000 Subject: An early WIP of PreAGI (TrollVM) support svn-id: r28787 --- engines/agi/agi.cpp | 11 +- engines/agi/agi.h | 168 +++++++-- engines/agi/agi_preagi.cpp | 215 +++++++++++ engines/agi/console.h | 1 + engines/agi/detection.cpp | 63 +++- engines/agi/font.h | 259 +++++++++++++ engines/agi/graphics.cpp | 4 +- engines/agi/graphics.h | 4 +- engines/agi/module.mk | 4 + engines/agi/picture.cpp | 26 +- engines/agi/picture.h | 6 +- engines/agi/preagi.cpp | 275 ++++++++++++++ engines/agi/preagi_keyboard.cpp | 146 ++++++++ engines/agi/preagi_mickey.cpp | 140 +++++++ engines/agi/preagi_mickey.h | 801 ++++++++++++++++++++++++++++++++++++++++ 15 files changed, 2061 insertions(+), 62 deletions(-) create mode 100644 engines/agi/agi_preagi.cpp create mode 100644 engines/agi/preagi.cpp create mode 100644 engines/agi/preagi_keyboard.cpp create mode 100644 engines/agi/preagi_mickey.cpp create mode 100644 engines/agi/preagi_mickey.h (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index d9fe32ba23..bc3cd86e7c 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -46,8 +46,6 @@ #include "agi/menu.h" #include "agi/sound.h" - - namespace Agi { static uint32 g_tickTimer; @@ -495,7 +493,7 @@ int AgiEngine::agiDetectGame() { assert(_gameDescription != NULL); - if(getVersion() <= 0x2999) { + if (getVersion() <= 0x2999) { _loader = new AgiLoader_v2(this); } else { _loader = new AgiLoader_v3(this); @@ -521,6 +519,7 @@ int AgiEngine::agiLoadResource(int r, int n) { int i; i = _loader->loadResource(r, n); + return i; } @@ -602,7 +601,11 @@ AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) { setAmigaStyle(renderMode == Common::kRenderAmiga); } -AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) { +AgiBase::AgiBase(OSystem *syst) : Engine(syst) { + +} + +AgiEngine::AgiEngine(OSystem *syst) : AgiBase(syst) { // Setup mixer if (!_mixer->isReady()) { diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 046688f240..3fcf1f4982 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -103,7 +103,8 @@ enum AgiGameID { GID_SQ1, GID_SQ2, GID_XMASCARD, - GID_FANMADE // TODO: Should this be extended to include all fanmade games? + GID_FANMADE, // TODO: Should this be extended to include all fanmade games? + GID_MICKEY // PreAGI }; } // End of namespace Agi @@ -118,8 +119,9 @@ enum AgiGameID { namespace Agi { enum AgiGameType { + GType_PreAGI = 0, GType_V2 = 1, - GType_V3 + GType_V3 = 2 }; enum AgiGameFeatures { @@ -536,10 +538,6 @@ struct AgiGame { }; class AgiLoader { -private: - int intVersion; - AgiEngine *_vm; - public: AgiLoader() {} @@ -557,6 +555,33 @@ public: virtual int getIntVersion() = 0; }; +class AgiLoader_preagi : public AgiLoader { +private: + int _intVersion; + PreAgiEngine *_vm; + + int loadDir(AgiDir *agid, Common::File *fp, uint32 offs, uint32 len); + uint8 *loadVolRes(AgiDir *agid); + +public: + + AgiLoader_preagi(PreAgiEngine *vm) { + _vm = vm; + _intVersion = 0; + } + + virtual int init(); + virtual int deinit(); + virtual int detectGame(); + virtual int loadResource(int, int); + virtual int unloadResource(int, int); + virtual int loadObjects(const char *); + virtual int loadWords(const char *); + virtual int version(); + virtual void setIntVersion(int); + virtual int getIntVersion(); +}; + class AgiLoader_v2 : public AgiLoader { private: int _intVersion; @@ -642,7 +667,45 @@ struct StringData { #define KEY_QUEUE_SIZE 16 -class AgiEngine : public ::Engine { +class AgiBase : public ::Engine { +public: + AgiButtonStyle _defaultButtonStyle; + AgiButtonStyle _buttonStyle; + Common::RenderMode _renderMode; + volatile uint32 _clockCount; + AgiDebug _debug; + AgiGame _game; + AgiLoader *_loader; /* loader */ + Common::RandomSource *_rnd; + + virtual void agiTimerLow() = 0; + virtual int agiGetKeypressLow() = 0; + virtual int agiIsKeypressLow() = 0; + + AgiBase(OSystem *syst); + + #define INITIAL_IMAGE_STACK_SIZE 32 + + int _stackSize; + ImageStackElement *_imageStack; + int _imageStackPointer; + + virtual void clearImageStack() = 0; + virtual void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, + int16 p4, int16 p5, int16 p6, int16 p7) = 0; + virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, + int16 p4, int16 p5, int16 p6, int16 p7) = 0; + virtual void releaseImageStack() = 0; + + const AGIGameDescription *_gameDescription; + uint32 getGameID() const; + uint32 getFeatures() const; + uint16 getVersion() const; + uint16 getGameType() const; + Common::Platform getPlatform() const; +}; + +class AgiEngine : public AgiBase { int _gameId; protected: @@ -660,12 +723,6 @@ public: return _gameId; } - const AGIGameDescription *_gameDescription; - uint32 getGameID() const; - uint32 getFeatures() const; - uint16 getVersion() const; - Common::Platform getPlatform() const; - private: int _keyQueue[KEY_QUEUE_SIZE]; @@ -683,15 +740,10 @@ private: int _firstSlot; public: - AgiGame _game; AgiObject *_objects; /* objects in the game */ StringData _stringdata; - AgiLoader *_loader; /* loader */ - - Common::RandomSource *_rnd; - const char *getSavegameFilename(int num); void getSavegameDescription(int num, char *buf, bool showEmpty = true); int selectSlot(); @@ -702,14 +754,10 @@ public: int loadGameDialog(); int loadGameSimple(); - volatile uint32 _clockCount; - uint8 *_intobj; int _oldMode; Menu* _menu; - AgiButtonStyle _buttonStyle; - AgiButtonStyle _defaultButtonStyle; char _lastSentence[40]; @@ -718,12 +766,6 @@ public: SoundMgr *_sound; PictureMgr *_picture; - #define INITIAL_IMAGE_STACK_SIZE 32 - - int _stackSize; - ImageStackElement *_imageStack; - int _imageStackPointer; - void clearImageStack(); void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, int16 p4, int16 p5, int16 p6, int16 p7); @@ -731,8 +773,6 @@ public: int16 p4, int16 p5, int16 p6, int16 p7); void releaseImageStack(); - AgiDebug _debug; - Common::RenderMode _renderMode; int _soundemu; int _keyControl; @@ -750,9 +790,9 @@ public: int agiUnloadResource(int, int); void agiUnloadResources(); - void agiTimerLow(); - int agiGetKeypressLow(); - int agiIsKeypressLow(); + virtual void agiTimerLow(); + virtual int agiGetKeypressLow(); + virtual int agiIsKeypressLow(); static void agiTimerFunctionLow(void *refCon); void initPriTable(); @@ -809,7 +849,7 @@ public: int decodeLogic(int); void unloadLogic(int); int runLogic(int); - + void patchLogic(int n); // DELETE THIS void debugConsole(int, int, const char *); int testIfCode(int); void executeAgiCommand(uint8, uint8 *); @@ -916,6 +956,66 @@ public: char _predictiveResult[40]; }; + +class PreAgiEngine : public AgiBase { + int _gameId; + +protected: + int init(); + int go(); + void shutdown(); + void initialize(); + + bool initGame(); + +public: + void agiTimerLow() {} + int agiGetKeypressLow() { return 0; } + int agiIsKeypressLow() { return 0; } + + int preAgiLoadResource(int r, int n); + int preAgiUnloadResource(int r, int n); + + PreAgiEngine(OSystem *syst); + virtual ~PreAgiEngine(); + int getGameId() { + return _gameId; + } + +private: + +public: + GfxMgr *_gfx; + SoundMgr *_sound; + PictureMgr *_picture; + + void clearImageStack() {} + void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, + int16 p4, int16 p5, int16 p6, int16 p7) {} + void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, + int16 p4, int16 p5, int16 p6, int16 p7) {} + void releaseImageStack() {} + +/* + int agiInit(); + int agiDeinit(); + int agiVersion(); + int agiGetRelease(); + void agiSetRelease(int); + int agiDetectGame(); + int agiLoadResource(int, int); + int agiUnloadResource(int, int); + void agiUnloadResources(); +*/ + + // Keyboard, preagi + void waitAnyKeyAnim(); + int getSelection(int type); + bool waitAnyKeyChoice(); + void waitAnyKey(bool anim); + +}; + } // End of namespace Agi #endif /* AGI_H */ diff --git a/engines/agi/agi_preagi.cpp b/engines/agi/agi_preagi.cpp new file mode 100644 index 0000000000..de8be73c67 --- /dev/null +++ b/engines/agi/agi_preagi.cpp @@ -0,0 +1,215 @@ +/* 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$ + * + */ + +#include "common/stdafx.h" + +#include "agi/agi.h" +#include "agi/lzw.h" +#include "agi/preagi_mickey.h" + +#include "common/config-manager.h" +#include "common/fs.h" + +namespace Agi { + +int AgiLoader_preagi::version() { + return 0; +} + +void AgiLoader_preagi::setIntVersion(int ver) { + _intVersion = ver; +} + +int AgiLoader_preagi::getIntVersion() { + return _intVersion; +} + +int AgiLoader_preagi::detectGame() { + // TODO: Only Mickey is detected for now + if (!Common::File::exists("1.pic")) + return errInvalidAGIFile; + + _intVersion = 0x0000; + return errOK; +} + +int AgiLoader_preagi::loadDir(struct AgiDir *agid, Common::File *fp, + uint32 offs, uint32 len) { + int ec = errOK; +/* uint8 *mem; + unsigned int i; + + fp->seek(offs, SEEK_SET); + if ((mem = (uint8 *)malloc(len + 32)) != NULL) { + fp->read(mem, len); + + // set all directory resources to gone + for (i = 0; i < MAX_DIRS; i++) { + agid[i].volume = 0xff; + agid[i].offset = _EMPTY; + } + + // build directory entries + for (i = 0; i < len; i += 3) { + agid[i / 3].volume = *(mem + i) >> 4; + agid[i / 3].offset = READ_BE_UINT24(mem + i) & (uint32) _EMPTY; + } + + free(mem); + } else { + ec = errNotEnoughMemory; + } +*/ + return ec; +} + +int AgiLoader_preagi::init() { + int ec = errOK; + //int i; + //uint16 xd[4]; + Common::File fp; + Common::String path; + + // TODO : load all preagi resources here + + return ec; +} + +int AgiLoader_preagi::deinit() { + int ec = errOK; + return ec; +} + +int AgiLoader_preagi::unloadResource(int t, int n) { + switch (t) { + case rLOGIC: + //_vm->unloadLogic(n); + break; + case rPICTURE: + _vm->_picture->unloadPicture(n); + break; + case rVIEW: + //_vm->unloadView(n); + break; + case rSOUND: + //_vm->_sound->unloadSound(n); + break; + } + + return errOK; +} + +/* + * This function does noting but load a raw resource into memory. + * If further decoding is required, it must be done by another + * routine. + * + * NULL is returned if unsucsessful. + */ +uint8 *AgiLoader_preagi::loadVolRes(AgiDir *agid) { + + return NULL; +} + +/* + * Loads a resource into memory, a raw resource is loaded in + * with above routine, then further decoded here. + */ +int AgiLoader_preagi::loadResource(int t, int n) { + int ec = errOK; + uint8 *data = NULL; + + if (n > MAX_DIRS) + return errBadResource; + + switch (t) { + case rLOGIC: + // The logic in preagi games is hardcoded + break; + case rPICTURE: + /* if picture is currently NOT loaded *OR* cacheing is off, + * unload the resource (caching==off) and reload it + */ + if (true) { //(~_vm->_game.dirPic[n].flags & RES_LOADED) { + unloadResource(rPICTURE, n); + //data = loadVolRes(&_vm->_game.dirPic[n]); + + data = new uint8[4096]; + char szFile[255] = {0}; + + sprintf(szFile, IDS_MSA_PATH_PIC, n); + Common::File infile; + if (!infile.open(szFile)) + return errBadResource; + infile.read(data, infile.size()); + + if (data != NULL) { + _vm->_game.pictures[n].rdata = data; + _vm->_game.dirPic[n].len = infile.size(); + _vm->_game.dirPic[n].flags |= RES_LOADED; + } else { + ec = errBadResource; + } + + infile.close(); + } + break; + case rSOUND: + /* + if (_vm->_game.dirSound[n].flags & RES_LOADED) + break; + + data = loadVolRes(&_vm->_game.dirSound[n]); + if (data != NULL) { + // Freeing of the raw resource from memory is delegated to the createFromRawResource-function + _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, *_vm->_sound); + _vm->_game.dirSound[n].flags |= RES_LOADED; + } else { + ec = errBadResource; + } + */ + break; + case rVIEW: + // + break; + default: + ec = errBadResource; + break; + } + + return ec; +} + +int AgiLoader_preagi::loadObjects(const char *fname) { + return 0; + //return _vm->loadObjects(fname); +} + +int AgiLoader_preagi::loadWords(const char *fname) { + return 0; + //return _vm->loadWords(fname); +} + +} // End of namespace Agi diff --git a/engines/agi/console.h b/engines/agi/console.h index ad955d51ae..a6994ce922 100644 --- a/engines/agi/console.h +++ b/engines/agi/console.h @@ -31,6 +31,7 @@ namespace Agi { class AgiEngine; +class PreAgiEngine; struct AgiDebug { int enabled; diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index be5a3bbb36..6be1573bc0 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -45,22 +45,26 @@ struct AGIGameDescription { uint16 version; }; -uint32 AgiEngine::getGameID() const { +uint32 AgiBase::getGameID() const { return _gameDescription->gameID; } -uint32 AgiEngine::getFeatures() const { +uint32 AgiBase::getFeatures() const { return _gameDescription->features; } -Common::Platform AgiEngine::getPlatform() const { +Common::Platform AgiBase::getPlatform() const { return _gameDescription->desc.platform; } -uint16 AgiEngine::getVersion() const { +uint16 AgiBase::getVersion() const { return _gameDescription->version; } +uint16 AgiBase::getGameType() const { + return _gameDescription->gameType; +} + } static const PlainGameDescriptor agiGames[] = { @@ -76,6 +80,7 @@ static const PlainGameDescriptor agiGames[] = { {"kq3", "King's Quest III: To Heir Is Human"}, {"kq4", "King's Quest IV: The Perils of Rosella"}, {"lsl1", "Leisure Suit Larry in the Land of the Lounge Lizards"}, + {"mickey", "Mickey\'s Space Adventure"}, {"mixedup", "Mixed-Up Mother Goose"}, {"mh1", "Manhunter 1: New York"}, {"mh2", "Manhunter 2: San Francisco"}, @@ -1114,6 +1119,23 @@ static const AGIGameDescription gameDescriptions[] = { 0x3149, }, + { + // Mickey's Space Adventure + // Preagi game + { + "mickey", + "", + AD_ENTRY1("1.pic", "b6ec04c91a05df374792872c4d4ce66d"), + Common::EN_ANY, + Common::kPlatformPC, + Common::ADGF_NO_FLAGS + }, + GID_MICKEY, + GType_PreAGI, + 0, + 0x0000, + }, + #if 0 { // Mixed-Up Mother Goose (Amiga) 1.1 @@ -2027,9 +2049,31 @@ static const Common::ADParams detectionParams = { Common::kADFlagAugmentPreferredTarget }; -ADVANCED_DETECTOR_DEFINE_PLUGIN(AGI, Agi::AgiEngine, detectionParams); +bool engineCreateAgi(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) { + const Agi::AGIGameDescription *gd = (const Agi::AGIGameDescription *)(encapsulatedDesc.realDesc); + bool res = true; + + switch (gd->gameType) { + case Agi::GType_PreAGI: + *engine = new Agi::PreAgiEngine(syst); + break; + case Agi::GType_V2: + *engine = new Agi::AgiEngine(syst); + break; + case Agi::GType_V3: + *engine = new Agi::AgiEngine(syst); + break; + default: + res = false; + error("AGI engine: unknown gameType"); + } + + return res; +} -REGISTER_PLUGIN(AGI, "AGI v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software"); +ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(AGI, engineCreateAgi, detectionParams); + +REGISTER_PLUGIN(AGI, "AGI preAGI + v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software"); namespace Agi { @@ -2040,5 +2084,12 @@ bool AgiEngine::initGame() { return (_gameDescription != 0); } +bool PreAgiEngine::initGame() { + Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams); + _gameDescription = (const AGIGameDescription *)(encapsulatedDesc.realDesc); + + return (_gameDescription != 0); +} + } // End of namespace Agi diff --git a/engines/agi/font.h b/engines/agi/font.h index 12b36f2520..7825dafaff 100644 --- a/engines/agi/font.h +++ b/engines/agi/font.h @@ -294,6 +294,265 @@ static const uint8 curFont[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x7E, 0x00 }; +const uint8 mickey_fontdata[] = { + 0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, + 0x00, 0x00, 0x3F, 0x20, 0x2F, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x2F, 0x20, 0x2F, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x2F, 0x20, 0x3F, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xEF, 0x28, 0x28, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x28, 0xEF, 0x00, 0xEF, 0x28, 0x28, 0x28, + 0x28, 0x28, 0xEF, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xF8, 0x08, 0xE8, 0x28, 0x28, 0x28, + 0x28, 0x28, 0xE8, 0x08, 0xE8, 0x28, 0x28, 0x28, + 0x28, 0x28, 0xE8, 0x08, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x18, 0x18, 0x18, 0x1F, 0x1F, 0x00, 0x00, 0x00, + 0x78, 0x60, 0x78, 0x60, 0x7E, 0x18, 0x1E, 0x00, + 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x00, + 0x00, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, + 0x00, 0x18, 0x30, 0x7E, 0x30, 0x18, 0x00, 0x00, + 0x00, 0x18, 0x0C, 0x7E, 0x0C, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, + 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x66, 0xFF, 0x66, 0x66, 0xFF, 0x66, 0x00, + 0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, + 0x00, 0x66, 0x6C, 0x18, 0x30, 0x66, 0x46, 0x00, + 0x1C, 0x36, 0x1C, 0x38, 0x6F, 0x66, 0x3B, 0x00, + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x1C, 0x18, 0x18, 0x18, 0x1C, 0x0E, 0x00, + 0x70, 0x38, 0x18, 0x18, 0x18, 0x38, 0x70, 0x00, + 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00, + 0x3C, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x3C, 0x00, + 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, + 0x3C, 0x66, 0x06, 0x0C, 0x18, 0x30, 0x7E, 0x00, + 0x7E, 0x0C, 0x18, 0x0C, 0x06, 0x66, 0x3C, 0x00, + 0x0C, 0x1C, 0x3C, 0x6C, 0x6C, 0x7E, 0x0C, 0x00, + 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 0x00, + 0x3C, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00, + 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, + 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00, + 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00, + 0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, + 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, + 0x3C, 0x66, 0x04, 0x0C, 0x18, 0x00, 0x18, 0x00, + 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x00, + 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00, + 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00, + 0x78, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0x78, 0x00, + 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E, 0x00, + 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x00, + 0x3E, 0x60, 0x60, 0x6E, 0x66, 0x66, 0x3E, 0x00, + 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00, + 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00, + 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x66, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00, + 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x00, + 0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x66, 0x00, + 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, + 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x00, + 0x3C, 0x66, 0x66, 0x66, 0x66, 0x6C, 0x36, 0x00, + 0x7C, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x66, 0x00, + 0x3C, 0x60, 0x60, 0x3C, 0x06, 0x06, 0x3C, 0x00, + 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x00, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, + 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00, + 0x66, 0x66, 0x3C, 0x3C, 0x66, 0x66, 0x66, 0x00, + 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00, + 0x7E, 0x0C, 0x18, 0x30, 0x60, 0x60, 0x7E, 0x00, + 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00, + 0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, + 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, + 0x00, 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, + 0x00, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x00, + 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, + 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00, + 0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x3C, 0x00, + 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00, + 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, + 0x0E, 0x18, 0x18, 0x3E, 0x18, 0x18, 0x18, 0x00, + 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x7C, + 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, + 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, + 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3C, + 0x60, 0x60, 0x6C, 0x78, 0x6C, 0x66, 0x66, 0x00, + 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, + 0x00, 0x00, 0x66, 0x7F, 0x7F, 0x6B, 0x63, 0x00, + 0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, + 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, + 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, + 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06, + 0x00, 0x00, 0x7C, 0x66, 0x60, 0x60, 0x60, 0x00, + 0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00, + 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x0E, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, + 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x3E, 0x36, 0x00, + 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x0C, 0x78, + 0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00, + 0x00, 0x18, 0x3C, 0x7E, 0x7E, 0x18, 0x3C, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x7E, 0x78, 0x7C, 0x6E, 0x66, 0x06, 0x00, + 0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08, 0x00, + 0x10, 0x18, 0x1C, 0x1E, 0x1C, 0x18, 0x10, 0x00, + 0xFF, 0xC9, 0x80, 0x80, 0xC1, 0xE3, 0xF7, 0xFF, + 0xFF, 0xFF, 0xC0, 0xDF, 0xD0, 0xD7, 0xD7, 0xD7, + 0xD7, 0xD7, 0xD7, 0xD7, 0xD7, 0xD7, 0xD7, 0xD7, + 0xD7, 0xD7, 0xD0, 0xDF, 0xD0, 0xD7, 0xD7, 0xD7, + 0xD7, 0xD7, 0xD0, 0xDF, 0xC0, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xFF, 0x10, 0xD7, 0xD7, 0xD7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xD7, 0xD7, 0x10, 0xFF, 0x10, 0x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0x7E, 0x78, 0x7C, 0x6E, 0x66, 0x06, 0x00, + 0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08, 0x00, + 0x10, 0x18, 0x1C, 0x1E, 0x1C, 0x18, 0x10, 0x00, +}; + } // End of namespace Agi #endif /* AGI_FONT_H */ diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index b6430e0f81..e07648a720 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -532,7 +532,7 @@ static struct UpdateBlock update = { MAX_INT, MAX_INT, 0, 0 }; -GfxMgr::GfxMgr(AgiEngine *vm) : _vm(vm) { +GfxMgr::GfxMgr(AgiBase *vm) : _vm(vm) { _shakeH = NULL; _shakeV = NULL; _agipalFileNum = 0; @@ -1078,7 +1078,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) { } else { const uint16 mask = _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? 0xffff : 0x0f0f; for (x *= 2; n--; p++, x += 2) { - register uint16 q = ((uint16) * p << 8) | *p; + register uint16 q = ((uint16)*p << 8) | *p; *(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = (q >> rShift) & mask; } } diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index e06af90f5d..a5f9d47df0 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -39,7 +39,7 @@ class AgiEngine; class GfxMgr { private: - AgiEngine *_vm; + AgiBase *_vm; uint8 _palette[256 * 4]; uint8 *_agiScreen; @@ -54,7 +54,7 @@ private: void rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor, bool border, int textOffset); public: - GfxMgr(AgiEngine *vm); + GfxMgr(AgiBase *vm); void gfxPutBlock(int x1, int y1, int x2, int y2); diff --git a/engines/agi/module.mk b/engines/agi/module.mk index d74eba034a..82634953cf 100644 --- a/engines/agi/module.mk +++ b/engines/agi/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS = \ agi.o \ agi_v2.o \ agi_v3.o \ + agi_preagi.o \ checks.o \ console.o \ cycle.o \ @@ -22,6 +23,9 @@ MODULE_OBJS = \ op_dbg.o \ op_test.o \ picture.o \ + preagi.o \ + preagi_keyboard.o \ + preagi_mickey.o \ predictive.o \ saveload.o \ sound.o \ diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 6665e8ed4a..81a4f5a743 100644 --- a/engines/agi/picture.cpp +++ b/engines/agi/picture.cpp @@ -28,6 +28,7 @@ #include "agi/agi.h" #include "agi/graphics.h" + namespace Agi { #define nextByte data[foffs++] @@ -225,7 +226,7 @@ void PictureMgr::dynamicDrawLine() { putVirtPixel(x1, y1); for (;;) { - if ((disp = nextByte) >= 0xf0) + if ((disp = nextByte) >= 0xe0) break; dx = ((disp & 0xf0) >> 4) & 0x0f; @@ -256,10 +257,10 @@ void PictureMgr::absoluteDrawLine() { putVirtPixel(x1, y1); for (;;) { - if ((x2 = nextByte) >= 0xf0) + if ((x2 = nextByte) >= 0xe0) break; - if ((y2 = nextByte) >= 0xf0) + if ((y2 = nextByte) >= 0xe0) break; drawLine(x1, y1, x2, y2); @@ -362,14 +363,14 @@ void PictureMgr::xCorner() { for (;;) { x2 = nextByte; - if (x2 >= 0xf0) + if (x2 >= 0xe0) break; drawLine(x1, y1, x2, y1); x1 = x2; y2 = nextByte; - if (y2 >= 0xf0) + if (y2 >= 0xe0) break; drawLine(x1, y1, x1, y2); @@ -393,14 +394,14 @@ void PictureMgr::yCorner() { for (;;) { y2 = nextByte; - if (y2 >= 0xF0) + if (y2 >= 0xe0) break; drawLine(x1, y1, x1, y2); y1 = y2; x2 = nextByte; - if (x2 >= 0xf0) + if (x2 >= 0xe0) break; drawLine(x1, y1, x2, y1); @@ -418,7 +419,7 @@ void PictureMgr::yCorner() { void PictureMgr::fill() { int x1, y1; - while ((x1 = nextByte) < 0xF0 && (y1 = nextByte) < 0xf0) + while ((x1 = nextByte) < 0xe0 && (y1 = nextByte) < 0xe0) agiFill(x1, y1); foffs--; @@ -480,15 +481,15 @@ void PictureMgr::plotBrush() { for (;;) { if (patCode & 0x20) { - if ((patNum = nextByte) >= 0xF0) + if ((patNum = nextByte) >= 0xe0) break; patNum = (patNum >> 1) & 0x7f; } - if ((x1 = nextByte) >= 0xf0) + if ((x1 = nextByte) >= 0xe0) break; - if ((y1 = nextByte) >= 0xf0) + if ((y1 = nextByte) >= 0xe0) break; plotPattern(x1, y1); @@ -734,6 +735,9 @@ void PictureMgr::drawPictureV2() { break; case 0xf9: /* set pattern */ patCode = nextByte; + + if (_vm->getGameType() == GType_PreAGI) + plotBrush(); break; case 0xfA: /* plot brush */ plotBrush(); diff --git a/engines/agi/picture.h b/engines/agi/picture.h index 17c27d6132..d8dcb5b1a0 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -38,11 +38,11 @@ struct AgiPicture { uint8 *rdata; /**< raw vector image data */ }; -class AgiEngine; +class AgiBase; class GfxMgr; class PictureMgr { - AgiEngine *_vm; + AgiBase *_vm; GfxMgr *_gfx; private: @@ -66,7 +66,7 @@ private: void drawPictureV2(); public: - PictureMgr(AgiEngine *agi, GfxMgr *gfx) { + PictureMgr(AgiBase *agi, GfxMgr *gfx) { _vm = agi; _gfx = gfx; } diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp new file mode 100644 index 0000000000..f24fbcd294 --- /dev/null +++ b/engines/agi/preagi.cpp @@ -0,0 +1,275 @@ +/* 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$ + * + */ + +#include "common/stdafx.h" + +#include "common/events.h" +#include "common/file.h" +#include "common/savefile.h" +#include "common/config-manager.h" + +#include "base/plugins.h" +#include "base/version.h" + +#include "graphics/cursorman.h" + +#include "sound/mididrv.h" +#include "sound/mixer.h" + +#include "agi/agi.h" +#include "agi/graphics.h" +#include "agi/sprite.h" +#include "agi/opcodes.h" +#include "agi/keyboard.h" +#include "agi/menu.h" +#include "agi/sound.h" + +// preagi engines +#include "agi/preagi_mickey.h" + +namespace Agi { + +PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) { + + // Setup mixer + if (!_mixer->isReady()) { + warning("Sound initialization failed."); + } + + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + +/* + const GameSettings *g; + + const char *gameid = ConfMan.get("gameid").c_str(); + for (g = agiSettings; g->gameid; ++g) + if (!scumm_stricmp(g->gameid, gameid)) + _gameId = g->id; +*/ + + _rnd = new Common::RandomSource(); + + Common::addSpecialDebugLevel(kDebugLevelMain, "Main", "Generic debug level"); + Common::addSpecialDebugLevel(kDebugLevelResources, "Resources", "Resources debugging"); + Common::addSpecialDebugLevel(kDebugLevelSprites, "Sprites", "Sprites debugging"); + Common::addSpecialDebugLevel(kDebugLevelInventory, "Inventory", "Inventory debugging"); + Common::addSpecialDebugLevel(kDebugLevelInput, "Input", "Input events debugging"); + Common::addSpecialDebugLevel(kDebugLevelMenu, "Menu", "Menu debugging"); + Common::addSpecialDebugLevel(kDebugLevelScripts, "Scripts", "Scripts debugging"); + Common::addSpecialDebugLevel(kDebugLevelSound, "Sound", "Sound debugging"); + Common::addSpecialDebugLevel(kDebugLevelText, "Text", "Text output debugging"); + Common::addSpecialDebugLevel(kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging"); + + memset(&_game, 0, sizeof(struct AgiGame)); + memset(&_debug, 0, sizeof(struct AgiDebug)); + memset(&g_mouse, 0, sizeof(struct Mouse)); + +/* + _game.clockEnabled = false; + _game.state = STATE_INIT; + + _keyQueueStart = 0; + _keyQueueEnd = 0; + + _keyControl = 0; + _keyAlt = 0; + + _allowSynthetic = false; + + g_tickTimer = 0; + + _intobj = NULL; + + _stackSize = 0; + _imageStack = NULL; + _imageStackPointer = 0; + + _menu = NULL; + + _lastSentence[0] = 0; + memset(&_stringdata, 0, sizeof(struct StringData)); + + _objects = NULL; + + _oldMode = -1; + + _predictiveDialogRunning = false; + _predictiveDictText = NULL; + _predictiveDictLine = NULL; + _predictiveDictLineCount = 0; + _firstSlot = 0; +*/ +} + +void PreAgiEngine::initialize() { + // TODO: Some sound emulation modes do not fit our current music + // drivers, and I'm not sure what they are. For now, they might + // as well be called "PC Speaker" and "Not PC Speaker". + + // If used platform is Apple IIGS then we must use Apple IIGS sound emulation + // because Apple IIGS AGI games use only Apple IIGS specific sound resources. + /* + if (ConfMan.hasKey("platform") && + Common::parsePlatform(ConfMan.get("platform")) == Common::kPlatformApple2GS) { + _soundemu = SOUND_EMU_APPLE2GS; + } else { + switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) { + case MD_PCSPK: + _soundemu = SOUND_EMU_PC; + break; + default: + _soundemu = SOUND_EMU_NONE; + break; + } + } + */ + + if (ConfMan.hasKey("render_mode")) { + _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); + } else if (ConfMan.hasKey("platform")) { + switch (Common::parsePlatform(ConfMan.get("platform"))) { + case Common::kPlatformAmiga: + _renderMode = Common::kRenderAmiga; + break; + case Common::kPlatformPC: + _renderMode = Common::kRenderEGA; + break; + default: + _renderMode = Common::kRenderEGA; + break; + } + } + + //_buttonStyle = AgiButtonStyle(_renderMode); + //_defaultButtonStyle = AgiButtonStyle(); + //_console = new Console(this); + _gfx = new GfxMgr(this); + //_sound = new SoundMgr(this, _mixer); + _picture = new PictureMgr(this, _gfx); + //_sprites = new SpritesMgr(this, _gfx); + + _gfx->initMachine(); + + _game.gameFlags = 0; + + _game.colorFg = 15; + _game.colorBg = 0; + + _game.name[0] = '\0'; + + _game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically + _game.sbuf16c = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen + _game.sbuf = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default + + _game.lineMinPrint = 1; // hardcoded + + _gfx->initVideo(); + //_sound->initSound(); + + //_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL); + + _game.ver = -1; // Don't display the conf file warning + + debugC(2, kDebugLevelMain, "Detect game"); + + _loader = new AgiLoader_preagi(this); + + if (_loader->detectGame() == errOK) { + _game.state = STATE_LOADED; + debugC(2, kDebugLevelMain, "game loaded"); + } else { + report("Could not open PreAGI game"); + } + + /* clear all resources and events */ + for (int i = 0; i < MAX_DIRS; i++) { + //memset(&_game.views[i], 0, sizeof(struct AgiView)); + memset(&_game.pictures[i], 0, sizeof(struct AgiPicture)); + //memset(&_game.logics[i], 0, sizeof(struct AgiLogic)); + //memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now + //memset(&_game.dirView[i], 0, sizeof(struct AgiDir)); + memset(&_game.dirPic[i], 0, sizeof(struct AgiDir)); + //memset(&_game.dirLogic[i], 0, sizeof(struct AgiDir)); + //memset(&_game.dirSound[i], 0, sizeof(struct AgiDir)); + } + + // load resources + _loader->init(); + + debugC(2, kDebugLevelMain, "Init sound"); +} + +PreAgiEngine::~PreAgiEngine() { + +} + +int PreAgiEngine::init() { + + // Detect game + if (!initGame()) { + GUIErrorMessage("No valid games were found in the specified directory."); + return -1; + } + + // Initialize backend + _system->beginGFXTransaction(); + initCommonGFX(false); + _system->initSize(320, 200); + _system->endGFXTransaction(); + + initialize(); + + _gfx->gfxSetPalette(); + + return 0; +} + +int PreAgiEngine::go() { + // run preagi engine main loop + switch (getGameID()) { + case GID_MICKEY: + { + Mickey *mickey = new Mickey(this); + mickey->init(); + mickey->run(); + } + break; + default: + error("Unknown preagi engine"); + break; + } + return 0; +} + +int PreAgiEngine::preAgiLoadResource(int r, int n) { + return _loader->loadResource(r, n); +} + +int PreAgiEngine::preAgiUnloadResource(int r, int n) { + return _loader->unloadResource(r, n); +} + +} // End of namespace Agi diff --git a/engines/agi/preagi_keyboard.cpp b/engines/agi/preagi_keyboard.cpp new file mode 100644 index 0000000000..56bade1439 --- /dev/null +++ b/engines/agi/preagi_keyboard.cpp @@ -0,0 +1,146 @@ +/* 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$ + * + */ + +#include "common/stdafx.h" +#include "common/events.h" + +#include "agi/agi.h" +#include "agi/graphics.h" +#include "agi/keyboard.h" + +namespace Agi { + +// Input + +void PreAgiEngine::waitAnyKeyAnim() { + waitAnyKey(true); +} + +int PreAgiEngine::getSelection(int type) { + Common::Event event; + + // Selection types: + // 0: Y/N + // 1: 1-9 + for (;;) { + while (_eventMan->pollEvent(event)) { + switch(event.type) { + case Common::EVENT_QUIT: + _system->quit(); + case Common::EVENT_LBUTTONUP: + if (type == 0) + return 1; + case Common::EVENT_RBUTTONUP: + return 0; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_y: + if (type == 0) + return 1; + case Common::KEYCODE_n: + if (type == 0) + return 0; + case Common::KEYCODE_ESCAPE: + if (type == 1) + return 0; + case Common::KEYCODE_1: + case Common::KEYCODE_2: + case Common::KEYCODE_3: + case Common::KEYCODE_4: + case Common::KEYCODE_5: + case Common::KEYCODE_6: + case Common::KEYCODE_7: + case Common::KEYCODE_8: + case Common::KEYCODE_9: + if (type == 1) + return event.kbd.keycode - Common::KEYCODE_1 + 1; + default: + if (type == 0) { + return 2; + } else { + return 10; + } + } + break; + default: + break; + } + } + } + return 0; +} + +bool PreAgiEngine::waitAnyKeyChoice() { + Common::Event event; + + for (;;) { + while (_eventMan->pollEvent(event)) { + switch(event.type) { + case Common::EVENT_QUIT: + _system->quit(); + case Common::EVENT_LBUTTONUP: + return true; + case Common::EVENT_RBUTTONUP: + return false; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_ESCAPE: //Escape + return false; + default: + return true; + } + break; + default: + break; + } + } + } +} + +void PreAgiEngine::waitAnyKey(bool anim) { + Common::Event event; + + for (;;) { + while (_eventMan->pollEvent(event)) { + switch(event.type) { + case Common::EVENT_QUIT: + _system->quit(); + case Common::EVENT_KEYDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONUP: + return; + default: + break; + } + } + // TODO + /*if (anim) { + _game->Animate(); + UpdateScreen(); + }*/ + } +} + +} diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp new file mode 100644 index 0000000000..6cbc316543 --- /dev/null +++ b/engines/agi/preagi_mickey.cpp @@ -0,0 +1,140 @@ +/* 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$ + * + */ + +#include "agi/preagi_mickey.h" +#include "agi/graphics.h" + +namespace Agi { + +Mickey::Mickey(PreAgiEngine *vm) : _vm(vm) { +} + +Mickey::~Mickey() { +} + +void Mickey::init() { +} + +void Mickey::run() { + intro(); + while(true) { + _vm->getSelection(0); + _vm->_system->delayMillis(10); + } + //gameLoop(); + //gameOver(); +} + +void Mickey::intro() { + // draw sierra logo + drawLogo(); + + // draw title picture + game.iRoom = IDI_MSA_PIC_TITLE; + drawRoom(); + +#if 0 + // show copyright and play theme + PrintExeMsg(IDO_MSA_COPYRIGHT); + PlaySound(IDI_MSA_SND_THEME); + + // load game + game.fIntro = true; + if (ChooseY_N(IDO_MSA_LOAD_GAME[0], true)) { + if (LoadGame()) { + game.iPlanet = IDI_MSA_PLANET_EARTH; + game.fIntro = false; + game.iRoom = IDI_MSA_PIC_SHIP_CORRIDOR; + return; + } + } + + // play spaceship landing scene + game.iPlanet = IDI_MSA_PLANET_EARTH; + game.iRoom = IDI_MSA_PIC_EARTH_ROAD_4; + + DrawRoom(); + PrintRoomDesc(); + + #ifndef _DEBUG + PlaySound(IDI_MSA_SND_SHIP_LAND); + #endif + + FlashScreen(); + FlashScreen(); + FlashScreen(); + + PrintExeMsg(IDO_MSA_INTRO); +#endif +} + +void Mickey::drawLogo() { + char szFile[256] = {0}; + uint8 *buffer = new uint8[16384]; + + // read in logos.bcg + sprintf(szFile, IDS_MSA_PATH_LOGO); + Common::File infile; + if (!infile.open(szFile)) + return; + infile.read(buffer, infile.size()); + infile.close(); + + // draw logo bitmap + // TODO + //drawPictureBCG(buffer); + //updateScreen(); + + delete [] buffer; +} + +void Mickey::drawRoomPicture() { + if (false) { //(getDebug()) { + drawPic(0); + //debug(); // TODO + } else { + if (game.iRoom == IDI_MSA_PIC_TITLE) { + drawPic(IDI_MSA_PIC_TITLE); + } else { + drawPic(game.iRmPic[game.iRoom]); + } + } +} + +void Mickey::drawPic(int iPic) { + _vm->preAgiLoadResource(rPICTURE, iPic); + _vm->_picture->decodePicture(iPic, true); + _vm->_picture->showPic(); + _vm->_gfx->doUpdate(); + _vm->_system->updateScreen(); // TODO: this should go in the game's main loop +} + +void Mickey::drawRoom() { + drawRoomPicture(); + //drawRoomObjects(); + //drawRoomAnimation(); +} + +} diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h new file mode 100644 index 0000000000..376211bea3 --- /dev/null +++ b/engines/agi/preagi_mickey.h @@ -0,0 +1,801 @@ +/* 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$ + * + */ + +#include "agi/agi.h" + +namespace Agi { + +// strings + +#define IDS_MSA_PATH_DAT "dat/%s" +#define IDS_MSA_PATH_OBJ "obj/%s.ooo" +#define IDS_MSA_PATH_PIC "%d.pic" +#define IDS_MSA_PATH_LOGO "logos.bcg" +#define IDS_MSA_PATH_EXE "mickey.exe" + +#define IDS_MSA_INVENTORY "MICKEY IS CARRYING THE FOLLOWING:" +#define IDS_MSA_CRYSTALS "%s CRYSTALS" + +const char IDS_MSA_CRYSTAL_NO[][3] = { + "NO", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9" +}; +const char IDS_MSA_TEMP_C[][5] = { + " 20 ", " 480", "-200", " 430", "-185", "-230", "-130", "-150", "-215" +}; +const char IDS_MSA_TEMP_F[][5] = { + " 68 ", " 897", "-328", " 807", "-301", "-382", "-202", "-238", "-355" +}; +const char IDS_MSA_PLANETS[][10] = { + "EARTH. ", "VENUS. ", "TRITON. ", "MERCURY.", "TITAN. ", + "PLUTO. ", "IO. ", "MARS. ", "OBERON. " +}; + +#define IDS_MSA_DEBUG_ROOM "Now in room #%d " +#define IDS_MSA_DEBUG_OBJ "There is object #%d " + +// patch Mickey.exe offset 0x21E to value 0x01 to enable debug mode + +const char IDS_MSA_INSERT_DISK[][40] = { + "Please insert disk 1 and press any key", "Please insert disk 2 and press any key" +}; + +#define IDS_MSA_ERROR_EXE_NOT_FOUND "File 'mickey.exe' not found in folder 'mickey\'." + +// max values + +#define IDI_MSA_MAX_PLANET 9 +#define IDI_MSA_MAX_DAT 10 +#define IDI_MSA_MAX_OBJ 32 +#define IDI_MSA_MAX_PIC 240 +#define IDI_MSA_MAX_PIC_ROOM 224 +#define IDI_MSA_MAX_SOUND 8 +#define IDI_MSA_MAX_ROOM 160 +#define IDI_MSA_MAX_STR 160 + +#define IDI_MSA_MAX_BUTTON 6 +#define IDI_MSA_MAX_ITEM 11 +#define IDI_MSA_MAX_HINT 20 +#define IDI_MSA_MAX_PLANET_INFO 4 +#define IDI_MSA_MAX_AIR_SUPPLY 50 + +#define IDI_MSA_ANIM_DELAY 25 + +#define IDI_MSA_LEN_STORY 1372 + +// rows + +#define IDI_MSA_ROW_MENU_0 20 +#define IDI_MSA_ROW_MENU_1 21 +#define IDI_MSA_ROW_INV_TITLE 2 +#define IDI_MSA_ROW_INV_CRYSTALS 4 +#define IDI_MSA_ROW_INV_ITEMS 5 +#define IDI_MSA_ROW_TEMPERATURE 21 +#define IDI_MSA_ROW_PLANET 22 +#define IDI_MSA_ROW_BUTTONS 20 +#define IDI_MSA_ROW_INSERT_DISK 23 + +#define IDI_MSA_COL_INV_TITLE 4 +#define IDI_MSA_COL_INV_ITEMS 15 +#define IDI_MSA_COL_TEMPERATURE_C 15 +#define IDI_MSA_COL_TEMPERATURE_F 23 +#define IDI_MSA_COL_PLANET 28 +#define IDI_MSA_COL_BUTTONS 22 +#define IDI_MSA_COL_INSERT_DISK 1 + +// messages + +#define IDI_MSA_MSG_STAR_MAP_0 46 +#define IDI_MSA_MSG_STAR_MAP_1 47 +#define IDI_MSA_MSG_STAR_MAP_2 48 +#define IDI_MSA_MSG_SPACESUIT_WEAR 11 +#define IDI_MSA_MSG_SPACESUIT_REMOVE 13 +#define IDI_MSA_MSG_SPACESUIT_0 3 +#define IDI_MSA_MSG_SPACESUIT_CANT_WEAR_ON_EARTH 12 +#define IDI_MSA_MSG_SHIP_LAUNCH 16 +#define IDI_MSA_MSG_SHIP_LAND 22 + +// screen + +#define IDI_MSA_PIC_WIDTH 140 +#define IDI_MSA_PIC_HEIGHT 159 +#define IDI_MSA_PIC_X0 10 +#define IDI_MSA_PIC_Y0 0 +#define IDI_MSA_PIC_FLAGS IDF_AGI_PIC_V2 + +// pictures + +#define IDI_MSA_PIC_EARTH_TIRE_SWING 1 +#define IDI_MSA_PIC_EARTH_TIRE_SWING_1 200 // rope taken, swing on ground +#define IDI_MSA_PIC_EARTH_DOGHOUSE 2 +#define IDI_MSA_PIC_EARTH_IN_DOGHOUSE 154 +#define IDI_MSA_PIC_EARTH_TREE 3 +#define IDI_MSA_PIC_EARTH_GARDEN 4 +#define IDI_MSA_PIC_EARTH_FRONT_HOUSE 5 +#define IDI_MSA_PIC_EARTH_HAMMOCK 6 +#define IDI_MSA_PIC_EARTH_BUTTERFLY 7 +#define IDI_MSA_PIC_EARTH_MAILBOX 8 +#define IDI_MSA_PIC_EARTH_ROAD_0 9 +#define IDI_MSA_PIC_EARTH_ROAD_1 10 +#define IDI_MSA_PIC_EARTH_ROAD_2 11 +#define IDI_MSA_PIC_EARTH_ROAD_3 12 +#define IDI_MSA_PIC_EARTH_ROAD_4 13 // starting room +#define IDI_MSA_PIC_EARTH_ROAD_5 14 +#define IDI_MSA_PIC_EARTH_ROAD_6 15 +#define IDI_MSA_PIC_EARTH_ROAD_7 18 +#define IDI_MSA_PIC_EARTH_UNDER_TREE 16 +#define IDI_MSA_PIC_EARTH_UP_IN_TREE 155 // CRYSTAL +#define IDI_MSA_PIC_EARTH_SHIP 17 +#define IDI_MSA_PIC_EARTH_LIVING_ROOM 19 +#define IDI_MSA_PIC_EARTH_KITCHEN 20 +#define IDI_MSA_PIC_EARTH_KITCHEN_1 159 // cupboard open +#define IDI_MSA_PIC_EARTH_GARAGE 21 +#define IDI_MSA_PIC_EARTH_GARAGE_1 160 // cabinet open +#define IDI_MSA_PIC_EARTH_BEDROOM 22 +#define IDI_MSA_PIC_EARTH_BEDROOM_1 161 // closet open +#define IDI_MSA_PIC_EARTH_BATHROOM 23 // WEIGH MICKEY +#define IDI_MSA_PIC_EARTH_SHIP_LEAVING 24 +#define IDI_MSA_PIC_EARTH_MINNIE 25 + +#define IDI_MSA_PIC_SHIP_AIRLOCK 25 +#define IDI_MSA_PIC_SHIP_AIRLOCK_0 201 // door closed +#define IDI_MSA_PIC_SHIP_AIRLOCK_1 202 // door open +#define IDI_MSA_PIC_SHIP_AIRLOCK_2 203 // door closed, spacesuits on +#define IDI_MSA_PIC_SHIP_AIRLOCK_3 204 // door open, spacesuits on +#define IDI_MSA_PIC_SHIP_BEDROOM 29 +#define IDI_MSA_PIC_SHIP_CONTROLS 26 +#define IDI_MSA_PIC_SHIP_CORRIDOR 27 +#define IDI_MSA_PIC_SHIP_KITCHEN 28 +#define IDI_MSA_PIC_SHIP_KITCHEN_1 172 // cabinet open + +#define IDI_MSA_PIC_SHIP_VENUS 146 +#define IDI_MSA_PIC_SHIP_NEPTUNE 147 +#define IDI_MSA_PIC_SHIP_MERCURY 148 +#define IDI_MSA_PIC_SHIP_SATURN 149 +#define IDI_MSA_PIC_SHIP_PLUTO 150 +#define IDI_MSA_PIC_SHIP_JUPITER 151 +#define IDI_MSA_PIC_SHIP_MARS 152 +#define IDI_MSA_PIC_SHIP_URANUS 153 + +#define IDI_MSA_PIC_VENUS_0 30 +#define IDI_MSA_PIC_VENUS_1 31 +#define IDI_MSA_PIC_VENUS_2 32 +#define IDI_MSA_PIC_VENUS_3 34 +#define IDI_MSA_PIC_VENUS_4 36 +#define IDI_MSA_PIC_VENUS_5 38 +#define IDI_MSA_PIC_VENUS_CHASM 35 +#define IDI_MSA_PIC_VENUS_CHASM_1 183 // rope lowered +#define IDI_MSA_PIC_VENUS_PROBE 39 // CRYSTAL, USE WRENCH +#define IDI_MSA_PIC_VENUS_PROBE_1 184 // hatch open +#define IDI_MSA_PIC_VENUS_SHIP 33 +#define IDI_MSA_PIC_VENUS_WEIGH 37 // WEIGH MICKEY + +#define IDI_MSA_PIC_NEPTUNE_0 40 +#define IDI_MSA_PIC_NEPTUNE_1 42 +#define IDI_MSA_PIC_NEPTUNE_2 43 +#define IDI_MSA_PIC_NEPTUNE_3 44 +#define IDI_MSA_PIC_NEPTUNE_4 45 +#define IDI_MSA_PIC_NEPTUNE_5 48 +#define IDI_MSA_PIC_NEPTUNE_6 50 +#define IDI_MSA_PIC_NEPTUNE_7 52 +#define IDI_MSA_PIC_NEPTUNE_8 53 +#define IDI_MSA_PIC_NEPTUNE_9 54 +#define IDI_MSA_PIC_NEPTUNE_10 55 +#define IDI_MSA_PIC_NEPTUNE_11 56 +#define IDI_MSA_PIC_NEPTUNE_BABIES 61 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_0 46 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_1 51 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_2 57 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_3 58 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_4 59 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_5 60 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_6 66 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_7 67 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_8 68 +#define IDI_MSA_PIC_NEPTUNE_EATING_AREA 62 +#define IDI_MSA_PIC_NEPTUNE_ENTRANCE 47 +#define IDI_MSA_PIC_NEPTUNE_ENTRANCE_1 185 // entrance open +#define IDI_MSA_PIC_NEPTUNE_ENTRYWAY 63 +#define IDI_MSA_PIC_NEPTUNE_GUARD 69 +#define IDI_MSA_PIC_NEPTUNE_LEADER 64 // CRYSTAL, GIVE SCARF +#define IDI_MSA_PIC_NEPTUNE_SHIP 49 +#define IDI_MSA_PIC_NEPTUNE_SLEEP_AREA 65 +#define IDI_MSA_PIC_NEPTUNE_WEIGH 41 + +#define IDI_MSA_PIC_MERCURY_0 71 +#define IDI_MSA_PIC_MERCURY_1 73 +#define IDI_MSA_PIC_MERCURY_2 75 +#define IDI_MSA_PIC_MERCURY_3 77 +#define IDI_MSA_PIC_MERCURY_4 80 +#define IDI_MSA_PIC_MERCURY_ALIEN_0 72 // CRYSTAL, GIVE SUNGLASSES +#define IDI_MSA_PIC_MERCURY_ALIEN_1 74 +#define IDI_MSA_PIC_MERCURY_ALIEN_2 81 +#define IDI_MSA_PIC_MERCURY_CAVE_0 70 // hidden feature, press '2' here +#define IDI_MSA_PIC_MERCURY_CAVE_1 78 +#define IDI_MSA_PIC_MERCURY_CAVE_2 79 +#define IDI_MSA_PIC_MERCURY_SHIP 76 +#define IDI_MSA_PIC_MERCURY_WEIGH 82 + +#define IDI_MSA_PIC_SATURN_0 84 +#define IDI_MSA_PIC_SATURN_1 86 +#define IDI_MSA_PIC_SATURN_2 90 +#define IDI_MSA_PIC_SATURN_3 91 +#define IDI_MSA_PIC_SATURN_ISLAND 89 // CRYSTAL +#define IDI_MSA_PIC_SATURN_LAKE_0 85 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_LAKE_1 88 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_LAKE_2 92 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_SHIP 87 +#define IDI_MSA_PIC_SATURN_WEIGH 83 // WEIGH MICKEY + +#define IDI_MSA_PIC_PLUTO_0 93 +#define IDI_MSA_PIC_PLUTO_1 96 +#define IDI_MSA_PIC_PLUTO_2 97 +#define IDI_MSA_PIC_PLUTO_3 98 +#define IDI_MSA_PIC_PLUTO_4 101 +#define IDI_MSA_PIC_PLUTO_ALIENS 100 // CRYSTAL, GIVE BONE +#define IDI_MSA_PIC_PLUTO_CAVE_0 99 +#define IDI_MSA_PIC_PLUTO_CAVE_1 103 +#define IDI_MSA_PIC_PLUTO_CRATER 102 +#define IDI_MSA_PIC_PLUTO_SHIP 95 +#define IDI_MSA_PIC_PLUTO_WEIGH 94 // WEIGH MICKEY + +#define IDI_MSA_PIC_JUPITER_0 106 +#define IDI_MSA_PIC_JUPITER_1 107 +#define IDI_MSA_PIC_JUPITER_2 108 +#define IDI_MSA_PIC_JUPITER_3 109 +#define IDI_MSA_PIC_JUPITER_4 113 +#define IDI_MSA_PIC_JUPITER_5 116 +#define IDI_MSA_PIC_JUPITER_6 117 +#define IDI_MSA_PIC_JUPITER_7 120 +#define IDI_MSA_PIC_JUPITER_CRACK 114 +#define IDI_MSA_PIC_JUPITER_LAVA 110 // CRYSTAL, THROW ROCK +#define IDI_MSA_PIC_JUPITER_ROCK_0 112 // GET ROCK +#define IDI_MSA_PIC_JUPITER_ROCK_1 119 // GET ROCK +#define IDI_MSA_PIC_JUPITER_SHIP 115 +#define IDI_MSA_PIC_JUPITER_WEIGH 118 // WEIGH MICKEY + +#define IDI_MSA_PIC_MARS_0 121 +#define IDI_MSA_PIC_MARS_1 124 +#define IDI_MSA_PIC_MARS_2 125 +#define IDI_MSA_PIC_MARS_3 126 +#define IDI_MSA_PIC_MARS_4 127 +#define IDI_MSA_PIC_MARS_5 128 +#define IDI_MSA_PIC_MARS_6 130 +#define IDI_MSA_PIC_MARS_SHIP 123 +#define IDI_MSA_PIC_MARS_TUBE_0 129 +#define IDI_MSA_PIC_MARS_TUBE_1 131 +#define IDI_MSA_PIC_MARS_VOLCANO 132 // CRYSTAL, DIG PLUTO +#define IDI_MSA_PIC_MARS_WEIGH 122 // WEIGH MICKEY + +#define IDI_MSA_PIC_URANUS_0 133 +#define IDI_MSA_PIC_URANUS_1 134 +#define IDI_MSA_PIC_URANUS_2 135 +#define IDI_MSA_PIC_URANUS_3 138 +#define IDI_MSA_PIC_URANUS_4 139 +#define IDI_MSA_PIC_URANUS_5 140 +#define IDI_MSA_PIC_URANUS_6 142 +#define IDI_MSA_PIC_URANUS_CHAMBER 145 // CRYSTAL, USE CROWBAR +#define IDI_MSA_PIC_URANUS_SHIP 137 +#define IDI_MSA_PIC_URANUS_STEPS 144 +#define IDI_MSA_PIC_URANUS_ENTRANCE 141 // ENTER TEMPLE +#define IDI_MSA_PIC_URANUS_TEMPLE 143 // USE CRYSTAL, ENTER DOOR +#define IDI_MSA_PIC_URANUS_TEMPLE_1 206 // crystal used +#define IDI_MSA_PIC_URANUS_TEMPLE_2 207 // door open +#define IDI_MSA_PIC_URANUS_WEIGH 136 // WEIGH MICKEY + +#define IDI_MSA_PIC_STAR_MAP 165 +#define IDI_MSA_PIC_TITLE 240 + +// objects + +enum ENUM_MSA_OBJECT { + IDI_MSA_OBJECT_NONE = -1, + IDI_MSA_OBJECT_ROCK_0, + IDI_MSA_OBJECT_WRENCH, + IDI_MSA_OBJECT_SCALE, + IDI_MSA_OBJECT_CROWBAR, + IDI_MSA_OBJECT_BONE, + IDI_MSA_OBJECT_SUNGLASSES, + IDI_MSA_OBJECT_DESK_STUFF, + IDI_MSA_OBJECT_MATTRESS, + IDI_MSA_OBJECT_SCARF, + IDI_MSA_OBJECT_FLASHLIGHT, + IDI_MSA_OBJECT_ROPE, + IDI_MSA_OBJECT_ROCK_1, + IDI_MSA_OBJECT_SCARF_C64, + IDI_MSA_OBJECT_ROCK_2, + IDI_MSA_OBJECT_ROCK_3, + IDI_MSA_OBJECT_W_EARTH, + IDI_MSA_OBJECT_W_VENUS, + IDI_MSA_OBJECT_W_TRITON, + IDI_MSA_OBJECT_W_MERCURY, + IDI_MSA_OBJECT_W_TITAN, + IDI_MSA_OBJECT_W_PLUTO, + IDI_MSA_OBJECT_W_IO, + IDI_MSA_OBJECT_W_MARS, + IDI_MSA_OBJECT_W_OBERON, + IDI_MSA_OBJECT_W_SPACE, + IDI_MSA_OBJECT_XL31, + IDI_MSA_OBJECT_XL31E, + IDI_MSA_OBJECT_XL32, + IDI_MSA_OBJECT_XL32E, + IDI_MSA_OBJECT_XL33, + IDI_MSA_OBJECT_XL33E, + IDI_MSA_OBJECT_CRYSTAL +}; + +const char IDS_MSA_NAME_OBJ[][9] = { + "rok1", "wrench", "scale", "cbar", "bone", "glasses", "deskstuf", "raft", + "scarf", "flashlit", "rope", "rok1", "scarfc64", "rok2", "rock35", "earthw", + "venw", "trw", "merw", "titw", "plw", "iow", "mrw", "obw", "spw", "xl31", + "xl31e", "xl32", "xl32e", "xl33", "xl33e", "crys1" +}; + +const int IDI_MSA_XTAL_ROOM_XY[IDI_MSA_MAX_PLANET][3] = { + // room x y + {IDI_MSA_PIC_EARTH_UP_IN_TREE, 14, 76}, + {IDI_MSA_PIC_VENUS_PROBE, 74, 80}, + {IDI_MSA_PIC_NEPTUNE_LEADER, 70, 27}, + {IDI_MSA_PIC_MERCURY_ALIEN_0, 123, 64}, + {IDI_MSA_PIC_SATURN_ISLAND, 110, 115}, + {IDI_MSA_PIC_PLUTO_ALIENS, 60, 104}, + {IDI_MSA_PIC_JUPITER_LAVA, 56, 54}, + {IDI_MSA_PIC_MARS_VOLCANO, 107, 100}, + {IDI_MSA_PIC_URANUS_CHAMBER, 90, 4} +}; + +// planets + +enum ENUM_MSA_PLANET { + IDI_MSA_PLANET_EARTH = 0, + IDI_MSA_PLANET_VENUS, + IDI_MSA_PLANET_NEPTUNE, + IDI_MSA_PLANET_MERCURY, + IDI_MSA_PLANET_SATURN, + IDI_MSA_PLANET_PLUTO, + IDI_MSA_PLANET_JUPITER, + IDI_MSA_PLANET_MARS, + IDI_MSA_PLANET_URANUS, + IDI_MSA_PLANET_SPACESHIP +}; + +const char IDS_MSA_NAME_DAT[][13] = { + "earth.dat", "venus.dat", "neptune.dat", "mercury.dat", "saturn.dat", + "pluto.dat", "jupiter.dat", "mars.dat", "uranus.dat", "spacship.dat" +}; + +const char IDS_MSA_NAME_PLANET[][10] = { + "EARTH", "VENUS", "TRITON", "MERCURY", "TITAN", + "PLUTO", "IO", "MARS", "OBERON" +}; + +const char IDS_MSA_NAME_PLANET_2[][10] = { + "EARTH", "VENUS", "NEPTUNE", "MERCURY", "SATURN", + "PLUTO", "JUPITER", "MARS", "URANUS" +}; + +const char IDS_MSA_ADDR_PLANET[][7] = { + "OB", "B", "OOBBB", "O", "OOBB", + "OOOBBB", "OBB", "OOB", "OOOBB" +}; + +const int IDI_MSA_HOME_PLANET[] = { + IDI_MSA_PIC_EARTH_SHIP, IDI_MSA_PIC_VENUS_SHIP, IDI_MSA_PIC_NEPTUNE_SHIP, IDI_MSA_PIC_MERCURY_SHIP, + IDI_MSA_PIC_SATURN_SHIP, IDI_MSA_PIC_PLUTO_SHIP, IDI_MSA_PIC_JUPITER_SHIP, IDI_MSA_PIC_MARS_SHIP, + IDI_MSA_PIC_URANUS_SHIP +}; + +const int IDI_MSA_SHIP_PLANET[] = { + 0, IDI_MSA_PIC_SHIP_VENUS, IDI_MSA_PIC_SHIP_NEPTUNE, IDI_MSA_PIC_SHIP_MERCURY, IDI_MSA_PIC_SHIP_SATURN, + IDI_MSA_PIC_SHIP_PLUTO, IDI_MSA_PIC_SHIP_JUPITER, IDI_MSA_PIC_SHIP_MARS, IDI_MSA_PIC_SHIP_URANUS +}; + +// items + +enum ENUM_MSA_ITEM { + IDI_MSA_ITEM_FLASHLIGHT = 0, + IDI_MSA_ITEM_ROPE, + IDI_MSA_ITEM_BONE, + IDI_MSA_ITEM_LETTER, + IDI_MSA_ITEM_CROWBAR, + IDI_MSA_ITEM_WRENCH, + IDI_MSA_ITEM_MATTRESS, + IDI_MSA_ITEM_SCARF, + IDI_MSA_ITEM_SUNGLASSES, + IDI_MSA_ITEM_SCALE, + IDI_MSA_ITEM_ROCK +}; + +const char IDS_MSA_NAME_ITEM[][15] = { + "A FLASHLIGHT", "A ROPE ", "A BONE ", "A LETTER", "A CROWBAR", "A WRENCH", + "A MATTRESS", "A SCARF", "SUNGLASSES", "A SCALE ", "A ROCK " +}; + +// buttons + +#define IDI_MSA_BUTTON_ORANGE 0x4F // 'O' +#define IDI_MSA_BUTTON_BLUE 0x42 // 'B' + +// file structures + +struct MSA_TEXT_ENTRY { + uint8 x0; + uint8 szText[11]; +}; + +struct MSA_TEXT_BLOCK { + uint8 count; + MSA_TEXT_ENTRY entry[5]; +}; + +struct MSA_MSG_BLOCK { + uint8 data[5]; +}; + +struct MSA_MENU { + MSA_TEXT_BLOCK row[2]; + MSA_MSG_BLOCK cmd[5]; + MSA_MSG_BLOCK arg[5]; +}; + +struct MSA_DAT_HEADER { + uint16 filelen; + uint16 ofsRoom[IDI_MSA_MAX_ROOM]; + uint16 ofsDesc[IDI_MSA_MAX_ROOM]; + uint16 ofsStr[IDI_MSA_MAX_STR]; +}; + +struct MSA_SND_NOTE { + uint16 counter; // freq = 1193180 / counter + uint8 length; // msec = length / 0.0182 +}; + +// file offset modifiers + +#define IDI_MSA_OFS_INVALID 0xFE9A +#define IDI_MSA_OFS_DAT 0x0002 +#define IDI_MSA_OFS_EXE 0x35C0 +#define IDI_MSA_OFS_OBJECT_DATA 0x58E8 + +// actions + +#define IDI_MSA_ACTION_GOTO_ROOM 0x00 +#define IDI_MSA_ACTION_SHOW_INT_STR 0x01 +#define IDI_MSA_ACTION_UNUSED 0x02 +#define IDI_MSA_ACTION_SHOW_DAT_STR 0x03 + +#define IDI_MSA_ACTION_GET_ROPE 0x7F +#define IDI_MSA_ACTION_UNTIE_ROPE 0x80 +#define IDI_MSA_ACTION_GET_BONE 0x81 +#define IDI_MSA_ACTION_GET_XTAL_EARTH 0x82 +#define IDI_MSA_ACTION_LOOK_DESK 0x83 +#define IDI_MSA_ACTION_WRITE_LETTER 0x84 +#define IDI_MSA_ACTION_MAIL_LETTER 0x85 +#define IDI_MSA_ACTION_OPEN_CUPBOARD 0x86 +#define IDI_MSA_ACTION_GET_FLASHLIGHT 0x87 +#define IDI_MSA_ACTION_OPEN_CABINET 0x88 +#define IDI_MSA_ACTION_GET_CROWBAR 0x89 +#define IDI_MSA_ACTION_GET_WRENCH 0x8A +#define IDI_MSA_ACTION_OPEN_CLOSET 0x8B +#define IDI_MSA_ACTION_GET_MATTRESS 0x8C +#define IDI_MSA_ACTION_GET_SCARF 0x8D +#define IDI_MSA_ACTION_GET_SUNGLASSES 0x8E +#define IDI_MSA_ACTION_GET_SCALE 0x8F +#define IDI_MSA_ACTION_GOTO_SPACESHIP 0x90 + +#define IDI_MSA_ACTION_DOWN_CHASM 0x91 +#define IDI_MSA_ACTION_DOWN_ROPE 0x92 +#define IDI_MSA_ACTION_USE_ROPE 0x93 +#define IDI_MSA_ACTION_OPEN_HATCH 0x94 +#define IDI_MSA_ACTION_USE_WRENCH 0x95 +#define IDI_MSA_ACTION_GET_XTAL_VENUS 0x96 + +#define IDI_MSA_ACTION_LOOK_CASTLE 0x97 +#define IDI_MSA_ACTION_ENTER_OPENING 0x98 +#define IDI_MSA_ACTION_USE_CROWBAR 0x99 +#define IDI_MSA_ACTION_GET_XTAL_NEPTUNE 0x9A +#define IDI_MSA_ACTION_TALK_LEADER 0x9B +#define IDI_MSA_ACTION_GIVE_SCARF 0x9C + +#define IDI_MSA_ACTION_GET_XTAL_MERCURY 0x9D +#define IDI_MSA_ACTION_GIVE_SUNGLASSES 0x9E +#define IDI_MSA_ACTION_CROSS_LAKE 0x9F +#define IDI_MSA_ACTION_USE_MATTRESS 0xA0 +#define IDI_MSA_ACTION_GET_XTAL_SATURN 0xA1 +#define IDI_MSA_ACTION_LEAVE_ISLAND 0xA2 + +#define IDI_MSA_ACTION_GET_XTAL_PLUTO 0xA3 +#define IDI_MSA_ACTION_GIVE_BONE 0xA4 + +#define IDI_MSA_ACTION_GET_ROCK_0 0xA5 +#define IDI_MSA_ACTION_GET_ROCK_1 0xA6 +#define IDI_MSA_ACTION_GET_XTAL_JUPITER 0xA7 +#define IDI_MSA_ACTION_THROW_ROCK 0xA8 + +#define IDI_MSA_ACTION_GO_TUBE 0xA9 +#define IDI_MSA_ACTION_USE_FLASHLIGHT 0xAA +#define IDI_MSA_ACTION_PLUTO_DIG 0xAB +#define IDI_MSA_ACTION_GET_XTAL_MARS 0xAC + +#define IDI_MSA_ACTION_USE_CRYSTAL 0xAD +#define IDI_MSA_ACTION_OPEN_DOOR 0xAE +#define IDI_MSA_ACTION_ENTER_DOOR 0xAF +#define IDI_MSA_ACTION_GET_XTAL_URANUS 0xB0 +#define IDI_MSA_ACTION_USE_CROWBAR_1 0xB1 + +#define IDI_MSA_ACTION_GO_NORTH 0xB2 +#define IDI_MSA_ACTION_GO_PLANET 0xB3 +#define IDI_MSA_ACTION_PRESS_BUTTON 0xB4 +#define IDI_MSA_ACTION_WEAR_SPACESUIT 0xB5 +#define IDI_MSA_ACTION_READ_GAUGE 0xB6 +#define IDI_MSA_ACTION_PRESS_ORANGE 0xB7 +#define IDI_MSA_ACTION_PRESS_BLUE 0xB8 +#define IDI_MSA_ACTION_FLIP_SWITCH 0xB9 +#define IDI_MSA_ACTION_PUSH_THROTTLE 0xBA +#define IDI_MSA_ACTION_PULL_THROTTLE 0xBB +#define IDI_MSA_ACTION_LEAVE_ROOM 0xBC +#define IDI_MSA_ACTION_OPEN_CABINET_1 0xBD +#define IDI_MSA_ACTION_READ_MAP 0xBE +#define IDI_MSA_ACTION_GO_WEST 0xBF + +#define IDI_MSA_ACTION_PLANET_INFO 0xC0 +#define IDI_MSA_ACTION_ENTER_TEMPLE 0xC1 +#define IDI_MSA_ACTION_OPEN_MAILBOX 0xC2 +#define IDI_MSA_ACTION_SAVE_GAME 0xC3 +#define IDI_MSA_ACTION_LOOK_MICKEY 0xC4 + +// sounds + +enum ENUM_MSA_SOUND { + IDI_MSA_SND_THEME, + IDI_MSA_SND_CRYSTAL, + IDI_MSA_SND_TAKE, + IDI_MSA_SND_GAME_OVER, + IDI_MSA_SND_PRESS_BLUE, + IDI_MSA_SND_PRESS_ORANGE, + IDI_MSA_SND_SHIP_LAND, + IDI_MSA_SND_XL30 +}; + +// message offsets within mickey.exe + +const int IDO_MSA_ERROR[] = { + 0x4C9C, 0x4CB9, 0x4CD4, 0x4CEA, 0x4D0D, 0x4D20, 0x4D3B, 0x4D5E +}; + +const int IDO_MSA_HIDDEN_MSG[] = { + 0x8C44, 0x8C83, 0x8D23, 0x8D97, 0x8E2A +}; + +const int IDO_MSA_GAME_OVER[] = { + 0x7914, 0x7978, 0x7A17, 0x7A94, 0x7B04, 0x7B8F, 0x7BEB, 0x7C79 +}; + +const int IDO_MSA_SAVE_GAME[] = { + 0x73FA, 0x7436, 0x746C, 0x74E9, 0x75F6, 0x766A, 0x758B + // do you have a formatted disk, insert disk, insert disk 2, save by number + // everything will be lost, previous game will be lost, game saved +}; + +const int IDO_MSA_LOAD_GAME[] = { + 0x76CE, 0x770B, 0x7777 + // do you want to load game, insert game save disk, game restored +}; + +const int IDO_MSA_AIR_SUPPLY[] = { + 0x7D10, 0x7D31, 0x7D51, 0x7D9B + // be aware, low, dangerously low, out of air + // 30, 20, 10, 0 +}; + +const int IDI_MSA_AIR_SUPPLY[] = { 30, 20, 10, 0 }; + +// planet information + +const int IDO_MSA_PLANET_INFO[IDI_MSA_MAX_PLANET][4] = { + {0x6313, 0x63B2, 0x6449, 0}, // EARTH + {0x61EB, 0x6288, 0, 0}, // VENUS + {0x6B64, 0x6C06, 0x6CA3, 0}, // NEPTUNE + {0x609B, 0x612C, 0x61CA, 0}, // MERCURY + {0x6879, 0x6916, 0x6984, 0}, // SATURN + {0x6CCF, 0x6D72, 0x6E10, 0}, // PLUTO + {0x667C, 0x6714, 0x67B1, 0x684E}, // JUPITER + {0x6471, 0x650F, 0x65AD, 0x6651}, // MARS + {0x69C3, 0x6A62, 0x6B00, 0} // URANUS +}; + +// next crystal piece hints + +const int IDO_MSA_NEXT_PIECE[IDI_MSA_MAX_PLANET][5] = { + {0, 0, 0, 0, 0}, // earth + {0x4DCC, 0x4E20, 0x4E64, 0x4E9E, 0x4F0B}, // venus + {0x5900, 0x599B, 0x5A07, 0x5A8E, 0x5B07}, // neptune + {0x4F57, 0x4FA3, 0x4FF1, 0x5056, 0x50BD}, // mercury + {0x5471, 0x54DF, 0x5548, 0x55C2, 0x562A}, // saturn + {0x5B78, 0x5BB6, 0x5C29, 0x5C76, 0x5CE1}, // pluto + {0x526B, 0x52DA, 0x5340, 0x53A1, 0x540C}, // jupiter + {0x50F6, 0x512C, 0x5170, 0x51D5, 0x5228}, // mars + {0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus +}; + +// message offsets + +#define IDO_MSA_COPYRIGHT 0x7801 +#define IDO_MSA_INTRO 0x4679 +#define IDO_MSA_GAME_STORY 0x6E9C + +#define IDO_MSA_CHECK_DISK_DRIVE 0x7885 +#define IDO_MSA_YOU_CAN_SEE_MICKEY_ALREADY 0x46D1 +#define IDO_MSA_THE_CABINET_IS_ALREADY_OPEN 0x46EF + +#define IDO_MSA_PRESS_1_TO_9 0x7530 +#define IDO_MSA_PRESS_YES_OR_NO 0x480D +#define IDO_MSA_TOO_MANY_BUTTONS_PRESSED 0x5DF7 + +#define IDO_MSA_MICKEY_HAS_PRESSED 0x5D90 + +#define IDO_MSA_XL30_SPEAKING 0x4725 +#define IDO_MSA_CRYSTAL_PIECE_FOUND 0x600C + +#define IDO_MSA_FONT 0x7EDC // 256 chars, 2048 bytes (00110010 * 8 = character) + +#define IDO_MSA_ROOM_TEXT 0x4B80 +#define IDO_MSA_ROOM_TEXT_OFFSETS 0x8B01 +#define IDO_MSA_ROOM_OBJECT 0x475C +#define IDO_MSA_ROOM_PICTURE 0x4AE4 +#define IDO_MSA_ROOM_OBJECT_XY_OFFSETS 0x8EA8 +#define IDO_MSA_PIC_SHIP_LIGHT 0x8F38 +#define IDO_MSA_XTAL_ROOM_XY 0x97F8 +//#define IDO_MSA_PLANET_INFO 0x6048 +#define IDO_MSA_ROOM_MENU_FIX 0x4a27 +#define IDO_MSA_ROOM_MENU_FIX_OFFSETS 0x5E7A + +// offsets to offset arrays + +#define IDOFS_MSA_INTERPRETER_ERRORS 0x4c8e +#define IDOFS_MSA_HIDDEN_FEATURE 0x8c3a +#define IDOFS_MSA_MENU_PATCHES 0x5e7a +#define IDOFS_MSA_SOUND_DATA 0x9deb +#define IDOFS_MSA_NEXT_PLANET_CLUES 0x4d7c +#define IDOFS_MSA_PLANET_INFORMATION 0x6048 +#define IDOFS_MSA_PLANET_ADDRESSES 0x5e40 +#define IDOFS_MSA_OBJECT_DATA 0x8ea8 +#define IDOFS_MSA_EXTENDED_ROOM_DESCRIPTIONS 0x8b01 + +// game structure + +struct MSA_GAME { + int iRoom; + int iPlanet; + int iDisk; + + int nAir; + int nButtons; + int nRocks; + + bool fHasXtal; + int nXtals; + int iPlanetXtal[IDI_MSA_MAX_DAT]; + int iClue[IDI_MSA_MAX_PLANET]; + char szAddr[IDI_MSA_MAX_BUTTON + 1]; + + bool fIntro; + bool fSuit; + bool fShipDoorOpen; + bool fFlying; + bool fStoryShown; + bool fTempleDoorOpen; + + bool fItem[IDI_MSA_MAX_ITEM]; + bool fItemUsed[IDI_MSA_MAX_ITEM]; + int iItem[IDI_MSA_MAX_ITEM]; + int nItems; + + int8 fRmTxt[IDI_MSA_MAX_ROOM]; + int8 iRmObj[IDI_MSA_MAX_ROOM]; + uint8 iRmPic[IDI_MSA_MAX_ROOM]; + uint16 oRmTxt[IDI_MSA_MAX_ROOM]; + + uint8 iRmMenu[IDI_MSA_MAX_ROOM]; + uint8 nRmMenu[IDI_MSA_MAX_ROOM]; + + int nFrame; // 0.1.4 + bool fAnimXL30; // 0.1.4 + int nTicks; // 0.1.4 +}; + +class Mickey { + friend class PreAgiEngine; +public: + + Mickey(PreAgiEngine *vm); + ~Mickey(); + + void init(); + void run(); +protected: + PreAgiEngine *_vm; + MSA_GAME game; + + int getDat(int); + void readExe(int, uint8*, long); + void getDatFileName(int, char*); + void readDatHdr(char*, MSA_DAT_HEADER*); + void readDesc(int, char*, long); + void readMenu(int, char*); + void readDatStr(int, int, char*, long); + void readOfsData(int, int, uint8*, long); + bool chooseY_N(int, bool); + int choose1to9(int); + void printStr(char*); + void printExeStr(int); + void printExeMsg(int); + void printDatStr(int, int); + void printDesc(int); + void drawMenu(MSA_MENU, int, int); + void getMouseMenuSelRow(MSA_MENU, int*, int*, int, int, int); + bool getMenuSelRow(MSA_MENU, int*, int*, int); + void getMenuSel(char*, int*, int*); + void centerMenu(MSA_MENU*); + void patchMenu(MSA_MENU*); + void printDatString(int); + void printDatMessage(int); + void _playNote(MSA_SND_NOTE); + void playSound(ENUM_MSA_SOUND); + void debug(); + void drawObj(ENUM_MSA_OBJECT, int, int); + void drawPic(int); + void drawRoomPicture(); + void drawRoomObjects(); + void drawRoomAnimation(); + void drawRoom(); + void drawLogo(); + void animate(); + void printRoomDesc(); + bool loadGame(); + void saveGame(); + void showPlanetInfo(); + void printStory(); + void hidden(); + int getPlanet(); + void pressOB(int); + void checkAirSupply(bool, int*); + void insertDisk(int); + void gameOver(); + void inventory(); + void randomize(); + void flashScreen(); + void intro(); + void getItem(ENUM_MSA_ITEM); + void getXtal(int); + bool parse(int, int); + void gameLoop(); + void debug_DrawObjs(); + void debug_DrawPics(); + void initVars(); + void initEngine(); + void flipSwitch(); +}; + +} -- cgit v1.2.3