ScummVM API documentation
talk.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 QUEEN_TALK_H
23#define QUEEN_TALK_H
24
25#include "common/util.h"
26#include "queen/structs.h"
27
28namespace Queen {
29
30class QueenEngine;
31
32class Talk {
33public:
34
36 static void talk(const char *filename, int personInRoom, char *cutawayFilename, QueenEngine *vm);
37
39 static bool speak(const char *sentence, Person *person, const char *voiceFilePrefix, QueenEngine *vm);
40
42 static void getString(const byte *ptr, uint16 &offset, char *str, int maxLength, int align = 2);
43
44private:
45
47 enum {
48 LINE_HEIGHT = 10,
49 MAX_STRING_LENGTH = 255,
50 MAX_STRING_SIZE = (MAX_STRING_LENGTH + 1),
51 MAX_TEXT_WIDTH = (320-18),
52 PUSHUP = 4,
53 ARROW_ZONE_UP = 5,
54 ARROW_ZONE_DOWN = 6,
55 DOG_HEADER_SIZE = 20,
56 OPTION_TEXT_MARGIN = 24
57 };
58
60 enum {
61 SPEAK_DEFAULT = 0,
62 SPEAK_FACE_LEFT = -1,
63 SPEAK_FACE_RIGHT = -2,
64 SPEAK_FACE_FRONT = -3,
65 SPEAK_FACE_BACK = -4,
66 SPEAK_ORACLE = -5,
67 SPEAK_UNKNOWN_6 = -6,
68 SPEAK_AMAL_ON = -7,
69 SPEAK_PAUSE = -8,
70 SPEAK_NONE = -9
71 };
72
73 struct DialogueNode {
74 int16 head;
75 int16 dialogueNodeValue1;
76 int16 gameStateIndex;
77 int16 gameStateValue;
78 };
79
80 struct SpeechParameters {
81 const char *name;
82 signed char state,faceDirection;
83 signed char body,bf,rf,af;
84 const char *animation;
85 signed char ff;
86 };
87
88 QueenEngine *_vm;
89
91 byte *_fileData;
92
94 int16 _levelMax;
95
97 int16 _uniqueKey;
98
100 int16 _talkKey;
101
102 int16 _jMax;
103
105 int16 _pMax;
106
107 // Update game state efter dialogue
108 int16 _gameState[2];
109 int16 _testValue[2];
110 int16 _itemNumber[2];
111
113 uint16 _person1PtrOff;
114
116 uint16 _cutawayPtrOff;
117
119 uint16 _person2PtrOff;
120
122 uint16 _joePtrOff;
123
125 bool _talkHead;
126
128 DialogueNode _dialogueTree[18][6];
129
131 char _person2String[MAX_STRING_SIZE];
132
133 int _oldSelectedSentenceIndex;
134 int _oldSelectedSentenceValue;
135
136 char _talkString[5][MAX_STRING_SIZE];
137 char _joeVoiceFilePrefix[5][MAX_STRING_SIZE];
138
139 static const SpeechParameters _speechParameters[];
140
141 Talk(QueenEngine *vm);
142 ~Talk();
143
145 void talk(const char *filename, int personInRoom, char *cutawayFilename);
146
147 byte *loadDialogFile(const char *filename);
148
150 void load(const char *filename);
151
153 void initialTalk();
154
156 void findDialogueString(uint16 offset, int16 id, int16 max, char *str);
157
159 TalkSelected *talkSelected();
160
162 bool hasTalkedTo() { return talkSelected()->hasTalkedTo; }
163
165 void setHasTalkedTo() { talkSelected()->hasTalkedTo = true; }
166
168 int16 selectedValue(int index) {
169 return talkSelected()->values[index-1];
170 }
171
173 void selectedValue(int index, int16 value) {
174 talkSelected()->values[index-1] = value;
175 }
176
178 void disableSentence(int oldLevel, int selectedSentence);
179
181 int16 selectSentence();
182
184 bool speak(const char *sentence, Person *person, const char *voiceFilePrefix);
185
187 int getSpeakCommand(const Person *person, const char *sentence, unsigned &index);
188
190 void speakSegment(
191 const char *segmentStart,
192 int length,
193 Person *person,
194 int command,
195 const char *voiceFilePrefix,
196 int index);
197
198 void headStringAnimation(const SpeechParameters *parameters, int bobNum, int bankNum);
199
200 void stringAnimation(const SpeechParameters *parameters, int startFrame, int bankNum);
201
202 void defaultAnimation(
203 const char *segment,
204 bool isJoe,
205 const SpeechParameters *parameters,
206 int startFrame,
207 int bankNum);
208
209 int countSpaces(const char *segment);
210
212 const SpeechParameters *findSpeechParameters(
213 const char *name,
214 int state,
215 int faceDirection);
216
217 int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
218
219 int splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]);
220
221 int splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]);
222
223};
224
225} // End of namespace Queen
226
227#endif
Definition: queen.h:87
Definition: talk.h:32
static void getString(const byte *ptr, uint16 &offset, char *str, int maxLength, int align=2)
Read a string from ptr and update offset.
static bool speak(const char *sentence, Person *person, const char *voiceFilePrefix, QueenEngine *vm)
Public interface to speak a sentence.
static void talk(const char *filename, int personInRoom, char *cutawayFilename, QueenEngine *vm)
Public interface to run a talk from a file.
Definition: bankman.h:28
Definition: structs.h:543