[Scummvm-cvs-logs] scummvm master -> cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f

DrMcCoy drmccoy at drmccoy.de
Fri Jan 27 14:58:59 CET 2012


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:
8414627216 GOB: Play Oko's breathing sound
cf45f49f72 GOB: Picking up pearls


Commit: 841462721686488a41588410418f4e5ff46dac76
    https://github.com/scummvm/scummvm/commit/841462721686488a41588410418f4e5ff46dac76
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-27T05:45:41-08:00

Commit Message:
GOB: Play Oko's breathing sound

Changed paths:
    engines/gob/minigames/geisha/diving.cpp
    engines/gob/minigames/geisha/oko.cpp
    engines/gob/minigames/geisha/oko.h
    engines/gob/sound/bgatmosphere.h



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 1f5c025..e08902a 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -134,6 +134,11 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 }
 
 void Diving::init() {
+	_vm->_sound->sampleLoad(&_soundShoot     , SOUND_SND, "tirgim.snd");
+	_vm->_sound->sampleLoad(&_soundBreathe   , SOUND_SND, "respir.snd");
+	_vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
+	_vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
+
 	_background = new DECFile(_vm, "tperle.dec"  , 320, 200);
 	_objects    = new ANIFile(_vm, "tperle.ani"  , 320);
 	_gui        = new ANIFile(_vm, "tperlcpt.ani", 320);
@@ -201,7 +206,7 @@ void Diving::init() {
 		_shot[i]->setMode(ANIObject::kModeOnce);
 	}
 
-	_oko = new Oko(*_okoAnim);
+	_oko = new Oko(*_okoAnim, *_vm->_sound, _soundBreathe);
 
 	Surface tmp(320, 103, 1);
 
@@ -226,11 +231,6 @@ void Diving::init() {
 	_anims.push_back(_oko);
 	_anims.push_back(_lungs);
 	_anims.push_back(_heart);
-
-	_vm->_sound->sampleLoad(&_soundShoot     , SOUND_SND, "tirgim.snd");
-	_vm->_sound->sampleLoad(&_soundBreathe   , SOUND_SND, "respir.snd");
-	_vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
-	_vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
 }
 
 void Diving::deinit() {
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
index 24a6c80..f8536ea 100644
--- a/engines/gob/minigames/geisha/oko.cpp
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -20,6 +20,8 @@
  *
  */
 
+#include "gob/sound/sound.h"
+
 #include "gob/minigames/geisha/oko.h"
 
 namespace Gob {
@@ -40,7 +42,9 @@ static const uint kLevelCount = 3;
 static const int16 kLevelPositionX[kLevelCount] = { 44, 84, 124 };
 
 
-Oko::Oko(const ANIFile &ani) : ANIObject(ani), _state(kStateEnter), _level(0) {
+Oko::Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe) :
+	ANIObject(ani), _sound(&sound), _breathe(&breathe), _state(kStateEnter), _level(0) {
+
 	setAnimation(kOkoAnimationEnter);
 	setVisible(true);
 }
@@ -62,9 +66,11 @@ void Oko::advance() {
 			}
 			break;
 
+		case kStateBreathe:
+			if ((getFrame() == 6) || (getFrame() == 23))
+			_sound->blasterPlay(_breathe, 1, 0);
 		case kStateSink:
 		case kStateRaise:
-		case kStateBreathe:
 			if (wasLastFrame) {
 				setAnimation(kOkoAnimationSwim);
 				setPosition(kOkoPositionX, kLevelPositionX[_level]);
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
index 7e56315..e44d273 100644
--- a/engines/gob/minigames/geisha/oko.h
+++ b/engines/gob/minigames/geisha/oko.h
@@ -27,6 +27,9 @@
 
 namespace Gob {
 
+class Sound;
+class SoundDesc;
+
 namespace Geisha {
 
 /** Oko, the person you control, in Geisha's "Diving" minigame. */
@@ -40,7 +43,7 @@ public:
 		kStateBreathe
 	};
 
-	Oko(const ANIFile &ani);
+	Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe);
 	~Oko();
 
 	/** Advance the animation to the next frame. */
@@ -54,6 +57,9 @@ public:
 	State getState() const;
 
 private:
+	Sound *_sound;
+	SoundDesc *_breathe;
+
 	State _state;
 
 	uint8 _level;
diff --git a/engines/gob/sound/bgatmosphere.h b/engines/gob/sound/bgatmosphere.h
index e88b91d..23fcc8a 100644
--- a/engines/gob/sound/bgatmosphere.h
+++ b/engines/gob/sound/bgatmosphere.h
@@ -24,6 +24,7 @@
 #define GOB_SOUND_BGATMOSPHERE_H
 
 #include "audio/mixer.h"
+#include "common/array.h"
 #include "common/mutex.h"
 #include "common/random.h"
 


Commit: cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f
    https://github.com/scummvm/scummvm/commit/cf45f49f72dba59c94ac4d2c0e1bcbebf1482b8f
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-27T05:55:32-08:00

Commit Message:
GOB: Picking up pearls

Changed paths:
    engines/gob/minigames/geisha/diving.cpp
    engines/gob/minigames/geisha/diving.h
    engines/gob/minigames/geisha/oko.cpp
    engines/gob/minigames/geisha/oko.h



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index e08902a..d59d343 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -120,9 +120,12 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 		if (mouseButtons == kMouseButtonsLeft)
 			shoot(mouseX, mouseY);
 
-		if      (key == kKeyDown)
+		if (key == kKeyDown) {
+			if (_oko->isAtBottom())
+				getPearl();
+
 			_oko->sink();
-		else if (key == kKeyUp)
+		} else if (key == kKeyUp)
 			_oko->raise();
 
 		if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2))
@@ -510,6 +513,30 @@ void Diving::updatePearl() {
 	}
 }
 
+void Diving::getPearl() {
+	if (!_pearl.pearl->isVisible())
+		return;
+
+	// Make sure the pearl is within Oko's grasp
+
+	int16 x, y, width, height;
+	_pearl.pearl->getFramePosition(x, y);
+	_pearl.pearl->getFrameSize(width, height);
+
+	if ((x > 175) || ((x + width) < 168))
+		return;
+
+	// Remove the pearl
+	_pearl.pearl->setVisible(false);
+	_pearl.pearl->setPause(true);
+
+	// Add the pearl to our found pearls repository
+	if (_pearl.black)
+		foundBlackPearl();
+	else
+		foundWhitePearl();
+}
+
 void Diving::foundBlackPearl() {
 	_blackPearlCount++;
 
@@ -520,6 +547,8 @@ void Diving::foundBlackPearl() {
 		_vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 160, 179, 0);
 		_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 160, 186);
 	}
