aboutsummaryrefslogtreecommitdiff
path: root/scumm/charset.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2005-04-10 09:58:37 +0000
committerEugene Sandulenko2005-04-10 09:58:37 +0000
commit582c56c236a859da23c287986e1021fa0735f197 (patch)
treebc3d71ab907e1b8b089feeccdcb7c90a88782bd4 /scumm/charset.cpp
parent82c10524b431061e0e79a8ed5eacf894109533b2 (diff)
downloadscummvm-rg350-582c56c236a859da23c287986e1021fa0735f197.tar.gz
scummvm-rg350-582c56c236a859da23c287986e1021fa0735f197.tar.bz2
scummvm-rg350-582c56c236a859da23c287986e1021fa0735f197.zip
Do not hardcode character translation tables and verbs prepositions
in MM NES but extract it directly from ROM. Patch from Quietust svn-id: r17505
Diffstat (limited to 'scumm/charset.cpp')
-rw-r--r--scumm/charset.cpp81
1 files changed, 7 insertions, 74 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 09e167d422..76613f01dd 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1681,82 +1681,9 @@ void CharsetRendererNut::printChar(int chr) {
_str.bottom = shadow.bottom;
}
-static byte trNESEnglishTable[] = {
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x0a, 0x07, 0x00,
- 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
- 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
- 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x00, 0x00, 0x00, 0x2f, 0x00,
- 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x00, 0x00, 0x00, 0x05, 0x08,
- 0x20, 0x20, 0x21, 0x60, 0x27, 0x7e, 0x2c, 0x2e,
- 0x7f, 0x3f, 0x2d, 0x30, 0x31, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5e
-};
-
-static byte trNESFrenchTable[] = {
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x64, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x0a, 0x07, 0x00,
- 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
- 0x13, 0x14, 0x00, 0x00, 0x15, 0x15, 0x64, 0x09,
- 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x19, 0x19, 0x19, 0x2f, 0x29,
- 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x1d, 0x23, 0x29, 0x05, 0x08,
- 0x20, 0x20, 0x21, 0x60, 0x27, 0x7e, 0x2c, 0x2e,
- 0x7f, 0x3f, 0x2d, 0x30, 0x31, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5e
-};
-
-static byte trNESSwedishTable[] = {
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x0a, 0x07, 0x00,
- 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
- 0x13, 0x14, 0x00, 0x00, 0x61, 0x00, 0x64, 0x09,
- 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x62, 0x63, 0x00, 0x2f, 0x00,
- 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2e, 0x63, 0x64, 0x61, 0x05, 0x08,
- 0x20, 0x20, 0x21, 0x60, 0x27, 0x7e, 0x2c, 0x2e,
- 0x7f, 0x3f, 0x2d, 0x30, 0x31, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5e
-};
-
CharsetRendererNES::CharsetRendererNES(ScummEngine *vm, Common::Language language)
: CharsetRendererCommon(vm) {
- switch (language) {
- case Common::FR_FRA:
- _trTable = trNESFrenchTable;
- break;
- case Common::SE_SWE:
- _trTable = trNESSwedishTable;
- break;
- default:
- _trTable = trNESEnglishTable;
- break;
- }
+ _trTable = NULL; // can't init it here, since resources aren't yet loaded!
}
void CharsetRendererNES::printChar(int chr) {
@@ -1764,6 +1691,9 @@ void CharsetRendererNES::printChar(int chr) {
VirtScreen *vs;
byte *charPtr, *dst;
+ if (!_trTable) // have to init it here instead
+ _trTable = _vm->getResourceAddress(rtCostume, 77) + 2;
+
// HACK: how to set it properly?
if (_top == 0)
_top = 16;
@@ -1825,6 +1755,9 @@ void CharsetRendererNES::drawChar(int chr, const Graphics::Surface &s, int x, in
byte *charPtr, *dst;
int width, height;
+ if (!_trTable)
+ _trTable = _vm->getResourceAddress(rtCostume, 77) + 2;
+
charPtr = _vm->_NESPatTable[1] + _trTable[chr - 32] * 16;
width = getCharWidth(chr);
height = 8;