BLADERUNNER: Fixed end credits

Game is completable for blade runner path
This commit is contained in:
Peter Kohaut 2019-02-03 11:42:26 +01:00
parent 934ba34adb
commit a7f1230980
9 changed files with 147 additions and 150 deletions

View File

@ -340,7 +340,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_lights = new Lights(this);
// TODO: outtake player - but this is done bit differently
// outtake player was initialized here in the original game - but this is done bit differently
_policeMaze = new PoliceMaze(this);
@ -383,11 +383,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
return false;
}
// TODO: Create datetime - not used
// TODO: Create graphics surfaces 1-4
// TODO: Allocate audio cache
if (hasSavegames) {
@ -434,7 +429,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_ambientSounds = new AmbientSounds(this);
// TODO: Read BLADE.INI
// BLADE.INI was read here, but it was replaced by ScummVM configuration
_chapters = new Chapters(this);
if (!_chapters)
@ -546,14 +541,13 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount());
// TODO: Scene
_scene = new Scene(this);
// Load INIT.DLL
InitScript initScript(this);
initScript.SCRIPT_Initialize_Game();
// TODO: Load AI-ACT1.DLL
// Load AI-ACT1.DLL
_aiScripts = new AIScripts(this, actorCount);
initChapterAndScene();
@ -594,7 +588,7 @@ void BladeRunnerEngine::initChapterAndScene() {
void BladeRunnerEngine::shutdown() {
_mixer->stopAll();
// TODO: Write BLADE.INI
// BLADE.INI as updated here
delete _vk;
_vk = nullptr;
@ -721,10 +715,6 @@ void BladeRunnerEngine::shutdown() {
delete _waypoints;
_waypoints = nullptr;
// TODO: Delete Cover waypoints
// TODO: Delete Flee waypoints
delete _scores;
_scores = nullptr;
@ -743,8 +733,6 @@ void BladeRunnerEngine::shutdown() {
delete _suspectsDatabase;
_suspectsDatabase = nullptr;
// TODO: Delete datetime - not used
int actorCount = (int)_gameInfo->getActorCount();
for (int i = 0; i != actorCount; ++i) {
delete _actors[i];
@ -846,136 +834,141 @@ void BladeRunnerEngine::gameLoop() {
void BladeRunnerEngine::gameTick() {
handleEvents();
if (_gameIsRunning && _windowIsActive) {
if (!_kia->isOpen() && !_sceneScript->isInsideScript() && !_aiScripts->isInsideScript()) {
_settings->openNewScene();
}
if (!_gameIsRunning || !_windowIsActive) {
return;
}
// TODO: Autosave
if (!_kia->isOpen() && !_sceneScript->isInsideScript() && !_aiScripts->isInsideScript()) {
_settings->openNewScene();
}
//probably not needed, this version of tick is just loading data from buffer
//_audioMixer->tick();
// TODO: Autosave
if (_kia->isOpen()) {
_kia->tick();
return;
}
//probably not needed, this version of tick is just loading data from buffer
//_audioMixer->tick();
if (_spinner->isOpen()) {
_spinner->tick();
_ambientSounds->tick();
return;
}
if (_esper->isOpen()) {
_esper->tick();
return;
}
if (_vk->isOpen()) {
_vk->tick();
_ambientSounds->tick();
return;
}
if (_elevator->isOpen()) {
_elevator->tick();
_ambientSounds->tick();
return;
}
if (_scores->isOpen()) {
_scores->tick();
_ambientSounds->tick();
return;
}
_actorDialogueQueue->tick();
if (_scene->didPlayerWalkIn()) {
_sceneScript->playerWalkedIn();
}
bool inDialogueMenu = _dialogueMenu->isVisible();
if (!inDialogueMenu) {
for (int i = 0; i < (int)_gameInfo->getActorCount(); ++i) {
_actors[i]->tickCombat();
}
}
_policeMaze->tick();
// TODO: Gun range announcements
_zbuffer->clean();
if (_kia->isOpen()) {
_kia->tick();
return;
}
if (_spinner->isOpen()) {
_spinner->tick();
_ambientSounds->tick();
return;
}
bool backgroundChanged = false;
int frame = _scene->advanceFrame();
if (frame >= 0) {
_sceneScript->sceneFrameAdvanced(frame);
backgroundChanged = true;
}
blit(_surfaceBack, _surfaceFront);
if (_esper->isOpen()) {
_esper->tick();
return;
}
_overlays->tick();
if (_vk->isOpen()) {
_vk->tick();
_ambientSounds->tick();
return;
}
if (!inDialogueMenu) {
actorsUpdate();
}
if (_elevator->isOpen()) {
_elevator->tick();
_ambientSounds->tick();
return;
}
if (_settings->getNewScene() == -1 || _sceneScript->isInsideScript() || _aiScripts->isInsideScript()) {
_sliceRenderer->setView(_view);
if (_scores->isOpen()) {
_scores->tick();
_ambientSounds->tick();
return;
}
// Tick and draw all actors in current set
int setId = _scene->getSetId();
for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) {
if (_actors[i]->getSetId() == setId) {
Common::Rect screenRect;
if (_actors[i]->tick(backgroundChanged, &screenRect)) {
_zbuffer->mark(screenRect);
}
}
}
_actorDialogueQueue->tick();
if (_scene->didPlayerWalkIn()) {
_sceneScript->playerWalkedIn();
}
_items->tick();
_itemPickup->tick();
_itemPickup->draw();
Common::Point p = getMousePos();
if (_dialogueMenu->isVisible()) {
_dialogueMenu->tick(p.x, p.y);
_dialogueMenu->draw(_surfaceFront);
}
if (_debugger->_viewZBuffer) {
_surfaceFront.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480);
}
_mouse->tick(p.x, p.y);
_mouse->draw(_surfaceFront, p.x, p.y);
// TODO: Process AUD
if (_walkSoundId >= 0) {
_audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0);
_walkSoundId = -1;
}
if (_debugger->_isDebuggerOverlay) {
_debugger->drawDebuggerOverlay();
}
if (_debugger->_viewObstacles) {
_obstacles->draw();
}
_subtitles->tick(_surfaceFront);
blitToScreen(_surfaceFront);
_system->delayMillis(10);
bool inDialogueMenu = _dialogueMenu->isVisible();
if (!inDialogueMenu) {
for (int i = 0; i < (int)_gameInfo->getActorCount(); ++i) {
_actors[i]->tickCombat();
}
}
_policeMaze->tick();
// TODO: Gun range announcements
_zbuffer->clean();
_ambientSounds->tick();
bool backgroundChanged = false;
int frame = _scene->advanceFrame();
if (frame >= 0) {
_sceneScript->sceneFrameAdvanced(frame);
backgroundChanged = true;
}
blit(_surfaceBack, _surfaceFront);
_overlays->tick();
if (!inDialogueMenu) {
actorsUpdate();
}
if (_settings->getNewScene() != -1 && !_sceneScript->isInsideScript() && !_aiScripts->isInsideScript()) {
return;
}
_sliceRenderer->setView(_view);
// Tick and draw all actors in current set
int setId = _scene->getSetId();
for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) {
if (_actors[i]->getSetId() == setId) {
Common::Rect screenRect;
if (_actors[i]->tick(backgroundChanged, &screenRect)) {
_zbuffer->mark(screenRect);
}
}
}
_items->tick();
_itemPickup->tick();
_itemPickup->draw();
Common::Point p = getMousePos();
if (_dialogueMenu->isVisible()) {
_dialogueMenu->tick(p.x, p.y);
_dialogueMenu->draw(_surfaceFront);
}
if (_debugger->_viewZBuffer) {
_surfaceFront.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480);
}
_mouse->tick(p.x, p.y);
_mouse->draw(_surfaceFront, p.x, p.y);
// TODO: Process AUD
if (_walkSoundId >= 0) {
_audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0);
_walkSoundId = -1;
}
if (_debugger->_isDebuggerOverlay) {
_debugger->drawDebuggerOverlay();
}
if (_debugger->_viewObstacles) {
_obstacles->draw();
}
_subtitles->tick(_surfaceFront);
blitToScreen(_surfaceFront);
_system->delayMillis(10);
}
void BladeRunnerEngine::actorsUpdate() {

View File

@ -1275,7 +1275,7 @@ enum AnimationModes {
kAnimationModeDie = 48,
kAnimationModeCombatDie = 49,
kAnimationModeFeeding = 52,
kAnimationModeSit = 53, // TODO: check
kAnimationModeSit = 53,
kAnimationModeClimbUp = 64,
kAnimationModeClimbDown = 65,
kAnimationModeCombatClimbUp = 66,

View File

@ -72,6 +72,10 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co
while (!_vm->_vqaStopIsRequested && !_vm->shouldQuit()) {
_vm->handleEvents();
if (!_vm->_windowIsActive) {
continue;
}
int frame = vqaPlayer.update();
blit(_surfaceVideo, _vm->_surfaceFront); // This helps to make subtitles disappear properly, if the video is rendered in separate surface and then pushed to the front surface
if (frame == -3) { // end of video

View File

@ -204,7 +204,7 @@ int Elevator::handleMouseDown(int x, int y) {
}
void Elevator::tick() {
if (!_vm->_gameIsRunning) {
if (!_vm->_windowIsActive) {
return;
}
@ -283,8 +283,6 @@ void Elevator::buttonFocus(int buttonId) {
void Elevator::setupDescription(int actorId, int sentenceId) {
_actorId = actorId;
_sentenceId = sentenceId;
// TODO: Use proper timer
_timeSpeakDescription = _vm->_time->current() + 600;
}

View File

@ -105,7 +105,7 @@ void EndCredits::show() {
//soundSystem::tick(SoundSystem);
_vm->handleEvents();
if (!_vm->_gameIsRunning) {
if (!_vm->_windowIsActive) {
timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
continue;

View File

@ -208,7 +208,7 @@ void ESPER::handleMouseDown(int x, int y, bool mainButton) {
}
void ESPER::tick() {
if (!_vm->_gameIsRunning) {
if (!_vm->_windowIsActive) {
return;
}

View File

@ -95,7 +95,7 @@ void Scores::close() {
_vm->closeArchive("MODE.MIX");
// TODO: Unfreeze game time
_vm->_time->resume();
_vm->_scene->resume();
}
@ -129,7 +129,7 @@ int Scores::handleMouseDown(int x, int y) {
}
void Scores::tick() {
if (!_vm->_gameIsRunning) {
if (!_vm->_windowIsActive) {
return;
}

View File

@ -29,8 +29,9 @@
#include "bladerunner/scene.h"
#include "bladerunner/shape.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/vqa_player.h"
#include "bladerunner/time.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/vqa_player.h"
#include "common/rect.h"
#include "common/system.h"
@ -155,7 +156,8 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
this
);
// TODO: Freeze game time
_vm->_time->pause();
_selectedDestination = -1;
do {
_vm->gameTick();
@ -176,7 +178,7 @@ int Spinner::chooseDestination(int loopId, bool immediately) {
_isOpen = false;
// TODO: Unfreeze game time
_vm->_time->resume();
_vm->_scene->resume();
return _selectedDestination;
@ -207,7 +209,7 @@ int Spinner::handleMouseDown(int x, int y) {
}
void Spinner::tick() {
if (!_vm->_gameIsRunning) {
if (!_vm->_windowIsActive) {
return;
}

View File

@ -34,14 +34,14 @@
#include "bladerunner/mouse.h"
#include "bladerunner/music.h"
#include "bladerunner/scene.h"
#include "bladerunner/shape.h"
#include "bladerunner/script/vk_script.h"
#include "bladerunner/shape.h"
#include "bladerunner/slice_renderer.h"
#include "bladerunner/subtitles.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/time.h"
#include "bladerunner/ui/ui_image_picker.h"
#include "bladerunner/vqa_player.h"
#include "bladerunner/subtitles.h"
#include "common/str.h"
#include "common/keyboard.h"
@ -128,7 +128,7 @@ void VK::open(int actorId, int calibrationRatio) {
_script = new VKScript(_vm);
//TODO: time->lock()
_vm->_time->pause();
init();
}
@ -184,7 +184,7 @@ void VK::close() {
_vm->_music->setVolume(_volumeMusic);
_vm->_ambientSounds->setVolume(_volumeAmbient);
// TODO: time->unlock();
_vm->_time->resume();
_vm->_scene->resume();
}
@ -472,7 +472,7 @@ void VK::init() {
}
void VK::draw() {
if (!_isOpen || !_vm->_gameIsRunning) {
if (!_isOpen || !_vm->_windowIsActive) {
return;
}
@ -895,7 +895,7 @@ void VK::askQuestion(int intensity) {
for (int i = 0; i < (int)_questions[intensity].size(); ++i) {
if (_questions[intensity][i].isPresent && !_questions[intensity][i].wasAsked) {
// TODO: related questions are not used in game
// cut content? related questions are not used in game
// int relatedQuestion = -1;
// if (_questions[intensity][i].relatedSentenceId >= 0) {
// relatedQuestion = vk::findQuestionById(this, questions, relatedQuestionId);