Improved talking.

svn-id: r10813
This commit is contained in:
David Eriksson 2003-10-15 11:33:02 +00:00
parent 233e33cf78
commit de410e62f2
4 changed files with 697 additions and 67 deletions

View File

@ -496,12 +496,10 @@ byte *Cutaway::getCutawayAnim(byte *ptr, int header, CutawayAnim &anim) {
if (0 == header) {
anim.object = 0;
// XXX
#if 0
anim.originalFrame =29+XTRA;
anim.originalFrame = 29 + FRAMES_JOE_XTRA;
// 21/9/94, Make sure that bobs are clipped on 150 screens
if(FULLSCREEN) bobs[0].y2=199;
#endif
// XXX if(FULLSCREEN) bobs[0].y2=199;
}
else {
warning("Stuff not yet implemented in Cutaway::handleAnimation()");
@ -626,26 +624,18 @@ void Cutaway::handlePersonRecord(
const char *sentence) {
// Lines 1455-1516 in cutaway.c
char name[MAX_STRING_SIZE];
Person p;
if (object.objectNumber == OBJECT_JOE) {
if (object.moveToX || object.moveToY) {
_walk->joeMove(0, object.moveToX, object.moveToY, true);
}
strcpy(name, "JOE");
}
else {
Person p;
_logic->personSetData(
object.objectNumber - _logic->roomData(object.room),
"", true, &p);
#if 0
debug(0, "Moving person '%s' (%i) = actor '%s' to (%i,%i)",
_logic->objectName(object.objectNumber),
object.objectNumber,
p.name, object.moveToX, object.moveToY);
#endif
strcpy(name, p.name);
if (object.bobStartX || object.bobStartY) {
BobSlot *bob = _graphics->bob(p.actor->bobNum);
bob->scale = 100; // XXX SF;
@ -653,14 +643,12 @@ void Cutaway::handlePersonRecord(
bob->y = object.bobStartY;
}
#if 1
_walk->personMove(
&p,
object.moveToX, object.moveToY,
_logic->numFrames() + 1, // XXX CI+1
_logic->objectData(object.objectNumber)->image
);
#endif
}
if (_quit)
@ -691,7 +679,7 @@ void Cutaway::handlePersonRecord(
char voiceFilePrefix[MAX_STRING_SIZE];
findCdCut(_basename, index, voiceFilePrefix);
Talk::speak(sentence, name, voiceFilePrefix,
Talk::speak(sentence, (object.objectNumber == OBJECT_JOE) ? NULL : &p, voiceFilePrefix,
_graphics, _logic, _resource);
}

View File

@ -46,7 +46,7 @@ void Talk::talk(
bool Talk::speak(
const char *sentence,
const char *person,
Person *person,
const char *voiceFilePrefix,
Graphics *graphics,
Logic *logic,
@ -110,15 +110,9 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
load(filename);
//Person person;
//_logic->personSetData(
Person person;
_logic->personSetData(personInRoom, "", false, &person);
char personName[MAX_STRING_SIZE];
// XXX SET_PERSON_DATA(N,NAMEstr,0);
int bobNum = 1; // XXX P_BNUM;
// XXX strcpy(PERstr,P_NAMEstr);
personName[0] = '\0';
int16 oldLevel = 0;
bool personWalking = false; // OWALK in talk.c
@ -201,21 +195,21 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
if (1 == choicesLeft) {
// Automatically run the final dialogue option
if (speak(_talkString[0], personName, otherVoiceFilePrefix))
if (speak(_talkString[0], &person, otherVoiceFilePrefix))
personWalking = true;
if (_quit)
break;
speak(_talkString[selectedSentence], personName, _joeVoiceFilePrefix[selectedSentence]);
speak(_talkString[selectedSentence], &person, _joeVoiceFilePrefix[selectedSentence]);
}
else {
if (bobNum > 0) {
speak(_talkString[0], personName, otherVoiceFilePrefix);
if (person.actor->bobNum > 0) {
speak(_talkString[0], &person, otherVoiceFilePrefix);
selectedSentence = selectSentence();
}
else {
warning("bobBum is %i", bobNum);
warning("bobBum is %i", person.actor->bobNum);
selectedSentence = 0;
}
}
@ -286,7 +280,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
findDialogueString(_person1Ptr, head, _talkString[0]);
if (_talkString[0][0] != '\0') {
sprintf(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head);
if (speak(_talkString[0], personName, otherVoiceFilePrefix))
if (speak(_talkString[0], &person, otherVoiceFilePrefix))
personWalking = true;
}
}
@ -426,7 +420,7 @@ void Talk::initialTalk() {
if (joeString[0] != '0') {
char voiceFilePrefix[MAX_STRING_SIZE];
sprintf(voiceFilePrefix, "%2dSSSSJ", _talkKey);
speak(joeString, "JOE", voiceFilePrefix);
speak(joeString, NULL, voiceFilePrefix);
}
}
else {
@ -435,7 +429,7 @@ void Talk::initialTalk() {
if (joe2String[0] != '0') {
char voiceFilePrefix[MAX_STRING_SIZE];
sprintf(voiceFilePrefix, "%2dSSSSJ", _talkKey);
speak(joe2String, "JOE", voiceFilePrefix);
speak(joe2String, NULL, voiceFilePrefix);
}
}
@ -493,8 +487,9 @@ int Talk::getSpeakCommand(const char *sentence, unsigned &index) {
// For example *XY00(237,112)
if (sentence[index + 1] == 'Y') {
commandCode = atoi(sentence + index + 2);
// XXX int x = atoi(sentence + index + 5);
// XXX int y = atoi(sentence + index + 9);
int x = atoi(sentence + index + 5);
int y = atoi(sentence + index + 9);
debug(0, "Calling MOVE_SPEAK(person, %i, %i)",x, y);
// XXX MOVE_SPEAK(person, x, y)
index += 11;
/// XXX personWalking = true;
@ -518,28 +513,45 @@ int Talk::getSpeakCommand(const char *sentence, unsigned &index) {
}
bool Talk::speak(const char *sentence, const char *person, const char *voiceFilePrefix) {
bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePrefix) {
// Function SPEAK, lines 1266-1384 in talk.c
bool personWalking = false;
bool talkHead;
unsigned segmentIndex = 0;
unsigned segmentStart = 0;
unsigned i;
Person joe_person;
ActorData joe_actor;
if (!person) {
// Fill in values for use by speakSegment() etc.
memset(&joe_person, 0, sizeof(Person));
memset(&joe_actor, 0, sizeof(ActorData));
joe_actor.bobNum = 0;
joe_actor.color = 14;
joe_actor.bankNum = 7;
joe_person.actor = &joe_actor;
joe_person.name = "JOE";
person = &joe_person;
}
debug(0, "Sentence '%s' is said by person '%s' and voice files with prefix '%s' played",
sentence, person, voiceFilePrefix);
sentence, person->name, voiceFilePrefix);
if (sentence[0] == '\0') {
goto exit;
}
if (0 == strcmp(person, "FAYE-H") ||
0 == strcmp(person, "FRANK-H") ||
0 == strcmp(person, "AZURA-H") ||
0 == strcmp(person, "X3_RITA-H"))
talkHead = true;
if (0 == strcmp(person->name, "FAYE-H") ||
0 == strcmp(person->name, "FRANK-H") ||
0 == strcmp(person->name, "AZURA-H") ||
0 == strcmp(person->name, "X3_RITA-H"))
_talkHead = true;
else
talkHead = false;
_talkHead = false;
// XXX CLEAR_COMMAND(false)
@ -594,8 +606,8 @@ int Talk::countSpaces(const char *segment) {
void Talk::speakSegment(
const char *segment,
int length,
const char *person,
int length,
Person *person,
int command,
const char *voiceFilePrefix,
int index) {
@ -608,26 +620,170 @@ void Talk::speakSegment(
debug(0, "Playing voice file '%s'", voiceFileName);
int faceDirectionCommand = 0;
if (SPEAK_PAUSE == command) {
for (int i = 0; i < 10; i++) {
if (_quit)
break;
_graphics->update();
}
return;
switch (command) {
case SPEAK_PAUSE:
for (int i = 0; i < 10; i++) {
if (_quit)
break;
_graphics->update();
}
return;
case SPEAK_FACE_LEFT:
case SPEAK_FACE_RIGHT:
case SPEAK_FACE_FRONT:
case SPEAK_FACE_BACK:
faceDirectionCommand = command;
command = 0;
break;
}
//int spaces = countSpaces(segment);
if (scumm_stricmp(person, "JOE")) {
bool isJoe = (0 == person->actor->bobNum);
int16 bobNum = person->actor->bobNum;
//uint16 color = person->actor->color;
uint16 bankNum = person->actor->bankNum;
BobSlot *bob = _graphics->bob(bobNum);
int textX = 0;
int textY = 0;
if (!isJoe) {
if (SPEAK_AMAL_ON == command) {
// It's the oracle!
// Dont turn AMAL animation off, and dont manually anim person
command = SPEAK_ORACLE;
warning("Oracle not yet handled!");
// XXX oracle=1;
// XXX k=PERSON_FRAMES[BNUM];
// XXX for(i=5;i<=8;i++) {
// XXX unpack(i,k,BANK);
// XXX k=k+1;
// XXX }
}
else {
bob->animating = false;
bob->frameNum = 29 + bobNum + FRAMES_JOE_XTRA;
}
}
if (_talkHead) {
// talk.c lines 1491-1533
warning("Talking heads not yet handled");
}
else {
textX = bob->x;
textY = bob->y;
}
//int SF = _logic->findScale(textX, textY);
const SpeechParameters *parameters = NULL;
if (_talkHead && isJoe) {
// XXX MAKE_SPEAK_BOB(Tstr,tx,ty,C,TALKHEAD==1);
}
else {
if (SPEAK_UNKNOWN_6 == command)
return;
if (isJoe) {
if (_logic->currentRoom() == 108)
parameters = findSpeechParameters("JOE-E", command, 0);
else
parameters = findSpeechParameters("JOE", command, _logic->joeFacing());
}
else
parameters = findSpeechParameters(person->name, command, 0);
int startFrame = 29 + bobNum + FRAMES_JOE_XTRA;
int faceDirection = 0;
if (isJoe && _logic->joeFacing() == DIR_LEFT)
faceDirection = DIR_LEFT;
else if (!isJoe) {
ObjectData *data = _logic->objectData(_logic->objectForPerson(bobNum));
if (data->image == -3)
faceDirection = DIR_LEFT;
if (faceDirectionCommand == SPEAK_FACE_LEFT)
data->image = -3;
else if (faceDirectionCommand == SPEAK_FACE_RIGHT)
data->image = -4;
}
if (faceDirectionCommand) {
switch (faceDirectionCommand) {
case SPEAK_FACE_LEFT: faceDirection = DIR_LEFT; break;
case SPEAK_FACE_RIGHT: faceDirection = DIR_RIGHT; break;
case SPEAK_FACE_FRONT: faceDirection = DIR_FRONT; break;
case SPEAK_FACE_BACK: faceDirection = DIR_BACK; break;
}
if (isJoe)
_logic->joeFacing(faceDirection);
}
if (!isJoe) {
bob->xflip = (faceDirection == DIR_LEFT);
}
// Run animated sequence if SANIMstr is primed
if (_talkHead) {
// talk.c lines 1612-1635
warning("Talking heads not yet handled");
}
// XXX MAKE_SPEAK_BOB(Tstr,tx,ty,C,TALKHEAD==1);
if (parameters->animation[0] != '\0') {
// talk.c lines 1639-1690
warning("Speech animation not yet implemented");
}
else {
_graphics->bankUnpack(parameters->body, startFrame, bankNum);
}
if (length == 0 && !isJoe && parameters->bf > 0) {
_graphics->bankOverpack(parameters->bf, startFrame, bankNum);
_graphics->update();
}
// TODO implement more
}
// talkloop: XXX
// TODO implement more
}
const Talk::SpeechParameters *Talk::findSpeechParameters(
const char *name,
int state,
int faceDirection) {
// function FIND_SACTION in queen.c
const SpeechParameters *iterator = _speechParameters;
if (faceDirection == DIR_RIGHT)
faceDirection = DIR_LEFT;
while (iterator->name[0] != '*') {
if (0 == scumm_stricmp(iterator->name, name) &&
iterator->state == state &&
iterator->faceDirection == faceDirection)
break;
iterator++;
}
return iterator;
}
byte *Talk::getString(byte *ptr, char *str, int maxLength, int align) {
int length = *ptr;
@ -840,7 +996,7 @@ int16 Talk::selectSentence() {
if (selectedSentence > 0) {
_graphics->textClear(0,198);
speak(_talkString[selectedSentence], "JOE", _joeVoiceFilePrefix[selectedSentence]);
speak(_talkString[selectedSentence], NULL, _joeVoiceFilePrefix[selectedSentence]);
}
_graphics->textClear(151,151);
@ -848,4 +1004,469 @@ int16 Talk::selectSentence() {
return selectedSentence;
}
const Talk::SpeechParameters Talk::_speechParameters[] = {
{ "JOE",0,1,1,10,2,3,"",0},
{ "JOE",0,3,3,28,2,3,"",0},
{ "JOE",0,4,5,38,1,0,"",0},
{ "JOE",1,1,1,45,-1,0,"",0},
{ "JOE",1,3,3,28,2,3,"",0},
{ "JOE",1,4,5,38,1,0,"",0},
{ "JOE",2,1,1,46,-1,0,"",0},
{ "JOE",2,3,3,28,2,3,"",0},
{ "JOE",2,4,5,38,1,0,"",0},
{ "JOE",3,1,1,47,-1,0,"",0},
{ "JOE",3,3,3,28,2,3,"",0},
{ "JOE",3,4,5,38,1,0,"",0},
{ "JOE",4,1,1,50,-1,0,"",0},
{ "JOE",4,3,3,28,2,3,"",0},
{ "JOE",4,4,5,38,1,0,"",0},
{ "JOE",5,1,2,0,0,0,"",0},
{ "JOE",5,3,4,0,0,0,"",0},
{ "JOE",5,4,6,0,0,0,"",0},
//CR - Change 48,1,0 -> 48,0,1
{ "JOE",6,1,1,48,0,1,"",0},
{ "JOE",6,3,3,28,2,3,"",0},
{ "JOE",6,4,5,38,1,0,"",0},
//CR - Change 51,1,0 -> 51,0,1
{ "JOE",7,1,1,51,0,1,"",0},
{ "JOE",7,3,3,28,2,3,"",0},
{ "JOE",7,4,5,38,1,0,"",0},
{ "JOE",8,1,1,26,0,0,"",0},
{ "JOE",8,3,3,28,2,3,"",0},
{ "JOE",8,4,5,38,1,0,"",0},
{ "JOE",9,1,1,29,0,0,"",0},
{ "JOE",9,3,3,28,0,0,"",0},
{ "JOE",9,4,5,38,0,0,"",0},
// - Look down, sad. 10,12,46
{ "JOE",10,1,1,12,0,0,"T046,010,010,010,012,012,012,012,012,012,012,012,012,012,012,012,012,012,010,000",0},
{ "JOE",10,3,3,18,0,0,"",0},
{ "JOE",10,4,5,44,0,0,"",0},
{ "JOE",11,1,1,53,-1,0,"",0},
{ "JOE",11,3,3,28,2,3,"",0},
{ "JOE",11,4,5,38,1,0,"",0},
{ "JOE",12,1,1,10,2,3,"",0},
{ "JOE",12,3,3,28,2,0,"",0},
{ "JOE",12,4,5,38,1,0,"",0},
{ "JOE",13,1,1,10,2,3,"T012,013,019,019,019,019,019,019,019,019,019,019,013,010,000",0},
{ "JOE",13,3,3,28,2,3,"",0},
{ "JOE",13,4,5,38,1,0,"",0},
// - 7/11/94, Make Joe look front
{ "JOE",14,1,1,16,2,3,"",16},
{ "JOE",14,3,3,28,2,3,"",0},
{ "JOE",14,4,5,38,1,0,"",0},
{ "JOE",15,1,1,58,-1,0,"",0},
{ "JOE",15,3,3,28,2,3,"",0},
{ "JOE",15,4,5,38,1,0,"",0},
{ "JOE",16,1,1,59,-1,0,"",0},
{ "JOE",16,3,3,28,2,3,"",0},
{ "JOE",16,4,5,38,1,0,"",0},
{ "JOE",17,1,1,56,-1,0,"",0},
{ "JOE",17,3,3,28,2,3,"",0},
{ "JOE",17,4,5,38,1,0,"",0},
{ "JOE",18,1,56,16,2,3,"T056,057,057,057,056,056,000",0},
{ "JOE",18,3,3,28,2,3,"",0},
{ "JOE",18,4,5,38,1,0,"",0},
{ "JOE",19,1,54,16,2,3,"T054,055,057,056,000",0},
{ "JOE",19,3,3,28,2,3,"",0},
{ "JOE",19,4,5,38,1,0,"",0},
{ "JOE",20,1,56,16,2,3,"T056,057,055,054,001,000",0},
{ "JOE",20,3,3,28,2,3,"",0},
{ "JOE",20,4,5,38,1,0,"",0},
{ "JOE",21,1,1,60,-1,0,"",0},
{ "JOE",21,3,3,28,2,3,"",0},
{ "JOE",21,4,61,38,1,0,"",0},
{ "JOE",22,1,1,16,2,3,"T063,060,000",0},
{ "JOE",22,3,3,28,2,3,"",0},
{ "JOE",22,4,5,38,1,0,"",0},
{ "JOE",23,1,1,16,2,3,"T060,063,001,000",0},
{ "JOE",23,3,3,28,2,3,"",0},
{ "JOE",23,4,5,38,1,0,"",0},
{ "JOE",24,1,1,47,-2,0,"",0},
{ "JOE",24,3,3,28,2,3,"",0},
{ "JOE",24,4,5,38,1,0,"",0},
{ "RICO",0,0,1,7,1,3,"",7},
{ "RICO",1,0,1,5,-1,0,"",7},
{ "RICO",2,0,1,9,0,3,"",7},
{ "RICO",3,0,1,4,-1,0,"",7},
{ "EDDY",0,0,14,18,1,3,"",18},
{ "EDDY",1,0,14,0,0,0,"T016,017,017,016,016,017,017,016,016,017,017,000",18},
{ "MIKE",0,0,1,2,2,3,"",2},
{ "LOLA",0,0,30,33,2,3,"",33},
{ "LOLA",1,0,9,10,2,3,"",33},
{ "LOLA",2,0,30,33,2,3,"",33},
{ "LOLA",3,0,32,33,2,3,"",33},
//CR 2 - 22/2/95,
{ "LOLA",4,0,8,0,0,0,"",33},
{ "LOLA",5,0,31,0,0,0,"",0},
{ "LOLA",6,0,31,0,0,0,"047,048,049,050,000",33},
{ "LOLA_SHOWER",0,0,7,10,2,3,"",10},
{ "LOLA_SHOWER",1,0,9,10,2,3,"",10},
{ "LOLA_SHOWER",2,0,30,33,2,3,"",10},
{ "LOLA_SHOWER",3,0,32,33,2,3,"",10},
{ "LOLA_SHOWER",4,0,8,0,0,0,"",0},
{ "LOLA_SHOWER",5,0,61,0,0,0,"",0},
{ "LOLA_SHOWER",6,0,64,10,2,3,"",0},
{ "LOLA_SHOWER",7,0,31,0,0,0,"062,063,064,000",0},
// { "SECRETARY",0,0,1,12,2,0,"",12},
// Change Secretary
{ "SECRETARY",0,0,1,12,2,3,"",12},
{ "SECRETARY",1,0,1,12,2,0,"",12},
{ "SECRETARY",2,0,1,12,2,0,"",12},
// { "SPARKY",0,0,21,23,5,0,"",23},
// Change Sparky talk code
{ "SPARKY",0,0,21,23,2,3,"",23},
{ "SPARKY",1,0,21,22,0,0,"",0},
{ "SPARKY",2,0,21,22,0,0,"021,042,043,000",0},
{ "SPARKY",3,0,21,22,0,0,"043,042,021,000",0},
{ "SPARKY",4,0,43,43,1,0,"",0},
{ "SPARKY",14,0,21,29,5,0,"",29},
{ "SPARKY-F",0,0,45,23,5,0,"",23},
{ "SPARKY-F",1,0,45,47,0,0,"",0},
{ "SPARKY-F",2,0,45,23,5,0,"045,046,046,045,000",23},
{ "SPARKY-F",14,0,45,29,5,0,"",29},
{ "FAYE",0,0,19,35,2,3,"",35},
{ "FAYE",1,0,19,41,2,3,"",35},
{ "FAYE",2,0,19,28,-1,0,"",35},
{ "FAYE",3,0,19,20,0,0,"",0},
{ "FAYE",4,0,19,27,-1,0,"",35},
{ "FAYE",5,0,19,29,-1,0,"",35},
{ "FAYE",6,0,59,35,2,3,"",35},
{ "FAYE",7,0,19,30,-1,0,"",35},
{ "FAYE",8,0,19,31,-1,0,"",35},
{ "BOB",0,0,27,34,2,3,"",34},
{ "BOB",1,0,27,28,-1,0,"",34},
{ "BOB",2,0,30,0,0,0,"",0},
{ "BOB",3,0,31,0,0,0,"",0},
{ "BOB",4,0,27,61,-1,0,"",34},
{ "BOB",5,0,27,42,1,0,"",42},
{ "PYGMY",0,0,20,21,2,6,"",0},
{ "PYGMY",1,0,20,21,2,6,"020,068,068,068,068,068,068,068,068,020,000",0},
{ "PYGMY",2,0,20,21,2,6,"T028,029,030,031,031,031,031,030,029,028,035,000",0},
{ "PYGMY",3,0,20,21,2,6,"T035,036,037,038,037,038,037,038,036,035,000",0},
{ "PYGMY",4,0,20,21,2,6,"T032,033,032,033,032,033,035,000",0},
{ "PYGMY",5,0,20,21,2,6,"T023,022,021,022,023,024,025,026,027,026,025,024,023,000",0},
{ "PYGMY",6,0,20,21,2,6,"T034,034,034,035,000",0},
{ "WITCH",0,0,39,40,2,6,"",40},
{ "WITCH",1,0,39,40,2,6,"073,074,000",40},
{ "WITCH",2,0,39,40,2,6,"074,073,000",40},
{ "WITCH",3,0,39,40,2,6,"T047,048,049,050,051,000",40},
{ "WITCH",4,0,39,40,2,6,"T052,053,054,055,056,057,058,057,056,056,056,055,054,053,052,000",40},
{ "WITCH",5,0,39,40,2,6,"069,070,071,072,073,074,000",40},
{ "WITCH",6,0,39,40,2,6,"074,073,072,071,070,069,070,000",40},
{ "WITCH",7,0,39,51,-1,0,"",40},
{ "WITCH",8,0,39,40,2,6,"T051,050,049,048,047,000",40},
{ "CHIEF",0,0,1,7,1,7,"",3},
{ "CHIEF",1,0,1,2,2,6,"062,063,064,065,066,000",0},
{ "CHIEF",2,0,1,2,2,6,"066,065,064,063,062,000",0},
{ "CHIEF",3,0,1,17,-1,0,"",3},
{ "CHIEF",4,0,1,18,-1,0,"",3},
{ "CHIEF",5,0,1,19,-1,0,"",3},
{ "NAOMI",0,0,1,2,2,3,"",2},
{ "NAOMI",1,0,1,2,2,6,"048,049,050,051,052,053,054,055,000",0},
{ "NAOMI",2,0,1,2,2,6,"055,054,053,052,051,050,049,048,000",0},
{ "NAOMI",3,0,1,13,-1,0,"",2},
{ "NAOMI",4,0,1,14,-1,0,"",2},
{ "NAOMI",5,0,1,10,-1,0,"",2},
{ "NAOMI",6,0,1,12,-1,0,"",2},
{ "NAOMI",7,0,1,12,-1,0,"T008,008,008,002,000",2},
{ "WEDGEWOOD",0,0,8,1,2,0,"",8},
{ "WEDGEWOOD",1,0,1,1,3,0,"",1},
// { "BUD",0,0,1,2,4,2,"",2},
// Change Buds talk code
{ "BUD",0,0,1,2,3,2,"",2},
{ "BUD",1,0,1,2,4,2,"T017,018,000",2},
{ "BUD",2,0,1,21,-1,0,"",2},
{ "BUD",3,0,1,14,-1,0,"",2},
{ "BUD",4,0,1,15,-1,0,"",2},
{ "BUD",5,0,1,20,-1,0,"",2},
{ "BUD",6,0,1,16,-1,0,"",2},
{ "BUD",7,0,1,19,-1,0,"",2},
{ "BUD",8,0,1,17,-1,0,"",2},
{ "BUD",9,0,1,14,-1,0,"T014,008,008,003,003,008,008,003,003,010,010,012,012,000",2},
//CR 2 - Change 4,2 -> 2,3, End Frames 8 -> 2
{ "LOU",0,0,1,2,2,3,"",2},
{ "LOU",1,0,1,2,4,2,"013,014,015,016,017,018,000",2},
{ "LOU",2,0,1,2,4,2,"018,017,016,015,014,013,000",2},
{ "JIMMY",0,0,16,17,2,3,"",17},
{ "JIMMY",1,0,16,25,-1,0,"",17},
{ "JIMMY",2,0,16,26,-1,0,"",17},
{ "JIMMY",3,0,16,27,-1,0,"",17},
{ "JIMMY",4,0,16,28,-1,0,"",17},
{ "JIMMY",5,0,16,29,-1,0,"",17},
{ "TAMMY",0,0,1,2,2,3,"",2},
{ "TAMMY",1,0,1,2,2,3,"T008,008,009,009,008,008,009,009,008,008,009,009,002,000",2},
{ "TAMMY",2,0,1,2,2,3,"T002,010,010,010,002,000",2},
{ "TAMMY",3,0,1,2,2,3,"T011,011,011,011,011,002,000",2},
{ "TAMMY",4,0,1,2,2,3,"T013,014,015,013,014,015,013,009,001,000",2},
{ "SKULL",0,0,9,9,4,0,"",0},
{ "SKULL",1,0,1,9,4,0,"001,002,003,004,005,006,007,008,009,000",0},
{ "SKULL",2,0,1,9,4,0,"009,008,007,006,005,004,003,002,001,000",0},
{ "APE",0,0,1,6,7,0,"",6},
{ "APE",1,0,1,6,7,0,"002,001,000",6},
{ "APE",2,0,1,6,7,0,"002,003,001,000",6},
{ "APE",3,0,1,6,7,0,"004,005,004,005,004,001,000",6},
{ "APE",4,0,1,6,7,0,"001,003,005,004,005,004,001,000",6},
{ "APE1",0,0,15,16,7,0,"",16},
{ "APE2",0,0,14,6,7,0,"",6},
{ "SHOWERAM",0,0,1,2,3,0,"",2},
{ "SHOWERAM",1,0,1,2,3,0,"026,027,028,029,001,000",2},
{ "SHOWERAM",2,0,1,2,3,0,"001,029,028,027,026,000",2},
{ "PRINCESS1",0,0,19,23,2,3,"",23},
{ "PRINCESS1",1,0,19,41,-1,0,"",23},
{ "PRINCESS1",2,0,19,42,-1,0,"",23},
{ "PRINCESS1",3,0,19,45,-1,0,"",23},
{ "PRINCESS1",4,0,19,40,-1,0,"",23},
{ "PRINCESS1",5,0,19,45,2,3,"T40,043,044,045,000",45},
{ "PRINCESS1",6,0,19,45,-1,0,"T041,038,000",38},
{ "PRINCESS1",7,0,22,0,0,0,"",0},
{ "PRINCESS1",8,0,19,45,2,3,"T045,044,043,040,039,000",39},
{ "PRINCESS2",0,0,46,23,2,3,"",23},
{ "PRINCESS2",1,0,46,29,2,3,"",29},
{ "PRINCESS2",2,0,46,29,2,3,"T029,036,035,000",35},
{ "GUARDS",0,0,7,7,0,0,"",7},
{ "AMGUARD",0,0,19,22,2,3,"",22},
{ "MAN1",0,0,2,3,2,3,"",3},
{ "MAN2",0,0,9,10,1,2,"",10},
{ "DOG",0,0,6,6,1,0,"",0},
{ "DOG",1,0,6,6,1,0,"010,009,008,000",0},
{ "DOG",2,0,6,6,1,0,"008,009,010,000",0},
{ "CHEF",0,0,5,6,2,3,"",6},
{ "HENRY",0,0,7,9,2,3,"",9},
{ "HENRY",1,0,7,21,-1,0,"",9},
{ "HENRY",2,0,7,19,-1,0,"",9},
{ "HENRY",3,0,7,20,-1,0,"",9},
{ "HENRY",4,0,8,9,2,3,"",9},
{ "HENRY",5,0,23,9,-1,0,"",9},
{ "HENRY",6,0,7,9,2,3,"T019,015,017,017,017,017,017,017,017,015,009,000",9},
{ "HENRY",7,0,7,9,2,3,"T018,010,000",10},
{ "HENRY",8,0,7,9,2,3,"T018,016,000",16},
{ "HENRY",9,0,7,9,2,3,"T018,011,000",11},
{ "HENRY",10,0,29,33,1,1,"",33},
{ "HENRY",11,0,7,30,2,0,"",9},
{ "HENRY",12,0,7,9,2,3,"025,026,000",26},
{ "HENRY",13,0,7,9,2,3,"027,028,027,028,000",28},
{ "HENRY",14,0,7,9,2,3,"026,025,007,000",9},
{ "JOHAN",0,0,1,15,2,3,"",15},
{ "JOHAN",1,0,1,0,0,0,"T006,007,008,000",15},
{ "JOHAN",2,0,1,15,2,3,"T002,003,004,005,004,005,004,005,004,005,004,005,004,003,002,000",15},
{ "JOHAN",3,0,1,8,-1,0,"",15},
{ "JOHAN",4,0,1,0,0,0,"T008,007,006,001,000",15},
{ "KLUNK",0,0,1,2,2,3,"",2},
{ "KLUNK",1,0,1,2,2,3,"019,020,021,022,001,000",2},
//CR 4 - 22/2/95, Change 017 -> 517
{ "KLUNK",2,0,1,2,2,3,"001,022,021,020,019,016,517,000",2},
{ "KLUNK",3,0,1,2,2,3,"T010,011,010,011,010,011,009,000",2},
{ "FRANK",0,0,13,14,2,3,"",14},
//CR 2 - 21/2/95, Change from Torso to normal
{ "FRANK",1,0,13,20,0,1,"",14},
{ "FRANK",2,0,13,14,2,3,"025,026,027,027,027,026,026,026,027,027,026,026,027,025,013,000",14},
{ "FRANK",3,0,28,14,2,3,"",14},
{ "DEATH",0,0,1,2,2,3,"",2},
{ "DEATH",1,0,1,2,2,3,"013,014,015,016,017,001,000",0},
{ "DEATH",2,0,1,2,2,3,"001,017,016,015,014,013,000",0},
//CR 2 - Change 024 -> 524
{ "DEATH",3,0,1,2,2,3,"T018,019,020,021,021,022,022,020,021,022,020,021,022,023,024,524,000",2},
{ "DEATH",4,0,1,2,2,3,"T025,026,027,028,028,028,028,028,028,028,028,028,029,035,000",2},
{ "DEATH",5,0,1,2,2,3,"T030,031,032,033,033,033,033,033,033,033,033,033,034,035,000",2},
{ "DEATH",6,0,1,2,2,3,"T023,022,020,019,018,001,000",2},
{ "JASPAR",0,0,1,1,22,0,"026,027,028,029,028,029,028,029,030,023,000",0},
{ "JASPAR",1,0,1,1,22,0,"023,026,000",0},
{ "ORACLE",0,0,1,5,3,0,"",0},
{ "ZOMBIE",0,0,1,5,2,3,"",5},
{ "ZOMBIE",1,0,1,12,-1,0,"",5},
{ "ZOMBIE",2,0,1,13,-1,0,"",5},
{ "ZOMBIE",3,0,1,1,5,5,"",5},
{ "ZOMBIE2",0,0,14,14,0,0,"",0},
{ "ZOMBIE3",0,0,18,18,0,0,"",0},
{ "ANDERSON",0,0,7,8,2,3,"",8},
{ "ANDERSON",1,0,7,8,1,0,"",8},
{ "ANDERSON",2,0,7,16,-1,0,"",8},
{ "ANDERSON",3,0,7,18,-1,0,"",8},
{ "ANDERSON",4,0,7,19,-1,0,"",8},
{ "ANDERSON",5,0,7,20,-1,0,"",8},
{ "ANDERSON",6,0,7,21,1,0,"",8},
{ "COMPY",0,0,12,12,-1,0,"",0},
{ "COMPY",1,0,10,10,10,0,"010,011,012,012,013,014,014,000",0},
{ "COMPY",2,0,10,10,10,0,"014,013,012,000",0},
{ "DEINO",0,0,13,13,-1,0,"",0},
{ "DEINO",1,0,9,9,9,0,"009,010,000",0},
{ "TMPD",0,0,19,22,2,3,"",22},
{ "IAN",0,0,7,9,2,3,"",9},
{ "IAN",1,0,8,25,3,0,"",25},
{ "IAN",2,0,7,21,-1,0,"",9},
{ "IAN",3,0,7,22,1,0,"",9},
{ "IAN",4,0,7,22,-1,0,"",9},
{ "IAN",5,0,7,24,-1,0,"",9},
{ "IAN",6,0,7,9,2,3,"034,034,034,035,035,036,036,035,035,036,035,036,035,000",9},
{ "IAN",7,0,7,31,-1,0,"",9},
{ "FAYE-H",0,0,1,1,4,1,"",1},
{ "FAYE-H",1,0,1,1,4,1,"007,000",7},
{ "FAYE-H",2,0,1,1,4,1,"009,010,011,009,001,000",1},
{ "FAYE-H",3,0,1,1,4,1,"E012,013,000",1},
{ "FAYE-H",4,0,1,1,4,1,"E015,000",1},
{ "FAYE-H",5,0,1,1,4,1,"E014,000",1},
{ "AZURA-H",0,0,1,1,4,1,"",1},
{ "AZURA-H",1,0,1,1,4,1,"007,000",7},
{ "AZURA-H",2,0,1,1,4,1,"009,010,011,009,001,000",1},
{ "AZURA-H",3,0,1,1,4,1,"E012,013,000",1},
{ "AZURA-H",4,0,1,1,4,1,"E015,000",1},
{ "AZURA-H",5,0,1,1,4,1,"E014,000",1},
{ "FRANK-H",0,0,1,1,4,1,"",1},
{ "FRANK-H",1,0,1,1,4,1,"E009,000",1},
{ "FRANK-H",2,0,1,1,4,1,"E007,000",1},
{ "FRANK-H",3,0,1,1,4,1,"010,011,012,013,014,015,010,000",1},
{ "JOE-E",0,0,1,2,4,1,"",2},
{ "JOE-E",6,0,1,2,4,1,"008,009,008,002,000",2},
{ "AZURA-E",0,0,1,1,5,1,"",1},
{ "AZURA-E",1,0,1,1,5,1,"009,010,009,008,000",1},
{ "FAYE-E",0,0,1,4,4,1,"",1},
{ "FAYE-E",1,0,1,4,4,1,"002,003,002,001,000",1},
{ "ANDSON-E",0,0,1,3,4,1,"",1},
{ "ANDSON-E",1,0,1,3,4,1,"002,001,000",1},
//#ifdef __DOS__
{ "JOE-H",0,0,1,1,4,4,"",1},
{ "JOE-H",1,0,1,1,2,3,"012,013,014,000",14},
{ "JOE-H",2,0,1,1,2,3,"010,011,000",11},
{ "JOE-H",3,0,1,1,2,3,"014,013,012,001,000",1},
{ "JOE-H",4,0,1,13,1,0,"",13},
{ "RITA-H",0,0,7,1,2,3,"",1},
{ "RITA-H",1,0,7,0,0,0,"009,010,011,012,013,000",13},
{ "RITA-H",2,0,7,0,0,0,"014,015,016,000",16},
{ "RITA-H",3,0,7,0,0,0,"013,012,011,010,000",10},
{ "RITA-H",4,0,7,0,0,0,"009,007,008,007,009,000",9},
{ "RITA-H",5,0,7,0,0,0,"016,015,014,000",14},
{ "RITA",0,0,1,4,2,3,"",4},
{ "RITA",1,0,2,4,2,3,"",4},
{ "SPARKY-H",0,0,1,1,2,3,"",1},
{ "HUGH",0,0,1,1,2,3,"",1},
{ "HUGH",1,0,7,7,2,3,"",7},
// New CD-Rom intro persons
// *01 Blink
{ "X2_JOE",0,0,1,1,2,3,"",1},
{ "X2_JOE",1,0,1,1,2,3,"001,007,008,008,007,001,000",1},
// *01 Blink
{ "X2_RITA",0,0,1,1,2,3,"",1},
{ "X2_RITA",1,0,1,1,2,3,"001,007,008,008,007,001,000",1},
// *01 Smile, *02 Blink, *03 Raise Eyebrow, *04 Anger, *05 Surprise
{ "X3_RITA",0,0,1,1,4,1,"",1},
{ "X3_RITA",1,0,1,1,4,1,"007,000",7},
{ "X3_RITA",2,0,1,1,4,1,"009,010,011,009,001,000",1},
{ "X3_RITA",3,0,1,1,4,1,"E012,013,000",1},
{ "X3_RITA",4,0,1,1,4,1,"E015,000",1},
{ "X3_RITA",5,0,1,1,4,1,"E014,000",1},
// *01 Talk to Sparky, *02 Turn to Sparky, *03 Turn to Rita, *04 Close Eyes
{ "X4_JOE",0,0,1,1,3,4,"",1},
{ "X4_JOE",1,0,1,13,2,3,"",13},
{ "X4_JOE",2,0,1,1,3,4,"009,010,011,012,013,000",13},
{ "X4_JOE",3,0,1,1,3,4,"012,011,010,009,000",9},
{ "X4_JOE",4,0,1,1,3,4,"001,019,000",19},
// *01 Talk to Sparky, *02 Turn to Sparky, *03 Turn to Joe, *04 Close Eyes
{ "X4_RITA",0,0,1,1,0,1,"",1},
{ "X4_RITA",1,0,1,7,0,1,"",7},
{ "X4_RITA",2,0,1,1,3,4,"004,005,006,006,006,006,007,000",7},
{ "X4_RITA",3,0,1,1,3,4,"005,004,001,000",1},
{ "X4_RITA",4,0,1,1,3,4,"001,003,000",3},
// *01 Blink, *02 Look Right
{ "X5_SPARKY",0,0,1,1,2,3,"",1},
{ "X5_SPARKY",1,0,1,1,2,3,"001,010,011,011,001,000",1},
{ "X5_SPARKY",2,0,1,1,2,3,"001,007,008,009,000",9},
// *01 Eyes Bulge Once, *02 Eyes Bulge Big Time
{ "X6_HUGH",0,0,1,1,2,3,"",1},
{ "X6_HUGH",1,0,1,1,2,3,"007,007,007,007,,001,000",1},
{ "X6_HUGH",2,0,1,1,2,3,"008,008,008,008,008,009,009,008,008,008,009,008,000",8},
// *01 Talk to Sparky, Rub Head
{ "X10_JOE",0,0,1,2,2,3,"",2},
{ "X10_JOE",1,0,1,8,2,3,"",8},
//CR 2 - 21/2/95, Cut down rub head anim
{ "X10_JOE",2,0,1,2,2,3,"014,014,014,015,015,014,014,015,015,000",2},
{ "X10_RITA",0,0,1,2,2,3,"",2},
{ "X11_JOE",0,0,1,2,0,1,"",2},
// *01 Look at Joe
{ "X11_RITA",0,0,1,2,0,1,"",2},
{ "X11_RITA",1,0,1,2,1,0,"003,004,000",4},
//#endif
{ "*",0,0,0,0,0,0,"",0}
};
} // End of namespace Queen

View File

@ -45,7 +45,7 @@ class Talk {
//! Public interface to speak a sentence
static bool speak(
const char *sentence,
const char *person,
Person *person,
const char *voiceFilePrefix,
Graphics *graphics,
Logic *logic,
@ -73,6 +73,8 @@ class Talk {
SPEAK_FACE_RIGHT = -2,
SPEAK_FACE_FRONT = -3,
SPEAK_FACE_BACK = -4,
SPEAK_ORACLE = -5,
SPEAK_UNKNOWN_6 = -6,
SPEAK_AMAL_ON = -7,
SPEAK_PAUSE = -8,
SPEAK_NONE = -9
@ -91,6 +93,14 @@ class Talk {
int16 gameStateValue;
};
struct SpeechParameters {
const char *name; // Nstr
signed char state,faceDirection; // S,F
signed char body,bf,rf,af;
const char *animation; // SANIMstr
signed char ff;
};
Graphics *_graphics;
Logic *_logic;
Resource *_resource;
@ -122,6 +132,9 @@ class Talk {
//! Set to true to quit talking
bool _quit;
//! Is a talking head
bool _talkHead;
//! IDs for sentences
DialogueNode _dialogueTree[18][6];
@ -137,6 +150,8 @@ class Talk {
char _talkString[5][MAX_STRING_SIZE];
char _joeVoiceFilePrefix[5][MAX_STRING_SIZE];
static const SpeechParameters _speechParameters[];
Talk(Graphics *graphics, Logic *logic, Resource *resource);
~Talk();
@ -162,22 +177,28 @@ class Talk {
int16 selectSentence();
//! Speak sentence
bool speak(const char *sentence, const char *person, const char *voiceFilePrefix);
bool speak(const char *sentence, Person *person, const char *voiceFilePrefix);
//! Convert command in sentence to command code
int getSpeakCommand(const char *sentence, unsigned &index);
//! Speak a part of a sentence
void speakSegment(
const char *segment,
int length,
const char *person,
int command,
const char *voiceFilePrefix,
int index);
const char *segment,
int length,
Person *person,
int command,
const char *voiceFilePrefix,
int index);
int countSpaces(const char *segment);
//! Get special parameters for speech
const SpeechParameters *findSpeechParameters(
const char *name,
int state,
int faceDirection); // FIND_SACTION
static int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);

View File

@ -147,7 +147,7 @@ FIND_BOB() Logic::findBob
FIND_DEFAULT()
FIND_FRAME() Logic::findFrame
FIND_GRAPHIC()
FIND_SACTION()
FIND_SACTION() Talk::findSpeechParameters
FIND_SCALE() Logic::findScale
FIND_VERB()
LOOK()