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

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Feb 13 16:27:36 CET 2007


Revision: 25549
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25549&view=rev
Author:   sev
Date:     2007-02-13 07:27:36 -0800 (Tue, 13 Feb 2007)

Log Message:
-----------
Get rid of _opt. Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/agi_v3.cpp
    scummvm/trunk/engines/agi/cycle.cpp
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/agi/global.cpp
    scummvm/trunk/engines/agi/graphics.cpp
    scummvm/trunk/engines/agi/id.cpp
    scummvm/trunk/engines/agi/keyboard.cpp
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/sound.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/agi.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -375,9 +375,12 @@
 		break;
 	}
 
-	_game.gameFlags |= _opt.amigaMode ? ID_AMIGA : 0;
-	_game.gameFlags |= _opt.agdsMode ? ID_AGDS : 0;
+	if (getPlatform() == Common::kPlatformAmiga)
+		_game.gameFlags |= ID_AMIGA;
 
+	if (getFeatures() & GF_AGDS)
+		_game.gameFlags |= ID_AGDS;
+
 	if (_game.gameFlags & ID_AMIGA)
 		report("Amiga padded game detected.\n");
 
@@ -441,11 +444,6 @@
 
 	assert(_gameDescription != NULL);
 
-	_opt.amigaMode = (getPlatform() == Common::kPlatformAmiga);
-	_opt.agdsMode = ((getFeatures() & AGI_AGDS) == AGI_AGDS);
-	_opt.agimouse = ((getFeatures() & AGI_MOUSE) == AGI_MOUSE);
-
-
 	if(getVersion() <= 0x2999) {
 		_loader = new AgiLoader_v2(this);
 	} else {
@@ -564,33 +562,31 @@
 }
 
 void AgiEngine::initialize() {
-	memset(&_opt, 0, sizeof(struct AgiOptions));
-	_opt.gamerun = GAMERUN_RUNGAME;
-
 	// TODO: Some sound emulation modes do not fit our current music
 	//       drivers, and I'm not sure what they are. For now, they might
 	//       as well be called "PC Speaker" and "Not PC Speaker".
 
 	switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) {
 	case MD_PCSPK:
-		_opt.soundemu = SOUND_EMU_PC;
+		_soundemu = SOUND_EMU_PC;
 		break;
 	default:
-		_opt.soundemu = SOUND_EMU_NONE;
+		_soundemu = SOUND_EMU_NONE;
 		break;
 	}
 
 	if (ConfMan.hasKey("render_mode")) {
-		_opt.renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
+		_renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
 	} else if (ConfMan.hasKey("platform")) {
 		switch (Common::parsePlatform(ConfMan.get("platform"))) {
 		case Common::kPlatformAmiga:
-			_opt.renderMode = Common::kRenderAmiga;
+			_renderMode = Common::kRenderAmiga;
 			break;
 		case Common::kPlatformPC:
-			_opt.renderMode = Common::kRenderEGA;
+			_renderMode = Common::kRenderEGA;
 			break;
 		default:
+			_renderMode = Common::kRenderEGA;
 			break;
 		}
 	}

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/agi.h	2007-02-13 15:27:36 UTC (rev 25549)
@@ -104,9 +104,13 @@
 };
 
 enum AgiGameFeatures {
-	AGI_MOUSE = 1 << 0,
-	AGI_AGDS = 1 << 1,
-	AGI_MACGOLDRUSH = 1 << 2
+	GF_AGIMOUSE =    (1 << 0),
+	GF_AGDS =        (1 << 1),
+	GF_AGI256 =      (1 << 2),
+	GF_AGI256_2 =    (1 << 3),
+	GF_AGIPAL =      (1 << 4),
+	GF_MACGOLDRUSH = (1 << 5),
+	GF_FANMADE =     (1 << 6)
 };
 
 struct AGIGameDescription;
@@ -180,26 +184,6 @@
 	unsigned int y;
 };
 
