Actually use actor talkScript when required.
svn-id: r14217
This commit is contained in:
parent
95520634d3
commit
6a18e02a53
4 changed files with 22 additions and 19 deletions
|
@ -1192,7 +1192,7 @@ void ScummEngine::actorTalk(const byte *msg) {
|
||||||
stopTalk();
|
stopTalk();
|
||||||
setTalkingActor(a->number);
|
setTalkingActor(a->number);
|
||||||
if (!_string[0].no_talk_anim) {
|
if (!_string[0].no_talk_anim) {
|
||||||
a->startAnimActor(a->talkStartFrame);
|
a->runActorTalkScript(a->talkStartFrame);
|
||||||
_useTalkAnims = true;
|
_useTalkAnims = true;
|
||||||
}
|
}
|
||||||
oldact = getTalkingActor();
|
oldact = getTalkingActor();
|
||||||
|
@ -1216,6 +1216,19 @@ void ScummEngine::actorTalk(const byte *msg) {
|
||||||
CHARSET_1();
|
CHARSET_1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::runActorTalkScript(int f) {
|
||||||
|
if (talkScript) {
|
||||||
|
int script = talkScript;
|
||||||
|
int args[16];
|
||||||
|
memset(args, 0, sizeof(args));
|
||||||
|
args[1] = f;
|
||||||
|
args[0] = number;
|
||||||
|
|
||||||
|
_vm->runScript(script, 1, 0, args);
|
||||||
|
} else
|
||||||
|
startAnimActor(f);
|
||||||
|
}
|
||||||
|
|
||||||
void ScummEngine::stopTalk() {
|
void ScummEngine::stopTalk() {
|
||||||
int act;
|
int act;
|
||||||
|
|
||||||
|
@ -1228,7 +1241,7 @@ void ScummEngine::stopTalk() {
|
||||||
if (act && act < 0x80) {
|
if (act && act < 0x80) {
|
||||||
Actor *a = derefActor(act, "stopTalk");
|
Actor *a = derefActor(act, "stopTalk");
|
||||||
if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
|
if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
|
||||||
a->startAnimActor(a->talkStopFrame);
|
a->runActorTalkScript(a->talkStopFrame);
|
||||||
_useTalkAnims = false;
|
_useTalkAnims = false;
|
||||||
}
|
}
|
||||||
if (!(_features & GF_HUMONGOUS))
|
if (!(_features & GF_HUMONGOUS))
|
||||||
|
|
|
@ -166,6 +166,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void startWalkAnim(int cmd, int angle);
|
void startWalkAnim(int cmd, int angle);
|
||||||
public:
|
public:
|
||||||
|
void runActorTalkScript(int f);
|
||||||
void startAnimActor(int frame);
|
void startAnimActor(int frame);
|
||||||
|
|
||||||
void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
|
void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
|
||||||
|
|
|
@ -522,10 +522,10 @@ void Sound::processSfxQueues() {
|
||||||
if (_mouthSyncMode != b) {
|
if (_mouthSyncMode != b) {
|
||||||
_mouthSyncMode = b;
|
_mouthSyncMode = b;
|
||||||
if (_talk_sound_frame != -1) {
|
if (_talk_sound_frame != -1) {
|
||||||
a->startAnimActor(_talk_sound_frame);
|
a->runActorTalkScript(_talk_sound_frame);
|
||||||
_talk_sound_frame = -1;
|
_talk_sound_frame = -1;
|
||||||
} else
|
} else
|
||||||
a->startAnimActor(b ? a->talkStopFrame : a->talkStartFrame);
|
a->runActorTalkScript(b ? a->talkStopFrame : a->talkStartFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,6 @@ void ScummEngine::CHARSET_1() {
|
||||||
int frme = -1;
|
int frme = -1;
|
||||||
Actor *a;
|
Actor *a;
|
||||||
byte *buffer;
|
byte *buffer;
|
||||||
bool has_talk_sound = false;
|
|
||||||
bool has_anim = false;
|
|
||||||
|
|
||||||
if (!_haveMsg)
|
if (!_haveMsg)
|
||||||
return;
|
return;
|
||||||
|
@ -152,7 +150,7 @@ void ScummEngine::CHARSET_1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a && !_string[0].no_talk_anim) {
|
if (a && !_string[0].no_talk_anim) {
|
||||||
has_anim = true;
|
a->runActorTalkScript(a->talkStartFrame);
|
||||||
_useTalkAnims = true;
|
_useTalkAnims = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,14 +228,15 @@ void ScummEngine::CHARSET_1() {
|
||||||
case 9:
|
case 9:
|
||||||
frme = *buffer++;
|
frme = *buffer++;
|
||||||
frme |= *buffer++ << 8;
|
frme |= *buffer++ << 8;
|
||||||
has_anim = true;
|
a->startAnimActor(frme != -1 ? frme : a->talkStartFrame);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
|
talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
|
||||||
talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24);
|
talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24);
|
||||||
has_talk_sound = true;
|
|
||||||
buffer += 14;
|
buffer += 14;
|
||||||
|
|
||||||
|
_sound->talkSound(talk_sound_a, talk_sound_b, 2, frme);
|
||||||
|
|
||||||
// Set flag that speech variant exist of this msg.
|
// Set flag that speech variant exist of this msg.
|
||||||
// TODO: This does not work for the speech system in V7+ games
|
// TODO: This does not work for the speech system in V7+ games
|
||||||
// since they encode the voice information differently, and it
|
// since they encode the voice information differently, and it
|
||||||
|
@ -303,16 +302,6 @@ void ScummEngine::CHARSET_1() {
|
||||||
}
|
}
|
||||||
} while (c != 2 && c != 3);
|
} while (c != 2 && c != 3);
|
||||||
|
|
||||||
// Even if talkSound() is called, we may still have to call
|
|
||||||
// startAnimActor() since actorTalk() may already have caused the
|
|
||||||
// wrong animation frame to be drawn, and the talkSound() won't be
|
|
||||||
// processed until after the next screen update. Bleah.
|
|
||||||
|
|
||||||
if (has_talk_sound)
|
|
||||||
_sound->talkSound(talk_sound_a, talk_sound_b, 2, frme);
|
|
||||||
if (a && has_anim)
|
|
||||||
a->startAnimActor(frme != -1 ? frme : a->talkStartFrame);
|
|
||||||
|
|
||||||
_charsetBufPos = buffer - _charsetBuffer;
|
_charsetBufPos = buffer - _charsetBuffer;
|
||||||
|
|
||||||
// FIXME: Remove this and the next two lines eventually!
|
// FIXME: Remove this and the next two lines eventually!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue