[Scummvm-cvs-logs] SF.net SVN: scummvm: [31698] scummvm/trunk/engines/made

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Apr 24 20:45:11 CEST 2008


Revision: 31698
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31698&view=rev
Author:   thebluegr
Date:     2008-04-24 11:45:11 -0700 (Thu, 24 Apr 2008)

Log Message:
-----------
Some initial code for font loading
Implemented opcode o1_LOADANIM

Modified Paths:
--------------
    scummvm/trunk/engines/made/resource.cpp
    scummvm/trunk/engines/made/resource.h
    scummvm/trunk/engines/made/screen.h
    scummvm/trunk/engines/made/scriptfuncs.cpp

Modified: scummvm/trunk/engines/made/resource.cpp
===================================================================
--- scummvm/trunk/engines/made/resource.cpp	2008-04-24 17:50:15 UTC (rev 31697)
+++ scummvm/trunk/engines/made/resource.cpp	2008-04-24 18:45:11 UTC (rev 31698)
@@ -221,6 +221,22 @@
 	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 @@
 	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

Modified: scummvm/trunk/engines/made/resource.h
===================================================================
--- scummvm/trunk/engines/made/resource.h	2008-04-24 17:50:15 UTC (rev 31697)
+++ scummvm/trunk/engines/made/resource.h	2008-04-24 18:45:11 UTC (rev 31698)
@@ -45,7 +45,8 @@
 	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 @@
 	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 @@
 	SoundResource *getSound(int index);
 	MenuResource *getMenu(int index);
 	XmidiResource *getXmidi(int index);
+	FontResource *getFont(int index);
 
 	void freeResource(Resource *resource);
 

Modified: scummvm/trunk/engines/made/screen.h
===================================================================
--- scummvm/trunk/engines/made/screen.h	2008-04-24 17:50:15 UTC (rev 31697)
+++ scummvm/trunk/engines/made/screen.h	2008-04-24 18:45:11 UTC (rev 31698)
@@ -70,6 +70,7 @@
 	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 @@
 	byte _palette[768], _newPalette[768], _fxPalette[768];
 	int _paletteColorCount, _oldPaletteColorCount;
 	bool _paletteInitialized, _needPalette;
+	uint16 _currentFont;
 
 	uint16 _clip, _exclude, _ground;
 	int _visualEffectNum;

Modified: scummvm/trunk/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/trunk/engines/made/scriptfuncs.cpp	2008-04-24 17:50:15 UTC (rev 31697)
+++ scummvm/trunk/engines/made/scriptfuncs.cpp	2008-04-24 18:45:11 UTC (rev 31698)
@@ -422,6 +422,10 @@
 
 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_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_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;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list