ASYLUM: add support for Sanitarium Demo
This commit is contained in:
parent
99b334f90f
commit
2fd785c12c
14 changed files with 131 additions and 35 deletions
|
@ -119,7 +119,7 @@ Common::Error AsylumEngine::run() {
|
||||||
setDebugger(_console);
|
setDebugger(_console);
|
||||||
|
|
||||||
// Create resource manager
|
// Create resource manager
|
||||||
_resource = new ResourceManager();
|
_resource = new ResourceManager(this);
|
||||||
_resource->setCdNumber(1);
|
_resource->setCdNumber(1);
|
||||||
|
|
||||||
// Create all game classes
|
// Create all game classes
|
||||||
|
@ -137,10 +137,15 @@ Common::Error AsylumEngine::run() {
|
||||||
|
|
||||||
// Create main menu
|
// Create main menu
|
||||||
_menu = new Menu(this);
|
_menu = new Menu(this);
|
||||||
|
if (checkGameVersion("Demo")) {
|
||||||
|
_video->play(0, NULL);
|
||||||
|
restart();
|
||||||
|
} else {
|
||||||
_handler = _menu;
|
_handler = _menu;
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
Config.read();
|
Config.read();
|
||||||
|
}
|
||||||
|
|
||||||
// Setup mixer
|
// Setup mixer
|
||||||
syncSoundSettings();
|
syncSoundSettings();
|
||||||
|
@ -174,6 +179,7 @@ void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
|
||||||
error("[AsylumEngine::startGame] Subsystems not initialized properly!");
|
error("[AsylumEngine::startGame] Subsystems not initialized properly!");
|
||||||
|
|
||||||
// Load the default mouse cursor
|
// Load the default mouse cursor
|
||||||
|
if (!checkGameVersion("Demo"))
|
||||||
_cursor->set(MAKE_RESOURCE(kResourcePackSound, 14), 0, kCursorAnimationNone);
|
_cursor->set(MAKE_RESOURCE(kResourcePackSound, 14), 0, kCursorAnimationNone);
|
||||||
_cursor->hide();
|
_cursor->hide();
|
||||||
|
|
||||||
|
@ -298,13 +304,13 @@ void AsylumEngine::playIntro() {
|
||||||
if (!_introPlayed) {
|
if (!_introPlayed) {
|
||||||
_cursor->hide();
|
_cursor->hide();
|
||||||
_cursor->setForceHide(true);
|
_cursor->setForceHide(true);
|
||||||
if (!Config.showIntro) {
|
if (!Config.showIntro && !checkGameVersion("Demo")) {
|
||||||
if (_scene->worldstats()->chapter == kChapter1)
|
if (_scene->worldstats()->chapter == kChapter1)
|
||||||
_sound->playMusic(MAKE_RESOURCE(kResourcePackMusic, _scene->worldstats()->musicCurrentResourceIndex));
|
_sound->playMusic(MAKE_RESOURCE(kResourcePackMusic, _scene->worldstats()->musicCurrentResourceIndex));
|
||||||
} else {
|
} else {
|
||||||
_sound->playMusic(kResourceNone, 0);
|
_sound->playMusic(kResourceNone, 0);
|
||||||
|
|
||||||
_video->play(1, _menu);
|
_video->play(1, checkGameVersion("Demo") ? NULL : _menu);
|
||||||
|
|
||||||
if (_scene->worldstats()->musicCurrentResourceIndex != kMusicStopped)
|
if (_scene->worldstats()->musicCurrentResourceIndex != kMusicStopped)
|
||||||
_sound->playMusic(MAKE_RESOURCE(kResourcePackMusic, _scene->worldstats()->musicCurrentResourceIndex));
|
_sound->playMusic(MAKE_RESOURCE(kResourcePackMusic, _scene->worldstats()->musicCurrentResourceIndex));
|
||||||
|
@ -316,10 +322,10 @@ void AsylumEngine::playIntro() {
|
||||||
|
|
||||||
// Play the intro speech: it is played after the intro video over a black background,
|
// Play the intro speech: it is played after the intro video over a black background,
|
||||||
// and the game is "locked" until the speech is completed.
|
// and the game is "locked" until the speech is completed.
|
||||||
ResourceId introSpeech = MAKE_RESOURCE(kResourcePackSound, 7);
|
ResourceId introSpeech = MAKE_RESOURCE(checkGameVersion("Demo") ? kResourcePackShared : kResourcePackSound, 7);
|
||||||
_sound->playSound(introSpeech);
|
_sound->playSound(introSpeech);
|
||||||
|
|
||||||
int8 skip = 0;
|
bool skip = false;
|
||||||
do {
|
do {
|
||||||
// Poll events (this ensures we don't freeze the screen)
|
// Poll events (this ensures we don't freeze the screen)
|
||||||
Common::Event ev;
|
Common::Event ev;
|
||||||
|
@ -468,7 +474,7 @@ void AsylumEngine::processDelayedEvents() {
|
||||||
// Message handlers
|
// Message handlers
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void AsylumEngine::switchEventHandler(EventHandler *handler) {
|
void AsylumEngine::switchEventHandler(EventHandler *handler) {
|
||||||
if (handler == NULL)
|
if (handler == NULL && !checkGameVersion("Demo"))
|
||||||
warning("[AsylumEngine::switchMessageHandler] NULL handler parameter (shouldn't happen outside of debug commands)!");
|
warning("[AsylumEngine::switchMessageHandler] NULL handler parameter (shouldn't happen outside of debug commands)!");
|
||||||
|
|
||||||
// De-init previous handler
|
// De-init previous handler
|
||||||
|
|
|
@ -353,8 +353,9 @@ void PuzzleVCR::updateScreen(const AsylumEvent &) {
|
||||||
// setupPalette();
|
// setupPalette();
|
||||||
getScreen()->setupPalette(NULL, 0, 0);
|
getScreen()->setupPalette(NULL, 0, 0);
|
||||||
|
|
||||||
getScreen()->setPalette(MAKE_RESOURCE(kResourcePackTowerCells, 28));
|
int paletteId = _vm->checkGameVersion("Demo") ? 20 : 28;
|
||||||
getScreen()->setGammaLevel(MAKE_RESOURCE(kResourcePackTowerCells, 28));
|
getScreen()->setPalette(MAKE_RESOURCE(kResourcePackTowerCells, paletteId));
|
||||||
|
getScreen()->setGammaLevel(MAKE_RESOURCE(kResourcePackTowerCells, paletteId));
|
||||||
} else {
|
} else {
|
||||||
getScreen()->drawGraphicsInQueue();
|
getScreen()->drawGraphicsInQueue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,9 @@ void Actor::load(Common::SeekableReadStream *stream) {
|
||||||
for (int32 i = 0; i < 20; i++)
|
for (int32 i = 0; i < 20; i++)
|
||||||
_distancesNSEO[i] = stream->readSint32LE();
|
_distancesNSEO[i] = stream->readSint32LE();
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
return;
|
||||||
|
|
||||||
_actionIdx2 = stream->readSint32LE();
|
_actionIdx2 = stream->readSint32LE();
|
||||||
_field_924 = stream->readSint32LE();
|
_field_924 = stream->readSint32LE();
|
||||||
_lastScreenUpdate = stream->readUint32LE();
|
_lastScreenUpdate = stream->readUint32LE();
|
||||||
|
|
|
@ -101,6 +101,7 @@ Encounter::Encounter(AsylumEngine *engine) : _vm(engine),
|
||||||
_data_455BF0 = 0;
|
_data_455BF0 = 0;
|
||||||
_data_455BF4 = 0;
|
_data_455BF4 = 0;
|
||||||
_keywordStartIndex = 0;
|
_keywordStartIndex = 0;
|
||||||
|
_keywordsOffset = _vm->checkGameVersion("Demo") ? 204 : 3681;
|
||||||
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
@ -213,6 +214,13 @@ void Encounter::initPortraits() {
|
||||||
if (_portrait2.resourceId == kResourceInvalid && getWorld()->chapter == kChapter1)
|
if (_portrait2.resourceId == kResourceInvalid && getWorld()->chapter == kChapter1)
|
||||||
_portrait2.resourceId = getWorld()->graphicResourceIds[36];
|
_portrait2.resourceId = getWorld()->graphicResourceIds[36];
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
if (_index == 1)
|
||||||
|
_portrait2.resourceId = getWorld()->graphicResourceIds[35];
|
||||||
|
else
|
||||||
|
_portrait2.resourceId = getWorld()->graphicResourceIds[34];
|
||||||
|
}
|
||||||
|
|
||||||
if (_portrait2.resourceId == kResourceInvalid)
|
if (_portrait2.resourceId == kResourceInvalid)
|
||||||
error("[Encounter::initPortraits] No portrait 2 for this encounter!");
|
error("[Encounter::initPortraits] No portrait 2 for this encounter!");
|
||||||
|
|
||||||
|
@ -585,7 +593,7 @@ int32 Encounter::getKeywordIndex() {
|
||||||
int32 x = _drawingStructs[0].point1.y + 145 * (counter % 3) + _point.x + _portrait1.rect.width() + 15;
|
int32 x = _drawingStructs[0].point1.y + 145 * (counter % 3) + _point.x + _portrait1.rect.width() + 15;
|
||||||
int32 y = 16 * (counter / 3) + _point.y + 5;
|
int32 y = 16 * (counter / 3) + _point.y + 5;
|
||||||
|
|
||||||
if (mousePos.x >= x && mousePos.x <= (x + getText()->getWidth(MAKE_RESOURCE(kResourcePackText, 3681 + (_item->keywords[index] & KEYWORD_MASK))))
|
if (mousePos.x >= x && mousePos.x <= (x + getText()->getWidth(MAKE_RESOURCE(kResourcePackText, _keywordsOffset + (_item->keywords[index] & KEYWORD_MASK))))
|
||||||
&& mousePos.y >= y && mousePos.y <= (y + 16))
|
&& mousePos.y >= y && mousePos.y <= (y + 16))
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
|
@ -605,7 +613,7 @@ void Encounter::choose(int32 index) {
|
||||||
_value1 = (_item->keywords[index] & KEYWORD_MASK);
|
_value1 = (_item->keywords[index] & KEYWORD_MASK);
|
||||||
setVariable(1, _value1);
|
setVariable(1, _value1);
|
||||||
|
|
||||||
if (strcmp("Goodbye", getText()->get(MAKE_RESOURCE(kResourcePackText, 3681 + _value1))))
|
if (strcmp("Goodbye", getText()->get(MAKE_RESOURCE(kResourcePackText, _keywordsOffset + _value1))))
|
||||||
if (_index != 79)
|
if (_index != 79)
|
||||||
BYTE1(_item->keywords[index]) |= kKeywordOptionsDisabled;
|
BYTE1(_item->keywords[index]) |= kKeywordOptionsDisabled;
|
||||||
|
|
||||||
|
@ -710,7 +718,7 @@ void Encounter::resetSpeech(int16 keywordIndex, int16 a2) {
|
||||||
_data_455BCC = false;
|
_data_455BCC = false;
|
||||||
_data_455B3C = 1;
|
_data_455B3C = 1;
|
||||||
|
|
||||||
if (keywordIndex) {
|
if (keywordIndex || _vm->checkGameVersion("Demo")) {
|
||||||
getSpeech()->setTextResourceId(keywordIndex + a2);
|
getSpeech()->setTextResourceId(keywordIndex + a2);
|
||||||
setupSpeechText();
|
setupSpeechText();
|
||||||
}
|
}
|
||||||
|
@ -798,7 +806,7 @@ void Encounter::setupSpeech(ResourceId textResourceId, ResourceId fontResourceId
|
||||||
}
|
}
|
||||||
|
|
||||||
_data_455BE0 = true;
|
_data_455BE0 = true;
|
||||||
_soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, textResourceId - _speechResourceId);
|
_soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, textResourceId - _speechResourceId + _vm->checkGameVersion("Demo"));
|
||||||
//_soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId); // todo replace with speech (this is being override by the actor speechs)
|
//_soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId); // todo replace with speech (this is being override by the actor speechs)
|
||||||
//getSpeech()->setSoundResourceId(MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId));
|
//getSpeech()->setSoundResourceId(MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId));
|
||||||
}
|
}
|
||||||
|
@ -1113,10 +1121,10 @@ void Encounter::drawDialogOptions() {
|
||||||
_point.y + (int16)(16 * (counter / 3)));
|
_point.y + (int16)(16 * (counter / 3)));
|
||||||
|
|
||||||
if (getKeywordIndex() == keywordIndex)
|
if (getKeywordIndex() == keywordIndex)
|
||||||
getScreen()->fillRect(coords.x - 1, coords.y + 5, getText()->getWidth(MAKE_RESOURCE(kResourcePackText, 3681 + (keyword & KEYWORD_MASK))) + 2, 18, 0);
|
getScreen()->fillRect(coords.x - 1, coords.y + 5, getText()->getWidth(MAKE_RESOURCE(kResourcePackText, _keywordsOffset + (keyword & KEYWORD_MASK))) + 2, 18, 0);
|
||||||
|
|
||||||
getText()->setPosition(coords);
|
getText()->setPosition(coords);
|
||||||
getText()->draw(MAKE_RESOURCE(kResourcePackText, 3681 + (keyword & KEYWORD_MASK)));
|
getText()->draw(MAKE_RESOURCE(kResourcePackText, _keywordsOffset + (keyword & KEYWORD_MASK)));
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
_data_455B14 = i;
|
_data_455B14 = i;
|
||||||
|
|
|
@ -193,6 +193,7 @@ private:
|
||||||
int16 _data_455BF0;
|
int16 _data_455BF0;
|
||||||
uint32 _data_455BF4;
|
uint32 _data_455BF4;
|
||||||
uint32 _keywordStartIndex;
|
uint32 _keywordStartIndex;
|
||||||
|
uint32 _keywordsOffset;
|
||||||
|
|
||||||
EventHandler *_previousEventHandler;
|
EventHandler *_previousEventHandler;
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,10 @@ void Object::load(Common::SeekableReadStream *stream) {
|
||||||
_randomResourceIds[i] = (ResourceId)stream->readSint32LE();
|
_randomResourceIds[i] = (ResourceId)stream->readSint32LE();
|
||||||
|
|
||||||
_soundResourceId = (ResourceId)stream->readSint32LE();
|
_soundResourceId = (ResourceId)stream->readSint32LE();
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
return;
|
||||||
|
|
||||||
_field_6A4 = (ActorDirection)stream->readSint32LE();
|
_field_6A4 = (ActorDirection)stream->readSint32LE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,9 +251,13 @@ void ScriptManager::load(Common::SeekableReadStream *stream) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
stream->seek(2 * 4, SEEK_CUR);
|
||||||
|
} else {
|
||||||
script.field_1BAC = stream->readSint32LE();
|
script.field_1BAC = stream->readSint32LE();
|
||||||
script.field_1BB0 = stream->readSint32LE();
|
script.field_1BB0 = stream->readSint32LE();
|
||||||
script.counter = stream->readSint32LE();
|
script.counter = stream->readSint32LE();
|
||||||
|
}
|
||||||
|
|
||||||
_scripts.push_back(script);
|
_scripts.push_back(script);
|
||||||
}
|
}
|
||||||
|
@ -618,6 +622,11 @@ END_OPCODE
|
||||||
IMPLEMENT_OPCODE(SetActorPosition)
|
IMPLEMENT_OPCODE(SetActorPosition)
|
||||||
Actor *actor = getScene()->getActor(cmd->param1);
|
Actor *actor = getScene()->getActor(cmd->param1);
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo") && cmd->param2 == 150 && cmd->param3 == 337) {
|
||||||
|
actor->setPosition(151, 332, (ActorDirection)cmd->param4, (uint32)cmd->param5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
actor->setPosition((int16)cmd->param2, (int16)cmd->param3, (ActorDirection)cmd->param4, (uint32)cmd->param5);
|
actor->setPosition((int16)cmd->param2, (int16)cmd->param3, (ActorDirection)cmd->param4, (uint32)cmd->param5);
|
||||||
END_OPCODE
|
END_OPCODE
|
||||||
|
|
||||||
|
@ -1025,6 +1034,12 @@ END_OPCODE
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Opcode 0x2D
|
// Opcode 0x2D
|
||||||
IMPLEMENT_OPCODE(PlayMovie)
|
IMPLEMENT_OPCODE(PlayMovie)
|
||||||
|
if (_vm->checkGameVersion("Demo") && cmd->param1 == 4) {
|
||||||
|
Engine::quitGame();
|
||||||
|
_done = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getSharedData()->getMatteBarHeight() < 170) {
|
if (getSharedData()->getMatteBarHeight() < 170) {
|
||||||
_processNextEntry = true;
|
_processNextEntry = true;
|
||||||
|
|
||||||
|
@ -2048,6 +2063,9 @@ void ScriptManager::enableObject(ScriptEntry *cmd, ObjectTransparency type) {
|
||||||
void ScriptManager::setActionFlag(ScriptEntry *cmd, ActionType flag) {
|
void ScriptManager::setActionFlag(ScriptEntry *cmd, ActionType flag) {
|
||||||
switch (cmd->param2) {
|
switch (cmd->param2) {
|
||||||
default:
|
default:
|
||||||
|
if (!getWorld()->getObjectById((ObjectId)cmd->param1))
|
||||||
|
return;
|
||||||
|
|
||||||
getWorld()->getObjectById((ObjectId)cmd->param1)->actionType |= flag;
|
getWorld()->getObjectById((ObjectId)cmd->param1)->actionType |= flag;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2064,6 +2082,9 @@ void ScriptManager::setActionFlag(ScriptEntry *cmd, ActionType flag) {
|
||||||
void ScriptManager::clearActionFlag(ScriptEntry *cmd, ActionType flag) {
|
void ScriptManager::clearActionFlag(ScriptEntry *cmd, ActionType flag) {
|
||||||
switch (cmd->param2) {
|
switch (cmd->param2) {
|
||||||
default:
|
default:
|
||||||
|
if (!getWorld()->getObjectById((ObjectId)cmd->param1))
|
||||||
|
return;
|
||||||
|
|
||||||
getWorld()->getObjectById((ObjectId)cmd->param1)->actionType &= ~flag;
|
getWorld()->getObjectById((ObjectId)cmd->param1)->actionType &= ~flag;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
uint32 numActions = stream->readUint32LE();
|
uint32 numActions = stream->readUint32LE();
|
||||||
uint32 numObjects = stream->readUint32LE();
|
uint32 numObjects = stream->readUint32LE();
|
||||||
|
|
||||||
for (int32 c = 0; c < 7; c++)
|
for (int32 c = 0; c < 7 + _vm->checkGameVersion("Demo"); c++)
|
||||||
coordinates[c] = (int16)stream->readSint32LE();
|
coordinates[c] = (int16)stream->readSint32LE();
|
||||||
|
|
||||||
uint32 numActors = stream->readUint32LE();
|
uint32 numActors = stream->readUint32LE();
|
||||||
|
@ -174,6 +174,12 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
for (int32 s = 0; s < ARRAYSIZE(soundResourceIds); s++)
|
for (int32 s = 0; s < ARRAYSIZE(soundResourceIds); s++)
|
||||||
soundResourceIds[s] = (ResourceId)stream->readSint32LE();
|
soundResourceIds[s] = (ResourceId)stream->readSint32LE();
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
stream->readSint32LE();
|
||||||
|
stream->readSint32LE();
|
||||||
|
goto load_objects;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32 s = 0; s < ARRAYSIZE(ambientSounds); s++) {
|
for (int32 s = 0; s < ARRAYSIZE(ambientSounds); s++) {
|
||||||
ambientSounds[s].field_0 = stream->readSint32LE();
|
ambientSounds[s].field_0 = stream->readSint32LE();
|
||||||
ambientSounds[s].flags = stream->readSint32LE();
|
ambientSounds[s].flags = stream->readSint32LE();
|
||||||
|
@ -196,6 +202,7 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
musicResourceIndex = stream->readSint32LE();
|
musicResourceIndex = stream->readSint32LE();
|
||||||
musicStatusExt = stream->readSint32LE();
|
musicStatusExt = stream->readSint32LE();
|
||||||
|
|
||||||
|
load_objects:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Read Objects
|
// Read Objects
|
||||||
for (uint32 a = 0; a < numObjects; a++) {
|
for (uint32 a = 0; a < numObjects; a++) {
|
||||||
|
@ -205,6 +212,9 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
objects.push_back(object);
|
objects.push_back(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
stream->seek(0x1C93A, SEEK_SET);
|
||||||
|
else
|
||||||
stream->seek((OBJECTS_MAX_COUNT - numObjects) * OBJECTS_SIZE, SEEK_CUR);
|
stream->seek((OBJECTS_MAX_COUNT - numObjects) * OBJECTS_SIZE, SEEK_CUR);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -216,6 +226,11 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
actors.push_back(actor);
|
actors.push_back(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
stream->seek(0x1D2AA, SEEK_SET);
|
||||||
|
goto load_inventory;
|
||||||
|
}
|
||||||
|
|
||||||
stream->seek((ACTORS_MAX_COUNT - numActors) * ACTORS_SIZE, SEEK_CUR);
|
stream->seek((ACTORS_MAX_COUNT - numActors) * ACTORS_SIZE, SEEK_CUR);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -230,6 +245,7 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
numScripts = stream->readUint32LE();
|
numScripts = stream->readUint32LE();
|
||||||
numPolygons = stream->readUint32LE();
|
numPolygons = stream->readUint32LE();
|
||||||
|
|
||||||
|
load_inventory:
|
||||||
// Load inventory resources
|
// Load inventory resources
|
||||||
for (uint32 i = 0; i < ARRAYSIZE(inventoryIconsActive); i++)
|
for (uint32 i = 0; i < ARRAYSIZE(inventoryIconsActive); i++)
|
||||||
inventoryIconsActive[i] = (ResourceId)stream->readSint32LE();
|
inventoryIconsActive[i] = (ResourceId)stream->readSint32LE();
|
||||||
|
@ -240,6 +256,9 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
for (uint32 i = 0; i < ARRAYSIZE(inventoryCursorsBlinking); i++)
|
for (uint32 i = 0; i < ARRAYSIZE(inventoryCursorsBlinking); i++)
|
||||||
inventoryCursorsBlinking[i] = (ResourceId)stream->readSint32LE();
|
inventoryCursorsBlinking[i] = (ResourceId)stream->readSint32LE();
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
stream->seek(0x1A60A, SEEK_SET);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Read actions
|
// Read actions
|
||||||
for (uint32 a = 0; a < numActions; a++) {
|
for (uint32 a = 0; a < numActions; a++) {
|
||||||
|
@ -249,6 +268,9 @@ void WorldStats::load(Common::SeekableReadStream *stream) {
|
||||||
actions.push_back(action);
|
actions.push_back(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
return;
|
||||||
|
|
||||||
stream->seek((ACTIONS_MAX_COUNT - numActions) * ACTIONS_SIZE, SEEK_CUR);
|
stream->seek((ACTIONS_MAX_COUNT - numActions) * ACTIONS_SIZE, SEEK_CUR);
|
||||||
|
|
||||||
field_E848C = stream->readSint32LE();
|
field_E848C = stream->readSint32LE();
|
||||||
|
|
|
@ -48,7 +48,7 @@ const struct {
|
||||||
// ResourceManager
|
// ResourceManager
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ResourceManager::ResourceManager() : _cdNumber(-1), _musicPackId(kResourcePackInvalid) {
|
ResourceManager::ResourceManager(AsylumEngine *vm) : _cdNumber(-1), _musicPackId(kResourcePackInvalid), _vm(vm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceManager::~ResourceManager() {
|
ResourceManager::~ResourceManager() {
|
||||||
|
@ -76,9 +76,18 @@ ResourceEntry *ResourceManager::get(ResourceId id) {
|
||||||
ResourcePack *pack;
|
ResourcePack *pack;
|
||||||
|
|
||||||
if (isMusicPack) {
|
if (isMusicPack) {
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
pack = new ResourcePack("res.002");
|
||||||
|
else
|
||||||
pack = new ResourcePack(Common::String::format("mus.%03d", _musicPackId));
|
pack = new ResourcePack(Common::String::format("mus.%03d", _musicPackId));
|
||||||
} else {
|
} else {
|
||||||
if (packId == kResourcePackSharedSound) {
|
if (packId == kResourcePackSharedSound) {
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
pack = new ResourcePack("res.004");
|
||||||
|
cache->setVal(packId, pack);
|
||||||
|
return cache->getVal(packId)->get(index);
|
||||||
|
}
|
||||||
|
|
||||||
if (_cdNumber == -1)
|
if (_cdNumber == -1)
|
||||||
error("[ResourceManager::get] Cd number has not been set!");
|
error("[ResourceManager::get] Cd number has not been set!");
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/hashmap.h"
|
#include "common/hashmap.h"
|
||||||
|
|
||||||
|
#include "asylum/asylum.h"
|
||||||
#include "asylum/shared.h"
|
#include "asylum/shared.h"
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
@ -71,7 +72,7 @@ private:
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
public:
|
public:
|
||||||
ResourceManager();
|
ResourceManager(AsylumEngine *vm);
|
||||||
~ResourceManager();
|
~ResourceManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,6 +115,7 @@ private:
|
||||||
|
|
||||||
int _cdNumber;
|
int _cdNumber;
|
||||||
ResourcePackId _musicPackId;
|
ResourcePackId _musicPackId;
|
||||||
|
AsylumEngine *_vm;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
|
@ -59,6 +59,9 @@ void Sound::playSound(ResourceId resourceId, bool looping, int32 volume, int32 p
|
||||||
if (volume <= -10000)
|
if (volume <= -10000)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo") && RESOURCE_PACK(resourceId) == kResourcePackSound)
|
||||||
|
resourceId = MAKE_RESOURCE(kResourcePackShared, RESOURCE_INDEX(resourceId));
|
||||||
|
|
||||||
SoundQueueItem *item = getItem(resourceId);
|
SoundQueueItem *item = getItem(resourceId);
|
||||||
if (item) {
|
if (item) {
|
||||||
// Duplicate the queue entry
|
// Duplicate the queue entry
|
||||||
|
|
|
@ -186,10 +186,15 @@ ResourceId Speech::playPlayer(int32 index) {
|
||||||
textResourceIndex -= 9;
|
textResourceIndex -= 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceId soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, soundResourceIndex);
|
ResourceId soundResourceId;
|
||||||
|
if (_vm->checkGameVersion("Demo")) {
|
||||||
|
soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, soundResourceIndex + 21);
|
||||||
|
return play(soundResourceId, MAKE_RESOURCE(kResourcePackText, textResourceIndex + 20));
|
||||||
|
} else {
|
||||||
|
soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, soundResourceIndex);
|
||||||
return play(soundResourceId, MAKE_RESOURCE(kResourcePackText, textResourceIndex + 83));
|
return play(soundResourceId, MAKE_RESOURCE(kResourcePackText, textResourceIndex + 83));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case kActorSarah:
|
case kActorSarah:
|
||||||
return play(MAKE_RESOURCE(kResourcePackSharedSound, index + 1927), MAKE_RESOURCE(kResourcePackText, index + 586));
|
return play(MAKE_RESOURCE(kResourcePackSharedSound, index + 1927), MAKE_RESOURCE(kResourcePackText, index + 586));
|
||||||
|
|
|
@ -271,8 +271,14 @@ void Scene::load(ResourcePackId packId) {
|
||||||
_ws = new WorldStats(_vm);
|
_ws = new WorldStats(_vm);
|
||||||
_ws->load(fd);
|
_ws->load(fd);
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
fd->seek(0x1D72E, SEEK_SET);
|
||||||
|
|
||||||
_polygons = new Polygons(fd);
|
_polygons = new Polygons(fd);
|
||||||
|
|
||||||
|
if (_vm->checkGameVersion("Demo"))
|
||||||
|
fd->seek(3 * 4, SEEK_CUR);
|
||||||
|
|
||||||
ScriptManager *script = getScript();
|
ScriptManager *script = getScript();
|
||||||
script->resetAll();
|
script->resetAll();
|
||||||
script->load(fd);
|
script->load(fd);
|
||||||
|
@ -416,10 +422,12 @@ bool Scene::action(AsylumAction a) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kAsylumActionQuickLoad:
|
case kAsylumActionQuickLoad:
|
||||||
|
if (!_vm->checkGameVersion("Demo"))
|
||||||
getSaveLoad()->quickLoad();
|
getSaveLoad()->quickLoad();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kAsylumActionQuickSave:
|
case kAsylumActionQuickSave:
|
||||||
|
if (!_vm->checkGameVersion("Demo"))
|
||||||
getSaveLoad()->quickSave();
|
getSaveLoad()->quickSave();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -464,6 +472,7 @@ bool Scene::key(const AsylumEvent &evt) {
|
||||||
if (getCursor()->isHidden())
|
if (getCursor()->isHidden())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (!_vm->checkGameVersion("Demo"))
|
||||||
_vm->switchEventHandler(_vm->menu());
|
_vm->switchEventHandler(_vm->menu());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2357,7 +2366,7 @@ void Scene::changePlayerUpdate(ActorIndex index) {
|
||||||
// Scene drawing
|
// Scene drawing
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void Scene::preload() {
|
void Scene::preload() {
|
||||||
if (!Config.showSceneLoading)
|
if (!Config.showSceneLoading || _vm->checkGameVersion("Demo"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SceneTitle *title = new SceneTitle(_vm);
|
SceneTitle *title = new SceneTitle(_vm);
|
||||||
|
|
|
@ -73,6 +73,7 @@ bool VideoPlayer::handleEvent(const AsylumEvent &evt) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_ASYLUM_INIT:
|
case EVENT_ASYLUM_INIT:
|
||||||
|
if (!_vm->checkGameVersion("Demo"))
|
||||||
_previousFont = getText()->loadFont(MAKE_RESOURCE(kResourcePackShared, 57));
|
_previousFont = getText()->loadFont(MAKE_RESOURCE(kResourcePackShared, 57));
|
||||||
_subtitleCounter = 0;
|
_subtitleCounter = 0;
|
||||||
_subtitleIndex = -1;
|
_subtitleIndex = -1;
|
||||||
|
@ -80,6 +81,7 @@ bool VideoPlayer::handleEvent(const AsylumEvent &evt) {
|
||||||
|
|
||||||
case EVENT_ASYLUM_DEINIT:
|
case EVENT_ASYLUM_DEINIT:
|
||||||
getScreen()->clear();
|
getScreen()->clear();
|
||||||
|
if (!_vm->checkGameVersion("Demo"))
|
||||||
getText()->loadFont(_previousFont);
|
getText()->loadFont(_previousFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue