[Scummvm-cvs-logs] SF.net SVN: scummvm:[33469] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Jul 31 14:50:45 CEST 2008


Revision: 33469
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33469&view=rev
Author:   peres001
Date:     2008-07-31 12:50:43 +0000 (Thu, 31 Jul 2008)

Log Message:
-----------
Made changing of background more flexible, in that the engine can now configure its BackgroundInfo before passing it to Gfx.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/gui_br.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/parser_br.cpp

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-31 12:50:43 UTC (rev 33469)
@@ -831,15 +831,11 @@
 	_numItems = 0;
 }
 
-
-void Gfx::setBackground(uint type, const char* name, const char* mask, const char* path) {
-
+void Gfx::setBackground(uint type, BackgroundInfo *info) {
 	delete _backgroundInfo;
-	_backgroundInfo = new BackgroundInfo;
+	_backgroundInfo = info;
 
 	if (type == kBackgroundLocation) {
-		_disk->loadScenery(*_backgroundInfo, name, mask, path);
-
 		// The PC version of BRA needs the entries 20-31 of the palette to be constant, but
 		// the background resource files are screwed up. The right colors come from an unused
 		// bitmap (pointer.bmp). Nothing is known about the Amiga version so far.
@@ -854,12 +850,10 @@
 		setPalette(_backgroundInfo->palette);
 		_palette.clone(_backgroundInfo->palette);
 	} else {
-		_disk->loadSlide(*_backgroundInfo, name);
 		for (uint i = 0; i < 6; i++)
 			_backgroundInfo->ranges[i]._flags = 0;	// disable palette cycling for slides
 		setPalette(_backgroundInfo->palette);
 	}
-
 }
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-07-31 12:50:43 UTC (rev 33469)
@@ -512,7 +512,7 @@
 
 	// background surface
 	BackgroundInfo	*_backgroundInfo;
-	void setBackground(uint type, const char* name, const char* mask, const char* path);
+	void setBackground(uint type, BackgroundInfo *info);
 	void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
 	void grabBackground(const Common::Rect& r, Graphics::Surface &dst);
 	void fillBackground(const Common::Rect& r, byte color);

Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-31 12:50:43 UTC (rev 33469)
@@ -72,9 +72,7 @@
 
 	virtual void enter() {
 		_vm->_gfx->clearScreen();
-		_vm->_gfx->setBackground(kBackgroundSlide, _slideName.c_str(), 0, 0);
-		_vm->_gfx->_backgroundInfo->x = (_vm->_screenWidth - _vm->_gfx->_backgroundInfo->width) >> 1;
-		_vm->_gfx->_backgroundInfo->y = (_vm->_screenHeight - _vm->_gfx->_backgroundInfo->height) >> 1;
+		_vm->showSlide(_slideName.c_str(), CENTER_LABEL_HORIZONTAL, CENTER_LABEL_VERTICAL);
 		_vm->_input->setMouseState(MOUSE_DISABLED);
 
 		_startTime = g_system->getMillis();
@@ -215,11 +213,12 @@
 
 	virtual void enter() {
 		_vm->_gfx->clearScreen();
-		_vm->_gfx->setBackground(kBackgroundSlide, "tbra", 0, 0);
+		int x = 0, y = 0;
 		if (_vm->getPlatform() == Common::kPlatformPC) {
-			_vm->_gfx->_backgroundInfo->x = 20;
-			_vm->_gfx->_backgroundInfo->y = 50;
+			x = 20;
+			y = 50;
 		}
+		_vm->showSlide("tbra", x, y);
 
 		// TODO: load progress from savefile
 		int progress = 3;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-31 12:50:43 UTC (rev 33469)
@@ -289,7 +289,10 @@
 
 void Parallaction::setBackground(const char* name, const char* mask, const char* path) {
 
-	_gfx->setBackground(kBackgroundLocation, name, mask, path);
+	BackgroundInfo *info = new BackgroundInfo;
+	_disk->loadScenery(*info, name, mask, path);
+
+	_gfx->setBackground(kBackgroundLocation, info);
 	_pathBuffer = &_gfx->_backgroundInfo->path;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-31 12:50:43 UTC (rev 33469)
@@ -487,7 +487,7 @@
 	bool saveGame();
 
 	void		switchBackground(const char* background, const char* mask);
-	void		showSlide(const char *name);
+	void		showSlide(const char *name, int x = 0, int y = 0);
 	void 		setArrowCursor();
 
 	// TODO: this should be private!!!!!!!

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-31 12:50:43 UTC (rev 33469)
@@ -253,8 +253,14 @@
 }
 
 
-void Parallaction_ns::showSlide(const char *name) {
-	_gfx->setBackground(kBackgroundSlide, name, 0, 0);
+void Parallaction_ns::showSlide(const char *name, int x, int y) {
+	BackgroundInfo *info = new BackgroundInfo;
+	_disk->loadSlide(*info, name);
+
+	info->x = (x == CENTER_LABEL_HORIZONTAL) ? ((_vm->_screenWidth - info->width) >> 1) : x;
+	info->y = (y == CENTER_LABEL_VERTICAL) ? ((_vm->_screenHeight - info->height) >> 1) : y;
+
+	_gfx->setBackground(kBackgroundSlide, info);
 }
 
 void Parallaction_ns::runPendingZones() {

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-31 12:26:12 UTC (rev 33468)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-31 12:50:43 UTC (rev 33469)
@@ -1178,8 +1178,7 @@
 
 	LocationParser_ns::parse(script);
 
-	_vm->_gfx->setBackground(kBackgroundLocation, ctxt.bgName, ctxt.maskName, ctxt.pathName);
-	_vm->_pathBuffer = &_vm->_gfx->_backgroundInfo->path;
+	_vm->setBackground(ctxt.bgName, ctxt.maskName, ctxt.pathName);
 
 	if (ctxt.characterName) {
 		_vm->changeCharacter(ctxt.characterName);


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