diff options
author | James Brown | 2002-12-26 08:06:33 +0000 |
---|---|---|
committer | James Brown | 2002-12-26 08:06:33 +0000 |
commit | f0e31cc23fb60ea6eea8656d5a83b3669280d728 (patch) | |
tree | 64a9013c03bbc25934c43b792923e0217ee3ad22 | |
parent | 608812f683ae8d2bd070c24485c4876189ac8f60 (diff) | |
download | scummvm-rg350-f0e31cc23fb60ea6eea8656d5a83b3669280d728.tar.gz scummvm-rg350-f0e31cc23fb60ea6eea8656d5a83b3669280d728.tar.bz2 scummvm-rg350-f0e31cc23fb60ea6eea8656d5a83b3669280d728.zip |
Update more CMI opcodes. The first room now starts, although actor text crashes if I try and draw it (Fingolfin?).
Object Flags seem to be, suprise, wrong.. as the door to the outside starts open :)
svn-id: r6169
-rw-r--r-- | scumm/intern.h | 3 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 110 |
2 files changed, 107 insertions, 6 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index b15d4a93bc..c1659105d8 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -419,6 +419,9 @@ protected: void o8_printSystem(); void o8_blastText(); + void o8_talkActor(); + void o8_talkActorSimple(); + void o8_cursorCommand(); void o8_resourceRoutines(); void o8_roomOps(); diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index f2f443c8c2..742fd3b2af 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -200,7 +200,7 @@ void Scumm_v8::setupOpcodes() /* 7C */ OPCODE(o6_stopScript), OPCODE(o6_jumpToScript), // FIXME - is this right? "O_CHAIN_SCRIPT" - OPCODE(o6_invalid), + OPCODE(o6_dummy), OPCODE(o6_startObject), /* 80 */ OPCODE(o6_stopObjectScript), // FIXME - is this right? @@ -221,10 +221,10 @@ void Scumm_v8::setupOpcodes() OPCODE(o6_panCameraTo), OPCODE(o6_actorFollowCamera), OPCODE(o6_setCameraAt), - OPCODE(o6_invalid), + OPCODE(o8_talkActor), /* 90 */ OPCODE(o6_invalid), - OPCODE(o6_invalid), + OPCODE(o8_talkActorSimple), OPCODE(o6_invalid), OPCODE(o8_printLine), /* 94 */ @@ -643,15 +643,57 @@ void Scumm_v8::o8_wait() // TODO byte subOp = fetchScriptByte(); switch (subOp) { - case 0x1E: // SO_WAIT_FOR_ACTOR Wait for actor (to finish current action?) + case 0x1E: { // SO_WAIT_FOR_ACTOR Wait for actor (to finish current action?) + int offs = fetchScriptWordSigned(); + if (derefActorSafe(pop(), "o8_wait:SO_WAIT_FOR_ACTOR")->moving) { + _scriptPointer += offs; + o6_breakHere(); + } + return; + } case 0x1F: // SO_WAIT_FOR_MESSAGE Wait for message + if (_vars[VAR_HAVE_MSG]) + break; + return; case 0x20: // SO_WAIT_FOR_CAMERA Wait for camera (to finish current action?) + if (camera._dest != camera._cur) + break; case 0x21: // SO_WAIT_FOR_SENTENCE - case 0x22: // SO_WAIT_FOR_ANIMATION - case 0x23: // SO_WAIT_FOR_TURN + if (_sentenceNum) { + if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) + return; + break; + } + if (!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) + return; + break; + case 0x22: { // SO_WAIT_FOR_ANIMATION + int actnum = pop(); + Actor *a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_ANIMATION"); + int offs = fetchScriptWordSigned(); + if (a && a->isInCurrentRoom() && a->needRedraw) { + _scriptPointer += offs; + o6_breakHere(); + } + return; + } + case 0x23: { // SO_WAIT_FOR_TURN + int actnum = pop(); + Actor *a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_TURN"); + int offs = fetchScriptWordSigned(); + if (a && a->isInCurrentRoom() && a->moving & MF_TURN) { + _scriptPointer += offs; + o6_breakHere(); + } + return; + } + default: error("o8_wait: default case %d", subOp); } + + _scriptPointer -= 2; + o6_breakHere(); } void Scumm_v8::o8_dim() @@ -747,6 +789,62 @@ void Scumm_v8::o8_arrayOps() } } +void Scumm_v8::o8_talkActor() { + int _actorToPrintStrFor = pop(); + + _messagePtr = _scriptPointer; + if (_messagePtr[0] == '/') { + char pointer[20]; + int i, j; + + _scriptPointer += resStrLen((char*)_scriptPointer)+ 1; + translateText(_messagePtr, _transText); + for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) { + if (_messagePtr[i] != '/') + pointer[j++] = _messagePtr[i]; + } + pointer[j] = 0; + + _messagePtr = _transText; + //setStringVars(0); + //actorTalk(); // FIXME - This crashes + } else { + //setStringVars(0); + //actorTalk(); // FIXME - This crashes + _scriptPointer = _messagePtr; + } + + printf("o8_talkActor(%d, %s)\n", _actorToPrintStrFor, _messagePtr); +} + +void Scumm_v8::o8_talkActorSimple() { + int _actorToPrintStrFor = pop(); + + _messagePtr = _scriptPointer; + if (_messagePtr[0] == '/') { + char pointer[20]; + int i, j; + + _scriptPointer += resStrLen((char*)_scriptPointer)+ 1; + translateText(_messagePtr, _transText); + for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) { + if (_messagePtr[i] != '/') + pointer[j++] = _messagePtr[i]; + } + pointer[j] = 0; + + _messagePtr = _transText; + //setStringVars(0); + //actorTalk(); // FIXME - This crashes + } else { + //setStringVars(0); + //actorTalk(); // FIXME - This crashes + _scriptPointer = _messagePtr; + } + + printf("o8_talkActorSimple(%d, %s)\n", _actorToPrintStrFor, _messagePtr); +} + void Scumm_v8::o8_printLine() { // FIXME |