SHERLOCK: Implement some more Rose Tattoo script opcodes

These are cmdSetNPCInfoLine, cmdSetNPCVerb, cmdSetNPCVerbCAnimation,
cmdSetNPCVerbScript and cmdSetNPCVerbTarget
This commit is contained in:
Filippos Karapetis 2015-06-07 03:38:51 +03:00
parent dfd036bf71
commit 75610e7119

View File

@ -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 = "";