mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 03:24:50 +00:00
ACCESS: Changed _objectsTable from raw data array to SpriteResource array
This commit is contained in:
parent
ba1f8b2f6b
commit
0e3f9e983d
@ -192,13 +192,17 @@ int AccessEngine::getRandomNumber(int maxNumber) {
|
||||
|
||||
void AccessEngine::loadCells(Common::Array<RoomInfo::CellIdent> &cells) {
|
||||
for (uint i = 0; i < cells.size(); ++i) {
|
||||
_objectsTable[cells[i]._cell] = _files->loadFile(
|
||||
cells[i]._fileNum, cells[i]._subfile);
|
||||
byte *spriteData = _files->loadFile(cells[i]._fileNum, cells[i]._subfile);
|
||||
_objectsTable[cells[i]._cell] = new SpriteResource(this,
|
||||
spriteData, _files->_filesize, DisposeAfterUse::YES);
|
||||
}
|
||||
}
|
||||
|
||||
void AccessEngine::clearCellTable() {
|
||||
Common::fill(&_objectsTable[0], &_objectsTable[100], (byte *)nullptr);
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
delete _objectsTable[i];
|
||||
_objectsTable[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessEngine::freeCells() {
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
ASurface *_current;
|
||||
ASurface _buffer1;
|
||||
ASurface _buffer2;
|
||||
byte *_objectsTable[100];
|
||||
SpriteResource *_objectsTable[100];
|
||||
int _establishTable[100];
|
||||
bool _establishFlag;
|
||||
int _establishMode;
|
||||
|
@ -125,8 +125,9 @@ void AmazonEngine::doTitle() {
|
||||
_screen->forceFadeIn();
|
||||
_sound->playSound(1);
|
||||
|
||||
_objectsTable[0] = _files->loadFile(0, 2);
|
||||
SpriteResource *spr = new SpriteResource(this, _objectsTable[0], _files->_filesize);
|
||||
byte *spriteData = _files->loadFile(0, 2);
|
||||
_objectsTable[0] = new SpriteResource(this, spriteData, _files->_filesize,
|
||||
DisposeAfterUse::YES);
|
||||
|
||||
_sound->playSound(1);
|
||||
|
||||
@ -143,11 +144,11 @@ void AmazonEngine::doTitle() {
|
||||
_buffer2.copyFrom(_buffer1);
|
||||
int id = READ_LE_UINT16(COUNTDOWN + _pCount * 4);
|
||||
int xp = READ_LE_UINT16(COUNTDOWN + _pCount * 4 + 2);
|
||||
_screen->plotImage(spr, id, Common::Point(xp, 71));
|
||||
_screen->plotImage(_objectsTable[0], id, Common::Point(xp, 71));
|
||||
}
|
||||
// TODO: More to do
|
||||
|
||||
delete spr;
|
||||
delete _objectsTable[0];
|
||||
}
|
||||
|
||||
void AmazonEngine::doOpening() {
|
||||
|
@ -28,7 +28,8 @@
|
||||
|
||||
namespace Access {
|
||||
|
||||
SpriteResource::SpriteResource(AccessEngine *vm, const byte *data, uint32 size) {
|
||||
SpriteResource::SpriteResource(AccessEngine *vm, const byte *data, uint32 size,
|
||||
DisposeAfterUse::Flag disposeMemory) {
|
||||
Common::MemoryReadStream stream(data, size);
|
||||
Common::Array<uint32> offsets;
|
||||
int count = stream.readUint16LE();
|
||||
@ -52,6 +53,9 @@ SpriteResource::SpriteResource(AccessEngine *vm, const byte *data, uint32 size)
|
||||
|
||||
_frames.push_back(frame);
|
||||
}
|
||||
|
||||
if (disposeMemory == DisposeAfterUse::YES)
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
SpriteResource::~SpriteResource() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "common/array.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/types.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Access {
|
||||
@ -71,7 +72,8 @@ class SpriteResource {
|
||||
public:
|
||||
Common::Array<SpriteFrame *> _frames;
|
||||
public:
|
||||
SpriteResource(AccessEngine *vm, const byte *data, uint32 size);
|
||||
SpriteResource(AccessEngine *vm, const byte *data, uint32 size,
|
||||
DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO);
|
||||
~SpriteResource();
|
||||
|
||||
int getCount() { return _frames.size(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user