Add WinHack source files to distribution

This commit is contained in:
nethack.allison
2002-01-13 05:27:55 +00:00
parent fbcf710621
commit b79441dc5d
46 changed files with 8480 additions and 0 deletions

297
win/win32/dgncomp.dsp Normal file
View File

@@ -0,0 +1,297 @@
# Microsoft Developer Studio Project File - Name="dgncomp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=dgncomp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "dgncomp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dgncomp.mak" CFG="dgncomp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dgncomp - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "dgncomp - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "dgncomp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "..\util"
# PROP BASE Intermediate_Dir "dgncomp___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\util\dgn_comp.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=dgncomp
PostBuild_Cmds=echo Building dungeon echo pushd ..\dat pushd ..\dat echo ..\util\dgn_comp.exe dungeon.pdf ..\util\dgn_comp.exe dungeon.pdf echo popd popd
# End Special Build Tool
!ELSEIF "$(CFG)" == "dgncomp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "dgncomp___Win32_Debug"
# PROP BASE Intermediate_Dir "dgncomp___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"..\util\dgn_comp.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=dgncomp
PostBuild_Cmds=echo Building dungeon echo pushd ..\dat pushd ..\dat echo ..\util\dgn_comp.exe dungeon.pdf ..\util\dgn_comp.exe dungeon.pdf echo popd popd
# End Special Build Tool
!ENDIF
# Begin Target
# Name "dgncomp - Win32 Release"
# Name "dgncomp - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\src\alloc.c
# End Source File
# Begin Source File
SOURCE=..\util\dgn_lex.c
# End Source File
# Begin Source File
SOURCE=..\util\dgn_main.c
# End Source File
# Begin Source File
SOURCE=..\util\dgn_yacc.c
# End Source File
# Begin Source File
SOURCE=..\util\panic.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\align.h
# End Source File
# Begin Source File
SOURCE=..\include\attrib.h
# End Source File
# Begin Source File
SOURCE=..\include\color.h
# End Source File
# Begin Source File
SOURCE=..\include\config.h
# End Source File
# Begin Source File
SOURCE=..\include\config1.h
# End Source File
# Begin Source File
SOURCE=..\include\coord.h
# End Source File
# Begin Source File
SOURCE=..\include\decl.h
# End Source File
# Begin Source File
SOURCE=..\include\dgn_comp.h
# End Source File
# Begin Source File
SOURCE=..\include\dgn_file.h
# End Source File
# Begin Source File
SOURCE=..\include\display.h
# End Source File
# Begin Source File
SOURCE=..\include\dungeon.h
# End Source File
# Begin Source File
SOURCE=..\include\engrave.h
# End Source File
# Begin Source File
SOURCE=..\include\flag.h
# End Source File
# Begin Source File
SOURCE=..\include\global.h
# End Source File
# Begin Source File
SOURCE=..\include\mkroom.h
# End Source File
# Begin Source File
SOURCE=..\include\monattk.h
# End Source File
# Begin Source File
SOURCE=..\include\monst.h
# End Source File
# Begin Source File
SOURCE=..\include\monsym.h
# End Source File
# Begin Source File
SOURCE=..\include\nhlan.h
# End Source File
# Begin Source File
SOURCE=..\include\ntconf.h
# End Source File
# Begin Source File
SOURCE=..\include\obj.h
# End Source File
# Begin Source File
SOURCE=..\include\objclass.h
# End Source File
# Begin Source File
SOURCE=..\include\onames.h
# End Source File
# Begin Source File
SOURCE=..\include\permonst.h
# End Source File
# Begin Source File
SOURCE=..\include\pm.h
# End Source File
# Begin Source File
SOURCE=..\include\prop.h
# End Source File
# Begin Source File
SOURCE=..\include\quest.h
# End Source File
# Begin Source File
SOURCE=..\include\rect.h
# End Source File
# Begin Source File
SOURCE=..\include\region.h
# End Source File
# Begin Source File
SOURCE=..\include\rm.h
# End Source File
# Begin Source File
SOURCE=..\include\skills.h
# End Source File
# Begin Source File
SOURCE=..\include\spell.h
# End Source File
# Begin Source File
SOURCE=..\include\timeout.h
# End Source File
# Begin Source File
SOURCE=..\include\tradstdc.h
# End Source File
# Begin Source File
SOURCE=..\include\trampoli.h
# End Source File
# Begin Source File
SOURCE=..\include\trap.h
# End Source File
# Begin Source File
SOURCE=..\include\vision.h
# End Source File
# Begin Source File
SOURCE=..\include\winprocs.h
# End Source File
# Begin Source File
SOURCE=..\include\wintty.h
# End Source File
# Begin Source File
SOURCE=..\include\wintype.h
# End Source File
# Begin Source File
SOURCE=..\include\you.h
# End Source File
# Begin Source File
SOURCE=..\include\youprop.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

97
win/win32/dgnstuff.dsp Normal file
View File

@@ -0,0 +1,97 @@
# Microsoft Developer Studio Project File - Name="dgnstuff" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) External Target" 0x0106
CFG=dgnstuff - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "dgnstuff.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dgnstuff.mak" CFG="dgnstuff - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dgnstuff - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE "dgnstuff - Win32 Debug" (based on "Win32 (x86) External Target")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
!IF "$(CFG)" == "dgnstuff - Win32 Release"
# PROP BASE Use_MFC
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Cmd_Line "NMAKE /f dgnstuff.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "dgnstuff.exe"
# PROP BASE Bsc_Name "dgnstuff.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "nmake /f "dgnstuff.mak""
# PROP Rebuild_Opt "/a"
# PROP Target_File "..\util\dgncomp.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ELSEIF "$(CFG)" == "dgnstuff - Win32 Debug"
# PROP BASE Use_MFC
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Cmd_Line "NMAKE /f dgnstuff.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "dgnstuff.exe"
# PROP BASE Bsc_Name "dgnstuff.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "dgnstuff___Win32_Debug"
# PROP Intermediate_Dir "Debug"
# PROP Cmd_Line "nmake /f "dgnstuff.mak""
# PROP Rebuild_Opt "/a"
# PROP Target_File "..\util\dgncomp.exe"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ENDIF
# Begin Target
# Name "dgnstuff - Win32 Release"
# Name "dgnstuff - Win32 Debug"
!IF "$(CFG)" == "dgnstuff - Win32 Release"
!ELSEIF "$(CFG)" == "dgnstuff - Win32 Debug"
!ENDIF
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

59
win/win32/dgnstuff.mak Normal file
View File

@@ -0,0 +1,59 @@
#Set all of these or none of them
#YACC = byacc.exe
#LEX = flex.exe
#YTABC = y_tab.c
#YTABH = y_tab.h
#LEXYYC = lexyy.c
!IF "$(YACC)"!=""
@echo Yacc-alike set to $(YACC)
@echo YTABC set to $(YTABC)
@echo YTABH set to $(YTABH)
!ENDIF
!IF "$(LEX)"!=""
@echo Lex-alike set to $(LEX)
@echo LEXYYC set to $(LEXYYC)
!ENDIF
default: all
all: ..\util\dgn_yacc.c ..\util\dgn_lex.c
rebuild: clean all
clean:
-del ..\util\dgn_lex.c
-del ..\util\dgn_yacc.c
-del ..\include\dgn_comp.h
#==========================================
# Dungeon Compiler Stuff
#==========================================
..\util\dgn_yacc.c ..\include\dgn_comp.h : ..\util\dgn_comp.y
!IF "$(YACC)"==""
@echo Using pre-built dgn_yacc.c and dgn_comp.h
@copy ..\sys\share\dgn_yacc.c ..\util\dgn_yacc.c
@copy ..\sys\share\dgn_comp.h ..\include\dgn_comp.h
!ELSE
chdir ..\util
$(YACC) -d dgn_comp.y
copy $(YTABC) $@
copy $(YTABH) ..\include\dgn_comp.h
@del $(YTABC)
@del $(YTABH)
chdir ..\src
!ENDIF
..\util\dgn_lex.c: ..\util\dgn_comp.l
!IF "$(LEX)"==""
@echo Using pre-built lev_lex.c
@copy ..\sys\share\dgn_lex.c $@
!ELSE
chdir ..\util
$(LEX) dgn_comp.l
copy $(LEXYYC) $@
@del $(LEXYYC)
chdir ..\src
!ENDIF

129
win/win32/dlb_main.dsp Normal file
View File

@@ -0,0 +1,129 @@
# Microsoft Developer Studio Project File - Name="dlb_main" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=dlb_main - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "dlb_main.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dlb_main.mak" CFG="dlb_main - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dlb_main - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "dlb_main - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "dlb_main - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt" /I "..\win\share" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DLB" /D "WIN32CON" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\util\dlb_main.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Packaging via DLB
PostBuild_Cmds=echo pushd ..\dat pushd ..\dat chdir echo data >dlb.lst echo oracles >>dlb.lst echo options >>dlb.lst echo quest.dat >>dlb.lst echo rumors >>dlb.lst echo help >>dlb.lst echo hh >>dlb.lst echo cmdhelp >>dlb.lst echo history >>dlb.lst echo opthelp >>dlb.lst echo wizhelp >>dlb.lst echo dungeon >>dlb.lst echo license >>dlb.lst for %%N in (*.lev) do echo %%N >>dlb.lst ..\util\dlb_main.exe cIf dlb.lst nhdat echo popd popd echo if NOT exist ..\binary\*.* mkdir ..\binary
# End Special Build Tool
!ELSEIF "$(CFG)" == "dlb_main - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\sys\winnt" /I "..\win\share" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DLB" /D "WIN32CON" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"..\util\dlb_main.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Packaging via dlb
PostBuild_Cmds=echo pushd ..\dat pushd ..\dat chdir echo data >dlb.lst echo oracles >>dlb.lst echo options >>dlb.lst echo quest.dat >>dlb.lst echo rumors >>dlb.lst echo help >>dlb.lst echo hh >>dlb.lst echo cmdhelp >>dlb.lst echo history >>dlb.lst echo opthelp >>dlb.lst echo wizhelp >>dlb.lst echo dungeon >>dlb.lst echo license >>dlb.lst for %%N in (*.lev) do echo %%N >>dlb.lst ..\util\dlb_main.exe cIf dlb.lst nhdat echo popd popd echo if NOT exist ..\binary\*.* mkdir ..\binary if NOT exist ..\binary\*.* mkdir ..\binary
# End Special Build Tool
!ENDIF
# Begin Target
# Name "dlb_main - Win32 Release"
# Name "dlb_main - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\src\alloc.c
# End Source File
# Begin Source File
SOURCE=..\src\dlb.c
# End Source File
# Begin Source File
SOURCE=..\util\dlb_main.c
# End Source File
# Begin Source File
SOURCE=..\util\panic.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\dlb.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

150
win/win32/levcomp.dsp Normal file
View File

@@ -0,0 +1,150 @@
# Microsoft Developer Studio Project File - Name="levcomp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=levcomp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "levcomp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "levcomp.mak" CFG="levcomp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "levcomp - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "levcomp - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "levcomp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=levcomp
PostBuild_Cmds=echo Building special levels echo chdir ../dat chdir ..\dat echo arch.des ..\util\levcomp.exe arch.des echo barb.des ..\util\levcomp.exe barb.des echo bigroom.des ..\util\levcomp.exe bigroom.des echo castle.des ..\util\levcomp.exe castle.des echo caveman.des ..\util\levcomp.exe caveman.des echo endgame.des ..\util\levcomp.exe endgame.des echo gehennom.des ..\util\levcomp.exe gehennom.des echo healer.des ..\util\levcomp.exe healer.des echo knight.des ..\util\levcomp.exe knight.des echo knox.des ..\util\levcomp.exe knox.des echo medusa.des ..\util\levcomp.exe medusa.des echo mines.des ..\util\levcomp.exe mines.des echo monk.des ..\util\levcomp.exe monk.des echo oracle.des ..\util\levcomp.exe oracle.des echo priest.des ..\util\levcomp.exe priest.des echo ranger.des ..\util\levcomp.exe ranger.des echo rogue.des ..\util\levcomp.exe rogue.des echo samurai.des ..\util\levcomp.exe samurai.des echo sokoban.des ..\util\levcomp.exe sokoban.des echo tourist.des ..\util\levcomp.exe tourist.des echo tower.des ..\util\levcomp.exe tower.des echo valkyrie.des ..\util\levcomp.exe valkyrie.des echo wizard .des ..\util\levcomp.exe wizard.des echo yendor.des\
..\util\levcomp.exe yendor.des echo popd popd
# End Special Build Tool
!ELSEIF "$(CFG)" == "levcomp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=levcomp
PostBuild_Cmds=echo Building special levels echo pushd ../dat pushd ..\dat echo arch.des ..\util\levcomp.exe arch.des echo barb.des ..\util\levcomp.exe barb.des echo bigroom.des ..\util\levcomp.exe bigroom.des echo castle.des ..\util\levcomp.exe castle.des echo caveman.des ..\util\levcomp.exe caveman.des echo endgame.des ..\util\levcomp.exe endgame.des echo gehennom.des ..\util\levcomp.exe gehennom.des echo healer.des ..\util\levcomp.exe healer.des echo knight.des ..\util\levcomp.exe knight.des echo knox.des ..\util\levcomp.exe knox.des echo medusa.des ..\util\levcomp.exe medusa.des echo mines.des ..\util\levcomp.exe mines.des echo monk.des ..\util\levcomp.exe monk.des echo oracle.des ..\util\levcomp.exe oracle.des echo priest.des ..\util\levcomp.exe priest.des echo ranger.des ..\util\levcomp.exe ranger.des echo rogue.des ..\util\levcomp.exe rogue.des echo samurai.des ..\util\levcomp.exe samurai.des echo sokoban.des ..\util\levcomp.exe sokoban.des echo tourist.des ..\util\levcomp.exe tourist.des echo tower.des ..\util\levcomp.exe tower.des echo valkyrie.des ..\util\levcomp.exe valkyrie.des echo wizard .des ..\util\levcomp.exe wizard.des echo yendor.des\
..\util\levcomp.exe yendor.des echo popd popd
# End Special Build Tool
!ENDIF
# Begin Target
# Name "levcomp - Win32 Release"
# Name "levcomp - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\src\alloc.c
# End Source File
# Begin Source File
SOURCE=..\src\decl.c
# End Source File
# Begin Source File
SOURCE=..\src\drawing.c
# End Source File
# Begin Source File
SOURCE=..\util\lev_lex.c
# End Source File
# Begin Source File
SOURCE=..\util\lev_main.c
# End Source File
# Begin Source File
SOURCE=..\util\lev_yacc.c
# End Source File
# Begin Source File
SOURCE=..\src\monst.c
# End Source File
# Begin Source File
SOURCE=..\src\objects.c
# End Source File
# Begin Source File
SOURCE=..\util\panic.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\lev_comp.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

97
win/win32/levstuff.dsp Normal file
View File

@@ -0,0 +1,97 @@
# Microsoft Developer Studio Project File - Name="levstuff" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) External Target" 0x0106
CFG=levstuff - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "levstuff.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "levstuff.mak" CFG="levstuff - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "levstuff - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE "levstuff - Win32 Debug" (based on "Win32 (x86) External Target")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
!IF "$(CFG)" == "levstuff - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Cmd_Line "NMAKE /f levstuff.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "levstuff.exe"
# PROP BASE Bsc_Name "levstuff.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "nmake /f "levstuff.mak""
# PROP Rebuild_Opt "/a"
# PROP Target_File "..\util\lev_lex.c"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ELSEIF "$(CFG)" == "levstuff - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "levstuff___Win32_Debug0"
# PROP BASE Intermediate_Dir "levstuff___Win32_Debug0"
# PROP BASE Cmd_Line "NMAKE /f levstuff.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "levstuff.exe"
# PROP BASE Bsc_Name "levstuff.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "levstuff___Win32_Debug0"
# PROP Intermediate_Dir "levstuff___Win32_Debug0"
# PROP Cmd_Line "nmake /f "levstuff.mak""
# PROP Rebuild_Opt "/a"
# PROP Target_File "..\util\lev_lex.c"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ENDIF
# Begin Target
# Name "levstuff - Win32 Release"
# Name "levstuff - Win32 Debug"
!IF "$(CFG)" == "levstuff - Win32 Release"
!ELSEIF "$(CFG)" == "levstuff - Win32 Debug"
!ENDIF
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

59
win/win32/levstuff.mak Normal file
View File

