1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Use constants for colours

This commit is contained in:
Marijn van der Werf
2016-08-06 19:47:55 +02:00
parent 207f552203
commit 198ebd0cb1
16 changed files with 46 additions and 44 deletions

View File

@@ -65,6 +65,8 @@ enum {
COLOUR_LIGHT_WATER = 10
};
#define COLOUR_FLAG_OUTLINE (1 << 5)
#define COLOUR_FLAG_INSET (1 << 6)
#define COLOUR_FLAG_TRANSLUCENT (1 << 7)
#define TRANSLUCENT(x) ((x) | COLOUR_FLAG_TRANSLUCENT)
#define NOT_TRANSLUCENT(x) ((x) & ~COLOUR_FLAG_TRANSLUCENT)

View File

@@ -861,7 +861,7 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
int t = w->y + widget->top;
// Get the colour
uint8 colour = w->colours[widget->colour] & 0x7F;
uint8 colour = NOT_TRANSLUCENT(w->colours[widget->colour]);
if (widget->type == WWT_4 || widget->type == WWT_COLOURBTN || widget->type == WWT_TRNBTN || widget->type == WWT_TAB)
if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))
@@ -870,12 +870,12 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
if (widget_is_disabled(w, widgetIndex)) {
// Draw greyed out (light border bottom right shadow)
colour = w->colours[widget->colour];
colour = ColourMapA[colour & 0x7F].lighter;
colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter;
gfx_draw_sprite_solid(dpi, image, l + 1, t + 1, colour);
// Draw greyed out (dark)
colour = w->colours[widget->colour];
colour = ColourMapA[colour & 0x7F].mid_light;
colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light;
gfx_draw_sprite_solid(dpi, image, l, t, colour);
} else {
if (image & 0x80000000) {