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

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


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

Log Message:
-----------
Changed Gfx::_backgroundInfo to be a pointer. This temporarily kills all z-buffering.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/gfxbase.cpp
    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/parser_br.cpp

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -291,8 +291,8 @@
 
 void Parallaction_ns::_c_setMask(void *parm) {
 
-	memset(_gfx->_backgroundInfo.mask.data + 3600, 0, 3600);
-	_gfx->_backgroundInfo.layers[1] = 500;
+	memset(_gfx->_backgroundInfo->mask.data + 3600, 0, 3600);
+	_gfx->_backgroundInfo->layers[1] = 500;
 
 	return;
 }
@@ -502,11 +502,11 @@
 		_rightHandAnim->_top
 	);
 
-	uint16 _di = r.left/4 + r.top * _gfx->_backgroundInfo.mask.internalWidth;
+	uint16 _di = r.left/4 + r.top * _gfx->_backgroundInfo->mask.internalWidth;
 
 	for (uint16 _si = r.top; _si < r.bottom; _si++) {
-		memset(_gfx->_backgroundInfo.mask.data + _di, 0, r.width()/4+1);
-		_di += _gfx->_backgroundInfo.mask.internalWidth;
+		memset(_gfx->_backgroundInfo->mask.data + _di, 0, r.width()/4+1);
+		_di += _gfx->_backgroundInfo->mask.internalWidth;
 	}
 
 	return;

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -347,7 +347,7 @@
 			if (anim->_flags & kFlagsNoMasked)
 				layer = 3;
 			else
