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

bgK bastien.bouclet at gmail.com
Sun Aug 6 17:57:23 CEST 2017


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

Summary:
8e5ac98a4b MOHAWK: Riven: Add keyboard navigation
f5b335af10 GUI: Mark some fall-through cases as intentional


Commit: 8e5ac98a4b6082caf68ad205dc6cadffa4df5051
    https://github.com/scummvm/scummvm/commit/8e5ac98a4b6082caf68ad205dc6cadffa4df5051
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-06T17:36:27+02:00

Commit Message:
MOHAWK: Riven: Add keyboard navigation

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven_card.cpp
    engines/mohawk/riven_card.h
    engines/mohawk/riven_scripts.cpp
    engines/mohawk/riven_stack.cpp
    engines/mohawk/riven_stack.h
    engines/mohawk/riven_stacks/jspit.cpp
    engines/mohawk/riven_video.cpp


diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 8fd2805..6c2b1a2 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -218,7 +218,7 @@ void MohawkEngine_Riven::doFrame() {
 			_inventory->checkClick(_eventMan->getMousePos());
 			break;
 		case Common::EVENT_KEYUP:
-			_stack->keyForceUp();
+			_stack->keyResetAction();
 			break;
 		case Common::EVENT_KEYDOWN:
 			switch (event.kbd.keycode) {
@@ -255,7 +255,7 @@ void MohawkEngine_Riven::doFrame() {
 				}
 				break;
 			default:
-				_stack->onKeyPressed(event.kbd.keycode);
+				_stack->onKeyPressed(event.kbd);
 				break;
 			}
 			break;
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index d3166f3..a116d88 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -30,6 +30,8 @@
 #include "mohawk/resource.h"
 #include "mohawk/riven.h"
 
+#include "common/memstream.h"
+
 namespace Mohawk {
 
 RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) :
@@ -44,6 +46,7 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) :
 	loadCardMovieList(id);
 	loadCardHotspotEnableList(id);
 	loadCardWaterEffectList(id);
