Skip to content

Commit

Permalink
DREAMWEB: 'commandwithob' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Aug 15, 2011
1 parent b0f5e4d commit 03e222f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 57 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'getreelstart',
'findobname',
'copyname',
'commandwithob',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
55 changes: 0 additions & 55 deletions engines/dreamweb/dreamgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16962,60 +16962,6 @@ void DreamGenContext::examineobtext() {
commandwithob();
}

void DreamGenContext::commandwithob() {
STACK_CHECK;
push(ax);
push(ax);
push(bx);
push(cx);
push(dx);
push(es);
push(ds);
push(si);
push(di);
deltextline();
di = pop();
si = pop();
ds = pop();
es = pop();
dx = pop();
cx = pop();
bx = pop();
ax = pop();
push(bx);
ah = 0;
_add(ax, ax);
bx = ax;
es = data.word(kCommandtext);
ax = es.word(bx);
_add(ax, (66*2));
si = ax;
di = data.word(kTextaddressx);
bx = data.word(kTextaddressy);
dl = data.byte(kTextlen);
al = 0;
ah = 0;
printdirect();
ax = pop();
di = 5847;
copyname();
ax = pop();
di = data.word(kLastxpos);
_cmp(al, 0);
if (flags.z())
goto noadd;
_add(di, 5);
noadd:
bx = data.word(kTextaddressy);
es = cs;
si = 5847;
dl = data.byte(kTextlen);
al = 0;
ah = 0;
printdirect();
data.byte(kNewtextline) = 1;
}

void DreamGenContext::commandonly() {
STACK_CHECK;
push(ax);
Expand Down Expand Up @@ -19804,7 +19750,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_obname: obname(); break;
case addr_finishedwalking: finishedwalking(); break;
case addr_examineobtext: examineobtext(); break;
case addr_commandwithob: commandwithob(); break;
case addr_commandonly: commandonly(); break;
case addr_printmessage: printmessage(); break;
case addr_printmessage2: printmessage2(); break;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class DreamGenContext : public Context {
static const uint16 addr_printmessage2 = 0xca30;
static const uint16 addr_printmessage = 0xca2c;
static const uint16 addr_commandonly = 0xca28;
static const uint16 addr_commandwithob = 0xca24;
static const uint16 addr_examineobtext = 0xca20;
static const uint16 addr_finishedwalking = 0xca1c;
static const uint16 addr_obname = 0xca18;
Expand Down Expand Up @@ -2028,7 +2027,7 @@ class DreamGenContext : public Context {
void isitright();
void businessman();
void switchryanoff();
void commandwithob();
//void commandwithob();
void panelicons1();
void adjustdown();
void withwhat();
Expand Down
27 changes: 27 additions & 0 deletions engines/dreamweb/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,4 +1038,31 @@ void DreamGenContext::copyname(uint8 type, uint8 index, uint8 *dst) {
dst[i] = 0;
}

void DreamGenContext::commandwithob() {
commandwithob(al, bh, bl);
}

void DreamGenContext::commandwithob(uint8 command, uint8 type, uint8 index) {
uint8 commandLine[64] = "OBJECT NAME ONE ";
deltextline();
uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2);
uint8 textLen = data.byte(kTextlen);
{
uint16 y = data.word(kTextaddressy);
const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0);
printdirect(&string, data.word(kTextaddressx), &y, textLen, (bool)(textLen & 1));
}
copyname(type, index, commandLine);
uint16 x = data.word(kLastxpos);
if (command != 0)
x += 5;
{
uint16 y = data.word(kTextaddressy);
const uint8 *string = commandLine;
printdirect(&string, x, &y, textLen, (bool)(textLen & 1));
}
data.byte(kNewtextline) = 1;
}

} /*namespace dreamgen */

2 changes: 2 additions & 0 deletions engines/dreamweb/stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,6 @@
const uint8 *findobname(uint8 type, uint8 index);
void copyname();
void copyname(uint8 type, uint8 index, uint8 *dst);
void commandwithob();
void commandwithob(uint8 command, uint8 type, uint8 index);

0 comments on commit 03e222f

Please sign in to comment.