diff options
author | Filippos Karapetis | 2010-06-10 11:18:10 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-10 11:18:10 +0000 |
commit | 93f33c7dab009e8ff82fac195e7b6d02e66ab755 (patch) | |
tree | 6e96c80da2d5167d781a50f5c4b81b57af3a99b0 /engines/sci/engine | |
parent | a635b948239fbbd1ce302fb9d5eac943e90ca7ee (diff) | |
download | scummvm-rg350-93f33c7dab009e8ff82fac195e7b6d02e66ab755.tar.gz scummvm-rg350-93f33c7dab009e8ff82fac195e7b6d02e66ab755.tar.bz2 scummvm-rg350-93f33c7dab009e8ff82fac195e7b6d02e66ab755.zip |
Resolved a FIXME with getSciLanguage(), by creating a separate setter. Also, some camelCase changes
svn-id: r49568
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/ksound.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 25 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 10 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 12 |
6 files changed, 34 insertions, 26 deletions
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 367a89005c..29302181b1 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -151,7 +151,10 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { if (language != -1) g_sci->getResMan()->setAudioLanguage(language); - return make_reg(0, g_sci->getSciLanguage()); + kLanguage kLang = g_sci->getSciLanguage(); + g_sci->setSciLanguage(kLang); + + return make_reg(0, kLang); } break; case kSciAudioCD: diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 99191146e5..3cd444d4d7 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -722,7 +722,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename meta.savegame_date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF); meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF); - if (s->execution_stack_base) { + if (s->executionStackBase) { warning("Cannot save from below kernel function"); return 1; } @@ -875,7 +875,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { s->gc_countdown = GC_INTERVAL - 1; // Time state: - s->last_wait_time = g_system->getMillis(); + s->lastWaitTime = g_system->getMillis(); s->game_start_time = g_system->getMillis(); #ifdef USE_OLD_MUSIC_FUNCTIONS diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 159c278e8c..436eaafec5 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -284,7 +284,7 @@ void script_debug(EngineState *s) { #if 0 if (sci_debug_flags & _DEBUG_FLAG_LOGGING) { - printf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); + printf("%d: acc=%04x:%04x ", scriptStepCounter, PRINT_REG(s->r_acc)); disassemble(s, s->xs->addr.pc, 0, 1); if (s->seeking == kDebugSeekGlobal) printf("Global %d (0x%x) = %04x:%04x\n", s->seekSpecial, @@ -351,7 +351,7 @@ void script_debug(EngineState *s) { } } - printf("Step #%d\n", s->script_step_counter); + printf("Step #%d\n", s->scriptStepCounter); disassemble(s, s->xs->addr.pc, 0, 1); if (g_debugState.runningStep) { diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 367a9b78b9..8e4a5200c8 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -95,7 +95,7 @@ void EngineState::reset(bool isRestoring) { abortScriptProcessing = kAbortNone; } - execution_stack_base = 0; + executionStackBase = 0; _executionStackPosChanged = false; restAdjust = 0; @@ -103,7 +103,7 @@ void EngineState::reset(bool isRestoring) { r_acc = NULL_REG; r_prev = NULL_REG; - last_wait_time = 0; + lastWaitTime = 0; gc_countdown = 0; @@ -111,14 +111,14 @@ void EngineState::reset(bool isRestoring) { _throttleLastTime = 0; _throttleTrigger = false; - script_step_counter = 0; - script_gc_interval = GC_INTERVAL; + scriptStepCounter = 0; + scriptGCInterval = GC_INTERVAL; } void EngineState::wait(int16 ticks) { uint32 time = g_system->getMillis(); - r_acc = make_reg(0, ((long)time - (long)last_wait_time) * 60 / 1000); - last_wait_time = time; + r_acc = make_reg(0, ((long)time - (long)lastWaitTime) * 60 / 1000); + lastWaitTime = time; ticks *= g_debug_sleeptime_factor; g_sci->getEventManager()->sleep(ticks * 1000 / 60); @@ -144,7 +144,7 @@ void EngineState::setRoomNumber(uint16 roomNumber) { } void EngineState::shrinkStackToBase() { - uint size = execution_stack_base + 1; + uint size = executionStackBase + 1; assert(_executionStack.size() >= size); Common::List<ExecStack>::iterator iter = _executionStack.begin(); for (uint i = 0; i < size; ++i) @@ -268,15 +268,20 @@ kLanguage SciEngine::getSciLanguage() { default: lang = K_LANG_ENGLISH; } - - // Store language in printLang selector - writeSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang), lang); } } return lang; } +void SciEngine::setSciLanguage(kLanguage lang) { + writeSelectorValue(_gamestate->_segMan, _gameObj, SELECTOR(printLang), lang); +} + +void SciEngine::setSciLanguage() { + setSciLanguage(getSciLanguage()); +} + Common::String SciEngine::strSplit(const char *str, const char *sep) { kLanguage lang = getSciLanguage(); kLanguage subLang = K_LANG_NONE; diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 32da83b162..fd2380667b 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -112,7 +112,7 @@ public: SoundCommandParser *_soundCmd; uint32 game_start_time; /**< The time at which the interpreter was started */ - uint32 last_wait_time; /**< The last time the game invoked Wait() */ + uint32 lastWaitTime; /**< The last time the game invoked Wait() */ void wait(int16 ticks); @@ -134,7 +134,7 @@ public: * When called from kernel functions, the vm is re-started recursively on * the same stack. This variable contains the stack base for the current vm. */ - int execution_stack_base; + int executionStackBase; bool _executionStackPosChanged; /**< Set to true if the execution stack position should be re-evaluated by the vm */ reg_t r_acc; /**< Accumulator */ @@ -156,8 +156,8 @@ public: AbortGameState abortScriptProcessing; bool gameWasRestarted; - int script_step_counter; // Counts the number of steps executed - int script_gc_interval; // Number of steps in between gcs + int scriptStepCounter; // Counts the number of steps executed + int scriptGCInterval; // Number of steps in between gcs uint16 currentRoomNumber() const; void setRoomNumber(uint16 roomNumber); @@ -169,7 +169,7 @@ public: /** * Shrink execution stack to size. - * Contains an assert it is not already smaller. + * Contains an assert if it is not already smaller. */ void shrinkStackToBase(); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index f99ae817bf..a203352dcd 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -631,7 +631,7 @@ static void callKernelFunc(EngineState *s, int kernelFuncNum, int argc) { static void gc_countdown(EngineState *s) { if (s->gc_countdown-- <= 0) { - s->gc_countdown = s->script_gc_interval; + s->gc_countdown = s->scriptGCInterval; run_gc(s); } } @@ -726,7 +726,7 @@ void run_vm(EngineState *s, bool restoring) { ExecStack *xs_new = NULL; Object *obj = s->_segMan->getObject(s->xs->objp); Script *local_script = s->_segMan->getScriptIfLoaded(s->xs->local_segment); - int old_execution_stack_base = s->execution_stack_base; + int old_executionStackBase = s->executionStackBase; // Used to detect the stack bottom, for "physical" returns const byte *code_buf = NULL; // (Avoid spurious warning) @@ -735,7 +735,7 @@ void run_vm(EngineState *s, bool restoring) { } if (!restoring) - s->execution_stack_base = s->_executionStack.size() - 1; + s->executionStackBase = s->_executionStack.size() - 1; s->variables_seg[VAR_TEMP] = s->variables_seg[VAR_PARAM] = s->_segMan->findSegmentByType(SEG_TYPE_STACK); s->variables_base[VAR_TEMP] = s->variables_base[VAR_PARAM] = s->stack_base; @@ -1179,8 +1179,8 @@ void run_vm(EngineState *s, bool restoring) { StackPtr old_fp = s->xs->fp; ExecStack *old_xs = &(s->_executionStack.back()); - if ((int)s->_executionStack.size() - 1 == s->execution_stack_base) { // Have we reached the base? - s->execution_stack_base = old_execution_stack_base; // Restore stack base + if ((int)s->_executionStack.size() - 1 == s->executionStackBase) { // Have we reached the base? + s->executionStackBase = old_executionStackBase; // Restore stack base s->_executionStack.pop_back(); @@ -1661,7 +1661,7 @@ void run_vm(EngineState *s, bool restoring) { opcode); } //#endif - ++s->script_step_counter; + ++s->scriptStepCounter; } } |