DREAMWEB: Port 'dosometalk' to C++

This commit is contained in:
D G Turner 2011-12-25 07:28:29 +00:00
parent 652403021d
commit 088c145f8f
5 changed files with 86 additions and 143 deletions

View File

@ -379,6 +379,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'dontloadseg',
'doorway',
'dosaveload',
'dosometalk',
'dosreturn',
'doshake',
'drawflags',

View File

@ -927,146 +927,6 @@ cantpurge2:
goto lookforpurge2;
}
void DreamGenContext::doSomeTalk() {
STACK_CHECK;
dospeech:
al = data.byte(kTalkpos);
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
cx = 64;
_mul(cx);
cx = ax;
al = data.byte(kTalkpos);
ah = 0;
_add(ax, cx);
_add(ax, ax);
si = ax;
es = data.word(kPeople);
_add(si, (0+24));
cx = (0+24+(1026*2));
ax = es.word(si);
_add(ax, cx);
si = ax;
_cmp(es.byte(si), 0);
if (flags.z())
goto endheartalk;
push(es);
push(si);
createPanel();
showPanel();
showMan();
showExit();
convIcons();
si = pop();
es = pop();
di = 164;
bx = 64;
dl = 144;
al = 0;
ah = 0;
printDirect();
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
cx = 64;
_mul(cx);
cl = data.byte(kTalkpos);
ch = 0;
_add(ax, cx);
cl = 'C';
dl = 'R';
dh = data.byte(kReallocation);
loadSpeech();
_cmp(data.byte(kSpeechloaded), 0);
if (flags.z())
goto noplay1;
al = 62;
playChannel1();
noplay1:
data.byte(kPointermode) = 3;
workToScreenM();
cx = 180;
hangOnPQ();
if (!flags.c())
goto _tmp1;
return;
_tmp1:
_inc(data.byte(kTalkpos));
al = data.byte(kTalkpos);
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
cx = 64;
_mul(cx);
cx = ax;
al = data.byte(kTalkpos);
ah = 0;
_add(ax, cx);
_add(ax, ax);
si = ax;
es = data.word(kPeople);
_add(si, (0+24));
cx = (0+24+(1026*2));
ax = es.word(si);
_add(ax, cx);
si = ax;
_cmp(es.byte(si), 0);
if (flags.z())
goto endheartalk;
_cmp(es.byte(si), ':');
if (flags.z())
goto skiptalk2;
_cmp(es.byte(si), 32);
if (flags.z())
goto skiptalk2;
push(es);
push(si);
createPanel();
showPanel();
showMan();
showExit();
convIcons();
si = pop();
es = pop();
di = 48;
bx = 128;
dl = 144;
al = 0;
ah = 0;
printDirect();
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
cx = 64;
_mul(cx);
cl = data.byte(kTalkpos);
ch = 0;
_add(ax, cx);
cl = 'C';
dl = 'R';
dh = data.byte(kReallocation);
loadSpeech();
_cmp(data.byte(kSpeechloaded), 0);
if (flags.z())
goto noplay2;
al = 62;
playChannel1();
noplay2:
data.byte(kPointermode) = 3;
workToScreenM();
cx = 180;
hangOnPQ();
if (!flags.c())
goto skiptalk2;
return;
skiptalk2:
_inc(data.byte(kTalkpos));
goto dospeech;
endheartalk:
data.byte(kPointermode) = 0;
}
void DreamGenContext::locationPic() {
STACK_CHECK;
getDestInfo();

View File

@ -454,7 +454,6 @@ public:
void __start();
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
void doSomeTalk();
void outOfOpen();
void dirCom();
void findFirstPath();

View File

@ -100,6 +100,7 @@
void convIcons();
void startTalk();
void getPersonText(uint8 index);
void doSomeTalk();
void examineOb(bool examineAgain = true);
void dumpWatch();
void transferText();

View File

@ -110,7 +110,7 @@ void DreamGenContext::startTalk() {
void DreamGenContext::getPersonText(uint8 index) {
es = data.word(kPeople);
si = es.word((index * 64 * 2) + 24) + (1026 * 2) + 24;
si = es.word((index * 64 * 2) + kPersontxtdat) + kPersontext;
}
void DreamGenContext::moreTalk() {
@ -138,7 +138,89 @@ void DreamGenContext::moreTalk() {
doSomeTalk();
}
// TODO: put Dosometalk here
void DreamGenContext::doSomeTalk() {
while (true) {
es = data.word(kPeople);
si = ((data.byte(kTalkpos) + (64 * (data.byte(kCharacter) & 0x7F))) * 2) + kPersontxtdat;
si = es.word(si) + kPersontext;
if (es.byte(si) == 0) {
// endheartalk
data.byte(kPointermode) = 0;
return;
}
push(es);
push(si);
createPanel();
showPanel();
showMan();
showExit();
convIcons();
si = pop();
es = pop();
const uint8 *str = es.ptr(si, 0);
uint16 y = 64;
printDirect(&str, 164, &y, 144, false);
loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos));
if (data.byte(kSpeechloaded) != 0)
playChannel1(62);
data.byte(kPointermode) = 3;
workToScreenM();
cx = 180;
hangOnPQ();
if (flags.c())
return;
data.byte(kTalkpos)++;
es = data.word(kPeople);
si = kPersontxtdat + (((64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)) * 2);
si = es.word(si) + kPersontext;
if (es.byte(si) == 0) {
// endheartalk
data.byte(kPointermode) = 0;
return;
}
if (es.byte(si) != ':' && es.byte(si) != 32) {
push(es);
push(si);
createPanel();
showPanel();
showMan();
showExit();
convIcons();
si = pop();
es = pop();
str = es.ptr(si, 0);
y = 128;
printDirect(&str, 48, &y, 144, false);
loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos));
if (data.byte(kSpeechloaded) != 0)
playChannel1(62);
data.byte(kPointermode) = 3;
workToScreenM();
cx = 180;
hangOnPQ();
if (flags.c())
return;
}
data.byte(kTalkpos)++;
}
}
void DreamGenContext::hangOnPQ() {
data.byte(kGetback) = 0;