ScummVM API documentation
dialogplayer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_SERVICES_DIALOG_PLAYER_H
23 #define STARK_SERVICES_DIALOG_PLAYER_H
24 
25 #include "common/array.h"
26 
27 #include "engines/stark/resources/dialog.h"
28 
29 namespace Stark {
30 
31 namespace Resources {
32 class Speech;
33 }
34 
41 class DialogPlayer {
42 public:
43  DialogPlayer();
44  virtual ~DialogPlayer();
45 
46  enum OptionType {
47  kOptionTypeAsk = 0
48  };
49 
50  struct Option {
51  uint32 _type;
52  Common::String _caption;
54  int32 _replyIndex;
55  };
56 
58  void run(Resources::Dialog *dialog);
59 
61  void playSingle(Resources::Speech *speech);
62 
64  bool isRunning() const;
65 
67  void update();
68 
70  void selectOption(uint32 index);
71 
73  bool isSpeechReady() const;
74  bool isSpeechReady(Resources::Speech *speech) const;
75 
77  Resources::Speech *acquireReadySpeech();
78 
80  bool areOptionsAvailable() const;
81 
83  Common::Array<DialogPlayer::Option> listOptions() const;
84 
86  void resume(Resources::Dialog *dialog);
87 
89  void reset();
90 
91 protected:
93  void buildOptions();
94 
96  void removeLastOnlyOption();
97 
99  void onReplyEnd();
100 
101  void saveToInterruptionSlot();
102  void restoreFromInterruptionSlot();
103 
104  Resources::Dialog *_currentDialog;
105  Resources::Dialog::Reply *_currentReply;
106 
107  Resources::Dialog *_interruptedDialog;
108  Resources::Dialog::Reply *_interruptedReply;
109 
110  Resources::Speech *_singleSpeech;
111 
112  bool _speechReady;
113  bool _optionsAvailable;
114  Common::Array<Option> _options;
115 };
116 
117 } // End of namespace Stark
118 
119 #endif // STARK_SERVICES_DIALOG_PLAYER_H
Definition: dialog.h:51
Definition: str.h:59
Definition: dialogplayer.h:50
Definition: array.h:52
Definition: dialog.h:61
Definition: dialog.h:111
Definition: console.h:27
Definition: dialogplayer.h:41
Definition: speech.h:48