@@ -0,0 +1,59 @@
#YACC = byacc.exe
#LEX = flex.exe
#YTABC = y_tab.c
#YTABH = y_tab.h
#LEXYYC = lexyy.c
!IF "$(YACC)"!=""
@echo Yacc-alike set to $(YACC)
@echo YTABC set to $(YTABC)
@echo YTABH set to $(YTABH)
!ENDIF
!IF "$(LEX)"!=""
@echo Lex-alike set to $(LEX)
@echo LEXYYC set to $(LEXYYC)
!ENDIF
default: all
all: ..\util\lev_yacc.c ..\util\lev_lex.c
rebuild: clean all
clean:
-del ..\util\lev_lex.c
-del ..\util\lev_yacc.c
-del ..\include\lev_comp.h
#==========================================
# Level Compiler Stuff
#==========================================
..\util\lev_yacc.c ..\include\lev_comp.h: ..\util\lev_comp.y
!IF "$(YACC)"==""
@echo Using pre-built lev_yacc.c and lev_comp.h
@copy ..\sys\share\lev_yacc.c ..\util\lev_yacc.c
@copy ..\sys\share\lev_comp.h ..\include\lev_comp.h
!ELSE
pushd ..\util
$(YACC) -d lev_comp.y
copy $(YTABC) $@
copy $(YTABH) ..\include\lev_comp.h
@del $(YTABC)
@del $(YTABH)
popd
!ENDIF
..\util\lev_lex.c: ..\util\lev_comp.l
!IF "$(LEX)"==""
@echo Using pre-built lev_lex.c
@copy ..\sys\share\lev_lex.c $@
!ELSE
pushd ..\util
$(LEX) lev_comp.l
copy $(LEXYYC) $@
@del $(LEXYYC)
popd
!ENDIF

198
win/win32/makedefs.dsp Normal file
View File

@@ -0,0 +1,198 @@
# Microsoft Developer Studio Project File - Name="makedefs" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=makedefs - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "makedefs.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "makedefs.mak" CFG="makedefs - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "makedefs - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "makedefs - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "makedefs - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Running makedefs
PostBuild_Cmds=echo chdir ..\util chdir ..\util chdir \
echo makedefs.exe -v makedefs.exe -v \
echo makedefs.exe -o makedefs.exe -o \
echo makedefs.exe -p makedefs.exe -p \
echo makedefs.exe -m makedefs.exe -m \
echo makedefs.exe -z makedefs.exe -z \
echo chdir ..\dat chdir ..\dat chdir \
echo Generating NetHack database echo ..\util\makedefs.exe -d ..\util\makedefs.exe -d \
echo Generating rumors echo ..\util\makedefs.exe -r ..\util\makedefs.exe -r \
echo Generating quests echo ..\util\makedefs.exe -q ..\util\makedefs.exe -q \
echo Generating oracles echo ..\util\makedefs.exe -h ..\util\makedefs.exe -h \
echo Generating dungeon.pdf echo ..\util\makedefs.exe -e ..\util\makedefs.exe -e \
echo popd popd \
copy ..\win\share\tilemap.c ..\win\share\tiletxt.c
# End Special Build Tool
!ELSEIF "$(CFG)" == "makedefs - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\util"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Running makedefs
PostBuild_Cmds=echo chdir ..\util chdir ..\util chdir \
echo makedefs.exe -v makedefs.exe -v \
echo makedefs.exe -o makedefs.exe -o \
echo makedefs.exe -p makedefs.exe -p \
echo makedefs.exe -m makedefs.exe -m \
echo makedefs.exe -z makedefs.exe -z \
echo chdir ..\dat chdir ..\dat chdir \
echo Generating NetHack database echo ..\util\makedefs.exe -d ..\util\makedefs.exe -d \
echo Generating rumors echo ..\util\makedefs.exe -r ..\util\makedefs.exe -r \
echo Generating quests echo ..\util\makedefs.exe -q ..\util\makedefs.exe -q \
echo Generating oracles echo ..\util\makedefs.exe -h ..\util\makedefs.exe -h \
echo Generating dungeon.pdf echo ..\util\makedefs.exe -e ..\util\makedefs.exe -e \
echo popd popd \
copy ..\win\share\tilemap.c ..\win\share\tiletxt.c
# End Special Build Tool
!ENDIF
# Begin Target
# Name "makedefs - Win32 Release"
# Name "makedefs - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\util\makedefs.c
# End Source File
# Begin Source File
SOURCE=..\src\monst.c
# End Source File
# Begin Source File
SOURCE=..\src\objects.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\config.h
# End Source File
# Begin Source File
SOURCE=..\include\config1.h
# End Source File
# Begin Source File
SOURCE=..\include\coord.h
# End Source File
# Begin Source File
SOURCE=..\include\global.h
# End Source File
# Begin Source File
SOURCE=..\include\monattk.h
# End Source File
# Begin Source File
SOURCE=..\include\monflag.h
# End Source File
# Begin Source File
SOURCE=..\include\monsym.h
# End Source File
# Begin Source File
SOURCE=..\include\nhlan.h
# End Source File
# Begin Source File
SOURCE=..\include\ntconf.h
# End Source File
# Begin Source File
SOURCE=..\include\objclass.h
# End Source File
# Begin Source File
SOURCE=..\include\patchlevel.h
# End Source File
# Begin Source File
SOURCE=..\include\qtext.h
# End Source File
# Begin Source File
SOURCE=..\include\tradstdc.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

11
win/win32/mhaskyn.c Normal file
View File

@@ -0,0 +1,11 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include <assert.h>
#include "winMS.h"
#include "mhaskyn.h"
int mswin_yes_no_dialog( const char *question, const char *choices, int def)
{
return '\032';
}

11
win/win32/mhaskyn.h Normal file
View File

@@ -0,0 +1,11 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINAskYesNO_h
#define MSWINAskYesNO_h
#include "winMS.h"
int mswin_yes_no_dialog( const char *question, const char *choices, int def);
#endif /* MSWINAskYesNO_h */

78
win/win32/mhcmd.c Normal file
View File

@@ -0,0 +1,78 @@
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "resource.h"
#include "mhcmd.h"
#include "mhinput.h"
LRESULT CALLBACK CommandWndProc(HWND, UINT, WPARAM, LPARAM);
struct cmd2key_map {
UINT cmd_code;
char f_char;
const char* text;
UINT image;
} cmd2key[] = {
{ IDC_CMD_MOVE_NW, '7', "7", 0 },
{ IDC_CMD_MOVE_N, '8', "8", 0 },
{ IDC_CMD_MOVE_NE, '9', "9", 0 },
{ IDC_CMD_MOVE_W, '4', "4", 0 },
{ IDC_CMD_MOVE_SELF, '.', ".", 0 },
{ IDC_CMD_MOVE_E, '6', "6", 0 },
{ IDC_CMD_MOVE_SW, '1', "1", 0 },
{ IDC_CMD_MOVE_S, '2', "2", 0 },
{ IDC_CMD_MOVE_SE, '3', "3", 0 },
{ IDC_CMD_MOVE_UP, '<', "<", 0 },
{ IDC_CMD_MOVE_DOWN, '>', ">", 0 },
{ 0, 0 }
};
HWND mswin_init_command_window () {
HWND ret;
ret = CreateDialog(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_COMMANDS),
GetNHApp()->hMainWnd,
CommandWndProc
);
if( !ret ) panic("Cannot create command window");
return ret;
}
void mswin_command_window_size (HWND hwnd, LPSIZE sz)
{
RECT rt;
GetWindowRect(hwnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
}
LRESULT CALLBACK CommandWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct cmd2key_map* cmd_p;
switch (message)
{
case WM_COMMAND:
switch(HIWORD(wParam)) {
case BN_CLICKED:
for( cmd_p=cmd2key; cmd_p->cmd_code>0; cmd_p++ ) {
if( cmd_p->cmd_code==LOWORD(wParam) ) break;
}
if( cmd_p->cmd_code>0 ) {
MSNHEvent event;
ZeroMemory(&event, sizeof(event));
event.ch = cmd_p->f_char;
mswin_input_push(&event);
}
SetFocus(hWnd);
break;
}
}
return FALSE;
}

13
win/win32/mhcmd.h Normal file
View File

@@ -0,0 +1,13 @@
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINCMDWindow_h
#define MSWINCMDWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_command_window ();
void mswin_command_window_size (HWND hwnd, LPSIZE sz);
#endif /* MSWINCMDWindow_h */

662
win/win32/mhdlg.c Normal file
View File

