diff options
author | Filippos Karapetis | 2009-05-31 14:55:32 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-05-31 14:55:32 +0000 |
commit | 4441ca4b3e39ed1613c826f7b46b1e7076fcbe14 (patch) | |
tree | b540763429cefd43f33d209fd3a2a2a8e5307bda /engines/sci/vocabulary.h | |
parent | be224386484793c519840cff0b752e9fd2a430b1 (diff) | |
download | scummvm-rg350-4441ca4b3e39ed1613c826f7b46b1e7076fcbe14.tar.gz scummvm-rg350-4441ca4b3e39ed1613c826f7b46b1e7076fcbe14.tar.bz2 scummvm-rg350-4441ca4b3e39ed1613c826f7b46b1e7076fcbe14.zip |
- Further objectification of the SCI vocabulary functions
- Rewrote the sci_opcodes enum so that it's easier to read
- Made the engine error out if data is sent to an invalid selector (which is a fatal condition)
svn-id: r41069
Diffstat (limited to 'engines/sci/vocabulary.h')
-rw-r--r-- | engines/sci/vocabulary.h | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/engines/sci/vocabulary.h b/engines/sci/vocabulary.h index 153317185f..f1b2ef867b 100644 --- a/engines/sci/vocabulary.h +++ b/engines/sci/vocabulary.h @@ -267,12 +267,46 @@ public: void copyParserListsTo(SuffixList &parserSuffixes, parse_rule_list_t &parserRules, Common::Array<parse_tree_branch_t> &parserBranches, WordMap &parserWords); + /** + * Copies the kernel lists from another vocabulary + */ + void copyKernelListsFrom(Vocabulary *voc); + + /** + * Gets the internal kernel lists, for vocabulary copying + */ + void copyKernelListsTo(Common::Array<opcode> &opcodes, Common::StringList &selectorNames, + Common::StringList &kernelNames); + uint getParserBranchesSize() { return _parserBranches.size(); } parse_tree_branch_t getParseTreeBranch(int number) { return _parserBranches[number]; } - Common::StringList _selectorNames; - Common::Array<opcode> _opcodes; - Common::StringList _kernelNames; + uint getOpcodesSize() { return _opcodes.size(); } + opcode getOpcode(uint opcode) { return _opcodes[opcode]; } + + uint getSelectorNamesSize() { return _selectorNames.size(); } + Common::String getSelectorName(uint selector) { return _selectorNames[selector]; } + + /* Determines the selector ID of a selector by its name + ** (const char *) selectorName: Name of the selector to look up + ** Returns : (int) The appropriate selector ID, or -1 on error + */ + int findSelector(const char *selectorName); + + /* Detects whether a particular kernel function is required in the game + ** (const char *) functionName: The name of the desired kernel function + ** Returns : (bool) true if the kernel function is listed in the kernel table, + ** false otherwise + */ + bool hasKernelFunction(const char *functionName); + + uint getKernelNamesSize() { return _kernelNames.size(); } + Common::String getKernelName(uint number) { return _kernelNames[number]; } + + // Script dissection/dumping functions + void dissectScript(int scriptNumber); + void dumpScriptObject(char *data, int seeker, int objsize); + void dumpScriptClass(char *data, int seeker, int objsize); selector_map_t _selectorMap; /**< Shortcut list for important selectors */ @@ -283,6 +317,11 @@ private: */ bool getSelectorNames(); + /* Maps special selectors + ** Returns : (void) + */ + void mapSelectors(); + /** * Fills the given Array with opcodes. * @return true on success, false on failure @@ -334,6 +373,13 @@ private: bool _isOldSci0; VocabularyVersions _vocabVersion; + // Kernel-related lists + // List of opcodes, loaded from vocab.998. This list is only used for debugging + // purposes, as we hardcode the list of opcodes in the sci_opcodes enum (script.h) + Common::Array<opcode> _opcodes; + Common::StringList _selectorNames; + Common::StringList _kernelNames; + // Parser-related lists SuffixList _parserSuffixes; parse_rule_list_t *_parserRules; /**< GNF rules used in the parser algorithm */ |