diff options
author | Max Horn | 2009-04-24 10:43:42 +0000 |
---|---|---|
committer | Max Horn | 2009-04-24 10:43:42 +0000 |
commit | eb0710c2cd50b3ca0f156641109c503ac740a54f (patch) | |
tree | 4f4ad64ea45a56c67b29f9fb9934af794daf4445 /engines | |
parent | 486f10edaf813e19ce55812f7ab75e0b6d349fb6 (diff) | |
download | scummvm-rg350-eb0710c2cd50b3ca0f156641109c503ac740a54f.tar.gz scummvm-rg350-eb0710c2cd50b3ca0f156641109c503ac740a54f.tar.bz2 scummvm-rg350-eb0710c2cd50b3ca0f156641109c503ac740a54f.zip |
SCI: Some const corrections, removed dead stuff, cleanup
svn-id: r40101
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kernel.h | 8 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 39 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 16 | ||||
-rw-r--r-- | engines/sci/scicore/vocabulary.cpp | 10 | ||||
-rw-r--r-- | engines/sci/scicore/vocabulary.h | 8 |
6 files changed, 36 insertions, 50 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index e1da6a7851..1e49afda55 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -388,7 +388,7 @@ reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kCheckSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kRestoreGame(EngineState *s, int funct_nr, int argc, reg_t *argv); -reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kHaveMouse(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kJoystick(EngineState *s, int funct_nr, int argc, reg_t *argv); @@ -400,8 +400,8 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv); -reg_t kStrCpy(EngineState *s, int funct_nr, int argc, reg_t *argp); -reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kStrCpy(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kDrawControl(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kHiliteControl(EngineState *s, int funct_nr, int argc, reg_t *argv); @@ -411,7 +411,7 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kSetNowSeen(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kInitBresen(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv); -reg_t kBaseSetter(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kBaseSetter(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv); diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index ddaa0f30e3..c949f3ce92 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -40,26 +40,29 @@ namespace Sci { #define MAX_TEXT_WIDTH_MAGIC_VALUE 192 // Graph subfunctions -#define K_GRAPH_GET_COLORS_NR 2 -#define K_GRAPH_DRAW_LINE 4 -#define K_GRAPH_SAVE_BOX 7 -#define K_GRAPH_RESTORE_BOX 8 -#define K_GRAPH_FILL_BOX_BACKGROUND 9 -#define K_GRAPH_FILL_BOX_FOREGROUND 10 -#define K_GRAPH_FILL_BOX_ANY 11 -#define K_GRAPH_UPDATE_BOX 12 -#define K_GRAPH_REDRAW_BOX 13 -#define K_GRAPH_ADJUST_PRIORITY 14 +enum { + K_GRAPH_GET_COLORS_NR = 2, + K_GRAPH_DRAW_LINE = 4, + K_GRAPH_SAVE_BOX = 7, + K_GRAPH_RESTORE_BOX = 8, + K_GRAPH_FILL_BOX_BACKGROUND = 9, + K_GRAPH_FILL_BOX_FOREGROUND = 10, + K_GRAPH_FILL_BOX_ANY = 11, + K_GRAPH_UPDATE_BOX = 12, + K_GRAPH_REDRAW_BOX = 13, + K_GRAPH_ADJUST_PRIORITY = 14 +}; // Control types and flags -#define K_CONTROL_BUTTON 1 -#define K_CONTROL_TEXT 2 -#define K_CONTROL_EDIT 3 -#define K_CONTROL_ICON 4 -#define K_CONTROL_CONTROL 6 -#define K_CONTROL_CONTROL_ALIAS 7 -#define K_CONTROL_BOX 10 - +enum { + K_CONTROL_BUTTON = 1, + K_CONTROL_TEXT = 2, + K_CONTROL_EDIT = 3, + K_CONTROL_ICON = 4, + K_CONTROL_CONTROL = 6, + K_CONTROL_CONTROL_ALIAS = 7, + K_CONTROL_BOX = 10 +}; #define ADD_TO_CURRENT_PORT(widget) \ {if (s->port) \ diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 1af9f779ba..8b0291cc51 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -65,7 +65,6 @@ But the solution resulting from that is a lot more complicated, so we use the ab Still, what we compute in the end is of course not a real velocity anymore, but an integer approximation, used in an iterative stepping algorithm */ - reg_t kSetJump(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Input data reg_t object = argv[0]; @@ -163,7 +162,7 @@ reg_t kSetJump(EngineState *s, int funct_nr, int argc, reg_t *argv) { #define _K_BRESEN_AXIS_X 0 #define _K_BRESEN_AXIS_Y 1 -void initialize_bresen(EngineState *s, int funct_nr, int argc, reg_t *argv, reg_t mover, int step_factor, int deltax, int deltay) { +static void initialize_bresen(EngineState *s, int argc, reg_t *argv, reg_t mover, int step_factor, int deltax, int deltay) { reg_t client = GET_SEL32(mover, client); int stepx = GET_SEL32SV(client, xStep) * step_factor; int stepy = GET_SEL32SV(client, yStep) * step_factor; @@ -223,7 +222,7 @@ reg_t kInitBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { int deltax = GET_SEL32SV(mover, x) - GET_SEL32SV(client, x); int deltay = GET_SEL32SV(mover, y) - GET_SEL32SV(client, y); - initialize_bresen(s, funct_nr, argc, argv, mover, KP_UINT(KP_ALT(1, make_reg(0, 1))), deltax, deltay); + initialize_bresen(s, argc, argv, mover, KP_UINT(KP_ALT(1, make_reg(0, 1))), deltax, deltay); return s->r_acc; } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 9354ac4676..6212abf423 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -673,22 +673,6 @@ void script_uninstantiate(EngineState *s, int script_nr); */ -int game_save_state(EngineState *s, char *name, int coredump); -/* Saves the game state to the harddisk -** Parameters: (EngineState *) s: The game state to save -** (char *) name: Name of the subdirectory (relative to s->save_dir) -** (int) coredump: Set to non-zero in order to write additional debug information -** Returns : (int) 0 on success, 1 otherwise -*/ - - -EngineState *game_restore_state(char *name); -/* Restores the game state from a file -** Parameters: (char *) name: Name of the saved game state to restore -** Returns : (EngineState *): The restored game state, or NULL on failure -*/ - - int game_init(EngineState *s); /* Initializes an SCI game ** Parameters: (EngineState *) s: The state to operate on diff --git a/engines/sci/scicore/vocabulary.cpp b/engines/sci/scicore/vocabulary.cpp index d708e95563..3a55e95e5c 100644 --- a/engines/sci/scicore/vocabulary.cpp +++ b/engines/sci/scicore/vocabulary.cpp @@ -163,7 +163,7 @@ bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) { while ((seeker < resource->size - 1) && (resource->data[seeker + 1] != 0xff)) { suffix_t suffix; - suffix.alt_suffix = (char *)resource->data + seeker; + suffix.alt_suffix = (const char *)resource->data + seeker; suffix.alt_suffix_length = strlen(suffix.alt_suffix); seeker += suffix.alt_suffix_length + 1; // Hit end of string @@ -173,7 +173,7 @@ bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) { // Beginning of next string - skip leading '*' seeker++; - suffix.word_suffix = (char *)resource->data + seeker; + suffix.word_suffix = (const char *)resource->data + seeker; suffix.word_suffix_length = strlen(suffix.word_suffix); seeker += suffix.word_suffix_length + 1; @@ -230,7 +230,7 @@ bool vocab_get_branches(ResourceManager * resmgr, Common::Array<parse_tree_branc } -ResultWord vocab_lookup_word(char *word, int word_len, const WordMap &words, const SuffixList &suffixes) { +ResultWord vocab_lookup_word(const char *word, int word_len, const WordMap &words, const SuffixList &suffixes) { Common::String tempword(word, word_len); // Remove all dashes from tempword @@ -432,9 +432,9 @@ int vocab_build_simple_parse_tree(parse_tree_node_t *nodes, WordMap &words) { } #endif -bool vocab_tokenize_string(ResultWordList &retval, char *sentence, const WordMap &words, +bool vocab_tokenize_string(ResultWordList &retval, const char *sentence, const WordMap &words, const SuffixList &suffixes, char **error) { - char *lastword = sentence; + const char *lastword = sentence; int pos_in_sentence = 0; char c; int wordlen = 0; diff --git a/engines/sci/scicore/vocabulary.h b/engines/sci/scicore/vocabulary.h index a8d58c04e1..a1277d89cd 100644 --- a/engines/sci/scicore/vocabulary.h +++ b/engines/sci/scicore/vocabulary.h @@ -150,8 +150,8 @@ struct suffix_t { int alt_suffix_length; /* String length of the suffix */ int word_suffix_length; /* String length of the other suffix */ - char *alt_suffix; /* The alternative suffix */ - char *word_suffix; /* The suffix as used in the word vocabulary */ + const char *alt_suffix; /* The alternative suffix */ + const char *word_suffix; /* The suffix as used in the word vocabulary */ }; @@ -251,7 +251,7 @@ void vocab_free_suffixes(ResourceManager *resmgr, SuffixList &suffixes); */ bool vocab_get_branches(ResourceManager *resmgr, Common::Array<parse_tree_branch_t> &branches); -ResultWord vocab_lookup_word(char *word, int word_len, +ResultWord vocab_lookup_word(const char *word, int word_len, const WordMap &words, const SuffixList &suffixes); /* Looks up a single word in the words and suffixes list ** Parameters: (char *) word: Pointer to the word to look up @@ -262,7 +262,7 @@ ResultWord vocab_lookup_word(char *word, int word_len, */ -bool vocab_tokenize_string(ResultWordList &retval, char *sentence, +bool vocab_tokenize_string(ResultWordList &retval, const char *sentence, const WordMap &words, const SuffixList &suffixes, char **error); /* Tokenizes a string and compiles it into word_ts. ** Parameters: (char *) sentence: The sentence to examine |