2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2003-12-16 02:10:15 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2003-12-16 02:10:15 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-12-16 02:10:15 +00:00
|
|
|
*
|
2006-02-11 10:01:01 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-12-16 02:10:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-20 18:04:13 +00:00
|
|
|
#ifndef SWORD1_TEXT_H
|
|
|
|
#define SWORD1_TEXT_H
|
2003-12-16 02:10:15 +00:00
|
|
|
|
2004-10-21 12:43:49 +00:00
|
|
|
#include "sword1/object.h"
|
|
|
|
#include "sword1/sworddefs.h"
|
2004-01-11 15:47:41 +00:00
|
|
|
|
|
|
|
namespace Sword1 {
|
|
|
|
|
2007-04-28 07:27:53 +00:00
|
|
|
#define MAX_TEXT_OBS 3
|
|
|
|
|
|
|
|
#define BORDER_COL 200
|
2009-02-28 10:46:33 +00:00
|
|
|
#define BORDER_COL_PSX 199
|
2007-04-28 07:27:53 +00:00
|
|
|
#define LETTER_COL 193
|
|
|
|
#define NO_COL 0 // sprite background - 0 for transparency
|
2004-01-11 15:47:41 +00:00
|
|
|
|
2003-12-16 02:10:15 +00:00
|
|
|
class ObjectMan;
|
|
|
|
class ResMan;
|
|
|
|
|
|
|
|
struct LineInfo {
|
|
|
|
uint16 width; // width of line in pixels
|
|
|
|
uint16 length; // length of line in characters
|
|
|
|
};
|
|
|
|
|
2004-01-11 15:47:41 +00:00
|
|
|
class Text {
|
2003-12-16 02:10:15 +00:00
|
|
|
public:
|
2004-01-11 15:47:41 +00:00
|
|
|
Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion);
|
2009-11-02 21:54:57 +00:00
|
|
|
~Text();
|
2003-12-16 02:10:15 +00:00
|
|
|
FrameHeader *giveSpriteData(uint32 textTarget);
|
|
|
|
uint32 lowTextManager(uint8 *text, int32 width, uint8 pen);
|
2007-04-28 07:27:53 +00:00
|
|
|
void makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen);
|
2008-10-13 18:41:12 +00:00
|
|
|
void releaseText(uint32 id, bool updateCount = true);
|
2003-12-16 02:10:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint16 analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *info);
|
|
|
|
uint16 charWidth(uint8 ch);
|
|
|
|
uint16 copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen);
|
|
|
|
uint8 *_font;
|
|
|
|
uint8 _textCount;
|
|
|
|
uint16 _charHeight, _joinWidth;
|
|
|
|
ObjectMan *_objMan;
|
|
|
|
ResMan *_resMan;
|
|
|
|
FrameHeader *_textBlocks[MAX_TEXT_OBS];
|
2004-11-09 04:06:10 +00:00
|
|
|
uint32 _fontId;
|
2003-12-16 02:10:15 +00:00
|
|
|
};
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
} // End of namespace Sword1
|
2004-01-11 15:47:41 +00:00
|
|
|
|
2003-12-16 02:10:15 +00:00
|
|
|
#endif //BSTEXT_H
|