[Scummvm-cvs-logs] SF.net SVN: scummvm:[47705] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Jan 30 10:21:07 CET 2010


Revision: 47705
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47705&view=rev
Author:   dreammaster
Date:     2010-01-30 09:21:07 +0000 (Sat, 30 Jan 2010)

Log Message:
-----------
Beginnings of a separation of the MADS and M4 engines into separate classes. This will be cleaner then having checks everywhere for whether the game mode is MADS or M4.

Modified Paths:
--------------
    scummvm/trunk/engines/m4/actor.cpp
    scummvm/trunk/engines/m4/actor.h
    scummvm/trunk/engines/m4/animation.cpp
    scummvm/trunk/engines/m4/animation.h
    scummvm/trunk/engines/m4/assets.cpp
    scummvm/trunk/engines/m4/assets.h
    scummvm/trunk/engines/m4/compression.cpp
    scummvm/trunk/engines/m4/compression.h
    scummvm/trunk/engines/m4/console.cpp
    scummvm/trunk/engines/m4/console.h
    scummvm/trunk/engines/m4/converse.cpp
    scummvm/trunk/engines/m4/converse.h
    scummvm/trunk/engines/m4/detection.cpp
    scummvm/trunk/engines/m4/dialogs.cpp
    scummvm/trunk/engines/m4/dialogs.h
    scummvm/trunk/engines/m4/events.cpp
    scummvm/trunk/engines/m4/events.h
    scummvm/trunk/engines/m4/font.cpp
    scummvm/trunk/engines/m4/font.h
    scummvm/trunk/engines/m4/globals.cpp
    scummvm/trunk/engines/m4/globals.h
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/graphics.h
    scummvm/trunk/engines/m4/gui.cpp
    scummvm/trunk/engines/m4/gui.h
    scummvm/trunk/engines/m4/hotspot.cpp
    scummvm/trunk/engines/m4/m4.cpp
    scummvm/trunk/engines/m4/m4.h
    scummvm/trunk/engines/m4/m4_menus.cpp
    scummvm/trunk/engines/m4/m4_menus.h
    scummvm/trunk/engines/m4/m4_views.cpp
    scummvm/trunk/engines/m4/m4_views.h
    scummvm/trunk/engines/m4/mads_anim.cpp
    scummvm/trunk/engines/m4/mads_anim.h
    scummvm/trunk/engines/m4/mads_menus.cpp
    scummvm/trunk/engines/m4/mads_menus.h
    scummvm/trunk/engines/m4/midi.cpp
    scummvm/trunk/engines/m4/midi.h
    scummvm/trunk/engines/m4/resource.cpp
    scummvm/trunk/engines/m4/resource.h
    scummvm/trunk/engines/m4/saveload.cpp
    scummvm/trunk/engines/m4/saveload.h
    scummvm/trunk/engines/m4/scene.cpp
    scummvm/trunk/engines/m4/scene.h
    scummvm/trunk/engines/m4/script.cpp
    scummvm/trunk/engines/m4/script.h
    scummvm/trunk/engines/m4/sound.cpp
    scummvm/trunk/engines/m4/sound.h
    scummvm/trunk/engines/m4/sprite.h
    scummvm/trunk/engines/m4/viewmgr.cpp
    scummvm/trunk/engines/m4/viewmgr.h
    scummvm/trunk/engines/m4/woodscript.cpp
    scummvm/trunk/engines/m4/woodscript.h

Modified: scummvm/trunk/engines/m4/actor.cpp
===================================================================
--- scummvm/trunk/engines/m4/actor.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/actor.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -33,7 +33,7 @@
 
 #define WALKER_BURGER "Wilbur0%i"	// wilbur, with a number denoting his current direction
 
-Actor::Actor(M4Engine *vm) : _vm(vm) {
+Actor::Actor(MadsM4Engine *vm) : _vm(vm) {
 	_scaling = 100;
 	_direction = 5;
 	_walkerSprites.resize(10);
@@ -104,7 +104,7 @@
 							  _walkerSprites[kFacingSouthEast]->getColorCount());
 }
 
-Inventory::Inventory(M4Engine *vm) : _vm(vm) {
+Inventory::Inventory(MadsM4Engine *vm) : _vm(vm) {
 }
 
 Inventory::~Inventory() {

Modified: scummvm/trunk/engines/m4/actor.h
===================================================================
--- scummvm/trunk/engines/m4/actor.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/actor.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -61,7 +61,7 @@
 
 class Actor {
 public:
-	Actor(M4Engine *vm);
+	Actor(MadsM4Engine *vm);
 	~Actor();
 	void placeWalkerSpriteAt(int spriteNum, int x, int y);
 	void setWalkerScaling(int scaling) { _scaling = scaling; }
@@ -72,7 +72,7 @@
 	int getWalkerWidth();
 	int getWalkerHeight();
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	int _scaling;
 	uint8 _direction;
 	Common::Array<SpriteAsset*> _walkerSprites;
@@ -90,7 +90,7 @@
 // the normal strcmp method instead
 class Inventory {
 public:
-	Inventory(M4Engine *vm);
+	Inventory(MadsM4Engine *vm);
 	~Inventory();
 	void clear();
 	void registerObject(char* name, int32 scene, int32 icon);
@@ -107,7 +107,7 @@
 	int getTotalItems() { return _inventory.size(); }
 
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::Array<InventoryObject *> _inventory;
 };
 

Modified: scummvm/trunk/engines/m4/animation.cpp
===================================================================
--- scummvm/trunk/engines/m4/animation.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/animation.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -31,7 +31,7 @@
 
 // TODO: this code needs cleanup
 
-Animation::Animation(M4Engine *vm) {
+Animation::Animation(MadsM4Engine *vm) {
 	_vm = vm;
 	_playing = false;
 }

Modified: scummvm/trunk/engines/m4/animation.h
===================================================================
--- scummvm/trunk/engines/m4/animation.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/animation.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -43,7 +43,7 @@
 
 class Animation {
     public:
-		Animation(M4Engine *vm);
+		Animation(MadsM4Engine *vm);
         ~Animation();
 
         void load(const char *filename);
@@ -54,7 +54,7 @@
 
     private:
 		bool _playing;
-		M4Engine *_vm;
+		MadsM4Engine *_vm;
         int _seriesCount;
         int _frameCount;
         int _frameEntryCount;

Modified: scummvm/trunk/engines/m4/assets.cpp
===================================================================
--- scummvm/trunk/engines/m4/assets.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/assets.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -29,13 +29,13 @@
 
 namespace M4 {
 
-BaseAsset::BaseAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : _vm(vm) {
+BaseAsset::BaseAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : _vm(vm) {
 }
 
 BaseAsset::~BaseAsset() {
 }
 
-MachineAsset::MachineAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
+MachineAsset::MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
 	uint32 stateCount = stream->readUint32LE();
 	for (uint32 curState = 0; curState < stateCount; curState++) {
 		uint32 stateOffset = stream->readUint32LE();
@@ -60,7 +60,7 @@
 	return _stateTable[state];
 }
 
-SequenceAsset::SequenceAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
+SequenceAsset::SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
 	_localVarCount = stream->readUint32LE();
 	_codeSize = size - 4;
 	_code = new byte[_codeSize];
@@ -77,7 +77,7 @@
 }
 
 
-DataAsset::DataAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
+DataAsset::DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) {
 
 	_recCount = stream->readUint32LE();
 	_recSize = stream->readUint32LE();
@@ -97,7 +97,7 @@
 	return &_data[_recSize * index];
 }
 
-SpriteAsset::SpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream) : BaseAsset(vm, stream, size, name) {
+SpriteAsset::SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream) : BaseAsset(vm, stream, size, name) {
 	_stream = stream;
 
 	if (_vm->isM4()) {
@@ -107,7 +107,7 @@
 	}
 }
 
-void SpriteAsset::loadM4SpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream, bool asStream) {
+void SpriteAsset::loadM4SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, bool asStream) {
 	bool isBigEndian = false;
 	uint32 frameOffset;
 
@@ -169,7 +169,7 @@
 
 }
 
-void SpriteAsset::loadMadsSpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream) {
+void SpriteAsset::loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream) {
 	int curFrame = 0;
 	uint32 frameOffset = 0;
 	MadsPack sprite(stream);
@@ -335,7 +335,7 @@
 	return _frameOffsets[index + 1] - _frameOffsets[index];
 }
 
-AssetManager::AssetManager(M4Engine *vm) {
+AssetManager::AssetManager(MadsM4Engine *vm) {
 
 	_vm = vm;
 

Modified: scummvm/trunk/engines/m4/assets.h
===================================================================
--- scummvm/trunk/engines/m4/assets.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/assets.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -44,21 +44,21 @@
 #define CELS__PAL MKID_BE(' PAL')	//' PAL'
 #define CELS___SS MKID_BE('  SS')	//'  SS'
 
-class M4Engine;
+class MadsM4Engine;
 
 class BaseAsset {
 public:
-	BaseAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
+	BaseAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
 	~BaseAsset();
 	const Common::String getName() const { return _name; }
 protected:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::String _name;
 };
 
 class MachineAsset : public BaseAsset {
 public:
-	MachineAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
+	MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
 	~MachineAsset();
 	void getCode(byte *&code, uint32 &codeSize);
 	uint32 getStateOffset(uint32 state);
@@ -70,7 +70,7 @@
 
 class SequenceAsset : public BaseAsset {
 public:
-	SequenceAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
+	SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
 	~SequenceAsset();
 	void getCode(byte *&code, uint32 &codeSize);
 	int localVarCount() const { return _localVarCount; }
@@ -82,7 +82,7 @@
 
 class DataAsset : public BaseAsset {
 public:
-	DataAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
+	DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
 	~DataAsset();
 	int getCount() const { return _recCount; }
 	long *getRow(int index);
@@ -101,10 +101,10 @@
 
 class SpriteAsset : public BaseAsset {
 public:
-	SpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream = false);
+	SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream = false);
 	~SpriteAsset();
-	void loadM4SpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream, bool asStream);
-	void loadMadsSpriteAsset(M4Engine *vm, Common::SeekableReadStream* stream);
+	void loadM4SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, bool asStream);
+	void loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream);
 	int32 getCount() { return _frameCount; }
 	int32 getFrameRate() const { return _frameRate; }
 	int32 getPixelSpeed() const { return _pixelSpeed; }
@@ -149,7 +149,7 @@
 class AssetManager {
 public:
 
-	AssetManager(M4Engine *vm);
+	AssetManager(MadsM4Engine *vm);
 	~AssetManager();
 
 	bool clearAssets(AssetType assetType, int32 minHash, int32 maxHash);
@@ -168,7 +168,7 @@
 
 protected:
 	// TODO: Check if we need _vm
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 
 	MachineAsset *_MACH[256];
 	SequenceAsset *_SEQU[256];

Modified: scummvm/trunk/engines/m4/compression.cpp
===================================================================
--- scummvm/trunk/engines/m4/compression.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/compression.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -47,7 +47,7 @@
 	initialise(stream);
 }
 
-MadsPack::MadsPack(const char *resourceName, M4Engine* vm) {
+MadsPack::MadsPack(const char *resourceName, MadsM4Engine* vm) {
 	Common::SeekableReadStream *stream = vm->_resourceManager->get(resourceName);
 	initialise(stream);
 	vm->_resourceManager->toss(resourceName);

Modified: scummvm/trunk/engines/m4/compression.h
===================================================================
--- scummvm/trunk/engines/m4/compression.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/compression.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -52,7 +52,7 @@
 public:
 	static bool isCompressed(Common::SeekableReadStream *stream);
 	MadsPack(Common::SeekableReadStream *stream);
-	MadsPack(const char *resourceName, M4Engine *vm);
+	MadsPack(const char *resourceName, MadsM4Engine *vm);
 	~MadsPack();
 
 	int getCount() const { return _count; }

Modified: scummvm/trunk/engines/m4/console.cpp
===================================================================
--- scummvm/trunk/engines/m4/console.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/console.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -31,7 +31,7 @@
 
 namespace M4 {
 
-Console::Console(M4Engine *vm) : GUI::Debugger() {
+Console::Console(MadsM4Engine *vm) : GUI::Debugger() {
 	_vm = vm;
 
 	DCmd_Register("scene",			WRAP_METHOD(Console, cmdLoadScene));
@@ -49,8 +49,6 @@
 	DCmd_Register("textview",		WRAP_METHOD(Console, cmdShowTextview));
 	DCmd_Register("animview",		WRAP_METHOD(Console, cmdShowAnimview));
 	DCmd_Register("anim",			WRAP_METHOD(Console, cmdPlayAnimation));
-	DCmd_Register("object",			WRAP_METHOD(Console, cmdObject));
-	DCmd_Register("message",		WRAP_METHOD(Console, cmdMessage));
 }
 
 Console::~Console() {
@@ -299,10 +297,17 @@
 	return true;
 }
 
-bool Console::cmdObject(int argc, const char **argv) {
-	if (_vm->isM4()) {
-		DebugPrintf("Command not implemented for M4 games\n");
-	} else if (argc == 1) {
+/*--------------------------------------------------------------------------*/
+
+MadsConsole::MadsConsole(MadsEngine *vm): Console(vm) {
+	_vm = vm;
+
+	DCmd_Register("object",			WRAP_METHOD(MadsConsole, cmdObject));
+	DCmd_Register("message",		WRAP_METHOD(MadsConsole, cmdMessage));
+}
+
+bool MadsConsole::cmdObject(int argc, const char **argv) {
+	if (argc == 1) {
 		DebugPrintf("Usage: object ['list' | '#objnum' | 'add #objnum']\n");
 	} else if (!strcmp(argv[1], "list")) {
 		// List of objects
@@ -358,7 +363,7 @@
 	return true;
 }
 
-bool Console::cmdMessage(int argc, const char **argv) {
+bool MadsConsole::cmdMessage(int argc, const char **argv) {
 	VALIDATE_MADS;
 
 	if (argc == 1)

Modified: scummvm/trunk/engines/m4/console.h
===================================================================
--- scummvm/trunk/engines/m4/console.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/console.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -30,14 +30,13 @@
 
 namespace M4 {
 
-class M4Engine;
+class MadsM4Engine;
+class MadsEngine;
 
-class Console : public GUI::Debugger {
-public:
-	Console(M4Engine *vm);
-	virtual ~Console();
+class Console: public GUI::Debugger {
+private:
+	MadsM4Engine *_vm;
 
-private:
 	bool cmdLoadScene(int argc, const char **argv);
 	bool cmdStartingScene(int argc, const char **argv);
 	bool cmdSceneInfo(int argc, const char **argv);
@@ -53,11 +52,27 @@
 	bool cmdShowTextview(int argc, const char **argv);
 	bool cmdShowAnimview(int argc, const char **argv);
 	bool cmdPlayAnimation(int argc, const char **argv);
+
+public:
+	Console(MadsM4Engine *vm);
+	virtual ~Console();
+};
+
+class MadsConsole: public Console {
+private:
+	MadsEngine *_vm;
+
 	bool cmdObject(int argc, const char **argv);
 	bool cmdMessage(int argc, const char **argv);
+public:
+	MadsConsole(MadsEngine *vm);
+	virtual ~MadsConsole() {};
+};
 
-private:
-	M4Engine *_vm;
+class M4Console: public Console {
+public:
+	M4Console(MadsM4Engine *vm): Console(vm) {};
+	virtual ~M4Console() {};
 };
 
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/converse.cpp
===================================================================
--- scummvm/trunk/engines/m4/converse.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/converse.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -75,7 +75,7 @@
 #define CHUNK_WPRL MKID_BE('WPRL')		// weighted preply chunk
 
 
-ConversationView::ConversationView(M4Engine *vm): View(vm, Common::Rect(0,
+ConversationView::ConversationView(MadsM4Engine *vm): View(vm, Common::Rect(0,
 		vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())) {
 
 	_screenType = VIEWID_CONVERSATION;

Modified: scummvm/trunk/engines/m4/converse.h
===================================================================
--- scummvm/trunk/engines/m4/converse.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/converse.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -137,7 +137,7 @@
 
 class ConversationView: public View {
 public:
-	ConversationView(M4Engine *vm);
+	ConversationView(MadsM4Engine *vm);
 	~ConversationView();
 	void setNode(int32 nodeIndex);
 
@@ -162,7 +162,7 @@
 class Converse {
 
 public:
-	Converse(M4Engine *vm) : _vm(vm) {}
+	Converse(MadsM4Engine *vm) : _vm(vm) {}
 	~Converse() {}
 
 	void startConversation(const char *convName, bool showConversebox = true, ConverseStyle style = CONVSTYLE_EARTH );
@@ -179,7 +179,7 @@
 	void play();
 	*/
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::Array<ConvEntry*>_convNodes;
 	Common::Array<MessageEntry*>_madsMessageList;
 	Common::Array<char *>_convStrings;

Modified: scummvm/trunk/engines/m4/detection.cpp
===================================================================
--- scummvm/trunk/engines/m4/detection.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/detection.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -39,10 +39,10 @@
 	uint32 features;
 };
 
-int M4Engine::getGameType() const { return _gameDescription->gameType; }
-uint32 M4Engine::getFeatures() const { return _gameDescription->features; }
-Common::Language M4Engine::getLanguage() const { return _gameDescription->desc.language; }
-Common::Platform M4Engine::getPlatform() const { return _gameDescription->desc.platform; }
+int MadsM4Engine::getGameType() const { return _gameDescription->gameType; }
+uint32 MadsM4Engine::getFeatures() const { return _gameDescription->features; }
+Common::Language MadsM4Engine::getLanguage() const { return _gameDescription->desc.language; }
+Common::Platform MadsM4Engine::getPlatform() const { return _gameDescription->desc.platform; }
 
 }
 
@@ -60,7 +60,7 @@
 
 namespace M4 {
 
-const char *M4Engine::getGameFile(int fileType) {
+const char *MadsM4Engine::getGameFile(int fileType) {
 	for (int i = 0; _gameDescription->desc.filesDescriptions[i].fileName; i++) {
 		if (_gameDescription->desc.filesDescriptions[i].fileType == fileType)
 			return _gameDescription->desc.filesDescriptions[i].fileName;
@@ -421,7 +421,10 @@
 bool M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
 	const M4::M4GameDescription *gd = (const M4::M4GameDescription *)desc;
 	if (gd) {
-		*engine = new M4::M4Engine(syst, gd);
+		if ((gd->gameType == M4::GType_Burger) || (gd->gameType == M4::GType_Riddle))
+			*engine = new M4::M4Engine(syst, gd);
+		else
+			*engine = new M4::MadsEngine(syst, gd);
 	}
 	return gd != 0;
 }

Modified: scummvm/trunk/engines/m4/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/m4/dialogs.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/dialogs.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -191,7 +191,7 @@
  */
 void Dialog::getVocab(int vocabId, char **line) {
 	assert(vocabId > 0);
-	const char *vocabStr = _vm->_globals->getVocab(vocabId);
+	const char *vocabStr = _madsVm->_globals->getVocab(vocabId);
 	strcpy(*line, vocabStr);
 
 	if (_commandCase)
@@ -253,6 +253,16 @@
 }
 
 /**
+ * Sets up an area within the dialog for textual input
+ */
+void Dialog::setupInputArea() {
+	_askPosition.x = _lineX + 1;
+	_askPosition.y = _lines.size();
+
+	incLine();
+}
+
+/**
  * Checks whether the start of an extracted command matches a specified given command constant
  */
 bool Dialog::matchCommand(const char *s1, const char *s2) {
@@ -261,7 +271,7 @@
 	return result;
 }
 
-Dialog::Dialog(M4Engine *vm, const char *msgData, const char *title): View(vm, Common::Rect(0, 0, 0, 0)) {
+Dialog::Dialog(MadsM4Engine *vm, const char *msgData, const char *title): View(vm, Common::Rect(0, 0, 0, 0)) {
 	assert(msgData);
 	_vm->_font->setFont(FONT_INTERFACE_MADS);
 
@@ -325,24 +335,9 @@
 			cmdFlag = false;
 			strToUpper(cmdText);
 
-			if (matchCommand(cmdText, "TITLE")) {
-				// Title command - specifies the dialog width in number of characters
-				skipLine = true;
-				crFlag = true;
-				underline = true;
+			if (matchCommand(cmdText, "ASK")) {
+				setupInputArea();
 
-				int id = atoi(cmdText + 5);
-				if (id > 0) {
-					// Suffix provided - specifies the dialog width in number of chars
-					_widthChars = id * 2;
-					_dialogWidth = id * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
-				}
-			} else if (matchCommand(cmdText, "SENTENCE")) {
-				// Sentence command - loads the title into the line buffer
-				strcpy(dialogLine, title);
-				strToUpper(dialogLine);
-				lineP += strlen(dialogLine) + 1;
-
 			} else if (matchCommand(cmdText, "BAR")) {
 				// Adds a full-width line instead of normal text
 				addBarLine();
@@ -368,10 +363,29 @@
 				// Noun command 2
 				handleNounSuffix(lineP, 2, cmdText + 5);
 
+			} else if (matchCommand(cmdText, "SENTENCE")) {
+				// Sentence command - loads the title into the line buffer
+				strcpy(dialogLine, title);
+				strToUpper(dialogLine);
+				lineP += strlen(dialogLine) + 1;
+
 			} else if (matchCommand(cmdText, "TAB")) {
 				// Specifies the X offset for the current line
 				_lines[_lines.size() - 1].xp = atoi(cmdText + 3);
 
+			} else if (matchCommand(cmdText, "TITLE")) {
+				// Title command - specifies the dialog width in number of characters
+				skipLine = true;
+				crFlag = true;
+				underline = true;
+
+				int id = atoi(cmdText + 5);
+				if (id > 0) {
+					// Suffix provided - specifies the dialog width in number of chars
+					_widthChars = id * 2;
+					_dialogWidth = id * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
+				}
+
 			} else if (matchCommand(cmdText, "UNDER")) {
 				// Underline command
 				underline = true;
@@ -382,9 +396,6 @@
 				getVocab(verbId, &lineP);
 
 
-
-			} else if (matchCommand(cmdText, "ASK")) {
-				// doAsk();
 			} else if (matchCommand(cmdText, "INDEX")) {
 				// Index command
 				_dialogIndex = atoi(cmdText + 5);
@@ -402,25 +413,15 @@
 	draw();
 }
 
-Dialog::Dialog(M4Engine *vm, int widthChars, const char **descEntries): View(vm, Common::Rect(0, 0, 0, 0)) {
+Dialog::Dialog(MadsM4Engine *vm, int widthChars): View(vm, Common::Rect(0, 0, 0, 0)) {
 	_vm->_font->setFont(FONT_INTERFACE_MADS);
 	_widthChars = widthChars * 2;
 	_dialogWidth = widthChars * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
 	_screenType = LAYER_DIALOG;
 	_lineX = 0;
 	_widthX = 0;
-
-	while (*descEntries != NULL) {
-		incLine();
-		writeChars(*descEntries);
-
-		int lineWidth = _vm->_font->getWidth(*descEntries, DIALOG_SPACING);
-		_lines[_lines.size() - 1].xp = (_dialogWidth - 10 - lineWidth) / 2;
-		++descEntries;
-	}
-
-	_lines[0].underline = true;
-	draw();
+	_askPosition.x = 0;
+	_askPosition.y = 0;
 }
 
 Dialog::~Dialog() {
@@ -449,9 +450,6 @@
 	_coords.right = dialogX + dlgWidth + 1;
 	_coords.bottom = dialogY + dlgHeight + 1;
 
-	// Ask position
-	//int askY = (_vm->_font->getHeight() + 1) * _askPosition.y + 3;
-
 	// Set up the dialog
 	fillRect(Common::Rect(0, 0, width(), height()), 3);
 	setColour(2);
@@ -476,6 +474,11 @@
 		}
 	}
 
+	// If an ask position is set, create the input area frame
+	if (_askPosition.y > 0) {
+
+	}
+
 	// Handle drawing the text contents
 	_vm->_font->setColours(7, 7, 7);
 	setColour(7);
@@ -518,10 +521,42 @@
 	return true;
 }
 
-void Dialog::display(M4Engine *vm, int widthChars, const char **descEntries) {
-	Dialog *dlg = new Dialog(vm, widthChars, descEntries);
+void Dialog::display(MadsM4Engine *vm, int widthChars, const char **descEntries) {
+	Dialog *dlg = new Dialog(vm, widthChars);
+
+	while (*descEntries != NULL) {
+		dlg->incLine();
+		dlg->writeChars(*descEntries);
+
+		int lineWidth = vm->_font->getWidth(*descEntries, DIALOG_SPACING);
+		dlg->_lines[dlg->_lines.size() - 1].xp = (dlg->_dialogWidth - 10 - lineWidth) / 2;
+		++descEntries;
+	}
+
+	dlg->_lines[0].underline = true;
+	
+	dlg->draw();
 	vm->_viewManager->addView(dlg);
 	vm->_viewManager->moveToFront(dlg);
 }
 
+void Dialog::getValue(MadsM4Engine *vm, const char *title, const char *text, int numChars, int currentValue) {
+	int titleLen = strlen(title);
+	Dialog *dlg = new Dialog(vm, titleLen + 4);
+
+	dlg->addLine(title, true);
+	dlg->writeChars("\n");
+
+	dlg->writeChars(text);
+	dlg->setupInputArea();
+	dlg->writeChars("\n");
+
+	dlg->draw();
+	vm->_viewManager->addView(dlg);
+	vm->_viewManager->moveToFront(dlg);
+
+	// TODO: How to wait until the dialog is closed
+	
+}
+
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/dialogs.h
===================================================================
--- scummvm/trunk/engines/m4/dialogs.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/dialogs.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -42,6 +42,8 @@
 	DialogLine() { data[0] = '\0'; xp = 0; underline = barLine = false; }
 };
 
+typedef void (*GetValueFn)(MadsM4Engine *vm, int result);
+
 class Dialog: public View {
 private:
 	Common::Array<DialogLine> _lines;
@@ -63,13 +65,15 @@
 	void addBarLine();
 	void getVocab(int vocabId, char **line);
 	bool handleNounSuffix(char *destP, int nounNum, const char *srcP);
+	void setupInputArea();
 	void draw();
 public:
-	Dialog(M4Engine *vm, const char *msgData, const char *title = NULL);
-	Dialog(M4Engine *vm, int widthChars, const char **descEntries);
+	Dialog(MadsM4Engine *vm, const char *msgData, const char *title = NULL);
+	Dialog(MadsM4Engine *vm, int widthChars);
 	virtual ~Dialog();
 
-	static void display(M4Engine *vm, int widthChars, const char **descEntries);
+	static void display(MadsM4Engine *vm, int widthChars, const char **descEntries);
+	static void getValue(MadsM4Engine *vm, const char *title, const char *text, int numChars, int currentValue);
 
 	bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
 };

Modified: scummvm/trunk/engines/m4/events.cpp
===================================================================
--- scummvm/trunk/engines/m4/events.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/events.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -44,13 +44,17 @@
  * Implements an interface to the event system								*
  *--------------------------------------------------------------------------*/
 
-Events::Events(M4Engine *vm) : _vm(vm) {
+Events::Events(MadsM4Engine *vm) : _vm(vm) {
 	_mouseState = MSTATE_NO_EVENT;
 	quitFlag = false;
 	_keyCode = 0;
-	_console = new Console(_vm);
 	_mouseButtons = 0;
 	_ctrlFlag = false;
+
+	if (_vm->isM4())
+		_console = new M4Console(_vm);
+	else
+		_console = new MadsConsole(_madsVm);
 }
 
 M4EventType Events::handleEvents() {
@@ -177,7 +181,7 @@
  * Implements an interface to the mouse										*
  *--------------------------------------------------------------------------*/
 
-Mouse::Mouse(M4Engine *vm) : _vm(vm) {
+Mouse::Mouse(MadsM4Engine *vm) : _vm(vm) {
 	_locked = false;
 	_cursorOn = false;
 	_cursor = NULL;

Modified: scummvm/trunk/engines/m4/events.h
===================================================================
--- scummvm/trunk/engines/m4/events.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/events.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -68,7 +68,7 @@
 
 class Events {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::Event _event;
 	M4MouseState _mouseState;
 	int32 _keyCode;
@@ -77,7 +77,7 @@
 	bool _ctrlFlag;
 public:
 	bool quitFlag;
-	Events(M4Engine *vm);
+	Events(MadsM4Engine *vm);
 
 	Common::Event &event() { return _event; }
 	Common::EventType type() { return _event.type; }
@@ -92,7 +92,7 @@
 
 class Mouse {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	int _currentCursor, _lockedCursor;
 	bool _locked;
 	bool _cursorOn;
@@ -105,7 +105,7 @@
 	bool inHideArea();
 	friend class Events;
 public:
-	Mouse(M4Engine *vm);
+	Mouse(MadsM4Engine *vm);
 	~Mouse();
 
 	bool init(const char *seriesName, RGB8 *palette);

Modified: scummvm/trunk/engines/m4/font.cpp
===================================================================
--- scummvm/trunk/engines/m4/font.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/font.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -29,7 +29,7 @@
 
 namespace M4 {
 
-Font::Font(M4Engine *vm) : _vm(vm) {
+Font::Font(MadsM4Engine *vm) : _vm(vm) {
 	_sysFont = true;
 	_filename = NULL;
 	//TODO: System font

Modified: scummvm/trunk/engines/m4/font.h
===================================================================
--- scummvm/trunk/engines/m4/font.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/font.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -59,7 +59,7 @@
 
 class Font {
 public:
-	Font(M4Engine *vm);
+	Font(MadsM4Engine *vm);
 	~Font();
 	void setFont(const char *filename);
 	void setColor(uint8 color);
@@ -79,7 +79,7 @@
 	void setFontM4(const char *filename);
 	void setFontMads(const char *filename);
 
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	uint8 _maxWidth, _maxHeight;
 	uint8 *_charWidths;
 	uint16 *_charOffs;

Modified: scummvm/trunk/engines/m4/globals.cpp
===================================================================
--- scummvm/trunk/engines/m4/globals.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/globals.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -34,7 +34,7 @@
 
 namespace M4 {
 
-Kernel::Kernel(M4Engine *vm) : _vm(vm) {
+Kernel::Kernel(MadsM4Engine *vm) : _vm(vm) {
 	daemonTriggerAvailable = true;
 	firstFadeColorIndex = 0;
 	paused = false;
@@ -267,10 +267,10 @@
 
 //--------------------------------------------------------------------------
 
-Globals::Globals(M4Engine *vm): _vm(vm) {
+MadsGlobals::MadsGlobals(MadsM4Engine *vm): _vm(vm) {
 }
 
-Globals::~Globals() {
+MadsGlobals::~MadsGlobals() {
 	uint32 i;
 
 	for (i = 0; i < _madsVocab.size(); i++)
@@ -284,11 +284,11 @@
 	_madsMessages.clear();
 }
 
-bool Globals::isInterfaceVisible() {
+bool MadsGlobals::isInterfaceVisible() {
 	return _vm->_interfaceView->isVisible();
 }
 
-void Globals::loadMadsVocab() {
+void MadsGlobals::loadMadsVocab() {
 	Common::SeekableReadStream *vocabS = _vm->res()->get("vocab.dat");
 	int curPos = 0;
 
@@ -311,7 +311,7 @@
 	_vm->res()->toss("vocab.dat");
 }
 
-void Globals::loadMadsQuotes() {
+void MadsGlobals::loadMadsQuotes() {
 	Common::SeekableReadStream *quoteS = _vm->res()->get("quotes.dat");
 	int curPos = 0;
 
@@ -334,7 +334,7 @@
 	_vm->res()->toss("quotes.dat");
 }
 
-void Globals::loadMadsMessagesInfo() {
+void MadsGlobals::loadMadsMessagesInfo() {
 	Common::SeekableReadStream *messageS = _vm->res()->get("messages.dat");
 
 	int16 count = messageS->readUint16LE();
@@ -359,7 +359,7 @@
 	_vm->res()->toss("messages.dat");
 }
 
-void Globals::loadMadsObjects() {
+void MadsGlobals::loadMadsObjects() {
 	Common::SeekableReadStream *objList = _vm->res()->get("objects.dat");
 	int numObjects = objList->readUint16LE();
 
@@ -369,7 +369,7 @@
 	_vm->res()->toss("objects.dat");
 }
 
-int Globals::messageIndexOf(uint32 messageId) {
+int MadsGlobals::messageIndexOf(uint32 messageId) {
 	for (uint i = 0; i < _madsMessages.size(); ++i)
 	{
 		if (_madsMessages[i]->id == messageId)
@@ -378,7 +378,7 @@
 	return -1;
 }
 
-const char *Globals::loadMessage(uint index) {
+const char *MadsGlobals::loadMessage(uint index) {
 	if (index > _madsMessages.size() - 1) {
 		warning("Invalid message index: %i", index);
 		return NULL;
@@ -404,7 +404,7 @@
 
 //--------------------------------------------------------------------------
 
-Player::Player(M4Engine *vm) : _vm(vm) {
+Player::Player(MadsM4Engine *vm) : _vm(vm) {
 	commandsAllowed = true;
 	needToWalk = false;
 	readyToWalk = false;

Modified: scummvm/trunk/engines/m4/globals.h
===================================================================
--- scummvm/trunk/engines/m4/globals.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/globals.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -35,7 +35,7 @@
 
 namespace M4 {
 
-class M4Engine;
+class MadsM4Engine;
 class ScriptInterpreter;
 class ScriptFunction;
 
@@ -100,14 +100,14 @@
 
 class Kernel {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	ScriptFunction *_globalDaemonFn, *_globalParserFn;
 	ScriptFunction *_sectionInitFn, *_sectionDaemonFn, *_sectionParserFn;
 	ScriptFunction *_roomInitFn, *_roomDaemonFn, *_roomPreParserFn, *_roomParserFn;
 	void pauseEngines();
 	void unpauseEngines();
 public:
-	Kernel(M4Engine *vm);
+	Kernel(MadsM4Engine *vm);
 
 	// TODO: Move to some palette/fading class
 	int fadeUpDuration, firstFadeColorIndex;
@@ -183,7 +183,7 @@
 
 typedef Common::Array<Common::SharedPtr<MadsObject> > MadsObjectArray;
 
-class Globals {
+class MadsGlobals {
 private:
 	struct MessageItem {
 		uint32 id;
@@ -192,14 +192,14 @@
 		uint16 compSize;
 	};
 
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::Array<char* > _madsVocab;
 	Common::Array<char* > _madsQuotes;
 	Common::Array<MessageItem* > _madsMessages;
 	MadsObjectArray _madsObjects;
 public:
-	Globals(M4Engine *vm);
-	~Globals();
+	MadsGlobals(MadsM4Engine *vm);
+	~MadsGlobals();
 	bool isInterfaceVisible();
 
 	// M4 variables
@@ -236,7 +236,7 @@
 
 class Player {
 public:
-	Player(M4Engine *vm);
+	Player(MadsM4Engine *vm);
 	void setCommandsAllowed(bool value);
 
 	// Variables
@@ -265,7 +265,7 @@
 		const char *word8, const char *word9, const char *word10);
 
 private:
-	 M4Engine *_vm;
+	 MadsM4Engine *_vm;
 };
 
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/graphics.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -718,7 +718,7 @@
 
 // Support function for fading in or out
 
-static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal,  int startIndex, int endIndex,
+static void fadeRange(MadsM4Engine *vm, RGB8 *srcPal, RGB8 *destPal,  int startIndex, int endIndex,
 					 int numSteps, uint delayAmount) {
 	RGB8 tempPal[256];
 
@@ -746,7 +746,7 @@
 	vm->_palette->setPalette(&destPal[startIndex], startIndex, endIndex - startIndex + 1);
 }
 
-Palette::Palette(M4Engine *vm) : _vm(vm) {
+Palette::Palette(MadsM4Engine *vm) : _vm(vm) {
 	reset();
 	_fading_in_progress = false;
 	Common::set_to(&_usageCount[0], &_usageCount[256], 0);

Modified: scummvm/trunk/engines/m4/graphics.h
===================================================================
--- scummvm/trunk/engines/m4/graphics.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/graphics.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -173,7 +173,7 @@
 
 class Palette {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	bool _colorsChanged;
 	bool _fading_in_progress;
 	byte _originalPalette[256 * 4];
@@ -182,7 +182,7 @@
 
 	void reset();
 public:
-	Palette(M4Engine *vm);
+	Palette(MadsM4Engine *vm);
 
 	void setPalette(const byte *colors, uint start, uint num);
 	void setPalette(const RGB8 *colors, uint start, uint num);

Modified: scummvm/trunk/engines/m4/gui.cpp
===================================================================
--- scummvm/trunk/engines/m4/gui.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/gui.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -1191,7 +1191,7 @@
 				_buttonState = BUTTON_PRESSED;
 			}
 
-			_vm->_globals->invSuppressClickSound = false;
+			_madsVm->_globals->invSuppressClickSound = false;
 		} else {
 			// Button isn't pressed
 			if (_tracking)

Modified: scummvm/trunk/engines/m4/gui.h
===================================================================
--- scummvm/trunk/engines/m4/gui.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/gui.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -212,12 +212,12 @@
 
 class DialogView: public View {
 public:
-	DialogView(M4Engine *Vm, const Common::Rect &viewBounds, bool transparent = false):
+	DialogView(MadsM4Engine *Vm, const Common::Rect &viewBounds, bool transparent = false):
 		View(Vm, viewBounds, transparent) {};
-	DialogView(M4Engine *Vm, int x = 0, int y = 0, bool transparent = false):
+	DialogView(MadsM4Engine *Vm, int x = 0, int y = 0, bool transparent = false):
 		View(Vm, x, y, transparent) {};
 
-	M4Engine *vm() { return _vm; }
+	MadsM4Engine *vm() { return _vm; }
 	virtual SpriteAsset *sprites() = 0;
 	virtual MenuType getMenuType() = 0;
 	virtual MenuObject *getItem(int objectId) { return NULL; }

Modified: scummvm/trunk/engines/m4/hotspot.cpp
===================================================================
--- scummvm/trunk/engines/m4/hotspot.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/hotspot.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -274,10 +274,10 @@
 			currentHotSpot->setVerb("");
 
 			if (currentHotSpot->getVocabID() > 0)
-				currentHotSpot->setVocab(_vm->_globals->getVocab(currentHotSpot->getVocabID()));
+				currentHotSpot->setVocab(_madsVm->_globals->getVocab(currentHotSpot->getVocabID()));
 
 			if (currentHotSpot->getVerbID() > 0)
-				currentHotSpot->setVerb(_vm->_globals->getVocab(currentHotSpot->getVerbID()));
+				currentHotSpot->setVerb(_madsVm->_globals->getVocab(currentHotSpot->getVerbID()));
 		}
 	}
 }

Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -64,16 +64,18 @@
 namespace M4 {
 
 // FIXME: remove global
-M4Engine *_vm;
+MadsM4Engine *_vm;
+MadsEngine *_madsVm;
+M4Engine *_m4Vm;
 
-void escapeHotkeyHandler(M4Engine *vm, View *view, uint32 key) {
+void escapeHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
 	// For now, simply exit the game
 	vm->_events->quitFlag = true;
 }
 
 // Temporary hotkey handler for use in testing the TextviewView class
 
-void textviewHotkeyHandler(M4Engine *vm, View *view, uint32 key) {
+void textviewHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
 	// Deactivate the scene if it's currently active
 	View *sceneView = vm->_viewManager->getView(VIEWID_SCENE);
 	if (sceneView != NULL)
@@ -86,38 +88,40 @@
 	textView->setScript("quotes", NULL);
 }
 
-void saveGameHotkeyHandler(M4Engine *vm, View *view, uint32 key) {
+void saveGameHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
 	// TODO: See CreateF2SaveMenu - save menu should only be activated when
 	// certain conditions are met, such as player_commands_allowed, and isInterfaceVisible
 	vm->loadMenu(SAVE_MENU, true);
 }
 
-void loadGameHotkeyHandler(M4Engine *vm, View *view, uint32 key) {
+void loadGameHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
 	// TODO: See CreateF3LoadMenu - save menu should only be activated when
 	// certain conditions are met, such as player_commands_allowed, and isInterfaceVisible
 	vm->loadMenu(LOAD_MENU, true);
 }
 
-void gameMenuHotkeyHandler(M4Engine *vm, View *view, uint32 key) {
+void gameMenuHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
 	vm->loadMenu(GAME_MENU);
 }
 
-M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
+MadsM4Engine::MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
 	Engine(syst), _gameDescription(gameDesc) {
 
 	// FIXME
 	_vm = this;
+	_madsVm = NULL;
 
 	SearchMan.addSubDirectoryMatching(_gameDataDir, "goodstuf");
 	SearchMan.addSubDirectoryMatching(_gameDataDir, "resource");
 
 	Common::addDebugChannel(kDebugScript, "script", "Script debug level");
 	Common::addDebugChannel(kDebugConversations, "conversations", "Conversations debugging");
+
+	_resourceManager = NULL;
 }
 
 
-M4Engine::~M4Engine() {
-	delete _globals;
+MadsM4Engine::~MadsM4Engine() {
 	delete _midi;
 	delete _saveLoad;
 	delete _kernel;
@@ -138,16 +142,10 @@
 	delete _random;
 	delete _animation;
 	delete _palette;
-	delete _resourceManager;
 }
 
-Common::Error M4Engine::run() {
+Common::Error MadsM4Engine::run() {
 	// Initialize backend
-	if (isM4())
-		initGraphics(640, 480, true);
-	else
-		initGraphics(320, 200, false);
-
 	_screen = new M4Surface(true); // Special form for creating screen reference
 
 	MidiDriverType midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
@@ -161,11 +159,6 @@
 	_midi->setGM(true);
 	_midi->setNativeMT32(native_mt32);
 
-	_globals = new Globals(this);
-	if (isM4())
-		_resourceManager = new M4ResourceManager(this);
-	else
-		_resourceManager = new MADSResourceManager(this);
 	_saveLoad = new SaveLoad(this);
 	_palette = new Palette(this);
 	_mouse = new Mouse(this);
@@ -194,13 +187,10 @@
 	_random = new Common::RandomSource();
 	g_eventRec.registerRandomSource(*_random, "m4");
 
-	if (isM4())
-		return goM4();
-	else
-		return goMADS();
+	return Common::kNoError;
 }
 
-void M4Engine::eventHandler() {
+void MadsM4Engine::eventHandler() {
 	M4EventType event;
 	uint32 keycode = 0;
 
@@ -213,7 +203,7 @@
 		_viewManager->handleKeyboardEvents(keycode);
 }
 
-bool M4Engine::delay(int duration, bool keyAborts, bool clickAborts) {
+bool MadsM4Engine::delay(int duration, bool keyAborts, bool clickAborts) {
 	uint32 endTime = g_system->getMillis() + duration;
 	M4EventType event;
 	uint32 keycode = 0;
@@ -234,7 +224,7 @@
 	return false;
 }
 
-void M4Engine::loadMenu(MenuType menuType, bool loadSaveFromHotkey, bool calledFromMainMenu) {
+void MadsM4Engine::loadMenu(MenuType menuType, bool loadSaveFromHotkey, bool calledFromMainMenu) {
 	if (isM4() && (menuType != MAIN_MENU)) {
 		bool menuActive = _viewManager->getView(VIEWID_MENU) != NULL;
 
@@ -272,88 +262,59 @@
 	_viewManager->moveToFront(view);
 }
 
-Common::Error M4Engine::goMADS() {
-	_palette->setMadsSystemPalette();
+void MadsM4Engine::dumpFile(const char* filename, bool uncompress) {
+	Common::SeekableReadStream *fileS = res()->get(filename);
+	byte buffer[256];
+	FILE *destFile = fopen(filename, "wb");
+	int bytesRead = 0;
+	printf("Dumping %s, size: %i\n", filename, fileS->size());
 
-	_mouse->init("cursor.ss", NULL);
-	_mouse->setCursorNum(0);
-
-	// Load MADS data files
-	_globals->loadMadsVocab();			// vocab.dat
-	_globals->loadMadsQuotes();			// quotes.dat
-	_globals->loadMadsMessagesInfo();	// messages.dat
-	_globals->loadMadsObjects();
-
-	// Setup globals
-	_vm->_globals->easyMouse = true;
-	_vm->_globals->invObjectsStill = false;
-	_vm->_globals->textWindowStill = false;
-	_vm->_globals->storyMode = 0;
-
-	// Test code to dump all messages to the console
-	//for (int i = 0; i < _globals->getMessagesSize(); i++)
-	//printf("%s\n----------\n", _globals->loadMessage(i));
-
-	if ((getGameType() == GType_RexNebular) || (getGameType() == GType_DragonSphere)) {
-		loadMenu(MAIN_MENU);
-
+	if (!uncompress) {
+		while (!fileS->eos()) {
+			bytesRead = fileS->read(buffer, 256);
+			fwrite(buffer, bytesRead, 1, destFile);
+		}
 	} else {
-		if (getGameType() == GType_DragonSphere) {
-			_scene->loadScene(FIRST_SCENE);
-		} else if (getGameType() == GType_Phantom) {
-			//_scene->loadScene(FIRST_SCENE);
-			_scene->loadScene(106);		// a more interesting scene
+		MadsPack packData(fileS);
+		Common::MemoryReadStream *sourceUnc;
+		for (int i = 0; i < packData.getCount(); i++) {
+			sourceUnc = packData.getItemStream(i);
+			printf("Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
+			while (!sourceUnc->eos()) {
+				bytesRead = sourceUnc->read(buffer, 256);
+				fwrite(buffer, bytesRead, 1, destFile);
+			}
+			delete sourceUnc;
 		}
-
-		_scene->show();
-
-		_font->setFont(FONT_MAIN_MADS);
-		_font->setColors(2, 1, 3);
-		_font->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
-		_font->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);
-
-		if (getGameType() == GType_DragonSphere) {
-			//_scene->showMADSV2TextBox("Test", 10, 10, NULL);
-		}
-
-		_mouse->cursorOn();
 	}
 
-	_viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler);
-	_viewManager->systemHotkeys().add(Common::KEYCODE_KP_MULTIPLY, &textviewHotkeyHandler);
+	fclose(destFile);
+	res()->toss(filename);
+	res()->purge();
+}
 
-	// Load the general game SFX/voices
-	if (getGameType() == GType_RexNebular) {
-		_sound->loadDSRFile("rex009.dsr");
-	} else if (getGameType() == GType_Phantom) {
-		_sound->loadDSRFile("phan009.dsr");
-	} else if (getGameType() == GType_DragonSphere) {
-		_sound->loadDSRFile("drag009.dsr");
-	}
+/*--------------------------------------------------------------------------*/
 
-	uint32 nextFrame = g_system->getMillis();
-	while (!_events->quitFlag) {
-		eventHandler();
+M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc): MadsM4Engine(syst, gameDesc) {
+	// FIXME
+	_m4Vm = this;
+}
 
-		_animation->updateAnim();
+M4Engine::~M4Engine() {
+	delete _resourceManager;
+}
 
-		// Call the updateState method of all views
-		_viewManager->updateState();
+Common::Error M4Engine::run() {
+	// Set up the graphics mode
+	initGraphics(640, 480, true);
 
-		if (g_system->getMillis() >= nextFrame) {
+	// Necessary pre-initialisation
+	_resourceManager = new M4ResourceManager(this);
 
-			_viewManager->refreshAll();
-			nextFrame = g_system->getMillis();// + GAME_FRAME_DELAY;
-		}
+	// Set up needed common functionality
+	MadsM4Engine::run();
 
-		g_system->delayMillis(10);
-	}
 
-	return Common::kNoError;
-}
-
-Common::Error M4Engine::goM4() {
-
 	_script->open("m4.dat");
 
 #ifdef SCRIPT_TEST
@@ -521,35 +482,108 @@
 	return Common::kNoError;
 }
 
-void M4Engine::dumpFile(const char* filename, bool uncompress) {
-	Common::SeekableReadStream *fileS = res()->get(filename);
-	byte buffer[256];
-	FILE *destFile = fopen(filename, "wb");
-	int bytesRead = 0;
-	printf("Dumping %s, size: %i\n", filename, fileS->size());
+/*--------------------------------------------------------------------------*/
 
-	if (!uncompress) {
-		while (!fileS->eos()) {
-			bytesRead = fileS->read(buffer, 256);
-			fwrite(buffer, bytesRead, 1, destFile);
-		}
+MadsEngine::MadsEngine(OSystem *syst, const M4GameDescription *gameDesc): MadsM4Engine(syst, gameDesc) {
+	// FIXME
+	_madsVm = this;
+
+	_globals = new MadsGlobals(this);
+}
+
+MadsEngine::~MadsEngine() {
+	delete _globals;
+	delete _resourceManager;
+}
+
+Common::Error MadsEngine::run() {
+	// Set up the graphics mode
+	initGraphics(320, 200, false);
+
+	// Necessary pre-initialisation
+	_resourceManager = new MADSResourceManager(this);
+
+	// Set up needed common functionality
+	MadsM4Engine::run();
+
+	_palette->setMadsSystemPalette();
+
+	_mouse->init("cursor.ss", NULL);
+	_mouse->setCursorNum(0);
+
+	// Load MADS data files
+	_globals->loadMadsVocab();			// vocab.dat
+	_globals->loadMadsQuotes();			// quotes.dat
+	_globals->loadMadsMessagesInfo();	// messages.dat
+	_globals->loadMadsObjects();
+
+	// Setup globals
+	_madsVm->_globals->easyMouse = true;
+	_madsVm->_globals->invObjectsStill = false;
+	_madsVm->_globals->textWindowStill = false;
+	_madsVm->_globals->storyMode = 0;
+
+	// Test code to dump all messages to the console
+	//for (int i = 0; i < _globals->getMessagesSize(); i++)
+	//printf("%s\n----------\n", _globals->loadMessage(i));
+
+	if ((getGameType() == GType_RexNebular) || (getGameType() == GType_DragonSphere)) {
+		loadMenu(MAIN_MENU);
+
 	} else {
-		MadsPack packData(fileS);
-		Common::MemoryReadStream *sourceUnc;
-		for (int i = 0; i < packData.getCount(); i++) {
-			sourceUnc = packData.getItemStream(i);
-			printf("Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
-			while (!sourceUnc->eos()) {
-				bytesRead = sourceUnc->read(buffer, 256);
-				fwrite(buffer, bytesRead, 1, destFile);
-			}
-			delete sourceUnc;
+		if (getGameType() == GType_DragonSphere) {
+			_scene->loadScene(FIRST_SCENE);
+		} else if (getGameType() == GType_Phantom) {
+			//_scene->loadScene(FIRST_SCENE);
+			_scene->loadScene(106);		// a more interesting scene
 		}
+
+		_scene->show();
+
+		_font->setFont(FONT_MAIN_MADS);
+		_font->setColors(2, 1, 3);
+		_font->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
+		_font->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);
+
+		if (getGameType() == GType_DragonSphere) {
+			//_scene->showMADSV2TextBox("Test", 10, 10, NULL);
+		}
+
+		_mouse->cursorOn();
 	}
 
-	fclose(destFile);
-	res()->toss(filename);
-	res()->purge();
+	_viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler);
+	_viewManager->systemHotkeys().add(Common::KEYCODE_KP_MULTIPLY, &textviewHotkeyHandler);
+
+	// Load the general game SFX/voices
+	if (getGameType() == GType_RexNebular) {
+		_sound->loadDSRFile("rex009.dsr");
+	} else if (getGameType() == GType_Phantom) {
+		_sound->loadDSRFile("phan009.dsr");
+	} else if (getGameType() == GType_DragonSphere) {
+		_sound->loadDSRFile("drag009.dsr");
+	}
+
+	uint32 nextFrame = g_system->getMillis();
+	while (!_events->quitFlag) {
+		eventHandler();
+
+		_animation->updateAnim();
+
+		// Call the updateState method of all views
+		_viewManager->updateState();
+
+		if (g_system->getMillis() >= nextFrame) {
+
+			_viewManager->refreshAll();
+			nextFrame = g_system->getMillis();// + GAME_FRAME_DELAY;
+		}
+
+		g_system->delayMillis(10);
+	}
+
+	return Common::kNoError;
 }
 
+
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/m4.h
===================================================================
--- scummvm/trunk/engines/m4/m4.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -128,7 +128,7 @@
 inline long FixedMul(long a, long b) { return (long)(((float)a * (float)b) / 65536.0); }
 inline long FixedDiv(long a, long b) { return (long)(((float)a / (float)b) * 65536.0); }
 
-class M4Engine : public Engine {
+class MadsM4Engine : public Engine {
 private:
 	Common::Error goMADS();
 	Common::Error goM4();
@@ -142,8 +142,8 @@
 	MidiPlayer *_midi;
 
 public:
-	M4Engine(OSystem *syst, const M4GameDescription *gameDesc);
-	virtual ~M4Engine();
+	MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc);
+	virtual ~MadsM4Engine();
 
 	int getGameType() const;
 	uint32 getFeatures() const;
@@ -179,7 +179,6 @@
 	ViewManager *_viewManager;
 	Palette *_palette;
 	Kernel *_kernel;
-	Globals *_globals;
 	Player *_player;
 	Mouse *_mouse;
 	Events *_events;
@@ -200,9 +199,29 @@
 	Common::RandomSource *_random;
 };
 
-// FIXME: remove global
-extern M4Engine *_vm;
+class MadsEngine: public MadsM4Engine {
+public:
+	MadsEngine(OSystem *syst, const M4GameDescription *gameDesc);
+	virtual ~MadsEngine();
 
+	virtual Common::Error run();
+
+	MadsGlobals *_globals;
+};
+
+class M4Engine: public MadsM4Engine {
+public:
+	M4Engine(OSystem *syst, const M4GameDescription *gameDesc);
+	virtual ~M4Engine();
+
+	virtual Common::Error run();
+};
+
+// FIXME: remove globals
+extern MadsM4Engine *_vm;
+extern MadsEngine *_madsVm;
+extern M4Engine *_m4Vm;
+
 } // End of namespace M4
 
 #endif

Modified: scummvm/trunk/engines/m4/m4_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4_menus.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4_menus.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -306,7 +306,7 @@
 
 //--------------------------------------------------------------------------
 
-OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
+OrionMenuView::OrionMenuView(MadsM4Engine *Vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
 		bool loadSaveFromHotkey): DialogView(Vm, x, y, true) {
 	_menuType = menuType;
 	_screenType = VIEWID_MENU;
@@ -512,7 +512,7 @@
 }
 
 void OrionMenuView::destroyView() {
-	M4Engine *engine = _vm;
+	MadsM4Engine *engine = _vm;
 	bool interfaceVisible = _interfaceWasVisible;
 	engine->_viewManager->deleteView(this);
 

Modified: scummvm/trunk/engines/m4/m4_menus.h
===================================================================
--- scummvm/trunk/engines/m4/m4_menus.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4_menus.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -59,7 +59,7 @@
 	M4Surface *createThumbnail();
 	void destroyView();
 public:
-	OrionMenuView(M4Engine *vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
+	OrionMenuView(MadsM4Engine *vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
 		bool loadSaveFromHotkey);
 	~OrionMenuView();
 	MenuType getMenuType() { return _menuType; }

Modified: scummvm/trunk/engines/m4/m4_views.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4_views.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4_views.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -31,7 +31,7 @@
 
 namespace M4 {
 
-GUIInventory::GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells,
+GUIInventory::GUIInventory(View *owner, MadsM4Engine *vm, const Common::Rect &bounds, int horizCells,
 		   int vertCells, int cellWidth, int cellHeight, int tag): GUIRect(owner, bounds, tag) {
 
     _vm = vm;
@@ -218,7 +218,7 @@
 
 #define SPR(x) _sprites->getFrame(x)
 
-GameInterfaceView::GameInterfaceView(M4Engine *vm):
+GameInterfaceView::GameInterfaceView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT,
 				vm->_screen->width(), vm->_screen->height())),
 		_statusText(GUITextField(this, Common::Rect(200, 1, 450, 21))),

Modified: scummvm/trunk/engines/m4/m4_views.h
===================================================================
--- scummvm/trunk/engines/m4/m4_views.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/m4_views.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -58,9 +58,9 @@
 	int _scrollPosition;
 	int _highlightedIndex;
 	int _selectedIndex;
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 public:
-	GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds,
+	GUIInventory(View *owner, MadsM4Engine *vm, const Common::Rect &bounds,
 				 int horizCells, int vertCells, int cellWidth, int cellHeight, int tag);
 
 	void onRefresh();
@@ -100,7 +100,7 @@
 private:
 	void setHighlightedButton(int index);
 public:
-	GameInterfaceView(M4Engine *vm);
+	GameInterfaceView(MadsM4Engine *vm);
 	~GameInterfaceView();
 
 	void onRefresh(RectList *rects, M4Surface *destSurface);

Modified: scummvm/trunk/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/mads_anim.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -34,7 +34,7 @@
 #define TV_NUM_FADE_STEPS 40
 #define TV_FADE_DELAY_MILLI 50
 
-TextviewView::TextviewView(M4Engine *vm):
+TextviewView::TextviewView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
 		_bgSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT),
 		_textSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT + vm->_font->getHeight() +
@@ -235,7 +235,7 @@
 
 void TextviewView::scriptDone() {
 	TextviewCallback fn = _callback;
-	M4Engine *vm = _vm;
+	MadsM4Engine *vm = _vm;
 
 	// Remove this view from manager and destroy it
 	_vm->_viewManager->deleteView(this);
@@ -439,7 +439,7 @@
 
 //--------------------------------------------------------------------------
 
-AnimviewView::AnimviewView(M4Engine *vm):
+AnimviewView::AnimviewView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
 		_bgSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT) {
 
@@ -642,7 +642,7 @@
 
 void AnimviewView::scriptDone() {
 	AnimviewCallback fn = _callback;
-	M4Engine *vm = _vm;
+	MadsM4Engine *vm = _vm;
 
 	// Remove this view from manager and destroy it
 	_vm->_viewManager->deleteView(this);
@@ -714,7 +714,7 @@
 	}
 }
 
-AAFile::AAFile(const char *resourceName, M4Engine* vm): MadsPack(resourceName, vm) {
+AAFile::AAFile(const char *resourceName, MadsM4Engine* vm): MadsPack(resourceName, vm) {
 	Common::MemoryReadStream stream1(*getItemStream(1));
 	Common::MemoryReadStream stream2(*getItemStream(2));
 

Modified: scummvm/trunk/engines/m4/mads_anim.h
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/mads_anim.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -44,7 +44,7 @@
 	kTransitionCircleIn = 9
 };
 
-typedef void (*TextviewCallback)(M4Engine *vm);
+typedef void (*TextviewCallback)(MadsM4Engine *vm);
 
 class TextviewView: public View {
 private:
@@ -74,7 +74,7 @@
 	void processText();
 	int getParameter(char **paramP);
 public:
-	TextviewView(M4Engine *vm);
+	TextviewView(MadsM4Engine *vm);
 	~TextviewView();
 
 	void setScript(const char *resourceName, TextviewCallback callback);
@@ -85,11 +85,11 @@
 	void updateState();
 };
 
-typedef void (*AnimviewCallback)(M4Engine *vm);
+typedef void (*AnimviewCallback)(MadsM4Engine *vm);
 
 class AAFile: public MadsPack {
 public:
-	AAFile(const char *resourceName, M4Engine* vm);
+	AAFile(const char *resourceName, MadsM4Engine* vm);
 
 	uint16 seriesCount;
 	uint16 frameCount;
@@ -122,7 +122,7 @@
 	void readNextCommand();
 	void processCommand();
 public:
-	AnimviewView(M4Engine *vm);
+	AnimviewView(MadsM4Engine *vm);
 	~AnimviewView();
 
 	void setScript(const char *resourceName, AnimviewCallback callback);

Modified: scummvm/trunk/engines/m4/mads_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_menus.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/mads_menus.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -45,7 +45,7 @@
 #define DRAGON_MENU_BUTTON_W = 45
 #define DRAGON_MENU_BUTTON_H = 11
 
-RexMainMenuView::RexMainMenuView(M4Engine *vm):
+RexMainMenuView::RexMainMenuView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
 
 	_screenType = VIEWID_MAINMENU;
@@ -295,7 +295,7 @@
 }
 
 void RexMainMenuView::handleAction(MadsGameAction action) {
-	M4Engine *vm = _vm;
+	MadsM4Engine *vm = _vm;
 	vm->_mouse->cursorOff();
 	vm->_viewManager->deleteView(this);
 
@@ -344,7 +344,7 @@
 
 //--------------------------------------------------------------------------
 
-MadsMainMenuView::MadsMainMenuView(M4Engine *vm):
+MadsMainMenuView::MadsMainMenuView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
 
 }
@@ -359,7 +359,7 @@
 
 //--------------------------------------------------------------------------
 
-DragonMainMenuView::DragonMainMenuView(M4Engine *vm):
+DragonMainMenuView::DragonMainMenuView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
 
 	_screenType = VIEWID_MAINMENU;
@@ -548,7 +548,7 @@
 }
 
 void DragonMainMenuView::handleAction(MadsGameAction action) {
-	M4Engine *vm = _vm;
+	MadsM4Engine *vm = _vm;
 	vm->_mouse->cursorOff();
 	vm->_viewManager->deleteView(this);
 

Modified: scummvm/trunk/engines/m4/mads_menus.h
===================================================================
--- scummvm/trunk/engines/m4/mads_menus.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/mads_menus.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -49,7 +49,7 @@
 	int getHighlightedItem(int x, int y);
 	void handleAction(MadsGameAction action);
 public:
-	RexMainMenuView(M4Engine *vm);
+	RexMainMenuView(MadsM4Engine *vm);
 	~RexMainMenuView();
 
 	bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
@@ -71,7 +71,7 @@
 	int getHighlightedItem(int x, int y);
 	void handleAction(MadsGameAction action);
 public:
-	DragonMainMenuView(M4Engine *vm);
+	DragonMainMenuView(MadsM4Engine *vm);
 	~DragonMainMenuView();
 
 	bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
@@ -80,7 +80,7 @@
 
 class MadsMainMenuView: public View {
 public:
-	MadsMainMenuView(M4Engine *vm);
+	MadsMainMenuView(MadsM4Engine *vm);
 
 	bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
 	void updateState();

Modified: scummvm/trunk/engines/m4/midi.cpp
===================================================================
--- scummvm/trunk/engines/m4/midi.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/midi.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -32,7 +32,7 @@
 
 namespace M4 {
 
-MidiPlayer::MidiPlayer(M4Engine *vm, MidiDriver *driver) : _vm(vm), _midiData(NULL), _driver(driver), _isPlaying(false), _passThrough(false), _isGM(false) {
+MidiPlayer::MidiPlayer(MadsM4Engine *vm, MidiDriver *driver) : _vm(vm), _midiData(NULL), _driver(driver), _isPlaying(false), _passThrough(false), _isGM(false) {
 	memset(_channel, 0, sizeof(_channel));
 	_masterVolume = 0;
 	_parser = MidiParser::createParser_SMF();

Modified: scummvm/trunk/engines/m4/midi.h
===================================================================
--- scummvm/trunk/engines/m4/midi.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/midi.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -36,7 +36,7 @@
 
 class MidiPlayer : public MidiDriver {
 public:
-	MidiPlayer(M4Engine *vm, MidiDriver *driver);
+	MidiPlayer(MadsM4Engine *vm, MidiDriver *driver);
 	~MidiPlayer();
 
 	bool isPlaying() { return _isPlaying; }
@@ -69,7 +69,7 @@
 protected:
 	static void onTimer(void *data);
 
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	byte *_midiData;
 
 	MidiChannel *_channel[16];

Modified: scummvm/trunk/engines/m4/resource.cpp
===================================================================
--- scummvm/trunk/engines/m4/resource.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/resource.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -409,7 +409,7 @@
 
 //--------------------------------------------------------------------------
 
-M4ResourceManager::M4ResourceManager(M4Engine *vm): ResourceManager(vm) {
+M4ResourceManager::M4ResourceManager(MadsM4Engine *vm): ResourceManager(vm) {
 	_hfs = new FileSystem(_vm->getGameFile(kFileTypeHash));
 }
 

Modified: scummvm/trunk/engines/m4/resource.h
===================================================================
--- scummvm/trunk/engines/m4/resource.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/resource.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -90,11 +90,11 @@
 	typedef Common::List<Common::SharedPtr<Resource> > ResourceList;
 	typedef ResourceList::iterator ResourceIterator;
 	ResourceList _resources;
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 
 	virtual Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag) = 0;
 public:
-	ResourceManager(M4Engine *vm): _vm(vm) {};
+	ResourceManager(MadsM4Engine *vm): _vm(vm) {};
 	virtual ~ResourceManager();
 
 	Common::SeekableReadStream *get(const char *resourceName, bool loadFlag = true);
@@ -119,7 +119,7 @@
 protected:
 	Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag);
 public:
-	MADSResourceManager(M4Engine *vm): ResourceManager(vm) {};
+	MADSResourceManager(MadsM4Engine *vm): ResourceManager(vm) {};
 	bool resourceExists(const char *resourceName);
 };
 
@@ -127,7 +127,7 @@
 protected:
 	Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag);
 public:
-	M4ResourceManager(M4Engine *vm);
+	M4ResourceManager(MadsM4Engine *vm);
 	~M4ResourceManager();
 	bool resourceExists(const char *resourceName);
 

Modified: scummvm/trunk/engines/m4/saveload.cpp
===================================================================
--- scummvm/trunk/engines/m4/saveload.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/saveload.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -34,7 +34,7 @@
 
 const char *orionSavesList = "saves.dir";
 
-SaveLoad::SaveLoad(M4Engine *vm) : _vm(vm) {
+SaveLoad::SaveLoad(MadsM4Engine *vm) : _vm(vm) {
 	// For Orion Burger, check the existance of a 'saves.dir' file to determine whether to
 	// act exactly like the original. Otherwise, we'll use the ScummVM standard, where we'll
 	// keep all the data for a savegame in a single file

Modified: scummvm/trunk/engines/m4/saveload.h
===================================================================
--- scummvm/trunk/engines/m4/saveload.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/saveload.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -38,12 +38,12 @@
 
 class SaveLoad {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	bool _emulateOriginal;
 
 	const char *generateSaveName(int slotNumber);
 public:
-	SaveLoad(M4Engine *vm);
+	SaveLoad(MadsM4Engine *vm);
 
 	bool hasSaves();
 	SaveGameList *getSaves();

Modified: scummvm/trunk/engines/m4/scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/scene.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/scene.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -44,7 +44,7 @@
 static const int SCROLLER_DELAY = 200;
 
 
-Scene::Scene(M4Engine *vm): View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
+Scene::Scene(MadsM4Engine *vm): View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
 	_screenType = VIEWID_SCENE;
 
 	_sceneResources.hotspots = new HotSpotList();
@@ -393,7 +393,7 @@
 		if (verbId == kVerbNone)
 			verbId = kVerbWalkTo;
 
-		sprintf(statusText, "%s %s\n", _vm->_globals->getVocab(verbId), currentHotSpot->getVocab());
+		sprintf(statusText, "%s %s\n", _madsVm->_globals->getVocab(verbId), currentHotSpot->getVocab());
 
 		statusText[0] = toupper(statusText[0]);	// capitalize first letter
 		setMADSStatusText(statusText);
@@ -535,7 +535,7 @@
 					if (currentHotSpot->getVerbID() != 0) {
 						sprintf(statusText, "%s %s\n", currentHotSpot->getVerb(), currentHotSpot->getVocab());
 					} else {
-						sprintf(statusText, "%s %s\n", _vm->_globals->getVocab(kVerbWalkTo), currentHotSpot->getVocab());
+						sprintf(statusText, "%s %s\n", _madsVm->_globals->getVocab(kVerbWalkTo), currentHotSpot->getVocab());
 					}
 
 					statusText[0] = toupper(statusText[0]);	// capitalize first letter
@@ -550,8 +550,8 @@
 			_vm->_interfaceView->_inventory.clearSelected();
 		} else {
 			// ***DEBUG*** - sample dialog display
-			int idx = 3; //_vm->_globals->messageIndexOf(0x277a);
-			const char *msg = _vm->_globals->loadMessage(idx);
+			int idx = 3; //_madsVm->_globals->messageIndexOf(0x277a);
+			const char *msg = _madsVm->_globals->loadMessage(idx);
 			Dialog *dlg = new Dialog(_vm, msg, "TEST DIALOG");
 			_vm->_viewManager->addView(dlg);
 			_vm->_viewManager->moveToFront(dlg);
@@ -699,12 +699,12 @@
 	// a second object can be selected, as in 'use gun to shoot person', with requires a target
 
 	// Set up the new action
-	strcpy(statusText, _vm->_globals->getVocab(action));
+	strcpy(statusText, _madsVm->_globals->getVocab(action));
 	statusText[0] = toupper(statusText[0]);	// capitalize first letter
 
 	if (objectId != -1) {
-		MadsObject *obj = _vm->_globals->getObject(objectId);
-		sprintf(statusText + strlen(statusText), " %s", _vm->_globals->getVocab(obj->descId));
+		MadsObject *obj = _madsVm->_globals->getObject(objectId);
+		sprintf(statusText + strlen(statusText), " %s", _madsVm->_globals->getVocab(obj->descId));
 	} else {
 		_currentAction = action;
 	}
@@ -719,7 +719,7 @@
  *--------------------------------------------------------------------------
  */
 
-MadsInterfaceView::MadsInterfaceView(M4Engine *vm): View(vm, Common::Rect(0, MADS_SURFACE_HEIGHT,
+MadsInterfaceView::MadsInterfaceView(MadsM4Engine *vm): View(vm, Common::Rect(0, MADS_SURFACE_HEIGHT,
 														 vm->_screen->width(), vm->_screen->height())) {
 	_screenType = VIEWID_INTERFACE;
 	_highlightedElement = -1;
@@ -772,8 +772,8 @@
 	// Build up the inventory list
 	_inventoryList.clear();
 
-	for (uint i = 0; i < _vm->_globals->getObjectsSize(); ++i) {
-		MadsObject *obj = _vm->_globals->getObject(i);
+	for (uint i = 0; i < _madsVm->_globals->getObjectsSize(); ++i) {
+		MadsObject *obj = _madsVm->_globals->getObject(i);
 		if (obj->roomNumber == PLAYER_INVENTORY)
 			_inventoryList.push_back(i);
 	}
@@ -823,7 +823,7 @@
 
 void MadsInterfaceView::addObjectToInventory(int objectNumber) {
 	if (_inventoryList.indexOf(objectNumber) == -1) {
-		_vm->_globals->getObject(objectNumber)->roomNumber = PLAYER_INVENTORY;
+		_madsVm->_globals->getObject(objectNumber)->roomNumber = PLAYER_INVENTORY;
 		_inventoryList.push_back(objectNumber);
 	}
 
@@ -847,7 +847,7 @@
 				((actionIndex == 0) ? ITEM_SELECTED : ITEM_NORMAL));
 
 			// Get the verb action and capitalise it
-			const char *verbStr = _vm->_globals->getVocab(kVerbLook + actionIndex);
+			const char *verbStr = _madsVm->_globals->getVocab(kVerbLook + actionIndex);
 			strcpy(buffer, verbStr);
 			if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A';
 
@@ -875,7 +875,7 @@
 		if ((_topIndex + i) >= _inventoryList.size())
 			break;
 
-		const char *descStr = _vm->_globals->getVocab(_vm->_globals->getObject(
+		const char *descStr = _madsVm->_globals->getVocab(_madsVm->_globals->getObject(
 			_inventoryList[_topIndex + i])->descId);
 		strcpy(buffer, descStr);
 		if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A';
@@ -898,21 +898,21 @@
 		M4Sprite *spr = _objectSprites->getFrame(_objectFrameNumber / INV_ANIM_FRAME_SPEED);
 		spr->copyTo(destSurface, INVENTORY_X, INVENTORY_Y, 0);
 
-		if (!_vm->_globals->invObjectsStill && !dialogVisible) {
+		if (!_madsVm->_globals->invObjectsStill && !dialogVisible) {
 			// If objetcs are to animated, move to the next frame
 			if (++_objectFrameNumber >= (_objectSprites->getCount() * INV_ANIM_FRAME_SPEED))
 				_objectFrameNumber = 0;
 		}
 
 		// List the vocab actions for the currently selected object
-		MadsObject *obj = _vm->_globals->getObject(_selectedObject);
+		MadsObject *obj = _madsVm->_globals->getObject(_selectedObject);
 		int yIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1);
 
 		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 = _vm->_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';
 
@@ -958,7 +958,7 @@
 			_vm->_scene->setAction(kVerbLook + (_highlightedElement - ACTIONS_START));
 		} else if ((_highlightedElement >= VOCAB_START) && (_highlightedElement < (VOCAB_START + 5))) {
 			// A vocab action was selected
-			MadsObject *obj = _vm->_globals->getObject(_selectedObject);
+			MadsObject *obj = _madsVm->_globals->getObject(_selectedObject);
 			int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->vocabCount - 1);
 			if (vocabIndex >= 0)
 				_vm->_scene->setAction(obj->vocabList[vocabIndex].vocabId, _selectedObject);

Modified: scummvm/trunk/engines/m4/scene.h
===================================================================
--- scummvm/trunk/engines/m4/scene.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/scene.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -79,7 +79,7 @@
 
 class Scene: public View {
 public:
-	Scene(M4Engine *vm);
+	Scene(MadsM4Engine *vm);
 	~Scene();
 
 	// TODO: perhaps move playIntro() someplace else?
@@ -162,7 +162,7 @@
 	bool handleCheatKey(int32 keycode);
 	bool handleKeypress(int32 keycode);
 public:
-	MadsInterfaceView(M4Engine *vm);
+	MadsInterfaceView(MadsM4Engine *vm);
 	~MadsInterfaceView();
 
 	void initialise();

Modified: scummvm/trunk/engines/m4/script.cpp
===================================================================
--- scummvm/trunk/engines/m4/script.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/script.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -217,7 +217,7 @@
 }
 
 
-ScriptInterpreter::ScriptInterpreter(M4Engine *vm) : _scriptFile(NULL), _vm(vm) {
+ScriptInterpreter::ScriptInterpreter(MadsM4Engine *vm) : _scriptFile(NULL), _vm(vm) {
 	initScriptKernel();
 	_dataCache = new ScriptDataCache(this);
 	_runningFunction = NULL;

Modified: scummvm/trunk/engines/m4/script.h
===================================================================
--- scummvm/trunk/engines/m4/script.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/script.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -276,7 +276,7 @@
 
 class ScriptInterpreter {
 public:
-	ScriptInterpreter(M4Engine *vm);
+	ScriptInterpreter(MadsM4Engine *vm);
 	~ScriptInterpreter();
 	/* Opens a M4 program file */
 	void open(const char *filename);
@@ -322,7 +322,7 @@
 
 protected:
 
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 
 	typedef Common::HashMap<Common::String, uint32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FunctionNameMap;
 	Common::File *_scriptFile;

Modified: scummvm/trunk/engines/m4/sound.cpp
===================================================================
--- scummvm/trunk/engines/m4/sound.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/sound.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -35,7 +35,7 @@
 
 namespace M4 {
 
-Sound::Sound(M4Engine *vm, Audio::Mixer *mixer, int volume) :
+Sound::Sound(MadsM4Engine *vm, Audio::Mixer *mixer, int volume) :
 	_vm(vm), _mixer(mixer) {
 
 	for (int i = 0; i < SOUND_HANDLES; i++)

Modified: scummvm/trunk/engines/m4/sound.h
===================================================================
--- scummvm/trunk/engines/m4/sound.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/sound.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -68,12 +68,12 @@
 	Common::Array<DSREntry *> dsrEntries;
 };
 
-class M4Engine;
+class MadsM4Engine;
 
 class Sound {
 public:
 
-	Sound(M4Engine *vm, Audio::Mixer *mixer, int volume);
+	Sound(MadsM4Engine *vm, Audio::Mixer *mixer, int volume);
 	~Sound();
 
 	void playSound(const char *soundName, int volume, bool loop, int channel = -1);
@@ -99,7 +99,7 @@
 
  private:
 
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Audio::Mixer *_mixer;
 	SndHandle _handles[SOUND_HANDLES];
 

Modified: scummvm/trunk/engines/m4/sprite.h
===================================================================
--- scummvm/trunk/engines/m4/sprite.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/sprite.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -106,8 +106,8 @@
 	int xOffset, yOffset;
 	uint8 encoding;
 
-	M4Sprite(M4Engine *vm): M4Surface() {}
-	M4Sprite(M4Engine *vm, int widthVal, int heightVal): M4Surface(widthVal, heightVal), xOffset(0), yOffset(0) {}
+	M4Sprite(MadsM4Engine *vm): M4Surface() {}
+	M4Sprite(MadsM4Engine *vm, int widthVal, int heightVal): M4Surface(widthVal, heightVal), xOffset(0), yOffset(0) {}
 	// Loads a sprite from the given stream, and optionally decompresses the RLE-encoded data
 	M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0);
 	// Loads an RLE compressed sprite; the surface must have been created before

Modified: scummvm/trunk/engines/m4/viewmgr.cpp
===================================================================
--- scummvm/trunk/engines/m4/viewmgr.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/viewmgr.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -31,7 +31,7 @@
 
 namespace M4 {
 
-void returnToMainMenuFn(M4Engine *vm) {
+void returnToMainMenuFn(MadsM4Engine *vm) {
 	vm->_palette->resetColorCounts();
 	vm->_palette->setMadsSystemPalette();
 
@@ -105,14 +105,14 @@
 
 // View constructor
 
-View::View(M4Engine *vm, const Common::Rect &viewBounds, bool transparent)
+View::View(MadsM4Engine *vm, const Common::Rect &viewBounds, bool transparent)
 	: M4Surface(viewBounds.width(), viewBounds.height()), _hotkeys(this), _vm(vm) {
 	SCREEN_FLAGS_DEFAULT;
 	_coords = viewBounds;
 	_transparent = transparent;
 }
 
-View::View(M4Engine *vm, int x, int y, bool transparent)
+View::View(MadsM4Engine *vm, int x, int y, bool transparent)
 	: M4Surface(), _hotkeys(this), _vm(vm) {
 	SCREEN_FLAGS_DEFAULT;
 	_coords.left = x;
@@ -194,7 +194,7 @@
 
 //--------------------------------------------------------------------------
 
-ViewManager::ViewManager(M4Engine *vm): _systemHotkeys(HotkeyList(NULL)), _vm(vm) {
+ViewManager::ViewManager(MadsM4Engine *vm): _systemHotkeys(HotkeyList(NULL)), _vm(vm) {
 	_captureScreen = NULL;
 	_captureEvents = false;
 }

Modified: scummvm/trunk/engines/m4/viewmgr.h
===================================================================
--- scummvm/trunk/engines/m4/viewmgr.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/viewmgr.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -89,7 +89,7 @@
 
 struct Hotkey {
 public:
-	typedef void (*Callback)(M4Engine *vm, View *view, uint32 key);
+	typedef void (*Callback)(MadsM4Engine *vm, View *view, uint32 key);
 	Hotkey(uint32 keyVal, Hotkey::Callback callbackFn) : key(keyVal), callback(callbackFn) {};
 	uint32 key;
 	Hotkey::Callback callback;
@@ -109,8 +109,8 @@
 
 class View: public M4Surface {
 public:
-	View(M4Engine *vm, const Common::Rect &viewBounds, bool transparent = false);
-	View(M4Engine *vm, int x = 0, int y = 0, bool transparent = false);
+	View(MadsM4Engine *vm, const Common::Rect &viewBounds, bool transparent = false);
+	View(MadsM4Engine *vm, int x = 0, int y = 0, bool transparent = false);
 	virtual ~View() {}
 
 	void getCoordinates(Common::Rect &rect);
@@ -139,7 +139,7 @@
 	virtual void updateState() {};
 
 protected:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	Common::Rect _coords;
 	HotkeyList _hotkeys;
 	int _screenType;
@@ -149,7 +149,7 @@
 
 class ViewManager {
 private:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	HotkeyList _systemHotkeys;
 	Common::List<View *> _views;
 	View *_captureScreen;
@@ -157,7 +157,7 @@
 public:
 	typedef Common::List<View *>::iterator ListIterator;
 
-	ViewManager(M4Engine *vm);
+	ViewManager(MadsM4Engine *vm);
 	~ViewManager();
 
 	void addView(View *view);

Modified: scummvm/trunk/engines/m4/woodscript.cpp
===================================================================
--- scummvm/trunk/engines/m4/woodscript.cpp	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/woodscript.cpp	2010-01-30 09:21:07 UTC (rev 47705)
@@ -153,7 +153,7 @@
 	return true;
 }
 
-WoodScript::WoodScript(M4Engine *vm) {
+WoodScript::WoodScript(MadsM4Engine *vm) {
 	_vm = vm;
 	_machineId = 0;
 	_assets = new AssetManager(vm);

Modified: scummvm/trunk/engines/m4/woodscript.h
===================================================================
--- scummvm/trunk/engines/m4/woodscript.h	2010-01-30 07:11:38 UTC (rev 47704)
+++ scummvm/trunk/engines/m4/woodscript.h	2010-01-30 09:21:07 UTC (rev 47705)
@@ -43,7 +43,7 @@
 
 namespace M4 {
 
-class M4Engine;
+class MadsM4Engine;
 class WoodScript;
 class Machine;
 class Sequence;
@@ -278,7 +278,7 @@
 class WoodScript {
 public:
 
-	WoodScript(M4Engine *vm);
+	WoodScript(MadsM4Engine *vm);
 	~WoodScript();
 
 	Machine *createMachine(int32 machineHash, Sequence *parentSeq, int32 dataHash, int32 dataRowIndex, int callbackHandler, const char *machineName);
@@ -323,7 +323,7 @@
 	byte *getInverseColorTable() const { return _inverseColorTable; }
 
 protected:
-	M4Engine *_vm;
+	MadsM4Engine *_vm;
 	AssetManager *_assets;
 
 	Common::Array<Sequence*> _sequences, _layers;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list