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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Feb 2 01:41:31 CET 2008


Revision: 30725
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30725&view=rev
Author:   peres001
Date:     2008-02-01 16:41:31 -0800 (Fri, 01 Feb 2008)

Log Message:
-----------
Moved depth buffer and palette rotation data into BackgroundInfo.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/disk_ns.cpp
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-02-02 00:41:31 UTC (rev 30725)
@@ -331,7 +331,7 @@
 void Parallaction_ns::_c_setMask(void *parm) {
 
 	memset(_gfx->_backgroundInfo->mask.data + 3600, 0, 3600);
-	_gfx->_bgLayers[1] = 500;
+	_gfx->_backgroundInfo->layers[1] = 500;
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/disk.h	2008-02-02 00:41:31 UTC (rev 30725)
@@ -133,7 +133,7 @@
 	Frames* loadExternalStaticCnv(const char *filename);
 	void loadBackground(BackgroundInfo& info, const char *filename);
 	void loadMaskAndPath(BackgroundInfo& info, const char *name);
-	void parseDepths(Common::SeekableReadStream &stream);
+	void parseDepths(BackgroundInfo &info, Common::SeekableReadStream &stream);
 	void parseBackground(BackgroundInfo& info, Common::SeekableReadStream &stream);
 	Font *createFont(const char *name, Cnv* cnv);
 

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-02-02 00:41:31 UTC (rev 30725)
@@ -24,7 +24,6 @@
  */
 
 #include "graphics/iff.h"
-#include "graphics/surface.h"
 
 #include "parallaction/parallaction.h"
 
@@ -321,7 +320,6 @@
 // loads a cnv from an external file
 //
 Cnv* DosDisk_ns::loadExternalCnv(const char *filename) {
-//	printf("Gfx::loadExternalCnv(%s)...", filename);
 
 	char path[PATH_LEN];
 
@@ -367,7 +365,6 @@
 }
 
 Cnv* DosDisk_ns::loadCnv(const char *filename) {
-//	printf("Gfx::loadCnv(%s)\n", filename);
 
 	char path[PATH_LEN];
 
@@ -525,12 +522,11 @@
 	return;
 }
 
-
-void DosDisk_ns::parseDepths(Common::SeekableReadStream &stream) {
-	_vm->_gfx->_bgLayers[0] = stream.readByte();
-	_vm->_gfx->_bgLayers[1] = stream.readByte();
-	_vm->_gfx->_bgLayers[2] = stream.readByte();
-	_vm->_gfx->_bgLayers[3] = stream.readByte();
+void DosDisk_ns::parseDepths(BackgroundInfo &info, Common::SeekableReadStream &stream) {
+	info.layers[0] = stream.readByte();
+	info.layers[1] = stream.readByte();
+	info.layers[2] = stream.readByte();
+	info.layers[3] = stream.readByte();
 }
 
 
@@ -545,14 +541,17 @@
 		info.palette.setEntry(i, tmp[0], tmp[1], tmp[2]);
 	}
 
-	parseDepths(stream);
+	parseDepths(info, stream);
 
+	PaletteFxRange range;
 	for (uint32 _si = 0; _si < 6; _si++) {
-		_vm->_gfx->_palettefx[_si]._timer = stream.readUint16BE();
-		_vm->_gfx->_palettefx[_si]._step = stream.readUint16BE();
-		_vm->_gfx->_palettefx[_si]._flags = stream.readUint16BE();
-		_vm->_gfx->_palettefx[_si]._first = stream.readByte();
-		_vm->_gfx->_palettefx[_si]._last = stream.readByte();
+		range._timer = stream.readUint16BE();
+		range._step = stream.readUint16BE();
+		range._flags = stream.readUint16BE();
+		range._first = stream.readByte();
+		range._last = stream.readByte();
+
+		info.setPaletteRange(_si, range);
 	}
 
 }
@@ -590,7 +589,7 @@
 	if (!_resArchive.openArchivedFile(path))
 		errorFileNotFound(name);
 
-	parseDepths(_resArchive);
+	parseDepths(info, _resArchive);
 
 	info.path.create(info.width, info.height);
 	_resArchive.read(info.path.data, info.path.size);
@@ -1145,15 +1144,18 @@
 	Common::SeekableReadStream *s = openArchivedFile(name, true);
 
 	byte *pal;
+	PaletteFxRange ranges[6];
 
-	BackgroundDecoder decoder(*s, info.bg, pal, _vm->_gfx->_palettefx);
+	BackgroundDecoder decoder(*s, info.bg, pal, ranges);
 	decoder.decode();
 
+	uint i;
+
 	info.width = info.bg.w;
 	info.height = info.bg.h;
 
 	byte *p = pal;
