diff --git a/common/include/ui.h b/common/include/ui.h index c6030fc99..c160861c7 100644 --- a/common/include/ui.h +++ b/common/include/ui.h @@ -232,9 +232,9 @@ extern grs_font_ptr ui_small_font; extern unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED; extern UI_GADGET * selected_gadget; -#define Hline(x1,x2,y) Hline(x1,y,x2) +#define Hline(x1,x2,y,c) Hline(x1,y,x2,c) #define Vline(y1,y2,x) Vline(x,y1,y2) -extern void Hline(short x1, short x2, short y ); +void Hline(short x1, short x2, short y, uint8_t color); extern void Vline(short y1, short y2, short x ); extern void ui_string_centered( short x, short y, const char * s ); extern void ui_draw_box_out( short x1, short y1, short x2, short y2 ); diff --git a/common/ui/listbox.cpp b/common/ui/listbox.cpp index 16e2bfd14..f1c894e17 100644 --- a/common/ui/listbox.cpp +++ b/common/ui/listbox.cpp @@ -109,13 +109,14 @@ void ui_draw_listbox( UI_DIALOG *dlg, UI_GADGET_LISTBOX * listbox ) static void gr_draw_sunken_border( short x1, short y1, short x2, short y2 ) { - + const uint8_t cgrey = CGREY; + const uint8_t cbright = CBRIGHT; gr_setcolor( CGREY ); - Hline( x1-1, x2+1, y1-1); + Hline(x1-1, x2+1, y1-1, cgrey); Vline( y1-1, y2+1, x1-1); gr_setcolor( CBRIGHT ); - Hline( x1-1, x2+1, y2+1); + Hline(x1-1, x2+1, y2+1, cbright); Vline( y1, y2+1, x2+1); } diff --git a/common/ui/message.cpp b/common/ui/message.cpp index 857212946..15a899916 100644 --- a/common/ui/message.cpp +++ b/common/ui/message.cpp @@ -77,10 +77,10 @@ static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m ui_string_centered( m->width/2, m->text_y, m->text ); gr_setcolor( CGREY ); - Hline(1, m->width-2, m->line_y+1 ); + Hline(1, m->width-2, m->line_y+1, CGREY); gr_setcolor( CBRIGHT ); - Hline(2, m->width-2, m->line_y+2 ); + Hline(2, m->width-2, m->line_y+2, CBRIGHT); grd_curscreen->sc_canvas.cv_font = temp_font; diff --git a/common/ui/uidraw.cpp b/common/ui/uidraw.cpp index 80128b769..01ccbeeac 100644 --- a/common/ui/uidraw.cpp +++ b/common/ui/uidraw.cpp @@ -25,9 +25,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. namespace dcx { -void Hline(short x1, short x2, short y ) +void Hline(short x1, short x2, short y, const uint8_t color) { - const auto color = grd_curcanv->cv_color; gr_uline(i2f(x1), i2f(y), i2f(x2), i2f(y), color); } @@ -54,11 +53,11 @@ void ui_draw_shad( short x1, short y1, short x2, short y2, short c1, short c2 ) { gr_setcolor( c1 ); - Hline( x1+0, x2-1, y1+0 ); + Hline(x1+0, x2-1, y1+0, c1); Vline( y1+1, y2+0, x1+0 ); gr_setcolor( c2 ); - Hline( x1+1, x2, y2-0 ); + Hline(x1+1, x2, y2-0, c2); Vline( y1+0, y2-1, x2-0 ); } @@ -78,10 +77,6 @@ void ui_draw_frame( short x1, short y1, short x2, short y2 ) } - - - - void ui_draw_box_out( short x1, short y1, short x2, short y2 ) { @@ -103,25 +98,22 @@ void ui_draw_box_in( short x1, short y1, short x2, short y2 ) ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT ); } - void ui_draw_line_in( short x1, short y1, short x2, short y2 ) { + const uint8_t cgrey = CGREY; + const uint8_t cbright = CBRIGHT; gr_setcolor( CGREY ); - Hline( x1, x2, y1 ); - Hline( x1, x2-1, y2-1 ); + Hline(x1, x2, y1, cgrey); + Hline(x1, x2-1, y2-1, cgrey); Vline( y1+1, y2-2, x1 ); Vline( y1+1, y2-2, x2-1 ); gr_setcolor( CBRIGHT ); - Hline( x1+1, x2-1, y1+1 ); - Hline( x1, x2, y2 ); + Hline(x1+1, x2-1, y1+1, cbright); + Hline(x1, x2, y2, cbright); Vline( y1+2, y2-2, x1+1 ); Vline( y1+1, y2-1, x2 ); } - - - - }