engines/scumm/*: enabled choosing of the colorpalette, by setting RenderMode to EGA the "old" palette will be used

tfmx/tfmxplayer.cpp: removed some unused stuff
sound/mods/tfmx.cpp: emulating the way MI initialises new macro-programms. (Difference might not be audible at all)

svn-id: r41976
This commit is contained in:
Norbert Lange 2009-06-30 17:41:24 +00:00
parent cf351dffe6
commit e3a5da7b7e
7 changed files with 97 additions and 219 deletions

View file

@ -70,140 +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);
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,
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);
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,
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);
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,
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);
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);
} */
void ScummEngine::setAmigaPalette() {
setPalColor( 0, 0, 0, 0);
setPalColor( 1, 0, 0, 170);
setPalColor( 2, 0, 136, 34);
setPalColor( 3, 0, 102, 119);
setPalColor( 4, 187, 102, 102);
setPalColor( 5, 170, 34, 170);
setPalColor( 6, 136, 85, 34);
setPalColor( 7, 119, 119, 119);
setPalColor( 8, 51, 51, 51);
setPalColor( 9, 34, 85, 221);
setPalColor(10, 34, 221, 68);
setPalColor(11, 0, 204, 255);
setPalColor(12, 255, 153, 153);
setPalColor(13, 255, 85, 255);
setPalColor(14, 255, 255, 119);
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() {
@ -233,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;
@ -296,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++;
@ -321,9 +249,7 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
memcpy(_darkenPalette, _currentPalette, 768);
}
setAmigaPalette();
setDirtyColors(0, numcolor - 1);
setDirtyColors(firstIndex, numcolor - 1);
}
void ScummEngine::setDirtyColors(int min, int max) {

View file

@ -495,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;

View file

@ -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();

View file

@ -440,27 +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 && false) {
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

View file

@ -93,8 +93,9 @@ void Tfmx::interrupt() {
channel.sfxLocked = (channel.customMacroPrio != 0);
}
// apply timebased effects on Parameters
effects(channel);
// apply timebased effects on Parameters
if (channel.macroSfxRun > 0)
effects(channel);
// see if we have to run the macro-program
if (channel.macroRun) {
@ -107,6 +108,8 @@ void Tfmx::interrupt() {
}
Paula::setChannelPeriod(channel.paulaChannel, channel.period);
if (channel.macroSfxRun >= 0)
channel.macroSfxRun = 1;
// TODO: handling pending DMAOff?
}
@ -253,6 +256,9 @@ void Tfmx::macroRun(ChannelContext &channel) {
continue;
case 0x01: // DMA On
// TODO: Parameter macroPtr[1] - en-/disable effects
if (macroPtr[1])
debug("Tfmx: DMA On %i", (int8)macroPtr[1]);
channel.dmaIntCount = 0;
if (deferWait) {
// TODO

View file

@ -146,6 +146,7 @@ public:
uint16 macroReturnStep;
uint8 macroLoopCount;
bool macroRun;
int8 macroSfxRun;
uint32 customMacro;
uint8 customMacroIndex;
@ -232,6 +233,7 @@ private:
channel.macroStep = 0;
channel.macroWait = 0;
channel.macroRun = true;
channel.macroSfxRun = 0;
channel.macroLoopCount = 0xFF;
channel.dmaIntCount = 0;
}
@ -245,6 +247,7 @@ private:
static void clearMacroProgramm(ChannelContext &channel) {
channel.macroRun = false;
channel.macroSfxRun = 0;
channel.dmaIntCount = 0;
}

View file

@ -16,48 +16,9 @@
using namespace Common;
void simplePlaybacktest(int argc, const char *const argv[]) {
const char *modFilename = "mod.protracker";
if (argc == 2)
modFilename = argv[1];
// get Mixer, assume this never fails
Audio::Mixer *mixer = g_system->getMixer();
FSNode fileDir(FILEDIR);
debug( "searching for Files in Directory: %s", fileDir.getPath().c_str());
FSNode musicFile = fileDir.getChild(modFilename);
SeekableReadStream *fileIn = musicFile.createReadStream();
if (0 == fileIn) {
debug( "cant open File %s", musicFile.getName().c_str());
return;
}
Audio::AudioStream *stream = Audio::makeProtrackerStream(fileIn);
delete fileIn;
if (0 == stream) {
debug( "cant open File %s as Protacker-Stream", musicFile.getName().c_str());
return;
}
Audio::SoundHandle soundH;
mixer->playInputStream(Audio::Mixer::kMusicSoundType, &soundH, stream);
while (mixer->isSoundHandleActive(soundH))
g_system->delayMillis(1000);
//mixer->stopAll();
}
#define MUSICFILE "mdat.monkey"
#define SAMPLEFILE "smpl.monkey"
//#define MUSICFILE "mdat.tworld_1"
//#define SAMPLEFILE "smpl.tworld_1"
Audio::Tfmx *loadTfmxfile(const char *mdatName, const char *sampleName) {
FSNode fileDir(FILEDIR);
FSNode musicNode = fileDir.getChild(mdatName);