]> granicus.if.org Git - nethack/commitdiff
Changes to existing files by the win32 port additions.
authornethack.allison <nethack.allison>
Sun, 13 Jan 2002 05:53:39 +0000 (05:53 +0000)
committernethack.allison <nethack.allison>
Sun, 13 Jan 2002 05:53:39 +0000 (05:53 +0000)
13 files changed:
include/config.h
include/config1.h
include/global.h
src/files.c
src/mklev.c
src/rip.c
src/windows.c
sys/share/pcmain.c
sys/share/pcsys.c
sys/winnt/Install.nt
sys/winnt/nhsetup.bat
util/lev_main.c
util/recover.c

index e449c214f03e54f2f5a118ffcba0f13444812d0f..b12ac77cb94aeb19a2e76e7d9345cc4090e5a1c7 100644 (file)
@@ -46,6 +46,7 @@
 /* #define X11_GRAPHICS */     /* X11 interface */
 /* #define QT_GRAPHICS */      /* Qt interface */
 /* #define GNOME_GRAPHICS */   /* Gnome interface */
+/* #define MSWIN_GRAPHICS */   /* Windows NT, CE, Graphics */
 
 /*
  * Define the default window system.  This should be one that is compiled
 # endif
 #endif
 
+#ifdef MSWIN_GRAPHICS
+# ifdef TTY_GRAPHICS
+# undef TTY_GRAPHICS
+# endif
+# ifndef DEFAULT_WINDOW_SYS
+#  define DEFAULT_WINDOW_SYS "mswin"
+# endif
+# define HACKDIR "\\nethack"
+#endif
+
 #ifndef DEFAULT_WINDOW_SYS
 # define DEFAULT_WINDOW_SYS "tty"
 #endif
index 4f003680a1de8eee59464bf403fb9544b1d691b9..0f34f169297ae2c4210529640b67b9f094bb5679 100644 (file)
 /*
  * Windows NT Autodetection
  */
+#ifdef _WIN32_WCE
+# ifndef WIN32
+# define WIN32
+# endif
+#endif
 
 #ifdef WIN32
 # undef UNIX
 # define STRNCMPI
 # define USE_STDARG
 # define NEED_VARARGS
+
+# ifdef UNDER_CE
+# define WIN_CE
+# define STRCMPI
+# endif 
+
+/* ARM - the processor; avoids conflict with ARM in hack.h */
+# ifdef ARM
+# undef ARM
+# endif
 #endif
 
 
index d8ad8dc9e6e2c773e9471050cd80e89d53efb782..0bcb4d3b9fa5025d4a1266625af1d4e49188bb34 100644 (file)
@@ -175,8 +175,12 @@ typedef xchar      boolean;                /* 0 or 1 */
 #endif
 
 #ifdef WIN32
+#ifdef WIN_CE
+#include "wceconf.h"
+#else
 #include "ntconf.h"
 #endif
+#endif
 
 /* Displayable name of this port; don't redefine if defined in *conf.h */
 #ifndef PORT_ID
index 3d343a948ab3a71ae1c539b6f70935abfbf62c2b..80dd8f03ccbb991f0b7da81764a68cbd8defef25 100644 (file)
@@ -99,8 +99,10 @@ static int lockptr;
 #define Delay(a) msleep(a)
 # endif
 #define Close close
+#ifndef WIN_CE
 #define DeleteFile unlink
 #endif
+#endif
 
 #ifdef USER_SOUNDS
 extern int FDECL(add_sound_mapping, (const char* mapping));
index 3f2b3105f11b20294e9072e5a53316fed9e33ba9..6275821a4d0b4fc387de609c7b1288ebd76407fc 100644 (file)
@@ -34,7 +34,13 @@ STATIC_DCL struct mkroom *FDECL(pos_to_room, (XCHAR_P, XCHAR_P));
 STATIC_DCL boolean FDECL(place_niche,(struct mkroom *,int*,int*,int*));
 STATIC_DCL void FDECL(makeniche,(int));
 STATIC_DCL void NDECL(make_niches);
