[Scummvm-cvs-logs] SF.net SVN: scummvm:[54949] scummvm/trunk/engines/mohawk

bgk at users.sourceforge.net bgk at users.sourceforge.net
Sat Dec 18 09:07:17 CET 2010


Revision: 54949
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54949&view=rev
Author:   bgk
Date:     2010-12-18 08:07:16 +0000 (Sat, 18 Dec 2010)

Log Message:
-----------
MOHAWK: Implement Myst opcodes 157, 161 and 162: Rocket piano

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst.h
    scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/myst.h

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2010-12-17 23:12:36 UTC (rev 54948)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2010-12-18 08:07:16 UTC (rev 54949)
@@ -612,6 +612,15 @@
 	checkCursorHints();
 }
 
+MystResource *MohawkEngine_Myst::updateCurrentResource() {
+	checkCurrentResource();
+
+	if (_curResource >= 0)
+		return _resources[_curResource];
+	else
+		return 0;
+}
+
 void MohawkEngine_Myst::loadCard() {
 	debugC(kDebugView, "Loading Card View:");
 

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2010-12-17 23:12:36 UTC (rev 54948)
+++ scummvm/trunk/engines/mohawk/myst.h	2010-12-18 08:07:16 UTC (rev 54949)
@@ -160,6 +160,7 @@
 	void setMainCursor(uint16 cursor);
 	uint16 getMainCursor() { return _mainCursor; }
 	void checkCursorHints();
+	MystResource *updateCurrentResource();
 
 	MystVar *_varStore;
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-17 23:12:36 UTC (rev 54948)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-18 08:07:16 UTC (rev 54949)
@@ -32,6 +32,8 @@
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/myst.h"
 
+#include "common/events.h"
+
 #include "gui/message.h"
 
 namespace Mohawk {
@@ -109,9 +111,12 @@
 	OPCODE(154, o_basementIncreasePressureStop);
 	OPCODE(155, o_basementDecreasePressureStart);
 	OPCODE(156, o_basementDecreasePressureStop);
+	OPCODE(157, o_rocketPianoMove);
 	OPCODE(158, o_rocketSoundSliderStartMove);
 	OPCODE(159, o_rocketSoundSliderMove);
 	OPCODE(160, o_rocketSoundSliderEndMove);
+	OPCODE(161, o_rocketPianoStart);
+	OPCODE(162, o_rocketPianoStop);
 	OPCODE(163, o_rocketLeverStartMove);
 	OPCODE(164, o_rocketOpenBook);
 	OPCODE(165, o_rocketLeverMove);
@@ -979,7 +984,7 @@
 		_vm->_system->delayMillis(500);
 
 		// TODO: Play only 1st half of movie i.e. gears rise up, from 0 to 650
-		_vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36);
+		_vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 33);
 
 		myst.clockTowerBridgeOpen = 1;
 		_vm->redrawArea(12);
@@ -988,7 +993,7 @@
 		_vm->_system->delayMillis(500);
 
 		// TODO: Play only 2nd half of movie i.e. gears sink down, from 700 to 1300
-		_vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36);
+		_vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 33);
 
 		myst.clockTowerBridgeOpen = 0;
 		_vm->redrawArea(12);
@@ -1576,6 +1581,8 @@
 				// Stop background music if going up from book room
 				if (_vm->getCurCard() == 4630 && myst.treePosition > 0) {
 					_vm->_sound->stopBackground();
+				} else {
+					_vm->_sound->replaceBackground(4630, 24576);
 				}
 
 				// Redraw tree
@@ -1729,6 +1736,95 @@
 	_vm->_cursor->showCursor();
 }
 
