aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/cine.cpp16
-rw-r--r--engines/cine/cine.h1
-rw-r--r--engines/cine/module.mk1
-rw-r--r--engines/cine/object.cpp1
-rw-r--r--engines/cine/part.cpp24
-rw-r--r--engines/cine/part.h3
-rw-r--r--engines/cine/resource.cpp126
-rw-r--r--engines/cine/resource.h47
-rw-r--r--engines/cine/sfx_player.cpp4
9 files changed, 31 insertions, 192 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 5f2ded13a0..1a2ae7f53b 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -113,9 +113,6 @@ int CineEngine::go() {
mainLoop(1);
- if (g_cine->getGameType() == Cine::GType_FW)
- snd_clearBasesonEntries();
-
delete g_sfxPlayer;
delete g_soundDriver;
return 0;
@@ -138,16 +135,9 @@ void CineEngine::initialize() {
loadTextData("texte.dat", textDataPtr);
- switch (g_cine->getGameType()) {
- case Cine::GType_FW:
- snd_loadBasesonEntries("BASESON.SND");
- break;
- case Cine::GType_OS:
- if (!(g_cine->getFeatures() & GF_DEMO)) {
- loadPoldatDat("poldat.dat");
- loadErrmessDat("errmess.dat");
- }
- break;
+ if (g_cine->getGameType() == Cine::GType_OS && !(g_cine->getFeatures() & GF_DEMO)) {
+ loadPoldatDat("poldat.dat");
+ loadErrmessDat("errmess.dat");
}
for (i = 0; i < NUM_MAX_OBJECT; i++) {
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index 4646850a93..061e9ab66b 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -36,7 +36,6 @@
#include "cine/script.h"
#include "cine/part.h"
#include "cine/prc.h"
-#include "cine/resource.h"
#include "cine/msg.h"
#include "cine/bg.h"
#include "cine/pal.h"
diff --git a/engines/cine/module.mk b/engines/cine/module.mk
index 929511b1b4..f427415e0c 100644
--- a/engines/cine/module.mk
+++ b/engines/cine/module.mk
@@ -14,7 +14,6 @@ MODULE_OBJS = \
part.o \
prc.o \
rel.o \
- resource.o \
script.o \
sfx_player.o \
sound_driver.o \
diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp
index 80c4b1999c..980bcfe5d7 100644
--- a/engines/cine/object.cpp
+++ b/engines/cine/object.cpp
@@ -30,7 +30,6 @@
#include "cine/cine.h"
#include "cine/object.h"
#include "cine/part.h"
-#include "cine/resource.h"
#include "cine/various.h"
namespace Cine {
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index 99d1109c2b..f915fc3260 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -68,7 +68,7 @@ void loadPart(const char *partName) {
partFileHandle.readUint32BE(); // unused
}
- if (g_cine->getGameType() == Cine::GType_FW && g_cine->getPlatform() == Common::kPlatformPC)
+ if (g_cine->getGameType() == Cine::GType_FW && g_cine->getPlatform() == Common::kPlatformPC && strcmp(partName, "BASESON.SND") != 0)
loadPal(partName);
}
@@ -420,6 +420,25 @@ byte *readBundleFile(int16 foundFileIdx) {
return dataPtr;
}
+byte *readBundleSoundFile(const char *entryName) {
+ int16 index;
+ byte *data = 0;
+ char previousPartName[15] = "";
+
+ if (g_cine->getGameType() == Cine::GType_FW) {
+ strcpy(previousPartName, currentPartName);
+ loadPart("BASESON.SND");
+ }
+ index = findFileInBundle((const char *)entryName);
+ if (index != -1) {
+ data = readBundleFile(index);
+ }
+ if (g_cine->getGameType() == Cine::GType_FW) {
+ loadPart(previousPartName);
+ }
+ return data;
+}
+
byte *readFile(const char *filename) {
Common::File in;
@@ -437,6 +456,9 @@ byte *readFile(const char *filename) {
return dataPtr;
}
+void checkDataDisk(int16 param) {
+}
+
void dumpBundle(const char *fileName) {
char tmpPart[15];
diff --git a/engines/cine/part.h b/engines/cine/part.h
index 17ffd7aeb3..657d00465c 100644
--- a/engines/cine/part.h
+++ b/engines/cine/part.h
@@ -65,8 +65,11 @@ int16 findFileInBundle(const char *fileName);
void readFromPart(int16 idx, byte *dataPtr);
byte *readBundleFile(int16 foundFileIdx);
+byte *readBundleSoundFile(const char *entryName);
byte *readFile(const char *filename);
+void checkDataDisk(int16 param);
+
void dumpBundle(const char *filename);
} // End of namespace Cine
diff --git a/engines/cine/resource.cpp b/engines/cine/resource.cpp
deleted file mode 100644
index fb5fcfb94e..0000000000
--- a/engines/cine/resource.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2006 The ScummVM project
- *
- * cinE Engine is (C) 2004-2005 by CinE Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/file.h"
-
-#include "cine/cine.h"
-#include "cine/resource.h"
-#include "cine/unpack.h"
-#include "cine/various.h"
-
-namespace Cine {
-
-void checkDataDisk(int16 param) {
-}
-
-/* FW specific */
-static Common::File *snd_baseSndFile = NULL;
-static uint16 snd_numBasesonEntries = 0;
-static BasesonEntry *snd_basesonEntries = NULL;
-
-int snd_loadBasesonEntries(const char *fileName) {
- int i;
-
- snd_baseSndFile = new Common::File();
- snd_baseSndFile->open(fileName);
- if (!snd_baseSndFile->isOpen())
- return -1;
-
- snd_numBasesonEntries = snd_baseSndFile->readUint16BE();
- snd_baseSndFile->readUint16BE(); /* entry_size */
- snd_basesonEntries = (BasesonEntry *)malloc(snd_numBasesonEntries * sizeof(BasesonEntry));
- if (snd_basesonEntries) {
- for (i = 0; i < snd_numBasesonEntries; ++i) {
- BasesonEntry *be = &snd_basesonEntries[i];
- snd_baseSndFile->read(be->name, 14);
- be->offset = snd_baseSndFile->readUint32BE();
- be->size = snd_baseSndFile->readUint32BE();
- be->unpackedSize = snd_baseSndFile->readUint32BE();
- snd_baseSndFile->readUint32BE(); /* unused */
- }
- }
- return 0;
-}
-
-void snd_clearBasesonEntries() {
- snd_baseSndFile->close();
- delete snd_baseSndFile;
- free(snd_basesonEntries);
- snd_basesonEntries = NULL;
- snd_numBasesonEntries = 0;
-}
-
-static int snd_findBasesonEntry(const char *entryName) {
- int i;
- char *p;
- char basesonEntryName[20];
-
- assert(strlen(entryName) < 20);
- strcpy(basesonEntryName, entryName);
- for (p = basesonEntryName; *p; ++p) {
- if (*p >= 'a' && *p <= 'z')
- *p += 'A' - 'a';
- }
-
- for (i = 0; i < snd_numBasesonEntries; ++i) {
- if (strcmp(snd_basesonEntries[i].name, basesonEntryName) == 0)
- return i;
- }
- return -1;
-}
-
-byte *snd_loadBasesonEntry(const char *entryName) {
- int entryNum;
- byte *entryData = NULL;
-
- if (g_cine->getGameType() == Cine::GType_OS) {
- entryNum = findFileInBundle((const char *)entryName);
- if (entryNum != -1)
- entryData = readBundleFile(entryNum);
- } else {
- entryNum = snd_findBasesonEntry(entryName);
- if (entryNum != -1 && entryNum < snd_numBasesonEntries) {
- const BasesonEntry *be = &snd_basesonEntries[entryNum];
- entryData = (byte *)malloc(be->unpackedSize);
- if (entryData) {
- if (be->unpackedSize > be->size) {
- byte *tempData = (byte *)malloc(be->size);
- if (tempData) {
- snd_baseSndFile->seek(be->offset, SEEK_SET);
- snd_baseSndFile->read(tempData, be->size);
- delphineUnpack(entryData, tempData, be->size);
- free(tempData);
- }
- } else {
- snd_baseSndFile->seek(be->offset, SEEK_SET);
- snd_baseSndFile->read(entryData, be->size);
- }
- }
- }
- }
-
- return entryData;
-}
-
-} // End of namespace Cine
diff --git a/engines/cine/resource.h b/engines/cine/resource.h
deleted file mode 100644
index 9f3f5bb927..0000000000
--- a/engines/cine/resource.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2006 The ScummVM project
- *
- * cinE Engine is (C) 2004-2005 by CinE Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef CINE_RESOURCE_H
-#define CINE_RESOURCE_H
-
-#include "common/stdafx.h"
-#include "common/scummsys.h"
-
-namespace Cine {
-
-struct BasesonEntry {
- char name[14];
- uint32 offset;
- uint32 size;
- uint32 unpackedSize;
-};
-
-void checkDataDisk(int16 param);
-extern int snd_loadBasesonEntries(const char *fileName);
-extern void snd_clearBasesonEntries();
-extern byte *snd_loadBasesonEntry(const char *entryName);
-
-} // End of namespace Cine
-
-#endif
diff --git a/engines/cine/sfx_player.cpp b/engines/cine/sfx_player.cpp
index fa97fe2891..86ca2754a8 100644
--- a/engines/cine/sfx_player.cpp
+++ b/engines/cine/sfx_player.cpp
@@ -67,7 +67,7 @@ bool SfxPlayer::load(const char *song) {
return 0;
}
- _sfxData = snd_loadBasesonEntry(song);
+ _sfxData = readBundleSoundFile(song);
if (!_sfxData) {
warning("Unable to load soundfx module '%s'", song);
return 0;
@@ -86,7 +86,7 @@ bool SfxPlayer::load(const char *song) {
*dot = '\0';
}
strcat(instrument, _driver->getInstrumentExtension());
- _instrumentsData[i] = snd_loadBasesonEntry(instrument);
+ _instrumentsData[i] = readBundleSoundFile(instrument);
if (!_instrumentsData[i]) {
warning("Unable to load soundfx instrument '%s'", instrument);
}