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 #include "kyra/graphics/screen.h"
30 
31 namespace Kyra {
32 
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 	virtual void printDialogueText(int stringId, const char *pageBreakString, const char *pageBreakString2 = 0);
43 	virtual void printDialogueText(const char *str, bool wait = false);
44 	void printMessage(const char *str, int textColor = -1, ...);
45 	virtual void printShadedText(const char *str, int x = -1, int y = -1, int textColor = -1, int shadowColor = -1, int pitchW = -1, int pitchH = -1, int marginRight = 0, bool screenUpdate = true) {}
46 
47 	virtual int clearDim(int dim);
48 	void clearCurDim();
49 
50 	void resetDimTextPositions(int dim);
51 	void resetPageBreakString();
52 	void setPageBreakFlag();
53 	void removePageBreakFlag();
54 
allowPageBreak(bool mode)55 	void allowPageBreak(bool mode) { _allowPageBreak = mode; }
setWaitButtonMode(int mode)56 	void setWaitButtonMode(int mode) { _waitButtonMode = mode; }
lineCount()57 	int lineCount() const { return _lineCount; }
colorMap()58 	const uint8 *colorMap() const { return _colorMap; }
59 
60 protected:
vm()61 	virtual KyraRpgEngine *vm() { return _vm; }
screen()62 	virtual Screen *screen() { return _screen; }
63 
64 	virtual void displayText(char *str, ...);
65 	char parseCommand();
66 	void readNextPara();
67 	void printLine(char *str);
68 	virtual void textPageBreak();
69 	void displayWaitButton();
70 
71 	void convertString(char *str);
72 
73 	char *_dialogueBuffer;
74 
75 	char *_tempString1;
76 	char *_tempString2;
77 	char *_currentLine;
78 	char _ctrl[3];
79 
80 	uint16 _lineWidth;
81 	uint32 _numCharsTotal;
82 	uint32 _numCharsLeft;
83 	uint32 _numCharsPrinted;
84 
85 	bool _printFlag;
86 	bool _sjisTextModeLineBreak;
87 	const bool _pc98TextMode;
88 
89 	char _pageBreakString[20];
90 	char _scriptParaString[11];
91 	int _lineCount;
92 
93 	bool _allowPageBreak;
94 	int _waitButtonSpace;
95 	int _waitButtonMode;
96 
97 	static const char _pageBreakDefault[3][5];
98 
99 	struct TextDimData {
100 		uint8 color1;
101 		uint8 color2;
102 		uint16 column;
103 		uint8 line;
104 	};
105 
106 	TextDimData *_textDimData;
107 	KyraRpgEngine *_vm;
108 
109 private:
110 	Screen *_screen;
111 
112 	char *_table1;
113 	char *_table2;
114 
115 	Screen::FontId _waitButtonFont;
116 
117 	uint8 _colorMap[256];
118 };
119 
120 } // End of namespace Kyra
121 
122 #endif
123 
124 #endif // ENABLE_EOB || ENABLE_LOL
125