mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
Some initial code for font loading
Implemented opcode o1_LOADANIM svn-id: r31698
This commit is contained in:
parent
dd1ae2dd4f
commit
b861f38d10
@ -221,6 +221,22 @@ void XmidiResource::load(byte *source, int size) {
|
||||
memcpy(_data, source, size);
|
||||
}
|
||||
|
||||
/* FontResource */
|
||||
|
||||
FontResource::FontResource() : _data(NULL), _size(0) {
|
||||
}
|
||||
|
||||
FontResource::~FontResource() {
|
||||
if (_data)
|
||||
delete[] _data;
|
||||
}
|
||||
|
||||
void FontResource::load(byte *source, int size) {
|
||||
_data = new byte[size];
|
||||
_size = size;
|
||||
memcpy(_data, source, size);
|
||||
}
|
||||
|
||||
/* ProjectReader */
|
||||
|
||||
ProjectReader::ProjectReader() {
|
||||
@ -289,6 +305,10 @@ XmidiResource *ProjectReader::getXmidi(int index) {
|
||||
return createResource<XmidiResource>(kResXMID, index);
|
||||
}
|
||||
|
||||
FontResource *ProjectReader::getFont(int index) {
|
||||
return createResource<FontResource>(kResFONT, index);
|
||||
}
|
||||
|
||||
void ProjectReader::loadIndex(ResourceSlots *slots) {
|
||||
_fd->readUint32LE(); // skip INDX
|
||||
_fd->readUint32LE(); // skip index size
|
||||
|
@ -45,7 +45,8 @@ enum ResourceType {
|
||||
kResSNDS = MKID_BE('SNDS'),
|
||||
kResANIM = MKID_BE('ANIM'),
|
||||
kResMENU = MKID_BE('MENU'),
|
||||
kResXMID = MKID_BE('XMID')
|
||||
kResXMID = MKID_BE('XMID'),
|
||||
kResFONT = MKID_BE('FONT')
|
||||
};
|
||||
|
||||
struct ResourceSlot;
|
||||
@ -123,6 +124,19 @@ protected:
|
||||
int _size;
|
||||
};
|
||||
|
||||
// TODO
|
||||
class FontResource : public Resource {
|
||||
public:
|
||||
FontResource();
|
||||
~FontResource();
|
||||
void load(byte *source, int size);
|
||||
byte *getData() const { return _data; }
|
||||
int getSize() const { return _size; }
|
||||
protected:
|
||||
byte *_data;
|
||||
int _size;
|
||||
};
|
||||
|
||||
struct ResourceSlot {
|
||||
uint32 offs;
|
||||
uint32 size;
|
||||
@ -147,6 +161,7 @@ public:
|
||||
SoundResource *getSound(int index);
|
||||
MenuResource *getMenu(int index);
|
||||
XmidiResource *getXmidi(int index);
|
||||
FontResource *getFont(int index);
|
||||
|
||||
void freeResource(Resource *resource);
|
||||
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
void setClip(uint16 clip) { _clip = clip; }
|
||||
void setExclude(uint16 exclude) { _exclude = exclude; }
|
||||
void setGround(uint16 ground) { _ground = ground; }
|
||||
void setFont(uint16 font) { _currentFont = font; }
|
||||
|
||||
uint16 updateChannel(uint16 channelIndex);
|
||||
void deleteChannel(uint16 channelIndex);
|
||||
@ -115,6 +116,7 @@ protected:
|
||||
byte _palette[768], _newPalette[768], _fxPalette[768];
|
||||
int _paletteColorCount, _oldPaletteColorCount;
|
||||
bool _paletteInitialized, _needPalette;
|
||||
uint16 _currentFont;
|
||||
|
||||
uint16 _clip, _exclude, _ground;
|
||||
int _visualEffectNum;
|
||||
|
@ -422,6 +422,10 @@ int16 ScriptFunctionsRtz::o1_PALETTELOCK(int16 argc, int16 *argv) {
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_FONT(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_FONT");
|
||||
|
||||
uint16 fontID = argv[0];
|
||||
printf("Set font to %i\n", fontID);
|
||||
_vm->_screen->setFont(fontID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -442,6 +446,11 @@ int16 ScriptFunctionsRtz::o1_TEXTRECT(int16 argc, int16 *argv) {
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_TEXTXY(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_TEXTXY");
|
||||
|
||||
int16 x = CLIP<int16>(argv[0], 1, 318);
|
||||
int16 y = CLIP<int16>(argv[1], 1, 198);
|
||||
|
||||
printf("Text: x = %i, y = %i\n", x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -717,7 +726,11 @@ int16 ScriptFunctionsRtz::o1_DRAWANIMPIC(int16 argc, int16 *argv) {
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_LOADANIM(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_LOADANIM");
|
||||
AnimationResource *anim = _vm->_res->getAnimation(argv[0]);
|
||||
if (anim) {
|
||||
_vm->_res->freeResource(anim);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user