[Scummvm-cvs-logs] CVS: scummvm/scumm nut_renderer.cpp,1.48,1.49 resource.cpp,1.231,1.232 scumm.h,1.433,1.434 sound.cpp,1.358,1.359 sound.h,1.70,1.71 string.cpp,1.229,1.230
Max Horn
fingolfin at users.sourceforge.net
Mon Jul 26 16:16:08 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27289
Modified Files:
nut_renderer.cpp resource.cpp scumm.h sound.cpp sound.h
string.cpp
Log Message:
Load SMUSH files and NUT fonts from mac container files, too (done that by adding a new high level method openFile to class ScummEngine)
Index: nut_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- nut_renderer.cpp 27 Jun 2004 21:52:23 -0000 1.48
+++ nut_renderer.cpp 26 Jul 2004 23:14:56 -0000 1.49
@@ -119,8 +119,8 @@
warning("NutRenderer::loadFont() Font already loaded, ok, loading...");
}
- File file;
- file.open(filename);
+ ScummFile file;
+ _vm->openFile(file, filename);
if (file.isOpen() == false) {
warning("NutRenderer::loadFont() Can't open font file: %s", filename);
return false;
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -d -r1.231 -r1.232
--- resource.cpp 26 Jul 2004 17:14:56 -0000 1.231
+++ resource.cpp 26 Jul 2004 23:15:01 -0000 1.232
@@ -111,7 +111,7 @@
file_name[0x20] = 0;
assert(file_name[0]);
- //debug(0, "extracting \'%s\'", file_name);
+ //debug(7, " extracting \'%s\'", file_name);
// Consistency check. make sure the file data is in the file
if (file_off + file_len > data_file_len) {
@@ -120,7 +120,6 @@
if (scumm_stricmp(file_name, filename) == 0) {
// We got a match!
- _subFileName = file_name;
setSubfileRange(file_off, file_len);
return true;
}
@@ -376,28 +375,35 @@
}
}
-bool ScummEngine::openResourceFile(const char *filename, byte encByte) {
- debugC(DEBUG_GENERAL, "openResourceFile(%s)", filename);
+bool ScummEngine::openFile(ScummFile &file, const char *filename) {
bool result = false;
if (!_containerFile.isEmpty()) {
- if (!_fileHandle.isOpen())
- _fileHandle.open(_containerFile.c_str());
- assert(_fileHandle.isOpen());
+ file.close();
+ file.open(_containerFile.c_str());
+ assert(file.isOpen());
- result = _fileHandle.openSubFile(filename);
+ result = file.openSubFile(filename);
}
if (!result) {
- _fileHandle.close();
- result = _fileHandle.open(filename);
+ file.close();
+ result = file.open(filename);
}
-
- _fileHandle.setEnc(encByte);
-
+
return result;
}
+bool ScummEngine::openResourceFile(const char *filename, byte encByte) {
+ debugC(DEBUG_GENERAL, "openResourceFile(%s)", filename);
+
+ if (openFile(_fileHandle, filename)) {
+ _fileHandle.setEnc(encByte);
+ return true;
+ }
+ return false;
+}
+
void ScummEngine::askForDisk(const char *filename, int disknum) {
char buf[128];
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.433
retrieving revision 1.434
diff -u -d -r1.433 -r1.434
--- scumm.h 26 Jul 2004 17:14:56 -0000 1.433
+++ scumm.h 26 Jul 2004 23:15:01 -0000 1.434
@@ -66,7 +66,6 @@
byte _encbyte;
uint32 _subFileStart;
uint32 _subFileLen;
- Common::String _subFileName;
public:
ScummFile();
void setEnc(byte value);
@@ -629,6 +628,8 @@
public:
/** The name of the (macintosh/rescumm style) container file, if any. */
Common::String _containerFile;
+
+ bool openFile(ScummFile &file, const char *filename);
protected:
int _resourceHeaderSize;
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- sound.cpp 26 Jul 2004 17:14:57 -0000 1.358
+++ sound.cpp 26 Jul 2004 23:15:01 -0000 1.359
@@ -588,10 +588,10 @@
_sfxFile->close();
sprintf(filename, "audio/%s.%d/%d.voc", roomname, offset, b);
- _sfxFile->open(filename);
+ _vm->openFile(*_sfxFile, filename);
if (!_sfxFile->isOpen()) {
sprintf(filename, "%d.%d.voc", offset, b);
- _sfxFile->open(filename);
+ _vm->openFile(*_sfxFile, filename);
}
if (!_sfxFile->isOpen()) {
warning("startTalkSound: dig demo: voc file not found");
@@ -968,41 +968,30 @@
}
}
-File *Sound::openSfxFile() {
+ScummFile *Sound::openSfxFile() {
struct SoundFileExtensions {
const char *ext;
SoundMode mode;
};
static const SoundFileExtensions extensions[] = {
+ { "sou", kVOCMode },
#ifdef USE_FLAC
{ "sof", kFlacMode },
#endif
- #ifdef USE_MAD
- { "so3", kMP3Mode },
- #endif
#ifdef USE_VORBIS
{ "sog", kVorbisMode },
#endif
- { "sou", kVOCMode },
+ #ifdef USE_MAD
+ { "so3", kMP3Mode },
+ #endif
{ 0, kVOCMode }
};
-
-
char buf[256];
ScummFile *file = new ScummFile();
_offsetTable = NULL;
-
- if (!_vm->_containerFile.isEmpty() && file->open(_vm->_containerFile.c_str())) {
- if (file->openSubFile("monster.sou")) {
- _soundMode = kVOCMode;
- } else {
- file->close();
- }
- }
-
/* Try opening the file <_gameName>.sou first, e.g. tentacle.sou.
* That way, you can keep .sou files for multiple games in the
* same directory */
@@ -1014,7 +1003,7 @@
for (int j = 0; basename[j] && !file->isOpen(); ++j) {
for (int i = 0; extensions[i].ext; ++i) {
sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
- if (file->open(buf)) {
+ if (_vm->openFile(*file, buf)) {
_soundMode = extensions[i].mode;
break;
}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- sound.h 24 Jul 2004 14:24:34 -0000 1.70
+++ sound.h 26 Jul 2004 23:15:01 -0000 1.71
@@ -29,6 +29,7 @@
namespace Scumm {
class ScummEngine;
+class ScummFile;
struct MP3OffsetTable;
@@ -57,7 +58,7 @@
int16 _soundQuePos, _soundQue[0x100];
int16 _soundQue2Pos, _soundQue2Sound[10], _soundQue2Offset[10];
- File *_sfxFile;
+ ScummFile *_sfxFile;
SoundMode _soundMode;
MP3OffsetTable *_offsetTable; // For compressed audio
int _numSoundEffects; // For compressed audio
@@ -110,7 +111,7 @@
int getCurrentCDSound() const { return _currentCDSound; }
protected:
- File *openSfxFile();
+ ScummFile *openSfxFile();
void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id = -1);
bool isSfxFinished() const;
void processSfxQueues();
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -d -r1.229 -r1.230
--- string.cpp 24 Jul 2004 14:24:34 -0000 1.229
+++ string.cpp 26 Jul 2004 23:15:01 -0000 1.230
@@ -691,13 +691,13 @@
// Create an index of the language file.
void ScummEngine::loadLanguageBundle() {
- File file;
+ ScummFile file;
int32 size;
if (_gameId == GID_DIG) {
- file.open("language.bnd");
+ openFile(file, "language.bnd");
} else if (_gameId == GID_CMI) {
- file.open("language.tab");
+ openFile(file, "language.tab");
} else {
return;
}
More information about the Scummvm-git-logs
mailing list