diff options
author | Paweł Kołodziejski | 2009-02-21 09:44:53 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2009-02-21 09:44:53 +0000 |
commit | ea495756897eafec48ab93f97e978df4c5593f1f (patch) | |
tree | b7b2225e425b62e4a1fe3232785a01e31964a343 /engines | |
parent | 9ad232e5cfac377b8a1b763683e19358b3d56c37 (diff) | |
download | scummvm-rg350-ea495756897eafec48ab93f97e978df4c5593f1f.tar.gz scummvm-rg350-ea495756897eafec48ab93f97e978df4c5593f1f.tar.bz2 scummvm-rg350-ea495756897eafec48ab93f97e978df4c5593f1f.zip |
formating
svn-id: r38673
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gfx/resource/sci_cursor_0.cpp | 18 | ||||
-rw-r--r-- | engines/sci/gfx/resource/sci_font.cpp | 24 | ||||
-rw-r--r-- | engines/sci/gfx/resource/sci_pal_1.cpp | 25 |
3 files changed, 19 insertions, 48 deletions
diff --git a/engines/sci/gfx/resource/sci_cursor_0.cpp b/engines/sci/gfx/resource/sci_cursor_0.cpp index 5af2f106b8..e95b9cff68 100644 --- a/engines/sci/gfx/resource/sci_cursor_0.cpp +++ b/engines/sci/gfx/resource/sci_cursor_0.cpp @@ -42,9 +42,7 @@ gfx_pixmap_color_t gfx_sci01_cursor_colors[GFX_SCI01_CURSOR_COLORS_NR] = { {GFX_COLOR_INDEX_UNMAPPED, 0xaa, 0xaa, 0xaa} }; - -static gfx_pixmap_t * -_gfxr_draw_cursor(int id, byte *resource, int size, int sci01) { +static gfx_pixmap_t *_gfxr_draw_cursor(int id, byte *resource, int size, int sci01) { int colors[4] = {0, 1, GFX_CURSOR_TRANSPARENT, 1}; int line; byte *data; @@ -67,7 +65,7 @@ _gfxr_draw_cursor(int id, byte *resource, int size, int sci01) { if (sci01) { retval->xoffset = get_int_16(resource); retval->yoffset = get_int_16(resource + 2); - } else if (resource[3]) /* center */ + } else if (resource[3]) // center retval->xoffset = retval->yoffset = CURSOR_SIZE / 2; else retval->xoffset = retval->yoffset = 0; @@ -81,23 +79,17 @@ _gfxr_draw_cursor(int id, byte *resource, int size, int sci01) { int i; for (i = 0; i < 16; i++) { - int color_code = ((mask_a << i) & 0x8000) - | (((mask_b << i) >> 1) & 0x4000); - + int color_code = ((mask_a << i) & 0x8000) | (((mask_b << i) >> 1) & 0x4000); *data++ = colors[color_code >> 14]; } } return retval; } - -gfx_pixmap_t * -gfxr_draw_cursor0(int id, byte *resource, int size) { +gfx_pixmap_t *gfxr_draw_cursor0(int id, byte *resource, int size) { return _gfxr_draw_cursor(id, resource, size, 0); } -gfx_pixmap_t * -gfxr_draw_cursor01(int id, byte *resource, int size) { +gfx_pixmap_t *gfxr_draw_cursor01(int id, byte *resource, int size) { return _gfxr_draw_cursor(id, resource, size, 1); } - diff --git a/engines/sci/gfx/resource/sci_font.cpp b/engines/sci/gfx/resource/sci_font.cpp index de5b348823..6a9c40f332 100644 --- a/engines/sci/gfx/resource/sci_font.cpp +++ b/engines/sci/gfx/resource/sci_font.cpp @@ -31,12 +31,10 @@ extern int font_counter; - #define FONT_HEIGHT_OFFSET 4 #define FONT_MAXCHAR_OFFSET 2 -static int -calc_char(byte *dest, int total_width, int total_height, byte *src, int size) { +static int calc_char(byte *dest, int total_width, int total_height, byte *src, int size) { int width = src[0]; int height = src[1]; int byte_width = (width + 7) >> 3; @@ -63,9 +61,7 @@ calc_char(byte *dest, int total_width, int total_height, byte *src, int size) { return GFX_OK; } - -gfx_bitmap_font_t * -gfxr_read_font(int id, byte *resource, int size) { +gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { gfx_bitmap_font_t *font = (gfx_bitmap_font_t*)sci_calloc(sizeof(gfx_bitmap_font_t), 1); int chars_nr; int max_width = 0, max_height; @@ -84,8 +80,7 @@ gfxr_read_font(int id, byte *resource, int size) { if (chars_nr < 0 || chars_nr > 256 || max_height < 0) { if (chars_nr < 0 || chars_nr > 256) - GFXERROR("Font %04x: Invalid number of characters: %d\n", id, - chars_nr); + GFXERROR("Font %04x: Invalid number of characters: %d\n", id, chars_nr); if (max_height < 0) GFXERROR("Font %04x: Invalid font height: %d\n", id, max_height); gfxr_free_font(font); @@ -93,8 +88,7 @@ gfxr_read_font(int id, byte *resource, int size) { } if (size < 6 + chars_nr * 2) { - GFXERROR("Font %04x: Insufficient space for %d characters in font\n", - id, chars_nr); + GFXERROR("Font %04x: Insufficient space for %d characters in font\n", id, chars_nr); gfxr_free_font(font); return NULL; } @@ -106,8 +100,7 @@ gfxr_read_font(int id, byte *resource, int size) { int offset = get_int_16(resource + (i << 1) + 6); if (offset >= size) { - GFXERROR("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)\n", - id, i, offset, size); + GFXERROR("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)\n", id, i, offset, size); gfxr_free_font(font); return NULL; } @@ -130,13 +123,12 @@ gfxr_read_font(int id, byte *resource, int size) { font->row_size = (font->row_size + 3) & ~3; font->char_size = font->row_size * max_height; - font->data = (byte*)sci_calloc(font->char_size, chars_nr); + font->data = (byte *)sci_calloc(font->char_size, chars_nr); for (i = 0; i < chars_nr; i++) { int offset = get_int_16(resource + (i << 1) + 6); - if (calc_char(font->data + (font->char_size * i), font->row_size, max_height, - resource + offset, size - offset)) { + if (calc_char(font->data + (font->char_size * i), font->row_size, max_height, resource + offset, size - offset)) { GFXERROR("Problem occured in font %04x, char %d/%d\n", id, i, chars_nr); gfxr_free_font(font); return NULL; @@ -145,5 +137,3 @@ gfxr_read_font(int id, byte *resource, int size) { return font; } - - diff --git a/engines/sci/gfx/resource/sci_pal_1.cpp b/engines/sci/gfx/resource/sci_pal_1.cpp index b9a2b1c50a..b344ee355f 100644 --- a/engines/sci/gfx/resource/sci_pal_1.cpp +++ b/engines/sci/gfx/resource/sci_pal_1.cpp @@ -36,8 +36,7 @@ #define SCI_PAL_FORMAT_VARIABLE_FLAGS 0 #define SCI_PAL_FORMAT_CONSTANT_FLAGS 1 -gfx_pixmap_color_t * -gfxr_read_pal11(int id, int *colors_nr, byte *resource, int size) { +gfx_pixmap_color_t *gfxr_read_pal11(int id, int *colors_nr, byte *resource, int size) { int start_color = resource[25]; int format = resource[32]; int entry_size = 0; @@ -55,8 +54,7 @@ gfxr_read_pal11(int id, int *colors_nr, byte *resource, int size) { break; } - retval = (gfx_pixmap_color_t *) - sci_malloc(sizeof(gfx_pixmap_color_t) * (_colors_nr + start_color)); + retval = (gfx_pixmap_color_t *)sci_malloc(sizeof(gfx_pixmap_color_t) * (_colors_nr + start_color)); memset(retval, 0, sizeof(gfx_pixmap_color_t) * (_colors_nr + start_color)); for (i = 0; i < start_color; i ++) { @@ -86,8 +84,7 @@ gfxr_read_pal11(int id, int *colors_nr, byte *resource, int size) { return retval; } -gfx_pixmap_color_t * -gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size) { +gfx_pixmap_color_t *gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size) { int counter = 0; int pos; unsigned int colors[MAX_COLORS] = {0}; @@ -98,14 +95,10 @@ gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size) { return NULL; } - pos = PALETTE_START; while (pos < size/* && resource[pos] == COLOR_OK && counter < MAX_COLORS*/) { - int color = resource[pos] - | (resource[pos + 1] << 8) - | (resource[pos + 2] << 16) - | (resource[pos + 3] << 24); + int color = resource[pos] | (resource[pos + 1] << 8) | (resource[pos + 2] << 16) | (resource[pos + 3] << 24); pos += 4; @@ -123,9 +116,6 @@ gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size) { } retval = (gfx_pixmap_color_t*)sci_malloc(sizeof(gfx_pixmap_color_t) * counter); -#ifdef SATISFY_PURIFY - memset(retval, 0, sizeof(gfx_pixmap_color_t) * counter); -#endif *colors_nr = counter; for (pos = 0; pos < counter; pos++) { @@ -140,12 +130,11 @@ gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size) { return retval; } -gfx_pixmap_color_t * -gfxr_read_pal1_amiga(int *colors_nr, FILE *f) { +gfx_pixmap_color_t *gfxr_read_pal1_amiga(int *colors_nr, FILE *f) { int i; gfx_pixmap_color_t *retval; - retval = (gfx_pixmap_color_t*)sci_malloc(sizeof(gfx_pixmap_color_t) * 32); + retval = (gfx_pixmap_color_t *)sci_malloc(sizeof(gfx_pixmap_color_t) * 32); for (i = 0; i < 32; i++) { int b1, b2; @@ -165,6 +154,6 @@ gfxr_read_pal1_amiga(int *colors_nr, FILE *f) { } *colors_nr = 32; + return retval; } - |