From: nethack.allison Date: Sun, 13 Jan 2002 05:27:55 +0000 (+0000) Subject: Add WinHack source files to distribution X-Git-Tag: MOVE2GIT~3490 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b79441dc5d672dc6a3b8039d9c6d1742fa894f7d;p=nethack Add WinHack source files to distribution --- diff --git a/win/win32/dgncomp.dsp b/win/win32/dgncomp.dsp new file mode 100644 index 000000000..d9e796ad9 --- /dev/null +++ b/win/win32/dgncomp.dsp @@ -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 diff --git a/win/win32/dgnstuff.dsp b/win/win32/dgnstuff.dsp new file mode 100644 index 000000000..6e57bda9f --- /dev/null +++ b/win/win32/dgnstuff.dsp @@ -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 diff --git a/win/win32/dgnstuff.mak b/win/win32/dgnstuff.mak new file mode 100644 index 000000000..ef58b0fed --- /dev/null +++ b/win/win32/dgnstuff.mak @@ -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 diff --git a/win/win32/dlb_main.dsp b/win/win32/dlb_main.dsp new file mode 100644 index 000000000..aad1bcc10 --- /dev/null +++ b/win/win32/dlb_main.dsp @@ -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 diff --git a/win/win32/levcomp.dsp b/win/win32/levcomp.dsp new file mode 100644 index 000000000..d89932ff1 --- /dev/null +++ b/win/win32/levcomp.dsp @@ -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 diff --git a/win/win32/levstuff.dsp b/win/win32/levstuff.dsp new file mode 100644 index 000000000..676dae0c2 --- /dev/null +++ b/win/win32/levstuff.dsp @@ -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 diff --git a/win/win32/levstuff.mak b/win/win32/levstuff.mak new file mode 100644 index 000000000..39808e660 --- /dev/null +++ b/win/win32/levstuff.mak @@ -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 + diff --git a/win/win32/makedefs.dsp b/win/win32/makedefs.dsp new file mode 100644 index 000000000..2a5f67620 --- /dev/null +++ b/win/win32/makedefs.dsp @@ -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 diff --git a/win/win32/mhaskyn.c b/win/win32/mhaskyn.c new file mode 100644 index 000000000..8553d9df9 --- /dev/null +++ b/win/win32/mhaskyn.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* NetHack may be freely redistributed. See license for details. */ + +#include +#include "winMS.h" +#include "mhaskyn.h" + +int mswin_yes_no_dialog( const char *question, const char *choices, int def) +{ + return '\032'; +} \ No newline at end of file diff --git a/win/win32/mhaskyn.h b/win/win32/mhaskyn.h new file mode 100644 index 000000000..a386b0971 --- /dev/null +++ b/win/win32/mhaskyn.h @@ -0,0 +1,11 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhcmd.c b/win/win32/mhcmd.c new file mode 100644 index 000000000..2a367cfda --- /dev/null +++ b/win/win32/mhcmd.c @@ -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; +} + diff --git a/win/win32/mhcmd.h b/win/win32/mhcmd.h new file mode 100644 index 000000000..5ada76efe --- /dev/null +++ b/win/win32/mhcmd.h @@ -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 */ diff --git a/win/win32/mhdlg.c b/win/win32/mhdlg.c new file mode 100644 index 000000000..c9de94509 --- /dev/null +++ b/win/win32/mhdlg.c @@ -0,0 +1,662 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; +} diff --git a/win/win32/mhdlg.h b/win/win32/mhdlg.h new file mode 100644 index 000000000..b96483881 --- /dev/null +++ b/win/win32/mhdlg.h @@ -0,0 +1,15 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhfont.c b/win/win32/mhfont.c new file mode 100644 index 000000000..8897b8b16 --- /dev/null +++ b/win/win32/mhfont.c @@ -0,0 +1,131 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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=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); */ +} + diff --git a/win/win32/mhfont.h b/win/win32/mhfont.h new file mode 100644 index 000000000..394582f49 --- /dev/null +++ b/win/win32/mhfont.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhinput.c b/win/win32/mhinput.c new file mode 100644 index 000000000..dc9680df2 --- /dev/null +++ b/win/win32/mhinput.c @@ -0,0 +1,85 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* NetHack may be freely redistributed. See license for details. */ + +#include +#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; +} \ No newline at end of file diff --git a/win/win32/mhinput.h b/win/win32/mhinput.h new file mode 100644 index 000000000..294bc9b22 --- /dev/null +++ b/win/win32/mhinput.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c new file mode 100644 index 000000000..a5c5ae76c --- /dev/null +++ b/win/win32/mhmain.c @@ -0,0 +1,422 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; iwindowlist[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; +} + diff --git a/win/win32/mhmain.h b/win/win32/mhmain.h new file mode 100644 index 000000000..4e4eac21a --- /dev/null +++ b/win/win32/mhmain.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c new file mode 100644 index 000000000..c72250821 --- /dev/null +++ b/win/win32/mhmap.c @@ -0,0 +1,466 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; imap[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; imap[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; imap[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); +} + diff --git a/win/win32/mhmap.h b/win/win32/mhmap.h new file mode 100644 index 000000000..537efe93c --- /dev/null +++ b/win/win32/mhmap.h @@ -0,0 +1,13 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c new file mode 100644 index 000000000..79e2a8ef3 --- /dev/null +++ b/win/win32/mhmenu.c @@ -0,0 +1,784 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "winMS.h" +#include +#include +#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; imenu.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 && nItemmenu.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=0 && buffer[i]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 && + nItemmenu.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; imenu.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; imenu.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; imenu.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; +} \ No newline at end of file diff --git a/win/win32/mhmenu.h b/win/win32/mhmenu.h new file mode 100644 index 000000000..aa9a90db9 --- /dev/null +++ b/win/win32/mhmenu.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h new file mode 100644 index 000000000..0cc94114f --- /dev/null +++ b/win/win32/mhmsg.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 diff --git a/win/win32/mhmsgwnd.c b/win/win32/mhmsgwnd.c new file mode 100644 index 000000000..21c754595 --- /dev/null +++ b/win/win32/mhmsgwnd.c @@ -0,0 +1,470 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; imax_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; ixChar * (-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; + } +} \ No newline at end of file diff --git a/win/win32/mhmsgwnd.h b/win/win32/mhmsgwnd.h new file mode 100644 index 000000000..0434f1cc4 --- /dev/null +++ b/win/win32/mhmsgwnd.h @@ -0,0 +1,15 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhrip.c b/win/win32/mhrip.c new file mode 100644 index 000000000..c1025b83b --- /dev/null +++ b/win/win32/mhrip.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; +} \ No newline at end of file diff --git a/win/win32/mhrip.h b/win/win32/mhrip.h new file mode 100644 index 000000000..533daa918 --- /dev/null +++ b/win/win32/mhrip.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mhstatus.c b/win/win32/mhstatus.c new file mode 100644 index 000000000..623be9e18 --- /dev/null +++ b/win/win32/mhstatus.c @@ -0,0 +1,164 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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; iwindow_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); + } +} \ No newline at end of file diff --git a/win/win32/mhtext.c b/win/win32/mhtext.c new file mode 100644 index 000000000..e9a64234f --- /dev/null +++ b/win/win32/mhtext.c @@ -0,0 +1,153 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 ); +} diff --git a/win/win32/mhtext.h b/win/win32/mhtext.h new file mode 100644 index 000000000..3a7b1b7a6 --- /dev/null +++ b/win/win32/mhtext.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* 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 */ diff --git a/win/win32/mnsel.uu b/win/win32/mnsel.uu new file mode 100644 index 000000000..9fd2d9923 --- /dev/null +++ b/win/win32/mnsel.uu @@ -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-- diff --git a/win/win32/mnunsel.uu b/win/win32/mnunsel.uu new file mode 100644 index 000000000..e0571a70b --- /dev/null +++ b/win/win32/mnunsel.uu @@ -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-- diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c new file mode 100644 index 000000000..abf259f9a --- /dev/null +++ b/win/win32/mswproc.c @@ -0,0 +1,1031 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* NetHack may be freely redistributed. See license for details. */ + +/* + * This file implements the interface between the window port specific + * code in the mswin port and the rest of the nethack game engine. +*/ + +#include "hack.h" +#include "dlb.h" +#include "winMS.h" +#include "mhmap.h" +#include "mhstatus.h" +#include "mhtext.h" +#include "mhmsgwnd.h" +#include "mhmenu.h" +#include "mhmsg.h" +#include "mhinput.h" +#include "mhaskyn.h" +#include "mhdlg.h" +#include "mhrip.h" + +#define LLEN 128 + +#ifdef _DEBUG +extern void logDebug(const char *fmt, ...); +#else +void logDebug(const char *fmt, ...) { } +#endif + +static void mswin_main_loop(); + +/* Interface definition, for windows.c */ +struct window_procs mswin_procs = { + "MSWIN", + mswin_init_nhwindows, + mswin_player_selection, + mswin_askname, + mswin_get_nh_event, + mswin_exit_nhwindows, + mswin_suspend_nhwindows, + mswin_resume_nhwindows, + mswin_create_nhwindow, + mswin_clear_nhwindow, + mswin_display_nhwindow, + mswin_destroy_nhwindow, + mswin_curs, + mswin_putstr, + mswin_display_file, + mswin_start_menu, + mswin_add_menu, + mswin_end_menu, + mswin_select_menu, + genl_message_menu, /* no need for X-specific handling */ + mswin_update_inventory, + mswin_mark_synch, + mswin_wait_synch, +#ifdef CLIPPING + mswin_cliparound, +#endif +#ifdef POSITIONBAR + donull, +#endif + mswin_print_glyph, + mswin_raw_print, + mswin_raw_print_bold, + mswin_nhgetch, + mswin_nh_poskey, + mswin_nhbell, + mswin_doprev_message, + mswin_yn_function, + mswin_getlin, + mswin_get_ext_cmd, + mswin_number_pad, + mswin_delay_output, +#ifdef CHANGE_COLOR /* only a Mac option currently */ + mswin, + mswin_change_background, +#endif + /* other defs that really should go away (they're tty specific) */ + mswin_start_screen, + mswin_end_screen, + mswin_outrip, +}; + + +/* +init_nhwindows(int* argcp, char** argv) + -- Initialize the windows used by NetHack. This can also + create the standard windows listed at the top, but does + not display them. + -- Any commandline arguments relevant to the windowport + should be interpreted, and *argcp and *argv should + be changed to remove those arguments. + -- When the message window is created, the variable + iflags.window_inited needs to be set to TRUE. Otherwise + all plines() will be done via raw_print(). + ** Why not have init_nhwindows() create all of the "standard" + ** windows? Or at least all but WIN_INFO? -dean +*/ +void mswin_init_nhwindows(int* argc, char** argv) +{ + logDebug("mswin_init_nhwindows()\n"); + +#ifdef _DEBUG + { + /* truncate trace file */ + FILE *dfp = fopen("nhtrace.log", "w"); + fclose(dfp); + } +#endif + mswin_nh_input_init(); + + iflags.window_inited = TRUE; +} + + +/* Do a window-port specific player type selection. If player_selection() + offers a Quit option, it is its responsibility to clean up and terminate + the process. You need to fill in pl_character[0]. +*/ +void mswin_player_selection(void) +{ + int nRole; + + logDebug("mswin_player_selection()\n"); + + /* select a role */ + flags.initalign = -1; /* reset */ + flags.initgend = -1; + flags.initrace = -1; + flags.initrole = -1; + + if( mswin_player_selection_window( &nRole ) == IDCANCEL ) { + clearlocks(); + mswin_exit_nhwindows(0); + } +} + + +/* Ask the user for a player name. */ +void mswin_askname(void) +{ + logDebug("mswin_askname()\n"); + +#ifdef _DEBUG + strcpy(plname, "wizard"); +#else + if( mswin_getlin_window("who are you?", plname, PL_NSIZ)==IDCANCEL ) { + bail("bye-bye"); + /* not reached */ + } +#endif +} + + +/* Does window event processing (e.g. exposure events). + A noop for the tty and X window-ports. +*/ +void mswin_get_nh_event(void) +{ + logDebug("mswin_get_nh_event()\n"); + return; +} + +/* Exits the window system. This should dismiss all windows, + except the "window" used for raw_print(). str is printed if possible. +*/ +void mswin_exit_nhwindows(const char *str) +{ + logDebug("mswin_exit_nhwindows(%s)\n", str); + + terminate(EXIT_SUCCESS); +} + +/* Prepare the window to be suspended. */ +void mswin_suspend_nhwindows(const char *str) +{ + logDebug("mswin_suspend_nhwindows(%s)\n", str); + return; +} + + +/* Restore the windows after being suspended. */ +void mswin_resume_nhwindows() +{ + logDebug("mswin_resume_nhwindows()\n"); + return; +} + +/* Create a window of type "type" which can be + NHW_MESSAGE (top line) + NHW_STATUS (bottom lines) + NHW_MAP (main dungeon) + NHW_MENU (inventory or other "corner" windows) + NHW_TEXT (help/text, full screen paged window) +*/ +winid +mswin_create_nhwindow(int type) +{ + winid i = 0; + MSNHMsgAddWnd data; + + logDebug("mswin_create_nhwindow(%d)\n", type); + + /* Return the next available winid + */ + + for (i=1; iwindowlist[i].win == NULL && + !GetNHApp()->windowlist[i].dead) + break; + if (i == MAXWINDOWS) + panic ("ERROR: No windows available...\n"); + + switch (type) { + case NHW_MAP: + { + GetNHApp()->windowlist[i].win = mswin_init_map_window(); + GetNHApp()->windowlist[i].type = type; + GetNHApp()->windowlist[i].dead = 0; + break; + } + case NHW_MESSAGE: + { + GetNHApp()->windowlist[i].win = mswin_init_message_window(); + GetNHApp()->windowlist[i].type = type; + GetNHApp()->windowlist[i].dead = 0; + break; + } + case NHW_STATUS: + { + GetNHApp()->windowlist[i].win = mswin_init_status_window(); + GetNHApp()->windowlist[i].type = type; + GetNHApp()->windowlist[i].dead = 0; + break; + } + case NHW_MENU: + { + GetNHApp()->windowlist[i].win = NULL; //will create later + GetNHApp()->windowlist[i].type = type; + GetNHApp()->windowlist[i].dead = 1; + break; + } + case NHW_TEXT: + { + GetNHApp()->windowlist[i].win = mswin_init_text_window(); + GetNHApp()->windowlist[i].type = type; + GetNHApp()->windowlist[i].dead = 0; + break; + } + } + + ZeroMemory(&data, sizeof(data) ); + data.wid = i; + SendMessage( GetNHApp()->hMainWnd, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_ADDWND, (LPARAM)&data ); + return i; +} + +/* Clear the given window, when asked to. */ +void mswin_clear_nhwindow(winid wid) +{ + logDebug("mswin_clear_nhwindow(%d)\n", wid); + + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_CLEAR_WINDOW, (LPARAM)NULL ); + } +} + +/* -- Display the window on the screen. If there is data + pending for output in that window, it should be sent. + If blocking is TRUE, display_nhwindow() will not + return until the data has been displayed on the screen, + and acknowledged by the user where appropriate. + -- All calls are blocking in the tty window-port. + -- Calling display_nhwindow(WIN_MESSAGE,???) will do a + --more--, if necessary, in the tty window-port. +*/ +void mswin_display_nhwindow(winid wid, BOOLEAN_P block) +{ + logDebug("mswin_display_nhwindow(%d, %d)\n", wid, block); + if (GetNHApp()->windowlist[wid].win != NULL) + { + if (GetNHApp()->windowlist[wid].type == NHW_MENU) { + MENU_ITEM_P* p; + mswin_menu_window_select_menu(GetNHApp()->windowlist[wid].win, PICK_NONE, &p); + } if (GetNHApp()->windowlist[wid].type == NHW_TEXT) { + mswin_display_text_window(GetNHApp()->windowlist[wid].win); + } if (GetNHApp()->windowlist[wid].type == NHW_RIP) { + mswin_display_RIP_window(GetNHApp()->windowlist[wid].win); + } else { + if( !block ) { + UpdateWindow(GetNHApp()->windowlist[wid].win); + } else { + if ( GetNHApp()->windowlist[wid].type == NHW_MAP ) { + (void) mswin_nhgetch(); + } + } + } + SetFocus(GetNHApp()->hMainWnd); + } +} + + +HWND mswin_hwnd_from_winid(winid wid) +{ + if( wid>=0 && widwindowlist[wid].win; + } else { + return NULL; + } +} + +winid mswin_winid_from_handle(HWND hWnd) +{ + winid i = 0; + + for (i=1; iwindowlist[i].win == hWnd) + return i; + return -1; +} + +winid mswin_winid_from_type(int type) +{ + winid i = 0; + + for (i=1; iwindowlist[i].type == type) + return i; + return -1; +} + +void mswin_window_mark_dead(winid wid) +{ + if( wid>=0 && widwindowlist[wid].win = NULL; + GetNHApp()->windowlist[wid].dead = 1; + } +} + +/* Destroy will dismiss the window if the window has not + * already been dismissed. +*/ +void mswin_destroy_nhwindow(winid wid) +{ + logDebug("mswin_destroy_nhwindow(%d)\n", wid); + + if ((GetNHApp()->windowlist[wid].type == NHW_MAP) || + (GetNHApp()->windowlist[wid].type == NHW_MESSAGE) || + (GetNHApp()->windowlist[wid].type == NHW_STATUS)) { + /* main windows is going to take care of those */ + return; + } + + if (GetNHApp()->windowlist[wid].type == NHW_TEXT) { + /* this type takes care of themself */ + return; + } + + if (wid != -1) { + if( !GetNHApp()->windowlist[wid].dead && + GetNHApp()->windowlist[wid].win != NULL ) + DestroyWindow(GetNHApp()->windowlist[wid].win); + GetNHApp()->windowlist[wid].win = NULL; + GetNHApp()->windowlist[wid].type = 0; + GetNHApp()->windowlist[wid].dead = 0; + } +} + +/* Next output to window will start at (x,y), also moves + displayable cursor to (x,y). For backward compatibility, + 1 <= x < cols, 0 <= y < rows, where cols and rows are + the size of window. +*/ +void mswin_curs(winid wid, int x, int y) +{ + logDebug("mswin_curs(%d, %d, %d)\n", wid, x, y); + + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + MSNHMsgCursor data; + data.x = x; + data.y = y; + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_CURSOR, (LPARAM)&data ); + } +} + +/* +putstr(window, attr, str) + -- Print str on the window with the given attribute. Only + printable ASCII characters (040-0126) must be supported. + Multiple putstr()s are output on separate lines. +Attributes + can be one of + ATR_NONE (or 0) + ATR_ULINE + ATR_BOLD + ATR_BLINK + ATR_INVERSE + If a window-port does not support all of these, it may map + unsupported attributes to a supported one (e.g. map them + all to ATR_INVERSE). putstr() may compress spaces out of + str, break str, or truncate str, if necessary for the + display. Where putstr() breaks a line, it has to clear + to end-of-line. + -- putstr should be implemented such that if two putstr()s + are done consecutively the user will see the first and + then the second. In the tty port, pline() achieves this + by calling more() or displaying both on the same line. +*/ +void mswin_putstr(winid wid, int attr, const char *text) +{ + logDebug("mswin_putstr(%d, %d, %s)\n", wid, attr, text); + + if( (wid >= 0) && + (wid < MAXWINDOWS) ) + { + if( GetNHApp()->windowlist[wid].win==NULL && + GetNHApp()->windowlist[wid].type==NHW_MENU ) { + GetNHApp()->windowlist[wid].win = mswin_init_menu_window(MENU_TYPE_TEXT); + GetNHApp()->windowlist[wid].dead = 0; + } + + if (GetNHApp()->windowlist[wid].win != NULL) + { + MSNHMsgPutstr data; + data.attr = attr; + data.text = text; + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data ); + } + } +} + +/* Display the file named str. Complain about missing files + iff complain is TRUE. +*/ +void mswin_display_file(const char *filename,BOOLEAN_P must_exist) +{ + dlb *f; + TCHAR wbuf[BUFSZ]; + + logDebug("mswin_display_file(%s, %d)\n", filename, must_exist); + + f = dlb_fopen(filename, RDTMODE); + if (!f) { + if (must_exist) { + TCHAR message[90]; + _stprintf(message, TEXT("Warning! Could not find file: %s\n"), NH_A2W(filename, wbuf, sizeof(wbuf))); + MessageBox(GetNHApp()->hMainWnd, message, TEXT("ERROR"), MB_OK | MB_ICONERROR ); + } + } else { + HWND hwnd; + char line[LLEN]; + RECT rt; + + hwnd = mswin_init_text_window(); + + while (dlb_fgets(line, LLEN, f)) { + MSNHMsgPutstr data; + size_t len; + + len = strlen(line); + if( line[len-1]=='\n' ) line[len-1]='\x0'; + data.attr = 0; + data.text = line; + SendMessage( hwnd, WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data ); + } + (void) dlb_fclose(f); + + GetNHApp()->hMenuWnd = hwnd; + GetWindowRect(mswin_hwnd_from_winid(WIN_MAP), &rt); + MoveWindow(hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); + ShowWindow(hwnd, SW_SHOW); + } +} + +/* Start using window as a menu. You must call start_menu() + before add_menu(). After calling start_menu() you may not + putstr() to the window. Only windows of type NHW_MENU may + be used for menus. +*/ +void mswin_start_menu(winid wid) +{ + logDebug("mswin_start_menu(%d)\n", wid); + if( (wid >= 0) && + (wid < MAXWINDOWS) ) { + if( GetNHApp()->windowlist[wid].win==NULL && + GetNHApp()->windowlist[wid].type==NHW_MENU ) { + GetNHApp()->windowlist[wid].win = mswin_init_menu_window(MENU_TYPE_MENU); + GetNHApp()->windowlist[wid].dead = 0; + } + + if(GetNHApp()->windowlist[wid].win != NULL) { + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_STARTMENU, (LPARAM)NULL + ); + } + } +} + +/* +add_menu(windid window, int glyph, const anything identifier, + char accelerator, char groupacc, + int attr, char *str, boolean preselected) + -- Add a text line str to the given menu window. If identifier + is 0, then the line cannot be selected (e.g. a title). + Otherwise, identifier is the value returned if the line is + selected. Accelerator is a keyboard key that can be used + to select the line. If the accelerator of a selectable + item is 0, the window system is free to select its own + accelerator. It is up to the window-port to make the + accelerator visible to the user (e.g. put "a - " in front + of str). The value attr is the same as in putstr(). + Glyph is an optional glyph to accompany the line. If + window port cannot or does not want to display it, this + is OK. If there is no glyph applicable, then this + value will be NO_GLYPH. + -- All accelerators should be in the range [A-Za-z]. + -- It is expected that callers do not mix accelerator + choices. Either all selectable items have an accelerator + or let the window system pick them. Don't do both. + -- Groupacc is a group accelerator. It may be any character + outside of the standard accelerator (see above) or a + number. If 0, the item is unaffected by any group + accelerator. If this accelerator conflicts with + the menu command (or their user defined alises), it loses. + The menu commands and aliases take care not to interfere + with the default object class symbols. + -- If you want this choice to be preselected when the + menu is displayed, set preselected to TRUE. +*/ +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) +{ + logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", + wid, glyph, identifier, (char)accelerator, (char)group_accel, + attr, str, presel); + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + MSNHMsgAddMenu data; + ZeroMemory(&data, sizeof(data)); + data.glyph = glyph; + data.identifier = identifier; + data.accelerator = accelerator; + data.group_accel = group_accel; + data.attr = attr; + data.str = str; + data.presel = presel; + + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_ADDMENU, (LPARAM)&data + ); + } +} + +/* +end_menu(window, prompt) + -- Stop adding entries to the menu and flushes the window + to the screen (brings to front?). Prompt is a prompt + to give the user. If prompt is NULL, no prompt will + be printed. + ** This probably shouldn't flush the window any more (if + ** it ever did). That should be select_menu's job. -dean +*/ +void mswin_end_menu(winid wid, const char *prompt) +{ + logDebug("mswin_end_menu(%d, %s)\n", wid, prompt); +} + +/* +int select_menu(windid window, int how, menu_item **selected) + -- Return the number of items selected; 0 if none were chosen, + -1 when explicitly cancelled. If items were selected, then + selected is filled in with an allocated array of menu_item + structures, one for each selected line. The caller must + free this array when done with it. The "count" field + of selected is a user supplied count. If the user did + not supply a count, then the count field is filled with + -1 (meaning all). A count of zero is equivalent to not + being selected and should not be in the list. If no items + were selected, then selected is NULL'ed out. How is the + mode of the menu. Three valid values are PICK_NONE, + PICK_ONE, and PICK_N, meaning: nothing is selectable, + only one thing is selectable, and any number valid items + may selected. If how is PICK_NONE, this function should + never return anything but 0 or -1. + -- You may call select_menu() on a window multiple times -- + the menu is saved until start_menu() or destroy_nhwindow() + is called on the window. + -- Note that NHW_MENU windows need not have select_menu() + called for them. There is no way of knowing whether + select_menu() will be called for the window at + create_nhwindow() time. +*/ +int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected) +{ + int nReturned = -1; + + logDebug("mswin_select_menu(%d, %d)\n", wid, how); + + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + nReturned = mswin_menu_window_select_menu(GetNHApp()->windowlist[wid].win, how, selected); + } + return nReturned; +} + +/* + -- Indicate to the window port that the inventory has been changed. + -- Merely calls display_inventory() for window-ports that leave the + window up, otherwise empty. +*/ +void mswin_update_inventory() +{ + logDebug("mswin_update_inventory()\n"); +} + +/* +mark_synch() -- Don't go beyond this point in I/O on any channel until + all channels are caught up to here. Can be an empty call + for the moment +*/ +void mswin_mark_synch() +{ + logDebug("mswin_mark_synch()\n"); +} + +/* +wait_synch() -- Wait until all pending output is complete (*flush*() for + streams goes here). + -- May also deal with exposure events etc. so that the + display is OK when return from wait_synch(). +*/ +void mswin_wait_synch() +{ + logDebug("mswin_wait_synch()\n"); +} + +/* +cliparound(x, y)-- Make sure that the user is more-or-less centered on the + screen if the playing area is larger than the screen. + -- This function is only defined if CLIPPING is defined. +*/ +void mswin_cliparound(int x, int y) +{ + winid wid = WIN_MAP; + + logDebug("mswin_cliparound(%d, %d)\n", x, y); + + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + MSNHMsgClipAround data; + data.x = x; + data.y = y; + SendMessage( + GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_CLIPAROUND, (LPARAM)&data ); + } +} + +/* +print_glyph(window, x, y, glyph) + -- Print the glyph at (x,y) on the given window. Glyphs are + integers at the interface, mapped to whatever the window- + port wants (symbol, font, color, attributes, ...there's + a 1-1 map between glyphs and distinct things on the map). +*/ +void mswin_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph) +{ + logDebug("mswin_print_glyph(%d, %d, %d, %d)\n", wid, x, y, glyph); + + if ((wid >= 0) && + (wid < MAXWINDOWS) && + (GetNHApp()->windowlist[wid].win != NULL)) + { + MSNHMsgPrintGlyph data; + + ZeroMemory(&data, sizeof(data) ); + data.x = x; + data.y = y; + data.glyph = glyph; + SendMessage( GetNHApp()->windowlist[wid].win, + WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PRINT_GLYPH, (LPARAM)&data ); + } +} + +/* +raw_print(str) -- Print directly to a screen, or otherwise guarantee that + the user sees str. raw_print() appends a newline to str. + It need not recognize ASCII control characters. This is + used during startup (before windowing system initialization + -- maybe this means only error startup messages are raw), + for error messages, and maybe other "msg" uses. E.g. + updating status for micros (i.e, "saving"). +*/ +void mswin_raw_print(const char *str) +{ + TCHAR wbuf[255]; + logDebug("mswin_raw_print(%s)\n", str); + MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK ); +} + +/* +raw_print_bold(str) + -- Like raw_print(), but prints in bold/standout (if +possible). +*/ +void mswin_raw_print_bold(const char *str) +{ + TCHAR wbuf[255]; + logDebug("mswin_raw_print_bold(%s)\n", str); + MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK ); +} + +/* +int nhgetch() -- Returns a single character input from the user. + -- In the tty window-port, nhgetch() assumes that tgetch() + will be the routine the OS provides to read a character. + Returned character _must_ be non-zero. +*/ +int mswin_nhgetch() +{ + PMSNHEvent event; + int key = 0; + + logDebug("mswin_nhgetch()\n"); + + + while( (event = mswin_input_pop()) == NULL || + event->type != NHEVENT_CHAR ) + mswin_main_loop(); + + key = event->kbd.ch; + return (key); +} + +/* +int nh_poskey(int *x, int *y, int *mod) + -- Returns a single character input from the user or a + a positioning event (perhaps from a mouse). If the + return value is non-zero, a character was typed, else, + a position in the MAP window is returned in x, y and mod. + mod may be one of + + CLICK_1 -- mouse click type 1 + CLICK_2 -- mouse click type 2 + + The different click types can map to whatever the + hardware supports. If no mouse is supported, this + routine always returns a non-zero character. +*/ +int mswin_nh_poskey(int *x, int *y, int *mod) +{ + PMSNHEvent event; + int key; + + logDebug("mswin_nh_poskey()\n"); + + while( (event = mswin_input_pop())==NULL ) mswin_main_loop(); + + if( event->type==NHEVENT_MOUSE ) { + *mod = CLICK_1; + *x = event->ms.x; + *y = event->ms.y; + key = 0; + } else { + key = event->kbd.ch; + } + return (key); +} + +/* +nhbell() -- Beep at user. [This will exist at least until sounds are + redone, since sounds aren't attributable to windows anyway.] +*/ +void mswin_nhbell() +{ + logDebug("mswin_nhbell()\n"); +} + +/* +doprev_message() + -- Display previous messages. Used by the ^P command. + -- On the tty-port this scrolls WIN_MESSAGE back one line. +*/ +int mswin_doprev_message() +{ + logDebug("mswin_doprev_message()\n"); + return 0; +} + +/* +char yn_function(const char *ques, const char *choices, char default) + -- Print a prompt made up of ques, choices and default. + Read a single character response that is contained in + choices or default. If choices is NULL, all possible + inputs are accepted and returned. This overrides + everything else. The choices are expected to be in + lower case. Entering ESC always maps to 'q', or 'n', + in that order, if present in choices, otherwise it maps + to default. Entering any other quit character (SPACE, + RETURN, NEWLINE) maps to default. + -- If the choices string contains ESC, then anything after + it is an acceptable response, but the ESC and whatever + follows is not included in the prompt. + -- If the choices string contains a '#' then accept a count. + Place this value in the global "yn_number" and return '#'. + -- This uses the top line in the tty window-port, other + ports might use a popup. +*/ +char mswin_yn_function(const char *question, const char *choices, + CHAR_P def) +{ + int result=-1; + char ch; + char yn_esc_map='\033'; + char message[BUFSZ]; + + logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def); + + if (choices) { + char *cb, choicebuf[QBUFSZ]; + Strcpy(choicebuf, choices); + if ((cb = index(choicebuf, '\033')) != 0) { + /* anything beyond is hidden */ + *cb = '\0'; + } + sprintf(message, "%s [%s] ", question, choicebuf); + if (def) sprintf(eos(message), "(%c) ", def); + /* escape maps to 'q' or 'n' or default, in that order */ + yn_esc_map = (index(choices, 'q') ? 'q' : + (index(choices, 'n') ? 'n' : def)); + } else { + Strcpy(message, question); + } + + mswin_putstr(WIN_MESSAGE, ATR_BOLD, message); + + /* Only here if main window is not present */ + while (result<0) { + ch=mswin_nhgetch(); + if (ch=='\033') { + result=yn_esc_map; + } else if (choices && !index(choices,ch)) { + /* FYI: ch==-115 is for KP_ENTER */ + if (def && (ch==' ' || ch=='\r' || ch=='\n' || ch==-115)) { + result=def; + } else { + mswin_nhbell(); + /* and try again... */ + } + } else { + result=ch; + } + } + return result; +} + +/* +getlin(const char *ques, char *input) + -- Prints ques as a prompt and reads a single line of text, + up to a newline. The string entered is returned without the + newline. ESC is used to cancel, in which case the string + "\033\000" is returned. + -- getlin() must call flush_screen(1) before doing anything. + -- This uses the top line in the tty window-port, other + ports might use a popup. +*/ +void mswin_getlin(const char *question, char *input) +{ + logDebug("mswin_getlin(%s, %p)\n", question, input); + if( mswin_getlin_window(question, input, BUFSZ)==IDCANCEL ) { + strcpy(input, "\033"); + } +} + +/* +int get_ext_cmd(void) + -- Get an extended command in a window-port specific way. + An index into extcmdlist[] is returned on a successful + selection, -1 otherwise. +*/ +int mswin_get_ext_cmd() +{ + int ret; + logDebug("mswin_get_ext_cmd()\n"); + + if(mswin_ext_cmd_window (&ret) == IDCANCEL) + return -1; + else + return ret; +} + + +/* +number_pad(state) + -- Initialize the number pad to the given state. +*/ +void mswin_number_pad(int state) +{ + /* Do Nothing */ + logDebug("mswin_number_pad(%d)\n", state); +} + +/* +delay_output() -- Causes a visible delay of 50ms in the output. + Conceptually, this is similar to wait_synch() followed + by a nap(50ms), but allows asynchronous operation. +*/ +void mswin_delay_output() +{ + logDebug("mswin_delay_output()\n"); + Sleep(50); +} + +void mswin_change_color() +{ + logDebug("mswin_change_color()\n"); +} + +char *mswin_get_color_string() +{ + logDebug("mswin_get_color_string()\n"); + return( "" ); +} + +/* +start_screen() -- Only used on Unix tty ports, but must be declared for + completeness. Sets up the tty to work in full-screen + graphics mode. Look at win/tty/termcap.c for an + example. If your window-port does not need this function + just declare an empty function. +*/ +void mswin_start_screen() +{ + /* Do Nothing */ + logDebug("mswin_start_screen()\n"); +} + +/* +end_screen() -- Only used on Unix tty ports, but must be declared for + completeness. The complement of start_screen(). +*/ +void mswin_end_screen() +{ + /* Do Nothing */ + logDebug("mswin_end_screen()\n"); +} + +/* +outrip(winid, int) + -- The tombstone code. If you want the traditional code use + genl_outrip for the value and check the #if in rip.c. +*/ +void mswin_outrip(winid wid, int how) +{ + logDebug("mswin_outrip(%d)\n", wid, how); + if ((wid >= 0) && (wid < MAXWINDOWS) ) { + DestroyWindow(GetNHApp()->windowlist[wid].win); + GetNHApp()->windowlist[wid].win = mswin_init_RIP_window(); + GetNHApp()->windowlist[wid].type = NHW_RIP; + GetNHApp()->windowlist[wid].dead = 0; + } + + genl_outrip(wid, how); +} + + +void mswin_main_loop() +{ + MSG msg; + + while( !mswin_have_input() && + GetMessage(&msg, NULL, 0, 0)!=0 ) { + if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } +} + +/* clean up and quit */ +void bail(const char *mesg) +{ + clearlocks(); + mswin_exit_nhwindows(mesg); + terminate(EXIT_SUCCESS); + /*NOTREACHED*/ +} + +#ifdef _DEBUG +#include + +void +logDebug(const char *fmt, ...) +{ + FILE *dfp = fopen("nhtrace.log", "a"); + + if (dfp) { + va_list args; + + va_start(args, fmt); + vfprintf(dfp, fmt, args); + va_end(args); + fclose(dfp); + } +} + +#endif \ No newline at end of file diff --git a/win/win32/nethack.dsw b/win/win32/nethack.dsw new file mode 100644 index 000000000..19ee48962 --- /dev/null +++ b/win/win32/nethack.dsw @@ -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> +{{{ +}}} + +############################################################################### + diff --git a/win/win32/recover.dsp b/win/win32/recover.dsp new file mode 100644 index 000000000..48b1a0cbc --- /dev/null +++ b/win/win32/recover.dsp @@ -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 diff --git a/win/win32/resource.h b/win/win32/resource.h new file mode 100644 index 000000000..def1994e6 --- /dev/null +++ b/win/win32/resource.h @@ -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 diff --git a/win/win32/tile2bmp.dsp b/win/win32/tile2bmp.dsp new file mode 100644 index 000000000..3ae4fa663 --- /dev/null +++ b/win/win32/tile2bmp.dsp @@ -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 diff --git a/win/win32/tilemap.dsp b/win/win32/tilemap.dsp new file mode 100644 index 000000000..cc06cdf36 --- /dev/null +++ b/win/win32/tilemap.dsp @@ -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 diff --git a/win/win32/winMS.h b/win/win32/winMS.h new file mode 100644 index 000000000..ae88641f6 --- /dev/null +++ b/win/win32/winMS.h @@ -0,0 +1,131 @@ +/* Copyright (C) 2001 by Alex Kompel */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef WINMS_H +#define WINMS_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#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 */ diff --git a/win/win32/winhack.c b/win/win32/winhack.c new file mode 100644 index 000000000..372f159b6 --- /dev/null +++ b/win/win32/winhack.c @@ -0,0 +1,129 @@ +/* Copyright (C) 2001 by Alex Kompel */ +// winhack.cpp : Defines the entry point for the application. +// + +#include +#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 && argc0 ) { + 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; +} + diff --git a/win/win32/winhack.dsp b/win/win32/winhack.dsp new file mode 100644 index 000000000..886cab9d2 --- /dev/null +++ b/win/win32/winhack.dsp @@ -0,0 +1,1172 @@ +# Microsoft Developer Studio Project File - Name="winhack" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=winhack - Win32 Unicode 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 "winhack.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 "winhack.mak" CFG="winhack - Win32 Unicode Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "winhack - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "winhack - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "winhack - Win32 Unicode Release" (based on "Win32 (x86) Application") +!MESSAGE "winhack - Win32 Unicode Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "winhack - 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 "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /I "..\win\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# 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 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 +# Begin Special Build Tool +OutDir=.\Release +SOURCE="$(InputPath)" +PostBuild_Desc=Install exe +PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy $(NTSYS)\winnt.cnf ..\binary\defaults.nh +# End Special Build Tool + +!ELSEIF "$(CFG)" == "winhack - 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 "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /I "..\win\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# 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 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +OutDir=.\Debug +SOURCE="$(InputPath)" +PostBuild_Desc=Install exe +PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy ..\sys\winnt\winnt.cnf ..\binary\defaults.nh +# End Special Build Tool + +!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "winhack___Win32_Unicode_Release" +# PROP BASE Intermediate_Dir "winhack___Win32_Unicode_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Unicode_Release" +# PROP Intermediate_Dir "Unicode_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /FD /c +# SUBTRACT BASE CPP /YX /Yc /Yu +# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /I "..\win\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# 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 comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 +# Begin Special Build Tool +OutDir=.\Unicode_Release +SOURCE="$(InputPath)" +PostBuild_Desc=Install exe +PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy $(NTSYS)\winnt.cnf ..\binary\defaults.nh +# End Special Build Tool + +!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "winhack___Win32_Unicode_Debug" +# PROP BASE Intermediate_Dir "winhack___Win32_Unicode_Debug" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Unicode_Debug" +# PROP Intermediate_Dir "Unicode_Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /FD /GZ /c +# SUBTRACT BASE CPP /YX /Yc /Yu +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /I "..\win\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# 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 comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +OutDir=.\Unicode_Debug +SOURCE="$(InputPath)" +PostBuild_Desc=Install exe +PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy $(NTSYS)\winnt.cnf ..\binary\defaults.nh +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "winhack - Win32 Release" +# Name "winhack - Win32 Debug" +# Name "winhack - Win32 Unicode Release" +# Name "winhack - Win32 Unicode Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\src\allmain.c +# End Source File +# Begin Source File + +SOURCE=..\src\alloc.c +# End Source File +# Begin Source File + +SOURCE=..\src\apply.c +# End Source File +# Begin Source File + +SOURCE=..\src\artifact.c +# End Source File +# Begin Source File + +SOURCE=..\src\attrib.c +# End Source File +# Begin Source File + +SOURCE=..\src\ball.c +# End Source File +# Begin Source File + +SOURCE=..\src\bones.c +# End Source File +# Begin Source File + +SOURCE=..\src\botl.c +# End Source File +# Begin Source File + +SOURCE=..\src\cmd.c +# End Source File +# Begin Source File + +SOURCE=..\src\dbridge.c +# End Source File +# Begin Source File + +SOURCE=..\src\decl.c +# End Source File +# Begin Source File + +SOURCE=..\src\detect.c +# End Source File +# Begin Source File + +SOURCE=..\src\dig.c +# End Source File +# Begin Source File + +SOURCE=..\src\display.c +# End Source File +# Begin Source File + +SOURCE=..\src\dlb.c +# End Source File +# Begin Source File + +SOURCE=..\src\do.c +# End Source File +# Begin Source File + +SOURCE=..\src\do_name.c +# End Source File +# Begin Source File + +SOURCE=..\src\do_wear.c +# End Source File +# Begin Source File + +SOURCE=..\src\dog.c +# End Source File +# Begin Source File + +SOURCE=..\src\dogmove.c +# End Source File +# Begin Source File + +SOURCE=..\src\dokick.c +# End Source File +# Begin Source File + +SOURCE=..\src\dothrow.c +# End Source File +# Begin Source File + +SOURCE=..\src\drawing.c +# End Source File +# Begin Source File + +SOURCE=..\src\dungeon.c +# End Source File +# Begin Source File + +SOURCE=..\src\eat.c +# End Source File +# Begin Source File + +SOURCE=..\src\end.c +# End Source File +# Begin Source File + +SOURCE=..\src\engrave.c +# End Source File +# Begin Source File + +SOURCE=..\src\exper.c +# End Source File +# Begin Source File + +SOURCE=..\src\explode.c +# End Source File +# Begin Source File + +SOURCE=..\src\extralev.c +# End Source File +# Begin Source File + +SOURCE=..\src\files.c +# End Source File +# Begin Source File + +SOURCE=..\src\fountain.c +# End Source File +# Begin Source File + +SOURCE=..\win\tty\getline.c +# End Source File +# Begin Source File + +SOURCE=..\src\hack.c +# End Source File +# Begin Source File + +SOURCE=..\src\hacklib.c +# End Source File +# Begin Source File + +SOURCE=..\src\invent.c +# End Source File +# Begin Source File + +SOURCE=..\src\light.c +# End Source File +# Begin Source File + +SOURCE=..\src\lock.c +# End Source File +# Begin Source File + +SOURCE=..\src\mail.c +# End Source File +# Begin Source File + +SOURCE=..\src\makemon.c +# End Source File +# Begin Source File + +SOURCE=..\src\mcastu.c +# End Source File +# Begin Source File + +SOURCE=..\src\mhitm.c +# End Source File +# Begin Source File + +SOURCE=..\src\mhitu.c +# End Source File +# Begin Source File + +SOURCE=..\src\minion.c +# End Source File +# Begin Source File + +SOURCE=..\src\mklev.c +# End Source File +# Begin Source File + +SOURCE=..\src\mkmap.c +# End Source File +# Begin Source File + +SOURCE=..\src\mkmaze.c +# End Source File +# Begin Source File + +SOURCE=..\src\mkobj.c +# End Source File +# Begin Source File + +SOURCE=..\src\mkroom.c +# End Source File +# Begin Source File + +SOURCE=..\src\mon.c +# End Source File +# Begin Source File + +SOURCE=..\src\mondata.c +# End Source File +# Begin Source File + +SOURCE=..\src\monmove.c +# End Source File +# Begin Source File + +SOURCE=..\src\monst.c +# End Source File +# Begin Source File + +SOURCE=..\src\monstr.c +# End Source File +# Begin Source File + +SOURCE=..\src\mplayer.c +# End Source File +# Begin Source File + +SOURCE=..\src\mthrowu.c +# End Source File +# Begin Source File + +SOURCE=..\src\muse.c +# End Source File +# Begin Source File + +SOURCE=..\src\music.c +# End Source File +# Begin Source File + +SOURCE=..\src\o_init.c +# End Source File +# Begin Source File + +SOURCE=..\src\objects.c +# End Source File +# Begin Source File + +SOURCE=..\src\objnam.c +# End Source File +# Begin Source File + +SOURCE=..\src\options.c +# End Source File +# Begin Source File + +SOURCE=..\src\pager.c +# End Source File +# Begin Source File + +SOURCE=..\sys\share\pcmain.c +# End Source File +# Begin Source File + +SOURCE=..\sys\share\pcsys.c +# End Source File +# Begin Source File + +SOURCE=..\sys\share\pcunix.c +# End Source File +# Begin Source File + +SOURCE=..\src\pickup.c +# End Source File +# Begin Source File + +SOURCE=..\src\pline.c +# End Source File +# Begin Source File + +SOURCE=..\src\polyself.c +# End Source File +# Begin Source File + +SOURCE=..\src\potion.c +# End Source File +# Begin Source File + +SOURCE=..\src\pray.c +# End Source File +# Begin Source File + +SOURCE=..\src\priest.c +# End Source File +# Begin Source File + +SOURCE=..\src\quest.c +# End Source File +# Begin Source File + +SOURCE=..\src\questpgr.c +# End Source File +# Begin Source File + +SOURCE=..\sys\share\random.c +# End Source File +# Begin Source File + +SOURCE=..\src\read.c +# End Source File +# Begin Source File + +SOURCE=..\src\rect.c +# End Source File +# Begin Source File + +SOURCE=..\src\region.c +# End Source File +# Begin Source File + +SOURCE=..\src\restore.c +# End Source File +# Begin Source File + +SOURCE=..\src\rip.c +# End Source File +# Begin Source File + +SOURCE=..\src\rnd.c +# End Source File +# Begin Source File + +SOURCE=..\src\role.c +# End Source File +# Begin Source File + +SOURCE=..\src\rumors.c +# End Source File +# Begin Source File + +SOURCE=..\src\save.c +# End Source File +# Begin Source File + +SOURCE=..\src\shk.c +# End Source File +# Begin Source File + +SOURCE=..\src\shknam.c +# End Source File +# Begin Source File + +SOURCE=..\src\sit.c +# End Source File +# Begin Source File + +SOURCE=..\src\sounds.c +# End Source File +# Begin Source File + +SOURCE=..\src\sp_lev.c +# End Source File +# Begin Source File + +SOURCE=..\src\spell.c +# End Source File +# Begin Source File + +SOURCE=..\src\steal.c +# End Source File +# Begin Source File + +SOURCE=..\src\steed.c +# End Source File +# Begin Source File + +SOURCE=..\src\teleport.c +# End Source File +# Begin Source File + +SOURCE=..\src\tile.c +# End Source File +# Begin Source File + +SOURCE=..\src\timeout.c +# End Source File +# Begin Source File + +SOURCE=..\src\topten.c +# End Source File +# Begin Source File + +SOURCE=..\src\track.c +# End Source File +# Begin Source File + +SOURCE=..\src\trap.c +# End Source File +# Begin Source File + +SOURCE=..\src\u_init.c +# End Source File +# Begin Source File + +SOURCE=..\src\uhitm.c +# End Source File +# Begin Source File + +SOURCE=..\src\vault.c +# End Source File +# Begin Source File + +SOURCE=..\src\version.c +# End Source File +# Begin Source File + +SOURCE=..\src\vision.c +# End Source File +# Begin Source File + +SOURCE=..\src\weapon.c +# End Source File +# Begin Source File + +SOURCE=..\src\were.c +# End Source File +# Begin Source File + +SOURCE=..\src\wield.c +# End Source File +# Begin Source File + +SOURCE=..\src\windows.c +# End Source File +# Begin Source File + +SOURCE=..\sys\winnt\winnt.c + +!IF "$(CFG)" == "winhack - Win32 Release" + +!ELSEIF "$(CFG)" == "winhack - Win32 Debug" + +!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Release" + +# ADD CPP /D "_MBCS" +# SUBTRACT CPP /D "_UNICODE" /D "UNICODE" + +!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Debug" + +# ADD CPP /D "_MBCS" +# SUBTRACT CPP /D "_UNICODE" /D "UNICODE" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\win\tty\wintty.c +# End Source File +# Begin Source File + +SOURCE=..\src\wizard.c +# End Source File +# Begin Source File + +SOURCE=..\src\worm.c +# End Source File +# Begin Source File + +SOURCE=..\src\worn.c +# End Source File +# Begin Source File + +SOURCE=..\src\write.c +# End Source File +# Begin Source File + +SOURCE=..\src\zap.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\amiconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\artifact.h +# End Source File +# Begin Source File + +SOURCE=..\include\artilist.h +# End Source File +# Begin Source File + +SOURCE=..\include\attrib.h +# End Source File +# Begin Source File + +SOURCE=..\include\beconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\bitmfile.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\def_os2.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\dlb.h +# End Source File +# Begin Source File + +SOURCE=..\include\dungeon.h +# End Source File +# Begin Source File + +SOURCE=..\include\edog.h +# End Source File +# Begin Source File + +SOURCE=..\include\emin.h +# End Source File +# Begin Source File + +SOURCE=..\include\engrave.h +# End Source File +# Begin Source File + +SOURCE=..\include\epri.h +# End Source File +# Begin Source File + +SOURCE=..\include\eshk.h +# End Source File +# Begin Source File + +SOURCE=..\include\extern.h +# End Source File +# Begin Source File + +SOURCE=..\include\flag.h +# End Source File +# Begin Source File + +SOURCE=..\include\func_tab.h +# End Source File +# Begin Source File + +SOURCE=..\include\gem_rsc.h +# End Source File +# Begin Source File + +SOURCE=..\include\global.h +# End Source File +# Begin Source File + +SOURCE=..\include\hack.h +# End Source File +# Begin Source File + +SOURCE=..\include\lev.h +# End Source File +# Begin Source File + +SOURCE=..\include\load_img.h +# End Source File +# Begin Source File + +SOURCE=..\include\macconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\macpopup.h +# End Source File +# Begin Source File + +SOURCE=..\include\mactty.h +# End Source File +# Begin Source File + +SOURCE=..\include\macwin.h +# End Source File +# Begin Source File + +SOURCE=..\include\mail.h +# End Source File +# Begin Source File + +SOURCE=..\include\mfndpos.h +# End Source File +# Begin Source File + +SOURCE=..\include\micro.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\mondata.h +# End Source File +# Begin Source File + +SOURCE=..\include\monflag.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\mttypriv.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\os2conf.h +# End Source File +# Begin Source File + +SOURCE=..\include\patchlevel.h +# End Source File +# Begin Source File + +SOURCE=..\include\pcconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\permonst.h +# End Source File +# Begin Source File + +SOURCE=..\include\prop.h +# End Source File +# Begin Source File + +SOURCE=..\include\qt_clust.h +# End Source File +# Begin Source File + +SOURCE=..\include\qt_kde0.h +# End Source File +# Begin Source File + +SOURCE=..\include\qt_win.h +# End Source File +# Begin Source File + +SOURCE=..\include\qt_xpms.h +# End Source File +# Begin Source File + +SOURCE=..\include\qtext.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\sp_lev.h +# End Source File +# Begin Source File + +SOURCE=..\include\spell.h +# End Source File +# Begin Source File + +SOURCE=..\include\system.h +# End Source File +# Begin Source File + +SOURCE=..\include\tcap.h +# End Source File +# Begin Source File + +SOURCE=..\include\tile2x11.h +# End Source File +# Begin Source File + +SOURCE=..\include\timeout.h +# End Source File +# Begin Source File + +SOURCE=..\include\tosconf.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\unixconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\vault.h +# End Source File +# Begin Source File + +SOURCE=..\include\vision.h +# End Source File +# Begin Source File + +SOURCE=..\include\vmsconf.h +# End Source File +# Begin Source File + +SOURCE=..\include\winami.h +# End Source File +# Begin Source File + +SOURCE=..\include\wingem.h +# End Source File +# Begin Source File + +SOURCE=..\include\winGnome.h +# End Source File +# Begin Source File + +SOURCE=.\winhack.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\winX.h +# End Source File +# Begin Source File + +SOURCE=..\include\xwindow.h +# End Source File +# Begin Source File + +SOURCE=..\include\xwindowp.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" +# Begin Source File + +SOURCE=.\bitmap1.bmp +# End Source File +# Begin Source File + +SOURCE=.\bitmap2.bmp +# End Source File +# Begin Source File + +SOURCE=.\mnsel.bmp +# End Source File +# Begin Source File + +SOURCE=.\mnunsel.bmp +# End Source File +# Begin Source File + +SOURCE=.\NETHACK.ICO +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# Begin Source File + +SOURCE=.\tiles.bmp +# End Source File +# Begin Source File + +SOURCE=.\winhack.ico +# End Source File +# End Group +# Begin Group "wnd" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\mhaskyn.c +# End Source File +# Begin Source File + +SOURCE=.\mhaskyn.h +# End Source File +# Begin Source File + +SOURCE=.\mhdlg.c +# End Source File +# Begin Source File + +SOURCE=.\mhdlg.h +# End Source File +# Begin Source File + +SOURCE=.\mhfont.c +# End Source File +# Begin Source File + +SOURCE=.\mhfont.h +# End Source File +# Begin Source File + +SOURCE=.\mhinput.c +# End Source File +# Begin Source File + +SOURCE=.\mhinput.h +# End Source File +# Begin Source File + +SOURCE=.\mhmain.c +# End Source File +# Begin Source File + +SOURCE=.\mhmain.h +# End Source File +# Begin Source File + +SOURCE=.\mhmap.c +# End Source File +# Begin Source File + +SOURCE=.\mhmap.h +# End Source File +# Begin Source File + +SOURCE=.\mhmenu.c +# End Source File +# Begin Source File + +SOURCE=.\mhmenu.h +# End Source File +# Begin Source File + +SOURCE=.\mhmsg.h +# End Source File +# Begin Source File + +SOURCE=.\mhmsgwnd.c +# End Source File +# Begin Source File + +SOURCE=.\mhmsgwnd.h +# End Source File +# Begin Source File + +SOURCE=.\mhrip.c +# End Source File +# Begin Source File + +SOURCE=.\mhrip.h +# End Source File +# Begin Source File + +SOURCE=.\mhstatus.c +# End Source File +# Begin Source File + +SOURCE=.\mhstatus.h +# End Source File +# Begin Source File + +SOURCE=.\mhtext.c +# End Source File +# Begin Source File + +SOURCE=.\mhtext.h +# End Source File +# Begin Source File + +SOURCE=.\mswproc.c +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\winhack.c +# End Source File +# Begin Source File + +SOURCE=.\winhack.rc +# End Source File +# Begin Source File + +SOURCE=.\winMS.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/win/win32/winhack.h b/win/win32/winhack.h new file mode 100644 index 000000000..814e2f37d --- /dev/null +++ b/win/win32/winhack.h @@ -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 +#include "resource.h" + + +#endif // !defined(AFX_WINHACK_H__6397C328_BAF8_460C_9465_F12C596C5732__INCLUDED_) diff --git a/win/win32/winhack.rc b/win/win32/winhack.rc new file mode 100644 index 000000000..50638d155 --- /dev/null +++ b/win/win32/winhack.rc @@ -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 + diff --git a/win/win32/winnt.dsw b/win/win32/winnt.dsw new file mode 100644 index 000000000..7e737c178 --- /dev/null +++ b/win/win32/winnt.dsw @@ -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> +{{{ +}}} + +############################################################################### +