2002-12-25 21:04:47 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2003-03-06 21:46:56 +00:00
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
2002-12-25 21:04:47 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CHARSET_H
|
|
|
|
#define CHARSET_H
|
|
|
|
|
2003-05-15 22:30:32 +00:00
|
|
|
#include "common/rect.h"
|
2002-12-25 21:04:47 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
|
|
|
|
class Scumm;
|
2002-12-26 01:47:40 +00:00
|
|
|
class NutRenderer;
|
2002-12-25 21:04:47 +00:00
|
|
|
struct VirtScreen;
|
|
|
|
|
|
|
|
class CharsetRenderer {
|
|
|
|
public:
|
2003-05-15 22:30:32 +00:00
|
|
|
ScummVM::Rect _str;
|
2002-12-25 21:04:47 +00:00
|
|
|
int _nextLeft, _nextTop;
|
|
|
|
|
|
|
|
int _top;
|
|
|
|
int _left, _startLeft;
|
|
|
|
int _right;
|
2002-12-25 21:14:26 +00:00
|
|
|
|
2003-04-27 18:49:27 +00:00
|
|
|
protected:
|
2002-12-25 21:04:47 +00:00
|
|
|
byte _color;
|
2003-04-27 18:49:27 +00:00
|
|
|
bool _dropShadow;
|
2002-12-25 21:14:26 +00:00
|
|
|
|
2003-04-27 18:49:27 +00:00
|
|
|
public:
|
2002-12-25 21:14:26 +00:00
|
|
|
bool _center;
|
2002-12-25 21:04:47 +00:00
|
|
|
bool _hasMask;
|
2002-12-25 21:14:26 +00:00
|
|
|
bool _ignoreCharsetMask;
|
2002-12-25 21:04:47 +00:00
|
|
|
bool _blitAlso;
|
|
|
|
bool _firstChar;
|
|
|
|
bool _disableOffsX;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Scumm *_vm;
|
2002-12-26 01:47:40 +00:00
|
|
|
byte _curId;
|
2002-12-25 21:04:47 +00:00
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
virtual int getCharWidth(byte chr) = 0;
|
2002-12-25 21:57:01 +00:00
|
|
|
|
2002-12-25 21:04:47 +00:00
|
|
|
public:
|
2003-05-20 15:12:33 +00:00
|
|
|
CharsetRenderer(Scumm *vm);
|
2002-12-26 00:21:19 +00:00
|
|
|
virtual ~CharsetRenderer() {}
|
2002-12-25 21:04:47 +00:00
|
|
|
|
2002-12-25 21:57:01 +00:00
|
|
|
virtual void printChar(int chr) = 0;
|
|
|
|
|
2003-05-21 16:28:02 +00:00
|
|
|
int getStringWidth(int a, const byte *str);
|
2002-12-25 21:04:47 +00:00
|
|
|
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
virtual void setCurID(byte id) = 0;
|
2002-12-26 01:47:40 +00:00
|
|
|
int getCurID() { return _curId; }
|
2002-12-26 00:21:19 +00:00
|
|
|
|
|
|
|
virtual int getFontHeight() = 0;
|
2003-04-27 18:49:27 +00:00
|
|
|
|
|
|
|
virtual void setColor(byte color) { _color = color; }
|
2002-12-26 00:21:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CharsetRendererCommon : public CharsetRenderer {
|
|
|
|
protected:
|
|
|
|
byte *_fontPtr;
|
|
|
|
|
2003-06-04 14:37:43 +00:00
|
|
|
void drawBits1(VirtScreen *vs, byte *dst, const byte *src, byte *mask, int drawTop, int width, int height);
|
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
public:
|
|
|
|
CharsetRendererCommon(Scumm *vm) : CharsetRenderer(vm) {}
|
|
|
|
|
2002-12-25 21:04:47 +00:00
|
|
|
void setCurID(byte id);
|
|
|
|
|
2002-12-25 21:42:22 +00:00
|
|
|
int getFontHeight() { return _fontPtr[1]; }
|
2002-12-25 21:04:47 +00:00
|
|
|
};
|
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
class CharsetRendererClassic : public CharsetRendererCommon {
|
2002-12-25 21:57:01 +00:00
|
|
|
protected:
|
2002-12-26 00:21:19 +00:00
|
|
|
int getCharWidth(byte chr);
|
2003-06-04 14:37:43 +00:00
|
|
|
|
|
|
|
void drawBitsN(VirtScreen *vs, byte *dst, const byte *src, byte *mask, byte bpp, int drawTop, int width, int height);
|
2002-12-25 21:57:01 +00:00
|
|
|
|
|
|
|
public:
|
2002-12-26 00:21:19 +00:00
|
|
|
CharsetRendererClassic(Scumm *vm) : CharsetRendererCommon(vm) {}
|
2002-12-25 21:57:01 +00:00
|
|
|
|
|
|
|
void printChar(int chr);
|
|
|
|
};
|
|
|
|
|
2003-05-08 22:44:46 +00:00
|
|
|
class CharsetRendererV3 : public CharsetRendererCommon {
|
2002-12-25 21:57:01 +00:00
|
|
|
protected:
|
2003-05-08 22:44:46 +00:00
|
|
|
int _nbChars;
|
|
|
|
byte *_widthTable;
|
|
|
|
|
2002-12-26 00:21:19 +00:00
|
|
|
int getCharWidth(byte chr);
|
2002-12-25 21:57:01 +00:00
|
|
|
|
|
|
|
public:
|
2003-05-08 22:44:46 +00:00
|
|
|
CharsetRendererV3(Scumm *vm) : CharsetRendererCommon(vm) {}
|
2002-12-25 21:57:01 +00:00
|
|
|
|
|
|
|
void printChar(int chr);
|
2003-05-08 22:44:46 +00:00
|
|
|
void setCurID(byte id);
|
2003-04-27 18:49:27 +00:00
|
|
|
void setColor(byte color);
|
2003-05-14 13:30:52 +00:00
|
|
|
int getFontHeight() { return 8; }
|
2002-12-25 21:57:01 +00:00
|
|
|
};
|
|
|
|
|
2003-05-08 22:44:46 +00:00
|
|
|
class CharsetRendererV2 : public CharsetRendererV3 {
|
2003-05-14 12:12:55 +00:00
|
|
|
protected:
|
|
|
|
int getCharWidth(byte chr) { return 8; }
|
|
|
|
|
2003-05-08 22:44:46 +00:00
|
|
|
public:
|
|
|
|
CharsetRendererV2(Scumm *vm) : CharsetRendererV3(vm) {}
|
|
|
|
|
|
|
|
void setCurID(byte id);
|
|
|
|
};
|
|
|
|
|
2002-12-26 01:47:40 +00:00
|
|
|
class CharsetRendererNut : public CharsetRenderer {
|
2002-12-26 00:21:19 +00:00
|
|
|
protected:
|
|
|
|
int getCharWidth(byte chr);
|
|
|
|
|
2002-12-31 21:41:24 +00:00
|
|
|
NutRenderer *_fr[5];
|
2002-12-26 01:47:40 +00:00
|
|
|
NutRenderer *_current;
|
2002-12-26 00:21:19 +00:00
|
|
|
|
|
|
|
public:
|
2002-12-26 01:47:40 +00:00
|
|
|
CharsetRendererNut(Scumm *vm);
|
|
|
|
~CharsetRendererNut();
|
2002-12-26 00:21:19 +00:00
|
|
|
|
|
|
|
void printChar(int chr);
|
|
|
|
|
|
|
|
void setCurID(byte id);
|
2002-12-26 01:47:40 +00:00
|
|
|
|
|
|
|
int getFontHeight();
|
2002-12-26 00:21:19 +00:00
|
|
|
};
|
2002-12-25 21:57:01 +00:00
|
|
|
|
2002-12-25 21:04:47 +00:00
|
|
|
#endif
|