[Scummvm-cvs-logs] scummvm master -> 9fba98415de3fe4bd0549075eed9f7b42400f8c5

DrMcCoy drmccoy at drmccoy.de
Sat Jan 28 20:11:20 CET 2012


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

Summary:
0eeae6e59e GOB: Oko gets hurt by fish and dies if health == 0
3a95cdf961 GOB: Correct the variable value for the Diving result
4b60a761a0 GOB: Explicitely set the Diving palette
c0d0792ccf GOB: End the Diving minigame when Oko is dead
c161cc1232 GOB: Fade the Diving minigame in
9fba98415d GOB: Don't play a hurt animation right before Oko dies


Commit: 0eeae6e59e49dbcd72a646a1be0d77aa962e7959
    https://github.com/scummvm/scummvm/commit/0eeae6e59e49dbcd72a646a1be0d77aa962e7959
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T10:45:02-08:00

Commit Message:
GOB: Oko gets hurt by fish and dies if health == 0

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



diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index a01fe43..0ca850d 100644
--- a/engines/gob/aniobject.cpp
+++ b/engines/gob/aniobject.cpp
@@ -111,6 +111,36 @@ void ANIObject::getFrameSize(int16 &width, int16 &height) const {
 	height = animation.frameAreas[_frame].bottom - animation.frameAreas[_frame].top  + 1;
 }
 
+bool ANIObject::isIn(int16 x, int16 y) const {
+	if (!isVisible())
+		return false;
+
+	int16 frameX, frameY, frameWidth, frameHeight;
+	getFramePosition(frameX, frameY);
+	getFrameSize(frameWidth, frameHeight);
+
+	if ((x < frameX) || (y < frameY))
+		return false;
+	if ((x > (frameX + frameWidth)) || (y > (frameY + frameHeight)))
+		return false;
+
+	return true;
+}
+
+bool ANIObject::isIn(const ANIObject &obj) const {
+	if (!isVisible() || !obj.isVisible())
+		return false;
+
+	int16 frameX, frameY, frameWidth, frameHeight;
+	getFramePosition(frameX, frameY);
+	getFrameSize(frameWidth, frameHeight);
+
+	return obj.isIn(frameX                 , frameY                  ) ||
+	       obj.isIn(frameX + frameWidth - 1, frameY                  ) ||
+	       obj.isIn(frameX                 , frameY + frameHeight - 1) ||
+	       obj.isIn(frameX + frameWidth - 1, frameY + frameHeight - 1);
+}
+
 void ANIObject::draw(Surface &dest, int16 &left, int16 &top,
                                     int16 &right, int16 &bottom) {
 
diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h
index 2810300..e3fe301 100644
--- a/engines/gob/aniobject.h
+++ b/engines/gob/aniobject.h
@@ -69,6 +69,11 @@ public:
 	/** Return the current frame size. */
 	void getFrameSize(int16 &width, int16 &height) const;
 
+	/** Are there coordinates within the animation sprite? */
+	bool isIn(int16 x, int16 y) const;
+	/** Is this object within the animation sprite? */
+	bool isIn(const ANIObject &obj) const;
+
 	/** Set the animation number. */
 	void setAnimation(uint16 animation);
 
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 0a43f96..fb906ce 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -66,8 +66,8 @@ Diving::Diving(GobEngine *vm) : _vm(vm), _background(0),
 
 	_blackPearl = new Surface(11, 8, 1);
 
-	_airMeter    = new Meter(4  , 195, 38, 2, 5, 7, 38, Meter::kFillToLeft);
-	_healthMeter = new Meter(276, 195, 38, 2, 6, 7, 38, Meter::kFillToLeft);
+	_airMeter    = new Meter(3  , 195, 40, 2, 5, 7, 40, Meter::kFillToLeft);
+	_healthMeter = new Meter(275, 195, 40, 2, 6, 7,  4, Meter::kFillToLeft);
 
 	for (uint i = 0; i < kEvilFishCount; i++)
 		_evilFish[i].evilFish = 0;
@@ -108,6 +108,8 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 
 	while (!_vm->shouldQuit()) {
 		checkShots();
+		checkOkoHurt();
+
 		updateAirMeter();
 		updateEvilFish();
 		updateDecorFish();
@@ -132,13 +134,7 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 		if (mouseButtons == kMouseButtonsLeft)
 			shoot(mouseX, mouseY);
 
-		if (key == kKeyDown) {
-			_oko->sink();
-			if ((_oko->getState() == Oko::kStatePick) && (_oko->getFrame() == 0))
-				getPearl();
-
-		} else if (key == kKeyUp)
-			_oko->raise();
+		handleOko(key);
 
 		if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2))
 			break;
