From b2d69649f7e4c484dcf3810e11cd644699b78d2c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Feb 2010 01:32:27 +0000 Subject: SCI: Rearrange members of class EngineState svn-id: r47832 --- engines/sci/engine/state.h | 71 ++++++++++++++++++++++++++++------------------ engines/sci/engine/vm.cpp | 2 +- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 2833957bbb..a4232f27b7 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -141,15 +141,11 @@ public: EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, SciGui *gui, AudioPlayer *audio); virtual ~EngineState(); - enum { - kMemorySegmentMax = 256 - }; - virtual void saveLoadWithSerializer(Common::Serializer &ser); - kLanguage getLanguage(); public: ResourceManager *resMan; /**< The resource manager */ + SegManager *_segMan; /**< The segment manager */ Kernel *_kernel; Vocabulary *_voc; @@ -194,6 +190,7 @@ public: DirSeeker _dirseeker; +public: /* VM Information */ Common::List _executionStack; /**< The execution stack */ @@ -217,6 +214,34 @@ public: uint16 currentRoomNumber() const; void setRoomNumber(uint16 roomNumber); + /* Debugger data: */ + Common::List _breakpoints; /**< List of breakpoints */ + int _activeBreakpointTypes; /**< Bit mask specifying which types of breakpoints are active */ + + /* System strings */ + SegmentId sys_strings_segment; + SystemStrings *sys_strings; + + reg_t _gameObj; /**< Pointer to the game object */ + + int gc_countdown; /**< Number of kernel calls until next gc */ + +public: + MessageState *_msgState; + + // MemorySegment provides access to a 256-byte block of memory that remains + // intact across restarts and restores + enum { + kMemorySegmentMax = 256 + }; + uint _memorySegmentSize; + byte _memorySegment[kMemorySegmentMax]; + + EngineState *successor; /**< Successor of this state: Used for restoring */ + + +public: + /** * Processes a multilanguage string based on the current language settings and * returns a string that is ready to be displayed. @@ -227,6 +252,19 @@ public: */ Common::String strSplit(const char *str, const char *sep = "\r----------\r"); + kLanguage getLanguage(); + + Common::String getLanguageString(const char *str, kLanguage lang) const; + +private: + kLanguage charToLanguage(const char c) const; + + +public: + // TODO: The following methods and member variables deal with (detecting) + // features and capabilities the active game expects to find in the engine. + // It should likely be moved to a separate class. + /** * Autodetects the DoSound type * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE / @@ -279,28 +317,6 @@ public: bool usesCdTrack() { return _usesCdTrack; } - /* Debugger data: */ - Common::List _breakpoints; /**< List of breakpoints */ - int _activeBreakpointTypes; /**< Bit mask specifying which types of breakpoints are active */ - - /* System strings */ - SegmentId sys_strings_segment; - SystemStrings *sys_strings; - - reg_t _gameObj; /**< Pointer to the game object */ - - SegManager *_segMan; - int gc_countdown; /**< Number of kernel calls until next gc */ - - MessageState *_msgState; - - uint _memorySegmentSize; - byte _memorySegment[kMemorySegmentMax]; - - EngineState *successor; /**< Successor of this state: Used for restoring */ - - Common::String getLanguageString(const char *str, kLanguage lang) const; - private: bool autoDetectFeature(FeatureDetection featureDetection, int methodNum = -1); @@ -310,7 +326,6 @@ private: #endif MoveCountType _moveCountType; - kLanguage charToLanguage(const char c) const; bool _usesCdTrack; }; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index e6c20f8e5a..ce9e2b8f02 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -571,7 +571,7 @@ void run_vm(EngineState *s, int restoring) { scriptState.variables_seg[VAR_TEMP] = scriptState.variables_seg[VAR_PARAM] = s->stack_segment; scriptState.variables_base[VAR_TEMP] = scriptState.variables_base[VAR_PARAM] = s->stack_base; - // SCI code reads the zeroeth argument to determine argc + // SCI code reads the zeroth argument to determine argc if (s->script_000->_localsBlock) scriptState.variables_base[VAR_GLOBAL] = scriptState.variables[VAR_GLOBAL] = s->script_000->_localsBlock->_locals.begin(); else -- cgit v1.2.3