SAGA2: Move tileImageBanks to Saga2Engine

This commit is contained in:
a/ 2021-07-18 13:57:29 +09:00
parent 38057f51d0
commit fa2eedced5
5 changed files with 10 additions and 21 deletions

View File

@ -90,6 +90,7 @@ Saga2Engine::Saga2Engine(OSystem *syst)
_edpList = nullptr;
_sdpList = nullptr;
_containerList = nullptr;
_tileImageBanks = nullptr;
}
Saga2Engine::~Saga2Engine() {

View File

@ -68,6 +68,7 @@ class Properties;
class PlayerActor;
class ProtoObj;
class ActorProto;
class HandleArray;
enum {
kDebugResources = 1 << 0,
@ -150,6 +151,7 @@ public:
ActiveRegion *_activeRegionList;
gToolBase *_toolBase;
Properties *_properties;
HandleArray *_tileImageBanks;
gDisplayPort _mainPort;
gPort _backPort;

View File

@ -96,7 +96,6 @@ void setAreaSound(const TilePoint &baseCoords);
* ===================================================================== */
TileBankPtr tileBanks[maxBanks];
extern HandleArray tileImageBanks;
void updateHandleRefs(const TilePoint &pt); //, StandingTileInfo *stiResult )
void updateFrameCount(void);
@ -284,7 +283,7 @@ TileInfo *TileInfo::tileAddress(TileID id, uint8 **imageData) {
}
if (ti != nullptr) {
if ((tibh = tileImageBanks[tileBank]) != nullptr)
if ((tibh = (*g_vm->_tileImageBanks)[tileBank]) != nullptr)
*imageData = &tibh[ti->offset];
else
*imageData = nullptr;

View File

@ -35,7 +35,7 @@
namespace Saga2 {
const uint16 tileBankCount = 25;
const uint16 tileBankCount = 64;
const uint32 tileImageID = MKTAG('T', 'I', 'L', 0);
@ -52,31 +52,16 @@ static byte *tileResLoad(hResID i, bool asynch = false) {
return nullptr;
}
HandleArray tileImageBanks(64, tileResLoad, tileImageID);
void initTileBank(int16 bankNum) {
}
void RHeapsAMess(void);
void freeAllTileBanks(void) {
tileImageBanks.flush();
}
void unlockAllTileBanks(void) {
tileImageBanks.flush();
}
void freeTileBank(int16) {
g_vm->_tileImageBanks->flush();
}
void updateHandleRefs(const TilePoint &) { //, StandingTileInfo *stiResult )
tileImageBanks.flush();
g_vm->_tileImageBanks->flush();
}
void initTileBanks(void) {
for (int16 i = 0; i < tileBankCount; i++)
initTileBank(i);
g_vm->_tileImageBanks = new HandleArray(tileBankCount, tileResLoad, tileImageID);
}
void drawPlatform(

View File

@ -42,6 +42,7 @@
#include "saga2/uidialog.h"
#include "saga2/contain.h"
#include "saga2/saveload.h"
#include "saga2/oncall.h"
namespace Saga2 {
@ -679,6 +680,7 @@ void TileModeCleanup(void) {
tileControls->enable(false);
freeAllTileBanks();
delete g_vm->_tileImageBanks;
// freePalette();