TSAGE: Implemented scene priority changes introduced in Ringworld CD & Floppy Demo #2
This commit is contained in:
parent
09bf964807
commit
8fddf47e8c
4 changed files with 49 additions and 27 deletions
|
@ -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,19 +3242,28 @@ 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Region *ScenePriorities::find(int priority) {
|
||||
// If no priority regions are loaded, then return the placeholder region
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,21 +69,7 @@ static const tSageGameDescription gameDescriptions[] = {
|
|||
GType_Ringworld,
|
||||
GF_FLOPPY
|
||||
},
|
||||
// Ringworld English Floppy Demo version
|
||||
{
|
||||
{
|
||||
"ring",
|
||||
"Floppy Demo",
|
||||
AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformPC,
|
||||
ADGF_DEMO,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GType_Ringworld,
|
||||
GF_FLOPPY | GF_DEMO
|
||||
},
|
||||
// Ringworld English Floppy Demo Alt version
|
||||
// Ringworld English Floppy Demo #1 version
|
||||
{
|
||||
{
|
||||
"ring",
|
||||
|
@ -97,6 +83,20 @@ static const tSageGameDescription gameDescriptions[] = {
|
|||
GType_Ringworld,
|
||||
GF_FLOPPY | GF_DEMO
|
||||
},
|
||||
// Ringworld English Floppy Demo #2 version
|
||||
{
|
||||
{
|
||||
"ring",
|
||||
"Floppy Demo",
|
||||
AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformPC,
|
||||
ADGF_DEMO,
|
||||
Common::GUIO_NONE
|
||||
},
|
||||
GType_Ringworld,
|
||||
GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS
|
||||
},
|
||||
|
||||
// Blue Force
|
||||
{
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue