Move function as requested.
svn-id: r14844
This commit is contained in:
parent
93584bcdc3
commit
0ab96ee6c8
4 changed files with 28 additions and 28 deletions
|
@ -50,30 +50,6 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) {
|
||||||
_curId = 0;
|
_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) {
|
void CharsetRendererCommon::setCurID(byte id) {
|
||||||
checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d");
|
checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d");
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ public:
|
||||||
virtual void printChar(int chr) = 0;
|
virtual void printChar(int chr) = 0;
|
||||||
virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}
|
virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}
|
||||||
|
|
||||||
int getLetter(int letter);
|
|
||||||
int getStringWidth(int a, const byte *str);
|
int getStringWidth(int a, const byte *str);
|
||||||
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
||||||
|
|
||||||
|
|
|
@ -615,6 +615,7 @@ protected:
|
||||||
virtual const char *getOpcodeDesc(byte i);
|
virtual const char *getOpcodeDesc(byte i);
|
||||||
|
|
||||||
byte stringLen(byte *);
|
byte stringLen(byte *);
|
||||||
|
int getCharsetOffset(int letter);
|
||||||
|
|
||||||
/* Version 7 script opcodes */
|
/* Version 7 script opcodes */
|
||||||
void o7_cursorCommand();
|
void o7_cursorCommand();
|
||||||
|
|
|
@ -407,6 +407,31 @@ byte ScummEngine_v7he::stringLen(byte *ptr) {
|
||||||
return len;
|
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() {
|
void ScummEngine_v7he::o7_cursorCommand() {
|
||||||
int a, i;
|
int a, i;
|
||||||
int args[16];
|
int args[16];
|
||||||
|
@ -726,8 +751,7 @@ void ScummEngine_v7he::o7_unknownED() {
|
||||||
writeVar(0, array);
|
writeVar(0, array);
|
||||||
while (len >= pos) {
|
while (len >= pos) {
|
||||||
letter = readArray(0, 0, pos);
|
letter = readArray(0, 0, pos);
|
||||||
if (letter)
|
result += getCharsetOffset(letter);
|
||||||
result += _charset->getLetter(letter);
|
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +927,7 @@ void ScummEngine_v7he::o7_unknownF5() {
|
||||||
|
|
||||||
while (len <= pos) {
|
while (len <= pos) {
|
||||||
letter = readArray(0, 0, pos);
|
letter = readArray(0, 0, pos);
|
||||||
result += _charset->getLetter(letter);
|
result += getCharsetOffset(letter);
|
||||||
if (result >= ebx)
|
if (result >= ebx)
|
||||||
break;
|
break;
|
||||||
pos++;
|
pos++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue