aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorEugene Sandulenko2007-02-13 15:27:36 +0000
committerEugene Sandulenko2007-02-13 15:27:36 +0000
commit80eb248a0eb22f6ba8e052047e8af3c3bf948087 (patch)
treecb2c86c17aaf931fd9a6e8f17f4ef033e3ad59e9 /engines/agi
parent433e7d69ac155c03ded74de11b4f1db4dbfc2a2f (diff)
downloadscummvm-rg350-80eb248a0eb22f6ba8e052047e8af3c3bf948087.tar.gz
scummvm-rg350-80eb248a0eb22f6ba8e052047e8af3c3bf948087.tar.bz2
scummvm-rg350-80eb248a0eb22f6ba8e052047e8af3c3bf948087.zip
Get rid of _opt. Cleanup.
svn-id: r25549
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/agi.cpp26
-rw-r--r--engines/agi/agi.h33
-rw-r--r--engines/agi/agi_v3.cpp2
-rw-r--r--engines/agi/cycle.cpp4
-rw-r--r--engines/agi/detection.cpp14
-rw-r--r--engines/agi/global.cpp2
-rw-r--r--engines/agi/graphics.cpp4
-rw-r--r--engines/agi/id.cpp11
-rw-r--r--engines/agi/keyboard.cpp2
-rw-r--r--engines/agi/op_cmd.cpp4
-rw-r--r--engines/agi/sound.cpp20
11 files changed, 43 insertions, 79 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 5dbddec800..8a629ad87d 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -375,8 +375,11 @@ int AgiEngine::agiInit() {
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 @@ int AgiEngine::agiDetectGame() {
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 @@ AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) {
}
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;
}
}
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index e3f71e86a2..0506ceb802 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -104,9 +104,13 @@ enum AgiGameType {
};
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 @@ struct Mouse {
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 @@ public:
void releaseImageStack();
AgiDebug _debug;
- AgiOptions _opt;
+ Common::RenderMode _renderMode;
+ int _soundemu;
int _keyControl;
int _keyAlt;
diff --git a/engines/agi/agi_v3.cpp b/engines/agi/agi_v3.cpp
index 68a27af43c..4729058484 100644
--- a/engines/agi/agi_v3.cpp
+++ b/engines/agi/agi_v3.cpp
@@ -125,7 +125,7 @@ int AgiLoader_v3::init() {
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 {
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 2309f26e2b..c695ae82ba 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -201,7 +201,7 @@ int AgiEngine::mainCycle() {
/* 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 @@ int AgiEngine::playGame() {
_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");
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 15a283db50..485dce44ae 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -99,11 +99,11 @@ namespace Agi {
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 @@ static const AGIGameDescription gameDescriptions[] = {
Common::ADGF_NO_FLAGS
},
GType_V3,
- AGI_MACGOLDRUSH,
+ GF_MACGOLDRUSH,
0x3149,
},
@@ -1523,8 +1523,8 @@ static const AGIGameDescription gameDescriptions[] = {
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 @@ static const AGIGameDescription gameDescriptions[] = {
Common::ADGF_NO_FLAGS
},
GType_V2,
- AGI_AGDS,
+ GF_AGDS,
0x2440,
},
diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp
index 8c9d33e79c..502f58466b 100644
--- a/engines/agi/global.cpp
+++ b/engines/agi/global.cpp
@@ -64,7 +64,7 @@ void AgiEngine::decrypt(uint8 *mem, int len) {
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++)
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 9ca53b3a74..ca2c13c2bf 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -407,7 +407,7 @@ static const byte mouseCursorArrow[] = {
* @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 @@ int GfxMgr::deinitMachine() {
* @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)
diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp
index 2bcaf4e2d5..1dc1a6a004 100644
--- a/engines/agi/id.cpp
+++ b/engines/agi/id.cpp
@@ -70,15 +70,9 @@ int AgiEngine::setupV2Game(int ver, uint32 crc) {
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 @@ int AgiEngine::setupV3Game(int ver, uint32 crc) {
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.
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index becb6faf56..e4a025f2b9 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -166,7 +166,7 @@ int AgiEngine::handleController(int key) {
return true;
}
- if (!_opt.agimouse) {
+ if (!(getFeatures() & GF_AGIMOUSE)) {
/* Handle mouse button events */
if (key == BUTTON_LEFT) {
v->flags |= ADJ_EGO_XY;
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 3b1800abee..3a29983f2e 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1195,7 +1195,7 @@ cmd(print_at_v) {
}
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 @@ cmd(shake_screen) {
/* 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
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 4d334dfd07..f4a2ee790e 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -273,14 +273,6 @@ void SoundMgr::startSound(int resnum, int flag) {
/* 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 @@ int SoundMgr::initSound() {
env = false;
- switch (_vm->_opt.soundemu) {
+ switch (_vm->_soundemu) {
case SOUND_EMU_NONE:
waveform = waveformRamp;
env = true;
@@ -349,7 +341,7 @@ void SoundMgr::stopNote(int i) {
#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::stopNote(int i) {
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 @@ void SoundMgr::playNote(int i, int freq, int vol) {
#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::playSampleSound() {
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 @@ void SoundMgr::playAgiSound() {
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;
}