[Scummvm-cvs-logs] SF.net SVN: scummvm: [22336] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu May 4 05:22:04 CEST 2006


Revision: 22336
Author:   kirben
Date:     2006-05-04 05:20:49 -0700 (Thu, 04 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22336&view=rev

Log Message:
-----------
Cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/cursor.cpp
    scummvm/trunk/engines/simon/debug.cpp
    scummvm/trunk/engines/simon/draw.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/subroutine.cpp
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/cursor.cpp
===================================================================
--- scummvm/trunk/engines/simon/cursor.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/cursor.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -351,7 +351,7 @@
 }
 
 // Feeble Files specific
-const byte _mouseOffs[] = {
+static const byte _mouseOffs[29 * 32] = {
 	6,0,15,21,16,21,14,21,15,21,16,21,16,21,16,21,15,21,15,21,15,21,14,21,12,21,12,21,12,21,12,21,
 	6,2,10,12,9,12,8,11,7,10,6,9,4,8,3,7,1,7,0,6,3,7,4,8,6,9,7,10,8,11,9,12,
 	0,0,0,0,0,0,0,0,0,1,0,3,0,3,0,4,1,4,1,3,2,3,2,2,1,3,0,4,0,3,0,0,

Modified: scummvm/trunk/engines/simon/debug.cpp
===================================================================
--- scummvm/trunk/engines/simon/debug.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/debug.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -56,30 +56,30 @@
 	}
 	while (*st != '|')
 		st++;
-	fprintf(_dumpFile, "%s ", st + 1);
+	printf("%s ", st + 1);
 
 	for (;;) {
 		switch (*s++) {
 		case 'x':
-			fprintf(_dumpFile, "\n");
+			printf("\n");
 			return NULL;
 		case '|':
-			fprintf(_dumpFile, "\n");
+			printf("\n");
 			return p;
 		case 'B':{
 				byte b = *p++;
 				if (b == 255)
-					fprintf(_dumpFile, "[%d] ", *p++);
+					printf("[%d] ", *p++);
 				else
-					fprintf(_dumpFile, "%d ", b);
+					printf("%d ", b);
 				break;
 			}
 		case 'V':{
 				byte b = *p++;
 				if (b == 255)
-					fprintf(_dumpFile, "[[%d]] ", *p++);
+					printf("[[%d]] ", *p++);
 				else
-					fprintf(_dumpFile, "[%d] ", b);
+					printf("[%d] ", b);
 				break;
 			}
 
@@ -87,16 +87,16 @@
 				int n = (int16)((p[0] << 8) | p[1]);
 				p += 2;
 				if (n >= 30000 && n < 30512)
-					fprintf(_dumpFile, "[%d] ", n - 30000);
+					printf("[%d] ", n - 30000);
 				else
-					fprintf(_dumpFile, "%d ", n);
+					printf("%d ", n);
 				break;
 			}
 
 		case 'w':{
 				int n = (int16)((p[0] << 8) | p[1]);
 				p += 2;
-				fprintf(_dumpFile, "%d ", n);
+				printf("%d ", n);
 				break;
 			}
 
@@ -104,22 +104,22 @@
 				int n = (int16)((p[0] << 8) | p[1]);;
 				p += 2;
 				if (n == -1)
-					fprintf(_dumpFile, "ITEM_M1 ");
+					printf("ITEM_M1 ");
 				else if (n == -3)
-					fprintf(_dumpFile, "ITEM_M3 ");
+					printf("ITEM_M3 ");
 				else if (n == -5)
-					fprintf(_dumpFile, "ITEM_1 ");
+					printf("ITEM_1 ");
 				else if (n == -7)
-					fprintf(_dumpFile, "ITEM_0 ");
+					printf("ITEM_0 ");
 				else if (n == -9)
-					fprintf(_dumpFile, "ITEM_A_PARENT ");
+					printf("ITEM_A_PARENT ");
 				else
-					fprintf(_dumpFile, "<%d> ", n);
+					printf("<%d> ", n);
 				break;
 			}
 
 		case 'J':{
-				fprintf(_dumpFile, "-> ");
+				printf("-> ");
 			}
 			break;
 
@@ -127,9 +127,9 @@
 				uint n = ((p[0] << 8) | p[1]);
 				p += 2;
 				if (n != 0xFFFF)
-					fprintf(_dumpFile, "\"%s\"(%d) ", getStringPtrByID(n), n);
+					printf("\"%s\"(%d) ", getStringPtrByID(n), n);
 				else
-					fprintf(_dumpFile, "NULL_STRING ");
+					printf("NULL_STRING ");
 			}
 			break;
 		}
@@ -143,7 +143,7 @@
 
 	p = (byte *)sl + SUBROUTINE_LINE_SMALL_SIZE;
 	if (sub->id == 0) {
-		fprintf(_dumpFile, "; verb=%d, noun1=%d, noun2=%d\n", sl->verb, sl->noun1, sl->noun2);
+		printf("; verb=%d, noun1=%d, noun2=%d\n", sl->verb, sl->noun1, sl->noun2);
 		p = (byte *)sl + SUBROUTINE_LINE_BIG_SIZE;
 	}
 
@@ -157,13 +157,12 @@
 void SimonEngine::dumpSubroutine(Subroutine *sub) {
 	SubroutineLine *sl;
 
-	fprintf(_dumpFile, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
+	printf("\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
 	sl = (SubroutineLine *)((byte *)sub + sub->first);
 	for (; (byte *)sl != (byte *)sub; sl = (SubroutineLine *)((byte *)sub + sl->next)) {
 		dumpSubroutineLine(sl, sub);
 	}
-	fprintf(_dumpFile, "\nEND ******************************************\n");
-	fflush(_dumpFile);
+	printf("\nEND ******************************************\n");
 }
 
 void SimonEngine::dumpSubroutines() {
@@ -200,32 +199,32 @@
 
 		while (*strn != '|')
 			strn++;
-		fprintf(_dumpFile, "%.2d: %s ", opcode, strn + 1);
+		printf("%.2d: %s ", opcode, strn + 1);
 
 		int end = (getGameType() == GType_FF) ? 9999 : 999;
 		for (; *str != '|'; str++) {
 			switch (*str) {
 			case 'x':
-				fprintf(_dumpFile, "\n");
+				printf("\n");
 				return;
 			case 'b':
-				fprintf(_dumpFile, "%d ", *src++);
+				printf("%d ", *src++);
 				break;
 			case 'd':
-				fprintf(_dumpFile, "%d ", (int16)readUint16Wrapper(src));
+				printf("%d ", (int16)readUint16Wrapper(src));
 				src += 2;
 				break;
 			case 'v':
-				fprintf(_dumpFile, "[%d] ", readUint16Wrapper(src));
+				printf("[%d] ", readUint16Wrapper(src));
 				src += 2;
 				break;
 			case 'i':
-				fprintf(_dumpFile, "%d ", (int16)readUint16Wrapper(src));
+				printf("%d ", (int16)readUint16Wrapper(src));
 				src += 2;
 				break;
 			case 'q':
 				while (readUint16Wrapper(src) != end) {
-					fprintf(_dumpFile, "(%d,%d) ", readUint16Wrapper(src),
+					printf("(%d,%d) ", readUint16Wrapper(src),
 									readUint16Wrapper(src + 2));
 					src += 4;
 				}
@@ -236,43 +235,36 @@
 			}
 		}
 
-		fprintf(_dumpFile, "\n");
+		printf("\n");
 	} while (!one_opcode_only);
 }
 
 void SimonEngine::dump_vga_file(const byte *vga) {
-	{
-		const byte *pp;
-		const byte *p;
-		int count;
+	const byte *pp;
+	const byte *p;
+	int count;
 
-		pp = vga;
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start);
-		count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationCount);
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationTable);
-		while (--count >= 0) {
-			int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
+	pp = vga;
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start);
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationTable);
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
 
-			dump_vga_script_always(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
-			p += sizeof(AnimationHeader_Simon);
-		}
+		dump_vga_script_always(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
+		p += sizeof(AnimationHeader_Simon);
 	}
 
-	{
-		const byte *bb, *b;
-		int c;
+	pp = vga;
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start);
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->imageCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->imageTable);
 
-		bb = vga;
-		b = bb + READ_BE_UINT16(&((const VgaFileHeader_Simon *) bb)->hdr2_start);
-		c = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) b)->imageCount);
-		b = bb + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) b)->imageTable);
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
 
-		while (--c >= 0) {
-			int id = READ_BE_UINT16(&((const ImageHeader_Simon *) b)->id);
-
-			dump_vga_script_always(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) b)->scriptOffs), id / 100, id);
-			b += sizeof(ImageHeader_Simon);
-		}
+		dump_vga_script_always(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
+		p += sizeof(ImageHeader_Simon);
 	}
 }
 
@@ -416,13 +408,11 @@
 	const byte *p2;
 	byte pal[768];
 
-	{
-		memset(pal, 0, sizeof(pal));
-		pal_load(pal, vga1, 2, 0);
-		pal_load(pal, vga1, 3, 1);
-		pal_load(pal, vga1, 4, 2);
-		pal_load(pal, vga1, 5, 3);
-	}
+	memset(pal, 0, sizeof(pal));
+	pal_load(pal, vga1, 2, 0);
+	pal_load(pal, vga1, 3, 1);
+	pal_load(pal, vga1, 4, 2);
+	pal_load(pal, vga1, 5, 3);
 
 	int width, height, flags;
 
@@ -441,28 +431,26 @@
 		height = p2[5];
 		flags = p2[4];
 
-		fprintf(_dumpFile, "Image %d. Width=%d, Height=%d, Flags=0x%X\n", i, width, height, flags);
-		fflush(_dumpFile);
+		printf("Image %d. Width=%d, Height=%d, Flags=0x%X\n", i, width, height, flags);
 
 		/* dump bitmap */
-		{
-			char buf[40];
+		char buf[40];
 #if defined(MACOS_CARBON)
-			sprintf(buf, ":dumps:Res%d_Image%d.bmp", res, i);
+		sprintf(buf, ":dumps:Res%d_Image%d.bmp", res, i);
 #else
-			sprintf(buf, "dumps/Res%d_Image%d.bmp", res, i);
+		sprintf(buf, "dumps/Res%d_Image%d.bmp", res, i);
 #endif
 
-			dump_bitmap(buf, vga + offs, width, height, flags, pal, 0);
-		}
+		dump_bitmap(buf, vga + offs, width, height, flags, pal, 0);
+
 	}
 }
 
 void SimonEngine::dump_vga_script_always(const byte *ptr, uint res, uint sprite_id) {
-	fprintf(_dumpFile, "; address=%x, vgafile=%d  vgasprite=%d\n",
+	printf("; address=%x, vgafile=%d  vgasprite=%d\n",
 					ptr - _vgaBufferPointers[res].vgaFile1, res, sprite_id);
 	dump_video_script(ptr, false);
-	fprintf(_dumpFile, "; end\n");
+	printf("; end\n");
 }
 
 void SimonEngine::dump_vga_script(const byte *ptr, uint res, uint sprite_id) {

Modified: scummvm/trunk/engines/simon/draw.cpp
===================================================================
--- scummvm/trunk/engines/simon/draw.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/draw.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -128,7 +128,7 @@
 		_vgaCurSpriteId = vsp->id;
 
 		if (vsp->image)
-			fprintf(_dumpFile, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
+			printf("id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
 							vsp->id, vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
 		params[0] = readUint16Wrapper(&vsp->image);
 		params[1] = readUint16Wrapper(&vsp->palette);

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -351,8 +351,6 @@
 	_ambientPaused = false;
 	_musicPaused = false;
 
-	_dumpFile = 0;
-
 	_saveLoadType = 0;
 	_saveLoadSlot = 0;
 	memset(_saveLoadName, 0, sizeof(_saveLoadName));
@@ -463,8 +461,6 @@
 	_currentMouseCursor = 255;
 	_currentMouseAnim = 255;
 
-	_dumpFile = stdout;
-
 	_frameRate = 1;
 
 	_lastMusicPlayed = -1;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/simon.h	2006-05-04 12:20:49 UTC (rev 22336)
@@ -456,8 +456,6 @@
 
 	Debugger *_debugger;
 
-	FILE *_dumpFile;
-
 	int _saveLoadRowCurPos;
 	int _numSaveGameRows;
 	bool _saveDialogFlag;

Modified: scummvm/trunk/engines/simon/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/simon/subroutine.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/subroutine.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -257,7 +257,7 @@
 				_codePtr += 8;
 
 			if (_continousMainScript)
-				fprintf(_dumpFile, "; %d\n", sub->id);
+				printf("; %d\n", sub->id);
 			result = runScript();
 			if (result != 0) {
 				/* result -10 means restart subroutine */

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-05-04 12:05:03 UTC (rev 22335)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-05-04 12:20:49 UTC (rev 22336)
@@ -131,7 +131,7 @@
 
 		if (_continousVgaScript) {
 			if (_vcPtr != (const byte *)&_vc_get_out_of_code) {
-				fprintf(_dumpFile, "%.5d %.5X: %5d %4d ", _vgaTickCounter, _vcPtr - _curVgaFile1, _vgaCurSpriteId, _vgaCurZoneNum);
+				printf("%.5d %.5X: %5d %4d ", _vgaTickCounter, _vcPtr - _curVgaFile1, _vgaCurSpriteId, _vgaCurZoneNum);
 				dump_video_script(_vcPtr, true);
 			}
 		}
@@ -286,7 +286,7 @@
 	}
 
 	if (_continousVgaScript)
-		fprintf(_dumpFile, "; skipped\n");
+		printf("; skipped\n");
 }
 
 // VGA Script commands


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