Skip to content

Commit

Permalink
TSAGE: Added missing code for loading scene regions in the CD/FW vers…
Browse files Browse the repository at this point in the history
…ions of the game
  • Loading branch information
dreammaster committed May 11, 2011
1 parent bfc9414 commit 0c3c0f2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions engines/tsage/core.cpp
Expand Up @@ -2914,15 +2914,22 @@ void Region::uniteRect(const Rect &rect) {

void SceneRegions::load(int sceneNum) {
clear();

byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, 9999, true);
bool altRegions = _vm->getFeatures() & GF_ALT_REGIONS;
byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, altRegions ? 1 : 9999, true);

if (regionData) {
int regionCount = READ_LE_UINT16(regionData);
for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
int regionId = READ_LE_UINT16(regionData + regionCtr * 6 + 2);

push_back(Region(sceneNum, rlbNum));
if (altRegions) {
// Load data from within this resource
uint32 dataOffset = READ_LE_UINT32(regionData + regionCtr * 6 + 4);
push_back(Region(regionId, regionData + dataOffset));
} else {
// Load region from a separate resource
push_back(Region(sceneNum, regionId));
}
}

DEALLOCATE(regionData);
Expand Down

0 comments on commit 0c3c0f2

Please sign in to comment.