]> granicus.if.org Git - nethack/commitdiff
Change mhmap to use mapglyph()
authornethack.allison <nethack.allison>
Sun, 27 Jan 2002 02:52:33 +0000 (02:52 +0000)
committernethack.allison <nethack.allison>
Sun, 27 Jan 2002 02:52:33 +0000 (02:52 +0000)
win/win32/mhmap.c
win/win32/nethackw.dsp

index 456a0f2875217b38811ad5df60c92373e2370ae2..1823e39915a58bc4f2d8f2f815ff903d612ad8bf 100644 (file)
@@ -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
+}
index 49f86b8899fefaf87c036d3b9805da8bd823cbe8..f9aef09b7a4d60da41436839e7206c1a8558890e 100644 (file)
@@ -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