aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-04-24 15:07:44 +0300
committerThanasis Antoniou2019-04-24 15:13:26 +0300
commit81575df8d976aee1f98ce567a2eb5bd6181106de (patch)
tree9464106bb967485dc9a9e5d1dea5523705fba4b7
parentac32d35ff47d3d0dac069fd7e125031ad24708d4 (diff)
downloadscummvm-rg350-81575df8d976aee1f98ce567a2eb5bd6181106de.tar.gz
scummvm-rg350-81575df8d976aee1f98ce567a2eb5bd6181106de.tar.bz2
scummvm-rg350-81575df8d976aee1f98ce567a2eb5bd6181106de.zip
BLADERUNNER: Debugger command for full VK sessions
-rw-r--r--engines/bladerunner/debugger.cpp38
-rw-r--r--engines/bladerunner/debugger.h3
-rw-r--r--engines/bladerunner/script/vk_script.cpp44
-rw-r--r--engines/bladerunner/script/vk_script.h2
-rw-r--r--engines/bladerunner/ui/vk.cpp144
-rw-r--r--engines/bladerunner/ui/vk.h2
6 files changed, 191 insertions, 42 deletions
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index 0913e5ec3f..acafd68a59 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -56,6 +56,7 @@
#include "bladerunner/ui/elevator.h"
#include "bladerunner/ui/vk.h"
#include "bladerunner/ui/scores.h"
+#include "bladerunner/script/vk_script.h"
#include "bladerunner/overlays.h"
#include "bladerunner/subtitles.h"
@@ -83,6 +84,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() {
_viewWaypoints = false;
_viewWalkboxes = false;
_viewZBuffer = false;
+ _playFullVk = false;
registerCmd("anim", WRAP_METHOD(Debugger, cmdAnimation));
registerCmd("draw", WRAP_METHOD(Debugger, cmdDraw));
@@ -101,6 +103,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() {
registerCmd("save", WRAP_METHOD(Debugger, cmdSave));
registerCmd("overlay", WRAP_METHOD(Debugger, cmdOverlay));
registerCmd("subtitle", WRAP_METHOD(Debugger, cmdSubtitle));
+ registerCmd("vk", WRAP_METHOD(Debugger, cmdVk));
}
Debugger::~Debugger() {
@@ -1073,6 +1076,41 @@ bool Debugger::cmdSubtitle(int argc, const char **argv) {
}
/**
+* Toggle playing a full VK session (full)
+* Only available in VK mode
+*/
+bool Debugger::cmdVk(int argc, const char **argv) {
+ bool invalidSyntax = false;
+
+ if (argc != 2) {
+ invalidSyntax = true;
+ } else {
+ if (!_vm->_vk->isOpen()) {
+ debugPrintf("Error:Command %s is only valid within a Voigt-Kampff session\n", argv[0]);
+ return true;
+ }
+ //
+ // set a debug variable to enable going through the (remaining) VK session
+ // enabling all the remaining VK questions
+ //
+ Common::String argName = argv[1];
+ argName.toLowercase();
+ if (argc == 2 && argName == "full") {
+ _playFullVk = !_playFullVk;
+ debugPrintf("Playing full V-K session = %s\n", _playFullVk ? "True":"False");
+ } else {
+ invalidSyntax = true;
+ }
+ }
+
+ if (invalidSyntax) {
+ debugPrintf("Toggle playing the full VK session instead of the at most 10 questions of the vanilla mode\n");
+ debugPrintf("Usage: %s full\n", argv[0]);
+ }
+ return true;
+
+}
+/**
*
* Similar to draw but only list items instead of drawing
* Maybe keep this separate from the draw command, even though some code gets repeated here
diff --git a/engines/bladerunner/debugger.h b/engines/bladerunner/debugger.h
index 2349af9d8c..17255a7f30 100644
--- a/engines/bladerunner/debugger.h
+++ b/engines/bladerunner/debugger.h
@@ -53,7 +53,7 @@ public:
bool _viewWaypoints;
bool _viewWalkboxes;
bool _viewZBuffer;
-
+ bool _playFullVk;
Debugger(BladeRunnerEngine *vm);
~Debugger();
@@ -76,6 +76,7 @@ public:
bool cmdOverlay(int argc, const char **argv);
bool cmdSubtitle(int argc, const char **argv);
bool cmdList(int argc, const char **argv);
+ bool cmdVk(int argc, const char **argv);
void drawDebuggerOverlay();
diff --git a/engines/bladerunner/script/vk_script.cpp b/engines/bladerunner/script/vk_script.cpp
index 688cda7cf8..c60c2200de 100644
--- a/engines/bladerunner/script/vk_script.cpp
+++ b/engines/bladerunner/script/vk_script.cpp
@@ -24,6 +24,7 @@
#include "bladerunner/bladerunner.h"
#include "bladerunner/mouse.h"
+#include "bladerunner/debugger.h"
namespace BladeRunner {
@@ -405,8 +406,47 @@ void VKScript::SCRIPT_VK_DLL_McCoy_Asks_Question(int actorId, int questionId) {
VK_Play_Speech_Line(kActorMcCoy, 7780, 0.5f);
break;
}
- if (++_questionCounter >= 10) {
- VK_Subject_Reacts(5, 0, 0, 100);
+
+ if ( _vm->_debugger->_playFullVk ) {
+ if (++_questionCounter >= 40) {
+ switch(actorId) {
+ case kActorLucy:
+ //debug("Last Lucy Question!");
+ if (Game_Flag_Query(kFlagLucyIsReplicant)) {
+ VK_Subject_Reacts(5, 0, 100, 100); // Replicant result
+ } else {
+ VK_Subject_Reacts(5, 100, 0, 100); // Human result
+ }
+ break;
+ case kActorDektora:
+ //debug("Last Dektora Question!");
+ if (Game_Flag_Query(kFlagDektoraIsReplicant)) {
+ VK_Subject_Reacts(5, 0, 100, 100); // Replicant result
+ } else {
+ VK_Subject_Reacts(5, 100, 0, 100); // Human result
+ }
+ break;
+ case kActorGrigorian:
+ //debug("Last Grigorian Question!");
+ VK_Subject_Reacts(5, 100, 0, 100); // Human result
+ break;
+ case kActorRunciter:
+ //debug("Last Runciter Question!");
+ VK_Subject_Reacts(5, 100, 0, 100); // Human result
+ break;
+ case kActorBulletBob:
+ //debug("Last Bullet Bob Question!");
+ // don't break for BOB
+ // fall-through
+ default:
+ VK_Subject_Reacts(5, 0, 0, 100);
+ }
+ }
+ } else {
+ // original behavior
+ if (++_questionCounter >= 10) {
+ VK_Subject_Reacts(5, 0, 0, 100);
+ }
}
}
diff --git a/engines/bladerunner/script/vk_script.h b/engines/bladerunner/script/vk_script.h
index 6f09c12abe..eaddd99ac1 100644
--- a/engines/bladerunner/script/vk_script.h
+++ b/engines/bladerunner/script/vk_script.h
@@ -30,6 +30,8 @@ namespace BladeRunner {
class BladeRunnerEngine;
class VKScript : ScriptBase {
+ friend class Debugger;
+
int _inScriptCounter;
int _calibrationQuestionCounter;
int _questionCounter;
diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp
index 6345082788..05dc239ca2 100644
--- a/engines/bladerunner/ui/vk.cpp
+++ b/engines/bladerunner/ui/vk.cpp
@@ -271,6 +271,7 @@ void VK::subjectReacts(int intensity, int humanResponse, int replicantResponse,
replicantResponse = CLIP(replicantResponse, -20, 20);
int timeNow = _vm->_time->current();
+ bool closeVK = false;
if (intensity > 0) {
_needleValueTarget = 78 * intensity / 100;
@@ -280,10 +281,27 @@ void VK::subjectReacts(int intensity, int humanResponse, int replicantResponse,
if (humanResponse != 0) {
_humanProbability = CLIP(_humanProbability + humanResponse + _calibration, 0, 100);
+// debug("Human probability is %d, human response is %d, calibration is %d", _humanProbability, humanResponse,_calibration);
if (_humanProbability >= 80 && !_isClosing) {
- _isClosing = true;
- _timeClose = timeNow + 3000;
- _vm->_mouse->disable();
+ closeVK = false;
+ if (_vm->_debugger->_playFullVk
+ && intensity == 5
+ && (humanResponse == 0 || humanResponse == 20 )
+ && replicantResponse == 0
+ && anxiety == 100
+ ) { // only close if 5, 0, 0, 100 argument (the actual anxiety ending of VK)
+ // force Human result
+ _replicantProbability = 0;
+ closeVK = true;
+ } else if (!_vm->_debugger->_playFullVk) {
+ closeVK = true;
+ }
+
+ if (closeVK == true) {
+ _isClosing = true;
+ _timeClose = timeNow + 3000;
+ _vm->_mouse->disable();
+ }
}
_humanGaugeTarget = humanResponse;
_humanGaugeDelta = humanResponse / 10;
@@ -294,10 +312,27 @@ void VK::subjectReacts(int intensity, int humanResponse, int replicantResponse,
if (replicantResponse != 0) {
_replicantProbability = CLIP(_replicantProbability + replicantResponse - _calibration, 0, 100);
+// debug("Replicant probability is %d, replicant response is %d, calibration is %d", _replicantProbability, replicantResponse, _calibration);
if (_replicantProbability >= 80 && !_isClosing) {
- _isClosing = true;
- _timeClose = timeNow + 3000;
- _vm->_mouse->disable();
+ closeVK = false;
+ if (_vm->_debugger->_playFullVk
+ && intensity == 5
+ && humanResponse == 0
+ && (replicantResponse == 0 || replicantResponse == 20 )
+ && anxiety == 100
+ ) { // only close if 5, 0, 0, 100 argument (the actual anxiety ending of VK)
+ // force Rep result
+ _humanProbability = 0;
+ closeVK = true;
+ } else if (!_vm->_debugger->_playFullVk) {
+ closeVK = true;
+ }
+
+ if (closeVK == true) {
+ _isClosing = true;
+ _timeClose = timeNow + 3000;
+ _vm->_mouse->disable();
+ }
}
_replicantGaugeTarget = replicantResponse;
_replicantGauge = replicantResponse / 10;
@@ -306,8 +341,22 @@ void VK::subjectReacts(int intensity, int humanResponse, int replicantResponse,
}
}
- _anxiety = CLIP(_anxiety + anxiety, 0, 100);
- if (_anxiety == 100 && !_isClosing) {
+ closeVK = false;
+ if (_vm->_debugger->_playFullVk
+ && intensity == 5
+ && humanResponse == 0
+ && replicantResponse == 0
+ && anxiety == 100 && !_isClosing
+ ) {
+ closeVK = true;
+ } else if (!_vm->_debugger->_playFullVk) {
+ _anxiety = CLIP(_anxiety + anxiety, 0, 100);
+ if (_anxiety == 100 && !_isClosing) {
+ closeVK = true;
+ }
+ }
+
+ if (closeVK == true) {
_isClosing = true;
_timeClose = timeNow + 3000;
_vm->_mouse->disable();
@@ -914,38 +963,53 @@ void VK::askQuestion(int intensity) {
int foundQuestionIndex = -1;
int foundQuestionIndexLast = -1;
- for (int i = 0; i < (int)_questions[intensity].size(); ++i) {
- if (_questions[intensity][i].isPresent && !_questions[intensity][i].wasAsked) {
- // cut content? related questions are not used in game
- //
- // Note: There are questions that seem related and a subject may reference them
- // (eg Bullet Bob does that with the "hamster" - VK Low 05 and VK Medium 14)
- //
- // This was probably meant to be a mechanism to prevent asking a related question before asking the original one
- // to avoid inconsistencies. However, this seems it would restrict relevant questions within the same intensity
- // which should be changed.
- //
- // An issue with this issue is that if in a pair of related questions from different intensities
- // (eg in Bob's case L05 -> M14), if M14 is the last available question from the Medium intensity,
- // and L05 has not been asked, then what question should McCoy ask?
- //
- // The original code (if it worked) would simply not make any question and that's the simplest solution to adopt.
- // This issue is only likely to occur in vanilla game (with very low probability)
- // with High intensity questions that depend on questions of other intensity
- //
- int relatedSentenceId = _questions[intensity][i].relatedSentenceId;
- int relatedQuestionId = -1;
- int relatedQuestionIntensity = -1;
-
- if (relatedSentenceId >= 0) {
- findRelatedQuestionBySentenceId(relatedSentenceId, relatedQuestionId, relatedQuestionIntensity);
- }
+ if (_vm->_debugger->_playFullVk) {
+ // loop backwards to maintain proper order in sound files
+ for (int i = (int)_questions[intensity].size() - 1; i >= 0; --i) {
- if (relatedQuestionId < 0 || _questions[relatedQuestionIntensity][relatedQuestionId].wasAsked) {
+ if (_questions[intensity][i].isPresent && !_questions[intensity][i].wasAsked) {
+ // In full VK debug mode we don't need the question dependencies (related questions)
+ // We also assign the new question id deterministically from an intensity "pack"
+ // we don't use randomness here
foundQuestionIndexLast = i;
- if (_vm->_rnd.getRandomNumberRng(0, 100) < 20) {
- foundQuestionIndex = i;
- break;
+ foundQuestionIndex = i;
+ }
+ }
+ } else {
+ // original code
+ for (int i = 0; i < (int)_questions[intensity].size(); ++i) {
+ if (_questions[intensity][i].isPresent && !_questions[intensity][i].wasAsked) {
+ // cut content? related questions are not used in game
+ //
+ // Note: There are questions that seem related and a subject may reference them
+ // (eg Bullet Bob does that with the "hamster" - VK Low 05 and VK Medium 14)
+ //
+ // This was probably meant to be a mechanism to prevent asking a related question before asking the original one
+ // to avoid inconsistencies. However, this seems it would restrict relevant questions within the same intensity
+ // which should be changed.
+ //
+ // An issue with this issue is that if in a pair of related questions from different intensities
+ // (eg in Bob's case L05 -> M14), if M14 is the last available question from the Medium intensity,
+ // and L05 has not been asked, then what question should McCoy ask?
+ //
+ // The original code (if it worked) would simply not make any question and that's the simplest solution to adopt.
+ // This issue is only likely to occur in vanilla game (with very low probability)
+ // with High intensity questions that depend on questions of other intensity
+ //
+ int relatedSentenceId = _questions[intensity][i].relatedSentenceId;
+ int relatedQuestionId = -1;
+ int relatedQuestionIntensity = -1;
+
+ if (relatedSentenceId >= 0) {
+ findRelatedQuestionBySentenceId(relatedSentenceId, relatedQuestionId, relatedQuestionIntensity);
+ }
+
+ if (relatedQuestionId < 0 || _questions[relatedQuestionIntensity][relatedQuestionId].wasAsked) {
+ foundQuestionIndexLast = i;
+ if (_vm->_rnd.getRandomNumberRng(0, 100) < 20) {
+ foundQuestionIndex = i;
+ break;
+ }
}
}
}
@@ -961,7 +1025,9 @@ void VK::askQuestion(int intensity) {
_script->mcCoyAsksQuestion(_actorId, _questions[intensity][foundQuestionIndex].sentenceId);
_script->questionAsked(_actorId, _questions[intensity][foundQuestionIndex].sentenceId);
_vm->_mouse->enable();
- } else if (!_isClosing && !_script->isInsideScript()) {
+ } else if (!_isClosing && !_script->isInsideScript()
+ && !_vm->_debugger->_playFullVk
+ ) {
_isClosing = true;
_vm->_mouse->disable();
_timeClose = _vm->_time->current() + 3000;
diff --git a/engines/bladerunner/ui/vk.h b/engines/bladerunner/ui/vk.h
index 328953c9e2..d0b749363d 100644
--- a/engines/bladerunner/ui/vk.h
+++ b/engines/bladerunner/ui/vk.h
@@ -37,6 +37,8 @@ class UIImagePicker;
class VQAPlayer;
class VK {
+ friend class Debugger;
+
struct Question {
bool isPresent;
bool wasAsked;