aboutsummaryrefslogtreecommitdiff
path: root/engines/made
diff options
context:
space:
mode:
authorAlejandro Marzini2010-07-30 05:28:09 +0000
committerAlejandro Marzini2010-07-30 05:28:09 +0000
commitfb4086cadb8ce3e473dae40558d713e7a31b3858 (patch)
tree95c19d544da914c43a43f0538a1977f43e17cb39 /engines/made
parent7b070bbef8275ff25dfc2cbc3106acfdc8de74a5 (diff)
parenta17e3c444917ca90dfd537c2102a6150e7ffe977 (diff)
downloadscummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.tar.gz
scummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.tar.bz2
scummvm-rg350-fb4086cadb8ce3e473dae40558d713e7a31b3858.zip
Merged from trunk, from Rev 50841 to HEAD
svn-id: r51495
Diffstat (limited to 'engines/made')
-rw-r--r--engines/made/database.cpp7
-rw-r--r--engines/made/detection.cpp55
-rw-r--r--engines/made/resource.cpp7
-rw-r--r--engines/made/scriptfuncs.cpp83
-rw-r--r--engines/made/scriptfuncs.h17
5 files changed, 147 insertions, 22 deletions
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index ae1a08e1b5..51308cb7e5 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -515,6 +515,8 @@ int16 GameDatabaseV2::loadgame(const char *filename, int16 version) {
_objects[i]->load(*in);
}
delete in;
+
+ _objectPropertyCache.clear(); // make sure to clear cache
return result;
}
@@ -644,6 +646,8 @@ void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) {
void GameDatabaseV3::reloadFromStream(Common::SeekableReadStream &sourceS) {
sourceS.seek(_gameStateOffs);
sourceS.read(_gameState, _gameStateSize);
+
+ _objectPropertyCache.clear(); // make sure to clear cache
}
bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String &description, int16 version) {
@@ -734,6 +738,9 @@ int16 GameDatabaseV3::loadgame(const char *filename, int16 version) {
in->skip(64); // skip savegame description
in->read(_gameState, _gameStateSize);
delete in;
+
+ _objectPropertyCache.clear(); // make sure to clear cache
+
return 0;
}
diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp
index dd2becd3b8..6a6a70cb30 100644
--- a/engines/made/detection.cpp
+++ b/engines/made/detection.cpp
@@ -76,7 +76,6 @@ using Common::GUIO_NONE;
using Common::GUIO_NOSPEECH;
static const MadeGameDescription gameDescriptions[] = {
-
{
// NOTE: Return to Zork entries with *.dat are used to detect the game via rtzcd.dat,
// which is packed inside rtzcd.red. Entries with *.red refer to the packed file
@@ -329,6 +328,60 @@ static const MadeGameDescription gameDescriptions[] = {
},
{
+ // Return to Zork - Japanese DOS
+ // This is the RTZCD.DAT in the base directory of the FM-Towns CD
+ {
+ "rtz",
+ "",
+ AD_ENTRY1("rtzcd.dat", "c4fccf67ad247f09b94c3c808b138576"),
+ Common::JA_JPN,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO_NONE
+ },
+ GID_RTZ,
+ 0,
+ GF_CD,
+ 3,
+ },
+
+ {
+ // Return to Zork - Japanese FM-Towns
+ // This is in the RTZFM folder of the FM-Towns CD
+ {
+ "rtz",
+ "",
+ AD_ENTRY1("rtzcd.dat", "e949a6a42d82daabfa7d4dc0a87a9843"),
+ Common::JA_JPN,
+ Common::kPlatformFMTowns,
+ ADGF_NO_FLAGS,
+ GUIO_NONE
+ },
+ GID_RTZ,
+ 0,
+ GF_CD,
+ 3,
+ },
+
+ {
+ // Return to Zork - Japanese PC-98
+ // This is in the RTZ9821 folder of the FM-Towns CD
+ {
+ "rtz",
+ "",
+ AD_ENTRY1("rtzcd.dat", "0c0117e98530c736a141c2aad6834dc5"),
+ Common::JA_JPN,
+ Common::kPlatformPC98,
+ ADGF_NO_FLAGS,
+ GUIO_NONE
+ },
+ GID_RTZ,
+ 0,
+ GF_CD,
+ 3,
+ },
+
+ {
// The Manhole: New and Enhanced
{
"manhole",
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index 28d46cf4ec..cdcb49f9f9 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -50,10 +50,9 @@ PictureResource::~PictureResource() {
delete _picture;
_picture = 0;
}
- if (_picturePalette) {
- delete[] _picturePalette;
- _picturePalette = 0;
- }
+
+ delete[] _picturePalette;
+ _picturePalette = 0;
}
void PictureResource::load(byte *source, int size) {
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index b1a8b0ff84..2f069e882e 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "common/events.h"
#include "graphics/cursorman.h"
+#include "sound/softsynth/pcspk.h"
#include "made/made.h"
#include "made/resource.h"
@@ -40,6 +41,22 @@
namespace Made {
+ScriptFunctions::ScriptFunctions(MadeEngine *vm) : _vm(vm), _soundStarted(false) {
+ // Initialize the two tone generators
+ _pcSpeaker1 = new Audio::PCSpeaker();
+ _pcSpeaker2 = new Audio::PCSpeaker();
+ _vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_pcSpeakerHandle1, _pcSpeaker1);
+ _vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_pcSpeakerHandle2, _pcSpeaker2);
+}
+
+ScriptFunctions::~ScriptFunctions() {
+ for (uint i = 0; i < _externalFuncs.size(); ++i)
+ delete _externalFuncs[i];
+
+ _vm->_system->getMixer()->stopHandle(_pcSpeakerHandle1);
+ _vm->_system->getMixer()->stopHandle(_pcSpeakerHandle2);
+}
+
typedef Common::Functor2Mem<int16, int16*, int16, ScriptFunctions> ExternalScriptFunc;
#define External(x) \
_externalFuncs.push_back(new ExternalScriptFunc(this, &ScriptFunctions::x)); \
@@ -307,36 +324,78 @@ int16 ScriptFunctions::sfFlashScreen(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfPlayNote(int16 argc, int16 *argv) {
- // TODO: Used in Manhole:NE, Manhole EGA
- // This is used when using the piano in the desk screen inside the ship.
+ // This is used when using the piano in the desk screen inside the ship
+ // in The Manhole (EGA/NE).
+
// It takes 2 parameters:
- // The first parameter is the key pressed
+ // The first parameter is the note number of the key pressed + 1
// The second parameter is some sort of modifier (volume, perhaps?),
- // depending on which of the 3 keys on the right has been pressed (12 - 14)
- warning("Unimplemented opcode: sfPlayNote");
+ // depending on which of the 3 keys on the right has been pressed.
+ // This value seems to be [12, 14] in NE and [1, 3] in EGA.
+
+ // Note frequencies based on http://www.phy.mtu.edu/~suits/notefreqs.html
+ static const int freqTable[] = {
+ 16, 17, 18, 19, 21, 22, 23, 24, 26, 28, 29,
+ 30, 32, 35, 37, 39, 41, 44, 46, 49, 52, 55,
+ 58, 62, 65, 69, 73, 77, 82, 87, 93, 98, 104,
+ 110, 117, 123, 131, 139, 147, 156, 165, 175, 195,
+ 196, 208, 220, 233, 247, 262, 277, 294, 311, 330,
+ 349, 370, 392, 415, 440, 466, 494, 523, 554, 587,
+ 622, 659, 698, 740, 784, 831, 880, 932, 988, 1047,
+ 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760,
+ 1865, 1976, 2093, 2217, 2349, 2489, 2637, 2794, 2960,
+ 3136, 3322, 3529, 3729, 3951, 4186, 4435, 4697, 4978
+ };
+
+ debug(4, "sfPlayNote: Note = %d, Volume(?) = %d", argv[0] - 1, argv[1]);
+
+ _pcSpeaker1->play(Audio::PCSpeaker::kWaveFormSine, freqTable[argv[0] - 1], -1);
+
+ // TODO: Figure out what to do with the second parameter
+ //_pcSpeaker1->setVolume(argv[1]);
+
return 0;
}
int16 ScriptFunctions::sfStopNote(int16 argc, int16 *argv) {
- // TODO: Used in Manhole:NE, Manhole EGA
// Used in the same place as sfPlayNote, with the same parameters
- warning("Unimplemented opcode: sfStopNote");
+ // We just stop the wave generator here
+ _pcSpeaker1->stop();
return 0;
}
int16 ScriptFunctions::sfPlayTele(int16 argc, int16 *argv) {
- // TODO: Used in Manhole:NE, Manhole EGA
// This is used when pressing the phone keys while using the phone in
- // the desk screen inside the ship.
+ // the desk screen inside the ship in The Manhole (EGA/NE).
// It takes 1 parameter, the key pressed (0-9, 10 for asterisk, 11 for hash)
- warning("Unimplemented opcode: sfPlayTele");
+
+ // A telephone keypad uses a two tones for each key.
+ // See http://en.wikipedia.org/wiki/Telephone_keypad for more info
+
+ static const int freqTable1[] = {
+ 1336, 1209, 1336, 1477,
+ 1209, 1336, 1477, 1209,
+ 1336, 1477, 1209, 1477
+ };
+
+ static const int freqTable2[] = {
+ 941, 697, 697, 697,
+ 770, 770, 770, 852,
+ 852, 852, 941, 941
+ };
+
+ debug(4, "sfPlayTele: Button = %d", argv[0]);
+
+ _pcSpeaker1->play(Audio::PCSpeaker::kWaveFormSine, freqTable1[argv[0]], -1);
+ _pcSpeaker2->play(Audio::PCSpeaker::kWaveFormSine, freqTable2[argv[0]], -1);
return 0;
}
int16 ScriptFunctions::sfStopTele(int16 argc, int16 *argv) {
- // TODO: Used in Manhole:NE, Manhole EGA
// Used in the same place as sfPlayTele, with the same parameters
- warning("Unimplemented opcode: sfStopTele");
+ // We just stop both wave generators here
+ _pcSpeaker1->stop();
+ _pcSpeaker2->stop();
return 0;
}
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 5fdfb77f45..3bed27c5c8 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -33,6 +33,10 @@
#include "made/resource.h"
+namespace Audio {
+ class PCSpeaker;
+}
+
namespace Made {
class MadeEngine;
@@ -41,17 +45,16 @@ typedef Common::Functor2<int16, int16*, int16> ExternalFunc;
class ScriptFunctions {
public:
- ScriptFunctions(MadeEngine *vm) : _vm(vm), _soundStarted(false) {}
- virtual ~ScriptFunctions() {
- for (uint i = 0; i < _externalFuncs.size(); ++i)
- delete _externalFuncs[i];
- }
+ ScriptFunctions(MadeEngine *vm);
+ virtual ~ScriptFunctions();
+
int16 callFunction(uint16 index, int16 argc, int16 *argv) {
if (index >= _externalFuncs.size())
error("ScriptFunctions::callFunction() Invalid function index %d", index);
debug(4, "%s", _externalFuncNames[index]);
return (*_externalFuncs[index])(argc, argv);
}
+
void setupExternalsTable();
const char* getFuncName(int index) { return _externalFuncNames[index]; }
int getCount() const { return _externalFuncs.size(); }
@@ -64,6 +67,10 @@ protected:
SoundResource* _soundResource;
bool _soundStarted;
+ // PlayNote/StopNote and PlayTele/StopTele wave generators
+ Audio::SoundHandle _pcSpeakerHandle1, _pcSpeakerHandle2;
+ Audio::PCSpeaker *_pcSpeaker1, *_pcSpeaker2;
+
Common::Array<const ExternalFunc*> _externalFuncs;
Common::Array<const char *> _externalFuncNames;
GenericResource *_musicRes;