+void MystScriptParser_Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Rocket piano start move", op);
+
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+	MystResourceType11 *key = static_cast<MystResourceType11 *>(_invokingResource);
+
+	// What the hell ??
+	Common::Rect src = key->_subImages[1].rect;
+	Common::Rect rect = key->_subImages[0].rect;
+	Common::Rect dest = rect;
+	dest.top = 332 - rect.bottom;
+	dest.bottom = 332 - rect.top;
+
+	// Draw pressed piano key
+	_vm->_gfx->copyImageSectionToScreen(key->_subImages[1].wdib, src, dest);
+	_vm->_system->updateScreen();
+
+	// Play note
+	if (myst.generatorVoltage == 59 && !myst.generatorBreakers) {
+		uint16 soundId = key->getList1(0);
+		_vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true);
+	}
+}
+
+void MystScriptParser_Myst::o_rocketPianoMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Rocket piano move", op);
+
+	const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
+	Common::Rect piano = Common::Rect(85, 123, 460, 270);
+	MystVariables::Myst &myst = _vm->_saveLoad->_v->myst;
+
+	// Unpress previous key
+	MystResourceType11 *key = static_cast<MystResourceType11 *>(_invokingResource);
+
+	Common::Rect src = key->_subImages[0].rect;
+	Common::Rect dest = src;
+	dest.top = 332 - src.bottom;
+	dest.bottom = 332 - src.top;
+
+	// Draw unpressed piano key
+	_vm->_gfx->copyImageSectionToScreen(key->_subImages[0].wdib, src, dest);
+
+	if (piano.contains(mouse)) {
+		MystResource *resource = _vm->updateCurrentResource();
+		if (resource && resource->type == kMystDragArea) {
+			// Press new key
+			key = static_cast<MystResourceType11 *>(resource);
+			src = key->_subImages[1].rect;
+			Common::Rect rect = key->_subImages[0].rect;
+			dest = rect;
+			dest.top = 332 - rect.bottom;
+			dest.bottom = 332 - rect.top;
+
+			// Draw pressed piano key
+			_vm->_gfx->copyImageSectionToScreen(key->_subImages[1].wdib, src, dest);
+
+			// Play note
+			if (myst.generatorVoltage == 59 && !myst.generatorBreakers) {
+				uint16 soundId = key->getList1(0);
+				_vm->_sound->replaceSound(soundId, Audio::Mixer::kMaxChannelVolume, true);
+			}
+		} else {
+			// Not pressing a key anymore
+			_vm->_sound->stopSound();
+			_vm->_sound->resumeBackground();
+		}
+	}
+
+	_vm->_system->updateScreen();
+}
+
+void MystScriptParser_Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Rocket piano end move", op);
+
+	MystResourceType8 *key = static_cast<MystResourceType8 *>(_invokingResource);
+
+	Common::Rect &src = key->_subImages[0].rect;
+	Common::Rect dest = src;
+	dest.top = 332 - src.bottom;
+	dest.bottom = 332 - src.top;
+
+	// Draw unpressed piano key
+	_vm->_gfx->copyImageSectionToScreen(key->_subImages[0].wdib, src, dest);
+	_vm->_system->updateScreen();
+
+	_vm->_sound->stopSound();
+	_vm->_sound->resumeBackground();
+}
+
 void MystScriptParser_Myst::o_rocketLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Rocket lever start move", op);
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-17 23:12:36 UTC (rev 54948)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.h	2010-12-18 08:07:16 UTC (rev 54949)
@@ -111,6 +111,9 @@
 	DECLARE_OPCODE(o_basementIncreasePressureStop);
 	DECLARE_OPCODE(o_basementDecreasePressureStart);
 	DECLARE_OPCODE(o_basementDecreasePressureStop);
+	DECLARE_OPCODE(o_rocketPianoStart);
+	DECLARE_OPCODE(o_rocketPianoMove);
+	DECLARE_OPCODE(o_rocketPianoStop);
 	DECLARE_OPCODE(o_rocketSoundSliderStartMove);
 	DECLARE_OPCODE(o_rocketSoundSliderMove);
 	DECLARE_OPCODE(o_rocketSoundSliderEndMove);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list