2003-04-05 18:01:29 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
2003-04-05 18:01:29 +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-04-05 18:01:29 +00:00
|
|
|
*
|
2006-02-11 10:03:24 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-04-05 18:01:29 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
#include "sky/disk.h"
|
2003-04-29 19:52:24 +00:00
|
|
|
#include "sky/logic.h"
|
2003-10-05 20:21:20 +00:00
|
|
|
#include "sky/text.h"
|
|
|
|
#include "sky/sky.h"
|
|
|
|
#include "sky/skydefs.h"
|
|
|
|
#include "sky/struc.h"
|
2004-12-15 06:48:08 +00:00
|
|
|
#include "sky/compact.h"
|
2003-04-05 18:01:29 +00:00
|
|
|
|
2004-01-03 01:58:58 +00:00
|
|
|
namespace Sky {
|
|
|
|
|
2003-04-05 18:01:29 +00:00
|
|
|
#define FIRST_TEXT_SEC 77
|
2003-04-29 19:52:24 +00:00
|
|
|
#define FIRST_TEXT_BUFFER 274
|
2005-12-05 05:02:43 +00:00
|
|
|
#define LAST_TEXT_BUFFER 284
|
2003-04-05 18:01:29 +00:00
|
|
|
#define NO_OF_TEXT_SECTIONS 8 // 8 sections per language
|
|
|
|
#define CHAR_SET_FILE 60150
|
2005-07-30 21:11:48 +00:00
|
|
|
#define MAX_SPEECH_SECTION 7
|
2003-04-20 15:51:29 +00:00
|
|
|
#define CHAR_SET_HEADER 128
|
|
|
|
#define MAX_NO_LINES 10
|
2003-04-05 18:01:29 +00:00
|
|
|
|
2004-12-15 06:48:08 +00:00
|
|
|
Text::Text(Disk *skyDisk, SkyCompact *skyCompact) {
|
2003-04-07 20:44:16 +00:00
|
|
|
_skyDisk = skyDisk;
|
2004-12-15 06:48:08 +00:00
|
|
|
_skyCompact = skyCompact;
|
2003-04-05 18:01:29 +00:00
|
|
|
|
2003-05-09 22:06:37 +00:00
|
|
|
initHuffTree();
|
|
|
|
|
2004-11-11 10:14:35 +00:00
|
|
|
_mainCharacterSet.addr = _skyDisk->loadFile(CHAR_SET_FILE);
|
2003-04-14 17:26:42 +00:00
|
|
|
_mainCharacterSet.charHeight = MAIN_CHAR_HEIGHT;
|
|
|
|
_mainCharacterSet.charSpacing = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-04-05 18:01:29 +00:00
|
|
|
fnSetFont(0);
|
2003-05-17 20:04:05 +00:00
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
if (!SkyEngine::isDemo()) {
|
2004-11-11 10:14:35 +00:00
|
|
|
_controlCharacterSet.addr = _skyDisk->loadFile(60520);
|
2003-04-14 17:26:42 +00:00
|
|
|
_controlCharacterSet.charHeight = 12;
|
2003-07-09 07:02:57 +00:00
|
|
|
_controlCharacterSet.charSpacing = 0;
|
2003-07-09 16:54:34 +00:00
|
|
|
|
2004-11-11 10:14:35 +00:00
|
|
|
_linkCharacterSet.addr = _skyDisk->loadFile(60521);
|
2003-04-14 17:26:42 +00:00
|
|
|
_linkCharacterSet.charHeight = 12;
|
2003-07-09 07:02:57 +00:00
|
|
|
_linkCharacterSet.charSpacing = 1;
|
2003-07-31 02:08:00 +00:00
|
|
|
|
|
|
|
patchLINCCharset();
|
2003-05-17 20:04:05 +00:00
|
|
|
} else {
|
|
|
|
_controlCharacterSet.addr = NULL;
|
|
|
|
_linkCharacterSet.addr = NULL;
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
2003-05-17 20:04:05 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
Text::~Text(void) {
|
2005-12-05 05:02:43 +00:00
|
|
|
for (int i = FIRST_TEXT_BUFFER; i <= LAST_TEXT_BUFFER; i++)
|
|
|
|
if (SkyEngine::_itemList[i]) {
|
|
|
|
free(SkyEngine::_itemList[i]);
|
|
|
|
SkyEngine::_itemList[i] = NULL;
|
|
|
|
}
|
2003-05-17 20:04:05 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (_mainCharacterSet.addr)
|
|
|
|
free(_mainCharacterSet.addr);
|
|
|
|
if (_controlCharacterSet.addr)
|
|
|
|
free(_controlCharacterSet.addr);
|
|
|
|
if (_linkCharacterSet.addr)
|
|
|
|
free(_linkCharacterSet.addr);
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data) {
|
2003-07-31 02:08:00 +00:00
|
|
|
byte *ptr = charSetPtr + (CHAR_SET_HEADER + (height << 2) * c);
|
|
|
|
|
|
|
|
charSetPtr[c] = width;
|
|
|
|
|
|
|
|
for (int i = 0; i < height; i++) {
|
2003-08-13 15:29:44 +00:00
|
|
|
ptr[i * 4 + 0] = (data[i] & 0xFF00) >> 8;
|
|
|
|
ptr[i * 4 + 1] = data[i] & 0x00FF;
|
|
|
|
ptr[i * 4 + 2] = (data[i + height] & 0xFF00) >> 8;
|
|
|
|
ptr[i * 4 + 3] = data[i + height] & 0x00FF;
|
2003-07-31 02:08:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::patchLINCCharset() {
|
2003-07-31 02:08:00 +00:00
|
|
|
// The LINC terminal charset looks strange in some cases. This
|
|
|
|
// function attempts to patch up the worst blemishes.
|
|
|
|
|
|
|
|
byte *charSetPtr = _controlCharacterSet.addr;
|
|
|
|
int charHeight = _controlCharacterSet.charHeight;
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
// In v0.0288, the character spacing is too wide. Decrease the width
|
|
|
|
// for every character by one, except for space which needs to be one
|
|
|
|
// pixel wider than before.
|
2003-07-31 02:08:00 +00:00
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
if (SkyEngine::_systemVars.gameVersion == 288) {
|
2003-07-31 02:08:00 +00:00
|
|
|
for (int i = 1; i < CHAR_SET_HEADER; i++)
|
|
|
|
charSetPtr[i]--;
|
|
|
|
charSetPtr[0]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: I have only tested this part of the code with v0.0372
|
|
|
|
|
|
|
|
// Several characters are different in this charset than in the other
|
|
|
|
// two. This is particularly noticeable when using a non-English
|
|
|
|
// version.
|
|
|
|
|
2003-08-13 15:29:44 +00:00
|
|
|
// Since the same character data is used both in LINC terminals and
|
|
|
|
// in LINC-space, we need to provide a mask (for the black outline)
|
|
|
|
// even though it's only visible in the latter. We store the mask
|
|
|
|
// as the second half of the array to make it more human-readable.
|
|
|
|
// In the actual game data, the character and mask are interleaved.
|
|
|
|
|
2003-07-31 02:08:00 +00:00
|
|
|
const uint16 slash[] = {
|
|
|
|
0x0000, 0x0000, 0x0000, 0x0800, 0x1000, 0x1000,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x2000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x0000, 0x0800, 0x1C00, 0x3800, 0x3800,
|
|
|
|
0x7000, 0x7000, 0xE000, 0x4000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 lt[] = {
|
|
|
|
0x0000, 0x0000, 0x0800, 0x1000, 0x2000, 0x4000,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x2000, 0x1000, 0x0800, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x0800, 0x1C00, 0x3800, 0x7000, 0xE000,
|
|
|
|
0x7000, 0x3800, 0x1C00, 0x0800, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 gt[] = {
|
|
|
|
0x0000, 0x0000, 0x4000, 0x2000, 0x1000, 0x0800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x1000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x4000, 0xE000, 0x7000, 0x3800, 0x1C00,
|
|
|
|
0x3800, 0x7000, 0xE000, 0x4000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 a_umlaut[] = {
|
2003-08-13 15:29:44 +00:00
|
|
|
0x0000, 0x0000, 0x2800, 0x0000, 0x3000, 0x0800,
|
|
|
|
0x3800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x2800, 0x7C00, 0x3800, 0x7800, 0x3C00,
|
|
|
|
0x7C00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 o_umlaut[] = {
|
|
|
|
0x0000, 0x0000, 0x4800, 0x0000, 0x3000, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 u_umlaut[] = {
|
|
|
|
0x0000, 0x0000, 0x4800, 0x0000, 0x4800, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x4800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x4800, 0xFC00, 0x4800, 0xFC00, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 A_umlaut[] = {
|
|
|
|
0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x7800, 0x4800, 0x4800, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0xFC00, 0x4800, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 O_umlaut[] = {
|
|
|
|
0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x4800, 0xFC00, 0x7800, 0x7800, 0xFC00, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 U_umlaut[] = {
|
|
|
|
0x0000, 0x4800, 0x0000, 0x4800, 0x4800, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x4800, 0xFC00, 0x4800, 0xFC00, 0xFC00, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 normal_j[] = {
|
|
|
|
0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x0800, 0x0800, 0x0800, 0x4800, 0x3000, 0x0000,
|
|
|
|
0x0000, 0x0000, 0x0800, 0x1C00, 0x0800, 0x1C00,
|
|
|
|
0x1C00, 0x1C00, 0x5C00, 0xFC00, 0x7800, 0x3000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 german_sz[] = {
|
|
|
|
0x0000, 0x0000, 0x2000, 0x5000, 0x5000, 0x4800,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x4800, 0x4800, 0x5000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x2000, 0x7000, 0xF800, 0xF800, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0xF800, 0x7000, 0x0000, 0x0000
|
2003-07-31 02:08:00 +00:00
|
|
|
};
|
|
|
|
|
2003-07-31 17:24:51 +00:00
|
|
|
const uint16 normal_1[] = {
|
|
|
|
0x0000, 0x0000, 0x0000, 0x1000, 0x7000, 0x1000,
|
2003-08-13 15:29:44 +00:00
|
|
|
0x1000, 0x1000, 0x7c00, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x0000, 0x0000, 0x1000, 0x7800, 0xF800, 0x7800,
|
|
|
|
0x3800, 0x7c00, 0xFE00, 0x7c00, 0x0000, 0x0000
|
2003-07-31 17:24:51 +00:00
|
|
|
};
|
|
|
|
|
2005-06-04 13:58:11 +00:00
|
|
|
// The next five are needed for at least the French version
|
|
|
|
|
|
|
|
const uint16 e_acute[] = {
|
|
|
|
0x0000, 0x1000, 0x2000, 0x0000, 0x3000, 0x4800,
|
|
|
|
0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x1000, 0x3800, 0x7000, 0x7000, 0x7800, 0xFC00,
|
|
|
|
0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 e_grave[] = {
|
|
|
|
0x0000, 0x2000, 0x1000, 0x0000, 0x3000, 0x4800,
|
|
|
|
0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x2000, 0x7000, 0x3800, 0x3800, 0x7800, 0xFC00,
|
|
|
|
0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 e_circumflex[] = {
|
|
|
|
0x0000, 0x1000, 0x2800, 0x0000, 0x3000, 0x4800,
|
|
|
|
0x7800, 0x4000, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x1000, 0x3800, 0x7C00, 0x7800, 0x7800, 0xFC00,
|
|
|
|
0xFC00, 0xF800, 0x7800, 0x3000, 0x0000, 0x0000
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 o_circumflex[] = {
|
|
|
|
0x0000, 0x1000, 0x2800, 0x0000, 0x3000, 0x4800,
|
|
|
|
0x4800, 0x4800, 0x3000, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x1000, 0x3800, 0x7C00, 0x3800, 0x7800, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7800, 0x3000, 0x0000, 0x0000
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16 u_circumflex[] = {
|
|
|
|
0x0000, 0x1000, 0x2800, 0x0000, 0x4800, 0x4800,
|
|
|
|
0x4800, 0x4800, 0x3800, 0x0000, 0x0000, 0x0000,
|
|
|
|
0x1000, 0x3800, 0x7C00, 0x7800, 0xFC00, 0xFC00,
|
|
|
|
0xFC00, 0xFC00, 0x7C00, 0x3800, 0x0000, 0x0000
|
|
|
|
};
|
|
|
|
|
2003-07-31 02:08:00 +00:00
|
|
|
patchChar(charSetPtr, 5, charHeight, 3, u_umlaut);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 8, german_sz);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 9, o_umlaut);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 93, U_umlaut);
|
2003-07-31 17:24:51 +00:00
|
|
|
patchChar(charSetPtr, 5, charHeight, 74, normal_j);
|
|
|
|
patchChar(charSetPtr, 6, charHeight, 17, normal_1);
|
2005-06-04 13:58:11 +00:00
|
|
|
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 11, e_acute);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 61, e_grave);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 29, e_circumflex);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 32, o_circumflex);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 30, u_circumflex);
|
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
if (SkyEngine::_systemVars.gameVersion <= 303) {
|
2003-07-31 02:08:00 +00:00
|
|
|
patchChar(charSetPtr, 5, charHeight, 10, a_umlaut);
|
|
|
|
} else {
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 94, A_umlaut);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 95, O_umlaut);
|
|
|
|
|
|
|
|
// Used by, for instance, the BRIEFING.DOC file in all (?) languages
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 96, lt);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 97, gt);
|
|
|
|
patchChar(charSetPtr, 5, charHeight, 98, slash);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
void Text::fnSetFont(uint32 fontNr) {
|
2003-04-14 17:26:42 +00:00
|
|
|
|
|
|
|
struct charSet *newCharSet;
|
|
|
|
|
|
|
|
switch (fontNr) {
|
2003-09-24 06:33:59 +00:00
|
|
|
case 0:
|
|
|
|
newCharSet = &_mainCharacterSet;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
newCharSet = &_controlCharacterSet;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
newCharSet = &_linkCharacterSet;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("Tried to set invalid font (%d)", fontNr);
|
2003-04-14 17:26:42 +00:00
|
|
|
}
|
|
|
|
|
2003-04-05 18:01:29 +00:00
|
|
|
_curCharSet = fontNr;
|
2003-04-14 17:26:42 +00:00
|
|
|
_characterSet = newCharSet->addr;
|
2003-04-20 16:22:34 +00:00
|
|
|
_charHeight = (byte)newCharSet->charHeight;
|
2003-04-14 17:26:42 +00:00
|
|
|
_dtCharSpacing = newCharSet->charSpacing;
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::fnTextModule(uint32 textInfoId, uint32 textNo) {
|
2003-06-02 06:42:42 +00:00
|
|
|
|
|
|
|
fnSetFont(1);
|
2004-12-15 06:48:08 +00:00
|
|
|
uint16* msgData = (uint16 *)_skyCompact->fetchCpt(textInfoId);
|
2003-06-02 06:42:42 +00:00
|
|
|
lowTextManager_t textId = lowTextManager(textNo, msgData[1], msgData[2], 209, false);
|
2004-01-03 15:57:57 +00:00
|
|
|
Logic::_scriptVariables[RESULT] = textId.compactNum;
|
2004-12-15 06:48:08 +00:00
|
|
|
Compact *textCompact = _skyCompact->fetchCpt(textId.compactNum);
|
2003-06-02 06:42:42 +00:00
|
|
|
textCompact->xcood = msgData[3];
|
|
|
|
textCompact->ycood = msgData[4];
|
|
|
|
fnSetFont(0);
|
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::getText(uint32 textNr) { //load text #"textNr" into textBuffer
|
2003-07-31 21:26:27 +00:00
|
|
|
|
|
|
|
if (patchMessage(textNr))
|
2005-09-08 14:08:04 +00:00
|
|
|
return;
|
2003-07-31 21:26:27 +00:00
|
|
|
|
2003-06-27 12:11:50 +00:00
|
|
|
uint32 sectionNo = (textNr & 0x0F000) >> 12;
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo] == NULL) { //check if already loaded
|
2005-09-08 14:08:04 +00:00
|
|
|
debug(5, "Loading Text item(s) for Section %d", (sectionNo >> 2));
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
uint32 fileNo = sectionNo + ((SkyEngine::_systemVars.language * NO_OF_TEXT_SECTIONS) + 60600);
|
2004-11-11 10:14:35 +00:00
|
|
|
SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo] = (void **)_skyDisk->loadFile((uint16)fileNo);
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
2005-12-05 05:02:43 +00:00
|
|
|
uint8 *textDataPtr = (uint8 *)SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo];
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
uint32 offset = 0;
|
2005-12-05 05:02:43 +00:00
|
|
|
|
|
|
|
uint32 blockNr = textNr & 0xFE0;
|
|
|
|
textNr &= 0x1F;
|
|
|
|
|
|
|
|
if (blockNr) {
|
|
|
|
uint16 *blockPtr = (uint16*)(textDataPtr + 4);
|
|
|
|
uint32 nr32MsgBlocks = blockNr >> 5;
|
|
|
|
|
2003-04-05 18:01:29 +00:00
|
|
|
do {
|
|
|
|
offset += READ_LE_UINT16(blockPtr);
|
2005-12-05 05:02:43 +00:00
|
|
|
blockPtr++;
|
2005-07-30 21:11:48 +00:00
|
|
|
} while (--nr32MsgBlocks);
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
2003-10-01 09:40:28 +00:00
|
|
|
|
2003-04-05 18:01:29 +00:00
|
|
|
if (textNr) {
|
2005-12-05 05:02:43 +00:00
|
|
|
uint8 *blockPtr = textDataPtr + blockNr + READ_LE_UINT16(textDataPtr);
|
2003-04-05 18:01:29 +00:00
|
|
|
do {
|
2005-12-05 05:02:43 +00:00
|
|
|
uint8 skipBytes = *blockPtr++;
|
|
|
|
if (skipBytes & 0x80) {
|
|
|
|
skipBytes &= 0x7F;
|
2003-04-05 18:01:29 +00:00
|
|
|
skipBytes <<= 3;
|
2005-12-05 05:02:43 +00:00
|
|
|
}
|
2003-04-05 18:01:29 +00:00
|
|
|
offset += skipBytes;
|
|
|
|
} while (--textNr);
|
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 bitPos = offset & 3;
|
2003-04-05 18:01:29 +00:00
|
|
|
offset >>= 2;
|
2005-12-05 05:02:43 +00:00
|
|
|
offset += READ_LE_UINT16(textDataPtr + 2);
|
|
|
|
|
|
|
|
textDataPtr += offset;
|
2003-04-05 18:01:29 +00:00
|
|
|
|
|
|
|
//bit pointer: 0->8, 1->6, 2->4 ...
|
2005-12-05 05:02:43 +00:00
|
|
|
bitPos ^= 3;
|
|
|
|
bitPos++;
|
|
|
|
bitPos <<= 1;
|
2003-04-05 18:01:29 +00:00
|
|
|
|
|
|
|
char *dest = (char *)_textBuffer;
|
|
|
|
char textChar;
|
|
|
|
|
|
|
|
do {
|
2005-12-05 05:02:43 +00:00
|
|
|
textChar = getTextChar(&textDataPtr, &bitPos);
|
2005-07-30 21:11:48 +00:00
|
|
|
*dest++ = textChar;
|
2005-05-08 21:49:52 +00:00
|
|
|
} while (textChar);
|
2003-04-05 18:01:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY) {
|
2003-06-05 18:54:26 +00:00
|
|
|
|
2004-12-15 06:48:08 +00:00
|
|
|
Compact *ptrComp = _skyCompact->fetchCpt(pointedId);
|
2003-06-05 18:54:26 +00:00
|
|
|
lowTextManager_t text = lowTextManager(ptrComp->cursorText, TEXT_MOUSE_WIDTH, L_CURSOR, 242, false);
|
2004-01-03 15:57:57 +00:00
|
|
|
Logic::_scriptVariables[CURSOR_ID] = text.compactNum;
|
|
|
|
if (Logic::_scriptVariables[MENU]) {
|
2003-06-05 18:54:26 +00:00
|
|
|
_mouseOfsY = TOP_LEFT_Y - 2;
|
2005-12-05 05:02:43 +00:00
|
|
|
if (mouseX < 150)
|
|
|
|
_mouseOfsX = TOP_LEFT_X + 24;
|
|
|
|
else
|
|
|
|
_mouseOfsX = TOP_LEFT_X - 8 - text.textWidth;
|
2003-06-05 18:54:26 +00:00
|
|
|
} else {
|
2003-10-01 09:40:28 +00:00
|
|
|
_mouseOfsY = TOP_LEFT_Y - 10;
|
2005-12-05 05:02:43 +00:00
|
|
|
if (mouseX < 150)
|
|
|
|
_mouseOfsX = TOP_LEFT_X + 13;
|
|
|
|
else
|
|
|
|
_mouseOfsX = TOP_LEFT_X - 8 - text.textWidth;
|
2003-06-05 18:54:26 +00:00
|
|
|
}
|
2004-12-15 06:48:08 +00:00
|
|
|
Compact *textCompact = _skyCompact->fetchCpt(text.compactNum);
|
2003-06-05 18:54:26 +00:00
|
|
|
logicCursor(textCompact, mouseX, mouseY);
|
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY) {
|
2003-06-05 18:54:26 +00:00
|
|
|
|
|
|
|
textCompact->xcood = (uint16)(mouseX + _mouseOfsX);
|
|
|
|
textCompact->ycood = (uint16)(mouseY + _mouseOfsY);
|
2005-12-05 05:02:43 +00:00
|
|
|
if (textCompact->ycood < TOP_LEFT_Y)
|
|
|
|
textCompact->ycood = TOP_LEFT_Y;
|
2003-06-05 18:54:26 +00:00
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
bool Text::getTextBit(uint8 **data, uint32 *bitPos) {
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (*bitPos) {
|
|
|
|
(*bitPos)--;
|
2003-04-07 20:44:16 +00:00
|
|
|
} else {
|
2005-12-05 05:02:43 +00:00
|
|
|
(*data)++;
|
|
|
|
*bitPos = 7;
|
2005-07-30 21:11:48 +00:00
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
return (bool)(((**data) >> (*bitPos)) & 1);
|
2003-04-07 20:44:16 +00:00
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
char Text::getTextChar(uint8 **data, uint32 *bitPos) {
|
|
|
|
int pos = 0;
|
|
|
|
while (1) {
|
|
|
|
if (getTextBit(data, bitPos))
|
|
|
|
pos = _huffTree[pos].rChild;
|
|
|
|
else
|
|
|
|
pos = _huffTree[pos].lChild;
|
|
|
|
|
|
|
|
if (_huffTree[pos].lChild == 0 && _huffTree[pos].rChild == 0) {
|
|
|
|
return _huffTree[pos].value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
displayText_t Text::displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
|
|
|
|
//Render text into buffer *dest
|
|
|
|
getText(textNum);
|
|
|
|
return displayText(_textBuffer, dest, centre, pixelWidth, color);
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
displayText_t Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
//Render text pointed to by *textPtr in buffer *dest
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 centerTable[10];
|
2005-07-30 21:11:48 +00:00
|
|
|
uint16 lineWidth = 0;
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 numLines = 0;
|
|
|
|
_numLetters = 2;
|
2003-04-20 15:51:29 +00:00
|
|
|
|
2003-07-28 20:59:53 +00:00
|
|
|
// work around bug #778105 (line width exceeded)
|
|
|
|
char *tmpPtr = strstr(textPtr, "MUND-BEATMUNG!");
|
|
|
|
if (tmpPtr)
|
|
|
|
strcpy(tmpPtr, "MUND BEATMUNG!");
|
|
|
|
|
2005-03-13 13:15:17 +00:00
|
|
|
// work around bug #1151924 (line width exceeded when talking to gardener using spanish text)
|
|
|
|
// This text apparently only is broken in the floppy versions, the CD versions contain
|
|
|
|
// the correct string "MANIFESTACION - ARTISTICA.", which doesn't break the algorithm/game.
|
|
|
|
tmpPtr = strstr(textPtr, "MANIFESTACION-ARTISTICA.");
|
|
|
|
if (tmpPtr)
|
2005-03-13 14:03:54 +00:00
|
|
|
strcpy(tmpPtr, "MANIFESTACION ARTISTICA.");
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
char *curPos = textPtr;
|
|
|
|
char *lastSpace = textPtr;
|
|
|
|
uint8 textChar = (uint8)*curPos++;
|
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
while (textChar >= 0x20) {
|
2003-07-10 01:55:48 +00:00
|
|
|
if ((_curCharSet == 1) && (textChar >= 0x80))
|
|
|
|
textChar = 0x20;
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
textChar -= 0x20;
|
|
|
|
if (textChar == 0) {
|
|
|
|
lastSpace = curPos; //keep track of last space
|
2005-12-05 05:02:43 +00:00
|
|
|
centerTable[numLines] = lineWidth;
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
lineWidth += _characterSet[textChar]; //add character width
|
2003-04-20 21:50:48 +00:00
|
|
|
lineWidth += (uint16)_dtCharSpacing; //include character spacing
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
if (pixelWidth <= lineWidth) {
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
if (*(lastSpace-1) == 10)
|
2003-06-06 13:44:49 +00:00
|
|
|
error("line width exceeded!");
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
*(lastSpace-1) = 10;
|
|
|
|
lineWidth = 0;
|
2005-12-05 05:02:43 +00:00
|
|
|
numLines++;
|
2003-04-20 15:51:29 +00:00
|
|
|
curPos = lastSpace; //go back for new count
|
|
|
|
}
|
|
|
|
|
2003-07-06 21:03:39 +00:00
|
|
|
textChar = (uint8)*curPos++;
|
2005-12-05 05:02:43 +00:00
|
|
|
_numLetters++;
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 dtLastWidth = lineWidth; //save width of last line
|
|
|
|
centerTable[numLines] = lineWidth; //and update centering table
|
|
|
|
numLines++;
|
2003-04-20 15:51:29 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (numLines > MAX_NO_LINES)
|
2003-04-20 15:51:29 +00:00
|
|
|
error("Maximum no. of lines exceeded!");
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 dtLineSize = pixelWidth * _charHeight;
|
|
|
|
uint32 numBytes = (dtLineSize * numLines) + sizeof(struct dataFileHeader) + 4;
|
2003-04-20 15:51:29 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (!dest)
|
|
|
|
dest = (uint8*)malloc(numBytes);
|
2003-04-20 15:51:29 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
// clear text sprite buffer
|
|
|
|
memset(dest + sizeof(struct dataFileHeader), 0, numBytes - sizeof(struct dataFileHeader));
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
//make the header
|
2005-12-05 05:02:43 +00:00
|
|
|
((struct dataFileHeader *)dest)->s_width = pixelWidth;
|
|
|
|
((struct dataFileHeader *)dest)->s_height = (uint16)(_charHeight * numLines);
|
|
|
|
((struct dataFileHeader *)dest)->s_sp_size = (uint16)(pixelWidth * _charHeight * numLines);
|
|
|
|
((struct dataFileHeader *)dest)->s_offset_x = 0;
|
|
|
|
((struct dataFileHeader *)dest)->s_offset_y = 0;
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
//reset position
|
|
|
|
curPos = textPtr;
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
uint8 *curDest = dest + sizeof(struct dataFileHeader); //point to where pixels start
|
2003-04-20 15:51:29 +00:00
|
|
|
byte *prevDest = curDest;
|
2005-12-05 05:02:43 +00:00
|
|
|
uint32 *centerTblPtr = centerTable;
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
do {
|
2005-12-05 05:02:43 +00:00
|
|
|
if (centre) {
|
|
|
|
uint32 width = (pixelWidth - *centerTblPtr) >> 1;
|
|
|
|
centerTblPtr++;
|
2003-04-20 15:51:29 +00:00
|
|
|
curDest += width;
|
|
|
|
}
|
|
|
|
|
2003-07-06 21:03:39 +00:00
|
|
|
textChar = (uint8)*curPos++;
|
2003-04-20 15:51:29 +00:00
|
|
|
while (textChar >= 0x20) {
|
2005-12-05 05:02:43 +00:00
|
|
|
makeGameCharacter(textChar - 0x20, _characterSet, curDest, color, pixelWidth);
|
2003-04-20 15:51:29 +00:00
|
|
|
textChar = *curPos++;
|
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
prevDest = curDest = prevDest + dtLineSize; //start of last line + start of next
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
} while (textChar >= 10);
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-29 17:42:07 +00:00
|
|
|
struct displayText_t ret;
|
2005-12-05 05:02:43 +00:00
|
|
|
ret.textData = dest;
|
|
|
|
ret.textWidth = dtLastWidth;
|
2003-04-29 17:42:07 +00:00
|
|
|
return ret;
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
void Text::makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&dest, uint8 color, uint16 bufPitch) {
|
2003-04-20 15:51:29 +00:00
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
bool maskBit, dataBit;
|
2003-04-21 15:26:13 +00:00
|
|
|
uint8 charWidth = (uint8)((*(charSetPtr + textChar)) + 1 - _dtCharSpacing);
|
2005-07-30 21:11:48 +00:00
|
|
|
uint16 data, mask;
|
2003-04-21 15:26:13 +00:00
|
|
|
byte *charSpritePtr = charSetPtr + (CHAR_SET_HEADER + ((_charHeight << 2) * textChar));
|
2003-04-20 15:51:29 +00:00
|
|
|
byte *startPos = dest;
|
|
|
|
byte *curPos = startPos;
|
|
|
|
|
|
|
|
for (int i = 0; i < _charHeight; i++) {
|
|
|
|
|
|
|
|
byte *prevPos = curPos;
|
2003-11-08 20:27:27 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
data = READ_BE_UINT16(charSpritePtr);
|
|
|
|
mask = READ_BE_UINT16(charSpritePtr + 2);
|
|
|
|
charSpritePtr += 4;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-04-20 15:51:29 +00:00
|
|
|
for (int j = 0; j < charWidth; j++) {
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-04-20 16:22:34 +00:00
|
|
|
maskBit = (mask & 0x8000) != 0; //check mask
|
2003-04-20 15:51:29 +00:00
|
|
|
mask <<= 1;
|
2003-04-20 16:22:34 +00:00
|
|
|
dataBit = (data & 0x8000) != 0; //check data
|
2003-04-20 15:51:29 +00:00
|
|
|
data <<= 1;
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
if (maskBit)
|
|
|
|
if (dataBit)
|
2003-04-20 15:51:29 +00:00
|
|
|
*curPos = color;
|
|
|
|
else
|
2005-07-30 21:11:48 +00:00
|
|
|
*curPos = 240; //black edge
|
2003-04-20 15:51:29 +00:00
|
|
|
|
|
|
|
curPos++;
|
|
|
|
}
|
|
|
|
//advance a line
|
2005-12-05 05:02:43 +00:00
|
|
|
curPos = prevPos + bufPitch;
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
|
|
|
//update position
|
2005-07-30 21:11:48 +00:00
|
|
|
dest = startPos + charWidth + _dtCharSpacing * 2 - 1;
|
2003-04-20 15:51:29 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
lowTextManager_t Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre) {
|
2003-04-29 19:52:24 +00:00
|
|
|
|
|
|
|
getText(textNum);
|
2005-12-05 05:02:43 +00:00
|
|
|
struct displayText_t textInfo = displayText(_textBuffer, NULL, centre, width, color);
|
2003-04-29 19:52:24 +00:00
|
|
|
|
|
|
|
uint32 compactNum = FIRST_TEXT_COMPACT;
|
2004-12-15 06:48:08 +00:00
|
|
|
Compact *cpt = _skyCompact->fetchCpt(compactNum);
|
2005-07-30 21:11:48 +00:00
|
|
|
while (cpt->status != 0) {
|
2003-04-29 19:52:24 +00:00
|
|
|
compactNum++;
|
2004-12-15 06:48:08 +00:00
|
|
|
cpt = _skyCompact->fetchCpt(compactNum);
|
2003-04-29 19:52:24 +00:00
|
|
|
}
|
|
|
|
|
2003-04-30 05:47:18 +00:00
|
|
|
cpt->flag = (uint16)(compactNum - FIRST_TEXT_COMPACT) + FIRST_TEXT_BUFFER;
|
2003-04-29 19:52:24 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
if (SkyEngine::_itemList[cpt->flag])
|
|
|
|
free(SkyEngine::_itemList[cpt->flag]);
|
2003-04-29 19:52:24 +00:00
|
|
|
|
2005-12-05 05:02:43 +00:00
|
|
|
SkyEngine::_itemList[cpt->flag] = textInfo.textData;
|
2003-04-29 19:52:24 +00:00
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
cpt->logic = logicNum;
|
2003-04-29 19:52:24 +00:00
|
|
|
cpt->status = ST_LOGIC | ST_FOREGROUND | ST_RECREATE;
|
2004-01-03 15:57:57 +00:00
|
|
|
cpt->screen = (uint16) Logic::_scriptVariables[SCREEN];
|
2003-04-29 19:52:24 +00:00
|
|
|
|
|
|
|
struct lowTextManager_t ret;
|
2005-12-05 05:02:43 +00:00
|
|
|
ret.textData = textInfo.textData;
|
|
|
|
ret.textWidth = textInfo.textWidth;
|
2003-04-30 05:47:18 +00:00
|
|
|
ret.compactNum = (uint16)compactNum;
|
2003-04-29 19:52:24 +00:00
|
|
|
|
|
|
|
return ret;
|
2003-06-09 02:33:27 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::changeTextSpriteColour(uint8 *sprData, uint8 newCol) {
|
2003-04-29 19:52:24 +00:00
|
|
|
|
2003-07-07 00:14:16 +00:00
|
|
|
dataFileHeader *header = (dataFileHeader *)sprData;
|
2003-06-09 02:33:27 +00:00
|
|
|
sprData += sizeof(dataFileHeader);
|
|
|
|
for (uint16 cnt = 0; cnt < header->s_sp_size; cnt++)
|
2005-12-05 05:02:43 +00:00
|
|
|
if (sprData[cnt] >= 241)
|
|
|
|
sprData[cnt] = newCol;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 Text::giveCurrentCharSet(void) {
|
|
|
|
return _curCharSet;
|
2003-04-29 19:52:24 +00:00
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
void Text::initHuffTree() {
|
2003-10-05 20:21:20 +00:00
|
|
|
switch (SkyEngine::_systemVars.gameVersion) {
|
2003-07-12 15:21:34 +00:00
|
|
|
case 109:
|
|
|
|
_huffTree = _huffTree_00109;
|
|
|
|
break;
|
2003-05-09 22:06:37 +00:00
|
|
|
case 267:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00267;
|
2003-05-09 22:06:37 +00:00
|
|
|
break;
|
|
|
|
case 288:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00288;
|
2003-05-09 22:06:37 +00:00
|
|
|
break;
|
|
|
|
case 303:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00303;
|
2003-05-09 22:06:37 +00:00
|
|
|
break;
|
|
|
|
case 331:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00331;
|
|
|
|
break;
|
2003-07-04 23:26:46 +00:00
|
|
|
case 348:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00348;
|
2003-05-09 22:06:37 +00:00
|
|
|
break;
|
|
|
|
case 365:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00365;
|
|
|
|
break;
|
2003-05-09 22:06:37 +00:00
|
|
|
case 368:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00368;
|
2003-06-14 10:14:28 +00:00
|
|
|
break;
|
2003-05-09 22:06:37 +00:00
|
|
|
case 372:
|
2003-07-05 02:21:19 +00:00
|
|
|
_huffTree = _huffTree_00372;
|
2003-05-09 22:06:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
2003-10-05 20:21:20 +00:00
|
|
|
error("Unknown game version %d", SkyEngine::_systemVars.gameVersion);
|
2003-05-09 22:06:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
bool Text::patchMessage(uint32 textNum) {
|
2003-07-31 21:26:27 +00:00
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
uint16 patchIdx = _patchLangIdx[SkyEngine::_systemVars.language];
|
|
|
|
uint16 patchNum = _patchLangNum[SkyEngine::_systemVars.language];
|
2003-07-31 21:26:27 +00:00
|
|
|
for (uint16 cnt = 0; cnt < patchNum; cnt++) {
|
|
|
|
if (_patchedMessages[cnt + patchIdx].textNr == textNum) {
|
|
|
|
strcpy(_textBuffer, _patchedMessages[cnt + patchIdx].text);
|
|
|
|
return true;
|
2005-07-30 21:11:48 +00:00
|
|
|
}
|
2003-07-31 21:26:27 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
const PatchMessage Text::_patchedMessages[NUM_PATCH_MSG] = {
|
2003-07-31 21:26:27 +00:00
|
|
|
{ 28724, "Testo e Parlato" }, // - italian
|
|
|
|
{ 28707, "Solo Testo" },
|
2005-07-30 21:11:48 +00:00
|
|
|
{ 28693, "Solo Parlato" },
|
2003-07-31 21:26:27 +00:00
|
|
|
{ 28724, "Text och tal" }, // - swedish
|
|
|
|
{ 28707, "Endast text" },
|
|
|
|
{ 28693, "Endast tal" },
|
2005-01-06 16:10:34 +00:00
|
|
|
{ 28686, "Musikvolym" },
|
|
|
|
{ 4336, "Wir befinden uns EINHUNDERTZWANZIG METER #ber dem ERBODEN!" }, // - german
|
2003-07-31 21:26:27 +00:00
|
|
|
};
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
const uint16 Text::_patchLangIdx[8] = {
|
2003-07-31 21:26:27 +00:00
|
|
|
0xFFFF, // SKY_ENGLISH
|
2005-01-06 16:10:34 +00:00
|
|
|
7, // SKY_GERMAN
|
2003-07-31 21:26:27 +00:00
|
|
|
0xFFFF, // SKY_FRENCH
|
|
|
|
0xFFFF, // SKY_USA
|
|
|
|
3, // SKY_SWEDISH
|
|
|
|
0, // SKY_ITALIAN
|
|
|
|
0xFFFF, // SKY_PORTUGUESE
|
|
|
|
0xFFFF // SKY_SPANISH
|
|
|
|
};
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
const uint16 Text::_patchLangNum[8] = {
|
2003-07-31 21:26:27 +00:00
|
|
|
0, // SKY_ENGLISH
|
2005-01-06 16:10:34 +00:00
|
|
|
1, // SKY_GERMAN
|
2003-07-31 21:26:27 +00:00
|
|
|
0, // SKY_FRENCH
|
|
|
|
0, // SKY_USA
|
|
|
|
4, // SKY_SWEDISH
|
|
|
|
3, // SKY_ITALIAN
|
|
|
|
0, // SKY_PORTUGUESE
|
|
|
|
0 // SKY_SPANISH
|
|
|
|
};
|
2004-01-03 01:58:58 +00:00
|
|
|
|
|
|
|
} // End of namespace Sky
|