[Scummvm-git-logs] scummvm master -> dabcacb0ca2157e1b82c52cb5b2f54549c9e77f9

csnover csnover at users.noreply.github.com
Sun Jul 23 17:40:27 CEST 2017


This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
970c312e76 SCI32: Detect multi-disc audio by RESSCI files instead of RESAUD
9f33f2b3df SCI32: Don't warp the mouse when it doesn't need to be warped
5b166a5173 SCI32: Avoid extra cursor paints when the cursor has not moved
8bab5a3467 SCI: Resolve offset names when disassembling object methods
3d92f05261 SCI32: Fix hot rectangle events
6b87b13ab1 SCI: Minor cleanups in kGetEvent
0beb259278 SCI32: Improve performance when flushing events during video playback
2ed18b86db SCI32: Check for stop events before rendering the next frame
2004aecb05 SCI32: Make stop flag condition more explicit
8d32353394 SCI32: Stop throttling of kFrameOut during interactive VMD playback
dabcacb0ca SCI32: Add missing method documentation


Commit: 970c312e76c2c3ca721fe6abe7bb4a6ba9533dcf
    https://github.com/scummvm/scummvm/commit/970c312e76c2c3ca721fe6abe7bb4a6ba9533dcf
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Detect multi-disc audio by RESSCI files instead of RESAUD

If a user fails to rename audio files in the required manner when
copying them, detecting multi-disc audio by looking for a renamed
audio file does not work very well. Looking at RESSCI.00n is a
better choice, though this is not completely valid since e.g.
Rama 1.0 US has only one RESOURCE.SFX volume which its installer
copies to the hard drive, so a little more work will need to be
done in the future to find and fix these kinds of edge cases.

Refs Trac#9976.

Changed paths:
    engines/sci/resource.cpp


diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index a465dd0..bf669c9 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -645,7 +645,7 @@ int ResourceManager::addAppropriateSources() {
 		if (mapFiles.empty() || files.empty())
 			return 0;
 
-		if (Common::File::exists("resaud.001")) {
+		if (Common::File::exists("ressci.001")) {
 			_multiDiscAudio = true;
 		}
 


Commit: 9f33f2b3df22a26314dbb74173f49bc930c7a1f9
    https://github.com/scummvm/scummvm/commit/9f33f2b3df22a26314dbb74173f49bc930c7a1f9
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Don't warp the mouse when it doesn't need to be warped

Changed paths:
    engines/sci/graphics/cursor32.cpp


diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index fc853bb..c626487 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -151,20 +151,28 @@ void GfxCursor32::setRestrictedArea(const Common::Rect &rect) {
 
 	mulru(_restrictedArea, Ratio(screenWidth, scriptWidth), Ratio(screenHeight, scriptHeight), 0);
 
+	bool restricted = false;
+
 	if (_position.x < rect.left) {
 		_position.x = rect.left;
+		restricted = true;
 	}
 	if (_position.x >= rect.right) {
 		_position.x = rect.right - 1;
+		restricted = true;
 	}
 	if (_position.y < rect.top) {
 		_position.y = rect.top;
+		restricted = true;
 	}
 	if (_position.y >= rect.bottom) {
 		_position.y = rect.bottom - 1;
+		restricted = true;
 	}
 
-	g_system->warpMouse(_position.x, _position.y);
+	if (restricted) {
+		g_system->warpMouse(_position.x, _position.y);
+	}
 }
 
 void GfxCursor32::clearRestrictedArea() {
@@ -367,22 +375,31 @@ void GfxCursor32::donePainting() {
 }
 
 void GfxCursor32::deviceMoved(Common::Point &position) {
+	bool restricted = false;
+
 	if (position.x < _restrictedArea.left) {
 		position.x = _restrictedArea.left;
+		restricted = true;
 	}
 	if (position.x >= _restrictedArea.right) {
 		position.x = _restrictedArea.right - 1;
+		restricted = true;
 	}
 	if (position.y < _restrictedArea.top) {
 		position.y = _restrictedArea.top;
+		restricted = true;
 	}
 	if (position.y >= _restrictedArea.bottom) {
 		position.y = _restrictedArea.bottom - 1;
+		restricted = true;
 	}
 
 	_position = position;
 
-	g_system->warpMouse(position.x, position.y);
+	if (restricted) {
+		g_system->warpMouse(position.x, position.y);
+	}
+
 	move();
 }
 


Commit: 5b166a517303b076478f21b108e1109b07e1a322
    https://github.com/scummvm/scummvm/commit/5b166a517303b076478f21b108e1109b07e1a322
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Avoid extra cursor paints when the cursor has not moved

Changed paths:
    engines/sci/graphics/cursor32.cpp


diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index c626487..feb62ee 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -394,13 +394,14 @@ void GfxCursor32::deviceMoved(Common::Point &position) {
 		restricted = true;
 	}
 
-	_position = position;
-
 	if (restricted) {
 		g_system->warpMouse(position.x, position.y);
 	}
 
-	move();
+	if (_position != position) {
+		_position = position;
+		move();
+	}
 }
 
 void GfxCursor32::move() {


Commit: 8bab5a3467519fdfd8509b8250d12a97e4a2e02e
    https://github.com/scummvm/scummvm/commit/8bab5a3467519fdfd8509b8250d12a97e4a2e02e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI: Resolve offset names when disassembling object methods

Changed paths:
    engines/sci/console.cpp
    engines/sci/console.h
    engines/sci/engine/scriptdebug.cpp


diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index bfa9f45..82661f0 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3402,7 +3402,7 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
 				farthestTarget = jumpTarget;
 		}
 		// TODO: Use a true 32-bit reg_t for the position (addr)
-		addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), objAddr, printBWTag, printBytecode);
+		addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), obj, printBWTag, printBytecode);
 		if (addr.isNull() && prevAddr < farthestTarget)
 			addr = prevAddr + 1; // skip past the ret
 	} while (addr.getOffset() > 0);
