aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2/cge2_main.cpp
diff options
context:
space:
mode:
authoruruk2014-06-18 23:34:26 +0200
committeruruk2014-06-18 23:34:26 +0200
commit7a549f2693222743dd76697534664fdc498a456c (patch)
treeb9b4b6220c8ba46c970d3ec601065a4826e73d15 /engines/cge2/cge2_main.cpp
parentea5697d5a0ff66c7e93db4e53c881980df0a5971 (diff)
downloadscummvm-rg350-7a549f2693222743dd76697534664fdc498a456c.tar.gz
scummvm-rg350-7a549f2693222743dd76697534664fdc498a456c.tar.bz2
scummvm-rg350-7a549f2693222743dd76697534664fdc498a456c.zip
CGE2: Implement offUse().
Diffstat (limited to 'engines/cge2/cge2_main.cpp')
-rw-r--r--engines/cge2/cge2_main.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index b17f48dacd..c27b16073c 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -1018,7 +1018,24 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
}
void CGE2Engine::offUse() {
- warning("STUB: CGE2Engine::offUse()");
+ int seq = 0;
+ int offUseCount = atoi(_text->getText(kOffUseCount));
+
+ // This fixes the issue of empty speech bubbles in the original.
+ // Now we only let this cycle pass if it randoms a valid value for getText().
+ int txt = 0;
+ do {
+ txt = kOffUseText + _sex * offUseCount + newRandom(offUseCount);
+ } while (_text->getText(txt) == nullptr);
+
+ Hero *h = _heroTab[_sex]->_ptr;
+ h->park();
+ _commandHandler->addCommand(kCmdWait, -1, -1, h);
+ _commandHandler->addCommand(kCmdSeq, -1, seq, h);
+ if (!_sayVox)
+ _commandHandler->addCommand(kCmdSound, -1, 6 + _sex, h);
+ _commandHandler->addCommand(kCmdWait, -1, -1, h);
+ _commandHandler->addCommand(kCmdSay, -1, txt, h);
}
Sprite *CGE2Engine::spriteAt(V2D pos) {