diff options
-rw-r--r-- | engines/director/director.cpp | 13 | ||||
-rw-r--r-- | engines/director/director.h | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 61 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 60 | ||||
-rw-r--r-- | engines/director/module.mk | 4 |
5 files changed, 136 insertions, 5 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index a044f23cc4..9108225565 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -31,15 +31,16 @@ #include "common/stream.h" #include "common/system.h" #include "common/textconsole.h" -#include "director/dib.h" #include "engines/util.h" -#include "director/director.h" -#include "director/score.h" -#include "director/resource.h" #include "graphics/surface.h" +#include "director/director.h" +#include "director/dib.h" +#include "director/resource.h" +#include "director/score.h" +#include "director/lingo/lingo.h" namespace Director { @@ -66,6 +67,8 @@ DirectorEngine::~DirectorEngine() { Common::Error DirectorEngine::run() { debug("Starting v%d Director game", getVersion()); + _lingo = new Lingo(); + //FIXME _mainArchive = new RIFFArchive(); _mainArchive->openFile("bookshelf_example.mmm"); @@ -86,6 +89,8 @@ void DirectorEngine::loadEXE() { if (!exeStream) error("Failed to open EXE '%s'", getEXEName().c_str()); + _lingo->processEvent(kEventStart, 0); + exeStream->seek(-4, SEEK_END); exeStream->seek(exeStream->readUint32LE()); diff --git a/engines/director/director.h b/engines/director/director.h index 2d1c39518a..205495a62a 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -41,6 +41,7 @@ enum DirectorGameID { class Archive; struct DirectorGameDescription; +class Lingo; class DirectorEngine : public ::Engine { public: @@ -76,6 +77,8 @@ private: Archive *_mainArchive; Common::MacResManager *_macBinary; + + Lingo *_lingo; }; } // End of namespace Director diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp new file mode 100644 index 0000000000..94e23fa403 --- /dev/null +++ b/engines/director/lingo/lingo.cpp @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "director/lingo/lingo.h" + +namespace Director { + +struct EventHandlerType { + LEvent handler; + const char *name; +} static const eventHanlerDescs[] = { + { kEventEnterFrame, "enterFrame" }, + { kEventPrepareFrame, "prepareFrame" }, + { kEventExitFrame, "exitFrame" }, + + { kEventActivateWindow, "activateWindow" }, + { kEventDeactivateWindow, "deactivateWindow" }, + { kEventMoveWindow, "moveWindow" }, + { kEventResizeWindow, "resizeWindow" }, + { kEventOpenWindow, "openWindow" }, + { kEventCloseWindow, "closeWindow" }, + { kEventStart, "start" }, + { kEventNone, 0 }, +}; + +Lingo::Lingo() { + for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t) + _eventHandlerTypes[t->handler] = t->name; +} + +Lingo::~Lingo() { +} + +void Lingo::processEvent(LEvent event, int entityId) { + if (!_eventHandlerTypes.contains(event)) + error("processEvent: Unknown event %d for entity %d", event, entityId); + + debug(0, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId); +} + + +} // End of namespace Director diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h new file mode 100644 index 0000000000..b3810a6470 --- /dev/null +++ b/engines/director/lingo/lingo.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef DIRECTOR_LINGO_LINGO_H +#define DIRECTOR_LINGO_LINGO_H + +#include "common/debug.h" +#include "common/hashmap.h" + +namespace Director { + +enum LEvent { + kEventNone, + kEventEnterFrame, + kEventPrepareFrame, + kEventExitFrame, + + kEventActivateWindow, + kEventDeactivateWindow, + kEventMoveWindow, + kEventResizeWindow, + kEventOpenWindow, + kEventCloseWindow, + + kEventStart +}; + +class Lingo { +public: + Lingo(); + ~Lingo(); + + void processEvent(LEvent event, int entityId); + +private: + Common::HashMap<uint32, const char *> _eventHandlerTypes; +}; + +} // End of namespace Director + +#endif diff --git a/engines/director/module.mk b/engines/director/module.mk index cf4a587dc5..6f2e2165a8 100644 --- a/engines/director/module.mk +++ b/engines/director/module.mk @@ -5,7 +5,9 @@ MODULE_OBJS = \ dib.o \ director.o \ resource.o \ - score.o + score.o \ + lingo/lingo.o + # This module can be built as a plugin ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN) PLUGIN := 1 |