From: nethack.allison Date: Mon, 11 Mar 2002 23:38:59 +0000 (+0000) Subject: (from Yitzhak) X-Git-Tag: MOVE2GIT~2989 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d936f1a1bff44895f489bdc823c41e79f3cf9d56;p=nethack (from Yitzhak) --- diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 8355b16ab..2790bb3d1 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -548,11 +548,12 @@ void onPaint(HWND hWnd) for(i=paint_rt.left; imap[i][j]>=0) { - uchar ch; + char ch; TCHAR wch; RECT glyph_rect; int color; - unsigned special, mgch; + unsigned special; + int mgch; HBRUSH back_brush; nhcoord2display(data, i, j, &glyph_rect); @@ -564,7 +565,7 @@ void onPaint(HWND hWnd) /* rely on NetHack core helper routine */ mapglyph(data->map[i][j], &mgch, &color, &special, i, j); - ch = (uchar)mgch; + ch = (char)mgch; if (((special & MG_PET) && iflags.hilite_pet) || ((special & MG_DETECT) && iflags.use_inverse)) { back_brush = CreateSolidBrush(RGB(192, 192, 192)); @@ -848,23 +849,23 @@ void nhglyph2charcolor(short g, uchar* ch, int* color) COLORREF nhcolor_to_RGB(int c) { switch(c) { - case CLR_BLACK: return RGB( 85, 85, 85); - case CLR_RED: return RGB(255, 0, 0); - case CLR_GREEN: return RGB( 0, 128, 0); - case CLR_BROWN: return RGB(165, 42, 42); - case CLR_BLUE: return RGB( 0, 0, 255); - case CLR_MAGENTA: return RGB(255, 0, 255); - case CLR_CYAN: return RGB( 0, 255, 255); - case CLR_GRAY: return RGB(192, 192, 192); - case NO_COLOR: return RGB(255, 255, 255); - case CLR_ORANGE: return RGB(255, 165, 0); - case CLR_BRIGHT_GREEN: return RGB( 0, 255, 0); - case CLR_YELLOW: return RGB(255, 255, 0); - case CLR_BRIGHT_BLUE: return RGB(0, 191, 255); - case CLR_BRIGHT_MAGENTA: return RGB(255, 127, 255); - case CLR_BRIGHT_CYAN: return RGB(127, 255, 255); /* something close to aquamarine */ - case CLR_WHITE: return RGB(255, 255, 255); - default: return RGB( 0, 0, 0); /* black */ + case CLR_BLACK: return RGB(0x55, 0x55, 0x55); + case CLR_RED: return RGB(0xFF, 0x00, 0x00); + case CLR_GREEN: return RGB(0x00, 0x80, 0x00); + case CLR_BROWN: return RGB(0xA5, 0x2A, 0x2A); + case CLR_BLUE: return RGB(0x00, 0x00, 0xFF); + case CLR_MAGENTA: return RGB(0xFF, 0x00, 0xFF); + case CLR_CYAN: return RGB(0x00, 0xFF, 0xFF); + case CLR_GRAY: return RGB(0xC0, 0xC0, 0xC0); + case NO_COLOR: return RGB(0xFF, 0xFF, 0xFF); + case CLR_ORANGE: return RGB(0xFF, 0xA5, 0x00); + case CLR_BRIGHT_GREEN: return RGB(0x00, 0xFF, 0x00); + case CLR_YELLOW: return RGB(0xFF, 0xFF, 0x00); + case CLR_BRIGHT_BLUE: return RGB(0x00, 0xC0, 0xFF); + case CLR_BRIGHT_MAGENTA: return RGB(0xFF, 0x80, 0xFF); + case CLR_BRIGHT_CYAN: return RGB(0x80, 0xFF, 0xFF); /* something close to aquamarine */ + case CLR_WHITE: return RGB(0xFF, 0xFF, 0xFF); + default: return RGB(0x00, 0x00, 0x00); /* black */ } } diff --git a/win/win32/mhrip.c b/win/win32/mhrip.c index 2f17a2062..2f480bf80 100644 --- a/win/win32/mhrip.c +++ b/win/win32/mhrip.c @@ -59,6 +59,7 @@ void mswin_display_RIP_window (HWND hWnd) RECT clientrect; RECT textrect; HDC hdc; + HFONT OldFont; data = (PNHRIPWindow)GetWindowLong(hWnd, GWL_USERDATA); @@ -75,8 +76,10 @@ void mswin_display_RIP_window (HWND hWnd) if (data->window_text) { hdc = GetDC (hWnd); + OldFont = SelectObject (hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE)); DrawText (hdc, data->window_text, strlen(data->window_text), &textrect, DT_LEFT | DT_NOPREFIX | DT_CALCRECT); + SelectObject (hdc, OldFont); ReleaseDC(hWnd, hdc); } if (textrect.right - textrect.left > RIP_WIDTH) @@ -145,8 +148,10 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam HDC hdcBitmap; HANDLE OldBitmap; PAINTSTRUCT ps; + HFONT OldFont; hdc = BeginPaint (hWnd, &ps); + OldFont = SelectObject (hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE)); hdcBitmap = CreateCompatibleDC(hdc); SetBkMode (hdc, TRANSPARENT); GetClientRect (hWnd, &clientrect); @@ -177,6 +182,7 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK); } SelectObject (hdcBitmap, OldBitmap); + SelectObject (hdc, OldFont); DeleteDC (hdcBitmap); EndPaint (hWnd, &ps); } diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 1bb435409..11ae2b685 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1549,29 +1549,42 @@ typedef struct ctv COLORREF colorvalue; } color_table_value; +/* + * The color list here is a combination of: + * NetHack colors. (See mhmap.c) + * HTML colors. (See http://www.w3.org/TR/REC-html40/types.html#h-6.5 ) + */ + static color_table_value color_table[] = { - { "black", RGB(0x00, 0x00, 0x00)}, - { "red", RGB(0xFF, 0x00, 0x00)}, - { "green", RGB(0x00, 0x80, 0x00)}, - { "brown", RGB(200,160,0)}, - { "blue", RGB(0,0,170)}, - { "magenta", RGB(160,0,160)}, - { "cyan", RGB(0,160,160,)}, - { "gray", RGB(0x80, 0x80, 0x80)}, - { "orange", RGB(255,140,0)}, - { "yellow", RGB(0xFF, 0xFF, 0x00)}, - { "white", RGB(0xFF, 0xFF, 0xFF)}, - { "purple", RGB(0x80, 0x00, 0x80)}, - { "silver", RGB(0xC0, 0xC0, 0xC0)}, - { "grey", RGB(0x80, 0x80, 0x80)}, - { "maroon", RGB(0x80, 0x00, 0x00)}, - { "fuchsia", RGB(0xFF, 0x00, 0xFF)}, - { "lime", RGB(0x00, 0xFF, 0x00)}, - { "olive", RGB(0x80, 0x80, 0x00)}, - { "navy", RGB(0x00, 0x00, 0x80)}, - { "teal", RGB(0x00, 0x80, 0x80)}, - { "aqua", RGB(0x00, 0xFF, 0xFF)}, - { "", RGB(0x00, 0x00, 0x00)}, +/* NetHack colors */ + { "black", RGB(0x55, 0x55, 0x55)}, + { "red", RGB(0xFF, 0x00, 0x00)}, + { "green", RGB(0x00, 0x80, 0x00)}, + { "brown", RGB(0xA5, 0x2A, 0x2A)}, + { "blue", RGB(0x00, 0x00, 0xFF)}, + { "magenta", RGB(0xFF, 0x00, 0xFF)}, + { "cyan", RGB(0x00, 0xFF, 0xFF)}, + { "orange", RGB(0xFF, 0xA5, 0x00)}, + { "brightgreen", RGB(0x00, 0xFF, 0x00)}, + { "yellow", RGB(0xFF, 0xFF, 0x00)}, + { "brightblue", RGB(0x00, 0xC0, 0xFF)}, + { "brightmagenta", RGB(0xFF, 0x80, 0xFF)}, + { "brightcyan", RGB(0x80, 0xFF, 0xFF)}, + { "white", RGB(0xFF, 0xFF, 0xFF)}, +/* Remaining HTML colors */ + { "trueblack", RGB(0x00, 0x00, 0x00)}, + { "gray", RGB(0x80, 0x80, 0x80)}, + { "grey", RGB(0x80, 0x80, 0x80)}, + { "purple", RGB(0x80, 0x00, 0x80)}, + { "silver", RGB(0xC0, 0xC0, 0xC0)}, + { "maroon", RGB(0x80, 0x00, 0x00)}, + { "fuchsia", RGB(0xFF, 0x00, 0xFF)}, /* = NetHack magenta */ + { "lime", RGB(0x00, 0xFF, 0x00)}, /* = NetHack bright green */ + { "olive", RGB(0x80, 0x80, 0x00)}, + { "navy", RGB(0x00, 0x00, 0x80)}, + { "teal", RGB(0x00, 0x80, 0x80)}, + { "aqua", RGB(0x00, 0xFF, 0xFF)}, /* = NetHack cyan */ + { "", RGB(0x00, 0x00, 0x00)}, }; typedef struct ctbv