2003-12-16 02:10:15 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
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
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BSTEXT_H
|
|
|
|
#define BSTEXT_H
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
#define MAX_TEXT_OBS 2
|
|
|
|
|
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);
|
|
|
|
~Text(void);
|
2003-12-16 02:10:15 +00:00
|
|
|
FrameHeader *giveSpriteData(uint32 textTarget);
|
|
|
|
uint32 lowTextManager(uint8 *text, int32 width, uint8 pen);
|
|
|
|
void releaseText(uint32 id);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen);
|
|
|
|
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
|