+	applyPatches(id);
 }
 
 RivenCard::~RivenCard() {
@@ -63,13 +66,89 @@ void RivenCard::loadCardResource(uint16 id) {
 	_zipModePlace = inStream->readUint16BE();
 	_scripts = _vm->_scriptMan->readScripts(inStream);
 
-	// Apply script patches for this card
+	delete inStream;
+}
+
+void RivenCard::applyPatches(uint16 id) {
 	uint32 globalId = _vm->getStack()->getCardGlobalId(id);
+
+	// Apply properties patches
+
+	// On Jungle Island on the back side of the "beetle" gate, the forward hotspot
+	// is always enabled, preventing keyboard navigation from automatically opening
+	// the gate.
+	// We patch the card so that the forward opcode is enabled only when the gate is open.
+	//
+	// New hotspot enable entries:
+	// == Hotspot enable 5 ==
+	// hotspotId: 3
+	// enabled: 1
+	//
+	// == Hotspot enable 6 ==
+	// hotspotId: 3
+	// enabled: 0
+	//
+	// Additional load script fragment:
+	// switch (jgate) {
+	// case 0:
+	//     activateBLST(6);
+	//     break;
+	// case 1:
+	//     activateBLST(5);
+	//     break;
+	if (globalId == 0x8EB7) {
+		HotspotEnableRecord forwardEnabled;
+		forwardEnabled.index = _hotspotEnableList.back().index + 1;
+		forwardEnabled.hotspotId = 3;
+		forwardEnabled.enabled = 1;
+		_hotspotEnableList.push_back(forwardEnabled);
+
+		HotspotEnableRecord forwardDisabled;
+		forwardDisabled.index = _hotspotEnableList.back().index + 1;
+		forwardDisabled.hotspotId = 3;
+		forwardDisabled.enabled = 0;
+		_hotspotEnableList.push_back(forwardDisabled);
+
+		uint16 jGateVariable = _vm->getStack()->getIdFromName(kVariableNames, "jgate");
+		uint16 patchData[] = {
+				1, // Command count in script
+				kRivenCommandSwitch,
+				2, // Unused
+				jGateVariable,
+				2, // Branches count
+
+				0, // jgate == 0 branch (gate closed)
+				1, // Command count in sub-script
+				kRivenCommandActivateBLST,
+				1, // Argument count
+				forwardDisabled.index,
+
+				1, // jgate == 1 branch (gate open)
+				1, // Command count in sub-script
+				kRivenCommandActivateBLST,
+				1, // Argument count
+				forwardEnabled.index
+		};
+
+		// Script data is expected to be in big endian
+		for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
+			patchData[i] = TO_BE_16(patchData[i]);
+		}
+
+		Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
+		RivenScriptPtr patchScript = _vm->_scriptMan->readScript(&patchStream);
+
+		// Append the patch to the existing script
+		RivenScriptPtr loadScript = getScript(kCardLoadScript);
+		loadScript += patchScript;
+
+		debugC(kRivenDebugPatches, "Applied fix always enabled forward hotspot in card %x", globalId);
+	}
+
+	// Apply script patches
 	for (uint i = 0; i < _scripts.size(); i++) {
 		_scripts[i].script->applyCardPatches(_vm, globalId, _scripts[i].type, 0xFFFF);
 	}
-
-	delete inStream;
 }
 
 void RivenCard::enter(bool unkMovies) {
@@ -255,6 +334,7 @@ void RivenCard::loadHotspots(uint16 id) {
 	uint32 globalId = _vm->getStack()->getCardGlobalId(id);
 	for (uint16 i = 0; i < hotspotCount; i++) {
 		_hotspots[i] = new RivenHotspot(_vm, inStream);
+		_hotspots[i]->applyPropertiesPatches(globalId);
 		_hotspots[i]->applyScriptPatches(globalId);
 	}
 
@@ -280,16 +360,20 @@ Common::Array<RivenHotspot *> RivenCard::getHotspots() const {
 	return _hotspots;
 }
 
-RivenHotspot *RivenCard::getHotspotByName(const Common::String &name) const {
+RivenHotspot *RivenCard::getHotspotByName(const Common::String &name, bool optional) const {
 	int16 nameId = _vm->getStack()->getIdFromName(kHotspotNames, name);
 
 	for (uint i = 0; i < _hotspots.size(); i++) {
-		if (_hotspots[i]->getNameId() == nameId) {
+		if (_hotspots[i]->getNameId() == nameId && nameId != -1) {
 			return _hotspots[i];
 		}
 	}
 
-	error("Card %d does not have an hotspot named %s", _id, name.c_str());
+	if (optional) {
+		return nullptr;
+	} else {
+		error("Card %d does not have an hotspot named %s", _id, name.c_str());
+	}
 }
 
 RivenHotspot *RivenCard::getHotspotByBlstId(const uint16 blstId) const {
@@ -598,6 +682,76 @@ void RivenCard::playMovie(uint16 index, bool queue) {
 	}
 }
 
+RivenScriptPtr RivenCard::onKeyAction(RivenKeyAction keyAction) {
+	RivenHotspot *directionHotspot = nullptr;
+	switch (keyAction) {
+		case kKeyActionMoveForward:
+			directionHotspot = findEnabledHotspotByName(17,
+			                        "forward", "forward1", "forward2", "forward3",
+			                        "opendoor", "openhatch", "opentrap", "opengate", "opengrate",
+			                        "open", "door", "drop", "go", "enterprison", "exit",
+			                        "forwardleft", "forwardright"
+			);
+			break;
+		case kKeyActionMoveForwardLeft:
+			directionHotspot = findEnabledHotspotByName(1, "forwardleft");
+			break;
+		case kKeyActionMoveForwardRight:
+			directionHotspot = findEnabledHotspotByName(1, "forwardright");
+			break;
+		case kKeyActionMoveLeft:
+			directionHotspot = findEnabledHotspotByName(3, "left", "afl", "prevpage");
+			break;
+		case kKeyActionMoveRight:
+			directionHotspot = findEnabledHotspotByName(3, "right", "afr", "nextpage");
+			break;
+		case kKeyActionMoveBack:
+			directionHotspot = findEnabledHotspotByName(1, "back");
+			break;
+		case kKeyActionLookUp:
+			directionHotspot = findEnabledHotspotByName(1, "up");
+			break;
+		case kKeyActionLookDown:
+			directionHotspot = findEnabledHotspotByName(1, "down");
+			break;
+		default:
+			break;
+	}
+
+	if (!directionHotspot) {
+		return RivenScriptPtr(new RivenScript());
+	}
+
+	_hoveredHotspot = directionHotspot;
+
+	RivenScriptPtr clickScript = directionHotspot->getScript(kMouseDownScript);
+	if (!clickScript || clickScript->empty()) {
+		clickScript = directionHotspot->getScript(kMouseUpScript);
+	}
+	if (!clickScript || clickScript->empty()) {
+		clickScript = RivenScriptPtr(new RivenScript());
+	}
+
+	return clickScript;
+}
+
+RivenHotspot *RivenCard::findEnabledHotspotByName(uint n, ...) const {
+	va_list ap;
+	va_start(ap, n);
+
+	for (uint i = 0; i < n; i++) {
+		const char *name = va_arg(ap, const char *);
+		RivenHotspot *hotspot = getHotspotByName(name, true);
+		if (hotspot && hotspot->isEnabled()) {
+			return hotspot;
+		}
+	}
+
+	va_end(ap);
+
+	return nullptr;
+}
+
 RivenHotspot::RivenHotspot(MohawkEngine_Riven *vm, Common::ReadStream *stream) :
 		_vm(vm) {
 	loadFromStream(stream);
@@ -644,6 +798,32 @@ RivenScriptPtr RivenHotspot::getScript(uint16 scriptType) const {
 	return RivenScriptPtr();
 }
 
+void RivenHotspot::applyPropertiesPatches(uint32 cardGlobalId) {
+	// In Jungle island, one of the bridge hotspots does not have a name
+	// This breaks keyboard navigation. Set the proper name.
+	if (cardGlobalId == 0x214a0 && _blstID == 9) {
+		_nameResource = _vm->getStack()->getIdFromName(kHotspotNames, "forward");
+		debugC(kRivenDebugPatches, "Applied missing hotspot name patch to card %x", cardGlobalId);
+	}
+
+	// In the lab in Book Making island the card showing one of the doors has
+	// two "forward" hotspots. One of them goes backwards. Disable it, and make sure
+	// it cannot be found by the keyboard navigation code.
+	if (cardGlobalId == 0x1fa79 && _blstID == 3) {
+		enable(false);
+		_nameResource = -1;
+		debugC(kRivenDebugPatches, "Applied disable buggy forward hotspot to card %x", cardGlobalId);
+	}
+
+	// On Temple Island, in front of the back door to the rotating room,
+	// change the name of the hotspot to look at the bottom of the door to
+	// "down" instead of "forwardleft". That way the keyboard navigation
+	// does not spoil that you can go below the door.
+	if (cardGlobalId == 0x87ac && _blstID == 10) {
+		_nameResource = _vm->getStack()->getIdFromName(kHotspotNames, "down");
+		debugC(kRivenDebugPatches, "Applied change hotspot name to 'down' patch to card %x", cardGlobalId);
+	}
+}
 
 void RivenHotspot::applyScriptPatches(uint32 cardGlobalId) {
 	for (uint16 i = 0; i < _scripts.size(); i++) {
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index cfcacdb..c5a5795 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -99,7 +99,10 @@ public:
 	RivenHotspot *getHotspotContainingPoint(const Common::Point &point) const;
 
 	/** Get the hotspot with the specified name */
-	RivenHotspot *getHotspotByName(const Common::String &name) const;
+	RivenHotspot *getHotspotByName(const Common::String &name, bool optional = false) const;
+
+	/** Find an enabled hotspot with a name matching one of the arguments */
+	RivenHotspot *findEnabledHotspotByName(uint n, ...) const;
 
 	/** Get the hotspot with the specified BLST id */
 	RivenHotspot *getHotspotByBlstId(const uint16 blstId) const;
@@ -125,6 +128,9 @@ public:
 	/** Handle a mouse move event */
 	RivenScriptPtr onMouseMove(const Common::Point &mouse);
 
+	/** Handle a keyboard action */
+	RivenScriptPtr onKeyAction(RivenKeyAction keyAction);
+
 	/** General frame update handler */
 	RivenScriptPtr onFrame();
 
@@ -145,6 +151,7 @@ private:
 	void loadCardMovieList(uint16 id);
 	void loadCardHotspotEnableList(uint16 id);
 	void loadCardWaterEffectList(uint16 id);
+	void applyPatches(uint16 id);
 	void setCurrentCardVariable();
 
 	RivenScriptPtr getScript(uint16 scriptType) const;
@@ -254,9 +261,12 @@ public:
 	/** Write all of the hotspot's data to standard output */
 	void dump() const;
 
-	/** Apply patches to hotspot's scripts to fix bugs in the original game scripts */
+	/** Apply patches to the hotspot's scripts to fix bugs in the original game scripts */
 	void applyScriptPatches(uint32 cardGlobalId);
 
+	/** Apply patches to the hotspot's properties to fix bugs in the original game scripts */
+	void applyPropertiesPatches(uint32 cardGlobalId);
+
 private:
 	enum {
 		kFlagZip = 1,
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index cfe6eeb..21c18fa 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -309,6 +309,7 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
 		arguments.push_back(256);
 		arguments.push_back(0);
 		_commands.push_back(RivenCommandPtr(new RivenSimpleCommand(vm, kRivenCommandPlaySound, arguments)));
+		debugC(kRivenDebugPatches, "Applied missing closing sound patch to card %x", cardGlobalId);
 	}
 
 	if (shouldApplyPatches) {
diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp
index 847a98f..c90642a 100644
--- a/engines/mohawk/riven_stack.cpp
+++ b/engines/mohawk/riven_stack.cpp
@@ -41,7 +41,7 @@ RivenStack::RivenStack(MohawkEngine_Riven *vm, uint16 id) :
 		_id(id),
 		_mouseIsDown(false),
 		_shouldRefreshMouseCursor(false),
-		_keyPressed(Common::KEYCODE_INVALID) {
+		_keyAction(kKeyActionNone) {
 	removeTimer();
 
 	loadResourceNames();
@@ -305,16 +305,78 @@ void RivenStack::onFrame() {
 	_vm->_scriptMan->runScript(script, true);
 }
 
-Common::KeyCode RivenStack::keyGetPressed() const {
-	return _keyPressed;
+RivenKeyAction RivenStack::keyGetAction() const {
+	return _keyAction;
 }
 
-void RivenStack::keyForceUp() {
-	_keyPressed = Common::KEYCODE_INVALID;
+void RivenStack::keyResetAction() {
+	_keyAction = kKeyActionNone;
 }
 
-void RivenStack::onKeyPressed(const Common::KeyCode keyCode) {
-	_keyPressed = keyCode;
+void RivenStack::onKeyPressed(const Common::KeyState &keyState) {
+	_keyAction = mapKeyStateToKeyAction(keyState);
+
+	if (_vm->getCard() && !_vm->_scriptMan->hasQueuedScripts()) {
+		RivenScriptPtr script = _vm->getCard()->onKeyAction(_keyAction);
+
+		if (!script->empty()) {
+			_vm->_scriptMan->runScript(script, true);
+			keyResetAction();
+		}
+	}
+}
+
+RivenKeyAction RivenStack::mapKeyStateToKeyAction(const Common::KeyState &keyState) {
+	switch (keyState.keycode) {
+		case Common::KEYCODE_ESCAPE:
+			return kKeyActionSkip;
+		case Common::KEYCODE_KP8:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			// Fallthrough
+		case Common::KEYCODE_UP:
+			return kKeyActionMoveForward;
+		case Common::KEYCODE_KP7:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			return kKeyActionMoveForwardLeft;
+		case Common::KEYCODE_KP9:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			return kKeyActionMoveForwardRight;
+		case Common::KEYCODE_KP4:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			// Fallthrough
+		case Common::KEYCODE_LEFT:
+			return kKeyActionMoveLeft;
+		case Common::KEYCODE_KP6:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			// Fallthrough
+		case Common::KEYCODE_RIGHT:
+			return kKeyActionMoveRight;
+		case Common::KEYCODE_KP2:
+			if (keyState.flags & Common::KBD_NUM) {
+				break;
+			}
+			// Fallthrough
+		case Common::KEYCODE_DOWN:
+			return kKeyActionMoveBack;
+		case Common::KEYCODE_PAGEUP:
+			return kKeyActionLookUp;
+		case Common::KEYCODE_PAGEDOWN:
+			return kKeyActionLookDown;
+		default:
+			break;
+	}
+
+	return kKeyActionNone;
 }
 
 Common::Point RivenStack::getMousePosition() const {
diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h
index 740dff8..ce7d2e2 100644
--- a/engines/mohawk/riven_stack.h
+++ b/engines/mohawk/riven_stack.h
@@ -70,6 +70,20 @@ private:
 	Common::Array<uint16> _index;
 };
 
+/** Actions that can be performed using the keyboard */
+enum RivenKeyAction {
+	kKeyActionNone,
+	kKeyActionSkip,
+	kKeyActionMoveForward,
+	kKeyActionMoveForwardLeft,
+	kKeyActionMoveForwardRight,
+	kKeyActionMoveLeft,
+	kKeyActionMoveRight,
+	kKeyActionMoveBack,
+	kKeyActionLookUp,
+	kKeyActionLookDown
+};
+
 /**
  * A game level
  *
@@ -152,13 +166,13 @@ public:
 	void mouseForceUp();
 
 	/** Handle a key press event */
-	void onKeyPressed(const Common::KeyCode keyCode);
+	void onKeyPressed(const Common::KeyState &keyState);
 
-	/** Get the pressed keyboard key if any */
-	Common::KeyCode keyGetPressed() const;
+	/** Get the action for the pressed keyboard key, if any */
+	RivenKeyAction keyGetAction() const;
 
 	/** Force the keyboard to be considered unpressed until the next key press */
-	void keyForceUp();
+	void keyResetAction();
 
 	// Common external commands
 	void xflies(const ArgumentArray &args); // Start the "flies" effect
@@ -210,7 +224,8 @@ private:
 
 	CommandsMap _commands;
 
-	Common::KeyCode _keyPressed;
+	RivenKeyAction _keyAction;
+	RivenKeyAction mapKeyStateToKeyAction(const Common::KeyState &keyState);
 
 	bool _mouseIsDown;
 	Common::Point _mousePosition;
diff --git a/engines/mohawk/riven_stacks/jspit.cpp b/engines/mohawk/riven_stacks/jspit.cpp
index 6a29145..eeff810 100644
--- a/engines/mohawk/riven_stacks/jspit.cpp
+++ b/engines/mohawk/riven_stacks/jspit.cpp
@@ -552,7 +552,7 @@ void JSpit::sunnersPlayVideo(RivenVideo *video, uint32 destCardGlobalId, bool su
 	while (!video->endOfVideo() && !_vm->hasGameEnded()) {
 		_vm->doFrame();
 
-		if (mouseIsDown()) {
+		if (mouseIsDown() || keyGetAction() == kKeyActionMoveForward) {
 			video->stop();
 
 			if (sunnersShouldFlee) {
diff --git a/engines/mohawk/riven_video.cpp b/engines/mohawk/riven_video.cpp
index 6923fbd..14af3e5 100644
--- a/engines/mohawk/riven_video.cpp
+++ b/engines/mohawk/riven_video.cpp
@@ -241,14 +241,14 @@ void RivenVideo::playBlocking(int32 endTime) {
 		_vm->doFrame();
 
 		// Handle skipping
-		if (playTillEnd && _vm->getStack()->keyGetPressed() == Common::KEYCODE_ESCAPE) {
+		if (playTillEnd && _vm->getStack()->keyGetAction() == kKeyActionSkip) {
 			continuePlaying = false;
 
 			// Seek to the last frame
 			_video->seek(_video->getDuration().addMsecs(-1));
 
 			_vm->getStack()->mouseForceUp();
-			_vm->getStack()->keyForceUp();
+			_vm->getStack()->keyResetAction();
 		}
 	}
 


Commit: f5b335af100c84d2ad761548825548d6fe3be125
    https://github.com/scummvm/scummvm/commit/f5b335af100c84d2ad761548825548d6fe3be125
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-06T17:55:33+02:00

Commit Message:
GUI: Mark some fall-through cases as intentional

Comments explain how the num lock handling works before the
fall-through cases.

Changed paths:
    gui/ThemeEngine.cpp
    gui/console.cpp
    gui/widgets/list.cpp
    gui/widgets/popup.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index d340047b..5c0b232 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -630,6 +630,7 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) {
 			_bytesPerPixel = sizeof(uint16);
 			break;
 		}
+		// fall through
 	default:
 		error("Invalid graphics mode");
 	}
diff --git a/gui/console.cpp b/gui/console.cpp
index 4cdad41..27b38ac 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -353,6 +353,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_DELETE:
 		if (_currentPos < _promptEndPos) {
 			killChar();
@@ -365,6 +366,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_END:
 		if (state.hasFlags(Common::KBD_SHIFT)) {
 			_scrollLine = _promptEndPos / kCharsPerLine;
@@ -382,6 +384,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_DOWN:
 		historyScroll(-1);
 		break;
@@ -391,6 +394,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_PAGEDOWN:
 		if (state.hasFlags(Common::KBD_SHIFT)) {
 			_scrollLine += _linesPerPage - 1;
@@ -409,6 +413,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_LEFT:
 		if (_currentPos > _promptStartPos)
 			_currentPos--;
@@ -420,6 +425,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_RIGHT:
 		if (_currentPos < _promptEndPos)
 			_currentPos++;
@@ -431,6 +437,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_HOME:
 		if (state.hasFlags(Common::KBD_SHIFT)) {
 			_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
@@ -446,6 +453,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_UP:
 		historyScroll(+1);
 		break;
@@ -455,6 +463,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
 			defaultKeyDownHandler(state);
 			break;
 		}
+		// fall through
 	case Common::KEYCODE_PAGEUP:
 		if (state.hasFlags(Common::KBD_SHIFT)) {
 			_scrollLine -= _linesPerPage - 1;
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 48d181e..e5690fb 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -359,6 +359,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_BACKSPACE:
 		case Common::KEYCODE_DELETE:
 			if (_selectedItem >= 0) {
@@ -375,6 +376,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_END:
 			_selectedItem = _list.size() - 1;
 			break;
@@ -385,6 +387,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_DOWN:
 			if (_selectedItem < (int)_list.size() - 1)
 				_selectedItem++;
@@ -395,6 +398,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_PAGEDOWN:
 			_selectedItem += _entriesPerPage - 1;
 			if (_selectedItem >= (int)_list.size() )
@@ -406,6 +410,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_HOME:
 			_selectedItem = 0;
 			break;
@@ -415,6 +420,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_UP:
 			if (_selectedItem > 0)
 				_selectedItem--;
@@ -425,6 +431,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 				handled = false;
 				break;
 			}
+			// fall through
 		case Common::KEYCODE_PAGEUP:
 			_selectedItem -= _entriesPerPage - 1;
 			if (_selectedItem < 0)
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 82f4112..74fbc44 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -234,6 +234,7 @@ void PopUpDialog::handleKeyDown(Common::KeyState state) {
 	case Common::KEYCODE_KP1:
 		if (state.flags & Common::KBD_NUM)
 			break;
+		// fall through
 	case Common::KEYCODE_END:
 		setSelection(_popUpBoss->_entries.size()-1);
 		break;
@@ -241,6 +242,7 @@ void PopUpDialog::handleKeyDown(Common::KeyState state) {
 	case Common::KEYCODE_KP2:
 		if (state.flags & Common::KBD_NUM)
 			break;
+		// fall through
 	case Common::KEYCODE_DOWN:
 		moveDown();
 		break;
@@ -248,6 +250,7 @@ void PopUpDialog::handleKeyDown(Common::KeyState state) {
 	case Common::KEYCODE_KP7:
 		if (state.flags & Common::KBD_NUM)
 			break;
+		// fall through
 	case Common::KEYCODE_HOME:
 		setSelection(0);
 		break;
@@ -255,6 +258,7 @@ void PopUpDialog::handleKeyDown(Common::KeyState state) {
 	case Common::KEYCODE_KP8:
 		if (state.flags & Common::KBD_NUM)
 			break;
+		// fall through
 	case Common::KEYCODE_UP:
 		moveUp();
 		break;





More information about the Scummvm-git-logs mailing list