aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/gfx_driver.cpp26
-rw-r--r--engines/sci/gfx/gfx_driver.h32
-rw-r--r--engines/sci/gfx/gfx_operations.h22
-rw-r--r--engines/sci/gfx/gfx_options.h4
-rw-r--r--engines/sci/gfx/gfx_res_options.h23
-rw-r--r--engines/sci/gfx/gfx_resmgr.h12
-rw-r--r--engines/sci/gfx/gfx_resource.h20
-rw-r--r--engines/sci/gfx/gfx_state_internal.h71
-rw-r--r--engines/sci/gfx/gfx_system.h8
-rw-r--r--engines/sci/gfx/operations.cpp12
-rw-r--r--engines/sci/gfx/sbtree.cpp4
-rw-r--r--engines/sci/gfx/sbtree.h4
-rw-r--r--engines/sci/gfx/widgets.cpp6
13 files changed, 123 insertions, 121 deletions
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
}