@@ -0,0 +1,662 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
/* various dialog boxes are defined here */
#include "winMS.h"
#include "hack.h"
#include "func_tab.h"
#include "resource.h"
#include "mhdlg.h"
/*---------------------------------------------------------------*/
/* data for getlin dialog */
struct getlin_data {
const char* question;
char* result;
size_t result_size;
};
LRESULT CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
int mswin_getlin_window (
const char *question,
char *result,
size_t result_size
)
{
int ret;
struct getlin_data data;
/* initilize dialog data */
ZeroMemory(&data, sizeof(data));
data.question = question;
data.result = result;
data.result_size = result_size;
/* create modal dialog window */
ret = DialogBoxParam(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_GETLIN),
GetNHApp()->hMainWnd,
GetlinDlgProc,
(LPARAM)&data
);
if( ret==-1 ) panic("Cannot create getlin window");
return ret;
}
LRESULT CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct getlin_data* data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
TCHAR wbuf[BUFSZ];
switch (message)
{
case WM_INITDIALOG:
data = (struct getlin_data*)lParam;
SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hWnd, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow( hWnd,
(main_rt.left+main_rt.right-dlg_sz.cx)/2,
(main_rt.top+main_rt.bottom-dlg_sz.cy)/2,
dlg_sz.cx,
dlg_sz.cy,
TRUE );
/* set focus to the edit control */
SetFocus(GetDlgItem(hWnd, IDC_GETLIN_EDIT));
/* tell windows that we've set the focus */
return FALSE;
break;
case WM_COMMAND:
{
TCHAR wbuf[BUFSZ];
switch (LOWORD(wParam))
{
/* OK button was pressed */
case IDOK:
data = (struct getlin_data*)GetWindowLong(hWnd, GWL_USERDATA);
SendDlgItemMessage(hWnd, IDC_GETLIN_EDIT, WM_GETTEXT, (WPARAM)sizeof(wbuf), (LPARAM)wbuf );
NH_W2A(wbuf, data->result, data->result_size);
/* Fall through. */
/* cancel button was pressed */
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
}
} break;
} /* end switch (message) */
return FALSE;
}
/*---------------------------------------------------------------*/
/* dialog data for the list of extended commands */
struct extcmd_data {
int* selection;
};
LRESULT CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
int mswin_ext_cmd_window (int* selection)
{
int ret;
struct extcmd_data data;
/* init dialog data */
ZeroMemory(&data, sizeof(data));
*selection = -1;
data.selection = selection;
/* create modal dialog window */
ret = DialogBoxParam(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_EXTCMD),
GetNHApp()->hMainWnd,
ExtCmdDlgProc,
(LPARAM)&data
);
if( ret==-1 ) panic("Cannot create extcmd window");
return ret;
}
LRESULT CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct extcmd_data* data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
int i;
const char *ptr;
TCHAR wbuf[255];
switch (message)
{
case WM_INITDIALOG:
data = (struct extcmd_data*)lParam;
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hWnd, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow( hWnd,
(main_rt.left+main_rt.right-dlg_sz.cx)/2,
(main_rt.top+main_rt.bottom-dlg_sz.cy)/2,
dlg_sz.cx,
dlg_sz.cy,
TRUE );
/* fill combobox with extended commands */
for(i=0; (ptr=extcmdlist[i].ef_txt); i++) {
SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(ptr, wbuf, sizeof(wbuf)) );
}
/* set focus to the list control */
SetFocus(GetDlgItem(hWnd, IDC_EXTCMD_LIST));
/* tell windows we set the focus */
return FALSE;
break;
case WM_COMMAND:
data = (struct extcmd_data*)GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam))
{
/* OK button ws clicked */
case IDOK:
*data->selection = SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
if( *data->selection==LB_ERR )
*data->selection = -1;
/* Fall through. */
/* CANCEL button ws clicked */
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
/* list control events */
case IDC_EXTCMD_LIST:
switch(HIWORD(wParam)) {
case LBN_DBLCLK:
/* double click within the list
wParam
The low-order word is the list box identifier.
The high-order word is the notification message.
lParam
Handle to the list box
*/
*data->selection = SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if( *data->selection==LB_ERR )
*data->selection = -1;
EndDialog(hWnd, IDOK);
return TRUE;
}
break;
}
}
return FALSE;
}
/*---------------------------------------------------------------*/
/* player selector dialog data */
struct plsel_data {
int* selection;
};
LRESULT CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
static void plselInitDialog(HWND hWnd);
static void plselAdjustLists(HWND hWnd, int changed_opt);
static int plselFinalSelection(HWND hWnd, int* selection);
int mswin_player_selection_window ( int* selection )
{
int ret;
struct plsel_data data;
/* init dialog data */
ZeroMemory(&data, sizeof(data));
data.selection = selection;
/* create modal dialog */
ret = DialogBoxParam(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_PLAYER_SELECTOR),
GetNHApp()->hMainWnd,
PlayerSelectorDlgProc,
(LPARAM)&data
);
if( ret==-1 ) panic("Cannot create getlin window");
return ret;
}
LRESULT CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct plsel_data* data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
switch (message)
{
case WM_INITDIALOG:
data = (struct plsel_data*)lParam;
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hWnd, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow( hWnd,
(main_rt.left+main_rt.right-dlg_sz.cx)/2,
(main_rt.top+main_rt.bottom-dlg_sz.cy)/2,
dlg_sz.cx,
dlg_sz.cy,
TRUE );
/* init dialog */
plselInitDialog(hWnd);
/* set focus on the name field */
SetFocus(GetDlgItem(hWnd, IDC_PLSEL_NAME));
/* tell windows we set the focus */
return FALSE;
break;
case WM_COMMAND:
data = (struct plsel_data*)GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam)) {
/* OK button was clicked */
case IDOK:
if( plselFinalSelection(hWnd, data->selection) ) {
EndDialog(hWnd, wParam);
} else {
MessageBox(hWnd, TEXT("Cannot match this role. Try something else."), TEXT("STOP"), MB_OK );
}
return TRUE;
/* CANCEL button was clicked */
case IDCANCEL:
*data->selection = -1;
EndDialog(hWnd, wParam);
return TRUE;
/* following are events from dialog controls:
"random" checkboxes send BN_CLICKED messages;
role/race/... combo-boxes send CBN_SELENDOK
if something was selected;
*/
case IDC_PLSEL_ROLE_RANDOM:
if( HIWORD(wParam)==BN_CLICKED ) {
/* enable corresponding list window if "random"
checkbox was "unchecked" */
EnableWindow(
GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST),
SendMessage((HWND)lParam, BM_GETCHECK, 0, 0)==BST_UNCHECKED
);
}
break;
case IDC_PLSEL_RACE_RANDOM:
if( HIWORD(wParam)==BN_CLICKED ) {
EnableWindow(
GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST),
SendMessage((HWND)lParam, BM_GETCHECK, 0, 0)==BST_UNCHECKED
);
}
break;
case IDC_PLSEL_GENDER_RANDOM:
if( HIWORD(wParam)==BN_CLICKED ) {
EnableWindow(
GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST),
SendMessage((HWND)lParam, BM_GETCHECK, 0, 0)==BST_UNCHECKED
);
}
break;
case IDC_PLSEL_ALIGN_RANDOM:
if( HIWORD(wParam)==BN_CLICKED ) {
EnableWindow(
GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST),
SendMessage((HWND)lParam, BM_GETCHECK, 0, 0)==BST_UNCHECKED
);
}
break;
case IDC_PLSEL_ROLE_LIST:
if( HIWORD(wParam)==CBN_SELENDOK ) {
/* filter out invalid options if
the selection was made */
plselAdjustLists( hWnd, LOWORD(wParam) );
}
break;
case IDC_PLSEL_RACE_LIST:
if( HIWORD(wParam)==CBN_SELENDOK ) {
plselAdjustLists( hWnd, LOWORD(wParam) );
}
break;
case IDC_PLSEL_GENDER_LIST:
if( HIWORD(wParam)==CBN_SELENDOK ) {
plselAdjustLists( hWnd, LOWORD(wParam) );
}
break;
case IDC_PLSEL_ALIGN_LIST:
if( HIWORD(wParam)==CBN_SELENDOK ) {
plselAdjustLists( hWnd, LOWORD(wParam) );
}
break;
}
break;
}
return FALSE;
}
/* initialize player selector dialog */
void plselInitDialog(HWND hWnd)
{
TCHAR wbuf[BUFSZ];
/* set player name */
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(plname, wbuf, sizeof(wbuf)));
plselAdjustLists(hWnd, -1);
/* intialize roles list */
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), FALSE);
/* intialize races list */
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), FALSE);
/* intialize genders list */
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), FALSE);
/* intialize alignments list */
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), FALSE);
}
/* adjust role/race/alignment/gender list - filter out
invalid combinations
changed_sel points to the list where selection occured
(-1 if unknown)
*/
void plselAdjustLists(HWND hWnd, int changed_sel)
{
HWND control_role;
HWND control_race;
HWND control_gender;
HWND control_align;
int i;
int ind;
int valid_opt;
TCHAR wbuf[255];
/* get control handles */
control_role = GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST);
control_race = GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST);
control_gender = GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST);
control_align = GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST);
/* get current selections */
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
flags.initrole = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
flags.initrace = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
flags.initgend = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
flags.initalign = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
/* intialize roles list */
if( changed_sel==-1 ) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_role, CB_RESETCONTENT, 0, 0);
for (i = 0; roles[i].name.m; i++) {
if (ok_role(i, flags.initrace, flags.initgend,
flags.initalign)) {
ind = SendMessage(control_role, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(roles[i].name.m, wbuf, sizeof(wbuf)) );
SendMessage(control_role, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initrole ) {
SendMessage(control_role, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1;
}
}
}
/* set selection to the previously selected role
if it is still valid */
if( !valid_opt ) {
flags.initrole = ROLE_NONE;
flags.initrace = ROLE_NONE;
flags.initgend = ROLE_NONE;
flags.initalign = ROLE_NONE;
SendMessage(control_role, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
}
/* trigger change of the races list */
changed_sel=IDC_PLSEL_ROLE_LIST;
}
/* intialize races list */
if( changed_sel==IDC_PLSEL_ROLE_LIST ) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_race, CB_RESETCONTENT, 0, 0);
for (i = 0; races[i].noun; i++)
if (ok_race(flags.initrole, i, ROLE_NONE, ROLE_NONE)) {
ind = SendMessage(control_race, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(races[i].noun, wbuf, sizeof(wbuf)) );
SendMessage(control_race, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initrace ) {
SendMessage(control_race, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1;
}
}
/* set selection to the previously selected race
if it is still valid */
if( !valid_opt ) {
flags.initrace = ROLE_NONE;
flags.initgend = ROLE_NONE;
flags.initalign = ROLE_NONE;
SendMessage(control_race, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
}
/* trigger change of the genders list */
changed_sel=IDC_PLSEL_RACE_LIST;
}
/* intialize genders list */
if( changed_sel==IDC_PLSEL_RACE_LIST ) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_gender, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_GENDERS; i++)
if (ok_gend(flags.initrole, flags.initrace, i,
ROLE_NONE)) {
ind = SendMessage(control_gender, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(genders[i].adj, wbuf, sizeof(wbuf)) );
SendMessage(control_gender, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initgend ) {
SendMessage(control_gender, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
}
}
/* set selection to the previously selected gender
if it is still valid */
if( !valid_opt ) {
flags.initgend = ROLE_NONE;
flags.initalign = ROLE_NONE;
SendMessage(control_gender, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
}
/* trigger change of the alignments list */
changed_sel=IDC_PLSEL_GENDER_LIST;
}
/* intialize alignments list */
if( changed_sel==IDC_PLSEL_GENDER_LIST ) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_align, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_ALIGNS; i++)
if (ok_align(flags.initrole, flags.initrace,
flags.initgend, i)) {
ind = SendMessage(control_align, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(aligns[i].adj, wbuf, sizeof(wbuf)) );
SendMessage(control_align, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initalign ) {
SendMessage(control_align, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1;
}
}
/* set selection to the previously selected alignment
if it is still valid */
if( !valid_opt ) {
flags.initalign = ROLE_NONE;
SendMessage(control_align, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
}
}
}
/* player made up his mind - get final selection here */
int plselFinalSelection(HWND hWnd, int* selection)
{
int ind;
/* get current selections */
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initrole = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETCURSEL, 0, 0);
flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initrace = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETCURSEL, 0, 0);
flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initgend = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETCURSEL, 0, 0);
flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
}
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
flags.initalign = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETCURSEL, 0, 0);
flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
}
/* check the role */
if( flags.initrole==ROLE_RANDOM ) {
flags.initrole = pick_role(flags.initrace, flags.initgend,
flags.initalign, PICK_RANDOM);
if (flags.initrole < 0) {
MessageBox(hWnd, TEXT("Incompatible role!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
/* Select a race, if necessary */
/* force compatibility with role */
if (flags.initrace==ROLE_RANDOM || !validrace(flags.initrole, flags.initrace)) {
/* pre-selected race not valid */
if (flags.initrace == ROLE_RANDOM) {
flags.initrace = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM);
}
if (flags.initrace < 0) {
MessageBox(hWnd, TEXT("Incompatible race!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
/* Select a gender, if necessary */
/* force compatibility with role/race, try for compatibility with
* pre-selected alignment */
if (flags.initgend < 0 ||
!validgend(flags.initrole, flags.initrace, flags.initgend)) {
/* pre-selected gender not valid */
if (flags.initgend == ROLE_RANDOM) {
flags.initgend = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM);
}
if (flags.initgend < 0) {
MessageBox(hWnd, TEXT("Incompatible gender!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
/* Select an alignment, if necessary */
/* force compatibility with role/race/gender */
if (flags.initalign < 0 ||
!validalign(flags.initrole, flags.initrace, flags.initalign)) {
/* pre-selected alignment not valid */
if (flags.initalign == ROLE_RANDOM) {
flags.initalign = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM);
} else {
MessageBox(hWnd, TEXT("Incompatible alignment!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
return TRUE;
}

15
win/win32/mhdlg.h Normal file
View File

@@ -0,0 +1,15 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINDlgWindow_h
#define MSWINDlgWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
int mswin_getlin_window (const char *question, char *result, size_t result_size);
int mswin_ext_cmd_window (int* selection);
int mswin_player_selection_window(int* selection);
#endif /* MSWINDlgWindow_h */

131
win/win32/mhfont.c Normal file
View File

@@ -0,0 +1,131 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
/* font management and such */
#include "mhfont.h"
#define MAXFONTS 64
/* font table - 64 fonts ought to be enough */
static struct font_table_entry {
int code;
HFONT hFont;
} font_table[MAXFONTS] ;
static int font_table_size = 0;
#define NHFONT_CODE(win, attr) (((win_type&0xFF)<<8)|(attr&0xFF))
/* create font based on window type, charater attributes and
window device context */
HGDIOBJ mswin_create_font(int win_type, int attr, HDC hdc)
{
HFONT fnt = NULL;
LOGFONT lgfnt;
int font_size;
int i;
ZeroMemory( &lgfnt, sizeof(lgfnt) );
/* try find font in the table */
for(i=0; i<font_table_size; i++) {
if(NHFONT_CODE(win_type, attr)==font_table[i].code) {
return font_table[i].hFont;
}
}
switch(win_type) {
case NHW_STATUS:
lgfnt.lfHeight = -8*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 = DEFAULT_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 = FIXED_PITCH; // pitch and family
/* lgfnt.lfFaceName */
break;
case NHW_MENU:
font_size = (attr==ATR_INVERSE)? 7 : 7;
lgfnt.lfHeight = -font_size*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 = (attr==ATR_BOLD || attr==ATR_INVERSE)? FW_BOLD : FW_NORMAL; // font weight
lgfnt.lfItalic = (attr==ATR_BLINK)? TRUE: FALSE; // italic attribute option
lgfnt.lfUnderline = (attr==ATR_ULINE)? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = DEFAULT_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 = VARIABLE_PITCH; // pitch and family
/* lgfnt.lfFaceName */
break;
case NHW_MESSAGE:
font_size = (attr==ATR_INVERSE)? 10 : 9;
lgfnt.lfHeight = -font_size*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 = (attr==ATR_BOLD || attr==ATR_INVERSE)? FW_BOLD : FW_NORMAL; // font weight
lgfnt.lfItalic = (attr==ATR_BLINK)? TRUE: FALSE; // italic attribute option
lgfnt.lfUnderline = (attr==ATR_ULINE)? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = DEFAULT_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 = VARIABLE_PITCH; // pitch and family
/* lgfnt.lfFaceName */
break;
case NHW_TEXT:
lgfnt.lfHeight = -8*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 = (attr==ATR_BOLD || attr==ATR_INVERSE)? FW_BOLD : FW_NORMAL; // font weight
lgfnt.lfItalic = (attr==ATR_BLINK)? TRUE: FALSE; // italic attribute option
lgfnt.lfUnderline = (attr==ATR_ULINE)? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = DEFAULT_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 = FIXED_PITCH; // pitch and family
/* lgfnt.lfFaceName */
break;
}
fnt = CreateFontIndirect(&lgfnt);
/* add font to the table */
if( font_table_size>=MAXFONTS ) panic( "font table overflow!" );
font_table[font_table_size].code = NHFONT_CODE(win_type, attr);
font_table[font_table_size].hFont = fnt;
font_table_size++;
return fnt;
}
/* dispose the font object */
void mswin_destroy_font( HGDIOBJ fnt )
{
/* do nothing - we are going to reuse the font,
then it will destroyed when application exits
(at least I hope it will) */
/* if(fnt) DeleteObject(fnt); */
}

14
win/win32/mhfont.h Normal file
View File

@@ -0,0 +1,14 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
/* font management functions */
#ifndef MSWINFont_h
#define MSWINFont_h
#include "winMS.h"
HGDIOBJ mswin_create_font(int win_type, int attr, HDC hdc);
void mswin_destroy_font( HGDIOBJ fnt );
#endif /* MSWINFont_h */

85
win/win32/mhinput.c Normal file
View File

@@ -0,0 +1,85 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include <assert.h>
#include "winMS.h"
#include "mhinput.h"
/* nethack input queue functions */
#define NH_INPUT_BUFFER_SIZE 64
/* as it stands right now we need only one slot
since events are processed almost the same time as
they occur but I like large round numbers */
static MSNHEvent nhi_input_buffer[NH_INPUT_BUFFER_SIZE];
static int nhi_init_input = 0;
static int nhi_read_pos = 0;
static int nhi_write_pos = 0;
/* initialize input queue */
void mswin_nh_input_init()
{
if( !nhi_init_input ) {
nhi_init_input = 1;
ZeroMemory( nhi_input_buffer, sizeof(nhi_input_buffer) );
nhi_read_pos = 0;
nhi_write_pos = 0;
}
}
/* check for input */
int mswin_have_input()
{
return (nhi_read_pos!=nhi_write_pos);
}
/* add event to the queue */
void mswin_input_push(PMSNHEvent event)
{
int new_write_pos;
if( !nhi_init_input ) mswin_nh_input_init();
new_write_pos = (nhi_write_pos+1) % NH_INPUT_BUFFER_SIZE;
if(new_write_pos!=nhi_read_pos) {
memcpy(nhi_input_buffer+nhi_write_pos, event, sizeof(*event));
nhi_write_pos = new_write_pos;
}
}
/* get event from the queue and delete it */
PMSNHEvent mswin_input_pop()
{
PMSNHEvent retval;
if( !nhi_init_input ) mswin_nh_input_init();
if( nhi_read_pos!=nhi_write_pos ) {
retval = &nhi_input_buffer[nhi_read_pos];
nhi_read_pos = (nhi_read_pos+1) % NH_INPUT_BUFFER_SIZE;
} else {
retval = NULL;
}
return retval;
}
/* get event from the queue but leave it there */
PMSNHEvent mswin_input_peek()
{
PMSNHEvent retval;
if( !nhi_init_input ) mswin_nh_input_init();
if( nhi_read_pos!=nhi_write_pos ) {
retval = &nhi_input_buffer[nhi_read_pos];
} else {
retval = NULL;
}
return retval;
}

34
win/win32/mhinput.h Normal file
View File

@@ -0,0 +1,34 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINInput_h
#define MSWINInput_h
/* nethack input queue - store/extract input events */
#include "winMS.h"
#define NHEVENT_CHAR 1
#define NHEVENT_MOUSE 2
typedef struct mswin_event {
int type;
union {
struct {
int ch;
} kbd;
struct {
int x, y;
} ms;
};
} MSNHEvent, *PMSNHEvent;
#define NHEVENT_KBD(c) { MSNHEvent e; e.type=NHEVENT_CHAR; e.kbd.ch=(c); mswin_input_push(&e); }
#define NHEVENT_MS(_x, _y) { MSNHEvent e; e.type=NHEVENT_MOUSE; e.ms.x=(_x); e.ms.y=(_y); mswin_input_push(&e); }
void mswin_nh_input_init();
int mswin_have_input();
void mswin_input_push(PMSNHEvent event);
PMSNHEvent mswin_input_pop();
PMSNHEvent mswin_input_peek();
#endif /* MSWINInput_h */

422
win/win32/mhmain.c Normal file
View File

@@ -0,0 +1,422 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "patchlevel.h"
#include "resource.h"
#include "mhmsg.h"
#include "mhinput.h"
#include "mhmain.h"
#include "mhmenu.h"
#include "mhstatus.h"
#include "mhmsgwnd.h"
#define MAX_LOADSTRING 100
typedef struct mswin_nethack_main_window {
int dummy;
} NHMainWindow, *PNHMainWindow;
static TCHAR szMainWindowClass[] = TEXT("MSNHMainWndClass");
static TCHAR szTitle[MAX_LOADSTRING];
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
static LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void register_main_window_class();
HWND mswin_init_main_window () {
static int run_once = 0;
HWND ret;
/* register window class */
if( !run_once ) {
LoadString(GetNHApp()->hApp, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
register_main_window_class( );
run_once = 1;
}
/* create the main window */
ret = CreateWindow(
szMainWindowClass, /* registered class name */
szTitle, /* window name */
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, /* window style */
CW_USEDEFAULT, /* horizontal position of window */
CW_USEDEFAULT, /* vertical position of window */
CW_USEDEFAULT, /* window width */
CW_USEDEFAULT, /* window height */
NULL, /* handle to parent or owner window */
NULL, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL /* window-creation data */
);
if( !ret ) panic("Cannot create main window");
return ret;
}
void register_main_window_class()
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)MainWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = LoadIcon(GetNHApp()->hApp, (LPCTSTR)IDI_WINHACK);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (TCHAR*)IDC_WINHACK;
wcex.lpszClassName = szMainWindowClass;
RegisterClass(&wcex);
}
/*
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
*/
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PNHMainWindow data;
switch (message)
{
case WM_CREATE:
/* set window data */
data = (PNHMainWindow)malloc(sizeof(NHMainWindow));
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHMainWindow));
SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
GetNHApp()->hMainWnd = hWnd;
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_KEYDOWN:
{
/* translate arrow keys into nethack commands */
switch (wParam)
{
case VK_LEFT:
NHEVENT_KBD('4')
return 0;
case VK_RIGHT:
NHEVENT_KBD('6')
return 0;
case VK_UP:
NHEVENT_KBD('8')
return 0;
case VK_DOWN:
NHEVENT_KBD('2')
return 0;
case VK_HOME:
NHEVENT_KBD('7')
return 0;
case VK_END:
NHEVENT_KBD('1')
return 0;
case VK_PRIOR:
NHEVENT_KBD('9')
return 0;
case VK_NEXT:
NHEVENT_KBD('3')
return 0;
}
return 1;
} break;
case WM_CHAR:
/* all characters go to nethack */
NHEVENT_KBD(wParam);
return 0;
case WM_COMMAND:
/* process commands - menu commands mostly */
if( onWMCommand(hWnd, wParam, lParam) )
return DefWindowProc(hWnd, message, wParam, lParam);
else
return 0;
case WM_SIZE:
mswin_layout_main_window(NULL);
break;
case WM_SETFOCUS:
/* if there is a menu window out there -
transfer input focus to it */
if( IsWindow( GetNHApp()->hMenuWnd ) ) {
SetFocus( GetNHApp()->hMenuWnd );
}
break;
case WM_CLOSE:
{
/* exit gracefully */
switch(MessageBox(hWnd, TEXT("Save?"), TEXT("WinHack"), MB_YESNOCANCEL | MB_ICONQUESTION)) {
case IDYES: NHEVENT_KBD('y'); dosave(); break;
case IDNO: NHEVENT_KBD('y'); done2(); break;
case IDCANCEL: break;
}
} return 0;
case WM_DESTROY:
/* apparently we never get here
TODO: work on exit routines - need to send
WM_QUIT somehow */
/* clean up */
free( (PNHMainWindow)GetWindowLong(hWnd, GWL_USERDATA) );
SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
// PostQuitMessage(0);
exit(1);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
switch(wParam) {
/* new window was just added */
case MSNH_MSG_ADDWND: {
PMSNHMsgAddWnd msg_param = (PMSNHMsgAddWnd)lParam;
HWND child = GetNHApp()->windowlist[msg_param->wid].win;
if( child ) mswin_layout_main_window(child);
} break;
}
}
/* adjust windows to fit main window layout
---------------------------
| Status |
+-------------------------+
| |
| |
| MAP |
| |
| |
+-------------------------+
| Messages |
---------------------------
*/
void mswin_layout_main_window(HWND changed_child)
{
winid i;
POINT pt;
RECT client_rt;
SIZE menu_size;
SIZE status_size;
SIZE msg_size;
HWND wnd_status, wnd_msg;
PNHMainWindow data;
GetClientRect(GetNHApp()->hMainWnd, &client_rt);
data = (PNHMainWindow)GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
/* get sizes of child windows */
wnd_status = mswin_hwnd_from_winid(WIN_STATUS);
if( IsWindow(wnd_status) ) {
mswin_status_window_size(wnd_status, &status_size);
} else {
status_size.cx = status_size.cy = 0;
}
wnd_msg = mswin_hwnd_from_winid(WIN_MESSAGE);
if( IsWindow(wnd_msg) ) {
mswin_message_window_size(wnd_msg, &msg_size);
} else {
status_size.cx = status_size.cy = 0;
}
/* go through the windows list and adjust sizes */
for( i=0; i<MAXWINDOWS; i++ ) {
if(GetNHApp()->windowlist[i].win && !GetNHApp()->windowlist[i].dead) {
switch( GetNHApp()->windowlist[i].type ) {
case NHW_STATUS:
MoveWindow(GetNHApp()->windowlist[i].win,
client_rt.left,
client_rt.top,
client_rt.right-client_rt.left,
status_size.cy,
TRUE );
break;
case NHW_MAP:
MoveWindow(GetNHApp()->windowlist[i].win,
client_rt.left,
client_rt.top+status_size.cy,
client_rt.right-client_rt.left,
client_rt.bottom-client_rt.top-msg_size.cy-status_size.cy,
TRUE );
break;
case NHW_MESSAGE:
MoveWindow(GetNHApp()->windowlist[i].win,
client_rt.left,
client_rt.bottom-msg_size.cy,
client_rt.right-client_rt.left,
msg_size.cy,
TRUE );
break;
case NHW_MENU:
mswin_menu_window_size(GetNHApp()->windowlist[i].win, &menu_size);
menu_size.cx = min(menu_size.cx, (client_rt.right-client_rt.left));
pt.x = max(0, (int)(client_rt.right-menu_size.cx));
pt.y = client_rt.top+status_size.cy;
ClientToScreen(GetNHApp()->hMainWnd, &pt);
MoveWindow(GetNHApp()->windowlist[i].win,
pt.x,
pt.y,
min(menu_size.cx, client_rt.right),
client_rt.bottom-client_rt.top-msg_size.cy-status_size.cy,
TRUE );
break;
}
ShowWindow(GetNHApp()->windowlist[i].win, SW_SHOW);
}
}
}
LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(GetNHApp()->hApp, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
done2();
break;
case IDM_SAVE:
dosave();
break;
case IDM_HELP_LONG:
display_file(HELP, TRUE);
break;
case IDM_HELP_COMMANDS:
display_file(SHELP, TRUE);
break;
case IDM_HELP_HISTORY:
(void) dohistory();
break;
case IDM_HELP_INFO_CHAR:
(void) dowhatis();
break;
case IDM_HELP_INFO_KEY:
(void) dowhatdoes();
break;
case IDM_HELP_OPTIONS:
option_help();
break;
case IDM_HELP_OPTIONS_LONG:
display_file(OPTIONFILE, TRUE);
break;
case IDM_HELP_EXTCMD:
(void) doextlist();
break;
case IDM_HELP_LICENSE:
display_file(LICENSE, TRUE);
break;
default:
return 1;
}
return 0;
}
// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
char buf[BUFSZ];
TCHAR wbuf[BUFSZ];
RECT main_rt, dlg_rt;
SIZE dlg_sz;
switch (message)
{
case WM_INITDIALOG:
getversionstring(buf);
SetDlgItemText(hDlg, IDC_ABOUT_VERSION, NH_A2W(buf, wbuf, sizeof(wbuf)));
SetDlgItemText(hDlg, IDC_ABOUT_COPYRIGHT,
NH_A2W(
COPYRIGHT_BANNER_A "\n"
COPYRIGHT_BANNER_B "\n"
COPYRIGHT_BANNER_C,
wbuf,
BUFSZ
) );
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hDlg, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow( hDlg,
(main_rt.left+main_rt.right-dlg_sz.cx)/2,
(main_rt.top+main_rt.bottom-dlg_sz.cy)/2,
dlg_sz.cx,
dlg_sz.cy,
TRUE );
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

14
win/win32/mhmain.h Normal file
View File

@@ -0,0 +1,14 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMainWindow_h
#define MSWINMainWindow_h
/* this is a main appliation window */
#include "winMS.h"
HWND mswin_init_main_window ();
void mswin_layout_main_window(HWND changed_child);
#endif /* MSWINMainWindow_h */

466
win/win32/mhmap.c Normal file
View File

@@ -0,0 +1,466 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "resource.h"
#include "mhstatus.h"
#include "mhmsg.h"
#include "mhinput.h"
#define MAXWINDOWTEXT 255
extern short glyph2tile[];
/* map window data */
typedef struct mswin_nethack_map_window {
int map[COLNO][ROWNO]; /* glyph map */
int xPos, yPos;
int xPageSize, yPageSize;
int xCur, yCur;
} NHMapWindow, *PNHMapWindow;
static TCHAR szNHMapWindowClass[] = TEXT("MSNethackMapWndClass");
LRESULT CALLBACK MapWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_map_window_class();
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onPaint(HWND hWnd);
static void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam);
HWND mswin_init_map_window () {
static int run_once = 0;
HWND ret;
if( !run_once ) {
register_map_window_class();
run_once = 1;
}
ret = CreateWindow(
szNHMapWindowClass, /* registered class name */
NULL, /* window name */
WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_CLIPSIBLINGS, /* window style */
0, /* horizontal position of window - set it later */
0, /* vertical position of window - set it later */
0, /* window width - set it later */
0, /* window height - set it later*/
GetNHApp()->hMainWnd, /* handle to parent or owner window */
NULL, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL ); /* window-creation data */
if( !ret ) {
panic("Cannot create map window");
}
return ret;
}
void register_map_window_class()
{
WNDCLASS wcex;
ZeroMemory( &wcex, sizeof(wcex));
/* window class */
wcex.style = CS_NOCLOSE;
wcex.lpfnWndProc = (WNDPROC)MapWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = CreateSolidBrush(RGB(0, 0, 0)); /* set backgroup here */
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szNHMapWindowClass;
if( !RegisterClass(&wcex) ) {
panic("cannot register Map window class");
}
}
LRESULT CALLBACK MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch (message)
{
case WM_CREATE:
onCreate( hWnd, wParam, lParam );
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_PAINT:
onPaint(hWnd);
break;
case WM_SETFOCUS:
/* transfer focus back to the main window */
SetFocus(GetNHApp()->hMainWnd);
break;
case WM_HSCROLL:
onMSNH_HScroll(hWnd, wParam, lParam);
break;
case WM_VSCROLL:
onMSNH_VScroll(hWnd, wParam, lParam);
break;
case WM_SIZE:
{
SCROLLINFO si;
int xNewSize;
int yNewSize;
xNewSize = LOWORD(lParam);
yNewSize = HIWORD(lParam);
/* adjust horizontal scroll bar */
if( xNewSize/TILE_X >= COLNO ) {
data->xPos = 0;
GetNHApp()->bNoHScroll = TRUE;
} else {
GetNHApp()->bNoHScroll = FALSE;
data->xPos = max(0, min(COLNO, u.ux - xNewSize/TILE_X/2));
}
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = COLNO;
si.nPage = xNewSize/TILE_X;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
/* adjust vertical scroll bar */
if( yNewSize/TILE_Y >= ROWNO ) {
data->yPos = 0;
GetNHApp()->bNoVScroll = TRUE;
} else {
GetNHApp()->bNoVScroll = FALSE;
data->yPos = max(0, min(ROWNO, u.uy - yNewSize/TILE_Y/2));
}
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = ROWNO;
si.nPage = yNewSize/TILE_Y;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
/* erase window */
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case WM_LBUTTONDOWN:
NHEVENT_MS(
min(COLNO, data->xPos + LOWORD(lParam)/TILE_X),
min(ROWNO, data->yPos + HIWORD(lParam)/TILE_Y)
);
break;
case WM_DESTROY:
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
RECT rt;
data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch(wParam) {
case MSNH_MSG_PRINT_GLYPH:
{
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph)lParam;
data->map[msg_data->x][msg_data->y] = msg_data->glyph;
/* invalidate the update area */
rt.left = msg_data->x*TILE_X - TILE_X*data->xPos;
rt.top = msg_data->y*TILE_Y - TILE_Y*data->yPos;
rt.right = rt.left + TILE_X;
rt.bottom = rt.top + TILE_Y;
InvalidateRect(hWnd, &rt, TRUE);
}
break;
case MSNH_MSG_CLIPAROUND:
{
PMSNHMsgClipAround msg_data = (PMSNHMsgClipAround)lParam;
SCROLLINFO si;
int xPage, yPage;
int x, y;
/* get page size */
if( !GetNHApp()->bNoHScroll ) {
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_HORZ, &si);
xPage = si.nPage;
x = max(0, min(COLNO, msg_data->x - xPage/2));
SendMessage( hWnd, WM_HSCROLL, (WPARAM)MAKELONG(SB_THUMBTRACK, x), (LPARAM)NULL );
}
if( !GetNHApp()->bNoVScroll ) {
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_VERT, &si);
yPage = si.nPage;
y = max(0, min(ROWNO, msg_data->y - yPage/2));
SendMessage( hWnd, WM_VSCROLL, (WPARAM)MAKELONG(SB_THUMBTRACK, y), (LPARAM)NULL );
}
}
break;
case MSNH_MSG_CLEAR_WINDOW:
{
int i, j;
for(i=0; i<COLNO; i++)
for(j=0; j<ROWNO; j++) {
data->map[i][j] = -1;
}
InvalidateRect(hWnd, NULL, TRUE);
} break;
case MSNH_MSG_CURSOR:
{
PMSNHMsgCursor msg_data = (PMSNHMsgCursor)lParam;
HDC hdc;
RECT rt;
/* move focus rectangle at the cursor postion */
hdc = GetDC(hWnd);
rt.left = (data->xCur - data->xPos)*TILE_X;
rt.top = (data->yCur - data->yPos)*TILE_Y;
rt.right = rt.left + TILE_X;
rt.bottom = rt.top + TILE_Y;
DrawFocusRect(hdc, &rt);
data->xCur = msg_data->x;
data->yCur = msg_data->y;
rt.left = (data->xCur - data->xPos)*TILE_X;
rt.top = (data->yCur - data->yPos)*TILE_Y;
rt.right = rt.left + TILE_X;
rt.bottom = rt.top + TILE_Y;
DrawFocusRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
} break;
}
}
void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
int i,j;
/* set window data */
data = (PNHMapWindow)malloc(sizeof(NHMapWindow));
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHMapWindow));
for(i=0; i<COLNO; i++)
for(j=0; j<ROWNO; j++) {
data->map[i][j] = -1;
}
SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
}
void onPaint(HWND hWnd)
{
PNHMapWindow data;
PAINTSTRUCT ps;
HDC hDC;
HDC tileDC;
HGDIOBJ saveBmp;
RECT paint_rt;
int i, j;
/* get window data */
data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
hDC = BeginPaint(hWnd, &ps);
/* calculate paint rectangle */
if( !IsRectEmpty(&ps.rcPaint) ) {
/* prepare tiles DC for mapping */
tileDC = CreateCompatibleDC(hDC);
saveBmp = SelectObject(tileDC, GetNHApp()->bmpTiles);
/* calculate paint rectangle */
paint_rt.top = data->yPos + ps.rcPaint.top/TILE_X;
paint_rt.left = data->xPos + ps.rcPaint.left/TILE_Y;
paint_rt.bottom = min(data->yPos+ps.rcPaint.bottom/TILE_Y+1, ROWNO);
paint_rt.right = min(data->xPos+ps.rcPaint.right/TILE_X+1, COLNO);
/* draw the map */
for(i=paint_rt.left; i<paint_rt.right; i++)
for(j=paint_rt.top; j<paint_rt.bottom; j++)
if(data->map[i][j]>0) {
short ntile;
int t_x, t_y;
ntile = glyph2tile[ data->map[i][j] ];
t_x = (ntile % TILES_PER_LINE)*TILE_X;
t_y = (ntile / TILES_PER_LINE)*TILE_Y;
BitBlt(hDC, (i-data->xPos)*TILE_X, (j-data->yPos)*TILE_Y, TILE_X, TILE_Y, tileDC, t_x, t_y, SRCCOPY );
}
SelectObject(tileDC, saveBmp);
DeleteDC(tileDC);
/* draw focus rect */
paint_rt.left = (data->xCur - data->xPos)*TILE_X;
paint_rt.top = (data->yCur - data->yPos)*TILE_Y;
paint_rt.right = paint_rt.left + TILE_X;
paint_rt.bottom = paint_rt.top + TILE_Y;
DrawFocusRect(hDC, &paint_rt);
}
EndPaint(hWnd, &ps);
}
void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
SCROLLINFO si;
int yNewPos;
int yDelta;
/* get window data */
data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
/* get page size */
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_VERT, &si);
switch(LOWORD (wParam))
{
/* User clicked shaft left of the scroll box. */
case SB_PAGEUP:
yNewPos = data->yPos-si.nPage;
break;
/* User clicked shaft right of the scroll box. */
case SB_PAGEDOWN:
yNewPos = data->yPos+si.nPage;
break;
/* User clicked the left arrow. */
case SB_LINEUP:
yNewPos = data->yPos-1;
break;
/* User clicked the right arrow. */
case SB_LINEDOWN:
yNewPos = data->yPos+1;
break;
/* User dragged the scroll box. */
case SB_THUMBTRACK:
yNewPos = HIWORD(wParam);
break;
default:
yNewPos = data->yPos;
}
yNewPos = max(0, yNewPos);
yNewPos = min(ROWNO, yNewPos);
if( yNewPos == data->yPos ) return;
yDelta = yNewPos - data->yPos;
data->yPos = yNewPos;
ScrollWindowEx (hWnd, 0, -TILE_Y * yDelta,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE | SW_ERASE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
SCROLLINFO si;
int xNewPos;
int xDelta;
/* get window data */
data = (PNHMapWindow)GetWindowLong(hWnd, GWL_USERDATA);
/* get page size */
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_HORZ, &si);
switch(LOWORD (wParam))
{
/* User clicked shaft left of the scroll box. */
case SB_PAGEUP:
xNewPos = data->xPos-si.nPage;
break;
/* User clicked shaft right of the scroll box. */
case SB_PAGEDOWN:
xNewPos = data->xPos+si.nPage;
break;
/* User clicked the left arrow. */
case SB_LINEUP:
xNewPos = data->xPos-1;
break;
/* User clicked the right arrow. */
case SB_LINEDOWN:
xNewPos = data->xPos+1;
break;
/* User dragged the scroll box. */
case SB_THUMBTRACK:
xNewPos = HIWORD(wParam);
break;
default:
xNewPos = data->xPos;
}
xNewPos = max(0, xNewPos);
xNewPos = min(COLNO, xNewPos);
if( xNewPos == data->xPos ) return;
xDelta = xNewPos - data->xPos;
data->xPos = xNewPos;
ScrollWindowEx (hWnd, -TILE_X * xDelta, 0,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE | SW_ERASE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
}

13
win/win32/mhmap.h Normal file
View File

@@ -0,0 +1,13 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMapWindow_h
#define MSWINMapWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_map_window ();
#endif /* MSWINMapWindow_h */

784
win/win32/mhmenu.c Normal file
View File

@@ -0,0 +1,784 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include <assert.h>
#include <richedit.h>
#include "resource.h"
#include "mhmenu.h"
#include "mhmain.h"
#include "mhmsg.h"
#include "mhfont.h"
#define MENU_MARGIN 0
#define NHMENU_STR_SIZE 50
typedef struct mswin_menu_item {
int glyph;
ANY_P identifier;
CHAR_P accelerator;
CHAR_P group_accel;
int attr;
char str[NHMENU_STR_SIZE];
BOOLEAN_P presel;
} NHMenuItem, *PNHMenuItem;
typedef struct mswin_nethack_menu_window {
int type;
int how;
union {
struct menu_list {
int size;
int allocated;
PNHMenuItem items;
} menu;
struct menu_text {
int size;
char* text;
} text;
};
int result;
int done;
HBITMAP bmpChecked;
HBITMAP bmpNotChecked;
} NHMenuWindow, *PNHMenuWindow;
extern short glyph2tile[];
#define NHMENU_IS_SELECTABLE(item) ((item).identifier.a_obj!=NULL)
LRESULT CALLBACK MenuWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static LRESULT onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam);
static LRESULT onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutMenu(HWND hwnd);
static void SetMenuType(HWND hwnd, int type);
static void SetMenuListType(HWND hwnd, int now);
static HWND GetMenuControl(HWND hwnd);
DWORD CALLBACK NHTextStreamCallback(
DWORD dwCookie, // application-defined value
LPBYTE pbBuff, // data buffer
LONG cb, // number of bytes to read or write
LONG *pcb // number of bytes transferred
);
HWND mswin_init_menu_window (int type) {
HWND ret;
ret = CreateDialog(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_MENU),
GetNHApp()->hMainWnd,
MenuWndProc
);
if( !ret ) panic("Cannot create menu window");
SetMenuType(ret, type);
return ret;
}
int mswin_menu_window_select_menu (HWND hWnd, int how, MENU_ITEM_P ** _selected)
{
MSG msg;
PNHMenuWindow data;
int ret_val;
MENU_ITEM_P *selected = NULL;
int i;
assert( _selected!=NULL );
*_selected = NULL;
ret_val = -1;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
/* Ok, now give items a unique accelerators */
if( data->type == MENU_TYPE_MENU ) {
char next_char = 'a';
for( i=0; i<data->menu.size; i++) {
if( data->menu.items[i].accelerator!=0 ) {
next_char = (char)(data->menu.items[i].accelerator+1);
} else if( NHMENU_IS_SELECTABLE(data->menu.items[i]) ) {
if ( (next_char>='a' && next_char<='z') ||
(next_char>='A' && next_char<='Z') ) {
data->menu.items[i].accelerator = next_char;
} else {
if( next_char > 'z' ) next_char = 'A';
else if ( next_char > 'Z' ) break;
data->menu.items[i].accelerator = next_char;
}
next_char ++;
}
}
}
/* activate the menu window */
GetNHApp()->hMenuWnd = hWnd;
SetMenuListType(hWnd, how);
mswin_layout_main_window(hWnd);
EnableWindow(mswin_hwnd_from_winid(WIN_MAP), FALSE);
EnableWindow(mswin_hwnd_from_winid(WIN_MESSAGE), FALSE);
EnableWindow(mswin_hwnd_from_winid(WIN_STATUS), FALSE);
EnableWindow(GetNHApp()->hMainWnd, FALSE);
SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
while( IsWindow(hWnd) &&
!data->done &&
GetMessage(&msg, NULL, 0, 0)!=0 ) {
if( !IsDialogMessage(hWnd, &msg) ) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
/* get the result */
if( data->result != -1 ) {
if(how==PICK_NONE) {
if(data->result>=0) ret_val=0;
else ret_val=-1;
} else if(how==PICK_ONE) {
HWND menu_list;
int nItem;
menu_list = GetMenuControl(hWnd);
nItem = SendMessage(menu_list, LB_GETCURSEL, 0, 0);
if(nItem==LB_ERR) {
ret_val = 0;
} else {
assert(nItem>=0 && nItem<data->menu.size);
ret_val = 1;
selected = malloc( sizeof(MENU_ITEM_P) );
assert (selected != NULL);
selected[0].item = data->menu.items[nItem].identifier;
selected[0].count = -1;
*_selected = selected;
}
} else if(how==PICK_ANY) {
HWND menu_list;
int buffer[255];
int n_sel_items_in_buffer;
int i;
menu_list = GetMenuControl(hWnd);
ret_val = SendMessage(menu_list, LB_GETSELCOUNT, 0, 0);
if( ret_val==LB_ERR ) ret_val = 0;
if( ret_val > 0 ) {
n_sel_items_in_buffer = SendMessage(menu_list, LB_GETSELITEMS, sizeof(buffer)/sizeof(buffer[0]), (LPARAM) buffer);
ret_val = n_sel_items_in_buffer;
selected = malloc( n_sel_items_in_buffer*sizeof(MENU_ITEM_P) );
assert (selected != NULL);
ret_val = 0;
for(i=0; i<n_sel_items_in_buffer; i++ ) {
assert(buffer[i]>=0 && buffer[i]<data->menu.size);
if( NHMENU_IS_SELECTABLE(data->menu.items[buffer[i]]) ) {
selected[ret_val].item = data->menu.items[buffer[i]].identifier;
selected[ret_val].count = -1;
ret_val++;
}
}
*_selected = selected;
}
}
}
/* restore window state */
EnableWindow(GetNHApp()->hMainWnd, TRUE);
EnableWindow(mswin_hwnd_from_winid(WIN_MAP), TRUE);
EnableWindow(mswin_hwnd_from_winid(WIN_MESSAGE), TRUE);
EnableWindow(mswin_hwnd_from_winid(WIN_STATUS), TRUE);
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
GetNHApp()->hMenuWnd = NULL;
mswin_window_mark_dead( mswin_winid_from_handle(hWnd) );
DestroyWindow(hWnd);
mswin_layout_main_window(hWnd);
SetFocus(GetTopWindow(GetNHApp()->hMainWnd));
return ret_val;
}
LRESULT CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PNHMenuWindow data;
int nItem;
HDC hdc;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch (message)
{
case WM_INITDIALOG:
data = (PNHMenuWindow)malloc(sizeof(NHMenuWindow));
ZeroMemory(data, sizeof(NHMenuWindow));
data->type = MENU_TYPE_TEXT;
data->how = PICK_NONE;
data->result = 0;
data->done = 0;
data->bmpChecked = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL));
data->bmpNotChecked = LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
/* set text control font & the rest*/
if( data->type==MENU_TYPE_MENU ) {
hdc = GetDC(GetDlgItem(hWnd, IDC_MENU_TEXT));
SendDlgItemMessage(hWnd, IDC_MENU_TEXT, WM_SETFONT, (WPARAM)mswin_create_font(NHW_MENU, ATR_NONE, hdc), 0);
ReleaseDC(GetDlgItem(hWnd, IDC_MENU_TEXT), hdc);
SetFocus(GetMenuControl(hWnd));
} else {
SetFocus(GetDlgItem(hWnd, IDOK));
}
return FALSE;
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_SIZE:
LayoutMenu(hWnd);
return FALSE;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
data->result = -1;
data->done = 1;
return TRUE;
case IDOK:
data->done = 1;
data->result = 0;
return TRUE;
case IDC_MENU_LIST:
{
if( !data || data->type!=MENU_TYPE_MENU ) break;
switch(HIWORD(wParam)) {
case LBN_DBLCLK:
if(data->how==PICK_ONE) {
nItem = SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if( nItem!=LB_ERR &&
nItem>0 &&
nItem<data->menu.size &&
data->menu.items[nItem].accelerator!=0 ) {
data->done = 1;
data->result = 0;
return TRUE;
}
}
break;
}
}
break;
}
} break;
case WM_SETFOCUS:
if( hWnd!=GetNHApp()->hMenuWnd ) {
SetFocus(GetNHApp()->hMainWnd );
}
break;
case WM_MEASUREITEM:
return onMeasureItem(hWnd, wParam, lParam);
case WM_DRAWITEM:
return onDrawItem(hWnd, wParam, lParam);
case WM_VKEYTOITEM:
{
WORD c[4];
BYTE kbd_state[256];
ZeroMemory(kbd_state, sizeof(kbd_state));
ZeroMemory(c, sizeof(c));
GetKeyboardState(kbd_state);
if( ToAscii( LOWORD(wParam), 0, kbd_state, c, 0)==1 ) {
int i = 0;
for(i=0; i<data->menu.size; i++ ) {
if( data->menu.items[i].accelerator == c[0] ) {
if( data->how == PICK_ANY ) {
SendMessage((HWND)lParam,
LB_SETSEL,
(WPARAM)!SendMessage((HWND)lParam, LB_GETSEL, (WPARAM)i, (LPARAM)0),
(LPARAM)i);
return -2;
} else if( data->how == PICK_ONE ) {
SendMessage((HWND)lParam, LB_SETCURSEL, (WPARAM)i, (LPARAM)0);
data->result = 0;
data->done = 1;
return -2;
}
}
}
}
} return -1;
case WM_DESTROY:
DeleteObject(data->bmpChecked);
DeleteObject(data->bmpNotChecked);
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
return TRUE;
}
return FALSE;
}
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMenuWindow data;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR:
{
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
HWND text_view;
EDITSTREAM txt_edit;
CHARFORMAT txt_format;
if( data->type!=MENU_TYPE_TEXT )
SetMenuType(hWnd, MENU_TYPE_TEXT);
text_view = GetDlgItem(hWnd, IDC_MENU_TEXT);
if( !text_view ) panic("cannot get text view window");
/* apply text format to the selection */
ZeroMemory(&txt_format, sizeof(txt_format));
txt_format.cbSize = sizeof(txt_format);
txt_format.dwMask = CFM_BOLD | CFM_ITALIC | CFM_STRIKEOUT;
txt_format.dwEffects =
((msg_data->attr==ATR_BOLD || msg_data->attr==ATR_INVERSE)? CFE_BOLD : 0) |
((msg_data->attr==ATR_BLINK)? CFE_ITALIC : 0) |
((msg_data->attr==ATR_ULINE)? CFE_STRIKEOUT : 0)
;
/* txt_format.yHeight; */
/* txt_format.yOffset; */
/* txt_format.crTextColor; */
/* txt_format.bCharSet; */
/* txt_format.bPitchAndFamily = FIXED_PITCH; */
/* txt_format.szFaceName[LF_FACESIZE]; */
SendMessage(text_view, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&txt_format);
/* inject text into control (see NHTextStreamCallback) */
ZeroMemory(&txt_edit, sizeof(txt_edit));
txt_edit.dwCookie = (DWORD)msg_data->text;
txt_edit.pfnCallback = NHTextStreamCallback;
SendMessage(text_view, EM_STREAMIN, SF_TEXT | SFF_SELECTION, (LPARAM)&txt_edit);
} break;
case MSNH_MSG_STARTMENU:
if( data->type!=MENU_TYPE_MENU )
SetMenuType(hWnd, MENU_TYPE_MENU);
if( data->menu.items ) free(data->menu.items);
data->how = PICK_NONE;
data->menu.items = NULL;
data->menu.size = 0;
data->menu.allocated = 0;
data->done = 0;
data->result = 0;
break;
case MSNH_MSG_ADDMENU:
{
PMSNHMsgAddMenu msg_data = (PMSNHMsgAddMenu)lParam;
if( data->type!=MENU_TYPE_MENU ) break;
if( strlen(msg_data->str)==0 ) break;
if( data->menu.size==data->menu.allocated ) {
data->menu.allocated += 10;
data->menu.items = (PNHMenuItem)realloc(data->menu.items, data->menu.allocated*sizeof(NHMenuItem));
}
data->menu.items[data->menu.size].glyph = msg_data->glyph;
data->menu.items[data->menu.size].identifier = *msg_data->identifier;
data->menu.items[data->menu.size].accelerator = msg_data->accelerator;
data->menu.items[data->menu.size].group_accel = msg_data->group_accel;
data->menu.items[data->menu.size].attr = msg_data->attr;
strncpy(data->menu.items[data->menu.size].str, msg_data->str, NHMENU_STR_SIZE);
data->menu.items[data->menu.size].presel = msg_data->presel;
data->menu.size++;
} break;
}
}
void LayoutMenu(HWND hWnd)
{
PNHMenuWindow data;
// HWND menu_list;
// HWND menu_text;
HWND menu_ok;
HWND menu_cancel;
RECT clrt, rt;
POINT pt_elem, pt_ok, pt_cancel;
SIZE sz_elem, sz_ok, sz_cancel;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
// menu_list = GetDlgItem(hWnd, IDC_MENU_LIST);
// menu_text = GetDlgItem(hWnd, IDC_MENU_TEXT);
menu_ok = GetDlgItem(hWnd, IDOK);
menu_cancel = GetDlgItem(hWnd, IDCANCEL);
/* get window coordinates */
GetClientRect(hWnd, &clrt );
/* set window placements */
GetWindowRect(menu_ok, &rt);
sz_ok.cx = (clrt.right - clrt.left)/2 - 2*MENU_MARGIN;
sz_ok.cy = rt.bottom-rt.top;
pt_ok.x = clrt.left + MENU_MARGIN;
pt_ok.y = clrt.bottom - MENU_MARGIN - sz_ok.cy;
GetWindowRect(menu_cancel, &rt);
sz_cancel.cx = (clrt.right - clrt.left)/2 - 2*MENU_MARGIN;
sz_cancel.cy = rt.bottom-rt.top;
pt_cancel.x = (clrt.left + clrt.right)/2 + MENU_MARGIN;
pt_cancel.y = clrt.bottom - MENU_MARGIN - sz_cancel.cy;
pt_elem.x = clrt.left + MENU_MARGIN;
pt_elem.y = clrt.top + MENU_MARGIN;
sz_elem.cx = (clrt.right - clrt.left) - 2*MENU_MARGIN;
sz_elem.cy = min(pt_cancel.y, pt_ok.y) - 2*MENU_MARGIN;
MoveWindow(GetMenuControl(hWnd), pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE );
MoveWindow(menu_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE );
MoveWindow(menu_cancel, pt_cancel.x, pt_cancel.y, sz_cancel.cx, sz_cancel.cy, TRUE );
}
void SetMenuType(HWND hWnd, int type)
{
PNHMenuWindow data;
HWND list, text;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
// if( type == data->type ) return;
data->type = type;
text = GetDlgItem(hWnd, IDC_MENU_TEXT);
list = GetDlgItem(hWnd, IDC_MENU_LIST);
if(data->type==MENU_TYPE_TEXT) {
ShowWindow(list, SW_HIDE);
EnableWindow(list, FALSE);
EnableWindow(text, TRUE);
ShowWindow(text, SW_SHOW);
} else {
ShowWindow(text, SW_HIDE);
EnableWindow(text, FALSE);
EnableWindow(list, TRUE);
ShowWindow(list, SW_SHOW);
}
LayoutMenu(hWnd);
}
void SetMenuListType(HWND hWnd, int how)
{
PNHMenuWindow data;
RECT rt;
DWORD dwStyles;
char buf[255];
int nItem;
int i;
HWND control;
LRESULT fnt;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
if( data->type != MENU_TYPE_MENU ) return;
data->how = how;
switch(how) {
case PICK_NONE:
dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD
| WS_VSCROLL | WS_HSCROLL | LBS_WANTKEYBOARDINPUT
| LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_NOSEL
| LBS_OWNERDRAWFIXED;
break;
case PICK_ONE:
dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD
| WS_VSCROLL | WS_HSCROLL | LBS_WANTKEYBOARDINPUT
| LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | LBS_OWNERDRAWFIXED;
break;
case PICK_ANY:
dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD
| WS_VSCROLL | WS_HSCROLL | LBS_WANTKEYBOARDINPUT
| LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | LBS_MULTIPLESEL
| LBS_OWNERDRAWFIXED;
break;
default: panic("how should be one of PICK_NONE, PICK_ONE or PICK_ANY");
};
GetWindowRect(GetDlgItem(hWnd, IDC_MENU_LIST), &rt);
DestroyWindow(GetDlgItem(hWnd, IDC_MENU_LIST));
control = CreateWindow(
TEXT("LISTBOX"), /* registered class name */
NULL, /* window name */
dwStyles, /* window style */
rt.left, /* horizontal position of window */
rt.top, /* vertical position of window */
rt.right - rt.left, /* window width */
rt.bottom - rt.top, /* window height */
hWnd, /* handle to parent or owner window */
(HMENU)IDC_MENU_LIST, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL ); /* window-creation data */
fnt = SendMessage(hWnd, WM_GETFONT, (WPARAM)0, (LPARAM)0);
SendMessage(control, WM_SETFONT, (WPARAM)fnt, (LPARAM)0);
for(i=0; i<data->menu.size; i++ ) {
TCHAR wbuf[255];
sprintf(buf, "%c - %s", max(data->menu.items[i].accelerator, ' '), data->menu.items[i].str );
nItem = SendMessage(control, LB_ADDSTRING, (WPARAM)0, (LPARAM) NH_A2W(buf, wbuf, sizeof(wbuf)));
if( data->menu.items[i].presel ) {
if( data->how==PICK_ONE ) {
nItem = SendMessage(control, LB_SETCURSEL, (WPARAM)nItem, (LPARAM)0);
} else if( data->how==PICK_ANY ) {
nItem = SendMessage(control, LB_SETSEL, (WPARAM)TRUE, (LPARAM)nItem);
}
}
}
SetFocus(control);
}
HWND GetMenuControl(HWND hWnd)
{
PNHMenuWindow data;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
if(data->type==MENU_TYPE_TEXT) {
return GetDlgItem(hWnd, IDC_MENU_TEXT);
} else {
return GetDlgItem(hWnd, IDC_MENU_LIST);
}
}
LRESULT onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
LPMEASUREITEMSTRUCT lpmis;
TEXTMETRIC tm;
HGDIOBJ saveFont;
HDC hdc;
PNHMenuWindow data;
RECT client_rect;
lpmis = (LPMEASUREITEMSTRUCT) lParam;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
hdc = GetDC(GetMenuControl(hWnd));
saveFont = SelectObject(hdc, mswin_create_font(NHW_MENU, ATR_INVERSE, hdc));
GetTextMetrics(hdc, &tm);
/* Set the height of the list box items. */
lpmis->itemHeight = max(tm.tmHeight, TILE_Y)+2;
/* Set windth of list box items */
GetClientRect(hWnd, &client_rect);
lpmis->itemWidth = client_rect.right - client_rect.left;
mswin_destroy_font(SelectObject(hdc, saveFont));
ReleaseDC(GetMenuControl(hWnd), hdc);
return TRUE;
}
LRESULT onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
LPDRAWITEMSTRUCT lpdis;
PNHMenuItem item;
PNHMenuWindow data;
TEXTMETRIC tm;
HGDIOBJ saveBmp;
HGDIOBJ saveFont;
HGDIOBJ savePen;
HPEN pen;
HDC tileDC;
short ntile;
int t_x, t_y;
int x, y;
TCHAR wbuf[255];
lpdis = (LPDRAWITEMSTRUCT) lParam;
/* If there are no list box items, skip this message. */
if (lpdis->itemID == -1) return FALSE;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch (lpdis->itemAction)
{
case ODA_SELECT:
case ODA_DRAWENTIRE:
item = &data->menu.items[lpdis->itemID];
tileDC = CreateCompatibleDC(lpdis->hDC);
saveFont = SelectObject(lpdis->hDC, mswin_create_font(NHW_MENU, item->attr, lpdis->hDC));
GetTextMetrics(lpdis->hDC, &tm);
x = lpdis->rcItem.left;
/* print check mark */
if( NHMENU_IS_SELECTABLE(*item) ) {
char buf[2];
saveBmp = SelectObject(tileDC,
(lpdis->itemState & ODS_SELECTED)? data->bmpChecked: data->bmpNotChecked );
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - TILE_Y) / 2;
BitBlt(lpdis->hDC, x, y, TILE_X, TILE_Y, tileDC, 0, 0, SRCCOPY );
x += TILE_X + 5;
if(item->accelerator!=0) {
y = (lpdis->rcItem.bottom + lpdis->rcItem.top -
tm.tmHeight) / 2;
buf[0] = item->accelerator;
buf[1] = '\x0';
TextOut(lpdis->hDC, x, y, NH_A2W(buf, wbuf, sizeof(wbuf)), 1);
}
x += tm.tmAveCharWidth + 5;
}
SelectObject(tileDC, GetNHApp()->bmpTiles);
ntile = glyph2tile[ item->glyph ];
t_x = (ntile % TILES_PER_LINE)*TILE_X;
t_y = (ntile / TILES_PER_LINE)*TILE_Y;
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - TILE_Y) / 2;
BitBlt(lpdis->hDC, x, y, TILE_X, TILE_Y, tileDC, t_x, t_y, SRCCOPY );
x += TILE_X + 5;
y = (lpdis->rcItem.bottom + lpdis->rcItem.top -
tm.tmHeight) / 2;
TextOut(lpdis->hDC,
x,
y,
NH_A2W(item->str, wbuf, sizeof(wbuf)),
strlen(item->str));
mswin_destroy_font(SelectObject(lpdis->hDC, saveFont));
SelectObject(tileDC, saveBmp);
DeleteDC(tileDC);
break;
case ODA_FOCUS:
if( data->how==PICK_NONE ) break;
if( lpdis->itemState & ODS_FOCUS )
pen = CreatePen(PS_DOT, 0, RGB(0,0,0));
else
pen = CreatePen(PS_DOT, 0, GetBkColor(lpdis->hDC));
savePen = SelectObject(lpdis->hDC, pen);
MoveToEx(lpdis->hDC,lpdis->rcItem.left, lpdis->rcItem.top, NULL);
LineTo(lpdis->hDC, lpdis->rcItem.right-1, lpdis->rcItem.top);
LineTo(lpdis->hDC, lpdis->rcItem.right-1, lpdis->rcItem.bottom-1);
LineTo(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.bottom-1);
LineTo(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top);
DeleteObject(SelectObject(lpdis->hDC, savePen));
break;
}
return TRUE;
}
void mswin_menu_window_size (HWND hWnd, LPSIZE sz)
{
TEXTMETRIC tm;
HGDIOBJ saveFont;
HDC hdc;
PNHMenuWindow data;
int i;
RECT rt;
GetWindowRect(hWnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);
if(data) {
hdc = GetDC(GetMenuControl(hWnd));
saveFont = SelectObject(hdc, mswin_create_font(NHW_MENU, ATR_INVERSE, hdc));
GetTextMetrics(hdc, &tm);
/* Set the height of the list box items. */
for(i=0; i<data->menu.size; i++ ) {
sz->cx = max(sz->cx,
(LONG)(2*TILE_X + tm.tmAveCharWidth*(strlen(data->menu.items[i].str)+1)));
}
mswin_destroy_font(SelectObject(hdc, saveFont));
ReleaseDC(GetMenuControl(hWnd), hdc);
}
}
DWORD CALLBACK NHTextStreamCallback(
DWORD dwCookie, // application-defined value
LPBYTE pbBuff, // data buffer
LONG cb, // number of bytes to read or write
LONG *pcb // number of bytes transferred
)
{
static int st = 0;
static char* _text_buf = 0;
size_t to_copy;
switch(st) {
case 0:
_text_buf = (char*)dwCookie;
st = 1;
/* fall through */
case 1:
to_copy = min((size_t)cb, strlen(_text_buf));
if( *pcb>0 ) {
strncpy((char*)pbBuff, _text_buf, to_copy);
_text_buf += to_copy;
*pcb = (LONG)to_copy;
}
if( !_text_buf[0] ) st = 3;
break;
case 3:
*pcb = 2;
strncpy( (char*)pbBuff, "\r\n", *pcb);
st = 4;
break;
case 4:
*pcb = 0;
st = 0;
break;
}
return 0;
}

