aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/parser/vocabulary.h
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2010-10-03 20:58:50 +0000
committerWillem Jan Palenstijn2010-10-03 20:58:50 +0000
commit11d9f1ec54351bcaf8eed8a55a96a474370808d9 (patch)
treec9fceb5a1bf51ad88dd3c4ce798673d5d1959ab6 /engines/sci/parser/vocabulary.h
parent0596971decae5d64857cf01eb11cf5694043440d (diff)
downloadscummvm-rg350-11d9f1ec54351bcaf8eed8a55a96a474370808d9.tar.gz
scummvm-rg350-11d9f1ec54351bcaf8eed8a55a96a474370808d9.tar.bz2
scummvm-rg350-11d9f1ec54351bcaf8eed8a55a96a474370808d9.zip
SCI: Support alternative inputs from vocab 913
This allows the input of accented characters and Japanese using plain ascii in non-English games. svn-id: r53001
Diffstat (limited to 'engines/sci/parser/vocabulary.h')
-rw-r--r--engines/sci/parser/vocabulary.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h
index 1b37219bac..620d50c09d 100644
--- a/engines/sci/parser/vocabulary.h
+++ b/engines/sci/parser/vocabulary.h
@@ -49,7 +49,9 @@ enum {
VOCAB_RESOURCE_SCI1_MAIN_VOCAB = 900,
VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES = 901,
- VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB = 902
+ VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB = 902,
+
+ VOCAB_RESOURCE_ALT_INPUTS = 913
};
@@ -147,6 +149,15 @@ struct synonym_t {
typedef Common::List<synonym_t> SynonymList;
+
+struct AltInput {
+ const char *_input;
+ const char *_replacement;
+ unsigned int _inputLength;
+ bool _prefix;
+};
+
+
struct parse_tree_branch_t {
int id;
int data[10];
@@ -273,6 +284,14 @@ public:
int parseNodes(int *i, int *pos, int type, int nr, int argc, const char **argv);
+ /**
+ * Check text input against alternative inputs.
+ * @param text The text to process. It will be modified in-place
+ * @param cursorPos The cursor position
+ * @return true if anything changed
+ */
+ bool checkAltInput(Common::String& text, uint16& cursorPos);
+
private:
/**
* Loads all words from the main vocabulary.
@@ -305,6 +324,20 @@ private:
*/
void freeRuleList(ParseRuleList *rule_list);
+
+ /**
+ * Retrieves all alternative input combinations from vocab 913.
+ * @return true on success, false on error
+ */
+ bool loadAltInputs();
+
+ /**
+ * Frees all alternative input combinations.
+ */
+ void freeAltInputs();
+
+
+
ResourceManager *_resMan;
VocabularyVersions _vocabVersion;
@@ -319,6 +352,7 @@ private:
Common::Array<parse_tree_branch_t> _parserBranches;
WordMap _parserWords;
SynonymList _synonyms; /**< The list of synonyms */
+ Common::Array<Common::List<AltInput> > _altInputs;
public:
// Accessed by said()