[Scummvm-cvs-logs] scummvm master -> 78c9c72691957ea8c6ed823b76b67a1c0e1d9a93

DrMcCoy drmccoy at drmccoy.de
Wed Jun 6 16:52:38 CEST 2012


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:
78c9c72691 GOB: Set Penetration floor palettes and fade in/out


Commit: 78c9c72691957ea8c6ed823b76b67a1c0e1d9a93
    https://github.com/scummvm/scummvm/commit/78c9c72691957ea8c6ed823b76b67a1c0e1d9a93
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-06T07:50:22-07:00

Commit Message:
GOB: Set Penetration floor palettes and fade in/out

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



diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 856c063..6d18a23 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -22,6 +22,7 @@
 
 #include "gob/global.h"
 #include "gob/util.h"
+#include "gob/palanim.h"
 #include "gob/draw.h"
 #include "gob/video.h"
 #include "gob/decfile.h"
@@ -39,25 +40,6 @@ namespace Gob {
 
 namespace Geisha {
 
-static const byte kPalette[48] = {
-	0x16,  0x16,  0x16,
-	0x12,  0x14,  0x16,
-	0x34,  0x00,  0x25,
-	0x1D,  0x1F,  0x22,
-	0x24,  0x27,  0x2A,
-	0x2C,  0x0D,  0x22,
-	0x2B,  0x2E,  0x32,
-	0x12,  0x09,  0x20,
-	0x3D,  0x3F,  0x00,
-	0x3F,  0x3F,  0x3F,
-	0x00,  0x00,  0x00,
-	0x15,  0x15,  0x3F,
-	0x25,  0x22,  0x2F,
-	0x1A,  0x14,  0x28,
-	0x3F,  0x00,  0x00,
-	0x15,  0x3F,  0x15
-};
-
 static const int kColorShield = 11;
 static const int kColorHealth = 15;
 static const int kColorBlack  = 10;
@@ -88,6 +70,63 @@ static const int kPlayAreaHeight = 113;
 static const int kPlayAreaBorderWidth  = kPlayAreaWidth  / 2;
 static const int kPlayAreaBorderHeight = kPlayAreaHeight / 2;
 
+const byte Penetration::kPalettes[kFloorCount][3 * kPaletteSize] = {
+	{
+		0x16, 0x16, 0x16,
+		0x12, 0x14, 0x16,
+		0x34, 0x00, 0x25,
+		0x1D, 0x1F, 0x22,
+		0x24, 0x27, 0x2A,
+		0x2C, 0x0D, 0x22,
+		0x2B, 0x2E, 0x32,
+		0x12, 0x09, 0x20,
+		0x3D, 0x3F, 0x00,
+		0x3F, 0x3F, 0x3F,
+		0x00, 0x00, 0x00,
+		0x15, 0x15, 0x3F,
+		0x25, 0x22, 0x2F,
+		0x1A, 0x14, 0x28,
+		0x3F, 0x00, 0x00,
+		0x15, 0x3F, 0x15
+	},
+	{
+		0x16, 0x16, 0x16,
+		0x12, 0x14, 0x16,
+		0x37, 0x00, 0x24,
+		0x1D, 0x1F, 0x22,
+		0x24, 0x27, 0x2A,
+		0x30, 0x0E, 0x16,
+		0x2B, 0x2E, 0x32,
+		0x22, 0x0E, 0x26,
+		0x3D, 0x3F, 0x00,
+		0x3F, 0x3F, 0x3F,
+		0x00, 0x00, 0x00,
+		0x15, 0x15, 0x3F,
+		0x36, 0x28, 0x36,
+		0x30, 0x1E, 0x2A,
+		0x3F, 0x00, 0x00,
+		0x15, 0x3F, 0x15
+	},
+	{
+		0x16, 0x16, 0x16,
+		0x12, 0x14, 0x16,
+		0x3F, 0x14, 0x22,
+		0x1D, 0x1F, 0x22,
+		0x24, 0x27, 0x2A,
+		0x30, 0x10, 0x10,
+		0x2B, 0x2E, 0x32,
+		0x2A, 0x12, 0x12,
+		0x3D, 0x3F, 0x00,
+		0x3F, 0x3F, 0x3F,
+		0x00, 0x00, 0x00,
+		0x15, 0x15, 0x3F,
+		0x3F, 0x23, 0x31,
+		0x39, 0x20, 0x2A,
+		0x3F, 0x00, 0x00,
+		0x15, 0x3F, 0x15
+	}
+};
+
 const byte Penetration::kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight] = {
 	{
 		{ // Real mode, floor 0
@@ -246,8 +285,9 @@ bool Penetration::play(bool hasAccessPass, bool hasMaxEnergy, bool testMode) {
 	while (!_vm->shouldQuit() && !isDead() && !hasWon()) {
 		updateAnims();
 
-		// Draw and wait for the end of the frame
+		// Draw, fade in if necessary and wait for the end of the frame
 		_vm->_draw->blitInvalidated();
+		fadeIn();
 		_vm->_util->waitEndFrame();
 
 		// Handle input
@@ -450,13 +490,30 @@ void Penetration::createMap() {
 	_anims.push_back(_sub->sub);
 }
 
+void Penetration::fadeIn() {
+	if (!_needFadeIn)
+		return;
+
+	// Fade to palette
+	_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+	_needFadeIn = false;
+}
+
+void Penetration::setPalette() {
+	// Fade to black
+	_vm->_palAnim->fade(0, 0, 0);
+
+	// Set palette
+	memcpy(_vm->_draw->_vgaPalette     , kPalettes[_floor], 3 * kPaletteSize);
+	memcpy(_vm->_draw->_vgaSmallPalette, kPalettes[_floor], 3 * kPaletteSize);
+
+	_needFadeIn = true;
+}
+
 void Penetration::initScreen() {
 	_vm->_util->setFrameRate(15);
 
-	memcpy(_vm->_draw->_vgaPalette     , kPalette, 48);
-	memcpy(_vm->_draw->_vgaSmallPalette, kPalette, 48);
-
-	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+	setPalette();
 
 	// Draw the shield meter
 	_sprites->draw(*_background,   0,   0,  95,   6, 9, 117, 0); // Meter frame
@@ -621,6 +678,7 @@ void Penetration::checkExited() {
 		if (_floor >= kFloorCount)
 			return;
 
+		setPalette();
 		createMap();
 	}
 }
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
index f717e72..f19e186 100644
--- a/engines/gob/minigames/geisha/penetration.h
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -57,6 +57,9 @@ private:
 	static const int kMapWidth  = 17;
 	static const int kMapHeight = 13;
 
+	static const int kPaletteSize = 16;
+
+	static const byte kPalettes[kFloorCount][3 * kPaletteSize];
 	static const byte kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight];
 
 	struct Position {
@@ -97,6 +100,8 @@ private:
 	bool _hasMaxEnergy;
 	bool _testMode;
 
+	bool _needFadeIn;
+
 	Surface *_background;
 	CMPFile *_sprites;
 	ANIFile *_objects;
@@ -133,6 +138,9 @@ private:
 
 	void initScreen();
 
+	void setPalette();
+	void fadeIn();
+
 	void updateAnims();
 
 	int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);






More information about the Scummvm-git-logs mailing list