18
win/win32/mhmenu.h Normal file
View File

@@ -0,0 +1,18 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMenuWindow_h
#define MSWINMenuWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
#define MENU_TYPE_TEXT 1
#define MENU_TYPE_MENU 2
HWND mswin_init_menu_window ( int type );
int mswin_menu_window_select_menu (HWND hwnd, int how, MENU_ITEM_P **);
void mswin_menu_window_size (HWND hwnd, LPSIZE sz);
#endif /* MSWINTextWindow_h */

54
win/win32/mhmsg.h Normal file
View File

@@ -0,0 +1,54 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MHNethackMessages_H
#define MHNethackMessages_H
/* nethack messages */
#define WM_MSNH_COMMAND (WM_APP+1)
#define MSNH_MSG_ADDWND 100
#define MSNH_MSG_PUTSTR 101
#define MSNH_MSG_PRINT_GLYPH 102
#define MSNH_MSG_CLEAR_WINDOW 103
#define MSNH_MSG_CLIPAROUND 104
#define MSNH_MSG_STARTMENU 105
#define MSNH_MSG_ADDMENU 106
#define MSNH_MSG_CURSOR 107
typedef struct mswin_nhmsg_add_wnd {
winid wid;
} MSNHMsgAddWnd, *PMSNHMsgAddWnd;
typedef struct mswin_nhmsg_putstr {
int attr;
const char* text;
} MSNHMsgPutstr, *PMSNHMsgPutstr;
typedef struct mswin_nhmsg_print_glyph {
XCHAR_P x;
XCHAR_P y;
int glyph;
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
typedef struct mswin_nhmsg_cliparound {
int x;
int y;
} MSNHMsgClipAround, *PMSNHMsgClipAround;
typedef struct mswin_nhmsg_add_menu {
int glyph;
const ANY_P* identifier;
CHAR_P accelerator;
CHAR_P group_accel;
int attr;
const char * str;
BOOLEAN_P presel;
} MSNHMsgAddMenu, *PMSNHMsgAddMenu;
typedef struct mswin_nhmsg_cursor {
int x;
int y;
} MSNHMsgCursor, *PMSNHMsgCursor;
#endif

470
win/win32/mhmsgwnd.c Normal file
View File

@@ -0,0 +1,470 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhmsgwnd.h"
#include "mhmsg.h"
#include "mhfont.h"
#define MSG_VISIBLE_LINES 4
#define MAX_MSG_LINES 32
#define MSG_LINES (int)min(iflags.msg_history, MAX_MSG_LINES)
#define MAXWINDOWTEXT 200
#define NHMSG_BKCOLOR RGB(192, 192, 192)
struct window_line {
int attr;
char text[MAXWINDOWTEXT];
};
typedef struct mswin_nethack_message_window {
size_t max_text;
struct window_line window_text[MAX_MSG_LINES];
int xChar; /* horizontal scrolling unit */
int yChar; /* vertical scrolling unit */
int xUpper; /* average width of uppercase letters */
int xPos; /* current horizontal scrolling position */
int yPos; /* current vertical scrolling position */
int xMax; /* maximum horizontal scrolling position */
int yMax; /* maximum vertical scrolling position */
} NHMessageWindow, *PNHMessageWindow;
static TCHAR szMessageWindowClass[] = TEXT("MSNHMessageWndClass");
LRESULT CALLBACK MessageWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_message_window_class();
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
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 HDC prepareDC( HDC hdc );
HWND mswin_init_message_window () {
static int run_once = 0;
HWND ret;
if( !run_once ) {
register_message_window_class( );
run_once = 1;
}
ret = CreateWindow(
szMessageWindowClass, /* registered class name */
NULL, /* window name */
WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL, /* window style */
0, /* horizontal position of window */
0, /* vertical position of window */
0, /* window width */
0, /* window height - set it later */
GetNHApp()->hMainWnd, /* handle to parent or owner window */
NULL, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL ); /* window-creation data */
if( !ret ) panic("Cannot create message window");
return ret;
}
void register_message_window_class()
{
WNDCLASS wcex;
ZeroMemory( &wcex, sizeof(wcex));
wcex.style = CS_NOCLOSE;
wcex.lpfnWndProc = (WNDPROC)MessageWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)CreateSolidBrush(NHMSG_BKCOLOR);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szMessageWindowClass;
RegisterClass(&wcex);
}
LRESULT CALLBACK MessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
onCreate( hWnd, wParam, lParam );
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_PAINT:
onPaint(hWnd);
break;
case WM_SETFOCUS:
SetFocus(GetNHApp()->hMainWnd);
break;
case WM_HSCROLL:
onMSNH_HScroll(hWnd, wParam, lParam);
break;
case WM_VSCROLL:
onMSNH_VScroll(hWnd, wParam, lParam);
break;
case WM_DESTROY:
{
PNHMessageWindow data;
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
} break;
case WM_SIZE:
{
SCROLLINFO si;
int xNewSize;
int yNewSize;
PNHMessageWindow data;
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
xNewSize = LOWORD(lParam);
yNewSize = HIWORD(lParam);
data->xMax = max(0, (int)(1 + data->max_text - xNewSize/data->xChar));
data->xPos = min(data->xPos, data->xMax);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = data->max_text;
si.nPage = xNewSize/data->xChar;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
data->yMax = MSG_LINES - MSG_VISIBLE_LINES + 1;
data->yPos = min(data->yPos, data->yMax);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = MSG_LINES;
si.nPage = MSG_VISIBLE_LINES;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch( wParam ) {
case MSNH_MSG_PUTSTR:
{
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
SCROLLINFO si;
int i;
memmove(&data->window_text[0],
&data->window_text[1],
(MSG_LINES-1)*sizeof(data->window_text[0]));
data->window_text[MSG_LINES-1].attr = msg_data->attr;
strncpy(data->window_text[MSG_LINES-1].text, msg_data->text, MAXWINDOWTEXT);
data->yPos = data->yMax;
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
data->max_text = 0;
for( i=0; i<MSG_LINES; i++ )
if( data->max_text < strlen(data->window_text[i].text) )
data->max_text = strlen(data->window_text[i].text);
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_HORZ, &si);
data->xMax = max(0, (int)(1 + data->max_text - si.nPage) );
data->xPos = min(data->xPos, data->xMax);
si.cbSize = sizeof(si);
si.fMask = SIF_POS | SIF_RANGE;
si.nMin = 0;
si.nMax = data->max_text;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case MSNH_MSG_CLEAR_WINDOW:
{
// do nothing
break;
}
}
}
void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
SCROLLINFO si;
int yInc;
/* get window data */
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_POS;
GetScrollInfo(hWnd, SB_VERT, &si);
switch(LOWORD (wParam))
{
// User clicked the shaft above the scroll box.
case SB_PAGEUP:
yInc = -(int)si.nPage;
break;
// User clicked the shaft below the scroll box.
case SB_PAGEDOWN:
yInc = si.nPage;
break;
// User clicked the top arrow.
case SB_LINEUP:
yInc = -1;
break;
// User clicked the bottom arrow.
case SB_LINEDOWN:
yInc = 1;
break;
// User dragged the scroll box.
case SB_THUMBTRACK:
yInc = HIWORD(wParam) - data->yPos;
break;
default:
yInc = 0;
}
// If applying the vertical scrolling increment does not
// take the scrolling position out of the scrolling range,
// increment the scrolling position, adjust the position
// of the scroll box, and update the window. UpdateWindow
// sends the WM_PAINT message.
if (yInc = max(-data->yPos, min(yInc, data->yMax - data->yPos)))
{
data->yPos += yInc;
/* ScrollWindowEx(hWnd, 0, -data->yChar * yInc,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE | SW_ERASE);
*/
InvalidateRect(hWnd, NULL, TRUE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
UpdateWindow (hWnd);
}
}
void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
SCROLLINFO si;
int xInc;
/* get window data */
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_HORZ, &si);
switch(LOWORD (wParam))
{
// User clicked shaft left of the scroll box.
case SB_PAGEUP:
xInc = - (int)si.nPage;
break;
// User clicked shaft right of the scroll box.
case SB_PAGEDOWN:
xInc = si.nPage;
break;
// User clicked the left arrow.
case SB_LINEUP:
xInc = -1;
break;
// User clicked the right arrow.
case SB_LINEDOWN:
xInc = 1;
break;
// User dragged the scroll box.
case SB_THUMBTRACK:
xInc = HIWORD(wParam) - data->xPos;
break;
default:
xInc = 0;
}
// If applying the horizontal scrolling increment does not
// take the scrolling position out of the scrolling range,
// increment the scrolling position, adjust the position
// of the scroll box, and update the window.
if (xInc = max (-data->xPos, min (xInc, data->xMax - data->xPos)))
{
data->xPos += xInc;
ScrollWindowEx (hWnd, -data->xChar * xInc, 0,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE | SW_ERASE);
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
UpdateWindow (hWnd);
}
}
void onPaint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hdc;
PNHMessageWindow data;
RECT client_rt, draw_rt;
int FirstLine, LastLine;
int i, x, y;
HGDIOBJ oldFont;
char draw_buf[MAXWINDOWTEXT+2];
TCHAR wbuf[MAXWINDOWTEXT+2];
hdc = BeginPaint(hWnd, &ps);
SetBkColor(hdc, NHMSG_BKCOLOR);
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
GetClientRect(hWnd, &client_rt);
FirstLine = max (0, data->yPos + ps.rcPaint.top/data->yChar - 1);
LastLine = min (MSG_LINES, data->yPos + ps.rcPaint.bottom/data->yChar);
for (i=FirstLine; i<LastLine; i++) {
if( i==MSG_LINES-1 ) {
x = data->xChar * (-data->xPos);
SetRect( &draw_rt,
client_rt.left, client_rt.bottom - data->yChar - 4, client_rt.right, client_rt.bottom );
DrawEdge(hdc, &draw_rt, EDGE_SUNKEN, BF_TOP | BF_ADJUST);
DrawEdge(hdc, &draw_rt, EDGE_SUNKEN, BF_BOTTOM | BF_ADJUST);
draw_rt.left = x;
draw_rt.right = client_rt.right - x;
strcpy( draw_buf, "> " );
strcat( draw_buf, data->window_text[i].text );
} else {
y = client_rt.bottom - data->yChar * (LastLine - i) - 4;
x = data->xChar * (4 - data->xPos);
SetRect( &draw_rt,
x, y, max(client_rt.right, client_rt.right-x), y+data->yChar );
strcpy( draw_buf, data->window_text[i].text );
}
if( strlen(draw_buf)>0 ) {
oldFont = SelectObject(hdc, mswin_create_font(NHW_MESSAGE, data->window_text[i].attr, hdc));
DrawText(hdc, NH_A2W(draw_buf, wbuf, sizeof(wbuf)), strlen(draw_buf), &draw_rt, DT_VCENTER | DT_NOPREFIX);
mswin_destroy_font(SelectObject(hdc, oldFont));
}
}
EndPaint(hWnd, &ps);
}
void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
TEXTMETRIC tm;
PNHMessageWindow data;
HGDIOBJ saveFont;
/* set window data */
data = (PNHMessageWindow)malloc(sizeof(NHMessageWindow));
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHMessageWindow));
data->max_text = MAXWINDOWTEXT;
SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
/* Get the handle to the client area's device context. */
hdc = prepareDC( GetDC(hWnd) );
saveFont = SelectObject(hdc, mswin_create_font(NHW_STATUS, ATR_NONE, hdc));
/* Extract font dimensions from the text metrics. */
GetTextMetrics (hdc, &tm);
data->xChar = tm.tmAveCharWidth;
data->xUpper = (tm.tmPitchAndFamily & 1 ? 3 : 2) * data->xChar/2;
data->yChar = tm.tmHeight + tm.tmExternalLeading;
/* Free the device context. */
mswin_destroy_font(SelectObject(hdc, saveFont));
ReleaseDC (hWnd, hdc);
}
HDC prepareDC( HDC hdc )
{
// set font here
return hdc;
}
void mswin_message_window_size (HWND hWnd, LPSIZE sz)
{
PNHMessageWindow data;
RECT rt;
GetWindowRect(hWnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
data = (PNHMessageWindow)GetWindowLong(hWnd, GWL_USERDATA);
if(data) {
sz->cy = data->yChar * MSG_VISIBLE_LINES + 4;
}
}

15
win/win32/mhmsgwnd.h Normal file
View File

@@ -0,0 +1,15 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMessageWindow_h
#define MSWINMessageWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_message_window ();
void mswin_message_window_size (HWND hWnd, LPSIZE sz);
#endif /* MSWINMessageWindow_h */

36
win/win32/mhrip.c Normal file
View File

@@ -0,0 +1,36 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "resource.h"
#include "mhrip.h"
#include "mhtext.h"
HWND mswin_init_RIP_window ()
{
return mswin_init_text_window();
}
void mswin_display_RIP_window (HWND hWnd)
{
MSG msg;
RECT rt;
GetNHApp()->hMenuWnd = hWnd;
GetWindowRect(GetNHApp()->hMainWnd, &rt);
MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, FALSE);
ShowWindow(hWnd, SW_SHOW);
SetFocus(hWnd);
while( IsWindow(hWnd) &&
GetMessage(&msg, NULL, 0, 0)!=0 ) {
if( !IsDialogMessage(hWnd, &msg) ) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
GetNHApp()->hMenuWnd = NULL;
}

14
win/win32/mhrip.h Normal file
View File

@@ -0,0 +1,14 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINRIPWindow_h
#define MSWINRIPWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_RIP_window ();
void mswin_display_RIP_window (HWND hwnd);
#endif /* MSWINRIPWindow_h */

164
win/win32/mhstatus.c Normal file
View File

@@ -0,0 +1,164 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhstatus.h"
#include "mhmsg.h"
#include "mhfont.h"
#define NHSW_LINES 2
#define MAXWINDOWTEXT 80
typedef struct mswin_nethack_status_window {
int index;
char window_text[NHSW_LINES][MAXWINDOWTEXT];
} NHStatusWindow, *PNHStatusWindow;
static TCHAR szStatusWindowClass[] = TEXT("MSNHStatusWndClass");
LRESULT CALLBACK StatusWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_status_window_class();
HWND mswin_init_status_window () {
static int run_once = 0;
HWND ret;
NHStatusWindow* data;
if( !run_once ) {
register_status_window_class( );
run_once = 1;
}
ret = CreateWindow(
szStatusWindowClass,
NULL,
WS_CHILD | WS_DISABLED | WS_CLIPSIBLINGS,
0, /* x position */
0, /* y position */
0, /* x-size - we will set it later */
0, /* y-size - we will set it later */
GetNHApp()->hMainWnd,
NULL,
GetNHApp()->hApp,
NULL );
if( !ret ) panic("Cannot create status window");
EnableWindow(ret, FALSE);
data = (PNHStatusWindow)malloc(sizeof(NHStatusWindow));
if( !data ) panic("out of memory");
ZeroMemory(data, sizeof(NHStatusWindow));
SetWindowLong(ret, GWL_USERDATA, (LONG)data);
return ret;
}
void register_status_window_class()
{
WNDCLASS wcex;
ZeroMemory( &wcex, sizeof(wcex));
wcex.style = CS_NOCLOSE;
wcex.lpfnWndProc = (WNDPROC)StatusWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szStatusWindowClass;
RegisterClass(&wcex);
}
LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rt;
PAINTSTRUCT ps;
HDC hdc;
PNHStatusWindow data;
data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
switch (message)
{
case WM_MSNH_COMMAND: {
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
strncpy(data->window_text[data->index], msg_data->text,
MAXWINDOWTEXT);
strncat(data->window_text[data->index], "\n",
MAXWINDOWTEXT-strlen(data->window_text[data->index]));
data->index = (data->index+1) % NHSW_LINES;
InvalidateRect(hWnd, NULL, TRUE);
break;
}
case MSNH_MSG_CLEAR_WINDOW:
data->index = 0;
ZeroMemory(data->window_text, sizeof(data->window_text));
InvalidateRect(hWnd, NULL, TRUE);
break;
}
} break;
case WM_PAINT: {
int i;
SIZE sz;
HGDIOBJ oldFont;
TCHAR wbuf[255];
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rt);
oldFont = SelectObject(hdc, mswin_create_font(NHW_STATUS, ATR_NONE, hdc));
for(i=0; i<NHSW_LINES; i++ ) {
GetTextExtentPoint32(hdc, NH_A2W(data->window_text[i], wbuf, sizeof(wbuf)), strlen(data->window_text[i]), &sz);
DrawText(hdc, NH_A2W(data->window_text[i], wbuf, sizeof(wbuf)), strlen(data->window_text[i]), &rt, DT_LEFT);
rt.top += sz.cy;
}
mswin_destroy_font(SelectObject(hdc, oldFont));
EndPaint(hWnd, &ps);
} break;
case WM_DESTROY:
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
break;
case WM_SETFOCUS:
SetFocus(GetNHApp()->hMainWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void mswin_status_window_size (HWND hWnd, LPSIZE sz)
{
TEXTMETRIC tm;
HGDIOBJ saveFont;
HDC hdc;
PNHStatusWindow data;
RECT rt;
GetWindowRect(hWnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
data = (PNHStatusWindow)GetWindowLong(hWnd, GWL_USERDATA);
if(data) {
hdc = GetDC(hWnd);
saveFont = SelectObject(hdc, mswin_create_font(NHW_STATUS, ATR_NONE, hdc));
GetTextMetrics(hdc, &tm);
sz->cy = tm.tmHeight * NHSW_LINES;
mswin_destroy_font(SelectObject(hdc, saveFont));
ReleaseDC(hWnd, hdc);
}
}

153
win/win32/mhtext.c Normal file
View File

@@ -0,0 +1,153 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "resource.h"
#include "mhtext.h"
#include "mhmsg.h"
#include "mhfont.h"
LRESULT CALLBACK TextWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutText(HWND hwnd);
HWND mswin_init_text_window () {
HWND ret;
ret = CreateDialog(
GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_TEXT),
GetNHApp()->hMainWnd,
TextWndProc
);
if( !ret ) panic("Cannot create text window");
return ret;
}
void mswin_display_text_window (HWND hWnd)
{
MSG msg;
RECT rt;
HWND map_wnd;
GetNHApp()->hMenuWnd = hWnd;
map_wnd = mswin_hwnd_from_winid(WIN_MAP);
if( !IsWindow(map_wnd) ) map_wnd = GetNHApp()->hMainWnd;
GetWindowRect(map_wnd, &rt);
MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
ShowWindow(hWnd, SW_SHOW);
SetFocus(hWnd);
while( IsWindow(hWnd) &&
GetMessage(&msg, NULL, 0, 0)!=0 ) {
if( !IsDialogMessage(hWnd, &msg) ) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
GetNHApp()->hMenuWnd = NULL;
}
LRESULT CALLBACK TextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND control;
HDC hdc;
switch (message)
{
case WM_INITDIALOG:
/* set text control font */
control = GetDlgItem(hWnd, IDC_TEXT_VIEW);
hdc = GetDC(control);
SendMessage(control, WM_SETFONT, (WPARAM)mswin_create_font(NHW_TEXT, ATR_NONE, hdc), 0);
ReleaseDC(control, hdc);
SetFocus(control);
return FALSE;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_SIZE:
LayoutText(hWnd);
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
mswin_window_mark_dead(mswin_winid_from_handle(hWnd));
if( GetNHApp()->hMainWnd==hWnd )
GetNHApp()->hMainWnd=NULL;
DestroyWindow(hWnd);
SetFocus(GetNHApp()->hMainWnd);
return TRUE;
}
}
return FALSE;
}
void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
switch( wParam ) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
HWND text_view;
TCHAR* text;
TCHAR wbuf[BUFSZ];
size_t text_size;
text_view = GetDlgItem(hWnd, IDC_TEXT_VIEW);
if( !text_view ) panic("cannot get text view window");
text_size = GetWindowTextLength(text_view) + strlen(msg_data->text) + 3;
text = (TCHAR*)malloc(text_size*sizeof(text[0]));
if( !text ) break;
ZeroMemory(text, text_size*sizeof(text[0]));
GetWindowText(text_view, text, GetWindowTextLength(text_view));
_tcscat(text, NH_A2W(msg_data->text, wbuf, sizeof(wbuf)));
_tcscat(text, TEXT("\n"));
SetWindowText(text_view, text);
free(text);
break;
}
}
}
void LayoutText(HWND hWnd)
{
HWND btn_ok;
HWND text;
RECT clrt, rt;
POINT pt_elem, pt_ok;
SIZE sz_elem, sz_ok;
text = GetDlgItem(hWnd, IDC_TEXT_VIEW);
btn_ok = GetDlgItem(hWnd, IDOK);
/* get window coordinates */
GetClientRect(hWnd, &clrt );
/* set window placements */
GetWindowRect(btn_ok, &rt);
sz_ok.cx = clrt.right - clrt.left;
sz_ok.cy = rt.bottom-rt.top;
pt_ok.x = clrt.left;
pt_ok.y = clrt.bottom - sz_ok.cy;
pt_elem.x = clrt.left;
pt_elem.y = clrt.top;
sz_elem.cx = clrt.right - clrt.left;
sz_elem.cy = pt_ok.y;
MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE );
MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE );
}

