aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorFilippos Karapetis2015-06-07 03:38:51 +0300
committerFilippos Karapetis2015-06-07 03:38:51 +0300
commit75610e7119b415779380805912de40101e3be656 (patch)
treee44c1691626dd910fba648d17d1a552af4573ae3 /engines/sherlock
parentdfd036bf71ddf8fe3abe8c103e7af25f83fbf094 (diff)
downloadscummvm-rg350-75610e7119b415779380805912de40101e3be656.tar.gz
scummvm-rg350-75610e7119b415779380805912de40101e3be656.tar.bz2
scummvm-rg350-75610e7119b415779380805912de40101e3be656.zip
SHERLOCK: Implement some more Rose Tattoo script opcodes
These are cmdSetNPCInfoLine, cmdSetNPCVerb, cmdSetNPCVerbCAnimation, cmdSetNPCVerbScript and cmdSetNPCVerbTarget
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp118
1 files changed, 106 insertions, 12 deletions
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 9d69d8f625..4075450c2e 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -216,7 +216,20 @@ OpcodeReturn TattooTalk::cmdPassword(const byte *&str) { error("TODO: script opc
OpcodeReturn TattooTalk::cmdPlaySong(const byte *&str) { error("TODO: script opcode"); }
OpcodeReturn TattooTalk::cmdRestorePeopleSequence(const byte *&str) { error("TODO: script opcode"); }
OpcodeReturn TattooTalk::cmdSetNPCDescOnOff(const byte *&str) { error("TODO: script opcode"); }
-OpcodeReturn TattooTalk::cmdSetNPCInfoLine(const byte *&str) { error("TODO: script opcode"); }
+
+OpcodeReturn TattooTalk::cmdSetNPCInfoLine(const byte *&str) {
+ int npcNum = *++str;
+ int len = *++str;
+ People &people = *_vm->_people;
+ Person &person = people[npcNum];
+
+ for (int x = 0; x < len; x++)
+ person._description.setChar(str[x + 1], x);
+ person._description.setChar(0, len);
+ str += len;
+
+ return RET_SUCCESS;
+}
OpcodeReturn TattooTalk::cmdSetNPCOff(const byte *&str) {
People &people = *_vm->_people;
@@ -240,17 +253,16 @@ OpcodeReturn TattooTalk::cmdSetNPCPathPauseTakingNotes(const byte *&str) { error
OpcodeReturn TattooTalk::cmdSetNPCPathPauseLookingHolmes(const byte *&str) { error("TODO: script opcode"); }
OpcodeReturn TattooTalk::cmdSetNPCPosition(const byte *&str) {
- ++str;
- int npc = *str - 1;
+ int npcNum = *++str - 1;
++str;
People &people = *_vm->_people;
- Person &person = people[npc];
+ Person &person = people[npcNum];
int32 posX = (str[0] - 1) * 256 + str[1] - 1;
if (posX > 16384)
posX = -1 * (posX - 16384);
int32 posY = (str[2] - 1) * 256 + str[3] - 1;
- people[npc]._position = Point32(posX * 1000, posY * 1000);
+ people[npcNum]._position = Point32(posX * 1000, posY * 1000);
if (person._seqTo && person._walkLoaded) {
person._walkSequences[person._sequenceNumber]._sequences[person._frameNumber] = person._seqTo;
person._seqTo = 0;
@@ -283,16 +295,98 @@ OpcodeReturn TattooTalk::cmdSetNPCPosition(const byte *&str) {
}
OpcodeReturn TattooTalk::cmdSetNPCTalkFile(const byte *&str) { error("TODO: script opcode"); }
-OpcodeReturn TattooTalk::cmdSetNPCVerb(const byte *&str) { error("TODO: script opcode"); }
-OpcodeReturn TattooTalk::cmdSetNPCVerbCAnimation(const byte *&str) { error("TODO: script opcode"); }
-OpcodeReturn TattooTalk::cmdSetNPCVerbScript(const byte *&str) { error("TODO: script opcode"); }
-OpcodeReturn TattooTalk::cmdSetNPCVerbTarget(const byte *&str) { error("TODO: script opcode"); }
+
+OpcodeReturn TattooTalk::cmdSetNPCVerb(const byte *&str) {
+ int npcNum = *++str;
+ int verbNum = *++str - 1;
+ People &people = *_vm->_people;
+ Common::String &verb = people[npcNum]._use[verbNum]._verb;
+
+ for (int x = 0; x < 12; x++) {
+ if (str[x + 1] != '~')
+ verb.setChar(str[x + 1], x);
+ else
+ verb.setChar(0, x);
+ }
+
+ verb.setChar(0, 11);
+
+ uint len = verb.size() - 1;
+ while (verb[len] == ' ' && len)
+ len--;
+ verb.setChar(0, len + 1);
+ if (verb != " ")
+ verb.clear();
+ str += 12;
+
+ return RET_SUCCESS;
+}
+
+OpcodeReturn TattooTalk::cmdSetNPCVerbCAnimation(const byte *&str) {
+ int npcNum = *++str;
+ int verbNum = *++str - 1;
+ People &people = *_vm->_people;
+ UseType &useType = people[npcNum]._use[verbNum];
+
+ useType._cAnimNum = (str[1] - 1) & 127;
+ useType._cAnimSpeed = 1 + 128 * (str[1] >= 128);
+ str++;
+
+ return RET_SUCCESS;
+}
+
+OpcodeReturn TattooTalk::cmdSetNPCVerbScript(const byte *&str) {
+ int npcNum = *++str;
+ int verbNum = *++str - 1;
+ People &people = *_vm->_people;
+ UseType &useType = people[npcNum]._use[verbNum];
+ Common::String &name = useType._names[0];
+ name.setChar('*', 0);
+ name.setChar('C', 1);
+
+ for (int x = 0; x < 8; x++) {
+ if (str[x + 1] != '~')
+ name.setChar(str[x + 1], x + 2);
+ else
+ name.setChar(0, x + 2);
+ }
+
+ name.setChar(0, 11);
+ useType._cAnimNum = 99;
+ useType._cAnimSpeed = 1;
+ str += 8;
+
+ return RET_SUCCESS;
+}
+
+OpcodeReturn TattooTalk::cmdSetNPCVerbTarget(const byte *&str) {
+ int npcNum = *++str;
+ int verbNum = *++str - 1;
+ People &people = *_vm->_people;
+ Common::String &target = people[npcNum]._use[verbNum]._target;
+
+ for (int x = 0; x < 12; x++) {
+ if (str[x + 1] != '~')
+ target.setChar(str[x + 1], x);
+ else
+ target.setChar(0, x);
+ }
+
+ target.setChar(0, 11);
+
+ uint len = target.size() - 1;
+ while (target[len] == ' ' && len)
+ len--;
+ target.setChar(0, len + 1);
+ str += 12;
+
+ return RET_SUCCESS;
+}
OpcodeReturn TattooTalk::cmdSetNPCWalkGraphics(const byte *&str) {
- ++str;
- int npc = *str - 1;
+ int npcNum = *++str - 1;
People &people = *_vm->_people;
- Person &person = people[npc];
+ Person &person = people[npcNum];
// Build up walk library name for the given NPC
person._walkVGSName = "";