[Scummvm-cvs-logs] SF.net SVN: scummvm:[43742] scummvm/trunk/engines/sci

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Aug 26 01:02:57 CEST 2009


Revision: 43742
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43742&view=rev
Author:   mthreepwood
Date:     2009-08-25 23:02:57 +0000 (Tue, 25 Aug 2009)

Log Message:
-----------
- Split SCI_VERSION_32 into SCI_VERSION_2, SCI_VERSION_2_1, and SCI_VERSION_3 (each version has a different kernel table).
- Improve map detection.
- Fix SCI32 object and script initialization (Torin's Passage and GK1 scripts now start up, and probably most SCI2/2.1 games).
- Add SCI2 and SCI2.1 kernel tables.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/detection.cpp
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/module.mk
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/resource.h
    scummvm/trunk/engines/sci/sci.cpp

Added Paths:
-----------
    scummvm/trunk/engines/sci/engine/kernel32.cpp

Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/detection.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -353,7 +353,7 @@
 #ifndef ENABLE_SCI32
 	// Is SCI32 compiled in? If not, and this is a SCI32 game,
 	// stop here
-	if (resourceManager->sciVersion() == SCI_VERSION_32) {
+	if (resourceManager->sciVersion() >= SCI_VERSION_2) {
 		SearchMan.remove("SCI_detection");
 		delete resourceManager;
 		return (const ADGameDescription *)&s_fallbackDesc;

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -335,6 +335,7 @@
 	DEFUN("SetVideoMode", kSetVideoMode, "i"),
 
 	// Special and NOP stuff
+	DEFUN("Dummy", kStub, ".*"),
 	{NULL, k_Unknown, NULL},
 
 	// Stub functions
@@ -817,36 +818,17 @@
 	}
 }
 
-#ifdef ENABLE_SCI32
-//static void vocab_get_knames11(ResourceManager *resourceManager, Common::StringList &names) {
-/*
- 999.voc format for SCI1.1 games:
-	[b] # of kernel functions
-	[w] unknown
-	[offset to function name info]
-		...
-    {[w name-len][function name]}
-		...
-*/
-/*	//unsigned int size = 64, pos = 3;
-	int len;
-	Resource *r = resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES), 0);
-	if(r == NULL) // failed to open vocab.999 (happens with SCI1 demos)
-		return; // FIXME: should return a default table for this engine
-	const byte nCnt = *r->data;
-
-	names.resize(nCnt);
-	for (int i = 0; i < nCnt; i++) {
-		int off = READ_LE_UINT16(r->data + 2 * i + 2);
-		len = READ_LE_UINT16(r->data + off);
-		names[i] = Common::String((char *)r->data + off + 2, len);
-	}
-}*/
-#endif
-
 bool Kernel::loadKernelNames() {
 	_kernelNames.clear();
-	setDefaultKernelNames();
+	
+#ifdef ENABLE_SCI32
+	if (_resourceManager->sciVersion() == SCI_VERSION_2)
+		setKernelNamesSci2();
+	else if (_resourceManager->sciVersion() == SCI_VERSION_2_1)
+		setKernelNamesSci21();
+	else
+#endif
+		setDefaultKernelNames();
 	return true;
 }
 

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2009-08-25 23:02:57 UTC (rev 43742)
@@ -134,6 +134,18 @@
 	 * Sets the default kernel function names, based on the SCI version used
 	 */
 	void setDefaultKernelNames();
+	
+#ifdef ENABLE_SCI32
+	/**
+	 * Sets the default kernel function names to the SCI2 kernel functions
+	 */
+	void setKernelNamesSci2();
+	
+	/**
+	 * Sets the default kernel function names to the SCI2.1 kernel functions
+	 */
+	void setKernelNamesSci21();
+#endif
 
 	/**
 	 * Loads the kernel selector names.

Added: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -0,0 +1,359 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "sci/engine/kernel.h"
+
+namespace Sci {
+
+static const char *sci2_default_knames[] = {
+	/*0x00*/ "Load",
+	/*0x01*/ "UnLoad",
+	/*0x02*/ "ScriptID",
+	/*0x03*/ "DisposeScript",
+	/*0x04*/ "Lock",
+	/*0x05*/ "ResCheck",
+	/*0x06*/ "Purge",
+	/*0x07*/ "Clone",
+	/*0x08*/ "DisposeClone",
+	/*0x09*/ "RespondsTo",
+	/*0x0a*/ "SetNowSeen",
+	/*0x0b*/ "NumLoops",
+	/*0x0c*/ "NumCels",
+	/*0x0d*/ "CelWide",
+	/*0x0e*/ "CelHigh",
+	/*0x0f*/ "GetHighPlanePri",
+	/*0x10*/ "GetHighItemPri",
+	/*0x11*/ "ShakeScreen",
+	/*0x12*/ "OnMe",
+	/*0x13*/ "ShowMovie",
+	/*0x14*/ "SetVideoMode",
+	/*0x15*/ "AddScreenItem",
+	/*0x16*/ "DeleteScreenItem",
+	/*0x17*/ "UpdateScreenItem",
+	/*0x18*/ "FrameOut",
+	/*0x19*/ "AddPlane",
+	/*0x1a*/ "DeletePlane",
+	/*0x1b*/ "UpdatePlane",
+	/*0x1c*/ "RepaintPlane",
+	/*0x1d*/ "SetShowStyle",
+	/*0x1e*/ "ShowStylePercent",
+	/*0x1f*/ "SetScroll",
+	/*0x20*/ "AddMagnify",
+	/*0x21*/ "DeleteMagnify",
+	/*0x22*/ "IsHiRes",
+	/*0x23*/ "Graph",
+	/*0x24*/ "InvertRect",
+	/*0x25*/ "TextSize",
+	/*0x26*/ "Message",
+	/*0x27*/ "TextColors",
+	/*0x28*/ "TextFonts",
+	/*0x29*/ "Dummy",
+	/*0x2a*/ "SetQuitStr",		 
+	/*0x2b*/ "EditText",
+	/*0x2c*/ "InputText",
+	/*0x2d*/ "CreateTextBitmap",
+	/*0x2e*/ "DisposeTextBitmap",
+	/*0x2f*/ "GetEvent",
+	/*0x30*/ "GlobalToLocal",
+	/*0x31*/ "LocalToGlobal",
+	/*0x32*/ "MapKeyToDir",
+	/*0x33*/ "HaveMouse",
+	/*0x34*/ "SetCursor",
+	/*0x35*/ "VibrateMouse",
+	/*0x36*/ "SaveGame",
+	/*0x37*/ "RestoreGame",
+	/*0x38*/ "RestartGame",
+	/*0x39*/ "GameIsRestarting",
+	/*0x3a*/ "MakeSaveCatName",
+	/*0x3b*/ "MakeSaveFileName",
+	/*0x3c*/ "GetSaveFiles",
+	/*0x3d*/ "GetSaveDir",
+	/*0x3e*/ "CheckSaveGame",
+	/*0x3f*/ "CheckFreeSpace",
+	/*0x40*/ "DoSound",
+	/*0x41*/ "DoAudio",
+	/*0x42*/ "DoSync",
+	/*0x43*/ "NewList",
+	/*0x44*/ "DisposeList",
+	/*0x45*/ "NewNode",
+	/*0x46*/ "FirstNode",
+	/*0x47*/ "LastNode",
+	/*0x48*/ "EmptyList",
+	/*0x49*/ "NextNode",
+	/*0x4a*/ "PrevNode",
+	/*0x4b*/ "NodeValue",
+	/*0x4c*/ "AddAfter",
+	/*0x4d*/ "AddToFront",
+	/*0x4e*/ "AddToEnd",
+	/*0x4f*/ "Dummy",
+	/*0x50*/ "Dummy",
+	/*0x51*/ "FindKey",
+	/*0x52*/ "Dummy",
+	/*0x53*/ "Dummy",
+	/*0x54*/ "Dummy",
+	/*0x55*/ "DeleteKey",
+	/*0x56*/ "Dummy",
+	/*0x57*/ "Dummy",
+	/*0x58*/ "ListAt",
+	/*0x59*/ "ListIndexOf",
+	/*0x5a*/ "ListEachElementDo",
+	/*0x5b*/ "ListFirstTrue",
+	/*0x5c*/ "ListAllTrue",
+	/*0x5d*/ "Random",
+	/*0x5e*/ "Abs",
+	/*0x5f*/ "Sqrt",
+	/*0x60*/ "GetAngle",
+	/*0x61*/ "GetDistance",
+	/*0x62*/ "ATan",
+	/*0x63*/ "SinMult",
+	/*0x64*/ "CosMult",
+	/*0x65*/ "SinDiv",
+	/*0x66*/ "CosDiv",
+	/*0x67*/ "GetTime",
+	/*0x68*/ "Platform",
+	/*0x69*/ "BaseSetter",
+	/*0x6a*/ "DirLoop",
+	/*0x6b*/ "CanBeHere",
+	/*0x6c*/ "InitBresen",
+	/*0x6d*/ "DoBresen",
+	/*0x6e*/ "SetJump",
+	/*0x6f*/ "AvoidPath",
+	/*0x70*/ "InPolygon",
+	/*0x71*/ "MergePoly",
+	/*0x72*/ "Dummy",
+	/*0x73*/ "Dummy",
+	/*0x74*/ "Dummy",
+	/*0x75*/ "Dummy",
+	/*0x76*/ "Dummy",
+	/*0x77*/ "Dummy",
+	/*0x78*/ "Dummy",
+	/*0x79*/ "Dummy",
+	/*0x7a*/ "GetCWD",
+	/*0x7b*/ "ValidPath",
+	/*0x7c*/ "FileIO",
+	/*0x7d*/ "Dummy",
+	/*0x7e*/ "DeviceInfo",
+	/*0x7f*/ "Palette",
+	/*0x80*/ "PalVary",
+	/*0x81*/ "PalCycle",
+	/*0x82*/ "Array",
+	/*0x83*/ "String",
+	/*0x84*/ "RemapColors",
+	/*0x85*/ "Dummy",
+	/*0x86*/ "Dummy",
+	/*0x87*/ "ObjectIntersect",
+	/*0x88*/ "Dummy"
+	/*0x89*/ "TextWidth",
+	/*0x8a*/ "PointSize"
+};
+
+static const char *sci21_default_knames[] = {
+	/*0x00*/ "LNew",
+	/*0x01*/ "LDispose",
+	/*0x02*/ "LNewNode",
+	/*0x03*/ "LFirstNode",
+	/*0x04*/ "LLastNode",
+	/*0x05*/ "LEmpty",
+	/*0x06*/ "LNextNode",
+	/*0x07*/ "LPrevNode",
+	/*0x08*/ "LNodeValue",
+	/*0x09*/ "LAddAfter",
+	/*0x0a*/ "LAddToFront",
+	/*0x0b*/ "LAddToEnd",
+	/*0x0c*/ "LAddBefore",
+	/*0x0d*/ "LMoveToFront",
+	/*0x0e*/ "LMoveToEnd",
+	/*0x0f*/ "LFindKey",
+	/*0x10*/ "LDeleteKey",
+	/*0x11*/ "LAt",
+	/*0x12*/ "LIndexOf",
+	/*0x13*/ "LEachElementDo",
+	/*0x14*/ "LFirstTrue",
+	/*0x15*/ "LAllTrue",
+	/*0x16*/ "LSort",
+	/*0x17*/ "Load",
+	/*0x18*/ "UnLoad",
+	/*0x19*/ "ScriptID",
+	/*0x1a*/ "DisposeScript",
+	/*0x1b*/ "Lock",
+	/*0x1c*/ "ResCheck",
+	/*0x1d*/ "Purge",
+	/*0x1e*/ "SetLanguage",
+	/*0x1f*/ "Dummy",
+	/*0x20*/ "Dummy",
+	/*0x21*/ "Clone",
+	/*0x22*/ "DisposeClone",
+	/*0x23*/ "RespondsTo",
+	/*0x24*/ "FindSelector",
+	/*0x25*/ "FindClass",
+	/*0x26*/ "Dummy",
+	/*0x27*/ "Dummy",
+	/*0x28*/ "Dummy",
+	/*0x29*/ "Dummy",
+	/*0x2a*/ "Dummy",
+	/*0x2b*/ "SetNowSeen",
+	/*0x2c*/ "NumLoops",
+	/*0x2d*/ "NumCels",
+	/*0x2e*/ "IsOnMe",
+	/*0x2f*/ "AddMagnify",
+	/*0x30*/ "DeleteMagnify",
+	/*0x31*/ "CelRect",
+	/*0x32*/ "BaseLineSpan"
+	/*0x33*/ "CelWide",
+	/*0x34*/ "CelHigh",
+	/*0x35*/ "AddScreenItem",
+	/*0x36*/ "DeleteScreenItem",
+	/*0x37*/ "UpdateScreenItem",
+	/*0x38*/ "FrameOut",
+	/*0x39*/ "CelInfo",
+	/*0x3a*/ "Bitmap",
+	/*0x3b*/ "CelLink",
+	/*0x3c*/ "Dummy",
+	/*0x3d*/ "Dummy",
+	/*0x3e*/ "Dummy",
+	/*0x3f*/ "AddPlane",
+	/*0x40*/ "DeletePlane",
+	/*0x41*/ "UpdatePlane",
+	/*0x42*/ "RepaintPlane",
+	/*0x43*/ "GetHighPlanePri",
+	/*0x44*/ "GetHighItemPri",
+	/*0x45*/ "SetShowStyle",
+	/*0x46*/ "ShowStylePercent",
+	/*0x47*/ "SetScroll",
+	/*0x48*/ "MovePlaneItems",
+	/*0x49*/ "ShakeScreen",
+	/*0x4a*/ "Dummy",
+	/*0x4b*/ "Dummy",
+	/*0x4c*/ "Dummy",
+	/*0x4d*/ "Dummy",
+	/*0x4e*/ "IsHiRes",
+	/*0x4f*/ "SetVideoMode",
+	/*0x50*/ "ShowMovie",
+	/*0x51*/ "Robot",
+	/*0x52*/ "CreateTextBitmap",
+	/*0x53*/ "Random",
+	/*0x54*/ "Abs",
+	/*0x55*/ "Sqrt",
+	/*0x56*/ "GetAngle",
+	/*0x57*/ "GetDistance",
+	/*0x58*/ "ATan",
+	/*0x59*/ "SinMult",
+	/*0x5a*/ "CosMult",
+	/*0x5b*/ "SinDiv",
+	/*0x5c*/ "CosDiv",
+	/*0x5d*/ "Text",
+	/*0x5e*/ "Dummy",
+	/*0x5f*/ "Message",
+	/*0x60*/ "Font",
+	/*0x61*/ "EditText",
+	/*0x62*/ "InputText",
+	/*0x63*/ "ScrollWindow",
+	/*0x64*/ "Dummy",
+	/*0x65*/ "Dummy",
+	/*0x66*/ "Dummy",
+	/*0x67*/ "GetEvent",
+	/*0x68*/ "GlobalToLocal",
+	/*0x69*/ "LocalToGlobal",
+	/*0x6a*/ "MapKeyToDir",
+	/*0x6b*/ "HaveMouse",
+	/*0x6c*/ "SetCursor",
+	/*0x6d*/ "VibrateMouse",
+	/*0x6e*/ "Dummy",
+	/*0x6f*/ "Dummy",
+	/*0x70*/ "Dummy",
+	/*0x71*/ "Array",
+	/*0x72*/ "String",
+	/*0x73*/ "FileIO",
+	/*0x74*/ "BaseSetter",
+	/*0x75*/ "DirLoop",
+	/*0x76*/ "CanBeHere",
+	/*0x77*/ "InitBresen",
+	/*0x78*/ "DoBresen",
+	/*0x79*/ "SetJump",
+	/*0x7a*/ "AvoidPath",
+	/*0x7b*/ "InPolygon",
+	/*0x7c*/ "MergePoly",
+	/*0x7d*/ "ObjectIntersect",
+	/*0x7e*/ "Dummy",
+	/*0x7f*/ "MemoryInfo",
+	/*0x80*/ "DeviceInfo",
+	/*0x81*/ "Palette",
+	/*0x82*/ "PalVary",
+	/*0x83*/ "PalCycle",
+	/*0x84*/ "RemapColors",
+	/*0x85*/ "AddLine",
+	/*0x86*/ "DeleteLine",
+	/*0x87*/ "UpdateLine",
+	/*0x88*/ "AddPolygon",
+	/*0x89*/ "DeletePolygon",
+	/*0x8a*/ "UpdatePolygon",
+	/*0x8b*/ "DoSound",
+	/*0x8c*/ "DoAudio",
+	/*0x8d*/ "DoSync",
+	/*0x8e*/ "Save",
+	/*0x8f*/ "GetTime",
+	/*0x90*/ "Platform",
+	/*0x91*/ "CD",
+	/*0x92*/ "SetQuitStr",
+	/*0x93*/ "GetConfig",
+	/*0x94*/ "Table",
+	/*0x95*/ "Dummy",
+	/*0x96*/ "Dummy",
+	/*0x97*/ "Dummy",
+	/*0x98*/ "Dummy",
+	/*0x99*/ "Dummy",
+	/*0x9a*/ "Dummy",
+	/*0x9b*/ "Dummy",
+	/*0x9c*/ "Dummy",
+	/*0x9d*/ "Dummy",
+	/*0x9e*/ "Dummy",
+	/*0x9f*/ "Dummy",
+	/*0xa0*/ "LoadChunk",
+	/*0xa1*/ "SetPalStyleRange"
+	/*0xa2*/ "AddPicAt",
+	/*0xa3*/ "Dummy",
+	/*0xa4*/ "NewRoom",
+	/*0xa5*/ "Dummy",
+	/*0xa6*/ "Priority",
+	/*0xa7*/ "MorphOn",
+	/*0xa8*/ "PlayVMD",
+	/*0xa9*/ "SetHotRectangles",
+	/*0xaa*/ "MulDiv",
+	/*0xab*/ "Dummy",
+	/*0xac*/ "Dummy",
+	/*0xad*/ "Dummy",
+	/*0xae*/ "Dummy",
+	/*0xaf*/ "Dummy"
+};
+
+void Kernel::setKernelNamesSci2() {
+	_kernelNames = Common::StringList(sci2_default_knames, ARRAYSIZE(sci2_default_knames));
+}
+
+void Kernel::setKernelNamesSci21() {
+	_kernelNames = Common::StringList(sci21_default_knames, ARRAYSIZE(sci21_default_knames));
+}
+
+} // End of namespace Sci