-/**
- * Command-line options.
- */
-struct AgiOptions {
-#define GAMERUN_RUNGAME 0
-#define GAMERUN_PICVIEW 1
-#define GAMERUN_WORDS	2
-#define GAMERUN_OBJECTS	3
-#define GAMERUN_GAMES	4
-#define GAMERUN_CRC	5
-	int gamerun;		/**< game run mode*/
-	int emuversion;		/**< AGI version to emulate */
-	bool agdsMode;		/**< enable AGDS mode */
-	bool amigaMode;		/**< enable Amiga mode */
-	bool nosound;		/**< disable sound */
-	Common::RenderMode renderMode;
-	int soundemu;		/**< sound emulation mode */
-	bool agimouse;		/**< AGI Mouse 1.0 emulation */
-};
-
 #define report printf
 
 enum GameId {
@@ -588,7 +572,8 @@
 	void releaseImageStack();
 
 	AgiDebug _debug;
-	AgiOptions _opt;
+	Common::RenderMode _renderMode;
+	int _soundemu;
 
 	int _keyControl;
 	int _keyAlt;

Modified: scummvm/trunk/engines/agi/agi_v3.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi_v3.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/agi_v3.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -125,7 +125,7 @@
 	if (_vm->getPlatform() == Common::kPlatformAmiga) {
 		path = Common::String("dirs");
 		_vm->_game.name[0] = 0; // Empty prefix
-	} else if (_vm->getFeatures() & AGI_MACGOLDRUSH) {
+	} else if (_vm->getFeatures() & GF_MACGOLDRUSH) {
 		path = "grdir";
 		_vm->_game.name[0] = 0; // Empty prefix
 	} else {

Modified: scummvm/trunk/engines/agi/cycle.cpp
===================================================================
--- scummvm/trunk/engines/agi/cycle.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/cycle.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -201,7 +201,7 @@
 	/* In AGI Mouse emulation mode we must update the mouse-related
 	 * vars in every interpreter cycle.
 	 */
-	if (_opt.agimouse) {
+	if (getFeatures() & GF_AGIMOUSE) {
 		_game.vars[28] = g_mouse.x / 2;
 		_game.vars[29] = g_mouse.y;
 	}
@@ -302,7 +302,7 @@
 	_game.clockEnabled = true;
 	_game.lineUserInput = 22;
 
-	if (_opt.agimouse)
+	if (getFeatures() & GF_AGIMOUSE)
 		report("Using AGI Mouse 1.0 protocol\n");
 
 	report("Running AGI script.\n");

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/detection.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -99,11 +99,11 @@
 		features, \
 		ver, \
 	}
-#define FANMADE_LV(name,md5,lang,ver) FANMADE_ILFV("agi-fanmade",name,md5,lang,0,ver)
+#define FANMADE_LV(name,md5,lang,ver) FANMADE_ILFV("agi-fanmade",name,md5,lang,GF_FANMADE,ver)
 #define FANMADE_V(name,md5,ver) FANMADE_LV(name,md5,Common::EN_ANY,ver)
-#define FANMADE_F(name,md5,features) FANMADE_ILFV("agi-danmade",name,md5,Common::EN_ANY,features,0x2917)
+#define FANMADE_F(name,md5,features) FANMADE_ILFV("agi-fanmade",name,md5,Common::EN_ANY,(GF_FANMADE|features),0x2917)
 #define FANMADE_L(name,md5,lang) FANMADE_LV(name,md5,lang,0x2917)
-#define FANMADE_I(id,name,md5) FANMADE_ILFV(id,name,md5,Common::EN_ANY,0,0x2917)
+#define FANMADE_I(id,name,md5) FANMADE_ILFV(id,name,md5,Common::EN_ANY,GF_FANMADE,0x2917)
 #define FANMADE(name,md5) FANMADE_LV(name,md5,Common::EN_ANY,0x2917)
 
 static const AGIGameDescription gameDescriptions[] = {
@@ -412,7 +412,7 @@
 			Common::ADGF_NO_FLAGS
 		},
 		GType_V3,
-		AGI_MACGOLDRUSH,
+		GF_MACGOLDRUSH,
 		0x3149,
 	},
 
@@ -1523,8 +1523,8 @@
 	FANMADE("Al Pond 1 - Al Lives Forever (v1.0)", "e8921c3043b749b056ff51f56d1b451b"),
 	FANMADE("Al Pond 1 - Al Lives Forever (v1.3)", "fb4699474054962e0dbfb4cf12ca52f6"),
 	FANMADE("Apocalyptic Quest (v0.03 Teaser)", "42ced528b67965d3bc3b52c635f94a57"),
-	FANMADE_F("Apocalyptic Quest (v4.00 Alpha 1)", "e15581628d84949b8d352d224ec3184b", AGI_MOUSE),
-	FANMADE_F("Apocalyptic Quest (v4.00 Alpha 2)", "0eee850005860e46345b38fea093d194", AGI_MOUSE),
+	FANMADE_F("Apocalyptic Quest (v4.00 Alpha 1)", "e15581628d84949b8d352d224ec3184b", GF_AGIMOUSE),
+	FANMADE_F("Apocalyptic Quest (v4.00 Alpha 2)", "0eee850005860e46345b38fea093d194", GF_AGIMOUSE),
 	FANMADE("Band Quest (Demo)", "7326abefd793571cc17ed0db647bdf34"),
 	FANMADE("Band Quest (Early Demo)", "de4758dd34676b248c8301b32d93bc6f"),
 	FANMADE("Beyond the Titanic 2", "9b8de38dc64ffb3f52b7877ea3ebcef9"),
@@ -1582,7 +1582,7 @@
 			Common::ADGF_NO_FLAGS
 		},
 		GType_V2,
