[Scummvm-cvs-logs] SF.net SVN: scummvm:[48257] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Mar 14 06:47:34 CET 2010


Revision: 48257
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48257&view=rev
Author:   dreammaster
Date:     2010-03-14 05:47:33 +0000 (Sun, 14 Mar 2010)

Log Message:
-----------
Further separation of MADS and M4 scene logic

Modified Paths:
--------------
    scummvm/trunk/engines/m4/m4_scene.cpp
    scummvm/trunk/engines/m4/m4_scene.h
    scummvm/trunk/engines/m4/mads_scene.cpp
    scummvm/trunk/engines/m4/mads_scene.h
    scummvm/trunk/engines/m4/scene.cpp
    scummvm/trunk/engines/m4/scene.h

Modified: scummvm/trunk/engines/m4/m4_scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4_scene.cpp	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/m4_scene.cpp	2010-03-14 05:47:33 UTC (rev 48257)
@@ -117,6 +117,28 @@
 	iplS->read(_inverseColourTable, iplS->size());
 	_vm->res()->toss(filename);
 }
+
+void M4Scene::loadSceneSpriteCodes(int sceneNumber) {
+	char filename[kM4MaxFilenameSize];
+	sprintf(filename, "%i.ssc", sceneNumber);
+
+	Common::SeekableReadStream *sceneS = _vm->res()->get(filename);
+
+	// TODO
+
+	if (sceneS != NULL) {
+		SpriteAsset* _sceneSpriteCodes = new SpriteAsset(_vm, sceneS, sceneS->size(), filename);
+		int colorCount = _sceneSpriteCodes->getColorCount();
+//			RGB8* spritePalette = _sceneSpriteCodes->getPalette();
+		//_vm->_palette->setPalette(spritePalette, 0, colorCount);
+
+		printf("Scene has %d sprite codes, each one having %d colors\n", _sceneSpriteCodes->getCount(), colorCount);
+
+		// Note that toss() deletes the MemoryReadStream
+		_vm->res()->toss(filename);
+	}
+}
+
 void M4Scene::loadScene(int sceneNumber) {
 	Scene::loadScene(sceneNumber);
 

Modified: scummvm/trunk/engines/m4/m4_scene.h
===================================================================
--- scummvm/trunk/engines/m4/m4_scene.h	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/m4_scene.h	2010-03-14 05:47:33 UTC (rev 48257)
@@ -55,6 +55,7 @@
 	void loadSceneSprites(int sceneNumber);
 	void loadSceneResources(int sceneNumber);
 	void loadSceneInverseColourTable(int sceneNumber);
+	void loadSceneSpriteCodes(int sceneNumber);
 	void nextCommonCursor();
 public:
 	M4Scene(M4Engine *vm);

Modified: scummvm/trunk/engines/m4/mads_scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_scene.cpp	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/mads_scene.cpp	2010-03-14 05:47:33 UTC (rev 48257)
@@ -370,6 +370,104 @@
 	error("Couldn't find player sprites");
 }
 
