[Scummvm-cvs-logs] CVS: scummvm/queen display.cpp,1.36,1.37 display.h,1.28,1.29 graphics.cpp,1.58,1.59 resource.cpp,1.32,1.33 resource.h,1.22,1.23

Gregory Montoir cyx at users.sourceforge.net
Fri Dec 26 07:37:02 CET 2003


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

Modified Files:
	display.cpp display.h graphics.cpp resource.cpp resource.h 
Log Message:
cleanup

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- display.cpp	26 Dec 2003 14:52:07 -0000	1.36
+++ display.cpp	26 Dec 2003 15:36:28 -0000	1.37
@@ -753,7 +753,7 @@
 }
 
 
-void Display::pcxRead(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) {
+void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) {
 
 	while (h--) {
 		uint8 *p = dst;
@@ -773,41 +773,23 @@
 }
 
 
-void Display::pcxReadBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) {
+void Display::readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal) {
 
 	_bdWidth  = READ_LE_UINT16(pcxBuf + 12);
 	_bdHeight = READ_LE_UINT16(pcxBuf + 14);
-	pcxRead(_buffer[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight);
+	readPCX(_buffer[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight);
 	memcpy(_pal.room, pcxBuf + size - 768, useFullPal ? 256 * 3 : 144 * 3);
 }
 
 
-void Display::pcxReadPanel(const uint8 *pcxBuf, uint32 size) {
+void Display::readPCXPanel(const uint8 *pcxBuf, uint32 size) {
 
 	uint8 *dst = _buffer[RB_PANEL] + PANEL_W * 10;
-	pcxRead(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
+	readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
 	memcpy(_pal.room + 144 * 3, pcxBuf + size - 768 + 144 * 3, (256 - 144) * 3);
 }
 
 
-void Display::textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
-
-	debug(9, "Display::textDraw(%s)", text);
-	_textRenderer.drawString(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined);
-}
-
-
-uint16 Display::textWidth(const char *text) const {
-
-	uint16 len = 0;
-	while (*text) {
-		len += _textRenderer._charWidth[ (uint8)*text ];
-		++text;
-	}
-	return len;
-}
-
-
 void Display::horizontalScrollUpdate(int16 xCamera) {
 
 	debug(9, "Display::horizontalScrollUpdate(%d)", xCamera);
@@ -868,6 +850,24 @@
 }
 
 
+uint16 Display::textWidth(const char *text) const {
+
+	uint16 len = 0;
+	while (*text) {
+		len += _textRenderer._charWidth[ (uint8)*text ];
+		++text;
+	}
+	return len;
+}
+
+
+void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
+
+	debug(9, "Display::drawText(%s)", text);
+	_textRenderer.drawString(_buffer[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined);
+}
+
+
 void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
 
 	uint8 *p = _buffer[RB_SCREEN];
@@ -913,12 +913,12 @@
 			uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - MINI_H - 2) + 1;
 			uint8 *p = _buffer[RB_SCREEN] + _bufPitch[RB_SCREEN] * y + x;
 			blit(RB_MINI, 0, 0, p, MINI_W, MINI_H, _bufPitch[RB_SCREEN], false, false);
-			if (_vm->randomizer.getRandomNumber(1) & 1) {
+			if (_vm->randomizer.getRandomNumber(1)) {
 				--x;
 			} else {
 				++x;
 			}
-			if (_vm->randomizer.getRandomNumber(1) & 1) {
+			if (_vm->randomizer.getRandomNumber(1)) {
 				--y;
 			} else {
 				++y;

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- display.h	26 Dec 2003 14:49:49 -0000	1.28
+++ display.h	26 Dec 2003 15:36:28 -0000	1.29
@@ -92,12 +92,9 @@
 	void blit(RenderingBuffer dstBuf, uint16 dstX, uint16 dstY, const uint8 *srcBuf, uint16 srcW, uint16 srcH, uint16 srcPitch, bool xflip, bool masked);
 	void fill(RenderingBuffer dstBuf, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color);
 
-	void pcxRead(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h);
-	void pcxReadBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal);
-	void pcxReadPanel(const uint8 *pcxBuf, uint32 size);
-
-	void textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
-	uint16 textWidth(const char *text) const;
+	void readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h);
+	void readPCXBackdrop(const uint8 *pcxBuf, uint32 size, bool useFullPal);
+	void readPCXPanel(const uint8 *pcxBuf, uint32 size);
 
 	void horizontalScrollUpdate(int16 xCamera);
 	void horizontalScroll(int16 scroll);
@@ -112,6 +109,8 @@
 	void setMouseCursor(uint8 *buf, uint16 w, uint16 h, uint16 xhs, uint16 yhs);
 	void showMouseCursor(bool show);
 
+	uint16 textWidth(const char *text) const;
+	void drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
 	void drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col);
 	void drawScreen();
 

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- graphics.cpp	20 Dec 2003 16:54:46 -0000	1.58
+++ graphics.cpp	26 Dec 2003 15:36:28 -0000	1.59
@@ -659,7 +659,7 @@
 	for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
 		const TextSlot *pts = &_texts[y];
 		if (!pts->text.isEmpty()) {
-			_vm->display()->textDraw(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
+			_vm->display()->drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
 		}
 	}
 }
@@ -715,7 +715,7 @@
 		error("Unable to load backdrop : '%s'", name);
 	}
 	uint32 size = _vm->resource()->fileSize(name);
