Rechanged the way the scumm class is choose (sorry, can't make up my mind). Implemented the different versions of loadCharset

svn-id: r3820
This commit is contained in:
Vincent Hamm 2002-03-25 02:09:05 +00:00
parent 055953b329
commit 57cf1bfbee
6 changed files with 49 additions and 41 deletions

View File

@ -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 \

View File

@ -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);

View File

@ -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

34
sdl.cpp
View File

@ -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.... */

View File

@ -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);
}

16
v4/resource.cpp Normal file
View File

@ -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);
}