[Scummvm-cvs-logs] SF.net SVN: scummvm: [28844] scummvm/trunk/engines/agi

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Sep 3 11:39:15 CEST 2007


Revision: 28844
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28844&view=rev
Author:   thebluegr
Date:     2007-09-03 02:39:15 -0700 (Mon, 03 Sep 2007)

Log Message:
-----------
Some updates to preagi's sound system and code cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/global.cpp
    scummvm/trunk/engines/agi/preagi.cpp
    scummvm/trunk/engines/agi/preagi_mickey.cpp
    scummvm/trunk/engines/agi/sound.cpp
    scummvm/trunk/engines/agi/sound.h

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/agi.h	2007-09-03 09:39:15 UTC (rev 28844)
@@ -697,6 +697,12 @@
 		int16 p4, int16 p5, int16 p6, int16 p7) = 0;
 	virtual void releaseImageStack() = 0;
 
+	int _soundemu;
+
+	int getflag(int);
+	void setflag(int, int);
+	void flipflag(int);
+
 	const AGIGameDescription *_gameDescription;
 	uint32 getGameID() const;
 	uint32 getFeatures() const;
@@ -773,8 +779,6 @@
 		int16 p4, int16 p5, int16 p6, int16 p7);
 	void releaseImageStack();
 
-	int _soundemu;
-
 	int _keyControl;
 	int _keyAlt;
 
@@ -799,9 +803,6 @@
 	void newInputMode(int);
 	void oldInputMode();
 
-	int getflag(int);
-	void setflag(int, int);
-	void flipflag(int);
 	int getvar(int);
 	void setvar(int, int);
 	void decrypt(uint8 * mem, int len);