-	_vm->display()->pcxReadBackdrop(pcxbuf, size, room > 114);
+	_vm->display()->readPCXBackdrop(pcxbuf, size, room > 114);
 	delete[] pcxbuf;
 
 	if (room >= 90) {
@@ -731,7 +731,7 @@
 		error("Unable to open panel file");
 	}
 	uint32 size = _vm->resource()->fileSize("panel.pcx");
-	_vm->display()->pcxReadPanel(pcxbuf, size);
+	_vm->display()->readPCXPanel(pcxbuf, size);
 	delete[] pcxbuf;
 }
 

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- resource.cpp	12 Dec 2003 15:29:58 -0000	1.32
+++ resource.cpp	26 Dec 2003 15:36:28 -0000	1.33
@@ -28,17 +28,17 @@
 const char *Resource::_tableFilename = "queen.tbl";
 
 const GameVersion Resource::_gameVersions[] = {
-	{ "PEM10", true,  false, 0x00000008,  22677657 },
-	{ "CEM10", false, false, 0x0000584E, 190787021 },
-	{ "PFM10", true,  false, 0x0002CD93,  22157304 },
-	{ "CFM10", false, false, 0x00032585, 186689095 },
-	{ "PGM10", true,  false, 0x00059ACA,  22240013 },
-	{ "CGM10", false, false, 0x0005F2A7, 217648975 },
-	{ "PIM10", true,  false, 0x000866B1,  22461366 },
-	{ "CIM10", false, false, 0x0008BEE2, 190795582 },
-	{ "CSM10", false, false, 0x000B343C, 190730602 },
-	{ "PE100", true,  true,  0x000DA981,   3724538 },
-	{ "PE100", true,  true,  0x000DB63A,   3732177 }
+	{ "PEM10", false, 0x00000008,  22677657 },
+	{ "CEM10", false, 0x0000584E, 190787021 },
+	{ "PFM10", false, 0x0002CD93,  22157304 },
+	{ "CFM10", false, 0x00032585, 186689095 },
+	{ "PGM10", false, 0x00059ACA,  22240013 },
+	{ "CGM10", false, 0x0005F2A7, 217648975 },
+	{ "PIM10", false, 0x000866B1,  22461366 },
+	{ "CIM10", false, 0x0008BEE2, 190795582 },
+	{ "CSM10", false, 0x000B343C, 190730602 },
+	{ "PE100", true,  0x000DA981,   3724538 },
+	{ "PE100", true,  0x000DB63A,   3732177 }
 };
 
 
