[Scummvm-cvs-logs] scummvm master -> 8fddf47e8ca5991b105d748304b64bf32c81c6de

dreammaster dreammaster at scummvm.org
Tue Apr 26 01:27:12 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8fddf47e8c TSAGE: Implemented scene priority changes introduced in Ringworld CD & Floppy Demo #2


Commit: 8fddf47e8ca5991b105d748304b64bf32c81c6de
    https://github.com/scummvm/scummvm/commit/8fddf47e8ca5991b105d748304b64bf32c81c6de
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-04-25T16:25:25-07:00

Commit Message:
TSAGE: Implemented scene priority changes introduced in Ringworld CD & Floppy Demo #2

Changed paths:
    engines/tsage/core.cpp
    engines/tsage/core.h
    engines/tsage/detection_tables.h
    engines/tsage/tsage.h



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 776e449..9118df2 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2667,6 +2667,17 @@ Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
 	byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum);
 	assert(regionData);
 
+	load(regionData);
+
+	DEALLOCATE(regionData);
+}
+
+Region::Region(int regionId, const byte *regionData) {
+	_regionId = regionId;
+	load(regionData);
+}
+
+void Region::load(const byte *regionData) {
 	// Set the region bounds
 	_bounds.top = READ_LE_UINT16(regionData + 6);
 	_bounds.left = READ_LE_UINT16(regionData + 8);
@@ -2689,8 +2700,6 @@ Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
 
 		_ySlices.push_back(sliceSet);
 	}
-
-	DEALLOCATE(regionData);
 }
 
 /**
@@ -3233,18 +3242,27 @@ void ScenePriorities::load(int resNum) {
 	_resNum = resNum;
 	clear();
 
-	byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, 9999, true);
+	bool altMode = (_vm->getFeatures() & GF_ALT_REGIONS) != 0;
+	byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, altMode ? 1 : 9999, true);
+	if (!regionData)
+		return;
 
-	if (regionData) {
-		int regionCount = READ_LE_UINT16(regionData);
-		for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
+	int regionCount = READ_LE_UINT16(regionData);
+	for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
+		if (altMode) {
+			// Region data is embedded within the resource
+			uint16 regionId = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
+			uint32 dataOffset = READ_LE_UINT32(regionData + regionCtr * 6 + 4);
+			push_back(Region(regionId, regionData + dataOffset));
+		} else {
+			// The data contains the index of another resource containing the region data
 			int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
 
 			push_back(Region(resNum, rlbNum, RES_PRIORITY));
 		}
-
-		DEALLOCATE(regionData);
 	}
+
+	DEALLOCATE(regionData);
 }
 
 Region *ScenePriorities::find(int priority) {
@@ -3255,7 +3273,7 @@ Region *ScenePriorities::find(int priority) {
 	if (priority > 255)
 		priority = 255;
 
-	// Loop through the regions to find the closest for the givne priority level
+	// Loop through the regions to find the closest for the given priority level
 	int minRegionId = 9998;
 	Region *region = NULL;
 	for (ScenePriorities::iterator i = begin(); i != end(); ++i) {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 85f4b42..4105c27 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -635,6 +635,8 @@ public:
 };
 
 class Region {
+private:
+	void load(const byte *regionData);
 public:
 	int _regionSize;
 	int _regionId;
@@ -643,6 +645,7 @@ public:
 public:
 	Region() { _regionSize = 0; _regionId = 0; }
 	Region(int resNum, int rlbNum, ResourceType ctlType = RES_CONTROL);
+	Region(int regionId, const byte *regionData);
 
 	bool contains(const Common::Point &pt);
 	bool empty() const;
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index df3814d..d165900 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -39,7 +39,7 @@ static const tSageGameDescription gameDescriptions[] = {
 			Common::GUIO_NONE
 		},
 		GType_Ringworld,
-		GF_CD
+		GF_CD | GF_ALT_REGIONS
 	},
 	// Ringworld First Wave English CD version
 	{
@@ -53,7 +53,7 @@ static const tSageGameDescription gameDescriptions[] = {
 			Common::GUIO_NONE
 		},
 		GType_Ringworld,
-		GF_CD
+		GF_CD | GF_ALT_REGIONS
 	},
 	// Ringworld English Floppy version
 	{
@@ -69,12 +69,12 @@ static const tSageGameDescription gameDescriptions[] = {
 		GType_Ringworld,
 		GF_FLOPPY
 	},
-	// Ringworld English Floppy Demo version
+	// Ringworld English Floppy Demo #1 version
 	{
 		{
 			"ring",
 			"Floppy Demo",
-			AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206),
+			AD_ENTRY1s("tsage.rlb", "bf4e8525d0cab84b08b57126092eeacd", 833453),
 			Common::EN_ANY,
 			Common::kPlatformPC,
 			ADGF_DEMO,
@@ -83,19 +83,19 @@ static const tSageGameDescription gameDescriptions[] = {
 		GType_Ringworld,
 		GF_FLOPPY | GF_DEMO
 	},
-	// Ringworld English Floppy Demo Alt version
+	// Ringworld English Floppy Demo #2 version
 	{
 		{
 			"ring",
 			"Floppy Demo",
-			AD_ENTRY1s("tsage.rlb", "bf4e8525d0cab84b08b57126092eeacd", 833453),
+			AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206),
 			Common::EN_ANY,
 			Common::kPlatformPC,
 			ADGF_DEMO,
 			Common::GUIO_NONE
 		},
 		GType_Ringworld,
-		GF_FLOPPY | GF_DEMO
+		GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS
 	},
 
 	// Blue Force
diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h
index e5b92e0..06c66d8 100644
--- a/engines/tsage/tsage.h
+++ b/engines/tsage/tsage.h
@@ -50,7 +50,8 @@ enum {
 enum {
 	GF_DEMO = 1 << 0,
 	GF_CD = 1 << 1,
-	GF_FLOPPY = 1 << 2
+	GF_FLOPPY = 1 << 2,
+	GF_ALT_REGIONS = 1 << 3
 };
 
 enum {






More information about the Scummvm-git-logs mailing list