@@ -251,6 +247,7 @@ void Diving::init() {
 	_healthMeter->setValue(38);
 
 	_airCycle = 0;
+	_hurtGracePeriod = 0;
 }
 
 void Diving::deinit() {
@@ -682,6 +679,45 @@ void Diving::checkShots() {
 	}
 }
 
+void Diving::handleOko(int16 key) {
+	if (key == kKeyDown) {
+		_oko->sink();
+
+		if ((_oko->getState() == Oko::kStatePick) && (_oko->getFrame() == 0))
+			getPearl();
+
+	} else if (key == kKeyUp)
+		_oko->raise();
+}
+
+void Diving::checkOkoHurt() {
+	if (_oko->getState() != Oko::kStateSwim)
+		return;
+
+	// Oko dies if the health reaches 0
+	if (_healthMeter->getValue() == 0)
+		_oko->die();
+
+	// Give Oko a grace period after being hurt
+	if (_hurtGracePeriod > 0) {
+		_hurtGracePeriod--;
+		return;
+	}
+
+	// Check for a fish/Oko-collision
+	for (uint i = 0; i < kEvilFishCount; i++) {
+		EvilFish &evilFish = *_evilFish[i].evilFish;
+
+		if (!evilFish.isDead() && evilFish.isIn(*_oko)) {
+			_oko->hurt();
+			_healthMeter->decrease();
+
+			_hurtGracePeriod = 10;
+			break;
+		}
+	}
+}
+
 } // End of namespace Geisha
 
 } // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index 2915e85..5db1b81 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -137,6 +137,7 @@ private:
 	Meter *_healthMeter;
 
 	uint8 _airCycle;
+	uint8 _hurtGracePeriod;
 
 	uint8 _currentShot;
 
@@ -174,6 +175,10 @@ private:
 
 	void shoot(int16 mouseX, int16 mouseY);
 	void checkShots();
+
+	void handleOko(int16 key);
+
+	void checkOkoHurt();
 };
 
 } // End of namespace Geisha
diff --git a/engines/gob/minigames/geisha/evilfish.cpp b/engines/gob/minigames/geisha/evilfish.cpp
index e9503f4..c7ef9d5 100644
--- a/engines/gob/minigames/geisha/evilfish.cpp
+++ b/engines/gob/minigames/geisha/evilfish.cpp
@@ -39,19 +39,6 @@ EvilFish::EvilFish(const ANIFile &ani, uint16 screenWidth,
 EvilFish::~EvilFish() {
 }
 
-bool EvilFish::isIn(int16 x, int16 y) const {
-	int16 frameX, frameY, frameWidth, frameHeight;
-	getFramePosition(frameX, frameY);
-	getFrameSize(frameWidth, frameHeight);
-
-	if ((x < frameX) || (y < frameY))
-		return false;
-	if ((x > (frameX + frameWidth)) || (y > (frameY + frameHeight)))
-		return false;
-
-	return true;
-}
-
 void EvilFish::enter(Direction from, int16 y) {
 	_shouldLeave = false;
 
@@ -184,6 +171,10 @@ void EvilFish::mutate(uint16 animSwimLeft, uint16 animSwimRight,
 	}
 }
 
+bool EvilFish::isDead() {
+	return !isVisible() || (_state == kStateNone) || (_state == kStateDie);
+}
+
 } // End of namespace Geisha
 
 } // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/evilfish.h b/engines/gob/minigames/geisha/evilfish.h
index 223645f..81efb67 100644
--- a/engines/gob/minigames/geisha/evilfish.h
+++ b/engines/gob/minigames/geisha/evilfish.h
@@ -42,9 +42,6 @@ public:
 	         uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
 	~EvilFish();
 
