]> granicus.if.org Git - nethack/commitdiff
(from Yitzhak)
authornethack.allison <nethack.allison>
Mon, 4 Mar 2002 22:55:45 +0000 (22:55 +0000)
committernethack.allison <nethack.allison>
Mon, 4 Mar 2002 22:55:45 +0000 (22:55 +0000)
win32gui: more splash screen integration

The Makefile have rip.uu/splash.uu added to them.  However, this won't
work if you don't have splash.uu.  Instead, just copy rip.uu or another
.uu and name it splash.uu.  Make expects to have splash.uu present (at
least Borland's make).   It doesn't add splash.uu decoding to the IDE
framework.  It does a bit in winhack.rc and Makefile.bcc to bring
winhack.rc up to sync with Borland's compiler.  If you don't like the
splash screen, then I'll have to redo that part of the patch apart from
the others.

12 files changed:
sys/winnt/Makefile.bcc
sys/winnt/Makefile.nt
win/win32/mhfont.c
win/win32/mhfont.h
win/win32/mhmap.h
win/win32/mhrip.c
win/win32/mswproc.c
win/win32/nethackw.dsp
win/win32/resource.h
win/win32/winMS.h
win/win32/winhack.c
win/win32/winhack.rc

index a96d4c8040746dbc231cacb5bbfa41b65a17a333..23569748ec22139cfed08a97aaf3b4cf0cef6294 100644 (file)
@@ -193,7 +193,7 @@ PRECOMPHEAD = N                     # set to Y if you want to use precomp. headers
 !IF "$(GRAPHICAL)" == "Y"
 WINPORT  = $(O)tile.o $(O)mhaskyn.o $(O)mhdlg.o \
        $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
-       $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o \
+       $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \
        $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o
 WINPFLAG   = -DTILES -DMSWIN_GRAPHICS
 NHRES   = $(O)winhack.res
@@ -583,10 +583,13 @@ tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe
        @echo Optional tile development utilities are up to date.
 
 !IF "$(GRAPHICAL)"=="Y"
-$(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc
+$(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
+       $(WIN32)\mnselcnt.bmp $(WIN32)\mnunsel.bmp \
+       $(WIN32)\petmark.bmp $(WIN32)\NetHack.ico $(WIN32)\rip.bmp \
+       $(WIN32)\splash.bmp
        @$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
 !ELSE
-$(NHRES): $(NTSYS)\console.rc
+$(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
        @$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc
 !ENDIF
 
@@ -670,6 +673,55 @@ $(INCL)\vis_tab.h: $(U)makedefs.exe
 $(SRC)\vis_tab.c: $(U)makedefs.exe
        $(U)makedefs -z
 
+#==========================================
+# uudecode utility and uuencoded targets
+#==========================================
+
+$(U)uudecode.exe: $(O)uudecode.o
+       @$(link) $(LFLAGSU) $(startobj) $(O)\uudecode.o, $@,,$(libsmt)
+
+$(O)uudecode.o: $(SSYS)\uudecode.c
+
+$(NTSYS)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu
+       chdir $(NTSYS)
+       ..\..\util\uudecode.exe nhico.uu
+       chdir ..\..\src
+
+$(WIN32)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe ../../sys/winnt/nhico.uu
+       chdir ..\..\src
+
+$(WIN32)\mnsel.bmp: $(U)uudecode.exe $(WIN32)\mnsel.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe mnsel.uu
+       chdir ..\..\src
+
+$(WIN32)\mnselcnt.bmp: $(U)uudecode.exe $(WIN32)\mnselcnt.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe mnselcnt.uu
+       chdir ..\..\src
+
+$(WIN32)\mnunsel.bmp: $(U)uudecode.exe $(WIN32)\mnunsel.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe mnunsel.uu
+       chdir ..\..\src
+
+$(WIN32)\petmark.bmp: $(U)uudecode.exe $(WIN32)\petmark.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe petmark.uu
+       chdir ..\..\src
+
+$(WIN32)\rip.bmp: $(U)uudecode.exe $(WIN32)\rip.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe rip.uu
+       chdir ..\..\src
+
+$(WIN32)\splash.bmp: $(U)uudecode.exe $(WIN32)\splash.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe splash.uu
+       chdir ..\..\src
+
 #==========================================
 # Level Compiler Stuff
 #==========================================
index 415011d656da12841e01fcba8f8419240ff973b7..efa62f0b53a9bc45da9fdfa3d7a995b199f2bddf 100644 (file)
@@ -139,7 +139,7 @@ PRECOMPHEAD = N                     # set to Y if you want to use precomp. headers
 !IF "$(GRAPHICAL)" == "Y"
 WINPORT  = $(O)tile.o $(O)mhaskyn.o $(O)mhdlg.o \
        $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
-       $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o \
+       $(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \
        $(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o
 WINPFLAG   = -DTILES -DMSWIN_GRAPHICS
 NHRES   = $(O)winhack.res
@@ -533,8 +533,9 @@ tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
 
 !IF "$(GRAPHICAL)"=="Y"
 $(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
-       $(WIN32)\mnselcnt.bmp $(WIN32)\mnunsel.bmp $(WIN32)\petmark.bmp \
-       $(WIN32)\NetHack.ico
+       $(WIN32)\mnselcnt.bmp $(WIN32)\mnunsel.bmp \
+       $(WIN32)\petmark.bmp $(WIN32)\NetHack.ico $(WIN32)\rip.bmp \
+       $(WIN32)\splash.bmp
        @$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
 !ELSE
 $(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
@@ -663,6 +664,16 @@ $(WIN32)\petmark.bmp: $(U)uudecode.exe $(WIN32)\petmark.uu
        ..\..\util\uudecode.exe petmark.uu
        chdir ..\..\src
 
+$(WIN32)\rip.bmp: $(U)uudecode.exe $(WIN32)\rip.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe rip.uu
+       chdir ..\..\src
+
+$(WIN32)\splash.bmp: $(U)uudecode.exe $(WIN32)\splash.uu
+       chdir $(WIN32)
+       ..\..\util\uudecode.exe splash.uu
+       chdir ..\..\src
+
 #==========================================
 # Level Compiler Stuff
 #==========================================
index 3e3d86eca6ca30ea85e72f8feba2d436213449c3..473889ecf301c420963b2d8dbafb1dc03796b058 100644 (file)
@@ -13,11 +13,45 @@ static struct font_table_entry {
        HFONT   hFont;
 } font_table[MAXFONTS] ;
 static int font_table_size = 0;
+HFONT version_splash_font;
+HFONT extrainfo_splash_font;
 
 #define NHFONT_CODE(win, attr) (((attr&0xFF)<<8)|(win_type&0xFF))
 
 static void __cdecl font_table_cleanup(void);
 
+void mswin_init_splashfonts(HWND hWnd)
+{
+       HDC hdc = GetDC(hWnd);
+       HFONT fnt = NULL;
+       LOGFONT lgfnt;
+       ZeroMemory( &lgfnt, sizeof(lgfnt) );
+       lgfnt.lfHeight          = -60*GetDeviceCaps(hdc, LOGPIXELSY)/72;         // height of font
+       lgfnt.lfWidth           =       0;                                   // average character width
+       lgfnt.lfEscapement      =       0;                                       // angle of escapement
+       lgfnt.lfOrientation             =       0;                                       // base-line orientation angle
+       lgfnt.lfWeight          =       FW_BOLD;   // font weight
+       lgfnt.lfItalic                  =       FALSE;               // italic attribute option
+       lgfnt.lfUnderline               =       FALSE;           // underline attribute option
+       lgfnt.lfStrikeOut               =       FALSE;                       // strikeout attribute option
+       lgfnt.lfCharSet         =       OEM_CHARSET;     // character set identifier
+       lgfnt.lfOutPrecision    =       OUT_DEFAULT_PRECIS;  // output precision
+       lgfnt.lfClipPrecision   =       CLIP_DEFAULT_PRECIS; // clipping precision
+       lgfnt.lfQuality         =       DEFAULT_QUALITY;     // output quality
+       lgfnt.lfPitchAndFamily  = DEFAULT_PITCH;                 // pitch and family
+       NH_A2W( "Times New Roman", lgfnt.lfFaceName, LF_FACESIZE);
+       version_splash_font = CreateFontIndirect(&lgfnt);
+       lgfnt.lfHeight          = -12*GetDeviceCaps(hdc, LOGPIXELSY)/72;         // height of font
+       extrainfo_splash_font = CreateFontIndirect(&lgfnt);
+       ReleaseDC(hWnd, hdc);
+}
+
+void mswin_destroy_splashfonts()
+{
+       DeleteObject (version_splash_font);
+       DeleteObject (extrainfo_splash_font);
+}
+
 /* create font based on window type, charater attributes and
    window device context */
 HGDIOBJ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace)
index 31888df1b72919ec22c507433b4f4664ef1eaff4..b9cc234040f65b5b1bac0a500c475306d7d26398 100644 (file)
@@ -9,5 +9,7 @@
 #include "winMS.h"
 
 HGDIOBJ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace);
+void mswin_init_splashfonts(HWND hWnd);
+void mswin_destroy_splashfonts(void);
 
 #endif /* MSWINFont_h */
index 4490ca018ebb54205a9eb5415497c9d129ba36b2..c7d7d3a0037ec2acac84b32e553c9d90667bd0f9 100644 (file)
@@ -11,7 +11,6 @@
 
 HWND mswin_init_map_window (void);
 void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw);
-
 int mswin_map_mode(HWND hWnd, int mode);
 
 #define ROGUE_LEVEL_MAP_MODE           MAP_MODE_ASCII12x16     
index 37099832b92d05c2e627659ed067fd4a529adec3..321a733742c1926f37a479e5e267b431404997d6 100644 (file)
@@ -7,6 +7,8 @@
 #include "mhmsg.h"
 #include "mhfont.h"
 
+#define RIP_WIDTH      400
+#define RIP_HEIGHT     200
 
 PNHWinApp GetNHApp(void);
 
@@ -16,12 +18,8 @@ typedef struct mswin_nethack_text_window {
        TCHAR*  rip_text;
 } NHRIPWindow, *PNHRIPWindow;
 
-static WNDPROC  editControlWndProc = 0;
-
-BOOL   CALLBACK        NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK       NHEditHookWndProc(HWND, UINT, WPARAM, LPARAM);
+BOOL CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
 static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
-static void LayoutText(HWND hwnd);
 
 HWND mswin_init_RIP_window () {
        HWND ret;
@@ -50,7 +48,6 @@ void mswin_display_RIP_window (HWND hWnd)
        PNHRIPWindow data;
        HWND mapWnd;
        RECT riprt;
-       SIZE bmpDims;
        RECT clientrect;
        RECT textrect;
        HDC hdc;
@@ -74,13 +71,11 @@ void mswin_display_RIP_window (HWND hWnd)
                DT_LEFT | DT_NOPREFIX | DT_CALCRECT);
            ReleaseDC(hWnd, hdc);
        }
-       bmpDims.cx = 400;
-       bmpDims.cy = 200;
-       if (textrect.right - textrect.left > bmpDims.cx)
+       if (textrect.right - textrect.left > RIP_WIDTH)
            clientrect.right = textrect.right + 10 - clientrect.right;
        else
-           clientrect.right = textrect.left + 20 + bmpDims.cx - clientrect.right;
-       clientrect.bottom = textrect.bottom + bmpDims.cy + 10 - clientrect.bottom;
+           clientrect.right = textrect.left + 20 + RIP_WIDTH - clientrect.right;
+       clientrect.bottom = textrect.bottom + RIP_HEIGHT + 10 - clientrect.bottom;
        GetWindowRect (GetDlgItem(hWnd, IDOK), &textrect);
        textrect.right -= textrect.left;
        textrect.bottom -= textrect.top;
@@ -136,7 +131,6 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
 
        case WM_PAINT:
        {
-               SIZE bmpDims;
                int bitmap_offset;
                RECT clientrect;
                RECT textrect;
@@ -159,11 +153,9 @@ BOOL CALLBACK NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
                }
                OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpRip);
                SetBkMode (hdc, OPAQUE);
-               bmpDims.cx = 400;
-               bmpDims.cy = 200;
-               bitmap_offset = (textrect.right - textrect.left - bmpDims.cx) / 2;
-               BitBlt (hdc, textrect.left + bitmap_offset, textrect.bottom, bmpDims.cx,
-                       bmpDims.cy, hdcBitmap, 0, 0, SRCCOPY);
+               bitmap_offset = (textrect.right - textrect.left - RIP_WIDTH) / 2;
+               BitBlt (hdc, textrect.left + bitmap_offset, textrect.bottom, RIP_WIDTH,
+                       RIP_HEIGHT, hdcBitmap, 0, 0, SRCCOPY);
                SetBkMode (hdc, TRANSPARENT);
                if (data->rip_text)
                {
index 5b5d7e48cab8b79fe2ce02a407913dd61d052ed5..f1f230e2928086776882dd39f7350127e3521f97 100644 (file)
@@ -14,6 +14,7 @@
 #include "mhtext.h"
 #include "mhmsgwnd.h"
 #include "mhmenu.h"
+#include "mhsplash.h"
 #include "mhmsg.h"
 #include "mhinput.h"
 #include "mhaskyn.h"
@@ -177,6 +178,7 @@ void mswin_init_nhwindows(int* argc, char** argv)
                SET_IN_GAME 
        );
 
+       mswin_display_splash_window();
        iflags.window_inited = TRUE;
 }
 
index 91fb03fa5df433d1e86f160ac783405fc281ffa9..e3ab108f68dad0dde53280aba2276d98cae690ae 100644 (file)
@@ -1049,10 +1049,18 @@ SOURCE=..\win\win32\mhmsgwnd.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\win\win32\mhsplash.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\win\win32\mhrip.c
 # End Source File
 # Begin Source File
 
+SOURCE=..\win\win32\mhsplash.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\win\win32\mhrip.h
 # End Source File
 # Begin Source File
index 0e6decc7801d7eab654e914d1113d94adea7be05..31bc6d0818fdb7fad38f6f59a32d9b9876c420b4 100644 (file)
@@ -25,6 +25,9 @@
 #define IDB_PETMARK                     143
 #define IDB_MENU_SEL_COUNT              144
 #define IDD_NHRIP                       145
+#define IDB_SPLASH                     146
+#define IDB_RIP                                147
+#define IDD_SPLASH                     148
 #define IDC_TEXT_VIEW                   1000
 #define IDC_TEXT_CONTROL                1000
 #define IDC_CMD_MOVE_NW                 1001
 #define IDC_PLSEL_GENDER_LIST           1326
 #define IDC_ABOUT_VERSION               1327
 #define IDC_ABOUT_COPYRIGHT             1328
-#define IDB_RIP                         1329
 #define IDM_SAVE                        32771
 #define IDM_HELP_LONG                   32772
 #define IDM_HELP_COMMANDS               32773
index 0d80936f7ba911c9c80a58a181693bed80aa6167..48366dae3dd9cad38a7cfe445325d213b9d3c7e3 100644 (file)
@@ -51,6 +51,7 @@ typedef struct mswin_nhwindow_app {
        HBITMAP         bmpPetMark;
        HBITMAP         bmpMapTiles; /* custom tiles bitmap */
        HBITMAP         bmpRip;
+       HBITMAP         bmpSplash;
        int                     mapTile_X;      /* tile width */
        int                     mapTile_Y;      /* tile height */
        int                     mapTilesPerLine;        /* number of tile per row in the bitmap */
index 253c6115f0771fae5c80b5b4046206af2a37d793..c36549ecc0e046fea8ee7f77500fc7a2b0b1c203 100644 (file)
@@ -59,6 +59,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
        if( _nethack_app.bmpPetMark==NULL ) panic("cannot load pet mark bitmap");
        _nethack_app.bmpRip = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_RIP));
        if ( _nethack_app.bmpRip == NULL ) panic("cannot load rip bitmap");
+       _nethack_app.bmpSplash = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SPLASH));
+       if ( _nethack_app.bmpSplash == NULL ) panic("cannot load splash bitmap");
        _nethack_app.bmpMapTiles = _nethack_app.bmpTiles;
        _nethack_app.mapTile_X = TILE_X;
        _nethack_app.mapTile_Y = TILE_Y;
index 4ae1370e9df31b22e51da08c6fb9c6eaa7969716..dfd7b661b357098d3a6c59028b67e1eb2c707bb0 100644 (file)
@@ -110,7 +110,7 @@ END
 IDD_NHTEXT DIALOGEX 0, 0, 172, 178
 STYLE DS_SETFOREGROUND | WS_POPUP | WS_THICKFRAME
 EXSTYLE WS_EX_STATICEDGE
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif"
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,54,163,50,14
     EDITTEXT        IDC_TEXT_CONTROL,0,0,170,160,ES_MULTILINE | 
@@ -189,6 +189,13 @@ BEGIN
     DEFPUSHBUTTON   "OK",IDOK,82,188,50,14
 END
 
+IDD_SPLASH DIALOGEX 0, 0, 281, 209
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Welcome to NetHack"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,82,188,50,14
+END
 
 #ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
@@ -233,6 +240,7 @@ IDB_MENU_UNSEL          BITMAP  DISCARDABLE     "mnunsel.bmp"
 IDB_PETMARK             BITMAP  DISCARDABLE     "petmark.bmp"
 IDB_MENU_SEL_COUNT      BITMAP  DISCARDABLE     "mnselcnt.bmp"
 IDB_RIP                 BITMAP  DISCARDABLE     "rip.bmp"
+IDB_SPLASH                 BITMAP  DISCARDABLE     "splash.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //