aboutsummaryrefslogtreecommitdiff
path: root/scumm/charset.cpp
diff options
context:
space:
mode:
authorMax Horn2002-12-26 01:47:40 +0000
committerMax Horn2002-12-26 01:47:40 +0000
commita43355a1bfedcf661f4bc75b396c9e499a3bf812 (patch)
tree7b6af355d268df341fcd609d47962560a4fbdd8f /scumm/charset.cpp
parent7e7be4f6f3911c428449c727caa06a550fec6e3a (diff)
downloadscummvm-rg350-a43355a1bfedcf661f4bc75b396c9e499a3bf812.tar.gz
scummvm-rg350-a43355a1bfedcf661f4bc75b396c9e499a3bf812.tar.bz2
scummvm-rg350-a43355a1bfedcf661f4bc75b396c9e499a3bf812.zip
reuse the old (ugly nasty dreaded) string system for V8, too (by supplying a NUT based CharsetRenderer)
svn-id: r6162
Diffstat (limited to 'scumm/charset.cpp')
-rw-r--r--scumm/charset.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index c1989832fb..57c242f71e 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -21,6 +21,7 @@
#include "stdafx.h"
#include "charset.h"
#include "scumm.h"
+#include "nut_renderer.h"
void CharsetRendererCommon::setCurID(byte id)
{
@@ -388,3 +389,78 @@ void CharsetRendererClassic::drawBits(VirtScreen *vs, byte *dst, byte *mask, int
mask += _vm->gdi._numStrips;
}
}
+
+CharsetRendererNut::CharsetRendererNut(Scumm *vm)
+ : CharsetRenderer(vm)
+{
+ _current = 0;
+
+ for (int i = 0; i < 4; i++) {
+ char fontname[256];
+ sprintf(fontname, "resource/font%d.nut", i);
+ warning("Loading charset %s\n", fontname);
+ _fr[i] = new NutRenderer(_vm);
+ if (!(_fr[i]->loadFont(fontname, _vm->getGameDataPath()))) {
+ delete _fr[i];
+ _fr[i] = NULL;
+ }
+
+ _fr[i]->bindDisplay(_vm->virtscr[0].screenPtr, _vm->_realWidth, _vm->_realHeight, _vm->_realWidth);
+ }
+}
+
+CharsetRendererNut::~CharsetRendererNut()
+{
+ for (int i = 0; i < 4; i++)
+ delete _fr[i];
+}
+
+void CharsetRendererNut::setCurID(byte id)
+{
+ assert(id < 4);
+ _curId = id;
+ _current = _fr[id];
+}
+
+int CharsetRendererNut::getCharWidth(byte chr)
+{
+ assert(_current);
+ return _current->getCharWidth(chr);
+}
+
+int CharsetRendererNut::getFontHeight()
+{
+ // FIXME / TODO: how to implement this properly???
+ assert(_current);
+ return _current->getCharHeight('|');
+}
+
+void CharsetRendererNut::printChar(int chr)
+{
+ assert(_current);
+
+ if (chr == '@')
+ return;
+
+ if (_firstChar) {
+ _strLeft = _left;
+ _strTop = _top;
+ _strRight = _left;
+ _strBottom = _top;
+ _firstChar = false;
+ }
+
+ int width = _current->getCharWidth(chr);
+ int height = _current->getCharHeight(chr);
+
+ _current->drawChar((char)chr, _left, _top, _color);
+ _vm->updateDirtyRect(0, _left, _left + width, _top, _top + height, 0);
+
+ _left += width;
+ if (_left > _strRight)
+ _strRight = _left;
+
+ if (_top + height > _strBottom)
+ _strBottom = _top + height;
+}
+