[Scummvm-cvs-logs] SF.net SVN: scummvm:[44483] scummvm/trunk/graphics
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Wed Sep 30 15:07:12 CEST 2009
Revision: 44483
http://scummvm.svn.sourceforge.net/scummvm/?rev=44483&view=rev
Author: lordhoto
Date: 2009-09-30 13:07:12 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
Update SJIS code to read SJIS.FNT version 2 data (no support for drawing ASCII and half-width katakana glyphs yet).
Modified Paths:
--------------
scummvm/trunk/graphics/sjis.cpp
scummvm/trunk/graphics/sjis.h
Modified: scummvm/trunk/graphics/sjis.cpp
===================================================================
--- scummvm/trunk/graphics/sjis.cpp 2009-09-30 13:05:53 UTC (rev 44482)
+++ scummvm/trunk/graphics/sjis.cpp 2009-09-30 13:07:12 UTC (rev 44483)
@@ -245,18 +245,20 @@
}
uint32 version = data->readUint32BE();
- if (version != 1) {
+ if (version != 2) {
delete data;
return false;
}
- uint numChars = data->readUint16BE();
+ uint numChars16x16 = data->readUint16BE();
+ /*uint numChars8x16 = */data->readUint16BE();
- _fontData = new uint16[numChars * 16];
- assert(_fontData);
+ _fontData16x16 = new uint16[numChars16x16 * 16];
+ assert(_fontData16x16);
+ _fontData16x16Size = numChars16x16 * 16;
- for (uint i = 0; i < numChars * 16; ++i)
- _fontData[i] = data->readUint16BE();
-
+ for (uint i = 0; i < _fontData16x16Size; ++i)
+ _fontData16x16[i] = data->readUint16BE();
+
bool retValue = !data->err();
delete data;
return retValue;
@@ -285,7 +287,9 @@
if (index < 0 || index >= 0xBC || base < 0)
return 0;
- return _fontData + (base * 0xBC + index) * 16;
+ const uint offset = (base * 0xBC + index) * 16;
+ assert(offset + 16 <= _fontData16x16Size);
+ return _fontData16x16 + offset;
}
} // end of namespace Graphics
Modified: scummvm/trunk/graphics/sjis.h
===================================================================
--- scummvm/trunk/graphics/sjis.h 2009-09-30 13:05:53 UTC (rev 44482)
+++ scummvm/trunk/graphics/sjis.h 2009-09-30 13:07:12 UTC (rev 44483)
@@ -168,8 +168,8 @@
*/
class FontSjisSVM : public FontSJIS16x16 {
public:
- FontSjisSVM() : _fontData(0) {}
- ~FontSjisSVM() { delete[] _fontData; }
+ FontSjisSVM() : _fontData16x16(0), _fontData16x16Size(0) {}
+ ~FontSjisSVM() { delete[] _fontData16x16; }
/**
* Load the font data from "SJIS.FNT".
@@ -177,7 +177,8 @@
bool loadData();
private:
- uint16 *_fontData;
+ uint16 *_fontData16x16;
+ uint _fontData16x16Size;
const uint16 *getCharData(uint16 c) const;
};
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