diff options
author | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
commit | d4c92983920cfe3b25a22d91e12c750e591b917e (patch) | |
tree | c0b63318b9ba0e67528337cfaa21515def1c3962 /engines/scumm | |
parent | 7e2edf16b3e2bf1d2b31999979a60802514df6cb (diff) | |
parent | cf107e24be28c7e6db65b5c7ffed120af4a7994b (diff) | |
download | scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.gz scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.bz2 scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/scumm')
176 files changed, 949 insertions, 1294 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 13581c4b45..25a26f6cf2 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -18,9 +18,6 @@ * 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/system.h" // for setFocusRectangle/clearFocusRectangle @@ -177,9 +174,21 @@ void Actor::setBox(int box) { } void Actor_v3::setupActorScale() { - // TODO: The following could probably be removed - _scalex = 0xFF; - _scaley = 0xFF; + // WORKAROUND bug #1463598: Under certain circumstances, it is possible + // for Henry Sr. to reach the front side of Castle Brunwald (following + // Indy there). But it seems the game has no small costume for Henry, + // hence he is shown as a giant, triple in size compared to Indy. + // To workaround this, we override the scale of Henry. Since V3 games + // like Indy3 don't use the costume scale otherwise, this works fine. + // The scale factor 0x50 was determined by some guess work. + if (_number == 2 && _costume == 7 && _vm->_game.id == GID_INDY3 && _vm->_currentRoom == 12) { + _scalex = 0x50; + _scaley = 0x50; + } else { + // TODO: The following could probably be removed + _scalex = 0xFF; + _scaley = 0xFF; + } } void Actor::setupActorScale() { diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index 8e699b5a49..1584d0a78b 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/actor_he.h b/engines/scumm/actor_he.h index bb7bbb6487..24b632d00e 100644 --- a/engines/scumm/actor_he.h +++ b/engines/scumm/actor_he.h @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 8acbb8058e..b6acf01050 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -18,9 +18,6 @@ * 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 "scumm/scumm.h" @@ -30,6 +27,7 @@ #include "scumm/imuse/imuse.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/he/intern_he.h" +#include "scumm/resource.h" #include "scumm/scumm_v7.h" #include "scumm/sound.h" #include "scumm/util.h" diff --git a/engines/scumm/akos.h b/engines/scumm/akos.h index 9f4f09d4dc..bd42aedcbd 100644 --- a/engines/scumm/akos.h +++ b/engines/scumm/akos.h @@ -18,9 +18,6 @@ * 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 SCUMM_AKOS_H diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index 2aecb3dfdd..46c68c81b0 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/base-costume.h b/engines/scumm/base-costume.h index d586b211f3..652655c24e 100644 --- a/engines/scumm/base-costume.h +++ b/engines/scumm/base-costume.h @@ -18,9 +18,6 @@ * 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 SCUMM_BASE_COSTUME_H diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp index 18db89be1f..845cf70722 100644 --- a/engines/scumm/bomp.cpp +++ b/engines/scumm/bomp.cpp @@ -17,9 +17,6 @@ * 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$ - * */ diff --git a/engines/scumm/bomp.h b/engines/scumm/bomp.h index 8f64b54f7c..b2d042daae 100644 --- a/engines/scumm/bomp.h +++ b/engines/scumm/bomp.h @@ -17,9 +17,6 @@ * 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 SCUMM_BOMP_H diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 15d5f04ed5..ba4dedfbd3 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -18,14 +18,12 @@ * 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 "scumm/scumm.h" #include "scumm/actor.h" #include "scumm/boxes.h" +#include "scumm/resource.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v6.h" #include "scumm/util.h" diff --git a/engines/scumm/boxes.h b/engines/scumm/boxes.h index a93c9f4919..e554aea1b5 100644 --- a/engines/scumm/boxes.h +++ b/engines/scumm/boxes.h @@ -18,9 +18,6 @@ * 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 SCUMM_BOXES_H diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index c12c956134..4b48acfbdb 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -17,9 +17,6 @@ * 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 "scumm/scumm.h" diff --git a/engines/scumm/charset-fontdata.cpp b/engines/scumm/charset-fontdata.cpp index 7f2bbd05b4..29465584f8 100644 --- a/engines/scumm/charset-fontdata.cpp +++ b/engines/scumm/charset-fontdata.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 9fb76d9d63..dce6c9c144 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index 4b2e053c6d..4c657b475e 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -17,9 +17,6 @@ * 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 SCUMM_CHARSET_H diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index d0a3ec6e11..75cde5e33a 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h index 367b86839d..3acf2a1f6c 100644 --- a/engines/scumm/costume.h +++ b/engines/scumm/costume.h @@ -17,9 +17,6 @@ * 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 SCUMM_COSTUME_H diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 820605924c..e9b5260eca 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -17,9 +17,6 @@ * 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/system.h" diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 4c1942b865..9cfdfbccc9 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -18,9 +18,6 @@ * 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/debug-channels.h" @@ -34,6 +31,7 @@ #include "scumm/debugger.h" #include "scumm/imuse/imuse.h" #include "scumm/object.h" +#include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/sound.h" @@ -376,8 +374,8 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) { DebugPrintf("Actor[%d]._elevation = %d\n", actnum, a->getElevation()); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "costume")) { - if (value >= _vm->_res->num[rtCostume]) - DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->_res->num[rtCostume]); + if (value >= (int)_vm->_res->_types[rtCostume].size()) + DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->_res->_types[rtCostume].size()); else { a->setActorCostume(value); _vm->_fullRedraw = true; @@ -401,14 +399,15 @@ bool ScummDebugger::Cmd_PrintActor(int argc, const char **argv) { int i; Actor *a; - DebugPrintf("+-----------------------------------------------------------+\n"); - DebugPrintf("|# | x | y | w |elev|cos|box|mov| zp|frm|scl|dir| cls |\n"); - DebugPrintf("+--+----+----+---+----+---+---+---+---+---+---+---+---------+\n"); + DebugPrintf("+---------------------------------------------------------------+\n"); + DebugPrintf("|# | x | y | w | h |elev|cos|box|mov| zp|frm|scl|dir| cls |\n"); + DebugPrintf("+--+----+----+---+---+----+---+---+---+---+---+---+---+---------+\n"); for (i = 1; i < _vm->_numActors; i++) { a = _vm->_actors[i]; if (a->_visible) - DebugPrintf("|%2d|%4d|%4d|%3d|%4d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|$%08x|\n", - a->_number, a->getRealPos().x, a->getRealPos().y, a->_width, a->getElevation(), + DebugPrintf("|%2d|%4d|%4d|%3d|%3d|%4d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|$%08x|\n", + a->_number, a->getRealPos().x, a->getRealPos().y, a->_width, a->_bottom - a->_top, + a->getElevation(), a->_costume, a->_walkbox, a->_moving, a->_forceClip, a->_frame, a->_scalex, a->getFacing(), _vm->_classData[a->_number]); } diff --git a/engines/scumm/debugger.h b/engines/scumm/debugger.h index 9a85493bbe..a9b340d691 100644 --- a/engines/scumm/debugger.h +++ b/engines/scumm/debugger.h @@ -17,9 +17,6 @@ * 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 SCUMM_DEBUGGER_H diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 51b46b033c..bba26961c7 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -18,9 +18,6 @@ * 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$ - * */ // FIXME: Avoid using printf @@ -43,6 +40,7 @@ #include "scumm/scumm_v8.h" #include "scumm/file.h" #include "scumm/file_nes.h" +#include "scumm/resource.h" #include "engines/metaengine.h" @@ -70,7 +68,7 @@ static const MD5Table *findInMD5Table(const char *md5) { } Common::String ScummEngine::generateFilename(const int room) const { - const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom][room]._roomno : 0; char buf[128]; if (_game.version == 4) { @@ -112,7 +110,7 @@ Common::String ScummEngine_v60he::generateFilename(const int room) const { if (room < 0) { id = '0' - room; } else { - const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0; + const int diskNumber = (room > 0) ? _res->_types[rtRoom][room]._roomno : 0; id = diskNumber + '0'; } @@ -1039,6 +1037,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co // Simply use the first match DetectorResult res(*(results.begin())); debug(1, "Using gameid %s, variant %s, extra %s", res.game.gameid, res.game.variant, res.extra); + debug(1, " SCUMM version %d, HE version %d", res.game.version, res.game.heversion); // Print the MD5 of the game; either verbose using printf, in case of an // unknown MD5, or with a medium debug level in case of a known MD5 (for @@ -1157,7 +1156,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co } const char *ScummMetaEngine::getName() const { - return "SCUMM Engine [" + return "SCUMM [" #if defined(ENABLE_SCUMM_7_8) && defined(ENABLE_HE) "all games" diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h index 9b4ff929e2..720c4bb750 100644 --- a/engines/scumm/detection.h +++ b/engines/scumm/detection.h @@ -18,9 +18,6 @@ * 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 SCUMM_DETECTION_H diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 952abdb39a..7eb1e80132 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -18,9 +18,6 @@ * 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 SCUMM_DETECTION_TABLES_H @@ -187,6 +184,8 @@ using Common::GUIO_NOLAUNCHLOAD; using Common::GUIO_NOMIDI; using Common::GUIO_NOSPEECH; using Common::GUIO_MIDITOWNS; +using Common::GUIO_MIDIADLIB; +using Common::GUIO_MIDIMT32; // The following table contains information about variants of our various // games. We index into it with help of md5table (from scumm-md5.h), to find @@ -245,11 +244,11 @@ static const GameSettings gameVariantsTable[] = { {"monkey", "SEGA", 0, GID_MONKEY, 5, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO_NOSPEECH | GUIO_NOMIDI}, {"monkey2", "", 0, GID_MONKEY2, 5, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH}, - {"monkey2", "FM-TOWNS", 0, GID_MONKEY2, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_NOSPEECH}, + {"monkey2", "FM-TOWNS", 0, GID_MONKEY2, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_MIDITOWNS | GUIO_MIDIADLIB | GUIO_MIDIMT32}, {"atlantis", "", 0, GID_INDY4, 5, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NONE}, {"atlantis", "Floppy", 0, GID_INDY4, 5, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH}, - {"atlantis", "FM-TOWNS", 0, GID_INDY4, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_NONE}, + {"atlantis", "FM-TOWNS", 0, GID_INDY4, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_MIDITOWNS | GUIO_MIDIADLIB | GUIO_MIDIMT32}, {"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NONE}, {"tentacle", "Floppy", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NOSPEECH}, diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index e396d37e30..f7f0c7d7ec 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -17,9 +17,6 @@ * 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/config-manager.h" diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 40e549471b..c26aa9f414 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -17,9 +17,6 @@ * 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 SCUMM_DIALOGS_H diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 20050e5d4c..9c161ff1cc 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -18,9 +18,6 @@ * 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 "scumm/file.h" diff --git a/engines/scumm/file.h b/engines/scumm/file.h index 8a25277ded..d6dbc06ddc 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -18,9 +18,6 @@ * 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 SCUMM_FILE_H diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp index 47704d6eaf..0e7130973e 100644 --- a/engines/scumm/file_nes.cpp +++ b/engines/scumm/file_nes.cpp @@ -18,9 +18,6 @@ * 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 "scumm/file_nes.h" diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h index f2ce3e19fd..2dfb6c54b3 100644 --- a/engines/scumm/file_nes.h +++ b/engines/scumm/file_nes.h @@ -18,9 +18,6 @@ * 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 SCUMM_FILE_NES_H diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index e7abd5610e..08ae9fdd96 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -17,9 +17,6 @@ * 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/system.h" @@ -221,6 +218,10 @@ Gdi::Gdi(ScummEngine *vm) : _vm(vm) { Gdi::~Gdi() { } +GdiHE::GdiHE(ScummEngine *vm) : Gdi(vm), _tmskPtr(0) { +} + + GdiNES::GdiNES(ScummEngine *vm) : Gdi(vm) { memset(&_NES, 0, sizeof(_NES)); } @@ -1503,6 +1504,15 @@ void Gdi::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, // Do nothing by default } +void GdiHE::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, + const int x, const int y, const int width, const int height, + int stripnr, int numstrip) { + if (_vm->_game.heversion >= 72) { + _tmskPtr = _vm->findResource(MKTAG('T','M','S','K'), ptr); + } else + _tmskPtr = 0; +} + void GdiV1::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, int stripnr, int numstrip) { @@ -1748,11 +1758,6 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const numzbuf = getZPlanes(ptr, zplane_list, false); - const byte *tmsk_ptr = NULL; - if (_vm->_game.heversion >= 72) { - tmsk_ptr = _vm->findResource(MKTAG('T','M','S','K'), ptr); - } - if (y + height > vs->h) { warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", y + height, vs->h); } @@ -1815,7 +1820,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const clear8Col(frontBuf, vs->pitch, height, vs->format.bytesPerPixel); } - decodeMask(x, y, width, height, stripnr, numzbuf, zplane_list, transpStrip, flag, tmsk_ptr); + decodeMask(x, y, width, height, stripnr, numzbuf, zplane_list, transpStrip, flag); #if 0 // HACK: blit mask(s) onto normal screen. Useful to debug masking @@ -1904,7 +1909,7 @@ bool GdiV2::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int widt void Gdi::decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr) { + bool transpStrip, byte flag) { int i; byte *mask_ptr; const byte *z_plane_ptr; @@ -1960,10 +1965,7 @@ void Gdi::decodeMask(int x, int y, const int width, const int height, if (offs) { z_plane_ptr = zplane_list[i] + offs; - if (tmsk_ptr) { - const byte *tmsk = tmsk_ptr + READ_LE_UINT16(tmsk_ptr + stripnr * 2 + 8); - decompressTMSK(mask_ptr, tmsk, z_plane_ptr, height); - } else if (transpStrip && (flag & dbAllowMaskOr)) { + if (transpStrip && (flag & dbAllowMaskOr)) { decompressMaskImgOr(mask_ptr, z_plane_ptr, height); } else { decompressMaskImg(mask_ptr, z_plane_ptr, height); @@ -1978,9 +1980,46 @@ void Gdi::decodeMask(int x, int y, const int width, const int height, } } +void GdiHE::decodeMask(int x, int y, const int width, const int height, + int stripnr, int numzbuf, const byte *zplane_list[9], + bool transpStrip, byte flag) { + int i; + byte *mask_ptr; + const byte *z_plane_ptr; + + for (i = 1; i < numzbuf; i++) { + uint32 offs; + + if (!zplane_list[i]) + continue; + + offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8); + + mask_ptr = getMaskBuffer(x, y, i); + + if (offs) { + z_plane_ptr = zplane_list[i] + offs; + + if (_tmskPtr) { + const byte *tmsk = _tmskPtr + READ_LE_UINT16(_tmskPtr + stripnr * 2 + 8); + decompressTMSK(mask_ptr, tmsk, z_plane_ptr, height); + } else if (transpStrip && (flag & dbAllowMaskOr)) { + decompressMaskImgOr(mask_ptr, z_plane_ptr, height); + } else { + decompressMaskImg(mask_ptr, z_plane_ptr, height); + } + + } else { + if (!(transpStrip && (flag & dbAllowMaskOr))) + for (int h = 0; h < height; h++) + mask_ptr[h * _numStrips] = 0; + } + } +} + void GdiNES::decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr) { + bool transpStrip, byte flag) { byte *mask_ptr = getMaskBuffer(x, y, 1); drawStripNESMask(mask_ptr, stripnr, y, height); } @@ -1988,7 +2027,7 @@ void GdiNES::decodeMask(int x, int y, const int width, const int height, #ifdef USE_RGB_COLOR void GdiPCEngine::decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr) { + bool transpStrip, byte flag) { byte *mask_ptr = getMaskBuffer(x, y, 1); drawStripPCEngineMask(mask_ptr, stripnr, y, height); } @@ -1996,14 +2035,14 @@ void GdiPCEngine::decodeMask(int x, int y, const int width, const int height, void GdiV1::decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr) { + bool transpStrip, byte flag) { byte *mask_ptr = getMaskBuffer(x, y, 1); drawStripC64Mask(mask_ptr, stripnr, width, height); } void GdiV2::decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr) { + bool transpStrip, byte flag) { // Do nothing here for V2 games - zplane was already handled. } @@ -2371,7 +2410,7 @@ void Gdi::decompressMaskImg(byte *dst, const byte *src, int height) const { } } -void Gdi::decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const { +void GdiHE::decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const { byte srcbits = 0; byte srcFlag = 0; byte maskFlag = 0; diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h index 3f69d75efd..6da07efd18 100644 --- a/engines/scumm/gfx.h +++ b/engines/scumm/gfx.h @@ -18,9 +18,6 @@ * 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 SCUMM_GFX_H @@ -224,7 +221,6 @@ protected: virtual void writeRoomColor(byte *dst, byte color) const; /* Mask decompressors */ - void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const; void decompressMaskImgOr(byte *dst, const byte *src, int height) const; void decompressMaskImg(byte *dst, const byte *src, int height) const; @@ -237,7 +233,7 @@ protected: virtual void decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr); + bool transpStrip, byte flag); virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, @@ -273,6 +269,24 @@ public: }; }; +class GdiHE : public Gdi { +protected: + const byte *_tmskPtr; + +protected: + void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const; + + virtual void decodeMask(int x, int y, const int width, const int height, + int stripnr, int numzbuf, const byte *zplane_list[9], + bool transpStrip, byte flag); + + virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, + const int x, const int y, const int width, const int height, + int stripnr, int numstrip); +public: + GdiHE(ScummEngine *vm); +}; + class GdiNES : public Gdi { protected: struct { @@ -296,7 +310,7 @@ protected: virtual void decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr); + bool transpStrip, byte flag); virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, @@ -339,7 +353,7 @@ protected: virtual void decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr); + bool transpStrip, byte flag); virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, @@ -376,7 +390,7 @@ protected: virtual void decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr); + bool transpStrip, byte flag); virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, @@ -402,7 +416,7 @@ protected: virtual void decodeMask(int x, int y, const int width, const int height, int stripnr, int numzbuf, const byte *zplane_list[9], - bool transpStrip, byte flag, const byte *tmsk_ptr); + bool transpStrip, byte flag); virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs, const int x, const int y, const int width, const int height, diff --git a/engines/scumm/gfxARM.s b/engines/scumm/gfxARM.s index 9f7c2949b3..92f8951466 100644 --- a/engines/scumm/gfxARM.s +++ b/engines/scumm/gfxARM.s @@ -18,9 +18,6 @@ @ 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$ -@ @ @author Robin Watts (robin@wss.co.uk) .text diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp index 78c7ef23f1..82bb32cdfb 100644 --- a/engines/scumm/gfx_towns.cpp +++ b/engines/scumm/gfx_towns.cpp @@ -17,9 +17,6 @@ * 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/endian.h" diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index e3e25c161c..74183c24d3 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h index f5000bca59..b3405fead0 100644 --- a/engines/scumm/he/animation_he.h +++ b/engines/scumm/he/animation_he.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_HE_ANIMATION_H) && defined(ENABLE_HE) diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index 5cd75a5c62..84562c12d5 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/cup_player_he.h b/engines/scumm/he/cup_player_he.h index 93146fdf85..15bc6b46ba 100644 --- a/engines/scumm/he/cup_player_he.h +++ b/engines/scumm/he/cup_player_he.h @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/he/floodfill_he.cpp b/engines/scumm/he/floodfill_he.cpp index 026a848828..f9d53c6b12 100644 --- a/engines/scumm/he/floodfill_he.cpp +++ b/engines/scumm/he/floodfill_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/floodfill_he.h b/engines/scumm/he/floodfill_he.h index cfc672436c..3f62cc9b81 100644 --- a/engines/scumm/he/floodfill_he.h +++ b/engines/scumm/he/floodfill_he.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_HE_FLOODFILL_HE_H) && defined(ENABLE_HE) diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 830e940322..c49217b650 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -18,9 +18,6 @@ * 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 SCUMM_HE_INTERN_HE_H @@ -132,8 +129,8 @@ public: protected: virtual void allocateArrays(); - virtual int readResTypeList(int id); - virtual uint32 getResourceRoomOffset(int type, int idx); + virtual int readResTypeList(ResType type); + virtual uint32 getResourceRoomOffset(ResType type, ResId idx); virtual void setupOpcodes(); virtual void setupScummVars(); @@ -268,7 +265,7 @@ protected: virtual void resetScummVars(); virtual void readArrayFromIndexFile(); - virtual byte *getStringAddress(int i); + virtual byte *getStringAddress(ResId idx); virtual void readMAXS(int blockSize); virtual void redrawBGAreas(); @@ -292,7 +289,7 @@ protected: void copyScriptString(byte *dst, int dstSize); int findObject(int x, int y, int num, int *args); - int getSoundResourceSize(int id); + int getSoundResourceSize(ResId idx); virtual bool handleNextCharsetCode(Actor *a, int *c); virtual int convertMessageToString(const byte *msg, byte *dst, int dstSize); @@ -557,7 +554,8 @@ protected: class ScummEngine_v100he : public ScummEngine_v99he { protected: - int32 _heResId, _heResType; + ResType _heResType; + int32 _heResId; byte _debugInputBuffer[256]; public: diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp index 297c2992db..a7d808e316 100644 --- a/engines/scumm/he/logic_he.cpp +++ b/engines/scumm/he/logic_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/logic_he.h b/engines/scumm/he/logic_he.h index d097d37e75..e05a05f310 100644 --- a/engines/scumm/he/logic_he.h +++ b/engines/scumm/he/logic_he.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_HE_LOGIC_HE_H) && defined(ENABLE_HE) diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index 49e43a040b..44ba841644 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index ecb094f29b..6b195bec84 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -18,9 +18,6 @@ * 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 "scumm/scumm.h" @@ -32,6 +29,7 @@ #include "audio/decoders/wave.h" #include "graphics/cursorman.h" +#include "graphics/maccursor.h" #include "graphics/wincursor.h" #include "common/archive.h" @@ -172,11 +170,49 @@ bool MacResExtractor::extractResource(int id, CachedCursor *cc) { if (!dataStream) return false; - int keyColor; // HACK: key color is ignored - _resMgr->convertCrsrCursor(dataStream, &cc->bitmap, cc->width, cc->height, cc->hotspotX, cc->hotspotY, - keyColor, _vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette), - &cc->palette, cc->palSize); + // If we don't have a cursor palette, force monochrome cursors + bool forceMonochrome = !_vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette); + + Graphics::MacCursor *macCursor = new Graphics::MacCursor(); + + if (!macCursor->readFromStream(*dataStream, forceMonochrome)) { + delete dataStream; + delete macCursor; + return false; + } + + cc->bitmap = new byte[macCursor->getWidth() * macCursor->getHeight()]; + cc->width = macCursor->getWidth(); + cc->height = macCursor->getHeight(); + cc->hotspotX = macCursor->getHotspotX(); + cc->hotspotY = macCursor->getHotspotY(); + + if (forceMonochrome) { + // Convert to the SCUMM palette + const byte *srcBitmap = macCursor->getSurface(); + + for (int i = 0; i < macCursor->getWidth() * macCursor->getHeight(); i++) { + if (srcBitmap[i] == macCursor->getKeyColor()) // Transparent + cc->bitmap[i] = 255; + else if (srcBitmap[i] == 0) // Black + cc->bitmap[i] = 253; + else // White + cc->bitmap[i] = 254; + } + } else { + // Copy data and palette + // Sanity check. This code assumes that the key color is the same + assert(macCursor->getKeyColor() == 255); + + memcpy(cc->bitmap, macCursor->getSurface(), macCursor->getWidth() * macCursor->getHeight()); + + cc->palette = new byte[256 * 3]; + cc->palSize = 256; + memcpy(cc->palette, macCursor->getPalette(), 256 * 3); + } + + delete macCursor; delete dataStream; return true; } @@ -190,7 +226,7 @@ void ScummEngine_v70he::readRoomsOffsets() { num = READ_LE_UINT16(_heV7RoomOffsets); ptr = _heV7RoomOffsets + 2; for (i = 0; i < num; i++) { - _res->roomoffs[rtRoom][i] = READ_LE_UINT32(ptr); + _res->_types[rtRoom][i]._roomoffs = READ_LE_UINT32(ptr); ptr += 4; } } @@ -217,8 +253,6 @@ void ScummEngine_v70he::readGlobalObjects() { #ifdef ENABLE_HE void ScummEngine_v99he::readMAXS(int blockSize) { if (blockSize == 52) { - debug(0, "ScummEngine_v99he readMAXS: MAXS has blocksize %d", blockSize); - _numVariables = _fileHandle->readUint16LE(); _fileHandle->readUint16LE(); _numRoomVariables = _fileHandle->readUint16LE(); @@ -251,8 +285,6 @@ void ScummEngine_v99he::readMAXS(int blockSize) { void ScummEngine_v90he::readMAXS(int blockSize) { if (blockSize == 46) { - debug(0, "ScummEngine_v90he readMAXS: MAXS has blocksize %d", blockSize); - _numVariables = _fileHandle->readUint16LE(); _fileHandle->readUint16LE(); _numRoomVariables = _fileHandle->readUint16LE(); @@ -285,8 +317,6 @@ void ScummEngine_v90he::readMAXS(int blockSize) { void ScummEngine_v72he::readMAXS(int blockSize) { if (blockSize == 40) { - debug(0, "ScummEngine_v72he readMAXS: MAXS has blocksize %d", blockSize); - _numVariables = _fileHandle->readUint16LE(); _fileHandle->readUint16LE(); _numBitVariables = _numRoomVariables = _fileHandle->readUint16LE(); @@ -311,14 +341,14 @@ void ScummEngine_v72he::readMAXS(int blockSize) { ScummEngine_v6::readMAXS(blockSize); } -byte *ScummEngine_v72he::getStringAddress(int i) { - byte *addr = getResourceAddress(rtString, i); +byte *ScummEngine_v72he::getStringAddress(ResId idx) { + byte *addr = getResourceAddress(rtString, idx); if (addr == NULL) return NULL; return ((ScummEngine_v72he::ArrayHeader *)addr)->data; } -int ScummEngine_v72he::getSoundResourceSize(int id) { +int ScummEngine_v72he::getSoundResourceSize(ResId id) { const byte *ptr; int offs, size; diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index 5d7c70db76..9978869ffc 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -18,9 +18,6 @@ * 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 SCUMM_HE_RESOURCE_HE_H diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 69063a1837..e057ab524a 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE @@ -2353,10 +2350,10 @@ void ScummEngine_v100he::o100_debugInput() { void ScummEngine_v100he::o100_isResourceLoaded() { // Reports percentage of resource loaded by queue - int type; + ResType type; byte subOp = fetchScriptByte(); - /* int idx = */ pop(); + int idx = pop(); switch (subOp) { case 25: @@ -2377,13 +2374,15 @@ void ScummEngine_v100he::o100_isResourceLoaded() { default: error("o100_isResourceLoaded: default case %d", subOp); } + debug(7, "o100_isResourceLoaded(%d,%d)", type, idx); push(100); } void ScummEngine_v100he::o100_getResourceSize() { const byte *ptr; - int size, type; + int size; + ResType type; int resid = pop(); byte subOp = fetchScriptByte(); @@ -2402,7 +2401,7 @@ void ScummEngine_v100he::o100_getResourceSize() { type = rtScript; break; case 72: - push (getSoundResourceSize(resid)); + push(getSoundResourceSize(resid)); return; default: error("o100_getResourceSize: default type %d", subOp); diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 7ecabd55e1..fb070b3e27 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -18,9 +18,6 @@ * 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/archive.h" diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index 9b160151b0..adb2fcac2e 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -364,10 +361,10 @@ void ScummEngine_v70he::o70_getStringLen() { void ScummEngine_v70he::o70_isResourceLoaded() { // Reports percentage of resource loaded by queue - int type; + ResType type; byte subOp = fetchScriptByte(); - /* int idx = */ pop(); + int idx = pop(); switch (subOp) { case 18: @@ -388,6 +385,7 @@ void ScummEngine_v70he::o70_isResourceLoaded() { default: error("o70_isResourceLoaded: default case %d", subOp); } + debug(7, "o70_isResourceLoaded(%d,%d)", type, idx); push(100); } diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp index a800a7d85c..3ad9220ac5 100644 --- a/engines/scumm/he/script_v71he.cpp +++ b/engines/scumm/he/script_v71he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 17bd29d826..8f16bf0f3a 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE @@ -624,15 +621,15 @@ void ScummEngine_v72he::o72_getArrayDimSize() { } void ScummEngine_v72he::o72_getNumFreeArrays() { - byte **addr = _res->address[rtString]; + const ResourceManager::ResTypeData &rtd = _res->_types[rtString]; int i, num = 0; for (i = 1; i < _numArray; i++) { - if (!addr[i]) + if (!rtd[i]._address) num++; } - push (num); + push(num); } void ScummEngine_v72he::o72_roomOps() { @@ -1914,7 +1911,8 @@ void ScummEngine_v72he::o72_writeINI() { void ScummEngine_v72he::o72_getResourceSize() { const byte *ptr; - int size, type; + int size; + ResType type; int resid = pop(); if (_game.heversion == 72) { @@ -1926,7 +1924,7 @@ void ScummEngine_v72he::o72_getResourceSize() { switch (subOp) { case 13: - push (getSoundResourceSize(resid)); + push(getSoundResourceSize(resid)); return; case 14: type = rtRoomImage; diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index c225be4b6c..7970d7806f 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 1a38a99f17..6b632d8ff2 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 4fd7caebf5..5c15a85929 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -18,14 +18,12 @@ * 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 "scumm/actor.h" #include "scumm/file.h" #include "scumm/imuse/imuse.h" +#include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/he/sound_he.h" #include "scumm/he/intern_he.h" @@ -304,13 +302,13 @@ void SoundHE::setOverrideFreq(int freq) { } void SoundHE::setupHEMusicFile() { - int i, total_size; + int i; Common::File musicFile; Common::String buf(_vm->generateFilename(-4)); if (musicFile.open(buf) == true) { musicFile.seek(4, SEEK_SET); - total_size = musicFile.readUint32BE(); + /*int total_size =*/ musicFile.readUint32BE(); musicFile.seek(16, SEEK_SET); _heMusicTracks = musicFile.readUint32LE(); debug(5, "Total music tracks %d", _heMusicTracks); diff --git a/engines/scumm/he/sound_he.h b/engines/scumm/he/sound_he.h index f3a881972e..f487acc7da 100644 --- a/engines/scumm/he/sound_he.h +++ b/engines/scumm/he/sound_he.h @@ -17,9 +17,6 @@ * 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 SCUMM_HE_SOUND_HE_H diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp index c66eed6ae6..0b37673e4a 100644 --- a/engines/scumm/he/sprite_he.cpp +++ b/engines/scumm/he/sprite_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/sprite_he.h b/engines/scumm/he/sprite_he.h index 73a05af579..d28c9f1944 100644 --- a/engines/scumm/he/sprite_he.h +++ b/engines/scumm/he/sprite_he.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_HE_SPRITE_HE_H) && defined(ENABLE_HE) diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 16cbadd65b..4107034fe6 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -18,9 +18,6 @@ * 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$ - * */ #ifdef ENABLE_HE diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h index c255e27d14..ce3fbc27c6 100644 --- a/engines/scumm/he/wiz_he.h +++ b/engines/scumm/he/wiz_he.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_HE_WIZ_HE_H) && defined(ENABLE_HE) diff --git a/engines/scumm/help.cpp b/engines/scumm/help.cpp index a3bb85ab42..59bf79658e 100644 --- a/engines/scumm/help.cpp +++ b/engines/scumm/help.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/help.h b/engines/scumm/help.h index 152dc99c3e..9763da8c00 100644 --- a/engines/scumm/help.h +++ b/engines/scumm/help.h @@ -18,9 +18,6 @@ * 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 SCUMM_HELP_H diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 07fd99c809..fe23b88e52 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -33,6 +30,7 @@ #include "scumm/imuse/imuse.h" #include "scumm/imuse/imuse_internal.h" #include "scumm/imuse/instrument.h" +#include "scumm/resource.h" #include "scumm/saveload.h" #include "scumm/scumm.h" @@ -50,7 +48,6 @@ _enable_gs(false), _sc55(false), _midi_adlib(NULL), _midi_native(NULL), -_base_sounds(NULL), _sysex(NULL), _paused(false), _initialized(false), @@ -103,11 +100,9 @@ IMuseInternal::~IMuseInternal() { } byte *IMuseInternal::findStartOfSound(int sound) { - byte *ptr = NULL; int32 size, pos; - if (_base_sounds) - ptr = _base_sounds[sound]; + byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; if (ptr == NULL) { debug(1, "IMuseInternal::findStartOfSound(): Sound %d doesn't exist", sound); @@ -115,12 +110,12 @@ byte *IMuseInternal::findStartOfSound(int sound) { } // Check for old-style headers first, like 'RO' - if (ptr[4] == 'R' && ptr[5] == 'O'&& ptr[6] != 'L') + if (ptr[0] == 'R' && ptr[1] == 'O'&& ptr[2] != 'L') + return ptr; + if (ptr[4] == 'S' && ptr[5] == 'O') return ptr + 4; - if (ptr[8] == 'S' && ptr[9] == 'O') - return ptr + 8; - ptr += 8; + ptr += 4; size = READ_BE_UINT32(ptr); ptr += 4; @@ -139,16 +134,11 @@ byte *IMuseInternal::findStartOfSound(int sound) { } bool IMuseInternal::isMT32(int sound) { - byte *ptr = NULL; - uint32 tag; - - if (_base_sounds) - ptr = _base_sounds[sound]; - + byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; if (ptr == NULL) return false; - tag = READ_BE_UINT32(ptr + 4); + uint32 tag = READ_BE_UINT32(ptr); switch (tag) { case MKTAG('A','D','L',' '): case MKTAG('A','S','F','X'): // Special AD class for old AdLib sound effects @@ -167,17 +157,17 @@ bool IMuseInternal::isMT32(int sound) { case MKTAG('M','I','D','I'): // Occurs in Sam & Max // HE games use Roland music - if (ptr[12] == 'H' && ptr[13] == 'S') + if (ptr[8] == 'H' && ptr[9] == 'S') return true; else return false; } // Old style 'RO' has equivalent properties to 'ROL' - if (ptr[4] == 'R' && ptr[5] == 'O') + if (ptr[0] == 'R' && ptr[1] == 'O') return true; // Euphony tracks show as 'SO' and have equivalent properties to 'ADL' - if (ptr[8] == 'S' && ptr[9] == 'O') + if (ptr[4] == 'S' && ptr[5] == 'O') return false; error("Unknown music type: '%c%c%c%c'", (char)tag >> 24, (char)tag >> 16, (char)tag >> 8, (char)tag); @@ -186,16 +176,11 @@ bool IMuseInternal::isMT32(int sound) { } bool IMuseInternal::isMIDI(int sound) { - byte *ptr = NULL; - uint32 tag; - - if (_base_sounds) - ptr = _base_sounds[sound]; - + byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; if (ptr == NULL) return false; - tag = READ_BE_UINT32(ptr + 4); + uint32 tag = READ_BE_UINT32(ptr); switch (tag) { case MKTAG('A','D','L',' '): case MKTAG('A','S','F','X'): // Special AD class for old AdLib sound effects @@ -215,11 +200,11 @@ bool IMuseInternal::isMIDI(int sound) { } // Old style 'RO' has equivalent properties to 'ROL' - if (ptr[4] == 'R' && ptr[5] == 'O') + if (ptr[0] == 'R' && ptr[1] == 'O') return true; // Euphony tracks show as 'SO' and have equivalent properties to 'ADL' // FIXME: Right now we're pretending it's GM. - if (ptr[8] == 'S' && ptr[9] == 'O') + if (ptr[4] == 'S' && ptr[5] == 'O') return true; error("Unknown music type: '%c%c%c%c'", (char)tag >> 24, (char)tag >> 16, (char)tag >> 8, (char)tag); @@ -426,11 +411,6 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) { return doCommand_internal(numargs, a); } -void IMuseInternal::setBase(byte **base) { - Common::StackLock lock(_mutex, "IMuseInternal::setBase()"); - _base_sounds = base; -} - uint32 IMuseInternal::property(int prop, uint32 value) { Common::StackLock lock(_mutex, "IMuseInternal::property()"); switch (prop) { @@ -645,6 +625,7 @@ int IMuseInternal::stopSound_internal(int sound) { } int IMuseInternal::stopAllSounds_internal() { + clear_queue(); Player *player = _players; for (int i = ARRAYSIZE(_players); i; i--, player++) { if (player->isActive()) @@ -945,54 +926,22 @@ void IMuseInternal::sequencer_timers(MidiDriver *midi) { } void IMuseInternal::handle_marker(uint id, byte data) { - uint16 *p = 0; - uint pos; - - if (_queue_adding && _queue_sound == id && data == _queue_marker) + if ((_queue_end == _queue_pos) || (_queue_adding && _queue_sound == id && data == _queue_marker)) return; - // Fix for bug #733401, revised for bug #761637: - // It would seem that sometimes a marker is in the queue - // but not at the head position. In the case of our bug, - // this seems to be the result of commands in the queue - // for songs that are no longer playing. So we skip - // ahead to the appropriate marker, effectively chomping - // anything in the queue before it. This fixes the FOA - // end credits music, but needs to be tested for inappopriate - // behavior elsewhere. - pos = _queue_end; - while (pos != _queue_pos) { - p = _cmd_queue[pos].array; - if (p[0] == TRIGGER_ID && p[1] == id && p[2] == data) - break; - pos = (pos + 1) % ARRAYSIZE(_cmd_queue); - } - - if (pos == _queue_pos) + uint16 *p = _cmd_queue[_queue_end].array; + if (p[0] != TRIGGER_ID || id != p[1] || data != p[2]) return; - if (pos != _queue_end) - debug(0, "Skipping entries in iMuse command queue to reach marker"); - _trigger_count--; _queue_cleared = false; - do { - pos = (pos + 1) % ARRAYSIZE(_cmd_queue); - if (_queue_pos == pos) - break; - p = _cmd_queue[pos].array; - if (*p++ != COMMAND_ID) - break; - _queue_end = pos; - - doCommand_internal(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0); - - if (_queue_cleared) - return; - pos = _queue_end; - } while (1); - - _queue_end = pos; + _queue_end = (_queue_end + 1) % ARRAYSIZE(_cmd_queue); + + while (_queue_end != _queue_pos && _cmd_queue[_queue_end].array[0] == COMMAND_ID && !_queue_cleared) { + p = _cmd_queue[_queue_end].array; + doCommand_internal(p[1], p[2], p[3], p[4], p[5], p[6], p[7], 0); + _queue_end = (_queue_end + 1) % ARRAYSIZE(_cmd_queue); + } } int IMuseInternal::get_channel_volume(uint a) { diff --git a/engines/scumm/imuse/imuse.h b/engines/scumm/imuse/imuse.h index 1e3b0fd756..8014b13409 100644 --- a/engines/scumm/imuse/imuse.h +++ b/engines/scumm/imuse/imuse.h @@ -18,9 +18,6 @@ * 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 SCUMM_IMUSE_H @@ -68,7 +65,6 @@ public: virtual bool get_sound_active(int sound) const = 0; virtual int32 doCommand(int numargs, int args[]) = 0; virtual int clear_queue() = 0; - virtual void setBase(byte **base) = 0; virtual uint32 property(int prop, uint32 value) = 0; virtual void addSysexHandler (byte mfgID, sysexfunc handler) = 0; diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h index 7d46650d2e..ec60b22509 100644 --- a/engines/scumm/imuse/imuse_internal.h +++ b/engines/scumm/imuse/imuse_internal.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_INTERNAL @@ -397,7 +394,6 @@ protected: TimerCallbackInfo _timer_info_native; uint32 _game_id; - byte **_base_sounds; // Plug-in SysEx handling. Right now this only supports one // custom SysEx handler for the hardcoded IMUSE_SYSEX_ID @@ -513,7 +509,6 @@ public: int save_or_load(Serializer *ser, ScummEngine *scumm); bool get_sound_active(int sound) const; int32 doCommand(int numargs, int args[]); - void setBase(byte **base); uint32 property(int prop, uint32 value); virtual void addSysexHandler(byte mfgID, sysexfunc handler); diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp index 487429c294..808af23dde 100644 --- a/engines/scumm/imuse/imuse_part.cpp +++ b/engines/scumm/imuse/imuse_part.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp index 4d185d94d7..e7ee935130 100644 --- a/engines/scumm/imuse/imuse_player.cpp +++ b/engines/scumm/imuse/imuse_player.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp index 02996c53d3..955700fc2b 100644 --- a/engines/scumm/imuse/instrument.cpp +++ b/engines/scumm/imuse/instrument.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse/instrument.h b/engines/scumm/imuse/instrument.h index f6108daf16..3555d319e6 100644 --- a/engines/scumm/imuse/instrument.h +++ b/engines/scumm/imuse/instrument.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_INSTRUMENT_H diff --git a/engines/scumm/imuse/sysex.h b/engines/scumm/imuse/sysex.h index bff80de9e7..7dd38e785e 100644 --- a/engines/scumm/imuse/sysex.h +++ b/engines/scumm/imuse/sysex.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_SYSEX_H diff --git a/engines/scumm/imuse/sysex_samnmax.cpp b/engines/scumm/imuse/sysex_samnmax.cpp index cdae767abf..4c4219e7bb 100644 --- a/engines/scumm/imuse/sysex_samnmax.cpp +++ b/engines/scumm/imuse/sysex_samnmax.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp index 78028c6056..6ab71c2fa5 100644 --- a/engines/scumm/imuse/sysex_scumm.cpp +++ b/engines/scumm/imuse/sysex_scumm.cpp @@ -17,9 +17,6 @@ * 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$ */ @@ -75,6 +72,7 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) { part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F)); part->set_pan((p[7] & 0x0F) << 4 | (p[8] & 0x0F)); part->_percussion = player->_isMIDI ? ((p[9] & 0x08) > 0) : false; + part->set_detune((p[11] & 0x0F) << 4 | (p[12] & 0x0F)); part->pitchBendFactor((p[13] & 0x0F) << 4 | (p[14] & 0x0F)); if (part->_percussion) { if (part->_mc) { diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 3831689def..23f57a01b9 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -17,9 +17,6 @@ * 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/system.h" diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index 1e96aa8827..d940b6897f 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -17,9 +17,6 @@ * 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$ */ #if !defined(SCUMM_IMUSE_DIGI_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index cb894d77cc..d6e07bd0ec 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.h b/engines/scumm/imuse_digi/dimuse_bndmgr.h index bed1ac6549..21d3110f8b 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_DIGI_BUNDLE_MGR_H diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index c78e313fc2..69cd89320c 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -17,9 +17,6 @@ * 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/scummsys.h" @@ -209,7 +206,7 @@ int32 decompressADPCM(byte *compInput, byte *compOutput, int channels) { int32 destPos; int16 firstWord; byte initialTablePos[MAX_CHANNELS] = {0, 0}; - int32 initialimcTableEntry[MAX_CHANNELS] = {7, 7}; + //int32 initialimcTableEntry[MAX_CHANNELS] = {7, 7}; int32 initialOutputWord[MAX_CHANNELS] = {0, 0}; int32 totalBitOffset, curTablePos, outputWord; byte *dst; @@ -248,7 +245,7 @@ int32 decompressADPCM(byte *compInput, byte *compOutput, int channels) { for (i = 0; i < channels; i++) { initialTablePos[i] = *src; src += 1; - initialimcTableEntry[i] = READ_BE_UINT32(src); + //initialimcTableEntry[i] = READ_BE_UINT32(src); src += 4; initialOutputWord[i] = READ_BE_UINT32(src); src += 4; diff --git a/engines/scumm/imuse_digi/dimuse_codecs.h b/engines/scumm/imuse_digi/dimuse_codecs.h index 71fd24c3ac..a38f7234dd 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.h +++ b/engines/scumm/imuse_digi/dimuse_codecs.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_DIGI_CODECS_H diff --git a/engines/scumm/imuse_digi/dimuse_music.cpp b/engines/scumm/imuse_digi/dimuse_music.cpp index 5c28917756..adf2560142 100644 --- a/engines/scumm/imuse_digi/dimuse_music.cpp +++ b/engines/scumm/imuse_digi/dimuse_music.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index 02395eed4d..bc030cc242 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 2cd90c4f2b..abd0d68e56 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -17,9 +17,6 @@ * 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$ */ @@ -31,6 +28,7 @@ #include "audio/decoders/vorbis.h" #include "audio/decoders/mp3.h" +#include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/util.h" #include "scumm/imuse_digi/dimuse.h" diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.h b/engines/scumm/imuse_digi/dimuse_sndmgr.h index 7ae9fdccb0..f869c62eb5 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.h @@ -17,9 +17,6 @@ * 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 SCUMM_IMUSE_DIGI_SNDMGR_H diff --git a/engines/scumm/imuse_digi/dimuse_tables.cpp b/engines/scumm/imuse_digi/dimuse_tables.cpp index a7ee35b0df..c27138b765 100644 --- a/engines/scumm/imuse_digi/dimuse_tables.cpp +++ b/engines/scumm/imuse_digi/dimuse_tables.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/imuse_digi/dimuse_tables.h b/engines/scumm/imuse_digi/dimuse_tables.h index 942acd721f..a74941dfea 100644 --- a/engines/scumm/imuse_digi/dimuse_tables.h +++ b/engines/scumm/imuse_digi/dimuse_tables.h @@ -17,9 +17,6 @@ * 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$ */ #if !defined(SCUMM_IMUSE_DIGI_TABLES_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 2a08d56163..0896f9af7d 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -17,9 +17,6 @@ * 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/config-manager.h" diff --git a/engines/scumm/imuse_digi/dimuse_track.h b/engines/scumm/imuse_digi/dimuse_track.h index 8c6625cad1..420db4bb06 100644 --- a/engines/scumm/imuse_digi/dimuse_track.h +++ b/engines/scumm/imuse_digi/dimuse_track.h @@ -17,9 +17,6 @@ * 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$ */ #if !defined(SCUMM_IMUSE_DIGI_TRACK_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index ab5357f1dd..1a4ed91f1c 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -38,6 +35,7 @@ #include "scumm/he/intern_he.h" #include "scumm/he/logic_he.h" #endif +#include "scumm/resource.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v6.h" #include "scumm/scumm_v8.h" diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index a82c0ae408..b8089ff226 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -31,6 +28,7 @@ #include "scumm/actor.h" #include "scumm/file.h" +#include "scumm/resource.h" #include "scumm/scumm_v7.h" #include "scumm/sound.h" diff --git a/engines/scumm/insane/insane.h b/engines/scumm/insane/insane.h index 499eb70a90..12d44c57f4 100644 --- a/engines/scumm/insane/insane.h +++ b/engines/scumm/insane/insane.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_INSANE_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/insane/insane_ben.cpp b/engines/scumm/insane/insane_ben.cpp index 05775f1585..48aaab505a 100644 --- a/engines/scumm/insane/insane_ben.cpp +++ b/engines/scumm/insane/insane_ben.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index e8d97d3875..68766ab72c 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -91,14 +88,13 @@ int32 Insane::enemyHandler(int num, int32 actor1, int32 actor2, int32 probabilit } int32 Insane::enemy0handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; int32 dist; - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act2damage = _actor[actor2].damage; // ebp - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act2damage = _actor[actor2].damage; // ebp + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (!_actor[actor1].defunct) { if (_enHdlVar[EN_ROTT1][1] > _enHdlVar[EN_ROTT1][2]) { @@ -255,14 +251,13 @@ int32 Insane::enemy0initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy1handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; int32 dist; - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act2damage = _actor[actor2].damage; // ebp - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act2damage = _actor[actor2].damage; // ebp + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (!_actor[actor1].defunct) { if (_enHdlVar[EN_ROTT2][1] > _enHdlVar[EN_ROTT2][2]) { @@ -400,14 +395,13 @@ int32 Insane::enemy1initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy2handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; int32 dist; - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act2damage = _actor[actor2].damage; // ebp - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act2damage = _actor[actor2].damage; // ebp + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (!_actor[actor1].defunct) { if (_enHdlVar[EN_ROTT3][1] > _enHdlVar[EN_ROTT3][2]) { @@ -549,14 +543,13 @@ int32 Insane::enemy2initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy3handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; int32 dist; - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act2damage = _actor[actor2].damage; // ebp - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act2damage = _actor[actor2].damage; // ebp + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (!_actor[actor1].defunct) { if (_enHdlVar[EN_VULTF1][1] > _enHdlVar[EN_VULTF1][2]) { @@ -706,14 +699,13 @@ int32 Insane::enemy3initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy4handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; int32 dist; - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act2damage = _actor[actor2].damage; // ebp - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act2damage = _actor[actor2].damage; // ebp + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (!_actor[actor1].defunct) { if (_enHdlVar[EN_VULTM1][1] > _enHdlVar[EN_VULTM1][2]) { @@ -876,15 +868,12 @@ int32 Insane::enemy4initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy5handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act1x, act2x, retval; - int32 dist; + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // ebp - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // ebp - - dist = ABS(act1x - act2x); + int32 dist = ABS(act1x - act2x); if (weaponMaxRange(actor1) >= dist) { if (!_enHdlVar[EN_VULTF2][2]) @@ -1022,19 +1011,16 @@ int32 Insane::enemy5initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy6handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act2damage, act1x, act2x, retval; - int32 dist; - - retval = 0; - act1damage = _actor[actor1].damage; // ebx //ebx - act2damage = _actor[actor2].damage; // ebp // edi - act1x = _actor[actor1].x; // esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx //ebx + //int32 act2damage = _actor[actor2].damage; // ebp // edi + int32 act1x = _actor[actor1].x; // esi + int32 act2x = _actor[actor2].x; // edi if (_actor[actor2].weapon == INV_CHAINSAW) retval = 1; - dist = ABS(act1x - act2x); + int32 dist = ABS(act1x - act2x); if (_actor[actor1].defunct) { /* scenePropIdx[18] */ @@ -1163,15 +1149,12 @@ int32 Insane::enemy6initializer(int32 actor1, int32 actor2, int32 probability) { } int32 Insane::enemy7handler(int32 actor1, int32 actor2, int32 probability) { - int32 act1damage, act1x, act2x, retval; - int32 dist; - - retval = 0; - act1damage = _actor[actor1].damage; // ebx - act1x = _actor[actor1].x; // ebp, esi - act2x = _actor[actor2].x; // edi + int32 retval = 0; + int32 act1damage = _actor[actor1].damage; // ebx + int32 act1x = _actor[actor1].x; // ebp, esi + int32 act2x = _actor[actor2].x; // edi - dist = ABS(act1x - act2x); + int32 dist = ABS(act1x - act2x); if (_enHdlVar[EN_CAVEFISH][1] >= 600) { _enHdlVar[EN_CAVEFISH][2] = 1; diff --git a/engines/scumm/insane/insane_iact.cpp b/engines/scumm/insane/insane_iact.cpp index 265931ecc2..3592d67c18 100644 --- a/engines/scumm/insane/insane_iact.cpp +++ b/engines/scumm/insane/insane_iact.cpp @@ -18,9 +18,6 @@ * 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 "scumm/scumm_v7.h" diff --git a/engines/scumm/insane/insane_scenes.cpp b/engines/scumm/insane/insane_scenes.cpp index 36a3f5a8b7..841fedafe2 100644 --- a/engines/scumm/insane/insane_scenes.cpp +++ b/engines/scumm/insane/insane_scenes.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/midiparser_ro.cpp b/engines/scumm/midiparser_ro.cpp index be77e4fd66..1a31d1ca82 100644 --- a/engines/scumm/midiparser_ro.cpp +++ b/engines/scumm/midiparser_ro.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/music.h b/engines/scumm/music.h index 6285412ffd..a527c77b72 100644 --- a/engines/scumm/music.h +++ b/engines/scumm/music.h @@ -18,9 +18,6 @@ * 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 SCUMM_MUSIC_H diff --git a/engines/scumm/nut_renderer.cpp b/engines/scumm/nut_renderer.cpp index 7f250e45e0..048b29d68b 100644 --- a/engines/scumm/nut_renderer.cpp +++ b/engines/scumm/nut_renderer.cpp @@ -17,9 +17,6 @@ * 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$ */ diff --git a/engines/scumm/nut_renderer.h b/engines/scumm/nut_renderer.h index 5783646d11..acccf161fa 100644 --- a/engines/scumm/nut_renderer.h +++ b/engines/scumm/nut_renderer.h @@ -17,9 +17,6 @@ * 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$ */ #if !defined(SCUMM_NUT_RENDERER_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index c2547f74f4..fb99d6ce7d 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -18,9 +18,6 @@ * 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 "scumm/actor.h" @@ -195,8 +192,11 @@ void ScummEngine::clearOwnerOf(int obj) { if (!_inventory[i] && _inventory[i+1]) { _inventory[i] = _inventory[i+1]; _inventory[i+1] = 0; - _res->address[rtInventory][i] = _res->address[rtInventory][i + 1]; - _res->address[rtInventory][i + 1] = NULL; + // FIXME FIXME FIXME: This is incomplete, as we do not touch flags, status... BUG + _res->_types[rtInventory][i]._address = _res->_types[rtInventory][i + 1]._address; + _res->_types[rtInventory][i]._size = _res->_types[rtInventory][i + 1]._size; + _res->_types[rtInventory][i + 1]._address = NULL; + _res->_types[rtInventory][i + 1]._size = 0; } } break; @@ -1799,7 +1799,7 @@ int ScummEngine::findLocalObjectSlot() { int ScummEngine::findFlObjectSlot() { int i; for (i = 1; i < _numFlObject; i++) { - if (_res->address[rtFlObject][i] == NULL) + if (_res->_types[rtFlObject][i]._address == NULL) return i; } error("findFlObjectSlot: Out of FLObject slots"); diff --git a/engines/scumm/object.h b/engines/scumm/object.h index 2a817b2b88..cdf8b09e6f 100644 --- a/engines/scumm/object.h +++ b/engines/scumm/object.h @@ -17,9 +17,6 @@ * 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 SCUMM_OBJECT_H diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index b0786c924d..b85771e897 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -17,9 +17,6 @@ * 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/system.h" @@ -1009,9 +1006,6 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { } void ScummEngine::setCurrentPalette(int palindex) { - // TODO: This method could almost be moved to ScummEngin_v6, the only - // problem is that it is called by ScummEngine::resetRoomSubBlocks(). - // But it should be possible to get rid of that, too (with some care). const byte *pals; _curPalIndex = palindex; diff --git a/engines/scumm/player_mod.cpp b/engines/scumm/player_mod.cpp index 657595fab1..6411f0a17a 100644 --- a/engines/scumm/player_mod.cpp +++ b/engines/scumm/player_mod.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h index 3f97c4cab9..619d83541d 100644 --- a/engines/scumm/player_mod.h +++ b/engines/scumm/player_mod.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_MOD_H diff --git a/engines/scumm/player_nes.cpp b/engines/scumm/player_nes.cpp index 5f792401e0..3f8bcef8b7 100644 --- a/engines/scumm/player_nes.cpp +++ b/engines/scumm/player_nes.cpp @@ -18,9 +18,6 @@ * aint32 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 DISABLE_NES_APU diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h index 402eea7bf8..be1617e0f6 100644 --- a/engines/scumm/player_nes.h +++ b/engines/scumm/player_nes.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_NES_H diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/player_pce.cpp index 46d976773d..786971c683 100644 --- a/engines/scumm/player_pce.cpp +++ b/engines/scumm/player_pce.cpp @@ -18,9 +18,6 @@ * 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$ - * */ /* diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h index 42153e8abc..eb6afd892a 100644 --- a/engines/scumm/player_pce.h +++ b/engines/scumm/player_pce.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_PCE_H diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/player_sid.cpp index 11468f3097..f0f60a3924 100644 --- a/engines/scumm/player_sid.cpp +++ b/engines/scumm/player_sid.cpp @@ -18,9 +18,6 @@ * 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 DISABLE_SID diff --git a/engines/scumm/player_sid.h b/engines/scumm/player_sid.h index 71497cc6f4..baeb7bbef0 100644 --- a/engines/scumm/player_sid.h +++ b/engines/scumm/player_sid.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_SID_H diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp index 8922ff1730..5d49478cb0 100644 --- a/engines/scumm/player_towns.cpp +++ b/engines/scumm/player_towns.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -29,10 +26,8 @@ namespace Scumm { -Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _numSoundMax(isVersion2 ? 256 : 200) { +Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _intf(0), _numSoundMax(isVersion2 ? 256 : 200), _unkFlags(0x33) { memset(_pcmCurrentSound, 0, sizeof(_pcmCurrentSound)); - _unkFlags = 0x33; - _intf = 0; } void Player_Towns::setSfxVolume(int vol) { @@ -505,15 +500,15 @@ void Player_Towns_v1::playEuphonyTrack(int sound, const uint8 *data) { const uint8 *trackData = src + 150; for (int i = 0; i < 32; i++) - _driver->chanEnable(i, *src++); + _driver->configChan_enable(i, *src++); for (int i = 0; i < 32; i++) - _driver->chanMode(i, 0xff); + _driver->configChan_setMode(i, 0xff); for (int i = 0; i < 32; i++) - _driver->chanOrdr(i, *src++); + _driver->configChan_remap(i, *src++); for (int i = 0; i < 32; i++) - _driver->chanVolumeShift(i, *src++); + _driver->configChan_adjustVolume(i, *src++); for (int i = 0; i < 32; i++) - _driver->chanNoteShift(i, *src++); + _driver->configChan_setTranspose(i, *src++); src += 8; for (int i = 0; i < 6; i++) @@ -579,15 +574,15 @@ void Player_Towns_v1::playCdaTrack(int sound, const uint8 *data, bool skipTrackV _cdaCurrentSound = sound; } -Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, IMuse *imuse, Audio::Mixer *mixer, bool disposeIMuse) : Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse) { +Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse) : Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse), _sblData(0) { _soundOverride = new SoundOvrParameters[_numSoundMax]; memset(_soundOverride, 0, _numSoundMax * sizeof(SoundOvrParameters)); - _sblData = 0; _intf = new TownsAudioInterface(mixer, 0); } Player_Towns_v2::~Player_Towns_v2() { delete _intf; + _intf = 0; if (_imuseDispose) delete _imuse; diff --git a/engines/scumm/player_towns.h b/engines/scumm/player_towns.h index fda8bd4042..470020d621 100644 --- a/engines/scumm/player_towns.h +++ b/engines/scumm/player_towns.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_TOWNS_H @@ -29,6 +26,7 @@ #include "scumm/scumm.h" #include "scumm/imuse/imuse.h" #include "audio/softsynth/fmtowns_pc98/towns_euphony.h" +#include "audio/softsynth/fmtowns_pc98/towns_midi.h" namespace Scumm { @@ -144,7 +142,7 @@ private: class Player_Towns_v2 : public Player_Towns { public: - Player_Towns_v2(ScummEngine *vm, IMuse *imuse, Audio::Mixer *mixer, bool disposeIMuse); + Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse); ~Player_Towns_v2(); bool init(); @@ -172,6 +170,7 @@ private: SoundOvrParameters *_soundOverride; uint8 *_sblData; + IMuse *_imuse; const bool _imuseDispose; }; diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/player_v1.cpp index f2487c0a57..8afede8c5a 100644 --- a/engines/scumm/player_v1.cpp +++ b/engines/scumm/player_v1.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/player_v1.h b/engines/scumm/player_v1.h index acba13e475..9e6063adc9 100644 --- a/engines/scumm/player_v1.h +++ b/engines/scumm/player_v1.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V1_H diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/player_v2.cpp index a66e248ecc..6910f5e0db 100644 --- a/engines/scumm/player_v2.cpp +++ b/engines/scumm/player_v2.cpp @@ -18,9 +18,6 @@ * 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 "scumm/player_v2.h" diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h index 6a0b3d6d5e..14a0b9c1e0 100644 --- a/engines/scumm/player_v2.h +++ b/engines/scumm/player_v2.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V2_H diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp index cee77024ca..ed97c4098f 100644 --- a/engines/scumm/player_v2a.cpp +++ b/engines/scumm/player_v2a.cpp @@ -18,9 +18,6 @@ * 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 "engines/engine.h" diff --git a/engines/scumm/player_v2a.h b/engines/scumm/player_v2a.h index d60040bd76..719d5491ea 100644 --- a/engines/scumm/player_v2a.h +++ b/engines/scumm/player_v2a.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V2A_H diff --git a/engines/scumm/player_v2base.cpp b/engines/scumm/player_v2base.cpp index 61c91aae85..0d3ad4b1b3 100644 --- a/engines/scumm/player_v2base.cpp +++ b/engines/scumm/player_v2base.cpp @@ -18,9 +18,6 @@ * 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 "scumm/player_v2base.h" diff --git a/engines/scumm/player_v2base.h b/engines/scumm/player_v2base.h index bd910b8a78..2f048070ad 100644 --- a/engines/scumm/player_v2base.h +++ b/engines/scumm/player_v2base.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V2BASE_H diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp index b081a68428..21e7f193b5 100644 --- a/engines/scumm/player_v2cms.cpp +++ b/engines/scumm/player_v2cms.cpp @@ -18,9 +18,6 @@ * 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 "scumm/player_v2cms.h" diff --git a/engines/scumm/player_v2cms.h b/engines/scumm/player_v2cms.h index fd939d8505..f7dc0c16b1 100644 --- a/engines/scumm/player_v2cms.h +++ b/engines/scumm/player_v2cms.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V2CMS_H diff --git a/engines/scumm/player_v3a.cpp b/engines/scumm/player_v3a.cpp index cffbd729ea..472cd1252b 100644 --- a/engines/scumm/player_v3a.cpp +++ b/engines/scumm/player_v3a.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/player_v3a.h b/engines/scumm/player_v3a.h index d3d1e5eeb5..9449664e9b 100644 --- a/engines/scumm/player_v3a.h +++ b/engines/scumm/player_v3a.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V3A_H diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp index 53c9e6b93c..e791736f0e 100644 --- a/engines/scumm/player_v4a.cpp +++ b/engines/scumm/player_v4a.cpp @@ -18,9 +18,6 @@ * 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 "engines/engine.h" diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h index 458a39b5fe..b51ca2f993 100644 --- a/engines/scumm/player_v4a.h +++ b/engines/scumm/player_v4a.h @@ -18,9 +18,6 @@ * 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 SCUMM_PLAYER_V4A_H diff --git a/engines/scumm/proc3ARM.s b/engines/scumm/proc3ARM.s index 5acfa86c29..5833bcf90b 100644 --- a/engines/scumm/proc3ARM.s +++ b/engines/scumm/proc3ARM.s @@ -18,9 +18,6 @@ @ 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$ -@ @ @author Robin Watts (robin@wss.co.uk) .text diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index c872a83d14..0448f60593 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -18,9 +18,6 @@ * 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/str.h" @@ -55,7 +52,7 @@ enum { -extern const char *resTypeFromId(int id); +extern const char *nameOfResType(ResType type); static uint16 newTag2Old(uint32 newTag); static const byte *findResourceSmall(uint32 tag, const byte *searchin); @@ -86,8 +83,8 @@ void ScummEngine::openRoom(const int room) { // Load the disk numer / room offs (special case for room 0 exists because // room 0 contains the data which is used to create the roomno / roomoffs // tables -- hence obviously we mustn't use those when loading room 0. - const uint32 diskNumber = room ? _res->roomno[rtRoom][room] : 0; - const uint32 room_offs = room ? _res->roomoffs[rtRoom][room] : 0; + const uint32 diskNumber = room ? _res->_types[rtRoom][room]._roomno : 0; + const uint32 room_offs = room ? _res->_types[rtRoom][room]._roomoffs : 0; // FIXME: Since room_offs is const, clearly the following loop either // is never entered, or loops forever (if it wasn't for the return/error @@ -97,7 +94,7 @@ void ScummEngine::openRoom(const int room) { while (room_offs != RES_INVALID_OFFSET) { if (room_offs != 0 && room != 0 && _game.heversion < 98) { - _fileOffset = _res->roomoffs[rtRoom][room]; + _fileOffset = _res->_types[rtRoom][room]._roomoffs; return; } @@ -125,7 +122,7 @@ void ScummEngine::openRoom(const int room) { return; deleteRoomOffsets(); readRoomsOffsets(); - _fileOffset = _res->roomoffs[rtRoom][room]; + _fileOffset = _res->_types[rtRoom][room]._roomoffs; if (_fileOffset != 8) return; @@ -160,15 +157,13 @@ void ScummEngine::closeRoom() { /** Delete the currently loaded room offsets. */ void ScummEngine::deleteRoomOffsets() { for (int i = 0; i < _numRooms; i++) { - if (_res->roomoffs[rtRoom][i] != RES_INVALID_OFFSET) - _res->roomoffs[rtRoom][i] = 0; + if (_res->_types[rtRoom][i]._roomoffs != RES_INVALID_OFFSET) + _res->_types[rtRoom][i]._roomoffs = 0; } } /** Read room offsets */ void ScummEngine::readRoomsOffsets() { - debug(9, "readRoomOffsets()"); - if (_game.features & GF_SMALL_HEADER) { _fileHandle->seek(12, SEEK_SET); // Directly searching for the room offset block would be more generic... } else { @@ -179,8 +174,8 @@ void ScummEngine::readRoomsOffsets() { while (num--) { int room = _fileHandle->readByte(); int offset = _fileHandle->readUint32LE(); - if (_res->roomoffs[rtRoom][room] != RES_INVALID_OFFSET) { - _res->roomoffs[rtRoom][room] = offset; + if (_res->_types[rtRoom][room]._roomoffs != RES_INVALID_OFFSET) { + _res->_types[rtRoom][room]._roomoffs = offset; } } } @@ -303,6 +298,7 @@ void ScummEngine::readIndexFile() { break; numblock++; + debug(2, "Reading index block of type '%s', size %d", tag2str(blocktype), itemsize); readIndexBlock(blocktype, itemsize); } @@ -352,7 +348,6 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) { char *ptr; switch (blocktype) { case MKTAG('A','N','A','M'): // Used by: The Dig, FT - debug(9, "found ANAM block, reading audio names"); num = _fileHandle->readUint16LE(); ptr = (char*)malloc(num * 9); _fileHandle->read(ptr, num * 9); @@ -421,7 +416,6 @@ void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) { break; case MKTAG('D','O','B','J'): - debug(9, "found DOBJ block, reading object table"); readGlobalObjects(); break; @@ -488,73 +482,78 @@ void ScummEngine::readArrayFromIndexFile() { error("readArrayFromIndexFile() not supported in pre-V6 games"); } -int ScummEngine::readResTypeList(int id) { - int num; - int i; - - debug(9, "readResTypeList(%s)", resTypeFromId(id)); +int ScummEngine::readResTypeList(ResType type) { + uint num; + ResId idx; if (_game.version == 8) num = _fileHandle->readUint32LE(); else num = _fileHandle->readUint16LE(); - if (num != _res->num[id]) { - error("Invalid number of %ss (%d) in directory", resTypeFromId(id), num); + if (num != _res->_types[type].size()) { + error("Invalid number of %ss (%d) in directory", nameOfResType(type), num); } - for (i = 0; i < num; i++) { - _res->roomno[id][i] = _fileHandle->readByte(); + debug(2, " readResTypeList(%s): %d entries", nameOfResType(type), num); + + + for (idx = 0; idx < num; idx++) { + _res->_types[type][idx]._roomno = _fileHandle->readByte(); } - for (i = 0; i < num; i++) { - _res->roomoffs[id][i] = _fileHandle->readUint32LE(); + for (idx = 0; idx < num; idx++) { + _res->_types[type][idx]._roomoffs = _fileHandle->readUint32LE(); } return num; } -int ScummEngine_v70he::readResTypeList(int id) { - int num; - int i; +int ScummEngine_v70he::readResTypeList(ResType type) { + uint num; + ResId idx; - num = ScummEngine::readResTypeList(id); + num = ScummEngine::readResTypeList(type); - if (id == rtRoom) - for (i = 0; i < num; i++) { - _heV7RoomIntOffsets[i] = _res->roomoffs[rtRoom][i]; + if (type == rtRoom) + for (idx = 0; idx < num; idx++) { + _heV7RoomIntOffsets[idx] = _res->_types[rtRoom][idx]._roomoffs; } - for (i = 0; i < num; i++) { - _res->globsize[id][i] = _fileHandle->readUint32LE(); + for (idx = 0; idx < num; idx++) { + // The globsize is currently not being used + /*_res->_types[type][idx]._globsize =*/ _fileHandle->readUint32LE(); } return num; } -void ResourceManager::allocResTypeData(int id, uint32 tag, int num_, const char *name_, int mode_) { - debug(9, "allocResTypeData(%s/%s,%s,%d,%d)", resTypeFromId(id), name_, tag2str(TO_BE_32(tag)), num_, mode_); - assert(id >= 0 && id < (int)(ARRAYSIZE(this->mode))); +void ResourceManager::allocResTypeData(ResType type, uint32 tag, int num, ResTypeMode mode) { + debug(2, "allocResTypeData(%s,%s,%d,%d)", nameOfResType(type), tag2str(TO_BE_32(tag)), num, mode); + assert(type >= 0 && type < (int)(ARRAYSIZE(_types))); - if (num_ >= 8000) - error("Too many %ss (%d) in directory", name_, num_); + if (num >= 8000) + error("Too many %s resources (%d) in directory", nameOfResType(type), num); - mode[id] = mode_; - num[id] = num_; - tags[id] = tag; - name[id] = name_; - address[id] = (byte **)calloc(num_, sizeof(void *)); - flags[id] = (byte *)calloc(num_, sizeof(byte)); - status[id] = (byte *)calloc(num_, sizeof(byte)); + _types[type]._mode = mode; + _types[type]._tag = tag; - if (mode_) { - roomno[id] = (byte *)calloc(num_, sizeof(byte)); - roomoffs[id] = (uint32 *)calloc(num_, sizeof(uint32)); + // If there was data in there, let's clear it out completely. This is important + // in case we are restarting the game. + _types[type].clear(); + _types[type].resize(num); + +/* + TODO: Use multiple Resource subclasses, one for each res mode; then, + given them serializability. + if (mode) { + _types[type].roomno = (byte *)calloc(num, sizeof(byte)); + _types[type].roomoffs = (uint32 *)calloc(num, sizeof(uint32)); } if (_vm->_game.heversion >= 70) { - globsize[id] = (uint32 *)calloc(num_, sizeof(uint32)); + _types[type].globsize = (uint32 *)calloc(num, sizeof(uint32)); } - +*/ } void ScummEngine::loadCharset(int no) { @@ -588,16 +587,14 @@ void ScummEngine::nukeCharset(int i) { _res->nukeResource(rtCharset, i); } -void ScummEngine::ensureResourceLoaded(int type, int i) { - void *addr = NULL; - - debugC(DEBUG_RESOURCE, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i); +void ScummEngine::ensureResourceLoaded(ResType type, ResId idx) { + debugC(DEBUG_RESOURCE, "ensureResourceLoaded(%s,%d)", nameOfResType(type), idx); - if ((type == rtRoom) && i > 0x7F && _game.version < 7 && _game.heversion <= 71) { - i = _resourceMapper[i & 0x7F]; + if ((type == rtRoom) && idx > 0x7F && _game.version < 7 && _game.heversion <= 71) { + idx = _resourceMapper[idx & 0x7F]; } - // FIXME: This check used to be "i==0". However, that causes + // FIXME: This check used to be "idx==0". However, that causes // problems when using this function to ensure charset 0 is loaded. // This is done for many games, e.g. Zak256 or Indy3 (EGA and VGA). // For now we restrict the check to anything which is not a charset. @@ -608,27 +605,24 @@ void ScummEngine::ensureResourceLoaded(int type, int i) { // our code base? After all we also have to add special cases for many // of our script opcodes that check for the (invalid) actor 0... so // maybe both issues are related... - if (type != rtCharset && i == 0) + if (type != rtCharset && idx == 0) return; - if (i <= _res->num[type]) - addr = _res->address[type][i]; - - if (addr) + if (idx <= _res->_types[type].size() && _res->_types[type][idx]._address) return; - loadResource(type, i); + loadResource(type, idx); - if (_game.version == 5 && type == rtRoom && i == _roomResource) + if (_game.version == 5 && type == rtRoom && (int)idx == _roomResource) VAR(VAR_ROOM_FLAG) = 1; } -int ScummEngine::loadResource(int type, int idx) { +int ScummEngine::loadResource(ResType type, ResId idx) { int roomNr; uint32 fileOffs; uint32 size, tag; - debugC(DEBUG_RESOURCE, "loadResource(%s,%d)", resTypeFromId(type), idx); + debugC(DEBUG_RESOURCE, "loadResource(%s,%d)", nameOfResType(type), idx); if (type == rtCharset && (_game.features & GF_SMALL_HEADER)) { loadCharset(idx); @@ -637,8 +631,8 @@ int ScummEngine::loadResource(int type, int idx) { roomNr = getResourceRoomNr(type, idx); - if (idx >= _res->num[type]) - error("%s %d undefined %d %d", _res->name[type], idx, _res->num[type], roomNr); + if (idx >= _res->_types[type].size()) + error("%s %d undefined %d %d", nameOfResType(type), idx, _res->_types[type].size(), roomNr); if (roomNr == 0) roomNr = _roomResource; @@ -672,11 +666,19 @@ int ScummEngine::loadResource(int type, int idx) { return readSoundResource(idx); } + // Sanity check: Is this the right tag for this resource type? + // + // Currently disabled for newer HE games because they use different + // tags. For example, for rtRoom, 'ROOM' changed to 'RMDA'; and for + // rtImage, 'AWIZ' and 'MULT' can both occur simultaneously. + // On the long run, it would be preferable to not turn this check off, + // but instead to explicitly support the variations in the HE games. tag = _fileHandle->readUint32BE(); - - if (tag != _res->tags[type] && _game.heversion < 70) { - error("%s %d not in room %d at %d+%d in file %s", - _res->name[type], idx, roomNr, + if (tag != _res->_types[type]._tag && _game.heversion < 70) { + error("Unknown res tag '%s' encountered (expected '%s') " + "while trying to load res (%s,%d) in room %d at %d+%d in file %s", + tag2str(tag), tag2str(_res->_types[type]._tag), + nameOfResType(type), idx, roomNr, _fileOffset, fileOffs, _fileHandle->getName()); } @@ -697,35 +699,33 @@ int ScummEngine::loadResource(int type, int idx) { return 1; } -int ScummEngine::getResourceRoomNr(int type, int idx) { +int ScummEngine::getResourceRoomNr(ResType type, ResId idx) { if (type == rtRoom && _game.heversion < 70) return idx; - return _res->roomno[type][idx]; + return _res->_types[type][idx]._roomno; } -uint32 ScummEngine::getResourceRoomOffset(int type, int idx) { +uint32 ScummEngine::getResourceRoomOffset(ResType type, ResId idx) { if (type == rtRoom) { return (_game.version == 8) ? 8 : 0; } - return _res->roomoffs[type][idx]; + return _res->_types[type][idx]._roomoffs; } -uint32 ScummEngine_v70he::getResourceRoomOffset(int type, int idx) { +uint32 ScummEngine_v70he::getResourceRoomOffset(ResType type, ResId idx) { if (type == rtRoom) { return _heV7RoomIntOffsets[idx]; } - return _res->roomoffs[type][idx]; + return _res->_types[type][idx]._roomoffs; } -int ScummEngine::getResourceSize(int type, int idx) { +int ScummEngine::getResourceSize(ResType type, ResId idx) { byte *ptr = getResourceAddress(type, idx); assert(ptr); - MemBlkHeader *hdr = (MemBlkHeader *)(ptr - sizeof(MemBlkHeader)); - - return hdr->size; + return _res->_types[type][idx]._size; } -byte *ScummEngine::getResourceAddress(int type, int idx) { +byte *ScummEngine::getResourceAddress(ResType type, ResId idx) { byte *ptr; if (_game.heversion >= 80 && type == rtString) @@ -734,33 +734,30 @@ byte *ScummEngine::getResourceAddress(int type, int idx) { if (!_res->validateResource("getResourceAddress", type, idx)) return NULL; - if (!_res->address[type]) { - debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d), _res->address[type] == NULL", resTypeFromId(type), idx); - return NULL; - } - - if (_res->mode[type] && !_res->address[type][idx]) { + // If the resource is missing, but loadable from the game data files, try to do so. + if (!_res->_types[type][idx]._address && _res->_types[type]._mode != kDynamicResTypeMode) { ensureResourceLoaded(type, idx); } - if (!(ptr = (byte *)_res->address[type][idx])) { - debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx); + ptr = (byte *)_res->_types[type][idx]._address; + if (!ptr) { + debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == NULL", nameOfResType(type), idx); return NULL; } _res->setResourceCounter(type, idx, 1); - debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader)); - return ptr + sizeof(MemBlkHeader); + debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", nameOfResType(type), idx, ptr); + return ptr; } -byte *ScummEngine::getStringAddress(int i) { - byte *addr = getResourceAddress(rtString, i); +byte *ScummEngine::getStringAddress(ResId idx) { + byte *addr = getResourceAddress(rtString, idx); return addr; } -byte *ScummEngine_v6::getStringAddress(int i) { - byte *addr = getResourceAddress(rtString, i); +byte *ScummEngine_v6::getStringAddress(ResId idx) { + byte *addr = getResourceAddress(rtString, idx); if (addr == NULL) return NULL; // Skip over the ArrayHeader @@ -772,35 +769,42 @@ byte *ScummEngine::getStringAddressVar(int i) { } void ResourceManager::increaseExpireCounter() { - if (!(++_expireCounter)) { - increaseResourceCounter(); + ++_expireCounter; + if (_expireCounter == 0) { // overflow? + increaseResourceCounters(); } } -void ResourceManager::increaseResourceCounter() { - int i, j; - byte counter; - - for (i = rtFirst; i <= rtLast; i++) { - for (j = num[i]; --j >= 0;) { - counter = flags[i][j] & RF_USAGE; +void ResourceManager::increaseResourceCounters() { + for (ResType type = rtFirst; type <= rtLast; type = ResType(type + 1)) { + ResId idx = _types[type].size(); + while (idx-- > 0) { + byte counter = _types[type][idx].getResourceCounter(); if (counter && counter < RF_USAGE_MAX) { - setResourceCounter(i, j, counter + 1); + setResourceCounter(type, idx, counter + 1); } } } } -void ResourceManager::setResourceCounter(int type, int idx, byte flag) { - flags[type][idx] &= ~RF_USAGE; - flags[type][idx] |= flag; +void ResourceManager::setResourceCounter(ResType type, ResId idx, byte counter) { + _types[type][idx].setResourceCounter(counter); +} + +void ResourceManager::Resource::setResourceCounter(byte counter) { + _flags &= RF_LOCK; // Clear lower 7 bits, preserve the lock bit. + _flags |= counter; // Update the usage counter +} + +byte ResourceManager::Resource::getResourceCounter() const { + return _flags & RF_USAGE; } /* 2 bytes safety area to make "precaching" of bytes in the gdi drawer easier */ #define SAFETY_AREA 2 -byte *ResourceManager::createResource(int type, int idx, uint32 size) { - debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", resTypeFromId(type), idx, size); +byte *ResourceManager::createResource(ResType type, ResId idx, uint32 size) { + debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", nameOfResType(type), idx, size); if (!validateResource("allocating", type, idx)) return NULL; @@ -810,31 +814,62 @@ byte *ResourceManager::createResource(int type, int idx, uint32 size) { // cases. For instance, Zak tries to reload the intro music // while it's playing. See bug #1253171. - if (address[type][idx] && (type == rtSound || type == rtScript || type == rtCostume)) - return address[type][idx] + sizeof(MemBlkHeader); + if (_types[type][idx]._address && (type == rtSound || type == rtScript || type == rtCostume)) + return _types[type][idx]._address; } nukeResource(type, idx); expireResources(size); - void *ptr = calloc(size + sizeof(MemBlkHeader) + SAFETY_AREA, 1); + byte *ptr = (byte *)calloc(size + SAFETY_AREA, 1); if (ptr == NULL) { - error("createResource(%s,%d): Out of memory while allocating %d", resTypeFromId(type), idx, size); + error("createResource(%s,%d): Out of memory while allocating %d", nameOfResType(type), idx, size); } _allocatedSize += size; - address[type][idx] = (byte *)ptr; - ((MemBlkHeader *)ptr)->size = size; + _types[type][idx]._address = ptr; + _types[type][idx]._size = size; setResourceCounter(type, idx, 1); - return (byte *)ptr + sizeof(MemBlkHeader); /* skip header */ + return ptr; +} + +ResourceManager::Resource::Resource() { + _address = 0; + _size = 0; + _flags = 0; + _status = 0; + _roomno = 0; + _roomoffs = 0; +} + +ResourceManager::Resource::~Resource() { + delete _address; + _address = 0; } -ResourceManager::ResourceManager(ScummEngine *vm) { - memset(this, 0, sizeof(ResourceManager)); - _vm = vm; -// _allocatedSize = 0; +void ResourceManager::Resource::nuke() { + delete _address; + _address = 0; + _size = 0; + _flags = 0; + _status &= ~RS_MODIFIED; +} + +ResourceManager::ResTypeData::ResTypeData() { + _mode = kDynamicResTypeMode; + _tag = 0; +} + +ResourceManager::ResTypeData::~ResTypeData() { +} + +ResourceManager::ResourceManager(ScummEngine *vm) : _vm(vm) { + _allocatedSize = 0; + _maxHeapThreshold = 0; + _minHeapThreshold = 0; + _expireCounter = 0; } ResourceManager::~ResourceManager() { @@ -848,30 +883,20 @@ void ResourceManager::setHeapThreshold(int min, int max) { _minHeapThreshold = min; } -bool ResourceManager::validateResource(const char *str, int type, int idx) const { - if (type < rtFirst || type > rtLast || (uint) idx >= (uint)num[type]) { - error("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx); +bool ResourceManager::validateResource(const char *str, ResType type, ResId idx) const { + if (type < rtFirst || type > rtLast || (uint)idx >= (uint)_types[type].size()) { + error("%s Illegal Glob type %s (%d) num %d", str, nameOfResType(type), type, idx); return false; } return true; } -void ResourceManager::nukeResource(int type, int idx) { - byte *ptr; - - if (!address[type]) - return; - - assert(idx >= 0 && idx < num[type]); - - ptr = address[type][idx]; +void ResourceManager::nukeResource(ResType type, ResId idx) { + byte *ptr = _types[type][idx]._address; if (ptr != NULL) { - debugC(DEBUG_RESOURCE, "nukeResource(%s,%d)", resTypeFromId(type), idx); - address[type][idx] = 0; - flags[type][idx] = 0; - status[type][idx] &= ~RS_MODIFIED; - _allocatedSize -= ((MemBlkHeader *)ptr)->size; - free(ptr); + debugC(DEBUG_RESOURCE, "nukeResource(%s,%d)", nameOfResType(type), idx); + _allocatedSize -= _types[type][idx]._size; + _types[type][idx].nuke(); } } @@ -900,77 +925,96 @@ int ScummEngine::getResourceDataSize(const byte *ptr) const { return READ_BE_UINT32(ptr - 4) - _resourceHeaderSize; } -void ResourceManager::lock(int type, int i) { - if (!validateResource("Locking", type, i)) +void ResourceManager::lock(ResType type, ResId idx) { + if (!validateResource("Locking", type, idx)) return; - flags[type][i] |= RF_LOCK; + _types[type][idx].lock(); } -void ResourceManager::unlock(int type, int i) { - if (!validateResource("Unlocking", type, i)) +void ResourceManager::unlock(ResType type, ResId idx) { + if (!validateResource("Unlocking", type, idx)) return; - flags[type][i] &= ~RF_LOCK; + _types[type][idx].unlock(); } -bool ResourceManager::isLocked(int type, int i) const { - if (!validateResource("isLocked", type, i)) +bool ResourceManager::isLocked(ResType type, ResId idx) const { + if (!validateResource("isLocked", type, idx)) return false; - return (flags[type][i] & RF_LOCK) != 0; + return _types[type][idx].isLocked(); +} + +void ResourceManager::Resource::lock() { + _flags |= RF_LOCK; +} + +void ResourceManager::Resource::unlock() { + _flags &= ~RF_LOCK; } -bool ScummEngine::isResourceInUse(int type, int i) const { - if (!_res->validateResource("isResourceInUse", type, i)) +bool ResourceManager::Resource::isLocked() const { + return (_flags & RF_LOCK) != 0; +} + +bool ScummEngine::isResourceInUse(ResType type, ResId idx) const { + if (!_res->validateResource("isResourceInUse", type, idx)) return false; switch (type) { case rtRoom: - return _roomResource == (byte)i; + return _roomResource == (byte)idx; case rtRoomImage: - return _roomResource == (byte)i; + return _roomResource == (byte)idx; case rtRoomScripts: - return _roomResource == (byte)i; + return _roomResource == (byte)idx; case rtScript: - return isScriptInUse(i); + return isScriptInUse(idx); case rtCostume: - return isCostumeInUse(i); + return isCostumeInUse(idx); case rtSound: // Sound resource 1 is used for queued speech - if (_game.heversion >= 60 && i == 1) + if (_game.heversion >= 60 && idx == 1) return true; else - return _sound->isSoundInUse(i); + return _sound->isSoundInUse(idx); case rtCharset: - return _charset->getCurID() == i; + return _charset->getCurID() == (int)idx; case rtImage: - return _res->isModified(type, i) != 0; + return _res->isModified(type, idx) != 0; case rtSpoolBuffer: - return _sound->isSoundRunning(10000 + i) != 0; + return _sound->isSoundRunning(10000 + idx) != 0; default: return false; } } -void ResourceManager::setModified(int type, int i) { - if (!validateResource("Modified", type, i)) +void ResourceManager::setModified(ResType type, ResId idx) { + if (!validateResource("Modified", type, idx)) return; - status[type][i] |= RS_MODIFIED; + _types[type][idx].setModified(); } -bool ResourceManager::isModified(int type, int i) const { - if (!validateResource("isModified", type, i)) +bool ResourceManager::isModified(ResType type, ResId idx) const { + if (!validateResource("isModified", type, idx)) return false; - return (status[type][i] & RS_MODIFIED) != 0; + return _types[type][idx].isModified(); +} + +void ResourceManager::Resource::setModified() { + _status |= RS_MODIFIED; +} + +bool ResourceManager::Resource::isModified() const { + return (_status & RS_MODIFIED) != 0; } void ResourceManager::expireResources(uint32 size) { - int i, j; - byte flag; byte best_counter; - int best_type, best_res = 0; + ResType best_type; + int best_res = 0; uint32 oldAllocatedSize; if (_expireCounter != 0xFF) { _expireCounter = 0xFF; - increaseResourceCounter(); + increaseResourceCounters(); } if (size + _allocatedSize < _maxHeapThreshold) @@ -979,60 +1023,58 @@ void ResourceManager::expireResources(uint32 size) { oldAllocatedSize = _allocatedSize; do { - best_type = 0; + best_type = rtInvalid; best_counter = 2; - for (i = rtFirst; i <= rtLast; i++) - if (mode[i]) { - for (j = num[i]; --j >= 0;) { - flag = flags[i][j]; - if (!(flag & RF_LOCK) && flag >= best_counter && address[i][j] && !_vm->isResourceInUse(i, j)) { - best_counter = flag; - best_type = i; - best_res = j; + for (ResType type = rtFirst; type <= rtLast; type = ResType(type + 1)) { + if (_types[type]._mode != kDynamicResTypeMode) { + // Resources of this type can be reloaded from the data files, + // so we can potentially unload them to free memory. + ResId idx = _types[type].size(); + while (idx-- > 0) { + Resource &tmp = _types[type][idx]; + byte counter = tmp.getResourceCounter(); + if (!tmp.isLocked() && counter >= best_counter && tmp._address && !_vm->isResourceInUse(type, idx)) { + best_counter = counter; + best_type = type; + best_res = idx; } } } + } if (!best_type) break; nukeResource(best_type, best_res); } while (size + _allocatedSize > _minHeapThreshold); - increaseResourceCounter(); + increaseResourceCounters(); debugC(DEBUG_RESOURCE, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize); } void ResourceManager::freeResources() { - int i, j; - for (i = rtFirst; i <= rtLast; i++) { - for (j = num[i]; --j >= 0;) { - if (isResourceLoaded(i, j)) - nukeResource(i, j); + for (ResType type = rtFirst; type <= rtLast; type = ResType(type + 1)) { + ResId idx = _types[type].size(); + while (idx-- > 0) { + if (isResourceLoaded(type, idx)) + nukeResource(type, idx); } - free(address[i]); - free(flags[i]); - free(status[i]); - free(roomno[i]); - free(roomoffs[i]); - - free(globsize[i]); + _types[type].clear(); } } -void ScummEngine::loadPtrToResource(int type, int resindex, const byte *source) { +void ScummEngine::loadPtrToResource(ResType type, ResId idx, const byte *source) { byte *alloced; int len; - _res->nukeResource(type, resindex); + _res->nukeResource(type, idx); len = resStrLen(source) + 1; - if (len <= 0) return; - alloced = _res->createResource(type, resindex, len); + alloced = _res->createResource(type, idx, len); if (!source) { // Need to refresh the script pointer, since createResource may @@ -1045,32 +1087,30 @@ void ScummEngine::loadPtrToResource(int type, int resindex, const byte *source) } } -bool ResourceManager::isResourceLoaded(int type, int idx) const { +bool ResourceManager::isResourceLoaded(ResType type, ResId idx) const { if (!validateResource("isResourceLoaded", type, idx)) return false; - return address[type][idx] != NULL; + return _types[type][idx]._address != NULL; } void ResourceManager::resourceStats() { - int i, j; uint32 lockedSize = 0, lockedNum = 0; - byte flag; - for (i = rtFirst; i <= rtLast; i++) - for (j = num[i]; --j >= 0;) { - flag = flags[i][j]; - if (flag & RF_LOCK && address[i][j]) { - lockedSize += ((MemBlkHeader *)address[i][j])->size; + for (ResType type = rtFirst; type <= rtLast; type = ResType(type + 1)) { + ResId idx = _types[type].size(); + while (idx-- > 0) { + Resource &tmp = _types[type][idx]; + if (tmp.isLocked() && tmp._address) { + lockedSize += tmp._size; lockedNum++; } } + } debug(1, "Total allocated size=%d, locked=%d(%d)", _allocatedSize, lockedSize, lockedNum); } void ScummEngine_v5::readMAXS(int blockSize) { - debug(9, "ScummEngine_v5 readMAXS: MAXS has blocksize %d", blockSize); - _numVariables = _fileHandle->readUint16LE(); // 800 _fileHandle->readUint16LE(); // 16 _numBitVariables = _fileHandle->readUint16LE(); // 2048 @@ -1099,8 +1139,6 @@ void ScummEngine_v5::readMAXS(int blockSize) { #ifdef ENABLE_SCUMM_7_8 void ScummEngine_v8::readMAXS(int blockSize) { - debug(9, "ScummEngine_v8 readMAXS: MAXS has blocksize %d", blockSize); - _fileHandle->seek(50, SEEK_CUR); // Skip over SCUMM engine version _fileHandle->seek(50, SEEK_CUR); // Skip over data file version _numVariables = _fileHandle->readUint32LE(); // 1500 @@ -1129,8 +1167,6 @@ void ScummEngine_v8::readMAXS(int blockSize) { } void ScummEngine_v7::readMAXS(int blockSize) { - debug(9, "ScummEngine_v7 readMAXS: MAXS has blocksize %d", blockSize); - _fileHandle->seek(50, SEEK_CUR); // Skip over SCUMM engine version _fileHandle->seek(50, SEEK_CUR); // Skip over data file version _numVariables = _fileHandle->readUint16LE(); @@ -1164,8 +1200,6 @@ void ScummEngine_v7::readMAXS(int blockSize) { void ScummEngine_v6::readMAXS(int blockSize) { if (blockSize == 38) { - debug(0, "ScummEngine_v6 readMAXS: MAXS has blocksize %d", blockSize); - _numVariables = _fileHandle->readUint16LE(); _fileHandle->readUint16LE(); _numBitVariables = _fileHandle->readUint16LE(); @@ -1288,35 +1322,35 @@ void ScummEngine::allocateArrays() { } _res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKTAG('A','K','O','S') : MKTAG('C','O','S','T'), - _numCostumes, "costume", 1); - _res->allocResTypeData(rtRoom, MKTAG('R','O','O','M'), _numRooms, "room", 1); - _res->allocResTypeData(rtRoomImage, MKTAG('R','M','I','M'), _numRooms, "room image", 1); - _res->allocResTypeData(rtRoomScripts, MKTAG('R','M','S','C'), _numRooms, "room script", 1); - _res->allocResTypeData(rtSound, MKTAG('S','O','U','N'), _numSounds, "sound", 2); - _res->allocResTypeData(rtScript, MKTAG('S','C','R','P'), _numScripts, "script", 1); - _res->allocResTypeData(rtCharset, MKTAG('C','H','A','R'), _numCharsets, "charset", 1); - _res->allocResTypeData(rtObjectName, 0, _numNewNames, "new name", 0); - _res->allocResTypeData(rtInventory, 0, _numInventory, "inventory", 0); - _res->allocResTypeData(rtTemp, 0, 10, "temp", 0); - _res->allocResTypeData(rtScaleTable, 0, 5, "scale table", 0); - _res->allocResTypeData(rtActorName, 0, _numActors, "actor name", 0); - _res->allocResTypeData(rtVerb, 0, _numVerbs, "verb", 0); - _res->allocResTypeData(rtString, 0, _numArray, "array", 0); - _res->allocResTypeData(rtFlObject, 0, _numFlObject, "flobject", 0); - _res->allocResTypeData(rtMatrix, 0, 10, "boxes", 0); - _res->allocResTypeData(rtImage, MKTAG('A','W','I','Z'), _numImages, "images", 1); - _res->allocResTypeData(rtTalkie, MKTAG('T','L','K','E'), _numTalkies, "talkie", 1); + _numCostumes, kStaticResTypeMode); + _res->allocResTypeData(rtRoom, MKTAG('R','O','O','M'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtRoomImage, MKTAG('R','M','I','M'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtRoomScripts, MKTAG('R','M','S','C'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtSound, MKTAG('S','O','U','N'), _numSounds, kSoundResTypeMode); + _res->allocResTypeData(rtScript, MKTAG('S','C','R','P'), _numScripts, kStaticResTypeMode); + _res->allocResTypeData(rtCharset, MKTAG('C','H','A','R'), _numCharsets, kStaticResTypeMode); + _res->allocResTypeData(rtObjectName, 0, _numNewNames, kDynamicResTypeMode); + _res->allocResTypeData(rtInventory, 0, _numInventory, kDynamicResTypeMode); + _res->allocResTypeData(rtTemp, 0, 10, kDynamicResTypeMode); + _res->allocResTypeData(rtScaleTable, 0, 5, kDynamicResTypeMode); + _res->allocResTypeData(rtActorName, 0, _numActors, kDynamicResTypeMode); + _res->allocResTypeData(rtVerb, 0, _numVerbs, kDynamicResTypeMode); + _res->allocResTypeData(rtString, 0, _numArray, kDynamicResTypeMode); + _res->allocResTypeData(rtFlObject, 0, _numFlObject, kDynamicResTypeMode); + _res->allocResTypeData(rtMatrix, 0, 10, kDynamicResTypeMode); + _res->allocResTypeData(rtImage, MKTAG('A','W','I','Z'), _numImages, kStaticResTypeMode); + _res->allocResTypeData(rtTalkie, MKTAG('T','L','K','E'), _numTalkies, kStaticResTypeMode); } void ScummEngine_v70he::allocateArrays() { ScummEngine::allocateArrays(); - _res->allocResTypeData(rtSpoolBuffer, 0, 9, "spool buffer", 1); + _res->allocResTypeData(rtSpoolBuffer, 0, 9, kStaticResTypeMode); _heV7RoomIntOffsets = (uint32 *)calloc(_numRooms, sizeof(uint32)); } -void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int length) { +void ScummEngine::dumpResource(const char *tag, int id, const byte *ptr, int length) { char buf[256]; Common::DumpFile out; @@ -1330,7 +1364,7 @@ void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int le else size = READ_BE_UINT32(ptr + 4); - sprintf(buf, "dumps/%s%d.dmp", tag, idx); + sprintf(buf, "dumps/%s%d.dmp", tag, id); out.open(buf); if (out.isOpen() == false) @@ -1499,10 +1533,10 @@ uint16 newTag2Old(uint32 newTag) { } } -const char *resTypeFromId(int id) { +const char *nameOfResType(ResType type) { static char buf[100]; - switch (id) { + switch (type) { case rtRoom: return "Room"; case rtScript: @@ -1545,10 +1579,8 @@ const char *resTypeFromId(int id) { return "Talkie"; case rtSpoolBuffer: return "SpoolBuffer"; - case rtNumTypes: - return "NumTypes"; default: - sprintf(buf, "%d", id); + sprintf(buf, "rt%d", type); return buf; } } diff --git a/engines/scumm/resource.h b/engines/scumm/resource.h index a14b7173a2..e8b0c1eaae 100644 --- a/engines/scumm/resource.h +++ b/engines/scumm/resource.h @@ -17,14 +17,14 @@ * 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 SCUMM_RESOURCE_H #define SCUMM_RESOURCE_H +#include "common/array.h" +#include "scumm/scumm.h" // for ResType + namespace Scumm { enum { @@ -44,6 +44,185 @@ public: const byte *findNext(uint32 tag); }; +enum { + RES_INVALID_OFFSET = 0xFFFFFFFF +}; + +class ScummEngine; + +/** + * The mode of a resource type indicates whether the resource can be restored + * from the game data files or not. + * This affects for example whether the resource is stored in savestates. + * + * Note that we treat sound resources somewhat differently: On the one hand, + * these behave mostly like a kStaticResTypeMode res type. However, when we + * create a savestate, we do save *some* information about them: Namely, which + * sound resources are loaded in memory at the time the save is made. And when + * loading, we invoke ensureResourceLoaded() for each sound resource that was + * marked in this way. + */ +enum ResTypeMode { + kDynamicResTypeMode = 0, ///!< Resource is generated during runtime and may change + kStaticResTypeMode = 1, ///!< Resource comes from data files, does not change + kSoundResTypeMode = 2 ///!< Resource comes from data files, but may change +}; + +/** + * The 'resource manager' class. Currently doesn't really deserve to be called + * a 'class', at least until somebody gets around to OOfying this more. + */ +class ResourceManager { + //friend class ScummDebugger; + //friend class ScummEngine; +protected: + ScummEngine *_vm; + +public: + class Resource { + public: + /** + * Pointer to the data contained in this resource + */ + byte *_address; + + /** + * Size of this resource, i.e. of the data contained in it. + */ + uint32 _size; + + protected: + /** + * The uppermost bit indicates whether the resources is locked. + * The lower 7 bits contain a counter. This counter measures roughly + * how old the resource is; it starts out with a count of 1 and can go + * as high as 127. When memory falls low resp. when the engine decides + * that it should throw out some unused stuff, then it begins by + * removing the resources with the highest counter (excluding locked + * resources and resources that are known to be in use). + */ + byte _flags; + + /** + * The status of the resource. Currently only one bit is used, which + * indicates whether the resource is modified. + */ + byte _status; + + public: + /** + * The id of the room (resp. the disk) the resource is contained in. + */ + byte _roomno; + + /** + * The offset (in bytes) where the data for this resources can be found + * in the game data file(s), relative to the start of the room the + * resource is contained in. + * + * A value of RES_INVALID_OFFSET indicates a resources that is not contained + * in the game data files. + */ + uint32 _roomoffs; + + public: + Resource(); + ~Resource(); + + void nuke(); + + inline void setResourceCounter(byte counter); + inline byte getResourceCounter() const; + + void lock(); + void unlock(); + bool isLocked() const; + + void setModified(); + bool isModified() const; + }; + + /** + * This struct represents a resource type and all resource of that type. + */ + class ResTypeData : public Common::Array<Resource> { + friend class ResourceManager; + public: + /** + * The mode of this res type. + */ + ResTypeMode _mode; + + /** + * The 4-byte tag or chunk type associated to this resource type, if any. + * Only applies to resources that are loaded from the game data files. + * This value is only used for debugging purposes. + */ + uint32 _tag; + + public: + ResTypeData(); + ~ResTypeData(); + }; + ResTypeData _types[rtLast + 1]; + +protected: + uint32 _allocatedSize; + uint32 _maxHeapThreshold, _minHeapThreshold; + byte _expireCounter; + +public: + ResourceManager(ScummEngine *vm); + ~ResourceManager(); + + void setHeapThreshold(int min, int max); + + void allocResTypeData(ResType type, uint32 tag, int num, ResTypeMode mode); + void freeResources(); + + byte *createResource(ResType type, ResId idx, uint32 size); + void nukeResource(ResType type, ResId idx); + +// inline Resource &getRes(ResType type, ResId idx) { return _types[type][idx]; } +// inline const Resource &getRes(ResType type, ResId idx) const { return _types[type][idx]; } + + bool isResourceLoaded(ResType type, ResId idx) const; + + void lock(ResType type, ResId idx); + void unlock(ResType type, ResId idx); + bool isLocked(ResType type, ResId idx) const; + + void setModified(ResType type, ResId idx); + bool isModified(ResType type, ResId idx) const; + + /** + * This method increments the _expireCounter, and if it overflows (which happens + * after at most 256 calls), it calls increaseResourceCounter. + * It is invoked in the engine's main loop ScummEngine::scummLoop(). + */ + void increaseExpireCounter(); + + /** + * Update the specified resource's counter. + */ + void setResourceCounter(ResType type, ResId idx, byte counter); + + /** + * Increment the counter of all unlocked loaded resources. + * The maximal count is 255. + * This is called by increaseExpireCounter and expireResources, + * but also by ScummEngine::startScene. + */ + void increaseResourceCounters(); + + void resourceStats(); + +//protected: + bool validateResource(const char *str, ResType type, ResId idx) const; +protected: + void expireResources(uint32 size); +}; + } // End of namespace Scumm #endif diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp index 3dc3b4d14e..927ee676a5 100644 --- a/engines/scumm/resource_v2.cpp +++ b/engines/scumm/resource_v2.cpp @@ -18,9 +18,6 @@ * 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 "scumm/file.h" @@ -87,40 +84,40 @@ void ScummEngine_v2::readClassicIndexFile() { } for (i = 0; i < _numRooms; i++) { - _res->roomno[rtRoom][i] = i; + _res->_types[rtRoom][i]._roomno = i; } _fileHandle->seek(_numRooms, SEEK_CUR); for (i = 0; i < _numRooms; i++) { - _res->roomoffs[rtRoom][i] = _fileHandle->readUint16LE(); - if (_res->roomoffs[rtRoom][i] == 0xFFFF) - _res->roomoffs[rtRoom][i] = (uint32)RES_INVALID_OFFSET; + _res->_types[rtRoom][i]._roomoffs = _fileHandle->readUint16LE(); + if (_res->_types[rtRoom][i]._roomoffs == 0xFFFF) + _res->_types[rtRoom][i]._roomoffs = (uint32)RES_INVALID_OFFSET; } for (i = 0; i < _numCostumes; i++) { - _res->roomno[rtCostume][i] = _fileHandle->readByte(); + _res->_types[rtCostume][i]._roomno = _fileHandle->readByte(); } for (i = 0; i < _numCostumes; i++) { - _res->roomoffs[rtCostume][i] = _fileHandle->readUint16LE(); - if (_res->roomoffs[rtCostume][i] == 0xFFFF) - _res->roomoffs[rtCostume][i] = (uint32)RES_INVALID_OFFSET; + _res->_types[rtCostume][i]._roomoffs = _fileHandle->readUint16LE(); + if (_res->_types[rtCostume][i]._roomoffs == 0xFFFF) + _res->_types[rtCostume][i]._roomoffs = (uint32)RES_INVALID_OFFSET; } for (i = 0; i < _numScripts; i++) { - _res->roomno[rtScript][i] = _fileHandle->readByte(); + _res->_types[rtScript][i]._roomno = _fileHandle->readByte(); } for (i = 0; i < _numScripts; i++) { - _res->roomoffs[rtScript][i] = _fileHandle->readUint16LE(); - if (_res->roomoffs[rtScript][i] == 0xFFFF) - _res->roomoffs[rtScript][i] = (uint32)RES_INVALID_OFFSET; + _res->_types[rtScript][i]._roomoffs = _fileHandle->readUint16LE(); + if (_res->_types[rtScript][i]._roomoffs == 0xFFFF) + _res->_types[rtScript][i]._roomoffs = (uint32)RES_INVALID_OFFSET; } for (i = 0; i < _numSounds; i++) { - _res->roomno[rtSound][i] = _fileHandle->readByte(); + _res->_types[rtSound][i]._roomno = _fileHandle->readByte(); } for (i = 0; i < _numSounds; i++) { - _res->roomoffs[rtSound][i] = _fileHandle->readUint16LE(); - if (_res->roomoffs[rtSound][i] == 0xFFFF) - _res->roomoffs[rtSound][i] = (uint32)RES_INVALID_OFFSET; + _res->_types[rtSound][i]._roomoffs = _fileHandle->readUint16LE(); + if (_res->_types[rtSound][i]._roomoffs == 0xFFFF) + _res->_types[rtSound][i]._roomoffs = (uint32)RES_INVALID_OFFSET; } } diff --git a/engines/scumm/resource_v3.cpp b/engines/scumm/resource_v3.cpp index 5f23720ce9..55e42e389c 100644 --- a/engines/scumm/resource_v3.cpp +++ b/engines/scumm/resource_v3.cpp @@ -18,44 +18,42 @@ * 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 "scumm/scumm_v3.h" #include "scumm/file.h" +#include "scumm/resource.h" #include "scumm/util.h" namespace Scumm { -extern const char *resTypeFromId(int id); +extern const char *nameOfResType(ResType type); -int ScummEngine_v3old::readResTypeList(int id) { - int num; - int i; +int ScummEngine_v3old::readResTypeList(ResType type) { + uint num; + ResId idx; - debug(9, "readResTypeList(%s)", resTypeFromId(id)); + debug(9, "readResTypeList(%s)", nameOfResType(type)); num = _fileHandle->readByte(); if (num >= 0xFF) { - error("Too many %ss (%d) in directory", resTypeFromId(id), num); + error("Too many %ss (%d) in directory", nameOfResType(type), num); } - if (id == rtRoom) { - for (i = 0; i < num; i++) - _res->roomno[id][i] = i; + if (type == rtRoom) { + for (idx = 0; idx < num; idx++) + _res->_types[type][idx]._roomno = idx; _fileHandle->seek(num, SEEK_CUR); } else { - for (i = 0; i < num; i++) - _res->roomno[id][i] = _fileHandle->readByte(); + for (idx = 0; idx < num; idx++) + _res->_types[type][idx]._roomno = _fileHandle->readByte(); } - for (i = 0; i < num; i++) { - _res->roomoffs[id][i] = _fileHandle->readUint16LE(); - if (_res->roomoffs[id][i] == 0xFFFF) - _res->roomoffs[id][i] = (uint32)RES_INVALID_OFFSET; + for (idx = 0; idx < num; idx++) { + _res->_types[type][idx]._roomoffs = _fileHandle->readUint16LE(); + if (_res->_types[type][idx]._roomoffs == 0xFFFF) + _res->_types[type][idx]._roomoffs = (uint32)RES_INVALID_OFFSET; } return num; diff --git a/engines/scumm/resource_v4.cpp b/engines/scumm/resource_v4.cpp index b1d98494d4..6215e86b89 100644 --- a/engines/scumm/resource_v4.cpp +++ b/engines/scumm/resource_v4.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -31,23 +28,22 @@ namespace Scumm { -extern const char *resTypeFromId(int id); +extern const char *nameOfResType(ResType type); -int ScummEngine_v4::readResTypeList(int id) { - int num; - int i; +int ScummEngine_v4::readResTypeList(ResType type) { + uint num; - debug(9, "readResTypeList(%s)", resTypeFromId(id)); + debug(9, "readResTypeList(%s)", nameOfResType(type)); num = _fileHandle->readUint16LE(); - if (num != _res->num[id]) { - error("Invalid number of %ss (%d) in directory", resTypeFromId(id), num); + if (num != _res->_types[type].size()) { + error("Invalid number of %ss (%d) in directory", nameOfResType(type), num); } - for (i = 0; i < num; i++) { - _res->roomno[id][i] = _fileHandle->readByte(); - _res->roomoffs[id][i] = _fileHandle->readUint32LE(); + for (ResId idx = 0; idx < num; idx++) { + _res->_types[type][idx]._roomno = _fileHandle->readByte(); + _res->_types[type][idx]._roomoffs = _fileHandle->readUint32LE(); } return num; diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 06fa0f2c39..8962a0e971 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -118,7 +115,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { VAR(VAR_ROOM) = room; _fullRedraw = true; - _res->increaseResourceCounter(); + _res->increaseResourceCounters(); _currentRoom = room; VAR(VAR_ROOM) = room; @@ -468,7 +465,7 @@ void ScummEngine::setupRoomSubBlocks() { * So it is not appropriate to call it after loading a savegame. */ void ScummEngine::resetRoomSubBlocks() { - int i; + ResId i; const byte *ptr; byte *roomptr; @@ -528,14 +525,14 @@ void ScummEngine::resetRoomSubBlocks() { // // Load scale data // - for (i = 1; i < _res->num[rtScaleTable]; i++) + for (i = 1; i < _res->_types[rtScaleTable].size(); i++) _res->nukeResource(rtScaleTable, i); ptr = findResourceData(MKTAG('S','C','A','L'), roomptr); if (ptr) { int s1, s2, y1, y2; if (_game.version == 8) { - for (i = 1; i < _res->num[rtScaleTable]; i++, ptr += 16) { + for (i = 1; i < _res->_types[rtScaleTable].size(); i++, ptr += 16) { s1 = READ_LE_UINT32(ptr); y1 = READ_LE_UINT32(ptr + 4); s2 = READ_LE_UINT32(ptr + 8); @@ -543,7 +540,7 @@ void ScummEngine::resetRoomSubBlocks() { setScaleSlot(i, 0, y1, s1, 0, y2, s2); } } else { - for (i = 1; i < _res->num[rtScaleTable]; i++, ptr += 8) { + for (i = 1; i < _res->_types[rtScaleTable].size(); i++, ptr += 8) { s1 = READ_LE_UINT16(ptr); y1 = READ_LE_UINT16(ptr + 2); s2 = READ_LE_UINT16(ptr + 4); @@ -715,7 +712,6 @@ void ScummEngine_v3old::setupRoomSubBlocks() { } void ScummEngine_v3old::resetRoomSubBlocks() { - int i; const byte *ptr; byte *roomptr; @@ -772,7 +768,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() { size = 0; // Compute matrix size - for (i = 0; i < numOfBoxes; i++) { + for (int i = 0; i < numOfBoxes; i++) { while (*tmp != 0xFF) { size++; tmp++; @@ -797,8 +793,8 @@ void ScummEngine_v3old::resetRoomSubBlocks() { // // No scale data in old bundle games // - for (i = 1; i < _res->num[rtScaleTable]; i++) - _res->nukeResource(rtScaleTable, i); + for (ResId id = 1; id < _res->_types[rtScaleTable].size(); id++) + _res->nukeResource(rtScaleTable, id); } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 3bfe51a77b..f5d219c721 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -314,7 +311,6 @@ static bool loadSaveGameHeader(Common::SeekableReadStream *in, SaveGameHeader &h bool ScummEngine::loadState(int slot, bool compat) { Common::String filename; Common::SeekableReadStream *in; - int i, j; SaveGameHeader hdr; int sb, sh; @@ -429,10 +425,10 @@ bool ScummEngine::loadState(int slot, bool compat) { memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); // Nuke all resources - for (i = rtFirst; i <= rtLast; i++) - if (i != rtTemp && i != rtBuffer && (i != rtSound || _saveSound || !compat)) - for (j = 0; j < _res->num[i]; j++) { - _res->nukeResource(i, j); + for (ResType type = rtFirst; type <= rtLast; type = ResType(type + 1)) + if (type != rtTemp && type != rtBuffer && (type != rtSound || _saveSound || !compat)) + for (ResId idx = 0; idx < _res->_types[type].size(); idx++) { + _res->nukeResource(type, idx); } resetScummVars(); @@ -520,8 +516,8 @@ bool ScummEngine::loadState(int slot, bool compat) { // loading such an old save game, try to upgrade the old to new format. if (hdr.ver < VER(22)) { // Convert all rtScaleTable resources to matching scale items - for (i = 1; i < _res->num[rtScaleTable]; i++) { - convertScaleTableToScaleSlot(i); + for (ResId idx = 1; idx < _res->_types[rtScaleTable].size(); idx++) { + convertScaleTableToScaleSlot(idx); } } @@ -1119,7 +1115,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { MKEND() }; - int i, j; + int i; int var120Backup; int var98Backup; uint8 md5Backup[16]; @@ -1137,9 +1133,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { // MD5 Operations: Backup on load, compare, and reset. if (s->isLoading()) { char md5str1[32+1], md5str2[32+1]; - for (j = 0; j < 16; j++) { - sprintf(md5str1 + j*2, "%02x", (int)_gameMD5[j]); - sprintf(md5str2 + j*2, "%02x", (int)md5Backup[j]); + for (i = 0; i < 16; i++) { + sprintf(md5str1 + i*2, "%02x", (int)_gameMD5[i]); + sprintf(md5str2 + i*2, "%02x", (int)md5Backup[i]); } debug(2, "Save version: %d", s->getVersion()); @@ -1239,18 +1235,19 @@ void ScummEngine::saveOrLoad(Serializer *s) { // // Save/load resources // - int type, idx; + ResType type; + ResId idx; if (s->getVersion() >= VER(26)) { // New, more robust resource save/load system. This stores the type // and index of each resource. Thus if we increase e.g. the maximum // number of script resources, savegames won't break. if (s->isSaving()) { - for (type = rtFirst; type <= rtLast; type++) { - if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) { + for (type = rtFirst; type <= rtLast; type = ResType(type + 1)) { + if (_res->_types[type]._mode != kStaticResTypeMode && type != rtTemp && type != rtBuffer) { s->saveUint16(type); // Save the res type... - for (idx = 0; idx < _res->num[type]; idx++) { + for (idx = 0; idx < _res->_types[type].size(); idx++) { // Only save resources which actually exist... - if (_res->address[type][idx]) { + if (_res->_types[type][idx]._address) { s->saveUint16(idx); // Save the index of the resource saveResource(s, type, idx); } @@ -1260,9 +1257,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { } s->saveUint16(0xFFFF); // End marker } else { - while ((type = s->loadUint16()) != 0xFFFF) { + while ((type = (ResType)s->loadUint16()) != 0xFFFF) { while ((idx = s->loadUint16()) != 0xFFFF) { - assert(0 <= idx && idx < _res->num[type]); + assert(idx < _res->_types[type].size()); loadResource(s, type, idx); } } @@ -1271,15 +1268,15 @@ void ScummEngine::saveOrLoad(Serializer *s) { // Old, fragile resource save/load system. Doesn't save resources // with index 0, and breaks whenever we change the limit on a given // resource type. - for (type = rtFirst; type <= rtLast; type++) - if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) { + for (type = rtFirst; type <= rtLast; type = ResType(type + 1)) + if (_res->_types[type]._mode != kStaticResTypeMode && type != rtTemp && type != rtBuffer) { // For V1-V5 games, there used to be no object name resources. // At some point this changed. But since old savegames rely on // unchanged resource counts, we have to hard code the following check if (_game.version < 6 && type == rtObjectName) continue; - for (idx = 1; idx < _res->num[type]; idx++) - saveLoadResource(s, type, idx); + for (idx = 1; idx < _res->_types[type].size(); idx++) + loadResourceOLD(s, type, idx); } } @@ -1390,18 +1387,18 @@ void ScummEngine::saveOrLoad(Serializer *s) { // Save/load a list of the locked objects // if (s->isSaving()) { - for (i = rtFirst; i <= rtLast; i++) - for (j = 1; j < _res->num[i]; j++) { - if (_res->isLocked(i, j)) { - s->saveByte(i); - s->saveUint16(j); + for (type = rtFirst; type <= rtLast; type = ResType(type + 1)) + for (idx = 1; idx < _res->_types[type].size(); idx++) { + if (_res->isLocked(type, idx)) { + s->saveByte(type); + s->saveUint16(idx); } } s->saveByte(0xFF); } else { - while ((i = s->loadByte()) != 0xFF) { - j = s->loadUint16(); - _res->lock(i, j); + while ((type = (ResType)s->loadByte()) != 0xFF) { + idx = s->loadUint16(); + _res->lock(type, idx); } } @@ -1636,69 +1633,44 @@ void ScummEngine_v100he::saveOrLoad(Serializer *s) { } #endif -void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { - byte *ptr; +void ScummEngine::loadResourceOLD(Serializer *ser, ResType type, ResId idx) { uint32 size; - if (!_res->mode[type]) { - if (ser->isSaving()) { - ptr = _res->address[type][idx]; - if (ptr == NULL) { - ser->saveUint32(0); - return; - } - - size = ((MemBlkHeader *)ptr)->size; - - ser->saveUint32(size); - ser->saveBytes(ptr + sizeof(MemBlkHeader), size); - + if (type == rtSound && ser->getVersion() >= VER(23)) { + // Save/load only a list of resource numbers that need to be reloaded. + if (ser->loadUint16()) + ensureResourceLoaded(rtSound, idx); + } else if (_res->_types[type]._mode == kDynamicResTypeMode) { + size = ser->loadUint32(); + if (size) { + _res->createResource(type, idx, size); + ser->loadBytes(getResourceAddress(type, idx), size); if (type == rtInventory) { - ser->saveUint16(_inventory[idx]); + _inventory[idx] = ser->loadUint16(); } if (type == rtObjectName && ser->getVersion() >= VER(25)) { - ser->saveUint16(_newNames[idx]); - } - } else { - size = ser->loadUint32(); - if (size) { - _res->createResource(type, idx, size); - ser->loadBytes(getResourceAddress(type, idx), size); - if (type == rtInventory) { - _inventory[idx] = ser->loadUint16(); - } - if (type == rtObjectName && ser->getVersion() >= VER(25)) { - // Paranoia: We increased the possible number of new names - // to fix bugs #933610 and #936323. The savegame format - // didn't change, but at least during the transition - // period there is a slight chance that we try to load - // more names than we have allocated space for. If so, - // discard them. - if (idx < _numNewNames) - _newNames[idx] = ser->loadUint16(); - } + // Paranoia: We increased the possible number of new names + // to fix bugs #933610 and #936323. The savegame format + // didn't change, but at least during the transition + // period there is a slight chance that we try to load + // more names than we have allocated space for. If so, + // discard them. + if (idx < _numNewNames) + _newNames[idx] = ser->loadUint16(); } } - } else if (_res->mode[type] == 2 && ser->getVersion() >= VER(23)) { - // Save/load only a list of resource numbers that need to be reloaded. - if (ser->isSaving()) { - ser->saveUint16(_res->address[type][idx] ? 1 : 0); - } else { - if (ser->loadUint16()) - ensureResourceLoaded(type, idx); - } } } -void ScummEngine::saveResource(Serializer *ser, int type, int idx) { - assert(_res->address[type][idx]); +void ScummEngine::saveResource(Serializer *ser, ResType type, ResId idx) { + assert(_res->_types[type][idx]._address); - if (_res->mode[type] == 0) { - byte *ptr = _res->address[type][idx]; - uint32 size = ((MemBlkHeader *)ptr)->size; + if (_res->_types[type]._mode == kDynamicResTypeMode) { + byte *ptr = _res->_types[type][idx]._address; + uint32 size = _res->_types[type][idx]._size; ser->saveUint32(size); - ser->saveBytes(ptr + sizeof(MemBlkHeader), size); + ser->saveBytes(ptr, size); if (type == rtInventory) { ser->saveUint16(_inventory[idx]); @@ -1709,18 +1681,24 @@ void ScummEngine::saveResource(Serializer *ser, int type, int idx) { } } -void ScummEngine::loadResource(Serializer *ser, int type, int idx) { +void ScummEngine::loadResource(Serializer *ser, ResType type, ResId idx) { if (_game.heversion >= 60 && ser->getVersion() <= VER(65) && ((type == rtSound && idx == 1) || (type == rtSpoolBuffer))) { uint32 size = ser->loadUint32(); assert(size); _res->createResource(type, idx, size); ser->loadBytes(getResourceAddress(type, idx), size); - } else if (_res->mode[type] == 0) { + } else if (type == rtSound) { + // HE Games use sound resource 1 for speech + if (_game.heversion >= 60 && idx == 1) + return; + + ensureResourceLoaded(rtSound, idx); + } else if (_res->_types[type]._mode == kDynamicResTypeMode) { uint32 size = ser->loadUint32(); assert(size); - _res->createResource(type, idx, size); - ser->loadBytes(getResourceAddress(type, idx), size); + byte *ptr = _res->createResource(type, idx, size); + ser->loadBytes(ptr, size); if (type == rtInventory) { _inventory[idx] = ser->loadUint16(); @@ -1728,12 +1706,6 @@ void ScummEngine::loadResource(Serializer *ser, int type, int idx) { if (type == rtObjectName) { _newNames[idx] = ser->loadUint16(); } - } else if (_res->mode[type] == 2) { - // HE Games use sound resource 1 for speech - if (_game.heversion >= 60 && idx == 1) - return; - - ensureResourceLoaded(type, idx); } } diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index eead241b90..776f40e12b 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -18,9 +18,6 @@ * 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 SCUMM_SAVELOAD_H diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 9e02f126cd..cfc4b3c419 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -39,7 +36,7 @@ namespace Scumm { /* Start executing script 'script' with the given parameters */ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle) { ScriptSlot *s; - byte *scriptPtr; + //byte *scriptPtr; uint32 scriptOffs; byte scriptType; int slot; @@ -51,7 +48,8 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in stopScript(script); if (script < _numGlobalScripts) { - scriptPtr = getResourceAddress(rtScript, script); + // Call getResourceAddress to ensure the resource is loaded & its usage count reset + /*scriptPtr =*/ getResourceAddress(rtScript, script); scriptOffs = _resourceHeaderSize; scriptType = WIO_GLOBAL; @@ -393,26 +391,26 @@ void ScummEngine::getScriptBaseAddress() { break; _scriptOrgPointer = getResourceAddress(rtInventory, idx); assert(idx < _numInventory); - _lastCodePtr = &_res->address[rtInventory][idx]; + _lastCodePtr = &_res->_types[rtInventory][idx]._address; break; case WIO_LOCAL: case WIO_ROOM: /* room script */ if (_game.version == 8) { _scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource); - assert(_roomResource < _res->num[rtRoomScripts]); - _lastCodePtr = &_res->address[rtRoomScripts][_roomResource]; + assert(_roomResource < (int)_res->_types[rtRoomScripts].size()); + _lastCodePtr = &_res->_types[rtRoomScripts][_roomResource]._address; } else { _scriptOrgPointer = getResourceAddress(rtRoom, _roomResource); assert(_roomResource < _numRooms); - _lastCodePtr = &_res->address[rtRoom][_roomResource]; + _lastCodePtr = &_res->_types[rtRoom][_roomResource]._address; } break; case WIO_GLOBAL: /* global script */ _scriptOrgPointer = getResourceAddress(rtScript, ss->number); assert(ss->number < _numScripts); - _lastCodePtr = &_res->address[rtScript][ss->number]; + _lastCodePtr = &_res->_types[rtScript][ss->number]._address; break; case WIO_FLOBJECT: /* flobject script */ @@ -421,7 +419,7 @@ void ScummEngine::getScriptBaseAddress() { idx = _objs[idx].fl_object_index; _scriptOrgPointer = getResourceAddress(rtFlObject, idx); assert(idx < _numFlObject); - _lastCodePtr = &_res->address[rtFlObject][idx]; + _lastCodePtr = &_res->_types[rtFlObject][idx]._address; break; default: error("Bad type while getting base address"); @@ -448,7 +446,7 @@ void ScummEngine::resetScriptPointer() { * collected by ResourceManager::expireResources. */ void ScummEngine::refreshScriptPointer() { - if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { + if (*_lastCodePtr != _scriptOrgPointer) { long oldoffs = _scriptPointer - _scriptOrgPointer; getScriptBaseAddress(); _scriptPointer = _scriptOrgPointer + oldoffs; @@ -496,7 +494,11 @@ void ScummEngine::executeOpcode(byte i) { } const char *ScummEngine::getOpcodeDesc(byte i) { +#ifndef REDUCE_MEMORY_USAGE return _opcodes[i].desc; +#else + return ""; +#endif } byte ScummEngine::fetchScriptByte() { @@ -1102,7 +1104,7 @@ void ScummEngine::checkAndRunSentenceScript() { // For now we assume that if there are more than 460 scripts, then // the pair 29/104 is used, else the pair 28/103. - if (_res->num[rtScript] > 460) { + if (_res->_types[rtScript].size() > 460) { if (sentenceScript == 104) sentenceScript = 29; } else { diff --git a/engines/scumm/script.h b/engines/scumm/script.h index 39d5d802b4..7b2c625144 100644 --- a/engines/scumm/script.h +++ b/engines/scumm/script.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_H @@ -30,14 +27,19 @@ namespace Scumm { - typedef Common::Functor0<void> Opcode; struct OpcodeEntry : Common::NonCopyable { Opcode *proc; +#ifndef REDUCE_MEMORY_USAGE const char *desc; +#endif +#ifndef REDUCE_MEMORY_USAGE OpcodeEntry() : proc(0), desc(0) {} +#else + OpcodeEntry() : proc(0) {} +#endif ~OpcodeEntry() { setProc(0, 0); } @@ -47,7 +49,9 @@ struct OpcodeEntry : Common::NonCopyable { delete proc; proc = p; } +#ifndef REDUCE_MEMORY_USAGE desc = d; +#endif } }; diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index 7c3964a326..1ef16d7106 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -18,15 +18,13 @@ * 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 "scumm/actor.h" #include "scumm/charset.h" #include "scumm/object.h" +#include "scumm/resource.h" #include "scumm/scumm_v0.h" #include "scumm/verbs.h" diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index d7ff8950f8..7f02e899b4 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -18,14 +18,12 @@ * 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 "scumm/actor.h" #include "scumm/charset.h" #include "scumm/object.h" +#include "scumm/resource.h" #include "scumm/scumm_v2.h" #include "scumm/sound.h" #include "scumm/util.h" @@ -740,23 +738,23 @@ void ScummEngine_v2::o2_drawObject() { } void ScummEngine_v2::o2_resourceRoutines() { - const ResTypes resTypes[] = { - rtNumTypes, // Invalid - rtNumTypes, // Invalid + const ResType resTypes[] = { + rtInvalid, + rtInvalid, rtCostume, rtRoom, - rtNumTypes, // Invalid + rtInvalid, rtScript, rtSound }; int resid = getVarOrDirectByte(PARAM_1); int opcode = fetchScriptByte(); - ResTypes type = rtNumTypes; + ResType type = rtInvalid; if (0 <= (opcode >> 4) && (opcode >> 4) < (int)ARRAYSIZE(resTypes)) type = resTypes[opcode >> 4]; - if ((opcode & 0x0f) == 0 || type == rtNumTypes) + if ((opcode & 0x0f) == 0 || type == rtInvalid) return; // HACK V2 Maniac Mansion tries to load an invalid sound resource in demo script. diff --git a/engines/scumm/script_v3.cpp b/engines/scumm/script_v3.cpp index 176eefdeef..b28d831101 100644 --- a/engines/scumm/script_v3.cpp +++ b/engines/scumm/script_v3.cpp @@ -18,9 +18,6 @@ * 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 "scumm/scumm_v3.h" diff --git a/engines/scumm/script_v4.cpp b/engines/scumm/script_v4.cpp index 98001e6854..1302c8c28d 100644 --- a/engines/scumm/script_v4.cpp +++ b/engines/scumm/script_v4.cpp @@ -18,9 +18,6 @@ * 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 "scumm/scumm_v4.h" diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index ee790f7876..b8f3b4b3b3 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -18,14 +18,12 @@ * 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 "scumm/actor.h" #include "scumm/charset.h" #include "scumm/object.h" +#include "scumm/resource.h" #include "scumm/scumm_v3.h" #include "scumm/scumm_v5.h" #include "scumm/sound.h" @@ -1492,7 +1490,7 @@ void ScummEngine_v5::o5_systemOps() { } void ScummEngine_v5::o5_resourceRoutines() { - const ResTypes resType[4] = { rtScript, rtSound, rtCostume, rtRoom }; + const ResType resType[4] = { rtScript, rtSound, rtCostume, rtRoom }; int resid = 0; int foo, bar; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index b2df1d0baa..decd34222d 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -360,11 +357,11 @@ void ScummEngine_v6::nukeArray(int a) { } int ScummEngine_v6::findFreeArrayId() { - byte **addr = _res->address[rtString]; + const ResourceManager::ResTypeData &rtd = _res->_types[rtString]; int i; for (i = 1; i < _numArray; i++) { - if (!addr[i]) + if (!rtd[i]._address) return i; } error("Out of array pointers, %d max", _numArray); diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index 1250a82d33..c8b92be3c8 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f43aed53f7..e8dd6cb548 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -18,16 +18,12 @@ * 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/config-manager.h" #include "common/debug-channels.h" #include "common/md5.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/system.h" #include "common/translation.h" @@ -65,6 +61,7 @@ #include "scumm/player_v2a.h" #include "scumm/player_v3a.h" #include "scumm/player_v4a.h" +#include "scumm/resource.h" #include "scumm/he/resource_he.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v8.h" @@ -113,9 +110,13 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _language(dr.language), _debugger(0), _currentScript(0xFF), // Let debug() work on init stage - _messageDialog(0), _pauseDialog(0), _versionDialog(0) { + _messageDialog(0), _pauseDialog(0), _versionDialog(0), + _rnd("scumm") + { - if (_game.platform == Common::kPlatformNES) { + if (_game.heversion > 0) { + _gdi = new GdiHE(this); + } else if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); #ifdef USE_RGB_COLOR } else if (_game.features & GF_16BIT_COLOR) { @@ -574,8 +575,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) assert(!_mainMenuDialog); _mainMenuDialog = new ScummMenuDialog(this); #endif - - g_eventRec.registerRandomSource(_rnd, "scumm"); } @@ -1184,10 +1183,6 @@ Common::Error ScummEngine::init() { resetScumm(); resetScummVars(); - if (_imuse) { - _imuse->setBase(_res->address[rtSound]); - } - if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); @@ -1233,7 +1228,7 @@ void ScummEngine::setupScumm() { requestLoad(ConfMan.getInt("save_slot")); } - _res->allocResTypeData(rtBuffer, 0, 10, "buffer", 0); + _res->allocResTypeData(rtBuffer, 0, 10, kDynamicResTypeMode); setupScummVars(); @@ -1833,22 +1828,22 @@ void ScummEngine::setupMusic(int midi) { MidiDriver *nativeMidiDriver = 0; MidiDriver *adlibMidiDriver = 0; - if (_musicType != MDT_ADLIB) + if (_musicType != MDT_ADLIB && _musicType != MDT_TOWNS) nativeMidiDriver = MidiDriver::createMidi(dev); if (nativeMidiDriver != NULL && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && (midi & MDT_ADLIB); - if (_musicType == MDT_ADLIB || multi_midi) { - adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB)); + if (_musicType == MDT_ADLIB || MDT_TOWNS || multi_midi) { + adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB)); adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } _imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver); if (_game.platform == Common::kPlatformFMTowns) { - _musicEngine = _townsPlayer = new Player_Towns_v2(this, _imuse, _mixer, true); + _musicEngine = _townsPlayer = new Player_Towns_v2(this, _mixer, _imuse, true); if (!_townsPlayer->init()) - error("Failed to initialize FM-Towns audio driver"); + error("ScummEngine::setupMusic(): Failed to initialize FM-Towns audio driver"); } else { _musicEngine = _imuse; } @@ -1860,7 +1855,6 @@ void ScummEngine::setupMusic(int midi) { _imuse->property(IMuse::PROP_GAME_ID, _game.id); if (ConfMan.hasKey("tempo")) _imuse->property(IMuse::PROP_TEMPO_BASE, ConfMan.getInt("tempo")); - // YM2162 driver can't handle midi->getPercussionChannel(), NULL shouldn't init MT-32/GM/GS if (midi != MDT_NONE) { _imuse->property(IMuse::PROP_NATIVE_MT32, _native_mt32); if (MidiDriver::getMusicType(dev) != MT_MT32) // MT-32 Emulation shouldn't be GM/GS initialized @@ -2422,13 +2416,16 @@ void ScummEngine::pauseGame() { } void ScummEngine::restart() { -// TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect -// this leaks memory like a sieve + // FIXME: This function *leaks memory*, and quite a lot so. For example, + // we re-init the resource manager, which causes readMAXS() to be called + // again, which allocates some memory. There are many other leaks, though. + + // TODO: We should also probably be reinitting a lot more stuff. -// Fingolfin seez: An alternate way to implement restarting would be to create -// a save state right after startup ... to this end we could introduce a SaveFile -// subclass which is implemented using a memory buffer (i.e. no actual file is -// created). Then to restart we just have to load that pseudo save state. + // Fingolfin seez: An alternate way to implement restarting would be to create + // a save state right after startup ... to this end we could introduce a SaveFile + // subclass which is implemented using a memory buffer (i.e. no actual file is + // created). Then to restart we just have to load that pseudo save state. int i; @@ -2448,23 +2445,12 @@ void ScummEngine::restart() { for (i = 1; i < _numGlobalObjects; i++) clearOwnerOf(i); - // Reallocate arrays - // FIXME: This should already be called by readIndexFile. - // FIXME: regardless of that, allocateArrays and allocResTypeData leaks - // heavily, which should be fixed. - allocateArrays(); - - // Reread index (reset objectstate etc) readIndexFile(); // Reinit scumm variables resetScumm(); resetScummVars(); - if (_imuse) { - _imuse->setBase(_res->address[rtSound]); - } - // Reinit sound engine if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 62c6c70e5a..636c909911 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -18,9 +18,6 @@ * 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 SCUMM_H @@ -171,17 +168,6 @@ enum { DEBUG_SMUSH = 1 << 10 // Track SMUSH }; -/** - * Internal header for any memory block allocated by the resource manager. - * - * @todo Hide MemBlkHeader; no code outside the resource manager should - * have to use it, ever. Currently script code needs it to detect whether - * some scripts have moved (in fetchScriptByte()). - */ -struct MemBlkHeader { - uint32 size; -}; - struct VerbSlot; struct ObjectData; @@ -322,7 +308,8 @@ struct SaveStateMetaInfos { * WARNING: Do not change the order of these, as the savegame format relies * on it; any change made here will break savegame compatibility! */ -enum ResTypes { +enum ResType { + rtInvalid = 0, rtFirst = 1, rtRoom = 1, rtScript = 2, @@ -345,75 +332,12 @@ enum ResTypes { rtImage = 19, rtTalkie = 20, rtSpoolBuffer = 21, - rtLast = 21, - rtNumTypes = 22 + rtLast = 21 }; -enum { - RES_INVALID_OFFSET = 0xFFFFFFFF -}; - -/** - * The 'resource manager' class. Currently doesn't really deserve to be called - * a 'class', at least until somebody gets around to OOfying this more. - */ -class ResourceManager { - //friend class ScummDebugger; - //friend class ScummEngine; -protected: - ScummEngine *_vm; - -public: - byte mode[rtNumTypes]; - uint16 num[rtNumTypes]; - uint32 tags[rtNumTypes]; - const char *name[rtNumTypes]; - byte **address[rtNumTypes]; -protected: - byte *flags[rtNumTypes]; - byte *status[rtNumTypes]; -public: - byte *roomno[rtNumTypes]; - uint32 *roomoffs[rtNumTypes]; - uint32 *globsize[rtNumTypes]; - -protected: - uint32 _allocatedSize; - uint32 _maxHeapThreshold, _minHeapThreshold; - byte _expireCounter; - -public: - ResourceManager(ScummEngine *vm); - ~ResourceManager(); - - void setHeapThreshold(int min, int max); - - void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode); - void freeResources(); - - byte *createResource(int type, int index, uint32 size); - void nukeResource(int type, int i); +typedef uint16 ResId; - bool isResourceLoaded(int type, int index) const; - - void lock(int type, int i); - void unlock(int type, int i); - bool isLocked(int type, int i) const; - - void setModified(int type, int i); - bool isModified(int type, int i) const; - - void increaseExpireCounter(); - void setResourceCounter(int type, int index, byte flag); - void increaseResourceCounter(); - - void resourceStats(); - -//protected: - bool validateResource(const char *str, int type, int index) const; -protected: - void expireResources(uint32 size); -}; +class ResourceManager; /** * Base class for all SCUMM engines. @@ -654,9 +578,9 @@ protected: bool saveState(int slot, bool compat); bool loadState(int slot, bool compat); virtual void saveOrLoad(Serializer *s); - void saveLoadResource(Serializer *ser, int type, int index); // "Obsolete" - void saveResource(Serializer *ser, int type, int index); - void loadResource(Serializer *ser, int type, int index); + void saveResource(Serializer *ser, ResType type, ResId idx); + void loadResource(Serializer *ser, ResType type, ResId idx); + void loadResourceOLD(Serializer *ser, ResType type, ResId idx); // "Obsolete" Common::String makeSavegameName(int slot, bool temporary) const { return makeSavegameName(_targetName, slot, temporary); @@ -689,9 +613,11 @@ protected: protected: /* Script VM - should be in Script class */ uint32 _localScriptOffsets[1024]; - const byte *_scriptPointer, *_scriptOrgPointer; - byte _opcode, _currentScript; + const byte *_scriptPointer; + const byte *_scriptOrgPointer; const byte * const *_lastCodePtr; + byte _opcode; + byte _currentScript; int _scummStackPos; int _vmStack[150]; @@ -787,26 +713,26 @@ protected: void askForDisk(const char *filename, int disknum); // TODO: Use Common::String bool openResourceFile(const Common::String &filename, byte encByte); // TODO: Use Common::String - void loadPtrToResource(int type, int i, const byte *ptr); - virtual int readResTypeList(int id); -// void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode); + void loadPtrToResource(ResType type, ResId idx, const byte *ptr); + virtual int readResTypeList(ResType type); +// void allocResTypeData(ResType type, uint32 tag, int num, int mode); // byte *createResource(int type, int index, uint32 size); - int loadResource(int type, int i); -// void nukeResource(int type, int i); - int getResourceRoomNr(int type, int idx); - virtual uint32 getResourceRoomOffset(int type, int idx); - int getResourceSize(int type, int idx); + int loadResource(ResType type, ResId idx); +// void nukeResource(ResType type, ResId idx); + int getResourceRoomNr(ResType type, ResId idx); + virtual uint32 getResourceRoomOffset(ResType type, ResId idx); + int getResourceSize(ResType type, ResId idx); public: - byte *getResourceAddress(int type, int i); - virtual byte *getStringAddress(int i); + byte *getResourceAddress(ResType type, ResId idx); + virtual byte *getStringAddress(ResId idx); byte *getStringAddressVar(int i); - void ensureResourceLoaded(int type, int i); + void ensureResourceLoaded(ResType type, ResId idx); protected: - int readSoundResource(int index); - int readSoundResourceSmallHeader(int index); - bool isResourceInUse(int type, int i) const; + int readSoundResource(ResId idx); + int readSoundResourceSmallHeader(ResId idx); + bool isResourceInUse(ResType type, ResId idx) const; virtual void setupRoomSubBlocks(); virtual void resetRoomSubBlocks(); diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h index 9ffb19a959..9c492663dc 100644 --- a/engines/scumm/scumm_v0.h +++ b/engines/scumm/scumm_v0.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V0_H diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h index 687ccd6ab3..47c5fa2626 100644 --- a/engines/scumm/scumm_v2.h +++ b/engines/scumm/scumm_v2.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V2_H diff --git a/engines/scumm/scumm_v3.h b/engines/scumm/scumm_v3.h index 6e8d593a35..f11ca16a50 100644 --- a/engines/scumm/scumm_v3.h +++ b/engines/scumm/scumm_v3.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V3_H @@ -62,7 +59,7 @@ public: ScummEngine_v3old(OSystem *syst, const DetectorResult &dr); protected: - virtual int readResTypeList(int id); + virtual int readResTypeList(ResType type); virtual void readIndexFile(); virtual void setupRoomSubBlocks(); virtual void resetRoomSubBlocks(); diff --git a/engines/scumm/scumm_v4.h b/engines/scumm/scumm_v4.h index 653cfc228e..e21e4b26ae 100644 --- a/engines/scumm/scumm_v4.h +++ b/engines/scumm/scumm_v4.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V4_H @@ -59,7 +56,7 @@ protected: virtual void scummLoop_handleSaveLoad(); - virtual int readResTypeList(int id); + virtual int readResTypeList(ResType type); virtual void readIndexFile(); virtual void loadCharset(int no); virtual void resetRoomObjects(); diff --git a/engines/scumm/scumm_v5.h b/engines/scumm/scumm_v5.h index 71222470f4..b8a61c1677 100644 --- a/engines/scumm/scumm_v5.h +++ b/engines/scumm/scumm_v5.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V5_H diff --git a/engines/scumm/scumm_v6.h b/engines/scumm/scumm_v6.h index eb55b83596..c42a49a9f5 100644 --- a/engines/scumm/scumm_v6.h +++ b/engines/scumm/scumm_v6.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V6_H @@ -110,7 +107,7 @@ protected: virtual void decodeParseString(int a, int b); virtual void readArrayFromIndexFile(); - virtual byte *getStringAddress(int i); + virtual byte *getStringAddress(ResId idx); virtual void readMAXS(int blockSize); virtual void palManipulateInit(int resID, int start, int end, int time); diff --git a/engines/scumm/scumm_v7.h b/engines/scumm/scumm_v7.h index c4bb3525be..81bb25e0b5 100644 --- a/engines/scumm/scumm_v7.h +++ b/engines/scumm/scumm_v7.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V7_H diff --git a/engines/scumm/scumm_v8.h b/engines/scumm/scumm_v8.h index 94619eb7ac..43bfad1fc9 100644 --- a/engines/scumm/scumm_v8.h +++ b/engines/scumm/scumm_v8.h @@ -18,9 +18,6 @@ * 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 SCUMM_SCRIPT_V8_H diff --git a/engines/scumm/smush/channel.cpp b/engines/scumm/smush/channel.cpp index 95b7653262..7f71d0549b 100644 --- a/engines/scumm/smush/channel.cpp +++ b/engines/scumm/smush/channel.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/channel.h b/engines/scumm/smush/channel.h index 717a294d96..839aeaa970 100644 --- a/engines/scumm/smush/channel.h +++ b/engines/scumm/smush/channel.h @@ -18,9 +18,6 @@ * 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 SCUMM_SMUSH_CHANNEL_H diff --git a/engines/scumm/smush/codec1.cpp b/engines/scumm/smush/codec1.cpp index d0d92fcd79..79d97d2ce3 100644 --- a/engines/scumm/smush/codec1.cpp +++ b/engines/scumm/smush/codec1.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/codec37.cpp b/engines/scumm/smush/codec37.cpp index 9dbbc6816f..dcc8ee3c19 100644 --- a/engines/scumm/smush/codec37.cpp +++ b/engines/scumm/smush/codec37.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/codec37.h b/engines/scumm/smush/codec37.h index 96033ade31..bcb858b0b5 100644 --- a/engines/scumm/smush/codec37.h +++ b/engines/scumm/smush/codec37.h @@ -18,9 +18,6 @@ * 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 SCUMM_SMUSH_CODEC37_H diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 47286ba4fc..4b503a0a38 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/codec47.h b/engines/scumm/smush/codec47.h index cfa467de4e..0e5156db5c 100644 --- a/engines/scumm/smush/codec47.h +++ b/engines/scumm/smush/codec47.h @@ -18,9 +18,6 @@ * 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 SCUMM_SMUSH_CODEC_47_H diff --git a/engines/scumm/smush/codec47ARM.s b/engines/scumm/smush/codec47ARM.s index 73341c117f..a91f932558 100644 --- a/engines/scumm/smush/codec47ARM.s +++ b/engines/scumm/smush/codec47ARM.s @@ -18,9 +18,6 @@ @ 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$ -@ @ @author Robin Watts (robin@wss.co.uk) @ @ This file, provides an ARM optimised version of sections of codec47.cpp. diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index 32fa99a870..f2c4f993e4 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp index f730acf804..2f1ca512f0 100644 --- a/engines/scumm/smush/saud_channel.cpp +++ b/engines/scumm/smush/saud_channel.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp index 75abe9a772..7765bf1292 100644 --- a/engines/scumm/smush/smush_font.cpp +++ b/engines/scumm/smush/smush_font.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/smush_font.h b/engines/scumm/smush/smush_font.h index 312d6dbc78..5de4a725c6 100644 --- a/engines/scumm/smush/smush_font.h +++ b/engines/scumm/smush/smush_font.h @@ -18,9 +18,6 @@ * 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 SCUMM_SMUSH_FONT_H diff --git a/engines/scumm/smush/smush_mixer.cpp b/engines/scumm/smush/smush_mixer.cpp index 4ab0d7c733..d2b4b5a482 100644 --- a/engines/scumm/smush/smush_mixer.cpp +++ b/engines/scumm/smush/smush_mixer.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/smush/smush_mixer.h b/engines/scumm/smush/smush_mixer.h index 3d62fdc722..75a8889242 100644 --- a/engines/scumm/smush/smush_mixer.h +++ b/engines/scumm/smush/smush_mixer.h @@ -18,9 +18,6 @@ * 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 SCUMM_SMUSH_MIXER_H diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 2e39558372..66502572de 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -18,9 +18,6 @@ * 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 "engines/engine.h" diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h index af7942c193..5a2024060e 100644 --- a/engines/scumm/smush/smush_player.h +++ b/engines/scumm/smush/smush_player.h @@ -18,9 +18,6 @@ * 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$ - * */ #if !defined(SCUMM_SMUSH_PLAYER_H) && defined(ENABLE_SCUMM_7_8) diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index a38119584f..c22da8e7c7 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -18,9 +18,6 @@ * 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/config-manager.h" @@ -32,6 +29,7 @@ #include "scumm/imuse/imuse.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/player_towns.h" +#include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/sound.h" #include "scumm/util.h" @@ -1066,7 +1064,7 @@ void Sound::saveLoadWithSerializer(Serializer *ser) { #pragma mark --- Sound resource handling --- #pragma mark - -static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, int size); +static void convertMac0Resource(ResourceManager *res, ResId idx, byte *src_ptr, int size); /* @@ -1076,7 +1074,7 @@ static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, in * could stand a thorough cleanup! */ -int ScummEngine::readSoundResource(int idx) { +int ScummEngine::readSoundResource(ResId idx) { uint32 pos, total_size, size, tag, basetag, max_total_size; int pri, best_pri; uint32 best_size = 0, best_offs = 0; @@ -1120,7 +1118,7 @@ int ScummEngine::readSoundResource(int idx) { break; case MKTAG('A','D','L',' '): pri = 1; - if (_musicType == MDT_ADLIB) + if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS) pri = 10; break; case MKTAG('A','M','I',' '): @@ -1226,7 +1224,7 @@ int ScummEngine::readSoundResource(int idx) { if (!dmuFile.open(buffer)) { error("Can't open music file %s", buffer); - _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; + _res->_types[rtSound][idx]._roomoffs = RES_INVALID_OFFSET; return 0; } dmuFile.seek(4, SEEK_SET); @@ -1250,7 +1248,7 @@ int ScummEngine::readSoundResource(int idx) { } error("Unrecognized base tag 0x%08x in sound %d", basetag, idx); } - _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; + _res->_types[rtSound][idx]._roomoffs = RES_INVALID_OFFSET; return 0; } @@ -1429,7 +1427,7 @@ static byte Mac0ToGMInstrument(uint32 type, int &transpose) { } } -static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, int size) { +static void convertMac0Resource(ResourceManager *res, ResId idx, byte *src_ptr, int size) { /* From Markus Magnuson (superqult) we got this information: Mac0 @@ -1620,7 +1618,7 @@ static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, in #endif } -static void convertADResource(ResourceManager *res, const GameSettings& game, int idx, byte *src_ptr, int size) { +static void convertADResource(ResourceManager *res, const GameSettings& game, ResId idx, byte *src_ptr, int size) { // We will ignore the PPQN in the original resource, because // it's invalid anyway. We use a constant PPQN of 480. const int ppqn = 480; @@ -2003,7 +2001,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in } -int ScummEngine::readSoundResourceSmallHeader(int idx) { +int ScummEngine::readSoundResourceSmallHeader(ResId idx) { uint32 pos, total_size, size, tag; uint32 ad_size = 0, ad_offs = 0; uint32 ro_size = 0, ro_offs = 0; @@ -2125,7 +2123,7 @@ int ScummEngine::readSoundResourceSmallHeader(int idx) { _fileHandle->read(_res->createResource(rtSound, idx, ro_size - 4), ro_size - 4); return 1; } - _res->roomoffs[rtSound][idx] = RES_INVALID_OFFSET; + _res->_types[rtSound][idx]._roomoffs = RES_INVALID_OFFSET; return 0; } diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h index 39b4af805d..03659ceff1 100644 --- a/engines/scumm/sound.h +++ b/engines/scumm/sound.h @@ -17,9 +17,6 @@ * 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 SCUMM_SOUND_H diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 2dfa9da723..c27b6d5e1c 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -18,9 +18,6 @@ * 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$ - * */ @@ -35,6 +32,7 @@ #ifdef ENABLE_HE #include "scumm/he/intern_he.h" #endif +#include "scumm/resource.h" #include "scumm/scumm.h" #include "scumm/scumm_v6.h" #include "scumm/scumm_v8.h" @@ -354,7 +352,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { const int charsetCode = (_game.heversion >= 80) ? 127 : 64; uint32 talk_sound_a = 0; - uint32 talk_sound_b = 0; + //uint32 talk_sound_b = 0; int i, c = 0; char value[32]; bool endLoop = false; @@ -385,7 +383,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { i++; } value[i] = 0; - talk_sound_b = atoi(value); + //talk_sound_b = atoi(value); ((SoundHE *)_sound)->startHETalkSound(talk_sound_a); break; case 104: @@ -408,7 +406,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { } value[i] = 0; talk_sound_a = atoi(value); - talk_sound_b = 0; + //talk_sound_b = 0; ((SoundHE *)_sound)->startHETalkSound(talk_sound_a); break; case 119: diff --git a/engines/scumm/usage_bits.cpp b/engines/scumm/usage_bits.cpp index da262defc9..10645fea10 100644 --- a/engines/scumm/usage_bits.cpp +++ b/engines/scumm/usage_bits.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/usage_bits.h b/engines/scumm/usage_bits.h index b3d582f7b9..3da1e791ea 100644 --- a/engines/scumm/usage_bits.h +++ b/engines/scumm/usage_bits.h @@ -18,9 +18,6 @@ * 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 SCUMM_USAGE_BITS_H diff --git a/engines/scumm/util.cpp b/engines/scumm/util.cpp index 5c3e4c9d0c..47a6bad6ec 100644 --- a/engines/scumm/util.cpp +++ b/engines/scumm/util.cpp @@ -18,9 +18,6 @@ * 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 "scumm/util.h" diff --git a/engines/scumm/util.h b/engines/scumm/util.h index 0d33987c31..f8f999624c 100644 --- a/engines/scumm/util.h +++ b/engines/scumm/util.h @@ -18,9 +18,6 @@ * 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 SCUMM_UTIL_H diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 48fe0a20ed..56f8de2ad1 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -18,9 +18,6 @@ * 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$ - * */ diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 6d5eb3fad7..69caceb53a 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -18,9 +18,6 @@ * 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 "scumm/actor.h" diff --git a/engines/scumm/verbs.h b/engines/scumm/verbs.h index 83e924edac..fb4dc969e2 100644 --- a/engines/scumm/verbs.h +++ b/engines/scumm/verbs.h @@ -17,9 +17,6 @@ * 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 SCUMM_VERBS_H |