[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.5,2.6 charset.h,2.5,2.6 intern.h,2.19,2.20 script_v8.cpp,2.47,2.48 scummvm.cpp,2.14,2.15
Max Horn
fingolfin at users.sourceforge.net
Wed Dec 25 17:48:02 CET 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv2521
Modified Files:
charset.cpp charset.h intern.h script_v8.cpp scummvm.cpp
Log Message:
reuse the old (ugly nasty dreaded) string system for V8, too (by supplying a NUT based CharsetRenderer)
Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- charset.cpp 26 Dec 2002 00:21:19 -0000 2.5
+++ charset.cpp 26 Dec 2002 01:47:40 -0000 2.6
@@ -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 @@
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;
+}
+
Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- charset.h 26 Dec 2002 00:21:19 -0000 2.5
+++ charset.h 26 Dec 2002 01:47:40 -0000 2.6
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
class Scumm;
+class NutRenderer;
struct VirtScreen;
class CharsetRenderer {
@@ -46,6 +47,7 @@
protected:
Scumm *_vm;
+ byte _curId;
virtual int getCharWidth(byte chr) = 0;
@@ -59,7 +61,7 @@
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
virtual void setCurID(byte id) = 0;
- virtual int getCurID() = 0;
+ int getCurID() { return _curId; }
virtual int getFontHeight() = 0;
};
@@ -67,14 +69,12 @@
class CharsetRendererCommon : public CharsetRenderer {
protected:
- byte _curId;
byte *_fontPtr;
public:
CharsetRendererCommon(Scumm *vm) : CharsetRenderer(vm) {}
void setCurID(byte id);
- int getCurID() { return _curId; }
int getFontHeight() { return _fontPtr[1]; }
};
@@ -104,20 +104,22 @@
void printChar(int chr);
};
-/*
-class CharsetRendererNUT : public CharsetRenderer {
+class CharsetRendererNut : public CharsetRenderer {
protected:
int getCharWidth(byte chr);
NutRenderer *_fr[4];
+ NutRenderer *_current;
public:
- CharsetRendererNUT(Scumm *vm) : CharsetRenderer(vm) {}
+ CharsetRendererNut(Scumm *vm);
+ ~CharsetRendererNut();
void printChar(int chr);
void setCurID(byte id);
+
+ int getFontHeight();
};
-*/
#endif
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -d -r2.19 -r2.20
--- intern.h 25 Dec 2002 19:06:31 -0000 2.19
+++ intern.h 26 Dec 2002 01:47:40 -0000 2.20
@@ -407,9 +407,10 @@
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_wait();
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.47
retrieving revision 2.48
diff -u -d -r2.47 -r2.48
--- script_v8.cpp 26 Dec 2002 00:21:19 -0000 2.47
+++ script_v8.cpp 26 Dec 2002 01:47:40 -0000 2.48
@@ -37,6 +37,7 @@
#define OPCODE(x) { &Scumm_v8::x, #x }
+/*
// FIXME: Move this somewhere better :)
void Scumm_v8::loadCharset(int charset) {
char fontname[256];
@@ -51,6 +52,7 @@
_fr[charset]->bindDisplay(virtscr[0].screenPtr, _realWidth, _realHeight, _realWidth);
}
+*/
void Scumm_v8::setupOpcodes()
{
@@ -528,6 +530,62 @@
break;
case 0xD1: {
+#if 1
+ _messagePtr = _scriptPointer;
+
+ if (_messagePtr[0] == '/') {
+ char pointer[20];
+ int i, j;
+
+ _scriptPointer += resStrLen((char*)_scriptPointer)+ 1;
+ translateText(_messagePtr, _transText);
+ for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) {
+ if (_messagePtr[i] != '/')
+ pointer[j++] = _messagePtr[i];
+ }
+ pointer[j] = 0;
+
+ // Stop any talking that's still going on
+ if (_sound->_talkChannel > -1)
+ _mixer->stop(_sound->_talkChannel);
+
+// _sound->_talkChannel = _sound->playBundleSound(pointer);
+ _messagePtr = _transText;
+
+ switch (m) {
+ case 0:
+ actorTalk();
+ break;
+ case 1:
+ drawString(1);
+ break;
+ case 2:
+ unkMessage1();
+ break;
+ case 3:
+ unkMessage2();
+ break;
+ }
+ return;
+ } else {
+ switch (m) {
+ case 0:
+ actorTalk();
+ break;
+ case 1:
+ drawString(1);
+ break;
+ case 2:
+ unkMessage1();
+ break;
+ case 3:
+ unkMessage2();
+ break;
+ }
+ _scriptPointer = _messagePtr;
+ return;
+ }
+#else
char buffer[1024];
_messagePtr = _scriptPointer;
@@ -579,6 +637,7 @@
x -= _fr[_string[m].charset]->getStringWidth(buffer) / 2;
_fr[_string[m].charset]->drawString(buffer, x, _string[m].ypos, _string[m].color, 0);
}
+#endif
break;
}
case 0xD2: // SO_PRINT_WRAP Set print wordwrap
@@ -731,7 +790,7 @@
void Scumm_v8::o8_blastText()
{
// FIXME
- decodeParseString(2, 0);
+ decodeParseString(1, 0);
}
void Scumm_v8::o8_cursorCommand()
@@ -789,7 +848,8 @@
break;
case 0xE7: { // SO_CHARSET_SET
int charset = pop();
- loadCharset(charset);
+ warning("Set userface charset to %d\n", charset);
+// loadCharset(charset);
break;
}
case 0xE8: // SO_CHARSET_COLOR
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -d -r2.14 -r2.15
--- scummvm.cpp 26 Dec 2002 01:15:25 -0000 2.14
+++ scummvm.cpp 26 Dec 2002 01:47:40 -0000 2.15
@@ -207,8 +207,16 @@
else
_resourceHeaderSize = 8;
+ if (_features & GF_AFTER_V7) {
+ initScreens(0, 0, _realWidth, _realHeight);
+ } else {
+ initScreens(0, 16, _realWidth, 144);
+ }
+
if (_features & GF_OLD256)
_charset = new CharsetRendererOld256(this);
+ else if (_features & GF_AFTER_V8)
+ _charset = new CharsetRendererNut(this);
else
_charset = new CharsetRendererClassic(this);
@@ -216,12 +224,6 @@
if (!(_features & GF_SMALL_NAMES) && !(_features & GF_AFTER_V8))
loadCharset(1);
-
- if (_features & GF_AFTER_V7) {
- initScreens(0, 0, _realWidth, _realHeight);
- } else {
- initScreens(0, 16, _realWidth, 144);
- }
setShake(0);
setupCursor();
More information about the Scummvm-git-logs
mailing list