CHEWY: Play audio commentary in inventory - bug #13522

This commit is contained in:
Filippos Karapetis 2022-06-12 21:12:28 +03:00
parent cdb198ade2
commit faf42d0f84
2 changed files with 11 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include "common/str.h"
#include "common/str-array.h"
#include "chewy/resource.h"
#include "chewy/text.h"
namespace Chewy {
@ -274,6 +275,7 @@ public:
Common::StringArray getTextArray(uint dialogNum, uint entryNum, int type, int subEntry = -1);
Common::String getTextEntry(uint dialogNum, uint entryNum, int type, int subEntry = -1);
int16 getLastSpeechId() { return _text->getLastSpeechId(); }
private:
void init();

View File

@ -28,6 +28,7 @@
#include "chewy/main.h"
#include "chewy/menus.h"
#include "chewy/mouse.h"
#include "chewy/sound.h"
namespace Chewy {
namespace Dialogs {
@ -383,6 +384,7 @@ int16 Inventory::look(int16 invent_nr, int16 mode, int16 ats_nr) {
bool endLoop = false;
int16 startLine = 0;
bool mouseFl = true;
bool firstTime = true;
if (mode == INV_ATS_MODE) {
itemName = _G(atds)->getTextEntry(invent_nr, TXT_MARK_NAME, INV_ATS_DATA);
@ -409,6 +411,8 @@ int16 Inventory::look(int16 invent_nr, int16 mode, int16 ats_nr) {
endLoop = true;
}
const int16 speechId = _G(atds)->getLastSpeechId();
while (!endLoop) {
int16 rect = _G(in)->findHotspot(_G(inventoryHotspots));
@ -518,6 +522,11 @@ int16 Inventory::look(int16 invent_nr, int16 mode, int16 ats_nr) {
_G(scr_width), itemDesc[i].c_str());
++k;
}
if (g_engine->_sound->speechEnabled() && speechId >= 0 && firstTime) {
g_engine->_sound->playSpeech(speechId, false);
firstTime = false;
}
}
_G(cur)->plot_cur();