From 5e976490c75ad9fdf11bff8f07dc1985eb56b15e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 Dec 2011 13:02:56 +0100 Subject: DREAMWEB: Move remaining talk functions to DreamBase --- engines/dreamweb/dreambase.h | 7 +++++- engines/dreamweb/stubs.h | 5 ---- engines/dreamweb/talk.cpp | 56 +++++++++++++------------------------------- 3 files changed, 22 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index be88295631..3b53353915 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -540,10 +540,15 @@ public: bool finishedWalking(); // from talk.cpp + void talk(); void convIcons(); uint16 getPersFrame(uint8 index); - const uint8 *getPersonText(uint8 index); + const uint8 *getPersonText(uint8 index, uint8 talkPos); void startTalk(); + void moreTalk(); + void doSomeTalk(); + bool hangOnPQ(); + void redes(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 52798f556f..0f473c8751 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -96,7 +96,6 @@ DreamBase::hangOn(frameCount); } void showCity(); - void doSomeTalk(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); @@ -157,8 +156,6 @@ void nextDest(); void lastDest(); void destSelect(); - void moreTalk(); - void redes(); void selectLocation(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { @@ -168,8 +165,6 @@ void afterNewRoom(); void madmanRun(); void decide(); - void talk(); - bool hangOnPQ(); void showGun(); void endGame(); void newPlace(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index e364d63e36..131e164cf6 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -void DreamGenContext::talk() { +void DreamBase::talk() { data.byte(kTalkpos) = 0; data.byte(kInmaparea) = 0; data.byte(kCharacter) = data.byte(kCommand); @@ -42,7 +42,7 @@ void DreamGenContext::talk() { RectWithCallback talkList[] = { { 273,320,157,198,&DreamBase::getBack1 }, - { 240,290,2,44,&DreamGenContext::moreTalk }, + { 240,290,2,44,&DreamBase::moreTalk }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -87,7 +87,7 @@ uint16 DreamBase::getPersFrame(uint8 index) { void DreamBase::startTalk() { data.byte(kTalkmode) = 0; - const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F); + const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, 0); uint16 y; data.word(kCharshift) = 91+91; @@ -107,12 +107,12 @@ void DreamBase::startTalk() { } } -const uint8 *DreamBase::getPersonText(uint8 index) { - uint16 offset = kPersontext + getSegment(data.word(kPeople)).word((index * 64 * 2) + kPersontxtdat); +const uint8 *DreamBase::getPersonText(uint8 index, uint8 talkPos) { + uint16 offset = kPersontext + getSegment(data.word(kPeople)).word(((index * 64 + talkPos) * 2) + kPersontxtdat); return getSegment(data.word(kPeople)).ptr(offset, 0); } -void DreamGenContext::moreTalk() { +void DreamBase::moreTalk() { if (data.byte(kTalkmode) != 0) { redes(); return; @@ -137,33 +137,23 @@ void DreamGenContext::moreTalk() { doSomeTalk(); } -void DreamGenContext::doSomeTalk() { +void DreamBase::doSomeTalk() { while (true) { - es = data.word(kPeople); - si = ((data.byte(kTalkpos) + (64 * (data.byte(kCharacter) & 0x7F))) * 2) + kPersontxtdat; - si = es.word(si) + kPersontext; + const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos)); - if (es.byte(si) == 0) { + if (*str == 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); + printDirect(str, 164, 64, 144, false); loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); if (data.byte(kSpeechloaded) != 0) @@ -171,38 +161,25 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); - cx = 180; if (hangOnPQ()) 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) { + str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos)); + if (*str == 0) { // endheartalk data.byte(kPointermode) = 0; return; } - if (es.byte(si) != ':' && es.byte(si) != 32) { - push(es); - push(si); - + if (*str != ':' && *str != 32) { createPanel(); showPanel(); showMan(); showExit(); convIcons(); - - si = pop(); - es = pop(); - - str = es.ptr(si, 0); - y = 128; - printDirect(&str, 48, &y, 144, false); + printDirect(str, 48, 128, 144, false); loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); if (data.byte(kSpeechloaded) != 0) @@ -210,7 +187,6 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); - cx = 180; if (hangOnPQ()) return; } @@ -219,7 +195,7 @@ void DreamGenContext::doSomeTalk() { } } -bool DreamGenContext::hangOnPQ() { +bool DreamBase::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { @@ -260,7 +236,7 @@ bool DreamGenContext::hangOnPQ() { return false; } -void DreamGenContext::redes() { +void DreamBase::redes() { if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { blank(); return; -- cgit v1.2.3