Inventory icons are now loaded correctly (not yet displayed). BRA doesn't crash anymore when pressing the right button. :)

svn-id: r33335
This commit is contained in:
Nicola Mettifogo 2008-07-27 13:43:40 +00:00
parent 7e7468b322
commit d223e90002
4 changed files with 54 additions and 2 deletions

View File

@ -211,6 +211,7 @@ protected:
Font *createFont(const char *name, Common::ReadStream &stream);
Sprites* createSprites(Common::ReadStream &stream);
void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette);
GfxObj* createInventoryObjects(Common::SeekableReadStream &stream);
public:
DosDisk_br(Parallaction *vm);

View File

@ -237,7 +237,15 @@ Font* DosDisk_br::loadFont(const char* name) {
GfxObj* DosDisk_br::loadObjects(const char *name) {
debugC(5, kDebugDisk, "DosDisk_br::loadObjects");
return 0;
char path[PATH_LEN];
sprintf(path, "%s/%s", _partPath, name);
Common::File stream;
if (!stream.open(path))
errorFileNotFound(path);
return createInventoryObjects(stream);
}
void genSlidePath(char *path, const char* name) {

View File

@ -35,6 +35,7 @@ extern byte _amigaTopazFont[];
class BraFont : public Font {
protected:
byte *_cp;
uint _bufPitch;
@ -173,6 +174,42 @@ byte BraFont::_charMap[] = {
};
class BraInventoryObjects : public BraFont, public Frames {
public:
BraInventoryObjects(Common::ReadStream &stream) : BraFont(stream) {
}
// Frames implementation
uint16 getNum() {
return _numGlyphs;
}
byte* getData(uint16 index) {
assert(index < _numGlyphs);
return _data + _height * index + _widths[index];
}
void getRect(uint16 index, Common::Rect &r) {
assert(index < _numGlyphs);
r.left = 0;
r.top = 0;
r.setWidth(_widths[index]);
r.setHeight(_height);
}
uint getRawSize(uint16 index) {
assert(index < _numGlyphs);
return _widths[index] * _height;
}
uint getSize(uint16 index) {
assert(index < _numGlyphs);
return _widths[index] * _height;
}
};
class DosFont : public Font {
protected:
@ -545,6 +582,12 @@ Font *AmigaDisk_br::createFont(const char *name, Common::SeekableReadStream &str
return new AmigaFont(stream);
}
GfxObj* DosDisk_br::createInventoryObjects(Common::SeekableReadStream &stream) {
Frames *frames = new BraInventoryObjects(stream);
return new GfxObj(0, frames, "inventoryobjects");
}
void Parallaction_ns::initFonts() {
if (getPlatform() == Common::kPlatformPC) {

View File

@ -174,7 +174,7 @@ void Parallaction_br::initPart() {
_objectsNames = _disk->loadTable("objects");
_countersNames = _disk->loadTable("counters");
// _disk->loadObjects("icone.ico");
_char._objs = _disk->loadObjects("icone.ico");
}