SCI: Rearrange members of class EngineState

svn-id: r47832
This commit is contained in:
Max Horn 2010-02-03 01:32:27 +00:00
parent 81f7a55e8c
commit b2d69649f7
2 changed files with 44 additions and 29 deletions

View File

@ -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<ExecStack> _executionStack; /**< The execution stack */
@ -217,6 +214,34 @@ public:
uint16 currentRoomNumber() const;
void setRoomNumber(uint16 roomNumber);
/* Debugger data: */
Common::List<Breakpoint> _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<Breakpoint> _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;
};

View File

@ -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