mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 07:11:49 +00:00
Skeleton for hacky font support using Smush's FontRenderer. Doesn't work (uncomment the loadFont line in script_v8 to test).
Aquadran, where are you? :) svn-id: r6114
This commit is contained in:
parent
1b0963dd76
commit
e1a416c031
@ -1326,7 +1326,7 @@ void Scumm::drawBlastObject(BlastObject *eo)
|
||||
if (!bomp)
|
||||
error("object %d is not a blast object", eo->number);
|
||||
|
||||
hexdump(bomp,32);
|
||||
//hexdump(bomp,32);
|
||||
|
||||
if (_features & GF_AFTER_V8) {
|
||||
bdd.srcwidth = READ_LE_UINT32(&((BompHeader *)bomp)->v8.width);
|
||||
|
@ -26,6 +26,9 @@
|
||||
#include "sound.h"
|
||||
#include "verbs.h"
|
||||
|
||||
#include "smush/player.h"
|
||||
#include "smush/frenderer.h"
|
||||
|
||||
/*
|
||||
* NO, we do NOT support CMI yet :-) This file is mostly a placeholder and a place
|
||||
* to grow real support in. For now, only a few opcodes are implemented, and they
|
||||
@ -34,6 +37,17 @@
|
||||
|
||||
#define OPCODE(x) { &Scumm_v8::x, #x }
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
void Scumm_v8::setupOpcodes()
|
||||
{
|
||||
// TODO: any of the o6_ entries are potentially wrong and pure guesses :-)
|
||||
@ -493,7 +507,8 @@ void Scumm_v8::decodeParseString(int m, int n)
|
||||
break;
|
||||
case 0xCD: // SO_PRINT_CHARSET Set print character set
|
||||
// FIXME - TODO
|
||||
pop();
|
||||
_string[m].charset = pop();
|
||||
printf("so_print_charset(%d)\n", _string[m].charset);
|
||||
break;
|
||||
case 0xCE:
|
||||
_string[m].center = false;
|
||||
@ -506,15 +521,23 @@ void Scumm_v8::decodeParseString(int m, int n)
|
||||
case 0xD0: // SO_PRINT_MUMBLE
|
||||
error("decodeParseString: SO_PRINT_MUMBLE");
|
||||
break;
|
||||
case 0xD1:
|
||||
case 0xD1: {
|
||||
// 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);
|
||||
}
|
||||
|
||||
// printf("Message(%d): '%s'\n", m, buffer);
|
||||
break;
|
||||
}
|
||||
case 0xD2: // SO_PRINT_WRAP Set print wordwrap
|
||||
error("decodeParseString: SO_PRINT_MUMBLE");
|
||||
break;
|
||||
@ -729,11 +752,20 @@ void Scumm_v8::o8_cursorCommand()
|
||||
case 0xE6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
|
||||
makeCursorColorTransparent(pop());
|
||||
break;
|
||||
case 0xE7: // SO_CHARSET_SET
|
||||
case 0xE7: { // SO_CHARSET_SET
|
||||
// FIXME - TODO
|
||||
pop();
|
||||
// initCharset(pop());
|
||||
int charset = pop();
|
||||
if (_fr[charset] == NULL) {
|
||||
char fontname[255];
|
||||
sprintf(fontname, "resource/font%d.nut", charset);
|
||||
|
||||
// _fr[charset] = loadFont(fontname, getGameDataPath(), true);
|
||||
|
||||
if (!_fr[charset])
|
||||
warning("Failed to load font %d from %s%s\n", charset, getGameDataPath(), fontname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0xE8: // SO_CHARSET_COLOR
|
||||
getStackList(args, sizeof(args) / sizeof(args[0]));
|
||||
for (i = 0; i < 16; i++)
|
||||
@ -1125,6 +1157,7 @@ void Scumm_v8::o8_kludge()
|
||||
// TODO
|
||||
int16 args[30];
|
||||
getStackList(args, sizeof(args) / sizeof(args[0]));
|
||||
warning("o8_kludge %d\n", args[0]);
|
||||
|
||||
switch (args[0]) {
|
||||
case 11:
|
||||
@ -1177,7 +1210,7 @@ void Scumm_v8::o8_kludge2()
|
||||
// TODO
|
||||
int16 args[30];
|
||||
getStackList(args, sizeof(args) / sizeof(args[0]));
|
||||
|
||||
warning("o8_kludge2 %d\n", args[0]);
|
||||
switch (args[0]) {
|
||||
case 0xCE: // getRGBSlot
|
||||
case 0xD3: // getKeyState
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "common/timer.h"
|
||||
#include "common/util.h"
|
||||
|
||||
class FontRenderer;
|
||||
class GameDetector;
|
||||
class NewGui;
|
||||
class Dialog;
|
||||
@ -680,6 +681,9 @@ public:
|
||||
void actorTalk();
|
||||
void stopTalk();
|
||||
|
||||
/* FIXME: This should not be here, probably. Hack for CMI v8 fonts */
|
||||
FontRenderer *_fr[4];
|
||||
|
||||
/* Akos Class */
|
||||
|
||||
bool akos_increaseAnims(byte *akos, Actor *a);
|
||||
|
@ -161,7 +161,6 @@ public:
|
||||
@return \c true if everything went fine, \c false otherwise
|
||||
*/
|
||||
bool drawStringAbsolute(const char * str, char * buffer, const Point & size, int32 x, int32 y) const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -698,7 +698,7 @@ bool SmushPlayer::readString(const char * file, const char * directory, bool & f
|
||||
return false;
|
||||
}
|
||||
|
||||
static FontRenderer * loadFont(const char * file, const char * directory, bool original = false) {
|
||||
static FontRenderer *loadFont(const char * file, const char * directory, bool original = false) {
|
||||
#ifdef DEBUG
|
||||
debug(5, "loading font from \"%s\"", file);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user