fixed o8_getStringWidth (should fix bug #741625)

svn-id: r8035
This commit is contained in:
Max Horn 2003-05-27 15:33:38 +00:00
parent 052a482f40
commit af2574c02d
2 changed files with 16 additions and 6 deletions

View file

@ -524,7 +524,7 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) { bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) {
int i; int i;
ScriptSlot *ss = &_s->vm.slot[0]; ScriptSlot *ss = _s->vm.slot;
Debug_Printf("+--------------------------------------+\n"); Debug_Printf("+--------------------------------------+\n");
Debug_Printf("|# | num | offset|sta|typ|fr|rec|fc|cut|\n"); Debug_Printf("|# | num | offset|sta|typ|fr|rec|fc|cut|\n");
Debug_Printf("+--+-----+-------+---+---+--+--+---+---+\n"); Debug_Printf("+--+-----+-------+---+---+--+--+---+---+\n");

View file

@ -1696,17 +1696,27 @@ void Scumm_v8::o8_getObjectImageHeight() {
void Scumm_v8::o8_getStringWidth() { void Scumm_v8::o8_getStringWidth() {
int charset = pop(); int charset = pop();
int len = resStrLen(_scriptPointer);
int oldID = _charset->getCurID(); int oldID = _charset->getCurID();
int width; int width;
const byte *msg = _scriptPointer;
// Skip to the next instruction
_scriptPointer += resStrLen(_scriptPointer) + 1;
if (msg[0] == '/') {
translateText(msg, _transText);
msg = _transText;
}
// Temporary set the specified charset id // Temporary set the specified charset id
_charset->setCurID(charset); _charset->setCurID(_string[charset].charset);
width = _charset->getStringWidth(0, _scriptPointer); // Determine the strings width
width = _charset->getStringWidth(0, msg);
// Revert to old font
_charset->setCurID(oldID); _charset->setCurID(oldID);
push(width); push(width);
_scriptPointer += len + 1;
} }
void Scumm_v8::o8_drawObject() { void Scumm_v8::o8_drawObject() {