SCUMM: Move class ResourceManager to its own header

This commit is contained in:
Max Horn 2011-05-11 16:03:50 +02:00
parent 7773a17b0a
commit b37463fe59
17 changed files with 86 additions and 65 deletions

View File

@ -27,6 +27,7 @@
#include "scumm/imuse/imuse.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/he/intern_he.h"
#include "scumm/resource.h"
#include "scumm/scumm_v7.h"
#include "scumm/sound.h"
#include "scumm/util.h"

View File

@ -23,6 +23,7 @@
#include "scumm/scumm.h"
#include "scumm/actor.h"
#include "scumm/boxes.h"
#include "scumm/resource.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v6.h"
#include "scumm/util.h"

View File

@ -31,6 +31,7 @@
#include "scumm/debugger.h"
#include "scumm/imuse/imuse.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"

View File

@ -40,6 +40,7 @@
#include "scumm/scumm_v8.h"
#include "scumm/file.h"
#include "scumm/file_nes.h"
#include "scumm/resource.h"
#include "engines/metaengine.h"

View File

@ -23,6 +23,7 @@
#include "scumm/actor.h"
#include "scumm/file.h"
#include "scumm/imuse/imuse.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/he/sound_he.h"
#include "scumm/he/intern_he.h"

View File

@ -28,6 +28,7 @@
#include "audio/decoders/vorbis.h"
#include "audio/decoders/mp3.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/util.h"
#include "scumm/imuse_digi/dimuse.h"

View File

@ -35,6 +35,7 @@
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
#endif
#include "scumm/resource.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v6.h"
#include "scumm/scumm_v8.h"

View File

@ -28,6 +28,7 @@
#include "scumm/actor.h"
#include "scumm/file.h"
#include "scumm/resource.h"
#include "scumm/scumm_v7.h"
#include "scumm/sound.h"

View File

@ -22,6 +22,8 @@
#ifndef SCUMM_RESOURCE_H
#define SCUMM_RESOURCE_H
#include "scumm/scumm.h" // for rtNumTypes
namespace Scumm {
enum {
@ -41,6 +43,74 @@ public:
const byte *findNext(uint32 tag);
};
enum {
RES_INVALID_OFFSET = 0xFFFFFFFF
};
class ScummEngine;
/**
* The 'resource manager' class. Currently doesn't really deserve to be called
* a 'class', at least until somebody gets around to OOfying this more.
*/
class ResourceManager {
//friend class ScummDebugger;
//friend class ScummEngine;
protected:
ScummEngine *_vm;
public:
byte mode[rtNumTypes];
uint16 num[rtNumTypes];
uint32 tags[rtNumTypes];
const char *name[rtNumTypes];
byte **address[rtNumTypes];
protected:
byte *flags[rtNumTypes];
byte *status[rtNumTypes];
public:
byte *roomno[rtNumTypes];
uint32 *roomoffs[rtNumTypes];
uint32 *globsize[rtNumTypes];
protected:
uint32 _allocatedSize;
uint32 _maxHeapThreshold, _minHeapThreshold;
byte _expireCounter;
public:
ResourceManager(ScummEngine *vm);
~ResourceManager();
void setHeapThreshold(int min, int max);
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
void freeResources();
byte *createResource(int type, int index, uint32 size);
void nukeResource(int type, int i);
bool isResourceLoaded(int type, int index) const;
void lock(int type, int i);
void unlock(int type, int i);
bool isLocked(int type, int i) const;
void setModified(int type, int i);
bool isModified(int type, int i) const;
void increaseExpireCounter();
void setResourceCounter(int type, int index, byte flag);
void increaseResourceCounter();
void resourceStats();
//protected:
bool validateResource(const char *str, int type, int index) const;
protected:
void expireResources(uint32 size);
};
} // End of namespace Scumm
#endif

View File

@ -23,6 +23,7 @@
#include "scumm/scumm_v3.h"
#include "scumm/file.h"
#include "scumm/resource.h"
#include "scumm/util.h"
namespace Scumm {

View File

@ -24,6 +24,7 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/scumm_v0.h"
#include "scumm/verbs.h"

View File

@ -23,6 +23,7 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/scumm_v2.h"
#include "scumm/sound.h"
#include "scumm/util.h"

View File

@ -23,6 +23,7 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/scumm_v3.h"
#include "scumm/scumm_v5.h"
#include "scumm/sound.h"

View File

@ -62,6 +62,7 @@
#include "scumm/player_v2a.h"
#include "scumm/player_v3a.h"
#include "scumm/player_v4a.h"
#include "scumm/resource.h"
#include "scumm/he/resource_he.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v8.h"

View File

@ -346,71 +346,7 @@ enum ResTypes {
rtNumTypes = 22
};
enum {
RES_INVALID_OFFSET = 0xFFFFFFFF
};
/**
* The 'resource manager' class. Currently doesn't really deserve to be called
* a 'class', at least until somebody gets around to OOfying this more.
*/
class ResourceManager {
//friend class ScummDebugger;
//friend class ScummEngine;
protected:
ScummEngine *_vm;
public:
byte mode[rtNumTypes];
uint16 num[rtNumTypes];
uint32 tags[rtNumTypes];
const char *name[rtNumTypes];
byte **address[rtNumTypes];
protected:
byte *flags[rtNumTypes];
byte *status[rtNumTypes];
public:
byte *roomno[rtNumTypes];
uint32 *roomoffs[rtNumTypes];
uint32 *globsize[rtNumTypes];
protected:
uint32 _allocatedSize;
uint32 _maxHeapThreshold, _minHeapThreshold;
byte _expireCounter;
public:
ResourceManager(ScummEngine *vm);
~ResourceManager();
void setHeapThreshold(int min, int max);
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
void freeResources();
byte *createResource(int type, int index, uint32 size);
void nukeResource(int type, int i);
bool isResourceLoaded(int type, int index) const;
void lock(int type, int i);
void unlock(int type, int i);
bool isLocked(int type, int i) const;
void setModified(int type, int i);
bool isModified(int type, int i) const;
void increaseExpireCounter();
void setResourceCounter(int type, int index, byte flag);
void increaseResourceCounter();
void resourceStats();
//protected:
bool validateResource(const char *str, int type, int index) const;
protected:
void expireResources(uint32 size);
};
class ResourceManager;
/**
* Base class for all SCUMM engines.

View File

@ -29,6 +29,7 @@
#include "scumm/imuse/imuse.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/player_towns.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
#include "scumm/util.h"

View File

@ -32,6 +32,7 @@
#ifdef ENABLE_HE
#include "scumm/he/intern_he.h"
#endif
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/scumm_v6.h"
#include "scumm/scumm_v8.h"