Implement '.' sentence skipping, and other shutUpActor use

This commit is contained in:
James Brown 2003-08-21 06:51:02 +00:00
parent 5b1490c130
commit cb02f26732
5 changed files with 29 additions and 2 deletions

View File

@ -91,6 +91,13 @@ bool Actor::talking() {
return true;
}
void Actor::shutUp() {
if (talkSound_) {
Mixer::instance()->stopVoice(talkSound_);
talkSound_ = NULL;
}
}
void Actor::pushCostume(const char *name) {
Costume *newCost = ResourceLoader::instance()->
loadCostume(name, currentCostume());

View File

@ -60,6 +60,7 @@ public:
void turn(int dir);
void sayLine(const char *msg);
void shutUp();
bool talking();
void pushCostume(const char *name);

10
lua.cpp
View File

@ -467,6 +467,12 @@ static void IsMessageGoing() {
}
}
static void ShutUpActor() {
Actor *act = check_actor(1);
if (act)
act->shutUp();
}
// Sector functions
static void GetActorSector(void) {
Actor *act = check_actor(1);
@ -854,7 +860,6 @@ static char *stubFuncs[] = {
"GetPointSector",
"IsPointInSector",
"SetActorFrustrumCull",
"ShutUpActor",
"SetActorFollowBoxes",
"SetActorHead",
"GetCameraActor",
@ -1122,7 +1127,8 @@ struct luaL_reg builtins[] = {
{ "InputDialog", InputDialog },
{ "ChangeTextObject", ChangeTextObject },
{ "GetTextObjectDimensions", GetTextObjectDimensions },
{ "MakeTextObject", MakeTextObject }
{ "MakeTextObject", MakeTextObject },
{ "ShutUpActor", ShutUpActor }
};
void register_lua() {

View File

@ -312,6 +312,18 @@ void Mixer::stopSfx(Sound *s) {
}
}
void Mixer::stopVoice(Sound *s) {
AudioLock l;
for (sound_list::iterator i = voiceSounds_.begin();
i != voiceSounds_.end(); ) {
if (*i == s)
i = voiceSounds_.erase(i);
else
i++;
}
}
static int compareStates(const void *p1, const void *p2) {
const imuseTableEntry *e1 = static_cast<const imuseTableEntry *>(p1);
const imuseTableEntry *e2 = static_cast<const imuseTableEntry *>(p2);

View File

@ -33,6 +33,7 @@ public:
void playVoice(Sound *s);
void playSfx(Sound *s);
void stopSfx(Sound *s);
void stopVoice(Sound *s);
void setImuseState(int state);
void setImuseSeq(int seq);