diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 13 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_res_options.h | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resource.h | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 10 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 21 | ||||
-rw-r--r-- | engines/sci/gfx/palette.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/palette.h | 6 | ||||
-rw-r--r-- | engines/sci/gfx/res_cursor.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gfx/res_pic.cpp | 76 |
9 files changed, 65 insertions, 79 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 1ef2fdf971..4917834fb1 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -3327,16 +3327,17 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) { if (player->dirtyPalette()) { byte *rawPalette = player->getPalette(); - gfx_pixmap_color_t *colors = new gfx_pixmap_color_t[256]; + Palette *colors = new Palette(256); + + byte r, g, b; for (uint16 i = 0; i < 256; i++) { - colors[i].r = rawPalette[i * 4]; - colors[i].g = rawPalette[i * 4 + 1]; - colors[i].b = rawPalette[i * 4 + 2]; - colors[i].global_index = i; + r = rawPalette[i * 4]; + g = rawPalette[i * 4 + 1]; + b = rawPalette[i * 4 + 2]; + colors->setColor(i, r, g, b); } - palette = new Palette(colors, 256); palette->forceInto(s->gfx_state->driver->getMode()->palette); } diff --git a/engines/sci/gfx/gfx_res_options.h b/engines/sci/gfx/gfx_res_options.h index a595c56606..bf2ec8244a 100644 --- a/engines/sci/gfx/gfx_res_options.h +++ b/engines/sci/gfx/gfx_res_options.h @@ -47,7 +47,7 @@ struct gfx_res_assign_t { union { struct { int colors_nr; - gfx_pixmap_color_t *colors; + PaletteEntry *colors; } palette; } assign; }; diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h index 5fcf67e3fa..753e966dd6 100644 --- a/engines/sci/gfx/gfx_resource.h +++ b/engines/sci/gfx/gfx_resource.h @@ -67,7 +67,7 @@ extern int sci0_palette; /** The 16 EGA base colors */ extern Palette* gfx_sci0_image_pal[]; -extern gfx_pixmap_color_t gfx_sci0_image_colors[][16]; +extern PaletteEntry gfx_sci0_image_colors[][16]; /** * The 256 interpolated colors (initialized when gfxr_init_pic() is called diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 526b61d04f..35f5dbed27 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -39,8 +39,6 @@ namespace Sci { /*** Data structures ***/ /***********************/ -#define GFX_COLOR_SYSTEM -1 - #define GFX_MODE_IS_UNSCALED(mode) (((mode)->scaleFactor == 1) && ((mode)->scaleFactor == 1)) /** Graphics mode description @@ -69,14 +67,6 @@ struct gfx_mode_t { -#define GFX_COLOR_INDEX_UNMAPPED -1 - -/** Pixmap-specific color entries */ -struct gfx_pixmap_color_t{ - int global_index; /**< Global index color or GFX_COLOR_INDEX_UNMAPPED. */ - uint8 r, g, b; /**< Real color */ -}; - /** Full color */ struct gfx_color_t { PaletteEntry visual; diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 0e655424a7..ba07071a8a 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -49,14 +49,15 @@ namespace Sci { // Default color maps #define DEFAULT_COLORS_NR 16 -gfx_pixmap_color_t default_colors[DEFAULT_COLORS_NR] = {{GFX_COLOR_SYSTEM, 0x00, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0x00, 0xaa}, - {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0xaa}, - {GFX_COLOR_SYSTEM, 0xaa, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0xaa, 0x00, 0xaa}, - {GFX_COLOR_SYSTEM, 0xaa, 0x55, 0x00}, {GFX_COLOR_SYSTEM, 0xaa, 0xaa, 0xaa}, - {GFX_COLOR_SYSTEM, 0x55, 0x55, 0x55}, {GFX_COLOR_SYSTEM, 0x55, 0x55, 0xff}, - {GFX_COLOR_SYSTEM, 0x55, 0xff, 0x55}, {GFX_COLOR_SYSTEM, 0x55, 0xff, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0x55, 0x55}, {GFX_COLOR_SYSTEM, 0xff, 0x55, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0xff, 0x55}, {GFX_COLOR_SYSTEM, 0xff, 0xff, 0xff} +PaletteEntry default_colors[DEFAULT_COLORS_NR] = { + PaletteEntry(0x00, 0x00, 0x00), PaletteEntry(0x00, 0x00, 0xaa), + PaletteEntry(0x00, 0xaa, 0x00), PaletteEntry(0x00, 0xaa, 0xaa), + PaletteEntry(0xaa, 0x00, 0x00), PaletteEntry(0xaa, 0x00, 0xaa), + PaletteEntry(0xaa, 0x55, 0x00), PaletteEntry(0xaa, 0xaa, 0xaa), + PaletteEntry(0x55, 0x55, 0x55), PaletteEntry(0x55, 0x55, 0xff), + PaletteEntry(0x55, 0xff, 0x55), PaletteEntry(0x55, 0xff, 0xff), + PaletteEntry(0xff, 0x55, 0x55), PaletteEntry(0xff, 0x55, 0xff), + PaletteEntry(0xff, 0xff, 0x55), PaletteEntry(0xff, 0xff, 0xff) }; // "Normal" EGA #define POINTER_VISIBLE_BUT_CLIPPED 2 @@ -775,7 +776,7 @@ void gfxop_draw_line(GfxState *state, Common::Point start, Common::Point end, end.y += yfact >> 1; } - if (color.visual.parent_index == GFX_COLOR_INDEX_UNMAPPED) + if (color.visual.parent_index == -1) gfxop_set_color(state, &color, color); _gfxop_draw_line_clipped(state, start, end, color, line_mode, line_style); } @@ -893,7 +894,7 @@ void gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t if (shade_type == GFX_BOX_SHADE_FLAT) { color1.priority = 0; color1.control = 0; - if (color1.visual.parent_index == GFX_COLOR_INDEX_UNMAPPED) + if (color1.visual.parent_index == -1) gfxop_set_color(state, &color1, color1); drv->drawFilledRect(new_box, color1, color1, GFX_SHADE_FLAT); return; diff --git a/engines/sci/gfx/palette.cpp b/engines/sci/gfx/palette.cpp index bded6a59fa..e69787a389 100644 --- a/engines/sci/gfx/palette.cpp +++ b/engines/sci/gfx/palette.cpp @@ -39,7 +39,7 @@ Palette::Palette(uint s) { _revision = 0; } -Palette::Palette(const gfx_pixmap_color_t *colors, uint s) { +Palette::Palette(const PaletteEntry *colors, uint s) { _size = s; _colors = new PaletteEntry[s]; _parent = 0; @@ -131,7 +131,7 @@ void Palette::unmerge() { _parent = 0; } -void Palette::setColor(uint index, byte r, byte g, byte b) { +void Palette::setColor(uint index, byte r, byte g, byte b, int parentIndex) { assert(index < _size); assert(!_parent); @@ -146,7 +146,7 @@ void Palette::setColor(uint index, byte r, byte g, byte b) { entry.r = r; entry.g = g; entry.b = b; - entry.parent_index = -1; + entry.parent_index = parentIndex; _dirty = true; } diff --git a/engines/sci/gfx/palette.h b/engines/sci/gfx/palette.h index 65d1cac18e..63de4bd7ab 100644 --- a/engines/sci/gfx/palette.h +++ b/engines/sci/gfx/palette.h @@ -57,12 +57,10 @@ struct PaletteEntry { int refcount; }; -struct gfx_pixmap_color_t; - class Palette { public: explicit Palette(uint size); - Palette(const gfx_pixmap_color_t *colors, uint size); + Palette(const PaletteEntry *colors, uint size); ~Palette(); Palette *getref(); @@ -70,7 +68,7 @@ public: Palette *copy(); void resize(uint size); - void setColor(uint index, byte r, byte g, byte b); + void setColor(uint index, byte r, byte g, byte b, int parentIndex = -1); void makeSystemColor(uint index, const PaletteEntry &color); const PaletteEntry &getColor(uint index) const { assert(index < _size); diff --git a/engines/sci/gfx/res_cursor.cpp b/engines/sci/gfx/res_cursor.cpp index 9b3e64b8d5..4dd9d26a88 100644 --- a/engines/sci/gfx/res_cursor.cpp +++ b/engines/sci/gfx/res_cursor.cpp @@ -37,10 +37,10 @@ namespace Sci { #define GFX_SCI01_CURSOR_COLORS_NR 3 #define GFX_SCI0_CURSOR_COLORS_NR 2 -gfx_pixmap_color_t gfx_sci01_cursor_colors[GFX_SCI01_CURSOR_COLORS_NR] = { - {GFX_COLOR_INDEX_UNMAPPED, 0x00, 0x00, 0x00}, - {GFX_COLOR_INDEX_UNMAPPED, 0xff, 0xff, 0xff}, - {GFX_COLOR_INDEX_UNMAPPED, 0xaa, 0xaa, 0xaa} +PaletteEntry gfx_sci01_cursor_colors[GFX_SCI01_CURSOR_COLORS_NR] = { + PaletteEntry(0x00, 0x00, 0x00), + PaletteEntry(0xff, 0xff, 0xff), + PaletteEntry(0xaa, 0xaa, 0xaa) }; gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01) { diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp index ce4510510a..616aab6b1a 100644 --- a/engines/sci/gfx/res_pic.cpp +++ b/engines/sci/gfx/res_pic.cpp @@ -45,25 +45,25 @@ int sci0_palette = 0; ((first) + (((nr)-1) * (last - first)) / 14))) // Default color maps -gfx_pixmap_color_t gfx_sci0_image_colors[SCI0_MAX_PALETTE+1][GFX_SCI0_IMAGE_COLORS_NR] = { - {{GFX_COLOR_SYSTEM, 0x00, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0x00, 0xaa}, - {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0xaa}, - {GFX_COLOR_SYSTEM, 0xaa, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0xaa, 0x00, 0xaa}, - {GFX_COLOR_SYSTEM, 0xaa, 0x55, 0x00}, {GFX_COLOR_SYSTEM, 0xaa, 0xaa, 0xaa}, - {GFX_COLOR_SYSTEM, 0x55, 0x55, 0x55}, {GFX_COLOR_SYSTEM, 0x55, 0x55, 0xff}, - {GFX_COLOR_SYSTEM, 0x55, 0xff, 0x55}, {GFX_COLOR_SYSTEM, 0x55, 0xff, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0x55, 0x55}, {GFX_COLOR_SYSTEM, 0xff, 0x55, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0xff, 0x55}, {GFX_COLOR_SYSTEM, 0xff, 0xff, 0xff}}, // "Normal" EGA - - - {{GFX_COLOR_SYSTEM, 0x00, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0x00, 0xff}, - {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0x00}, {GFX_COLOR_SYSTEM, 0x00, 0xaa, 0xaa}, - {GFX_COLOR_SYSTEM, 0xce, 0x00, 0x00}, {GFX_COLOR_SYSTEM, 0xbe, 0x71, 0xde}, - {GFX_COLOR_SYSTEM, 0x8d, 0x50, 0x00}, {GFX_COLOR_SYSTEM, 0xbe, 0xbe, 0xbe}, - {GFX_COLOR_SYSTEM, 0x55, 0x55, 0x55}, {GFX_COLOR_SYSTEM, 0x00, 0xbe, 0xff}, - {GFX_COLOR_SYSTEM, 0x00, 0xce, 0x55}, {GFX_COLOR_SYSTEM, 0x55, 0xff, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0x9d, 0x8d}, {GFX_COLOR_SYSTEM, 0xff, 0x55, 0xff}, - {GFX_COLOR_SYSTEM, 0xff, 0xff, 0x00}, {GFX_COLOR_SYSTEM, 0xff, 0xff, 0xff}}, // AGI Amiga-ish +PaletteEntry gfx_sci0_image_colors[SCI0_MAX_PALETTE+1][GFX_SCI0_IMAGE_COLORS_NR] = { + {PaletteEntry(0x00, 0x00, 0x00), PaletteEntry(0x00, 0x00, 0xaa), + PaletteEntry(0x00, 0xaa, 0x00), PaletteEntry(0x00, 0xaa, 0xaa), + PaletteEntry(0xaa, 0x00, 0x00), PaletteEntry(0xaa, 0x00, 0xaa), + PaletteEntry(0xaa, 0x55, 0x00), PaletteEntry(0xaa, 0xaa, 0xaa), + PaletteEntry(0x55, 0x55, 0x55), PaletteEntry(0x55, 0x55, 0xff), + PaletteEntry(0x55, 0xff, 0x55), PaletteEntry(0x55, 0xff, 0xff), + PaletteEntry(0xff, 0x55, 0x55), PaletteEntry(0xff, 0x55, 0xff), + PaletteEntry(0xff, 0xff, 0x55), PaletteEntry(0xff, 0xff, 0xff)}, // "Normal" EGA + + + {PaletteEntry(0x00, 0x00, 0x00), PaletteEntry(0x00, 0x00, 0xff), + PaletteEntry(0x00, 0xaa, 0x00), PaletteEntry(0x00, 0xaa, 0xaa), + PaletteEntry(0xce, 0x00, 0x00), PaletteEntry(0xbe, 0x71, 0xde), + PaletteEntry(0x8d, 0x50, 0x00), PaletteEntry(0xbe, 0xbe, 0xbe), + PaletteEntry(0x55, 0x55, 0x55), PaletteEntry(0x00, 0xbe, 0xff), + PaletteEntry(0x00, 0xce, 0x55), PaletteEntry(0x55, 0xff, 0xff), + PaletteEntry(0xff, 0x9d, 0x8d), PaletteEntry(0xff, 0x55, 0xff), + PaletteEntry(0xff, 0xff, 0x00), PaletteEntry(0xff, 0xff, 0xff)}, // AGI Amiga-ish // RGB and I intensities (former taken from the GIMP) #define GR 30 @@ -75,14 +75,14 @@ gfx_pixmap_color_t gfx_sci0_image_colors[SCI0_MAX_PALETTE+1][GFX_SCI0_IMAGE_COLO #define CC(x) (((x)*255)/FULL),(((x)*255)/FULL),(((x)*255)/FULL) // Combines color intensities - {{GFX_COLOR_SYSTEM, CC(0) }, {GFX_COLOR_SYSTEM, CC(GB) }, - {GFX_COLOR_SYSTEM, CC(GG) }, {GFX_COLOR_SYSTEM, CC(GB + GG) }, - {GFX_COLOR_SYSTEM, CC(GR) }, {GFX_COLOR_SYSTEM, CC(GB + GR) }, - {GFX_COLOR_SYSTEM, CC(GG + GR) }, {GFX_COLOR_SYSTEM, CC(GB + GG + GR) }, - {GFX_COLOR_SYSTEM, CC(GI) }, {GFX_COLOR_SYSTEM, CC(GB + GI) }, - {GFX_COLOR_SYSTEM, CC(GG + GI) }, {GFX_COLOR_SYSTEM, CC(GB + GG + GI) }, - {GFX_COLOR_SYSTEM, CC(GR + GI) }, {GFX_COLOR_SYSTEM, CC(GB + GR + GI) }, - {GFX_COLOR_SYSTEM, CC(GG + GR + GI) }, {GFX_COLOR_SYSTEM, CC(GB + GG + GR + GI) }} + {PaletteEntry(CC(0) ), PaletteEntry(CC(GB) ), + PaletteEntry(CC(GG) ), PaletteEntry(CC(GB + GG) ), + PaletteEntry(CC(GR) ), PaletteEntry(CC(GB + GR) ), + PaletteEntry(CC(GG + GR) ), PaletteEntry(CC(GB + GG + GR) ), + PaletteEntry(CC(GI) ), PaletteEntry(CC(GB + GI) ), + PaletteEntry(CC(GG + GI) ), PaletteEntry(CC(GB + GG + GI) ), + PaletteEntry(CC(GR + GI) ), PaletteEntry(CC(GB + GR + GI) ), + PaletteEntry(CC(GG + GR + GI) ), PaletteEntry(CC(GB + GG + GR + GI) )} }; // Grayscale #undef GR @@ -102,25 +102,19 @@ Palette* embedded_view_pal = 0; #define SCI1_PALETTE_SIZE 1284 -// Color mapping used while scaling embedded views. -static const gfx_pixmap_color_t embedded_view_colors[16] = { - {0x00, 0, 0, 0}, {0x11, 0, 0, 0}, {0x22, 0, 0, 0}, {0x33, 0, 0, 0}, - {0x44, 0, 0, 0}, {0x55, 0, 0, 0}, {0x66, 0, 0, 0}, {0x77, 0, 0, 0}, - {0x88, 0, 0, 0}, {0x99, 0, 0, 0}, {0xaa, 0, 0, 0}, {0xbb, 0, 0, 0}, - {0xcc, 0, 0, 0}, {0xdd, 0, 0, 0}, {0xee, 0, 0, 0}, {0xff, 0, 0, 0} -}; - void gfxr_init_static_palette() { + int i; + if (!gfx_sci0_pic_colors) { gfx_sci0_pic_colors = new Palette(256); gfx_sci0_pic_colors->name = "gfx_sci0_pic_colors"; // TODO: Discover the exact purpose of gfx_sci0_pic_colors // For now, we set the first 16 colours to the standard EGA palette, // and fill the remaining entries with slight variations - for (int i = 0; i < 16; i++) { - gfx_sci0_pic_colors->setColor(i,gfx_sci0_image_colors[0][i].r, gfx_sci0_image_colors[0][i].g, gfx_sci0_image_colors[0][i].b); + for (i = 0; i < 16; i++) { + gfx_sci0_pic_colors->setColor(i, gfx_sci0_image_colors[0][i].r, gfx_sci0_image_colors[0][i].g, gfx_sci0_image_colors[0][i].b); } - for (int i = 16; i < 256; i++) { + for (i = 16; i < 256; i++) { byte r = INTERCOL(gfx_sci0_image_colors[sci0_palette][i & 0xf].r, gfx_sci0_image_colors[sci0_palette][i >> 4].r); byte g = INTERCOL(gfx_sci0_image_colors[sci0_palette][i & 0xf].g, @@ -132,12 +126,14 @@ void gfxr_init_static_palette() { //warning("Uncomment me after fixing sci0_palette changes to reset me"); //_gfxr_pic0_colors_initialized = 1; - for (int i = 0; i <= SCI0_MAX_PALETTE; ++i) { + for (i = 0; i <= SCI0_MAX_PALETTE; ++i) { gfx_sci0_image_pal[i] = new Palette(gfx_sci0_image_colors[i], GFX_SCI0_IMAGE_COLORS_NR); gfx_sci0_image_pal[i]->name = "gfx_sci0_image_pal[i]"; } - embedded_view_pal = new Palette(embedded_view_colors, 16); + embedded_view_pal = new Palette(16); + for (i = 0; i < 16; i++) + embedded_view_pal->setColor(i, 0, 0, i * 0x11); embedded_view_pal->name = "embedded_view_pal"; } } |