diff options
author | Filippos Karapetis | 2010-06-10 09:18:57 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-10 09:18:57 +0000 |
commit | eb4ec596cdb8e541d5221263b3db185bd01b206f (patch) | |
tree | 83d0f31aaa8a3a5314ae3bc0ec9433818f4552ef /engines | |
parent | 0ab7c908bb3971a74bb1c8848d6f59f161464ad1 (diff) | |
download | scummvm-rg350-eb4ec596cdb8e541d5221263b3db185bd01b206f.tar.gz scummvm-rg350-eb4ec596cdb8e541d5221263b3db185bd01b206f.tar.bz2 scummvm-rg350-eb4ec596cdb8e541d5221263b3db185bd01b206f.zip |
Use the SELECTOR() macro for readability
svn-id: r49563
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/features.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/animate.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/compare.cpp | 8 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 7 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 2 |
8 files changed, 25 insertions, 23 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index 48f7c2d64f..4eb6bf2a56 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -69,7 +69,7 @@ reg_t GameFeatures::getDetectionAddr(const Common::String &objName, Selector slc bool GameFeatures::autoDetectSoundType() { // Look up the script address - reg_t addr = getDetectionAddr("Sound", _kernel->_selectorCache.play); + reg_t addr = getDetectionAddr("Sound", SELECTOR(play)); if (!addr.segment) return false; @@ -138,7 +138,7 @@ SciVersion GameFeatures::detectDoSoundType() { if (getSciVersion() == SCI_VERSION_0_EARLY) { // This game is using early SCI0 sound code (different headers than SCI0 late) _doSoundType = SCI_VERSION_0_EARLY; - } else if (_kernel->_selectorCache.nodePtr == -1) { + } else if (SELECTOR(nodePtr) == -1) { // No nodePtr selector, so this game is definitely using newer // SCI0 sound code (i.e. SCI_VERSION_0_LATE) _doSoundType = SCI_VERSION_0_LATE; @@ -293,7 +293,7 @@ SciVersion GameFeatures::detectLofsType() { bool GameFeatures::autoDetectGfxFunctionsType(int methodNum) { // Look up the script address - reg_t addr = getDetectionAddr("Rm", _kernel->_selectorCache.overlay, methodNum); + reg_t addr = getDetectionAddr("Rm", SELECTOR(overlay), methodNum); if (!addr.segment) return false; @@ -343,10 +343,10 @@ SciVersion GameFeatures::detectGfxFunctionsType() { bool searchRoomObj = false; reg_t rmObjAddr = _segMan->findObjectByName("Rm"); - if (_kernel->_selectorCache.overlay != -1) { + if (SELECTOR(overlay) != -1) { // The game has an overlay selector, check how it calls kDrawPicto determine // the graphics functions type used - if (lookupSelector(_segMan, rmObjAddr, _kernel->_selectorCache.overlay, NULL, NULL) == kSelectorMethod) { + if (lookupSelector(_segMan, rmObjAddr, SELECTOR(overlay), NULL, NULL) == kSelectorMethod) { if (!autoDetectGfxFunctionsType()) { warning("Graphics functions detection failed, taking an educated guess"); @@ -396,7 +396,7 @@ SciVersion GameFeatures::detectGfxFunctionsType() { #ifdef ENABLE_SCI32 bool GameFeatures::autoDetectSci21KernelType() { // Look up the script address - reg_t addr = getDetectionAddr("Sound", _kernel->_selectorCache.play); + reg_t addr = getDetectionAddr("Sound", SELECTOR(play)); if (!addr.segment) return false; @@ -448,7 +448,7 @@ SciVersion GameFeatures::detectSci21KernelType() { bool GameFeatures::autoDetectMoveCountType() { // Look up the script address - reg_t addr = getDetectionAddr("Motion", _kernel->_selectorCache.doit); + reg_t addr = getDetectionAddr("Motion", SELECTOR(doit)); if (!addr.segment) return false; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index abe55455de..f025d03a09 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -821,12 +821,12 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { maxChars = readSelectorValue(s->_segMan, controlObject, SELECTOR(x)); // max chars per entry cursorOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(cursor)); - if (g_sci->getKernel()->_selectorCache.topString != -1) { + if (SELECTOR(topString) != -1) { // Games from early SCI1 onwards use topString upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(topString)); } else { // Earlier games use lsTop or brTop - if (lookupSelector(s->_segMan, controlObject, g_sci->getKernel()->_selectorCache.brTop, NULL, NULL) == kSelectorVariable) + if (lookupSelector(s->_segMan, controlObject, SELECTOR(brTop), NULL, NULL) == kSelectorVariable) upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(brTop)); else upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(lsTop)); diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 716f948ce6..367a9b78b9 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -234,7 +234,7 @@ kLanguage SciEngine::getSciLanguage() { lang = K_LANG_ENGLISH; - if (_kernel->_selectorCache.printLang != -1) { + if (SELECTOR(printLang) != -1) { lang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang)); if ((getSciVersion() >= SCI_VERSION_1_1) || (lang == K_LANG_NONE)) { @@ -281,7 +281,7 @@ Common::String SciEngine::strSplit(const char *str, const char *sep) { kLanguage lang = getSciLanguage(); kLanguage subLang = K_LANG_NONE; - if (_kernel->_selectorCache.subtitleLang != -1) { + if (SELECTOR(subtitleLang) != -1) { subLang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(subtitleLang)); } diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 2c92bdadc3..f99ae817bf 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -35,8 +35,9 @@ #include "sci/engine/features.h" #include "sci/engine/state.h" #include "sci/engine/kernel.h" -#include "sci/engine/seg_manager.h" #include "sci/engine/script.h" +#include "sci/engine/seg_manager.h" +#include "sci/engine/selector.h" // for SELECTOR #include "sci/engine/gc.h" namespace Sci { @@ -205,7 +206,7 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i if (!stopGroopPos.isNull()) { // does the game have a stopGroop object? // Find the "client" member variable of the stopGroop object, and update it ObjVarRef varp; - if (lookupSelector(segMan, stopGroopPos, kernel->_selectorCache.client, &varp, NULL) == kSelectorVariable) { + if (lookupSelector(segMan, stopGroopPos, SELECTOR(client), &varp, NULL) == kSelectorVariable) { reg_t *clientVar = varp.getPointer(segMan); *clientVar = value; } diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index d4def39ebf..48715af53e 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -93,7 +93,7 @@ bool GfxAnimate::invoke(List *list, int argc, reg_t *argv) { signal = readSelectorValue(_s->_segMan, curObject, SELECTOR(signal)); if (!(signal & kSignalFrozen)) { // Call .doit method of that object - invokeSelector(_s, curObject, g_sci->getKernel()->_selectorCache.doit, kContinueOnInvalidSelector, argc, argv, 0); + invokeSelector(_s, curObject, SELECTOR(doit), argc, argv, 0); // Lookup node again, since the nodetable it was in may have been reallocated curNode = _s->_segMan->lookupNode(curAddress); } @@ -497,7 +497,7 @@ void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) { if (signal & kSignalDisposeMe) { // Call .delete_ method of that object - invokeSelector(_s, curObject, g_sci->getKernel()->_selectorCache.delete_, kContinueOnInvalidSelector, argc, argv, 0); + invokeSelector(_s, curObject, SELECTOR(delete_), argc, argv, 0); } listIterator--; } diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 3102edc2fa..47b4f22607 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -126,14 +126,14 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) { int16 x = (int16)readSelectorValue(_segMan, objectReference, SELECTOR(x)); int16 y = (int16)readSelectorValue(_segMan, objectReference, SELECTOR(y)); int16 z = 0; - if (_kernel->_selectorCache.z > -1) + if (SELECTOR(z) > -1) z = (int16)readSelectorValue(_segMan, objectReference, SELECTOR(z)); // now get cel rectangle view = _cache->getView(viewId); view->getCelRect(loopNo, celNo, x, y, z, &celRect); - if (lookupSelector(_segMan, objectReference, _kernel->_selectorCache.nsTop, NULL, NULL) == kSelectorVariable) { + if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), NULL, NULL) == kSelectorVariable) { writeSelectorValue(_segMan, objectReference, SELECTOR(nsLeft), celRect.left); writeSelectorValue(_segMan, objectReference, SELECTOR(nsRight), celRect.right); writeSelectorValue(_segMan, objectReference, SELECTOR(nsTop), celRect.top); @@ -183,10 +183,10 @@ bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, } void GfxCompare::kernelBaseSetter(reg_t object) { - if (lookupSelector(_segMan, object, _kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) { + if (lookupSelector(_segMan, object, SELECTOR(brLeft), NULL, NULL) == kSelectorVariable) { int16 x = readSelectorValue(_segMan, object, SELECTOR(x)); int16 y = readSelectorValue(_segMan, object, SELECTOR(y)); - int16 z = (_kernel->_selectorCache.z > -1) ? readSelectorValue(_segMan, object, SELECTOR(z)) : 0; + int16 z = (SELECTOR(z) > -1) ? readSelectorValue(_segMan, object, SELECTOR(z)) : 0; int16 yStep = readSelectorValue(_segMan, object, SELECTOR(yStep)); GuiResourceId viewId = readSelectorValue(_segMan, object, SELECTOR(view)); int16 loopNo = readSelectorValue(_segMan, object, SELECTOR(loop)); diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index fad4e8c4e8..3a3c147cb6 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -40,6 +40,7 @@ #include "sci/engine/state.h" #include "sci/engine/kernel.h" #include "sci/engine/script.h" // for script_adjust_opcode_formats +#include "sci/engine/selector.h" // for SELECTOR #include "sci/sound/audio.h" #include "sci/sound/soundcmd.h" @@ -366,7 +367,7 @@ void SciEngine::initStackBaseWithSelector(Selector selector) { } void SciEngine::runGame() { - initStackBaseWithSelector(_kernel->_selectorCache.play); // Call the play selector + initStackBaseWithSelector(SELECTOR(play)); // Call the play selector // Attach the debug console on game startup, if requested if (DebugMan.isDebugChannelEnabled(kDebugLevelOnStartup)) @@ -383,11 +384,11 @@ void SciEngine::runGame() { #ifdef USE_OLD_MUSIC_FUNCTIONS _gamestate->_sound.sfx_reset_player(); #endif - initStackBaseWithSelector(_kernel->_selectorCache.play); + initStackBaseWithSelector(SELECTOR(play)); _gamestate->gameWasRestarted = true; } else if (_gamestate->abortScriptProcessing == kAbortLoadGame) { _gamestate->abortScriptProcessing = kAbortNone; - initStackBaseWithSelector(_kernel->_selectorCache.replay); + initStackBaseWithSelector(SELECTOR(replay)); } else { break; // exit loop } diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 4711fe385d..2bbc5b44de 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -842,7 +842,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { // Update MIDI slots if (musicSlot->signal == 0) { if (musicSlot->dataInc != readSelectorValue(_segMan, obj, SELECTOR(dataInc))) { - if (_kernel->_selectorCache.dataInc > -1) + if (SELECTOR(dataInc) > -1) writeSelectorValue(_segMan, obj, SELECTOR(dataInc), musicSlot->dataInc); writeSelectorValue(_segMan, obj, SELECTOR(signal), musicSlot->dataInc + 127); } |