scummvm/engines/tony/font.cpp

2587 lines
62 KiB
C++
Raw Normal View History

/* 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.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
2012-05-14 07:43:50 +02:00
/*
* This code is based on original Tony Tough source code
*
* Copyright (c) 1997-2003 Nayma Software
*/
#include "common/textconsole.h"
#include "tony/mpal/mpalutils.h"
#include "tony/font.h"
#include "tony/input.h"
#include "tony/inventory.h"
#include "tony/loc.h"
#include "tony/tony.h"
namespace Tony {
/****************************************************************************\
* RMFont Methods
\****************************************************************************/
RMFont::RMFont() {
2012-06-06 08:04:33 +02:00
_letter = NULL;
}
RMFont::~RMFont() {
2012-06-06 08:04:33 +02:00
unload();
}
/**
* Dumps a font to a buffer
2012-05-21 23:53:13 +02:00
* @param buf Buffer for font contents
* @param nChars Number of characters (max 256)
* @param dimx X dimension in pixels
* @param dimy Y dimension in pixels
*
\****************************************************************************/
void DumpFontBMP(const char *filename, const byte *buf, int nChars, int charX, int charY, byte *pal) {
error("DumpFontBMP not supported in ScummVM");
}
2012-06-06 08:04:33 +02:00
void RMFont::load(const byte *buf, int nChars, int dimx, int dimy, uint32 palResID) {
_letter = new RMGfxSourceBuffer8RLEByte[nChars];
// Initialise the fonts
2012-05-03 23:08:19 +10:00
for (int i = 0; i < nChars; i++) {
// Initialise the buffer with the letters
2012-06-06 08:04:33 +02:00
_letter[i].init(buf + i * (dimx * dimy + 8) + 8, dimx, dimy);
_letter[i].loadPaletteWA(palResID);
}
2012-06-06 08:04:33 +02:00
_fontDimx = dimx;
_fontDimy = dimy;
2012-05-14 21:29:27 +02:00
nLetters = nChars;
}
2012-06-06 08:04:33 +02:00
void RMFont::load(uint32 resID, int nChars, int dimx, int dimy, uint32 palResID) {
RMRes res(resID);
if ((int)res.size() < nChars * (dimy * dimx + 8))
nChars = res.size() / (dimy * dimx + 8);
2012-06-06 08:04:33 +02:00
load(res, nChars, dimx, dimy, palResID);
}
2012-06-06 08:04:33 +02:00
void RMFont::unload(void) {
if (_letter != NULL) {
delete[] _letter;
_letter = NULL;
}
}
2012-06-06 08:04:33 +02:00
RMGfxPrimitive *RMFont::makeLetterPrimitive(byte bChar, int &nLength) {
RMFontPrimitive *prim;
int nLett;
// Convert from character to glyph index
2012-06-06 08:04:33 +02:00
nLett = convertToLetter(bChar);
assert(nLett < nLetters);
// Create primitive font
prim = new RMFontPrimitive(this);
2012-06-06 08:04:33 +02:00
prim->_nChar = nLett;
// Get the length of the character in pixels
2012-06-06 08:04:33 +02:00
nLength = letterLength(bChar);
return prim;
}
2012-06-05 08:39:55 +02:00
void RMFont::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim2) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
RMFontPrimitive *prim = (RMFontPrimitive *)prim2;
CORO_BEGIN_CODE(_ctx);
// Call the draw method of the letter assigned to the primitive
2012-06-06 08:04:33 +02:00
if (prim->_nChar != -1)
CORO_INVOKE_2(_letter[prim->_nChar].draw, bigBuf, prim);
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMFont::close(void) {
unload();
}
2012-06-06 08:04:33 +02:00
int RMFont::stringLen(const RMString &text) {
int len, i;
len = 0;
for (i = 0; i < text.length() - 1; i++)
2012-06-06 08:04:33 +02:00
len += letterLength(text[i], text[i + 1]);
len += letterLength(text[i]);
return len;
}
2012-06-06 08:04:33 +02:00
int RMFont::stringLen(char bChar, char bNext) {
return letterLength(bChar, bNext);
}
/****************************************************************************\
* Metodi di RMFontColor
\****************************************************************************/
RMFontColor::RMFontColor() : RMFont() {
2012-05-14 21:29:27 +02:00
m_r = m_g = m_b = 255;
}
RMFontColor::~RMFontColor() {
}
void RMFontColor::setBaseColor(byte r1, byte g1, byte b1) {
int r = (int)r1 << 16;
int g = (int)g1 << 16;
int b = (int)b1 << 16;
int rstep = r / 14;
int gstep = g / 14;
int bstep = b / 14;
int i;
2012-05-14 21:29:27 +02:00
byte pal[768 * 3];
// Check if we are already on the right colour
if (m_r == r1 && m_g == g1 && m_b == b1)
return;
m_r = r1;
m_g = g1;
m_b = b1;
// Constructs a new paletter for the font
for (i = 1; i < 16; i++) {
2012-05-14 21:29:27 +02:00
pal[i * 3 + 0] = r >> 16;
pal[i * 3 + 1] = g >> 16;
pal[i * 3 + 2] = b >> 16;
r -= rstep;
g -= gstep;
b -= bstep;
}
2012-05-14 21:29:27 +02:00
pal[15 * 3 + 0] += 8;
pal[15 * 3 + 1] += 8;
pal[15 * 3 + 2] += 8;
// Puts in all the letters
for (i = 0; i < nLetters; i++)
2012-06-06 08:04:33 +02:00
_letter[i].loadPaletteWA(pal);
}
/***************************************************************************\
* RMFontParla Methods
\****************************************************************************/
2012-06-05 08:39:55 +02:00
void RMFontParla::init(void) {
int i;
// bernie: Number of characters in the font
int nchars =
2012-05-14 21:29:27 +02:00
112 // base
+ 18 // polish
+ 66 // russian
+ 30 // czech
+ 8 // french
+ 5; // deutsch
2012-06-06 08:04:33 +02:00
load(RES_F_PARL, nchars, 20, 20);
// Initialise the f**king table
lDefault = 13;
hDefault = 18;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
2012-05-03 23:08:19 +10:00
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
}
for (i = 0; i < 26; i++)
cTable['A' + i] = i + 0;
for (i = 0; i < 26; i++)
cTable['a' + i] = i + 26;
for (i = 0; i < 10; i++)
cTable['0' + i] = i + 52;
cTable[';'] = 62;
cTable[','] = 63;
cTable['.'] = 64;
cTable[':'] = 65;
cTable['-'] = 66;
cTable['_'] = 67;
cTable['+'] = 68;
cTable['<'] = 69;
cTable['>'] = 70;
cTable['!'] = 71;
//cTable['!'] = 72; Exclamation countdown
cTable['?'] = 73;
//cTable['?'] = 74; Question down
cTable['('] = 75;
cTable[')'] = 76;
cTable['\"'] = 77;
cTable['^'] = 77;
cTable['/'] = 78;
cTable[(byte)'<EFBFBD>'] = 79;
cTable['$'] = 80;
cTable['%'] = 81;
cTable['&'] = 82;
cTable['='] = 83;
cTable[(byte)'<EFBFBD>'] = 84;
cTable[(byte)'<EFBFBD>'] = 85;
cTable[(byte)'<EFBFBD>'] = 86;
cTable[(byte)'<EFBFBD>'] = 87;
cTable[(byte)'<EFBFBD>'] = 88;
cTable[(byte)'<EFBFBD>'] = 89;
cTable[(byte)'<EFBFBD>'] = 89;
cTable[(byte)'<EFBFBD>'] = 90;
cTable[(byte)'<EFBFBD>'] = 91;
cTable[(byte)'<EFBFBD>'] = 92;
cTable[(byte)'<EFBFBD>'] = 93;
cTable[(byte)'<EFBFBD>'] = 94;
cTable[(byte)'<EFBFBD>'] = 95;
cTable[(byte)'<EFBFBD>'] = 96;
cTable[(byte)'<EFBFBD>'] = 97;
cTable[(byte)'<EFBFBD>'] = 98;
cTable[(byte)'<EFBFBD>'] = 99;
//cTable[' '] = 100; e circlet
//cTable[' '] = 101; i circlet
//cTable[' '] = 102; o circlet
//cTable[' '] = 103; u circlet
cTable[(byte)'<EFBFBD>'] = 104;
cTable[(byte)'<EFBFBD>'] = 105;
cTable[(byte)'<EFBFBD>'] = 106;
cTable[(byte)'<EFBFBD>'] = 107;
cTable[(byte)'<EFBFBD>'] = 108;
cTable[(byte)'<EFBFBD>'] = 109;
//cTable['<27>'] = 110; integral
2012-05-14 21:29:27 +02:00
cTable['\''] = 111;
// Little lengths
lTable[' '] = 9;
lTable['\''] = 5;
lTable['.'] = 5;
lTable[','] = 5;
lTable[':'] = 5;
lTable[';'] = 5;
lTable['!'] = 5;
lTable['?'] = 10;
lTable['\"'] = 5;
lTable['^'] = 5;
lTable['('] = 7;
lTable[')'] = 7;
lTable['4'] = 10;
lTable['a'] = 14;
lTable['b'] = 15;
lTable['c'] = 12;
lTable['e'] = 12;
lTable['i'] = 6;
lTable['<EFBFBD>'] = 6;
lTable['l'] = 5;
lTable['m'] = 16;
lTable['n'] = 12;
lTable['o'] = 11;
lTable['p'] = 11;
lTable['s'] = 12;
lTable['u'] = 12;
lTable['E'] = 10;
lTable['F'] = 11;
2012-05-21 23:53:13 +02:00
if (_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA3B3><EFBFBD>󌜯<EFBFBD><F38C9CAF><EFBFBD>
cTable[(byte)'<EFBFBD>'] = 112;
cTable[(byte)'<EFBFBD>'] = 113;
cTable[(byte)'<EFBFBD>'] = 114;
cTable[(byte)'<EFBFBD>'] = 115;
cTable[(byte)'<EFBFBD>'] = 116;
cTable[(byte)'<EFBFBD>'] = 117;
cTable[(byte)'<EFBFBD>'] = 118;
cTable[(byte)'<EFBFBD>'] = 119;
cTable[(byte)'<EFBFBD>'] = 120;
cTable[(byte)'<EFBFBD>'] = 121;
cTable[(byte)'<EFBFBD>'] = 122;
cTable[(byte)'<EFBFBD>'] = 123;
cTable[(byte)'<EFBFBD>'] = 124;
cTable[(byte)'<EFBFBD>'] = 125;
cTable[(byte)'<EFBFBD>'] = 126;
cTable[(byte)'<EFBFBD>'] = 127;
cTable[(byte)'<EFBFBD>'] = 128;
cTable[(byte)'<EFBFBD>'] = 129;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 13;
} else if (_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
2012-05-21 23:53:13 +02:00
// allowing for further translations. To support Tonyin other langauges,
// these mappings could be used as a basis
cTable[(byte)'<EFBFBD>'] = 130;
cTable[(byte)'<EFBFBD>'] = 131;
cTable[(byte)'<EFBFBD>'] = 132;
cTable[(byte)'<EFBFBD>'] = 133;
cTable[(byte)'<EFBFBD>'] = 134;
cTable[(byte)'<EFBFBD>'] = 135;
cTable[(byte)'<EFBFBD>'] = 136;
cTable[(byte)'<EFBFBD>'] = 137;
cTable[(byte)'<EFBFBD>'] = 138;
cTable[(byte)'<EFBFBD>'] = 139;
cTable[(byte)'<EFBFBD>'] = 140;
cTable[(byte)'<EFBFBD>'] = 141;
cTable[(byte)'<EFBFBD>'] = 142;
cTable[(byte)'<EFBFBD>'] = 143;
cTable[(byte)'<EFBFBD>'] = 144;
cTable[(byte)'<EFBFBD>'] = 145;
cTable[(byte)'<EFBFBD>'] = 146;
cTable[(byte)'<EFBFBD>'] = 147;
cTable[(byte)'<EFBFBD>'] = 148;
cTable[(byte)'<EFBFBD>'] = 149;
cTable[(byte)'<EFBFBD>'] = 150;
cTable[(byte)'<EFBFBD>'] = 151;
cTable[(byte)'<EFBFBD>'] = 152;
cTable[(byte)'<EFBFBD>'] = 153;
cTable[(byte)'<EFBFBD>'] = 154;
cTable[(byte)'<EFBFBD>'] = 155;
cTable[(byte)'<EFBFBD>'] = 156;
cTable[(byte)'<EFBFBD>'] = 157;
cTable[(byte)'<EFBFBD>'] = 158;
cTable[(byte)'<EFBFBD>'] = 159;
cTable[(byte)'<EFBFBD>'] = 160;
cTable[(byte)'<EFBFBD>'] = 161;
cTable[(byte)'<EFBFBD>'] = 162;
cTable[(byte)'<EFBFBD>'] = 163;
cTable[(byte)'<EFBFBD>'] = 164;
cTable[(byte)'<EFBFBD>'] = 165;
cTable[(byte)'<EFBFBD>'] = 166;
cTable[(byte)'<EFBFBD>'] = 167;
cTable[(byte)'<EFBFBD>'] = 168;
cTable[(byte)'<EFBFBD>'] = 169;
cTable[(byte)'<EFBFBD>'] = 170;
cTable[(byte)'<EFBFBD>'] = 171;
cTable[(byte)'<EFBFBD>'] = 172;
cTable[(byte)'<EFBFBD>'] = 173;
cTable[(byte)'<EFBFBD>'] = 174;
cTable[(byte)'<EFBFBD>'] = 175;
cTable[(byte)'<EFBFBD>'] = 176;
cTable[(byte)'<EFBFBD>'] = 177;
cTable[(byte)'<EFBFBD>'] = 178;
cTable[(byte)'<EFBFBD>'] = 179;
cTable[(byte)'<EFBFBD>'] = 180;
cTable[(byte)'<EFBFBD>'] = 181;
cTable[(byte)'<EFBFBD>'] = 182;
cTable[(byte)'<EFBFBD>'] = 183;
cTable[(byte)'<EFBFBD>'] = 184;
cTable[(byte)'<EFBFBD>'] = 185;
cTable[(byte)'<EFBFBD>'] = 186;
cTable[(byte)'<EFBFBD>'] = 187;
cTable[(byte)'<EFBFBD>'] = 188;
cTable[(byte)'<EFBFBD>'] = 189;
cTable[(byte)'<EFBFBD>'] = 190;
cTable[(byte)'<EFBFBD>'] = 191;
cTable[(byte)'<EFBFBD>'] = 192;
cTable[(byte)'<EFBFBD>'] = 193;
cTable[(byte)'<EFBFBD>'] = 194;
cTable[(byte)'<EFBFBD>'] = 195;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 8;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 14;
} else if (_vm->getLanguage() == Common::CZ_CZE) {
// Czech
cTable[(byte)'<EFBFBD>'] = 196;
cTable[(byte)'<EFBFBD>'] = 197;
cTable[(byte)'<EFBFBD>'] = 198;
cTable[(byte)'<EFBFBD>'] = 199;
cTable[(byte)'<EFBFBD>'] = 200;
cTable[(byte)'<EFBFBD>'] = 201;
cTable[(byte)'<EFBFBD>'] = 202;
cTable[(byte)'<EFBFBD>'] = 203;
cTable[(byte)'<EFBFBD>'] = 204;
cTable[(byte)'<EFBFBD>'] = 205;
cTable[(byte)'<EFBFBD>'] = 206;
cTable[(byte)'<EFBFBD>'] = 207;
cTable[(byte)'<EFBFBD>'] = 208;
cTable[(byte)'<EFBFBD>'] = 209;
cTable[(byte)'<EFBFBD>'] = 210;
cTable[(byte)'<EFBFBD>'] = 211;
cTable[(byte)'<EFBFBD>'] = 212;
cTable[(byte)'<EFBFBD>'] = 213;
cTable[(byte)'<EFBFBD>'] = 214;
cTable[(byte)'<EFBFBD>'] = 215;
cTable[(byte)'<EFBFBD>'] = 216;
cTable[(byte)'<EFBFBD>'] = 217;
cTable[(byte)'<EFBFBD>'] = 218;
cTable[(byte)'<EFBFBD>'] = 219;
cTable[(byte)'<EFBFBD>'] = 220;
cTable[(byte)'<EFBFBD>'] = 221;
cTable[(byte)'<EFBFBD>'] = 222;
cTable[(byte)'<EFBFBD>'] = 223;
cTable[(byte)'<EFBFBD>'] = 224;
cTable[(byte)'<EFBFBD>'] = 225;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 7;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
2012-05-21 23:53:13 +02:00
} else if (_vm->getLanguage() == Common::FR_FRA) {
// French
cTable[(byte)'<EFBFBD>'] = 226;
cTable[(byte)'<EFBFBD>'] = 227;
cTable[(byte)'<EFBFBD>'] = 228;
cTable[(byte)'<EFBFBD>'] = 229;
cTable[(byte)'<EFBFBD>'] = 230;
cTable[(byte)'<EFBFBD>'] = 231;
cTable[(byte)'<EFBFBD>'] = 232;
cTable[(byte)'<EFBFBD>'] = 233;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
} else if (_vm->getLanguage() == Common::DE_DEU) {
cTable[(byte)'<EFBFBD>'] = 234;
// 'SS' = 235
cTable[(byte)'<EFBFBD>'] = 236;
cTable[(byte)'<EFBFBD>'] = 237;
cTable[(byte)'<EFBFBD>'] = 238;
lTable[(byte)'<EFBFBD>'] = 15;
}
}
/***************************************************************************\
* RMFontMacc Methods
\****************************************************************************/
2012-06-05 08:39:55 +02:00
void RMFontMacc::init(void) {
int i;
// bernie: Number of characters in the font
int nchars =
2012-05-14 21:29:27 +02:00
102 // base
+ 18 // polish
+ 66 // russian
+ 30 // czech
+ 8 // francais
+ 5; // deutsch
2012-06-06 08:04:33 +02:00
load(RES_F_MACC, nchars, 11, 16);
// Default
lDefault = 10;
hDefault = 17;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
2012-05-14 21:29:27 +02:00
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
}
for (i = 0; i < 26; i++)
2012-05-14 21:29:27 +02:00
cTable['A' + i] = i + 0;
for (i = 0; i < 26; i++)
2012-05-14 21:29:27 +02:00
cTable['a' + i] = i + 26;
for (i = 0; i < 10; i++)
2012-05-14 21:29:27 +02:00
cTable['0' + i] = i + 52;
cTable['!'] = 62;
2012-05-14 21:29:27 +02:00
//cTable['!'] = 63; // ! rovescia
cTable['\"'] = 64;
cTable['$'] = 65;
cTable['%'] = 66;
cTable['&'] = 67;
cTable['/'] = 68;
cTable['('] = 69;
cTable[')'] = 70;
cTable['='] = 71;
cTable['?'] = 72;
//cTable['?'] = 73; // ? rovescia
cTable['*'] = 74;
cTable['+'] = 75;
cTable[(byte)'<EFBFBD>'] = 76;
cTable[';'] = 77;
cTable[','] = 78;
cTable['.'] = 79;
2012-05-14 21:29:27 +02:00
cTable[':'] = 80;
cTable['-'] = 81;
cTable['<'] = 82;
cTable['>'] = 83;
cTable['/'] = 84;
cTable[(byte)'<EFBFBD>'] = 85;
cTable[(byte)'<EFBFBD>'] = 86;
cTable[(byte)'<EFBFBD>'] = 87;
cTable[(byte)'<EFBFBD>'] = 88;
cTable[(byte)'<EFBFBD>'] = 89;
cTable[(byte)'<EFBFBD>'] = 90;
//cTable[(byte)''] = 91; // e with ball
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 92;
cTable[(byte)'<EFBFBD>'] = 93;
//cTable[(byte)''] = 94; // i with ball
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 95;
cTable[(byte)'<EFBFBD>'] = 96;
//cTable[(byte)''] = 97; // o with ball
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 98;
cTable[(byte)'<EFBFBD>'] = 99;
//cTable[(byte)''] = 100; // u with ball
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 101;
2012-05-21 23:53:13 +02:00
if (_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA3B3><EFBFBD>󌜯<EFBFBD><F38C9CAF><EFBFBD>
cTable[(byte)'<EFBFBD>'] = 102;
cTable[(byte)'<EFBFBD>'] = 103;
cTable[(byte)'<EFBFBD>'] = 104;
cTable[(byte)'<EFBFBD>'] = 105;
cTable[(byte)'<EFBFBD>'] = 106;
cTable[(byte)'<EFBFBD>'] = 107;
cTable[(byte)'<EFBFBD>'] = 108;
cTable[(byte)'<EFBFBD>'] = 109;
cTable[(byte)'<EFBFBD>'] = 110;
cTable[(byte)'<EFBFBD>'] = 111;
cTable[(byte)'<EFBFBD>'] = 112;
cTable[(byte)'<EFBFBD>'] = 113;
cTable[(byte)'<EFBFBD>'] = 114;
cTable[(byte)'<EFBFBD>'] = 115;
cTable[(byte)'<EFBFBD>'] = 116;
cTable[(byte)'<EFBFBD>'] = 117;
cTable[(byte)'<EFBFBD>'] = 118;
cTable[(byte)'<EFBFBD>'] = 119;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 13;
} else if (_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
2012-05-21 23:53:13 +02:00
// allowing for further translations. To support Tonyin other langauges,
// these mappings could be used as a basis
cTable[(byte)'<EFBFBD>'] = 120;
cTable[(byte)'<EFBFBD>'] = 121;
cTable[(byte)'<EFBFBD>'] = 122;
cTable[(byte)'<EFBFBD>'] = 123;
cTable[(byte)'<EFBFBD>'] = 124;
cTable[(byte)'<EFBFBD>'] = 125;
cTable[(byte)'<EFBFBD>'] = 126;
cTable[(byte)'<EFBFBD>'] = 127;
cTable[(byte)'<EFBFBD>'] = 128;
cTable[(byte)'<EFBFBD>'] = 129;
cTable[(byte)'<EFBFBD>'] = 130;
cTable[(byte)'<EFBFBD>'] = 131;
cTable[(byte)'<EFBFBD>'] = 132;
cTable[(byte)'<EFBFBD>'] = 133;
cTable[(byte)'<EFBFBD>'] = 134;
cTable[(byte)'<EFBFBD>'] = 135;
cTable[(byte)'<EFBFBD>'] = 136;
cTable[(byte)'<EFBFBD>'] = 137;
cTable[(byte)'<EFBFBD>'] = 138;
cTable[(byte)'<EFBFBD>'] = 139;
cTable[(byte)'<EFBFBD>'] = 140;
cTable[(byte)'<EFBFBD>'] = 141;
cTable[(byte)'<EFBFBD>'] = 142;
cTable[(byte)'<EFBFBD>'] = 143;
cTable[(byte)'<EFBFBD>'] = 144;
cTable[(byte)'<EFBFBD>'] = 145;
cTable[(byte)'<EFBFBD>'] = 146;
cTable[(byte)'<EFBFBD>'] = 147;
cTable[(byte)'<EFBFBD>'] = 148;
cTable[(byte)'<EFBFBD>'] = 149;
cTable[(byte)'<EFBFBD>'] = 150;
cTable[(byte)'<EFBFBD>'] = 151;
cTable[(byte)'<EFBFBD>'] = 152;
cTable[(byte)'<EFBFBD>'] = 153;
cTable[(byte)'<EFBFBD>'] = 154;
cTable[(byte)'<EFBFBD>'] = 155;
cTable[(byte)'<EFBFBD>'] = 156;
cTable[(byte)'<EFBFBD>'] = 157;
cTable[(byte)'<EFBFBD>'] = 158;
cTable[(byte)'<EFBFBD>'] = 159;
cTable[(byte)'<EFBFBD>'] = 160;
cTable[(byte)'<EFBFBD>'] = 161;
cTable[(byte)'<EFBFBD>'] = 162;
cTable[(byte)'<EFBFBD>'] = 163;
cTable[(byte)'<EFBFBD>'] = 164;
cTable[(byte)'<EFBFBD>'] = 165;
cTable[(byte)'<EFBFBD>'] = 166;
cTable[(byte)'<EFBFBD>'] = 167;
cTable[(byte)'<EFBFBD>'] = 168;
cTable[(byte)'<EFBFBD>'] = 169;
cTable[(byte)'<EFBFBD>'] = 170;
cTable[(byte)'<EFBFBD>'] = 171;
cTable[(byte)'<EFBFBD>'] = 172;
cTable[(byte)'<EFBFBD>'] = 173;
cTable[(byte)'<EFBFBD>'] = 174;
cTable[(byte)'<EFBFBD>'] = 175;
cTable[(byte)'<EFBFBD>'] = 176;
cTable[(byte)'<EFBFBD>'] = 177;
cTable[(byte)'<EFBFBD>'] = 178;
cTable[(byte)'<EFBFBD>'] = 179;
cTable[(byte)'<EFBFBD>'] = 180;
cTable[(byte)'<EFBFBD>'] = 181;
cTable[(byte)'<EFBFBD>'] = 182;
cTable[(byte)'<EFBFBD>'] = 183;
cTable[(byte)'<EFBFBD>'] = 184;
cTable[(byte)'<EFBFBD>'] = 185;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 8;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
} else if (_vm->getLanguage() == Common::CZ_CZE) {
// Czech
cTable[(byte)'<EFBFBD>'] = 186;
cTable[(byte)'<EFBFBD>'] = 187;
cTable[(byte)'<EFBFBD>'] = 188;
cTable[(byte)'<EFBFBD>'] = 189;
cTable[(byte)'<EFBFBD>'] = 190;
cTable[(byte)'<EFBFBD>'] = 191;
cTable[(byte)'<EFBFBD>'] = 192;
cTable[(byte)'<EFBFBD>'] = 193;
cTable[(byte)'<EFBFBD>'] = 194;
cTable[(byte)'<EFBFBD>'] = 195;
cTable[(byte)'<EFBFBD>'] = 196;
cTable[(byte)'<EFBFBD>'] = 197;
cTable[(byte)'<EFBFBD>'] = 198;
cTable[(byte)'<EFBFBD>'] = 199;
cTable[(byte)'<EFBFBD>'] = 200;
cTable[(byte)'<EFBFBD>'] = 201;
cTable[(byte)'<EFBFBD>'] = 202;
cTable[(byte)'<EFBFBD>'] = 203;
cTable[(byte)'<EFBFBD>'] = 204;
cTable[(byte)'<EFBFBD>'] = 205;
cTable[(byte)'<EFBFBD>'] = 206;
cTable[(byte)'<EFBFBD>'] = 207;
cTable[(byte)'<EFBFBD>'] = 208;
cTable[(byte)'<EFBFBD>'] = 209;
cTable[(byte)'<EFBFBD>'] = 210;
cTable[(byte)'<EFBFBD>'] = 211;
cTable[(byte)'<EFBFBD>'] = 212;
cTable[(byte)'<EFBFBD>'] = 213;
cTable[(byte)'<EFBFBD>'] = 214;
cTable[(byte)'<EFBFBD>'] = 215;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 9;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
} else if (_vm->getLanguage() == Common::FR_FRA) {
// French
cTable[(byte)'<EFBFBD>'] = 226;
cTable[(byte)'<EFBFBD>'] = 227;
cTable[(byte)'<EFBFBD>'] = 228;
cTable[(byte)'<EFBFBD>'] = 229;
cTable[(byte)'<EFBFBD>'] = 230;
cTable[(byte)'<EFBFBD>'] = 231;
cTable[(byte)'<EFBFBD>'] = 232;
cTable[(byte)'<EFBFBD>'] = 233;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 8;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
} else if (_vm->getLanguage() == Common::DE_DEU) {
// German
cTable[(byte)'<EFBFBD>'] = 234;
// 'SS' = 235
cTable[(byte)'<EFBFBD>'] = 236;
cTable[(byte)'<EFBFBD>'] = 237;
cTable[(byte)'<EFBFBD>'] = 238;
lTable[(byte)'<EFBFBD>'] = 11;
}
}
/***************************************************************************\
* RMFontCredits Methods
\****************************************************************************/
2012-06-05 08:39:55 +02:00
void RMFontCredits::init(void) {
int i;
// bernie: Number of characters in the font
int nchars =
2012-05-14 21:29:27 +02:00
112 // base
+ 18 // polish
+ 66 // russian
+ 30 // czech
+ 8 // french
+ 2; // deutsch
2012-06-06 08:04:33 +02:00
load(RES_F_CREDITS, nchars, 27, 28, RES_F_CPAL);
// Default
2012-05-14 21:29:27 +02:00
lDefault = 10;
hDefault = 28;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
2012-05-14 21:29:27 +02:00
2012-05-03 23:08:19 +10:00
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
}
for (i = 0; i < 26; i++)
cTable['A' + i] = i + 0;
for (i = 0; i < 26; i++)
cTable['a' + i] = i + 26;
cTable[(byte)'<EFBFBD>'] = 52;
cTable[(byte)'<EFBFBD>'] = 53;
// cTable[''] = 54; // a ^
// cTable[''] = 55; // a pallini
cTable[(byte)'<EFBFBD>'] = 56;
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 57;
// cTable[''] = 58; // e ^
// cTable[''] = 59; // e pallini
cTable[(byte)'<EFBFBD>'] = 60;
cTable[(byte)'<EFBFBD>'] = 61;
// cTable[''] = 62; // i ^
// cTable[''] = 63; // i pallini
cTable[(byte)'<EFBFBD>'] = 64;
cTable[(byte)'<EFBFBD>'] = 65;
// cTable[''] = 66; // o ^
// cTable[''] = 67; // o pallini
cTable[(byte)'<EFBFBD>'] = 68;
cTable[(byte)'<EFBFBD>'] = 69;
// cTable[''] = 70; // u ^
// cTable[''] = 71; // u pallini
// cTable[''] = 72; // y pallini
cTable[(byte)'<EFBFBD>'] = 73;
2012-05-14 21:29:27 +02:00
cTable[(byte)'<EFBFBD>'] = 74;
// cTable[''] = 75; // o barrato
// cTable[''] = 76; // ac
cTable[(byte)'<EFBFBD>'] = 77;
// cTable[''] = 78; // ? rovesciato
2012-05-14 21:29:27 +02:00
cTable['?'] = 79;
// cTable[''] = 80; // ! rovesciato
2012-05-14 21:29:27 +02:00
cTable['!'] = 81;
// cTable[''] = 82; // 1/2
// cTable[''] = 83; // 1/4
cTable['('] = 84;
cTable[')'] = 85;
cTable[(byte)'<EFBFBD>'] = 86;
cTable[(byte)'<EFBFBD>'] = 87;
// cTable[''] = 88; // AE
cTable[':'] = 89;
cTable['%'] = 90;
cTable['&'] = 91;
cTable['/'] = 92;
cTable['+'] = 93;
cTable[';'] = 94;
cTable[','] = 95;
cTable['^'] = 96;
cTable['='] = 97;
2012-05-14 21:29:27 +02:00
cTable['_'] = 98;
cTable['*'] = 99;
cTable['.'] = 100;
for (i = 0; i < 10; i++)
2012-05-14 21:29:27 +02:00
cTable['0' + i] = i + 101;
cTable['\''] = 111;
lTable[' '] = 11;
lTable[(byte)'<EFBFBD>'] = lTable['A'] = 19;
lTable['B'] = 15;
lTable['C'] = 14;
lTable['D'] = 13;
lTable['E'] = 14;
lTable['F'] = 13;
lTable['G'] = 16;
lTable['H'] = 15;
lTable['I'] = 5;
lTable['J'] = 8;
lTable['K'] = 15;
lTable['L'] = 13;
lTable['M'] = 17;
lTable['N'] = 15;
lTable['<EFBFBD>'] = lTable['O'] = 14;
lTable['P'] = 12;
lTable['Q'] = 14;
lTable['R'] = 14;
lTable['S'] = 15;
lTable['T'] = 11;
lTable['<EFBFBD>'] = lTable['U'] = 12;
lTable['V'] = 12;
lTable['W'] = 16;
lTable['X'] = 12;
lTable['Y'] = 13;
lTable['Z'] = 14;
lTable['a'] = 11;
lTable['b'] = 9;
lTable['c'] = 9;
lTable['d'] = 10;
lTable['e'] = 9;
lTable['f'] = 8;
lTable['g'] = 9;
lTable['h'] = 10;
lTable['i'] = 5;
lTable['j'] = 6;
lTable['k'] = 12;
lTable['l'] = 6;
lTable['m'] = 14;
lTable['n'] = 10;
lTable['o'] = 11;
lTable['p'] = 11;
lTable['q'] = 9;
lTable['r'] = 9;
lTable['s'] = 9;
lTable['t'] = 6;
lTable['u'] = 9;
lTable['v'] = 10;
lTable['w'] = 14;
lTable['x'] = 9;
lTable['y'] = 10;
lTable['z'] = 9;
lTable['0'] = 12;
lTable['1'] = 8;
lTable['2'] = 10;
lTable['3'] = 11;
lTable['4'] = 12;
lTable['5'] = 11;
lTable['6'] = 12;
lTable['7'] = 10;
lTable['8'] = 11;
lTable['9'] = 10;
lTable['/'] = 10;
lTable['^'] = 9;
lTable[','] = 5;
lTable['.'] = 5;
lTable[';'] = 5;
lTable[':'] = 5;
lTable['\''] = 5;
if (_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//AaCcEeLlNnOoSsZzZz
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA3B3><EFBFBD>󌜯<EFBFBD><F38C9CAF><EFBFBD>
cTable[(byte)'<EFBFBD>'] = 112;
cTable[(byte)'<EFBFBD>'] = 113;
cTable[(byte)'<EFBFBD>'] = 114;
cTable[(byte)'<EFBFBD>'] = 115;
cTable[(byte)'<EFBFBD>'] = 116;
cTable[(byte)'<EFBFBD>'] = 117;
cTable[(byte)'<EFBFBD>'] = 118;
cTable[(byte)'<EFBFBD>'] = 119;
cTable[(byte)'<EFBFBD>'] = 120;
cTable[(byte)'<EFBFBD>'] = 121;
cTable[(byte)'<EFBFBD>'] = 122;
cTable[(byte)'<EFBFBD>'] = 123;
cTable[(byte)'<EFBFBD>'] = 124;
cTable[(byte)'<EFBFBD>'] = 125;
cTable[(byte)'<EFBFBD>'] = 126;
cTable[(byte)'<EFBFBD>'] = 127;
cTable[(byte)'<EFBFBD>'] = 128;
cTable[(byte)'<EFBFBD>'] = 129;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
} else if (_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
2012-05-21 23:53:13 +02:00
// allowing for further translations. To support Tonyin other langauges,
// these mappings could be used as a basis
cTable[(byte)'<EFBFBD>'] = 130;
cTable[(byte)'<EFBFBD>'] = 131;
cTable[(byte)'<EFBFBD>'] = 132;
cTable[(byte)'<EFBFBD>'] = 133;
cTable[(byte)'<EFBFBD>'] = 134;
cTable[(byte)'<EFBFBD>'] = 135;
cTable[(byte)'<EFBFBD>'] = 136;
cTable[(byte)'<EFBFBD>'] = 137;
cTable[(byte)'<EFBFBD>'] = 138;
cTable[(byte)'<EFBFBD>'] = 139;
cTable[(byte)'<EFBFBD>'] = 140;
cTable[(byte)'<EFBFBD>'] = 141;
cTable[(byte)'<EFBFBD>'] = 142;
cTable[(byte)'<EFBFBD>'] = 143;
cTable[(byte)'<EFBFBD>'] = 144;
cTable[(byte)'<EFBFBD>'] = 145;
cTable[(byte)'<EFBFBD>'] = 146;
cTable[(byte)'<EFBFBD>'] = 147;
cTable[(byte)'<EFBFBD>'] = 148;
cTable[(byte)'<EFBFBD>'] = 149;
cTable[(byte)'<EFBFBD>'] = 150;
cTable[(byte)'<EFBFBD>'] = 151;
cTable[(byte)'<EFBFBD>'] = 152;
cTable[(byte)'<EFBFBD>'] = 153;
cTable[(byte)'<EFBFBD>'] = 154;
cTable[(byte)'<EFBFBD>'] = 155;
cTable[(byte)'<EFBFBD>'] = 156;
cTable[(byte)'<EFBFBD>'] = 157;
cTable[(byte)'<EFBFBD>'] = 158;
cTable[(byte)'<EFBFBD>'] = 159;
cTable[(byte)'<EFBFBD>'] = 160;
cTable[(byte)'<EFBFBD>'] = 161;
cTable[(byte)'<EFBFBD>'] = 162;
cTable[(byte)'<EFBFBD>'] = 163;
cTable[(byte)'<EFBFBD>'] = 164;
cTable[(byte)'<EFBFBD>'] = 165;
cTable[(byte)'<EFBFBD>'] = 166;
cTable[(byte)'<EFBFBD>'] = 167;
cTable[(byte)'<EFBFBD>'] = 168;
cTable[(byte)'<EFBFBD>'] = 169;
cTable[(byte)'<EFBFBD>'] = 170;
cTable[(byte)'<EFBFBD>'] = 171;
cTable[(byte)'<EFBFBD>'] = 172;
cTable[(byte)'<EFBFBD>'] = 173;
cTable[(byte)'<EFBFBD>'] = 174;
cTable[(byte)'<EFBFBD>'] = 175;
cTable[(byte)'<EFBFBD>'] = 176;
cTable[(byte)'<EFBFBD>'] = 177;
cTable[(byte)'<EFBFBD>'] = 178;
cTable[(byte)'<EFBFBD>'] = 179;
cTable[(byte)'<EFBFBD>'] = 180;
cTable[(byte)'<EFBFBD>'] = 181;
cTable[(byte)'<EFBFBD>'] = 182;
cTable[(byte)'<EFBFBD>'] = 183;
cTable[(byte)'<EFBFBD>'] = 184;
cTable[(byte)'<EFBFBD>'] = 185;
cTable[(byte)'<EFBFBD>'] = 186;
cTable[(byte)'<EFBFBD>'] = 187;
cTable[(byte)'<EFBFBD>'] = 188;
cTable[(byte)'<EFBFBD>'] = 189;
cTable[(byte)'<EFBFBD>'] = 190;
cTable[(byte)'<EFBFBD>'] = 191;
cTable[(byte)'<EFBFBD>'] = 192;
cTable[(byte)'<EFBFBD>'] = 193;
cTable[(byte)'<EFBFBD>'] = 194;
cTable[(byte)'<EFBFBD>'] = 195;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 23;
lTable[(byte)'<EFBFBD>'] = 23;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
} else if (_vm->getLanguage() == Common::CZ_CZE) {
// CZECH Language
cTable[(byte)'<EFBFBD>'] = 196;
cTable[(byte)'<EFBFBD>'] = 197;
cTable[(byte)'<EFBFBD>'] = 198;
cTable[(byte)'<EFBFBD>'] = 199;
cTable[(byte)'<EFBFBD>'] = 200;
cTable[(byte)'<EFBFBD>'] = 201;
cTable[(byte)'<EFBFBD>'] = 202;
cTable[(byte)'<EFBFBD>'] = 203;
cTable[(byte)'<EFBFBD>'] = 204;
cTable[(byte)'<EFBFBD>'] = 205;
cTable[(byte)'<EFBFBD>'] = 206;
cTable[(byte)'<EFBFBD>'] = 207;
cTable[(byte)'<EFBFBD>'] = 208;
cTable[(byte)'<EFBFBD>'] = 209;
cTable[(byte)'<EFBFBD>'] = 210;
cTable[(byte)'<EFBFBD>'] = 211;
cTable[(byte)'<EFBFBD>'] = 212;
cTable[(byte)'<EFBFBD>'] = 213;
cTable[(byte)'<EFBFBD>'] = 214;
cTable[(byte)'<EFBFBD>'] = 215;
cTable[(byte)'<EFBFBD>'] = 216;
cTable[(byte)'<EFBFBD>'] = 217;
cTable[(byte)'<EFBFBD>'] = 218;
cTable[(byte)'<EFBFBD>'] = 219;
cTable[(byte)'<EFBFBD>'] = 220;
cTable[(byte)'<EFBFBD>'] = 221;
cTable[(byte)'<EFBFBD>'] = 222;
cTable[(byte)'<EFBFBD>'] = 223;
cTable[(byte)'<EFBFBD>'] = 224;
cTable[(byte)'<EFBFBD>'] = 225;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 14;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 7;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 13;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 6;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
} else if (_vm->getLanguage() == Common::FR_FRA) {
// French
cTable[(byte)'<EFBFBD>'] = 226;
cTable[(byte)'<EFBFBD>'] = 227;
cTable[(byte)'<EFBFBD>'] = 228;
cTable[(byte)'<EFBFBD>'] = 229;
cTable[(byte)'<EFBFBD>'] = 230;
cTable[(byte)'<EFBFBD>'] = 231;
cTable[(byte)'<EFBFBD>'] = 232;
cTable[(byte)'<EFBFBD>'] = 233;
lTable[(byte)'<EFBFBD>'] = 12;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 6;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 10;
lTable[(byte)'<EFBFBD>'] = 11;
lTable[(byte)'<EFBFBD>'] = 11;
} else if (_vm->getLanguage() == Common::DE_DEU) {
// German
cTable[(byte)'<EFBFBD>'] = 234;
// 'SS' = 235
// old chars overrides
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 55;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 67;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 71;
lTable[(byte)'<EFBFBD>'] = 11;
}
}
/***************************************************************************\
* Metodi di RMFontObj
\****************************************************************************/
2012-05-23 00:19:46 +02:00
#define TOUPPER(a) ((a) >= 'a' && (a) <= 'z' ? (a) + 'A' - 'a' : (a))
#define TOLOWER(a) ((a) >= 'A' && (a) <= 'Z' ? (a) + 'a' - 'A' : (a))
2012-06-06 08:04:33 +02:00
void RMFontObj::setBothCase(int nChar, int nNext, signed char spiazz) {
l2Table[TOUPPER(nChar)][TOUPPER(nNext)] = spiazz;
l2Table[TOUPPER(nChar)][TOLOWER(nNext)] = spiazz;
l2Table[TOLOWER(nChar)][TOUPPER(nNext)] = spiazz;
l2Table[TOLOWER(nChar)][TOLOWER(nNext)] = spiazz;
}
2012-06-05 08:39:55 +02:00
void RMFontObj::init(void) {
int i;
//bernie: Number of characters in the font (solo maiuscolo)
int nchars =
2012-05-14 21:29:27 +02:00
85 // base
+ 9 // polish
+ 33 // russian
+ 15 // czech
+ 0 // francais (no uppercase chars)
+ 1; // deutsch
2012-06-06 08:04:33 +02:00
load(RES_F_OBJ, nchars, 25, 30);
// Initialise the f**king table
lDefault = 26;
hDefault = 30;
Common::fill(&l2Table[0][0], &l2Table[0][0] + (256 * 256), '\0');
2012-05-03 23:08:19 +10:00
for (i = 0; i < 256; i++) {
cTable[i] = -1;
lTable[i] = lDefault;
}
2012-05-03 23:08:19 +10:00
for (i = 0; i < 26; i++) {
2012-05-14 21:29:27 +02:00
cTable['A' + i] = i + 0;
cTable['a' + i] = i + 0;
}
for (i = 0; i < 10; i++)
2012-05-03 23:08:19 +10:00
cTable['0' + i] = i + 26;
cTable[','] = 36;
cTable[';'] = 37;
cTable['.'] = 38;
cTable[':'] = 39;
cTable['-'] = 40;
cTable['+'] = 41;
cTable['!'] = 42;
// cTable['!'] = 43; Exclamation countdown
cTable['?'] = 44;
//cTable['?'] = 45; Interrogativo alla rovescia
cTable['/'] = 46;
cTable['('] = 47;
cTable[')'] = 48;
cTable['='] = 49;
cTable['\''] = 50;
cTable['\"'] = 51;
cTable[(byte)'<EFBFBD>'] = 52;
cTable[(byte)'$'] = 53;
cTable[(byte)'%'] = 54;
cTable[(byte)'&'] = 55;
cTable[(byte)'^'] = 56;
cTable[(byte)'*'] = 57;
cTable[(byte)'<'] = 58;
cTable[(byte)'>'] = 59;
cTable[(byte)'<EFBFBD>'] = 60;
cTable[(byte)'<EFBFBD>'] = 61;
cTable[(byte)'<EFBFBD>'] = 62;
cTable[(byte)'<EFBFBD>'] = 63;
//cTable[(byte)'<27>'] = 64; integral
cTable[(byte)'<EFBFBD>'] = 65;
cTable[(byte)'<EFBFBD>'] = 66;
cTable[(byte)'<EFBFBD>'] = 67;
cTable[(byte)'<EFBFBD>'] = 68;
cTable[(byte)'<EFBFBD>'] = 69;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 70;
cTable[(byte)'<EFBFBD>'] = 71;
cTable[(byte)'<EFBFBD>'] = 72;
cTable[(byte)'<EFBFBD>'] = 73;
//cTable[(byte)' '] = 74; e circlet
cTable[(byte)'<EFBFBD>'] = 75;
cTable[(byte)'<EFBFBD>'] = 76;
//cTable[(byte)' '] = 77; i circlet
cTable[(byte)'<EFBFBD>'] = 78;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 79;
//cTable[(byte)' '] = 80; o circlet
cTable[(byte)'<EFBFBD>'] = 81;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 82;
//cTable[' '] = 83; u circlet
//cTable[' '] = 84; y dieresi
/* Little lengths */
lTable[' '] = 11;
lTable['.'] = 8;
lTable['-'] = 12;
lTable['\''] = 8;
lTable['0'] = 20;
lTable['1'] = 20;
lTable['2'] = 15;
lTable['3'] = 20;
lTable['4'] = 20;
lTable['5'] = 20;
lTable['6'] = 20;
lTable['7'] = 20;
lTable['8'] = 20;
lTable['9'] = 20;
2012-05-14 21:29:27 +02:00
lTable['a'] = lTable['A'] = lTable['<EFBFBD>'] = lTable['<EFBFBD>'] = 17;
lTable['b'] = lTable['B'] = 17;
lTable['c'] = lTable['C'] = 19;
lTable['d'] = lTable['D'] = 17;
lTable['e'] = lTable['E'] = 15;
lTable['f'] = lTable['F'] = 17;
lTable['g'] = lTable['G'] = 19;
lTable['i'] = lTable['I'] = 16;
lTable['h'] = lTable['H'] = 17;
lTable['k'] = lTable['K'] = 17;
lTable['l'] = lTable['L'] = 14;
lTable['m'] = lTable['M'] = 19;
lTable['n'] = lTable['N'] = 17;
lTable['o'] = lTable['O'] = lTable['<EFBFBD>'] = lTable['<EFBFBD>'] = 19;
lTable['p'] = lTable['P'] = 17;
lTable['q'] = lTable['Q'] = 19;
lTable['r'] = lTable['R'] = 14;
lTable['s'] = lTable['S'] = 13;
lTable['t'] = lTable['T'] = 15;
lTable['u'] = lTable['U'] = lTable['<EFBFBD>'] = lTable['<EFBFBD>'] = 15;
lTable['v'] = lTable['V'] = 13;
lTable['x'] = lTable['X'] = 15;
lTable['y'] = lTable['Y'] = 13;
lTable['w'] = lTable['W'] = 19;
lTable['z'] = lTable['Z'] = 20;
lTable[(byte)'<EFBFBD>'] = 17;
/* Casi particolari */
2012-06-06 08:04:33 +02:00
setBothCase('C', 'C', 2);
setBothCase('A', 'T', -2);
setBothCase('R', 'S', 2);
setBothCase('H', 'I', -2);
setBothCase('T', 'S', 2);
setBothCase('O', 'R', 2);
setBothCase('O', 'L', 2);
setBothCase('O', 'G', 2);
setBothCase('Z', 'A', -1);
setBothCase('R', 'R', 1);
setBothCase('R', 'U', 3);
2012-05-21 23:53:13 +02:00
if (_vm->getLanguage() == Common::PL_POL) {
// Polish characters
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA3B3><EFBFBD>󌜯<EFBFBD><F38C9CAF><EFBFBD>
//AaCcEeLlNnOoSsZzZz
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 85;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 20;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 86;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 87;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 88;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 89;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 90;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 91;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 92;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 21;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 93;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 21;
} else if (_vm->getLanguage() == Common::RU_RUS) {
// Russian Characters
2012-05-21 23:53:13 +02:00
// WARNING: The Russian font uses many of the ISO-Latin-1 font,
// allowing for further translations. To support Tonyin other langauges,
// these mappings could be used as a basis
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 85;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 20;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 94;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 95;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 96;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 97;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 98;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 99;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 100;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 101;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 102;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 103;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 104;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 105;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 106;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 107;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 108;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 109;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 110;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 111;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 112;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 113;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 114;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 115;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 116;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 117;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 118;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 119;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 120;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 121;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 122;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 123;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 124;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 125;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 126;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 21;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 20;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
} else if (_vm->getLanguage() == Common::CZ_CZE) {
// Czech
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 127;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 128;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 129;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 130;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 131;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 132;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 133;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 134;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 135;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 136;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 137;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 138;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 139;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 140;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 141;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 21;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 18;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 23;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 24;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 22;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
2012-05-21 23:53:13 +02:00
} else if (_vm->getLanguage() == Common::FR_FRA) {
// French
// Translate accented characters as normal letters
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 0; // a
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 17;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 4; // e
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 8; // i
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 16;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 14; // o
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 19;
cTable[(byte)'<EFBFBD>'] = cTable[(byte)'<EFBFBD>'] = 20; // u
lTable[(byte)'<EFBFBD>'] = lTable[(byte)'<EFBFBD>'] = 15;
} else if (_vm->getLanguage() == Common::DE_DEU) {
// German
cTable['<EFBFBD>'] = 142;
// SS = 143
lTable['<EFBFBD>'] = 24;
}
}
/****************************************************************************\
* RMText Methods
\****************************************************************************/
2012-06-06 08:04:33 +02:00
RMFontColor *RMText::_fonts[4] = { NULL, NULL, NULL, NULL };
RMGfxClearTask RMText::_clear;
2012-06-05 08:39:55 +02:00
void RMText::initStatics() {
2012-06-06 08:04:33 +02:00
Common::fill(&_fonts[0], &_fonts[4], (RMFontColor *)NULL);
}
RMText::RMText() {
// Default colour: white
m_r = m_g = m_b = 255;
// Default length
maxLineLength = 350;
2012-06-05 08:39:55 +02:00
_bTrasp0 = true;
aHorType = HCENTER;
aVerType = VTOP;
2012-06-05 08:39:55 +02:00
setPriority(150);
}
RMText::~RMText() {
2012-05-14 21:29:27 +02:00
}
2012-06-06 08:04:33 +02:00
void RMText::unload() {
if (_fonts[0] != NULL) {
delete _fonts[0];
delete _fonts[1];
delete _fonts[2];
delete _fonts[3];
_fonts[0] = _fonts[1] = _fonts[2] = _fonts[3] = 0;
}
}
2012-06-06 08:04:33 +02:00
void RMText::setMaxLineLength(int max) {
maxLineLength = max;
}
2012-06-05 18:51:20 +02:00
void RMText::removeThis(CORO_PARAM, bool &result) {
// Here we can do checks on the number of frames, time spent, etc.
result = true;
}
2012-06-06 08:04:33 +02:00
void RMText::writeText(const RMString &text, int nFont, int *time) {
// Initialises the font (only once)
2012-06-06 08:04:33 +02:00
if (_fonts[0] == NULL) {
_fonts[0] = new RMFontParla;
_fonts[0]->init();
_fonts[1] = new RMFontObj;
_fonts[1]->init();
_fonts[2] = new RMFontMacc;
_fonts[2]->init();
_fonts[3] = new RMFontCredits;
_fonts[3]->init();
}
2012-06-06 08:04:33 +02:00
writeText(text, _fonts[nFont], time);
}
2012-06-06 08:04:33 +02:00
void RMText::writeText(const RMString &text, RMFontColor *font, int *time) {
RMGfxPrimitive *prim;
char *p, *old_p;
int i, j, x, y;
int len;
int numchar;
int width, height;
char *string;
int numlines;
// Set the base colour
font->setBaseColor(m_r, m_g, m_b);
// Destroy the buffer before starting
2012-06-05 08:39:55 +02:00
destroy();
// If the string is empty, do nothing
if (text == NULL || text[0] == '\0')
return;
2012-05-14 21:29:27 +02:00
// Divide the words into lines. In this cycle, X contains the maximum length reached by a line,
// and the number of lines
2012-05-14 21:29:27 +02:00
string = p = text;
i = j = x = 0;
while (*p != '\0') {
2012-06-06 08:04:33 +02:00
j += font->stringLen(*p);
if (j > (((aHorType == HLEFTPAR) && (i > 0)) ? maxLineLength - 25 : maxLineLength)) {
2012-06-06 08:04:33 +02:00
j -= font->stringLen(*p, p[1]);
2012-05-23 00:19:46 +02:00
if (j > x)
x = j;
// Back to the first usable space
//
// BERNIE: In the original, sentences containing words that exceed the
2012-05-21 23:53:13 +02:00
// width of a line caused discontinuation of the whole sentence.
// This workaround has the partial word broken up so it will still display
//
old_p = p;
2012-05-23 00:19:46 +02:00
while (*p != ' ' && *p != '-' && p > string)
p--;
if (p == string)
p = old_p;
// Check if there are any blanks to end
2012-05-23 00:19:46 +02:00
while (*p == ' ' && *p != '\0')
p++;
if (*p == '\0')
break;
p--;
i++;
*p = '\0';
j = 0;
}
p++;
}
2012-05-23 00:19:46 +02:00
if (j > x)
x = j;
2012-05-14 21:29:27 +02:00
i++;
numlines = i;
x += 8;
// Starting position for the surface: X1, Y
width = x;
2012-06-06 08:04:33 +02:00
height = (numlines - 1) * font->letterHeight() + font->_fontDimy;
// Create the surface
2012-06-07 21:14:59 +02:00
create(width, height);
//AddPrim(new RMGfxPrimitive(&m_clear));
2012-06-05 08:39:55 +02:00
Common::fill(_buf, _buf + width * height * 2, 0);
p = string;
y = 0;
numchar = 0;
for (; i > 0; i--) {
// Measure the length of the line
x = 0;
2012-06-06 08:04:33 +02:00
j = font->stringLen(RMString(p));
switch (aHorType) {
case HLEFT:
x = 0;
break;
case HLEFTPAR:
if (i == numlines)
2012-05-14 21:29:27 +02:00
x = 0;
else
x = 25;
break;
case HCENTER:
x = width / 2 - j / 2;
break;
case HRIGHT:
x = width - j - 1;
break;
}
while (*p != '\0') {
if (*p == ' ') {
2012-06-06 08:04:33 +02:00
x += font->stringLen(*p);
p++;
continue;
}
2012-06-06 08:04:33 +02:00
prim = font->makeLetterPrimitive(*p, len);
2012-06-07 21:14:59 +02:00
prim->getDst().x1 = x;
prim->getDst().y1 = y;
2012-06-05 08:39:55 +02:00
addPrim(prim);
numchar++;
2012-06-06 08:04:33 +02:00
x += font->stringLen(*p, p[1]);
p++;
}
p++;
2012-06-06 08:04:33 +02:00
y += font->letterHeight();
}
if (time != NULL)
*time = 1000 + numchar * (11 - GLOBALS.nCfgTextSpeed) * 14;
}
2012-06-06 08:04:33 +02:00
void RMText::clipOnScreen(RMGfxPrimitive *prim) {
// Don't let it go outside the screen
2012-06-07 21:14:59 +02:00
if (prim->getDst().x1 < 5)
prim->getDst().x1 = 5;
if (prim->getDst().y1 < 5)
prim->getDst().y1 = 5;
if (prim->getDst().x1 + _dimx > 635)
prim->getDst().x1 = 635 - _dimx;
if (prim->getDst().y1 + _dimy > 475)
prim->getDst().y1 = 475 - _dimy;
}
2012-06-05 08:39:55 +02:00
void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
// Horizontally
if (aHorType == HCENTER)
2012-06-07 21:14:59 +02:00
prim->getDst().topLeft() -= RMPoint(_dimx / 2, 0);
else if (aHorType == HRIGHT)
2012-06-07 21:14:59 +02:00
prim->getDst().topLeft() -= RMPoint(_dimx, 0);
// Vertically
if (aVerType == VTOP) {
} else if (aVerType == VCENTER) {
2012-06-07 21:14:59 +02:00
prim->getDst().y1 -= _dimy / 2;
} else if (aVerType == VBOTTOM) {
2012-06-07 21:14:59 +02:00
prim->getDst().y1 -= _dimy;
}
2012-06-06 08:04:33 +02:00
clipOnScreen(prim);
2012-06-05 08:39:55 +02:00
CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
CORO_END_CODE;
}
/****************************************************************************\
* RMTextDialog Methods
\****************************************************************************/
RMTextDialog::RMTextDialog() : RMText() {
2012-06-06 08:04:33 +02:00
_startTime = 0;
2012-05-14 21:29:27 +02:00
dst = RMPoint(0, 0);
2012-06-06 08:04:33 +02:00
_bSkipStatus = true;
_bShowed = true;
_bForceTime = false;
_bForceNoTime = false;
_bAlwaysDisplay = false;
_bNoTab = false;
hCustomSkip = CORO_INVALID_PID_VALUE;
hCustomSkip2 = CORO_INVALID_PID_VALUE;
2012-06-06 08:04:33 +02:00
_input = NULL;
// Create the event for displaying the end
hEndDisplay = CoroScheduler.createEvent(false, false);
}
RMTextDialog::~RMTextDialog() {
CoroScheduler.closeEvent(hEndDisplay);
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::show(void) {
_bShowed = true;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::hide(CORO_PARAM) {
_bShowed = false;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::writeText(const RMString &text, int font, int *time) {
RMText::writeText(text, font, &_time);
if (time != NULL)
2012-06-06 08:04:33 +02:00
*time = _time;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::writeText(const RMString &text, RMFontColor *font, int *time) {
RMText::writeText(text, font, &_time);
if (time != NULL)
2012-06-06 08:04:33 +02:00
*time = _time;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setSkipStatus(bool bEnabled) {
_bSkipStatus = bEnabled;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::forceTime(void) {
_bForceTime = true;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::forceNoTime(void) {
_bForceNoTime = true;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setNoTab(void) {
_bNoTab = true;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setForcedTime(uint32 dwTime) {
_time = dwTime;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setAlwaysDisplay(void) {
_bAlwaysDisplay = true;
}
2012-06-05 18:51:20 +02:00
void RMTextDialog::removeThis(CORO_PARAM, bool &result) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
bool expired;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
// Presume successful result
result = true;
// Don't erase the background
2012-06-06 08:04:33 +02:00
if (_bSkipStatus) {
2012-05-23 00:19:46 +02:00
if (!(GLOBALS.bCfgDubbing && hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
if (GLOBALS.bCfgTimerizedText) {
2012-06-06 08:04:33 +02:00
if (!_bForceNoTime) {
if (_vm->getTime() > (uint32)_time + _startTime)
return;
2012-05-23 00:19:46 +02:00
}
}
2012-05-23 00:19:46 +02:00
}
2012-06-06 08:04:33 +02:00
if (!_bNoTab) {
if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
return;
2012-05-23 00:19:46 +02:00
}
2012-06-06 08:04:33 +02:00
if (!_bNoTab) {
if (_input) {
if (_input->mouseLeftClicked() || _input->mouseRightClicked())
return;
2012-05-23 00:19:46 +02:00
}
}
}
// Erase the background
2012-05-23 00:19:46 +02:00
else if (!(GLOBALS.bCfgDubbing && hCustomSkip2 != CORO_INVALID_PID_VALUE)) {
2012-06-06 08:04:33 +02:00
if (!_bForceNoTime) {
if (_vm->getTime() > (uint32)_time + _startTime)
2012-05-23 00:19:46 +02:00
return;
}
}
// If time is forced
2012-06-06 08:04:33 +02:00
if (_bForceTime) {
if (_vm->getTime() > (uint32)_time + _startTime)
return;
2012-05-23 00:19:46 +02:00
}
if (hCustomSkip != CORO_INVALID_PID_VALUE) {
CORO_INVOKE_3(CoroScheduler.waitForSingleObject, hCustomSkip, 0, &_ctx->expired);
// == WAIT_OBJECT_0
if (!_ctx->expired)
return;
}
if (GLOBALS.bCfgDubbing && hCustomSkip2 != CORO_INVALID_PID_VALUE) {
CORO_INVOKE_3(CoroScheduler.waitForSingleObject, hCustomSkip2, 0, &_ctx->expired);
// == WAIT_OBJECT_0
if (!_ctx->expired)
return;
}
result = false;
CORO_END_CODE;
}
void RMTextDialog::Unregister(void) {
RMGfxTask::Unregister();
2012-06-05 08:39:55 +02:00
assert(_nInList == 0);
CoroScheduler.setEvent(hEndDisplay);
}
2012-06-05 08:39:55 +02:00
void RMTextDialog::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
if (_startTime == 0)
_startTime = _vm->getTime();
2012-05-14 21:29:27 +02:00
2012-06-06 08:04:33 +02:00
if (_bShowed) {
if (GLOBALS.bCfgSottotitoli || _bAlwaysDisplay) {
2012-06-07 21:14:59 +02:00
prim->getDst().topLeft() = dst;
2012-06-05 08:39:55 +02:00
CORO_INVOKE_2(RMText::draw, bigBuf, prim);
}
}
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setCustomSkipHandle(uint32 hCustom) {
hCustomSkip = hCustom;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setCustomSkipHandle2(uint32 hCustom) {
hCustomSkip2 = hCustom;
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::waitForEndDisplay(CORO_PARAM) {
CoroScheduler.waitForSingleObject(coroParam, hEndDisplay, CORO_INFINITE);
}
2012-06-06 08:04:33 +02:00
void RMTextDialog::setInput(RMInput *input) {
_input = input;
}
/****************************************************************************\
* RMTextDialogScrolling Methods
\****************************************************************************/
RMTextDialogScrolling::RMTextDialogScrolling() {
curLoc = NULL;
}
RMTextDialogScrolling::RMTextDialogScrolling(RMLocation *loc) {
curLoc = loc;
startScroll = loc->scrollPosition();
}
RMTextDialogScrolling::~RMTextDialogScrolling() {
}
2012-06-05 08:39:55 +02:00
void RMTextDialogScrolling::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
RMPoint curDst;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
_ctx->curDst = dst;
if (curLoc != NULL)
dst -= curLoc->scrollPosition() - startScroll;
2012-06-05 08:39:55 +02:00
CORO_INVOKE_2(RMTextDialog::draw, bigBuf, prim);
dst = _ctx->curDst;
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMTextDialogScrolling::clipOnScreen(RMGfxPrimitive *prim) {
// We must not do anything!
}
/****************************************************************************\
* RMTextItemName Methods
\****************************************************************************/
RMTextItemName::RMTextItemName() : RMText() {
2012-06-06 08:04:33 +02:00
_item = NULL;
2012-06-05 08:39:55 +02:00
setPriority(220);
}
RMTextItemName::~RMTextItemName() {
}
2012-06-06 08:04:33 +02:00
void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &loc, RMPointer &ptr, RMInventory &inv) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
RMItem *lastItem;
uint32 hThread;
CORO_END_CONTEXT(_ctx);
RMString itemName;
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
_ctx->lastItem = _item;
// Adds to the list if there is need
2012-06-05 08:39:55 +02:00
if (!_nInList)
bigBuf.addPrim(new RMGfxPrimitive(this));
2012-05-14 21:29:27 +02:00
// Update the scrolling co-ordinates
_curscroll = loc.scrollPosition();
// Check if we are on the inventory
if (inv.itemInFocus(_mpos))
_item = inv.whichItemIsIn(_mpos);
else
_item = loc.whichItemIsIn(_mpos);
2012-05-14 21:29:27 +02:00
itemName = "";
// If there an item, get its name
2012-06-06 08:04:33 +02:00
if (_item != NULL)
_item->getName(itemName);
// Write it
2012-06-06 08:04:33 +02:00
writeText(itemName, 1);
// Handle the change If the selected item is different from the previous one
2012-06-06 08:04:33 +02:00
if (_ctx->lastItem != _item) {
if (_item == NULL)
ptr.setSpecialPointer(RMPointer::PTR_NONE);
else {
_ctx->hThread = mpalQueryDoAction(20, _item->mpalCode(), 0);
if (_ctx->hThread == CORO_INVALID_PID_VALUE)
ptr.setSpecialPointer(RMPointer::PTR_NONE);
else
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->hThread, CORO_INFINITE);
}
}
CORO_END_CODE;
}
2012-06-05 08:39:55 +02:00
void RMTextItemName::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
// If there is no text, it's pointless to continue
2012-06-05 08:39:55 +02:00
if (_buf == NULL)
return;
// Set the destination coordinates of the mouse
2012-06-07 21:14:59 +02:00
prim->getDst().topLeft() = _mpos - RMPoint(0, 30);
2012-06-05 08:39:55 +02:00
CORO_INVOKE_2(RMText::draw, bigBuf, prim);
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
RMPoint RMTextItemName::getHotspot() {
if (_item == NULL)
return _mpos + _curscroll;
2012-05-14 21:29:27 +02:00
else
return _item->hotspot();
}
2012-06-06 08:04:33 +02:00
RMItem *RMTextItemName::getSelectedItem() {
return _item;
}
2012-06-06 08:04:33 +02:00
bool RMTextItemName::isItemSelected() {
return _item != NULL;
}
2012-06-06 08:04:33 +02:00
bool RMTextItemName::isNormalItemSelected() {
return _item != NULL && _itemName.length() > 0;
}
/****************************************************************************\
* RMDialogChoice Methods
\****************************************************************************/
RMDialogChoice::RMDialogChoice() {
RMResRaw dlg1(RES_I_DLGTEXT);
RMResRaw dlg2(RES_I_DLGTEXTLINE);
RMRes dlgpal(RES_I_DLGTEXTPAL);
2012-05-14 21:29:27 +02:00
DlgText.init(dlg1, dlg1.width(), dlg1.height());
DlgTextLine.init(dlg2, dlg2.width(), dlg2.height());
2012-06-05 08:39:55 +02:00
DlgText.loadPaletteWA(dlgpal);
DlgTextLine.loadPaletteWA(dlgpal);
2012-05-14 21:29:27 +02:00
hUnreg = CoroScheduler.createEvent(false, false);
bRemoveFromOT = false;
}
RMDialogChoice::~RMDialogChoice() {
CoroScheduler.closeEvent(hUnreg);
}
void RMDialogChoice::Unregister(void) {
RMGfxWoodyBuffer::Unregister();
2012-06-05 08:39:55 +02:00
assert(!_nInList);
CoroScheduler.pulseEvent(hUnreg);
bRemoveFromOT = false;
}
2012-06-05 08:39:55 +02:00
void RMDialogChoice::init(void) {
2012-06-06 08:04:33 +02:00
_numChoices = 0;
_drawedStrings = NULL;
_ptDrawStrings = NULL;
_curSelection = -1;
2012-06-07 21:14:59 +02:00
create(640, 477);
2012-06-05 08:39:55 +02:00
setPriority(140);
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::close(void) {
if (_drawedStrings != NULL) {
delete[] _drawedStrings;
_drawedStrings = NULL;
}
2012-06-06 08:04:33 +02:00
if (_ptDrawStrings != NULL) {
delete[] _ptDrawStrings;
_ptDrawStrings = NULL;
}
2012-06-05 08:39:55 +02:00
destroy();
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::setNumChoices(int num) {
int i;
2012-06-06 08:04:33 +02:00
_numChoices = num;
_curAdded = 0;
2012-05-14 21:29:27 +02:00
// Allocate space for drawn strings
2012-06-06 08:04:33 +02:00
_drawedStrings = new RMText[num];
_ptDrawStrings = new RMPoint[num];
// Initialisation
2012-06-06 08:04:33 +02:00
for (i = 0; i < _numChoices; i++) {
_drawedStrings[i].setColor(0, 255, 0);
_drawedStrings[i].setAlignType(RMText::HLEFTPAR, RMText::VTOP);
_drawedStrings[i].setMaxLineLength(600);
_drawedStrings[i].setPriority(10);
}
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::addChoice(const RMString &string) {
// Draw the string
2012-06-06 08:04:33 +02:00
assert(_curAdded < _numChoices);
_drawedStrings[_curAdded++].writeText(string, 0);
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::prepare(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
int i;
RMPoint ptPos;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-05 08:39:55 +02:00
addPrim(new RMGfxPrimitive(&DlgText, RMPoint(0, 0)));
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155)));
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83)));
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83)));
addPrim(new RMGfxPrimitive(&DlgTextLine, RMPoint(0, 155 + 83 + 83 + 83)));
_ctx->ptPos.set(20, 90);
2012-06-06 08:04:33 +02:00
for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos));
_ptDrawStrings[_ctx->i] = _ctx->ptPos;
_ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15);
}
2012-06-05 08:39:55 +02:00
CORO_INVOKE_0(drawOT);
clearOT();
_ptDrawPos.set(0, 480 - _ctx->ptPos.y);
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::setSelected(CORO_PARAM, int pos) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
RMGfxBox box;
RMRect rc;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
if (pos == _curSelection)
return;
2012-06-05 08:39:55 +02:00
_ctx->box.setPriority(5);
2012-06-06 08:04:33 +02:00
if (_curSelection != -1) {
2012-06-07 21:14:59 +02:00
_ctx->box.setColor(0xCC, 0xCC, 0xFF);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection].y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy());
2012-06-05 08:39:55 +02:00
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
2012-06-06 08:04:33 +02:00
addPrim(new RMGfxPrimitive(&_drawedStrings[_curSelection], _ptDrawStrings[_curSelection]));
2012-06-05 08:39:55 +02:00
CORO_INVOKE_0(drawOT);
clearOT();
}
if (pos != -1) {
2012-06-07 21:14:59 +02:00
_ctx->box.setColor(100, 100, 100);
_ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos].y);
_ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy());
2012-06-05 08:39:55 +02:00
addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc));
2012-06-06 08:04:33 +02:00
addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos]));
}
2012-06-05 08:39:55 +02:00
CORO_INVOKE_0(drawOT);
clearOT();
2012-06-06 08:04:33 +02:00
_curSelection = pos;
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::show(CORO_PARAM, RMGfxTargetBuffer *bigBuf) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
RMPoint destpt;
int deltay;
int starttime;
int elaps;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
CORO_INVOKE_0(prepare);
_bShow = false;
2012-06-05 08:39:55 +02:00
if (!_nInList && bigBuf != NULL)
bigBuf->addPrim(new RMGfxPrimitive(this));
if (0) {
2012-06-06 08:04:33 +02:00
_bShow = true;
} else {
_ctx->starttime = _vm->getTime();
2012-06-06 08:04:33 +02:00
_ctx->deltay = 480 - _ptDrawPos.y;
_ctx->destpt = _ptDrawPos;
_ptDrawPos.set(0, 480);
2012-06-05 08:39:55 +02:00
if (!_nInList && bigBuf != NULL)
bigBuf->addPrim(new RMGfxPrimitive(this));
2012-06-06 08:04:33 +02:00
_bShow = true;
_ctx->elaps = 0;
while (_ctx->elaps < 700) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
_ctx->elaps = _vm->getTime() - _ctx->starttime;
2012-06-06 08:04:33 +02:00
_ptDrawPos.y = 480 - ((_ctx->deltay * 100) / 700 * _ctx->elaps) / 100;
mainUnfreeze();
}
2012-06-06 08:04:33 +02:00
_ptDrawPos.y = _ctx->destpt.y;
}
CORO_END_CODE;
}
2012-06-05 08:39:55 +02:00
void RMDialogChoice::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) {
CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
if (_bShow == false)
return;
2012-06-06 08:04:33 +02:00
prim->setDst(_ptDrawPos);
2012-06-05 08:39:55 +02:00
CORO_INVOKE_2(RMGfxSourceBuffer16::draw, bigBuf, prim);
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::hide(CORO_PARAM) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
int deltay;
int starttime;
int elaps;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
if (1) {
_ctx->starttime = _vm->getTime();
2012-06-06 08:04:33 +02:00
_ctx->deltay = 480 - _ptDrawPos.y;
_ctx->elaps = 0;
while (_ctx->elaps < 700) {
CORO_INVOKE_0(mainWaitFrame);
mainFreeze();
_ctx->elaps = _vm->getTime() - _ctx->starttime;
2012-06-06 08:04:33 +02:00
_ptDrawPos.y = 480 - ((_ctx->deltay * 100) / 700 * (700 - _ctx->elaps)) / 100;
mainUnfreeze();
}
}
2012-06-06 08:04:33 +02:00
_bShow = false;
bRemoveFromOT = true;
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, hUnreg, CORO_INFINITE);
CORO_END_CODE;
}
2012-06-05 18:51:20 +02:00
void RMDialogChoice::removeThis(CORO_PARAM, bool &result) {
result = bRemoveFromOT;
}
2012-06-06 08:04:33 +02:00
void RMDialogChoice::doFrame(CORO_PARAM, RMPoint ptMousePos) {
CORO_BEGIN_CONTEXT;
2012-05-14 21:29:27 +02:00
int i;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
2012-06-06 08:04:33 +02:00
if (ptMousePos.y > _ptDrawPos.y) {
for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) {
if ((ptMousePos.y >= _ptDrawPos.y + _ptDrawStrings[_ctx->i].y) && (ptMousePos.y < _ptDrawPos.y + _ptDrawStrings[_ctx->i].y + _drawedStrings[_ctx->i].getDimy())) {
CORO_INVOKE_1(setSelected, _ctx->i);
break;
}
}
2012-06-06 08:04:33 +02:00
if (_ctx->i == _numChoices)
CORO_INVOKE_1(setSelected, -1);
}
CORO_END_CODE;
}
2012-06-06 08:04:33 +02:00
int RMDialogChoice::getSelection(void) {
return _curSelection;
}
} // End of namespace Tony