+enum boxSprites {
+	topLeft = 0,
+	topRight = 1,
+	bottomLeft = 2,
+	bottomRight = 3,
+	left = 4,
+	right = 5,
+	top = 6,
+	bottom = 7,
+	topMiddle = 8,
+	filler1 = 9,
+	filler2 = 10
+	// TODO: finish this
+};
+
+// TODO: calculate width and height, show text, show face if it exists
+// TODO: this has been tested with Dragonsphere only, there are some differences
+// in the sprites used in Phantom
+void MadsScene::showMADSV2TextBox(char *text, int x, int y, char *faceName) {
+	int repeatX = 40;	// FIXME: this is hardcoded
+	int repeatY = 30;	// FIXME: this is hardcoded
+	int curX = x, curY = y;
+	int topRightX = x;	// TODO: this is probably not needed
+	Common::SeekableReadStream *data = _vm->res()->get("box.ss");
+	SpriteAsset *boxSprites = new SpriteAsset(_vm, data, data->size(), "box.ss");
+	_vm->res()->toss("box.ss");
+
+	RGBList *palData = new RGBList(boxSprites->getColorCount(), boxSprites->getPalette(), true);
+	_vm->_palette->addRange(palData);
+
+	for (int i = 0; i < boxSprites->getCount(); i++)
+		boxSprites->getFrame(i)->translate(palData);		// sprite pixel translation
+
+	// Top left corner
+	boxSprites->getFrame(topLeft)->copyTo(_backgroundSurface, x, curY);
+	curX += boxSprites->getFrame(topLeft)->width();
+
+	// Top line
+	for (int i = 0; i < repeatX; i++) {
+		boxSprites->getFrame(top)->copyTo(_backgroundSurface, curX, curY + 3);
+		curX += boxSprites->getFrame(top)->width();
+	}
+
+	// Top right corner
+	boxSprites->getFrame(topRight)->copyTo(_backgroundSurface, curX, curY);
+	topRightX = curX;
+
+	// Top middle
+	// FIXME: the transparent color for this is also the black border color
+	boxSprites->getFrame(topMiddle)->copyTo(_backgroundSurface,
+											x + (curX - x) / 2 - boxSprites->getFrame(topMiddle)->width() / 2,
+											curY - 5, 167);
+	curX = x;
+	curY += boxSprites->getFrame(topLeft)->height();
+
+	// -----------------------------------------------------------------------------------------------
+
+	// Draw contents
+	for (int i = 0; i < repeatY; i++) {
+		for (int j = 0; j < repeatX; j++) {
+			if (j == 0) {
+				boxSprites->getFrame(left)->copyTo(_backgroundSurface, curX + 3, curY);
+				curX += boxSprites->getFrame(left)->width();
+			} else if (j == repeatX - 1) {
+				curX = topRightX - 2;
+				boxSprites->getFrame(right)->copyTo(_backgroundSurface, curX + 3, curY + 1);
+			} else {
+				// TODO: the background of the contents follows a pattern which is not understood yet
+				if (j % 2 == 0) {
+					boxSprites->getFrame(filler1)->copyTo(_backgroundSurface, curX + 3, curY);
+					curX += boxSprites->getFrame(filler1)->width();
+				} else {
+					boxSprites->getFrame(filler2)->copyTo(_backgroundSurface, curX + 3, curY);
+					curX += boxSprites->getFrame(filler2)->width();
+				}
+			}
+		}	// for j
+		curX = x;
+		curY += boxSprites->getFrame(left)->height();
+	}	// for i
+
+	// -----------------------------------------------------------------------------------------------
+	curX = x;
+
+	// Bottom left corner
+	boxSprites->getFrame(bottomLeft)->copyTo(_backgroundSurface, curX, curY);
+	curX += boxSprites->getFrame(bottomLeft)->width();
+
+	// Bottom line
+	for (int i = 0; i < repeatX; i++) {
+		boxSprites->getFrame(bottom)->copyTo(_backgroundSurface, curX, curY + 1);
+		curX += boxSprites->getFrame(bottom)->width();
+	}
+
+	// Bottom right corner
+	boxSprites->getFrame(bottomRight)->copyTo(_backgroundSurface, curX, curY + 1);
+}
+
 /*--------------------------------------------------------------------------*/
 
 MadsAction::MadsAction() {

Modified: scummvm/trunk/engines/m4/mads_scene.h
===================================================================
--- scummvm/trunk/engines/m4/mads_scene.h	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/mads_scene.h	2010-03-14 05:47:33 UTC (rev 48257)
@@ -192,6 +192,7 @@
 
 	int loadSceneSpriteSet(const char *setName);
 	void loadPlayerSprites(const char *prefix);
+	void showMADSV2TextBox(char *text, int x, int y, char *faceName);
 
 	MadsInterfaceView *getInterface() { return (MadsInterfaceView *)_interfaceSurface; };
 	MadsSceneResources &getSceneResources() { return _sceneResources; };

Modified: scummvm/trunk/engines/m4/scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/scene.cpp	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/scene.cpp	2010-03-14 05:47:33 UTC (rev 48257)
@@ -91,27 +91,6 @@
 	_vm->_viewManager->deleteView(_interfaceSurface);
 }
 
-void Scene::loadSceneSpriteCodes(int sceneNumber) {
-	char filename[kM4MaxFilenameSize];
-	sprintf(filename, "%i.ssc", sceneNumber);
-
-	Common::SeekableReadStream *sceneS = _vm->res()->get(filename);
-
-	// TODO
-
-	if (sceneS != NULL) {
-		SpriteAsset* _sceneSpriteCodes = new SpriteAsset(_vm, sceneS, sceneS->size(), filename);
-		int colorCount = _sceneSpriteCodes->getColorCount();
-//			RGB8* spritePalette = _sceneSpriteCodes->getPalette();
-		//_vm->_palette->setPalette(spritePalette, 0, colorCount);
-
-		printf("Scene has %d sprite codes, each one having %d colors\n", _sceneSpriteCodes->getCount(), colorCount);
-
-		// Note that toss() deletes the MemoryReadStream
-		_vm->res()->toss(filename);
-	}
-}
-
 void Scene::showSprites() {
 	// TODO: This is all experimental code, it needs heavy restructuring
 	// and cleanup
@@ -222,102 +201,4 @@
 	return true;
 }
 
