diff options
Diffstat (limited to 'engines/sci/engine/script.h')
-rw-r--r-- | engines/sci/engine/script.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index 46d6ace917..755e2f3698 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -49,6 +49,21 @@ enum ScriptObjectTypes { typedef Common::HashMap<uint16, Object> ObjMap; +enum ScriptOffsetEntryTypes { + SCI_SCR_OFFSET_TYPE_OBJECT = 0, // classes are handled by this type as well + SCI_SCR_OFFSET_TYPE_STRING, + SCI_SCR_OFFSET_TYPE_SAID +}; + +struct offsetLookupArrayEntry { + uint16 type; // type of entry + uint16 id; // id of this type, first item inside script data is 1, second item is 2, etc. + uint32 offset; // offset of entry within script resource data + uint16 stringSize; // size of string, including terminating [NUL] +}; + +typedef Common::Array<offsetLookupArrayEntry> offsetLookupArrayType; + class Script : public SegmentObj { private: int _nr; /**< Script number */ @@ -75,6 +90,14 @@ private: ObjMap _objects; /**< Table for objects, contains property variables */ +protected: + offsetLookupArrayType _offsetLookupArray; // Table of all elements of currently loaded script, that may get pointed to + +private: + uint16 _offsetLookupObjectCount; + uint16 _offsetLookupStringCount; + uint16 _offsetLookupSaidCount; + public: int getLocalsOffset() const { return _localsOffset; } uint16 getLocalsCount() const { return _localsCount; } @@ -248,6 +271,14 @@ public: */ int getCodeBlockOffsetSci3() { return READ_SCI11ENDIAN_UINT32(_buf); } + /** + * Get the offset array + */ + const offsetLookupArrayType *getOffsetArray() { return &_offsetLookupArray; }; + uint16 getOffsetObjectCount() { return _offsetLookupObjectCount; }; + uint16 getOffsetStringCount() { return _offsetLookupStringCount; }; + uint16 getOffsetSaidCount() { return _offsetLookupSaidCount; }; + private: /** * Processes a relocation block within a SCI0-SCI2.1 script @@ -294,6 +325,11 @@ private: void initializeObjectsSci3(SegManager *segMan, SegmentId segmentId); LocalVariables *allocLocalsSegment(SegManager *segMan); + + /** + * Identifies certain offsets within script data and set up lookup-table + */ + void identifyOffsets(); }; } // End of namespace Sci |