[Scummvm-cvs-logs] scummvm master -> 2642b0640c5950e1db5c08852ab4a24994505b39

urukgit urukgit at users.noreply.github.com
Sat Feb 8 16:49:12 CET 2014


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:
2642b0640c AVALANCHE: Implement the animation of the ghost.


Commit: 2642b0640c5950e1db5c08852ab4a24994505b39
    https://github.com/scummvm/scummvm/commit/2642b0640c5950e1db5c08852ab4a24994505b39
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-08T07:48:29-08:00

Commit Message:
AVALANCHE: Implement the animation of the ghost.

Modify GraphicManager::ghostDrawGhost() to do so.

Changed paths:
    engines/avalanche/ghostroom.cpp
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h



diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 98dd909..d5d10ab 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -31,7 +31,7 @@
 namespace Avalanche {
 
 const int8 GhostRoom::kAdjustment[5] = { 7, 0, 7, 7, 7 };
-const byte GhostRoom::kWaveOrder[5] = { 5, 1, 2, 3, 4 };
+const byte GhostRoom::kWaveOrder[5] = { 4, 0, 1, 2, 3 };
 const byte GhostRoom::kGlerkFade[26] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 0 };
 const byte GhostRoom::kGreldetFade[18] = { 1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 };
 
@@ -236,6 +236,29 @@ void GhostRoom::run() {
 	_vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 530, 50), kColorBlack);
 	_vm->_graphics->refreshScreen();
 
+	
+	// Here comes the descending ghost:
+	for (int y = -64; y <= 103; y++) {
+		_vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y);
+		if (y > 0)
+			_vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8, y), kColorBlack);
+		_vm->_graphics->refreshScreen();
+
+		wait(27);
+	}
+
+	// Then it waves:
+	_aarghCount = -14;
+
+	for (int i = 0; i < 4; i++)
+		for (int j = 0; j < 5; j++) {
+			_vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 169 + kAdjustment[j]), kColorBlack);
+			_vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]);
+			_vm->_graphics->refreshScreen();
+
+			wait(177);
+		}
+	
 	warning("STUB: run()");
 
 	CursorMan.showMouse(true);
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 06c8c83..6cafc0b 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -504,19 +504,28 @@ void GraphicManager::nimFree() {
 	_nimLogo.free();
 }
 
-void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY) {
+void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY) {
 	const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
-	// Constants from the original code.
-	const uint16 height = 66;
+	// Constants from the original code:
+	uint16 height = 66;
 	const uint16 width = 26 * 8;
 
+	// We have to mess around with the coords and the sizes since
+	// the ghost isn't always placed fully on the screen.
+	int yStart = 0;
+	if (destY < 0) {
+		yStart = abs(destY);
+		height -= yStart;
+		destY = 0;
+	}
+
 	Graphics::Surface ghostPic;
 	ghostPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 
 	for (int y = 0; y < height; y++) {
 		for (int plane = 0; plane < 4; plane++) {
 			for (uint16 x = 0; x < width / 8; x ++) {
-				byte pixel = ghostArr[kPlaneToUse[plane]][y][x];
+				byte pixel = ghostArr[kPlaneToUse[plane]][y + yStart][x];
 				for (int bit = 0; bit < 8; bit++) {
 					byte pixelBit = (pixel >> bit) & 1;
 					*(byte *)ghostPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
@@ -531,7 +540,7 @@ void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint
 }
 
 void GraphicManager::ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY) {
-	// Constants from the original code.
+	// Constants from the original code:
 	const uint16 height = 35;
 	const uint16 width = 9 * 8;
 
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index a372ce8..d6625cc 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -93,7 +93,7 @@ public:
 	void shiftScreen();
 
 	// Ghostroom's functions:
-	void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
+	void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
 	void ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY); // Very similar to ghostDrawGhost(), but not enough to unify the two.
 	Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
 	void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);






More information about the Scummvm-git-logs mailing list