[Scummvm-cvs-logs] scummvm master -> 29cd1614219c73385b40376d2762596f3dc3218a

urukgit urukgit at users.noreply.github.com
Tue Feb 4 10:31:22 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:
29cd161421 AVALANCHE: Rename/move/implement getMe().


Commit: 29cd1614219c73385b40376d2762596f3dc3218a
    https://github.com/scummvm/scummvm/commit/29cd1614219c73385b40376d2762596f3dc3218a
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-04T01:30:41-08:00

Commit Message:
AVALANCHE: Rename/move/implement getMe().

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



diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 93034a4..f81a74d 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -31,7 +31,6 @@
 namespace Avalanche {
 
 const int8 GhostRoom::kAdjustment[5] = { 7, 0, 7, 7, 7 };
-const byte GhostRoom::kPlaneToUse[4] = { 2, 2, 2, 3 };
 const byte GhostRoom::kWaveOrder[5] = { 5, 1, 2, 3, 4 };
 const byte GhostRoom::kGlerkFade[26] = { 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 1 };
 const byte GhostRoom::kGreldetFade[18] = { 1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 };
@@ -53,12 +52,14 @@ GhostRoom::GhostRoom(AvalancheEngine *vm) {
 	_redGreldet = false;
 }
 
-void GhostRoom::plainGrab() {
-	warning("STUB: plainGrab()");
+GhostRoom::~GhostRoom() {
+	for (int i = 0; i < 2; i++)
+		_eyes[i].free();
+	_exclamation.free();
 }
 
-void GhostRoom::getMe(void *p) {
-	warning("STUB: getMe()");
+void GhostRoom::plainGrab() {
+	warning("STUB: plainGrab()");
 }
 
 void GhostRoom::getMeAargh(byte which) {
@@ -77,7 +78,7 @@ void GhostRoom::bigGreenEyes(byte how) {
 	warning("STUB: bigGreenEyes()");
 }
 
-GhostRoom::ChunkBlockType GhostRoom::readChunkBlock(Common::File &file) {
+ChunkBlockType GhostRoom::readChunkBlock(Common::File &file) {
 	ChunkBlockType cb;
 	cb._flavour = (FlavourType)file.readByte();
 	cb._x = file.readSint16LE();
@@ -99,7 +100,7 @@ void GhostRoom::run() {
 
 	_file.seek(44);
 
-	// Initializing array.
+	// Initializing ghost's array.
 	for (int i = 0; i < 5; i++)
 		for (int j = 0; j < 2; j++)
 			for (int y = 0; y < 66; y++)
@@ -114,6 +115,11 @@ void GhostRoom::run() {
 				_file.read(_ghost[i][j][y], cb._xl / 8);
 	}
 
+	// Load some smaller pictures.
+	for (int i = 0; i < 2; i++)
+		_eyes[i] = _vm->_graphics->ghostLoadPicture(_file);
+	_exclamation = _vm->_graphics->ghostLoadPicture(_file);
+
 	warning("STUB: run()");
 }
 
diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h
index 8950a8a..c6d0686 100644
--- a/engines/avalanche/ghostroom.h
+++ b/engines/avalanche/ghostroom.h
@@ -34,26 +34,27 @@
 namespace Avalanche {
 class AvalancheEngine;
 
+enum FlavourType { ch_EGA, ch_BGI, ch_Natural, ch_Two, ch_One };
+
+struct ChunkBlockType {
+	FlavourType _flavour;
+	int16 _x, _y;
+	int16 _xl, _yl;
+	int32 _size;
+};
+
 class GhostRoom {
 public:
 	GhostRoom(AvalancheEngine *vm);
+	~GhostRoom();
 
 	void run();
+	ChunkBlockType readChunkBlock(Common::File &file);
 
 private:
-	enum FlavourType { ch_EGA, ch_BGI, ch_Natural, ch_Two, ch_One };
-
-	struct ChunkBlockType {
-		FlavourType _flavour;
-		int16 _x, _y;
-		int16 _xl, _yl;
-		int32 _size;
-	};
-
 	AvalancheEngine *_vm;
 
 	static const int8 kAdjustment[5];
-	static const byte kPlaneToUse[4];
 	static const byte kWaveOrder[5];
 	static const byte kGlerkFade[26];
 	static const byte kGreldetFade[18];
@@ -64,8 +65,8 @@ private:
 	byte _ghost[5][2][66][26];
 	void *_memLevel;
 	byte _y, _yy, _bit, _xofs;
-	void *_eyes[2];
-	void *_exclamation;
+	Graphics::Surface _eyes[2];
+	Graphics::Surface _exclamation;
 	void *_aargh[6];
 	void *_bat[3];
 	GlerkType *_glerk;
@@ -82,12 +83,10 @@ private:
 	bool _redGreldet;
 
 	void plainGrab();
-	void getMe(void *p);
 	void getMeAargh(byte which);
 	void wait(uint16 howLong);
 	void doBat();
 	void bigGreenEyes(byte how);
-	ChunkBlockType readChunkBlock(Common::File &file);
 };
 
 } // End of namespace Avalanche
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index a85d7eb..a11773a 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -500,7 +500,7 @@ void GraphicManager::nimFree() {
 	_nimLogo.free();
 }
 
-void GraphicManager::ghostDrawPicture(byte ghostArr[2][66][26], uint16 destX, uint16 destY) {
+void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY) {
 	const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
 	// Constants from the original code.
 	uint16 height = 66;
@@ -528,6 +528,30 @@ void GraphicManager::ghostDrawPicture(byte ghostArr[2][66][26], uint16 destX, ui
 }
 
 /**
+ * @remarks	Originally called 'get_me' and was located in Ghostroom.
+ */
+Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file) {
+	ChunkBlockType cb = _vm->_ghostroom->readChunkBlock(file);
+	
+	Graphics::Surface picture = loadPictureGraphic(file);
+
+	int bytesPerRow = (picture.w / 8);
+	if ((picture.w % 8) > 0)
+		bytesPerRow += 1;
+	int loadedBytes = picture.h * bytesPerRow * 4 + 4;
+	// * 4 is for the four planes, + 4 is for the reading of the width and the height at loadPictureGraphic's beginning.
+
+	int bytesToSkip = cb._size - loadedBytes;
+	file.skip(bytesToSkip);
+		
+	return picture;
+}
+
+void GraphicManager::ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY) {
+	drawPicture(_surface, picture, destX, destY);
+}
+
+/**
  * This function mimics Pascal's getimage().
  */
 Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) {
@@ -537,7 +561,7 @@ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) {
 
 	Graphics::Surface picture; // We make a Surface object for the picture itself.
 	picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-
+	
 	// Produce the picture. We read it in row-by-row, and every row has 4 planes.
 	for (int y = 0; y < height; y++) {
 		for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way.
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 92b311e..ed5a47b 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -92,7 +92,9 @@ public:
 	void shiftScreen();
 
 	// Ghostroom's functions:
-	void ghostDrawPicture(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, uint16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
+	Graphics::Surface ghostLoadPicture(Common::File &file);
+	void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
 
 	void clearAlso();
 	void clearTextBar();






More information about the Scummvm-git-logs mailing list