(from Yitzhak)

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.
This commit is contained in:
nethack.allison
2002-03-04 22:55:45 +00:00
parent 5911621d9f
commit 4494593c30
12 changed files with 139 additions and 26 deletions

View 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
#==========================================

View 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
#==========================================

View 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)

View 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 */

View 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

View 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)
{

View 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;
}

View 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

View 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
@@ -108,7 +111,6 @@
#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

View 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 */

View 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;

View 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"
/////////////////////////////////////////////////////////////////////////////
//