aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorMax Horn2005-05-10 22:56:25 +0000
committerMax Horn2005-05-10 22:56:25 +0000
commitb75c969e666b9f262a05e0d1e54d56f7d3e45441 (patch)
treee4868d14ac249a63e01f905472ec9be69f04a028 /sword2
parent55c37c18ceed916eb3744666d3d10783b0cf8783 (diff)
downloadscummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.tar.gz
scummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.tar.bz2
scummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.zip
Moved class File and the MD5 stuff to namespace Common
svn-id: r18037
Diffstat (limited to 'sword2')
-rw-r--r--sword2/build_display.cpp2
-rw-r--r--sword2/driver/d_sound.cpp8
-rw-r--r--sword2/resman.cpp14
-rw-r--r--sword2/resman.h8
-rw-r--r--sword2/sound.cpp4
-rw-r--r--sword2/sound.h10
-rw-r--r--sword2/startup.cpp2
-rw-r--r--sword2/sword2.cpp12
8 files changed, 31 insertions, 29 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp
index 9b0dbe750a..397b4e9eda 100644
--- a/sword2/build_display.cpp
+++ b/sword2/build_display.cpp
@@ -698,7 +698,7 @@ void Screen::rollCredits() {
// now, let's just the standard speech font instead.
SpriteInfo spriteInfo;
- File f;
+ Common::File f;
int i;
// Read the "Smacker" logo
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 1432c14a31..7a792417b6 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -40,7 +40,7 @@
namespace Sword2 {
-static AudioStream *makeCLUStream(File *fp, int size);
+static AudioStream *makeCLUStream(Common::File *fp, int size);
static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) {
if (!fh->file->isOpen()) {
@@ -64,7 +64,7 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
char filename[20];
for (int i = 0; i < ARRAYSIZE(file_types); i++) {
- File f;
+ Common::File f;
sprintf(filename, "%s%d.%s", base, cd, file_types[i].ext);
if (f.open(filename)) {
@@ -156,7 +156,7 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
#define GetCompressedSign(n) (((n) >> 3) & 1)
#define GetCompressedAmplitude(n) ((n) & 7)
-CLUInputStream::CLUInputStream(File *file, int size)
+CLUInputStream::CLUInputStream(Common::File *file, int size)
: _file(file), _firstTime(true), _bufferEnd(_outbuf + BUFFER_SIZE) {
_file->incRef();
@@ -226,7 +226,7 @@ void CLUInputStream::refill() {
_bufferEnd = out;
}
-AudioStream *makeCLUStream(File *file, int size) {
+AudioStream *makeCLUStream(Common::File *file, int size) {
return new CLUInputStream(file, size);
}
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 417d8fe394..e11048c625 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -68,7 +68,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) {
// within the clusters at this point it makes no difference. We only
// wish to know what resource files there are and what is in each
- File file;
+ Common::File file;
uint32 size;
byte *temp;
@@ -418,7 +418,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
// care which CD it's on. But if we can't find it, keep asking
// for the CD until we do.
- File *file = openCluFile(cluFileNum);
+ Common::File *file = openCluFile(cluFileNum);
if (_resFiles[cluFileNum].entryTab == NULL) {
// we didn't read from this file before, get its index table
@@ -443,7 +443,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
StandardHeader *header = (StandardHeader *) _resList[res].ptr;
char buf[256];
const char *tag;
- File out;
+ Common::File out;
switch (header->fileType) {
case ANIMATION_FILE:
@@ -497,7 +497,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
#endif
if (!out.exists(buf, "")) {
- if (out.open(buf, File::kFileWriteMode, ""))
+ if (out.open(buf, Common::File::kFileWriteMode, ""))
out.write(_resList[res].ptr, len);
}
}
@@ -563,8 +563,8 @@ void ResourceManager::addToCacheList(Resource *res) {
_cacheEnd = res;
}
-File *ResourceManager::openCluFile(uint16 fileNum) {
- File *file = new File;
+Common::File *ResourceManager::openCluFile(uint16 fileNum) {
+ Common::File *file = new Common::File;
while (!file->open(_resFiles[fileNum].fileName)) {
// HACK: We have to check for this, or it'll be impossible to
// quit while the game is asking for the user to insert a CD.
@@ -585,7 +585,7 @@ File *ResourceManager::openCluFile(uint16 fileNum) {
return file;
}
-void ResourceManager::readCluIndex(uint16 fileNum, File *file) {
+void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
if (_resFiles[fileNum].entryTab == NULL) {
// we didn't read from this file before, get its index table
if (file == NULL)
diff --git a/sword2/resman.h b/sword2/resman.h
index 1e50f91047..e8b7b061a6 100644
--- a/sword2/resman.h
+++ b/sword2/resman.h
@@ -21,7 +21,9 @@
#ifndef RESMAN_H
#define RESMAN_H
-class File;
+namespace Common {
+ class File;
+}
#define MAX_MEM_CACHE (8 * 1024 * 1024) // we keep up to 8 megs of resource data files in memory
#define MAX_res_files 20
@@ -54,8 +56,8 @@ struct ResourceFile {
class ResourceManager {
private:
- File *openCluFile(uint16 fileNum);
- void readCluIndex(uint16 fileNum, File *file = NULL);
+ Common::File *openCluFile(uint16 fileNum);
+ void readCluIndex(uint16 fileNum, Common::File *file = NULL);
void removeFromCacheList(Resource *res);
void addToCacheList(Resource *res);
void checkMemUsage();
diff --git a/sword2/sound.cpp b/sword2/sound.cpp
index addaba928c..738f470f23 100644
--- a/sword2/sound.cpp
+++ b/sword2/sound.cpp
@@ -53,14 +53,14 @@ Sound::Sound(Sword2Engine *vm) {
for (i = 0; i < MAXMUS; i++) {
_music[i] = NULL;
- _musicFile[i].file = new File;
+ _musicFile[i].file = new Common::File;
_musicFile[i].idxTab = NULL;
_musicFile[i].idxLen = 0;
_musicFile[i].fileSize = 0;
_musicFile[i].fileType = 0;
_musicFile[i].inUse = false;
- _speechFile[i].file = new File;
+ _speechFile[i].file = new Common::File;
_speechFile[i].idxTab = NULL;
_speechFile[i].idxLen = 0;
_speechFile[i].fileSize = 0;
diff --git a/sword2/sound.h b/sword2/sound.h
index f34ba70014..1866ec1225 100644
--- a/sword2/sound.h
+++ b/sword2/sound.h
@@ -80,7 +80,7 @@ enum {
class CLUInputStream : public AudioStream {
private:
- File *_file;
+ Common::File *_file;
bool _firstTime;
uint32 _file_pos;
uint32 _end_pos;
@@ -98,7 +98,7 @@ private:
}
public:
- CLUInputStream(File *file, int size);
+ CLUInputStream(Common::File *file, int size);
~CLUInputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -109,7 +109,7 @@ public:
};
struct SoundFileHandle {
- File *file;
+ Common::File *file;
uint32 *idxTab;
uint32 idxLen;
uint32 fileSize;
@@ -120,7 +120,7 @@ struct SoundFileHandle {
class MusicInputStream : public AudioStream {
private:
int _cd;
- //File *_file;
+ //Common::File *_file;
SoundFileHandle *_fh;
uint32 _musicId;
AudioStream *_decoder;
@@ -201,7 +201,7 @@ private:
SoundHandle _soundHandleSpeech;
MusicInputStream *_music[MAXMUS];
- //File _musicFile[MAXMUS];
+ //Common::File _musicFile[MAXMUS];
SoundFileHandle _musicFile[MAXMUS];
SoundFileHandle _speechFile[MAXMUS];
diff --git a/sword2/startup.cpp b/sword2/startup.cpp
index bc2f226df8..b6aedf81c1 100644
--- a/sword2/startup.cpp
+++ b/sword2/startup.cpp
@@ -40,7 +40,7 @@ bool Sword2Engine::initStartMenu() {
// We query each in turn and setup an array of start structures.
// If the file doesn't exist then we say so and return a 0.
- File fp;
+ Common::File fp;
// ok, load in the master screen manager file
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index a4d57e8821..0f64db936d 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -109,12 +109,12 @@ namespace Sword2 {
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) {
// Add default file directories
- File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
- File::addDefaultDirectory(_gameDataPath + "SWORD2/");
- File::addDefaultDirectory(_gameDataPath + "VIDEO/");
- File::addDefaultDirectory(_gameDataPath + "clusters/");
- File::addDefaultDirectory(_gameDataPath + "sword2/");
- File::addDefaultDirectory(_gameDataPath + "video/");
+ Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
+ Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/");
+ Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
+ Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
+ Common::File::addDefaultDirectory(_gameDataPath + "sword2/");
+ Common::File::addDefaultDirectory(_gameDataPath + "video/");
_features = detector->_game.features;
_targetName = detector->_targetName;