-enum boxSprites {
-	topLeft = 0,
-	topRight = 1,
-	bottomLeft = 2,
-	bottomRight = 3,
-	left = 4,
-	right = 5,
-	top = 6,
-	bottom = 7,
-	topMiddle = 8,
-	filler1 = 9,
-	filler2 = 10
-	// TODO: finish this
-};
-
-// TODO: calculate width and height, show text, show face if it exists
-// TODO: this has been tested with Dragonsphere only, there are some differences
-// in the sprites used in Phantom
-void Scene::showMADSV2TextBox(char *text, int x, int y, char *faceName) {
-	int repeatX = 40;	// FIXME: this is hardcoded
-	int repeatY = 30;	// FIXME: this is hardcoded
-	int curX = x, curY = y;
-	int topRightX = x;	// TODO: this is probably not needed
-	Common::SeekableReadStream *data = _vm->res()->get("box.ss");
-	SpriteAsset *boxSprites = new SpriteAsset(_vm, data, data->size(), "box.ss");
-	_vm->res()->toss("box.ss");
-
-	RGBList *palData = new RGBList(boxSprites->getColorCount(), boxSprites->getPalette(), true);
-	_vm->_palette->addRange(palData);
-
-	for (int i = 0; i < boxSprites->getCount(); i++)
-		boxSprites->getFrame(i)->translate(palData);		// sprite pixel translation
-
-	// Top left corner
-	boxSprites->getFrame(topLeft)->copyTo(_backgroundSurface, x, curY);
-	curX += boxSprites->getFrame(topLeft)->width();
-
-	// Top line
-	for (int i = 0; i < repeatX; i++) {
-		boxSprites->getFrame(top)->copyTo(_backgroundSurface, curX, curY + 3);
-		curX += boxSprites->getFrame(top)->width();
-	}
-
-	// Top right corner
-	boxSprites->getFrame(topRight)->copyTo(_backgroundSurface, curX, curY);
-	topRightX = curX;
-
-	// Top middle
-	// FIXME: the transparent color for this is also the black border color
-	boxSprites->getFrame(topMiddle)->copyTo(_backgroundSurface,
-											x + (curX - x) / 2 - boxSprites->getFrame(topMiddle)->width() / 2,
-											curY - 5, 167);
-	curX = x;
-	curY += boxSprites->getFrame(topLeft)->height();
-
-	// -----------------------------------------------------------------------------------------------
-
-	// Draw contents
-	for (int i = 0; i < repeatY; i++) {
-		for (int j = 0; j < repeatX; j++) {
-			if (j == 0) {
-				boxSprites->getFrame(left)->copyTo(_backgroundSurface, curX + 3, curY);
-				curX += boxSprites->getFrame(left)->width();
-			} else if (j == repeatX - 1) {
-				curX = topRightX - 2;
-				boxSprites->getFrame(right)->copyTo(_backgroundSurface, curX + 3, curY + 1);
-			} else {
-				// TODO: the background of the contents follows a pattern which is not understood yet
-				if (j % 2 == 0) {
-					boxSprites->getFrame(filler1)->copyTo(_backgroundSurface, curX + 3, curY);
-					curX += boxSprites->getFrame(filler1)->width();
-				} else {
-					boxSprites->getFrame(filler2)->copyTo(_backgroundSurface, curX + 3, curY);
-					curX += boxSprites->getFrame(filler2)->width();
-				}
-			}
-		}	// for j
-		curX = x;
-		curY += boxSprites->getFrame(left)->height();
-	}	// for i
-
-	// -----------------------------------------------------------------------------------------------
-	curX = x;
-
-	// Bottom left corner
-	boxSprites->getFrame(bottomLeft)->copyTo(_backgroundSurface, curX, curY);
-	curX += boxSprites->getFrame(bottomLeft)->width();
-
-	// Bottom line
-	for (int i = 0; i < repeatX; i++) {
-		boxSprites->getFrame(bottom)->copyTo(_backgroundSurface, curX, curY + 1);
-		curX += boxSprites->getFrame(bottom)->width();
-	}
-
-	// Bottom right corner
-	boxSprites->getFrame(bottomRight)->copyTo(_backgroundSurface, curX, curY + 1);
-}
-
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/scene.h
===================================================================
--- scummvm/trunk/engines/m4/scene.h	2010-03-14 05:39:47 UTC (rev 48256)
+++ scummvm/trunk/engines/m4/scene.h	2010-03-14 05:47:33 UTC (rev 48257)
@@ -108,7 +108,6 @@
 
 	// TODO: perhaps move playIntro() someplace else?
 	void playIntro();
-	void loadSceneSpriteCodes(int sceneNumber);
 	void showSprites();
 	void showHotSpots();
 	void showCodes();
@@ -116,7 +115,6 @@
 	M4Surface *getBackgroundSurface() const { return _backgroundSurface; }
 	void showInterface();
 	void hideInterface();
-	void showMADSV2TextBox(char *text, int x, int y, char *faceName);
 	GameInterfaceView *getInterface() { return _interfaceSurface; };
 	SceneResources &getSceneResources() { return *_sceneResources; };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list