-				layer = _gfx->_backgroundInfo.getLayer(anim->_top + anim->height());
+				layer = _gfx->_backgroundInfo->getLayer(anim->_top + anim->height());
 
 			if (obj) {
 				_gfx->showGfxObj(obj, true);

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -291,8 +291,8 @@
 
 			for (uint16 j = 0; j < q.width(); j++) {
 				if (*s != transparentColor) {
-					if (_backgroundInfo.mask.data && (z < LAYER_FOREGROUND)) {
-						byte v = _backgroundInfo.mask.getValue(dp.x + j, dp.y + i);
+					if (_backgroundInfo->mask.data && (z < LAYER_FOREGROUND)) {
+						byte v = _backgroundInfo->mask.getValue(dp.x + j, dp.y + i);
 						if (z >= v) *d = 5;
 					} else {
 						*d = 5;
@@ -308,13 +308,13 @@
 		}
 
     } else {
-		if (_backgroundInfo.mask.data && (z < LAYER_FOREGROUND)) {
+		if (_backgroundInfo->mask.data && (z < LAYER_FOREGROUND)) {
 
 			for (uint16 i = 0; i < q.height(); i++) {
 
 				for (uint16 j = 0; j < q.width(); j++) {
 					if (*s != transparentColor) {
-						byte v = _backgroundInfo.mask.getValue(dp.x + j, dp.y + i);
+						byte v = _backgroundInfo->mask.getValue(dp.x + j, dp.y + i);
 						if (z >= v) *d = *s;
 					}
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -269,7 +269,7 @@
 
 	PaletteFxRange *range;
 	for (uint16 i = 0; i < 4; i++) {
-		range = &_backgroundInfo.ranges[i];
+		range = &_backgroundInfo->ranges[i];
 
 		if ((range->_flags & 1) == 0) continue;		// animated palette
 		range->_timer += range->_step * 2;	// update timer
@@ -359,7 +359,7 @@
 }
 
 void Gfx::beginFrame() {
-	_skipBackground = (_backgroundInfo.bg.pixels == 0);	// don't render frame if background is missing
+	_skipBackground = (_backgroundInfo->bg.pixels == 0);	// don't render frame if background is missing
 
 	if (!_skipBackground) {
 		int32 oldBackgroundMode = _varBackgroundMode;
@@ -370,11 +370,11 @@
 				_bitmapMask.free();
 				break;
 			case 2:
-				_bitmapMask.create(_backgroundInfo.width, _backgroundInfo.height, 1);
+				_bitmapMask.create(_backgroundInfo->width, _backgroundInfo->height, 1);
 				byte *data = (byte*)_bitmapMask.pixels;
 				for (uint y = 0; y < _bitmapMask.h; y++) {
 					for (uint x = 0; x < _bitmapMask.w; x++) {
-						*data++ = _backgroundInfo.mask.getValue(x, y);
+						*data++ = _backgroundInfo->mask.getValue(x, y);
 					}
 				}
 				break;
@@ -389,7 +389,7 @@
 		warning("Path zones are supported only in Big Red Adventure");
 	}
 
-	if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo.width)) {
+	if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo->width)) {
 		_varScrollX = 0;
 	} else {
 		_varScrollX = getVar("scroll_x");
@@ -416,22 +416,22 @@
 
 	if (!_skipBackground) {
 		// background may not cover the whole screen, so adjust bulk update size
-		uint w = MIN(_vm->_screenWidth, (int32)_backgroundInfo.width);
-		uint h = MIN(_vm->_screenHeight, (int32)_backgroundInfo.height);
+		uint w = MIN(_vm->_screenWidth, (int32)_backgroundInfo->width);
+		uint h = MIN(_vm->_screenHeight, (int32)_backgroundInfo->height);
 
 		byte *backgroundData = 0;
 		uint16 backgroundPitch = 0;
 		switch (_varBackgroundMode) {
 		case 1:
-			backgroundData = (byte*)_backgroundInfo.bg.getBasePtr(_varScrollX, 0);
-			backgroundPitch = _backgroundInfo.bg.pitch;
+			backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(_varScrollX, 0);
+			backgroundPitch = _backgroundInfo->bg.pitch;
 			break;
 		case 2:
 			backgroundData = (byte*)_bitmapMask.getBasePtr(_varScrollX, 0);
 			backgroundPitch = _bitmapMask.pitch;
 			break;
 		}
-		g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo.x, _backgroundInfo.y, w, h);
+		g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->x, _backgroundInfo->y, w, h);
 	}
 
 	if (_varDrawPathZones == 1) {
@@ -499,17 +499,17 @@
 	Common::Rect r(surf.w, surf.h);
 	r.moveTo(x, y);
 
-	uint16 z = (mask) ? _backgroundInfo.getLayer(y) : LAYER_FOREGROUND;
-	blt(r, (byte*)surf.pixels, &_backgroundInfo.bg, z, 0);
+	uint16 z = (mask) ? _backgroundInfo->getLayer(y) : LAYER_FOREGROUND;
+	blt(r, (byte*)surf.pixels, &_backgroundInfo->bg, z, 0);
 }
 
 void Gfx::fillBackground(const Common::Rect& r, byte color) {
-	_backgroundInfo.bg.fillRect(r, color);
+	_backgroundInfo->bg.fillRect(r, color);
 }
 
 void Gfx::invertBackground(const Common::Rect& r) {
 
-	byte *d = (byte*)_backgroundInfo.bg.getBasePtr(r.left, r.top);
+	byte *d = (byte*)_backgroundInfo->bg.getBasePtr(r.left, r.top);
 
 	for (int i = 0; i < r.height(); i++) {
 		for (int j = 0; j < r.width(); j++) {
@@ -517,7 +517,7 @@
 			d++;
 		}
 
-		d += (_backgroundInfo.bg.pitch - r.width());
+		d += (_backgroundInfo->bg.pitch - r.width());
 	}
 
 }
@@ -724,7 +724,7 @@
 }
 
 void Gfx::grabBackground(const Common::Rect& r, Graphics::Surface &dst) {
-	copyRect(r, _backgroundInfo.bg, dst);
+	copyRect(r, _backgroundInfo->bg, dst);
 }
 
 
@@ -744,6 +744,8 @@
 	_screenX = 0;
 	_screenY = 0;
 
+	_backgroundInfo = 0;
+
 	_halfbrite = false;
 	_hbCircleRadius = 0;
 
@@ -766,7 +768,6 @@
 		BackgroundInfo	paletteInfo;
 		_disk->loadSlide(paletteInfo, "pointer");
 		_backupPal.clone(paletteInfo.palette);
-		paletteInfo.free();
 	}
 
 	return;
@@ -774,7 +775,8 @@
 
 Gfx::~Gfx() {
 
-	freeBackground();
+	delete _backgroundInfo;
+
 	freeLabels();
 
 	delete []_unpackedBitmap;
@@ -829,16 +831,14 @@
 	_numItems = 0;
 }
 
-void Gfx::freeBackground() {
-	_backgroundInfo.free();
-}
 
 void Gfx::setBackground(uint type, const char* name, const char* mask, const char* path) {
 
-	freeBackground();
+	delete _backgroundInfo;
+	_backgroundInfo = new BackgroundInfo;
 
 	if (type == kBackgroundLocation) {
-		_disk->loadScenery(_backgroundInfo, name, mask, path);
+		_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
@@ -847,17 +847,17 @@
 			int r, g, b;
 			for (uint i = 16; i < 32; i++) {
 				_backupPal.getEntry(i, r, g, b);
-				_backgroundInfo.palette.setEntry(i, r, g, b);
+				_backgroundInfo->palette.setEntry(i, r, g, b);
 			}
 		}
 
-		setPalette(_backgroundInfo.palette);
-		_palette.clone(_backgroundInfo.palette);
+		setPalette(_backgroundInfo->palette);
+		_palette.clone(_backgroundInfo->palette);
 	} else {
-		_disk->loadSlide(_backgroundInfo, name);
+		_disk->loadSlide(*_backgroundInfo, name);
 		for (uint i = 0; i < 6; i++)
-			_backgroundInfo.ranges[i]._flags = 0;	// disable palette cycling for slides
-		setPalette(_backgroundInfo.palette);
+			_backgroundInfo->ranges[i]._flags = 0;	// disable palette cycling for slides
+		setPalette(_backgroundInfo->palette);
 	}
 
 }

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-07-31 12:26:12 UTC (rev 33468)
@@ -436,7 +436,7 @@
 		return LAYER_FOREGROUND;
 	}
 
-	void free() {
+	~BackgroundInfo() {
 		bg.free();
 		mask.free();
 		path.free();
@@ -511,7 +511,7 @@
 	void freeItems();
 
 	// background surface
-	BackgroundInfo	_backgroundInfo;
+	BackgroundInfo	*_backgroundInfo;
 	void setBackground(uint type, const char* name, const char* mask, const char* path);
 	void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
 	void grabBackground(const Common::Rect& r, Graphics::Surface &dst);

Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -65,7 +65,7 @@
 		uint32 curTime = _vm->_system->getMillis();
 		if (curTime - _startTime > _timeOut) {
 			_fadeSteps = 64;
-			pal.clone(_vm->_gfx->_backgroundInfo.palette);
+			pal.clone(_vm->_gfx->_backgroundInfo->palette);
 		}
 		return this;
 	}
@@ -73,8 +73,8 @@
 	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->_gfx->_backgroundInfo->x = (_vm->_screenWidth - _vm->_gfx->_backgroundInfo->width) >> 1;
+		_vm->_gfx->_backgroundInfo->y = (_vm->_screenHeight - _vm->_gfx->_backgroundInfo->height) >> 1;
 		_vm->_input->setMouseState(MOUSE_DISABLED);
 
 		_startTime = g_system->getMillis();
@@ -217,8 +217,8 @@
 		_vm->_gfx->clearScreen();
 		_vm->_gfx->setBackground(kBackgroundSlide, "tbra", 0, 0);
 		if (_vm->getPlatform() == Common::kPlatformPC) {
-			_vm->_gfx->_backgroundInfo.x = 20;
-			_vm->_gfx->_backgroundInfo.y = 50;
+			_vm->_gfx->_backgroundInfo->x = 20;
+			_vm->_gfx->_backgroundInfo->y = 50;
 		}
 
 		// TODO: load progress from savefile

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -264,7 +264,6 @@
 	_location._walkPoints.clear();
 
 	_gfx->clearGfxObjects(kGfxObjNormal);
-	freeBackground();
 
 	_location._programs.clear();
 	freeZones();
@@ -284,7 +283,6 @@
 
 void Parallaction::freeBackground() {
 
-	_gfx->freeBackground();
 	_pathBuffer = 0;
 
 }
@@ -292,7 +290,7 @@
 void Parallaction::setBackground(const char* name, const char* mask, const char* path) {
 
 	_gfx->setBackground(kBackgroundLocation, name, mask, path);
-	_pathBuffer = &_gfx->_backgroundInfo.path;
+	_pathBuffer = &_gfx->_backgroundInfo->path;
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-31 11:29:37 UTC (rev 33467)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-31 12:26:12 UTC (rev 33468)
@@ -464,9 +464,9 @@
 	debugC(7, kDebugParser, "LOCATION_PARSER(mask) ");
 
 	ctxt.maskName = strdup(_tokens[1]);
-	_vm->_gfx->_backgroundInfo.layers[0] = atoi(_tokens[2]);
-	_vm->_gfx->_backgroundInfo.layers[1] = atoi(_tokens[3]);
-	_vm->_gfx->_backgroundInfo.layers[2] = atoi(_tokens[4]);
+	_vm->_gfx->_backgroundInfo->layers[0] = atoi(_tokens[2]);
+	_vm->_gfx->_backgroundInfo->layers[1] = atoi(_tokens[3]);
+	_vm->_gfx->_backgroundInfo->layers[2] = atoi(_tokens[4]);
 }
 
 
@@ -1179,7 +1179,7 @@
 	LocationParser_ns::parse(script);
 
 	_vm->_gfx->setBackground(kBackgroundLocation, ctxt.bgName, ctxt.maskName, ctxt.pathName);
-	_vm->_pathBuffer = &_vm->_gfx->_backgroundInfo.path;
+	_vm->_pathBuffer = &_vm->_gfx->_backgroundInfo->path;
 
 	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