ScummVM API documentation
speech.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 #ifndef SLUDGE_TALK_H
22 #define SLUDGE_TALK_H
23 
24 #include "sludge/sprites.h"
25 
26 namespace Sludge {
27 
28 struct ObjectType;
29 
30 struct SpeechLine {
31  Common::String textLine;
32  int x;
33 };
34 
36 
37 struct SpeechStruct {
38  OnScreenPerson *currentTalker;
39  SpeechLineList allSpeech;
40  int speechY, lastFile, lookWhosTalking;
41  SpritePalette talkCol;
42 };
43 
45 public:
46  SpeechManager(SludgeEngine *vm) : _vm(vm) { init(); }
47  ~SpeechManager() { kill(); }
48 
49  void init();
50  void kill();
51 
52  int wrapSpeech(const Common::String &theText, int objT, int sampleFile, bool);
53  void display();
54 
55  int isThereAnySpeechGoingOn();
56  bool isCurrentTalker(OnScreenPerson *person) { return person == _speech->currentTalker; }
57  int getLastSpeechSound();
58 
59  // setters & getters
60  void setObjFontColour(ObjectType *t);
61  void setSpeechSpeed(float speed) { _speechSpeed = speed; }
62  float getSpeechSpeed() { return _speechSpeed; }
63  void setSpeechMode(int speechMode) { _speechMode = speechMode; }
64 
65  // load & save
66  void save(Common::WriteStream *stream);
67  bool load(Common::SeekableReadStream *stream);
68 
69  // freeze & restore
70  void freeze(FrozenStuffStruct *frozenStuff);
71  void restore(FrozenStuffStruct *frozenStuff);
72 
73 private:
74  SludgeEngine *_vm;
75  int _speechMode;
76  SpeechStruct *_speech;
77  float _speechSpeed;
78 
79  void addSpeechLine(const Common::String &theLine, int x, int &offset);
80  int wrapSpeechXY(const Common::String &theText, int x, int y, int wrap, int sampleFile);
81  int wrapSpeechPerson(const Common::String &theText, OnScreenPerson &thePerson, int sampleFile, bool animPerson);
82 };
83 
84 } // End of namespace Sludge
85 
86 #endif
Definition: str.h:59
Definition: objtypes.h:32
Definition: people.h:76
Definition: stream.h:77
Definition: speech.h:30
Definition: stream.h:745
Definition: speech.h:44
Definition: sprites.h:34
Definition: sludge.h:68
Definition: builtin.h:27
Definition: freeze.h:41
Definition: speech.h:37