From: nethack.allison Date: Sun, 27 Jan 2002 02:52:33 +0000 (+0000) Subject: Change mhmap to use mapglyph() X-Git-Tag: MOVE2GIT~3335 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=775b022819d21d4269ecb18f3624a180df5cee4d;p=nethack Change mhmap to use mapglyph() --- diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 456a0f287..1823e3991 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -7,6 +7,10 @@ #include "mhmsg.h" #include "mhinput.h" +#if (VERSION_MAJOR < 3) && (VERSION_MINOR < 3) && (PATCHLEVEL < 2) +#include "patchlevel.h" +#endif + #define NHMAP_FONT_NAME TEXT("Terminal") #define MAXWINDOWTEXT 255 #define CLIPAROUND_MARGIN 5 @@ -37,7 +41,9 @@ static void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam); static void onPaint(HWND hWnd); static void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam); static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut); +#if (VERSION_MAJOR < 3) && (VERSION_MINOR < 3) && (PATCHLEVEL < 2) static void nhglyph2charcolor(short glyph, uchar* ch, int* color); +#endif static COLORREF nhcolor_to_RGB(int c); HWND mswin_init_map_window () { @@ -525,9 +531,16 @@ void onPaint(HWND hWnd) TCHAR wch; RECT glyph_rect; int color; - + unsigned special, mgch; + +#if (VERSION_MAJOR < 3) && (VERSION_MINOR < 3) && (PATCHLEVEL < 2) nhglyph2charcolor(data->map[i][j], &ch, &color); - +#else + /* rely on NetHack core helper routine */ + mapglyph(data->map[i][j], &mgch, &color, + &special, i, j); + ch = (uchar)mgch; +#endif SetTextColor( hDC, nhcolor_to_RGB(color) ); nhcoord2display(data, i, j, &glyph_rect); @@ -744,6 +757,7 @@ void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut) lpOut->bottom = lpOut->top + data->yScrTile; } +#if (VERSION_MAJOR < 3) && (VERSION_MINOR < 3) && (PATCHLEVEL < 2) /* map glyph to character/color combination */ void nhglyph2charcolor(short g, uchar* ch, int* color) { @@ -797,6 +811,7 @@ void nhglyph2charcolor(short g, uchar* ch, int* color) } // end of wintty code } +#endif /* map nethack color to RGB */ COLORREF nhcolor_to_RGB(int c) @@ -904,4 +919,4 @@ void nhapply_image_transparent( DeleteDC(hdcBack); DeleteDC(hdcObject); DeleteDC(hdcSave); -} \ No newline at end of file +} diff --git a/win/win32/nethackw.dsp b/win/win32/nethackw.dsp index 49f86b889..f9aef09b7 100644 --- a/win/win32/nethackw.dsp +++ b/win/win32/nethackw.dsp @@ -266,6 +266,10 @@ SOURCE=..\src\makemon.c # End Source File # Begin Source File +SOURCE=..\src\mapglyph.c +# End Source File +# Begin Source File + SOURCE=..\src\mcastu.c # End Source File # Begin Source File