ScummVM API documentation
dialog.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_RESOURCES_DIALOG_H
23 #define STARK_RESOURCES_DIALOG_H
24 
25 #include "common/str.h"
26 
27 #include "engines/stark/resources/object.h"
28 #include "engines/stark/resourcereference.h"
29 
30 namespace Stark {
31 
32 namespace Formats {
33 class XRCReadStream;
34 }
35 
36 namespace Resources {
37 
38 class Speech;
39 class Script;
40 
51 class Dialog : public Object {
52 public:
53  static const Type::ResourceType TYPE = Type::kDialog;
54 
55  Dialog(Object *parent, byte subType, uint16 index, const Common::String &name);
56  virtual ~Dialog();
57 
61  class Reply {
62  public:
63  Reply();
64 
65  enum ConditionType {
66  kConditionTypeAlways = 0,
67  kConditionTypeNoOtherOptions = 1,
68  kConditionTypeHasItem = 3,
69  kConditionTypeCheckValue4 = 4,
70  kConditionTypeCheckValue5 = 5,
71  kConditionTypeRunScriptCheckValue = 6
72  };
73 
75  void start();
76 
78  void goToNextLine();
79 
81  Speech *getCurrentSpeech();
82 
84  bool checkCondition() const;
85 
87  bool isLastOnly() const;
88 
89  // Static data
91  uint32 _conditionType;
92  ResourceReference _conditionReference;
93  ResourceReference _conditionScriptReference;
94  uint32 _conditionReversed;
95  uint32 _field_88;
96  uint32 _minChapter;
97  uint32 _maxChapter;
98  uint32 _noCaption;
99  int32 _nextDialogIndex;
100  ResourceReference _nextScriptReference;
101 
102  // State
103  int32 _nextSpeechIndex;
104 
105  friend class Dialog;
106  };
107 
111  class Topic {
112  public:
113  Topic();
114 
116  int32 getNextReplyIndex() const;
117 
119  Common::String getCaption() const;
120 
122  Reply *startReply(uint32 index);
123 
125  Reply *getReply(uint32 index);
126 
127  Common::Array<Reply> _replies;
128 
129  bool _removeOnceDepleted;
130  int32 _currentReplyIndex;
131 
132  friend class Dialog;
133  };
134 
136 
137  // Resource API
138  void readData(Formats::XRCReadStream *stream) override;
139  void saveLoad(ResourceSerializer *serializer) override;
140 
142  TopicArray listAvailableTopics();
143 
145  Dialog *getNextDialog(Reply *reply);
146 
148  Script *getNextScript(Reply *reply);
149 
151  Common::String getDiaryTitle() const;
152 
154  int32 getCharacter() const;
155 
156  void printData() override;
157 
158  Common::Array<Topic> _topics;
159  uint32 _character;
160  uint32 _hasAskAbout;
161 };
162 
163 } // End of namespace Resources
164 } // End of namespace Stark
165 
166 #endif // STARK_RESOURCES_DIALOG_H
Definition: dialog.h:51
Definition: str.h:59
Definition: array.h:52
Definition: dialog.h:61
Definition: dialog.h:111
Definition: resourcereference.h:39
Definition: console.h:27
Definition: object.h:143
Definition: speech.h:48
Definition: xrc.h:45
Definition: stateprovider.h:51
Definition: script.h:45