Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

DialogStack Class Reference

Inheritance diagram for DialogStack:

Inheritance graph
[legend]
Collaboration diagram for DialogStack:

Collaboration graph
[legend]

Detailed Description

Stack of running dialogs.

Definition at line 17 of file DialogStack.h.

Public Member Functions

 DialogStack ()
virtual ~DialogStack ()
 Releases resources and stops all cycling dialogs.
void updateStack ()
 Removes finished dialogs from stack.
void addDialog (const std::string &name, Dialog *dialog)
 Store new dialog.
void actorTalk (int actor, const std::string &name, int volume, int loops=0, bool dialogFlag=false)
 Run talk.
bool isTalking (int actor) const
void killSound (int actor)
 Delete all running dialogs made by this actor.
bool isDialog () const
 Returns true when there is active dialog.
bool areRunning () const
void killTalks ()
 Kill all running dialogs.
void removeAll ()
 Delete all shared dialogs and kill talks.


Constructor & Destructor Documentation

DialogStack::DialogStack  ) 
 

Definition at line 17 of file DialogStack.cpp.

00018 {
00019     m_dialogs = new ResDialogPack();
00020     m_activeDialog = NULL;
00021 }

DialogStack::~DialogStack  )  [virtual]
 

Releases resources and stops all cycling dialogs.

Definition at line 26 of file DialogStack.cpp.

00027 {
00028     removeAll();
00029     delete m_dialogs;
00030 }


Member Function Documentation

void DialogStack::actorTalk int  actor,
const std::string &  name,
int  volume,
int  loops = 0,
bool  dialogFlag = false
 

Run talk.

Dialog name could contain "name@arg1@arg2..." to fill 1, 2, ... in subtitles.

Parameters:
actor actor index
name dialog name
volume dialog volume
loops number of loops, 0=play once, 1=play twice, -1=play infinite
dialogFlag whether it is blocking dialog

Definition at line 62 of file DialogStack.cpp.

00064 {
00065     StringTool::t_args args = StringTool::split(name, '@');
00066 
00067     const Dialog *subtitle = m_dialogs->findDialogHard(args[0]);
00068     if (subtitle) {
00069         subtitle->runSubtitle(args);
00070 
00071         const Dialog *dialog = m_dialogs->findDialogSpeech(args[0]);
00072         if (dialog) {
00073             PlannedDialog *talker = new PlannedDialog(actor, dialog,
00074                 subtitle->getMinTime());
00075             talker->talk(volume, loops);
00076 
00077             if (loops == -1) {
00078                 m_cycling.push_back(talker);
00079             }
00080             else {
00081                 m_running.push_back(talker);
00082             }
00083 
00084             if (dialogFlag) {
00085                 m_activeDialog = talker;
00086             }
00087         }
00088     }
00089 }

void DialogStack::addDialog const std::string &  name,
Dialog dialog
 

Store new dialog.

Definition at line 45 of file DialogStack.cpp.

00046 {
00047     m_dialogs->addRes(name, dialog);
00048 }

bool DialogStack::areRunning  )  const [inline]
 

Definition at line 43 of file DialogStack.h.

00043 { return !m_running.empty(); }

bool DialogStack::isDialog  )  const
 

Returns true when there is active dialog.

Definition at line 197 of file DialogStack.cpp.

00198 {
00199     return m_activeDialog && m_activeDialog->isTalking();
00200 }

bool DialogStack::isTalking int  actor  )  const
 

Definition at line 92 of file DialogStack.cpp.

00093 {
00094     return isTalkingIn(actor, m_running) ||
00095         isTalkingIn(actor, m_cycling);
00096 }

void DialogStack::killSound int  actor  ) 
 

Delete all running dialogs made by this actor.

Definition at line 130 of file DialogStack.cpp.

00131 {
00132     killSoundIn(actor, m_running);
00133     killSoundIn(actor, m_cycling);
00134 }

void DialogStack::killTalks  ) 
 

Kill all running dialogs.

Definition at line 157 of file DialogStack.cpp.

00158 {
00159     killTalksIn(m_running);
00160     killTalksIn(m_cycling);
00161 }

void DialogStack::removeAll  ) 
 

Delete all shared dialogs and kill talks.

Definition at line 187 of file DialogStack.cpp.

00188 {
00189     killTalks();
00190     m_dialogs->removeAll();
00191 }

void DialogStack::updateStack  ) 
 

Removes finished dialogs from stack.

Definition at line 36 of file DialogStack.cpp.

00037 {
00038     removeFirstNotTalking();
00039 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:54:53 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2