[Scummvm-cvs-logs] CVS: scummvm gameDetector.cpp,1.71,1.72 gui.cpp,1.53,1.54 gui.h,1.24,1.25 insane.cpp,1.36,1.37 resource.cpp,1.94,1.95 scumm.h,1.174,1.175

James Brown ender at users.sourceforge.net
Thu Jul 4 08:49:05 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv18941

Modified Files:
	gameDetector.cpp gui.cpp gui.h insane.cpp resource.cpp scumm.h 
Log Message:
Theres nothing to see here...
 - Start of CMI support



Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gameDetector.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- gameDetector.cpp	29 Jun 2002 10:28:43 -0000	1.71
+++ gameDetector.cpp	4 Jul 2002 15:48:17 -0000	1.72
@@ -426,7 +426,7 @@
 	{"simon2win", "Simon the Sorcerer 2 for Windows", GID_SIMON_FIRST+3, 99, 99, 99, 0},
 
 	/* Scumm Version 8 */
-//    {"curse",       "The Curse of Monkey Island",                   GID_CMI,      8, 1, 0,},
+	{"comi", "The Curse of Monkey Island", GID_CMI, 8, 1, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7|GF_AFTER_V8},
 	{NULL, NULL}
 };
 

Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- gui.cpp	4 Jul 2002 12:58:36 -0000	1.53
+++ gui.cpp	4 Jul 2002 15:48:17 -0000	1.54
@@ -27,6 +27,9 @@
 #include "guimaps.h"
 #include "config-file.h"
 
+#define hline(x, y, x2, color) line(x, y, x2, y, color);
+#define vline(x, y, y2, color) line(x, y, x, y2, color);
+
 #ifdef _WIN32_WCE
 // Additional variables for WinCE specific GUI
 #include "gapi_keys.h"
@@ -510,42 +513,19 @@
 
 void Gui::widgetBorder(const GuiWidget * w)
 {
-	int x = w->_x, y = w->_y;
-	int x2 = x + w->_w - 1, y2 = y + w->_h - 1;
-	byte tmp;
-
-	hline(x + 1, y, x2 - 1);
-	hline(x, y + 1, x2);
-	vline(x, y + 1, y2 - 1);
-	vline(x + 1, y, y2);
-
-	tmp = _color;
-	_color = _shadowcolor;
-
-	hline(x + 1, y2 - 1, x2);
-	hline(x + 1, y2, x2 - 1);
-	vline(x2, y + 1, y2 - 1);
-	vline(x2 - 1, y + 1, y2);
-
-	_color = tmp;
-}
-
-void Gui::hline(int x, int y, int x2)
-{
-	moveto(x, y);
-	lineto(x2, y);
+	box(w->_x, w->_y, w->_w, w->_h);
 }
 
-void Gui::vline(int x, int y, int y2)
-{
-	moveto(x, y);
-	lineto(x, y2);
-}
+void Gui::box(int x, int y, int width, int height) {
+	hline(x + 1, y, x + width - 2, _color);
+	hline(x, y + 1, x + width - 1, _color);
+	vline(x, y + 1, y + height - 2, _color);
+	vline(x + 1, y, y + height - 1, _color);
 
-void Gui::moveto(int x, int y)
-{
-	_curX = x;
-	_curY = y;
+	hline(x + 1, y + height - 2, x + width - 1, _shadowcolor);
+	hline(x + 1, y + height - 1, x + width - 2, _shadowcolor);
+	vline(x + width - 1, y + 1, y + height - 2, _shadowcolor);
+	vline(x + width - 2, y + 1, y + height - 1, _shadowcolor);
 }
 
 byte *Gui::getBasePtr(int x, int y)
@@ -561,15 +541,10 @@
 		_s->_screenStartStrip * 8 + (_s->camera._cur.y - 100)*320;
 }
 
-void Gui::lineto(int x, int y)
+void Gui::line(int x, int y, int x2, int y2, byte color)
 {
 	byte *ptr;
-	int x2 = _curX;
-	int y2 = _curY;
-
-	_curX = x;
-	_curY = y;
-
+	
 	if (x2 < x)
 		x2 ^= x ^= x2 ^= x;	// Swap x2 and x
 
@@ -584,13 +559,13 @@
 	if (x == x2) {
 		/* vertical line */
 		while (y++ <= y2) {
-			*ptr = _color;
+			*ptr = color;
 			ptr += 320;
 		}
 	} else if (y == y2) {
 		/* horizontal line */
 		while (x++ <= x2) {
-			*ptr++ = _color;
+			*ptr++ = color;
 		}
 	}
 }
