diff options
author | Max Horn | 2011-05-11 16:03:50 +0200 |
---|---|---|
committer | Max Horn | 2011-05-13 11:47:08 +0200 |
commit | b37463fe5921420a9081aa6c5cf7588d52b41e78 (patch) | |
tree | 6bb5b19101c7cd19ae9d8257ae5cc0812ecc57e1 | |
parent | 7773a17b0a1b1e7488490e96cba361ac060c0dd7 (diff) | |
download | scummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.tar.gz scummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.tar.bz2 scummvm-rg350-b37463fe5921420a9081aa6c5cf7588d52b41e78.zip |
SCUMM: Move class ResourceManager to its own header
-rw-r--r-- | engines/scumm/akos.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/boxes.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/debugger.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/he/sound_he.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/insane/insane.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/resource.h | 70 | ||||
-rw-r--r-- | engines/scumm/resource_v3.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/script_v0.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/script_v2.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 66 | ||||
-rw-r--r-- | engines/scumm/sound.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/string.cpp | 1 |
17 files changed, 86 insertions, 65 deletions
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 4fe70d37c3..b6acf01050 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -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" diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 5afdce9068..ba4dedfbd3 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -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" diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 4d4a6ca321..7de8a28536 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -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" diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 95f76dbf51..ad1cb3da89 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -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" diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 1f6a1445ef..85a8c02665 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -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" diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 9505f3a104..abd0d68e56 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -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" diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index e9272a8170..1a4ed91f1c 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -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" diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index 309877c7b4..b8089ff226 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -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" 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 diff --git a/engines/scumm/resource_v3.cpp b/engines/scumm/resource_v3.cpp index 9ce51be5d6..323e5b6370 100644 --- a/engines/scumm/resource_v3.cpp +++ b/engines/scumm/resource_v3.cpp @@ -23,6 +23,7 @@ #include "scumm/scumm_v3.h" #include "scumm/file.h" +#include "scumm/resource.h" #include "scumm/util.h" namespace Scumm { diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index aedbc636ca..1ef16d7106 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -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" diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index ba27151512..f7d4e74898 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -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" diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 9186371c85..81f28fbbd6 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -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" diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f5187546a1..70d8f0dab1 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -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" diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 32f8e759a1..642db82d66 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -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. diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 10eaf54774..567cf74d4a 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -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" diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 15ee22c666..54826c3fea 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -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" |