[Scummvm-cvs-logs] CVS: scummvm/queen graphics.cpp,1.4,1.5 graphics.h,1.3,1.4

Gregory Montoir cyx at users.sourceforge.net
Thu Oct 2 00:55:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv12010

Modified Files:
	graphics.cpp graphics.h 
Log Message:
minor changes to Graphics class (dtor...)

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- graphics.cpp	1 Oct 2003 21:23:41 -0000	1.4
+++ graphics.cpp	2 Oct 2003 07:54:01 -0000	1.5
@@ -28,7 +28,18 @@
 	memset(_frames, 0, sizeof(_frames));
 	memset(_banks, 0, sizeof(_banks));
 	memset(_sortedBobs, 0, sizeof(_sortedBobs));
+	_shrinkBuffer.data = new uint8[BOB_SHRINK_BUF_SIZE];
+
+}
 
+
+QueenGraphics::~QueenGraphics() {
+	uint32 i;
+	for(i = 0; i < ARRAYSIZE(_banks); ++i) {
+		delete _banks[i].data;
+	}
+//	frameClearAll();
+	delete _shrinkBuffer.data;
 }
 
 
@@ -269,16 +280,13 @@
 	BobFrame *pbf = &_frames[bobnum];
 	if (scale < 100) {  // Note: scale is unsigned, hence always >= 0
 		bobShrink(pbf, scale);
-		src = _shrinkBuffer.data;
-		w   = _shrinkBuffer.width;
-		h   = _shrinkBuffer.height;
-	}
-	else {
-		src = pbf->data;
-		w   = pbf->width;
-		h   = pbf->height;
+		pbf = &_shrinkBuffer;
 	}
 
+	src = pbf->data;
+	w   = pbf->width;
+	h   = pbf->height;
+
 	if(w != 0 && h != 0 && box.intersects(x, y, w, h)) {
 
 		uint16 x_skip = 0;
@@ -307,10 +315,7 @@
 			h_new = box.y2 - y + 1;
 		}
 
-		uint16 j;
-		for (j = 0; j < h_new; ++j) {
-			memset(_ulines[y + j], 2, w_new / 16);
-		}
+//		_display->ulines(i, j, w_new / 16, h_new);
 
 		src += w * y_skip;
 		if (!xflip) {
@@ -330,13 +335,7 @@
 void QueenGraphics::bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y) {
 	if (bobnum == 0) {
 		// clear panel area
-		uint8 *p = _panel + y * 320 + x;
-		for(uint32 j = 0; j < 32; ++j) {
-			for(uint32 i = 0; i < 32; ++i) {
-				*p++ = INK_BG_PANEL;
-			}
-			p += 320 - 32;
-		}
+//		_display->clear(panel, x, y, 32, 32, INK_BG_PANEL);
 	}
 	else {
 //		BobFrame *pbf = &_frames[bobnum];
@@ -391,7 +390,9 @@
 				src += pbf->width;
 				y_count &= 0xFFFF;
 			}
-		} 
+		}
+
+		debug(5, "Shrunk bob, buffer size = %d", new_w * new_h);
 	}
 }
 

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- graphics.h	1 Oct 2003 20:23:29 -0000	1.3
+++ graphics.h	2 Oct 2003 07:54:01 -0000	1.4
@@ -30,6 +30,8 @@
 #define MAX_BANKS_NUMBER    18
 #define MAX_BOBS_NUMBER     64
 
+#define BOB_SHRINK_BUF_SIZE  60000
+
 
 struct BobFrame {
 	uint16 width, height;
@@ -51,7 +53,7 @@
 	bool active; 
 	uint16 x, y;     //! current position
 	Box box;         //! bounding box
-	bool xflip; 
+	bool xflip;
 	uint16 scale;    //! shrinking percentage
 	uint16 frameNum; //! associated BobFrame
 	uint8 frameDir;  //! 'direction' for the next frame (-1, 1)
@@ -88,16 +90,11 @@
 };
 
 
-//! Inks indexes
-enum {
-	INK_BG_PANEL = 0xE2
-};
-
-
 class QueenGraphics {
 public:
 
 	QueenGraphics(QueenResource *resource);
+	~QueenGraphics();
 
 	void bankLoad(const char *bankname, uint32 bankslot); // loadbank()
 	void bankUnpack(uint32 srcframe, uint32 dstframe, uint32 bankslot); // unpackbank()
@@ -118,7 +115,6 @@
 
 	void frameErase(uint32 fslot);
 
-
 private:
 	
 	struct PackedBank {
@@ -126,19 +122,11 @@
 		uint8 *data;
 	};
 
-	struct ShrunkBobFrame {
-		uint16 width;
-		uint16 height;
-		uint8 data[60000]; // FIXME: original buffer size, maybe it can be smaller
-	};
-
 	BobFrame _frames[MAX_FRAMES_NUMBER]; //! unbanked bob frames
 	PackedBank _banks[MAX_BANKS_NUMBER]; //! banked bob frames
 	BobSlot _bobs[MAX_BOBS_NUMBER];
-	BobSlot* _sortedBobs[MAX_BOBS_NUMBER + 1]; //! bobs displayed
-	ShrunkBobFrame _shrinkBuffer;
-	uint8 _ulines[201][20];
-	uint8 _panel[320 * 50]; // FIXME: rather in QueenDisplay ?
+	BobSlot *_sortedBobs[MAX_BOBS_NUMBER + 1]; //! bobs displayed
+	BobFrame _shrinkBuffer;
 
 	QueenResource *_resource;
 	





More information about the Scummvm-git-logs mailing list