diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/module.mk | 1 | ||||
-rw-r--r-- | scumm/script.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 58 | ||||
-rw-r--r-- | scumm/scumm.h | 4 |
4 files changed, 31 insertions, 34 deletions
diff --git a/scumm/module.mk b/scumm/module.mk index 5f4a3b6410..7d83592a81 100644 --- a/scumm/module.mk +++ b/scumm/module.mk @@ -26,6 +26,7 @@ SCUMM_OBJS = \ scumm/string.o \ scumm/vars.o \ scumm/verbs.o \ + scumm/nut_renderer.o SMUSH_OBJS = \ scumm/smush/blitter.o \ diff --git a/scumm/script.cpp b/scumm/script.cpp index 97b045b33f..beeeeffec0 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -336,6 +336,8 @@ int Scumm::readVar(uint var) #endif debug(9, "readvar=%d", var); if (!(var & 0xF000)) { + if (var == 175) + return 1; #if defined(BYPASS_COPY_PROT) if (var == 490 && _gameId == GID_MONKEY2 && !copyprotbypassed) { copyprotbypassed = true; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index a8865302f3..94266c9de8 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -26,8 +26,7 @@ #include "sound.h" #include "verbs.h" -#include "smush/player.h" -#include "smush/frenderer.h" +#include "nut_renderer.h" /* * NO, we do NOT support CMI yet :-) This file is mostly a placeholder and a place @@ -35,24 +34,6 @@ * might even be wrong... so don't hold your breath. */ - -// #define FONT_HACK - -#ifdef FONT_HACK -// FIXME: Copied from smush/player.cpp - this should probably go somewhere sensible :) -static FontRenderer *loadFont(const char * file, const char * directory, bool original = false) { -#ifdef DEBUG - debug(5, "loading font from \"%s\"", file); -#endif - FontRenderer * fr = new FontRenderer(original); - SmushPlayer p(fr, false, false); - p.play(file, directory); - return fr; -} -#endif - - - #define OPCODE(x) { &Scumm_v8::x, #x } void Scumm_v8::setupOpcodes() @@ -512,9 +493,23 @@ void Scumm_v8::decodeParseString(int m, int n) _string[m].center = true; _string[m].overhead = false; break; - case 0xCD: // SO_PRINT_CHARSET Set print character set + case 0xCD: { // SO_PRINT_CHARSET Set print character set // FIXME - TODO - _string[m].charset = pop(); + 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; case 0xCE: _string[m].center = false; @@ -531,17 +526,16 @@ void Scumm_v8::decodeParseString(int m, int n) // TODO - FIXME _messagePtr = _scriptPointer; - Point screenSize(_realHeight, _realWidth); byte buffer[1024]; _msgPtrToAdd = buffer; _scriptPointer = _messagePtr = addMessageToStack(_messagePtr); if (_fr[_string[m].charset] != NULL) { - _fr[_string[m].charset]->drawStringAbsolute((const char*)buffer, (char*)virtscr[0].screenPtr, screenSize, (int16)_string[m].xpos, (int16)_string[m].ypos); - printf("Drawn message(%d)\n", m); + _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); } -// printf("Message(%d): '%s'\n", m, buffer); break; } case 0xD2: // SO_PRINT_WRAP Set print wordwrap @@ -759,18 +753,18 @@ void Scumm_v8::o8_cursorCommand() makeCursorColorTransparent(pop()); break; case 0xE7: { // SO_CHARSET_SET - // FIXME - TODO int charset = pop(); if (_fr[charset] == NULL) { char fontname[255]; sprintf(fontname, "resource/font%d.nut", charset); - -#ifdef FONT_HACK - _fr[charset] = loadFont(fontname, getGameDataPath(), true); -#endif - + _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); + } break; } diff --git a/scumm/scumm.h b/scumm/scumm.h index 37e65462e0..a5b893de4b 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -31,7 +31,7 @@ #include "common/timer.h" #include "common/util.h" -class FontRenderer; +class NutRenderer; class GameDetector; class NewGui; class Dialog; @@ -682,7 +682,7 @@ public: void stopTalk(); /* FIXME: This should not be here, probably. Hack for CMI v8 fonts */ - FontRenderer *_fr[4]; + NutRenderer *_fr[4]; /* Akos Class */ |