aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/module.mk1
-rw-r--r--engines/scumm/palette.cpp223
-rw-r--r--engines/scumm/player_v4a.cpp186
-rw-r--r--engines/scumm/player_v4a.h96
-rw-r--r--engines/scumm/scumm.cpp6
-rw-r--r--engines/scumm/scumm.h2
-rw-r--r--engines/scumm/sound.cpp20
7 files changed, 374 insertions, 160 deletions
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index 58d8db91fc..51fbecdb0d 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -40,6 +40,7 @@ MODULE_OBJS := \
player_v2a.o \
player_v2cms.o \
player_v3a.o \
+ player_v4a.o \
resource_v2.o \
resource_v3.o \
resource_v4.o \
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index a2cd4a0d4d..44249a8715 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -70,121 +70,80 @@ void ScummEngine::resetPalette() {
else
setEGAPalette();
}
+ } else if ((_game.platform == Common::kPlatformAmiga) && _game.version == 4) {
+ // if rendermode is set to EGA we use the full palette from the resources
+ // else we initialise and then lock down the first 16 colors.
+ if (_renderMode != Common::kRenderEGA)
+ setAmigaMIPalette();
} else
setDirtyColors(0, 255);
}
-void ScummEngine::setC64Palette() {
- setPalColor( 0, 0x00, 0x00, 0x00);
- setPalColor( 1, 0xFD, 0xFE, 0xFC);
- setPalColor( 2, 0xBE, 0x1A, 0x24);
- setPalColor( 3, 0x30, 0xE6, 0xC6);
- setPalColor( 4, 0xB4, 0x1A, 0xE2);
- setPalColor( 5, 0x1F, 0xD2, 0x1E);
- setPalColor( 6, 0x21, 0x1B, 0xAE);
- setPalColor( 7, 0xDF, 0xF6, 0x0A);
- setPalColor( 8, 0xB8, 0x41, 0x04);
- setPalColor( 9, 0x6A, 0x33, 0x04);
- setPalColor(10, 0xFE, 0x4A, 0x57);
- setPalColor(11, 0x42, 0x45, 0x40);
- setPalColor(12, 0x70, 0x74, 0x6F);
- setPalColor(13, 0x59, 0xFE, 0x59);
- setPalColor(14, 0x5F, 0x53, 0xFE);
- setPalColor(15, 0xA4, 0xA7, 0xA2);
+void ScummEngine::setHardcodedPaletteRGB(const byte *ptr, int numcolor, int index) {
+ for ( ; numcolor > 0; --numcolor, ++index, ptr += 3)
+ setPalColor( index, ptr[0], ptr[1], ptr[2]);
+}
+void ScummEngine::setC64Palette() {
// Use 17 color table for v1 games to allow correct color for inventory and
// sentence line. Original games used some kind of dynamic color table
// remapping between rooms.
- setPalColor(16, 255, 85, 255);
+ static const byte ctable[] = {
+ 0x00, 0x00, 0x00, 0xFD, 0xFE, 0xFC, 0xBE, 0x1A, 0x24, 0x30, 0xE6, 0xC6,
+ 0xB4, 0x1A, 0xE2, 0x1F, 0xD2, 0x1E, 0x21, 0x1B, 0xAE, 0xDF, 0xF6, 0x0A,
+ 0xB8, 0x41, 0x04, 0x6A, 0x33, 0x04, 0xFE, 0x4A, 0x57, 0x42, 0x45, 0x40,
+ 0x70, 0x74, 0x6F, 0x59, 0xFE, 0x59, 0x5F, 0x53, 0xFE, 0xA4, 0xA7, 0xA2,
+
+ 0xFF, 0x55, 0xFF
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
}
void ScummEngine::setNESPalette() {
- setPalColor(0x00,0x00,0x00,0x00); // 0x1D
- setPalColor(0x01,0x00,0x24,0x92);
- setPalColor(0x02,0x00,0x00,0xDB);
- setPalColor(0x03,0x6D,0x49,0xDB);
- setPalColor(0x04,0x92,0x00,0x6D);
- setPalColor(0x05,0xB6,0x00,0x6D);
- setPalColor(0x06,0xB6,0x24,0x00);
- setPalColor(0x07,0x92,0x49,0x00);
- setPalColor(0x08,0x6D,0x49,0x00);
- setPalColor(0x09,0x24,0x49,0x00);
- setPalColor(0x0A,0x00,0x6D,0x24);
- setPalColor(0x0B,0x00,0x92,0x00);
- setPalColor(0x0C,0x00,0x49,0x49);
- setPalColor(0x0D,0x00,0x00,0x00);
- setPalColor(0x0E,0x00,0x00,0x00);
- setPalColor(0x0F,0x00,0x00,0x00);
-
- setPalColor(0x10,0xB6,0xB6,0xB6);
- setPalColor(0x11,0x00,0x6D,0xDB);
- setPalColor(0x12,0x00,0x49,0xFF);
- setPalColor(0x13,0x92,0x00,0xFF);
- setPalColor(0x14,0xB6,0x00,0xFF);
- setPalColor(0x15,0xFF,0x00,0x92);
- setPalColor(0x16,0xFF,0x00,0x00);
- setPalColor(0x17,0xDB,0x6D,0x00);
- setPalColor(0x18,0x92,0x6D,0x00);
- setPalColor(0x19,0x24,0x92,0x00);
- setPalColor(0x1A,0x00,0x92,0x00);
- setPalColor(0x1B,0x00,0xB6,0x6D);
- setPalColor(0x1C,0x00,0x92,0x92);
- setPalColor(0x1D,0x6D,0x6D,0x6D); // 0x00
- setPalColor(0x1E,0x00,0x00,0x00);
- setPalColor(0x1F,0x00,0x00,0x00);
-
- setPalColor(0x20,0xFF,0xFF,0xFF);
- setPalColor(0x21,0x6D,0xB6,0xFF);
- setPalColor(0x22,0x92,0x92,0xFF);
- setPalColor(0x23,0xDB,0x6D,0xFF);
- setPalColor(0x24,0xFF,0x00,0xFF);
- setPalColor(0x25,0xFF,0x6D,0xFF);
- setPalColor(0x26,0xFF,0x92,0x00);
- setPalColor(0x27,0xFF,0xB6,0x00);
- setPalColor(0x28,0xDB,0xDB,0x00);
- setPalColor(0x29,0x6D,0xDB,0x00);
- setPalColor(0x2A,0x00,0xFF,0x00);
- setPalColor(0x2B,0x49,0xFF,0xDB);
- setPalColor(0x2C,0x00,0xFF,0xFF);
- setPalColor(0x2D,0x49,0x49,0x49);
- setPalColor(0x2E,0x00,0x00,0x00);
- setPalColor(0x2F,0x00,0x00,0x00);
-
- setPalColor(0x30,0xFF,0xFF,0xFF);
- setPalColor(0x31,0xB6,0xDB,0xFF);
- setPalColor(0x32,0xDB,0xB6,0xFF);
- setPalColor(0x33,0xFF,0xB6,0xFF);
- setPalColor(0x34,0xFF,0x92,0xFF);
- setPalColor(0x35,0xFF,0xB6,0xB6);
- setPalColor(0x36,0xFF,0xDB,0x92);
- setPalColor(0x37,0xFF,0xFF,0x49);
- setPalColor(0x38,0xFF,0xFF,0x6D);
- setPalColor(0x39,0xB6,0xFF,0x49);
- setPalColor(0x3A,0x92,0xFF,0x6D);
- setPalColor(0x3B,0x49,0xFF,0xDB);
- setPalColor(0x3C,0x92,0xDB,0xFF);
- setPalColor(0x3D,0x92,0x92,0x92);
- setPalColor(0x3E,0x00,0x00,0x00);
- setPalColor(0x3F,0x00,0x00,0x00);
+ static const byte ctable[] = {
+ /* 0x1D */
+ 0x00, 0x00, 0x00, 0x00, 0x24, 0x92, 0x00, 0x00, 0xDB, 0x6D, 0x49, 0xDB,
+ 0x92, 0x00, 0x6D, 0xB6, 0x00, 0x6D, 0xB6, 0x24, 0x00, 0x92, 0x49, 0x00,
+ 0x6D, 0x49, 0x00, 0x24, 0x49, 0x00, 0x00, 0x6D, 0x24, 0x00, 0x92, 0x00,
+ 0x00, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ 0xB6, 0xB6, 0xB6, 0x00, 0x6D, 0xDB, 0x00, 0x49, 0xFF, 0x92, 0x00, 0xFF,
+ 0xB6, 0x00, 0xFF, 0xFF, 0x00, 0x92, 0xFF, 0x00, 0x00, 0xDB, 0x6D, 0x00,
+ 0x92, 0x6D, 0x00, 0x24, 0x92, 0x00, 0x00, 0x92, 0x00, 0x00, 0xB6, 0x6D,
+ /* 0x00 */
+ 0x00, 0x92, 0x92, 0x6D, 0x6D, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ 0xFF, 0xFF, 0xFF, 0x6D, 0xB6, 0xFF, 0x92, 0x92, 0xFF, 0xDB, 0x6D, 0xFF,
+ 0xFF, 0x00, 0xFF, 0xFF, 0x6D, 0xFF, 0xFF, 0x92, 0x00, 0xFF, 0xB6, 0x00,
+ 0xDB, 0xDB, 0x00, 0x6D, 0xDB, 0x00, 0x00, 0xFF, 0x00, 0x49, 0xFF, 0xDB,
+ 0x00, 0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ 0xFF, 0xFF, 0xFF, 0xB6, 0xDB, 0xFF, 0xDB, 0xB6, 0xFF, 0xFF, 0xB6, 0xFF,
+ 0xFF, 0x92, 0xFF, 0xFF, 0xB6, 0xB6, 0xFF, 0xDB, 0x92, 0xFF, 0xFF, 0x49,
+ 0xFF, 0xFF, 0x6D, 0xB6, 0xFF, 0x49, 0x92, 0xFF, 0x6D, 0x49, 0xFF, 0xDB,
+ 0x92, 0xDB, 0xFF, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
}
void ScummEngine::setAmigaPalette() {
- setPalColor( 0, 0, 0, 0);
- setPalColor( 1, 0, 0, 187);
- setPalColor( 2, 0, 187, 0);
- setPalColor( 3, 0, 187, 187);
- setPalColor( 4, 187, 0, 0);
- setPalColor( 5, 187, 0, 187);
- setPalColor( 6, 187, 119, 0);
- setPalColor( 7, 187, 187, 187);
- setPalColor( 8, 119, 119, 119);
- setPalColor( 9, 119, 119, 255);
- setPalColor(10, 0, 255, 0);
- setPalColor(11, 0, 255, 255);
- setPalColor(12, 255, 136, 136);
- setPalColor(13, 255, 0, 255);
- setPalColor(14, 255, 255, 0);
- setPalColor(15, 255, 255, 255);
+ static const byte ctable[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0x00, 0xBB, 0x00, 0x00, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0xBB, 0x00, 0xBB, 0xBB, 0x77, 0x00, 0xBB, 0xBB, 0xBB,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF,
+ 0xFF, 0x88, 0x88, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
+}
+
+void ScummEngine::setAmigaMIPalette() {
+ static const byte ctable[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x88, 0x22, 0x00, 0x66, 0x77,
+ 0xBB, 0x66, 0x66, 0xAA, 0x22, 0xAA, 0x88, 0x55, 0x22, 0x77, 0x77, 0x77,
+ 0x33, 0x33, 0x33, 0x22, 0x55, 0xDD, 0x22, 0xDD, 0x44, 0x00, 0xCC, 0xFF,
+ 0xFF, 0x99, 0x99, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x77, 0xFF, 0xFF, 0xFF
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
}
void ScummEngine::setHercPalette() {
@@ -214,50 +173,32 @@ void ScummEngine::setCGAPalette() {
}
void ScummEngine::setEGAPalette() {
- setPalColor( 0, 0, 0, 0);
- setPalColor( 1, 0, 0, 170);
- setPalColor( 2, 0, 170, 0);
- setPalColor( 3, 0, 170, 170);
- setPalColor( 4, 170, 0, 0);
- setPalColor( 5, 170, 0, 170);
- setPalColor( 6, 170, 85, 0);
- setPalColor( 7, 170, 170, 170);
- setPalColor( 8, 85, 85, 85);
- setPalColor( 9, 85, 85, 255);
- setPalColor(10, 85, 255, 85);
- setPalColor(11, 85, 255, 255);
- setPalColor(12, 255, 85, 85);
- setPalColor(13, 255, 85, 255);
- setPalColor(14, 255, 255, 85);
- setPalColor(15, 255, 255, 255);
+ static const byte ctable[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0xAA, 0xAA,
+ 0xAA, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0xAA, 0x55, 0x00, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0x55, 0x55, 0xFF, 0xFF,
+ 0xFF, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
}
void ScummEngine::setV1Palette() {
- setPalColor( 0, 0, 0, 0);
- setPalColor( 1, 255, 255, 255);
- setPalColor( 2, 170, 0, 0);
- setPalColor( 3, 0, 170, 170);
- setPalColor( 4, 170, 0, 170);
- setPalColor( 5, 0, 170, 0);
- setPalColor( 6, 0, 0, 170);
- setPalColor( 7, 255, 255, 85);
- setPalColor( 8, 255, 85, 85);
- setPalColor( 9, 170, 85, 0);
- setPalColor(10, 255, 85, 85);
- setPalColor(11, 85, 85, 85);
- setPalColor(12, 170, 170, 170);
- setPalColor(13, 85, 255, 85);
- setPalColor(14, 85, 85, 255);
+ static const byte ctable[] = {
+ 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0xAA,
+ 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0xFF, 0xFF, 0x55,
+ 0xFF, 0x55, 0x55, 0xAA, 0x55, 0x00, 0xFF, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0x55, 0xFF, 0x55, 0x55, 0x55, 0xFF, 0x55, 0x55, 0x55,
+
+ 0xFF, 0x55, 0xFF
+ };
+ setHardcodedPaletteRGB(ctable, ARRAYSIZE(ctable) / 3);
if (_game.id == GID_ZAK)
setPalColor(15, 170, 170, 170);
- else
- setPalColor(15, 85, 85, 85);
-
- setPalColor(16, 255, 85, 255);
}
void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
+ int firstIndex = 0;
int i;
byte *dest, r, g, b;
@@ -277,7 +218,13 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
dest = _currentPalette;
- for (i = 0; i < numcolor; i++) {
+ if ((_game.platform == Common::kPlatformAmiga) && _game.version == 4 && _renderMode != Common::kRenderEGA) {
+ firstIndex = 16;
+ dest += 3 * 16;
+ ptr += 3 * 16;
+ }
+
+ for (i = firstIndex; i < numcolor; i++) {
r = *ptr++;
g = *ptr++;
b = *ptr++;
@@ -302,7 +249,7 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
memcpy(_darkenPalette, _currentPalette, 768);
}
- setDirtyColors(0, numcolor - 1);
+ setDirtyColors(firstIndex, numcolor - 1);
}
void ScummEngine::setDirtyColors(int min, int max) {
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp
new file mode 100644
index 0000000000..7c3aab0462
--- /dev/null
+++ b/engines/scumm/player_v4a.cpp
@@ -0,0 +1,186 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+
+#include "engines/engine.h"
+#include "scumm/player_v4a.h"
+#include "scumm/scumm.h"
+
+#include "common/file.h"
+
+namespace Scumm {
+
+Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer)
+ : _vm(scumm), _mixer(mixer), _musicId(), _sfxSlots(), _tfmxPlay(0), _tfmxSfx(0), _musicHandle(), _sfxHandle() {
+ init();
+}
+
+bool Player_V4A::init() {
+ if (_vm->_game.id != GID_MONKEY_VGA)
+ error("player_v4a - unknown game");
+
+ Common::File fileMdat;
+ Common::File fileSample;
+ bool mdatExists = fileMdat.open("music.dat");
+ bool sampleExists = fileSample.open("sample.dat");
+
+ if (mdatExists && sampleExists) {
+ Audio::Tfmx *play = new Audio::Tfmx(_mixer->getOutputRate(), true);
+ if (play->load(fileMdat, fileSample)) {
+ play->setSignalPtr(_signal);
+ _tfmxPlay = play;
+ } else
+ delete play;
+
+ play = new Audio::Tfmx(_mixer->getOutputRate(), true);
+ fileMdat.seek(0);
+ fileSample.seek(0);
+ if (play->load(fileMdat, fileSample)) {
+ _tfmxSfx = play;
+ } else
+ delete play;
+ }
+ return _tfmxPlay != 0;
+}
+
+Player_V4A::~Player_V4A() {
+ _mixer->stopHandle(_musicHandle);
+ _mixer->stopHandle(_sfxHandle);
+ delete _tfmxPlay;
+ delete _tfmxSfx;
+}
+
+void Player_V4A::setMusicVolume(int vol) {
+ debug(5, "player_v4a: setMusicVolume %i", vol);
+}
+
+void Player_V4A::stopAllSounds() {
+ debug(5, "player_v4a: stopAllSounds");
+ if (_tfmxPlay) {
+ _tfmxPlay->stopSong();
+ _signal[0] = 0;
+ }
+ _musicId = 0;
+ if (_tfmxSfx)
+ _tfmxSfx->stopSong();
+ clearSfxSlots();
+}
+
+void Player_V4A::stopSound(int nr) {
+ debug(5, "player_v4a: stopSound %d", nr);
+ if (nr == 0)
+ return;
+ if (nr == _musicId) {
+ _musicId = 0;
+ _tfmxPlay->stopSong();
+ _signal[0] = 0;
+ } else {
+ const int chan = getSfxChan(nr);
+ if (chan != -1) {
+ setSfxSlot(chan, 0);
+ _tfmxSfx->stopMacroEffect(chan);
+ }
+ }
+}
+
+void Player_V4A::startSound(int nr) {
+ assert(_vm);
+ const byte *ptr = _vm->getResourceAddress(rtSound, nr);
+ assert(ptr);
+
+ static const int8 monkeyCommands[52] = {
+ -1, -2, -3, -4, -5, -6, -7, -8,
+ -9, -10, -11, -12, -13, -14, 18, 17,
+ -17, -18, -19, -20, -21, -22, -23, -24,
+ -25, -26, -27, -28, -29, -30, -31, -32,
+ -33, 16, -35, 0, 1, 2, 3, 7,
+ 8, 10, 11, 4, 5, 14, 15, 12,
+ 6, 13, 9, 19
+ };
+
+ const int val = ptr[9];
+ if (val < 0 || val >= ARRAYSIZE(monkeyCommands)) {
+ warning("player_v4a: illegal Songnumber %i", val);
+ return;
+ }
+
+ if (!_tfmxSfx || !_tfmxPlay)
+ return;
+
+ int index = monkeyCommands[val];
+ const byte type = ptr[6];
+ if (index < 0) {
+ // SoundFX
+ index = -index - 1;
+ debug(3, "player_v4a: play %d: custom %i - %02X", nr, index, type);
+
+ if (_tfmxSfx->getSongIndex() < 0)
+ _tfmxSfx->doSong(0x18);
+ const int chan = _tfmxSfx->doSfx((uint16)index);
+ if (chan >= 0 && chan < ARRAYSIZE(_sfxSlots))
+ setSfxSlot(chan, nr, type);
+ else
+ warning("player_v4a: custom %i is not of required type", index);
+
+ if (!_mixer->isSoundHandleActive(_sfxHandle))
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+ } else {
+ // Song
+ debug(3, "player_v4a: play %d: song %i - %02X", nr, index, type);
+ if (ptr[6] != 0x7F)
+ warning("player_v4a: Song has wrong type");
+
+ _tfmxPlay->doSong(index);
+ _signal[0] = 2;
+ _musicId = nr;
+
+ if (!_mixer->isSoundHandleActive(_musicHandle))
+ _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+ }
+}
+
+int Player_V4A::getMusicTimer() const {
+ if (_musicId) {
+ // TODO: The titlesong is running with ~70 ticks per second and the scale seems to be based on that.
+ // Other songs dont and I have no clue if this scalevalue is anything close to correct for them.
+ // The Amiga-Game doesnt counts the ticks of the song, but has an own timer and I hope thespeed is constant through the game
+ const int magicScale = 357; // ~ 1000 * 25 * (10173 / 709379.0)
+ return (_mixer->getSoundElapsedTime(_musicHandle)) / magicScale;
+ }
+ return 0;
+}
+
+int Player_V4A::getSoundStatus(int nr) const {
+ bool a = nr == _musicId;
+ bool b = _tfmxPlay->getSongIndex() >= 0;
+ int c = _signal[0];
+
+ debug(5, "player_v4a: getSoundStatus music=%d, active=%d, signal=%d", a, b, c);
+ if (nr == _musicId)
+ return _signal[0];
+ return 0;
+}
+
+} // End of namespace Scumm
diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h
new file mode 100644
index 0000000000..3b454e9349
--- /dev/null
+++ b/engines/scumm/player_v4a.h
@@ -0,0 +1,96 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCUMM_PLAYER_V4A_H
+#define SCUMM_PLAYER_V4A_H
+
+#include "common/scummsys.h"
+#include "scumm/music.h"
+#include "sound/mixer.h"
+#include "sound/mods/tfmx.h"
+
+class Mixer;
+
+namespace Scumm {
+
+class ScummEngine;
+
+/**
+ * Scumm V4 Amiga sound/music driver.
+ */
+class Player_V4A : public MusicEngine {
+public:
+ Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer);
+ virtual ~Player_V4A();
+
+ virtual void setMusicVolume(int vol);
+ virtual void startSound(int sound);
+ virtual void stopSound(int sound);
+ virtual void stopAllSounds();
+ virtual int getMusicTimer() const;
+ virtual int getSoundStatus(int sound) const;
+
+private:
+ ScummEngine *_vm;
+
+ Audio::Tfmx *_tfmxPlay;
+ Audio::Tfmx *_tfmxSfx;
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _musicHandle;
+ Audio::SoundHandle _sfxHandle;
+
+ int _musicId;
+ uint16 _signal[4];
+
+ struct SfxChan {
+ int id;
+ byte type;
+ } _sfxSlots[4];
+
+ int getSfxChan(int id) const {
+ for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i)
+ if (_sfxSlots[i].id == id)
+ return i;
+ return -1;
+ }
+
+ void setSfxSlot(int channel, int id, byte type = 0) {
+ _sfxSlots[channel].id = id;
+ _sfxSlots[channel].type = type;
+ }
+
+ void clearSfxSlots() {
+ for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i){
+ _sfxSlots[i].id = 0;
+ _sfxSlots[i].type = 0;
+ }
+ }
+
+ bool init();
+};
+
+} // End of namespace Scumm
+
+#endif
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index dcbf95ef4b..6716fda3fd 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -55,6 +55,7 @@
#include "scumm/player_v2.h"
#include "scumm/player_v2a.h"
#include "scumm/player_v3a.h"
+#include "scumm/player_v4a.h"
#include "scumm/he/resource_he.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v8.h"
@@ -494,7 +495,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
case Common::kRenderCGA:
case Common::kRenderEGA:
case Common::kRenderAmiga:
- if ((_game.version >= 4 && !(_game.features & GF_16COLOR)) || (_game.features & GF_OLD256))
+ if ((_game.version >= 4 && !(_game.features & GF_16COLOR) && !(_game.platform == Common::kPlatformAmiga && _renderMode == Common::kRenderEGA))
+ || (_game.features & GF_OLD256))
_renderMode = Common::kRenderDefault;
break;
@@ -1669,7 +1671,7 @@ void ScummEngine::setupMusic(int midi) {
} else if (_game.platform == Common::kPlatformPCEngine && _game.version == 3) {
// TODO: Add support for music format
} else if (_game.platform == Common::kPlatformAmiga && _game.version <= 4) {
- // TODO: Add support for music format
+ _musicEngine = new Player_V4A(this, _mixer);
} else if (_game.id == GID_MANIAC && _game.version == 1) {
_musicEngine = new Player_V1(this, _mixer, midiDriver != MD_PCSPK);
} else if (_game.version <= 2) {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 9ac6f87f26..b74104ea3c 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1017,9 +1017,11 @@ protected:
const byte *getPalettePtr(int palindex, int room);
+ void setHardcodedPaletteRGB(const byte *ptr, int numcolor, int firstIndex = 0);
void setC64Palette();
void setNESPalette();
void setAmigaPalette();
+ void setAmigaMIPalette();
void setHercPalette();
void setCGAPalette();
void setEGAPalette();
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index bc3ca00571..970b3970b6 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -440,26 +440,6 @@ void Sound::playSound(int soundID) {
if (_vm->_game.id == GID_MONKEY_VGA || _vm->_game.id == GID_MONKEY_EGA
|| (_vm->_game.id == GID_MONKEY && _vm->_game.platform == Common::kPlatformMacintosh)) {
- // Sound is currently not supported at all in the amiga versions of these games
- if (_vm->_game.platform == Common::kPlatformAmiga) {
- int track = -1;
- if (soundID == 50)
- track = 17;
- else if (ptr[6] == 0x7F && ptr[7] == 0x00 && ptr[8] == 0x80) {
- static const char tracks[16] = {13,14,10,3,4,9,16,5,1,8,2,15,6,7,11,12};
- if (ptr[9] == 0x0E)
- track = 18;
- else
- track = tracks[ptr[9] - 0x23];
- }
- if (track != -1) {
- playCDTrack(track,((track < 5) || (track > 16)) ? 1 : -1,0,0);
- stopCDTimer();
- _currentCDSound = soundID;
- }
- return;
- }
-
// Works around the fact that in some places in MonkeyEGA/VGA,
// the music is never explicitly stopped.
// Rather it seems that starting a new music is supposed to