[Scummvm-cvs-logs] SF.net SVN: scummvm:[48046] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Feb 13 18:42:50 CET 2010
Revision: 48046
http://scummvm.svn.sourceforge.net/scummvm/?rev=48046&view=rev
Author: fingolfin
Date: 2010-02-13 17:42:49 +0000 (Sat, 13 Feb 2010)
Log Message:
-----------
SCI: Add global g_sci pointer to the active SciEngine instance
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/kevent.cpp
scummvm/trunk/engines/sci/engine/kfile.cpp
scummvm/trunk/engines/sci/engine/kmisc.cpp
scummvm/trunk/engines/sci/engine/message.cpp
scummvm/trunk/engines/sci/engine/selector.cpp
scummvm/trunk/engines/sci/engine/selector.h
scummvm/trunk/engines/sci/engine/vm.cpp
scummvm/trunk/engines/sci/event.cpp
scummvm/trunk/engines/sci/graphics/frameout.cpp
scummvm/trunk/engines/sci/graphics/menu.cpp
scummvm/trunk/engines/sci/graphics/palette.cpp
scummvm/trunk/engines/sci/parser/grammar.cpp
scummvm/trunk/engines/sci/parser/vocabulary.cpp
scummvm/trunk/engines/sci/sci.cpp
scummvm/trunk/engines/sci/sci.h
scummvm/trunk/engines/sci/sound/drivers/mididriver.h
scummvm/trunk/engines/sci/sound/iterator/core.cpp
scummvm/trunk/engines/sci/sound/iterator/iterator.cpp
scummvm/trunk/engines/sci/sound/music.cpp
scummvm/trunk/engines/sci/sound/soundcmd.cpp
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/console.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -1635,7 +1635,7 @@
void _print_address(void * _, reg_t addr) {
if (addr.segment)
- ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(addr));
+ g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(addr));
}
bool Console::cmdGCShowReachable(int argc, const char **argv) {
Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -93,7 +93,7 @@
// track left buttton clicks, if requested
if (curEvent.type == SCI_EVENT_MOUSE_PRESS && curEvent.data == 1 && g_debug_track_mouse_clicks) {
- ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n",
+ g_sci->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n",
mousePos.x, mousePos.y);
}
@@ -125,7 +125,7 @@
g_debugState.stopOnEvent = false;
// A SCI event occured, and we have been asked to stop, so open the debug console
- Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
con->DebugPrintf("SCI event occured: ");
switch (curEvent.type) {
case SCI_EVENT_QUIT:
Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -105,7 +105,7 @@
filename += 2;
Common::String englishName = s->getLanguageString(filename, K_LANG_ENGLISH);
- const Common::String wrappedName = ((Sci::SciEngine*)g_engine)->wrapFilename(englishName);
+ const Common::String wrappedName = g_sci->wrapFilename(englishName);
Common::SeekableReadStream *inFile = 0;
Common::WriteStream *outFile = 0;
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
@@ -257,7 +257,7 @@
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
// Load all saves
- Common::StringList saveNames = saveFileMan->listSavefiles(((SciEngine *)g_engine)->getSavegamePattern());
+ Common::StringList saveNames = saveFileMan->listSavefiles(g_sci->getSavegamePattern());
for (Common::StringList::const_iterator iter = saveNames.begin(); iter != saveNames.end(); ++iter) {
Common::String filename = *iter;
@@ -294,7 +294,7 @@
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
for (uint i = 0; i < saves.size(); i++) {
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(saves[i].id);
+ Common::String filename = g_sci->getSavegameName(saves[i].id);
Common::SeekableReadStream *in;
if ((in = saveFileMan->openForLoading(filename))) {
SavegameMetadata meta;
@@ -405,7 +405,7 @@
Common::Array<SavegameDesc> saves;
listSavegames(saves);
int savedir_nr = saves[savegame_id].id;
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
+ Common::String filename = g_sci->getSavegameName(savedir_nr);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
saveFileMan->removeSavefile(filename);
}
@@ -462,7 +462,7 @@
}
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
+ Common::String filename = g_sci->getSavegameName(savedir_nr);
Common::SeekableReadStream *in;
if ((in = saveFileMan->openForLoading(filename))) {
// found a savegame file
@@ -496,7 +496,7 @@
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
for (uint i = 0; i < saves.size(); i++) {
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(saves[i].id);
+ Common::String filename = g_sci->getSavegameName(saves[i].id);
Common::SeekableReadStream *in;
if ((in = saveFileMan->openForLoading(filename))) {
// found a savegame file
@@ -575,7 +575,7 @@
return NULL_REG;
}
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_id);
+ Common::String filename = g_sci->getSavegameName(savedir_id);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
Common::OutSaveFile *out;
if (!(out = saveFileMan->openForSaving(filename))) {
@@ -619,7 +619,7 @@
if (savedir_nr > -1) {
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
- Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
+ Common::String filename = g_sci->getSavegameName(savedir_nr);
Common::SeekableReadStream *in;
if ((in = saveFileMan->openForLoading(filename))) {
// found a savegame file
@@ -677,7 +677,7 @@
_outbuffer = buffer;
// Prefix the mask
- const Common::String wrappedMask = ((Sci::SciEngine*)g_engine)->wrapFilename(mask);
+ const Common::String wrappedMask = g_sci->wrapFilename(mask);
// Obtain a list of all savefiles matching the given mask
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
@@ -696,7 +696,7 @@
const Common::String wrappedString = *_iter;
// Strip the prefix
- Common::String string = ((Sci::SciEngine*)g_engine)->unwrapFilename(wrappedString);
+ Common::String string = g_sci->unwrapFilename(wrappedString);
if (string.size() > 12)
string = Common::String(string.c_str(), 12);
segMan->strcpy(_outbuffer, string.c_str());
@@ -795,10 +795,10 @@
Common::Array<SavegameDesc> saves;
listSavegames(saves);
int savedir_nr = saves[slotNum].id;
- name = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
+ name = g_sci->getSavegameName(savedir_nr);
saveFileMan->removeSavefile(name);
} else {
- const Common::String wrappedName = ((Sci::SciEngine*)g_engine)->wrapFilename(name);
+ const Common::String wrappedName = g_sci->wrapFilename(name);
saveFileMan->removeSavefile(wrappedName);
}
@@ -878,7 +878,7 @@
// Check for regular file
bool exists = Common::File::exists(name);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
- const Common::String wrappedName = ((Sci::SciEngine*)g_engine)->wrapFilename(name);
+ const Common::String wrappedName = g_sci->wrapFilename(name);
if (!exists)
exists = !saveFileMan->listSavefiles(name).empty();
Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -306,7 +306,7 @@
};
reg_t kPlatform(EngineState *s, int argc, reg_t *argv) {
- bool isWindows = ((SciEngine*)g_engine)->getPlatform() == Common::kPlatformWindows;
+ bool isWindows = g_sci->getPlatform() == Common::kPlatformWindows;
if (argc == 0 && getSciVersion() < SCI_VERSION_2) {
// This is called in KQ5CD with no parameters, where it seems to do some graphics
Modified: scummvm/trunk/engines/sci/engine/message.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/message.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/message.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -135,7 +135,7 @@
};
bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &record) {
- Resource *res = ((SciEngine *)g_engine)->getResourceManager()->findResource(ResourceId(kResourceTypeMessage, stack.getModule()), 0);
+ Resource *res = g_sci->getResourceManager()->findResource(ResourceId(kResourceTypeMessage, stack.getModule()), 0);
if (!res) {
warning("Failed to open message resource %d", stack.getModule());
Modified: scummvm/trunk/engines/sci/engine/selector.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/selector.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -187,7 +187,7 @@
void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_t value) {
ObjVarRef address;
- if ((selector_id < 0) || (selector_id > (int)((SciEngine*)g_engine)->getKernel()->getSelectorNamesSize())) {
+ if ((selector_id < 0) || (selector_id > (int)g_sci->getKernel()->getSelectorNamesSize())) {
warning("Attempt to write to invalid selector %d of"
" object at %04x:%04x.", selector_id, PRINT_REG(object));
return;
@@ -195,7 +195,7 @@
if (lookup_selector(segMan, object, selector_id, &address, NULL) != kSelectorVariable)
warning("Selector '%s' of object at %04x:%04x could not be"
- " written to", ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector_id).c_str(), PRINT_REG(object));
+ " written to", g_sci->getKernel()->getSelectorName(selector_id).c_str(), PRINT_REG(object));
else
*address.getPointer(segMan) = value;
}
Modified: scummvm/trunk/engines/sci/engine/selector.h
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.h 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/selector.h 2010-02-13 17:42:49 UTC (rev 48046)
@@ -46,7 +46,7 @@
/**
* Map a selector name to a selector id. Shortcut for accessing the selector cache.
*/
-#define SELECTOR(_slc_) (((SciEngine *)g_engine)->getKernel()->_selectorCache._slc_)
+#define SELECTOR(_slc_) (g_sci->getKernel()->_selectorCache._slc_)
//#define SELECTOR(_slc_) _slc_
/**
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -285,7 +285,7 @@
Common::List<Breakpoint>::const_iterator bp;
for (bp = s->_breakpoints.begin(); bp != s->_breakpoints.end(); ++bp) {
if (bp->type == BREAK_EXPORT && bp->address == bpaddress) {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
con->DebugPrintf("Break on script %d, export %d\n", script, pubfunct);
g_debugState.debugging = true;
breakpointWasHit = true;
@@ -368,7 +368,7 @@
cmplen = 256;
if (bp->type == BREAK_SELECTOR && !strncmp(bp->name.c_str(), method_name, cmplen)) {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
con->DebugPrintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj));
print_send_action = 1;
breakpointWasHit = true;
@@ -379,7 +379,7 @@
}
#ifdef VM_DEBUG_SEND
- printf("Send to %04x:%04x, selector %04x (%s):", PRINT_REG(send_obj), selector, ((SciEngine *)g_engine)->getKernel()->getSelectorName(selector).c_str());
+ printf("Send to %04x:%04x, selector %04x (%s):", PRINT_REG(send_obj), selector, g_sci->getKernel()->getSelectorName(selector).c_str());
#endif // VM_DEBUG_SEND
ObjVarRef varp;
@@ -816,7 +816,7 @@
script_debug(s, breakpointWasHit);
breakpointWasHit = false;
}
- Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
if (con->isAttached()) {
con->onFrame();
}
@@ -1681,7 +1681,7 @@
int game_is_finished = 0;
if (Common::isDebugChannelEnabled(kDebugLevelOnStartup))
- ((Sci::SciEngine*)g_engine)->getSciDebugger()->attach();
+ g_sci->getSciDebugger()->attach();
do {
s->_executionStackPosChanged = false;
@@ -1738,7 +1738,7 @@
// Now: Register the first element on the execution stack-
if (!send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base)) {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
con->printObject(s->_gameObj);
warning("Failed to run the game! Aborting...");
return 1;
Modified: scummvm/trunk/engines/sci/event.cpp
===================================================================
--- scummvm/trunk/engines/sci/event.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/event.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -175,7 +175,7 @@
// Debug console
if (ev.kbd.flags == Common::KBD_CTRL && ev.kbd.keycode == Common::KEYCODE_d) {
// Open debug console
- Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
con->attach();
// Clear keyboard event
Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -239,7 +239,7 @@
// TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap)
// This doesn't work for SCI2.1 games...
if (getSciVersion() == SCI_VERSION_2) {
- Kernel *kernel = ((SciEngine *)g_engine)->getKernel();
+ Kernel *kernel = g_sci->getKernel();
if (lookup_selector(_segMan, itemEntry->object, kernel->_selectorCache.text, NULL, NULL) == kSelectorVariable) {
Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, SELECTOR(text)));
int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(font));
Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -190,7 +190,7 @@
if (separatorCount == tempPos - beginPos) {
itemEntry->separatorLine = true;
} else {
- EngineState *s = ((SciEngine *)g_engine)->getEngineState(); // HACK: needed for strSplit()
+ EngineState *s = g_sci->getEngineState(); // HACK: needed for strSplit()
itemEntry->text = s->strSplit(Common::String(content.c_str() + beginPos, tempPos - beginPos).c_str());
// LSL6 uses "Ctrl-" prefix string instead of ^ like all the other games do
@@ -250,7 +250,7 @@
}
void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value) {
- EngineState *s = ((SciEngine *)g_engine)->getEngineState(); // HACK: needed for strSplit()
+ EngineState *s = g_sci->getEngineState(); // HACK: needed for strSplit()
GuiMenuItemEntry *itemEntry = findItem(menuId, itemId);
if (!itemEntry)
error("Tried to setAttribute() on non-existant menu-item %d:%d", menuId, itemId);
@@ -391,7 +391,7 @@
case SCI_EVENT_SAID:
// HACK: should be removed as soon as said() is cleaned up
- s = ((SciEngine *)g_engine)->getEngineState();
+ s = g_sci->getEngineState();
while (itemIterator != itemEnd) {
itemEntry = *itemIterator;
Modified: scummvm/trunk/engines/sci/graphics/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/graphics/palette.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -442,7 +442,7 @@
_palVaryId = paletteId;
_palVaryStart = g_system->getMillis();
_palVaryEnd = _palVaryStart + ticks * 1000 / 60;
- ((SciEngine*)g_engine)->getTimerManager()->installTimerProc(&palVaryCallback, 1000 / 60, this);
+ g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000 / 60, this);
}
void GfxPalette::togglePalVary(bool pause) {
@@ -453,7 +453,7 @@
}
void GfxPalette::stopPalVary() {
- ((SciEngine*)g_engine)->getTimerManager()->removeTimerProc(&palVaryCallback);
+ g_sci->getTimerManager()->removeTimerProc(&palVaryCallback);
_palVaryId = -1; // invalidate the target palette
// HACK: just set the target palette
Modified: scummvm/trunk/engines/sci/parser/grammar.cpp
===================================================================
--- scummvm/trunk/engines/sci/parser/grammar.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/parser/grammar.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -355,7 +355,7 @@
int ntrules_nr;
ParseRuleList *ntlist = NULL;
ParseRuleList *tlist, *new_tlist;
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
for (uint i = 1; i < _parserBranches.size(); i++) { // branch rule 0 is treated specially
ParseRule *rule = _vbuild_rule(&_parserBranches[i]);
@@ -480,7 +480,7 @@
}
int Vocabulary::parseGNF(const ResultWordList &words, bool verbose) {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
// Get the start rules:
ParseRuleList *work = _vocab_clone_rule_list_by_id(_parserRules, _parserBranches[0].data[1]);
ParseRuleList *results = NULL;
Modified: scummvm/trunk/engines/sci/parser/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/parser/vocabulary.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/parser/vocabulary.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -448,7 +448,7 @@
void Vocabulary::printSuffixes() const {
char word_buf[256], alt_buf[256];
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
int i = 0;
for (SuffixList::const_iterator suf = _parserSuffixes.begin(); suf != _parserSuffixes.end(); ++suf) {
@@ -463,7 +463,7 @@
}
void Vocabulary::printParserWords() const {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
int j = 0;
for (WordMap::iterator i = _parserWords.begin(); i != _parserWords.end(); ++i) {
@@ -570,7 +570,7 @@
}
void Vocabulary::printParserNodes(int num) {
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
for (int i = 0; i < num; i++) {
con->DebugPrintf(" Node %03x: ", i);
@@ -584,7 +584,7 @@
int Vocabulary::parseNodes(int *i, int *pos, int type, int nr, int argc, const char **argv) {
int nextToken = 0, nextValue = 0, newPos = 0, oldPos = 0;
- Console *con = ((SciEngine *)g_engine)->getSciDebugger();
+ Console *con = g_sci->getSciDebugger();
if (type == kParseNil)
return 0;
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -54,12 +54,18 @@
extern int g_loadFromLauncher;
+SciEngine *g_sci = 0;
+
+
class GfxDriver;
SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
: Engine(syst), _gameDescription(desc), _system(syst) {
_console = NULL;
+ assert(g_sci = 0);
+ g_sci = this;
+
// Set up the engine specific debug levels
Common::addDebugChannel(kDebugLevelError, "Error", "Script error debugging");
Common::addDebugChannel(kDebugLevelNodes, "Lists", "Lists and nodes debugging");
@@ -111,11 +117,11 @@
delete _vocabulary;
delete _console;
delete _resMan;
+
+ g_sci = 0;
}
Common::Error SciEngine::run() {
- // FIXME/TODO: Move some of the stuff below to init()
-
// Assign default values to the config manager, in case settings are missing
ConfMan.registerDefault("undither", "true");
ConfMan.registerDefault("enable_fb01", "false");
Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sci.h 2010-02-13 17:42:49 UTC (rev 48046)
@@ -154,7 +154,16 @@
OSystem *_system;
};
+
/**
+ * Global instance of the SciEngine class, similar to g_engine.
+ * This is a hackish way to make all central components available
+ * everywhere. Ideally, we would get rid of this again in the future,
+ * but for now it's a pragmatic and simple way to achieve the goal.
+ */
+extern SciEngine *g_sci;
+
+/**
* Convenience function to obtain the active SCI version.
*/
SciVersion getSciVersion();
Modified: scummvm/trunk/engines/sci/sound/drivers/mididriver.h
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/mididriver.h 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sound/drivers/mididriver.h 2010-02-13 17:42:49 UTC (rev 48046)
@@ -73,7 +73,7 @@
MidiPlayer(SciVersion version) : _reverb(0), _version(version) { }
int open() {
- ResourceManager *resMan = ((SciEngine *)g_engine)->getResourceManager(); // HACK
+ ResourceManager *resMan = g_sci->getResourceManager(); // HACK
return open(resMan);
}
virtual int open(ResourceManager *resMan) { return _driver->open(); }
Modified: scummvm/trunk/engines/sci/sound/iterator/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/iterator/core.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sound/iterator/core.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -228,7 +228,7 @@
switch (musicDriver) {
case MD_ADLIB:
// FIXME: There's no Amiga sound option, so we hook it up to AdLib
- if (((SciEngine *)g_engine)->getPlatform() == Common::kPlatformAmiga)
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
_mididrv = MidiPlayer_Amiga_create(_soundVersion);
else
_mididrv = MidiPlayer_AdLib_create(_soundVersion);
Modified: scummvm/trunk/engines/sci/sound/iterator/iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/iterator/iterator.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sound/iterator/iterator.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -144,7 +144,7 @@
byte buf[5];
// FIXME: Evil hack
- SfxState &sound = ((SciEngine*)g_engine)->getEngineState()->_sound;
+ SfxState &sound = g_sci->getEngineState()->_sound;
for (int i = 0; i < MIDI_CHANNELS; i++) {
if (playmask & (1 << i)) {
Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sound/music.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -67,7 +67,7 @@
// WORKAROUND: Default to MIDI in Amiga SCI1_EGA+ games as we don't support those patches yet.
// We also don't yet support the 7.pat file of SCI1+ Mac games or SCI0 Mac patches, so we
// default to MIDI in those games to let them run.
- Common::Platform platform = ((SciEngine *)g_engine)->getPlatform();
+ Common::Platform platform = g_sci->getPlatform();
if (getSciVersion() >= SCI_VERSION_2 || platform == Common::kPlatformMacintosh || (platform == Common::kPlatformAmiga && getSciVersion() >= SCI_VERSION_1_EGA))
midiType = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MIDI);
@@ -77,7 +77,7 @@
switch (midiType) {
case MD_ADLIB:
// FIXME: There's no Amiga sound option, so we hook it up to AdLib
- if (((SciEngine *)g_engine)->getPlatform() == Common::kPlatformAmiga)
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
_pMidiDrv = MidiPlayer_Amiga_create(_soundVersion);
else
_pMidiDrv = MidiPlayer_AdLib_create(_soundVersion);
@@ -199,7 +199,7 @@
delete pSnd->pStreamAud;
byte flags = Audio::FLAG_UNSIGNED;
// Amiga SCI1 games had signed sound data
- if (_soundVersion >= SCI_VERSION_1_EARLY && ((SciEngine *)g_engine)->getPlatform() == Common::kPlatformAmiga)
+ if (_soundVersion >= SCI_VERSION_1_EARLY && g_sci->getPlatform() == Common::kPlatformAmiga)
flags = 0;
int endPart = track->digitalSampleEnd > 0 ? (track->digitalSampleSize - track->digitalSampleEnd) : 0;
pSnd->pStreamAud = Audio::makeRawStream(channelData + track->digitalSampleStart,
Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-02-13 13:21:29 UTC (rev 48045)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp 2010-02-13 17:42:49 UTC (rev 48046)
@@ -133,7 +133,7 @@
#ifdef USE_OLD_MUSIC_FUNCTIONS
// The following hack is needed to ease the change from old to new sound code (because the new sound code does not use SfxState)
- _state = &((SciEngine *)g_engine)->getEngineState()->_sound; // HACK
+ _state = &g_sci->getEngineState()->_sound; // HACK
#endif
#ifndef USE_OLD_MUSIC_FUNCTIONS
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