diff options
author | eriktorbjorn | 2011-07-16 11:04:49 +0200 |
---|---|---|
committer | eriktorbjorn | 2011-07-16 11:04:49 +0200 |
commit | d1fbf595206c1010755667b404e823f13caa4c2b (patch) | |
tree | deb6080bedac44768b0db45b3a01cc75f295898d | |
parent | 5a1d0ab7e56c8c166ed1411be4a8fef29b721c56 (diff) | |
download | scummvm-rg350-d1fbf595206c1010755667b404e823f13caa4c2b.tar.gz scummvm-rg350-d1fbf595206c1010755667b404e823f13caa4c2b.tar.bz2 scummvm-rg350-d1fbf595206c1010755667b404e823f13caa4c2b.zip |
DREAMWEB: Rewrote lockmon() to fix pausing/unpausing
The original function would busy-wait for the user to press space
again. We can't do that, of course, since we don't have interrupt-
driven keyboard input.
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 14 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 6 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 26 |
4 files changed, 31 insertions, 18 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 5f7a528a5b..54fc091f06 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -24,6 +24,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'readabyte', 'readoneblock', 'frameoutv', - 'modifychar' + 'modifychar', + 'lockmon' ]) generator.generate('dreamweb') #start routine diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index a183c7c798..a25fae0874 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -11039,19 +11039,6 @@ void DreamGenContext::scrollmonitor() { ax = pop(); } -void DreamGenContext::lockmon() { - STACK_CHECK; - _cmp(data.byte(kLasthardkey), 57); - if (!flags.z()) - return /* (notlock) */; - locklighton(); -lockloop: - _cmp(data.byte(kLasthardkey), 57); - if (flags.z()) - goto lockloop; - locklightoff(); -} - void DreamGenContext::monitorlogo() { STACK_CHECK; al = data.byte(kLogonum); @@ -22407,7 +22394,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case 0xc550: searchforstring(); break; case 0xc554: parser(); break; case 0xc558: scrollmonitor(); break; - case 0xc55c: lockmon(); break; case 0xc560: monitorlogo(); break; case 0xc564: printlogo(); break; case 0xc568: showcurrentfile(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 71c466da24..08053b6f54 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -602,7 +602,6 @@ public: void clearbuffers(); void neterror(); void storeit(); - void lockeddoorway(); void isitworn(); void putundertimed(); void dumpmap(); @@ -958,9 +957,8 @@ public: void showmonk(); void diarykeyn(); void set16colpalette(); - void convicons(); - void interviewer(); void sparky(); + void interviewer(); void purgeanitem(); void madman(); void createpanel(); @@ -1255,12 +1253,14 @@ public: void usechurchgate(); void monkandryan(); void allocatebuffers(); + void convicons(); void swapwithinv(); void usecontrol(); void buttonseven(); void redrawmainscrn(); void finishedwalking(); void findallryan(); + void lockeddoorway(); void channel0tran(); void buttonpress(); void parseblaster(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 5614aa391a..bed259db38 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -554,4 +554,30 @@ void DreamGenContext::modifychar() { al = engine->modifyChar(al); } +void DreamGenContext::lockmon() { + // Pressing space pauses text output in the monitor. We use the "hard" + // key because calling readkey() drains characters from the input + // buffer, we we want the user to be able to type ahead while the text + // is being printed. + if (data.byte(kLasthardkey) == 57) { + // Clear the keyboard buffer. Otherwise the space that caused + // the pause will be read immediately in the pause loop. + do { + readkey(); + } while (data.byte(kCurrentkey) != 0); + + locklighton(); + while (!engine->shouldQuit()) { + engine->waitForVSync(); + readkey(); + if (data.byte(kCurrentkey) == ' ') + break; + } + // Forget the last "hard" key, otherwise the space that caused + // the unpausing will immediately re-pause the game. + data.byte(kLasthardkey) = 0; + locklightoff(); + } +} + } /*namespace dreamgen */ |