aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/resource.h
diff options
context:
space:
mode:
authorMax Horn2011-05-11 16:03:50 +0200
committerMax Horn2011-05-13 11:47:08 +0200
commitb37463fe5921420a9081aa6c5cf7588d52b41e78 (patch)
tree6bb5b19101c7cd19ae9d8257ae5cc0812ecc57e1 /engines/scumm/resource.h
parent7773a17b0a1b1e7488490e96cba361ac060c0dd7 (diff)
downloadscummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.tar.gz
scummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.tar.bz2
scummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.zip
SCUMM: Move class ResourceManager to its own header
Diffstat (limited to 'engines/scumm/resource.h')
-rw-r--r--engines/scumm/resource.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/engines/scumm/resource.h b/engines/scumm/resource.h
index 5cad7fc52a..32873a129b 100644
--- a/engines/scumm/resource.h
+++ b/engines/scumm/resource.h
@@ -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