+
+#ifdef WIN_CE
+static int __cdecl do_comp(const void *vx, const void *vy);
+#else
 STATIC_PTR int FDECL(do_comp,(const genericptr,const genericptr));
+#endif
+
 STATIC_DCL void FDECL(dosdoor,(XCHAR_P,XCHAR_P,struct mkroom *,int));
 STATIC_DCL void FDECL(join,(int,int,BOOLEAN_P));
 STATIC_DCL void FDECL(do_room_or_subroom, (struct mkroom *,int,int,int,int,
@@ -53,10 +59,14 @@ static boolean made_branch; /* used only during level creation */
 
 /* Args must be (const genericptr) so that qsort will always be happy. */
 
+#ifdef WIN_CE
+static int __cdecl do_comp(const void *vx, const void *vy)
+#else
 STATIC_PTR int
 do_comp(vx,vy)
 const genericptr vx;
 const genericptr vy;
+#endif
 {
 #ifdef LINT
 /* lint complains about possible pointer alignment problems, but we know
@@ -108,7 +118,11 @@ sort_rooms()
 #if defined(SYSV) || defined(DGUX)
        qsort((genericptr_t) rooms, (unsigned)nroom, sizeof(struct mkroom), do_comp);
 #else
+# if defined(WIN_CE)
+       qsort((genericptr_t) rooms, (unsigned)nroom, sizeof(struct mkroom), (int (__cdecl*)(const void *, const void *))do_comp);
+# else
        qsort((genericptr_t) rooms, nroom, sizeof(struct mkroom), do_comp);
+# endif
 #endif
 }
 
index bb65e097e3e4f67af63f803c0141ee83075a3d10..247b0127c6d9dce24fda8cf5fbb1076514cb6cae 100644 (file)
--- a/src/rip.c
+++ b/src/rip.c
@@ -8,7 +8,7 @@ STATIC_DCL void FDECL(center, (int, char *));
 
 extern const char *killed_by_prefix[];
 
-#if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS)
+#if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS)
 # define TEXT_TOMBSTONE
 #endif
 #if defined(mac) || defined(__BEOS__) || defined(WIN32_GRAPHICS)
index a18fba2e3819e504d2bb8706dd26e854ed3e14bb..dacde257d76d6777ec43ab266c7cf5f0ab25d03c 100644 (file)
@@ -37,6 +37,10 @@ extern struct window_procs win32_procs;
 #include "winGnome.h"
 extern struct window_procs Gnome_procs;
 #endif
+#ifdef MSWIN_GRAPHICS
+#include "winMS.h"
+extern struct window_procs mswin_procs;
+#endif
 
 STATIC_DCL void FDECL(def_raw_print, (const char *s));
 
@@ -74,6 +78,9 @@ struct win_choices {
 #endif
 #ifdef GNOME_GRAPHICS
     { &Gnome_procs, 0 },
+#endif
+#ifdef MSWIN_GRAPHICS
+    { &mswin_procs, 0 },
 #endif
     { 0, 0 }           /* must be last */
 };
index 0996d2be8ac70a7dd0ae92b30652f9f1d3e705d1..c09645ad2edbfb741a6db756c1c8bd25d3610904 100644 (file)
@@ -638,7 +638,15 @@ char *str;
 # ifndef WIN32
        Strcpy (tmp, str);
 # else
-       *(tmp + GetModuleFileName((HANDLE)0, tmp, bsize)) = '\0';
+       #ifdef UNICODE
+       {
+               TCHAR wbuf[BUFSZ];
+               GetModuleFileName((HANDLE)0, wbuf, BUFSZ);
+               WideCharToMultiByte(CP_ACP, 0, wbuf, -1, tmp, bsize, NULL, NULL);
+       }
+       #else
+               *(tmp + GetModuleFileName((HANDLE)0, tmp, bsize)) = '\0';
+       #endif
 # endif
        tmp2 = strrchr(tmp, PATH_SEPARATOR);
        if (tmp2) *tmp2 = '\0';
index dee9486bf837f5238d9505c432a2e74005b42ea3..b2c9cee3ab79e13000913ef2416ef120352ddc92 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <ctype.h>
 #include <fcntl.h>
-#ifndef MSDOS                  /* already done */
+#if !defined(MSDOS) && !defined(WIN_CE)        /* already done */
 #include <process.h>
 #endif
 #ifdef __GO32__
index b85e7ab35467aaaba3d70e7f920561b96e2ad079..7d9dabbebcb0fc7515093e246b02783a37920a33 100644 (file)
@@ -1,28 +1,59 @@
-         Copyright (c) NetHack Development Team 1990-2000
+         Copyright (c) NetHack Development Team 1990-2002
          NetHack may be freely redistributed.  See license for details.
          ==============================================================
                     Instructions for compiling and installing
-             NetHack 3.3 on a Windows NT, 2000, or Windows 9x system
+                 NetHack 3.3 on a Windows NT, 2000, or XP system
          ==============================================================
-         (or, How to make NetHack 3.3.1 for the WIN32 Console subsystem)
-                     Last revision: August 2, 2000
-
-Credit for the PC versions of NetHack goes to the PC Development team
-of Paul Winner, Kevin Smolkowski, Michael Allison, Yitzhak Sapir, Bill
-Dyer, Timo Hakulinen, Yamamoto Keizo, Mike Threepoint, Mike Stephenson,
-Stephen White, Ken Washikita and Janet Walz.
+                     Last revision: January 12, 2002
 
 Credit for the porting of NetHack to the Win32 Console Subsystem goes to 
 the NT Porting Team started by Michael Allison.
 
+Credit for the Win32 Graphical version of NetHack (aka Winhack) goes to
+Alex Kompel.
+
+You can build either the TTY version of NetHack or the Windows Graphical 
+version.  In either case you will need:
+  o A copy of Microsoft Visual C V6.0 or later.  Things may work with 
+    earlier version of the compiler, but the current code has not been
+    tested with an earlier compiler.
+
+  o A version of a UUDECODE utility in your path.  The Makefiles and
+    the VC Project files assume that a utility called uudecode.exe is
+    in your path.
+
+FIRST STEP:
+
+The first step in building either version of NetHack is to execute
+sys/winnt/Install.nt.  Specify either TTY, or GUI.  (You can 
+substitute WINHACK for GUI if you wish).
+
+For the tty version using the NT Console I/O subsystem:
+       cd sys\winnt
+       nhsetup TTY
+
+For the graphical version (WinHack)
+       cd sys\winnt
+       nhsetup WINHACK
+
+Files appropriate for the selected build will be moved to the
+appropriate place.
+
+If you wish to build the TTY version, proceed now to "BUILDING TTY VERSION."
+If you wish to build the graphical version, proceed now to "BUILDING GRAPHICAL VERSION."
+
+------------------------
+| BUILDING TTY VERSION |
+------------------------
+
 This version of NetHack for Win32 is a tty port utilizing the WIN32 
 Console I/O subsystem.
 
 I.  Dispelling the Myths:
 
-    Compiling NetHack is not as easy as it sounds, nor as hard as it looks,
-    however it will behoove you to read this entire file through before
-    beginning the task.
+    Compiling NetHack for WIN32 TTY is not as easy as it sounds, nor as hard 
+    as it looks, however it will behoove you to read this entire section 
+    through before beginning the task.
 
     We have provided a Makefile for building NetHack using the
     following compiler:
@@ -191,7 +222,151 @@ Notes:
 2)  The executable produced by this port is a 32-bit, flat-address space, 
     non-overlayed .exe file, which should run on any true Win32 environment. 
 
-3)  If you encounter a bug and wish to report it, please send e-mail to:
+
+------------------------------
+| BUILDING GRAPHICAL VERSION |
+------------------------------
+
+
+This version of NetHack is a Win32 native port built on the Windows API.
+
+I.  Dispelling the Myths:
+
+    Compiling WIN32 is straightforward, as long as you have Visual C
+    correctly installed.  It is also assumed that you changed your 
+    directory to sys\winnt and executed:
+       nhsetup winhack
+    as described at the top of this document.
+
+II. To compile your copy of NetHack on a Windows NT/2000/XP machine:
+
+Setting Up
+
+1.  A version of uudecode.exe is required to be in
+    your path when you attempt the build.  If you don't have a version
+    of uudecode on your system, then you must find a way to uudecode
+    the following files elsewhere and move the decoded version to its
+    target directory:
+
+        win\win32\mnsel.uu    ---> winhacknt\mnsel.bmp
+        win\win32\mnunsel.uu  ---> winhacknt\mnunsel.bmp
+        sys\winnt\nhico.uu    ---> winhacknt\nethack.ico
+
+    (The winhacknt directory should have been created when you
+     issued the "nhsetup winhack" command earlier.)
+
+2.  Make sure all the NetHack files are in the appropriate directory
+    structure.  You should have a main directory with subdirectories
+    dat, doc, include, src, sys\share, sys\winnt, util, win\win32, 
+    and at this point, you should also have winhacknt (created by
+    nhsetup.bat in sys\winnt.)
+
+    Other subdirectories may also be included in your distribution, but
+    they are not necessary for building the graphical version of NetHack
+    (you can delete them to save space if you wish.)
+
+    Required Directories for a Win32 Console NetHack:
+
+                            top
+                             |
+        -----------------------------------------/ /--------------- 
+        |     |    |      |     |   |      |           |       |
+       util  dat  doc  include src sys    win      winhacknt binary
+                                    |      |
+                                  ------   -----
+                                  |    |       |    
+                               share  winnt  win32
+    Those last two (winhacknt and binary) are created during the
+    build.  They are not disributed as part of the source distribution.
+    nhsetup.bat moves many files into the "winhacknt" directory.
+
+    Check the file "Files" in your top level directory for an exact
+    listing of what file is in which directory.  In order for the
+    build process to work, all the source files must be in the proper
+    locations.  Remember that nhsetup.bat moves many files around to
+    their intended locations.
+
+3.  Start the Visual C IDE. In the Visual C IDE Menus, choose:
+        File | Open Workspace
+
+4.  In the Visual C "Open Workspace" dialog box, navigate to your nethack
+    source directory, specifically the winhacknt subdirectory. 
+    In there, highlight "nethack.dsw" and click on Open.
+
+5.  Once the workspace has been opened, you should see the following list
+    in the Visual C selection window:
+       + dgncomp files
+       + dgnstuff files
+       + dlb_main files
+       + levcomp files
+       + levstuff files
+       + makedefs files
+       + recover files
+       + tile2bmp files
+       + tilemap files
+       + winhack files
+
+6.  On the Visual C menus, choose:
+      Project | Set Active Project | winhack
+
+7.  On the Visual C menus once again, choose:
+      Build | Build winhack.exe
+
+    This starts the build.  If all goes well, you will have a playable
+    game of netack in the "binary" directory.
+    In any case, it is likely that the command prompt window where you are
+    doing the compiling will be occupied for a quite a while.  If all 
+    goes well, you will get an NetHack executable.
+
+Running NetHack
+
+7.  Make sure all of the support files -- Guidebook.txt, license,
+    Defaults.nh, winhack.exe, nhdat, tiles.bmp, and recover.exe 
+    -- were copied to the binary directory.  
+    (If not, find them in the tree and move them there yourself if they
+     exist.  If they don't exist, something has gone wrong)
+
+    Defaults.nh is actually distributed in the sources as sys/winnt/winnt.cnf, 
+    but the build process should take care of moving it and renaming it 
+    correctly.
+
+    Edit Defaults.nh to reflect your particular setup and personal 
+    preferences, by following the comments.  As with all releases since
+    3.2.1, HACKDIR defaults to the same directory as that where the winhack.exe 
+    executable resides.  You only need to set HACKDIR in Defaults.nh if, 
+    for some reason, you wish to override that.
+  
+8a. Running from the command prompt:
+
+    If you add the directory containing the NetHack executable
+    to your PATH, 
+    You can just type "winhack" to start it up.  Alternatively, you 
+    can explicitly invoke it with a command such as 
+    "c:\games\nethack\winhack" (specifying whatever drive and directory 
+    your NetHack executable resides in) each time.
+
+
+8b. Running from a Windows shortcut (win95 or NT4.x)
+
+    If you will be running it by launching it from program manager
+    or from a shortcut, just use the following information when 
+    setting up the icon or shortcut.
+
+         Description      :  NetHack 3.3.2 
+         Command Line     :  C:\GAMES\NETHACK\WINHACK.EXE
+
+   (changing the directory to the appropriate one of course)
+
+9. Play NetHack.  If it works, you're done!
+
+
+PROBLEMS
+
+    If you encounter a bug and wish to report it, please send e-mail to:
         nethack-bugs@nethack.org
 
     If you have any comments or suggestions, feel free to drop us a line c/o:
index 8e2f0e8d196c1ee98e79798c1349c867592edc6f..19508831642b1e6a2a28bcf3588a1249ee74c0be 100755 (executable)
@@ -1,9 +1,14 @@
-@REM  SCCS Id: @(#)nhsetup.bat      96/10/30                
-@REM  Copyright (c) NetHack PC Development Team 1993, 1996
+@REM  SCCS Id: @(#)nhsetup.bat      2002/01/12
+@REM  Copyright (c) NetHack PC Development Team 1993, 1996, 2002
 @REM  NetHack may be freely redistributed.  See license for details. 
 @REM  Win32 setup batch file, see Install.nt for details
 @REM
 @echo off
+
+set err_nouu=
+set err_copy=
+set opt=
+
 echo Checking to see if directories are set up properly
 if not exist ..\..\include\hack.h goto err_dir
 if not exist ..\..\src\hack.c goto err_dir
@@ -12,53 +17,170 @@ if not exist ..\..\util\makedefs.c goto err_dir
 if not exist ..\..\sys\winnt\winnt.c goto err_dir
 echo Directories look ok.
 
-:do_rest
-echo "Copying Makefile.NT to ..\..\src\Makefile"
-copy makefile.NT ..\..\src\Makefile >nul
-echo Makefile copied ok.
-if not exist ..\..\win\win32\NetHack.dsp goto nowin32
-echo "Copying Visual C project files to top level directory"
-copy ..\..\win\win32\NetHack.rc ..\..
-copy ..\..\win\win32\resource.h ..\..
-copy ..\..\win\win32\NetHack.dsw ..\..
-copy ..\..\win\win32\NetHack.clw ..\..
-copy ..\..\win\win32\makedefs.dsp ..\..
-copy ..\..\win\win32\NetHack.dsp ..\..
-copy ..\..\win\win32\tile2bmp.dsp ..\..
-copy ..\..\win\win32\dgncomp.dsp ..\..
-copy ..\..\win\win32\levcomp.dsp ..\..
-copy ..\..\win\win32\dlb_main.dsp ..\..
-copy ..\..\win\win32\tilemap.dsp ..\..
-copy ..\..\win\win32\recover.dsp ..\..
-
-:nowin32
+if "%1"=="tty"      goto do_tty
+if "%1"=="WINHACK" goto do_winhack
+if "%1"=="tty"      goto do_tty
+if "%1"=="winhack" goto do_winhack
+if "%1"=="gui" goto do_winhack
+if "%1"=="GUI" goto do_winhack
+goto err_set
 
+:do_tty
+set opt=NetHack for NT Console
 if exist .\nethack.ico goto hasicon
 if exist .\nhico.uu uudecode nhico.uu >nul
-if NOT exist .\nethack.ico goto err_nouu
+if exist .\nethack.ico goto hasicon
+set err_nouu=Y
+goto done
 :hasicon
 echo NetHack icon exists ok.
+echo "Copying Makefile.NT to ..\..\src\Makefile"
+copy makefile.NT ..\..\src\Makefile >nul
+echo Makefile copied ok.
 echo done!
 echo.
 echo Proceed with the next step documented in Install.nt
 echo.
 goto done
-:err_nouu
-echo Apparently you have no UUDECODE utility in your path.  You need a UUDECODE
-echo utility in order to turn "nhico.uu" into "nethack.ico".
-echo Check "Install.nt" for a list of the steps required to build NetHack.
+
+:do_winhack
+set opt=Graphical NetHack for Windows (winhack)
+if not exist ..\..\win\win32\winnt.dsw goto err_winhack
+echo "Copying Visual C project files to ..\..\winhacknt directory"
+if NOT exist ..\..\winhacknt\*.* mkdir ..\..\winhacknt
+REM copy ..\..\win\win32\winnt.dsw ..\.. >nul
+copy ..\..\win\win32\nethack.dsw ..\.. >nul
+copy ..\..\win\win32\dgncomp.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\dgnstuff.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\dgnstuff.mak ..\..\winhacknt >nul
+copy ..\..\win\win32\dlb_main.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\levcomp.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\levstuff.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\levstuff.mak ..\..\winhacknt >nul
+copy ..\..\win\win32\makedefs.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\mhaskyn.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhaskyn.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhcmd.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhcmd.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhdlg.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhdlg.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhfont.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhfont.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhinput.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhinput.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmain.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmain.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmap.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmap.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmenu.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmenu.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmsg.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmsgwnd.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhmsgwnd.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhrip.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhrip.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhstatus.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhstatus.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mhtext.c ..\..\winhacknt >nul
+copy ..\..\win\win32\mhtext.h ..\..\winhacknt >nul
+copy ..\..\win\win32\mswproc.c ..\..\winhacknt >nul
+copy ..\..\win\win32\recover.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\resource.h ..\..\winhacknt >nul
+copy ..\..\win\win32\tile2bmp.c ..\..\winhacknt >nul
+copy ..\..\win\win32\tile2bmp.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\tilemap.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\winMS.h ..\..\winhacknt >nul
+copy ..\..\win\win32\winhack.c ..\..\winhacknt >nul
+copy ..\..\win\win32\winhack.dsp ..\..\winhacknt >nul
+copy ..\..\win\win32\winhack.h ..\..\winhacknt >nul
+copy ..\..\win\win32\winhack.rc ..\..\winhacknt >nul
+
+if exist ..\..\winhacknt\mnsel.bmp goto hasmnsel2
+if exist .\mnsel.bmp goto hasmnsel1
+if exist ..\..\win\win32\mnsel.uu uudecode ..\..\win\win32\mnsel.uu >nul
+if exist .\mnsel.bmp goto hasmnsel1
+echo Error - No UUDECODE utility to decode ..\..\win\win32\mnsel.uu
+goto hasmnsel2
+:hasmnsel1
+echo copy .\mnsel.bmp ..\..\winhacknt
+copy .\mnsel.bmp ..\..\winhacknt
+:hasmnsel2
+if NOT exist ..\..\winhacknt\mnsel.bmp set err_nouu=Y
+
+if exist ..\..\winhacknt\mnunsel.bmp goto hasmnuns2
+if exist .\mnunsel.bmp goto hasmnuns1
+if exist ..\..\win\win32\mnunsel.uu uudecode ..\..\win\win32\mnunsel.uu >nul
+if exist .\mnunsel.bmp goto hasmnuns1
+echo Error - No UUDECODE utility to decode ..\..\win\win32\mnunsel.uu
+goto hasmnuns2
+:hasmnuns1
+echo copy .\mnsel.bmp ..\..\winhacknt
+copy .\mnunsel.bmp ..\..\winhacknt
+:hasmnuns2
+if NOT exist ..\..\winhacknt\mnunsel.bmp set err_nouu=Y
+
+if exist ..\..\winhacknt\nethack.ico goto hasicon2
+if exist .\nethack.ico goto hasicon1
+if exist .\nhico.uu uudecode nhico.uu >nul
+if exist .\nethack.ico goto hasicon1
+echo Error - No UUDECODE utility to decode nhico.uu
+goto hasicon2
+:hasicon1
+echo copy .\nethack.ico ..\..\winhacknt
+copy .\nethack.ico ..\..\winhacknt
+:hasicon2
+if NOT exist ..\..\winhacknt\nethack.ico set err_nouu=Y
+
 goto done
-:err_plev
-echo A required file ..\..\include\patchlev.h seems to be missing.
-echo Check "Files." in the root directory for your NetHack distribution
-echo and make sure that all required files exist.
+
+:err_winhack
+echo Some of the files needed to build graphical NetHack
+echo for Windows are not in the expected places.
+echo Check "Install.nt" for a list of the steps required 
+echo to build NetHack.
 goto done
+
 :err_data
 echo A required file ..\..\dat\data.bas seems to be missing.
 echo Check "Files." in the root directory for your NetHack distribution
 echo and make sure that all required files exist.
 goto done
+
 :err_dir
 echo Your directories are not set up properly, please re-read the
 echo documentation.
+goto done
+
+:err_set
+echo.
+echo Usage:
+echo "%0 <TTY | WINHACK | CE >"
+echo.
+echo    Run this batch file specifying one of the following:
+echo            tty, winhack, ce
+echo.
+echo    The tty argument is for preparing to build a console I/O TTY version
+echo    of NetHack.
+echo.
+echo    The winhack argument is for preparing to build a graphical version
+echo    of NetHack.
+echo.
+echo    The CE argument is for preparing to build a Windows CE version
+echo    of NetHack.
+echo.
+goto end
+
 :done
+echo done!
+echo.
+if "%err_nouu%"=="" echo Proceed with the next step documented in Install.nt
+if "%err_nouu%"=="" echo  for building %opt%.
+echo.
+if "%err_nouu%"=="" goto fini
+echo Apparently you have no UUDECODE utility in your path.  
+echo You need a UUDECODE utility in order to turn several .uu files
+echo into their decoded binary versions.
+echo Check "Install.nt" for a list of prerequisites for building NetHack.
+
+:fini
+:end
index ea2ffc2587d523b86ccc1acd279b6c44458c87a7..2634d50dea37db837040bc1ad9a6807e635dc637 100644 (file)
 # endif
 #endif
 
+#ifdef WIN_CE
+#define PREFIX "\\nethack\\dat\\"
+#endif
+
 #ifndef MPWTOOL
 # define SpinCursor(x)
 #endif
index 94ab54763940b15c4a05435d90deec65da341cac..f6b812b94cf39628c0fded310b24165dc11be24c 100644 (file)
@@ -26,7 +26,13 @@ int FDECL(open_levelfile, (int));
 int NDECL(create_savefile);
 void FDECL(copy_bytes, (int,int));
 
+#ifndef WIN_CE
 #define Fprintf        (void)fprintf
+#else
+#define Fprintf        (void)nhce_message
+static void nhce_message(FILE*, const char*, ...);
+#endif
+
 #define Close  (void)close
 
 #ifdef UNIX
@@ -340,11 +346,19 @@ char *str;
        if (!str) return (char *)0;
        bsize = EXEPATHBUFSZ;
        tmp = exepathbuf;
-# ifndef WIN32
+#if !defined(WIN32)
        strcpy (tmp, str);
+#else
+# if defined(WIN_CE)
+       {
+         TCHAR wbuf[EXEPATHBUFSZ];
+         GetModuleFileName((HANDLE)0, wbuf, EXEPATHBUFSZ);
+         NH_W2A(wbuf, tmp, bsize);
+       }
 # else
        *(tmp + GetModuleFileName((HANDLE)0, tmp, bsize)) = '\0';
 # endif
+#endif
        tmp2 = strrchr(tmp, PATH_SEPARATOR);
        if (tmp2) *tmp2 = '\0';
        return tmp;
@@ -356,4 +370,19 @@ char *str;
 const char amiga_version_string[] = AMIGA_VERSION_STRING;
 #endif
 
+#ifdef WIN_CE
+void nhce_message(FILE* f, const char* str, ...)
+{
+    va_list ap;
+       TCHAR wbuf[NHSTR_BUFSIZE];
+       char buf[NHSTR_BUFSIZE];
+
+    va_start(ap, str);
+       vsprintf(buf, str, ap);
+    va_end(ap);
+
+       MessageBox(NULL, NH_A2W(buf, wbuf, NHSTR_BUFSIZE), TEXT("Recover"), MB_OK);
+}
+#endif
+
 /*recover.c*/