+
+	_vm->_sound->blasterPlay(&_soundBlackPearl, 1, 0);
 }
 
 void Diving::foundWhitePearl() {
@@ -531,6 +560,8 @@ void Diving::foundWhitePearl() {
 
 	_background->drawLayer(*_vm->_draw->_backSurface, 0, 2, x, 177, 0);
 	_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, 177, x + 3, 180);
+
+	_vm->_sound->blasterPlay(&_soundWhitePearl, 1, 0);
 }
 
 void Diving::updateAnims() {
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index eeee4df..b00252c 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -152,6 +152,8 @@ private:
 	void enterPlant(ManagedPlant &plant, int16 prevPlantX);
 	void enterPearl(int16 x);
 
+	void getPearl();
+
 	void foundBlackPearl();
 	void foundWhitePearl();
 
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
index f8536ea..e4cf32f 100644
--- a/engines/gob/minigames/geisha/oko.cpp
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -118,6 +118,10 @@ Oko::State Oko::getState() const {
 	return _state;
 }
 
+bool Oko::isAtBottom() const {
+	return _level >= (kLevelCount - 1);
+}
+
 } // End of namespace Geisha
 
 } // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
index e44d273..892f0b8 100644
--- a/engines/gob/minigames/geisha/oko.h
+++ b/engines/gob/minigames/geisha/oko.h
@@ -56,6 +56,8 @@ public:
 
 	State getState() const;
 
+	bool isAtBottom() const;
+
 private:
 	Sound *_sound;
 	SoundDesc *_breathe;






More information about the Scummvm-git-logs mailing list