From 0ab96ee6c87f6ca4be680f11f3bb502594b3b16c Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 31 Aug 2004 07:40:28 +0000 Subject: Move function as requested. svn-id: r14844 --- scumm/charset.cpp | 24 ------------------------ scumm/charset.h | 1 - scumm/intern.h | 1 + scumm/script_v7he.cpp | 30 +++++++++++++++++++++++++++--- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/scumm/charset.cpp b/scumm/charset.cpp index fff1f3b728..a3e5755ea4 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -50,30 +50,6 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) { _curId = 0; } -int CharsetRenderer::getLetter(int letter) { - int offset, result; - - byte *ptr = _vm->getResourceAddress(rtCharset, _curId); - if (!ptr) - error("CharsetRenderer::getLetter: charset %d not found!", _curId); - - offset = READ_LE_UINT32(ptr + 29 + letter); - if (offset == 0) - return 0; - - ptr += offset; - - result = READ_LE_UINT16(ptr + 2); - byte start = *ptr; - - if (result >= 0x80) { - result = result - 256 + start; - } else { - result += start; - }; - return (result); -} - void CharsetRendererCommon::setCurID(byte id) { checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d"); diff --git a/scumm/charset.h b/scumm/charset.h index 2613c934a6..66c506e73c 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -71,7 +71,6 @@ public: virtual void printChar(int chr) = 0; virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {} - int getLetter(int letter); int getStringWidth(int a, const byte *str); void addLinebreaks(int a, byte *str, int pos, int maxwidth); diff --git a/scumm/intern.h b/scumm/intern.h index 8d58fa9dc6..c820782e36 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -615,6 +615,7 @@ protected: virtual const char *getOpcodeDesc(byte i); byte stringLen(byte *); + int getCharsetOffset(int letter); /* Version 7 script opcodes */ void o7_cursorCommand(); diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 0150ab88ab..606f3e71f2 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -407,6 +407,31 @@ byte ScummEngine_v7he::stringLen(byte *ptr) { return len; } +int ScummEngine_v7he::getCharsetOffset(int letter) { + int offset, result; + int id = _charset->getCurID(); + + byte *ptr = getResourceAddress(rtCharset, id); + if (!ptr) + error("getCharsetOffset: charset %d not found!", id); + + offset = READ_LE_UINT32(ptr + 29 + letter); + if (offset == 0) + return 0; + + ptr += offset; + + result = READ_LE_UINT16(ptr + 2); + byte start = *ptr; + + if (result >= 0x80) { + result = result - 256 + start; + } else { + result += start; + }; + return (result); +} + void ScummEngine_v7he::o7_cursorCommand() { int a, i; int args[16]; @@ -726,8 +751,7 @@ void ScummEngine_v7he::o7_unknownED() { writeVar(0, array); while (len >= pos) { letter = readArray(0, 0, pos); - if (letter) - result += _charset->getLetter(letter); + result += getCharsetOffset(letter); pos++; } @@ -903,7 +927,7 @@ void ScummEngine_v7he::o7_unknownF5() { while (len <= pos) { letter = readArray(0, 0, pos); - result += _charset->getLetter(letter); + result += getCharsetOffset(letter); if (result >= ebx) break; pos++; -- cgit v1.2.3