diff options
author | James Brown | 2002-04-09 06:46:24 +0000 |
---|---|---|
committer | James Brown | 2002-04-09 06:46:24 +0000 |
commit | 0313be280a2e045c8b91d07baf5c0e044ac93490 (patch) | |
tree | bc0e0516c58a4895e896fbf27d95a21c44af910d | |
parent | 011cf6e066c2fa1a66f98282a0f9686b6c4fa4a5 (diff) | |
download | scummvm-rg350-0313be280a2e045c8b91d07baf5c0e044ac93490.tar.gz scummvm-rg350-0313be280a2e045c8b91d07baf5c0e044ac93490.tar.bz2 scummvm-rg350-0313be280a2e045c8b91d07baf5c0e044ac93490.zip |
Fix the BUN string parser. Doesn't crash other games anymore :)
svn-id: r3896
-rw-r--r-- | script_v2.cpp | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/script_v2.cpp b/script_v2.cpp index bcb2b78275..6e976d3473 100644 --- a/script_v2.cpp +++ b/script_v2.cpp @@ -2354,19 +2354,17 @@ void Scumm::o6_printEgo() { } void Scumm::o6_talkActor() { - char *pointer = NULL, *string = NULL; _actorToPrintStrFor = pop(); - pointer = string = (char *)_scriptPointer; - - pointer = strtok(pointer, "/"); - if (pointer) { - playBundleSound(pointer); - pointer = strtok(NULL, ""); - _messagePtr = (unsigned char *)pointer; - } else { - _messagePtr = (unsigned char *)string; - } + _messagePtr = _scriptPointer; + if (_scriptPointer[0] == '/') { + char *pointer = strtok((char *)_scriptPointer, "/"); + int bunsize = strlen(pointer) + 2; + playBundleSound(pointer); + _scriptPointer += bunsize; + _messagePtr = _scriptPointer; + } + setStringVars(0); actorTalk(); _scriptPointer = _messagePtr; @@ -2375,6 +2373,15 @@ void Scumm::o6_talkActor() { void Scumm::o6_talkEgo() { _actorToPrintStrFor = (unsigned char)_vars[VAR_EGO]; _messagePtr = _scriptPointer; + + if (_scriptPointer[0] == '/') { + char *pointer = strtok((char *)_scriptPointer, "/"); + int bunsize = strlen(pointer) + 2; + playBundleSound(pointer); + _scriptPointer += bunsize; + _messagePtr = _scriptPointer; + } + setStringVars(0); actorTalk(); _scriptPointer = _messagePtr; @@ -2826,18 +2833,26 @@ void Scumm::decodeParseString2(int m, int n) { case 74: string[m].no_talk_anim = true; break; - case 75: - _messagePtr = _scriptPointer; + case 75: { + _messagePtr = _scriptPointer; + + if (_scriptPointer[0] == '/') { + char *pointer = strtok((char *)_scriptPointer, "/"); + int bunsize = strlen(pointer) + 2; + playBundleSound(pointer); + _scriptPointer += bunsize; + _messagePtr = _scriptPointer; + } + switch(m) { - case 0: actorTalk(); break; - case 1: drawString(1); break; - - case 2: unkMessage1(); break; - case 3: unkMessage2(); break; + case 0: actorTalk(); break; + case 1: drawString(1); break; + case 2: unkMessage1(); break; + case 3: unkMessage2(); break; } _scriptPointer = _messagePtr; return; - + } case 0xFE: setStringVars(m); if (n) |