diff options
author | James Brown | 2002-12-25 14:31:17 +0000 |
---|---|---|
committer | James Brown | 2002-12-25 14:31:17 +0000 |
commit | bda8d953a8bcfc5a17c308861f4620768de09ea4 (patch) | |
tree | 29498de30a0e8fa5a485bd2c71f9c7329327a585 /scumm | |
parent | 6b5a1cfb1accc1873749fdc7e54004edc9c1430e (diff) | |
download | scummvm-rg350-bda8d953a8bcfc5a17c308861f4620768de09ea4.tar.gz scummvm-rg350-bda8d953a8bcfc5a17c308861f4620768de09ea4.tar.bz2 scummvm-rg350-bda8d953a8bcfc5a17c308861f4620768de09ea4.zip |
Clean up the hack. But it's still kinda a hack. Er. :)
svn-id: r6130
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 6 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 52 | ||||
-rw-r--r-- | scumm/scumm.h | 4 |
3 files changed, 28 insertions, 34 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 4ec16ea0ab..02da8da181 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -24,7 +24,7 @@ #define INTERN_H #include "scumm.h" - +class NutRenderer; // V8 Font Renderer class Scumm_v5 : public Scumm { @@ -406,6 +406,10 @@ protected: void decodeParseString(int m, int n); + /* Version 8 Font Stuff */ + void loadCharset(int charset); + NutRenderer *_fr[4]; + /* Version 8 script opcodes */ void o8_mod(); void o8_breakHereVar(); diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 94266c9de8..23f3a8a5c0 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -36,6 +36,21 @@ #define OPCODE(x) { &Scumm_v8::x, #x } +// FIXME: Move this somewhere better :) +void Scumm_v8::loadCharset(int charset) { + char fontname[255]; + sprintf(fontname, "resource/font%d.nut", charset); + warning("Loading charset %s\n", fontname); + _fr[charset] = new NutRenderer; + if (!(_fr[charset]->loadFont(fontname, (char*)getGameDataPath()))) { + delete _fr[charset]; + _fr[charset] = NULL; + return; + } + + _fr[charset]->bindDisplay((byte*)virtscr[0].screenPtr, (int32)_realWidth, (int32)_realHeight, (int32)_realWidth); +} + void Scumm_v8::setupOpcodes() { // TODO: any of the o6_ entries are potentially wrong and pure guesses :-) @@ -496,18 +511,6 @@ void Scumm_v8::decodeParseString(int m, int n) case 0xCD: { // SO_PRINT_CHARSET Set print character set // FIXME - TODO int charset = pop(); - if (_fr[charset] == NULL) { - char fontname[255]; - sprintf(fontname, "resource/font%d.nut", charset); - _fr[charset] = new NutRenderer; - _fr[charset]->loadFont(fontname, (char*)getGameDataPath()); - _fr[charset]->bindDisplay((byte*)virtscr[0].screenPtr, (int32)_realWidth, (int32)_realHeight, (int32)_realWidth); - if (!_fr[charset]) - warning("Failed to load font %d from %s%s\n", charset, getGameDataPath(), fontname); - else - warning("Loaded font %d from %s%s\n", charset, getGameDataPath(), fontname); - - } _string[m].charset = charset; } break; @@ -523,17 +526,18 @@ void Scumm_v8::decodeParseString(int m, int n) error("decodeParseString: SO_PRINT_MUMBLE"); break; case 0xD1: { - // TODO - FIXME _messagePtr = _scriptPointer; byte buffer[1024]; _msgPtrToAdd = buffer; _scriptPointer = _messagePtr = addMessageToStack(_messagePtr); + if (_fr[_string[m].charset] == NULL) // FIXME: Put this elsewhere? + loadCharset(_string[m].charset); + if (_fr[_string[m].charset] != NULL) { _fr[_string[m].charset]->drawString((char *)buffer, (int)_string[m].xpos, (int)_string[m].ypos, (unsigned char)_string[m].color, 0); - } else { - warning("No font loaded in slot %d\n", m); + //warning("Printing font loaded in slot %d: %s\n", _string[m].charset, buffer); } break; @@ -754,18 +758,7 @@ void Scumm_v8::o8_cursorCommand() break; case 0xE7: { // SO_CHARSET_SET int charset = pop(); - if (_fr[charset] == NULL) { - char fontname[255]; - sprintf(fontname, "resource/font%d.nut", charset); - _fr[charset] = new NutRenderer; - _fr[charset]->loadFont(fontname, (char*)getGameDataPath()); - _fr[charset]->bindDisplay((byte*)virtscr[0].screenPtr, (int32)_realWidth, (int32)_realHeight, (int32)_realWidth); - if (!_fr[charset]) - warning("Failed to load font %d from %s%s\n", charset, getGameDataPath(), fontname); - else - warning("Loaded font %d from %s%s\n", charset, getGameDataPath(), fontname); - - } + loadCharset(charset); break; } case 0xE8: // SO_CHARSET_COLOR @@ -897,7 +890,7 @@ void Scumm_v8::o8_actorOps() if (subOp == 0x7A) { _curActor = pop(); - printf("Setting current actor to %d\n", _curActor); + //printf("Setting current actor to %d\n", _curActor); return; } @@ -1124,7 +1117,8 @@ void Scumm_v8::o8_verbOps() break; case 0xA6: // SO_VERB_CHARSET Choose charset for verb // FIXME - TODO - pop(); + vs->charset_nr = pop(); + //printf("Set to charset %d\n", vs->charset_nr); break; case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb // FIXME - TODO diff --git a/scumm/scumm.h b/scumm/scumm.h index a5b893de4b..47113673c6 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -31,7 +31,6 @@ #include "common/timer.h" #include "common/util.h" -class NutRenderer; class GameDetector; class NewGui; class Dialog; @@ -681,9 +680,6 @@ public: void actorTalk(); void stopTalk(); - /* FIXME: This should not be here, probably. Hack for CMI v8 fonts */ - NutRenderer *_fr[4]; - /* Akos Class */ bool akos_increaseAnims(byte *akos, Actor *a); |