aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2011-04-26 09:25:25 +1000
committerPaul Gilbert2011-04-26 09:25:25 +1000
commit8fddf47e8ca5991b105d748304b64bf32c81c6de (patch)
tree52f9327d92d7043f91ee9b006ebcf64d88925293 /engines
parent09bf964807d35328a073fad3942a3e89f84c1ea6 (diff)
downloadscummvm-rg350-8fddf47e8ca5991b105d748304b64bf32c81c6de.tar.gz
scummvm-rg350-8fddf47e8ca5991b105d748304b64bf32c81c6de.tar.bz2
scummvm-rg350-8fddf47e8ca5991b105d748304b64bf32c81c6de.zip
TSAGE: Implemented scene priority changes introduced in Ringworld CD & Floppy Demo #2
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/core.cpp36
-rw-r--r--engines/tsage/core.h3
-rw-r--r--engines/tsage/detection_tables.h14
-rw-r--r--engines/tsage/tsage.h3
4 files changed, 39 insertions, 17 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 776e449c87..9118df2b15 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 85f4b420c1..4105c27ba4 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 df3814dd73..d165900d55 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 e5b92e09d0..06c66d8f42 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 {