Modified: scummvm/trunk/engines/agi/global.cpp
===================================================================
--- scummvm/trunk/engines/agi/global.cpp	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/global.cpp	2007-09-03 09:39:15 UTC (rev 28844)
@@ -29,14 +29,14 @@
 
 namespace Agi {
 
-int AgiEngine::getflag(int n) {
+int AgiBase::getflag(int n) {
 	uint8 *set = (uint8 *)&_game.flags;
 
 	set += n >> 3;
 	return (*set & (1 << (n & 0x07))) != 0;
 }
 
-void AgiEngine::setflag(int n, int v) {
+void AgiBase::setflag(int n, int v) {
 	uint8 *set = (uint8 *)&_game.flags;
 
 	set += n >> 3;
@@ -46,7 +46,7 @@
 		*set &= ~(1 << (n & 0x07));	/* clear bit */
 }
 
-void AgiEngine::flipflag(int n) {
+void AgiBase::flipflag(int n) {
 	uint8 *set = (uint8 *)&_game.flags;
 
 	set += n >> 3;

Modified: scummvm/trunk/engines/agi/preagi.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi.cpp	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/preagi.cpp	2007-09-03 09:39:15 UTC (rev 28844)
@@ -61,14 +61,14 @@
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
 
-/*
+	/*
 	const GameSettings *g;
 
 	const char *gameid = ConfMan.get("gameid").c_str();
 	for (g = agiSettings; g->gameid; ++g)
 		if (!scumm_stricmp(g->gameid, gameid))
 			_gameId = g->id;
-*/
+	*/
 
 	_rnd = new Common::RandomSource();
 
@@ -107,8 +107,6 @@
 	_imageStack = NULL;
 	_imageStackPointer = 0;
 
-	_menu = NULL;
-
 	_lastSentence[0] = 0;
 	memset(&_stringdata, 0, sizeof(struct StringData));
 
@@ -116,10 +114,6 @@
 
 	_oldMode = -1;
 	
-	_predictiveDialogRunning = false;
-	_predictiveDictText = NULL;
-	_predictiveDictLine = NULL;
-	_predictiveDictLineCount = 0;
 	_firstSlot = 0;
 */
 }
@@ -129,23 +123,14 @@
 	//       drivers, and I'm not sure what they are. For now, they might
 	//       as well be called "PC Speaker" and "Not PC Speaker".
 
-	// If used platform is Apple IIGS then we must use Apple IIGS sound emulation
-	// because Apple IIGS AGI games use only Apple IIGS specific sound resources.
-	/*
-	if (ConfMan.hasKey("platform") &&
-		Common::parsePlatform(ConfMan.get("platform")) == Common::kPlatformApple2GS) {
-		_soundemu = SOUND_EMU_APPLE2GS;
-	} else {
-		switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) {
-		case MD_PCSPK:
-			_soundemu = SOUND_EMU_PC;
-			break;
-		default:
-			_soundemu = SOUND_EMU_NONE;
-			break;
-		}
+	switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) {
+	case MD_PCSPK:
+		_soundemu = SOUND_EMU_PC;
+		break;
+	default:
+		_soundemu = SOUND_EMU_NONE;
+		break;
 	}
-	*/
 
 	if (ConfMan.hasKey("render_mode")) {
 		_renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
@@ -163,9 +148,8 @@
 		}
 	}
 
-	//_console = new Console(this);
 	_gfx = new GfxMgr(this);
-	//_sound = new SoundMgr(this, _mixer);
+	_sound = new SoundMgr(this, _mixer);
 	_picture = new PictureMgr(this, _gfx);
 	//_sprites = new SpritesMgr(this, _gfx);
 
@@ -185,7 +169,7 @@
 	_game.lineMinPrint = 0; // hardcoded
 
 	_gfx->initVideo();
-	//_sound->initSound();
+	_sound->initSound();
 
 	//_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL);
 
@@ -204,12 +188,10 @@
 
 	/* clear all resources and events */
 	for (int i = 0; i < MAX_DIRS; i++) {
-		//memset(&_game.views[i], 0, sizeof(struct AgiView));
 		memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
-		//memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
-		//memset(&_game.dirView[i], 0, sizeof(struct AgiDir));
+		memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
 		memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
-		//memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
+		memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
 	}
 
 	// load resources
@@ -244,6 +226,8 @@
 }
 
 int PreAgiEngine::go() {
+	setflag(fSoundOn, true);	// enable sound
+
 	// run preagi engine main loop
 	switch (getGameID()) {
 		case GID_MICKEY:

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-03 09:39:15 UTC (rev 28844)
@@ -362,10 +362,7 @@
 				case Common::KEYCODE_ESCAPE:
 					*sel0 = 0; *sel1 = -1; return false;
 				case Common::KEYCODE_s:
-#if 0
-					// TODO
-					flipSound();
-#endif
+					_vm->flipflag(fSoundOn);
 					break;
 				case Common::KEYCODE_c:
 					inventory();
@@ -526,11 +523,8 @@
 #endif
 
 void Mickey::playSound(ENUM_MSA_SOUND iSound) {
-#if 0
-	// TODO
-	if (!getSound())
+	if (!_vm->getflag(fSoundOn))
 		return;
-#endif
 
 	Common::Event event;
 	MSA_SND_NOTE note;

Modified: scummvm/trunk/engines/agi/sound.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound.cpp	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/sound.cpp	2007-09-03 09:39:15 UTC (rev 28844)
@@ -1085,7 +1085,7 @@
 	n -= s;
 }
 
-SoundMgr::SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer) {
+SoundMgr::SoundMgr(AgiBase *agi, Audio::Mixer *pMixer) {
 	_vm = agi;
 	_mixer = pMixer;
 	_sampleRate = pMixer->getOutputRate();

Modified: scummvm/trunk/engines/agi/sound.h
===================================================================
--- scummvm/trunk/engines/agi/sound.h	2007-09-03 01:55:56 UTC (rev 28843)
+++ scummvm/trunk/engines/agi/sound.h	2007-09-03 09:39:15 UTC (rev 28844)
@@ -336,12 +336,13 @@
 };
 
 class AgiEngine;
+class AgiBase;
 
 class SoundMgr : public Audio::AudioStream {
-	AgiEngine *_vm;
+	AgiBase *_vm;
 
 public:
-	SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer);
+	SoundMgr(AgiBase *agi, Audio::Mixer *pMixer);
 	~SoundMgr();
 	virtual void setVolume(uint8 volume);
 


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