14
win/win32/mhtext.h Normal file
View File

@@ -0,0 +1,14 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINTextWindow_h
#define MSWINTextWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_text_window ();
void mswin_display_text_window (HWND hwnd);
#endif /* MSWINTextWindow_h */

11
win/win32/mnsel.uu Normal file
View File

@@ -0,0 +1,11 @@
BEGIN--cut here--CUT HERE--
begin 600 mnsel.bmp
M0DWV`````````'8````H````$````!`````!``0``````(``````````````
M````````````````````@```@````("``(````"``(``@(```,#`P`"`@(``
M``#_``#_````__\`_P```/\`_P#__P``____````````````````````````
M________``#_"/____\``/@`C____P``\`@(____``#P#X"/__\``/`/^`C_
M_P``\`__@(__``#XC__X"/\``/____^`CP``______@/``#_______\``/__
5_____P``````````````````````
`
end
END--cut here--CUT HERE--

11
win/win32/mnunsel.uu Normal file
View File

@@ -0,0 +1,11 @@
BEGIN--cut here--CUT HERE--
begin 600 mnunsel.bmp
M0DWV`````````'8````H````$````!`````!``0``````(``````````````
M````````````````````@```@````("``(````"``(``@(```,#`P`"`@(``
M``#_``#_````__\`_P```/\`_P#__P``____````````````````````````
M________``#_______\``/_______P``________``#_______\``/______
M_P``________``#_______\``/_______P``________``#_______\``/__
5_____P``````````````````````
`
end
END--cut here--CUT HERE--

1031
win/win32/mswproc.c Normal file

File diff suppressed because it is too large Load Diff

185
win/win32/nethack.dsw Normal file
View File

@@ -0,0 +1,185 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "dgncomp"=.\winhacknt\dgncomp.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name dgnstuff
End Project Dependency
}}}
###############################################################################
Project: "dgnstuff"=.\winhacknt\dgnstuff.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name makedefs
End Project Dependency
}}}
###############################################################################
Project: "dlb_main"=.\winhacknt\dlb_main.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name dgncomp
End Project Dependency
Begin Project Dependency
Project_Dep_Name levcomp
End Project Dependency
Begin Project Dependency
Project_Dep_Name makedefs
End Project Dependency
}}}
###############################################################################
Project: "levcomp"=.\winhacknt\levcomp.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name levstuff
End Project Dependency
}}}
###############################################################################
Project: "levstuff"=.\winhacknt\levstuff.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name makedefs
End Project Dependency
}}}
###############################################################################
Project: "makedefs"=.\winhacknt\makedefs.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "recover"=.\winhacknt\recover.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name makedefs
End Project Dependency
Begin Project Dependency
Project_Dep_Name dlb_main
End Project Dependency
}}}
###############################################################################
Project: "tile2bmp"=.\winhacknt\tile2bmp.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "tilemap"=.\winhacknt\tilemap.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "winhack"=.\winhacknt\winhack.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name dgncomp
End Project Dependency
Begin Project Dependency
Project_Dep_Name dlb_main
End Project Dependency
Begin Project Dependency
Project_Dep_Name levcomp
End Project Dependency
Begin Project Dependency
Project_Dep_Name makedefs
End Project Dependency
Begin Project Dependency
Project_Dep_Name recover
End Project Dependency
Begin Project Dependency
Project_Dep_Name tile2bmp
End Project Dependency
Begin Project Dependency
Project_Dep_Name tilemap
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

146
win/win32/recover.dsp Normal file
View File

@@ -0,0 +1,146 @@
# Microsoft Developer Studio Project File - Name="recover" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=recover - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "recover.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "recover.mak" CFG="recover - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "recover - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "recover - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "recover - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# Begin Special Build Tool
OutDir=.\Release
SOURCE="$(InputPath)"
PostBuild_Cmds=copy $(OutDir)\recover.exe ..\binary
# End Special Build Tool
!ELSEIF "$(CFG)" == "recover - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# Begin Special Build Tool
OutDir=.\Debug
SOURCE="$(InputPath)"
PostBuild_Desc=install exe
PostBuild_Cmds=copy $(OutDir)\recover.exe ..\binary
# End Special Build Tool
!ENDIF
# Begin Target
# Name "recover - Win32 Release"
# Name "recover - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\util\recover.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\config.h
# End Source File
# Begin Source File
SOURCE=..\include\config1.h
# End Source File
# Begin Source File
SOURCE=..\include\coord.h
# End Source File
# Begin Source File
SOURCE=..\include\global.h
# End Source File
# Begin Source File
SOURCE=..\include\nhlan.h
# End Source File
# Begin Source File
SOURCE=..\include\ntconf.h
# End Source File
# Begin Source File
SOURCE=..\include\tradstdc.h
# End Source File
# Begin Source File
SOURCE=..\sys\winnt\win32api.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

127
win/win32/resource.h Normal file
View File

@@ -0,0 +1,127 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by winhack.rc
//
#define IDC_MYICON 2
#define IDD_WINHACK_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDS_HELLO 106
#define IDI_WINHACK 107
#define IDC_WINHACK 109
#define IDR_MAINFRAME 128
#define IDB_TILES 129
#define IDD_TEXT 130
#define IDD_MENU 132
#define IDB_MENU_SEL 133
#define IDB_MENU_UNSEL 134
#define IDD_COMMANDS 136
#define IDD_GETLIN 138
#define IDD_EXTCMD 139
#define IDD_PLAYER_SELECTOR 141
#define IDC_TEXT_VIEW 1000
#define IDC_CMD_MOVE_NW 1001
#define IDC_CMD_MOVE_N 1002
#define IDC_MENU_LIST 1003
#define IDC_CMD_MOVE_NE 1003
#define IDC_MENU_TEXT 1004
#define IDC_CMD_MOVE_W 1004
#define IDC_CMD_MOVE_SELF 1005
#define IDC_CMD_MOVE_E 1006
#define IDC_CMD_MOVE_SW 1007
#define IDC_CMD_MOVE_S 1008
#define IDC_CMD_MOVE_SE 1009
#define IDC_CMD_MOVE_UP 1010
#define IDC_CMD_MOVE_DOWN 1011
#define IDC_CMD_5 1012
#define IDC_CMD_A 1013
#define IDC_CMD_B 1014
#define IDC_CMD_C 1015
#define IDC_CMD_D 1016
#define IDC_CMD_E 1017
#define IDC_CMD_F 1018
#define IDC_CMD_G 1019
#define IDC_CMD_H 1020
#define IDC_CMD_I 1021
#define IDC_CMD_J 1022
#define IDC_CMD_K 1023
#define IDC_CMD_L 1024
#define IDC_CMD_M 1025
#define IDC_CMD_N 1026
#define IDC_CMD_O 1027
#define IDC_CMD_P 1028
#define IDC_CMD_Q 1029
#define IDC_CMD_R 1030
#define IDC_CMD_S 1031
#define IDC_CMD_T 1032
#define IDC_CMD_U 1033
#define IDC_CMD_V 1034
#define IDC_CMD_W 1035
#define IDC_CMD_X 1036
#define IDC_CMD_Y 1037
#define IDC_CMD_Z 1038
#define IDC_CMD_AA 1039
#define IDC_CMD_BB 1040
#define IDC_CMD_CC 1041
#define IDC_CMD_DD 1042
#define IDC_CMD_EE 1043
#define IDC_CMD_FF 1044
#define IDC_CMD_GG 1045
#define IDC_CMD_HH 1046
#define IDC_CMD_II 1047
#define IDC_CMD_JJ 1048
#define IDC_CMD_KK 1049
#define IDC_CMD_LL 1050
#define IDC_CMD_MM 1051
#define IDC_CMD_NN 1052
#define IDC_CMD_OO 1053
#define IDC_CMD_PP 1054
#define IDC_CMD_QQ 1055
#define IDC_CMD_RR 1056
#define IDC_CMD_SS 1057
#define IDC_CMD_TT 1058
#define IDC_CMD_UU 1059
#define IDC_CMD_VV 1060
#define IDC_CMD_WW 1061
#define IDC_CMD_XX 1062
#define IDC_CMD_YY 1063
#define IDC_CMD_ZZ 1064
#define IDC_CMD_FIRST 1100
#define IDC_CMD_LAST 1300
#define IDC_GETLIN_EDIT 1309
#define IDC_EXTCMD_LIST 1310
#define IDC_PLSEL_NAME 1314
#define IDC_PLSEL_ROLE_RANDOM 1315
#define IDC_PLSEL_RACE_RANDOM 1318
#define IDC_PLSEL_GENDER_RANDOM 1319
#define IDC_PLSEL_ALIGN_RANDOM 1320
#define IDC_PLSEL_ROLE_LIST 1323
#define IDC_PLSEL_RACE_LIST 1324
#define IDC_PLSEL_ALIGN_LIST 1325
#define IDC_PLSEL_GENDER_LIST 1326
#define IDC_ABOUT_VERSION 1327
#define IDC_ABOUT_COPYRIGHT 1328
#define IDM_SAVE 32771
#define IDM_HELP_LONG 32772
#define IDM_HELP_COMMANDS 32773
#define IDM_HELP_HISTORY 32774
#define IDM_HELP_INFO_CHAR 32775
#define IDM_HELP_INFO_KEY 32776
#define IDM_HELP_OPTIONS 32777
#define IDM_HELP_OPTIONS_LONG 32778
#define IDM_HELP_EXTCMD 32779
#define IDM_HELP_LICENSE 32780
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 143
#define _APS_NEXT_COMMAND_VALUE 32781
#define _APS_NEXT_CONTROL_VALUE 1329
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

156
win/win32/tile2bmp.dsp Normal file
View File

@@ -0,0 +1,156 @@
# Microsoft Developer Studio Project File - Name="tile2bmp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tile2bmp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tile2bmp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tile2bmp.mak" CFG="tile2bmp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tile2bmp - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tile2bmp - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tile2bmp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt" /I "..\win\share" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\util\tile2bmp.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Building nhtiles.bmp
PostBuild_Cmds=pushd ..\src ..\util\tile2bmp.exe tiles.bmp popd
# End Special Build Tool
!ELSEIF "$(CFG)" == "tile2bmp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\sys\winnt" /I "..\win\share" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\util\tile2bmp.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Building tiles.bmp
PostBuild_Cmds=pushd ..\src ..\util\tile2bmp.exe tiles.bmp if exist tiles.bmp copy tiles.bmp ..\winhacknt popd
# End Special Build Tool
!ENDIF
# Begin Target
# Name "tile2bmp - Win32 Release"
# Name "tile2bmp - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\src\decl.c
# End Source File
# Begin Source File
SOURCE=..\src\drawing.c
# End Source File
# Begin Source File
SOURCE=..\src\monst.c
# End Source File
# Begin Source File
SOURCE=..\src\objects.c
# End Source File
# Begin Source File
SOURCE=..\win\win32\tile2bmp.c
!IF "$(CFG)" == "tile2bmp - Win32 Release"
!ELSEIF "$(CFG)" == "tile2bmp - Win32 Debug"
# ADD CPP /D "PACKED_FILE"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\win\share\tiletext.c
!IF "$(CFG)" == "tile2bmp - Win32 Release"
!ELSEIF "$(CFG)" == "tile2bmp - Win32 Debug"
# ADD CPP /Zi
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\win\share\tiletxt.c
# ADD CPP /D "TILETEXT"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

281
win/win32/tilemap.dsp Normal file
View File

@@ -0,0 +1,281 @@
# Microsoft Developer Studio Project File - Name="tilemap" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tilemap - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tilemap.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tilemap.mak" CFG="tilemap - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tilemap - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tilemap - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tilemap - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sys\winnt\include" /I "..\win\share" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x1009 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\util\tilemap.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Generating src\tile.c
PostBuild_Cmds=chdir ..\src ..\util\tilemap.exe chdir ..\build
# End Special Build Tool
!ELSEIF "$(CFG)" == "tilemap - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\sys\winnt\include" /I "..\win\share" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32CON" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x1009 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"..\util\tilemap.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Generating src\tile.c
PostBuild_Cmds=echo pushd ..\src pushd ..\src ..\util\tilemap.exe popd echo popd
# End Special Build Tool
!ENDIF
# Begin Target
# Name "tilemap - Win32 Release"
# Name "tilemap - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\win\share\tilemap.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\align.h
# End Source File
# Begin Source File
SOURCE=..\include\attrib.h
# End Source File
# Begin Source File
SOURCE=..\include\color.h
# End Source File
# Begin Source File
SOURCE=..\include\config.h
# End Source File
# Begin Source File
SOURCE=..\include\config1.h
# End Source File
# Begin Source File
SOURCE=..\include\coord.h
# End Source File
# Begin Source File
SOURCE=..\include\decl.h
# End Source File
# Begin Source File
SOURCE=..\include\dgn_comp.h
# End Source File
# Begin Source File
SOURCE=..\include\dgn_file.h
# End Source File
# Begin Source File
SOURCE=..\include\display.h
# End Source File
# Begin Source File
SOURCE=..\include\dungeon.h
# End Source File
# Begin Source File
SOURCE=..\include\engrave.h
# End Source File
# Begin Source File
SOURCE=..\include\flag.h
# End Source File
# Begin Source File
SOURCE=..\include\global.h
# End Source File
# Begin Source File
SOURCE=..\include\mkroom.h
# End Source File
# Begin Source File
SOURCE=..\include\monattk.h
# End Source File
# Begin Source File
SOURCE=..\include\monst.h
# End Source File
# Begin Source File
SOURCE=..\include\monsym.h
# End Source File
# Begin Source File
SOURCE=..\include\nhlan.h
# End Source File
# Begin Source File
SOURCE=..\include\ntconf.h
# End Source File
# Begin Source File
SOURCE=..\include\obj.h
# End Source File
# Begin Source File
SOURCE=..\include\objclass.h
# End Source File
# Begin Source File
SOURCE=..\include\onames.h
# End Source File
# Begin Source File
SOURCE=..\include\permonst.h
# End Source File
# Begin Source File
SOURCE=..\include\pm.h
# End Source File
# Begin Source File
SOURCE=..\include\prop.h
# End Source File
# Begin Source File
SOURCE=..\include\quest.h
# End Source File
# Begin Source File
SOURCE=..\include\rect.h
# End Source File
# Begin Source File
SOURCE=..\include\region.h
# End Source File
# Begin Source File
SOURCE=..\include\rm.h
# End Source File
# Begin Source File
SOURCE=..\include\skills.h
# End Source File
# Begin Source File
SOURCE=..\include\spell.h
# End Source File
# Begin Source File
SOURCE=..\include\timeout.h
# End Source File
# Begin Source File
SOURCE=..\include\tradstdc.h
# End Source File
# Begin Source File
SOURCE=..\include\trampoli.h
# End Source File
# Begin Source File
SOURCE=..\include\trap.h
# End Source File
# Begin Source File
SOURCE=..\include\vision.h
# End Source File
# Begin Source File
SOURCE=..\include\winprocs.h
# End Source File
# Begin Source File
SOURCE=..\include\wintty.h
# End Source File
# Begin Source File
SOURCE=..\include\wintype.h
# End Source File
# Begin Source File
SOURCE=..\include\you.h
# End Source File
# Begin Source File
SOURCE=..\include\youprop.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

131
win/win32/winMS.h Normal file
View File

@@ -0,0 +1,131 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef WINMS_H
#define WINMS_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include "hack.h"
/* Create an array to keep track of the various windows */
#ifndef MAXWINDOWS
#define MAXWINDOWS 15
#endif
#define NHW_RIP 32
#ifndef TILE_X
#define TILE_X 16
#endif
#define TILE_Y 16
#define TILES_PER_LINE 40
typedef struct mswin_nhwindow_data {
HWND win;
int type;
int dead;
} MSNHWinData, *PMSNHWinData;
typedef struct mswin_nhwindow_app {
HINSTANCE hApp;
HWND hMainWnd;
HACCEL hAccelTable;
HWND hMenuWnd; /* menu window in the selection process */
MSNHWinData windowlist[MAXWINDOWS];
HBITMAP bmpTiles;
boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */
boolean bNoVScroll; /* disable cliparound for vertical grid (map) */
} NHWinApp, *PNHWinApp;
extern PNHWinApp GetNHApp();
#define E extern
E struct window_procs mswin_procs;
#undef E
/* Some prototypes */
void mswin_init_nhwindows(int* argc, char** argv);
void mswin_player_selection(void);
void mswin_askname(void);
void mswin_get_nh_event(void);
void mswin_exit_nhwindows(const char *);
void mswin_suspend_nhwindows(const char *);
void mswin_resume_nhwindows(void);
winid mswin_create_nhwindow(int type);
void mswin_clear_nhwindow(winid wid);
void mswin_display_nhwindow(winid wid, BOOLEAN_P block);
void mswin_destroy_nhwindow(winid wid);
void mswin_curs(winid wid, int x, int y);
void mswin_putstr(winid wid, int attr, const char *text);
void mswin_display_file(const char *filename,BOOLEAN_P must_exist);
void mswin_start_menu(winid wid);
void mswin_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel);
void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
void mswin_update_inventory(void);
void mswin_mark_synch(void);
void mswin_wait_synch(void);
void mswin_cliparound(int x, int y);
void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph);
void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str);
int mswin_nhgetch(void);
int mswin_nh_poskey(int *x, int *y, int *mod);
void mswin_nhbell(void);
int mswin_doprev_message(void);
char mswin_yn_function(const char *question, const char *choices,
CHAR_P def);
void mswin_getlin(const char *question, char *input);
int mswin_get_ext_cmd(void);
void mswin_number_pad(int state);
void mswin_delay_output(void);
void mswin_change_color(void);
char *mswin_get_color_string(void);
void mswin_start_screen(void);
void mswin_end_screen(void);
void mswin_outrip(winid wid, int how);
/* helper function */
HWND mswin_hwnd_from_winid(winid wid);
winid mswin_winid_from_type(int type);
winid mswin_winid_from_handle(HWND hWnd);
void mswin_window_mark_dead(winid wid);
void bail(const char *mesg);
/* unicode stuff */
#ifdef UNICODE
#define NH_W2A(w, a, cb) ( WideCharToMultiByte( \
CP_ACP, \
0, \
(w), \
-1, \
(a), \
(cb), \
NULL, \
NULL), (a) )
#define NH_A2W(a, w, cb) ( MultiByteToWideChar( \
CP_ACP, \
0, \
(a), \
-1, \
(w), \
(cb)), (w) )
#else
#define NH_W2A(w, a, cb) (strncpy((a), (w), (cb)))
#define NH_A2W(a, w, cb) (strncpy((w), (a), (cb)))
#endif
#endif /* WINmswin_H */

129
win/win32/winhack.c Normal file
View File

@@ -0,0 +1,129 @@
/* Copyright (C) 2001 by Alex Kompel <shurikk@pacbell.net> */
// winhack.cpp : Defines the entry point for the application.
//
#include <process.h>
#include "winMS.h"
#include "hack.h"
#include "dlb.h"
#include "resource.h"
#include "mhmain.h"
#ifdef OVL0
#define SHARED_DCL
#else
#define SHARED_DCL extern
#endif
SHARED_DCL char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */
extern void FDECL(nethack_exit,(int));
// Global Variables:
NHWinApp _nethack_app;
// Foward declarations of functions included in this code module:
BOOL InitInstance(HINSTANCE, int);
extern void FDECL(pcmain, (int,char **));
static void __cdecl mswin_moveloop(void *);
#define MAX_CMDLINE_PARAM 255
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
INITCOMMONCONTROLSEX InitCtrls;
int argc;
char* argv[MAX_CMDLINE_PARAM];
size_t len;
TCHAR* p;
TCHAR wbuf[BUFSZ];
char buf[BUFSZ];
/* init applicatio structure */
_nethack_app.hApp = hInstance;
_nethack_app.hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINHACK);
_nethack_app.hMainWnd = NULL;
_nethack_app.hMenuWnd = NULL;
_nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES));
if( _nethack_app.bmpTiles==NULL ) panic("cannot load tiles bitmap");
_nethack_app.bNoHScroll = FALSE;
_nethack_app.bNoVScroll = FALSE;
// init controls
LoadLibrary( TEXT("RICHED32.DLL") );
ZeroMemory(&InitCtrls, sizeof(InitCtrls));
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&InitCtrls);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
#ifdef _DEBUG
wizard = TRUE;
#endif
/* get command line parameters */
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
p = _tcstok(GetCommandLine(), TEXT(" "));
for( argc=1; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
len = _tcslen(p);
if( len>0 ) {
argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
} else {
argv[argc] = "";
}
p = _tcstok(NULL, TEXT(" "));
}
pcmain(argc,argv);
moveloop();
return 0;
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hWnd = mswin_init_main_window();
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
_nethack_app.hMainWnd = hWnd;
return TRUE;
}
PNHWinApp GetNHApp()
{
return &_nethack_app;
}

1172
win/win32/winhack.dsp Normal file

File diff suppressed because it is too large Load Diff

14
win/win32/winhack.h Normal file
View File

@@ -0,0 +1,14 @@
#if !defined(AFX_WINHACK_H__6397C328_BAF8_460C_9465_F12C596C5732__INCLUDED_)
#define AFX_WINHACK_H__6397C328_BAF8_460C_9465_F12C596C5732__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#include <windows.h>
#include "resource.h"
#endif // !defined(AFX_WINHACK_H__6397C328_BAF8_460C_9465_F12C596C5732__INCLUDED_)

280
win/win32/winhack.rc Normal file
View File

@@ -0,0 +1,280 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_WINHACK ICON DISCARDABLE "NETHACK.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_WINHACK MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Save", IDM_SAVE
MENUITEM SEPARATOR
MENUITEM "&Quit", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", IDM_ABOUT
MENUITEM "&Long description of the game", IDM_HELP_LONG
MENUITEM "List of &commands", IDM_HELP_COMMANDS
MENUITEM "&History of NetHack", IDM_HELP_HISTORY
MENUITEM "&Info on a character", IDM_HELP_INFO_CHAR
MENUITEM "Info on what a given &key does", IDM_HELP_INFO_KEY
MENUITEM "List of game &options", IDM_HELP_OPTIONS
MENUITEM "&Longer list of game options", IDM_HELP_OPTIONS_LONG
MENUITEM "List of e&xtended commands", IDM_HELP_EXTCMD
MENUITEM "The &NetHack license", IDM_HELP_LICENSE
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_WINHACK ACCELERATORS MOVEABLE PURE
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
LTEXT "NetHack",IDC_ABOUT_VERSION,10,10,170,15,SS_NOPREFIX
LTEXT "Copyright",IDC_ABOUT_COPYRIGHT,10,30,210,40
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
IDD_TEXT DIALOGEX 0, 0, 172, 178
STYLE DS_SETFOREGROUND | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_STATICEDGE
CAPTION "Text"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,54,163,50,14
CONTROL "",IDC_TEXT_VIEW,"RICHEDIT",ES_MULTILINE | ES_READONLY |
ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP,0,0,173,155
END
IDD_MENU DIALOGEX 0, 0, 187, 153
STYLE WS_POPUP | WS_CLIPSIBLINGS | WS_THICKFRAME
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT | WS_EX_STATICEDGE
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,132,50,14,BS_FLAT
PUSHBUTTON "Cancel",IDCANCEL,130,132,50,14,BS_FLAT
CONTROL "",IDC_MENU_TEXT,"RICHEDIT",ES_MULTILINE | ES_READONLY |
ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP,7,67,173,61
LISTBOX IDC_MENU_LIST,10,10,170,55,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
END
IDD_GETLIN DIALOG DISCARDABLE 0, 0, 131, 29
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Question?"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,0,15,65,14
PUSHBUTTON "Cancel",IDCANCEL,65,15,65,14
EDITTEXT IDC_GETLIN_EDIT,0,0,130,13,ES_AUTOHSCROLL
END
IDD_EXTCMD DIALOG DISCARDABLE 0, 0, 129, 114
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Extended Commands"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,75,5,50,14
PUSHBUTTON "Cancel",IDCANCEL,75,20,50,14
LISTBOX IDC_EXTCMD_LIST,5,5,65,105,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
END
IDD_PLAYER_SELECTOR DIALOG DISCARDABLE 0, 0, 144, 164
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "What are you?"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Play",IDOK,5,145,65,14
PUSHBUTTON "Quit",IDCANCEL,75,145,65,14
EDITTEXT IDC_PLSEL_NAME,35,5,105,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Name:",IDC_STATIC,5,5,25,10
GROUPBOX "Role",IDC_STATIC,5,20,135,30
GROUPBOX "Race",IDC_STATIC,5,50,135,30
GROUPBOX "Gender",IDC_STATIC,5,85,135,30
GROUPBOX "Alignment",IDC_STATIC,5,115,135,30
CONTROL "Random",IDC_PLSEL_ROLE_RANDOM,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,10,31,45,10
CONTROL "Random",IDC_PLSEL_RACE_RANDOM,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,10,60,45,10
CONTROL "Random",IDC_PLSEL_GENDER_RANDOM,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,10,95,40,10
CONTROL "Random",IDC_PLSEL_ALIGN_RANDOM,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,10,125,45,10
COMBOBOX IDC_PLSEL_ROLE_LIST,60,30,75,50,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_PLSEL_RACE_LIST,60,60,75,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_PLSEL_ALIGN_LIST,60,125,75,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_PLSEL_GENDER_LIST,60,95,75,40,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_TILES BITMAP DISCARDABLE "tiles.bmp"
IDB_MENU_SEL BITMAP DISCARDABLE "mnsel.bmp"
IDB_MENU_UNSEL BITMAP DISCARDABLE "mnunsel.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_TEXT, DIALOG
BEGIN
BOTTOMMARGIN, 177
END
IDD_MENU, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 180
TOPMARGIN, 7
BOTTOMMARGIN, 146
END
IDD_GETLIN, DIALOG
BEGIN
BOTTOMMARGIN, 22
END
IDD_EXTCMD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 122
TOPMARGIN, 7
BOTTOMMARGIN, 107
END
IDD_PLAYER_SELECTOR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 137
TOPMARGIN, 7
BOTTOMMARGIN, 157
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "winhack"
IDC_WINHACK "WINHACK"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

29
win/win32/winnt.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "winhack"=.\winhack\winhack.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################