[Scummvm-cvs-logs] scummvm master -> 4f5ecc4861f170c4a7881140533846db1095fa5b

bgK bastien.bouclet at gmail.com
Thu May 12 20:55:35 CEST 2011


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

Summary:
4f5ecc4861 MOHAWK: Implement Mechanical opcodes 101, 103 and 202. Singing Bird.


Commit: 4f5ecc4861f170c4a7881140533846db1095fa5b
    https://github.com/scummvm/scummvm/commit/4f5ecc4861f170c4a7881140533846db1095fa5b
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2011-05-12T11:53:53-07:00

Commit Message:
MOHAWK: Implement Mechanical opcodes 101, 103 and 202. Singing Bird.

Changed paths:
    engines/mohawk/myst_stacks/mechanical.cpp
    engines/mohawk/myst_stacks/mechanical.h



diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 452c8c8..b8a6b31 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -51,6 +51,9 @@ Mechanical::~Mechanical() {
 void Mechanical::setupOpcodes() {
 	// "Stack-Specific" Opcodes
 	OPCODE(100, o_throneEnablePassage);
+	OPCODE(101, o_birdCrankStart);
+	OPCODE(102, NOP);
+	OPCODE(103, o_birdCrankStop);
 	OPCODE(104, o_snakeBoxTrigger);
 	OPCODE(105, o_fortressStaircaseMovie);
 	OPCODE(106, o_elevatorRotationStart);
@@ -72,7 +75,7 @@ void Mechanical::setupOpcodes() {
 	// "Init" Opcodes
 	OPCODE(200, o_throne_init);
 	OPCODE(201, o_fortressStaircase_init);
-	OPCODE(202, opcode_202);
+	OPCODE(202, o_bird_init);
 	OPCODE(203, o_snakeBox_init);
 	OPCODE(204, o_elevatorRotation_init);
 	OPCODE(205, opcode_205);
@@ -86,15 +89,16 @@ void Mechanical::setupOpcodes() {
 #undef OPCODE
 
 void Mechanical::disablePersistentScripts() {
-	opcode_202_disable();
 	opcode_205_disable();
 	opcode_206_disable();
 	opcode_209_disable();
 	_elevatorGoingMiddle = false;
+	_birdSinging = false;
 }
 
 void Mechanical::runPersistentScripts() {
-	opcode_202_run();
+	if (_birdSinging)
+		birdSing_run();
 
 	if (_elevatorRotationLeverMoving)
 		elevatorRotation_run();
@@ -242,6 +246,38 @@ void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, uint16 argc, uint1
 	_vm->_resources[argv[0]]->setEnabled(getVar(var));
 }
 
+void Mechanical::o_birdCrankStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Mechanical bird crank start", op);
+
+	MystResourceType11 *crank = static_cast<MystResourceType11 *>(_invokingResource);
+
+	uint16 crankSoundId = crank->getList2(0);
+	_vm->_sound->replaceSoundMyst(crankSoundId, Audio::Mixer::kMaxChannelVolume, true);
+
+	_birdSingEndTime = 0;
+	_birdCrankStartTime = _vm->_system->getMillis();
+
+	MystResourceType6 *crankMovie = static_cast<MystResourceType6 *>(crank->getSubResource(0));
+	crankMovie->playMovie();
+}
+
+void Mechanical::o_birdCrankStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Mechanical bird crank stop", op);
+
+	MystResourceType11 *crank = static_cast<MystResourceType11 *>(_invokingResource);
+
+	MystResourceType6 *crankMovie = static_cast<MystResourceType6 *>(crank->getSubResource(0));
+	crankMovie->pauseMovie(true);
+
+	uint16 crankSoundId = crank->getList2(1);
+	_vm->_sound->replaceSoundMyst(crankSoundId);
+
+	_birdSingEndTime = 2 * _vm->_system->getMillis() - _birdCrankStartTime;
+	_birdSinging = true;
+
+	_bird->playMovie();
+}
+
 void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op);
 
@@ -512,25 +548,21 @@ void Mechanical::o_fortressStaircase_init(uint16 op, uint16 var, uint16 argc, ui
 	_vm->_resources[argv[2]]->setEnabled(_state.staircaseState);
 }
 
-static struct {
-	bool enabled;
-} g_opcode202Parameters;
-
-void Mechanical::opcode_202_run() {
+void Mechanical::birdSing_run() {
 	// Used for Card 6220 (Sirrus' Mechanical Bird)
-	// TODO: Fill in Function
+	uint32 time = _vm->_system->getMillis();
+	if (_birdSingEndTime < time) {
+		_bird->pauseMovie(true);
+		_birdSinging = false;
+	}
 }
 
-void Mechanical::opcode_202_disable() {
-	g_opcode202Parameters.enabled = false;
-}
+void Mechanical::o_bird_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Mechanical bird init", op);
 
-void Mechanical::opcode_202(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	// Used for Card 6220 (Sirrus' Mechanical Bird)
-	if (argc == 0)
-		g_opcode202Parameters.enabled = true;
-	else
-		unknown(op, var, argc, argv);
+	_birdSinging = false;
+	_birdSingEndTime = 0;
+	_bird = static_cast<MystResourceType6 *>(_invokingResource);
 }
 
 void Mechanical::o_snakeBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h
index 60b7d12..320fbb7 100644
--- a/engines/mohawk/myst_stacks/mechanical.h
+++ b/engines/mohawk/myst_stacks/mechanical.h
@@ -49,8 +49,7 @@ private:
 	void toggleVar(uint16 var);
 	bool setVarValue(uint16 var, uint16 value);
 
-	void opcode_202_run();
-	void opcode_202_disable();
+	void birdSing_run();
 	void elevatorRotation_run();
 	void elevatorGoMiddle_run();
 	void opcode_205_run();
@@ -61,6 +60,8 @@ private:
 	void opcode_209_disable();
 
 	DECLARE_OPCODE(o_throneEnablePassage);
+	DECLARE_OPCODE(o_birdCrankStart);
+	DECLARE_OPCODE(o_birdCrankStop);
 	DECLARE_OPCODE(o_snakeBoxTrigger);
 	DECLARE_OPCODE(o_fortressStaircaseMovie);
 	DECLARE_OPCODE(o_elevatorRotationStart);
@@ -81,7 +82,7 @@ private:
 
 	DECLARE_OPCODE(o_throne_init);
 	DECLARE_OPCODE(o_fortressStaircase_init);
-	DECLARE_OPCODE(opcode_202);
+	DECLARE_OPCODE(o_bird_init);
 	DECLARE_OPCODE(o_snakeBox_init);
 	DECLARE_OPCODE(o_elevatorRotation_init);
 	DECLARE_OPCODE(opcode_205);
@@ -110,6 +111,12 @@ private:
 
 	uint16 _crystalLit; // 130
 
+	bool _birdSinging; // 144
+	uint32 _birdCrankStartTime; // 136
+	uint32 _birdSingEndTime; // 140
+	MystResourceType6 *_bird; // 152
+
+
 	MystResourceType6 *_snakeBox; // 156
 };
 






More information about the Scummvm-git-logs mailing list