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 #if defined(ENABLE_EOB) || defined(ENABLE_LOL)
24 
25 #ifndef KYRA_TEXT_EOB_H
26 #define KYRA_TEXT_EOB_H
27 
28 #include "common/scummsys.h"
29 
30 namespace Kyra {
31 
32 class Screen;
33 class KyraRpgEngine;
34 
35 class TextDisplayer_rpg {
36 public:
37 	TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr);
38 	virtual ~TextDisplayer_rpg();
39 
40 	void setupField(int dim, bool mode);
41 
42 	void printDialogueText(int stringId, const char *pageBreakString);
43 	void printDialogueText(const char *str, bool wait = false);
44 	void printMessage(const char *str, int textColor = -1, ...);
45 
46 	int clearDim(int dim);
47 	void clearCurDim();
48 
49 	void resetDimTextPositions(int dim);
50 	void resetPageBreakString();
51 	void setPageBreakFlag();
52 	void removePageBreakFlag();
53 
allowPageBreak(bool mode)54 	void allowPageBreak(bool mode) { _allowPageBreak = mode; }
setWaitButtonMode(int mode)55 	void setWaitButtonMode(int mode) { _waitButtonMode = mode; }
lineCount()56 	int lineCount() const { return _lineCount; }
colorMap()57 	const uint8 *colorMap() const { return _colorMap; }
58 
59 protected:
vm()60 	virtual KyraRpgEngine *vm() { return _vm; }
screen()61 	virtual Screen *screen() { return _screen; }
62 
63 	void displayText(char *str, ...);
64 	char parseCommand();
65 	void readNextPara();
66 	void printLine(char *str);
67 	virtual void textPageBreak();
68 	void displayWaitButton();
69 
70 	void convertString(char *str);
71 
72 	char *_dialogueBuffer;
73 
74 	char *_tempString1;
75 	char *_tempString2;
76 	char *_currentLine;
77 	char _ctrl[3];
78 
79 	uint16 _lineWidth;
80 	uint32 _numCharsTotal;
81 	uint32 _numCharsLeft;
82 	uint32 _numCharsPrinted;
83 
84 	bool _printFlag;
85 	bool _sjisTextModeLineBreak;
86 
87 	char _pageBreakString[20];
88 	char _scriptParaString[11];
89 	int _lineCount;
90 
91 	bool _allowPageBreak;
92 	int _waitButtonSpace;
93 	int _waitButtonMode;
94 
95 	static const char _pageBreakDefault[3][5];
96 
97 	struct TextDimData {
98 		uint8 color1;
99 		uint8 color2;
100 		uint16 column;
101 		uint8 line;
102 	};
103 
104 	TextDimData *_textDimData;
105 
106 private:
107 	KyraRpgEngine *_vm;
108 	Screen *_screen;
109 
110 	char *_table1;
111 	char *_table2;
112 
113 	uint8 _colorMap[256];
114 };
115 
116 } // End of namespace Kyra
117 
118 #endif
119 
120 #endif // ENABLE_EOB || ENABLE_LOL
121