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);
|
byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum);
|
||||||
assert(regionData);
|
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
|
// Set the region bounds
|
||||||
_bounds.top = READ_LE_UINT16(regionData + 6);
|
_bounds.top = READ_LE_UINT16(regionData + 6);
|
||||||
_bounds.left = READ_LE_UINT16(regionData + 8);
|
_bounds.left = READ_LE_UINT16(regionData + 8);
|
||||||
|
@ -2689,8 +2700,6 @@ Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
|
||||||
|
|
||||||
_ySlices.push_back(sliceSet);
|
_ySlices.push_back(sliceSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE(regionData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3233,19 +3242,28 @@ void ScenePriorities::load(int resNum) {
|
||||||
_resNum = resNum;
|
_resNum = resNum;
|
||||||
clear();
|
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);
|
int regionCount = READ_LE_UINT16(regionData);
|
||||||
for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
|
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);
|
int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
|
||||||
|
|
||||||
push_back(Region(resNum, rlbNum, RES_PRIORITY));
|
push_back(Region(resNum, rlbNum, RES_PRIORITY));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEALLOCATE(regionData);
|
DEALLOCATE(regionData);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Region *ScenePriorities::find(int priority) {
|
Region *ScenePriorities::find(int priority) {
|
||||||
// If no priority regions are loaded, then return the placeholder region
|
// If no priority regions are loaded, then return the placeholder region
|
||||||
|
@ -3255,7 +3273,7 @@ Region *ScenePriorities::find(int priority) {
|
||||||
if (priority > 255)
|
if (priority > 255)
|
||||||
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;
|
int minRegionId = 9998;
|
||||||
Region *region = NULL;
|
Region *region = NULL;
|
||||||
for (ScenePriorities::iterator i = begin(); i != end(); ++i) {
|
for (ScenePriorities::iterator i = begin(); i != end(); ++i) {
|
||||||
|
|
|
@ -635,6 +635,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class Region {
|
class Region {
|
||||||
|
private:
|
||||||
|
void load(const byte *regionData);
|
||||||
public:
|
public:
|
||||||
int _regionSize;
|
int _regionSize;
|
||||||
int _regionId;
|
int _regionId;
|
||||||
|
@ -643,6 +645,7 @@ public:
|
||||||
public:
|
public:
|
||||||
Region() { _regionSize = 0; _regionId = 0; }
|
Region() { _regionSize = 0; _regionId = 0; }
|
||||||
Region(int resNum, int rlbNum, ResourceType ctlType = RES_CONTROL);
|
Region(int resNum, int rlbNum, ResourceType ctlType = RES_CONTROL);
|
||||||
|
Region(int regionId, const byte *regionData);
|
||||||
|
|
||||||
bool contains(const Common::Point &pt);
|
bool contains(const Common::Point &pt);
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
|
@ -39,7 +39,7 @@ static const tSageGameDescription gameDescriptions[] = {
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE
|
||||||
},
|
},
|
||||||
GType_Ringworld,
|
GType_Ringworld,
|
||||||
GF_CD
|
GF_CD | GF_ALT_REGIONS
|
||||||
},
|
},
|
||||||
// Ringworld First Wave English CD version
|
// Ringworld First Wave English CD version
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ static const tSageGameDescription gameDescriptions[] = {
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE
|
||||||
},
|
},
|
||||||
GType_Ringworld,
|
GType_Ringworld,
|
||||||
GF_CD
|
GF_CD | GF_ALT_REGIONS
|
||||||
},
|
},
|
||||||
// Ringworld English Floppy version
|
// Ringworld English Floppy version
|
||||||
{
|
{
|
||||||
|
@ -69,21 +69,7 @@ static const tSageGameDescription gameDescriptions[] = {
|
||||||
GType_Ringworld,
|
GType_Ringworld,
|
||||||
GF_FLOPPY
|
GF_FLOPPY
|
||||||
},
|
},
|
||||||
// Ringworld English Floppy Demo version
|
// Ringworld English Floppy Demo #1 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
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"ring",
|
"ring",
|
||||||
|
@ -97,6 +83,20 @@ static const tSageGameDescription gameDescriptions[] = {
|
||||||
GType_Ringworld,
|
GType_Ringworld,
|
||||||
GF_FLOPPY | GF_DEMO
|
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
|
// Blue Force
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,8 @@ enum {
|
||||||
enum {
|
enum {
|
||||||
GF_DEMO = 1 << 0,
|
GF_DEMO = 1 << 0,
|
||||||
GF_CD = 1 << 1,
|
GF_CD = 1 << 1,
|
||||||
GF_FLOPPY = 1 << 2
|
GF_FLOPPY = 1 << 2,
|
||||||
|
GF_ALT_REGIONS = 1 << 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue