diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | resource.cpp | 20 | ||||
-rw-r--r-- | scumm.h | 4 | ||||
-rw-r--r-- | sdl.cpp | 34 | ||||
-rw-r--r-- | v3/resource.cpp | 14 | ||||
-rw-r--r-- | v4/resource.cpp | 16 |
6 files changed, 49 insertions, 41 deletions
@@ -15,7 +15,7 @@ OBJS = actor.o boxes.o costume.o gfx.o object.o resource.o \ saveload.o script.o scummvm.o sound.o string.o \ sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \ sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o \ - akos.o vars.o insane.o gameDetecter.o v3/resource.o + akos.o vars.o insane.o gameDetecter.o v3/resource.o v4/resource.o DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \ windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \ diff --git a/resource.cpp b/resource.cpp index 45f747e32e..274a27629c 100644 --- a/resource.cpp +++ b/resource.cpp @@ -399,25 +399,9 @@ void Scumm::loadCharset(int no) { byte *ptr; debug(9, "loadCharset(%d)",no); - if(_features & GF_EXTERNAL_CHARSET) { - uint32 size; + + checkRange(_maxCharsets-1, 1, no, "Loading illegal charset %d"); - checkRange(4 ,0 ,no , "Loading illegal charset %d"); - openRoom(-1); - if( _features & GF_SMALL_NAMES) - openRoom(98+no); - else - openRoom(900+no); - - if (_features & GF_OLD256) - size = fileReadWordLE(); - else - size = fileReadDwordLE(); - fileRead(_fileHandle, createResource(6, no, size), size); - openRoom(-1); - } else { - checkRange(_maxCharsets-1, 1, no, "Loading illegal charset %d"); - } // ensureResourceLoaded(6, no); ptr = getResourceAddress(6, no); @@ -811,7 +811,7 @@ public: void readArrayFromIndexFile(); void readMAXS(); virtual void readIndexFile(); - void loadCharset(int i); + virtual void loadCharset(int i); void nukeCharset(int i); bool fileReadFailed(void *handle); @@ -1668,10 +1668,12 @@ class Scumm_v3 : public Scumm { public: void readIndexFile(); + virtual void loadCharset(int no); }; class Scumm_v4 : public Scumm_v3 { + void loadCharset(int no); }; class Scumm_v5 : public Scumm @@ -925,27 +925,19 @@ int main(int argc, char* argv[]) { if(detecter.detectMain(argc, argv)) return(-1); - switch(detecter._scummVersion) - { - case 3: - scumm = new Scumm_v3; - break; - case 4: - scumm = new Scumm_v4; - break; - case 5: - scumm = new Scumm_v5; - break; - case 6: - scumm = new Scumm_v6; - break; - case 7: - scumm = new Scumm_v7; - break; - default: // do we really need a default ? - scumm = new Scumm; - break; - } + if(detecter._features & GF_OLD256) + scumm = new Scumm_v3; + else + if(detecter._features & GF_SMALL_HEADER) // this force loomCD as v4 + scumm = new Scumm_v4; + else + if(detecter._features & GF_AFTER_V7) + scumm = new Scumm_v7; + else + if(detecter._features & GF_AFTER_V6) // this force SamnmaxCD as v6 + scumm = new Scumm_v6; + else + scumm = new Scumm_v5; /* All those stuff should be moved to the constructor.... */ diff --git a/v3/resource.cpp b/v3/resource.cpp index 71407cc317..e6836876b9 100644 --- a/v3/resource.cpp +++ b/v3/resource.cpp @@ -124,3 +124,17 @@ void Scumm_v3::readIndexFile() { openRoom(-1); } + +void Scumm_v3::loadCharset(int no){ + uint32 size; + + checkRange(4 ,0 ,no , "Loading illegal charset %d"); + openRoom(-1); + + openRoom(98+no); + + size = fileReadWordLE(); + + fileRead(_fileHandle, createResource(6, no, size), size); + openRoom(-1); +} diff --git a/v4/resource.cpp b/v4/resource.cpp new file mode 100644 index 0000000000..3cf2d4ec00 --- /dev/null +++ b/v4/resource.cpp @@ -0,0 +1,16 @@ +#include"../stdafx.h" +#include"../scumm.h" + +void Scumm_v4::loadCharset(int no) { + uint32 size; + + checkRange(4 ,0 ,no , "Loading illegal charset %d"); + openRoom(-1); + + openRoom(900+no); + + size = fileReadDwordLE(); + + fileRead(_fileHandle, createResource(6, no, size), size); + openRoom(-1); +} |