diff options
Diffstat (limited to 'engines/m4/assets.cpp')
-rw-r--r-- | engines/m4/assets.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 14857e6f2b..91c371dec5 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -30,13 +30,13 @@ namespace M4 { -BaseAsset::BaseAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : _vm(vm) { +BaseAsset::BaseAsset(MadsM4Engine *vm) : _vm(vm) { } BaseAsset::~BaseAsset() { } -MachineAsset::MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) { +MachineAsset::MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) { uint32 stateCount = stream->readUint32LE(); for (uint32 curState = 0; curState < stateCount; curState++) { uint32 stateOffset = stream->readUint32LE(); @@ -61,7 +61,7 @@ uint32 MachineAsset::getStateOffset(uint32 state) { return _stateTable[state]; } -SequenceAsset::SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) { +SequenceAsset::SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) { _localVarCount = stream->readUint32LE(); _codeSize = size - 4; _code = new byte[_codeSize]; @@ -78,7 +78,7 @@ void SequenceAsset::getCode(byte *&code, uint32 &codeSize) { } -DataAsset::DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm, stream, size, name) { +DataAsset::DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) { _recCount = stream->readUint32LE(); _recSize = stream->readUint32LE(); @@ -98,7 +98,8 @@ long *DataAsset::getRow(int index) { return &_data[_recSize * index]; } -SpriteAsset::SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream) : BaseAsset(vm, stream, size, name) { +SpriteAsset::SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name, bool asStream) : + BaseAsset(vm) { _stream = stream; _palInterface = NULL; _paletteData = NULL; @@ -110,6 +111,20 @@ SpriteAsset::SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, i } } +SpriteAsset::SpriteAsset(MadsM4Engine *vm, const char *name): BaseAsset(vm) { + _stream = vm->res()->get(name); + _palInterface = NULL; + _paletteData = NULL; + + if (_vm->isM4()) { + loadM4SpriteAsset(vm, _stream, true); + } else { + loadMadsSpriteAsset(vm, _stream); + } + + vm->res()->toss(name); +} + SpriteAsset::~SpriteAsset() { if (_palInterface) { // Internally stored palette translation data, so release it |