[Scummvm-cvs-logs] CVS: scummvm/queen graphics.h,1.13,1.14 graphics.cpp,1.14,1.15 logic.h,1.17,1.18 logic.cpp,1.27,1.28

Gregory Montoir cyx at users.sourceforge.net
Fri Oct 10 13:04:11 CEST 2003


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

Modified Files:
	graphics.h graphics.cpp logic.h logic.cpp 
Log Message:
Graphics tweaks

Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- graphics.h	10 Oct 2003 09:24:21 -0000	1.13
+++ graphics.h	10 Oct 2003 20:03:34 -0000	1.14
@@ -96,7 +96,7 @@
 struct TextSlot {
 	uint16 x;
 	uint8 color;
-	char *text;
+	Common::String text;
 	bool outlined;
 };
 
@@ -132,7 +132,7 @@
 	void textSet(uint16 x, uint16 y, const char *text, bool outlined = true); // text()
 	void textDrawAll(); // drawtext()
 	void textClear(uint16 y1, uint16 y2); // blanktexts()
-	uint16 textLength(const char* text); // textlen()
+	uint16 textWidth(const char* text) const; // textlen()
 
 	void frameErase(uint32 fslot);
 	void frameEraseAll(bool joe); // freeframes, freeallframes
@@ -142,6 +142,7 @@
 
 	void panelLoad(); // loadpanel
 	void panelDraw();
+	void panelClear();
 
 	void boxDraw(const Box &b, uint8 color);
 

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- graphics.cpp	10 Oct 2003 12:12:56 -0000	1.14
+++ graphics.cpp	10 Oct 2003 20:03:34 -0000	1.15
@@ -19,7 +19,9 @@
  *
  */
 
+#include "stdafx.h"
 #include "queen/graphics.h"
+#include "queen/resource.h"
 
 
 namespace Queen {
@@ -272,7 +274,6 @@
 	memset(_bobs, 0, sizeof(_bobs));
 	memset(_sortedBobs, 0, sizeof(_sortedBobs));
 	_sortedBobsCount = 0;
-	memset(_texts, 0, sizeof(_texts));
 	_shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ];
 	_backdrop = new uint8[ BACKDROP_W * BACKDROP_H ];
 	_panel = new uint8[ PANEL_W * PANEL_H ];
@@ -782,10 +783,7 @@
 		pts->x = x;
 		pts->color = _curTextColor;
 		pts->outlined = outlined;
-		if (pts->text != NULL) {
-			free(pts->text);
-		}
-		pts->text = strdup(text);
+		pts->text = text;
 	}
 }
 
@@ -794,7 +792,7 @@
 	int y;
 	for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
 		const TextSlot *pts = &_texts[y];
-		if (pts->text != NULL) {
+		if (!pts->text.isEmpty()) {
 			displayText(pts, y);
 		}
 	}
@@ -804,16 +802,13 @@
 void Graphics::textClear(uint16 y1, uint16 y2) {
 
 	while (y1 <= y2) {
-		if (_texts[y1].text != NULL) {
-			free(_texts[y1].text);
-			_texts[y1].text = NULL;
-		}
+		_texts[y1].text.clear();
 		++y1;
 	}
 }
 
 
-uint16 Graphics::textLength(const char* text) {
+uint16 Graphics::textWidth(const char* text) const {
 
 	uint16 len = 0;
 	while (*text) {
@@ -866,10 +861,6 @@
 	_backdropWidth  = READ_LE_UINT16(pcxbuf +  12);
 	_backdropHeight = READ_LE_UINT16(pcxbuf +  14);
 
-	if (_backdropHeight == 150) {
-		_fullscreen = false;
-	}
-
 	if (room >= 90) {
 		_cameraBob = 0;
 	}
@@ -916,6 +907,11 @@
 }
 
 
+void Graphics::panelClear() {
+	memset(_screen + SCREEN_W * ROOM_ZONE_HEIGHT, 0, PANEL_W * PANEL_H);
+}
+
+
 void Graphics::readPCX(const uint8 *src, uint8 *dst, uint16 dstPitch, uint16 w, uint16 h) {
 
 	while (h--) {
@@ -1024,7 +1020,7 @@
 void Graphics::displayText(const TextSlot *pts, uint16 y) {
 
 	uint16 x = pts->x;
-	uint8 *str = (uint8*)pts->text;
+	const uint8 *str = (const uint8*)pts->text.c_str();
 	while (*str && x < GAME_SCREEN_WIDTH) {
 		const uint8 *pchr = FONT + (*str) * 8;
 //		if (_resource->_gameVersion->versionString[1] == 'F' && *str == 150) {

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- logic.h	10 Oct 2003 09:19:52 -0000	1.17
+++ logic.h	10 Oct 2003 20:03:34 -0000	1.18
@@ -45,11 +45,12 @@
 
 
 class Graphics;
+class Resource;
 
 class Logic {
 
 public:
-	Logic(Resource *resource);
+	Logic(Resource *resource, Graphics *graphics);
 	~Logic();
 
 	uint16 currentRoom();
@@ -58,7 +59,7 @@
 	ObjectData* objectData(int index);
 	uint16 roomData(int room);
 	uint16 objMax(int room);
-	GraphicData* findGraphic(int index);
+	GraphicData* graphicData(int index);
 
 	uint16 findBob(uint16 obj); // FIXME: move that to QueenDisplay ?
 	uint16 findFrame(uint16 obj); // FIXME: move that to QueenDisplay ?
@@ -145,6 +146,7 @@
 	uint16 _maxAnimatedFrame, _maxStaticFrame, _maxAnimatedFrameLen; // FMAXA, FMAX, FMAXALEN
 
 	Resource *_resource;
+	Graphics *_graphics;
 
 	void initialise();
 };

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- logic.cpp	10 Oct 2003 09:19:52 -0000	1.27
+++ logic.cpp	10 Oct 2003 20:03:34 -0000	1.28
@@ -24,8 +24,8 @@
 
 namespace Queen {
 
-Logic::Logic(Resource *resource) 
-	: _maxAnimatedFrame(0), _maxStaticFrame(0), _resource(resource) {
+Logic::Logic(Resource *resource, Graphics *graphics) 
+	: _maxAnimatedFrame(0), _maxStaticFrame(0), _resource(resource), _graphics(graphics) {
 	_jas = _resource->loadFile("QUEEN.JAS", 20);
 	_joe.x = _joe.y = 0;
 	initialise();
@@ -264,7 +264,7 @@
 	return &_walkOffData[index];
 }
 
-GraphicData *Logic::findGraphic(int index) {
+GraphicData *Logic::graphicData(int index) {
 	return &_graphicData[index];
 }
 
@@ -457,6 +457,7 @@
 		if (bobcur == bobNum) {
 			return cur;
 		}
+		++cur;
 	}
 	return 0;
 }





More information about the Scummvm-git-logs mailing list