@@ -164,36 +164,36 @@
 
 const char *Resource::JASVersion() {
 	static char versionStr[6];
-	if (_gameVersion->isDemo)
-		_resourceFile->seek(fileOffset("QUEEN.JAS") + DEMO_JAS_VERSION_OFFSET, SEEK_SET );
+	if (isDemo())
+		_resourceFile->seek(fileOffset("QUEEN.JAS") + JAS_VERSION_OFFSET_DEMO, SEEK_SET);
 	else
 		_resourceFile->seek(fileOffset("QUEEN.JAS") + JAS_VERSION_OFFSET, SEEK_SET);
 	_resourceFile->read(versionStr, 6);
 	return versionStr;
 }
 
-bool Resource::isDemo() {
+bool Resource::isDemo() const {
 	return _gameVersion->isDemo;
 }
 
-bool Resource::isFloppy() {
-	return _gameVersion->isFloppy;
+bool Resource::isFloppy() const {
+	return _gameVersion->versionString[0] == 'P';
 }
 
-Language Resource::getLanguage() {
+Language Resource::getLanguage() const {
 	switch (_gameVersion->versionString[1]) {
-		case 'E':
-			return ENGLISH;
-		case 'G':
-			return GERMAN;
-		case 'F':
-			return FRENCH;
-		case 'I':
-			return ITALIAN;
-		case 'S':
-			return SPANISH;
-		default:
-			return ENGLISH;
+	case 'E':
+		return ENGLISH;
+	case 'G':
+		return GERMAN;
+	case 'F':
+		return FRENCH;
+	case 'I':
+		return ITALIAN;
+	case 'S':
+		return SPANISH;
+	default:
+		return ENGLISH;
 	}
 }
 
@@ -236,7 +236,7 @@
 void Resource::readTableCompResource() {
 	GameVersion *gv = new GameVersion;
 	_resourceFile->read(gv->versionString, 6);
-	gv->isFloppy = _resourceFile->readByte() != 0;
+	_resourceFile->readByte();
 	gv->isDemo = _resourceFile->readByte() != 0;
 	_compression = _resourceFile->readByte();
 	_resourceEntries = _resourceFile->readUint16BE();

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- resource.h	12 Dec 2003 15:29:58 -0000	1.22
+++ resource.h	26 Dec 2003 15:36:28 -0000	1.23
@@ -53,7 +53,6 @@
 
 struct GameVersion {
 	char versionString[6];
-	bool isFloppy;   
 	bool isDemo;
 	uint32 tableOffset;
 	uint32 dataFileSize;
@@ -69,19 +68,20 @@
 	uint8 *loadFileMalloc(const char *filename, uint32 skipBytes = 0, byte *dstBuf = NULL);
 	char *getJAS2Line();
 	bool exists(const char *filename);
-	bool isDemo();
-	bool isFloppy();
+	bool isDemo() const;
+	bool isFloppy() const;
 	uint8 compression()	{ return _compression; }
 	uint32 fileSize(const char *filename);
 	uint32 fileOffset(const char *filename);
 	File *giveCompressedSound(const char *filename);
-	Language getLanguage();
+	Language getLanguage() const;
 	const char *JASVersion();
 	bool writeSave(uint16 slot, const byte *saveData, uint32 size);
 	bool readSave(uint16 slot, byte *&ptr);
 
 	enum {
-		DEMO_JAS_VERSION_OFFSET	= 0x119A8,
+		JAS_VERSION_OFFSET_DEMO = 0x119A8,
+		JAS_VERSION_OFFSET_INTV = 0xCF8,
 		JAS_VERSION_OFFSET	    = 0x12484
 	};
 





More information about the Scummvm-git-logs mailing list