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 TRECISION_DIALOG_H
23 #define TRECISION_DIALOG_H
24 
25 #include "common/scummsys.h"
26 #include "common/serializer.h"
27 #include "common/stream.h"
28 
29 namespace Trecision {
30 class TrecisionEngine;
31 
32 #define MAXDISPCHOICES 5
33 #define MAXSUBTITLES 1500
34 #define MAXDIALOG 70
35 #define MAXCHOICE 1000
36 #define MAXNEWSMKPAL 40
37 
38 struct Dialog {
39  uint16 _flag; // DONT_SKIP .. and more
40  uint16 _interlocutor; // Person I'm talking to... Maybe it's not needed
41  char _startAnim[14]; // aANIMATION or text table index by filename.
42  uint16 _startLen;
43  uint16 _firstChoice;
44  uint16 _choiceNumb;
45  uint16 _newPal[MAXNEWSMKPAL];
46 
47  void clear();
48 };
49 
51  uint16 _sentence;
52  uint16 _x, _y, _color; // you can compact this info using a bit field
53  uint16 _startFrame, _length; // Frame at which the subtitle starts and its length
54 
55  void clear();
56 };
57 
58 struct DialogChoice {
59  uint16 _flag; // DLGCHOICE_HIDE|DLGCHOICE_ONETIME|DLGCHOICE_FRAUD...if used...
60  uint16 _sentenceIndex; // Index in the sentence array.
61  uint16 _firstSubTitle, _subTitleNumb; // starting index and number of sub title sentences
62  uint16 _on[MAXDISPCHOICES], _off[MAXDISPCHOICES];
63  uint16 _startFrame; // Starting frame of the choice
64  uint16 _nextDialog;
65 
66  void clear();
67 };
68 
70  TrecisionEngine *_vm;
71 
72  void showChoices(uint16 i);
73  void playChoice(uint16 i, bool singleChoice);
74 
75  Dialog _dialog[MAXDIALOG];
76  DialogChoice _choice[MAXCHOICE];
77 
78  int16 _curPos;
79  int16 _lastPos;
80  uint16 _dispChoice[MAXDISPCHOICES];
81  uint16 _curDispChoice;
82  DialogSubTitle _subTitles[MAXSUBTITLES];
83  uint16 _curSubTitle;
84  uint16 _curDialog;
85  uint16 _curChoice;
86 
87 public:
89  ~DialogManager();
90 
91  void dialogPrint(int x, int y, int c, const Common::String &txt);
92  void updateChoices(int16 dmx, int16 dmy);
93  void selectChoice(int16 dmx, int16 dmy);
94  void playDialog(uint16 i);
95  void toggleChoice(uint16 choice, bool enable);
96  void clearExitFlag(uint16 choice);
97  bool isChoiceVisible(uint16 choice) const;
98  bool isDialogFinished(uint16 choice) const;
99  void afterChoice();
100  void dialogHandler(int numFrame);
101  void doDialog();
102  bool showCharacterAfterDialog() const;
103  bool handleShopKeeperDialog(uint16 curObj);
104  uint16 getCurDialog() const { return _curDialog; }
105  uint16 getCurChoice() const { return _curChoice; }
106  void syncGameStream(Common::Serializer &ser);
107  void loadData(Common::SeekableReadStreamEndian *stream);
108 };
109 // end of class
110 
111 } // End of namespace Trecision
112 #endif
Definition: str.h:59
Definition: trecision.h:112
Definition: dialog.h:69
Definition: serializer.h:79
Definition: actor.h:29
Definition: dialog.h:58
Definition: dialog.h:50
Definition: stream.h:944
Definition: dialog.h:38