diff options
Diffstat (limited to 'engines/m4')
72 files changed, 205 insertions, 393 deletions
diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp index c61c6fe7d8..80a3624475 100644 --- a/engines/m4/actor.cpp +++ b/engines/m4/actor.cpp @@ -18,9 +18,6 @@ * 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/system.h" diff --git a/engines/m4/actor.h b/engines/m4/actor.h index 96299ab629..e28c522df8 100644 --- a/engines/m4/actor.h +++ b/engines/m4/actor.h @@ -18,9 +18,6 @@ * 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 M4_ACTOR_H diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 3fe050e604..39a3f175cd 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -64,9 +61,9 @@ MadsAnimation::~MadsAnimation() { #define FILENAME_SIZE 13 /** - * Initialises and loads the data of an animation + * Initializes and loads the data of an animation */ -void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) { +void MadsAnimation::initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) { MadsPack anim(filename.c_str(), _vm); bool madsRes = filename[0] == '*'; char buffer[20]; @@ -134,7 +131,7 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S if (flags & 0x100) loadInterface(surface, depthSurface); - // Initialise the reference list + // Initialize the reference list for (int i = 0; i < spriteListCount; ++i) _spriteListIndexes.push_back(-1); @@ -269,7 +266,7 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S * Loads an animation file for display */ void MadsAnimation::load(const Common::String &filename, int abortTimers) { - initialise(filename, 0, NULL, NULL); + initialize(filename, 0, NULL, NULL); _messageCtr = 0; _skipLoad = true; @@ -282,7 +279,7 @@ void MadsAnimation::load(const Common::String &filename, int abortTimers) { } */ - // Initialise miscellaneous fields + // Initialize miscellaneous fields _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _madsVm->_currentTimer; @@ -292,7 +289,7 @@ void MadsAnimation::load(const Common::String &filename, int abortTimers) { if (_madsVm->_scene) _actionNouns = _madsVm->scene()->_action._action; - // Initialise kernel message list + // Initialize kernel message list for (uint i = 0; i < _messages.size(); ++i) _messages[i].kernelMsgIndex = -1; } diff --git a/engines/m4/animation.h b/engines/m4/animation.h index a7a6b57c32..68a2883241 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -18,9 +18,6 @@ * 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 M4_ANIMATION_H @@ -114,7 +111,7 @@ public: MadsAnimation(MadsM4Engine *vm, MadsView *view); virtual ~MadsAnimation(); - virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface); + virtual void initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface); virtual void load(const Common::String &filename, int abortTimers); virtual void update(); virtual void setCurrentFrame(int frameNumber); diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index c4113e00d0..8ffdeb53e0 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -18,9 +18,6 @@ * 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 "m4/assets.h" diff --git a/engines/m4/assets.h b/engines/m4/assets.h index 940646b5f2..90670dde53 100644 --- a/engines/m4/assets.h +++ b/engines/m4/assets.h @@ -18,9 +18,6 @@ * 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 M4_ASSETS_H #define M4_ASSETS_H diff --git a/engines/m4/burger_data.h b/engines/m4/burger_data.h index c053268705..d30e546023 100644 --- a/engines/m4/burger_data.h +++ b/engines/m4/burger_data.h @@ -18,9 +18,6 @@ * 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 M4_BURGER_DATA_H diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp index 8fe4fbf1eb..65a25c14e3 100644 --- a/engines/m4/compression.cpp +++ b/engines/m4/compression.cpp @@ -18,9 +18,6 @@ * 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 "m4/compression.h" @@ -47,16 +44,16 @@ bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { } MadsPack::MadsPack(Common::SeekableReadStream *stream) { - initialise(stream); + initialize(stream); } MadsPack::MadsPack(const char *resourceName, MadsM4Engine* vm) { Common::SeekableReadStream *stream = vm->_resourceManager->get(resourceName); - initialise(stream); + initialize(stream); vm->_resourceManager->toss(resourceName); } -void MadsPack::initialise(Common::SeekableReadStream *stream) { +void MadsPack::initialize(Common::SeekableReadStream *stream) { if (!MadsPack::isCompressed(stream)) error("Attempted to decompress a resource that was not MadsPacked"); @@ -124,7 +121,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat copyOfs = 0xFFFF0000; destP = destData; - // Initialise data fields + // Initialize data fields _srcData = srcData; _srcP = _srcData + 6; _srcSize = srcSize; diff --git a/engines/m4/compression.h b/engines/m4/compression.h index 93c7d9af9e..cb0ef74eb7 100644 --- a/engines/m4/compression.h +++ b/engines/m4/compression.h @@ -18,9 +18,6 @@ * 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 M4_COMPRESSION_H @@ -48,7 +45,7 @@ private: int _count; int _dataOffset; - void initialise(Common::SeekableReadStream *stream); + void initialize(Common::SeekableReadStream *stream); public: static bool isCompressed(Common::SeekableReadStream *stream); MadsPack(Common::SeekableReadStream *stream); diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp index cbcaa04669..fa4ca6d121 100644 --- a/engines/m4/console.cpp +++ b/engines/m4/console.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -150,12 +147,12 @@ bool Console::cmdDumpFile(int argc, const char **argv) { DebugPrintf("If uncompress is 1, the file is uncompressed (for MADS games)\n"); } else { if (argc == 2) { - _vm->dumpFile(strdup(argv[1])); + _vm->dumpFile(argv[1], false); } else { if (argc == 3 && atoi(argv[2]) == 1) - _vm->dumpFile(strdup(argv[1]), true); + _vm->dumpFile(argv[1], true); else - _vm->dumpFile(strdup(argv[1])); + _vm->dumpFile(argv[1], false); } } return true; @@ -270,7 +267,7 @@ bool MadsConsole::cmdObject(int argc, const char **argv) { DebugPrintf("%2d - ", objStart); for (uint objId = objStart; objId < MIN<uint>(_vm->globals()->getObjectsSize(), objStart + 5); ++objId) { if (objId != objStart) DebugPrintf(", "); - uint16 descId = _vm->globals()->getObject(objId)->descId; + uint16 descId = _vm->globals()->getObject(objId)->_descId; DebugPrintf("%s", _vm->globals()->getVocab(descId)); } @@ -300,15 +297,15 @@ bool MadsConsole::cmdObject(int argc, const char **argv) { else { const MadsObject *obj = _vm->globals()->getObject(objNum); - DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", objNum, _vm->globals()->getVocab(obj->descId), - obj->roomNumber, (int)obj->article, englishMADSArticleList[obj->article], obj->vocabCount); + DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", objNum, _vm->globals()->getVocab(obj->_descId), + obj->_roomNumber, (int)obj->_article, englishMADSArticleList[obj->_article], obj->_vocabCount); - if (obj->vocabCount > 0) { + if (obj->_vocabCount > 0) { DebugPrintf(" - "); - for (int i = 0; i < obj->vocabCount; ++i) { + for (int i = 0; i < obj->_vocabCount; ++i) { if (i != 0) DebugPrintf(", "); - DebugPrintf("%s (%d)/%d,%d", _vm->globals()->getVocab(obj->vocabList[i].vocabId), - obj->vocabList[i].vocabId, obj->vocabList[i].flags1, obj->vocabList[i].flags2); + DebugPrintf("%s (%d)/%d,%d", _vm->globals()->getVocab(obj->_vocabList[i].vocabId), + obj->_vocabList[i].vocabId, obj->_vocabList[i].flags1, obj->_vocabList[i].flags2); } } DebugPrintf("\n"); diff --git a/engines/m4/console.h b/engines/m4/console.h index 53a47dada9..fc473b6464 100644 --- a/engines/m4/console.h +++ b/engines/m4/console.h @@ -18,9 +18,6 @@ * 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 M4_CONSOLE_H diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 46c4b35b79..4630d2e2d6 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -18,9 +18,6 @@ * 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/array.h" diff --git a/engines/m4/converse.h b/engines/m4/converse.h index 67ecf20424..b47e8d2a6b 100644 --- a/engines/m4/converse.h +++ b/engines/m4/converse.h @@ -18,9 +18,6 @@ * 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 M4_CONVERSE_H diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp index e0983e3327..1aefe3d02d 100644 --- a/engines/m4/detection.cpp +++ b/engines/m4/detection.cpp @@ -18,9 +18,6 @@ * 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 "base/plugins.h" @@ -417,7 +414,7 @@ public: M4MetaEngine() : AdvancedMetaEngine(detectionParams) {} virtual const char *getName() const { - return "MADS/M4 engine"; + return "MADS/M4"; } virtual const char *getOriginalCopyright() const { diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp index bc6228658d..afe2692753 100644 --- a/engines/m4/dialogs.cpp +++ b/engines/m4/dialogs.cpp @@ -18,9 +18,6 @@ * 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 "m4/dialogs.h" diff --git a/engines/m4/dialogs.h b/engines/m4/dialogs.h index 192ba5c23c..ea3519c9e3 100644 --- a/engines/m4/dialogs.h +++ b/engines/m4/dialogs.h @@ -18,9 +18,6 @@ * 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 M4_DIALOGS_H diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp index a9641eb542..f8225fba3e 100644 --- a/engines/m4/events.cpp +++ b/engines/m4/events.cpp @@ -18,9 +18,6 @@ * 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$ - * */ // TODO: There is a 'please_hyperwalk' variable that gets accessed that is meant to be global, but diff --git a/engines/m4/events.h b/engines/m4/events.h index 1c1418d5f8..6e7cf68555 100644 --- a/engines/m4/events.h +++ b/engines/m4/events.h @@ -18,9 +18,6 @@ * 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 M4_EVENTS_H diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp index 582fbaebc7..d4ba714d73 100644 --- a/engines/m4/font.cpp +++ b/engines/m4/font.cpp @@ -18,9 +18,6 @@ * 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 "m4/font.h" diff --git a/engines/m4/font.h b/engines/m4/font.h index 64e54f35b5..b00a393811 100644 --- a/engines/m4/font.h +++ b/engines/m4/font.h @@ -18,9 +18,6 @@ * 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 M4_FONT_H diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp index 3db9934cec..8787f89d04 100644 --- a/engines/m4/globals.cpp +++ b/engines/m4/globals.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -526,19 +523,23 @@ void MadsObject::load(Common::SeekableReadStream *stream) { stream->read(obj, 0x30); // Extract object data fields - descId = READ_LE_UINT16(&obj[0]); - roomNumber = READ_LE_UINT16(&obj[2]); - article = (MADSArticles)obj[4]; - vocabCount = obj[5] & 0x7f; + _descId = READ_LE_UINT16(&obj[0]); + _roomNumber = READ_LE_UINT16(&obj[2]); + _article = (MADSArticles)obj[4]; + _vocabCount = obj[5] & 0x7f; // Phantom / Dragon - if (vocabCount > 3) - warning("MadsObject::load(), vocab cound > 3 (it's %d)", vocabCount); + if (_vocabCount > 3) + warning("MadsObject::load(), vocab cound > 3 (it's %d)", _vocabCount); - for (int i = 0; i < vocabCount; ++i) { - vocabList[i].flags1 = obj[6 + i * 4]; - vocabList[i].flags2 = obj[7 + i * 4]; - vocabList[i].vocabId = READ_LE_UINT16(&obj[8 + i * 4]); + for (int i = 0; i < _vocabCount; ++i) { + _vocabList[i].flags1 = obj[6 + i * 4]; + _vocabList[i].flags2 = obj[7 + i * 4]; + _vocabList[i].vocabId = READ_LE_UINT16(&obj[8 + i * 4]); } } +void MadsObject::setRoom(int roomNumber) { + +} + } // End of namespace M4 diff --git a/engines/m4/globals.h b/engines/m4/globals.h index 2d90b7ba77..ae2941c169 100644 --- a/engines/m4/globals.h +++ b/engines/m4/globals.h @@ -18,9 +18,6 @@ * 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 M4_GLOBALS_H @@ -180,13 +177,14 @@ public: MadsObject() {} MadsObject(Common::SeekableReadStream *stream); void load(Common::SeekableReadStream *stream); - bool isInInventory() const { return roomNumber == PLAYER_INVENTORY; } - - uint16 descId; - uint16 roomNumber; - MADSArticles article; - uint8 vocabCount; - VocabEntry vocabList[3]; + bool isInInventory() const { return _roomNumber == PLAYER_INVENTORY; } + void setRoom(int roomNumber); + + uint16 _descId; + uint16 _roomNumber; + MADSArticles _article; + uint8 _vocabCount; + VocabEntry _vocabList[3]; }; typedef Common::Array<Common::SharedPtr<MadsObject> > MadsObjectArray; @@ -243,63 +241,6 @@ union DataMapEntry { typedef Common::HashMap<uint16, uint16> DataMapHash; -enum DataMapType {BOOL, UINT16, INT, INT_FN}; - -class DataMapWrapper { - friend class DataMap; -private: - DataMapEntry _value; - DataMapType _type; -public: - DataMapWrapper(bool *v) { _value.boolValue = v; _type = BOOL; } - DataMapWrapper(uint16 *v) { _value.uint16Value = v; _type = UINT16; } - DataMapWrapper(int16 *v) { _value.uint16Value = (uint16 *)v; _type = UINT16; } - DataMapWrapper(int *v) { _value.intValue = v; _type = INT; } - DataMapWrapper(IntFunctionPtr v) { _value.fnPtr = v; _type = INT_FN; } - - uint16 getIntValue() { - if (_type == BOOL) return *_value.boolValue ? 0xffff : 0; - else if (_type == UINT16) return *_value.uint16Value; - else if (_type == INT) return *_value.intValue; - else return _value.fnPtr(); - } - void setIntValue(uint16 v) { - if (_type == BOOL) *_value.boolValue = v != 0; - else if (_type == UINT16) *_value.uint16Value = v; - else if (_type == INT) *_value.intValue = v; - } -}; - -#define MAP_DATA(V) _madsVm->globals()->_dataMap.addMapping(new DataMapWrapper(V)) - -class DataMap { -private: - DataMapHash _data; - Common::Array<DataMapWrapper *> _mapList; -public: - DataMap() { - _mapList.push_back(NULL); - } - ~DataMap() { - for (uint i = 1; i < _mapList.size(); ++i) - delete _mapList[i]; - } - - void addMapping(DataMapWrapper *v) { _mapList.push_back(v); } - uint16 get(uint16 index) { - if (index < _mapList.size()) - return _mapList[index]->getIntValue(); - - return _data[index]; - } - void set(uint16 index, uint16 v) { - if (index < _mapList.size()) - _mapList[index]->setIntValue(v); - else - _data[index] = v; - } -}; - class MadsGlobals : public Globals { private: struct MessageItem { @@ -328,7 +269,7 @@ public: int previousScene; int16 _nextSceneId; uint16 actionNouns[3]; - DataMap _dataMap; + DataMapHash _dataMap; int _difficultyLevel; void loadMadsVocab(); diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 689a6ab8b4..786c975850 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -18,9 +18,6 @@ * 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/system.h" diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h index 96e81f746e..242857ba1a 100644 --- a/engines/m4/graphics.h +++ b/engines/m4/graphics.h @@ -18,9 +18,6 @@ * 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 M4_GRAPHICS_H diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp index 56cf96b589..6bedfa7e9b 100644 --- a/engines/m4/gui.cpp +++ b/engines/m4/gui.cpp @@ -18,9 +18,6 @@ * 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/events.h" diff --git a/engines/m4/gui.h b/engines/m4/gui.h index 7e1c8bf070..2b673d624c 100644 --- a/engines/m4/gui.h +++ b/engines/m4/gui.h @@ -18,9 +18,6 @@ * 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 M4_GUI_H @@ -446,7 +443,7 @@ public: GameInterfaceView(MadsM4Engine *vm, const Common::Rect &rect): View(vm, rect) {} ~GameInterfaceView() {} - virtual void initialise() {} + virtual void initialize() {} virtual void setSelectedObject(int objectNumber) {} virtual void addObjectToInventory(int objectNumber) {} }; diff --git a/engines/m4/hotspot.cpp b/engines/m4/hotspot.cpp index 500464dc09..a585a9af3d 100644 --- a/engines/m4/hotspot.cpp +++ b/engines/m4/hotspot.cpp @@ -18,9 +18,6 @@ * 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 "m4/m4.h" diff --git a/engines/m4/hotspot.h b/engines/m4/hotspot.h index f650d5ff54..86fe21bcab 100644 --- a/engines/m4/hotspot.h +++ b/engines/m4/hotspot.h @@ -18,9 +18,6 @@ * 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 M4_HOTSPOT_H diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index e88140cd26..93f5ab4cba 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -18,9 +18,6 @@ * 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$ - * */ //#define SCRIPT_TEST @@ -52,7 +49,6 @@ #include "common/error.h" #include "common/file.h" #include "common/fs.h" -#include "common/EventRecorder.h" #include "common/system.h" #include "common/config-manager.h" #include "common/debug-channels.h" @@ -180,8 +176,7 @@ Common::Error MadsM4Engine::run() { _script = new ScriptInterpreter(this); _ws = new WoodScript(this); //_callbacks = new Callbacks(this); - _random = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_random, "m4"); + _random = new Common::RandomSource("m4"); return Common::kNoError; } @@ -260,7 +255,7 @@ void MadsM4Engine::loadMenu(MenuType menuType, bool loadSaveFromHotkey, bool cal #define DUMP_BUFFER_SIZE 1024 -void MadsM4Engine::dumpFile(const char* filename, bool uncompress) { +void MadsM4Engine::dumpFile(const char *filename, bool uncompress) { Common::DumpFile f; byte buffer[DUMP_BUFFER_SIZE]; Common::SeekableReadStream *fileS = res()->get(filename); @@ -535,7 +530,7 @@ Common::Error MadsEngine::run() { //debugCN(kDebugCore, "%s\n----------\n", _globals->loadMessage(i)); if (getGameType() == GType_RexNebular) { - MadsGameLogic::initialiseGlobals(); + MadsGameLogic::initializeGlobals(); _scene = NULL; loadMenu(MAIN_MENU); diff --git a/engines/m4/m4.h b/engines/m4/m4.h index a43f3e1387..18c3936db8 100644 --- a/engines/m4/m4.h +++ b/engines/m4/m4.h @@ -18,9 +18,6 @@ * 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 M4_H @@ -168,7 +165,7 @@ public: ResourceManager *res() const { return _resourceManager; } MidiPlayer *midi() { return _midi; } Common::SaveFileManager *saveManager() { return _saveFileMan; } - void dumpFile(const char* filename, bool uncompress = false); + void dumpFile(const char *filename, bool uncompress); void eventHandler(); bool delay(int duration, bool keyAborts = true, bool clickAborts = true); void loadMenu(MenuType menuType, bool loadSaveFromHotkey = false, @@ -226,7 +223,7 @@ public: void startScene(int sceneNum) { if (!_scene) { _scene = new MadsScene(this); - ((MadsScene *)_scene)->initialise(); + ((MadsScene *)_scene)->initialize(); } _scene->show(); _scene->loadScene(101); diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp index a20bb2660b..787d8666f6 100644 --- a/engines/m4/m4_menus.cpp +++ b/engines/m4/m4_menus.cpp @@ -18,9 +18,6 @@ * 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/algorithm.h" // for find() diff --git a/engines/m4/m4_menus.h b/engines/m4/m4_menus.h index ecfd778c95..9abf71e9db 100644 --- a/engines/m4/m4_menus.h +++ b/engines/m4/m4_menus.h @@ -18,9 +18,6 @@ * 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 M4_M4_MENUS_H diff --git a/engines/m4/m4_scene.cpp b/engines/m4/m4_scene.cpp index a0d8a503ab..1a2e00e50d 100644 --- a/engines/m4/m4_scene.cpp +++ b/engines/m4/m4_scene.cpp @@ -18,9 +18,6 @@ * 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/system.h" diff --git a/engines/m4/m4_scene.h b/engines/m4/m4_scene.h index 9c2edbc06c..a0ba497cf7 100644 --- a/engines/m4/m4_scene.h +++ b/engines/m4/m4_scene.h @@ -18,9 +18,6 @@ * 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 M4_M4_SCENE_H diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp index 83f23edd3d..4eb84a7488 100644 --- a/engines/m4/m4_views.cpp +++ b/engines/m4/m4_views.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" diff --git a/engines/m4/m4_views.h b/engines/m4/m4_views.h index e390904aae..4ca2a74593 100644 --- a/engines/m4/m4_views.h +++ b/engines/m4/m4_views.h @@ -18,9 +18,6 @@ * 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 M4_M4_VIEWS_H diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index e7ca9cb14d..d35b31943a 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -606,7 +603,7 @@ static bool tempFlag = true;//****DEBUG - Temporarily allow me to skip several i flags |= 0x100; _activeAnimation = new MadsAnimation(_vm, this); - _activeAnimation->initialise(_currentLine, flags, &_backgroundSurface, &_codeSurface); + _activeAnimation->initialize(_currentLine, flags, &_backgroundSurface, &_codeSurface); if (_startFrame != -1) _activeAnimation->setCurrentFrame(_startFrame); diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index b33ea24071..411d575d59 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -18,9 +18,6 @@ * 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 M4_MADS_ANIM_H diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp index 98a0d06412..b1e57bd7f3 100644 --- a/engines/m4/mads_logic.cpp +++ b/engines/m4/mads_logic.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -34,7 +31,7 @@ namespace M4 { -void MadsGameLogic::initialiseGlobals() { +void MadsGameLogic::initializeGlobals() { // Clear the entire globals list Common::set_to(&_madsVm->globals()->_globals[0], &_madsVm->globals()->_globals[TOTAL_NUM_VARIABLES], 0); @@ -172,25 +169,81 @@ const char *MadsSceneLogic::_opcodeStrings[] = { * This method sets up the data map with pointers to all the common game objects. This allows the script engine to * convert game specific offsets for various fields in the original game's data segment into a generic data index * that will be common across all the MADS games - */ -void MadsSceneLogic::initialiseDataMap() { + +void MadsSceneLogic::initializeDataMap() { // The unique order of these items must be maintained - MAP_DATA((uint16 *)&_madsVm->scene()->_abortTimersMode2); - MAP_DATA(&_madsVm->scene()->_abortTimers); - MAP_DATA(&_madsVm->_player._stepEnabled); - MAP_DATA(&_madsVm->scene()->_nextScene); - MAP_DATA(&_madsVm->scene()->_previousScene); - MAP_DATA(&_madsVm->_player._playerPos.x); - MAP_DATA(&_madsVm->_player._playerPos.y); - MAP_DATA(&_madsVm->_player._direction); - MAP_DATA(&_madsVm->_player._visible); - MAP_DATA(&getActiveAnimationBool); - MAP_DATA(&getAnimationCurrentFrame); +} +*/ +uint32 MadsSceneLogic::getDataValue(int dataId) { + switch (dataId) { + case 1: + return _madsVm->scene()->_abortTimersMode2; + case 2: + return _madsVm->scene()->_abortTimers; + case 3: + return _madsVm->_player._stepEnabled ? 0xffff : 0; + case 4: + return _madsVm->scene()->_nextScene; + case 5: + return _madsVm->scene()->_previousScene; + case 6: + return _madsVm->_player._playerPos.x; + case 7: + return _madsVm->_player._playerPos.y; + case 8: + return _madsVm->_player._direction; + case 9: + return _madsVm->_player._visible ? 0xffff : 0; + case 10: + return getActiveAnimationBool(); + case 11: + return getAnimationCurrentFrame(); + default: + // All other data variables get stored in the hash table + return _madsVm->globals()->_dataMap[dataId]; + break; + } } -DataMap &MadsSceneLogic::dataMap() { - return _madsVm->globals()->_dataMap; +void MadsSceneLogic::setDataValue(int dataId, uint16 dataValue) { + switch (dataId) { + case 1: + _madsVm->scene()->_abortTimersMode2 = (AbortTimerMode)dataValue; + break; + case 2: + _madsVm->scene()->_abortTimers = dataValue; + break; + case 3: + _madsVm->_player._stepEnabled = dataValue != 0; + break; + case 4: + _madsVm->scene()->_nextScene = dataValue; + break; + case 5: + _madsVm->scene()->_previousScene = dataValue; + break; + case 6: + _madsVm->_player._playerPos.x = dataValue; + break; + case 7: + _madsVm->_player._playerPos.y = dataValue; + break; + case 8: + _madsVm->_player._direction = dataValue; + break; + case 9: + _madsVm->_player._visible = dataValue != 0; + break; + case 10: + case 11: + error("Tried to set read only data field %d", dataId); + break; + default: + // All other data variables get stored in the hash table + _madsVm->globals()->_dataMap[dataId] = dataValue; + break; + } } const char *MadsSceneLogic::formAnimName(char sepChar, int16 suffixNum) { @@ -329,7 +382,7 @@ void MadsSceneLogic::getPlayerSpritesPrefix2() { /** * Loads the MADS.DAT file and loads the script data for the correct game/language */ -void MadsSceneLogic::initialiseScripts() { +void MadsSceneLogic::initializeScripts() { Common::File f; if (!f.open("mads.dat")) { warning("Could not locate mads.dat file"); @@ -534,7 +587,7 @@ void MadsSceneLogic::execute(uint32 subOffset) { case OP_DLOAD: { // Gets data variable param = getParam(scriptOffset, opcode); - uint16 v = dataMap().get(param); + uint16 v = getDataValue(param); stack.push(ScriptVar(v)); break; } @@ -542,7 +595,7 @@ void MadsSceneLogic::execute(uint32 subOffset) { case OP_DSTORE: { // Stores data variable param = getParam(scriptOffset, opcode); ScriptVar v = stack.pop(); - dataMap().set(param, v.isInt() ? v.get() : 0); + setDataValue(param, v.isInt() ? v.get() : 0); break; } @@ -898,7 +951,7 @@ void MadsSceneLogic::callSubroutine(int subIndex, Common::Stack<ScriptVar> &stac // object_is_present EXTRACT_PARAMS(1); const MadsObject *obj = _madsVm->globals()->getObject(p[0]); - stack.push(ScriptVar((obj->roomNumber == _madsVm->scene()->_currentScene))); + stack.push(ScriptVar((obj->_roomNumber == _madsVm->scene()->_currentScene))); break; } @@ -925,6 +978,14 @@ void MadsSceneLogic::callSubroutine(int subIndex, Common::Stack<ScriptVar> &stac break; } + case 26: { + // object_set_room + EXTRACT_PARAMS(2); + MadsObject *obj = _madsVm->globals()->getObject(p[0]); + obj->setRoom(p[1]); + break; + } + default: error("Unknown subroutine %d called", subIndex); break; diff --git a/engines/m4/mads_logic.h b/engines/m4/mads_logic.h index adafe6f93d..3132094252 100644 --- a/engines/m4/mads_logic.h +++ b/engines/m4/mads_logic.h @@ -18,9 +18,6 @@ * 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$ - * * The MADS game logic is all hard-coded into the games, although for Rex at least * it seems to use only a fairly basic set of instructions and function calls, so it should be * possible @@ -88,14 +85,14 @@ private: void getSceneSpriteSet(); void getAnimName(); - DataMap &dataMap(); + uint32 getDataValue(int dataId); + void setDataValue(int dataId, uint16 dataValue); void getCallParameters(int numParams, Common::Stack<ScriptVar> &stack, ScriptVar *callParams); public: MadsSceneLogic() { _scriptsData = NULL; } ~MadsSceneLogic() { delete _scriptsData; } - void initialiseScripts(); - void initialiseDataMap(); + void initializeScripts(); void selectScene(int sceneNum); void setupScene(); @@ -112,7 +109,7 @@ public: class MadsGameLogic { public: - static void initialiseGlobals(); + static void initializeGlobals(); }; } diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp index 437e9d2a6b..fa65329d76 100644 --- a/engines/m4/mads_menus.cpp +++ b/engines/m4/mads_menus.cpp @@ -18,9 +18,6 @@ * 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/textconsole.h" @@ -599,18 +596,18 @@ RexDialogView::RexDialogView(): View(_madsVm, Common::Rect(0, 0, _madsVm->_scree MadsView(this) { _screenType = VIEWID_MENU; - // Initialise class variables + // Initialize class variables _priorSceneId = _madsVm->_scene->getCurrentScene(); _dialogType = DIALOG_NONE; // Load necessary quotes _madsVm->globals()->loadQuoteRange(1, 48); - initialiseLines(); - initialiseGraphics(); + initializeLines(); + initializeGraphics(); } -void RexDialogView::initialiseLines() { +void RexDialogView::initializeLines() { // Set up a list of blank entries for use in the various dialogs for (int i = 0; i < DIALOG_LINES_SIZE; ++i) { DialogTextEntry rec; @@ -625,7 +622,7 @@ void RexDialogView::initialiseLines() { _spriteSlots[0].seqIndex = -1; } -void RexDialogView::initialiseGraphics() { +void RexDialogView::initializeGraphics() { // Set needed palette entries _madsVm->_palette->blockRange(0, 16); _madsVm->_palette->setEntry(10, 0, 255, 0); diff --git a/engines/m4/mads_menus.h b/engines/m4/mads_menus.h index a0fc6fb3bc..4d3ea5da39 100644 --- a/engines/m4/mads_menus.h +++ b/engines/m4/mads_menus.h @@ -18,9 +18,6 @@ * 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 M4_MADS_MENUS_H @@ -120,8 +117,8 @@ class RexDialogView : public View, public MadsView { private: int _priorSceneId; - void initialiseLines(); - void initialiseGraphics(); + void initializeLines(); + void initializeGraphics(); void loadBackground(); void loadMenuSprites(); protected: diff --git a/engines/m4/mads_player.cpp b/engines/m4/mads_player.cpp index de09e97640..0b83b54ff5 100644 --- a/engines/m4/mads_player.cpp +++ b/engines/m4/mads_player.cpp @@ -18,9 +18,6 @@ * 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 "m4/m4.h" diff --git a/engines/m4/mads_player.h b/engines/m4/mads_player.h index 6a9b7b4ca1..bbeefaf3d5 100644 --- a/engines/m4/mads_player.h +++ b/engines/m4/mads_player.h @@ -18,9 +18,6 @@ * 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 M4_MADS_PLAYER_H diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index 7b82480ee2..a0acbdd69d 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -18,9 +18,6 @@ * 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/system.h" @@ -97,12 +94,12 @@ void MadsScene::loadScene2(const char *aaName, int sceneNumber) { // Load scene walk paths loadSceneCodes(_currentScene); - // Initialise the scene animation + // Initialize the scene animation uint16 flags = 0x4100; if (_madsVm->globals()->_config.textWindowStill) flags |= 0x200; - _sceneAnimation->initialise(aaName, flags, _interfaceSurface, NULL); + _sceneAnimation->initialize(aaName, flags, _interfaceSurface, NULL); } /** @@ -116,7 +113,7 @@ void MadsScene::loadSceneTemporary() { {0x00<<2, 0x10<<2, 0x16<<2}}; _vm->_palette->setPalette(&sysColors[0], 4, 3); - _interfaceSurface->initialise(); + _interfaceSurface->initialize(); loadSceneHotspots(_currentScene); @@ -431,7 +428,29 @@ void MadsScene::doSceneStep() { } void MadsScene::doAction() { - warning("TODO MadsScene::doAction"); + AbortTimerMode mode = ABORTMODE_0; + _abortTimersMode2 = mode; + + if ((_action._inProgress || (_abortTimers != 0)) && !_action._v8453A) { + _sceneLogic.doAction(); + mode = _action._inProgress ? ABORTMODE_0 : ABORTMODE_1; + } + + if (_screenObjects._v832EC) + _action._inProgress = false; + else { + if ((_action._inProgress || (_abortTimers != 0)) && (mode == ABORTMODE_0) && (_action._v8453A == mode)) { + // TODO: sound_fn_p(); + mode = _action._inProgress ? ABORTMODE_0 : ABORTMODE_1; + + } + + if ((_action._inProgress || (_abortTimers != 0)) && (mode == ABORTMODE_0) && (_action._v8453A == mode)) { + // Perform a core scene-indepedant action on an object + // object_do_action + } + } + } @@ -599,7 +618,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su char buffer1[80]; const char *sceneName; - // TODO: Initialise spriteSet / xp_list + // TODO: Initialize spriteSet / xp_list if (sceneNumber > 0) { sceneName = MADSResourceManager::getResourceName(RESPREFIX_RM, sceneNumber, ".DAT"); @@ -671,7 +690,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su delete stream; - // Initialise a copy of the surfaces if they weren't provided + // Initialize a copy of the surfaces if they weren't provided bool dsFlag = false, ssFlag = false; if (!surface) { surface = new M4Surface(_width, _height); @@ -867,13 +886,13 @@ void MadsInterfaceView::setFontMode(InterfaceFontMode newMode) { } } -void MadsInterfaceView::initialise() { +void MadsInterfaceView::initialize() { // Build up the inventory list _inventoryList.clear(); for (uint i = 0; i < _madsVm->globals()->getObjectsSize(); ++i) { MadsObject *obj = _madsVm->globals()->getObject(i); - if (obj->roomNumber == PLAYER_INVENTORY) + if (obj->_roomNumber == PLAYER_INVENTORY) _inventoryList.push_back(i); } @@ -922,7 +941,7 @@ void MadsInterfaceView::setSelectedObject(int objectNumber) { void MadsInterfaceView::addObjectToInventory(int objectNumber) { if (_inventoryList.indexOf(objectNumber) == -1) { - _madsVm->globals()->getObject(objectNumber)->roomNumber = PLAYER_INVENTORY; + _madsVm->globals()->getObject(objectNumber)->_roomNumber = PLAYER_INVENTORY; _inventoryList.push_back(objectNumber); } @@ -975,7 +994,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { break; const char *descStr = _madsVm->globals()->getVocab(_madsVm->globals()->getObject( - _inventoryList[_topIndex + i])->descId); + _inventoryList[_topIndex + i])->_descId); strcpy(buffer, descStr); if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A'; @@ -1005,13 +1024,13 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { // List the vocab actions for the currently selected object MadsObject *obj = _madsVm->globals()->getObject(_selectedObject); - int yIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1); + int yIndex = MIN(_highlightedElement - VOCAB_START, obj->_vocabCount - 1); - for (int i = 0; i < obj->vocabCount; ++i) { + for (int i = 0; i < obj->_vocabCount; ++i) { const Common::Rect r(_screenObjects[VOCAB_START + i]); // Get the vocab description and capitalise it - const char *descStr = _madsVm->globals()->getVocab(obj->vocabList[i].vocabId); + const char *descStr = _madsVm->globals()->getVocab(obj->_vocabList[i].vocabId); strcpy(buffer, descStr); if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A'; @@ -1063,12 +1082,12 @@ bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int } else if ((_highlightedElement >= VOCAB_START) && (_highlightedElement < (VOCAB_START + 5))) { // A vocab action was selected MadsObject *obj = _madsVm->globals()->getObject(_selectedObject); - int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1); + int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->_vocabCount - 1); if (vocabIndex >= 0) { act._actionMode = ACTMODE_OBJECT; act._actionMode2 = ACTMODE2_2; - act._flags1 = obj->vocabList[1].flags1; - act._flags2 = obj->vocabList[1].flags2; + act._flags1 = obj->_vocabList[1].flags1; + act._flags2 = obj->_vocabList[1].flags2; act._action.verbId = _selectedObject; act._articleNumber = act._flags2; diff --git a/engines/m4/mads_scene.h b/engines/m4/mads_scene.h index 743719d954..9835de4daf 100644 --- a/engines/m4/mads_scene.h +++ b/engines/m4/mads_scene.h @@ -18,9 +18,6 @@ * 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 M4_MADS_SCENE_H @@ -111,9 +108,8 @@ public: public: MadsScene(MadsEngine *vm); virtual ~MadsScene(); - void initialise() { - _sceneLogic.initialiseScripts(); - _sceneLogic.initialiseDataMap(); + void initialize() { + _sceneLogic.initializeScripts(); } // Methods that differ between engines @@ -181,7 +177,7 @@ public: MadsInterfaceView(MadsM4Engine *vm); ~MadsInterfaceView(); - virtual void initialise(); + virtual void initialize(); virtual void setSelectedObject(int objectNumber); virtual void addObjectToInventory(int objectNumber); int getSelectedObject() { return _selectedObject; } diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp index 33c679c9bd..b66591a207 100644 --- a/engines/m4/mads_views.cpp +++ b/engines/m4/mads_views.cpp @@ -18,9 +18,6 @@ * 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 "m4/m4_views.h" @@ -103,8 +100,8 @@ void MadsAction::set() { int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); - _action.objectNameId = objEntry->descId; - _currentAction = objEntry->vocabList[_selectedRow].vocabId; + _action.objectNameId = objEntry->_descId; + _currentAction = objEntry->_vocabList[_selectedRow].vocabId; // Set up the status text stirng strcpy(_statusText, useStr); @@ -122,7 +119,7 @@ void MadsAction::set() { int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); - _currentAction = objEntry->vocabList[_selectedRow].vocabId; + _currentAction = objEntry->_vocabList[_selectedRow].vocabId; } appendVocab(_currentAction, true); @@ -168,7 +165,7 @@ void MadsAction::set() { if ((_actionMode2 == ACTMODE2_2) || (_actionMode2 == ACTMODE2_5)) { // Get name from given inventory object int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); - _action.objectNameId = _madsVm->globals()->getObject(objectId)->descId; + _action.objectNameId = _madsVm->globals()->getObject(objectId)->_descId; } else if (_hotspotId < hotspotCount) { // Get name from scene hotspot _action.objectNameId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVocabID(); @@ -187,7 +184,7 @@ void MadsAction::set() { if ((_v86F42 == 2) || (_v86F42 == 5)) { int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); - articleNum = _madsVm->globals()->getObject(objectId)->article; + articleNum = _madsVm->globals()->getObject(objectId)->_article; } else if (_v86F3A < hotspotCount) { articleNum = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getArticle(); } else { @@ -259,7 +256,7 @@ void MadsAction::startAction() { _madsVm->_player.moveComplete(); _inProgress = true; - _v8453A = 0; + _v8453A = ABORTMODE_0; _savedFields.selectedRow = _selectedRow; _savedFields.articleNumber = _articleNumber; _savedFields.actionMode = _actionMode; @@ -274,7 +271,7 @@ void MadsAction::startAction() { strcpy(_dialogTitle, _statusText); if ((_savedFields.actionMode2 == ACTMODE2_4) && (savedV86F42 == 0)) - _v8453A = true; + _v8453A = ABORTMODE_1; _startWalkFlag = false; int hotspotId = -1; diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h index ce5ba9c4e5..6be2283a32 100644 --- a/engines/m4/mads_views.h +++ b/engines/m4/mads_views.h @@ -18,9 +18,6 @@ * 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 M4_MADS_VIEWS_H @@ -37,7 +34,8 @@ namespace M4 { class MadsView; enum MadsActionMode {ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6}; -enum MAdsActionMode2 {ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5}; +enum MadsActionMode2 {ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5}; +enum AbortTimerMode {ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2}; struct ActionDetails { int verbId; @@ -65,7 +63,7 @@ public: int _currentAction; int8 _flags1, _flags2; MadsActionMode _actionMode; - MAdsActionMode2 _actionMode2; + MadsActionMode2 _actionMode2; int _articleNumber; bool _lookFlag; int _selectedRow; @@ -85,7 +83,7 @@ public: int16 _v86F4C; int _v83338; bool _inProgress; - bool _v8453A; + AbortTimerMode _v8453A; public: MadsAction(MadsView &owner); @@ -99,8 +97,6 @@ public: bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); }; -enum AbortTimerMode {ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2}; - class SpriteSlotSubset { public: int spriteListIndex; @@ -450,7 +446,7 @@ protected: public: Animation(MadsM4Engine *vm); virtual ~Animation(); - virtual void initialise(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) = 0; + virtual void initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) = 0; virtual void load(const Common::String &filename, int v0) = 0; virtual void update() = 0; virtual void setCurrentFrame(int frameNumber) = 0; diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp index 24ac60c22e..bfe77828da 100644 --- a/engines/m4/midi.cpp +++ b/engines/m4/midi.cpp @@ -18,9 +18,6 @@ * 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$ - * */ // FIXME: This is cribbed together from the SAGA music player. It needs cleanup diff --git a/engines/m4/midi.h b/engines/m4/midi.h index a544fb72aa..6eef907ce3 100644 --- a/engines/m4/midi.h +++ b/engines/m4/midi.h @@ -18,9 +18,6 @@ * 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$ - * */ // Music class diff --git a/engines/m4/rails.cpp b/engines/m4/rails.cpp index 39cba9ab84..f51d81c8f4 100644 --- a/engines/m4/rails.cpp +++ b/engines/m4/rails.cpp @@ -18,9 +18,6 @@ * 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$ - * */ /* @@ -64,9 +61,7 @@ void Rails::clearRails() { delete tempNode; } - for (i = 0; i < _edges.size(); i++) { - _edges.remove_at(i); - } + _edges.clear(); for (j = _noWalkRects.begin(); j != _noWalkRects.end(); ++j) delete (*j); @@ -249,7 +244,7 @@ void Rails::createEdge(int32 node1, int32 node2) { } else { distance = SqrtF16(FixedMul(deltaX, deltaX) + FixedMul(deltaY, deltaY)) << 8; } - _edges.insert_at(index, (int16*)(distance >> 16)); + _edges.insert_at(index, distance >> 16); } debugCN(kDebugCore, "node1 = %d, node2 = %d, valid = %d\n", node1, node2, valid); @@ -315,7 +310,7 @@ int16 Rails::getEdgeLength(int32 node1, int32 node2) { // Find the table entry i.e. tableWidth * node1 + node2 and then subtract // n(n+1)/2, since only the upper triangle of the table is stored index = (MAXRAILNODES-1)*node1 + node2 - 1 - (node1*(node1+1)>>1); - return *_edges[index]; + return _edges[index]; } void Rails::disposePath(RailNode *pathStart) { diff --git a/engines/m4/rails.h b/engines/m4/rails.h index e3183c243f..80bb55e9de 100644 --- a/engines/m4/rails.h +++ b/engines/m4/rails.h @@ -18,9 +18,6 @@ * 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 M4_RAILS_H @@ -76,7 +73,7 @@ public: private: Common::Array<RailNode *> _nodes; - Common::Array<int16 *> _edges; + Common::Array<int16> _edges; Common::List<NoWalkRect *> _noWalkRects; M4Surface *_walkCodes; diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp index 1946797f75..2ae29ca0bb 100644 --- a/engines/m4/resource.cpp +++ b/engines/m4/resource.cpp @@ -18,9 +18,6 @@ * 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 "m4/m4.h" diff --git a/engines/m4/resource.h b/engines/m4/resource.h index eed6e6dcd9..00c54a3680 100644 --- a/engines/m4/resource.h +++ b/engines/m4/resource.h @@ -18,9 +18,6 @@ * 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 M4_RESOURCE_H diff --git a/engines/m4/saveload.cpp b/engines/m4/saveload.cpp index 85f0ee9947..aa35385bfe 100644 --- a/engines/m4/saveload.cpp +++ b/engines/m4/saveload.cpp @@ -18,9 +18,6 @@ * 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/file.h" diff --git a/engines/m4/saveload.h b/engines/m4/saveload.h index 132cb93f00..9b76054e65 100644 --- a/engines/m4/saveload.h +++ b/engines/m4/saveload.h @@ -18,9 +18,6 @@ * 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 M4_SAVELOAD_H diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp index c0cbd879b2..a38be20086 100644 --- a/engines/m4/scene.cpp +++ b/engines/m4/scene.cpp @@ -18,9 +18,6 @@ * 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/system.h" diff --git a/engines/m4/scene.h b/engines/m4/scene.h index e0b28e6454..5086cc0db0 100644 --- a/engines/m4/scene.h +++ b/engines/m4/scene.h @@ -18,9 +18,6 @@ * 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 M4_SCENE_H diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp index cc60ec310d..026c025f45 100644 --- a/engines/m4/script.cpp +++ b/engines/m4/script.cpp @@ -18,9 +18,6 @@ * 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/system.h" diff --git a/engines/m4/script.h b/engines/m4/script.h index 32b5701419..22f07fd062 100644 --- a/engines/m4/script.h +++ b/engines/m4/script.h @@ -18,9 +18,6 @@ * 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 M4_SCRIPT_H diff --git a/engines/m4/sound.cpp b/engines/m4/sound.cpp index fb90cea5cc..d10dea5cad 100644 --- a/engines/m4/sound.cpp +++ b/engines/m4/sound.cpp @@ -18,9 +18,6 @@ * 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 "m4/m4.h" diff --git a/engines/m4/sound.h b/engines/m4/sound.h index 8962e67dfd..99a2292d83 100644 --- a/engines/m4/sound.h +++ b/engines/m4/sound.h @@ -18,9 +18,6 @@ * 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$ - * */ // Sound class diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp index cef9917381..1a3228d1bb 100644 --- a/engines/m4/sprite.cpp +++ b/engines/m4/sprite.cpp @@ -18,9 +18,6 @@ * 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/rect.h" diff --git a/engines/m4/sprite.h b/engines/m4/sprite.h index d4e5502efd..af49d8cbaf 100644 --- a/engines/m4/sprite.h +++ b/engines/m4/sprite.h @@ -18,9 +18,6 @@ * 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 M4_SPRITE_H diff --git a/engines/m4/staticres.cpp b/engines/m4/staticres.cpp index fc49998adb..520c0ad58e 100644 --- a/engines/m4/staticres.cpp +++ b/engines/m4/staticres.cpp @@ -18,9 +18,6 @@ * 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 "m4/staticres.h" diff --git a/engines/m4/staticres.h b/engines/m4/staticres.h index 80fc69fc80..e3ead3398b 100644 --- a/engines/m4/staticres.h +++ b/engines/m4/staticres.h @@ -18,9 +18,6 @@ * 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 M4_STATICRES_H diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp index 46b4b5af9d..8eb40f0f17 100644 --- a/engines/m4/viewmgr.cpp +++ b/engines/m4/viewmgr.cpp @@ -18,9 +18,6 @@ * 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$ - * */ // TODO: Views have a _coords rect, so I'm not sure if x/y is needed in the onRefresh diff --git a/engines/m4/viewmgr.h b/engines/m4/viewmgr.h index 211e6087f4..bb4f76cfaa 100644 --- a/engines/m4/viewmgr.h +++ b/engines/m4/viewmgr.h @@ -18,9 +18,6 @@ * 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 M4_VIEWMGR_H diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index dc24548f84..42f4fbce98 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -18,9 +18,6 @@ * 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 "m4/woodscript.h" diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h index a9a884a4b0..95033b9179 100644 --- a/engines/m4/woodscript.h +++ b/engines/m4/woodscript.h @@ -18,9 +18,6 @@ * 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 M4_WOODSCRIPT_H diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp index 3a25e3c622..18a8af76a8 100644 --- a/engines/m4/ws_machine.cpp +++ b/engines/m4/ws_machine.cpp @@ -18,9 +18,6 @@ * 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 "m4/woodscript.h" diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp index 3ee496da0d..01776ef6ec 100644 --- a/engines/m4/ws_sequence.cpp +++ b/engines/m4/ws_sequence.cpp @@ -18,9 +18,6 @@ * 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 "m4/woodscript.h" |