-	for (uint i = 0; i < 32; i++) {
+	for (i = 0; i < 32; i++) {
 		byte r = *p >> 2;
 		p++;
 		byte g = *p >> 2;
@@ -1165,6 +1167,10 @@
 
 	free(pal);
 
+	for (i = 0; i < 6; i++) {
+		info.setPaletteRange(i, ranges[i]);
+	}
+
 	delete s;
 
 	return;
@@ -1191,12 +1197,9 @@
 		g = s->readByte();
 		b = s->readByte();
 
-		_vm->_gfx->_bgLayers[i] = (((r << 4) & 0xF00) | (g & 0xF0) | (b >> 4)) & 0xFF;
-
-//		printf("rgb = (%x, %x, %x) -> %x\n", r, g, b, _vm->_gfx->_bgLayers[i]);
+		info.layers[i] = (((r << 4) & 0xF00) | (g & 0xF0) | (b >> 4)) & 0xFF;
 	}
 
-
 	s->seek(0x126, SEEK_SET);	// HACK: skipping IFF/ILBM header should be done by analysis, not magic
 	Graphics::PackBitsReadStream stream(*s);
 

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-02 00:41:31 UTC (rev 30725)
@@ -413,10 +413,11 @@
 
 DECLARE_INSTRUCTION_OPCODE(mask) {
 	Instruction *inst = *_instRunCtxt.inst;
-
+#if 0
 	_gfx->_bgLayers[0] = inst->_opA.getRValue();
 	_gfx->_bgLayers[1] = inst->_opB.getRValue();
 	_gfx->_bgLayers[2] = inst->_opC.getRValue();
+#endif
 }
 
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-02-02 00:41:31 UTC (rev 30725)
@@ -260,18 +260,19 @@
 	// avoid forcing setPalette when not needed
 	bool done = false;
 
+	PaletteFxRange *range;
 	for (uint16 i = 0; i < 4; i++) {
+		range = &_backgroundInfo->ranges[i];
 
-		if ((_palettefx[i]._flags & 1) == 0) continue;		// animated palette
+		if ((range->_flags & 1) == 0) continue;		// animated palette
+		range->_timer += range->_step * 2;	// update timer
 
-		_palettefx[i]._timer += _palettefx[i]._step * 2;	// update timer
+		if (range->_timer < 0x4000) continue;		// check timeout
 
-		if (_palettefx[i]._timer < 0x4000) continue;		// check timeout
+		range->_timer = 0;							// reset timer
 
-		_palettefx[i]._timer = 0;							// reset timer
+		_palette.rotate(range->_first, range->_last, (range->_flags & 2) != 0);
 
-		_palette.rotate(_palettefx[i]._first, _palettefx[i]._last, (_palettefx[i]._flags & 2) != 0);
-
 		done = true;
 	}
 
@@ -733,7 +734,7 @@
 uint16 Gfx::queryMask(uint16 v) {
 
 	for (uint16 _si = 0; _si < 3; _si++) {
-		if (_bgLayers[_si+1] > v) return _si;
+		if (_backgroundInfo->layers[_si+1] > v) return _si;
 	}
 
 	return BUFFER_FOREGROUND;
@@ -757,10 +758,6 @@
 	_screenX = 0;
 	_screenY = 0;
 
-	_bgLayers[0] = _bgLayers[1] = _bgLayers[2] = _bgLayers[3] = 0;
-
-	memset(_palettefx, 0, sizeof(_palettefx));
-
 	_halfbrite = false;
 	_hbCircleRadius = 0;
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-02-01 23:37:16 UTC (rev 30724)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-02-02 00:41:31 UTC (rev 30725)
@@ -335,6 +335,19 @@
 	PathBuffer			path;
 
 	Palette				palette;
+
+	int 				layers[4];
+	PaletteFxRange		ranges[6];
+
+	BackgroundInfo() : width(0), height(0) {
+		layers[0] = layers[1] = layers[2] = layers[3] = 0;
+		memset(ranges, 0, sizeof(ranges));
+	}
+
+	void setPaletteRange(int index, const PaletteFxRange& range) {
+		assert(index < 6);
+		memcpy(&ranges[index], &range, sizeof(PaletteFxRange));
+	}
 };
 
 
@@ -348,25 +361,15 @@
 public:
 	Disk *_disk;
 
+	GfxObjList _gfxobjList[3];
 	GfxObj* loadAnim(const char *name);
 	GfxObj* loadGet(const char *name);
 	GfxObj* loadDoor(const char *name);
+	void drawGfxObjects(Graphics::Surface &surf);
+	void showGfxObj(GfxObj* obj, bool visible);
 	void clearGfxObjects();
-
-	void showGfxObj(GfxObj* obj, bool visible);
-	GfxObjList _gfxobjList[3];
-	void drawGfxObjects(Graphics::Surface &surf);
 	void sortAnimations();
 
-	BackgroundInfo	*_backgroundInfo;
-	void freeBackground();
-	void setBackground(uint type, const char* name, const char* mask, const char* path);
-
-public:
-
-	// balloons and text
-	void getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height);
-
 	// labels
 	void setFloatingLabel(Label *label);
 	Label *renderFloatingLabel(Font *font, char *text);
@@ -375,27 +378,30 @@
 	void hideLabel(uint id);
 	void freeLabels();
 
-	// cut/paste
-	void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
-
-
+	// dialogue balloons
 	int setLocationBalloon(char *text, bool endGame);
 	int setDialogueBalloon(char *text, uint16 winding, byte textColor);
 	int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor);
 	void setBalloonText(uint id, char *text, byte textColor);
 	int hitTestDialogueBalloon(int x, int y);
+	void getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height);
 
+	// other items
 	int setItem(Frames* frames, uint16 x, uint16 y);
 	void setItemFrame(uint item, uint16 f);
 	void hideDialogueStuff();
 	void freeBalloons();
 	void freeItems();
 
-	// low level surfaces
+	// background surface
+	BackgroundInfo	*_backgroundInfo;
+	void setBackground(uint type, const char* name, const char* mask, const char* path);
 	void clearBackground();
+	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);
 	void invertBackground(const Common::Rect& r);
+	void freeBackground();
 
 	// palette
 	void setPalette(Palette palette);
@@ -408,17 +414,15 @@
 
 	// misc
 	uint16 queryMask(uint16 v);
-	void updateScreen();
 	void setMask(MaskBuffer *buffer);
 
 	// init
 	Gfx(Parallaction* vm);
 	virtual ~Gfx();
 
+	void updateScreen();
 
 public:
-	uint16				_bgLayers[4];
-	PaletteFxRange		_palettefx[6];
 	Palette				_palette;
 
 	uint				_screenX;		// scrolling position


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