aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dists/msvc9/scumm.vcproj1
-rw-r--r--engines/scumm/player_v4a.cpp41
-rw-r--r--engines/scumm/player_v4a.h3
-rw-r--r--sound/mods/tfmx.cpp24
-rw-r--r--sound/mods/tfmx.h3
5 files changed, 49 insertions, 23 deletions
diff --git a/dists/msvc9/scumm.vcproj b/dists/msvc9/scumm.vcproj
index 9b07375cc6..723113b253 100644
--- a/dists/msvc9/scumm.vcproj
+++ b/dists/msvc9/scumm.vcproj
@@ -130,7 +130,6 @@
ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0"
WarningLevel="4"
- WarnAsError="true"
DebugInformationFormat="0"
/>
<Tool
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp
index 69c071e08e..ea3c2c9eb9 100644
--- a/engines/scumm/player_v4a.cpp
+++ b/engines/scumm/player_v4a.cpp
@@ -48,12 +48,12 @@ bool Player_V4A::init() {
if (mdatExists && sampleExists) {
Audio::Tfmx *play = new Audio::Tfmx(_mixer->getOutputRate(), true);
- if (play->load(fileMdat, fileSample))
+ if (play->load(fileMdat, fileSample)) {
_tfmxPlay = play;
- else
+ } else
delete play;
}
- return true;
+ return _tfmxPlay != 0;
}
Player_V4A::~Player_V4A() {
@@ -98,26 +98,23 @@ void Player_V4A::startSound(int nr) {
debug("%s", buf);
- static const uint8 monkeyCommands[52] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 18, 17,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 16, 34, 0, 1, 2, 3, 7, 8, 10, 11, 4, 5, 14, 15, 12,
- 6, 13, 9, 19 };
-
- static const uint8 monkeyTypes[52] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0 };
+ 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
+ };
int val = ptr[9];
- if (val < 0 || val >= ARRAYSIZE(monkeyTypes))
+ if (val < 0 || val >= ARRAYSIZE(monkeyCommands))
debug("Tfmx: illegal Songnumber %i", val);
- bool soundFX = monkeyTypes[val] == 1;
int index = monkeyCommands[val];
- if (soundFX) {
+ if (index < 0) {
// SoundFX
- debug("Tfmx: Soundpattern %i", index);
+ debug("Tfmx: Soundpattern %i", -index - 1);
} else {
// Song
@@ -127,6 +124,7 @@ void Player_V4A::startSound(int nr) {
_tfmxPlay->doSong(index);
_musicId = nr;
+ _musicLastTicks = _tfmxPlay->getTicks();
_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _tfmxPlay, -1, Audio::Mixer::kMaxChannelVolume, 0, false, false);
}
@@ -134,9 +132,10 @@ void Player_V4A::startSound(int nr) {
int Player_V4A::getMusicTimer() const {
- static int t = 0;
- t += 300;
- return t;
+ if (_musicId) {
+ return (_tfmxPlay->getTicks() - _musicLastTicks) / 25;
+ } else
+ return 0;
}
int Player_V4A::getSoundStatus(int nr) const {
diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h
index 4eb881c656..6f7f6bc99f 100644
--- a/engines/scumm/player_v4a.h
+++ b/engines/scumm/player_v4a.h
@@ -54,10 +54,13 @@ public:
private:
ScummEngine *_vm;
+
Audio::Tfmx *_tfmxPlay;
Audio::Mixer *_mixer;
Audio::SoundHandle _musicHandle;
+ int _musicLastTicks;
+
enum {V4A_MAXSFX = 8};
struct SoundSlot {
diff --git a/sound/mods/tfmx.cpp b/sound/mods/tfmx.cpp
index 5f4598b518..de37823258 100644
--- a/sound/mods/tfmx.cpp
+++ b/sound/mods/tfmx.cpp
@@ -31,6 +31,8 @@
#include "sound/mods/tfmx.h"
+#include "tfmx/tfmxdebug.h"
+
namespace Audio {
const uint16 Tfmx::noteIntervalls[64] = {
@@ -57,6 +59,7 @@ Tfmx::~Tfmx() {
void Tfmx::interrupt() {
//assert(!_end);
+ ++_playerCtx.tickCount;
for (int i = 0; i < kNumVoices; ++i) {
ChannelContext &channel = _channelCtx[i];
@@ -187,7 +190,7 @@ static void warnMacroUnimplemented(const byte *macroPtr, int level) {
else
debug("Warning - Macro not completely supported:");
-// displayMacroStep(macroPtr);
+ displayMacroStep(macroPtr);
}
FORCEINLINE bool Tfmx::macroStep(ChannelContext &channel) {
@@ -496,6 +499,18 @@ doTrackstep:
}
}
+static void warnPatternUnimplemented(const byte *patternPtr, int level) {
+ if (level > 0)
+ return;
+ if (level == 0)
+ debug("Warning - Pattern not supported:");
+ else
+ debug("Warning - Pattern not completely supported:");
+
+ displayPatternstep(patternPtr);
+}
+
+
FORCEINLINE bool Tfmx::patternStep(PatternContext &pattern) {
const byte *const patternPtr = (byte *)(_resource.getPatternPtr(pattern.offset) + pattern.step);
++pattern.step;
@@ -547,6 +562,7 @@ FORCEINLINE bool Tfmx::patternStep(PatternContext &pattern) {
case 14: // Stop custompattern
// TODO ?
+ warnPatternUnimplemented(patternPtr, 0);
// FT
case 4: // Stop this pattern
pattern.command = 0xFF;
@@ -565,10 +581,13 @@ FORCEINLINE bool Tfmx::patternStep(PatternContext &pattern) {
return true;
case 8: // Subroutine
+ warnPatternUnimplemented(patternPtr, 0);
return true;
case 9: // Return from Subroutine
+ warnPatternUnimplemented(patternPtr, 0);
return true;
case 10: // fade master volume
+ warnPatternUnimplemented(patternPtr, 0);
return true;
case 11: { // play pattern. Parameters: patternCmd, channel, expose
@@ -589,7 +608,10 @@ FORCEINLINE bool Tfmx::patternStep(PatternContext &pattern) {
return true;
case 13: // Cue
+ warnPatternUnimplemented(patternPtr, 1);
+ debug("Cue/Signal %02X %04X", patternPtr[1], READ_BE_UINT16(&patternPtr[2]));
return true;
+
case 15: // NOP
return true;
}
diff --git a/sound/mods/tfmx.h b/sound/mods/tfmx.h
index 3064a1c86a..b6c4862178 100644
--- a/sound/mods/tfmx.h
+++ b/sound/mods/tfmx.h
@@ -49,6 +49,7 @@ public:
void doSong(int songPos);
void doMacro(int macro, int note);
bool load(Common::SeekableReadStream &musicData, Common::SeekableReadStream &sampleData);
+ int getTicks() {return _playerCtx.tickCount;}
// Note: everythings public so the debug-Routines work.
// private:
@@ -200,6 +201,8 @@ public:
int8 fadeTime;
int8 fadeReset;
int8 fadeSlope; */
+
+ int tickCount;
} _playerCtx;
void initMacroProgramm(ChannelContext &channel) {