Property changes on: scummvm/trunk/engines/sci/engine/kernel32.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -327,7 +327,7 @@
 		return 0;
 	}
 	block[idx].segment = segment; // Perform relocation
-	if (_resourceManager->sciVersion() == SCI_VERSION_1_1)
+	if (_resourceManager->sciVersion() >= SCI_VERSION_1_1)
 		block[idx].offset += getScript(segment)->script_size;
 
 	return 1;
@@ -589,7 +589,7 @@
 }
 
 Object *SegManager::scriptObjInit(reg_t obj_pos) {
-	if (_resourceManager->sciVersion() != SCI_VERSION_1_1)
+	if (_resourceManager->sciVersion() < SCI_VERSION_1_1)
 		return scriptObjInit0(obj_pos);
 	else
 		return scriptObjInit11(obj_pos);
@@ -633,7 +633,7 @@
 
 	VERIFY(location.offset + 1 < (uint16)scr->buf_size, "Locals beyond end of script\n");
 
-	if (_resourceManager->sciVersion() == SCI_VERSION_1_1)
+	if (_resourceManager->sciVersion() >= SCI_VERSION_1_1)
 		count = READ_LE_UINT16(scr->buf + location.offset - 2);
 	else
 		count = (READ_LE_UINT16(scr->buf + location.offset - 2) - 4) >> 1;

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -61,7 +61,7 @@
 	} else if (_resourceManager->sciVersion() == SCI_VERSION_1_1) {
 		debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n");
 #ifdef ENABLE_SCI32
-	} else if (_resourceManager->sciVersion() == SCI_VERSION_32) {
+	} else if (_resourceManager->sciVersion() >= SCI_VERSION_2) {
 		debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n");
 #endif
 	} else {

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/module.mk	2009-08-25 23:02:57 UTC (rev 43742)
@@ -66,6 +66,11 @@
 	sfx/softseq/adlib.o \
 	sfx/softseq/amiga.o \
 	sfx/softseq/pcjr.o
+	
+ifdef ENABLE_SCI32
+MODULE_OBJS += \
+	engine/kernel32.o 
+endif
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_SCI), DYNAMIC_PLUGIN)

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -752,14 +752,14 @@
 		// Only SCI32 has directory type < 0x80
 		if (directoryType < 0x80 && (mapDetected == kResVersionUnknown || mapDetected == kResVersionSci32))
 			mapDetected = kResVersionSci32;
-		else if ((directoryType < 0x80) || (directoryType > 0xA0 && directoryType != 0xFF))
+		else if (directoryType < 0x80 || ((directoryType & 0x7f) > 0x20 && directoryType != 0xFF))
 			break;
 		
 		// Offset is above file size? -> definitely not SCI1/SCI1.1
 		if (directoryOffset > fileStream->size())
 			break;
 
-		if (lastDirectoryOffset) {
+		if (lastDirectoryOffset && mapDetected == kResVersionUnknown) {
 			directorySize = directoryOffset - lastDirectoryOffset;
 			if ((directorySize % 5) && (directorySize % 6 == 0))
 				mapDetected = kResVersionSci1Late;
@@ -1380,7 +1380,7 @@
 		break;
 #ifdef ENABLE_SCI32
 	case kResVersionSci32:
-		type = (ResourceType)(file->readByte() &0x7F);
+		type = (ResourceType)(file->readByte() & 0x7F);
 		number = file->readUint16LE();
 		szPacked = file->readUint32LE();
 		szUnpacked = file->readUint32LE();
@@ -1587,13 +1587,25 @@
 	}
 
 	// Set view type
-	if (viewCompression == kCompDCL) {
+	if (viewCompression == kCompDCL || viewCompression == kCompSTACpack) {
 		// SCI1.1 VGA views
 		_viewType = kViewVga11;
 	} else {
 		// Otherwise we detect it from a view
 		_viewType = detectViewType();
 	}
+	
+	// Handle SCI32 versions here
+	if (_volVersion == kResVersionSci32) {
+		// SCI2.1/3 and SCI1 Late resource maps are the same, except that
+		// SCI1 Late resource maps have the resource types or'd with
+		// 0x80. We differentiate between SCI2 and SCI2.1/3 based on that.
+		// TODO: Differentiate between SCI2.1 and SCI3
+		if (_mapVersion == kResVersionSci1Late)
+			return SCI_VERSION_2;
+		else
+			return SCI_VERSION_2_1;
+	}
 
 	switch (_mapVersion) {
 	case kResVersionSci0Sci1Early:
@@ -1649,8 +1661,6 @@
 		return SCI_VERSION_1_LATE;
 	case kResVersionSci11:
 		return SCI_VERSION_1_1;
-	case kResVersionSci32:
-		return SCI_VERSION_32;
 	default:
 		return SCI_VERSION_AUTODETECT;
 	}

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/resource.h	2009-08-25 23:02:57 UTC (rev 43742)
@@ -58,7 +58,9 @@
 	SCI_VERSION_1_MIDDLE, // LSL1, JONESCD. (EGA?/VGA)
 	SCI_VERSION_1_LATE, // ECO1, LSL5. (EGA/VGA)
 	SCI_VERSION_1_1, // KQ6, ECO2
-	SCI_VERSION_32 // GK
+	SCI_VERSION_2, // GK1, PQ4 (Floppy), QFG4 (Floppy)
+	SCI_VERSION_2_1, // GK2, KQ7, SQ6, Torin
+	SCI_VERSION_3 // LSL7, RAMA, Lighthouse
 };
 
 /** Resource status types */

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-08-25 22:41:37 UTC (rev 43741)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-08-25 23:02:57 UTC (rev 43742)
@@ -44,7 +44,7 @@
 class GfxDriver;
 
 // FIXME: error-prone
-const char *versionNames[10] = {
+const char *versionNames[] = {
 	"Autodetect",
 	"SCI0 Early",
 	"SCI0 Late",
@@ -54,7 +54,9 @@
 	"SCI1 Middle",
 	"SCI1 Late",
 	"SCI1.1",
-	"SCI32"
+	"SCI2",
+	"SCI2.1",
+	"SCI3"
 };
 
 SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc)


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