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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef HOPKINS_TALK_H
24 #define HOPKINS_TALK_H
25 
26 #include "common/scummsys.h"
27 #include "common/str.h"
28 
29 namespace Hopkins {
30 
31 class HopkinsEngine;
32 
33 #define MIN_LETTERS_PER_LINE 65
34 
35 class TalkManager {
36 private:
37 	HopkinsEngine *_vm;
38 
39 	Common::String _questionsFilename;
40 	Common::String _answersFilename;
41 	byte *_characterBuffer;
42 	byte *_characterPalette;
43 	size_t _characterSize;
44 	int _dialogueMesgId1, _dialogueMesgId2;
45 	int _dialogueMesgId3, _dialogueMesgId4;
46 	int _paletteBufferIdx;
47 
48 	void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData);
49 	int dialogQuestion(bool animatedFl);
50 	int dialogAnswer(int idx, bool animatedFl);
51 	void searchCharacterPalette(int startIdx, bool dark);
52 	void dialogWait();
53 	void dialogTalk();
54 	void dialogEndTalk();
55 	void startCharacterAnim0(int startIndedx, bool readOnlyFl);
56 	void initCharacterAnim();
57 	void clearCharacterAnim();
58 	bool searchCharacterAnim(int idx, const byte *bufPerso, int animId, int bufferSize);
59 	int countBoxLines(int idx, const Common::String &file);
60 	void dialogAnim();
61 	void displayBobDialogAnim(int idx);
62 
63 public:
64 	byte *_characterAnim;
65 	byte *_characterSprite;
66 
67 	TalkManager(HopkinsEngine *vm);
68 
69 	void startStaticCharacterDialogue(const Common::String &filename);
70 	void startAnimatedCharacterDialogue(const Common::String &filename);
71 	void animateObject(const Common::String &filename);
72 	void handleAnswer(int zone, int verb);
73 	void handleForestAnswser(int zone, int verb);
74 };
75 
76 } // End of namespace Hopkins
77 
78 #endif /* HOPKINS_TALK_H */
79