diff options
Diffstat (limited to 'engines/sci')
48 files changed, 353 insertions, 356 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 9be70390ce..870f27829d 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -615,8 +615,10 @@ int game_init(EngineState *s) { // Initialize send_calls buffer - if (!send_calls_allocated) - send_calls = (calls_struct_t*)sci_calloc(sizeof(calls_struct_t), send_calls_allocated = 16); + if (!send_calls_allocated) { + send_calls_allocated = 16; + send_calls = (calls_struct_t*)sci_calloc(sizeof(calls_struct_t), send_calls_allocated); + } if (s->gfx_state && _reset_graphics_input(s)) return 1; diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index 5cca5bd34e..0a0097aad5 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -32,11 +32,11 @@ namespace Sci { //#define DEBUG_GC //#define DEBUG_GC_VERBOSE -typedef struct _worklist { +struct worklist_t { int used; reg_t entries[WORKLIST_CHUNK_SIZE]; - struct _worklist *next; -} worklist_t; + worklist_t *next; +}; static worklist_t *fresh_worklist(worklist_t *old) { worklist_t *retval = (worklist_t*)sci_malloc(sizeof(worklist_t)); @@ -118,10 +118,10 @@ static reg_t_hash_map * normalise_hashmap_ptrs(reg_t_hash_map *nonnormal_map, se } -typedef struct { +struct worklist_manager_t { reg_t_hash_map *nonnormal_map; worklist_t **worklist_ref; -} worklist_manager_t; +}; void add_outgoing_refs(void *pre_wm, reg_t addr) { worklist_manager_t *wm = (worklist_manager_t *) pre_wm; @@ -228,14 +228,14 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { return normal_map; } -typedef struct { +struct deallocator_t { seg_interface_t *interfce; #ifdef DEBUG_GC char *segnames[MEM_OBJ_MAX + 1]; int segcount[MEM_OBJ_MAX + 1]; #endif reg_t_hash_map *use_map; -} deallocator_t; +}; void free_unless_used(void *pre_use_map, reg_t addr) { deallocator_t *deallocator = (deallocator_t *)pre_use_map; diff --git a/engines/sci/engine/heap.h b/engines/sci/engine/heap.h index b89d03a684..bb8df540fb 100644 --- a/engines/sci/engine/heap.h +++ b/engines/sci/engine/heap.h @@ -34,12 +34,12 @@ namespace Sci { typedef uint16 heap_ptr; -typedef struct { +struct heap_t { byte *start; byte *base; unsigned int first_free; int old_ff; -} heap_t; +}; heap_t *heap_new(); /* Allocates a new heap. diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index db2deebbcd..e2cd12d7c7 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -427,10 +427,10 @@ reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, 1); // Signal success } -typedef struct { +struct sort_temp_t { reg_t key, value; reg_t order; -} sort_temp_t; +}; int sort_temp_cmp(const void *p1, const void *p2) { sort_temp_t *st1 = (sort_temp_t *)p1; diff --git a/engines/sci/engine/message.h b/engines/sci/engine/message.h index 572501c00f..759b0f4b75 100644 --- a/engines/sci/engine/message.h +++ b/engines/sci/engine/message.h @@ -27,18 +27,18 @@ namespace Sci { -typedef struct { +struct message_tuple_t { int noun; int verb; int cond; int seq; -} message_tuple_t; +}; -typedef struct { +struct index_record_cursor_t { byte *index_record; int index; byte *resource_beginning; -} index_record_cursor_t; +}; typedef int index_record_size_t(); typedef void parse_index_record_t(index_record_cursor_t *index_record, message_tuple_t *t); @@ -46,7 +46,7 @@ typedef int get_talker_t(index_record_cursor_t *cursor); typedef void get_text_t(index_record_cursor_t *cursor, char *buffer, int buffer_size); typedef int index_record_count_t(byte *header); -typedef struct { +struct message_handler_t { int version_id; parse_index_record_t *parse; get_talker_t *get_talker; @@ -55,9 +55,9 @@ typedef struct { int header_size; int index_record_size; -} message_handler_t; +}; -typedef struct { +struct message_state_t { int initialized; message_handler_t *handler; ResourceManager *resmgr; @@ -66,7 +66,7 @@ typedef struct { int record_count; byte *index_records; index_record_cursor_t engine_cursor; -} message_state_t; +}; int message_get_specific(message_state_t *state, message_tuple_t *t); int message_get_next(message_state_t *state); diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index 6bd7ca9b70..f710619457 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -51,21 +51,21 @@ static int c_selectornames(EngineState *s); // Displays all selector names static int c_kernelnames(EngineState *s); // Displays all kernel function names static int c_dissectscript(EngineState *s); // Splits a script into objects and explains them -typedef struct { +struct cmd_mm_entry_t { const char *name; const char *description; -} cmd_mm_entry_t; // All later structures must "extend" this +}; // All later structures must "extend" this typedef cmd_mm_entry_t cmd_page_t; // Simple info page -typedef struct { +struct cmd_command_t { const char *name; const char *description; int (*command)(EngineState *); const char *param; -} cmd_command_t; +}; -typedef struct { +struct cmd_var_t { const char *name; const char *description; union { @@ -73,19 +73,19 @@ typedef struct { char **charpp; reg_t *reg; } var; -} cmd_var_t; +}; typedef void printfunc_t(cmd_mm_entry_t *data, int full); -typedef struct { +struct cmd_mm_struct_t { const char *name; void *data; // cmd_mm_entry_t size_t size_per_entry; printfunc_t *print; int entries; // Number of used entries int allocated; // Number of allocated entries -} cmd_mm_struct_t; +}; #define CMD_MM_ENTRIES 3 // command console memory and manual page manager #define CMD_MM_DEFAULT_ALLOC 4 // Number of table entries to allocate per default diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 717042f983..4760fdf286 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -49,7 +49,7 @@ int _debug_seeking = 0; // Stepping forward until some special condition is met int _debug_seek_level = 0; // Used for seekers that want to check their exec stack depth int _debug_seek_special = 0; // Used for special seeks(1) int _weak_validations = 1; // Some validation errors are reduced to warnings if non-0 -reg_t _debug_seek_reg = NULL_REG_INITIALIZER; // Used for special seeks(2) +reg_t _debug_seek_reg = NULL_REG; // Used for special seeks(2) #define _DEBUG_SEEK_NOTHING 0 #define _DEBUG_SEEK_CALLK 1 // Step forward until callk is found @@ -338,7 +338,7 @@ static void print_obj_head(EngineState *s, object_t *obj) { static void print_list(EngineState *s, list_t *l) { reg_t pos = l->first; - reg_t my_prev = NULL_REG_INITIALIZER; + reg_t my_prev = NULL_REG; sciprintf("\t<\n"); @@ -2223,11 +2223,11 @@ static int c_listclones(EngineState *s) { return 0; } -typedef struct { +struct generic_config_flag_t { const char *name; const char option; unsigned int flag; -} generic_config_flag_t; +}; static void handle_config_update(const generic_config_flag_t *flags_list, int flags_nr, const char *subsystem, int *active_options_p, char *changestring /* or NULL to display*/) { diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 42d9dfc809..54b6a5ce97 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -452,39 +452,39 @@ byte *sm_dereference(SegManager *self, reg_t reg, int *size); // 11. Segment interface, primarily for GC -typedef struct _seg_interface { +struct seg_interface_t { SegManager *segmgr; mem_obj_t *mobj; seg_id_t seg_id; mem_obj_enum type_id; // Segment type const char *type; // String description of the segment type - reg_t (*find_canonic_address)(struct _seg_interface *self, reg_t sub_addr); + reg_t (*find_canonic_address)(seg_interface_t *self, reg_t sub_addr); // Finds the canonic address associated with sub_reg // Parameters: (reg_t) sub_addr: The base address whose canonic address is to be found // For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)). // This address "governs" a in the sense that deallocating c(a) will deallocate a. - void (*free_at_address)(struct _seg_interface *self, reg_t sub_addr); + void (*free_at_address)(seg_interface_t *self, reg_t sub_addr); // Deallocates all memory associated with the specified address // Parameters: (reg_t) sub_addr: The address (within the given segment) to deallocate - void (*list_all_deallocatable)(struct _seg_interface *self, void *param, void (*note)(void *param, reg_t addr)); + void (*list_all_deallocatable)(seg_interface_t *self, void *param, void (*note)(void *param, reg_t addr)); // Iterates over and reports all addresses within the current segment // Parameters: note : (voidptr * addr) -> (): Invoked for each address on which free_at_address() // makes sense // (void *) param: Parameter passed to 'note' - void (*list_all_outgoing_references)(struct _seg_interface *self, EngineState *s, reg_t object, void *param, void (*note)(void *param, reg_t addr)); + void (*list_all_outgoing_references)(seg_interface_t *self, EngineState *s, reg_t object, void *param, void (*note)(void *param, reg_t addr)); // Iterates over all references reachable from the specified object // Parameters: (reg_t) object: The object (within the current segment) to analyse // (void *) param: Parameter passed to 'note' // note : (voidptr * addr) -> (): Invoked for each outgoing reference within the object // Note: This function may also choose to report numbers (segment 0) as adresses - void (*deallocate_self)(struct _seg_interface *self); + void (*deallocate_self)(seg_interface_t *self); // Deallocates the segment interface -} seg_interface_t; +}; seg_interface_t *get_seg_interface(SegManager *self, seg_id_t segid); // Retrieves the segment interface to the specified segment diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 45f8954ad7..3c5b1f5393 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -57,18 +57,18 @@ extern int _weak_validations; calls_struct_t *send_calls = NULL; int send_calls_allocated = 0; int bp_flag = 0; -static reg_t _dummy_register = NULL_REG_INITIALIZER; +static reg_t _dummy_register; // validation functionality #ifndef DISABLE_VALIDATIONS -static inline reg_t *validate_property(object_t *obj, int index) { +static inline reg_t &validate_property(object_t *obj, int index) { if (!obj) { if (sci_debug_flags & 4) sciprintf("[VM] Sending to disposed object!\n"); _dummy_register = NULL_REG; - return &_dummy_register; + return _dummy_register; } if (index < 0 || index >= obj->variables_nr) { @@ -77,10 +77,10 @@ static inline reg_t *validate_property(object_t *obj, int index) { obj->variables_nr); _dummy_register = NULL_REG; - return &_dummy_register; + return _dummy_register; } - return obj->variables + index; + return obj->variables[index]; } static inline stack_ptr_t validate_stack_addr(EngineState *s, stack_ptr_t sp) { @@ -175,7 +175,7 @@ static inline void validate_write_var(reg_t *r, reg_t *stack_base, int type, int # define validate_variable(r, sb, t, m, i, l) # define validate_read_var(r, sb, t, m, i, l) ((r)[i]) # define validate_write_var(r, sb, t, m, i, l, v) ((r)[i] = (v)) -# define validate_property(o, p) (&((o)->variables[p])) +# define validate_property(o, p) ((o)->variables[p]) # define ASSERT_ARITHMETIC(v) (v).offset #endif @@ -188,7 +188,7 @@ static inline void validate_write_var(reg_t *r, reg_t *stack_base, int type, int #define ACC_AUX_LOAD() aux_acc = signed_validate_arithmetic(s->r_acc) #define ACC_AUX_STORE() s->r_acc = make_reg(0, aux_acc) -#define OBJ_PROPERTY(o, p) (*validate_property(o, p)) +#define OBJ_PROPERTY(o, p) (validate_property(o, p)) int script_error(EngineState *s, const char *file, int line, const char *reason) { sciprintf("Script error in file %s, line %d: %s\n", file, line, reason); @@ -368,8 +368,10 @@ exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, stac sciprintf("Send to "PREG", selector %04x (%s):", PRINT_REG(send_obj), selector, s->selector_names[selector]); #endif // VM_DEBUG_SEND - if (++send_calls_nr == (send_calls_allocated - 1)) - send_calls = (calls_struct_t *)sci_realloc(send_calls, sizeof(calls_struct_t) * (send_calls_allocated *= 2)); + if (++send_calls_nr == (send_calls_allocated - 1)) { + send_calls_allocated *= 2; + send_calls = (calls_struct_t *)sci_realloc(send_calls, sizeof(calls_struct_t) * send_calls_allocated); + } switch (lookup_selector(s, send_obj, selector, &varp, &funcp)) { case SELECTOR_NONE: @@ -2052,8 +2054,10 @@ static EngineState *_game_run(EngineState *s, int restoring) { free(s); s = successor; - if (!send_calls_allocated) - send_calls = (calls_struct_t *)sci_calloc(sizeof(calls_struct_t), send_calls_allocated = 16); + if (!send_calls_allocated) { + send_calls_allocated = 16; + send_calls = (calls_struct_t *)sci_calloc(sizeof(calls_struct_t), 16); + } if (script_abort_flag == SCRIPT_ABORT_WITH_REPLAY) { sciprintf("Restarting with replay()\n"); diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 6881f79e71..69aa88396a 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -45,7 +45,7 @@ struct _scummvm_driver_state { #define S ((struct _scummvm_driver_state *)(drv->state)) static int -scummvm_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp) { +scummvm_init_specific(gfx_driver_t *drv, int xfact, int yfact, int bytespp) { int i; if (!drv->state) // = S @@ -83,11 +83,11 @@ scummvm_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp return GFX_OK; } -static int scummvm_init(struct _gfx_driver *drv) { +static int scummvm_init(gfx_driver_t *drv) { return scummvm_init_specific(drv, 1, 1, GFX_COLOR_MODE_INDEX); } -static void scummvm_exit(struct _gfx_driver *drv) { +static void scummvm_exit(gfx_driver_t *drv) { int i; if (S) { for (i = 0; i < 2; i++) { @@ -156,7 +156,7 @@ static void lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32 } } -static int scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point end, +static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) { uint32 scolor = color.visual.global_index; int xsize = S->xsize; @@ -180,7 +180,7 @@ static int scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Commo return GFX_OK; } -static int scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2, +static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2, gfx_rectangle_fill_t shade_mode) { if (color1.mask & GFX_MASK_VISUAL) { for (int i = rect.y; i < rect.y + rect.yl; i++) { @@ -196,7 +196,7 @@ static int scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect, gfx_co // Pixmap operations -static int scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority, +static int scummvm_draw_pixmap(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority, rect_t src, rect_t dest, gfx_buffer_t buffer) { int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1; int pribufnr = bufnr - 1; @@ -212,7 +212,7 @@ static int scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int p return GFX_OK; } -static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) { +static int scummvm_grab_pixmap(gfx_driver_t *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) { if (src.x < 0 || src.y < 0) { printf("Attempt to grab pixmap from invalid coordinates (%d,%d)\n", src.x, src.y); return GFX_ERROR; @@ -247,7 +247,7 @@ static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t // Buffer operations -static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) { +static int scummvm_update(gfx_driver_t *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) { //TODO int data_source = (buffer == GFX_BUFFER_BACK) ? 2 : 1; int data_dest = data_source - 1; @@ -289,7 +289,7 @@ static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point des return GFX_OK; } -static int scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) { +static int scummvm_set_static_buffer(gfx_driver_t *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) { memcpy(S->visual[2], pic->data, S->xsize * S->ysize); /*gfx_crossblit_pixmap(drv->mode, pic, 0, rect, rect, S->visual[2], S->xsize, S->priority[1]->index_data, S->priority[1]->index_xl, 1, 0);*/ @@ -301,7 +301,7 @@ static int scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, // Mouse pointer operations -static int scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) { +static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer) { if (pointer == NULL) { g_system->showMouse(false); } else { @@ -316,7 +316,7 @@ static int scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) { // Palette operations -static int scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) { +static int scummvm_set_palette(gfx_driver_t *drv, int index, byte red, byte green, byte blue) { if (index < 0 || index > 255) { GFXERROR("Attempt to set invalid palette entry %d\n", index); return GFX_ERROR; @@ -330,7 +330,7 @@ static int scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byt // Event management -static sci_event_t scummvm_get_event(struct _gfx_driver *drv) { +static sci_event_t scummvm_get_event(gfx_driver_t *drv) { sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 }; Common::EventManager *em = g_system->getEventManager(); @@ -480,7 +480,7 @@ static sci_event_t scummvm_get_event(struct _gfx_driver *drv) { return input; } -static int scummvm_usec_sleep(struct _gfx_driver *drv, long usecs) { +static int scummvm_usec_sleep(gfx_driver_t *drv, long usecs) { g_system->delayMillis(usecs / 1000); return GFX_OK; } diff --git a/engines/sci/gfx/gfx_driver.h b/engines/sci/gfx/gfx_driver.h index cb361a21bc..1d0bc09357 100644 --- a/engines/sci/gfx/gfx_driver.h +++ b/engines/sci/gfx/gfx_driver.h @@ -71,7 +71,7 @@ typedef enum { ** must use a reasonable default value. */ -typedef struct _gfx_driver { /* Graphics driver */ +struct gfx_driver_t { /* Graphics driver */ gfx_mode_t *mode; /* Currently active mode, NULL if no mode is active */ @@ -96,7 +96,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Initialization ***/ - int (*set_parameter)(struct _gfx_driver *drv, char *attribute, char *value); + int (*set_parameter)(gfx_driver_t *drv, char *attribute, char *value); /* Sets a driver-specific parameter ** Parameters: (gfx_driver_t *) drv: Pointer to the affected driver ** (char *) attribute: Name of the attribute/parameter to set @@ -110,7 +110,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** console). */ - int (*init_specific)(struct _gfx_driver *drv, int xres, int yres, + int (*init_specific)(gfx_driver_t *drv, int xres, int yres, int bytespp); /* Attempts to initialize a specific graphics mode ** Parameters: (gfx_driver_t *) drv: The affected driver @@ -128,7 +128,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** specified in gfx_tools.h. */ - int (*init)(struct _gfx_driver *drv); + int (*init)(gfx_driver_t *drv); /* Initialize any graphics mode ** Parameters: (gfx_driver_t *) drv: The affected driver ** Returns : (int) GFX_OK on success, GFX_FATAL otherwise. @@ -140,7 +140,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** specified in gfx_tools.h. */ - void (*exit)(struct _gfx_driver *drv); + void (*exit)(gfx_driver_t *drv); /* Uninitializes the current graphics mode ** Paramters: (gfx_driver_t *) drv: The driver to uninitialize ** Return : (void) @@ -154,7 +154,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Drawing operations ***/ - int (*draw_line)(struct _gfx_driver *drv, + int (*draw_line)(gfx_driver_t *drv, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style); @@ -175,7 +175,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** set. */ - int (*draw_filled_rect)(struct _gfx_driver *drv, rect_t rect, + int (*draw_filled_rect)(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2, gfx_rectangle_fill_t shade_mode); /* Draws a single filled and possibly shaded rectangle to the back buffer. @@ -192,7 +192,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Pixmap operations ***/ - int (*draw_pixmap)(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority, + int (*draw_pixmap)(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority, rect_t src, rect_t dest, gfx_buffer_t buffer); /* Draws part of a pixmap to the static or back buffer ** Parameters: (gfx_driver_t *) drv: The affected driver @@ -207,7 +207,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** (but should have been) registered. */ - int (*grab_pixmap)(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm, + int (*grab_pixmap)(gfx_driver_t *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map); /* Grabs an image from the visual or priority back buffer ** Parameters: (gfx_driver_t *) drv: The affected driver @@ -224,7 +224,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Buffer operations ***/ - int (*update)(struct _gfx_driver *drv, rect_t src, Common::Point dest, + int (*update)(gfx_driver_t *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer); /* Updates the front buffer or the back buffers ** Parameters: (gfx_driver_t *) drv: The affected driver @@ -240,7 +240,7 @@ typedef struct _gfx_driver { /* Graphics driver */ ** If they aren't, the priority map will not be required to be copied. */ - int (*set_static_buffer)(struct _gfx_driver *drv, gfx_pixmap_t *pic, + int (*set_static_buffer)(gfx_driver_t *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority); /* Sets the contents of the static visual and priority buffers ** Parameters: (gfx_driver_t *) drv: The affected driver @@ -262,7 +262,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Mouse pointer operations ***/ - int (*set_pointer)(struct _gfx_driver *drv, gfx_pixmap_t *pointer); + int (*set_pointer)(gfx_driver_t *drv, gfx_pixmap_t *pointer); /* Sets a new mouse pointer. ** Parameters: (gfx_driver_t *) drv: The driver to modify ** (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set @@ -278,7 +278,7 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Palette operations ***/ - int (*set_palette)(struct _gfx_driver *drv, int index, byte red, byte green, + int (*set_palette)(gfx_driver_t *drv, int index, byte red, byte green, byte blue); /* Manipulates a palette index in the hardware palette ** Parameters: (gfx_driver_t *) drv: The driver affected @@ -295,14 +295,14 @@ typedef struct _gfx_driver { /* Graphics driver */ /*** Event management ***/ - sci_event_t (*get_event)(struct _gfx_driver *drv); + sci_event_t (*get_event)(gfx_driver_t *drv); /* Returns the next event in the event queue for this driver ** Parameters: (gfx_driver_t *) drv: The driver to query ** Returns : (sci_event_t) The oldest event still in the driver's event ** queue, or the null event if there is none. */ - int (*usec_sleep)(struct _gfx_driver *drv, long usecs); + int (*usec_sleep)(gfx_driver_t *drv, long usecs); /* Sleeps the specified amount of microseconds, or until the mouse moves ** Parameters: (gfx_driver_t *) drv: The relevant driver ** (long) usecs: Amount of microseconds to sleep @@ -315,7 +315,7 @@ typedef struct _gfx_driver { /* Graphics driver */ void *state; /* Reserved for internal use */ -} gfx_driver_t; +}; } // End of namespace Sci diff --git a/engines/sci/gfx/gfx_operations.h b/engines/sci/gfx/gfx_operations.h index 15090d22da..5cfebb831c 100644 --- a/engines/sci/gfx/gfx_operations.h +++ b/engines/sci/gfx/gfx_operations.h @@ -43,7 +43,7 @@ namespace Sci { */ #define GFXOP_ALPHA_THRESHOLD 0xff -typedef struct { +struct gfx_text_handle_t { char *text; /* Copy of the actual text */ int lines_nr; @@ -56,7 +56,7 @@ typedef struct { int priority, control; gfx_alignment_t halign, valign; -} gfx_text_handle_t; +}; /* Unless individually stated otherwise, the following applies: ** All operations herein apply to the standard 320x200 coordinate system. @@ -81,18 +81,18 @@ typedef enum { } gfx_box_shade_t; -typedef struct _dirty_rect { +struct gfx_dirty_rect_t { rect_t rect; - struct _dirty_rect *next; -} gfx_dirty_rect_t; + gfx_dirty_rect_t *next; +}; -typedef struct _gfx_event { +struct gfx_input_event_t { sci_event_t event; - struct _gfx_event *next; -} gfx_input_event_t; + gfx_input_event_t *next; +}; -typedef struct { +struct gfx_state_t { int version; /* Interpreter version */ gfx_options_t *options; @@ -143,11 +143,11 @@ typedef struct { gfxr_pic_t *pic, *pic_unscaled; /* The background picture and its unscaled equivalent */ - struct _dirty_rect *dirty_rects; /* Dirty rectangles */ + gfx_dirty_rect_t *dirty_rects; /* Dirty rectangles */ void *internal_state; /* Internal interpreter information */ -} gfx_state_t; +}; /**************************/ diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h index d9abcbbfb2..323b4ff150 100644 --- a/engines/sci/gfx/gfx_options.h +++ b/engines/sci/gfx/gfx_options.h @@ -42,7 +42,7 @@ namespace Sci { #define GFXOP_DIRTY_FRAMES_CLUSTERS 2 -typedef struct _gfx_options { +struct gfx_options_t { /* gfx_options_t: Contains all user options to the rendering pipeline */ /* See note in sci_conf.h for config_entry_t before changing types of ** variables */ @@ -76,7 +76,7 @@ typedef struct _gfx_options { int workarounds; /* Workaround flags- see below */ rect_t pic_port_bounds; -} gfx_options_t; +}; /* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */ #define GFX_WORKAROUND_WHITESPACE_COUNT (1 << 0) diff --git a/engines/sci/gfx/gfx_res_options.h b/engines/sci/gfx/gfx_res_options.h index 6532cb456f..f405d88462 100644 --- a/engines/sci/gfx/gfx_res_options.h +++ b/engines/sci/gfx/gfx_res_options.h @@ -39,7 +39,7 @@ struct gfx_res_pattern_t { /* GFX resource assignments */ -typedef struct { +struct gfx_res_assign_t { short type; /* GFX_RES_ASSIGN_TYPE_* */ union { @@ -48,23 +48,23 @@ typedef struct { gfx_pixmap_color_t *colors; } palette; } assign; -} gfx_res_assign_t; +}; /* GFX resource modifications */ #define GFX_RES_MULTIPLY_FIXED 0 /* Linear palette update */ -typedef struct { +struct gfx_res_mod_t { short type; /* GFX_RES_ASSIGN_TYPE_* */ union { byte factor[3]; /* divide by 16 to retrieve factor */ } mod; -} gfx_res_mod_t; +}; -typedef struct _gfx_res_conf { +struct gfx_res_conf_t { int type; /* Resource type-- only one allowed */ /* If any of the following is 0, it means that there is no restriction. @@ -80,22 +80,21 @@ typedef struct _gfx_res_conf { gfx_res_mod_t mod; } conf; /* The actual configuration */ - struct _gfx_res_conf *next; -} gfx_res_conf_t; + gfx_res_conf_t *next; +}; typedef gfx_res_conf_t *gfx_res_conf_p_t; -typedef struct { +struct gfx_res_fullconf_t { gfx_res_conf_p_t assign[GFX_RESOURCE_TYPES_NR]; gfx_res_conf_p_t mod[GFX_RESOURCE_TYPES_NR]; -} gfx_res_fullconf_t; +}; -struct _gfx_options; +struct gfx_options_t; -int gfx_get_res_config(struct _gfx_options *options, - gfx_pixmap_t *pxm); +int gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm); /* Configures a graphical pixmap according to config options ** Parameters: (gfx_options_t *) options: The options according to which ** configuration should be performed diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index 04455451f9..12f7da4cb8 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -75,11 +75,11 @@ struct gfx_resource_t { }; -struct _gfx_options; +struct gfx_options_t; -typedef struct { +struct gfx_resstate_t { int version; /* Interpreter version */ - struct _gfx_options *options; + gfx_options_t *options; gfx_driver_t *driver; gfx_pixmap_color_t *static_palette; int static_palette_entries; @@ -91,11 +91,11 @@ typedef struct { sbtree_t *resource_trees[GFX_RESOURCE_TYPES_NR]; void *misc_payload; -} gfx_resstate_t; +}; -gfx_resstate_t *gfxr_new_resource_manager(int version, struct _gfx_options *options, +gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options, gfx_driver_t *driver, void *misc_payload); /* Allocates and initializes a new resource manager ** Parameters: (int) version: Interpreter version @@ -218,7 +218,7 @@ gfx_pixmap_color_t *gfxr_get_palette(gfx_resstate_t *state, int nr); int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version, - struct _gfx_options *options, void *internal, int palette); + gfx_options_t *options, void *internal, int palette); /* Calculates a unique hash value for the specified options/type setup ** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for ** (int) version: The interpreter type and version diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h index 2ad69b821d..0fcd7aa68d 100644 --- a/engines/sci/gfx/gfx_resource.h +++ b/engines/sci/gfx/gfx_resource.h @@ -66,13 +66,13 @@ extern gfx_pixmap_color_t gfx_sci0_image_colors[][16]; extern gfx_pixmap_color_t gfx_sci0_pic_colors[]; -typedef struct { +struct gfxr_pic0_params_t { gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */ gfx_brush_mode_t brush_mode; rect_t pic_port_bounds; -} gfxr_pic0_params_t; +}; -typedef struct { +struct gfxr_pic_t { int ID; /* pic number (NOT resource ID, just number) */ gfx_mode_t *mode; gfx_pixmap_t *visual_map; @@ -96,16 +96,16 @@ typedef struct { void *internal; /* Interpreter information, or NULL. Will be freed ** automatically when the pic is freed! */ -} gfxr_pic_t; +}; -typedef struct { +struct gfxr_loop_t { int cels_nr; gfx_pixmap_t **cels; -} gfxr_loop_t; +}; -typedef struct { +struct gfxr_view_t { int ID; int flags; @@ -116,7 +116,7 @@ typedef struct { gfxr_loop_t *loops; int translation[GFX_SCI0_IMAGE_COLORS_NR]; -} gfxr_view_t; +}; typedef enum { @@ -124,10 +124,10 @@ typedef enum { } gfxr_font_scale_filter_t; -typedef struct { +struct text_fragment_t { const char *offset; int length; -} text_fragment_t; +}; /* unscaled color index mode: Used in addition to a scaled mode ** to render the pic resource twice. See gfxr_remove_artifacts_pic0(). diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h index 871a618303..c5a03ce1b4 100644 --- a/engines/sci/gfx/gfx_state_internal.h +++ b/engines/sci/gfx/gfx_state_internal.h @@ -43,10 +43,10 @@ namespace Sci { #define GFXW_FLAG_IMMUNE_TO_SNAPSHOTS (1<<6) /* Snapshot restoring doesn't kill this widget, and +5 bonus to saving throws vs. Death Magic */ #define GFXW_FLAG_NO_IMPLICIT_SWITCH (1<<7) /* Ports: Don't implicitly switch to this port when disposing windows */ -typedef struct { +struct gfxw_snapshot_t { int serial; /* The first serial number to kill */ rect_t area; -} gfxw_snapshot_t; +}; typedef enum { GFXW_, /* Base widget */ @@ -77,15 +77,16 @@ typedef enum { #define GFXW_NO_ID -1 -struct _gfxw_widget; -struct _gfxw_container_widget; -struct _gfxw_visual; +struct gfxw_widget_t; +struct gfxw_container_t; +struct gfxw_visual_t; +struct gfxw_port_t; -typedef int gfxw_point_op(struct _gfxw_widget *, Common::Point); -typedef int gfxw_visual_op(struct _gfxw_widget *, struct _gfxw_visual *); -typedef int gfxw_op(struct _gfxw_widget *); -typedef int gfxw_op_int(struct _gfxw_widget *, int); -typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *); +typedef int gfxw_point_op(gfxw_widget_t *, Common::Point); +typedef int gfxw_visual_op(gfxw_widget_t *, gfxw_visual_t *); +typedef int gfxw_op(gfxw_widget_t *); +typedef int gfxw_op_int(gfxw_widget_t *, int); +typedef int gfxw_bin_op(gfxw_widget_t *, gfxw_widget_t *); #define WIDGET_COMMON \ int magic; /* Extra check after typecasting */ \ @@ -93,11 +94,11 @@ typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *); int flags; /* Widget flags */ \ gfxw_widget_type_t type; \ rect_t bounds; /* Boundaries */ \ - struct _gfxw_widget *next; /* Next widget in widget list */ \ + gfxw_widget_t *next; /* Next widget in widget list */ \ int ID; /* Unique ID or GFXW_NO_ID */ \ int subID; /* A 'sub-ID', or GFXW_NO_ID */ \ - struct _gfxw_container_widget *parent; /* The parent widget, or NULL if not owned */ \ - struct _gfxw_visual *visual; /* The owner visual */ \ + gfxw_container_t *parent; /* The parent widget, or NULL if not owned */ \ + gfxw_visual_t *visual; /* The owner visual */ \ int widget_priority; /* Drawing priority, or -1 */ \ gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \ gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \ @@ -109,26 +110,26 @@ typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *); gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \ gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */ -typedef struct _gfxw_widget { +struct gfxw_widget_t { WIDGET_COMMON; -} gfxw_widget_t; +}; #define GFXW_IS_BOX(widget) ((widget)->type == GFXW_BOX) -typedef struct { +struct gfxw_box_t { WIDGET_COMMON; gfx_color_t color1, color2; gfx_box_shade_t shade_type; -} gfxw_box_t; +}; #define GFXW_IS_PRIMITIVE(widget) ((widget)->type == GFXW_RECT || (widget)->type == GFXW_LINE || (widget->type == GFXW_INVERSE_LINE)) -typedef struct { +struct gfxw_primitive_t { WIDGET_COMMON; gfx_color_t color; gfx_line_mode_t line_mode; gfx_line_style_t line_style; -} gfxw_primitive_t; +}; @@ -141,12 +142,12 @@ typedef struct { #define GFXW_IS_VIEW(widget) ((widget)->type == GFXW_VIEW || (widget)->type == GFXW_STATIC_VIEW \ || (widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW) -typedef struct { +struct gfxw_view_t { VIEW_COMMON; -} gfxw_view_t; +}; #define GFXW_IS_DYN_VIEW(widget) ((widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW) -typedef struct { +struct gfxw_dyn_view_t { VIEW_COMMON; /* fixme: This code is specific to SCI */ rect_t draw_bounds; /* The correct position to draw to */ @@ -155,12 +156,12 @@ typedef struct { int z; /* The z coordinate: Added to y, but used for sorting */ int sequence; /* Sequence number: For sorting */ int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */ -} gfxw_dyn_view_t; +}; #define GFXW_IS_TEXT(widget) ((widget)->type == GFXW_TEXT) -typedef struct { +struct gfxw_text_t { WIDGET_COMMON; int font_nr; int lines_nr, lineheight, lastline_width; @@ -170,14 +171,14 @@ typedef struct { int text_flags; int width, height; /* Real text width and height */ gfx_text_handle_t *text_handle; -} gfxw_text_t; +}; /* Container widgets */ -typedef int gfxw_unary_container_op(struct _gfxw_container_widget *); -typedef int gfxw_container_op(struct _gfxw_container_widget *, gfxw_widget_t *); -typedef int gfxw_rect_op(struct _gfxw_container_widget *, rect_t, int); +typedef int gfxw_unary_container_op(gfxw_container_t *); +typedef int gfxw_container_op(gfxw_container_t *, gfxw_widget_t *); +typedef int gfxw_rect_op(gfxw_container_t *, rect_t, int); #define WIDGET_CONTAINER \ WIDGET_COMMON; \ @@ -192,9 +193,9 @@ typedef int gfxw_rect_op(struct _gfxw_container_widget *, rect_t, int); gfxw_container_op *add /* Append widget to an appropriate position (for view and control lists) */ -typedef struct _gfxw_container_widget { +struct gfxw_container_t { WIDGET_CONTAINER; -} gfxw_container_t; +}; #define GFXW_IS_CONTAINER(widget) ((widget)->type == GFXW_PORT || (widget)->type == GFXW_VISUAL || \ @@ -205,16 +206,16 @@ typedef struct _gfxw_container_widget { typedef gfxw_container_t gfxw_list_t; #define GFXW_IS_VISUAL(widget) ((widget)->type == GFXW_VISUAL) -typedef struct _gfxw_visual { +struct gfxw_visual_t { WIDGET_CONTAINER; - struct _gfxw_port **port_refs; /* References to ports */ + gfxw_port_t **port_refs; /* References to ports */ int port_refs_nr; int font_nr; /* Default font */ gfx_state_t *gfx_state; -} gfxw_visual_t; +}; #define GFXW_IS_PORT(widget) ((widget)->type == GFXW_PORT) -typedef struct _gfxw_port { +struct gfxw_port_t { WIDGET_CONTAINER; gfxw_list_t *decorations; /* optional window decorations- drawn before the contents */ @@ -228,7 +229,7 @@ typedef struct _gfxw_port { int port_flags; /* interpreter-dependant flags */ const char *title_text; byte gray_text; /* Whether text is 'grayed out' (dithered) */ -} gfxw_port_t; +}; #undef WIDGET_COMMON #undef WIDGET_CONTAINER diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 911a4dde97..95d6c72534 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -240,7 +240,7 @@ static inline rect_t gfx_rect_translate(rect_t rect, Common::Point offset) { #define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */ -typedef struct { /* gfx_pixmap_t: Pixel map */ +struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */ /*** Meta information ***/ int ID; /* Resource ID, or GFX_RESID_NONE for anonymous graphical data */ @@ -285,13 +285,13 @@ typedef struct { /* gfx_pixmap_t: Pixel map */ void *info; /* initialized to NULL */ } internal; -} gfx_pixmap_t; +}; #define GFX_FONT_BUILTIN_5x8 -1 #define GFX_FONT_BUILTIN_6x10 -2 -typedef struct { /* gfx_bitmap_font_t: Bitmap font information */ +struct gfx_bitmap_font_t { /* gfx_bitmap_font_t: Bitmap font information */ int ID; /* Unique resource ID */ int chars_nr; /* Numer of available characters */ @@ -312,7 +312,7 @@ typedef struct { /* gfx_bitmap_font_t: Bitmap font information */ ** its pixel width is widths[ch], provided that (ch < chars_nr). */ -} gfx_bitmap_font_t; +}; diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 0da172e096..d7fedf1d05 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -413,10 +413,10 @@ static inline int _gfxop_update_box(gfx_state_t *state, rect_t box) { return GFX_OK; } -static struct _dirty_rect *_rect_create(rect_t box) { - struct _dirty_rect *rect; +static gfx_dirty_rect_t *_rect_create(rect_t box) { + gfx_dirty_rect_t *rect; - rect = (struct _dirty_rect *)sci_malloc(sizeof(struct _dirty_rect)); + rect = (gfx_dirty_rect_t *)sci_malloc(sizeof(gfx_dirty_rect_t)); rect->next = NULL; rect->rect = box; @@ -450,11 +450,11 @@ gfx_dirty_rect_t *gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strate break; case GFXOP_DIRTY_FRAMES_CLUSTERS: { - struct _dirty_rect **rectp = &(base); + gfx_dirty_rect_t **rectp = &(base); while (*rectp) { if (gfx_rects_overlap((*rectp)->rect, box)) { - struct _dirty_rect *next = (*rectp)->next; + gfx_dirty_rect_t *next = (*rectp)->next; box = gfx_rects_merge((*rectp)->rect, box); free(*rectp); *rectp = next; @@ -496,7 +496,7 @@ static inline void _gfxop_add_dirty_x(gfx_state_t *state, rect_t box) { _gfxop_add_dirty(state, box); } -static int _gfxop_clear_dirty_rec(gfx_state_t *state, struct _dirty_rect *rect) { +static int _gfxop_clear_dirty_rec(gfx_state_t *state, gfx_dirty_rect_t *rect) { int retval; if (!rect) diff --git a/engines/sci/gfx/sbtree.cpp b/engines/sci/gfx/sbtree.cpp index 5520dd156d..a791f0650a 100644 --- a/engines/sci/gfx/sbtree.cpp +++ b/engines/sci/gfx/sbtree.cpp @@ -33,10 +33,10 @@ namespace Sci { #define NOT_A_KEY -1 -typedef struct { +struct sbcell_t { int key; void *value; -} sbcell_t; +}; int int_compar(const void *a, const void *b) { return (*((int *)a)) - (*((int *)b)); diff --git a/engines/sci/gfx/sbtree.h b/engines/sci/gfx/sbtree.h index 0639d80bfc..9165b71335 100644 --- a/engines/sci/gfx/sbtree.h +++ b/engines/sci/gfx/sbtree.h @@ -38,14 +38,14 @@ namespace Sci { -typedef struct { +struct sbtree_t { int entries_nr; int min_entry; int max_entry; int levels; int alloced_entries; void *data; -} sbtree_t; +}; sbtree_t *sbtree_new(int size, int *keys); diff --git a/engines/sci/gfx/widgets.cpp b/engines/sci/gfx/widgets.cpp index 1253829a41..e9079c1a5c 100644 --- a/engines/sci/gfx/widgets.cpp +++ b/engines/sci/gfx/widgets.cpp @@ -1643,7 +1643,8 @@ gfxw_visual_t *gfxw_new_visual(gfx_state_t *state, int font) { visual->font_nr = font; visual->gfx_state = state; - visual->port_refs = (struct _gfxw_port **)sci_calloc(sizeof(gfxw_port_t), visual->port_refs_nr = 16); + visual->port_refs_nr = 16; + visual->port_refs = (gfxw_port_t **)sci_calloc(sizeof(gfxw_port_t), visual->port_refs_nr); _gfxw_set_ops_VISUAL(GFXWC(visual)); @@ -1658,7 +1659,8 @@ static int _visual_find_free_ID(gfxw_visual_t *visual) { id++; if (id == visual->port_refs_nr) { // Out of ports? - visual->port_refs = (struct _gfxw_port**)sci_realloc(visual->port_refs, visual->port_refs_nr += newports); + visual->port_refs_nr += newports; + visual->port_refs = (gfxw_port_t**)sci_realloc(visual->port_refs, visual->port_refs_nr); memset(visual->port_refs + id, 0, newports * sizeof(gfxw_port_t *)); // Clear new port refs } diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index e7425c6929..37c52d8af1 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -79,10 +79,10 @@ namespace Sci { #define SCI_GAME_IS_RESTARTING_NOW 2 #define SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE 4 -typedef struct { +struct drawn_pic_t { int nr; int palette; -} drawn_pic_t; +}; // Savegame metadata struct SavegameMetadata { diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h index 906e864522..d1c54d1994 100644 --- a/engines/sci/include/kernel.h +++ b/engines/sci/include/kernel.h @@ -47,9 +47,9 @@ extern int _debug_step_running; #define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline" -typedef struct { +struct abs_rect_t { int x, y, xend, yend; -} abs_rect_t; +}; /* Formerly, the heap macros were here; they have been deprecated, however. */ @@ -315,22 +315,22 @@ typedef reg_t kfunct(EngineState *s, int funct_nr, int argc, reg_t *argv); #define FREESCI_KFUNCT_GLUTTON 1 -typedef struct { +struct kfunct_sig_pair_t { kfunct *fun; /* The actual function */ const char *signature; /* kfunct signature */ const char *orig_name; /* Original name, in case we couldn't map it */ -} kfunct_sig_pair_t; +}; #define KF_OLD 0 #define KF_NEW 1 #define KF_NONE -1 /* No mapping, but name is known */ #define KF_TERMINATOR -42 /* terminates kfunct_mappers */ -typedef struct { +struct sci_kernel_function_t { int type; /* KF_* */ const char *name; kfunct_sig_pair_t sig_pair; -} sci_kernel_function_t; +}; extern sci_kernel_function_t kfunct_mappers[]; diff --git a/engines/sci/include/menubar.h b/engines/sci/include/menubar.h index e437bddcf5..aed7b2de73 100644 --- a/engines/sci/include/menubar.h +++ b/engines/sci/include/menubar.h @@ -82,7 +82,7 @@ namespace Sci { #define MENU_ATTRIBUTE_FLAGS_KEY 0x01 #define MENU_ATTRIBUTE_FLAGS_SAID 0x02 -typedef struct { +struct menu_item_t { int type; /* Normal or hbar */ char *keytext; /* right-centered part of the text (the key) */ int keytext_size; /* Width of the right-centered text */ @@ -96,10 +96,10 @@ typedef struct { int enabled; int tag; -} menu_item_t; +}; -typedef struct { +struct menu_t { char *title; int title_width; /* Width of the title in pixels */ @@ -108,16 +108,16 @@ typedef struct { int items_nr; /* Window height equals to intems_nr * 10 */ menu_item_t *items; /* Actual entries into the menu */ -} menu_t; +}; -typedef struct { +struct menubar_t { int menus_nr; menu_t *menus; /* The actual menus */ -} menubar_t; +}; struct gfx_port; struct gfx_picture; /* forward declarations for graphics.h */ diff --git a/engines/sci/include/sciconsole.h b/engines/sci/include/sciconsole.h index c3b93a4671..8888e5927d 100644 --- a/engines/sci/include/sciconsole.h +++ b/engines/sci/include/sciconsole.h @@ -51,11 +51,11 @@ extern FILE *con_file; ** directly to the con_file variable. */ -typedef union { +union cmd_param_t { int32 val; char *str; reg_t reg; -} cmd_param_t; +}; extern unsigned int cmd_paramlength; /* The number of parameters passed to a function called from the parser */ diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h index 67561b76ed..05585632e8 100644 --- a/engines/sci/include/vm.h +++ b/engines/sci/include/vm.h @@ -106,10 +106,10 @@ namespace Sci { #define SELECTOR_METHOD 2 /* Types of selectors as returned by grep_selector() below */ -typedef struct { +struct class_t { int script; /* number of the script the class is in, -1 for non-existing */ reg_t reg; /* offset; script-relative offset, segment: 0 if not instantiated */ -} class_t; +}; #define RAW_GET_CLASS_INDEX(scr, reg) ((scr)->obj_indices->check_value(reg.offset, false)) #define RAW_IS_OBJECT(datablock) (getUInt16(((byte *) datablock) + SCRIPT_OBJECT_MAGIC_OFFSET) == SCRIPT_OBJECT_MAGIC_NUMBER) @@ -117,7 +117,7 @@ typedef struct { #define IS_CLASS(obj) (obj->variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS) /* This struct is used to buffer the list of send calls in send_selector() */ -typedef struct { +struct calls_struct_t { union { reg_t func; reg_t *var; @@ -127,17 +127,17 @@ typedef struct { selector_t selector; stack_ptr_t sp; /* Stack pointer */ int type; /* Same as exec_stack_t.type */ -} calls_struct_t; +}; -typedef struct { +struct local_variables_t { int script_id; /* Script ID this local variable block belongs to */ reg_t *locals; int nr; -} local_variables_t; +}; #define OBJECT_FLAG_FREED (0x1 << 0) /* Clone has been marked as 'freed' */ -typedef struct { +struct object_t { int flags; reg_t pos; /* Object offset within its script; for clones, this is their base */ int variables_nr; @@ -148,12 +148,12 @@ typedef struct { uint16 *base_method; /* Pointer to the method selector area for this object */ uint16 *base_vars; /* Pointer to the varselector area for this object */ reg_t *variables; -} object_t; +}; -typedef struct { +struct code_block_t { reg_t pos; int size; -} code_block_t; +}; #define VM_OBJECT_GET_VARSELECTOR(obj, i) \ (s->version < SCI_VERSION(1,001,000) ? \ @@ -180,7 +180,7 @@ typedef struct { //#define VM_OBJECT_SET_INDEX(ptr, index) { ((byte *) (ptr))[0] = (index) & 0xff; ((byte *) (ptr))[1] = ((index) >> 8) & 0xff; } //#define VM_OBJECT_GET_INDEX(scr, reg) (int_hash_map_check_value(scr->obj_indices, reg.offset, 0, NULL)) -typedef struct { +struct script_t { int nr; /* Script number */ byte* buf; /* Static data buffer, or NULL if not used */ size_t buf_size; @@ -212,34 +212,34 @@ typedef struct { int code_blocks_allocated; int relocated; int marked_as_deleted; -} script_t; +}; -typedef struct { +struct dstack_t { int nr; /* Number of stack entries */ reg_t *entries; -} dstack_t; /* Data stack */ +}; /* Data stack */ #define CLONE_USED -1 #define CLONE_NONE -1 typedef object_t clone_t; -typedef struct _node_struct { +struct node_t { reg_t pred, succ; /* Predecessor, successor */ reg_t key; reg_t value; -} node_t; /* List nodes */ +}; /* List nodes */ -typedef struct _list_struct { +struct list_t { reg_t first; reg_t last; -} list_t; +}; -typedef struct { +struct hunk_t { void *mem; unsigned int size; const char *type; -} hunk_t; +}; /* clone_table_t */ DECLARE_HEAPENTRY(clone) @@ -250,13 +250,13 @@ DECLARE_HEAPENTRY(list) /* list entries */ /* hunk_table_t */ DECLARE_HEAPENTRY(hunk) -typedef struct { +struct dynmem_t { int size; const char *description; byte *buf; -} dynmem_t; /* Free-style memory */ +}; /* Free-style memory */ -typedef struct _mem_obj { +struct mem_obj_t { int type; int segmgr_id; /* Internal value used by the seg_manager's hash map */ union { @@ -271,11 +271,11 @@ typedef struct _mem_obj { dynmem_t dynmem; char *reserved; } data; -} mem_obj_t; +}; -typedef struct { +struct selector_map_t { selector_t init; /* Init function */ selector_t play; /* Play function (first function to be called) */ selector_t replay; /* Replay function */ @@ -347,9 +347,9 @@ typedef struct { selector_t flags; selector_t points; /* Used by AvoidPath() */ -} selector_map_t; /* Contains selector IDs for a few selected selectors */ +}; /* Contains selector IDs for a few selected selectors */ -typedef struct { +struct view_object_t { reg_t obj; reg_t *signalp; /* Used only indirectly */ reg_t *underBitsp; /* The same goes for the handle storage */ @@ -361,7 +361,7 @@ typedef struct { int view_nr, loop, cel; /* view_nr is ised for save/restore */ int nsTop, nsLeft, nsRight, nsBottom; int real_y, z, index_nr; /* Used for sorting */ -} view_object_t; +}; #define VAR_GLOBAL 0 #define VAR_LOCAL 1 @@ -372,7 +372,7 @@ typedef struct { #define EXEC_STACK_TYPE_KERNEL 1 #define EXEC_STACK_TYPE_VARSELECTOR 2 -typedef struct { +struct exec_stack_t { reg_t objp; reg_t sendp; /* Pointer to the object containing the invoked method */ union { @@ -392,16 +392,16 @@ typedef struct { ** was the initial call. */ byte type; /* EXEC_STACK_TYPE* */ -} exec_stack_t; +}; -typedef struct _breakpoint { +struct breakpoint_t { int type; union { uint32 address; /* Breakpoints on exports */ char *name; /* Breakpoints on selector names */ } data; - struct _breakpoint *next; -} breakpoint_t; + breakpoint_t *next; +}; #define BREAK_SELECTOR 1 /* Break when selector is executed. data contains (char *) selector name diff --git a/engines/sci/include/vm_types.h b/engines/sci/include/vm_types.h index 64fe330189..8ffb0b19be 100644 --- a/engines/sci/include/vm_types.h +++ b/engines/sci/include/vm_types.h @@ -23,16 +23,13 @@ * */ -#ifndef _SCI_VM_TYPES_H_ -#define _SCI_VM_TYPES_H_ +#ifndef SCI_VM_TYPES_H +#define SCI_VM_TYPES_H #include "common/scummsys.h" namespace Sci { -#define SCI_REG_SIZE 16; -#define SCI_SEG_SIZE 16; - typedef int seg_id_t; /* Segment ID type */ struct reg_t { @@ -64,4 +61,4 @@ extern reg_t NULL_REG; } // End of namespace Sci -#endif /* !_SCI_VM_TYPES_H_ */ +#endif // SCI_VM_TYPES_H diff --git a/engines/sci/include/vocabulary.h b/engines/sci/include/vocabulary.h index 25f68bce78..3e2239b952 100644 --- a/engines/sci/include/vocabulary.h +++ b/engines/sci/include/vocabulary.h @@ -110,32 +110,32 @@ extern const char *class_names[]; /* Vocabulary class names */ #define SAID_LONG(x) ((x) << 8) -typedef struct { +struct word_t { int w_class; /* Word class */ int group; /* Word group */ char word[1]; /* The actual word */ -} word_t; +}; -typedef struct { +struct parse_rule_t { int id; /* non-terminal ID */ int first_special; /* first terminal or non-terminal */ int specials_nr; /* number of terminals and non-terminals */ int length; int data[1]; /* actual data (size 1 to avoid compiler warnings) */ -} parse_rule_t; +}; -typedef struct _parse_rule_list { +struct parse_rule_list_t { int terminal; /* Terminal character this rule matches against or 0 for a non-terminal rule */ parse_rule_t *rule; - struct _parse_rule_list *next; -} parse_rule_list_t; + parse_rule_list_t *next; +}; -typedef struct { +struct suffix_t { int class_mask; /* the word class this suffix applies to */ int result_class; /* the word class a word is morphed to if it doesn't fail this check */ @@ -146,36 +146,36 @@ typedef struct { char *alt_suffix; /* The alternative suffix */ char *word_suffix; /* The suffix as used in the word vocabulary */ -} suffix_t; +}; -typedef struct { +struct result_word_t { int w_class; /* Word class */ int group; /* Word group */ -} result_word_t; +}; -typedef struct { +struct synonym_t { int replaceant; /* The word group to replace */ int replacement; /* The replacement word group for this one */ -} synonym_t; +}; -typedef struct { +struct parse_tree_branch_t { int id; int data[10]; -} parse_tree_branch_t; +}; #define PARSE_TREE_NODE_LEAF 0 #define PARSE_TREE_NODE_BRANCH 1 -typedef struct { +struct parse_tree_node_t { short type; /* leaf or branch */ @@ -186,7 +186,7 @@ typedef struct { } content; -} parse_tree_node_t; +}; diff --git a/engines/sci/sfx/adlib.h b/engines/sci/sfx/adlib.h index ff2a3b2687..d6efcefb0f 100644 --- a/engines/sci/sfx/adlib.h +++ b/engines/sci/sfx/adlib.h @@ -33,7 +33,7 @@ namespace Sci { #define ADLIB_VOICES 12 -typedef struct _sci_adlib_def { +struct adlib_def { uint8 keyscale1; /* 0-3 !*/ uint8 freqmod1; /* 0-15 !*/ uint8 feedback1; /* 0-7 !*/ @@ -62,7 +62,7 @@ typedef struct _sci_adlib_def { uint8 algorithm2; /* 0,1 UNUSED */ uint8 waveform1; /* 0-3 !*/ uint8 waveform2; /* 0-3 !*/ -} adlib_def; +}; typedef unsigned char adlib_instr[12]; diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index ff4faafde2..7e04883ffc 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -583,7 +583,7 @@ static song_iterator_t *_sci0_handle_message(sci0_song_iterator_t *self, song_it #ifdef DEBUG_VERBOSE fprintf(stderr, "** CLONE INCREF for new %p from %p at %p\n", mem, self, mem->data); #endif - return (struct _song_iterator *) mem; /* Assume caller has another copy of this */ + return (song_iterator_t *) mem; /* Assume caller has another copy of this */ } case _SIMSG_BASEMSG_STOP: { @@ -1072,7 +1072,7 @@ static int _sci1_process_next_command(sci1_song_iterator_t *self, return retval; } -static struct _song_iterator * +static song_iterator_t * _sci1_handle_message(sci1_song_iterator_t *self, song_iterator_message_t msg) { if (msg.recipient == _SIMSG_BASE) { /* May extend this in the future */ @@ -1114,7 +1114,7 @@ static struct _song_iterator * samplep = &(newsample->next); } - return (struct _song_iterator *) mem; /* Assume caller has another copy of this */ + return (song_iterator_t *) mem; /* Assume caller has another copy of this */ } case _SIMSG_BASEMSG_STOP: { diff --git a/engines/sci/sfx/mixer/test.cpp b/engines/sci/sfx/mixer/test.cpp index f35a546cfd..52102ba81b 100644 --- a/engines/sci/sfx/mixer/test.cpp +++ b/engines/sci/sfx/mixer/test.cpp @@ -153,9 +153,9 @@ int dev_output(sfx_pcm_device_t *self, byte *buf, int count) { /* Feeds for debugging */ -typedef struct { +struct int_struct { int i; -} int_struct; +}; int feed_poll(sfx_pcm_feed_t *self, byte *dest, int size); void feed_destroy(sfx_pcm_feed_t *self); @@ -173,11 +173,11 @@ int_struct private_bits[10] = { }; -typedef struct { +struct sample_feed_t { int start; int samples_nr; byte *data; -} sample_feed_t; +}; #define FEEDS_NR 4 diff --git a/engines/sci/sfx/pcm-iterator.cpp b/engines/sci/sfx/pcm-iterator.cpp index 7bf9ed6a06..93514ffd51 100644 --- a/engines/sci/sfx/pcm-iterator.cpp +++ b/engines/sci/sfx/pcm-iterator.cpp @@ -34,11 +34,11 @@ namespace Sci { static int pi_poll(sfx_pcm_feed_t *self, byte *dest, int size); static void pi_destroy(sfx_pcm_feed_t *self); -typedef struct { +struct pcm_data_internal_t { byte *base_data; byte *data; int frames_left; -} pcm_data_internal_t; +}; static sfx_pcm_feed_t pcm_it_prototype = { diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 896c521007..ebd0b47bf6 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -23,17 +23,10 @@ * */ -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <stdio.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include "../sequencer.h" -#include "../device.h" -#include "instrument-map.h" -#include <resource.h> +#include "sci/tools.h" +#include "sci/sfx/sequencer.h" +#include "sci/sfx/device.h" +#include "sci/sfx/seq/instrument-map.h" namespace Sci { diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp index 8f9ee56371..40079e4d22 100644 --- a/engines/sci/sfx/seq/instrument-map.cpp +++ b/engines/sci/sfx/seq/instrument-map.cpp @@ -214,13 +214,13 @@ sfx_instrument_map_load_sci(byte *data, size_t size) { #define MIDI_CHANNELS_NR 0x10 // FIXME: Replace this ugly hack with simple subclassing once converting to C++ -typedef struct decorated_midi_writer { +struct decorated_midi_writer_t { MIDI_WRITER_BODY midi_writer_t *writer; sfx_patch_map_t patches[MIDI_CHANNELS_NR]; sfx_instrument_map_t *map; -} decorated_midi_writer_t; +}; static void diff --git a/engines/sci/sfx/seq/instrument-map.h b/engines/sci/sfx/seq/instrument-map.h index deb54fd1f6..95233f9099 100644 --- a/engines/sci/sfx/seq/instrument-map.h +++ b/engines/sci/sfx/seq/instrument-map.h @@ -51,12 +51,12 @@ namespace Sci { /* Maximum velocity (used for scaling) */ #define SFX_MAX_VELOCITY 128 -typedef struct { +struct sfx_patch_map_t { int patch; /* Native instrument, SFX_UNMAPPED or SFX_MAPPED_TO_RHYTHM */ int rhythm; /* Rhythm key when patch == SFX_MAPPED_TO_RHYTHM */ -} sfx_patch_map_t; +}; -typedef struct { +struct sfx_instrument_map_t { sfx_patch_map_t patch_map[SFX_INSTRUMENTS_NR]; /* Map patch nr to which native instrument or rhythm key */ int patch_key_shift[SFX_INSTRUMENTS_NR]; /* Shift patch key by how much? */ int patch_volume_adjust[SFX_INSTRUMENTS_NR]; /* Adjust controller 7 by how much? */ @@ -73,7 +73,7 @@ typedef struct { size_t initialisation_block_size; byte *initialisation_block; /* Initial MIDI commands to set up the device */ -} sfx_instrument_map_t; +}; sfx_instrument_map_t * sfx_instrument_map_new(int velocity_maps_nr); diff --git a/engines/sci/sfx/sequencer.h b/engines/sci/sfx/sequencer.h index 4c25e8bd46..182e2bf771 100644 --- a/engines/sci/sfx/sequencer.h +++ b/engines/sci/sfx/sequencer.h @@ -37,7 +37,7 @@ namespace Sci { #define SFX_SEQ_PATCHFILE_NONE -1 -typedef struct _sfx_sequencer { +struct sfx_sequencer_t { const char *name; /* Sequencer name */ const char *version; /* Sequencer version */ @@ -129,7 +129,7 @@ typedef struct _sfx_sequencer { int min_write_ahead_ms; /* Minimal write-ahead, in milliseconds */ /* Note that write-ahead is tuned automatically; this enforces a lower limit */ -} sfx_sequencer_t; +}; sfx_sequencer_t *sfx_find_sequencer(char *name); diff --git a/engines/sci/sfx/sfx_engine.h b/engines/sci/sfx/sfx_engine.h index 60893e550f..20447c69c8 100644 --- a/engines/sci/sfx/sfx_engine.h +++ b/engines/sci/sfx/sfx_engine.h @@ -47,7 +47,7 @@ namespace Sci { #define SFX_DEBUG_CUES (1 << 1) /* Debug cues, loops, and ** song completions */ -typedef struct { +struct sfx_state_t { song_iterator_t *it; /* The song iterator at the heart of things */ unsigned int flags; /* SFX_STATE_FLAG_* */ songlib_t songlib; /* Song library */ @@ -55,7 +55,7 @@ typedef struct { int suspended; /* Whether we are suspended */ unsigned int debug; /* Debug flags */ -} sfx_state_t; +}; /***********/ /* General */ diff --git a/engines/sci/sfx/sfx_iterator.h b/engines/sci/sfx/sfx_iterator.h index 623206bd20..0203159a49 100644 --- a/engines/sci/sfx/sfx_iterator.h +++ b/engines/sci/sfx/sfx_iterator.h @@ -44,12 +44,12 @@ namespace Sci { #define FADE_ACTION_FADE_AND_STOP 1 #define FADE_ACTION_FADE_AND_CONT 2 -typedef struct { +struct fade_params_t { int ticks_per_step; int final_volume; int step_size; int action; -} fade_params_t; +}; #define SONG_ITERATOR_MESSAGE_ARGUMENTS_NR 2 @@ -96,7 +96,7 @@ struct listener_t { typedef unsigned long songit_id_t; -typedef struct { +struct song_iterator_message_t { songit_id_t ID; unsigned int recipient; /* Type of iterator supposed to receive this */ unsigned int type; @@ -104,7 +104,7 @@ typedef struct { unsigned int i; void * p; } args[SONG_ITERATOR_MESSAGE_ARGUMENTS_NR]; -} song_iterator_message_t; +}; #define INHERITS_SONG_ITERATOR \ songit_id_t ID; \ @@ -115,15 +115,15 @@ typedef struct { int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \ sfx_pcm_feed_t * (*get_pcm_feed) (song_iterator_t *s); \ song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \ - void (*init) (struct _song_iterator *self); \ - void (*cleanup) (struct _song_iterator *self); \ - int (*get_timepos) (struct _song_iterator *self); \ + void (*init) (song_iterator_t *self); \ + void (*cleanup) (song_iterator_t *self); \ + int (*get_timepos) (song_iterator_t *self); \ listener_t death_listeners[SONGIT_MAX_LISTENERS]; \ int death_listeners_nr \ #define SONGIT_MAX_LISTENERS 2 -typedef struct _song_iterator { +struct song_iterator_t { songit_id_t ID; uint16 channel_mask; /* Bitmask of all channels this iterator will use */ @@ -131,7 +131,7 @@ typedef struct _song_iterator { unsigned int flags; int priority; - int (*next)(struct _song_iterator *self, + int (*next)(song_iterator_t *self, unsigned char *buf, int *result); /* Reads the next MIDI operation _or_ delta time ** Parameters: (song_iterator_t *) self @@ -150,7 +150,7 @@ typedef struct _song_iterator { ** PCM, but this must be done before any subsequent calls to next(). */ - sfx_pcm_feed_t * (*get_pcm_feed)(struct _song_iterator *self); + sfx_pcm_feed_t * (*get_pcm_feed)(song_iterator_t *self); /* Checks for the presence of a pcm sample ** Parameters: (song_iterator_t *) self ** Returns : (sfx_pcm_feed_t *) NULL if no PCM data was found, a @@ -158,8 +158,8 @@ typedef struct _song_iterator { */ - struct _song_iterator * - (* handle_message)(struct _song_iterator *self, song_iterator_message_t msg); + song_iterator_t * + (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); /* Handles a message to the song iterator ** Parameters: (song_iterator_t *) self ** (song_iterator_messag_t) msg: The message to handle @@ -174,20 +174,20 @@ typedef struct _song_iterator { */ - void (*init)(struct _song_iterator *self); + void (*init)(song_iterator_t *self); /* Resets/initializes the sound iterator ** Parameters: (song_iterator_t *) self ** Returns : (void) */ - void (*cleanup)(struct _song_iterator *self); + void (*cleanup)(song_iterator_t *self); /* Frees any content of the iterator structure ** Parameters: (song_iterator_t *) self ** Does not physically free(self) yet. May be NULL if nothing needs to be done. ** Must not recurse on its delegate. */ - int (*get_timepos)(struct _song_iterator *self); + int (*get_timepos)(song_iterator_t *self); /* Gets the song position to store in a savegame ** Parameters: (song_iterator_t *) self */ @@ -199,7 +199,7 @@ typedef struct _song_iterator { /* See songit_* for the constructor and non-virtual member functions */ -} song_iterator_t; +}; /* Song iterator flags */ diff --git a/engines/sci/sfx/sfx_iterator_internal.h b/engines/sci/sfx/sfx_iterator_internal.h index 4c104b5c52..ba6f79742c 100644 --- a/engines/sci/sfx/sfx_iterator_internal.h +++ b/engines/sci/sfx/sfx_iterator_internal.h @@ -50,7 +50,7 @@ namespace Sci { #define SIPFX __FILE__" : " -typedef struct { +struct song_iterator_channel_t { int state; /* SI_STATE_* */ int offset; /* Offset into the data chunk */ int end; /* Last allowed byte in track */ @@ -73,7 +73,7 @@ typedef struct { int saw_notes; /* Bitmask of channels we have currently played notes on */ byte last_cmd; /* Last operation executed, for running status */ -} song_iterator_channel_t; +}; #define INHERITS_BASE_SONG_ITERATOR \ INHERITS_SONG_ITERATOR; /* aka "extends song iterator" */ \ @@ -92,19 +92,19 @@ typedef struct { int loops; /* Number of loops remaining */ \ int recover_delay -typedef struct _base_song_iterator { +struct base_song_iterator_t { INHERITS_BASE_SONG_ITERATOR; -} base_song_iterator_t; +}; /********************************/ /*--------- SCI 0 --------------*/ /********************************/ -typedef struct { +struct sci0_song_iterator_t { INHERITS_BASE_SONG_ITERATOR; song_iterator_channel_t channel; int delay_remaining; /* Number of ticks that haven't been polled yet */ -} sci0_song_iterator_t; +}; /********************************/ @@ -112,17 +112,17 @@ typedef struct { /********************************/ -typedef struct _sci1_sample { +struct sci1_sample_t { int delta; /* Time left-- initially, this is 'Sample point 1'. ** After initialisation, it is 'sample point 1 minus the sample point of the previous sample' */ int size; int announced; /* Announced for download (SI_PCM) */ sfx_pcm_config_t format; byte *data; - struct _sci1_sample *next; -} sci1_sample_t; + sci1_sample_t *next; +}; -typedef struct { +struct sci1_song_iterator_t { INHERITS_BASE_SONG_ITERATOR; song_iterator_channel_t channels[MIDI_CHANNELS]; @@ -136,8 +136,7 @@ typedef struct { int delay_remaining; /* Number of ticks that haven't been polled yet */ int hold; - \ -} sci1_song_iterator_t; +}; #define PLAYMASK_NONE 0x0 @@ -164,11 +163,11 @@ int is_cleanup_iterator(song_iterator_t *it); /*--------- Fast Forward ---------*/ /**********************************/ -typedef struct { +struct fast_forward_song_iterator_t { INHERITS_SONG_ITERATOR; song_iterator_t *delegate; int delta; /* Remaining time */ -} fast_forward_song_iterator_t; +}; song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); @@ -198,7 +197,7 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); #define TEE_MORPH_NONE 0 /* Not waiting to self-morph */ #define TEE_MORPH_READY 1 /* Ready to self-morph */ -typedef struct { +struct tee_song_iterator_t { INHERITS_SONG_ITERATOR; int status; @@ -217,7 +216,7 @@ typedef struct { /* Remapping for channels */ } children[2]; -} tee_song_iterator_t; +}; sfx_pcm_feed_t *sfx_iterator_make_feed(byte *base_data, int offset, diff --git a/engines/sci/sfx/sfx_pcm.h b/engines/sci/sfx/sfx_pcm.h index 726399cf6d..e40641d187 100644 --- a/engines/sci/sfx/sfx_pcm.h +++ b/engines/sci/sfx/sfx_pcm.h @@ -64,19 +64,19 @@ namespace Sci { #define SFX_PCM_FRAME_SIZE(conf) ((conf).stereo? 2 : 1) * (((conf).format & SFX_PCM_FORMAT_16)? 2 : 1) -typedef struct { +struct sfx_pcm_config_t { int rate; /* Sampling rate */ int stereo; /* The stereo mode used (SFX_PCM_MONO or SFX_PCM_STEREO_*) */ unsigned int format; /* Sample format (SFX_PCM_FORMAT_*) */ -} sfx_pcm_config_t; +}; -typedef struct _sfx_pcm_device { +struct sfx_pcm_device_t { /* SFX devices are PCM players, i.e. output drivers for digitalised audio (sequences of audio samples). ** Implementors are (in general) allowed to export specifics of these devices and let the mixer handle ** endianness/signedness/bit size/mono-vs-stereo conversions. */ - int (*init)(struct _sfx_pcm_device *self); + int (*init)(sfx_pcm_device_t *self); /* Initializes the device ** Parameters: (sfx_pcm_device_t *) self: Self reference ** Returns : (int) SFX_OK on success, SFX_ERROR if the device could not be @@ -85,7 +85,7 @@ typedef struct _sfx_pcm_device { ** specified beforehand. */ - int (*output)(struct _sfx_pcm_device *self, byte *buf, + int (*output)(sfx_pcm_device_t *self, byte *buf, int count, sfx_timestamp_t *timestamp); /* Writes output to the device ** Parameters: (sfx_pcm_device_t *) self: Self reference @@ -103,7 +103,7 @@ typedef struct _sfx_pcm_device { */ sfx_timestamp_t - (*get_output_timestamp)(struct _sfx_pcm_device *self); + (*get_output_timestamp)(sfx_pcm_device_t *self); /* Determines the timestamp for 'output' ** Parameters: (sfx_pcm_device_t *) self: Self reference ** Returns : (sfx_timestamp_t) A timestamp (with the device's conf.rate) @@ -121,14 +121,14 @@ typedef struct _sfx_pcm_device { ** output() will block or fail, drained according ** to conf.rate */ -} sfx_pcm_device_t; +}; #define PCM_FEED_TIMESTAMP 0 /* New timestamp available */ #define PCM_FEED_IDLE 1 /* No sound ATM, but new timestamp may be available later */ #define PCM_FEED_EMPTY 2 /* Feed is finished, can be destroyed */ -typedef struct _sfx_pcm_feed_t { +struct sfx_pcm_feed_t { /* PCM feeds are sources of input for the PCM mixer. Their member functions ** are invoked as callbacks on demand, to provide the mixer with input it ** (in turn) passes on to PCM output devices. @@ -136,7 +136,7 @@ typedef struct _sfx_pcm_feed_t { ** to be considered. */ - int (*poll)(struct _sfx_pcm_feed_t *self, byte *dest, int size); + int (*poll)(sfx_pcm_feed_t *self, byte *dest, int size); /* Asks the PCM feed to write out the next stuff it would like to have written ** Parameters: (sfx_pcm_feed_t *) self: Self reference ** (byte *) dest: The destination buffer to write to @@ -148,14 +148,14 @@ typedef struct _sfx_pcm_feed_t { ** is available. */ - void (*destroy)(struct _sfx_pcm_feed_t *self); + void (*destroy)(sfx_pcm_feed_t *self); /* Asks the PCM feed to free all resources it occupies ** Parameters: (sfx_pcm_feed_t *) self: Self reference ** free(self) should be part of this function, if applicable. */ int - (*get_timestamp)(struct _sfx_pcm_feed_t *self, sfx_timestamp_t *timestamp); + (*get_timestamp)(sfx_pcm_feed_t *self, sfx_timestamp_t *timestamp); /* Determines the timestamp of the next frame-to-read ** Returns : (sfx_timestamp_t) timestamp: The timestamp of the next frame ** (int) PCM_FEED_* @@ -171,7 +171,7 @@ typedef struct _sfx_pcm_feed_t { ** (print in hex) */ int frame_size; /* Frame size, computed by the mixer for the feed */ -} sfx_pcm_feed_t; +}; int sfx_pcm_available(); /* Determines whether a PCM device is available and has been initialised diff --git a/engines/sci/sfx/sfx_player.h b/engines/sci/sfx/sfx_player.h index b1e6695f14..9e6247b5c3 100644 --- a/engines/sci/sfx/sfx_player.h +++ b/engines/sci/sfx/sfx_player.h @@ -36,7 +36,7 @@ namespace Sci { typedef void tell_synth_func(int buf_nr, byte *buf); -typedef struct { +struct sfx_player_t { const char *name; const char *version; @@ -115,7 +115,7 @@ typedef struct { int polyphony; /* Number of voices that can play simultaneously */ -} sfx_player_t; +}; sfx_player_t *sfx_find_player(char *name); /* Looks up a player by name or finds the default player diff --git a/engines/sci/sfx/sfx_songlib.h b/engines/sci/sfx/sfx_songlib.h index da619b3777..c1683a2f47 100644 --- a/engines/sci/sfx/sfx_songlib.h +++ b/engines/sci/sfx/sfx_songlib.h @@ -50,7 +50,7 @@ typedef enum { RESTORE_BEHAVIOR_RESTART /* continue it from where it was */ } RESTORE_BEHAVIOR; -typedef struct _song { +struct song_t { song_handle_t handle; int resource_num; /* Resource number */ int priority; /* Song priority (more important if priority is higher) */ @@ -70,18 +70,18 @@ typedef struct _song { ** Playing -> time at which 'delay' has elapsed ** Suspended/Waiting -> stopping time */ - struct _song *next; /* Next song or NULL if this is the last one */ - struct _song *next_playing; /* Next playing song; used by the + song_t *next; /* Next song or NULL if this is the last one */ + song_t *next_playing; /* Next playing song; used by the ** core song system */ - struct _song *next_stopping; /* Next song pending stopping; used exclusively by + song_t *next_stopping; /* Next song pending stopping; used exclusively by ** the core song system's _update_multi_song() */ -} song_t; +}; -typedef struct { +struct songlib_t { song_t **lib; song_t *_s; -} songlib_t; +}; /**************************/ /* Song library commands: */ diff --git a/engines/sci/sfx/sfx_time.h b/engines/sci/sfx/sfx_time.h index d362dfa381..ebb6824e1d 100644 --- a/engines/sci/sfx/sfx_time.h +++ b/engines/sci/sfx/sfx_time.h @@ -28,13 +28,13 @@ namespace Sci { -typedef struct { +struct sfx_timestamp_t { long secs; long usecs; int frame_rate; int frame_offset; /* Total time: secs + usecs + frame_offset/frame_rate */ -} sfx_timestamp_t; +}; sfx_timestamp_t sfx_new_timestamp(long secs, long usecs, int frame_rate); diff --git a/engines/sci/sfx/sfx_timer.h b/engines/sci/sfx/sfx_timer.h index 581f7d1ac5..19971124e6 100644 --- a/engines/sci/sfx/sfx_timer.h +++ b/engines/sci/sfx/sfx_timer.h @@ -30,7 +30,7 @@ namespace Sci { -typedef struct { +struct sfx_timer_t { int delay_ms; /* Approximate delay (in milliseconds) between calls */ int (*init)(void (*callback)(void *data), void *data); @@ -49,7 +49,7 @@ typedef struct { ** All resources allocated with the timer should be freed as an effect ** of this. */ -} sfx_timer_t; +}; } // End of namespace Sci diff --git a/engines/sci/sfx/softseq.h b/engines/sci/sfx/softseq.h index 5a2def8f41..2b0c04ac70 100644 --- a/engines/sci/sfx/softseq.h +++ b/engines/sci/sfx/softseq.h @@ -34,11 +34,11 @@ namespace Sci { /* Software sequencer */ -typedef struct sfx_softseq { +struct sfx_softseq_t { const char *name; const char *version; - int (*set_option)(struct sfx_softseq *self, const char *name, const char *value); + int (*set_option)(sfx_softseq_t *self, const char *name, const char *value); /* Sets an option for the sequencer ** Parameters: (sfx_softseq_t *) self: Self reference ** (const char *) name: Name of the option to set @@ -46,7 +46,7 @@ typedef struct sfx_softseq { ** Returns : (int) GFX_OK on success, or GFX_ERROR if not supported */ - int (*init)(struct sfx_softseq *self, byte *res_data, int res_size, + int (*init)(sfx_softseq_t *self, byte *res_data, int res_size, byte *res2_data, int res2_size); /* Initialises the sequencer ** Parameters: (sfx_softseq_t *) self: Self reference @@ -61,18 +61,18 @@ typedef struct sfx_softseq { ** /even if/ patch_nr is set. */ - void (*exit)(struct sfx_softseq *self); + void (*exit)(sfx_softseq_t *self); /* Uninitialises the sequencer and frees all used resources ** Parameters: (sfx_softseq_t *) self: Self reference */ - void (*set_volume)(struct sfx_softseq *self, int new_volume); + void (*set_volume)(sfx_softseq_t *self, int new_volume); /* Sets the sequencer volume ** Parameters: (sfx_softseq_t *) self: Self reference ** (int) new_volume: A volume, between 0 (quiet) and 127 (max) */ - void (*handle_command)(struct sfx_softseq *self, byte cmd, int argc, byte *argv); + void (*handle_command)(sfx_softseq_t *self, byte cmd, int argc, byte *argv); /* Handle a MIDI command ** Parameters: (sfx_softseq_t *) self: Self reference ** (byte) cmd: Basic MIDI command, always includes command and channel @@ -80,14 +80,14 @@ typedef struct sfx_softseq { ** (byte *) argv: Additional arguments to 'cmd' */ - void (*poll)(struct sfx_softseq *self, byte *dest, int len); + void (*poll)(sfx_softseq_t *self, byte *dest, int len); /* Asks the software sequencer to fill in parts of a buffer ** Parameters: (sfx_softseq_t *) self: Self reference ** (int) len: Number of _frames_ to write ** Returns : (byte) *dest: 'len' frames must be written to this buffer */ - void (*allstop)(struct sfx_softseq *self); + void (*allstop)(sfx_softseq_t *self); /* Stops all sound generation ** Parameters: (sfx_softseq_t *) self: Self reference */ @@ -111,7 +111,7 @@ typedef struct sfx_softseq { sfx_pcm_config_t pcm_conf; /* Setup of the channel the sequencer writes to */ -} sfx_softseq_t; +}; sfx_softseq_t *sfx_find_softseq(const char *name); diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index 95b82d586f..a6926b2101 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -48,19 +48,19 @@ namespace Sci { /* #define DEBUG */ -typedef struct envelope { +struct envelope_t { /* Phase period length in samples */ int length; /* Velocity delta per period */ int delta; /* Target velocity */ int target; -} envelope_t; +}; /* Fast decay envelope */ static envelope_t env_decay = {FREQUENCY / (32 * 64), 1, 0}; -typedef struct instrument { +struct instrument_t { char name[30]; int mode; /* Size of non-looping part in bytes */ @@ -73,15 +73,15 @@ typedef struct instrument { envelope_t envelope[4]; int8 *samples; int8 *loop; -} instrument_t; +}; -typedef struct bank { +struct bank_t { char name[30]; int size; instrument_t *instruments[256]; -} bank_t; +}; -typedef struct channel { +struct channel_t { int instrument; int note; int note_velocity; @@ -94,13 +94,13 @@ typedef struct channel { int hw_channel; frac_t offset; frac_t rate; -} channel_t; +}; -typedef struct hw_channel { +struct hw_channel_t { int instrument; int volume; int pan; -} hw_channel_t; +}; /* Instrument bank */ static bank_t bank; diff --git a/engines/sci/tools.h b/engines/sci/tools.h index c4ae2fc98c..a40c763b89 100644 --- a/engines/sci/tools.h +++ b/engines/sci/tools.h @@ -83,12 +83,12 @@ namespace Sci { -typedef struct { +struct GTimeVal { long tv_sec; long tv_usec; -} GTimeVal; +}; -typedef struct { +struct sci_dir_t { #ifdef WIN32 long search; struct _finddata_t fileinfo; @@ -96,7 +96,7 @@ typedef struct { DIR *dir; char *mask_copy; #endif -} sci_dir_t; /* used by sci_find_first and friends */ +}; /* used by sci_find_first and friends */ |