aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/include
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/include')
-rw-r--r--engines/sci/include/console.h12
-rw-r--r--engines/sci/include/engine.h33
-rw-r--r--engines/sci/include/event.h4
-rw-r--r--engines/sci/include/kdebug.h7
-rw-r--r--engines/sci/include/kernel.h58
-rw-r--r--engines/sci/include/menubar.h10
-rw-r--r--engines/sci/include/sci_widgets.h24
-rw-r--r--engines/sci/include/script.h5
-rw-r--r--engines/sci/include/uinput.h2
-rw-r--r--engines/sci/include/versions.h12
-rw-r--r--engines/sci/include/vm.h174
-rw-r--r--engines/sci/include/vm_types.h2
-rw-r--r--engines/sci/include/vocabulary.h10
13 files changed, 147 insertions, 206 deletions
diff --git a/engines/sci/include/console.h b/engines/sci/include/console.h
index 9dd998cde6..4bba2edc23 100644
--- a/engines/sci/include/console.h
+++ b/engines/sci/include/console.h
@@ -51,8 +51,6 @@ extern FILE *con_file;
** directly to the con_file variable.
*/
-struct _state; /* state_t later on */
-
typedef union {
int32 val;
char *str;
@@ -65,7 +63,7 @@ extern unsigned int cmd_paramlength;
extern cmd_param_t *cmd_params;
/* The parameters passed to a function called by the parser */
-extern struct _state *con_gamestate;
+extern struct EngineState *con_gamestate;
/* The game state as used by some of the console commands */
@@ -101,16 +99,16 @@ con_init(void);
void
-con_parse(struct _state *s, const char *command);
+con_parse(EngineState *s, const char *command);
/* Parses a command and summons appropriate facilities to handle it
-** Parameters: (state_t *) s: The state_t to use
+** Parameters: (EngineState *) s: The EngineState to use
** command: The command to execute
** Returns : (void)
*/
int
-con_hook_command(int command(struct _state *s), const char *name, const char *param, const char *description);
+con_hook_command(int command(EngineState *s), const char *name, const char *param, const char *description);
/* Adds a command to the parser's command list
** Parameters: command: The command to add
** name: The command's name
@@ -121,7 +119,7 @@ con_hook_command(int command(struct _state *s), const char *name, const char *pa
** 'name' already being in use.
** A valid param string is either empty (no parameters allowed)
** or contains one of the following tokens:
-** ! Special token: state_t* must be set for this function to be called
+** ! Special token: EngineState* must be set for this function to be called
** i (an int)
** s (a 'string' (char *))
** h (a byte, described in hexadecimal digits)
diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h
index 8c3458c75f..b79cb7498d 100644
--- a/engines/sci/include/engine.h
+++ b/engines/sci/include/engine.h
@@ -77,7 +77,7 @@ namespace Sci {
#define MAX_SAVE_DIR_SIZE MAX_HOMEDIR_SIZE + STRLEN_FREESCI_GAMEDIR + MAX_GAMEDIR_SIZE + 4
/* +4 for the three slashes and trailing \0 */
-/* values for state_t.restarting_flag */
+/* values for EngineState.restarting_flag */
#define SCI_GAME_IS_NOT_RESTARTING 0
#define SCI_GAME_WAS_RESTARTED 1
#define SCI_GAME_IS_RESTARTING_NOW 2
@@ -98,7 +98,7 @@ struct SavegameMetadata {
int savegame_time;
};
-typedef struct _state {
+struct EngineState {
int savegame_version;
int widget_serial_counter; /* Used for savegames */
@@ -275,54 +275,47 @@ typedef struct _state {
/* Backwards compatibility crap */
int port_ID;
- struct _state *successor; /* Successor of this state: Used for restoring */
-
-} state_t;
+ EngineState *successor; /* Successor of this state: Used for restoring */
+};
#define STATE_T_DEFINED
-int
-gamestate_save(state_t *s, Common::WriteStream *save, const char *savename);
+int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename);
/* Saves a game state to the hard disk in a portable way
-** Parameters: (state_t *) s: The state to save
+** Parameters: (EngineState *) s: The state to save
** (WriteStream *) save: The stream to save to
** (char *) savename: The description of the savegame
** Returns : (int) 0 on success, 1 otherwise
*/
-state_t *
-gamestate_restore(state_t *s, Common::SeekableReadStream *save);
+EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *save);
/* Restores a game state from a directory
-** Parameters: (state_t *) s: An older state from the same game
+** Parameters: (EngineState *) s: An older state from the same game
** (char *) dirname: The subdirectory to restore from
-** Returns : (state_t *) NULL on failure, a pointer to a valid state_t otherwise
+** Returns : (EngineState *) NULL on failure, a pointer to a valid EngineState otherwise
*/
bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* meta);
/* Read the header from a savegame
*/
-gfx_pixmap_color_t *
-get_pic_color(state_t *s, int color);
+gfx_pixmap_color_t *get_pic_color(EngineState *s, int color);
/* Retrieves the gfx_pixmap_color_t associated with a game color index
-** Parameters: (state_t *) s: The game state
+** Parameters: (EngineState *) s: The game state
** (int) color: The color to look up
** Returns : (gfx_pixmap_color_t *) The requested color.
*/
-void
-other_libs_exit(void);
+void other_libs_exit(void);
/* Called directly before FreeSCI ends to allow libraries to clean up
*/
-static inline
-reg_t not_register(state_t *s, reg_t r) {
+static inline reg_t not_register(EngineState *s, reg_t r) {
if (s->version >= SCI_VERSION_FTU_INVERSE_CANBEHERE)
return make_reg(0, !r.offset);
else
return r;
-
}
} // End of namespace Sci
diff --git a/engines/sci/include/event.h b/engines/sci/include/event.h
index dc4bc6a83a..49480d92fa 100644
--- a/engines/sci/include/event.h
+++ b/engines/sci/include/event.h
@@ -30,9 +30,7 @@
namespace Sci {
-struct _state;
-
-sci_event_t getEvent(struct _state *s);
+sci_event_t getEvent(EngineState *s);
/* Returns the next SCI_EV_* event
** Parameters: (struct state *) Current game state
** Returns : (sci_event_t) The next event, which may be any of the
diff --git a/engines/sci/include/kdebug.h b/engines/sci/include/kdebug.h
index 92a5511706..e830965b7b 100644
--- a/engines/sci/include/kdebug.h
+++ b/engines/sci/include/kdebug.h
@@ -30,7 +30,6 @@
namespace Sci {
-struct _state;
#define SCIk_DEBUG_MODES 17
#define SCIkERROR_NR -2
@@ -80,14 +79,14 @@ struct _state;
/* Internal functions */
-void _SCIkdebug(struct _state *s, const char *file, int line, int area, const char *format, ...);
-void _SCIGNUkdebug(const char *funcname, struct _state *s, const char *file, int line, int area, const char *format, ...);
+void _SCIkdebug(EngineState *s, const char *file, int line, int area, const char *format, ...);
+void _SCIGNUkdebug(const char *funcname, EngineState *s, const char *file, int line, int area, const char *format, ...);
/* If mode=1, enables debugging for specified areas. If mode=0, disables
** debugging for specified areas.
** Valid area characters: ulgcmfbad
*/
-void set_debug_mode(struct _state *s, int mode, const char *areas);
+void set_debug_mode(EngineState *s, int mode, const char *areas);
extern int sci_debug_flags;
diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h
index 21a7e7b79b..332e12fd9f 100644
--- a/engines/sci/include/kernel.h
+++ b/engines/sci/include/kernel.h
@@ -85,19 +85,19 @@ typedef struct {
*/
-reg_t read_selector(struct _state *s, reg_t object, selector_t selector_id, const char *fname, int line);
-void write_selector(struct _state *s, reg_t object, selector_t selector_id, reg_t value,
+reg_t read_selector(EngineState *s, reg_t object, selector_t selector_id, const char *fname, int line);
+void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t value,
const char *fname, int line);
-int invoke_selector(struct _state *s, reg_t object, int selector_id, int noinvalid, int kfunct,
+int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct,
stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...);
/******************** Text functionality ********************/
-char *kernel_lookup_text(struct _state *s, reg_t address, int index);
+char *kernel_lookup_text(EngineState *s, reg_t address, int index);
/* Looks up text referenced by scripts
-** Parameters: (state_t *s): The current state
+** Parameters: (EngineState *s): The current state
** (reg_t) address: The address to look up
** (int) index: The relative index
** Returns : (char *): The referenced text, or NULL on error.
@@ -131,9 +131,9 @@ char *kernel_lookup_text(struct _state *s, reg_t address, int index);
#endif /* !SCI_KERNEL_DEBUG */
-bool is_object(struct _state *s, reg_t obj);
+bool is_object(EngineState *s, reg_t obj);
/* Checks whether a heap address contains an object
-** Parameters: (state_t *) s: The current state
+** Parameters: (EngineState *) s: The current state
** (reg_t) obj: The address to check
** Returns : (int) 1 if it is an object, 0 otherwise
*/
@@ -155,11 +155,11 @@ bool is_object(struct _state *s, reg_t obj);
#define SKPV_OR_ALT(x,a) KP_SINT(KP_ALT(x, make_reg(0, a)))
#define UKPV_OR_ALT(x,a) KP_UINT(KP_ALT(x, make_reg(0, a)))
-reg_t *kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries);
-byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entries);
+reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries);
+byte *kernel_dereference_bulk_pointer(EngineState *s, reg_t pointer, int entries);
#define kernel_dereference_char_pointer(state, pointer, entries) (char*)kernel_dereference_bulk_pointer(state, pointer, entries)
/* Dereferences a heap pointer
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (reg_t ) pointer: The pointer to dereference
** (int) entries: The number of values expected (for checking)
** (use 0 for strings)
@@ -180,9 +180,9 @@ byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entri
-int kernel_oops(struct _state *s, const char *file, int line, const char *reason);
+int kernel_oops(EngineState *s, const char *file, int line, const char *reason);
/* Halts script execution and informs the user about an internal kernel error or failed assertion
-** Paramters: (state_t *) s: The state to use
+** Paramters: (EngineState *) s: The state to use
** (const char *) file: The file the oops occured in
** (int) line: The line the oops occured in
** (const char *) reason: Reason for the kernel oops
@@ -193,20 +193,18 @@ int kernel_oops(struct _state *s, const char *file, int line, const char *reason
/******************** Priority macros/functions ********************/
-struct _state;
-
extern int sci01_priority_table_flags; /* 1: delete, 2: print */
-int _find_priority_band(struct _state *s, int band);
+int _find_priority_band(EngineState *s, int band);
/* Finds the position of the priority band specified
-** Parameters: (state_t *) s: State to search in
+** Parameters: (EngineState *) s: State to search in
** (int) band: Band to look for
** Returns : (int) Offset at which the band starts
*/
-int _find_view_priority(struct _state *s, int y);
+int _find_view_priority(EngineState *s, int y);
/* Does the opposite of _find_priority_band
-** Parameters: (state_t *) s: State
+** Parameters: (EngineState *) s: State
** (int) y: Coordinate to check
** Returns : (int) The priority band y belongs to
*/
@@ -232,16 +230,16 @@ int _find_view_priority(struct _state *s, int y);
/******************** Dynamic view list functions ********************/
-abs_rect_t set_base(struct _state *s, reg_t object);
+abs_rect_t set_base(EngineState *s, reg_t object);
/* Determines the base rectangle of the specified view object
-** Parameters: (state_t *) s: The state to use
+** Parameters: (EngineState *) s: The state to use
** (reg_t) object: The object to set
** Returns : (abs_rect) The absolute base rectangle
*/
-extern abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip);
+extern abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip);
/* Determines the now-seen rectangle of a view object
-** Parameters: (state_t *) s: The state to use
+** Parameters: (EngineState *) s: The state to use
** (reg_t) object: The object to check
** (byte) clip: Flag to determine wheter priority band
** clipping should be performed
@@ -249,9 +247,9 @@ extern abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip);
** now-seen area.
*/
-void _k_dyn_view_list_prepare_change(struct _state *s);
+void _k_dyn_view_list_prepare_change(EngineState *s);
/* Removes all views in anticipation of a new window or text */
-void _k_dyn_view_list_accept_change(struct _state *s);
+void _k_dyn_view_list_accept_change(EngineState *s);
/* Redraws all views after a new window or text was added */
@@ -259,14 +257,14 @@ void _k_dyn_view_list_accept_change(struct _state *s);
/******************** Misc functions ********************/
-void process_sound_events(struct _state *s); /* Get all sound events, apply their changes to the heap */
+void process_sound_events(EngineState *s); /* Get all sound events, apply their changes to the heap */
#define LOOKUP_NODE(addr) lookup_node(s, (addr), __FILE__, __LINE__)
#define LOOKUP_LIST(addr) lookup_list(s, addr, __FILE__, __LINE__)
-node_t *lookup_node(struct _state *s, reg_t addr, const char *file, int line);
+node_t *lookup_node(EngineState *s, reg_t addr, const char *file, int line);
/* Resolves an address into a list node
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (reg_t) addr: The address to resolve
** (const char *) file: The file the function was called from
** (int) line: The line number the function was called from
@@ -274,9 +272,9 @@ node_t *lookup_node(struct _state *s, reg_t addr, const char *file, int line);
*/
-list_t *lookup_list(struct _state *s, reg_t addr, const char *file, int line);
+list_t *lookup_list(EngineState *s, reg_t addr, const char *file, int line);
/* Resolves a list pointer to a list
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (reg_t) addr: The address to resolve
** (const char *) file: The file the function was called from
** (int) line: The line number the function was called from
@@ -327,7 +325,7 @@ list_t *lookup_list(struct _state *s, reg_t addr, const char *file, int line);
/******************** Kernel functions ********************/
/* Generic description: */
-typedef reg_t kfunct(struct _state *s, int funct_nr, int argc, reg_t *argv);
+typedef reg_t kfunct(EngineState *s, int funct_nr, int argc, reg_t *argv);
#define FREESCI_KFUNCT_GLUTTON 1
diff --git a/engines/sci/include/menubar.h b/engines/sci/include/menubar.h
index 0fec648e6d..4fed274891 100644
--- a/engines/sci/include/menubar.h
+++ b/engines/sci/include/menubar.h
@@ -33,8 +33,6 @@
namespace Sci {
-struct _state;
-
#define MENU_FREESCI_BLATANT_PLUG 0xfff0
/* This adds an "About FreeSCI" menu option to the first menu */
@@ -168,7 +166,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr
int
-menubar_set_attribute(struct _state *s, int menu, int item, int attribute, reg_t value);
+menubar_set_attribute(EngineState *s, int menu, int item, int attribute, reg_t value);
/* Sets the (currently unidentified) foo and bar values.
** Parameters: (state_t *) s: The current state
** (int) menu: The menu number to edit
@@ -180,7 +178,7 @@ menubar_set_attribute(struct _state *s, int menu, int item, int attribute, reg_t
reg_t
-menubar_get_attribute(struct _state *s, int menu, int item, int attribute);
+menubar_get_attribute(EngineState *s, int menu, int item, int attribute);
/* Sets the (currently unidentified) foo and bar values.
** Parameters: (state_t *) s: The current state
** (int) menu: The menu number
@@ -191,7 +189,7 @@ menubar_get_attribute(struct _state *s, int menu, int item, int attribute);
int
-menubar_item_valid(struct _state *s, int menu, int item);
+menubar_item_valid(EngineState *s, int menu, int item);
/* Determines whether the specified menu entry may be activated
** Parameters: (state_t *) s: The current state
** (int x int) (menu, item): The menu item to check
@@ -200,7 +198,7 @@ menubar_item_valid(struct _state *s, int menu, int item);
int
-menubar_map_pointer(struct _state *s, int *menu_nr, int *item_nr, gfxw_port_t *port);
+menubar_map_pointer(EngineState *s, int *menu_nr, int *item_nr, gfxw_port_t *port);
/* Maps the pointer position to a (menu,item) tuple.
** Parameters: (state_t *) s: The current state
** ((int *) x (int *)) (menu_nr, item_nr): Pointers to the current menu/item tuple
diff --git a/engines/sci/include/sci_widgets.h b/engines/sci/include/sci_widgets.h
index d9cbbefd63..5a8d8b7c93 100644
--- a/engines/sci/include/sci_widgets.h
+++ b/engines/sci/include/sci_widgets.h
@@ -61,20 +61,20 @@ namespace Sci {
#define CONTROL_STATE_ENABLED 0x0001
void
-sciw_set_status_bar(state_t *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor);
+sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor);
/* Sets the contents of a port used as status bar
-** Parmeters: (state_t *) s: The affected game state
+** Parmeters: (EngineState *) s: The affected game state
** (gfxw_port_t *) status_bar: The status bar port
** (char *) text: The text to draw
** Returns : (void)
*/
gfxw_port_t *
-sciw_new_window(state_t *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
+sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
int title_font, gfx_color_t title_color, gfx_color_t title_bg_color,
const char *title, int flags);
/* Creates a new SCI style window
-** Parameters: (state_t *) s: The affected game state
+** Parameters: (EngineState *) s: The affected game state
** (rect_t) area: The screen area to frame (not including a potential window title)
** (int) font: Default font number to use
** (gfx_color_t) color: The foreground color to use for drawing
@@ -169,9 +169,9 @@ sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, cha
/*---------------------*/
void
-sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection);
+sciw_set_menubar(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection);
/* Draws the menu bar
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (gfxw_port_t *) status_bar: The status bar port to modify
** (menubar_t *) menubar: The menu bar to use
** (int) selection: Number of the menu to hightlight, or -1 for 'none'
@@ -179,9 +179,9 @@ sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int se
*/
gfxw_port_t *
-sciw_new_menu(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection);
+sciw_new_menu(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection);
/* Creates a menu port
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (gfxw_port_t *) status_bar: The status bar
** (menubar_t *) menubar: The menu bar to use
** (int) selection: Number of the menu to interpret
@@ -189,9 +189,9 @@ sciw_new_menu(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selec
*/
gfxw_port_t *
-sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection);
+sciw_unselect_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection);
/* Unselects a previously selected item from a menu port
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (gfxw_port_t *) menu_port: The port modify
** (menu_t *) menu: The menu the menu port corresponds to
** (int) selection: Number of the menu entry to unselect, or -1 to do a NOP
@@ -199,9 +199,9 @@ sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selecti
*/
gfxw_port_t *
-sciw_select_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection);
+sciw_select_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection);
/* Selects a menu item from a menu port
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (gfxw_port_t *) menu_port: The port modify
** (menu_t *) menu: The menu the menu port corresponds to
** (int) selection: Number of the menu entry to select, or -1 to do a NOP
diff --git a/engines/sci/include/script.h b/engines/sci/include/script.h
index ad1e976914..00effd22a9 100644
--- a/engines/sci/include/script.h
+++ b/engines/sci/include/script.h
@@ -208,15 +208,14 @@ extern opcode_format formats[128][4];
void script_adjust_opcode_formats(int res_version);
int
-script_find_selector(struct _state *s, const char *selector_name);
+script_find_selector(EngineState *s, const char *selector_name);
/* Determines the selector ID of a selector by its name
** Parameters: (state_t *) s: VM state
** (char *) selector_name: Name of the selector to look up
** Returns : (int) The appropriate selector ID, or -1 on error
*/
-struct _state;
-void script_free_breakpoints(struct _state *s);
+void script_free_breakpoints(EngineState *s);
} // End of namespace Sci
diff --git a/engines/sci/include/uinput.h b/engines/sci/include/uinput.h
index 30b39ef9f5..3b2f21a2c3 100644
--- a/engines/sci/include/uinput.h
+++ b/engines/sci/include/uinput.h
@@ -34,8 +34,6 @@
namespace Sci {
-struct _state;
-
#define SCI_INPUT_DEFAULT_CLOCKTIME 100000
#define SCI_INPUT_DEFAULT_REDRAWTIME 30000
diff --git a/engines/sci/include/versions.h b/engines/sci/include/versions.h
index 1b5de640f5..dfcea5ede1 100644
--- a/engines/sci/include/versions.h
+++ b/engines/sci/include/versions.h
@@ -32,8 +32,6 @@
namespace Sci {
-struct _state;
-
#define SCI_VERSION(_major_, _minor_, _patchlevel_) (((_major_)<<20) | ((_minor_)<<10) | _patchlevel_)
/* This allows version numbers to be compared directly */
@@ -125,19 +123,19 @@ struct _state;
typedef int sci_version_t;
-struct _state;
+struct EngineState;
void
-version_require_earlier_than(struct _state *s, sci_version_t version);
+version_require_earlier_than(EngineState *s, sci_version_t version);
/* Function used in autodetection
-** Parameters: (state_t *) s: state_t containing the version
+** Parameters: (EngineState *) s: EngineState containing the version
** (sci_version_t) version: The version that we're earlier than
*/
void
-version_require_later_than(struct _state *s, sci_version_t version);
+version_require_later_than(EngineState *s, sci_version_t version);
/* Function used in autodetection (read this function "version_require_later_than_or_equal_to")
-** Parameters: (state_t *) s: state_t containing the version
+** Parameters: (EngineState *) s: EngineState containing the version
** (sci_version_t) version: The version that we're later than
*/
diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h
index fa404e701c..a6e169a1d6 100644
--- a/engines/sci/include/vm.h
+++ b/engines/sci/include/vm.h
@@ -446,17 +446,16 @@ extern int _debug_seeking;
extern int _debug_step_running;
-typedef int kernel_function(struct _state* s);
+typedef int kernel_function(struct EngineState *s);
extern kernel_function* kfuncs[];
extern int max_instance;
/*inline*/
-exec_stack_t *
-execute_method(struct _state *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj,
+exec_stack_t *execute_method(EngineState *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj,
word argc, stack_ptr_t argp);
/* Executes function pubfunct of the specified script.
-** Parameters: (state_t *) s: The state which is to be executed with
+** Parameters: (EngineState *) s: The state which is to be executed with
** (word) script: The script which is called
** (word) pubfunct: The exported script function which is to be called
** (stack_ptr_t) sp: Stack pointer position
@@ -467,11 +466,10 @@ execute_method(struct _state *s, word script, word pubfunct, stack_ptr_t sp, reg
*/
-exec_stack_t *
-send_selector(struct _state *s, reg_t send_obj, reg_t work_obj,
+exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj,
stack_ptr_t sp, int framesize, stack_ptr_t argp);
/* Executes a "send" or related operation to a selector
-** Parameters: (state_t *) s: The state_t to operate on
+** Parameters: (EngineState *) s: The EngineState to operate on
** (reg_t) send_obj: Heap address of the object to send to
** (reg_t) work_obj: Heap address of the object initiating the send
** (stack_ptr_t) sp: Stack pointer position
@@ -486,12 +484,11 @@ send_selector(struct _state *s, reg_t send_obj, reg_t work_obj,
#define SCI_XS_CALLEE_LOCALS -1
-exec_stack_t *
-add_exec_stack_entry(struct _state *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc,
+exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc,
stack_ptr_t argp, selector_t selector, reg_t sendp, int origin,
seg_id_t local_segment);
/* Adds an entry to the top of the execution stack
-** Parameters: (state_t *) s: The state with which to execute
+** Parameters: (EngineState *) s: The state with which to execute
** (reg_t) pc: The initial program counter
** (stack_ptr_t) sp: The initial stack pointer
** (reg_t) objp: Pointer to the beginning of the current object
@@ -509,11 +506,10 @@ add_exec_stack_entry(struct _state *s, reg_t pc, stack_ptr_t sp, reg_t objp, int
*/
-exec_stack_t *
-add_exec_stack_varselector(struct _state *s, reg_t objp, int argc, stack_ptr_t argp,
+exec_stack_t *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, stack_ptr_t argp,
selector_t selector, reg_t *address, int origin);
/* Adds one varselector access to the execution stack
-** Parameters: (state_t *) s: The state_t to use
+** Parameters: (EngineState *) s: The EngineState to use
** (reg_t) objp: Pointer to the object owning the selector
** (int) argc: 1 for writing, 0 for reading
** (stack_ptr_t) argp: Pointer to the address of the data to write -2
@@ -525,33 +521,30 @@ add_exec_stack_varselector(struct _state *s, reg_t objp, int argc, stack_ptr_t a
*/
-void
-run_vm(struct _state *s, int restoring);
+void run_vm(EngineState *s, int restoring);
/* Executes the code on s->heap[pc] until it hits a 'ret' operation while (stack_base == stack_pos)
-** Parameters: (state_t *) s: The state to use
+** Parameters: (EngineState *) s: The state to use
** (int) restoring: 1 if s has just been restored, 0 otherwise
** Returns : (void)
** This function will execute SCI bytecode. It requires s to be set up
** correctly.
*/
-void
-vm_handle_fatal_error(struct _state *s, int line, const char *file);
+void vm_handle_fatal_error(EngineState *s, int line, const char *file);
/* Handles a fatal error condition
-** Parameters: (state_t *) s: The state to recover from
+** Parameters: (EngineState *) s: The state to recover from
** (int) line: Source code line number the error occured in
** (const char *) file: File the error occured in
*/
-void
-script_debug(struct _state *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp,
+void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp,
int *restadjust,
seg_id_t *segids, reg_t **variables, reg_t **variables_base,
int *variables_nr,
int bp);
/* Debugger functionality
-** Parameters: (state_t *) s: The state at which debugging should take place
+** Parameters: (EngineState *) s: The state at which debugging should take place
** (reg_t *) pc: Pointer to the program counter
** (stack_ptr_t *) sp: Pointer to the stack pointer
** (stack_ptr_t *) pp: Pointer to the frame pointer
@@ -566,42 +559,37 @@ script_debug(struct _state *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_
** Returns : (void)
*/
-int
-script_init_engine(struct _state *s, sci_version_t version);
-/* Initializes a state_t block
-** Parameters: (state_t *) s: The state to initialize
+int script_init_engine(EngineState *s, sci_version_t version);
+/* Initializes a EngineState block
+** Parameters: (EngineState *) s: The state to initialize
** Returns : 0 on success, 1 if vocab.996 (the class table) is missing or corrupted
*/
-void
-script_set_gamestate_save_dir(struct _state *s, const char *path);
+void script_set_gamestate_save_dir(EngineState *s, const char *path);
/* Sets the gamestate's save_dir to the parameter path
-** Parameters: (state_t *) s: The state to set
+** Parameters: (EngineState *) s: The state to set
** (const char *) path: Path where save_dir will point to
** Returns : (void)
*/
-void
-script_free_engine(struct _state *s);
-/* Frees all additional memory associated with a state_t block
-** Parameters: (state_t *) s: The state_t whose elements should be cleared
+void script_free_engine(EngineState *s);
+/* Frees all additional memory associated with a EngineState block
+** Parameters: (EngineState *) s: The EngineState whose elements should be cleared
** Returns : (void)
*/
-void
-script_free_vm_memory(struct _state *s);
+void script_free_vm_memory(EngineState *s);
/* Frees all script memory (heap, hunk, and class tables).
-** Parameters: (state_t *) s: The state_t to free
+** Parameters: (EngineState *) s: The EngineState to free
** Returns : (void)
** This operation is implicit in script_free_engine(), but is required for restoring
** the game state.
*/
-int
-lookup_selector(struct _state *s, reg_t obj, selector_t selectorid, reg_t **vptr, reg_t *fptr);
+int lookup_selector(EngineState *s, reg_t obj, selector_t selectorid, reg_t **vptr, reg_t *fptr);
/* Looks up a selector and returns its type and value
-** Parameters: (state_t *) s: The state_t to use
+** Parameters: (EngineState *) s: The EngineState to use
** (reg_t) obj: Address of the object to look the selector up in
** (selector_t) selectorid: The selector to look up
** Returns : (int) SELECTOR_NONE if the selector was not found in the object or its superclasses.
@@ -620,27 +608,24 @@ lookup_selector(struct _state *s, reg_t obj, selector_t selectorid, reg_t **vptr
#define SCRIPT_GET_LOAD 1 /* Load, if neccessary */
#define SCRIPT_GET_LOCK 3 /* Load, if neccessary, and lock */
-seg_id_t
-script_get_segment(struct _state *s, int script_id, int load);
+seg_id_t script_get_segment(EngineState *s, int script_id, int load);
/* Determines the segment occupied by a certain script
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (int) script_id: The script in question
** (int) load: One of SCRIPT_GET_*
** Returns : The script's segment, or 0 on failure
*/
-reg_t
-script_lookup_export(struct _state *s, int script_nr, int export_index);
+reg_t script_lookup_export(EngineState *s, int script_nr, int export_index);
/* Looks up an entry of the exports table of a script
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (int) script_nr: The script to look up in
** Returns : (int) export_index: index of the export entry to look up
*/
-int
-script_instantiate(struct _state *s, int script_nr);
+int script_instantiate(EngineState *s, int script_nr);
/* Makes sure that a script and its superclasses get loaded to the heap
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (int) script_nr: The script number to load
** Returns : (int) The script's segment ID or 0 if out of heap
** If the script already has been loaded, only the number of lockers is increased.
@@ -650,10 +635,9 @@ script_instantiate(struct _state *s, int script_nr);
*/
-void
-script_uninstantiate(struct _state *s, int script_nr);
+void script_uninstantiate(EngineState *s, int script_nr);
/* Decreases the numer of lockers of a script and unloads it if that number reaches zero
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** (int) script_nr: The script number that is requestet to be unloaded
** Returns : (void)
** This function will recursively unload scripts containing its superclasses, if those
@@ -661,46 +645,41 @@ script_uninstantiate(struct _state *s, int script_nr);
*/
-int
-game_save_state(struct _state *s, char *name, int coredump);
+int game_save_state(EngineState *s, char *name, int coredump);
/* Saves the game state to the harddisk
-** Parameters: (state_t *) s: The game state to save
+** 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
*/
-struct _state *
- game_restore_state(char *name);
+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 : (state_t *): The restored game state, or NULL on failure
+** Returns : (EngineState *): The restored game state, or NULL on failure
*/
-int
-game_init(struct _state *s);
+int game_init(EngineState *s);
/* Initializes an SCI game
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** Returns : (int): 0 on success, 1 if an error occured.
** This function must be run before script_run() is executed.
** Graphics data is initialized iff s->gfx_state != NULL.
*/
-int
-game_init_graphics(struct _state *s);
+int game_init_graphics(EngineState *s);
/* Initializes the graphics part of an SCI game
-** Parameters: (state_t *) s: The state to initialize the graphics in
+** Parameters: (EngineState *) s: The state to initialize the graphics in
** Returns : (int) 0 on success, 1 if an error occured
** This function may only be called if game_init() did not initialize
** the graphics data.
*/
-int
-game_init_sound(struct _state *s, int sound_flags);
+int game_init_sound(EngineState *s, int sound_flags);
/* Initializes the sound part of an SCI game
-** Parameters: (state_t *) s: The state to initialize the sound in
+** Parameters: (EngineState *) s: The state to initialize the sound in
** (int) sound_flags: Flags to pass to the sound subsystem
** Returns : (int) 0 on success, 1 if an error occured
** This function may only be called if game_init() did not initialize
@@ -708,10 +687,9 @@ game_init_sound(struct _state *s, int sound_flags);
*/
-int
-game_run(struct _state **s);
+int game_run(EngineState **s);
/* Runs an SCI game
-** Parameters: (state_t **) s: Pointer to the pointer of the state to operate on
+** Parameters: (EngineState **) s: Pointer to the pointer of the state to operate on
** Returns : (int): 0 on success, 1 if an error occured.
** This is the main function for SCI games. It takes a valid state, loads script 0 to it,
** finds the game object, allocates a stack, and runs the init method of the game object.
@@ -719,94 +697,83 @@ game_run(struct _state **s);
** By the way, *s may be changed during the game, e.g. if a game state is restored.
*/
-int
-game_restore(struct _state **s, char *savegame_name);
+int game_restore(EngineState **s, char *savegame_name);
/* Restores an SCI game state and runs the game
-** Parameters: (state_t **) s: Pointer to the pointer of the state to operate on
+** Parameters: (EngineState **) s: Pointer to the pointer of the state to operate on
** (char *) savegame_name: Name of the savegame to restore
** Returns : (int): 0 on success, 1 if an error occured.
** This restores a savegame; otherwise, it behaves just like game_run().
*/
-int
-game_exit(struct _state *s);
+int game_exit(EngineState *s);
/* Uninitializes an initialized SCI game
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** Returns : (int): 0 on success, 1 if an error occured.
** This function should be run after each script_run() call.
*/
-void
-quit_vm(void);
+void quit_vm(void);
/* Instructs the virtual machine to abort
** Paramteres: (void)
** Returns : (void)
*/
-void
-script_map_selectors(struct _state *s, selector_map_t *map);
+void script_map_selectors(EngineState *s, selector_map_t *map);
/* Maps special selectors
-** Parameters: (state_t *) s: The state from which the selector information should be taken
+** Parameters: (EngineState *) s: The state from which the selector information should be taken
** (selector_map_t *) map: Pointer to the selector map to map
** Returns : (void)
** Called by script_run();
*/
-int
-script_map_kernel(struct _state *s);
+int script_map_kernel(EngineState *s);
/* Maps kernel functions
-** Parameters: (state_t *) s: The state which the kernel_names are retrieved from
+** Parameters: (EngineState *) s: The state which the kernel_names are retrieved from
** Returns : (void)
** This function reads from and writes to s. It is called by script_run().
*/
-void
-script_detect_versions(struct _state *s);
+void script_detect_versions(EngineState *s);
/* Detects SCI versions by their different script header
-** Parameters: (state_t *) s: The state to operate on
+** Parameters: (EngineState *) s: The state to operate on
** Returns : (void)
*/
-reg_t
-kalloc(struct _state *s, const char *type, int space);
+reg_t kalloc(EngineState *s, const char *type, int space);
/* Allocates "kernel" memory and returns a handle suitable to be passed on to SCI scripts
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (const char *) type: A free-form type description string (static)
** (int) space: The space to allocate
** Returns : (reg_t) The handle
*/
-int
-has_kernel_function(struct _state *s, const char *kname);
+int has_kernel_function(EngineState *s, const char *kname);
/* Detects whether a particular kernel function is required in the game
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (const char *) kname: The name of the desired kernel function
** Returns : (int) 1 if the kernel function is listed in the kernel table,
** 0 otherwise
*/
-byte *
-kmem(struct _state *s, reg_t handle);
+byte *kmem(EngineState *s, reg_t handle);
/* Returns a pointer to "kernel" memory based on the handle
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (reg_t) handle: The handle to use
** Returns : (byte *) A pointer to the allocated memory
*/
-int
-kfree(struct _state *s, reg_t handle);
+int kfree(EngineState *s, reg_t handle);
/* Frees all "kernel" memory associated with a handle
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (reg_t) handle: The handle to free
** Returns : (int) 0 on success, 1 otherwise
*/
-const char *
-obj_get_name(struct _state *s, reg_t pos);
+const char *obj_get_name(EngineState *s, reg_t pos);
/* Determines the name of an object
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (reg_t) pos: Location of the object whose name we want to
** inspect
** Returns : (const char *) A name for that object, or a string describing
@@ -815,10 +782,9 @@ obj_get_name(struct _state *s, reg_t pos);
** may it be modified).
*/
-object_t *
-obj_get(struct _state *s, reg_t offset);
+object_t *obj_get(EngineState *s, reg_t offset);
/* Retreives an object from the specified location
-** Parameters: (state_t *) s: Pointer to the state_t to operate on
+** Parameters: (EngineState *) s: Pointer to the EngineState to operate on
** (reg_t) offset: The object's offset
** Returns : (object_t *) The object in question, or NULL if there is none
*/
diff --git a/engines/sci/include/vm_types.h b/engines/sci/include/vm_types.h
index 847a1f30e4..c8634ce9a3 100644
--- a/engines/sci/include/vm_types.h
+++ b/engines/sci/include/vm_types.h
@@ -35,8 +35,6 @@ namespace Sci {
typedef int seg_id_t; /* Segment ID type */
-struct _state; /* engine.h */
-
struct reg_t {
uint16 segment;
uint16 offset;
diff --git a/engines/sci/include/vocabulary.h b/engines/sci/include/vocabulary.h
index b51affc570..f890b3f4ba 100644
--- a/engines/sci/include/vocabulary.h
+++ b/engines/sci/include/vocabulary.h
@@ -372,12 +372,10 @@ vocab_dump_parse_tree(const char *tree_name, parse_tree_node_t *nodes);
-struct _state;
-
int
-said(struct _state *s, byte *spec, int verbose);
+said(EngineState *s, byte *spec, int verbose);
/* Builds a parse tree from a spec and compares it to a parse tree
-** Parameters: (state_t *) s: The affected state
+** Parameters: (EngineState *) s: The affected state
** (byte *) spec: Pointer to the spec to build
** (int) verbose: Whether to display the parse tree after building it
** Returns : (int) 1 on a match, 0 otherwise
@@ -394,9 +392,9 @@ vocab_get_any_group_word(int group, word_t **words, int words_nr);
void
-vocab_decypher_said_block(struct _state *s, byte *pos);
+vocab_decypher_said_block(EngineState *s, byte *pos);
/* Decyphers a said block and dumps its content via sciprintf.
-** Parameters: (state_t *) s: The state to use
+** Parameters: (EngineState *) s: The state to use
** (byte *) pos: Pointer to the data to dump
** For debugging only.
*/