@@ -1192,3 +1167,47 @@
 	_cur_page = 0;
 	_dialog = LAUNCHER_DIALOG;
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+void Gui::loop()
+{
+	if (_active && !_inited) {
+		_inited = true;
+		_old_soundsPaused = _s->_soundsPaused;
+		_s->pauseSounds(true);
+
+		// Backup old cursor
+		memcpy(_old_grabbedCursor, _s->_grabbedCursor, sizeof(_old_grabbedCursor));
+		_old_cursorWidth = _s->_cursorWidth;
+		_old_cursorHeight = _s->_cursorHeight;
+		_old_cursorHotspotX = _s->_cursorHotspotX;
+		_old_cursorHotspotY = _s->_cursorHotspotY;
+		_old_cursor_mode = _s->_system->show_mouse(true);
+
+		_s->_cursorAnimate++;
+		_s->gdi._cursorActive = 1;
+	}
+	_s->animateCursor();
+	_s->getKeyInput(0);
+	
+	_s->drawDirtyScreenParts();
+	_s->_mouseButStat = 0;
+}
+*/
\ No newline at end of file

Index: gui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- gui.h	4 Jul 2002 12:58:36 -0000	1.24
+++ gui.h	4 Jul 2002 15:48:17 -0000	1.25
@@ -49,8 +49,7 @@
 protected:
 	Scumm *_s;
 	const GuiWidget *_widgets[4];
-	int _return_to;
-	int _curX, _curY;
+	int _return_to;	
 	VirtScreen *_vs;
 	int _parentX, _parentY;
 	bool _active;
@@ -84,11 +83,13 @@
 	// Drawing
 	void draw(int start, int end);
 	void draw(int item) { draw(item,-1); }
-	void drawWidget(const GuiWidget *w);
-	void moveto(int x, int y);
-	void lineto(int x, int y);
-	void hline(int x, int y, int x2);
-	void vline(int x, int y, int y2);
+	void drawWidget(const GuiWidget *w);	
+	
+    void line(int x, int y, int x2, int y2, byte color);
+	void box(int x, int y, int width, int height);
+
+	//void hline(int x, int y, int x2, byte color);
+	//void vline(int x, int y, int y2, byte color);
 	void drawChar(const char str, int xx, int yy);
 	void drawString(const char *str, int x, int y, int w, byte color, bool center);
 	void widgetClear(const GuiWidget *w);

Index: insane.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/insane.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- insane.cpp	26 Jun 2002 10:20:56 -0000	1.36
+++ insane.cpp	4 Jul 2002 15:48:17 -0000	1.37
@@ -236,15 +236,15 @@
 						temp = (temp | _imusData[idx][0]) << 4;
 						temp -= 0x8000;
 
-						buf[bpos++] = (temp >> 8) & 0xff;
-						buf[bpos++] = temp & 0xff;
+						buf[bpos++] = (byte)((temp >> 8) & 0xff);
+						buf[bpos++] = (byte)(temp & 0xff);
 
 						temp = (_imusData[idx][1] & 0xf0) << 4;
 						temp = (temp | _imusData[idx][2]) << 4;
 						temp -= 0x8000;
 
-						buf[bpos++] = (temp >> 8) & 0xff;
-						buf[bpos++] = temp & 0xff;
+						buf[bpos++] = (byte)((temp >> 8) & 0xff);
+						buf[bpos++] = (byte)(temp & 0xff);
 						_imusPos[idx] = 0;
 					}
 				}

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- resource.cpp	2 Jul 2002 21:28:57 -0000	1.94
+++ resource.cpp	4 Jul 2002 15:48:17 -0000	1.95
@@ -263,14 +263,24 @@
 			break;
 
 		case MKID('DOBJ'):
-			num = fileReadWordLE();
+			if (_features & GF_AFTER_V8)
+				num = fileReadDwordLE();
+			else
+				num = fileReadWordLE();
 			assert(num == _numGlobalObjects);
 
