DREAMWEB: 'useroutine' ported to C++
This commit is contained in:
parent
1d412ff7f7
commit
3bcc4ce1fd
6 changed files with 173 additions and 89 deletions
|
@ -191,6 +191,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||||
'showryanpage',
|
'showryanpage',
|
||||||
'findallryan',
|
'findallryan',
|
||||||
'fillryan',
|
'fillryan',
|
||||||
|
'useroutine',
|
||||||
], skip_output = [
|
], skip_output = [
|
||||||
# These functions are processed but not output
|
# These functions are processed but not output
|
||||||
'dreamweb',
|
'dreamweb',
|
||||||
|
|
|
@ -8162,91 +8162,6 @@ douse:
|
||||||
useroutine();
|
useroutine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DreamGenContext::useroutine() {
|
|
||||||
STACK_CHECK;
|
|
||||||
_cmp(data.byte(kReallocation), 50);
|
|
||||||
if (flags.c())
|
|
||||||
goto nodream7;
|
|
||||||
_cmp(data.byte(kPointerpower), 0);
|
|
||||||
if (!flags.z())
|
|
||||||
goto powerok;
|
|
||||||
return;
|
|
||||||
powerok:
|
|
||||||
data.byte(kPointerpower) = 0;
|
|
||||||
nodream7:
|
|
||||||
getanyad();
|
|
||||||
dx = data;
|
|
||||||
ds = dx;
|
|
||||||
si = offset_uselist;
|
|
||||||
checkuselist:
|
|
||||||
push(si);
|
|
||||||
_lodsb();
|
|
||||||
_sub(al, 'A');
|
|
||||||
_cmp(al, es.byte(bx+12));
|
|
||||||
if (!flags.z())
|
|
||||||
goto failed;
|
|
||||||
_lodsb();
|
|
||||||
_sub(al, 'A');
|
|
||||||
_cmp(al, es.byte(bx+13));
|
|
||||||
if (!flags.z())
|
|
||||||
goto failed;
|
|
||||||
_lodsb();
|
|
||||||
_sub(al, 'A');
|
|
||||||
_cmp(al, es.byte(bx+14));
|
|
||||||
if (!flags.z())
|
|
||||||
goto failed;
|
|
||||||
_lodsb();
|
|
||||||
_sub(al, 'A');
|
|
||||||
_cmp(al, es.byte(bx+15));
|
|
||||||
if (!flags.z())
|
|
||||||
goto failed;
|
|
||||||
_lodsw();
|
|
||||||
si = pop();
|
|
||||||
__dispatch_call(ax);
|
|
||||||
return;
|
|
||||||
failed:
|
|
||||||
si = pop();
|
|
||||||
_add(si, 6);
|
|
||||||
_cmp(ds.byte(si), 140);
|
|
||||||
if (!flags.z())
|
|
||||||
goto checkuselist;
|
|
||||||
delpointer();
|
|
||||||
getobtextstart();
|
|
||||||
findnextcolon();
|
|
||||||
_cmp(al, 0);
|
|
||||||
if (flags.z())
|
|
||||||
goto cantuse2;
|
|
||||||
findnextcolon();
|
|
||||||
_cmp(al, 0);
|
|
||||||
if (flags.z())
|
|
||||||
goto cantuse2;
|
|
||||||
al = es.byte(si);
|
|
||||||
_cmp(al, 0);
|
|
||||||
if (flags.z())
|
|
||||||
goto cantuse2;
|
|
||||||
usetext();
|
|
||||||
cx = 400;
|
|
||||||
hangonp();
|
|
||||||
putbackobstuff();
|
|
||||||
return;
|
|
||||||
cantuse2:
|
|
||||||
createpanel();
|
|
||||||
showpanel();
|
|
||||||
showman();
|
|
||||||
showexit();
|
|
||||||
obicons();
|
|
||||||
di = 33;
|
|
||||||
bx = 100;
|
|
||||||
al = 63;
|
|
||||||
dl = 241;
|
|
||||||
printmessage();
|
|
||||||
worktoscreenm();
|
|
||||||
cx = 50;
|
|
||||||
hangonp();
|
|
||||||
putbackobstuff();
|
|
||||||
data.byte(kCommandtype) = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DreamGenContext::wheelsound() {
|
void DreamGenContext::wheelsound() {
|
||||||
STACK_CHECK;
|
STACK_CHECK;
|
||||||
al = 17;
|
al = 17;
|
||||||
|
@ -17326,7 +17241,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
|
||||||
case addr_printcurs: printcurs(); break;
|
case addr_printcurs: printcurs(); break;
|
||||||
case addr_delcurs: delcurs(); break;
|
case addr_delcurs: delcurs(); break;
|
||||||
case addr_useobject: useobject(); break;
|
case addr_useobject: useobject(); break;
|
||||||
case addr_useroutine: useroutine(); break;
|
|
||||||
case addr_wheelsound: wheelsound(); break;
|
case addr_wheelsound: wheelsound(); break;
|
||||||
case addr_runtap: runtap(); break;
|
case addr_runtap: runtap(); break;
|
||||||
case addr_playguitar: playguitar(); break;
|
case addr_playguitar: playguitar(); break;
|
||||||
|
|
|
@ -368,7 +368,6 @@ public:
|
||||||
static const uint16 addr_playguitar = 0xc590;
|
static const uint16 addr_playguitar = 0xc590;
|
||||||
static const uint16 addr_runtap = 0xc58c;
|
static const uint16 addr_runtap = 0xc58c;
|
||||||
static const uint16 addr_wheelsound = 0xc588;
|
static const uint16 addr_wheelsound = 0xc588;
|
||||||
static const uint16 addr_useroutine = 0xc584;
|
|
||||||
static const uint16 addr_useobject = 0xc580;
|
static const uint16 addr_useobject = 0xc580;
|
||||||
static const uint16 addr_delcurs = 0xc57c;
|
static const uint16 addr_delcurs = 0xc57c;
|
||||||
static const uint16 addr_printcurs = 0xc578;
|
static const uint16 addr_printcurs = 0xc578;
|
||||||
|
@ -642,7 +641,6 @@ public:
|
||||||
static const uint16 offset_openchangesize = 0x0a1c;
|
static const uint16 offset_openchangesize = 0x0a1c;
|
||||||
static const uint16 offset_keys = 0x0b14;
|
static const uint16 offset_keys = 0x0b14;
|
||||||
static const uint16 offset_mainlist2 = 0x1440;
|
static const uint16 offset_mainlist2 = 0x1440;
|
||||||
static const uint16 offset_uselist = 0x0ba8;
|
|
||||||
static const uint16 offset_gameerror2 = 0x0fb2;
|
static const uint16 offset_gameerror2 = 0x0fb2;
|
||||||
static const uint16 offset_loadlist = 0x0ef0;
|
static const uint16 offset_loadlist = 0x0ef0;
|
||||||
static const uint16 offset_gameerror6 = 0x10be;
|
static const uint16 offset_gameerror6 = 0x10be;
|
||||||
|
@ -1817,7 +1815,7 @@ public:
|
||||||
//void turnanypathon();
|
//void turnanypathon();
|
||||||
void restorereels();
|
void restorereels();
|
||||||
void setwalk();
|
void setwalk();
|
||||||
void useroutine();
|
//void useroutine();
|
||||||
void zoomicon();
|
void zoomicon();
|
||||||
//void findlen();
|
//void findlen();
|
||||||
void findpathofpoint();
|
void findpathofpoint();
|
||||||
|
|
|
@ -11,6 +11,7 @@ MODULE_OBJS := \
|
||||||
saveload.o \
|
saveload.o \
|
||||||
sprite.o \
|
sprite.o \
|
||||||
stubs.o \
|
stubs.o \
|
||||||
|
use.o \
|
||||||
vgagrafx.o
|
vgagrafx.o
|
||||||
|
|
||||||
# This module can be built as a plugin
|
# This module can be built as a plugin
|
||||||
|
|
|
@ -230,4 +230,5 @@
|
||||||
void findallryan();
|
void findallryan();
|
||||||
void findallryan(uint8 *inv);
|
void findallryan(uint8 *inv);
|
||||||
void fillryan();
|
void fillryan();
|
||||||
|
void useroutine();
|
||||||
|
|
||||||
|
|
169
engines/dreamweb/use.cpp
Normal file
169
engines/dreamweb/use.cpp
Normal file
|
@ -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 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue