DREAMWEB: Convert a bunch of stuff to C++

Specifically, I started with openOb() and withWhat() which allowed to
remove offset_commandline and offset_openchangesize. A clean conversion of
these required a conversion of printMessage2 and getOpenedSize.
This commit is contained in:
Max Horn 2011-12-15 10:54:28 +01:00
parent ee43bfed74
commit 719f3ec178
9 changed files with 163 additions and 208 deletions

View file

@ -48,6 +48,8 @@ p = parser(skip_binary_data = [
'icongraphics1',
'savenames',
'volumetabname',
'commandline',
'openchangesize',
# keypad.asm
'keypadlist',
'symbollist',
@ -438,6 +440,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'getnamepos',
'getnextword',
'getnumber',
'getopenedsize',
'getpersframe',
'getreelframeax',
'getreelstart',
@ -592,6 +595,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'openhoteldoor2',
'openinv',
'openlouis',
'openob',
'openpoolboss',
'openryan',
'opensarters',
@ -626,6 +630,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'printdirect',
'printlogo',
'printmessage',
'printmessage2',
'printoutermon',
'printslow',
'printsprites',
@ -871,6 +876,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'wheelsound',
'widedoor',
'width160',
'withwhat',
'workoutframes',
'worktoscreen',
'worktoscreenm',
@ -1349,7 +1355,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'printdirect' : 'printDirect',
'printlogo' : 'printLogo',
'printmessage' : 'printMessage',
'printmessage2' : 'printmessage2',
'printmessage2' : 'printMessage2',
'printoutermon' : 'printOuterMon',
'printslow' : 'printSlow',
'printsprites' : 'printSprites',

View file

@ -47,8 +47,14 @@ class DreamBase : public SegmentManager {
protected:
DreamWeb::DreamWebEngine *engine;
// from object.cpp
uint16 _openChangeSize;
// from pathfind.cpp
Common::Point _lineData[200]; // Output of Bresenham
public:
DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) { }
DreamBase(DreamWeb::DreamWebEngine *en);
public:
// from monitor.cpp
@ -76,7 +82,6 @@ public:
void obIcons();
// from pathfind.cpp
Common::Point _lineData[200]; // Output of Bresenham
void checkDest(const RoomPaths *roomsPaths);
RoomPaths *getRoomsPaths();
void faceRightWay();
@ -126,6 +131,7 @@ public:
// from stubs.cpp
void crosshair();
void delTextLine();
void showBlink();
void dumpBlink();
void dumpPointer();

View file

@ -950,37 +950,6 @@ findnewpage:
delPointer();
}
void DreamGenContext::openOb() {
STACK_CHECK;
al = data.byte(kOpenedob);
ah = data.byte(kOpenedtype);
di = offset_commandline;
copyName();
di = (80);
bx = (58)+86;
al = 62;
dl = 240;
printMessage();
di = data.word(kLastxpos);
_add(di, 5);
bx = (58)+86;
es = cs;
si = offset_commandline;
dl = 220;
al = 0;
ah = 0;
printDirect();
fillOpen();
getOpenedSize();
al = ah;
ah = 0;
cx = (44);
_mul(cx);
_add(ax, (80));
bx = offset_openchangesize;
cs.word(bx) = ax;
}
void DreamGenContext::getObTextStart() {
STACK_CHECK;
es = data.word(kFreedesc);
@ -1475,29 +1444,6 @@ isex:
ax = es.word(bx+7);
}
void DreamGenContext::getOpenedSize() {
STACK_CHECK;
_cmp(data.byte(kOpenedtype), 4);
if (flags.z())
goto isex2;
_cmp(data.byte(kOpenedtype), 2);
if (flags.z())
goto isfree2;
al = data.byte(kOpenedob);
getSetAd();
ax = es.word(bx+3);
return;
isfree2:
al = data.byte(kOpenedob);
getFreeAd();
ax = es.word(bx+7);
return;
isex2:
al = data.byte(kOpenedob);
getExAd();
ax = es.word(bx+7);
}
void DreamGenContext::getSetAd() {
STACK_CHECK;
ah = 0;
@ -2586,14 +2532,14 @@ void DreamGenContext::getDestInfo() {
push(ax);
dx = data;
es = dx;
si = 1174;
si = 1131;
_add(si, ax);
cl = es.byte(si);
ax = pop();
push(cx);
dx = data;
es = dx;
si = 1190;
si = 1147;
_add(si, ax);
ax = pop();
}
@ -2645,7 +2591,7 @@ clearedlocations:
bx = ax;
dx = data;
es = dx;
_add(bx, 1174);
_add(bx, 1131);
es.byte(bx) = 0;
}
@ -2684,7 +2630,7 @@ dirroot:
si = offset_rootdir;
_inc(si);
es = cs;
di = 1050;
di = 1048;
_inc(di);
cx = 12;
_movsb(cx, true);
@ -2786,7 +2732,7 @@ notyetassigned:
push(bx);
_add(bx, 2);
ds = cs;
si = 1208;
si = 1165;
checkpass:
_lodsw();
ah = es.byte(bx);
@ -2857,7 +2803,7 @@ void DreamGenContext::read() {
return;
okcom:
es = cs;
di = 1050;
di = 1048;
ax = data.word(kTextfile1);
data.word(kMonsource) = ax;
ds = ax;
@ -2987,7 +2933,7 @@ keyok2:
ds = cs;
si = offset_operand1+1;
es = cs;
di = 1050+1;
di = 1048+1;
cx = 12;
_movsb(cx, true);
monitorLogo();
@ -3114,7 +3060,7 @@ void DreamGenContext::parser() {
al = '=';
_stosb();
ds = cs;
si = 1208;
si = 1165;
notspace1:
_lodsw();
_cmp(al, 32);
@ -3154,7 +3100,7 @@ void DreamGenContext::notHeldError() {
al = 63;
ah = 1;
dl = 201;
printmessage2();
printMessage2();
workToScreenM();
cx = 50;
hangOnP();
@ -3333,48 +3279,6 @@ stereoon:
putBackObStuff();
}
void DreamGenContext::withWhat() {
STACK_CHECK;
createPanel();
showPanel();
showMan();
showExit();
al = data.byte(kCommand);
ah = data.byte(kObjecttype);
es = cs;
di = offset_commandline;
copyName();
di = 100;
bx = 21;
dl = 200;
al = 63;
ah = 2;
printmessage2();
di = data.word(kLastxpos);
_add(di, 5);
bx = 21;
es = cs;
si = offset_commandline;
dl = 220;
al = 0;
ah = 0;
printDirect();
di = data.word(kLastxpos);
_add(di, 5);
bx = 21;
dl = 200;
al = 63;
ah = 3;
printmessage2();
fillRyan();
data.byte(kCommandtype) = 255;
readMouse();
showPointer();
workToScreen();
delPointer();
data.byte(kInvopen) = 2;
}
void DreamGenContext::selectOb() {
STACK_CHECK;
findInvPos();
@ -3795,7 +3699,7 @@ void DreamGenContext::clearChanges() {
di = 0;
_stosw(cx, true);
es = cs;
di = 1174;
di = 1131;
al = 1;
_stosb(2);
al = 0;
@ -3957,35 +3861,6 @@ gotfirst:
al = es.byte(bx+6);
}
void DreamGenContext::printmessage2() {
STACK_CHECK;
push(dx);
push(bx);
push(di);
push(ax);
ah = 0;
_add(ax, ax);
bx = ax;
es = data.word(kCommandtext);
ax = es.word(bx);
_add(ax, (66*2));
si = ax;
ax = pop();
searchmess:
push(ax);
findNextColon();
ax = pop();
_dec(ah);
if (!flags.z())
goto searchmess;
di = pop();
bx = pop();
dx = pop();
al = 0;
ah = 0;
printDirect();
}
void DreamGenContext::__start() {
static const uint8 src[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -4102,43 +3977,43 @@ void DreamGenContext::__start() {
//0x0370: .2.. .... .2.. .!(.
0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39,
//0x0380: .2.. .DRE AMWE B.V9
0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20,
//0x0390: 9... ..PU BLIC
0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00,
//0x03a0: PU BLIC ...
0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e,
//0x03b0: BLAC KDRA GON RYAN
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49,
//0x03c0: . ..HE NDRI
0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x03d0: X LO UIS
0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20,
//0x03e0: ... SEPT IMUS
0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20,
//0x03f0: BECK ETT . ..
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f,
//0x0400: . "ROO
0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0410: T ."
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00,
//0x0420: . 0000 .00.
0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45,
//0x0430: .... $OBJ ECT NAME
0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0440: ONE
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12,
//0x0450: ...
0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,
//0x0460: .... .... .... ....
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0470: .... ..D: .... ....
0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0390: 9... PUBL IC
0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c,
//0x03a0: PUBL IC . ..BL
0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20,
//0x03b0: ACKD RAGO N RY AN
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20,
//0x03c0: ... HEND RIX
0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
//0x03d0: LOUI S .
0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45,
//0x03e0: ..SE PTIM US BE
0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20,
//0x03f0: CKET T ...
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20,
//0x0400: ."R OOT
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0410: . "
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a,
//0x0420: .00 00.0 0...
0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
//0x0430: ..$. .... .... ....
0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00,
//0x0440: .... .... ...D :...
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0450: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00,
//0x0460: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04,
//0x0470: .... .... .... ....
0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0480: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0490: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04a0: .... .... .... ....
0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04b0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04c0: .... .... .... ....
@ -4148,15 +4023,9 @@ void DreamGenContext::__start() {
//0x04e0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
//0x0500: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0510: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0520: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
//0x0530: .... .... .... ....
0x00, };
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
}

View file

@ -32,13 +32,11 @@
namespace DreamGen {
static const uint16 offset_money2poke = 0x042d;
static const uint16 offset_rootdir = 0x040c;
static const uint16 offset_openchangesize = 0x0392;
static const uint16 offset_keys = 0x0394;
static const uint16 offset_commandline = 0x0435;
static const uint16 offset_money1poke = 0x0428;
static const uint16 offset_operand1 = 0x03fe;
static const uint16 offset_money1poke = 0x0426;
static const uint16 offset_operand1 = 0x03fc;
static const uint16 offset_rootdir = 0x040a;
static const uint16 offset_keys = 0x0392;
static const uint16 offset_money2poke = 0x042b;
static const uint16 kStartvars = 0;
static const uint16 kProgresspoints = 1;
static const uint16 kWatchon = 2;
@ -366,15 +364,15 @@ static const uint16 kCurrentsample = 442;
static const uint16 kRoomssample = 443;
static const uint16 kReelroutines = 444;
static const uint16 kBasicsample = 901;
static const uint16 kCurrentfile = 1050;
static const uint16 kRoomscango = 1174;
static const uint16 kRoompics = 1190;
static const uint16 kOplist = 1205;
static const uint16 kInputline = 1208;
static const uint16 kPresslist = 1336;
static const uint16 kQuitrequested = 1342;
static const uint16 kSubtitles = 1343;
static const uint16 kForeignrelease = 1344;
static const uint16 kCurrentfile = 1048;
static const uint16 kRoomscango = 1131;
static const uint16 kRoompics = 1147;
static const uint16 kOplist = 1162;
static const uint16 kInputline = 1165;
static const uint16 kPresslist = 1293;
static const uint16 kQuitrequested = 1299;
static const uint16 kSubtitles = 1300;
static const uint16 kForeignrelease = 1301;
static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0);
@ -478,6 +476,7 @@ public:
void fadeDownMon();
void identifyOb();
void getPersonText();
void clearBuffers();
void getObTextStart();
void checkObjectSize();
@ -487,7 +486,6 @@ public:
void moneyPoke();
void doSomeTalk();
void resetLocation();
void getOpenedSize();
void adjustUp();
void fadeScreenDownHalf();
void outOfOpen();
@ -506,7 +504,6 @@ public:
void removeObFromInv();
void dirFile();
void pickupConts();
void nextColon();
void findInvPos();
void getKeyAndLogo();
void selectOb();
@ -520,7 +517,7 @@ public:
void notHeldError();
void getSetAd();
void showKeys();
void printmessage2();
void nextColon();
void findOpenPos();
void deleteExFrame();
void searchForSame();
@ -533,7 +530,6 @@ public:
void getEitherAd();
void setPickup();
void dropObject();
void openOb();
void useStereo();
void showDiaryKeys();
void useOpened();
@ -558,12 +554,10 @@ public:
void swapWithInv();
void adjustRight();
void transferToEx();
void getPersonText();
void parser();
void emergencyPurge();
void transferConToEx();
void adjustDown();
void withWhat();
};
} // End of namespace DreamGen

View file

@ -410,3 +410,13 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const {
}
} // End of namespace DreamWeb
namespace DreamGen {
// FIXME/TODO: Move this to a better place.
DreamBase::DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) {
_openChangeSize = kInventx+(4*kItempicsize);
}
} // End of namespace DreamGen

View file

@ -162,12 +162,12 @@ void DreamGenContext::examineOb(bool examineAgain) {
break;
}
case 1: {
// NB: This table contains the non-constant openChangeSize!
// Note: This table contains the non-constant _openChangeSize!
RectWithCallback invList1[] = {
{ 273,320,157,198,&DreamGenContext::getBackFromOb },
{ 255,294,0,24,&DreamGenContext::dropObject },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
{ kInventx, data.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
{ kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
{ kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
@ -263,4 +263,33 @@ void DreamGenContext::getBackFromOb() {
blank();
}
void DreamGenContext::getOpenedSize() {
ax = getOpenedSizeCPP();
}
byte DreamGenContext::getOpenedSizeCPP() {
byte obj = data.byte(kOpenedob);
switch (data.byte(kOpenedtype)) {
case 4:
return getExAd(obj)->b7;
case 2:
return getFreeAd(obj)->b7;
default:
return getSetAd(obj)->b3;
}
}
void DreamGenContext::openOb() {
uint8 commandLine[64] = "OBJECT NAME ONE ";
copyName(data.byte(kOpenedtype), data.byte(kOpenedob), commandLine);
printMessage(kInventx, kInventy+86, 62, 240, false);
al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false);
fillOpen();
_openChangeSize = getOpenedSizeCPP() * kItempicsize + kInventx;
}
} // End of namespace DreamGen

View file

@ -1191,7 +1191,7 @@ void DreamBase::crosshair() {
showFrame(engine->icons1(), kZoomx + 24, kZoomy + 19, frame, 0);
}
void DreamGenContext::delTextLine() {
void DreamBase::delTextLine() {
uint16 x = data.word(kTextaddressx);
uint16 y = data.word(kTextaddressy);
if (data.byte(kForeignrelease) != 0)
@ -1752,7 +1752,20 @@ void DreamGenContext::printMessage() {
void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
printDirect(&string, x, &y, maxWidth, centered);
printDirect(string, x, y, maxWidth, centered);
}
void DreamGenContext::printMessage2() {
printMessage2(di, bx, al, dl, (bool)(dl & 1), ah);
}
void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) {
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
while (count--) {
findNextColon(&string);
}
printDirect(string, x, y, maxWidth, centered);
}
bool objectMatches(void *object, const char *id) {

View file

@ -58,8 +58,10 @@
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return DreamBase::printDirect(string, x, y, maxWidth, centered);
}
void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
void printMessage();
void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
void printMessage2();
void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count);
void useTimedText();
void dumpTimedText();
void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
@ -111,7 +113,6 @@
void dealWithSpecial(uint8 firstParam, uint8 secondParam);
void zoom();
void showRain();
void delTextLine();
void commandOnly();
void commandOnly(uint8 command);
void doBlocks();
@ -590,5 +591,9 @@
void findExObject();
uint16 findExObject(const char *id);
void describeOb();
void getOpenedSize();
byte getOpenedSizeCPP();
void openOb();
void withWhat();
#endif

View file

@ -1473,4 +1473,27 @@ void DreamGenContext::useAltar() {
}
}
void DreamGenContext::withWhat() {
uint8 commandLine[64] = "OBJECT NAME ONE ";
createPanel();
showPanel();
showMan();
showExit();
copyName(data.byte(kObjecttype), data.byte(kCommand), commandLine);
printMessage2(100, 21, 63, 200, false, 2);
printDirect(commandLine, data.word(kLastxpos) + 5, 21, 220, false);
printMessage2(data.word(kLastxpos) + 5, 21, 63, 200, false, 3);
fillRyan();
data.byte(kCommandtype) = 255;
readMouse();
showPointer();
workToScreen();
delPointer();
data.byte(kInvopen) = 2;
}
} // End of namespace DreamGen