-			if (_features & GF_AFTER_V7) {
+			if (_features & GF_AFTER_V8) { /* FIXME: Not sure.. */
+				for (i=0; i<num; i++) {
+					fileSeek(_fileHandle, 40, SEEK_CUR);
+					_objectStateTable[i] = fileReadByte();
+					_objectRoomTable[i] = fileReadByte();
+					_classData[i] = fileReadDwordLE();
+				}
+				memset(_objectOwnerTable, 0xFF, num);
+			} else if (_features & GF_AFTER_V7) {
 				fileRead(_fileHandle, _objectStateTable, num);
 				fileRead(_fileHandle, _objectRoomTable, num);
 				memset(_objectOwnerTable, 0xFF, num);
-
 			} else {
 				fileRead(_fileHandle, _objectOwnerTable, num);
 				for (i = 0; i < num; i++) {
@@ -278,15 +288,16 @@
 					_objectOwnerTable[i] &= OF_OWNER_MASK;
 				}
 			}
-			fileRead(_fileHandle, _classData, num * sizeof(uint32));
 
-			/* This code should be here. Otherwise the flags will be swapped for big endian computers.
-			 * If it doesn't work with this code, something else is wrong */
+			if (!(_features & GF_AFTER_V8)) {
+				fileRead(_fileHandle, _classData, num * sizeof(uint32));
+
+				// Swap flag endian where applicable
 #if defined(SCUMM_BIG_ENDIAN)
-			for (i = 0; i != num; i++) {
-				_classData[i] = FROM_LE_32(_classData[i]);
-			}
+				for (i = 0; i != num; i++)
+					_classData[i] = FROM_LE_32(_classData[i]);
 #endif
+			}
 			break;
 
 		case MKID('RNAM'):
@@ -298,6 +309,10 @@
 			readResTypeList(rtRoom, MKID('ROOM'), "room");
 			break;
 
+		case MKID('DRSC'):	// FIXME: Verify
+			readResTypeList(rtRoomScripts,MKID('RMSC'), "room script");
+			break;
+
 		case MKID('DSCR'):
 			readResTypeList(rtScript, MKID('SCRP'), "script");
 			break;
@@ -354,7 +369,10 @@
 
 	debug(9, "readResTypeList(%s,%x,%s)", resTypeFromId(id), FROM_LE_32(tag), name);
 
-	num = fileReadWordLE();
+	if (_features & GF_AFTER_V8)
+		num = fileReadDwordLE();
+	else
+		num = fileReadWordLE();
 
 	if (1 || _features & GF_AFTER_V6) {
 		if (num != res.num[id]) {
@@ -1152,7 +1170,31 @@
 
 void Scumm::readMAXS()
 {
-	if (_features & GF_AFTER_V7) {
+	if (_features & GF_AFTER_V8) {
+		fileSeek(_fileHandle, 50+50, SEEK_CUR);
+		_numVariables = fileReadDwordLE(); /* ? 1500 */
+		_numBitVariables = fileReadDwordLE(); /* ? 2048 */
+		fileReadDwordLE(); /* 40 */
+		_numScripts = fileReadDwordLE();
+		_numSounds = fileReadDwordLE();
+		_numCharsets = fileReadDwordLE();
+		_numCostumes = fileReadDwordLE();
+		_numRooms = fileReadDwordLE();
+		_numInventory = fileReadDwordLE();
+		_numGlobalObjects = fileReadDwordLE();
+		_numFlObject = fileReadDwordLE();
+		_numLocalObjects = fileReadDwordLE();
+		_numVerbs = fileReadDwordLE();
+		_numNewNames = fileReadDwordLE();
+		fileReadDwordLE();
+		fileReadDwordLE();
+		_numArray = fileReadDwordLE();
+
+		_objectRoomTable = (byte*)calloc(_numGlobalObjects, 1);
+		_numGlobalScripts = 2000;
+
+		_shadowPaletteSize = NUM_SHADOW_PALETTE * 256;
+	} else if (_features & GF_AFTER_V7) {
 		fileSeek(_fileHandle, 50 + 50, SEEK_CUR);
 		_numVariables = fileReadWordLE();
 		_numBitVariables = fileReadWordLE();
@@ -1247,6 +1289,7 @@
 									 MKID('COST'), _numCostumes, "costume", 1);
 
 	allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1);
+	allocResTypeData(rtRoomScripts, MKID('RMSC'), _numRooms, "room script", 1);
 	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 1);
 	allocResTypeData(rtScript, MKID('SCRP'), _numScripts, "script", 1);
 	allocResTypeData(rtCharset, MKID('CHAR'), _numCharsets, "charset", 1);

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- scumm.h	2 Jul 2002 20:57:27 -0000	1.174
+++ scumm.h	4 Jul 2002 15:48:17 -0000	1.175
@@ -248,8 +248,9 @@
 	rtMatrix = 14,
 	rtBox = 15,
 	rtObjectName = 16,
-	rtLast = 16,
-	rtNumTypes = 17
+	rtRoomScripts = 17,
+	rtLast = 17,
+	rtNumTypes = 18
 };
 
 enum {
@@ -449,8 +450,10 @@
 	GID_FT = 11,
 	GID_DIG = 12,
 	GID_MONKEY_VGA = 13,
+	GID_CMI = 14,
+
 	/* Simon the Sorcerer */
-	GID_SIMON_FIRST = 14,
+	GID_SIMON_FIRST = 20,
 	GID_SIMON_LAST = GID_SIMON_FIRST+3,
 };
 
@@ -476,7 +479,8 @@
 	GF_NO_SCALLING = 2048,
 	GF_ADLIB_DEFAULT = 4096,
 	GF_AMIGA = 8192,
-	GF_HUMONGOUS = 16384
+	GF_HUMONGOUS = 16384,
+	GF_AFTER_V8 = 32768
 };
 
 enum WhereIsObject {





More information about the Scummvm-git-logs mailing list