Fixed conversations in IHNM. Now, when a dialog option is selected, the protagonist will say it out properly before we hear the other character's reply. Also, added some more code for sfScriptFade and made it a stub for now, as it still needs work
svn-id: r27264
This commit is contained in:
parent
86f6aaf206
commit
3fd5347421
6 changed files with 47 additions and 18 deletions
|
@ -2027,7 +2027,7 @@ void Interface::converseClear(void) {
|
||||||
_conversePos = -1;
|
_conversePos = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interface::converseAddText(const char *text, int replyId, byte replyFlags, int replyBit) {
|
bool Interface::converseAddText(const char *text, int strId, int replyId, byte replyFlags, int replyBit) {
|
||||||
int count = 0; // count how many pieces of text per string
|
int count = 0; // count how many pieces of text per string
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
|
@ -2058,6 +2058,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags,
|
||||||
_converseText[_converseTextCount].text = (char *)malloc(i + 1);
|
_converseText[_converseTextCount].text = (char *)malloc(i + 1);
|
||||||
strncpy(_converseText[_converseTextCount].text, _converseWorkString, i);
|
strncpy(_converseText[_converseTextCount].text, _converseWorkString, i);
|
||||||
|
|
||||||
|
_converseText[_converseTextCount].strId = strId;
|
||||||
_converseText[_converseTextCount].text[i] = 0;
|
_converseText[_converseTextCount].text[i] = 0;
|
||||||
_converseText[_converseTextCount].textNum = count;
|
_converseText[_converseTextCount].textNum = count;
|
||||||
_converseText[_converseTextCount].stringNum = _converseStrCount;
|
_converseText[_converseTextCount].stringNum = _converseStrCount;
|
||||||
|
@ -2187,7 +2188,7 @@ void Interface::converseSetPos(int key) {
|
||||||
|
|
||||||
ct = &_converseText[_conversePos];
|
ct = &_converseText[_conversePos];
|
||||||
|
|
||||||
_vm->_script->finishDialog(ct->replyId, ct->replyFlags, ct->replyBit);
|
_vm->_script->finishDialog(ct->strId, ct->replyId, ct->replyFlags, ct->replyBit);
|
||||||
|
|
||||||
if (_vm->_puzzle->isActive())
|
if (_vm->_puzzle->isActive())
|
||||||
_vm->_puzzle->handleReply(ct->replyId);
|
_vm->_puzzle->handleReply(ct->replyId);
|
||||||
|
|
|
@ -157,6 +157,7 @@ struct InterfacePanel {
|
||||||
|
|
||||||
struct Converse {
|
struct Converse {
|
||||||
char *text;
|
char *text;
|
||||||
|
int strId;
|
||||||
int stringNum;
|
int stringNum;
|
||||||
int textNum;
|
int textNum;
|
||||||
int replyId;
|
int replyId;
|
||||||
|
@ -346,7 +347,7 @@ private:
|
||||||
public:
|
public:
|
||||||
void converseInit(void);
|
void converseInit(void);
|
||||||
void converseClear(void);
|
void converseClear(void);
|
||||||
bool converseAddText(const char *text, int replyId, byte replyFlags, int replyBit);
|
bool converseAddText(const char *text, int strId, int replyId, byte replyFlags, int replyBit);
|
||||||
void converseDisplayText();
|
void converseDisplayText();
|
||||||
void converseSetTextLines(int row);
|
void converseSetTextLines(int row);
|
||||||
void converseChangePos(int chg);
|
void converseChangePos(int chg);
|
||||||
|
|
|
@ -439,9 +439,9 @@ void Puzzle::solicitHint(void) {
|
||||||
_vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
|
_vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
|
||||||
|
|
||||||
_vm->_interface->converseClear();
|
_vm->_interface->converseClear();
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 1, 0, 0 );
|
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0 );
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 2, 0, 0 );
|
_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 0, 2, 0, 0 );
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0 );
|
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0 );
|
||||||
_vm->_interface->converseDisplayText();
|
_vm->_interface->converseDisplayText();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -458,9 +458,9 @@ void Puzzle::solicitHint(void) {
|
||||||
|
|
||||||
case kRQSakkaDenies:
|
case kRQSakkaDenies:
|
||||||
_vm->_interface->converseClear();
|
_vm->_interface->converseClear();
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 1, 0, 0);
|
_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0);
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 2, 0, 0);
|
_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 0, 2, 0, 0);
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
|
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
|
||||||
_vm->_interface->converseDisplayText();
|
_vm->_interface->converseDisplayText();
|
||||||
|
|
||||||
_vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
|
_vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
|
||||||
|
@ -546,7 +546,7 @@ void Puzzle::giveHint(void) {
|
||||||
|
|
||||||
_hintRqState = kRQNoHint;
|
_hintRqState = kRQNoHint;
|
||||||
|
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
|
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
|
||||||
_vm->_interface->converseDisplayText();
|
_vm->_interface->converseDisplayText();
|
||||||
|
|
||||||
_vm->_timer->removeTimerProc(&hintTimerCallback);
|
_vm->_timer->removeTimerProc(&hintTimerCallback);
|
||||||
|
@ -555,7 +555,7 @@ void Puzzle::giveHint(void) {
|
||||||
|
|
||||||
void Puzzle::clearHint(void) {
|
void Puzzle::clearHint(void) {
|
||||||
_vm->_interface->converseClear();
|
_vm->_interface->converseClear();
|
||||||
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
|
_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
|
||||||
_vm->_interface->converseDisplayText();
|
_vm->_interface->converseDisplayText();
|
||||||
_vm->_interface->setStatusText(" ");
|
_vm->_interface->setStatusText(" ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,7 @@ private:
|
||||||
void setThreadEntrypoint(ScriptThread *thread, int entrypointNumber);
|
void setThreadEntrypoint(ScriptThread *thread, int entrypointNumber);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void finishDialog(int replyID, int flags, int bitOffset);
|
void finishDialog(int strID, int replyID, int flags, int bitOffset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -1830,12 +1830,25 @@ void Script::sfPlayVoice(SCRIPTFUNC_PARAMS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Script::finishDialog(int replyID, int flags, int bitOffset) {
|
void Script::finishDialog(int strID, int replyID, int flags, int bitOffset) {
|
||||||
byte *addr;
|
byte *addr;
|
||||||
|
const char *str;
|
||||||
|
|
||||||
if (_conversingThread) {
|
if (_conversingThread) {
|
||||||
_vm->_interface->setMode(kPanelNull);
|
_vm->_interface->setMode(kPanelNull);
|
||||||
|
|
||||||
|
if (_vm->getGameType() == GType_IHNM) {
|
||||||
|
str = _conversingThread->_strings->getString(strID);
|
||||||
|
if (strcmp(str, "[") != 0) {
|
||||||
|
int sampleResourceId = -1;
|
||||||
|
sampleResourceId = _conversingThread->_voiceLUT->voices[strID];
|
||||||
|
if (sampleResourceId < 0 || sampleResourceId > 4000)
|
||||||
|
sampleResourceId = -1;
|
||||||
|
|
||||||
|
_vm->_actor->actorSpeech(_vm->_actor->_protagonist->_id, &str, 1, sampleResourceId, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_conversingThread->_flags &= ~kTFlagWaiting;
|
_conversingThread->_flags &= ~kTFlagWaiting;
|
||||||
|
|
||||||
_conversingThread->push(replyID);
|
_conversingThread->push(replyID);
|
||||||
|
@ -1911,17 +1924,30 @@ void Script::sfScriptFade(SCRIPTFUNC_PARAMS) {
|
||||||
int16 startingBrightness = thread->pop();
|
int16 startingBrightness = thread->pop();
|
||||||
int16 endingBrightness = thread->pop();
|
int16 endingBrightness = thread->pop();
|
||||||
// delay between pal changes is always 10 (not used)
|
// delay between pal changes is always 10 (not used)
|
||||||
|
|
||||||
Event event;
|
|
||||||
static PalEntry cur_pal[PAL_ENTRIES];
|
static PalEntry cur_pal[PAL_ENTRIES];
|
||||||
|
Event event;
|
||||||
|
short delta = (startingBrightness < endingBrightness) ? +1 : -1;
|
||||||
|
|
||||||
_vm->_gfx->getCurrentPal(cur_pal);
|
_vm->_gfx->getCurrentPal(cur_pal);
|
||||||
|
|
||||||
|
// TODO: This is still wrong, probably a new event type needs to be added (kEventPalFade)
|
||||||
|
warning("TODO: sfScriptFade");
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (startingBrightness > 255)
|
||||||
|
startingBrightness = 255;
|
||||||
|
if (startingBrightness < 0 )
|
||||||
|
startingBrightness = 0;
|
||||||
|
if (endingBrightness > 255)
|
||||||
|
endingBrightness = 255;
|
||||||
|
if (endingBrightness < 0)
|
||||||
|
endingBrightness = 0;
|
||||||
|
|
||||||
event.type = kEvTImmediate;
|
event.type = kEvTImmediate;
|
||||||
event.code = kPalEvent;
|
event.code = kPalEvent;
|
||||||
event.op = kEventPalToBlack;
|
event.op = kEventPalToBlack;
|
||||||
event.time = 0;
|
event.time = 0;
|
||||||
event.duration = endingBrightness - startingBrightness;
|
event.duration = kNormalFadeDuration - ((endingBrightness - startingBrightness) * delta);
|
||||||
event.data = cur_pal;
|
event.data = cur_pal;
|
||||||
|
|
||||||
_vm->_events->queue(&event);
|
_vm->_events->queue(&event);
|
||||||
|
|
|
@ -700,6 +700,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
|
||||||
replyNum = scriptS.readByte();
|
replyNum = scriptS.readByte();
|
||||||
flags = scriptS.readByte();
|
flags = scriptS.readByte();
|
||||||
iparam1 = 0;
|
iparam1 = 0;
|
||||||
|
int strID = thread->pop();
|
||||||
|
|
||||||
if (flags & kReplyOnce) {
|
if (flags & kReplyOnce) {
|
||||||
iparam1 = scriptS.readSint16LE();
|
iparam1 = scriptS.readSint16LE();
|
||||||
|
@ -709,8 +710,8 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
str = thread->_strings->getString(thread->pop());
|
str = thread->_strings->getString(strID);
|
||||||
if (_vm->_interface->converseAddText(str, replyNum, flags, iparam1))
|
if (_vm->_interface->converseAddText(str, strID, replyNum, flags, iparam1))
|
||||||
warning("Error adding ConverseText (%s, %d, %d, %d)", str, replyNum, flags, iparam1);
|
warning("Error adding ConverseText (%s, %d, %d, %d)", str, replyNum, flags, iparam1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue