#else
#define WRTMODE "w+"
#endif
-#if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) || defined(__MWERKS__)
+#if (defined(MICRO) && !defined(AMIGA)) || defined(THINK_C) || defined(__MWERKS__) || defined(WIN32)
# define RDBMODE "rb"
# define WRBMODE "w+b"
#else
E void FDECL(create_mplayers, (int,BOOLEAN_P));
E void FDECL(mplayer_talk, (struct monst *));
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
/* ### msdos.c,os2.c,tos.c,winnt.c ### */
E void FDECL(Delay, (int));
# endif /* WIN32 */
-#endif /* MICRO */
+#endif /* MICRO || WIN32 */
/* ### mthrowu.c ### */
/* ### pcmain.c ### */
-#if defined(MICRO)
+#if defined(MICRO) || defined(WIN32)
# ifdef CHDIR
E void FDECL(chdirx, (char *,BOOLEAN_P));
# endif /* CHDIR */
-#endif /* MICRO */
+#endif /* MICRO || WIN32 */
/* ### pcsys.c ### */
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
E void NDECL(flushout);
E int NDECL(dosh);
# ifdef MFLOPPY
E void VDECL(msmsg, (const char *,...));
# endif
E FILE *FDECL(fopenp, (const char *,const char *));
-#endif /* MICRO */
+#endif /* MICRO || WIN32 */
/* ### pctty.c ### */
-#if defined(MICRO)
+#if defined(MICRO) || defined(WIN32)
E void NDECL(gettty);
E void FDECL(settty, (const char *));
E void NDECL(setftty);
#if defined(TIMED_DELAY) && defined(_MSC_VER)
E void FDECL(msleep, (unsigned));
#endif
-#endif /* MICRO */
+#endif /* MICRO || WIN32 */
/* ### pcunix.c ### */
#endif
#if defined(MICRO)
-#if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) && !defined(WIN32)
+#if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS)
#define SHORT_FILENAMES /* filenames are 8.3 */
#endif
#endif
#define PC_LOCKING /* Prevent overwrites of aborted or in-progress games */
/* without first receiving confirmation. */
-#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR,
- LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
- SCOREDIR, LOCKDIR, and CONFIGDIR */
+
/*
* -----------------------------------------------------------------
*/
/* #define SHORT_FILENAMES /* All NT filesystems support long names now */
-#define MICRO /* always define this! */
+#ifdef MICRO
+#undef MICRO /* never define this! */
+#endif
+
+#define NOCWD_ASSUMPTIONS /* Always define this. There are assumptions that
+ it is defined for WIN32.
+ Allow paths to be specified for HACKDIR,
+ LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
+ SCOREDIR, LOCKDIR, and CONFIGDIR */
#define NO_TERMS
#define ASCIIGRAPH
#define FILENAME_CMP stricmp /* case insensitive */
#endif
-#ifdef MICRO
-# ifndef MICRO_H
-#include "micro.h" /* contains necessary externs for [os_name].c */
-# endif
+#if 0
+#ifndef C
+#define C(c) (0x1f & (c))
#endif
+#ifndef M
+#define M(c) (0x80 | (c))
+#endif
+extern char levels[], bones[], permbones[],
+#endif /* 0 */
+
+/* this was part of the MICRO stuff in the past */
+extern const char *alllevels, *allbones;
+extern char hackdir[];
+#define ABORT C('a')
+#define getuid() 1
+#define getlogin() ((char *)0)
#include <fcntl.h>
#ifndef __BORLANDC__
void
moveloop()
{
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
char ch;
int abort_lev;
#endif
flags.move = 1;
if(multi >= 0 && occupation) {
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
abort_lev = 0;
if (kbhit()) {
if ((ch = Getchar()) == ABORT)
#endif
occupation = 0;
if(
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
abort_lev ||
#endif
monster_nearby()) {
stop_occupation();
reset_eat();
}
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
if (!(++occtime % 7))
display_nhwindow(WIN_MAP, FALSE);
#endif
#if defined(MONITOR_HEAP) || defined(WIZARD)
-# ifdef MICRO
+# if defined(MICRO) || defined(WIN32)
/* we actually want to know which systems have an ANSI run-time library
* to know which support the new %p format for printing pointers.
* due to the presence of things like gcc, NHSTDC is not a good test.
const char disclosure_options[] = "iavgc";
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
char hackdir[PATHLEN]; /* where rumors, help, record are */
+# ifdef MICRO
char levels[PATHLEN]; /* where levels are */
-#endif /* MICRO */
+# endif
+#endif /* MICRO || WIN32 */
#ifdef MFLOPPY
return;
}
+#if defined(WIN32)
+#define NOTIFY_NETHACK_BUGS
+#endif
+
/*VARARGS1*/
void
panic VA_DECL(const char *, str)
"Program initialization has failed." :
"Suddenly, the dungeon collapses.");
#if defined(WIZARD) && !defined(MICRO)
+# if defined(NOTIFY_NETHACK_BUGS)
+ if (!wizard)
+ raw_printf("Report error to \"%s\".\n%s.\n",
+ "nethack-bugs@nethack.org",
+ !program_state.something_worth_saving ? "" :
+ "An error save file will be created.\n");
+ else if (program_state.something_worth_saving)
+ raw_print("\nAn error save file will be created.\n");
+# else
if (!wizard)
raw_printf("Report error to \"%s\"%s.",
-# ifdef WIZARD_NAME /*(KR1ED)*/
+# ifdef WIZARD_NAME /*(KR1ED)*/
WIZARD_NAME,
-# else
+# else
WIZARD,
-# endif
+# endif
!program_state.something_worth_saving ? "" :
" and it may be possible to rebuild.");
+# endif
if (program_state.something_worth_saving) {
set_error_savefile();
(void) dosave0();
set_levelfile_name(lock, lev);
fq_lock = fqname(lock, LEVELPREFIX, 0);
-#if defined(MICRO)
+#if defined(MICRO) || defined(WIN32)
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
# else
fd = creat(fq_lock, FCMASK);
# endif
-#endif /* MICRO */
+#endif /* MICRO || WIN32 */
if (fd >= 0)
level_info[lev].flags |= LFILE_EXISTS;
file = set_bonestemp_name();
file = fqname(file, BONESPREFIX, 0);
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
*/
(void) chmod(file, FCMASK | 007); /* allow other users full access */
# endif /* VMS && !SECURE */
-#endif /* MICRO */
+#endif /* MICRO || WIN32*/
return fd;
}
regularize(SAVEF+7);
Strcat(SAVEF, ";1");
#else
-# if defined(MICRO) && !defined(WIN32)
+# if defined(MICRO)
Strcpy(SAVEF, SAVEP);
# ifdef AMIGA
strncat(SAVEF, bbs_id, PATHLEN);
int fd;
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
#else
# ifdef MAC
}
}
-#if defined(MICRO) || defined(MAC) || defined(__BEOS__)
+#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r"))
!= (FILE *)0)
return(fp);
#define tmp_levels (char *)0
#define tmp_ramdisk (char *)0
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
#undef tmp_levels
char tmp_levels[PATHLEN];
# ifdef MFLOPPY
if (!(fp = fopen_config_file(filename))) return;
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
# ifdef MFLOPPY
# ifndef AMIGA
tmp_ramdisk[0] = 0;
wait_synch();
}
#endif /* !UNIX && !VMS */
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
char tmp[PATHLEN];
# ifdef OS2_CODEVIEW /* explicit path on opening for OS/2 */
(void) close(fd);
} else /* open succeeded */
(void) close(fd);
-#else /* MICRO */
+#else /* MICRO || WIN32*/
# ifdef MAC
/* Create the "record" file, if necessary */
if (fd != -1) macclose (fd);
# endif /* MAC */
-#endif /* MICRO */
+#endif /* MICRO || WIN32*/
}
/* ---------- END SCOREBOARD CREATION ----------- */
#else
{"checkspace", (boolean *)0, FALSE, SET_IN_FILE},
#endif
-# ifdef MICRO
+# if defined(MICRO) || defined(WIN32)
{"color", &iflags.wc_color,TRUE, SET_IN_GAME}, /*WC*/
# else /* systems that support multiple terminals, many monochrome */
{"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
{"pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME},
-#if defined(MICRO) && !defined(AMIGA) && !defined(MSWIN_GRAPHICS)
+#if defined(MICRO) && !defined(AMIGA)
{"rawio", &iflags.rawio, FALSE, DISP_IN_GAME},
#else
{"rawio", (boolean *)0, FALSE, SET_IN_FILE},
}
-#if defined(MICRO) || defined(MAC)
+#if defined(MICRO) || defined(MAC) || defined(WIN32)
# define OPTIONS_HEADING "OPTIONS"
#else
# define OPTIONS_HEADING "NETHACKOPTIONS"
#include "lev.h"
#include "tcap.h" /* for TERMLIB and ASCIIGRAPH */
-#ifdef MICRO
+#if defined(MICRO)
extern int dotcnt; /* shared with save */
extern int dotrow; /* shared with save */
#endif
#define POINTSMIN 1 /* must be > 0 */
#define ENTRYMAX 100 /* must be >= 10 */
-#if !defined(MICRO) && !defined(MAC)
+#if !defined(MICRO) && !defined(MAC) && !defined(WIN32)
#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */
#endif
struct toptenentry {
extern int GUILaunched; /* from nttty.c */
#endif
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
void
flushout()
#endif
return;
}
-#ifdef WIN32
-/*
- * This is a kludge. Just before the release of 3.3.0 the latest
- * version of a popular MAPI mail product was found to exhibit
- * a strange result where the current directory was changed out
- * from under NetHack resulting in a failure of all subsequent
- * file operations in NetHack. This routine is called prior
- * to all file open/renames/deletes in file.c.
- *
- * A more elegant solution will be sought after 3.3.0 is released.
- */
-void dircheck()
-{
- char dirbuf[BUFSZ];
- dirbuf[0] = '\0';
- if (getcwd(dirbuf, sizeof dirbuf) != (char *)0)
- /* pline("%s,%s",dirbuf,hackdir); */
- if (strcmp(dirbuf,hackdir) != 0)
- chdir(hackdir); /* chdir, not chdirx */
-}
-#endif
#endif /* MICRO || WIN32 || OS2 */
return(0);
}
# else
-# if defined(MICRO) && !defined(NO_FSTAT)
+# if (defined(MICRO) || defined(WIN32)) && !defined(NO_FSTAT)
if(fstat(fd, &buf)) {
if(moves > 1) pline("Cannot get status of saved level? ");
else pline("Cannot get status of saved game");
# define O_BINARY 0
#endif
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
# define OMASK FCMASK
#else
# define OMASK 0644
#ifdef TERMINFO
"terminal info library",
#else
-# if defined(TERMLIB) || (!defined(MICRO) && defined(TTY_GRAPHICS))
+# if defined(TERMLIB) || ((!defined(MICRO) && !defined(WIN32)) && defined(TTY_GRAPHICS))
"terminal capability library",
# endif
#endif
extern void NDECL(init_colormap);
extern void NDECL(merge_colormap);
-#if defined(MICRO)
+#if defined(MICRO) || defined(WIN32)
#undef exit
# if !defined(MSDOS) && !defined(WIN32)
extern void FDECL(exit, (int));
void NDECL(init_tilemap);
void FDECL(process_substitutions, (FILE *));
-#ifdef MICRO
+#if defined(MICRO) || defined(WIN32)
#undef exit
#if !defined(MSDOS) && !defined(WIN32)
extern void FDECL(exit, (int));