aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--resource.cpp20
-rw-r--r--scumm.h4
-rw-r--r--sdl.cpp34
-rw-r--r--v3/resource.cpp14
-rw-r--r--v4/resource.cpp16
6 files changed, 49 insertions, 41 deletions
diff --git a/Makefile b/Makefile
index 5a2d6d487b..23ec5e0fa9 100644
--- a/Makefile
+++ b/Makefile
@@ -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);
diff --git a/scumm.h b/scumm.h
index 350e7c335b..cb12b104ca 100644
--- a/scumm.h
+++ b/scumm.h
@@ -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
diff --git a/sdl.cpp b/sdl.cpp
index a05d024a89..5f8c1eae0f 100644
--- a/sdl.cpp
+++ b/sdl.cpp
@@ -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);
+}