mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-12 22:51:11 +00:00
GLK: FROTZ: Improved palette reading
This commit is contained in:
parent
1c75912ecf
commit
acb39303f1
@ -149,13 +149,7 @@ Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String
|
||||
error("Reading failed");
|
||||
|
||||
if (e._dataSize) {
|
||||
if (e._paletteOffset) {
|
||||
// Read in the image's palette
|
||||
assert(e._paletteOffset);
|
||||
f.seek(e._paletteOffset);
|
||||
_palette->resize(f.readByte() * 3);
|
||||
f.read(&(*_palette)[0], _palette->size());
|
||||
}
|
||||
loadPalette(f, e, *_palette);
|
||||
|
||||
f.seek(e._dataOffset);
|
||||
Common::SeekableReadStream *src = f.readStream(e._dataSize);
|
||||
@ -176,5 +170,20 @@ Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Pics::loadPalette(Common::File &f, const Entry &e, Common::Array<byte> &palette) const {
|
||||
if (e._paletteOffset) {
|
||||
// Read in the image's palette
|
||||
assert(e._paletteOffset);
|
||||
f.seek(e._paletteOffset);
|
||||
_palette->resize(f.readByte() * 3);
|
||||
f.read(&(*_palette)[0], _palette->size());
|
||||
}
|
||||
|
||||
if (e._flags & 1) {
|
||||
byte *entry = &palette[(e._flags >> 12) * 3];
|
||||
Common::fill(entry, entry + 3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Frotz
|
||||
} // End of namespace Glk
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "common/archive.h"
|
||||
#include "common/array.h"
|
||||
#include "common/file.h"
|
||||
|
||||
namespace Glk {
|
||||
namespace Frotz {
|
||||
@ -71,6 +72,11 @@ private:
|
||||
* Returns the filename for the pictures archive
|
||||
*/
|
||||
static Common::String getFilename();
|
||||
|
||||
/**
|
||||
* Read in the palette
|
||||
*/
|
||||
void loadPalette(Common::File &f, const Entry &e, Common::Array<byte> &palette) const;
|
||||
public:
|
||||
/**
|
||||
* Returns true if an mg1 file exists for the game
|
||||
|
Loading…
x
Reference in New Issue
Block a user