diff options
Diffstat (limited to 'engines/dreamweb/talk.cpp')
-rw-r--r-- | engines/dreamweb/talk.cpp | 153 |
1 files changed, 151 insertions, 2 deletions
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 86d1b886ef..fac75be6cf 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -24,8 +24,53 @@ namespace DreamGen { -uint16 DreamGenContext::getPersFrame(uint8 index) { - return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +void DreamGenContext::talk() { + data.byte(kTalkpos) = 0; + data.byte(kInmaparea) = 0; + data.byte(kCharacter) = data.byte(kCommand); + createPanel(); + showPanel(); + showMan(); + showExit(); + underTextLine(); + convIcons(); + startTalk(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreenCPP(); + + RectWithCallback<DreamGenContext> talkList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 240,290,2,44,&DreamGenContext::moreTalk }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + data.byte(kGetback) = 0; + checkCoords(talkList); + if (data.byte(kQuitrequested)) + break; + } while (!data.byte(kGetback)); + + if (data.byte(kTalkpos) >= 4) + data.byte(data.word(kPersondata)+7) |= 128; + + redrawMainScrn(); + workToScreenM(); + if (data.byte(kSpeechloaded) == 1) { + cancelCh1(); + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 0; + } } void DreamGenContext::convIcons() { @@ -35,4 +80,108 @@ void DreamGenContext::convIcons() { showFrame(base, 234, 2, frame, 0); } +uint16 DreamGenContext::getPersFrame(uint8 index) { + return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +} + +// TODO: put Starttalk here + +// TODO: put Getpersontext here + +void DreamGenContext::moreTalk() { + if (data.byte(kTalkmode) != 0) { + redes(); + return; + } + + if (data.byte(kCommandtype) != 215) { + data.byte(kCommandtype) = 215; + commandOnly(49); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // nomore + + if (!(data.word(kMousebutton) & 1)) + return; + + data.byte(kTalkmode) = 2; + data.byte(kTalkpos) = 4; + + if (data.byte(kCharacter) >= 100) + data.byte(kTalkpos) = 48; // second part + doSomeTalk(); +} + +// TODO: put Dosometalk here + +void DreamGenContext::hangOnPQ() { + data.byte(kGetback) = 0; + + RectWithCallback<DreamBase> quitList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + uint16 speechFlag = 0; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + checkCoords(quitList); + + if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) { + // Quit conversation + delPointer(); + data.byte(kPointermode) = 0; + cancelCh1(); + flags._c = true; + return; + } + + if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { + speechFlag++; + if (speechFlag == 40) + break; + } + } while (!data.word(kMousebutton) || data.word(kOldbutton)); + + delPointer(); + data.byte(kPointermode) = 0; + flags._c = false; +} + +void DreamGenContext::redes() { + if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { + blank(); + return; + } + + if (data.byte(kCommandtype) != 217) { + data.byte(kCommandtype) = 217; + commandOnly(50); + } + + if (!(data.word(kMousebutton) & 1)) + return; + + delPointer(); + createPanel(); + showPanel(); + showMan(); + showExit(); + convIcons(); + startTalk(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen |