ScummVM API documentation
big_dialogue.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 PETKA_BIG_DIALOGUE_H
23 #define PETKA_BIG_DIALOGUE_H
24 
25 #include "common/array.h"
26 #include "common/ustr.h"
27 
28 namespace Petka {
29 
30 class PetkaEngine;
31 
32 enum {
33  kOpcodePlay = 1,
34  kOpcodeMenu,
35  kOpcodeEnd,
36  kOpcodeUserMessage
37 };
38 
39 enum {
40  kOperationBreak = 1,
41  kOperationMenu,
42  kOperationGoTo,
43  kOperationDisableMenuItem,
44  kOperationEnableMenuItem,
45  kOperationReturn,
46  kOperationPlay,
47  kOperationCircle,
48  kOperationUserMessage
49 };
50 
51 struct Operation {
52  union {
53  struct {
54  byte bits;
55  uint16 bitField;
56  } menu;
57  struct {
58  uint16 opIndex;
59  } goTo;
60  struct {
61  uint16 opIndex;
62  byte bit;
63  } disableMenuItem;
64  struct {
65  uint16 opIndex;
66  byte bit;
67  } enableMenuItem;
68  struct {
69  uint16 messageIndex;
70  } play;
71  struct {
72  uint16 count;
73  byte curr;
74  } circle;
75  struct {
76  uint16 arg;
77  } userMsg;
78  };
79  byte type;
80 };
81 
82 struct Dialog {
83  uint32 startOpIndex;
84  // uint32 opsCount;
85  // Operation *ops;
86 };
87 
88 struct DialogHandler {
89  uint32 opcode;
90  uint32 startDialogIndex;
91  Common::Array<Dialog> dialogs;
92 };
93 
94 struct DialogGroup {
95  uint32 objId;
97 };
98 
99 struct SpeechInfo {
100  uint32 speakerId;
101  char soundName[16];
102  Common::U32String text;
103 };
104 
105 class BigDialogue {
106 public:
108 
109  uint opcode();
110 
111  uint choicesCount();
112 
113  void next(int choice = -1);
114 
115  const DialogHandler *findHandler(uint objId, uint opcode, bool *fallback) const;
116  void setHandler(uint objId, uint opcode);
117 
118  const Common::U32String *getSpeechInfo(int *talkerId, const char **soundName, int choice);
119  void getMenuChoices(Common::Array<Common::U32String> &choices);
120 
121  void load(Common::ReadStream *s);
122  void save(Common::WriteStream *s);
123 
124 private:
125  void loadSpeechesInfo();
126  bool checkMenu(uint opIndex);
127  bool findOperation(uint startOpIndex, uint opType, uint *resIndex);
128  void circleMoveTo(byte index);
129 
130 private:
131  PetkaEngine &_vm;
132 
133  Operation *_currOp;
135  uint _startOpIndex;
136 
137  Common::Array<SpeechInfo> _speeches;
138  Common::Array<DialogGroup> _objDialogs;
139 };
140 
141 } // End of namespace Petka
142 
143 #endif
Definition: big_dialogue.h:82
Definition: stream.h:77
Definition: array.h:52
Definition: big_dialogue.h:88
Definition: big_dialogue.h:105
Definition: big_dialogue.h:94
Definition: ustr.h:57
Definition: big_dialogue.h:51
Definition: petka.h:83
Definition: stream.h:385
Definition: base.h:27
Definition: big_dialogue.h:99