NANCY: Pick correct responses in primary video

Fixed an issue where the incorrect player dialogue would be chosen
when one or more of the other responses are hidden.
This commit is contained in:
Kaloyan Chehlarski 2023-03-07 13:38:41 +02:00
parent fb7a903080
commit 415406bbcc
2 changed files with 17 additions and 2 deletions

View File

@ -300,6 +300,7 @@ void PlayPrimaryVideoChan0::execute() {
if (res.conditionFlags.isSatisfied()) {
NancySceneState.getTextbox().addTextLine(res.text);
res.isOnScreen = true;
}
}
}
@ -314,7 +315,19 @@ void PlayPrimaryVideoChan0::execute() {
// NPC has finished talking, we have responses
for (uint i = 0; i < 30; ++i) {
if (NancySceneState.getLogicCondition(i, kLogUsed)) {
_pickedResponse = i;
int pickedOnScreenResponse = _pickedResponse = i;
// Adjust to account for hidden responses
for (uint j = 0; j < _responses.size(); ++j) {
if (!_responses[j].isOnScreen) {
++_pickedResponse;
}
if ((int)j == pickedOnScreenResponse) {
break;
}
}
break;
}
}
@ -350,7 +363,7 @@ void PlayPrimaryVideoChan0::execute() {
g_nancy->_sound->stopSound(_responseGenericSound);
if (_pickedResponse != -1) {
NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
} else {
// Evaluate scene branch structs here

View File

@ -59,6 +59,8 @@ struct ResponseStruct {
Common::String soundName; // 0x196
SceneChangeDescription sceneChange; // 0x1A0
FlagDescription flagDesc; // 0x1A8
bool isOnScreen = false;
};
struct FlagsStruct {