diff options
author | Bertrand Augereau | 2011-09-02 16:41:54 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-09-02 16:41:54 +0200 |
commit | 3bcc4ce1fdd22de41a2e772f8dedcb17c4a48347 (patch) | |
tree | 6fa123344055f01bdabd723e78915230df672e5d /engines/dreamweb/use.cpp | |
parent | 1d412ff7f736f890bef62ebba18c23751728235e (diff) | |
download | scummvm-rg350-3bcc4ce1fdd22de41a2e772f8dedcb17c4a48347.tar.gz scummvm-rg350-3bcc4ce1fdd22de41a2e772f8dedcb17c4a48347.tar.bz2 scummvm-rg350-3bcc4ce1fdd22de41a2e772f8dedcb17c4a48347.zip |
DREAMWEB: 'useroutine' ported to C++
Diffstat (limited to 'engines/dreamweb/use.cpp')
-rw-r--r-- | engines/dreamweb/use.cpp | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp new file mode 100644 index 0000000000..237c8d4fad --- /dev/null +++ b/engines/dreamweb/use.cpp @@ -0,0 +1,169 @@ +/* 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 "dreamweb/dreamweb.h" + +namespace DreamGen { + + +typedef void (DreamGenContext::*UseCallback)(void); + +struct UseListEntry { + uint8 id[5]; // 0-terminal because it is easier syntatically to initialize the array + UseCallback callback; +}; + +void DreamGenContext::useroutine() { + + static const UseListEntry kUseList[] = { + { "NETW", &DreamGenContext::usemon }, + { "ELVA", &DreamGenContext::useelevator1 }, + { "ELVB", &DreamGenContext::useelevator2 }, + { "ELVC", &DreamGenContext::useelevator3 }, + { "ELVE", &DreamGenContext::useelevator4 }, + { "ELVF", &DreamGenContext::useelevator5 }, + { "CGAT", &DreamGenContext::usechurchgate }, + { "REMO", &DreamGenContext::usestereo }, + { "BUTA", &DreamGenContext::usebuttona }, + { "CBOX", &DreamGenContext::usewinch }, + { "LITE", &DreamGenContext::uselighter }, + { "PLAT", &DreamGenContext::useplate }, + { "LIFT", &DreamGenContext::usecontrol }, + { "WIRE", &DreamGenContext::usewire }, + { "HNDL", &DreamGenContext::usehandle }, + { "HACH", &DreamGenContext::usehatch }, + { "DOOR", &DreamGenContext::useelvdoor }, + { "CSHR", &DreamGenContext::usecashcard }, + { "GUNA", &DreamGenContext::usegun }, + { "CRAA", &DreamGenContext::usecardreader1 }, + { "CRBB", &DreamGenContext::usecardreader2 }, + { "CRCC", &DreamGenContext::usecardreader3 }, + { "SEAT", &DreamGenContext::sitdowninbar }, + { "MENU", &DreamGenContext::usemenu }, + { "COOK", &DreamGenContext::usecooker }, + { "ELCA", &DreamGenContext::callhotellift }, + { "EDCA", &DreamGenContext::calledenslift }, + { "DDCA", &DreamGenContext::calledensdlift }, + { "ALTR", &DreamGenContext::usealtar }, + { "LOKA", &DreamGenContext::openhoteldoor }, + { "LOKB", &DreamGenContext::openhoteldoor2 }, + { "ENTA", &DreamGenContext::openlouis }, + { "ENTB", &DreamGenContext::openryan }, + { "ENTE", &DreamGenContext::openpoolboss }, + { "ENTC", &DreamGenContext::openyourneighbour }, + { "ENTD", &DreamGenContext::openeden }, + { "ENTH", &DreamGenContext::opensarters }, + { "WWAT", &DreamGenContext::wearwatch }, + { "POOL", &DreamGenContext::usepoolreader }, + { "WSHD", &DreamGenContext::wearshades }, + { "GRAF", &DreamGenContext::grafittidoor }, + { "TRAP", &DreamGenContext::trapdoor }, + { "CDPE", &DreamGenContext::edenscdplayer }, + { "DLOK", &DreamGenContext::opentvdoor }, + { "HOLE", &DreamGenContext::usehole }, + { "DRYR", &DreamGenContext::usedryer }, + { "HOLY", &DreamGenContext::usechurchhole }, + { "WALL", &DreamGenContext::usewall }, + { "BOOK", &DreamGenContext::usediary }, + { "AXED", &DreamGenContext::useaxe }, + { "SHLD", &DreamGenContext::useshield }, + { "BCNY", &DreamGenContext::userailing }, + { "LIDC", &DreamGenContext::usecoveredbox }, + { "LIDU", &DreamGenContext::useclearbox }, + { "LIDO", &DreamGenContext::useopenbox }, + { "PIPE", &DreamGenContext::usepipe }, + { "BALC", &DreamGenContext::usebalcony }, + { "WIND", &DreamGenContext::usewindow }, + { "PAPR", &DreamGenContext::viewfolder }, + { "UWTA", &DreamGenContext::usetrainer }, + { "UWTB", &DreamGenContext::usetrainer }, + { "STAT", &DreamGenContext::entersymbol }, + { "TLID", &DreamGenContext::opentomb }, + { "SLAB", &DreamGenContext::useslab }, + { "CART", &DreamGenContext::usecart }, + { "FCAR", &DreamGenContext::usefullcart }, + { "SLBA", &DreamGenContext::slabdoora }, + { "SLBB", &DreamGenContext::slabdoorb }, + { "SLBC", &DreamGenContext::slabdoorc }, + { "SLBD", &DreamGenContext::slabdoord }, + { "SLBE", &DreamGenContext::slabdoore }, + { "SLBF", &DreamGenContext::slabdoorf }, + { "PLIN", &DreamGenContext::useplinth }, + { "LADD", &DreamGenContext::useladder }, + { "LADB", &DreamGenContext::useladderb }, + { "GUMA", &DreamGenContext::chewy }, + { "SQEE", &DreamGenContext::wheelsound }, + { "TAPP", &DreamGenContext::runtap }, + { "GUIT", &DreamGenContext::playguitar }, + { "CONT", &DreamGenContext::hotelcontrol }, + { "BELL", &DreamGenContext::hotelbell }, + }; + + if (data.byte(kReallocation) >= 50) { + if (data.byte(kPointerpower) == 0) + return; + data.byte(kPointerpower) = 0; + } + + getanyad(); + const uint8 *id = es.ptr(bx + 12, 4); + + for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) { + const UseListEntry &entry = kUseList[i]; + if (('A' + id[0] == entry.id[0]) && ('A' + id[1] == entry.id[1]) && ('A' + id[2] == entry.id[2]) && ('A' + id[3] == entry.id[3])) { + (this->*entry.callback)(); + return; + } + } + + delpointer(); + getobtextstart(); + findnextcolon(); + if (al != 0) { + findnextcolon(); + if (al != 0) { + al = es.byte(si); + if (al != 0) { + usetext(); + cx = 400; + hangonp(); + putbackobstuff(); + return; + } + } + } + + createpanel(); + showpanel(); + showman(); + showexit(); + obicons(); + printmessage(33, 100, 63, 241, true); + worktoscreenm(); + cx = 50; + hangonp(); + putbackobstuff(); + data.byte(kCommandtype) = 255; +} + +} /*namespace dreamgen */ + |