[Scummvm-cvs-logs] SF.net SVN: scummvm:[41526] scummvm/branches/gsoc2009-mods

nolange at users.sourceforge.net nolange at users.sourceforge.net
Sun Jun 14 21:40:24 CEST 2009


Revision: 41526
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41526&view=rev
Author:   nolange
Date:     2009-06-14 19:40:24 +0000 (Sun, 14 Jun 2009)

Log Message:
-----------
player_v4a:
	Made musictimer work a bit better, merged the 2 tables into 1

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/dists/msvc9/scumm.vcproj
    scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
    scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h

Modified: scummvm/branches/gsoc2009-mods/dists/msvc9/scumm.vcproj
===================================================================
--- scummvm/branches/gsoc2009-mods/dists/msvc9/scumm.vcproj	2009-06-14 19:06:46 UTC (rev 41525)
+++ scummvm/branches/gsoc2009-mods/dists/msvc9/scumm.vcproj	2009-06-14 19:40:24 UTC (rev 41526)
@@ -130,7 +130,6 @@
 				ForceConformanceInForLoopScope="true"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"
-				WarnAsError="true"
 				DebugInformationFormat="0"
 			/>
 			<Tool

Modified: scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp	2009-06-14 19:06:46 UTC (rev 41525)
+++ scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.cpp	2009-06-14 19:40:24 UTC (rev 41526)
@@ -48,12 +48,12 @@
 
 	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 @@
 	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 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
+	};
 
-	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 };
-
 	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 @@
 
 		_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 @@
 
 
 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 {

Modified: scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h	2009-06-14 19:06:46 UTC (rev 41525)
+++ scummvm/branches/gsoc2009-mods/engines/scumm/player_v4a.h	2009-06-14 19:40:24 UTC (rev 41526)
@@ -54,10 +54,13 @@
 
 private:
 	ScummEngine *_vm;
+
 	Audio::Tfmx *_tfmxPlay;
 	Audio::Mixer *_mixer;
 	Audio::SoundHandle _musicHandle;
 
+	int _musicLastTicks;
+
 	enum {V4A_MAXSFX = 8};
 
 	struct SoundSlot {

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-14 19:06:46 UTC (rev 41525)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.cpp	2009-06-14 19:40:24 UTC (rev 41526)
@@ -31,6 +31,8 @@
 
 #include "sound/mods/tfmx.h"
 
+#include "tfmx/tfmxdebug.h"
+
 namespace Audio {
 
 const uint16 Tfmx::noteIntervalls[64] = {
@@ -57,6 +59,7 @@
 
 void Tfmx::interrupt() {
 	//assert(!_end);
+	++_playerCtx.tickCount;
 	for (int i = 0; i < kNumVoices; ++i) {
 		ChannelContext &channel = _channelCtx[i];
 
@@ -187,7 +190,7 @@
 	else
 		debug("Warning - Macro not completely supported:");
 
-//	displayMacroStep(macroPtr);
+	displayMacroStep(macroPtr);
 }
 
 FORCEINLINE bool Tfmx::macroStep(ChannelContext &channel) {
@@ -496,6 +499,18 @@
 	}
 }
 
+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 @@
 
 		case 14: 	// Stop custompattern
 			// TODO ?
+			warnPatternUnimplemented(patternPtr, 0);
 			// FT
 		case 4: 	// Stop this pattern
 			pattern.command = 0xFF;
@@ -565,10 +581,13 @@
 			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 @@
 			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;
 		}

Modified: scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-06-14 19:06:46 UTC (rev 41525)
+++ scummvm/branches/gsoc2009-mods/sound/mods/tfmx.h	2009-06-14 19:40:24 UTC (rev 41526)
@@ -49,6 +49,7 @@
 	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 @@
 		int8	fadeTime;
 		int8	fadeReset;
 		int8	fadeSlope; */
+
+		int		tickCount;
 	} _playerCtx;
 
 	void initMacroProgramm(ChannelContext &channel) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list