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 DRAGONS_TALK_H
23 #define DRAGONS_TALK_H
24 
25 #include "common/str.h"
26 #include "dragons/scriptopcodes.h"
27 
28 namespace Dragons {
29 
30 class BigfileArchive;
31 class Actor;
32 class DragonsEngine;
33 
35  char dialogText[600];
36  uint32 textIndex;
37  uint32 textIndex1;
38  byte *scriptCodeStartPtr;
39  byte *scriptCodeEndPtr;
40  uint16 flags;
41  uint8 xPosMaybe;
42  uint8 yPosMaybe;
43  int16 field_26c;
44  uint16 iniId;
45  bool hasText;
46 };
47 
48 
49 class Talk {
50 public:
51  uint32 _dat_8008e7e8_dialogBox_x1;
52  uint32 _dat_8008e844_dialogBox_y1;
53  uint32 _dat_8008e848_dialogBox_x2;
54  uint32 _dat_8008e874_dialogBox_y2;
55 private:
56  DragonsEngine *_vm;
57  BigfileArchive *_bigfileArchive;
58  Common::Array<TalkDialogEntry*> _dialogEntries;
59  uint32 _defaultResponseTbl[45];
60 
61  uint8 _dat_800726ec_tfont_field0;
62  uint8 _dat_800726f0_tfont_field2;
63 
64  uint8 _dat_800633f8_talkDialogFlag;
65 
66 public:
67  Talk(DragonsEngine *vm, BigfileArchive *bigfileArchive);
68  void init();
69  bool loadText(uint32 textIndex, uint16 *textBuffer, uint16 bufferLength);
70  void printWideText(byte *text);
71 
72  void talkFromIni(uint32 iniId, uint32 textIndex);
73  void flickerRandomDefaultResponse();
74 
75  void loadAndDisplayDialogAroundPoint(uint32 textId, uint16 x, uint16 y, uint16 param_4, int16 param_5);
76  uint32 displayDialogAroundINI(uint32 iniId, uint16 *dialogText, uint32 textIndex);
77  void displayDialogAroundPoint(uint16 *dialogText, uint16 x, uint16 y, uint16 param_4, int16 param_5, uint32 textId);
78  void displayDialogAroundActor(Actor *actor, uint16 param_2, uint16 *dialogText, uint32 textIndex);
79 
80  void FUN_8003239c(uint16 *dialog, int16 x, int16 y, int32 param_4, uint16 param_5, Actor *actor, uint16 startSequenceId, uint16 endSequenceId, uint32 textId);
81 
82  uint8 conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, uint16 param_4, int16 param_5, uint32 textId, int16 param_7);
83 
84  void addTalkDialogEntry(TalkDialogEntry *talkDialogEntry);
85  void clearDialogEntries();
86 
87  bool talkToActor(ScriptOpCall &scriptOpCall);
88 
89  uint somethingTextAndSpeechAndAnimRelated(Actor *actor, int16 sequenceId1, int16 sequenceId2, uint32 textIndex, uint16 param_5);
90  void FUN_8001a7c4_clearDialogBoxMaybe(); //clear box maybe?
91 
92  void playDialogAudioDontWait(uint32 textIndex);
93 
94 private:
95  void copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength);
96  uint32 wideStrLen(uint16 *text);
97  TalkDialogEntry *displayTalkDialogMenu(Common::Array<TalkDialogEntry*> dialogEntries);
98  void exitTalkMenu(bool isFlag8Set, bool isFlag100Set, Common::Array<TalkDialogEntry*> dialogEntries);
99  uint32 getDefaultResponseTextIndex();
100  void initDefaultResponseTable();
101  uint32 strlenUTF16(uint16 *text);
102  uint16 *findCharInU16Str(uint16 *text, uint16 chr);
103  void drawDialogBox(uint32 x1, uint32 y1, uint32 x2, uint32 y2, uint16 unk);
104  uint16 *UTF16ToUTF16Z(uint16 *dest, uint16 *src);
105  uint16 findLastPositionOf5cChar(uint16 *text);
106  uint32 truncateDialogText(uint16 *srcText, uint16 *destText, uint32 srcLength, uint16 destLength);
107 
108  uint32 extractTextIndex(Common::File *fd, uint16 offset);
109 };
110 
111 } // End of namespace Dragons
112 
113 #endif //DRAGONS_TALK_H
Definition: bigfile.h:42
Definition: array.h:52
Definition: actor.h:85
Definition: file.h:47
Definition: scriptopcodes.h:34
Definition: actor.h:26
Definition: talk.h:34
Definition: dragons.h:167
Definition: talk.h:49