-		AGI_AGDS,
+		GF_AGDS,
 		0x2440,
 	},
 

Modified: scummvm/trunk/engines/agi/global.cpp
===================================================================
--- scummvm/trunk/engines/agi/global.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/global.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -64,7 +64,7 @@
 	const uint8 *key;
 	int i;
 
-	key = _opt.agdsMode ? (const uint8 *)CRYPT_KEY_AGDS
+	key = (getFeatures() & GF_AGDS) ? (const uint8 *)CRYPT_KEY_AGDS
 	                   : (const uint8 *)CRYPT_KEY_SIERRA;
 
 	for (i = 0; i < len; i++)

Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/graphics.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -407,7 +407,7 @@
  * @see deinit_video()
  */
 int GfxMgr::initVideo() {
-	if (_vm->_opt.renderMode == Common::kRenderEGA)
+	if (_vm->_renderMode == Common::kRenderEGA)
 		initPalette(egaPalette);
 	else
 		initPalette(newPalette);
@@ -481,7 +481,7 @@
  * @param p pointer to the row start in the AGI screen
  */
 void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
-	if (_vm->_opt.renderMode == Common::kRenderCGA) {
+	if (_vm->_renderMode == Common::kRenderCGA) {
 		for (x *= 2; n--; p++, x += 2) {
 			register uint16 q = (cgaMap[(*p & 0xf0) >> 4] << 4) | cgaMap[*p & 0x0f];
 			if (_vm->_debug.priority)

Modified: scummvm/trunk/engines/agi/id.cpp
===================================================================
--- scummvm/trunk/engines/agi/id.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/id.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -70,15 +70,9 @@
 		agiSetRelease(ver = 0x2917);
 	}
 
-	/* setup the differences in the opcodes and other bits in the
-	 * AGI v2 specs
-	 */
-	if (_opt.emuversion)
-		agiSetRelease(ver = _opt.emuversion);
-
 	// Should this go above the previous lines, so we can force emulation versions
 	// even for AGDS games? -- dsymonds
-	if (_opt.agdsMode)
+	if (getFeatures() & GF_AGDS)
 		agiSetRelease(ver = 0x2440);	/* ALL AGDS games built for 2.440 */
 
 	report("Seting up for version 0x%04X\n", ver);
@@ -109,9 +103,6 @@
 		agiSetRelease(ver = 0x3149);
 	}
 
-	if (_opt.emuversion)
-		agiSetRelease(ver = _opt.emuversion);
-
 	report("Seting up for version 0x%04X\n", ver);
 
 	// 'unknown176' takes 1 arg for 3.002.086, not 0 args.

Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/keyboard.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -166,7 +166,7 @@
 			return true;
 		}
 
-		if (!_opt.agimouse) {
+		if (!(getFeatures() & GF_AGIMOUSE)) {
 			/* Handle mouse button events */
 			if (key == BUTTON_LEFT) {
 				v->flags |= ADJ_EGO_XY;

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -1195,7 +1195,7 @@
 }
 
 cmd(push_script) {
-	if (g_agi->_opt.agimouse) {
+	if (g_agi->getFeatures() & GF_AGIMOUSE) {
 		game.vars[27] = g_mouse.button;
 		game.vars[28] = g_mouse.x / 2;
 		game.vars[29] = g_mouse.y;
@@ -1230,7 +1230,7 @@
 	/* AGI Mouse 1.1 uses shake.screen values between 100 and 109 to
 	 * set the palette.
 	 */
-	if (g_agi->_opt.agimouse && p0 >= 100 && p0 < 110) {
+	if ((g_agi->getFeatures() & GF_AGIMOUSE) && p0 >= 100 && p0 < 110) {
 		report("not implemented: AGI Mouse palettes\n");
 		return;
 	} else

Modified: scummvm/trunk/engines/agi/sound.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound.cpp	2007-02-13 15:03:43 UTC (rev 25548)
+++ scummvm/trunk/engines/agi/sound.cpp	2007-02-13 15:27:36 UTC (rev 25549)
@@ -273,14 +273,6 @@
 	/* Nat Budin reports that the flag should be reset when sound starts
 	 */
 	_vm->setflag(endflag, false);
-
-	/* FIXME: should wait for sound time instead of setting the flag
-	 *        immediately
-	 */
-	if (_vm->_opt.nosound) {
-		_vm->setflag(endflag, true);
-		stopSound();
-	}
 }
 
 void SoundMgr::stopSound() {
@@ -305,7 +297,7 @@
 
 	env = false;
 
-	switch (_vm->_opt.soundemu) {
+	switch (_vm->_soundemu) {
 	case SOUND_EMU_NONE:
 		waveform = waveformRamp;
 		env = true;
@@ -349,7 +341,7 @@
 #ifdef USE_CHORUS
 	/* Stop chorus ;) */
 	if (chn[i].type == AGI_SOUND_4CHN &&
-		_vm->_opt.soundemu == SOUND_EMU_NONE && i < 3) {
+		_vm->_soundemu == SOUND_EMU_NONE && i < 3) {
 		stopNote(i + 4);
 	}
 #endif
@@ -358,7 +350,7 @@
 void SoundMgr::playNote(int i, int freq, int vol) {
 	if (!_vm->getflag(fSoundOn))
 		vol = 0;
-	else if (vol && _vm->_opt.soundemu == SOUND_EMU_PC)
+	else if (vol && _vm->_soundemu == SOUND_EMU_PC)
 		vol = 160;
 
 	chn[i].phase = 0;
@@ -370,7 +362,7 @@
 #ifdef USE_CHORUS
 	/* Add chorus ;) */
 	if (chn[i].type == AGI_SOUND_4CHN &&
-		_vm->_opt.soundemu == SOUND_EMU_NONE && i < 3) {
+		_vm->_soundemu == SOUND_EMU_NONE && i < 3) {
 		int newfreq = freq * 1007 / 1000;
 		if (freq == newfreq)
 			newfreq++;
@@ -452,7 +444,7 @@
 void SoundMgr::playAgiSound() {
 	int i, freq;
 
-	for (playing = i = 0; i < (_vm->_opt.soundemu == SOUND_EMU_PC ? 1 : 4); i++) {
+	for (playing = i = 0; i < (_vm->_soundemu == SOUND_EMU_PC ? 1 : 4); i++) {
 		playing |= !chn[i].end;
 
 		if (chn[i].end)
@@ -475,7 +467,7 @@
 				chn[i].env = 0;
 #ifdef USE_CHORUS
 				/* chorus */
-				if (chn[i].type == AGI_SOUND_4CHN && _vm->_opt.soundemu == SOUND_EMU_NONE && i < 3) {
+				if (chn[i].type == AGI_SOUND_4CHN && _vm->_soundemu == SOUND_EMU_NONE && i < 3) {
 					chn[i + 4].vol = 0;
 					chn[i + 4].env = 0;
 				}


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