diff options
author | Max Horn | 2009-05-18 15:07:51 +0000 |
---|---|---|
committer | Max Horn | 2009-05-18 15:07:51 +0000 |
commit | e0366f00bce7d35807425bd9478a0e73a63b5bf1 (patch) | |
tree | a2e3b0fc240e7ec39855345c6f5225ab37eaf3d6 /engines | |
parent | 790e235ae17382b70f4a90f7a6fa931fde476a64 (diff) | |
download | scummvm-rg350-e0366f00bce7d35807425bd9478a0e73a63b5bf1.tar.gz scummvm-rg350-e0366f00bce7d35807425bd9478a0e73a63b5bf1.tar.bz2 scummvm-rg350-e0366f00bce7d35807425bd9478a0e73a63b5bf1.zip |
SCI: Removed SCI_SIMPLE_SAID_CODE and the associated heavily bitrotted code
svn-id: r40691
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 67 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 2 | ||||
-rw-r--r-- | engines/sci/vocabulary.cpp | 96 | ||||
-rw-r--r-- | engines/sci/vocabulary.h | 1 |
5 files changed, 3 insertions, 171 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 87dd201763..b2e9ebf893 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -77,41 +77,6 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) { /* Parser */ /**********/ -#ifdef SCI_SIMPLE_SAID_CODE -int vocab_match_simple(EngineState *s, HeapPtr addr) { - int nextitem; - int listpos = 0; - - if (!s->parser_valid) - return SAID_NO_MATCH; - - if (s->parser_valid == 2) { /* debug mode: sim_said */ - do { - sciprintf("DEBUGMATCH: "); - nextitem = s->heap[addr++]; - - if (nextitem < 0xf0) { - nextitem = nextitem << 8 | s->heap[addr++]; - if (s->parser_nodes[listpos].type - || nextitem != s->parser_nodes[listpos++].content.value) - return SAID_NO_MATCH; - } else { - - if (nextitem == 0xff) - return (s->parser_nodes[listpos++].type == -1) ? SAID_FULL_MATCH : SAID_NO_MATCH; /* Finished? */ - - if (s->parser_nodes[listpos].type != 1 - || nextitem != s->parser_nodes[listpos++].content.value) - return SAID_NO_MATCH; - - } - } while (42); - } else { /* normal simple match mode */ - return vocab_simple_said_test(s, addr); - } -} -#endif /* SCI_SIMPLE_SAID_CODE */ - reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t heap_said_block = argv[0]; @@ -137,29 +102,8 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -#ifdef SCI_SIMPLE_SAID_CODE - - s->acc = 0; - - if (s->parser_lastmatch_word == SAID_FULL_MATCH) - return; /* Matched before; we're not doing any more matching work today. */ - - if ((new_lastmatch = vocab_match_simple(s, said_block)) != SAID_NO_MATCH) { - - if (s->debug_mode & (1 << SCIkPARSER_NR)) - sciprintf("Match (simple).\n"); - s->acc = 1; - - if (new_lastmatch == SAID_FULL_MATCH) /* Finished matching? */ - PUT_SELECTOR(s->parser_event, claimed, 1); /* claim event */ - /* otherwise, we have a partial match: Set new lastmatch word in all cases. */ - - s->parser_lastmatch_word = new_lastmatch; - } - -#else /* !SCI_SIMPLE_SAID_CODE */ - if ((new_lastmatch = said(s, said_block, (s->debug_mode & (1 << SCIkPARSER_NR)))) - != SAID_NO_MATCH) { /* Build and possibly display a parse tree */ + new_lastmatch = said(s, said_block, (s->debug_mode & (1 << SCIkPARSER_NR))); + if (new_lastmatch != SAID_NO_MATCH) { /* Build and possibly display a parse tree */ if (s->debug_mode & (1 << SCIkPARSER_NR)) sciprintf("Match.\n"); @@ -175,7 +119,6 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->parser_lastmatch_word = SAID_NO_MATCH; return NULL_REG; } -#endif /* !SCI_SIMPLE_SAID_CODE */ return s->r_acc; } @@ -275,10 +218,6 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->parser_rules)) syntax_fail = 1; /* Building a tree failed */ -#ifdef SCI_SIMPLE_SAID_CODE - vocab_build_simple_parse_tree(&(s->parser_nodes[0]), words); -#endif /* SCI_SIMPLE_SAID_CODE */ - if (syntax_fail) { s->r_acc = make_reg(0, 1); @@ -292,10 +231,8 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { } else { s->parser_valid = 1; PUT_SEL32V(event, claimed, 0); -#ifndef SCI_SIMPLE_SAID_CODE if (s->debug_mode & (1 << SCIkPARSER_NR)) vocab_dump_parse_tree("Parse-tree", s->parser_nodes); -#endif /* !SCI_SIMPLE_SAID_CODE */ } } else { diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 6da40fc09d..73ccc357b9 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -3062,14 +3062,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * "SEE ALSO\n" " debuglog.1, sfx_debuglog.1\n"); -#ifdef SCI_SIMPLE_SAID_CODE - con_hook_command(c_sim_parse, "simparse", "s*", "Simulates a parsed entity.\n\nUSAGE\n Call this" - " function with a list of\n Said operators, words, and word group" - "\n numbers to match Said() specs\n that look identical.\n" - "\n Note that opening braces and\n everything behind them are\n" - "\n removed from all non-operator\n parameter tokens.\n" - "\n simparse without parameters\n removes the entity.\n"); -#endif /* SCI_SIMPLE_SAID_CODE */ #ifdef GFXW_DEBUG_WIDGETS con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n shows which widgets are active.\n" " With parameters, it lists the\n widget corresponding to the\n numerical index specified (for\n each parameter)."); diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 75e9668e15..5ab90f442a 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -228,7 +228,7 @@ public: reg_t parser_event; /**< The event passed to Parse() and later used by Said() */ Script *script_000; /**< script 000, e.g. for globals */ - uint16 currentRoomNumber() { return KP_UINT(script_000->locals_block->_locals[13]); } + uint16 currentRoomNumber() const { return KP_UINT(script_000->locals_block->_locals[13]); } int parser_lastmatch_word; /**< Position of the input word the parser last matched on, or SAID_NO_MATCH */ diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index 7df8d7f5cc..b830b57c89 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -336,102 +336,6 @@ void vocab_decypher_said_block(EngineState *s, byte *addr) { sciprintf("\n"); } - -#ifdef SCI_SIMPLE_SAID_CODE - -static const short _related_words[][2] = { // 0 is backwards, 1 is forward - {0x800, 0x180}, // preposition - {0x000, 0x180}, // article - {0x000, 0x180}, // adjective - {0x800, 0x000}, // pronoun - {0x800, 0x180}, // noun - {0x000, 0x800}, // auxiliary verb - {0x800, 0x800}, // adverb - {0x000, 0x180}, // verb - {0x000, 0x180} // number -}; - -int vocab_build_simple_parse_tree(parse_tree_node_t *nodes, WordMap &words) { - int i, length, pos = 0; - - for (i = 0; i < words.size(); ++i) { - if (words[i]._class != VOCAB_CLASS_ANYWORD) { - nodes[pos].type = words[i]._class; - nodes[pos].content.value = words[i]._group; - pos += 2; // Link information is filled in below - } - } - nodes[pos].type = -1; // terminate - length = pos >> 1; - - // now find all referenced words -#ifdef SCI_SIMPLE_SAID_DEBUG - sciprintf("Semantic references:\n"); -#endif - - for (i = 0; i < length; i++) { - int j; - int searchmask; - int type; - - pos = (i << 1); - type = sci_ffs(nodes[pos].type); - - if (type) { - int found = -1; - - type -= 5; // 1 because ffs starts counting at 1, 4 because nodes[pos].type is a nibble off - if (type < 0) - type = 0; -#ifdef SCI_SIMPLE_SAID_DEBUG - sciprintf("#%d: Word %04x: type %04x\n", i, nodes[pos].content.value, type); -#endif - - // search backwards - searchmask = _related_words[type][0]; - if (searchmask) { - for (j = i - 1; j >= 0; j--) - if (nodes[j << 1].type & searchmask) { - found = j << 1; - break; - } - } - nodes[pos+1].content.branches[0] = found; -#ifdef SCI_SIMPLE_SAID_DEBUG - if (found > -1) - sciprintf(" %d <\n", found >> 1); -#endif - - // search forward - found = -1; - searchmask = _related_words[type][1]; - if (searchmask) { - for (j = i + 1; j < length; j++) - if (nodes[j << 1].type & searchmask) { - found = j << 1; - break; - } - } -#ifdef SCI_SIMPLE_SAID_DEBUG - if (found > -1) - sciprintf(" > %d\n", found >> 1); -#endif - } else { -#ifdef SCI_SIMPLE_SAID_DEBUG - sciprintf("#%d: Untypified word\n", i); /* Weird, but not fatal */ -#endif - nodes[pos + 1].content.branches[0] = -1; - nodes[pos + 1].content.branches[1] = -1; - } - } -#ifdef SCI_SIMPLE_SAID_DEBUG - sciprintf("/Semantic references.\n"); -#endif - - return 0; -} -#endif - bool vocab_tokenize_string(ResultWordList &retval, const char *sentence, const WordMap &words, const SuffixList &suffixes, char **error) { const char *lastword = sentence; diff --git a/engines/sci/vocabulary.h b/engines/sci/vocabulary.h index d0c807aebf..041721e498 100644 --- a/engines/sci/vocabulary.h +++ b/engines/sci/vocabulary.h @@ -38,7 +38,6 @@ namespace Sci { class ResourceManager; /*#define VOCABULARY_DEBUG */ -/*#define SCI_SIMPLE_SAID_CODE */ /* Whether the simplified Said() matching should be used */ /*#define SCI_SIMPLE_SAID_DEBUG */ /* uncomment to enable simple said debugging */ |