@@ -3451,7 +3451,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
 
 	do {
 		// TODO: Use a true 32-bit reg_t for the position (vpc)
-		vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), NULL_REG, printBWTag, printBytes);
+		vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), nullptr, printBWTag, printBytes);
 	} while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount));
 
 	return true;
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 0b8cd93..82a5f69 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -33,7 +33,7 @@ namespace Sci {
 class SciEngine;
 struct List;
 
-reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, bool printBytecode);
+reg_t disassemble(EngineState *s, reg32_t pos, const Object *obj, bool printBWTag, bool printBytecode);
 bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpOffset);
 
 class Console : public GUI::Debugger {
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index a15725e..545aae6 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -81,7 +81,7 @@ void DebugState::updateActiveBreakpointTypes() {
 }
 
 // Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
-reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, bool printBytecode) {
+reg_t disassemble(EngineState *s, reg32_t pos, const Object *obj, bool printBWTag, bool printBytecode) {
 	SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
 	Script *script_entity = NULL;
 	reg_t retval;
@@ -200,8 +200,7 @@ reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, b
 					debugN(opsize ? "\t%02x" : "\t%04x", param_value);
 				}
 			} else if (opcode == op_super) {
-				Object *obj;
-				if (objAddr != NULL_REG && (obj = s->_segMan->getObject(objAddr)) != nullptr) {
+				if (obj != nullptr) {
 					debugN("\t%s", s->_segMan->getObjectName(obj->getSuperClassSelector()));
 					debugN(opsize ? "[%02x]" : "[%04x]", param_value);
 				} else {
@@ -210,16 +209,28 @@ reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, b
 
 				debugN(",");
 #ifdef ENABLE_SCI32
-			} else if (getSciVersion() == SCI_VERSION_3 && (
+			} else if (
 				opcode == op_pToa || opcode == op_aTop ||
 				opcode == op_pTos || opcode == op_sTop ||
 				opcode == op_ipToa || opcode == op_dpToa ||
-				opcode == op_ipTos || opcode == op_dpTos)) {
+				opcode == op_ipTos || opcode == op_dpTos) {
 
-				const char *selectorName = "<invalid>";
+				const char *selectorName;
 
-				if (param_value < kernel->getSelectorNamesSize()) {
-					selectorName = kernel->getSelectorName(param_value).c_str();
+				if (getSciVersion() == SCI_VERSION_3) {
+					if (param_value < kernel->getSelectorNamesSize()) {
+						selectorName = kernel->getSelectorName(param_value).c_str();
+					} else {
+						selectorName = "<invalid>";
+					}
+				} else {
+					if (obj != nullptr) {
+						const Object *const super = obj->getClass(s->_segMan);
+						assert(super);
+						selectorName = kernel->getSelectorName(super->getVarSelector(param_value / 2)).c_str();
+					} else {
+						selectorName = "<unavailable>";
+					}
 				}
 
 				debugN("\t%s[%x]", selectorName, param_value);
@@ -290,7 +301,7 @@ reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, b
 	if (pos == s->xs->addr.pc) { // Extra information if debugging the current opcode
 		if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) ||
 		        (opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) {
-			const Object *obj = s->_segMan->getObject(s->xs->objp);
+			obj = s->_segMan->getObject(s->xs->objp);
 			if (!obj) {
 				warning("Attempted to reference on non-object at %04x:%04x", PRINT_REG(s->xs->objp));
 			} else {
@@ -479,7 +490,7 @@ void SciEngine::scriptDebug() {
 	}
 
 	debugN("Step #%d\n", s->scriptStepCounter);
-	disassemble(s, s->xs->addr.pc, s->xs->objp, false, true);
+	disassemble(s, s->xs->addr.pc, s->_segMan->getObject(s->xs->objp), false, true);
 
 	if (_debugState.runningStep) {
 		_debugState.runningStep--;


Commit: 3d92f05261fbbfbb491ed855ed06167ab94ad3d3
    https://github.com/scummvm/scummvm/commit/3d92f05261fbbfbb491ed855ed06167ab94ad3d3
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Fix hot rectangle events

This fixes delayed mouse cursor updates during the chase scene in
Phant1.

Refs Trac#9975.

Changed paths:
    engines/sci/engine/kevent.cpp
    engines/sci/event.h


diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index b240c94..85665cd 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -206,6 +206,14 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 		}
 		break;
 
+#ifdef ENABLE_SCI32
+	case SCI_EVENT_HOT_RECTANGLE:
+		writeSelectorValue(segMan, obj, SELECTOR(type), curEvent.type);
+		writeSelectorValue(segMan, obj, SELECTOR(message), curEvent.hotRectangleIndex);
+		s->r_acc = TRUE_REG;
+		break;
+#endif
+
 	default:
 		// Return a null event
 		writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_NONE);
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 3b18db2..b06d2ae 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -63,7 +63,7 @@ struct SciEvent {
 #define SCI_EVENT_DIRECTION       (1 << 6)
 #define SCI_EVENT_SAID            (1 << 7)
 #ifdef ENABLE_SCI32
-#define SCI_EVENT_HOT_RECTANGLE   (1 << 8)
+#define SCI_EVENT_HOT_RECTANGLE   (1 << 10)
 #endif
 /*Fake values for other events*/
 #define SCI_EVENT_QUIT            (1 << 11)


Commit: 6b87b13ab1ead1115cce6a897ee78c4eba45d76d
    https://github.com/scummvm/scummvm/commit/6b87b13ab1ead1115cce6a897ee78c4eba45d76d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI: Minor cleanups in kGetEvent

Changed paths:
    engines/sci/engine/kevent.cpp


diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 85665cd..735382c 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -72,7 +72,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 		writeSelectorValue(segMan, obj, SELECTOR(x), mousePos.x);
 		writeSelectorValue(segMan, obj, SELECTOR(y), mousePos.y);
 		g_debug_simulated_key = 0;
-		return make_reg(0, 1);
+		return TRUE_REG;
 	}
 
 	curEvent = g_sci->getEventManager()->getSciEvent(mask);
@@ -183,11 +183,10 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 
 	case SCI_EVENT_KEYBOARD:
 		writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD); // Keyboard event
-		s->r_acc = make_reg(0, 1);
-
 		writeSelectorValue(segMan, obj, SELECTOR(message), curEvent.character);
 		// We only care about the translated character
 		writeSelectorValue(segMan, obj, SELECTOR(modifiers), modifiers);
+		s->r_acc = TRUE_REG;
 		break;
 
 	case SCI_EVENT_MOUSE_RELEASE:
@@ -202,7 +201,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 			writeSelectorValue(segMan, obj, SELECTOR(type), curEvent.type);
 			writeSelectorValue(segMan, obj, SELECTOR(message), 0);
 			writeSelectorValue(segMan, obj, SELECTOR(modifiers), modifiers);
-			s->r_acc = make_reg(0, 1);
+			s->r_acc = TRUE_REG;
 		}
 		break;
 


Commit: 0beb259278dfd18757bf9484a6123edf4b44864e
    https://github.com/scummvm/scummvm/commit/0beb259278dfd18757bf9484a6123edf4b44864e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Improve performance when flushing events during video playback

Calling through EventManager::getSciEvent to flush events is
pretty inefficient and created stalls that lead to dropped
frames during the chapter 7 chase in Phantasmagoria 1.

If necessary, performance could be improved further by extending
Common::EventManager to expose SDL_FlushEvents, but this seems to
finish in 0-1ms so should be OK for now.

Refs Trac#9974, Trac#9975.

Changed paths:
    engines/sci/event.cpp
    engines/sci/event.h
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 873b6bb..b1be46a 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -408,6 +408,13 @@ SciEvent EventManager::getSciEvent(uint32 mask) {
 	return event;
 }
 
+void EventManager::flushEvents() {
+	Common::EventManager *em = g_system->getEventManager();
+	Common::Event event;
+	while (em->pollEvent(event));
+	_events.clear();
+}
+
 #ifdef ENABLE_SCI32
 void EventManager::setHotRectanglesActive(const bool active) {
 	_hotRectanglesActive = active;
diff --git a/engines/sci/event.h b/engines/sci/event.h
index b06d2ae..614a5a6 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -138,6 +138,7 @@ public:
 
 	void updateScreen();
 	SciEvent getSciEvent(uint32 mask);
+	void flushEvents();
 
 private:
 	SciEvent getScummVMEvent();
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 22be48c..e0f83c6 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -56,18 +56,6 @@ namespace Graphics { struct Surface; }
 
 namespace Sci {
 
-static void flushEvents(EventManager *eventMan) {
-	// Flushing all the keyboard and mouse events out of the event manager
-	// keeps events queued from before the start of playback from accidentally
-	// activating a video stop flag
-	for (;;) {
-		const SciEvent event = eventMan->getSciEvent(SCI_EVENT_ANY & ~SCI_EVENT_QUIT);
-		if (event.type == SCI_EVENT_NONE) {
-			break;
-		}
-	}
-}
-
 bool VideoPlayer::open(const Common::String &fileName) {
 	if (!_decoder->loadFile(fileName)) {
 		warning("Failed to load %s", fileName.c_str());
@@ -129,7 +117,10 @@ bool VideoPlayer::endHQVideo() {
 }
 
 VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, const uint32 maxSleepMs) {
-	flushEvents(_eventMan);
+	// Flushing all the keyboard and mouse events out of the event manager
+	// keeps events queued from before the start of playback from accidentally
+	// activating a video stop flag
+	_eventMan->flushEvents();
 	_decoder->start();
 
 	EventFlags stopFlag = kEventFlagNone;


Commit: 2ed18b86db51caacd123b5e95f4672685dc49799
    https://github.com/scummvm/scummvm/commit/2ed18b86db51caacd123b5e95f4672685dc49799
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Check for stop events before rendering the next frame

This should make things slightly more responsive and avoids
unnecessary rendering of frames that are just going to disappear
in a moment.

Changed paths:
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index e0f83c6..07e5f3b 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -121,11 +121,13 @@ VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, cons
 	// keeps events queued from before the start of playback from accidentally
 	// activating a video stop flag
 	_eventMan->flushEvents();
+
 	_decoder->start();
 
 	EventFlags stopFlag = kEventFlagNone;
 	for (;;) {
 		g_sci->sleep(MIN(_decoder->getTimeToNextFrame(), maxSleepMs));
+
 		const Graphics::Surface *nextFrame = nullptr;
 		// If a decoder needs more than one update per loop, this means we are
 		// running behind and should skip rendering these frames (but must still
@@ -143,10 +145,19 @@ VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, cons
 			renderFrame(*nextFrame);
 		}
 
+		// Event checks must only happen *after* the decoder is updated (1) and
+		// frame rendered (2), otherwise (1) interval yields will get stuck
+		// forever on the current frame, and (2) other events will end up
+		// dropping the new frame entirely
 		stopFlag = checkForEvent(flags);
 		if (stopFlag != kEventFlagNone) {
 			break;
 		}
+
+		// Only call to update the screen after the event check, otherwise
+		// whatever the game scripts try to change when the player yields to
+		// them will not make it into the hardware buffer until the next tick
+		g_sci->_gfxFrameout->updateScreen();
 	}
 
 	return stopFlag;


Commit: 2004aecb0583cec6bad8f903199cf1ffaf728a30
    https://github.com/scummvm/scummvm/commit/2004aecb0583cec6bad8f903199cf1ffaf728a30
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Make stop flag condition more explicit

Changed paths:
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 07e5f3b..d92f9a1 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -706,7 +706,7 @@ VMDPlayer::EventFlags VMDPlayer::checkForEvent(const EventFlags flags) {
 	}
 
 	EventFlags stopFlag = VideoPlayer::checkForEvent(flags);
-	if (stopFlag) {
+	if (stopFlag != kEventFlagNone) {
 		return stopFlag;
 	}
 


Commit: 8d32353394ce4aa750e54becc3f2d2e375b3963d
    https://github.com/scummvm/scummvm/commit/8d32353394ce4aa750e54becc3f2d2e375b3963d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Stop throttling of kFrameOut during interactive VMD playback

Refs Trac#9974, Trac#9975.

Changed paths:
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/frameout.h
    engines/sci/graphics/video32.cpp


diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index b49332d..4e28f80 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -69,6 +69,7 @@ GfxFrameout::GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitio
 	_throttleState(0),
 	_remapOccurred(false),
 	_overdrawThreshold(0),
+	_throttleKernelFrameOut(true),
 	_palMorphIsOn(false),
 	_lastScreenUpdateTick(0) {
 
@@ -1136,7 +1137,9 @@ void GfxFrameout::kernelFrameOut(const bool shouldShowBits) {
 		frameOut(shouldShowBits);
 	}
 
-	throttle();
+	if (_throttleKernelFrameOut) {
+		throttle();
+	}
 }
 
 void GfxFrameout::throttle() {
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 93dc35e..d94689b 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -310,6 +310,11 @@ public:
 	}
 
 	/**
+	 * Whether or not to throttle kFrameOut calls.
+	 */
+	bool _throttleKernelFrameOut;
+
+	/**
 	 * Whether palMorphFrameOut should be used instead of
 	 * frameOut for rendering. Used by kMorphOn to
 	 * explicitly enable palMorphFrameOut for one frame.
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index d92f9a1..da34a73 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -890,6 +890,13 @@ void VMDPlayer::initComposited() {
 	// here, but none of the game scripts seem to use this functionality.
 
 	g_sci->_gfxFrameout->addScreenItem(*_screenItem);
+
+	// Composited VMDs periodically yield to game scripts which will often call
+	// kFrameOut to make changes to other parts of the screen. Since VMDPlayer
+	// is responsible for throttling output during these times, GfxFrameout
+	// needs to stop throttling kFrameOut calls or else we will drop frames when
+	// kFrameOut sleeps right through the next frame
+	g_sci->_gfxFrameout->_throttleKernelFrameOut = false;
 }
 
 void VMDPlayer::renderComposited() const {
@@ -915,6 +922,8 @@ void VMDPlayer::closeComposited() {
 		// This call *actually* deletes the plane/screen item
 		g_sci->_gfxFrameout->frameOut(true);
 	}
+
+	g_sci->_gfxFrameout->_throttleKernelFrameOut = true;
 }
 
 #pragma mark -


Commit: dabcacb0ca2157e1b82c52cb5b2f54549c9e77f9
    https://github.com/scummvm/scummvm/commit/dabcacb0ca2157e1b82c52cb5b2f54549c9e77f9
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T10:35:13-05:00

Commit Message:
SCI32: Add missing method documentation

Changed paths:
    engines/sci/graphics/frameout.h


diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index d94689b..ddaa17c 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -305,6 +305,9 @@ public:
 	 */
 	void updateScreen(const int delta = 0);
 
+	/**
+	 * Resets the pixel format of the hardware surface to the given format.
+	 */
 	void setPixelFormat(const Graphics::PixelFormat &format) const {
 		initGraphics(_currentBuffer.screenWidth, _currentBuffer.screenHeight, _isHiRes, &format);
 	}





More information about the Scummvm-git-logs mailing list