-	/** Are there coordinates within the fish's sprite? */
-	bool isIn(int16 x, int16 y) const;
-
 	/** Enter from this direction / screen edge. */
 	void enter(Direction from, int16 y);
 	/** Leave the screen in the current direction. */
@@ -60,6 +57,9 @@ public:
 	void mutate(uint16 animSwimLeft, uint16 animSwimRight,
 	            uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
 
+	/** Is the fish dead? */
+	bool isDead();
+
 private:
 	enum State {
 		kStateNone,
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
index c9d4d1f..1e90b1f 100644
--- a/engines/gob/minigames/geisha/oko.cpp
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -35,6 +35,7 @@ enum kOkoAnimation {
 	kOkoAnimationRaise   =  7,
 	kOkoAnimationBreathe =  2,
 	kOkoAnimationPick    =  3,
+	kOkoAnimationHurt    =  4,
 	kOkoAnimationDie0    = 17,
 	kOkoAnimationDie1    = 18,
 	kOkoAnimationDie2    = 19
@@ -80,6 +81,7 @@ void Oko::advance() {
 			_sound->blasterPlay(_breathe, 1, 0);
 		case kStateSink:
 		case kStateRaise:
+		case kStateHurt:
 			if (wasLastFrame) {
 				setAnimation(kOkoAnimationSwim);
 				setPosition(kOkoPositionX, kLevelPositionX[_level]);
@@ -135,6 +137,14 @@ void Oko::raise() {
 	_level--;
 }
 
+void Oko::hurt() {
+	if (_state != kStateSwim)
+		return;
+
+	setAnimation(kOkoAnimationHurt);
+	_state = kStateHurt;
+}
+
 void Oko::die() {
 	if (_state != kStateSwim)
 		return;
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
index d5d18c1..7fe0001 100644
--- a/engines/gob/minigames/geisha/oko.h
+++ b/engines/gob/minigames/geisha/oko.h
@@ -42,6 +42,7 @@ public:
 		kStateRaise,
 		kStateBreathe,
 		kStatePick,
+		kStateHurt,
 		kStateDead
 	};
 
@@ -56,6 +57,9 @@ public:
 	/** Oko should raise a level. */
 	void raise();
 
+	/** Oko should get hurt. */
+	void hurt();
+
 	/** Oko should die. */
 	void die();
 


Commit: 3a95cdf961c36387968c7db0c9950a0672b097b9
    https://github.com/scummvm/scummvm/commit/3a95cdf961c36387968c7db0c9950a0672b097b9
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T10:45:27-08:00

Commit Message:
GOB: Correct the variable value for the Diving result

Changed paths:
    engines/gob/inter_geisha.cpp



diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index c5b91a4..1f2a7fa 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -280,7 +280,7 @@ void Inter_Geisha::oGeisha_gameDiving(OpGobParams &params) {
 
 	bool result = _diving->play(playerCount, hasPearlLocation);
 
-	WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
+	WRITE_VAR_UINT32(resultVar, result ? 0 : 1);
 }
 
 void Inter_Geisha::oGeisha_loadTitleMusic(OpGobParams &params) {


Commit: 4b60a761a0ec5694178ac236e24136823d8907d9
    https://github.com/scummvm/scummvm/commit/4b60a761a0ec5694178ac236e24136823d8907d9
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T10:53:26-08:00

Commit Message:
GOB: Explicitely set the Diving palette

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



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index fb906ce..d94ce08 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -41,6 +41,24 @@ namespace Geisha {
 
 static const uint8 kAirDecreaseRate = 15;
 
+static const byte kPalette[48] = {
+	0x00, 0x02, 0x12,
+	0x01, 0x04, 0x1D,
+	0x05, 0x08, 0x28,
+	0x0C, 0x0D, 0x33,
+	0x15, 0x14, 0x3F,
+	0x00, 0x3F, 0x00,
+	0x3F, 0x00, 0x00,
+	0x00, 0x00, 0x00,
+	0x21, 0x0D, 0x00,
+	0x2F, 0x1A, 0x04,
+	0x3D, 0x2B, 0x0D,
+	0x10, 0x10, 0x10,
+	0x1A, 0x1A, 0x1A,
+	0x24, 0x24, 0x24,
+	0x00, 0x01, 0x0F,
+	0x3F, 0x3F, 0x3F
+};
 
 const uint16 Diving::kEvilFishTypes[kEvilFishTypeCount][5] = {
 	{ 0, 14,  8,  9, 3}, // Shark
@@ -315,6 +333,9 @@ void Diving::deinit() {
 void Diving::initScreen() {
 	_vm->_util->setFrameRate(15);
 
+	memcpy(_vm->_draw->_vgaPalette     , kPalette, 48);
+	memcpy(_vm->_draw->_vgaSmallPalette, kPalette, 48);
+
 	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
 
 	_vm->_draw->_backSurface->clear();


Commit: c0d0792ccf346270f4def39182748e4c9f3def3d
    https://github.com/scummvm/scummvm/commit/c0d0792ccf346270f4def39182748e4c9f3def3d
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T10:55:55-08:00

Commit Message:
GOB: End the Diving minigame when Oko is dead

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



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index d94ce08..6b891b4 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -128,6 +128,10 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 		checkShots();
 		checkOkoHurt();
 
+		// Is Oko dead?
+		if (_oko->isPaused())
+			break;
+
 		updateAirMeter();
 		updateEvilFish();
 		updateDecorFish();


Commit: c161cc123239966128d9487e84face5fbdc463de
    https://github.com/scummvm/scummvm/commit/c161cc123239966128d9487e84face5fbdc463de
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T11:08:13-08:00

Commit Message:
GOB: Fade the Diving minigame in

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



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 6b891b4..047eb5b 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -23,6 +23,7 @@
 #include "common/list.h"
 
 #include "gob/global.h"
+#include "gob/palanim.h"
 #include "gob/draw.h"
 #include "gob/video.h"
 #include "gob/decfile.h"
@@ -116,14 +117,21 @@ Diving::~Diving() {
 bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
 	_hasPearlLocation = hasPearlLocation;
 
+	_vm->_palAnim->fade(0, 0, 0);
+
 	init();
 	initScreen();
 	initCursor();
 	initPlants();
 
+	updateAirMeter();
+	updateAnims();
+
 	_vm->_draw->blitInvalidated();
 	_vm->_video->retrace();
 
+	_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+
 	while (!_vm->shouldQuit()) {
 		checkShots();
 		checkOkoHurt();
@@ -340,8 +348,6 @@ void Diving::initScreen() {
 	memcpy(_vm->_draw->_vgaPalette     , kPalette, 48);
 	memcpy(_vm->_draw->_vgaSmallPalette, kPalette, 48);
 
-	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
-
 	_vm->_draw->_backSurface->clear();
 	_background->draw(*_vm->_draw->_backSurface);
 


Commit: 9fba98415de3fe4bd0549075eed9f7b42400f8c5
    https://github.com/scummvm/scummvm/commit/9fba98415de3fe4bd0549075eed9f7b42400f8c5
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-01-28T11:09:58-08:00

Commit Message:
GOB: Don't play a hurt animation right before Oko dies

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



diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 047eb5b..12571be 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -725,10 +725,6 @@ void Diving::checkOkoHurt() {
 	if (_oko->getState() != Oko::kStateSwim)
 		return;
 
-	// Oko dies if the health reaches 0
-	if (_healthMeter->getValue() == 0)
-		_oko->die();
-
 	// Give Oko a grace period after being hurt
 	if (_hurtGracePeriod > 0) {
 		_hurtGracePeriod--;
@@ -740,9 +736,14 @@ void Diving::checkOkoHurt() {
 		EvilFish &evilFish = *_evilFish[i].evilFish;
 
 		if (!evilFish.isDead() && evilFish.isIn(*_oko)) {
-			_oko->hurt();
 			_healthMeter->decrease();
 
+			// If the health reached 0, Oko dies. Otherwise, she gets hurt
+			if (_healthMeter->getValue() == 0)
+				_oko->die();
+			else
+				_oko->hurt();
+
 			_hurtGracePeriod = 10;
 			break;
 		}






More information about the Scummvm-git-logs mailing list