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

DrMcCoy drmccoy at drmccoy.de
Sun Sep 18 17:08:00 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:
a1825e4d02 GOB: At the decorative fishes in the Diving minigame


Commit: a1825e4d02b179233d0f8074e5c38136959a9eeb
    https://github.com/scummvm/scummvm/commit/a1825e4d02b179233d0f8074e5c38136959a9eeb
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2011-09-18T08:02:45-07:00

Commit Message:
GOB: At the decorative fishes in the Diving minigame

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



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 501f13c..e3bc69a 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -70,6 +70,7 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 	while (!_vm->shouldQuit()) {
 		checkShots();
 		updateEvilFish();
+		updateDecorFish();
 		updateAnims();
 
 		_vm->_draw->animateCursor(1);
@@ -128,6 +129,21 @@ void Diving::init() {
 		_evilFish[i].evilFish = new EvilFish(*_objects, 320, 0, 0, 0, 0, 0);
 	}
 
+	for (uint i = 0; i < kDecorFishCount; i++) {
+		_decorFish[i].enterAt = 0;
+
+		_decorFish[i].decorFish = new ANIObject(*_objects);
+	}
+
+	_decorFish[0].decorFish->setAnimation( 6); // Jellyfish
+	_decorFish[0].deltaX = 0;
+
+	_decorFish[1].decorFish->setAnimation(32); // Swarm of red/green fish
+	_decorFish[1].deltaX = -6;
+
+	_decorFish[2].decorFish->setAnimation(33); // Swarm of orange fish
+	_decorFish[2].deltaX = -6;
+
 	for (uint i = 0; i < kMaxShotCount; i++) {
 		_shot[i] = new ANIObject(*_objects);
 
@@ -148,6 +164,8 @@ void Diving::init() {
 	_anims.push_back(_water);
 	for (uint i = 0; i < kMaxShotCount; i++)
 		_anims.push_back(_shot[i]);
+	for (uint i = 0; i < kDecorFishCount; i++)
+		_anims.push_back(_decorFish[i].decorFish);
 	for (uint i = 0; i < kEvilFishCount; i++)
 		_anims.push_back(_evilFish[i].evilFish);
 	_anims.push_back(_lungs);
@@ -184,6 +202,12 @@ void Diving::deinit() {
 		_evilFish[i].evilFish = 0;
 	}
 
+	for (uint i = 0; i < kDecorFishCount; i++) {
+		delete _decorFish[i].decorFish;
+
+		_decorFish[i].decorFish = 0;
+	}
+
 	delete _heart;
 	delete _lungs;
 	delete _water;
@@ -271,6 +295,44 @@ void Diving::updateEvilFish() {
 	}
 }
 
+void Diving::updateDecorFish() {
+	for (uint i = 0; i < kDecorFishCount; i++) {
+		ManagedDecorFish &fish = _decorFish[i];
+
+		if (fish.decorFish->isVisible()) {
+			// Move the fish
+			int16 x, y;
+			fish.decorFish->getPosition(x, y);
+			fish.decorFish->setPosition(x + fish.deltaX, y);
+
+			// Check if the fish has left the screen
+			int16 width, height;
+			fish.decorFish->getFramePosition(x, y);
+			fish.decorFish->getFrameSize(width, height);
+
+			if ((x + width) <= 0) {
+				fish.decorFish->setVisible(false);
+				fish.decorFish->setPause(true);
+
+				fish.enterAt = 0;
+			}
+
+		} else {
+			// Decor fishes enter the screen every 0s - 10s
+
+			if (fish.enterAt == 0)
+				fish.enterAt = _vm->_util->getTimeKey() + _vm->_util->getRandom(10000);
+
+			if (_vm->_util->getTimeKey() >= fish.enterAt) {
+				fish.decorFish->rewind();
+				fish.decorFish->setPosition(320, 30 + _vm->_util->getRandom(100));
+				fish.decorFish->setVisible(true);
+				fish.decorFish->setPause(false);
+			}
+		}
+	}
+}
+
 void Diving::foundBlackPearl() {
 	_blackPearlCount++;
 
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index 962aaf8..e386d78 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -50,8 +50,9 @@ public:
 	bool play(uint16 playerCount, bool hasPearlLocation);
 
 private:
-	static const uint kEvilFishCount =  3;
-	static const uint kMaxShotCount  = 10;
+	static const uint kEvilFishCount  =  3;
+	static const uint kDecorFishCount =  3;
+	static const uint kMaxShotCount   = 10;
 
 	struct ManagedEvilFish {
 		EvilFish *evilFish;
@@ -60,6 +61,13 @@ private:
 		uint32 leaveAt;
 	};
 
+	struct ManagedDecorFish {
+		ANIObject *decorFish;
+
+		uint32 enterAt;
+		int8 deltaX;
+	};
+
 	GobEngine *_vm;
 
 	DECFile *_background;
@@ -71,7 +79,8 @@ private:
 	ANIObject *_lungs;
 	ANIObject *_heart;
 
-	ManagedEvilFish _evilFish[kEvilFishCount];
+	ManagedEvilFish  _evilFish[kEvilFishCount];
+	ManagedDecorFish _decorFish[kDecorFishCount];
 
 	ANIObject *_shot[kMaxShotCount];
 
@@ -102,6 +111,7 @@ private:
 	void foundWhitePearl();
 
 	void updateEvilFish();
+	void updateDecorFish();
 	void updateAnims();
 
 	int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);






More information about the Scummvm-git-logs mailing list