save/restore changes - part 3

This is the third of a series of savefile-related changes.

    This adds early-days experimental support for a completely optional
    'sfctool' utility (savefile conversion tool), to be able to export
    a savefile's contents into a more portable format. There are likely
    to be bugs at this stage. In this initial first-attempt, the export
    format is a very simple ascii output.

    NetHack can be built entirely, without also building this tool.
    NetHack has no dependencies on the tool.

    Attempts were made to minimize duplication of existing NetHack code.
    To achieve that, unfortunately, #ifdef SFCTOOL and #ifndef SFCTOOL
    had to be sprinkled around through some of the existing NetHack
    source code, so that it could be re-used for building the utility.

    The process for building the sfctool typically recompiles the source
    files with #define SFCTOOL and a distinct object file with SF- is
    produced.

sfctool notes:

    Universal ctags is used and required to produce the sfctool utility.

    Some targets were added to the Unix and Windows Makefiles to
    facilitate the build process.

         make sfctool

    That should build a copy in util.

    Note: At present, the Unix Makefiles do not copy sfctool over to the
          NetHack playground during 'make install' or 'make update'.
          Until that gets resolved by someone, The tool will
          have to be manually copied there by the builder/admin if
          desired.
          cp util/sfctool ~/nh/install/games/lib/nethackdir/sfctool

    Also, a separate Visual Studio sfctool.sln solution was written and
    placed in sys/windows/vs. That has has only very limited testing.

    Usage:

      i)  To convert an existing savefile to an exportascii format
          that co-resides with the savefile:

          sfctool -c savefile

          That *must* be executed on the same platform / architecture /
          data model that produced the save file in the first place.

     ii)  To unconvert an existing exportascii format export file to a
          historical format savefile that can then be used by NetHack:

          sfctool -u savefile

          That must be executed on the same target platform / architecture /
          data model that was used to build the NetHack that will
          utilize the save file that results.

     A Windows example:

          sfctool -c Fred.NetHack-saved-game

          That should result in creation of Fred.NetHack-saved-game.exportascii
          from existing savefile:
              %USERPROFILE%\AppData\Local\NetHack\3.7\Fred.NetHack-saved-game

     A Unix example:

          sfctool -c 1000wizard

          That should result in creation of 1000wizard.exportascii.gz
          from existing savefile in the playground save directory:
              1000wizard.gz

  Current Mechanics:
     1. Makefile recipe, or script uses universal ctags to produce
        util/sf.tags.

     2. util/sftags is built and executed to read util/sf.tags and
        generate: include/sfproto.h and src/sfdata.c.

     3. util/sfctool is built from the following:
        generated file compiled with -DSFCTOOL:
                    src/sfdata.c       -> sfdata.o
        existing files compiled with -DSFCTOOL:
                    util/sfctool.c     -> sfctool.o
                    util/sfexpasc.c    -> sfexpasc.o
                    src/alloc.c        -> sf-alloc.o
                    src/monst.c        -> sf-monst.o
                    src/objects.c      -> sf-objects.o
                    src/sfbase.c       -> sfbase.o
                    src/sfstruct.c     -> sfstruct.o
                    src/nhlua.c        -> sf-nhlua.o
                    util/panic.c       -> panic.o
                    src/date.c         -> sf-date.o
                    src/decl.c         -> sf-decl.o
                    src/artifact.c     -> sf-artifact.o
                    src/dungeon.c      -> sf-dungeon.o
                    src/end.c          -> sf-end.o
                    src/engrave.c      -> sf-engrave.o
                    src/cfgfiles.c     -> sf-cfgfiles.o
                    src/files.c        -> sf-files.o
                    src/light.c        -> sf-light.o
                    src/mdlib.c        -> sf-mdlib.o
                    src/mkmaze.c       -> sf-mkmaze.o
                    src/mkroom.c       -> sf-mkroom.o
                    src/o_init.c       -> sf-o_init.o
                    src/region.c       -> sf-region.o
                    src/restore.c      -> sf-restore.o
                    src/rumors.c       -> sf-rumors.o
                    src/sys.c          -> sf-sys.o
                    src/timeout.c      -> sf-timeout.o
                    src/track.c        -> sf-track.o
                    src/version.c      -> sf-version.o
                    src/worm.c         -> sf-worm.o
                    src/strutil.c      -> strutil.o
This commit is contained in:
nhmall
2025-05-25 20:38:17 -04:00
parent 82fd29c429
commit a654d08c3b
49 changed files with 7578 additions and 257 deletions
+5 -4
View File
@@ -57,10 +57,11 @@ considered spoilers:
level once that square's location becomes known (found or magic level once that square's location becomes known (found or magic
mapped); goes away once sanctum temple is found (entered or high altar mapped); goes away once sanctum temple is found (entered or high altar
mapped) mapped)
- savefile: add support to deconstruct internal data structures down into - savefile: add support for a tool to deconstruct data structures,
their individual fields and save those fields instead of the entire that get stored in a savefile, down into their individual fields and
struct save those individual fields instead of the entire struct. The
- savefile: use little-endian format for fields where that makes a difference intention is to provide a way to export and transport savefiles
between platforms, architectures and data models.
- - - - - - - - - - - - - - - - - - - - - -
+2
View File
@@ -15,3 +15,5 @@ tile.h
win32api.h win32api.h
# really obsolete... # really obsolete...
.cvsignore .cvsignore
sfproto.h
+12 -1
View File
@@ -1068,6 +1068,10 @@ extern char **get_saved_games(void);
extern void free_saved_games(char **); extern void free_saved_games(char **);
extern void nh_compress(const char *); extern void nh_compress(const char *);
extern void nh_uncompress(const char *); extern void nh_uncompress(const char *);
extern void nh_sfconvert(const char *);
extern void nh_sfunconvert(const char *);
extern int delete_convertedfile(const char *);
extern void free_convert_filenames(void);
extern boolean lock_file(const char *, int, int) NONNULLARG1; extern boolean lock_file(const char *, int, int) NONNULLARG1;
extern void unlock_file(const char *) NONNULLARG1; extern void unlock_file(const char *) NONNULLARG1;
extern void check_recordfile(const char *); extern void check_recordfile(const char *);
@@ -1093,6 +1097,7 @@ extern boolean read_tribute(const char *, const char *, int, char *, int,
extern boolean Death_quote(char *, int) NONNULLARG1; extern boolean Death_quote(char *, int) NONNULLARG1;
extern void livelog_add(long ll_type, const char *) NONNULLARG2; extern void livelog_add(long ll_type, const char *) NONNULLARG2;
ATTRNORETURN extern void do_deferred_showpaths(int) NORETURN; ATTRNORETURN extern void do_deferred_showpaths(int) NORETURN;
extern boolean contains_directory(const char *);
/* ### fountain.c ### */ /* ### fountain.c ### */
@@ -1969,7 +1974,7 @@ extern int dosuspend(void);
extern void nt_regularize(char *); extern void nt_regularize(char *);
extern int(*nt_kbhit)(void); extern int(*nt_kbhit)(void);
extern void Delay(int); extern void Delay(int);
extern boolean contains_directory(const char *); boolean get_user_home_folder(char *, size_t);
# ifdef CRASHREPORT # ifdef CRASHREPORT
struct CRctxt; struct CRctxt;
extern struct CRctxt *ctxp; extern struct CRctxt *ctxp;
@@ -2678,6 +2683,12 @@ extern boolean lookup_id_mapping(unsigned, unsigned *) NONNULLARG2;
/* extern void reset_restpref(void); */ /* extern void reset_restpref(void); */
/* extern void set_restpref(const char *); */ /* extern void set_restpref(const char *); */
/* extern void set_savepref(const char *); */ /* extern void set_savepref(const char *); */
#ifdef SFCTOOL
void rest_bubbles(NHFILE *);
void restore_gamelog(NHFILE *);
boolean restgamestate(NHFILE *);
void restore_msghistory(NHFILE *);
#endif
/* ### rip.c ### */ /* ### rip.c ### */
+4 -1
View File
@@ -429,6 +429,7 @@ extern struct nomakedefs_s nomakedefs;
/* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED /* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED
but only for supported platforms. */ but only for supported platforms. */
#ifndef NOPANICTRACE
#ifdef UNIX #ifdef UNIX
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
/* see end.c */ /* see end.c */
@@ -439,6 +440,7 @@ extern struct nomakedefs_s nomakedefs;
#endif /* CROSS_TO_WASM | CROSS_TO_MSDOS */ #endif /* CROSS_TO_WASM | CROSS_TO_MSDOS */
#endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */ #endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */
#endif /* UNIX */ #endif /* UNIX */
#endif /* !NOPANICTRACE */
/* The following are meaningless if PANICTRACE is not defined: */ /* The following are meaningless if PANICTRACE is not defined: */
#if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2) #if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2)
@@ -569,5 +571,6 @@ typedef enum NHL_pcall_action {
NHLpa_impossible NHLpa_impossible
} NHL_pcall_action; } NHL_pcall_action;
#define SFCTOOL_BIT (1UL << 30) /* needed for upcoming savefile handling */ #define SFCTOOL_BIT (1UL << 30)
#endif /* GLOBAL_H */ #endif /* GLOBAL_H */
+7 -7
View File
@@ -954,9 +954,9 @@ struct xlock_s {
#define NHF_BONESFILE 3 #define NHF_BONESFILE 3
/* modes */ /* modes */
#define READING 0x0 #define READING 0x0
#define COUNTING 0x1 #define COUNTING 0x01
#define WRITING 0x2 #define WRITING 0x02
#define FREEING 0x4 #define FREEING 0x04
#define CONVERTING 0x08 #define CONVERTING 0x08
#define UNCONVERTING 0x10 #define UNCONVERTING 0x10
#if 0 #if 0
@@ -972,7 +972,7 @@ struct xlock_s {
enum saveformats { enum saveformats {
invalid = 0, invalid = 0,
historical = 1, /* entire struct, binary, as-is */ historical = 1, /* entire struct, binary, as-is */
cnvascii = 2, /* each field, ascii text */ exportascii = 2, /* each field written out as ascii text */
NUM_SAVEFORMATS NUM_SAVEFORMATS
}; };
@@ -984,11 +984,11 @@ struct fieldlevel_content {
struct nh_file { struct nh_file {
int fd; /* for traditional structlevel binary writes */ int fd; /* for traditional structlevel binary writes */
int mode; /* holds READING, WRITING, or FREEING modes */ int mode; /* holds READING, WRITING, FREEING, CONVERTING modes */
int ftype; /* NHF_LEVELFILE, NHF_SAVEFILE, or NHF_BONESFILE */ int ftype; /* NHF_LEVELFILE, NHF_SAVEFILE, or NHF_BONESFILE */
int fnidx; /* index of procs for fieldlevel saves */ int fnidx; /* index of procs for fieldlevel saves */
long count; /* holds current line count for default style file, long rcount, /* read count since opening */
field count for binary style */ wcount; /* write count since opening */
boolean structlevel; /* traditional structure binary saves */ boolean structlevel; /* traditional structure binary saves */
boolean fieldlevel; /* fieldlevel saves each field individually */ boolean fieldlevel; /* fieldlevel saves each field individually */
boolean addinfo; /* if set, some additional context info from core */ boolean addinfo; /* if set, some additional context info from core */
+3 -3
View File
@@ -23,7 +23,7 @@ extern void sfo_uint32(NHFILE *, uint32 *, const char *);
extern void sfo_uint64(NHFILE *, uint64 *, const char *); extern void sfo_uint64(NHFILE *, uint64 *, const char *);
extern void sfo_size_t(NHFILE *, size_t *, const char *); extern void sfo_size_t(NHFILE *, size_t *, const char *);
extern void sfo_time_t(NHFILE *, time_t *, const char *); extern void sfo_time_t(NHFILE *, time_t *, const char *);
//extern void sfo_str(NHFILE *, char *, const char *, int);
extern void sfo_arti_info(NHFILE *nhfp, extern void sfo_arti_info(NHFILE *nhfp,
struct arti_info *d_arti_info, struct arti_info *d_arti_info,
const char *myname); const char *myname);
@@ -199,7 +199,7 @@ extern void sfi_ulong(NHFILE *, ulong *, const char *);
#define Sfo_uint64(a,b,c) sfo_uint64(a, b, c) #define Sfo_uint64(a,b,c) sfo_uint64(a, b, c)
#define Sfo_size_t(a,b,c) sfo_size_t(a, b, c) #define Sfo_size_t(a,b,c) sfo_size_t(a, b, c)
#define Sfo_time_t(a,b,c) sfo_time_t(a, b, c) #define Sfo_time_t(a,b,c) sfo_time_t(a, b, c)
#define Sfo_str(a,b,c) sfo_str(a, b, c)
#define Sfo_arti_info(a,b,c) sfo_arti_info(a, b, c) #define Sfo_arti_info(a,b,c) sfo_arti_info(a, b, c)
#define Sfo_dgn_topology(a,b,c) sfo_dgn_topology(a, b, c) #define Sfo_dgn_topology(a,b,c) sfo_dgn_topology(a, b, c)
#define Sfo_dungeon(a,b,c) sfo_dungeon(a, b, c) #define Sfo_dungeon(a,b,c) sfo_dungeon(a, b, c)
@@ -471,7 +471,7 @@ extern void sfi_ulong(NHFILE *, ulong *, const char *);
#define Sfo_uint64(a,b,c) sfo(a, b, c) #define Sfo_uint64(a,b,c) sfo(a, b, c)
#define Sfo_size_t(a,b,c) sfo(a, b, c) #define Sfo_size_t(a,b,c) sfo(a, b, c)
#define Sfo_time_t(a,b,c) sfo(a, b, c) #define Sfo_time_t(a,b,c) sfo(a, b, c)
#define Sfo_str(a,b,c) sfo(a, b, c)
#define Sfo_arti_info(a,b,c) sfo(a, b, c) #define Sfo_arti_info(a,b,c) sfo(a, b, c)
#define Sfo_dgn_topology(a,b,c) sfo(a, b, c) #define Sfo_dgn_topology(a,b,c) sfo(a, b, c)
#define Sfo_dungeon(a,b,c) sfo(a, b, c) #define Sfo_dungeon(a,b,c) sfo(a, b, c)
+8 -5
View File
@@ -97,11 +97,11 @@ SF_PROTO_X(char, char);
#undef SF_PROTO_C #undef SF_PROTO_C
#undef SF_PROTO_X #undef SF_PROTO_X
#define SF_ENTRY(dtyp) \ #define SF_ENTRY(dtyp) \
void (*sf_##dtyp)(NHFILE *, dtyp *, const char *) void (*sf_##dtyp)(NHFILE *, dtyp *, const char *)
#define SF_ENTRY_C(keyw, dtyp) \ #define SF_ENTRY_C(keyw, dtyp) \
void (*sf_##dtyp)(NHFILE *, keyw dtyp *, const char *) void (*sf_##dtyp)(NHFILE *, keyw dtyp *, const char *)
#define SF_ENTRY_X(xxx, dtyp) \ #define SF_ENTRY_X(xxx, dtyp) \
void (*sf_##dtyp)(NHFILE *, xxx *, const char *, int bfsz) void (*sf_##dtyp)(NHFILE *, xxx *, const char *, int bfsz)
struct sf_procs { struct sf_procs {
@@ -189,11 +189,14 @@ struct sf_fieldlevel_procs {
struct sf_procs fn_x; /* called for fieldlevel */ struct sf_procs fn_x; /* called for fieldlevel */
}; };
extern struct sf_structlevel_procs sfoprocs[NUM_SAVEFORMATS], sfiprocs[NUM_SAVEFORMATS]; extern struct sf_structlevel_procs sfoprocs[NUM_SAVEFORMATS], sfiprocs[NUM_SAVEFORMATS];
extern void sf_setprocs(int, struct sf_structlevel_procs *, struct sf_structlevel_procs *);
extern void sf_setflprocs(int, struct sf_fieldlevel_procs *, struct sf_fieldlevel_procs *);
extern struct sf_structlevel_procs sfoprocs[NUM_SAVEFORMATS], sfiprocs[NUM_SAVEFORMATS];
extern struct sf_fieldlevel_procs sfoflprocs[NUM_SAVEFORMATS], sfiflprocs[NUM_SAVEFORMATS]; extern struct sf_fieldlevel_procs sfoflprocs[NUM_SAVEFORMATS], sfiflprocs[NUM_SAVEFORMATS];
extern struct sf_structlevel_procs historical_sfo_procs; extern struct sf_structlevel_procs historical_sfo_procs;
extern struct sf_structlevel_procs historical_sfi_procs; extern struct sf_structlevel_procs historical_sfi_procs;
extern struct sf_fieldlevel_procs cnv_sfo_procs; extern struct sf_fieldlevel_procs exportascii_sfo_procs;
extern struct sf_fieldlevel_procs cnv_sfi_procs; extern struct sf_fieldlevel_procs exportascii_sfi_procs;
#endif /* SFPROCS_H */ #endif /* SFPROCS_H */
+13
View File
@@ -7,6 +7,8 @@
#include "artifact.h" #include "artifact.h"
#include "artilist.h" #include "artilist.h"
#ifndef SFCTOOL
/* /*
* Note: both artilist[] and artiexist[] have a dummy element #0, * Note: both artilist[] and artiexist[] have a dummy element #0,
* so loops over them should normally start at #1. The primary * so loops over them should normally start at #1. The primary
@@ -57,6 +59,7 @@ staticfn void dispose_of_orig_obj(struct obj *);
Note: this will still break if they have more than about half the number Note: this will still break if they have more than about half the number
of hit points that will fit in a 15 bit integer. */ of hit points that will fit in a 15 bit integer. */
#define FATAL_DAMAGE_MODIFIER 200 #define FATAL_DAMAGE_MODIFIER 200
#endif /* SFCTOOL */
/* arti_info struct definition moved to artifact.h */ /* arti_info struct definition moved to artifact.h */
@@ -72,6 +75,7 @@ static xint16 artidisco[NROFARTIFACTS];
* and restored but that is done through this file so they can be local. * and restored but that is done through this file so they can be local.
*/ */
#ifndef SFCTOOL
static const struct arti_info zero_artiexist = {0}; /* all bits zero */ static const struct arti_info zero_artiexist = {0}; /* all bits zero */
staticfn void hack_artifacts(void); staticfn void hack_artifacts(void);
@@ -121,6 +125,8 @@ save_artifacts(NHFILE *nhfp)
Sfo_xint16(nhfp, &artidisco[i], "artidisco"); Sfo_xint16(nhfp, &artidisco[i], "artidisco");
} }
#endif /* SFCTOOL */
void void
restore_artifacts(NHFILE *nhfp) restore_artifacts(NHFILE *nhfp)
{ {
@@ -130,9 +136,15 @@ restore_artifacts(NHFILE *nhfp)
Sfi_arti_info(nhfp, &artiexist[i], "artiexist"); Sfi_arti_info(nhfp, &artiexist[i], "artiexist");
for (i = 0; i < NROFARTIFACTS; ++i) for (i = 0; i < NROFARTIFACTS; ++i)
Sfi_short(nhfp, &artidisco[i], "artidisco"); Sfi_short(nhfp, &artidisco[i], "artidisco");
#ifndef SFCTOOL
hack_artifacts(); /* redo non-saved special cases */ hack_artifacts(); /* redo non-saved special cases */
#else
nhUse(artilist);
#endif
} }
#ifndef SFCTOOL
const char * const char *
artiname(int artinum) artiname(int artinum)
{ {
@@ -2789,5 +2801,6 @@ permapoisoned(struct obj *obj)
{ {
return (obj && is_art(obj, ART_GRIMTOOTH)); return (obj && is_art(obj, ART_GRIMTOOTH));
} }
#endif /* SFCTOOL */
/*artifact.c*/ /*artifact.c*/
+9
View File
@@ -5,6 +5,7 @@
#include "hack.h" #include "hack.h"
#ifndef SFCTOOL
staticfn boolean no_bones_level(d_level *); staticfn boolean no_bones_level(d_level *);
staticfn void goodfruit(int); staticfn void goodfruit(int);
staticfn void resetobjs(struct obj *, boolean); staticfn void resetobjs(struct obj *, boolean);
@@ -622,6 +623,8 @@ savebones(int how, time_t when, struct obj *corpse)
compress_bonesfile(); compress_bonesfile();
} }
#endif /* !SFCTOOL */
int int
getbones(void) getbones(void)
{ {
@@ -630,6 +633,7 @@ getbones(void)
char c = 0, *bonesid, char c = 0, *bonesid,
oldbonesid[40] = { 0 }; /* was [10]; more should be safer */ oldbonesid[40] = { 0 }; /* was [10]; more should be safer */
#ifndef SFCTOOL
if (discover) /* save bones files for real games */ if (discover) /* save bones files for real games */
return 0; return 0;
@@ -641,6 +645,7 @@ getbones(void)
return 0; return 0;
if (no_bones_level(&u.uz)) if (no_bones_level(&u.uz))
return 0; return 0;
#endif /* !SFCTOOL */
nhfp = open_bonesfile(&u.uz, &bonesid); nhfp = open_bonesfile(&u.uz, &bonesid);
if (!nhfp) if (!nhfp)
@@ -740,6 +745,8 @@ getbones(void)
return ok; return ok;
} }
#ifndef SFCTOOL
/* check whether current level contains bones from a particular player */ /* check whether current level contains bones from a particular player */
boolean boolean
bones_include_name(const char *name) bones_include_name(const char *name)
@@ -821,4 +828,6 @@ free_ebones(struct monst *mtmp)
} }
} }
#endif /* SFCTOOL */
/*bones.c*/ /*bones.c*/
+37 -51
View File
@@ -35,6 +35,7 @@ staticfn char *is_config_section(char *);
staticfn boolean handle_config_section(char *); staticfn boolean handle_config_section(char *);
boolean parse_config_line(char *); boolean parse_config_line(char *);
staticfn char *find_optparam(const char *); staticfn char *find_optparam(const char *);
#ifndef SFCTOOL
staticfn boolean cnf_line_OPTIONS(char *); staticfn boolean cnf_line_OPTIONS(char *);
staticfn boolean cnf_line_AUTOPICKUP_EXCEPTION(char *); staticfn boolean cnf_line_AUTOPICKUP_EXCEPTION(char *);
staticfn boolean cnf_line_BINDINGS(char *); staticfn boolean cnf_line_BINDINGS(char *);
@@ -53,6 +54,7 @@ staticfn boolean cnf_line_NAME(char *);
staticfn boolean cnf_line_ROLE(char *); staticfn boolean cnf_line_ROLE(char *);
staticfn boolean cnf_line_dogname(char *); staticfn boolean cnf_line_dogname(char *);
staticfn boolean cnf_line_catname(char *); staticfn boolean cnf_line_catname(char *);
#endif /* SFCTOOL */
#ifdef SYSCF #ifdef SYSCF
staticfn boolean cnf_line_WIZARDS(char *); staticfn boolean cnf_line_WIZARDS(char *);
staticfn boolean cnf_line_SHELLERS(char *); staticfn boolean cnf_line_SHELLERS(char *);
@@ -80,12 +82,12 @@ staticfn boolean cnf_line_PANICTRACE_GDB(char *);
staticfn boolean cnf_line_GDBPATH(char *); staticfn boolean cnf_line_GDBPATH(char *);
staticfn boolean cnf_line_GREPPATH(char *); staticfn boolean cnf_line_GREPPATH(char *);
staticfn boolean cnf_line_CRASHREPORTURL(char *); staticfn boolean cnf_line_CRASHREPORTURL(char *);
staticfn boolean cnf_line_SAVEFORMAT(char *);
staticfn boolean cnf_line_BONESFORMAT(char *);
staticfn boolean cnf_line_ACCESSIBILITY(char *); staticfn boolean cnf_line_ACCESSIBILITY(char *);
staticfn boolean cnf_line_PORTABLE_DEVICE_PATHS(char *); staticfn boolean cnf_line_PORTABLE_DEVICE_PATHS(char *);
staticfn void parseformat(int *, char *); staticfn void parseformat(int *, char *);
#endif /* SYSCF */ #endif /* SYSCF */
#ifndef SFCTOOL
staticfn boolean cnf_line_BOULDER(char *); staticfn boolean cnf_line_BOULDER(char *);
staticfn boolean cnf_line_MENUCOLOR(char *); staticfn boolean cnf_line_MENUCOLOR(char *);
staticfn boolean cnf_line_HILITE_STATUS(char *); staticfn boolean cnf_line_HILITE_STATUS(char *);
@@ -101,6 +103,7 @@ staticfn boolean cnf_line_QT_TILEWIDTH(char *);
staticfn boolean cnf_line_QT_TILEHEIGHT(char *); staticfn boolean cnf_line_QT_TILEHEIGHT(char *);
staticfn boolean cnf_line_QT_FONTSIZE(char *); staticfn boolean cnf_line_QT_FONTSIZE(char *);
staticfn boolean cnf_line_QT_COMPACT(char *); staticfn boolean cnf_line_QT_COMPACT(char *);
#endif /* SFCTOOL */
struct _cnf_parser_state; /* defined below (far below...) */ struct _cnf_parser_state; /* defined below (far below...) */
staticfn void cnf_parser_init(struct _cnf_parser_state *parser); staticfn void cnf_parser_init(struct _cnf_parser_state *parser);
staticfn void cnf_parser_done(struct _cnf_parser_state *parser); staticfn void cnf_parser_done(struct _cnf_parser_state *parser);
@@ -109,6 +112,13 @@ staticfn void parse_conf_buf(struct _cnf_parser_state *parser,
/* next one is in extern.h; why here too? */ /* next one is in extern.h; why here too? */
boolean parse_conf_str(const char *str, boolean (*proc)(char *arg)); boolean parse_conf_str(const char *str, boolean (*proc)(char *arg));
#ifdef SFCTOOL
#ifdef wait_synch
#undef wait_synch
#endif
#define wait_synch()
#endif /* SFCTOOL */
/* ---------- BEGIN CONFIG FILE HANDLING ----------- */ /* ---------- BEGIN CONFIG FILE HANDLING ----------- */
/* used for messaging. Also used in options.c */ /* used for messaging. Also used in options.c */
@@ -151,6 +161,8 @@ get_default_configfile(void)
const char *backward_compat_configfile = "nethack.cnf"; const char *backward_compat_configfile = "nethack.cnf";
#endif #endif
#ifndef SFCTOOL
/* #saveoptions - save config options into file */ /* #saveoptions - save config options into file */
int int
do_write_config_file(void) do_write_config_file(void)
@@ -195,6 +207,7 @@ do_write_config_file(void)
} }
return ECMD_OK; return ECMD_OK;
} }
#endif /* SFCTOOL */
/* remember the name of the file we're accessing; /* remember the name of the file we're accessing;
if may be used in option reject messages */ if may be used in option reject messages */
@@ -455,7 +468,11 @@ choose_random_part(char *str, char sep)
nsep++; nsep++;
str++; str++;
} }
#ifndef SFCTOOL
csep = rn2(nsep); csep = rn2(nsep);
#else
csep = 1;
#endif
str = begin; str = begin;
while ((csep > 0) && *str) { while ((csep > 0) && *str) {
str++; str++;
@@ -571,6 +588,8 @@ find_optparam(const char *buf)
return bufp; return bufp;
} }
#ifndef SFCTOOL
staticfn boolean staticfn boolean
cnf_line_OPTIONS(char *origbuf) cnf_line_OPTIONS(char *origbuf)
{ {
@@ -759,6 +778,7 @@ cnf_line_catname(char *bufp)
(void) strncpy(gc.catname, bufp, PL_PSIZ - 1); (void) strncpy(gc.catname, bufp, PL_PSIZ - 1);
return TRUE; return TRUE;
} }
#endif /* SFCTOOL */
#ifdef SYSCF #ifdef SYSCF
@@ -1088,20 +1108,6 @@ cnf_line_CRASHREPORTURL(char *bufp)
return TRUE; return TRUE;
} }
staticfn boolean
cnf_line_SAVEFORMAT(char *bufp)
{
parseformat(sysopt.saveformat, bufp);
return TRUE;
}
staticfn boolean
cnf_line_BONESFORMAT(char *bufp)
{
parseformat(sysopt.bonesformat, bufp);
return TRUE;
}
staticfn boolean staticfn boolean
cnf_line_ACCESSIBILITY(char *bufp) cnf_line_ACCESSIBILITY(char *bufp)
{ {
@@ -1135,6 +1141,8 @@ cnf_line_PORTABLE_DEVICE_PATHS(char *bufp)
} }
#endif /* SYSCF */ #endif /* SYSCF */
#ifndef SFCTOOL
staticfn boolean staticfn boolean
cnf_line_BOULDER(char *bufp) cnf_line_BOULDER(char *bufp)
{ {
@@ -1271,6 +1279,7 @@ cnf_line_QT_COMPACT(char *bufp)
#endif #endif
return TRUE; return TRUE;
} }
#endif /* SFCTOOL */
typedef boolean (*config_line_stmt_func)(char *); typedef boolean (*config_line_stmt_func)(char *);
@@ -1288,6 +1297,7 @@ static const struct match_config_line_stmt {
boolean origbuf; boolean origbuf;
config_line_stmt_func fn; config_line_stmt_func fn;
} config_line_stmt[] = { } config_line_stmt[] = {
#ifndef SFCTOOL
/* OPTIONS handled separately */ /* OPTIONS handled separately */
{ "OPTIONS", 4, FALSE, TRUE, cnf_line_OPTIONS }, { "OPTIONS", 4, FALSE, TRUE, cnf_line_OPTIONS },
CNFL_N(AUTOPICKUP_EXCEPTION, 5), CNFL_N(AUTOPICKUP_EXCEPTION, 5),
@@ -1309,6 +1319,7 @@ static const struct match_config_line_stmt {
CNFL_NA(CHARACTER, 4, ROLE), CNFL_NA(CHARACTER, 4, ROLE),
CNFL_N(dogname, 3), CNFL_N(dogname, 3),
CNFL_N(catname, 3), CNFL_N(catname, 3),
#endif /* SFCTOOL */
#ifdef SYSCF #ifdef SYSCF
CNFL_S(WIZARDS, 7), CNFL_S(WIZARDS, 7),
CNFL_S(SHELLERS, 8), CNFL_S(SHELLERS, 8),
@@ -1336,11 +1347,10 @@ static const struct match_config_line_stmt {
CNFL_S(CRASHREPORTURL, 13), CNFL_S(CRASHREPORTURL, 13),
CNFL_S(GDBPATH, 7), CNFL_S(GDBPATH, 7),
CNFL_S(GREPPATH, 7), CNFL_S(GREPPATH, 7),
CNFL_S(SAVEFORMAT, 10),
CNFL_S(BONESFORMAT, 11),
CNFL_S(ACCESSIBILITY, 13), CNFL_S(ACCESSIBILITY, 13),
CNFL_S(PORTABLE_DEVICE_PATHS, 8), CNFL_S(PORTABLE_DEVICE_PATHS, 8),
#endif /*SYSCF*/ #endif /*SYSCF*/
#ifndef SFCTOOL
CNFL_N(BOULDER, 3), CNFL_N(BOULDER, 3),
CNFL_N(MENUCOLOR, 9), CNFL_N(MENUCOLOR, 9),
CNFL_N(HILITE_STATUS, 6), CNFL_N(HILITE_STATUS, 6),
@@ -1356,6 +1366,7 @@ static const struct match_config_line_stmt {
CNFL_N(QT_TILEHEIGHT, 13), CNFL_N(QT_TILEHEIGHT, 13),
CNFL_N(QT_FONTSIZE, 11), CNFL_N(QT_FONTSIZE, 11),
CNFL_N(QT_COMPACT, 10) CNFL_N(QT_COMPACT, 10)
#endif /* SFCTOOL */
}; };
#undef CNFL_N #undef CNFL_N
@@ -1485,6 +1496,7 @@ config_error_nextline(const char *line)
return TRUE; return TRUE;
} }
#ifndef SFCTOOL
int int
l_get_config_errors(lua_State *L) l_get_config_errors(lua_State *L)
{ {
@@ -1510,6 +1522,7 @@ l_get_config_errors(lua_State *L)
return 1; return 1;
} }
#endif /* SFCTOOL */
/* varargs 'config_error_add()' moved to pline.c */ /* varargs 'config_error_add()' moved to pline.c */
void void
@@ -1600,9 +1613,10 @@ read_config_file(const char *filename, int src)
if (!(fp = fopen_config_file(filename, src))) if (!(fp = fopen_config_file(filename, src)))
return FALSE; return FALSE;
#ifndef SFCTOOL
/* begin detection of duplicate configfile options */ /* begin detection of duplicate configfile options */
reset_duplicate_opt_detection(); reset_duplicate_opt_detection();
#endif /* SFCTOOL */
free_config_sections(); free_config_sections();
iflags.parse_config_file_src = src; iflags.parse_config_file_src = src;
@@ -1610,8 +1624,10 @@ read_config_file(const char *filename, int src)
(void) fclose(fp); (void) fclose(fp);
free_config_sections(); free_config_sections();
#ifndef SFCTOOL
/* turn off detection of duplicate configfile options */ /* turn off detection of duplicate configfile options */
reset_duplicate_opt_detection(); reset_duplicate_opt_detection();
#endif /* SFCTOOL */
return rv; return rv;
} }
@@ -1859,38 +1875,6 @@ vconfig_error_add(const char *str, va_list the_args)
} }
#ifdef SYSCF #ifdef SYSCF
staticfn void
parseformat(int *arr, char *str)
{
const char *legal[] = { "historical", "cnv" };
int i, kwi = 0, words = 0;
char *p = str, *keywords[2] = { NULL };
while (*p) {
while (*p && isspace((uchar) *p)) {
*p = '\0';
p++;
}
if (*p) {
words++;
if (kwi < 2)
keywords[kwi++] = p;
}
while (*p && !isspace((uchar) *p))
p++;
}
if (!words) {
impossible("missing format list");
return;
}
while (--kwi >= 0)
if (kwi < 2) {
for (i = 0; i < SIZE(legal); ++i) {
if (!strcmpi(keywords[kwi], legal[i]))
arr[kwi] = i + 1;
}
}
}
#ifdef SYSCF_FILE #ifdef SYSCF_FILE
void void
assure_syscf_file(void) assure_syscf_file(void)
@@ -1924,8 +1908,10 @@ assure_syscf_file(void)
close(fd); close(fd);
return; return;
} }
#ifndef SFCTOOL
if (gd.deferred_showpaths) if (gd.deferred_showpaths)
do_deferred_showpaths(1); /* does not return */ do_deferred_showpaths(1); /* does not return */
#endif
raw_printf("Unable to open SYSCF_FILE.\n"); raw_printf("Unable to open SYSCF_FILE.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
+14 -1
View File
@@ -34,6 +34,7 @@ struct lchoice {
static mapseen *load_mapseen(NHFILE *); static mapseen *load_mapseen(NHFILE *);
#ifndef SFCTOOL
#if 0 #if 0
staticfn void Fread(genericptr_t, int, int, dlb *); staticfn void Fread(genericptr_t, int, int, dlb *);
#endif #endif
@@ -202,6 +203,7 @@ save_dungeon(
svm.mapseenchn = 0; svm.mapseenchn = 0;
} }
} }
#endif /* !SFCTOOL */
/* Restore the dungeon structures. */ /* Restore the dungeon structures. */
void void
@@ -259,6 +261,7 @@ restore_dungeon(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
#if 0 #if 0
staticfn void staticfn void
Fread(genericptr_t ptr, int size, int nitems, dlb *stream) Fread(genericptr_t ptr, int size, int nitems, dlb *stream)
@@ -1428,6 +1431,7 @@ depth(d_level *lev)
{ {
return (schar) (svd.dungeons[lev->dnum].depth_start + lev->dlevel - 1); return (schar) (svd.dungeons[lev->dnum].depth_start + lev->dlevel - 1);
} }
#endif /* !SFCTOOL */
/* are "lev1" and "lev2" actually the same? */ /* are "lev1" and "lev2" actually the same? */
boolean boolean
@@ -1437,6 +1441,7 @@ on_level(d_level *lev1, d_level *lev2)
&& lev1->dlevel == lev2->dlevel); && lev1->dlevel == lev2->dlevel);
} }
#ifndef SFCTOOL
/* is this level referenced in the special level chain? */ /* is this level referenced in the special level chain? */
s_level * s_level *
Is_special(d_level *lev) Is_special(d_level *lev)
@@ -1602,6 +1607,8 @@ u_on_rndspot(int upflag)
switch_terrain(); switch_terrain();
} }
#endif /* !SFCTOOL */
#ifndef SFCTOOL
boolean boolean
Is_botlevel(d_level *lev) Is_botlevel(d_level *lev)
{ {
@@ -2536,6 +2543,7 @@ donamelevel(void)
query_annotation((d_level *) 0); query_annotation((d_level *) 0);
return ECMD_OK; return ECMD_OK;
} }
#endif /* !SFCTOOL */
/* exclusion zones */ /* exclusion zones */
void void
@@ -2562,7 +2570,7 @@ save_exclusions(NHFILE *nhfp)
; ;
if (update_file(nhfp)) { if (update_file(nhfp)) {
Sfo_int(nhfp, &nez, "exclusion-count"); Sfo_int(nhfp, &nez, "exclusion_count");
for (ez = sve.exclusion_zones; ez; ez = ez->next) { for (ez = sve.exclusion_zones; ez; ez = ez->next) {
Sfo_xint16(nhfp, &ez->zonetype, "exclusion-zonetype"); Sfo_xint16(nhfp, &ez->zonetype, "exclusion-zonetype");
Sfo_coordxy(nhfp, &ez->lx, "exclusion-lx"); Sfo_coordxy(nhfp, &ez->lx, "exclusion-lx");
@@ -2593,6 +2601,8 @@ load_exclusions(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
/* find the particular mapseen object in the chain; may return null */ /* find the particular mapseen object in the chain; may return null */
staticfn mapseen * staticfn mapseen *
find_mapseen(d_level *lev) find_mapseen(d_level *lev)
@@ -2673,6 +2683,7 @@ save_mapseen(NHFILE *nhfp, mapseen *mptr)
} }
savecemetery(nhfp, &mptr->final_resting_place); savecemetery(nhfp, &mptr->final_resting_place);
} }
#endif /* !SFCTOOL */
staticfn mapseen * staticfn mapseen *
load_mapseen(NHFILE *nhfp) load_mapseen(NHFILE *nhfp)
@@ -2709,6 +2720,7 @@ load_mapseen(NHFILE *nhfp)
restcemetery(nhfp, &load->final_resting_place); restcemetery(nhfp, &load->final_resting_place);
return load; return load;
} }
#ifndef SFCTOOL
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
@@ -3682,6 +3694,7 @@ print_mapseen(
} }
} }
} }
#endif /* !SFCTOOL */
#undef OF_INTEREST #undef OF_INTEREST
#undef ADDNTOBUF #undef ADDNTOBUF
#undef ADDTOBUF #undef ADDTOBUF
+4
View File
@@ -14,6 +14,7 @@
#endif #endif
#include "dlb.h" #include "dlb.h"
#ifndef SFCTOOL
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
staticfn void done_intr(int); staticfn void done_intr(int);
# if defined(UNIX) || defined(VMS) || defined(__EMX__) # if defined(UNIX) || defined(VMS) || defined(__EMX__)
@@ -33,9 +34,11 @@ staticfn void dump_plines(void);
#endif #endif
staticfn void dump_everything(int, time_t); staticfn void dump_everything(int, time_t);
staticfn void fixup_death(int); staticfn void fixup_death(int);
#endif /* SFCTOOL */
staticfn int wordcount(char *); staticfn int wordcount(char *);
staticfn void bel_copy1(char **, char *); staticfn void bel_copy1(char **, char *);
#ifndef SFCTOOL
#define done_stopprint program_state.stopprint #define done_stopprint program_state.stopprint
/* /*
@@ -1767,6 +1770,7 @@ save_killers(NHFILE *nhfp)
} }
} }
} }
#endif /* !SFCTOOL */
void void
restore_killers(NHFILE *nhfp) restore_killers(NHFILE *nhfp)
+4 -2
View File
@@ -37,7 +37,7 @@ struct _doengrave_ctx {
size_t len; /* # of nonspace chars of new engraving text */ size_t len; /* # of nonspace chars of new engraving text */
}; };
#ifndef SFCTOOL
staticfn int stylus_ok(struct obj *); staticfn int stylus_ok(struct obj *);
staticfn boolean u_can_engrave(void); staticfn boolean u_can_engrave(void);
staticfn void doengrave_ctx_init(struct _doengrave_ctx *); staticfn void doengrave_ctx_init(struct _doengrave_ctx *);
@@ -1542,6 +1542,7 @@ save_engravings(NHFILE *nhfp)
if (release_data(nhfp)) if (release_data(nhfp))
head_engr = 0; head_engr = 0;
} }
#endif /* !SFCTOOL */
void void
rest_engravings(NHFILE *nhfp) rest_engravings(NHFILE *nhfp)
@@ -1581,6 +1582,7 @@ rest_engravings(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
/* to support '#stats' wizard-mode command */ /* to support '#stats' wizard-mode command */
@@ -1728,5 +1730,5 @@ blengr(void)
{ {
return ROLL_FROM(blind_writing); return ROLL_FROM(blind_writing);
} }
#endif /* !SFCTOOL */
/*engrave.c*/ /*engrave.c*/
+254 -9
View File
@@ -12,6 +12,28 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#ifdef SFCTOOL
#ifdef TTY_GRAPHICS
#undef TTY_GRAPHICS
#endif
#ifdef mark_synch
#undef mark_synch
#endif
#define mark_synch()
#ifdef raw_print
#undef raw_print
#endif
#define raw_print(a)
#ifdef WINDOWPORT
#undef WINDOWPORT
#endif
#define WINDOWPORT(x) FALSE
#ifdef clear_nhwindow
#undef clear_nhwindow
#endif
#define clear_nhwindow(x)
#endif /* SFCTOOL */
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#include "wintty.h" /* more() */ #include "wintty.h" /* more() */
#endif #endif
@@ -125,8 +147,13 @@ extern boolean get_user_home_folder(char *, size_t);
#define PRAGMA_UNUSED #define PRAGMA_UNUSED
#endif #endif
#ifndef SFCTOOL
staticfn NHFILE *new_nhfile(void); staticfn NHFILE *new_nhfile(void);
staticfn void free_nhfile(NHFILE *); staticfn void free_nhfile(NHFILE *);
#else
NHFILE *new_nhfile(void);
void free_nhfile(NHFILE *);
#endif /* SFCTOOL */
#ifdef SELECTSAVED #ifdef SELECTSAVED
staticfn int QSORTCALLBACK strcmp_wrap(const void *, const void *); staticfn int QSORTCALLBACK strcmp_wrap(const void *, const void *);
@@ -144,6 +171,12 @@ staticfn boolean make_compressed_name(const char *, char *);
#endif #endif
staticfn NHFILE *problematic_savefile(int, const char *); staticfn NHFILE *problematic_savefile(int, const char *);
#ifndef SFCTOOL
staticfn int doconvert_file(const char *, int, boolean);
#endif /* SFCTOOL */
staticfn boolean make_converted_name(const char *);
#ifndef SFCTOOL
staticfn NHFILE *viable_nhfile(NHFILE *); staticfn NHFILE *viable_nhfile(NHFILE *);
#ifdef SELECTSAVED #ifdef SELECTSAVED
staticfn int QSORTCALLBACK strcmp_wrap(const void *, const void *); staticfn int QSORTCALLBACK strcmp_wrap(const void *, const void *);
@@ -159,6 +192,7 @@ boolean proc_wizkit_line(char *buf);
void read_wizkit(void); /* in extern.h; why here too? */ void read_wizkit(void); /* in extern.h; why here too? */
staticfn FILE *fopen_sym_file(void); staticfn FILE *fopen_sym_file(void);
staticfn NHFILE *viable_nhfile(NHFILE *); staticfn NHFILE *viable_nhfile(NHFILE *);
#endif /* !SFCTOOL */
/* return a file's name without its path and optionally trailing 'type' */ /* return a file's name without its path and optionally trailing 'type' */
const char * const char *
@@ -354,6 +388,7 @@ fqname(const char *basenam,
#endif /* !PREFIXES_IN_USE */ #endif /* !PREFIXES_IN_USE */
} }
#ifndef SFCTOOL
/* reasonbuf must be at least BUFSZ, supplied by caller */ /* reasonbuf must be at least BUFSZ, supplied by caller */
int int
validate_prefix_locations(char *reasonbuf) validate_prefix_locations(char *reasonbuf)
@@ -414,6 +449,7 @@ fopen_datafile(const char *filename, const char *mode, int prefix)
fp = fopen(filename, mode); fp = fopen(filename, mode);
return fp; return fp;
} }
#endif /* !SFCTOOL */
/* ---------- EXTERNAL FILE SUPPORT ----------- */ /* ---------- EXTERNAL FILE SUPPORT ----------- */
@@ -433,7 +469,7 @@ zero_nhfile(NHFILE *nhfp)
nhfp->fpdef = (FILE *) 0; nhfp->fpdef = (FILE *) 0;
nhfp->fplog = (FILE *) 0; nhfp->fplog = (FILE *) 0;
nhfp->fpdebug = (FILE *) 0; nhfp->fpdebug = (FILE *) 0;
nhfp->count = 0; nhfp->rcount = nhfp->wcount = 0;
nhfp->eof = FALSE; nhfp->eof = FALSE;
nhfp->fnidx = 0; nhfp->fnidx = 0;
nhfp->style.deflt = FALSE; nhfp->style.deflt = FALSE;
@@ -441,7 +477,10 @@ zero_nhfile(NHFILE *nhfp)
nhfp->nhfpconvert = 0; nhfp->nhfpconvert = 0;
} }
staticfn NHFILE * #ifndef SFCTOOL
staticfn
#endif
NHFILE *
new_nhfile(void) new_nhfile(void)
{ {
NHFILE *nhfp = (NHFILE *) alloc(sizeof(NHFILE)); NHFILE *nhfp = (NHFILE *) alloc(sizeof(NHFILE));
@@ -450,7 +489,10 @@ new_nhfile(void)
return nhfp; return nhfp;
} }
staticfn void #ifndef SFCTOOL
staticfn
#endif
void
free_nhfile(NHFILE *nhfp) free_nhfile(NHFILE *nhfp)
{ {
if (nhfp) { if (nhfp) {
@@ -477,13 +519,18 @@ close_nhfile(NHFILE *nhfp)
void void
rewind_nhfile(NHFILE *nhfp) rewind_nhfile(NHFILE *nhfp)
{ {
if (nhfp->structlevel) {
#ifdef BSD #ifdef BSD
(void) lseek(nhfp->fd, 0L, 0); (void) lseek(nhfp->fd, 0L, 0);
#else #else
(void) lseek(nhfp->fd, (off_t) 0, 0); (void) lseek(nhfp->fd, (off_t) 0, 0);
#endif #endif
} else {
rewind(nhfp->fpdef);
}
} }
#ifndef SFCTOOL
staticfn NHFILE * staticfn NHFILE *
viable_nhfile(NHFILE *nhfp) viable_nhfile(NHFILE *nhfp)
{ {
@@ -517,6 +564,7 @@ viable_nhfile(NHFILE *nhfp)
} }
return nhfp; return nhfp;
} }
#endif /* !SFCTOOL */
int int
nhclose(int fd) nhclose(int fd)
@@ -534,6 +582,7 @@ nhclose(int fd)
/* ---------- BEGIN LEVEL FILE HANDLING ----------- */ /* ---------- BEGIN LEVEL FILE HANDLING ----------- */
#ifndef SFCTOOL
/* Construct a file name for a level-type file, which is of the form /* Construct a file name for a level-type file, which is of the form
* something.level (with any old level stripped off). * something.level (with any old level stripped off).
* This assumes there is space on the end of 'file' to append * This assumes there is space on the end of 'file' to append
@@ -881,7 +930,7 @@ open_bonesfile(d_level *lev, char **bonesid)
nhfp->mode = READING; nhfp->mode = READING;
nhfp->addinfo = TRUE; nhfp->addinfo = TRUE;
nhfp->style.deflt = TRUE; nhfp->style.deflt = TRUE;
nhfp->style.binary = (sysopt.bonesformat[0] != cnvascii); nhfp->style.binary = (sysopt.bonesformat[0] != exportascii);
nhfp->fnidx = sysopt.bonesformat[0]; nhfp->fnidx = sysopt.bonesformat[0];
nhfp->fd = -1; nhfp->fd = -1;
nhfp->fpdef = fopen(fq_bones, nhfp->style.binary ? RDBMODE : RDTMODE); nhfp->fpdef = fopen(fq_bones, nhfp->style.binary ? RDBMODE : RDTMODE);
@@ -912,6 +961,7 @@ delete_bonesfile(d_level *lev)
(void) set_bonesfile_name(gb.bones, lev); (void) set_bonesfile_name(gb.bones, lev);
reslt = unlink(fqname(gb.bones, BONESPREFIX, 0)); reslt = unlink(fqname(gb.bones, BONESPREFIX, 0));
delete_convertedfile(fqname(gb.bones, BONESPREFIX, 0));
return !(reslt < 0); return !(reslt < 0);
} }
@@ -920,8 +970,10 @@ delete_bonesfile(d_level *lev)
void void
compress_bonesfile(void) compress_bonesfile(void)
{ {
nh_sfconvert(fqname(gb.bones, BONESPREFIX, 0));
nh_compress(fqname(gb.bones, BONESPREFIX, 0)); nh_compress(fqname(gb.bones, BONESPREFIX, 0));
} }
#endif /* !SFCTOOL */
/* ---------- END BONES FILE HANDLING ----------- */ /* ---------- END BONES FILE HANDLING ----------- */
@@ -1035,6 +1087,7 @@ set_savefile_name(boolean regularize_it)
#endif #endif
} }
#ifndef SFCTOOL
#ifdef INSURANCE #ifdef INSURANCE
void void
save_savefile_name(NHFILE *nhfp) save_savefile_name(NHFILE *nhfp)
@@ -1172,6 +1225,7 @@ delete_savefile(void)
const char *sfname = fqname(gs.SAVEF, SAVEPREFIX, 0); const char *sfname = fqname(gs.SAVEF, SAVEPREFIX, 0);
(void) unlink(sfname); (void) unlink(sfname);
(void) delete_convertedfile(sfname);
return 0; /* for restore_saved_game() (ex-xxxmain.c) test */ return 0; /* for restore_saved_game() (ex-xxxmain.c) test */
} }
@@ -1439,6 +1493,7 @@ free_saved_games(char **saved)
free((genericptr_t) saved); free((genericptr_t) saved);
} }
} }
#endif /* !SFCTOOL */
/* ---------- END SAVE FILE HANDLING ----------- */ /* ---------- END SAVE FILE HANDLING ----------- */
@@ -1490,13 +1545,20 @@ docompress_file(const char *filename, boolean uncomp)
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
boolean istty = WINDOWPORT(tty); boolean istty = WINDOWPORT(tty);
#endif #endif
#ifdef COMPRESS_EXTENSION #ifdef COMPRESS_EXTENSION
xtra = COMPRESS_EXTENSION; xtra = COMPRESS_EXTENSION;
#else #else
xtra = ""; xtra = "";
#endif #endif
#ifdef SFCTOOL
ln = strlen(filename) + sizeof COMPRESS_EXTENSION;
cfn = (char *) alloc(ln);
#else /* SFCTOOL */
ln = (unsigned) (strlen(filename) + strlen(xtra)); ln = (unsigned) (strlen(filename) + strlen(xtra));
cfn = (char *) alloc(ln + 1); cfn = (char *) alloc(ln + 1);
#endif /* SFCTOOL */
Strcpy(cfn, filename); Strcpy(cfn, filename);
Strcat(cfn, xtra); Strcat(cfn, xtra);
@@ -1540,8 +1602,9 @@ docompress_file(const char *filename, boolean uncomp)
* there is an error message from the compression, the 'y' or 'n' can * there is an error message from the compression, the 'y' or 'n' can
* end up being displayed after the error message. * end up being displayed after the error message.
*/ */
if (istty) if (istty) {
mark_synch(); mark_synch();
}
#endif #endif
f = fork(); f = fork();
if (f == 0) { /* child */ if (f == 0) { /* child */
@@ -1551,8 +1614,9 @@ docompress_file(const char *filename, boolean uncomp)
* them will have to clear the first line. This should be * them will have to clear the first line. This should be
* invisible if there are no error messages. * invisible if there are no error messages.
*/ */
if (istty) if (istty) {
raw_print(""); raw_print("");
}
#endif #endif
/* run compressor without privileges, in case other programs /* run compressor without privileges, in case other programs
* have surprises along the line of gzip once taking filenames * have surprises along the line of gzip once taking filenames
@@ -1715,10 +1779,17 @@ docompress_file(const char *filename, boolean uncomp)
{ {
gzFile compressedfile; gzFile compressedfile;
FILE *uncompressedfile; FILE *uncompressedfile;
#ifndef SFCTOOL
char cfn[256]; char cfn[256];
#else
char *cfn;
#endif
char buf[1024]; char buf[1024];
unsigned len, len2; unsigned len, len2;
#ifdef SFCTOOL
cfn = (char *) alloc(strlen(filename) + strlen(COMPRESS_EXTENSION) + 1);
#endif
if (!make_compressed_name(filename, cfn)) if (!make_compressed_name(filename, cfn))
return; return;
@@ -1739,6 +1810,9 @@ docompress_file(const char *filename, boolean uncomp)
} else { } else {
panic("Error in docompress_file %d", errno); panic("Error in docompress_file %d", errno);
} }
#ifdef SFCTOOL
free(cfn);
#endif
fclose(uncompressedfile); fclose(uncompressedfile);
return; return;
} }
@@ -1753,6 +1827,9 @@ docompress_file(const char *filename, boolean uncomp)
fclose(uncompressedfile); fclose(uncompressedfile);
gzclose(compressedfile); gzclose(compressedfile);
(void) unlink(cfn); (void) unlink(cfn);
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
if (len == 0) if (len == 0)
@@ -1765,6 +1842,9 @@ docompress_file(const char *filename, boolean uncomp)
fclose(uncompressedfile); fclose(uncompressedfile);
gzclose(compressedfile); gzclose(compressedfile);
(void) unlink(cfn); (void) unlink(cfn);
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
} }
@@ -1790,12 +1870,18 @@ docompress_file(const char *filename, boolean uncomp)
panic("Error in zlib docompress_file %s, %d", filename, panic("Error in zlib docompress_file %s, %d", filename,
errno); errno);
} }
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
uncompressedfile = fopen(filename, WRBMODE); uncompressedfile = fopen(filename, WRBMODE);
if (!uncompressedfile) { if (!uncompressedfile) {
pline("Error in zlib docompress file uncompress %s", filename); pline("Error in zlib docompress file uncompress %s", filename);
gzclose(compressedfile); gzclose(compressedfile);
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
@@ -1809,6 +1895,9 @@ docompress_file(const char *filename, boolean uncomp)
fclose(uncompressedfile); fclose(uncompressedfile);
gzclose(compressedfile); gzclose(compressedfile);
(void) unlink(filename); (void) unlink(filename);
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
if (len == 0) if (len == 0)
@@ -1821,6 +1910,9 @@ docompress_file(const char *filename, boolean uncomp)
fclose(uncompressedfile); fclose(uncompressedfile);
gzclose(compressedfile); gzclose(compressedfile);
(void) unlink(filename); (void) unlink(filename);
#ifdef SFCTOOL
free(cfn);
#endif
return; return;
} }
} }
@@ -1831,6 +1923,9 @@ docompress_file(const char *filename, boolean uncomp)
/* Delete the file left behind */ /* Delete the file left behind */
(void) unlink(cfn); (void) unlink(cfn);
} }
#ifdef SFCTOOL
free(cfn);
#endif
} }
#endif /* RLC 09 Mar 1999: End ZLIB patch */ #endif /* RLC 09 Mar 1999: End ZLIB patch */
@@ -1840,7 +1935,7 @@ docompress_file(const char *filename, boolean uncomp)
/* ---------- BEGIN PROBLEMATIC SAVEFILE HANDLING ----------- */ /* ---------- BEGIN PROBLEMATIC SAVEFILE HANDLING ----------- */
#ifndef SFCTOOL
static struct sfstatus_to_msg { static struct sfstatus_to_msg {
int sfstatus; int sfstatus;
const char *msg; const char *msg;
@@ -1873,6 +1968,8 @@ problematic_savefile(int sfstatus, const char *savefilenm)
case SF_DM_ILP32LL64_ON_IL32LLP64: case SF_DM_ILP32LL64_ON_IL32LLP64:
case SF_DM_I32LP64_ON_IL32LLP64: case SF_DM_I32LP64_ON_IL32LLP64:
case SF_DM_IL32LLP64_ON_I32LP64: case SF_DM_IL32LLP64_ON_I32LP64:
FALLTHROUGH;
/*FALLTHRU*/
case SF_DM_MISMATCH: case SF_DM_MISMATCH:
case SF_OUTDATED: case SF_OUTDATED:
case SF_CRITICAL_BYTE_COUNT_MISMATCH: case SF_CRITICAL_BYTE_COUNT_MISMATCH:
@@ -1889,11 +1986,155 @@ problematic_savefile(int sfstatus, const char *savefilenm)
} }
return nhfp; return nhfp;
} }
#endif /* !SFCTOOL */
/* ---------- END PROBLEMATIC SAVEFILE HANDLING ----------- */ /* ---------- END PROBLEMATIC SAVEFILE HANDLING ----------- */
/* ---------- BEGIN EXTERNAL CONVERSION HANDLING ----------- */
static boolean cvtinit = FALSE;
#ifndef SFCTOOL
static char *unconverted_filename = 0, *converted_filename = 0;
/*
* Returns non-zero if unconvert was successful
*/
staticfn int
doconvert_file(const char *filename, int sfstatus, boolean unconvert)
{
nhUse(sfstatus);
nhUse(unconvert);
return 1;
}
/* convert file */
void nh_sfconvert(const char *filename)
{
(void) doconvert_file(filename, 0, FALSE);
}
/* unconvert file if it exists */
void nh_sfunconvert(const char *filename)
{
(void) doconvert_file(filename, 0, TRUE);
}
#else /* !SFCTOOL */
/* in sfctool, these are in sfctool.c, not in here */
extern char *unconverted_filename, *converted_filename;
#endif /* !SFCTOOL */
staticfn boolean
make_converted_name(const char *filename)
{
unsigned ln;
const char *xtra, *finaldirchar;
const char *dir = NULL;
boolean needsep = FALSE;
#if defined(WIN32)
static char folderbuf[MAX_PATH];
#endif
if (!filename)
return FALSE;
if (unconverted_filename)
free((genericptr_t) unconverted_filename), unconverted_filename = 0;
if (converted_filename)
free((genericptr_t) converted_filename), converted_filename = 0;
#ifndef SHORT_FILENAMES
/* do we need to do some ms-dos processing here? */
#endif /* SHORT_FILENAMES */
ln = (unsigned) strlen(filename);
if (!contains_directory(filename)) {
#if defined(UNIX)
dir = nh_getenv("NETHACKDIR");
if (!dir)
dir = nh_getenv("HACKDIR");
#ifdef HACKDIR
if (!dir)
dir = HACKDIR;
#endif
#elif defined(WIN32)
if (get_user_home_folder(folderbuf, sizeof folderbuf)) {
size_t sz = strlen(folderbuf);
Snprintf(eos(folderbuf), sizeof folderbuf - sz,
"\\AppData\\Local\\NetHack\\3.7\\");
dir = (const char *) folderbuf;
}
#endif /* UNIX || WIN32 */
if (dir) {
finaldirchar = c_eos(dir);
finaldirchar--;
if (!(*finaldirchar == '/' || *finaldirchar == '\\'
|| *finaldirchar == ':')) {
needsep = TRUE;
ln += 1;
}
ln += strlen(dir);
}
}
unconverted_filename = (char *) alloc(ln + 1);
Snprintf(unconverted_filename, ln + 1, "%s%s%s",
dir ? dir : "",
(dir && needsep) ? "/" : "",
filename);
xtra = ".exportascii";
ln += (unsigned) strlen(xtra);
converted_filename = (char *) alloc(ln + 1);
Strcpy(converted_filename, unconverted_filename);
Strcat(converted_filename, xtra);
return TRUE;
}
/* delete converted savefile as a normal course of action */
int
delete_convertedfile(const char *basefilename)
{
if (!converted_filename)
make_converted_name(basefilename);
if (converted_filename) {
(void) unlink(converted_filename);
}
return 0;
}
void free_convert_filenames(void)
{
if (converted_filename)
free((genericptr_t) converted_filename), converted_filename = 0;
if (unconverted_filename)
free((genericptr_t) unconverted_filename), unconverted_filename = 0;
cvtinit = FALSE;
}
/* return TRUE if s contains a directory, not just a filespec */
boolean
contains_directory(const char *s)
{
int i, slen = strlen(s);
const char *cp = s;
for (i = 0; i < slen; ++i) {
if (*cp == '\\' || *cp == '/' || *cp == ':')
return TRUE;
cp++;
}
return FALSE;
}
/* =========================================================================*/
/* ---------- END EXTERNAL CONVERSION HANDLING ----------- */
/* ---------- BEGIN FILE LOCKING HANDLING ----------- */ /* ---------- BEGIN FILE LOCKING HANDLING ----------- */
#ifndef SFCTOOL
#if defined(NO_FILE_LINKS) || defined(USE_FCNTL) /* implies UNIX */ #if defined(NO_FILE_LINKS) || defined(USE_FCNTL) /* implies UNIX */
static int lockfd = -1; /* for lock_file() to pass to unlock_file() */ static int lockfd = -1; /* for lock_file() to pass to unlock_file() */
#endif #endif
@@ -2802,6 +3043,7 @@ do_deferred_showpaths(int code)
#endif #endif
#endif #endif
} }
#endif /* !SFCTOOL */
#ifdef DEBUG #ifdef DEBUG
/* used by debugpline() to decide whether to issue a message /* used by debugpline() to decide whether to issue a message
@@ -2856,6 +3098,7 @@ debugcore(const char *filename, boolean wildcards)
#endif /*DEBUG*/ #endif /*DEBUG*/
#ifndef SFCTOOL
#ifdef UNIX #ifdef UNIX
#ifndef PATH_MAX #ifndef PATH_MAX
#include <limits.h> #include <limits.h>
@@ -3346,6 +3589,8 @@ Death_quote(char *buf, int bufsz)
} }
/* ---------- END TRIBUTE ----------- */ /* ---------- END TRIBUTE ----------- */
#endif /* !SFCTOOL */
#ifdef LIVELOG #ifdef LIVELOG
#define LLOG_SEP "\t" /* livelog field separator, as a string literal */ #define LLOG_SEP "\t" /* livelog field separator, as a string literal */
#define LLOG_EOL "\n" /* end-of-line, for abstraction consistency */ #define LLOG_EOL "\n" /* end-of-line, for abstraction consistency */
+4 -1
View File
@@ -42,6 +42,7 @@
#define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */ #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */
#define LSF_IS_PROBLEMATIC 0x4 /* impossible situation encountered */ #define LSF_IS_PROBLEMATIC 0x4 /* impossible situation encountered */
#ifndef SFCTOOL
staticfn light_source *new_light_core(coordxy, coordxy, staticfn light_source *new_light_core(coordxy, coordxy,
int, int, anything *) NONNULLPTRS; int, int, anything *) NONNULLPTRS;
staticfn void delete_ls(light_source *); staticfn void delete_ls(light_source *);
@@ -468,6 +469,7 @@ save_light_sources(NHFILE *nhfp, int range)
} }
} }
} }
#endif /* !SFCTOOL */
/* /*
* Pull in the structures from disk, but don't recalculate the object * Pull in the structures from disk, but don't recalculate the object
@@ -490,6 +492,7 @@ restore_light_sources(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
@@ -970,7 +973,7 @@ wiz_light_sources(void)
return ECMD_OK; return ECMD_OK;
} }
#endif /* !SFCTOOL */
/* for 'onefile' processing where end of this file isn't necessarily the /* for 'onefile' processing where end of this file isn't necessarily the
end of the source code seen by the compiler */ end of the source code seen by the compiler */
#undef LSF_SHOW #undef LSF_SHOW
+9 -2
View File
@@ -61,7 +61,10 @@ char *version_id_string(char *, size_t, const char *) NONNULL NONNULLPTRS;
char *bannerc_string(char *, size_t, const char *) NONNULL NONNULLPTRS; char *bannerc_string(char *, size_t, const char *) NONNULL NONNULLPTRS;
int case_insensitive_comp(const char *, const char *) NONNULLPTRS; int case_insensitive_comp(const char *, const char *) NONNULLPTRS;
staticfn void make_version(void); #ifndef SFCTOOL
staticfn
#endif /* SFCTOOL */
void make_version(void);
#ifndef HAS_NO_MKSTEMP #ifndef HAS_NO_MKSTEMP
#ifdef _MSC_VER #ifdef _MSC_VER
@@ -234,10 +237,14 @@ md_ignored_features(void)
{ {
return (0UL return (0UL
| (1UL << 19) /* SCORE_ON_BOTL */ | (1UL << 19) /* SCORE_ON_BOTL */
| SFCTOOL_BIT /* stored by SFCTOOL, not NetHack itself */
); );
} }
staticfn void #ifndef SFCTOOL
staticfn
#endif
void
make_version(void) make_version(void)
{ {
int i; int i;
+13
View File
@@ -6,6 +6,7 @@
#include "hack.h" #include "hack.h"
#include "sp_lev.h" #include "sp_lev.h"
#ifndef SFCTOOL
staticfn int iswall(coordxy, coordxy); staticfn int iswall(coordxy, coordxy);
staticfn int iswall_or_stone(coordxy, coordxy); staticfn int iswall_or_stone(coordxy, coordxy);
staticfn boolean is_solid(coordxy, coordxy); staticfn boolean is_solid(coordxy, coordxy);
@@ -1736,6 +1737,7 @@ save_waterlevel(NHFILE *nhfp)
if (release_data(nhfp)) if (release_data(nhfp))
unsetup_waterlevel(); unsetup_waterlevel();
} }
#endif /* !SFCTOOL */
/* restoring air bubbles on Plane of Water or clouds on Plane of Air */ /* restoring air bubbles on Plane of Water or clouds on Plane of Air */
void void
@@ -1744,6 +1746,11 @@ restore_waterlevel(NHFILE *nhfp)
struct bubble *b = (struct bubble *) 0, *btmp; struct bubble *b = (struct bubble *) 0, *btmp;
int i, n = 0; int i, n = 0;
#ifdef SFCTOOL
svb.bbubbles = (struct bubble *) 0;
/* set_wportal(); */
#endif
Sfi_int(nhfp, &n, "waterlevel-bubble_count"); Sfi_int(nhfp, &n, "waterlevel-bubble_count");
Sfi_int(nhfp, &svx.xmin, "waterlevel-xmin"); Sfi_int(nhfp, &svx.xmin, "waterlevel-xmin");
Sfi_int(nhfp, &svy.ymin, "waterlevel-ymin"); Sfi_int(nhfp, &svy.ymin, "waterlevel-ymin");
@@ -1760,8 +1767,11 @@ restore_waterlevel(NHFILE *nhfp)
svb.bbubbles = b; svb.bbubbles = b;
b->prev = (struct bubble *) 0; b->prev = (struct bubble *) 0;
} }
#ifndef SFCTOOL
mv_bubble(b, 0, 0, TRUE); mv_bubble(b, 0, 0, TRUE);
#endif
} }
#ifndef SFCTOOL
ge.ebubbles = b; ge.ebubbles = b;
if (b) { if (b) {
b->next = (struct bubble *) 0; b->next = (struct bubble *) 0;
@@ -1778,8 +1788,10 @@ restore_waterlevel(NHFILE *nhfp)
: "air bubbles or clouds"); : "air bubbles or clouds");
program_state.something_worth_saving = 1; program_state.something_worth_saving = 1;
} }
#endif
} }
#ifndef SFCTOOL
staticfn void staticfn void
set_wportal(void) set_wportal(void)
{ {
@@ -2087,5 +2099,6 @@ mv_bubble(struct bubble *b, coordxy dx, coordxy dy, boolean ini)
} }
} }
} }
#endif /* !SFCTOOL */
/*mkmaze.c*/ /*mkmaze.c*/
+6
View File
@@ -17,6 +17,7 @@
#include "hack.h" #include "hack.h"
#ifndef SFCTOOL
staticfn boolean isbig(struct mkroom *); staticfn boolean isbig(struct mkroom *);
staticfn struct mkroom *pick_room(boolean); staticfn struct mkroom *pick_room(boolean);
staticfn void mkshop(void), mkzoo(int), mkswamp(void); staticfn void mkshop(void), mkzoo(int), mkswamp(void);
@@ -25,10 +26,12 @@ staticfn void mktemple(void);
staticfn coord *shrine_pos(int); staticfn coord *shrine_pos(int);
staticfn struct permonst *morguemon(void); staticfn struct permonst *morguemon(void);
staticfn struct permonst *squadmon(void); staticfn struct permonst *squadmon(void);
#endif /* SFCTOOL */
staticfn void save_room(NHFILE *, struct mkroom *); staticfn void save_room(NHFILE *, struct mkroom *);
staticfn void rest_room(NHFILE *, struct mkroom *); staticfn void rest_room(NHFILE *, struct mkroom *);
#ifndef SFCTOOL
staticfn boolean invalid_shop_shape(struct mkroom *sroom); staticfn boolean invalid_shop_shape(struct mkroom *sroom);
#define sq(x) ((x) * (x)) #define sq(x) ((x) * (x))
@@ -866,6 +869,7 @@ save_rooms(NHFILE *nhfp)
for (i = 0; i < svn.nroom; i++) for (i = 0; i < svn.nroom; i++)
save_room(nhfp, &svr.rooms[i]); save_room(nhfp, &svr.rooms[i]);
} }
#endif /* !SFCTOOL */
staticfn void staticfn void
rest_room(NHFILE *nhfp, struct mkroom *r) rest_room(NHFILE *nhfp, struct mkroom *r)
@@ -901,6 +905,7 @@ rest_rooms(NHFILE *nhfp)
gs.subrooms[gn.nsubroom].hx = -1; gs.subrooms[gn.nsubroom].hx = -1;
} }
#ifndef SFCTOOL
/* convert a display symbol for terrain into topology type; /* convert a display symbol for terrain into topology type;
used for remembered terrain when mimics pose as furniture */ used for remembered terrain when mimics pose as furniture */
int int
@@ -1089,5 +1094,6 @@ invalid_shop_shape(struct mkroom *sroom)
} }
return FALSE; return FALSE;
} }
#endif /* !SFCTOOL */
/*mkroom.c*/ /*mkroom.c*/
+22 -2
View File
@@ -25,6 +25,7 @@
struct e; struct e;
#ifndef SFCTOOL
/* lua_CFunction prototypes */ /* lua_CFunction prototypes */
#ifdef DUMPLOG #ifdef DUMPLOG
staticfn int nhl_dump_fmtstr(lua_State *); staticfn int nhl_dump_fmtstr(lua_State *);
@@ -91,7 +92,9 @@ staticfn void nhl_warn(void *, const char *, int);
staticfn void nhl_clearfromtable(lua_State *, int, int, struct e *); staticfn void nhl_clearfromtable(lua_State *, int, int, struct e *);
staticfn int nhl_panic(lua_State *); staticfn int nhl_panic(lua_State *);
staticfn void nhl_hookfn(lua_State *, lua_Debug *); staticfn void nhl_hookfn(lua_State *, lua_Debug *);
#endif /* !SFCTOOL */
#ifndef SFCTOOL
static const char *const nhcore_call_names[NUM_NHCORE_CALLS] = { static const char *const nhcore_call_names[NUM_NHCORE_CALLS] = {
"start_new_game", "start_new_game",
"restore_old_game", "restore_old_game",
@@ -102,6 +105,7 @@ static const char *const nhcore_call_names[NUM_NHCORE_CALLS] = {
"leave_tutorial", "leave_tutorial",
}; };
static boolean nhcore_call_available[NUM_NHCORE_CALLS]; static boolean nhcore_call_available[NUM_NHCORE_CALLS];
#endif
/* internal structure that hangs off L->ud (but use lua_getallocf() ) /* internal structure that hangs off L->ud (but use lua_getallocf() )
* Note that we use it for both memory use tracking and instruction counting. * Note that we use it for both memory use tracking and instruction counting.
@@ -126,6 +130,7 @@ typedef struct nhl_user_data {
#endif #endif
} nhl_user_data; } nhl_user_data;
#ifndef SFCTOOL
static lua_State *luapat; /* instance for file pattern matching */ static lua_State *luapat; /* instance for file pattern matching */
void void
@@ -1264,20 +1269,26 @@ get_nh_lua_variables(void)
RESTORE_WARNING_UNREACHABLE_CODE RESTORE_WARNING_UNREACHABLE_CODE
/* char *lua_data; */ #endif /* !SFCTOOL */
#ifdef SFCTOOL
char *lua_data;
#endif
/* save nh_lua_variables table to file */ /* save nh_lua_variables table to file */
void void
save_luadata(NHFILE *nhfp) save_luadata(NHFILE *nhfp)
{ {
unsigned lua_data_len; unsigned lua_data_len;
#ifndef SFCTOOL
char *lua_data = get_nh_lua_variables(); /* note: '\0' terminated */ char *lua_data = get_nh_lua_variables(); /* note: '\0' terminated */
#endif
if (!lua_data) if (!lua_data)
lua_data = dupstr(emptystr); lua_data = dupstr(emptystr);
lua_data_len = Strlen(lua_data) + 1; /* +1: include the terminator */ lua_data_len = Strlen(lua_data) + 1; /* +1: include the terminator */
Sfo_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len"); Sfo_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len");
Sfo_char(nhfp, lua_data, "lua_data", lua_data_len); Sfo_char(nhfp, lua_data, "luadata", lua_data_len);
free(lua_data); free(lua_data);
} }
@@ -1286,18 +1297,25 @@ void
restore_luadata(NHFILE *nhfp) restore_luadata(NHFILE *nhfp)
{ {
unsigned lua_data_len = 0; unsigned lua_data_len = 0;
#ifndef SFCTOOL
char *lua_data; char *lua_data;
#endif /* !SFCTOOL */
Sfi_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len"); Sfi_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len");
lua_data = (char *) alloc(lua_data_len); lua_data = (char *) alloc(lua_data_len);
Sfi_char(nhfp, lua_data, "luadata", lua_data_len); Sfi_char(nhfp, lua_data, "luadata", lua_data_len);
#ifndef SFCTOOL
if (!gl.luacore) if (!gl.luacore)
l_nhcore_init(); l_nhcore_init();
luaL_loadstring(gl.luacore, lua_data); luaL_loadstring(gl.luacore, lua_data);
free(lua_data); free(lua_data);
nhl_pcall_handle(gl.luacore, 0, 0, "restore_luadata", NHLpa_panic); nhl_pcall_handle(gl.luacore, 0, 0, "restore_luadata", NHLpa_panic);
#endif /* !SFCTOOL */
} }
#ifndef SFCTOOL
/* local stairs = stairways(); */ /* local stairs = stairways(); */
staticfn int staticfn int
nhl_stairways(lua_State *L) nhl_stairways(lua_State *L)
@@ -2977,6 +2995,8 @@ nhlL_newstate(nhl_sandbox_info *sbi, const char *name)
return L; return L;
} }
#endif /* !SFCTOOL */
/* /*
(See end of comment for conclusion.) (See end of comment for conclusion.)
to make packages safe, we need something like: to make packages safe, we need something like:
+9
View File
@@ -5,6 +5,7 @@
#include "hack.h" #include "hack.h"
#ifndef SFCTOOL
staticfn void setgemprobs(d_level *); staticfn void setgemprobs(d_level *);
staticfn void randomize_gem_colors(void); staticfn void randomize_gem_colors(void);
staticfn void shuffle(int, int, boolean); staticfn void shuffle(int, int, boolean);
@@ -403,6 +404,7 @@ savenames(NHFILE *nhfp)
} }
} }
} }
#endif /* !SFCTOOL */
void void
restnames(NHFILE *nhfp) restnames(NHFILE *nhfp)
@@ -426,11 +428,14 @@ restnames(NHFILE *nhfp)
Sfi_char(nhfp, objects[i].oc_uname, "names-oc_uname", (int) len); Sfi_char(nhfp, objects[i].oc_uname, "names-oc_uname", (int) len);
} }
} }
#ifndef SFCTOOL
#ifdef TILES_IN_GLYPHMAP #ifdef TILES_IN_GLYPHMAP
shuffle_tiles(); shuffle_tiles();
#endif #endif
#endif
} }
#ifndef SFCTOOL
void void
discover_object( discover_object(
int oindx, int oindx,
@@ -562,6 +567,7 @@ sortloot_descr(int otyp, char *outbuf)
sl_cookie.orderclass, sl_cookie.subclass, sl_cookie.disco); sl_cookie.orderclass, sl_cookie.subclass, sl_cookie.disco);
return outbuf; return outbuf;
} }
#endif /* !SFCTOOL */
#define DISCO_BYCLASS 0 /* by discovery order within each class */ #define DISCO_BYCLASS 0 /* by discovery order within each class */
#define DISCO_SORTLOOT 1 /* by discovery order within each subclass */ #define DISCO_SORTLOOT 1 /* by discovery order within each subclass */
@@ -577,6 +583,8 @@ static const char *const disco_orders_descr[] = {
(char *) 0 (char *) 0
}; };
#ifndef SFCTOOL
int int
choose_disco_sort( choose_disco_sort(
int mode) /* 0 => 'O' cmd, 1 => full discoveries; 2 => class disco */ int mode) /* 0 => 'O' cmd, 1 => full discoveries; 2 => class disco */
@@ -1110,6 +1118,7 @@ rename_disco(void)
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
return; return;
} }
#endif /* !SFCTOOL */
void void
get_sortdisco(char *opts, boolean cnf) get_sortdisco(char *opts, boolean cnf)
+10
View File
@@ -13,6 +13,7 @@
#define NO_CALLBACK (-1) #define NO_CALLBACK (-1)
void free_region(NhRegion *); void free_region(NhRegion *);
#ifndef SFCTOOL
boolean inside_gas_cloud(genericptr, genericptr); boolean inside_gas_cloud(genericptr, genericptr);
boolean expire_gas_cloud(genericptr, genericptr); boolean expire_gas_cloud(genericptr, genericptr);
boolean inside_rect(NhRect *, int, int); boolean inside_rect(NhRect *, int, int);
@@ -253,6 +254,7 @@ clone_region(NhRegion *reg)
} }
#endif /*0*/ #endif /*0*/
#endif /* !SFCTOOL */
/* /*
* Free mem from region. * Free mem from region.
@@ -273,6 +275,7 @@ free_region(NhRegion *reg)
} }
} }
#ifndef SFCTOOL
/* /*
* Add a region to the list. * Add a region to the list.
* This actually activates the region. * This actually activates the region.
@@ -381,6 +384,7 @@ remove_region(NhRegion *reg)
} }
free_region(reg); free_region(reg);
} }
#endif /* !SFCTOOL */
/* /*
* Remove all regions and clear all related data. This must be done * Remove all regions and clear all related data. This must be done
@@ -400,6 +404,7 @@ clear_regions(void)
gr.regions = (NhRegion **) 0; gr.regions = (NhRegion **) 0;
} }
#ifndef SFCTOOL
/* /*
* This function is called every turn. * This function is called every turn.
* It makes the regions age, if necessary and calls the appropriate * It makes the regions age, if necessary and calls the appropriate
@@ -788,6 +793,7 @@ save_regions(NHFILE *nhfp)
if (release_data(nhfp)) if (release_data(nhfp))
clear_regions(); clear_regions();
} }
#endif /* !SFCTOOL */
void void
rest_regions(NHFILE *nhfp) rest_regions(NHFILE *nhfp)
@@ -872,6 +878,7 @@ rest_regions(NHFILE *nhfp)
Sfi_int(nhfp, &r->glyph, "region-glyph"); Sfi_int(nhfp, &r->glyph, "region-glyph");
Sfi_any(nhfp, &r->arg, "region-arg"); Sfi_any(nhfp, &r->arg, "region-arg");
} }
#ifndef SFCTOOL
/* remove expired regions, do not trigger the expire_f callback (yet!); /* remove expired regions, do not trigger the expire_f callback (yet!);
also update monster lists if this data is coming from a bones file */ also update monster lists if this data is coming from a bones file */
for (i = svn.n_regions - 1; i >= 0; i--) { for (i = svn.n_regions - 1; i >= 0; i--) {
@@ -881,8 +888,10 @@ rest_regions(NHFILE *nhfp)
else if (ghostly && r->n_monst > 0) else if (ghostly && r->n_monst > 0)
reset_region_mids(r); reset_region_mids(r);
} }
#endif /* !SFCTOOL */
} }
#ifndef SFCTOOL
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
/* to support '#stats' wizard-mode command */ /* to support '#stats' wizard-mode command */
@@ -1394,5 +1403,6 @@ region_safety(void)
if (BlindedTimeout == 1L) if (BlindedTimeout == 1L)
make_blinded(0L, TRUE); make_blinded(0L, TRUE);
} }
#endif /* !SFCTOOL */
/*region.c*/ /*region.c*/
+125 -14
View File
@@ -22,6 +22,7 @@ staticfn struct fruit *loadfruitchn(NHFILE *);
staticfn void freefruitchn(struct fruit *); staticfn void freefruitchn(struct fruit *);
staticfn void rest_levl(NHFILE *); staticfn void rest_levl(NHFILE *);
staticfn void rest_stairs(NHFILE *); staticfn void rest_stairs(NHFILE *);
#ifndef SFCTOOL
staticfn void ghostfruit(struct obj *); staticfn void ghostfruit(struct obj *);
staticfn boolean restgamestate(NHFILE *); staticfn boolean restgamestate(NHFILE *);
staticfn void restlevelstate(void); staticfn void restlevelstate(void);
@@ -29,10 +30,12 @@ staticfn int restlevelfile(xint8);
staticfn void rest_bubbles(NHFILE *); staticfn void rest_bubbles(NHFILE *);
staticfn void restore_gamelog(NHFILE *); staticfn void restore_gamelog(NHFILE *);
staticfn void reset_oattached_mids(boolean); staticfn void reset_oattached_mids(boolean);
/* these ones are declared non-static in extern.h if SFCTOOL is defined */
staticfn boolean restgamestate(NHFILE *); staticfn boolean restgamestate(NHFILE *);
staticfn void rest_bubbles(NHFILE *); staticfn void rest_bubbles(NHFILE *);
staticfn void restore_gamelog(NHFILE *); staticfn void restore_gamelog(NHFILE *);
staticfn void restore_msghistory(NHFILE *); staticfn void restore_msghistory(NHFILE *);
#endif
/* /*
* Save a mapping of IDs from ghost levels to the current level. This * Save a mapping of IDs from ghost levels to the current level. This
@@ -47,8 +50,10 @@ struct bucket {
} map[N_PER_BUCKET]; } map[N_PER_BUCKET];
}; };
#ifndef SFCTOOL
staticfn void clear_id_mapping(void); staticfn void clear_id_mapping(void);
staticfn void add_id_mapping(unsigned, unsigned); staticfn void add_id_mapping(unsigned, unsigned);
#endif /* SFCTOOL */
#ifdef AMII_GRAPHICS #ifdef AMII_GRAPHICS
void amii_setpens(int); /* use colors from save file */ void amii_setpens(int); /* use colors from save file */
@@ -59,6 +64,7 @@ extern int amii_numcolors;
#define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE) #define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE)
#ifndef SFCTOOL
/* Recalculate svl.level.objects[x][y], since this info was not saved. */ /* Recalculate svl.level.objects[x][y], since this info was not saved. */
staticfn void staticfn void
@@ -118,6 +124,8 @@ inven_inuse(boolean quietly)
} }
} }
#endif /* SFCTOOL */
staticfn void staticfn void
restlevchn(NHFILE *nhfp) restlevchn(NHFILE *nhfp)
{ {
@@ -147,7 +155,9 @@ restdamage(NHFILE *nhfp)
unsigned int dmgcount = 0; unsigned int dmgcount = 0;
int counter; int counter;
struct damage *tmp_dam; struct damage *tmp_dam;
#ifndef SFCTOOL
boolean ghostly = (nhfp->ftype == NHF_BONESFILE); boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
#endif
Sfi_unsigned(nhfp, &dmgcount, "damage-damage_count"); Sfi_unsigned(nhfp, &dmgcount, "damage-damage_count");
counter = (int) dmgcount; counter = (int) dmgcount;
@@ -158,11 +168,13 @@ restdamage(NHFILE *nhfp)
tmp_dam = (struct damage *) alloc(sizeof *tmp_dam); tmp_dam = (struct damage *) alloc(sizeof *tmp_dam);
Sfi_damage(nhfp, tmp_dam, "damage"); Sfi_damage(nhfp, tmp_dam, "damage");
#ifndef SFCTOOL
if (ghostly) if (ghostly)
tmp_dam->when += (svm.moves - svo.omoves); tmp_dam->when += (svm.moves - svo.omoves);
tmp_dam->next = svl.level.damagelist; tmp_dam->next = svl.level.damagelist;
svl.level.damagelist = tmp_dam; svl.level.damagelist = tmp_dam;
#endif /* !SFCTOOL */
} while (--counter > 0); } while (--counter > 0);
} }
@@ -199,7 +211,7 @@ restobj(NHFILE *nhfp, struct obj *otmp)
} }
/* omailcmd - feedback mechanism for scroll of mail */ /* omailcmd - feedback mechanism for scroll of mail */
Sfi_int(nhfp, &buflen, "obj-omail_length"); Sfi_int(nhfp, &buflen, "obj-omailcmd_length");
if (buflen > 0) { if (buflen > 0) {
char *omailcmd = (char *) alloc(buflen); char *omailcmd = (char *) alloc(buflen);
@@ -210,7 +222,7 @@ restobj(NHFILE *nhfp, struct obj *otmp)
/* omid - monster id number, connecting corpse to ghost */ /* omid - monster id number, connecting corpse to ghost */
newomid(otmp); /* superfluous; we're already allocated otmp->oextra */ newomid(otmp); /* superfluous; we're already allocated otmp->oextra */
Sfi_unsigned(nhfp, &omid, "obj-omid_length"); Sfi_unsigned(nhfp, &omid, "obj-omid");
OMID(otmp) = omid; OMID(otmp) = omid;
} }
} }
@@ -221,10 +233,15 @@ restobjchn(NHFILE *nhfp, boolean frozen)
struct obj *otmp, *otmp2 = 0; struct obj *otmp, *otmp2 = 0;
struct obj *first = (struct obj *) 0; struct obj *first = (struct obj *) 0;
int buflen = 0; int buflen = 0;
#ifndef SFCTOOL
boolean ghostly = (nhfp->ftype == NHF_BONESFILE); boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
#endif
boolean trouble = FALSE;
while (1) { while (1) {
Sfi_int(nhfp, &buflen, "obj-obj_length"); Sfi_int(nhfp, &buflen, "obj-obj_length");
if (!(buflen != -1 || buflen != sizeof (struct obj)))
trouble = TRUE;
if (buflen == -1) if (buflen == -1)
break; break;
@@ -236,6 +253,7 @@ restobjchn(NHFILE *nhfp, boolean frozen)
else else
otmp2->nobj = otmp; otmp2->nobj = otmp;
#ifndef SFCTOOL
if (ghostly) { if (ghostly) {
unsigned nid = next_ident(); unsigned nid = next_ident();
@@ -250,6 +268,7 @@ restobjchn(NHFILE *nhfp, boolean frozen)
*/ */
if (ghostly && !frozen && !age_is_relative(otmp)) if (ghostly && !frozen && !age_is_relative(otmp))
otmp->age = svm.moves - svo.omoves + otmp->age; otmp->age = svm.moves - svo.omoves + otmp->age;
#endif /* !SFCTOOL */
/* get contents of a container or statue */ /* get contents of a container or statue */
if (Has_contents(otmp)) { if (Has_contents(otmp)) {
@@ -261,6 +280,7 @@ restobjchn(NHFILE *nhfp, boolean frozen)
otmp3->ocontainer = otmp; otmp3->ocontainer = otmp;
} }
#ifndef SFCTOOL
if (otmp->bypass) if (otmp->bypass)
otmp->bypass = 0; otmp->bypass = 0;
if (!ghostly) { if (!ghostly) {
@@ -272,12 +292,17 @@ restobjchn(NHFILE *nhfp, boolean frozen)
if (otmp->o_id == svc.context.spbook.o_id) if (otmp->o_id == svc.context.spbook.o_id)
svc.context.spbook.book = otmp; svc.context.spbook.book = otmp;
} }
#endif /* !SFADUSTER */
otmp2 = otmp; otmp2 = otmp;
} }
if (first && otmp2->nobj) { if (first && otmp2->nobj) {
impossible("Restobjchn: error reading objchn."); impossible("Restobjchn: error reading objchn.");
otmp2->nobj = 0; otmp2->nobj = 0;
} }
#ifdef SFCTOOL
nhUse(frozen);
#endif
nhUse(trouble);
return first; return first;
} }
@@ -353,8 +378,11 @@ restmonchn(NHFILE *nhfp)
{ {
struct monst *mtmp, *mtmp2 = 0; struct monst *mtmp, *mtmp2 = 0;
struct monst *first = (struct monst *) 0; struct monst *first = (struct monst *) 0;
int offset, buflen = 0; int buflen = 0;
#ifndef SFCTOOL
int offset;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE); boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
#endif
while (1) { while (1) {
Sfi_int(nhfp, &buflen, "monst-monst_length"); Sfi_int(nhfp, &buflen, "monst-monst_length");
@@ -369,6 +397,7 @@ restmonchn(NHFILE *nhfp)
else else
mtmp2->nmon = mtmp; mtmp2->nmon = mtmp;
#ifndef SFCTOOL
if (ghostly) { if (ghostly) {
unsigned nid = next_ident(); unsigned nid = next_ident();
@@ -386,13 +415,21 @@ restmonchn(NHFILE *nhfp)
mtmp->mhpmax = DEFUNCT_MONSTER; mtmp->mhpmax = DEFUNCT_MONSTER;
} }
} }
#endif /* !SFCTOOL */
if (mtmp->minvent) { if (mtmp->minvent) {
struct obj *obj; struct obj *obj;
mtmp->minvent = restobjchn(nhfp, FALSE); mtmp->minvent = restobjchn(nhfp, FALSE);
#ifndef SFCTOOL
/* restore monster back pointer */ /* restore monster back pointer */
for (obj = mtmp->minvent; obj; obj = obj->nobj) for (obj = mtmp->minvent; obj; obj = obj->nobj)
obj->ocarry = mtmp; obj->ocarry = mtmp;
#else
nhUse(obj);
#endif
} }
#ifndef SFCTOOL
if (mtmp->mw) { if (mtmp->mw) {
struct obj *obj; struct obj *obj;
@@ -416,12 +453,15 @@ restmonchn(NHFILE *nhfp)
if (mtmp->m_id == svc.context.polearm.m_id) if (mtmp->m_id == svc.context.polearm.m_id)
svc.context.polearm.hitmon = mtmp; svc.context.polearm.hitmon = mtmp;
} }
#endif /* !SFCTOOL */
mtmp2 = mtmp; mtmp2 = mtmp;
} }
#ifndef SFCTOOL
if (first && mtmp2->nmon) { if (first && mtmp2->nmon) {
impossible("Restmonchn: error reading monchn."); impossible("Restmonchn: error reading monchn.");
mtmp2->nmon = 0; mtmp2->nmon = 0;
} }
#endif
return first; return first;
} }
@@ -456,6 +496,7 @@ freefruitchn(struct fruit *flist)
} }
} }
#ifndef SFCTOOL
staticfn void staticfn void
ghostfruit(struct obj *otmp) ghostfruit(struct obj *otmp)
{ {
@@ -470,6 +511,7 @@ ghostfruit(struct obj *otmp)
else else
otmp->spe = fruitadd(oldf->fname, (struct fruit *) 0); otmp->spe = fruitadd(oldf->fname, (struct fruit *) 0);
} }
#endif /* !SFCTOOL */
#ifdef SYSCF #ifdef SYSCF
#define SYSOPT_CHECK_SAVE_UID sysopt.check_save_uid #define SYSOPT_CHECK_SAVE_UID sysopt.check_save_uid
@@ -477,7 +519,10 @@ ghostfruit(struct obj *otmp)
#define SYSOPT_CHECK_SAVE_UID TRUE #define SYSOPT_CHECK_SAVE_UID TRUE
#endif #endif
staticfn boolean #ifndef SFCTOOL
staticfn
#endif
boolean
restgamestate(NHFILE *nhfp) restgamestate(NHFILE *nhfp)
{ {
int i; int i;
@@ -486,15 +531,18 @@ restgamestate(NHFILE *nhfp)
struct obj *bc_obj; struct obj *bc_obj;
char timebuf[15]; char timebuf[15];
unsigned long uid = 0; unsigned long uid = 0;
#ifndef SFCTOOL
boolean defer_perm_invent, restoring_special; boolean defer_perm_invent, restoring_special;
struct obj *otmp; struct obj *otmp;
#endif
Sfi_ulong(nhfp, &uid, "gamestate-uid"); Sfi_ulong(nhfp, &uid, "gamestate-uid");
#ifndef SFCTOOL
if (SYSOPT_CHECK_SAVE_UID if (SYSOPT_CHECK_SAVE_UID
&& uid != (unsigned long) getuid()) { /* strange ... */ && uid != (unsigned long) getuid()) { /* strange ... */
if (!gc.converted_savefile_loaded) if (!gc.converted_savefile_loaded)
/* for wizard mode, issue a reminder; for others, treat it /* for wizard mode, issue a reminder; for others, treat it
as an attempt to cheat and refuse to restore this file */ * as an attempt to cheat and refuse to restore this file */
pline("Saved game was not yours."); pline("Saved game was not yours.");
if (wizard || gc.converted_savefile_loaded) { if (wizard || gc.converted_savefile_loaded) {
if (gc.converted_savefile_loaded) if (gc.converted_savefile_loaded)
@@ -503,7 +551,7 @@ restgamestate(NHFILE *nhfp)
return FALSE; return FALSE;
} }
} }
#endif /* SFCTOOL */
newgamecontext = svc.context; /* copy statically init'd context */ newgamecontext = svc.context; /* copy statically init'd context */
Sfi_context_info(nhfp, &svc.context, "gamestate-context"); Sfi_context_info(nhfp, &svc.context, "gamestate-context");
svc.context.warntype.species = (ismnum(svc.context.warntype.speciesidx)) svc.context.warntype.species = (ismnum(svc.context.warntype.speciesidx))
@@ -519,6 +567,7 @@ restgamestate(NHFILE *nhfp)
newgameflags = flags; newgameflags = flags;
Sfi_flag(nhfp, &flags, "gamestate-flags"); Sfi_flag(nhfp, &flags, "gamestate-flags");
#ifndef SFCTOOL
/* avoid keeping permanent inventory window up to date during restore /* avoid keeping permanent inventory window up to date during restore
(setworn() calls update_inventory); attempting to include the cost (setworn() calls update_inventory); attempting to include the cost
of unpaid items before shopkeeper's bill is available is a no-no; of unpaid items before shopkeeper's bill is available is a no-no;
@@ -545,16 +594,18 @@ restgamestate(NHFILE *nhfp)
#ifdef AMII_GRAPHICS #ifdef AMII_GRAPHICS
amii_setpens(amii_numcolors); /* use colors from save file */ amii_setpens(amii_numcolors); /* use colors from save file */
#endif #endif
#endif /* !SFCTOOL */
Sfi_you(nhfp, &u, "gamestate-you"); Sfi_you(nhfp, &u, "gamestate-you");
gy.youmonst.cham = u.mcham; gy.youmonst.cham = u.mcham;
#ifndef SFCTOOL
if (restoring_special && iflags.explore_error_flag) { if (restoring_special && iflags.explore_error_flag) {
/* savefile has wizard or explore mode, but player is no longer /* savefile has wizard or explore mode, but player is no longer
authorized to access either; can't downgrade mode any further, so authorized to access either; can't downgrade mode any further, so
fail restoration. */ fail restoration. */
u.uhp = 0; u.uhp = 0;
} }
#endif
Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14); Sfi_char(nhfp, timebuf, "gamestate-ubirthday", 14);
timebuf[14] = '\0'; timebuf[14] = '\0';
@@ -562,6 +613,7 @@ restgamestate(NHFILE *nhfp)
Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime"); Sfi_long(nhfp, &urealtime.realtime, "gamestate-realtime");
Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14); Sfi_char(nhfp, timebuf, "gamestate-start_timing", 14);
timebuf[14] = '\0'; timebuf[14] = '\0';
#ifndef SFCTOOL
urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf); urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf);
/* current time is the time to use for next urealtime.realtime update */ /* current time is the time to use for next urealtime.realtime update */
@@ -590,6 +642,7 @@ restgamestate(NHFILE *nhfp)
} }
/* in case hangup save occurred in midst of level change */ /* in case hangup save occurred in midst of level change */
assign_level(&u.uz0, &u.uz); assign_level(&u.uz0, &u.uz);
#endif /* !SFCTOOL */
/* this stuff comes after potential aborted restore attempts */ /* this stuff comes after potential aborted restore attempts */
restore_killers(nhfp); restore_killers(nhfp);
@@ -600,7 +653,7 @@ restgamestate(NHFILE *nhfp)
/* restore dangling (not on floor or in inventory) ball and/or chain */ /* restore dangling (not on floor or in inventory) ball and/or chain */
bc_obj = restobjchn(nhfp, FALSE); bc_obj = restobjchn(nhfp, FALSE);
#ifndef SFCTOOL
while (bc_obj) { while (bc_obj) {
struct obj *nobj = bc_obj->nobj; struct obj *nobj = bc_obj->nobj;
@@ -609,13 +662,15 @@ restgamestate(NHFILE *nhfp)
setworn(bc_obj, bc_obj->owornmask); setworn(bc_obj, bc_obj->owornmask);
bc_obj = nobj; bc_obj = nobj;
} }
#endif
gm.migrating_objs = restobjchn(nhfp, FALSE); gm.migrating_objs = restobjchn(nhfp, FALSE);
gm.migrating_mons = restmonchn(nhfp); gm.migrating_mons = restmonchn(nhfp);
for (i = 0; i < NUMMONS; ++i) { for (i = 0; i < NUMMONS; ++i) {
Sfi_mvitals(nhfp, &svm.mvitals[i], "gamestate-mvitals"); Sfi_mvitals(nhfp, &svm.mvitals[i], "gamestate-mvitals");
} }
#ifndef SFCTOOL
/* /*
* There are some things after this that can have unintended display * There are some things after this that can have unintended display
* side-effects too early in the game. * side-effects too early in the game.
@@ -637,6 +692,7 @@ restgamestate(NHFILE *nhfp)
setuwep(otmp); /* (don't need any null check here) */ setuwep(otmp); /* (don't need any null check here) */
if (!uwep || uwep->otyp == PICK_AXE || uwep->otyp == GRAPPLING_HOOK) if (!uwep || uwep->otyp == PICK_AXE || uwep->otyp == GRAPPLING_HOOK)
gu.unweapon = TRUE; gu.unweapon = TRUE;
#endif /* !SFCTOOL */
restore_dungeon(nhfp); restore_dungeon(nhfp);
restlevchn(nhfp); restlevchn(nhfp);
@@ -660,15 +716,22 @@ restgamestate(NHFILE *nhfp)
restore_msghistory(nhfp); restore_msghistory(nhfp);
restore_gamelog(nhfp); restore_gamelog(nhfp);
restore_luadata(nhfp); restore_luadata(nhfp);
#ifndef SFCTOOL
/* must come after all mons & objs are restored */ /* must come after all mons & objs are restored */
relink_timers(FALSE); relink_timers(FALSE);
relink_light_sources(FALSE); relink_light_sources(FALSE);
adj_erinys(u.ualign.abuse); adj_erinys(u.ualign.abuse);
/* inventory display is now viable */ /* inventory display is now viable */
iflags.perm_invent = defer_perm_invent; iflags.perm_invent = defer_perm_invent;
#else
nhUse(bc_obj);
nhUse(newgamecontext);
nhUse(newgameflags);
#endif /* !SFCTOOL */
return TRUE; return TRUE;
} }
#ifndef SFCTOOL
/* update game state pointers to those valid for the current level (so we /* update game state pointers to those valid for the current level (so we
don't dereference a wild u.ustuck when saving game state, for instance) */ don't dereference a wild u.ustuck when saving game state, for instance) */
staticfn void staticfn void
@@ -886,15 +949,20 @@ dorecover(NHFILE *nhfp)
check_special_room(FALSE); check_special_room(FALSE);
return 1; return 1;
} }
#endif /* !SFCTOOL */
staticfn void staticfn void
rest_stairs(NHFILE *nhfp) rest_stairs(NHFILE *nhfp)
{ {
int buflen = 0; int buflen = 0;
stairway stway = UNDEFINED_VALUES; stairway stway = UNDEFINED_VALUES;
#ifndef SFCTOOL
stairway *newst; stairway *newst;
#endif
#ifndef SFCTOOL
stairway_free_all(); stairway_free_all();
#endif
while (1) { while (1) {
Sfi_int(nhfp, &buflen, "stairs-staircount"); Sfi_int(nhfp, &buflen, "stairs-staircount");
if (buflen == -1) if (buflen == -1)
@@ -906,11 +974,13 @@ rest_stairs(NHFILE *nhfp)
/* stairway dlevel is relative, make it absolute */ /* stairway dlevel is relative, make it absolute */
stway.tolev.dlevel += u.uz.dlevel; stway.tolev.dlevel += u.uz.dlevel;
} }
#ifndef SFCTOOL
stairway_add(stway.sx, stway.sy, stway.up, stway.isladder, stairway_add(stway.sx, stway.sy, stway.up, stway.isladder,
&(stway.tolev)); &(stway.tolev));
newst = stairway_at(stway.sx, stway.sy); newst = stairway_at(stway.sx, stway.sy);
if (newst) if (newst)
newst->u_traversed = stway.u_traversed; newst->u_traversed = stway.u_traversed;
#endif
} }
} }
@@ -932,7 +1002,8 @@ restcemetery(NHFILE *nhfp, struct cemetery **cemeteryaddr)
} else { } else {
*cemeteryaddr = 0; *cemeteryaddr = 0;
} }
if ((nhfp->mode & CONVERTING) != 0) { if (((nhfp->mode & CONVERTING) != 0)
|| ((nhfp->mode & UNCONVERTING) != 0)) {
struct cemetery *thisbones, *nextbones; struct cemetery *thisbones, *nextbones;
/* free the memory */ /* free the memory */
@@ -958,6 +1029,8 @@ rest_levl(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
void void
trickery(char *reason) trickery(char *reason)
{ {
@@ -967,14 +1040,17 @@ trickery(char *reason)
Strcpy(svk.killer.name, reason ? reason : ""); Strcpy(svk.killer.name, reason ? reason : "");
done(TRICKED); done(TRICKED);
} }
#endif /* !SFCTOOL */
void void
getlev(NHFILE *nhfp, int pid, xint8 lev) getlev(NHFILE *nhfp, int pid, xint8 lev)
{ {
struct trap *trap; struct trap *trap;
#ifndef SFCTOOL
struct monst *mtmp; struct monst *mtmp;
branch *br; branch *br;
int x, y; int x, y;
#endif
long elapsed = 0L; long elapsed = 0L;
int hpid = 0; int hpid = 0;
xint8 dlvl = 0; xint8 dlvl = 0;
@@ -986,9 +1062,11 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
#endif #endif
program_state.in_getlev = TRUE; program_state.in_getlev = TRUE;
#ifndef SFCTOOL
if (ghostly) if (ghostly)
clear_id_mapping(); clear_id_mapping();
#endif /* !SFCTOOL */
#if 0 #if 0
#if defined(MSDOS) || defined(OS2) #if defined(MSDOS) || defined(OS2)
@@ -1007,6 +1085,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
Sfi_int(nhfp, &hpid, "gamestate-hackpid"); Sfi_int(nhfp, &hpid, "gamestate-hackpid");
/* CHECK: This may prevent restoration */ /* CHECK: This may prevent restoration */
Sfi_xint8(nhfp, &dlvl, "gamestate-dlvl"); Sfi_xint8(nhfp, &dlvl, "gamestate-dlvl");
#ifndef SFCTOOL
if ((pid && pid != hpid) || (lev && dlvl != lev)) { if ((pid && pid != hpid) || (lev && dlvl != lev)) {
char trickbuf[BUFSZ]; char trickbuf[BUFSZ];
@@ -1019,6 +1098,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
pline1(trickbuf); pline1(trickbuf);
trickery(trickbuf); trickery(trickbuf);
} }
#endif
restcemetery(nhfp, &svl.level.bonesinfo); restcemetery(nhfp, &svl.level.bonesinfo);
rest_levl(nhfp); rest_levl(nhfp);
@@ -1051,10 +1131,14 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
} }
rest_rooms(nhfp); /* No joke :-) */ rest_rooms(nhfp); /* No joke :-) */
if (svn.nroom) { if (svn.nroom) {
#ifndef SFCTOOL
gd.doorindex = svr.rooms[svn.nroom - 1].fdoor gd.doorindex = svr.rooms[svn.nroom - 1].fdoor
+ svr.rooms[svn.nroom - 1].doorct; + svr.rooms[svn.nroom - 1].doorct;
} else { } else {
gd.doorindex = 0; gd.doorindex = 0;
#else
gd.doorindex = 0;
#endif /* !SFCTOOL */
} }
restore_timers(nhfp, RANGE_LEVEL, elapsed); restore_timers(nhfp, RANGE_LEVEL, elapsed);
@@ -1080,14 +1164,16 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
dealloc_trap(trap); dealloc_trap(trap);
fobj = restobjchn(nhfp, FALSE); fobj = restobjchn(nhfp, FALSE);
#ifndef SFCTOOL
find_lev_obj(); find_lev_obj();
#endif /* !SFCTOOL */
/* restobjchn()'s `frozen' argument probably ought to be a callback /* restobjchn()'s `frozen' argument probably ought to be a callback
routine so that we can check for objects being buried under ice */ routine so that we can check for objects being buried under ice */
svl.level.buriedobjlist = restobjchn(nhfp, FALSE); svl.level.buriedobjlist = restobjchn(nhfp, FALSE);
gb.billobjs = restobjchn(nhfp, FALSE); gb.billobjs = restobjchn(nhfp, FALSE);
rest_engravings(nhfp); rest_engravings(nhfp);
#ifndef SFCTOOL
/* reset level.monsters for new level */ /* reset level.monsters for new level */
for (x = 0; x < COLNO; x++) for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) for (y = 0; y < ROWNO; y++)
@@ -1133,6 +1219,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
if (ghostly || (elapsed > 00 && elapsed > (long) rnd(10))) if (ghostly || (elapsed > 00 && elapsed > (long) rnd(10)))
hide_monst(mtmp); hide_monst(mtmp);
} }
#endif /* !SFCTOOL */
restdamage(nhfp); restdamage(nhfp);
rest_regions(nhfp); rest_regions(nhfp);
@@ -1140,6 +1227,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
load_exclusions(nhfp); load_exclusions(nhfp);
rest_track(nhfp); rest_track(nhfp);
#ifndef SFCTOOL
if (ghostly) { if (ghostly) {
stairway *stway = gs.stairs; stairway *stway = gs.stairs;
while (stway) { while (stway) {
@@ -1215,6 +1303,11 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
if (ghostly) if (ghostly)
clear_id_mapping(); clear_id_mapping();
program_state.in_getlev = FALSE; program_state.in_getlev = FALSE;
#else
nhUse(pid);
nhUse(lev);
#endif /* !SFCTOOL */
program_state.in_getlev = FALSE;
} }
/* "name-role-race-gend-algn" occurs very early in a save file; sometimes we /* "name-role-race-gend-algn" occurs very early in a save file; sometimes we
@@ -1247,7 +1340,10 @@ get_plname_from_file(
} }
/* restore Plane of Water's air bubbles and Plane of Air's clouds */ /* restore Plane of Water's air bubbles and Plane of Air's clouds */
staticfn void #ifndef SFCTOOL
staticfn
#endif
void
rest_bubbles(NHFILE *nhfp) rest_bubbles(NHFILE *nhfp)
{ {
xint8 bbubbly; xint8 bbubbly;
@@ -1265,7 +1361,10 @@ rest_bubbles(NHFILE *nhfp)
restore_waterlevel(nhfp); restore_waterlevel(nhfp);
} }
staticfn void #ifndef SFCTOOL
staticfn
#endif
void
restore_gamelog(NHFILE *nhfp) restore_gamelog(NHFILE *nhfp)
{ {
int slen = 0; int slen = 0;
@@ -1281,11 +1380,16 @@ restore_gamelog(NHFILE *nhfp)
Sfi_char(nhfp, msg, "gamelog-gamelog_text", slen); Sfi_char(nhfp, msg, "gamelog-gamelog_text", slen);
msg[slen] = '\0'; msg[slen] = '\0';
Sfi_gamelog_line(nhfp, &tmp, "gamelog-gamelog_line"); Sfi_gamelog_line(nhfp, &tmp, "gamelog-gamelog_line");
#ifndef SFCTOOL
gamelog_add(tmp.flags, tmp.turn, msg); gamelog_add(tmp.flags, tmp.turn, msg);
#endif /* !SFCTOOL */
} }
} }
staticfn void #ifndef SFCTOOL
staticfn
#endif
void
restore_msghistory(NHFILE *nhfp) restore_msghistory(NHFILE *nhfp)
{ {
int msgsize = 0; int msgsize = 0;
@@ -1300,14 +1404,20 @@ restore_msghistory(NHFILE *nhfp)
panic("restore_msghistory: msg too big (%d)", msgsize); panic("restore_msghistory: msg too big (%d)", msgsize);
Sfi_char(nhfp, msg, "msghistory-msg", msgsize); Sfi_char(nhfp, msg, "msghistory-msg", msgsize);
msg[msgsize] = '\0'; msg[msgsize] = '\0';
#ifndef SFCTOOL
putmsghistory(msg, TRUE); putmsghistory(msg, TRUE);
#endif /* !SFCTOOL */
++msgcount; ++msgcount;
} }
#ifndef SFCTOOL
if (msgcount) if (msgcount)
putmsghistory((char *) 0, TRUE); putmsghistory((char *) 0, TRUE);
debugpline1("Read %d messages from savefile.", msgcount); debugpline1("Read %d messages from savefile.", msgcount);
#endif /* !SFCTOOL */
} }
#ifndef SFCTOOL
/* Clear all structures for object and monster ID mapping. */ /* Clear all structures for object and monster ID mapping. */
staticfn void staticfn void
clear_id_mapping(void) clear_id_mapping(void)
@@ -1483,5 +1593,6 @@ restore_menu(
return (ch > 0) ? 1 : ch; return (ch > 0) ? 1 : ch;
} }
#endif /* SELECTSAVED */ #endif /* SELECTSAVED */
#endif /* !SFCTOOL */
/*restore.c*/ /*restore.c*/
+4
View File
@@ -41,6 +41,7 @@
* and placed there by 'makedefs'. * and placed there by 'makedefs'.
*/ */
#ifndef SFCTOOL
staticfn void unpadline(char *); staticfn void unpadline(char *);
staticfn void init_rumors(dlb *); staticfn void init_rumors(dlb *);
staticfn char *get_rnd_line(dlb *, char *, unsigned, int (*)(int), staticfn char *get_rnd_line(dlb *, char *, unsigned, int (*)(int),
@@ -615,6 +616,7 @@ save_oracles(NHFILE *nhfp)
} }
} }
} }
#endif /* !SFCTOOL */
void void
restore_oracles(NHFILE *nhfp) restore_oracles(NHFILE *nhfp)
@@ -632,6 +634,7 @@ restore_oracles(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
void void
outoracle(boolean special, boolean delphi) outoracle(boolean special, boolean delphi)
{ {
@@ -947,5 +950,6 @@ free_CapMons(void)
} }
CapMonSiz = 0; CapMonSiz = 0;
} }
#endif /* !SFCTOOL */
/*rumors.c*/ /*rumors.c*/
+4 -5
View File
@@ -115,7 +115,7 @@ dosave0(void)
clear_nhwindow(WIN_MESSAGE); clear_nhwindow(WIN_MESSAGE);
There("seems to be an old save file."); There("seems to be an old save file.");
if (y_n("Overwrite the old file?") == 'n') { if (y_n("Overwrite the old file?") == 'n') {
//nh_sfconvert(fq_save); nh_sfconvert(fq_save);
nh_compress(fq_save); nh_compress(fq_save);
goto done; goto done;
} }
@@ -131,8 +131,7 @@ dosave0(void)
goto done; goto done;
} }
if (nhfp && nhfp->fplog) { if (nhfp && nhfp->fplog) {
/* (void) fprintf(nhfp->fplog, "# just opened\n"); */ nhfp->rcount = nhfp->wcount = 0L;
nhfp->count = 0L;
} }
vision_recalc(2); /* shut down vision to prevent problems vision_recalc(2); /* shut down vision to prevent problems
@@ -221,7 +220,7 @@ dosave0(void)
/* get rid of current level --jgm */ /* get rid of current level --jgm */
delete_levelfile(ledger_no(&u.uz)); delete_levelfile(ledger_no(&u.uz));
delete_levelfile(0); delete_levelfile(0);
///nh_sfconvert(fq_save); nh_sfconvert(fq_save);
nh_compress(fq_save); nh_compress(fq_save);
/* this should probably come sooner... */ /* this should probably come sooner... */
program_state.something_worth_saving = 0; program_state.something_worth_saving = 0;
@@ -1144,7 +1143,7 @@ freedynamicdata(void)
#endif #endif
discard_gamelog(); discard_gamelog();
release_runtime_info(); /* build-time options and version stuff */ release_runtime_info(); /* build-time options and version stuff */
//free_convert_filenames(); free_convert_filenames();
#endif /* FREE_ALL_MEMORY */ #endif /* FREE_ALL_MEMORY */
if (VIA_WINDOWPORT()) if (VIA_WINDOWPORT())
+1047 -79
View File
File diff suppressed because it is too large Load Diff
+60 -4
View File
@@ -8,6 +8,8 @@
/* #define SFLOGGING */ /* debugging */ /* #define SFLOGGING */ /* debugging */
staticfn void sfstruct_read_error(void);
/* historical full struct savings */ /* historical full struct savings */
#ifdef SAVEFILE_DEBUGGING #ifdef SAVEFILE_DEBUGGING
@@ -29,6 +31,9 @@ staticfn void logging_finish(void);
#define SFI_BODY(dt) \ #define SFI_BODY(dt) \
{ \ { \
if (nhfp->eof) { \
sfstruct_read_error(); \
} \
mread(nhfp->fd, (genericptr_t) d_##dt, sizeof *d_##dt); \ mread(nhfp->fd, (genericptr_t) d_##dt, sizeof *d_##dt); \
if (restoreinfo.mread_flags == -1) \ if (restoreinfo.mread_flags == -1) \
nhfp->eof = TRUE; \ nhfp->eof = TRUE; \
@@ -46,20 +51,37 @@ void historical_sfi_##dtyp(NHFILE *nhfp, dtyp *d_##dtyp,
const char *myname UNUSED) \ const char *myname UNUSED) \
SFI_BODY(dtyp) SFI_BODY(dtyp)
#define SFO_CBODY(dt) \
{ \
normalize_pointers_##dt(d_##dt); \
bwrite(nhfp->fd, (genericptr_t) d_##dt, sizeof *d_##dt); \
}
#define SFI_CBODY(dt) \
{ \
if (nhfp->eof) { \
sfstruct_read_error(); \
} \
mread(nhfp->fd, (genericptr_t) d_##dt, sizeof *d_##dt); \
normalize_pointers_##dt(d_##dt); \
if (restoreinfo.mread_flags == -1) \
nhfp->eof = TRUE; \
}
#define SF_C(keyw, dtyp) \ #define SF_C(keyw, dtyp) \
void historical_sfo_##dtyp(NHFILE *, keyw dtyp *d_##dtyp, \ void historical_sfo_##dtyp(NHFILE *, keyw dtyp *d_##dtyp, \
const char *); \ const char *); \
void historical_sfi_##dtyp(NHFILE *, keyw dtyp *d_##dtyp, \ void historical_sfi_##dtyp(NHFILE *, keyw dtyp *d_##dtyp, \
const char *); \ const char *); \
extern void normalize_pointers_##dtyp(keyw dtyp *d_##dtyp); \
\ \
void historical_sfo_##dtyp(NHFILE *nhfp, keyw dtyp *d_##dtyp, \ void historical_sfo_##dtyp(NHFILE *nhfp, keyw dtyp *d_##dtyp, \
const char *myname UNUSED) \ const char *myname UNUSED) \
SFO_BODY(dtyp) \ SFO_CBODY(dtyp) \
\ \
void historical_sfi_##dtyp(NHFILE *nhfp, keyw dtyp *d_##dtyp, \ void historical_sfi_##dtyp(NHFILE *nhfp, keyw dtyp *d_##dtyp, \
const char *myname UNUSED) \ const char *myname UNUSED) \
SFI_BODY(dtyp) SFI_CBODY(dtyp)
#define SF_X(xxx, dtyp) \ #define SF_X(xxx, dtyp) \
void historical_sfo_##dtyp(NHFILE *, xxx *d_##dtyp, const char *, int); \ void historical_sfo_##dtyp(NHFILE *, xxx *d_##dtyp, const char *, int); \
@@ -121,7 +143,7 @@ SF_C(union, any)
SF_A(aligntyp) SF_A(aligntyp)
SF_A(boolean) SF_A(boolean)
SF_A(coordxy) SF_A(coordxy)
SF_A(genericptr_t) //SF_A(genericptr_t)
SF_A(int) SF_A(int)
SF_A(int16) SF_A(int16)
SF_A(int32) SF_A(int32)
@@ -159,6 +181,32 @@ historical_sfi_char(NHFILE *nhfp, char *d_char,
if (restoreinfo.mread_flags == -1) if (restoreinfo.mread_flags == -1)
nhfp->eof = TRUE; nhfp->eof = TRUE;
} }
//extern void sfo_genericptr(NHFILE *, void **, const char *);
//extern void sfi_genericptr(NHFILE *, void **, const char *);
//extern void sfo_x_genericptr(NHFILE *, void **, const char *);
//extern void sfi_x_genericptr(NHFILE *, void **, const char *);
void historical_sfo_genericptr_t(NHFILE *, genericptr_t *d_genericptr_t,
const char *);
void historical_sfi_genericptr_t(NHFILE *, genericptr_t *d_genericptr_t,
const char *);
void
historical_sfo_genericptr_t(NHFILE *nhfp, genericptr_t *d_genericptr_t,
const char *myname UNUSED)
{
bwrite(nhfp->fd, (genericptr_t) d_genericptr_t, sizeof *d_genericptr_t);
}
void
historical_sfi_genericptr_t(NHFILE *nhfp, genericptr_t *d_genericptr_t,
const char *myname UNUSED)
{
if (nhfp->eof) {
sfstruct_read_error();
}
mread(nhfp->fd, (genericptr_t) d_genericptr_t, sizeof *d_genericptr_t);
if (restoreinfo.mread_flags == -1)
nhfp->eof = TRUE;
}
SF_X(uint8_t, bitfield) SF_X(uint8_t, bitfield)
@@ -592,6 +640,7 @@ mread(int fd, genericptr_t buf, unsigned len)
restoreinfo.mread_flags = -1; restoreinfo.mread_flags = -1;
return; return;
} else { } else {
#ifndef SFCTOOL
pline("Read %d instead of %u bytes.", (int) rlen, len); pline("Read %d instead of %u bytes.", (int) rlen, len);
display_nhwindow(WIN_MESSAGE, TRUE); /* flush before error() */ display_nhwindow(WIN_MESSAGE, TRUE); /* flush before error() */
if (program_state.restoring) { if (program_state.restoring) {
@@ -600,10 +649,18 @@ mread(int fd, genericptr_t buf, unsigned len)
error("Error restoring old game."); error("Error restoring old game.");
} }
panic("Error reading level file."); panic("Error reading level file.");
#else
printf("Read %d instead of %u bytes.\n", (int) rlen, len);
#endif
} }
} }
} }
staticfn void
sfstruct_read_error(void)
{
/* problem */;
}
#ifdef SFLOGGING #ifdef SFLOGGING
staticfn void staticfn void
@@ -628,4 +685,3 @@ logging_finish(void)
icnt = 0L; icnt = 0L;
} }
#endif #endif
+6
View File
@@ -5,6 +5,7 @@
#include "hack.h" #include "hack.h"
#ifndef SFCTOOL
staticfn void stoned_dialogue(void); staticfn void stoned_dialogue(void);
staticfn void vomiting_dialogue(void); staticfn void vomiting_dialogue(void);
staticfn void sleep_dialogue(void); staticfn void sleep_dialogue(void);
@@ -2682,6 +2683,7 @@ save_timers(NHFILE *nhfp, int range)
} }
} }
} }
#endif /* !SFCTOOL */
/* /*
* Pull in the structures from disk, but don't recalculate the object and * Pull in the structures from disk, but don't recalculate the object and
@@ -2705,10 +2707,13 @@ restore_timers(NHFILE *nhfp, int range, long adjust)
Sfi_fe(nhfp, curr, "timer"); Sfi_fe(nhfp, curr, "timer");
if (ghostly) if (ghostly)
curr->timeout += adjust; curr->timeout += adjust;
#ifndef SFCTOOL
insert_timer(curr); insert_timer(curr);
#endif
} }
} }
#ifndef SFCTOOL
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
/* to support '#stats' wizard-mode command */ /* to support '#stats' wizard-mode command */
@@ -2753,5 +2758,6 @@ relink_timers(boolean ghostly)
} }
} }
} }
#endif /* !SFCTOOL */
/*timeout.c*/ /*timeout.c*/
+2
View File
@@ -18,6 +18,7 @@ initrack(void)
(void) memset((genericptr_t) &utrack, 0, sizeof(utrack)); (void) memset((genericptr_t) &utrack, 0, sizeof(utrack));
} }
#ifndef SFCTOOL
/* add to track */ /* add to track */
void void
settrack(void) settrack(void)
@@ -51,6 +52,7 @@ gettrack(coordxy x, coordxy y)
} }
return (coord *) 0; return (coord *) 0;
} }
#endif /* !SFCTOOL */
/* return TRUE if x,y has hero tracks on it */ /* return TRUE if x,y has hero tracks on it */
boolean boolean
+57 -35
View File
@@ -8,6 +8,7 @@
#include "dlb.h" #include "dlb.h"
#ifndef MINIMAL_FOR_RECOVER #ifndef MINIMAL_FOR_RECOVER
#ifndef SFCTOOL
#ifndef OPTIONS_AT_RUNTIME #ifndef OPTIONS_AT_RUNTIME
#define OPTIONS_AT_RUNTIME #define OPTIONS_AT_RUNTIME
@@ -357,6 +358,14 @@ comp_times(long filetime)
return ((unsigned long) filetime < (unsigned long) nomakedefs.build_time); return ((unsigned long) filetime < (unsigned long) nomakedefs.build_time);
} }
#endif #endif
#endif /* !SFCTOOL */
#ifdef SFCTOOL
#ifdef wait_synch
#undef wait_synch
#endif
#define wait_synch()
#endif /* SFCTOOL */
boolean boolean
check_version( check_version(
@@ -385,11 +394,13 @@ check_version(
version_data->incarnation != nomakedefs.version_number version_data->incarnation != nomakedefs.version_number
#endif #endif
) { ) {
#ifndef SFCTOOL
if (complain) { if (complain) {
pline("Version mismatch for file \"%s\".", filename); pline("Version mismatch for file \"%s\".", filename);
if (WIN_MESSAGE != WIN_ERR) if (WIN_MESSAGE != WIN_ERR)
display_nhwindow(WIN_MESSAGE, TRUE); display_nhwindow(WIN_MESSAGE, TRUE);
} }
#endif
return FALSE; return FALSE;
} else if ( } else if (
(version_data->feature_set & ~nomakedefs.ignored_features) (version_data->feature_set & ~nomakedefs.ignored_features)
@@ -397,42 +408,18 @@ check_version(
|| ((utdflags & UTD_SKIP_SANITY1) == 0 || ((utdflags & UTD_SKIP_SANITY1) == 0
&& version_data->entity_count != nomakedefs.version_sanity1) && version_data->entity_count != nomakedefs.version_sanity1)
) { ) {
#ifndef SFCTOOL
if (complain) { if (complain) {
pline("Configuration incompatibility for file \"%s\".", filename); pline("Configuration incompatibility for file \"%s\".", filename);
display_nhwindow(WIN_MESSAGE, TRUE); display_nhwindow(WIN_MESSAGE, TRUE);
} }
#endif
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
void #ifndef SFCTOOL
store_version(NHFILE *nhfp)
{
struct version_info version_data = {
0UL, 0UL, 0UL,
};
/* actual version number */
version_data.incarnation = nomakedefs.version_number;
/* bitmask of config settings */
version_data.feature_set = nomakedefs.version_features;
/* # of monsters and objects */
version_data.entity_count = nomakedefs.version_sanity1;
/* bwrite() before bufon() uses plain write() */
if (nhfp->structlevel)
bufoff(nhfp->fd);
store_critical_bytes(nhfp);
Sfo_version_info(nhfp, (struct version_info *) &version_data,
"version_info");
if (nhfp->structlevel)
bufon(nhfp->fd);
return;
}
#ifdef AMIGA #ifdef AMIGA
const char amiga_version_string[] = AMIGA_VERSION_STRING; const char amiga_version_string[] = AMIGA_VERSION_STRING;
#endif #endif
@@ -518,6 +505,34 @@ dump_version_info(void)
release_runtime_info(); release_runtime_info();
return; return;
} }
void
store_version(NHFILE *nhfp)
{
struct version_info version_data = {
0UL,
0UL,
0UL,
};
/* actual version number */
version_data.incarnation = nomakedefs.version_number;
/* bitmask of config settings */
version_data.feature_set = nomakedefs.version_features;
/* # of monsters and objects */
version_data.entity_count = nomakedefs.version_sanity1;
/* bwrite() before bufon() uses plain write() */
if (nhfp->structlevel)
bufoff(nhfp->fd);
store_critical_bytes(nhfp);
Sfo_version_info(nhfp, (struct version_info *) &version_data,
"version_info");
if (nhfp->structlevel)
bufon(nhfp->fd);
return;
}
#endif /* !SFCTOOL */
#endif /* MINIMAL_FOR_RECOVER */ #endif /* MINIMAL_FOR_RECOVER */
struct critical_sizes_with_names { struct critical_sizes_with_names {
@@ -662,9 +677,10 @@ store_critical_bytes(NHFILE *nhfp)
/* int cmc = 0; */ /* int cmc = 0; */
if (nhfp->mode & WRITING) { if (nhfp->mode & WRITING) {
indicate = (nhfp->structlevel) ? 'h' indicate = (nhfp->structlevel) ? 'h'
: (nhfp->fnidx == cnvascii) ? 'a' : (nhfp->fnidx == exportascii)
: '?'; ? 'a'
: '?';
Sfo_char(nhfp, &indicate, "indicate-format", 1); Sfo_char(nhfp, &indicate, "indicate-format", 1);
Sfo_char(nhfp, &csc_count, "count-critical_sizes", 1); Sfo_char(nhfp, &csc_count, "count-critical_sizes", 1);
cnt = (int) csc_count; cnt = (int) csc_count;
@@ -693,7 +709,11 @@ store_critical_bytes(NHFILE *nhfp)
int int
uptodate(NHFILE *nhfp, const char *name, unsigned long utdflags) uptodate(NHFILE *nhfp, const char *name, unsigned long utdflags)
{ {
#ifdef SFCTOOL
extern struct version_info vers_info;
#else
struct version_info vers_info; struct version_info vers_info;
#endif
char indicator; char indicator;
int sfstatus = 0, idx_1st_mismatch = 0; int sfstatus = 0, idx_1st_mismatch = 0;
boolean quietly = (utdflags & UTD_QUIETLY) != 0; boolean quietly = (utdflags & UTD_QUIETLY) != 0;
@@ -708,19 +728,18 @@ uptodate(NHFILE *nhfp, const char *name, unsigned long utdflags)
critical_sizes[idx_1st_mismatch].ucsize, critical_sizes[idx_1st_mismatch].ucsize,
critical_sizes[idx_1st_mismatch].nm); critical_sizes[idx_1st_mismatch].nm);
} }
return sfstatus;
} }
Sfi_version_info(nhfp, &vers_info, "version_info"); Sfi_version_info(nhfp, &vers_info, "version_info");
if (!check_version(&vers_info, name, verbose, utdflags)) { if (!check_version(&vers_info, name, verbose, utdflags)) {
if (verbose) { if (verbose) {
if ((utdflags & UTD_WITHOUT_WAITSYNCH_PERFILE) == 0) if ((utdflags & UTD_WITHOUT_WAITSYNCH_PERFILE) == 0) {
wait_synch(); wait_synch();
}
} }
return SF_OUTDATED; return SF_OUTDATED;
} }
return sfstatus;
return SF_UPTODATE;
} }
/* /*
@@ -819,12 +838,15 @@ validate(NHFILE *nhfp, const char *name, boolean without_waitsynch_perfile)
unsigned long utdflags = 0L; unsigned long utdflags = 0L;
int validsf = 0; int validsf = 0;
#ifdef SFCTOOL
utdflags |= UTD_QUIETLY;
#endif
if (nhfp->structlevel) if (nhfp->structlevel)
utdflags |= UTD_CHECKSIZES; utdflags |= UTD_CHECKSIZES;
if (without_waitsynch_perfile) if (without_waitsynch_perfile)
utdflags |= UTD_WITHOUT_WAITSYNCH_PERFILE; utdflags |= UTD_WITHOUT_WAITSYNCH_PERFILE;
if (nhfp->fieldlevel) if (nhfp->fieldlevel)
utdflags |= UTD_CHECKFIELDCOUNTS | UTD_SKIP_SANITY1 | UTD_QUIETLY; utdflags |= UTD_CHECKFIELDCOUNTS | UTD_SKIP_SANITY1;
validsf = uptodate(nhfp, name, utdflags); validsf = uptodate(nhfp, name, utdflags);
return validsf; return validsf;
} }
+6
View File
@@ -14,6 +14,7 @@ struct wseg {
coordxy wx, wy; /* the segment's position */ coordxy wx, wy; /* the segment's position */
}; };
#ifndef SFCTOOL
staticfn void toss_wsegs(struct wseg *, boolean) NO_NNARGS; staticfn void toss_wsegs(struct wseg *, boolean) NO_NNARGS;
staticfn void shrink_worm(int); staticfn void shrink_worm(int);
@@ -21,6 +22,7 @@ staticfn void shrink_worm(int);
staticfn void random_dir(int, int, int *, int *); staticfn void random_dir(int, int, int *, int *);
#endif #endif
staticfn struct wseg *create_worm_tail(int); /* may return NULL */ staticfn struct wseg *create_worm_tail(int); /* may return NULL */
#endif /* !SFCTOOL */
/* Description of long worm implementation. /* Description of long worm implementation.
* *
@@ -76,6 +78,7 @@ static struct wseg *wheads[MAX_NUM_WORMS] = DUMMY,
*wtails[MAX_NUM_WORMS] = DUMMY; *wtails[MAX_NUM_WORMS] = DUMMY;
static long wgrowtime[MAX_NUM_WORMS] = DUMMY; static long wgrowtime[MAX_NUM_WORMS] = DUMMY;
#ifndef SFCTOOL
/* /*
* get_wormno() * get_wormno()
* *
@@ -563,6 +566,7 @@ save_worm(NHFILE *nhfp)
} }
} }
} }
#endif /* !SFCTOOL */
/* /*
* rest_worm() * rest_worm()
@@ -598,6 +602,7 @@ rest_worm(NHFILE *nhfp)
} }
} }
#ifndef SFCTOOL
/* /*
* place_wsegs() * place_wsegs()
* *
@@ -991,5 +996,6 @@ redraw_worm(struct monst *worm)
curr = curr->nseg; curr = curr->nseg;
} }
} }
#endif /* !SFCTOOL */
/*worm.c*/ /*worm.c*/
+5
View File
@@ -288,6 +288,11 @@ package: $(GAME) recover $(VARDAT) spec_levs
recover: $(GAME) recover: $(GAME)
( cd util ; $(MAKE) $(RECOVERBIN) ) ( cd util ; $(MAKE) $(RECOVERBIN) )
# sfctool can be configured by the sysadmin to convert the savefile
# content format as necessary.
sfctool: $(GAME)
( cd util ; $(MAKE) sfctool )
dofiles: dofiles:
target=`sed -n \ target=`sed -n \
-e '/librarian/{' \ -e '/librarian/{' \
+166
View File
@@ -118,6 +118,12 @@ LIBS =
OBJDIR = ../src OBJDIR = ../src
# This is the universal ctags utility which produces the tags in the
# format that util/readtags requires.
# https://github.com/universal-ctags/ctags.git
#CTAGSCMD = universal-ctags
CTAGSCMD = ctags
# if you change this to 1, feedback while building will omit -Dthis -Wthat # if you change this to 1, feedback while building will omit -Dthis -Wthat
# -Isomewhere so that each file being compiled is listed on one short line; # -Isomewhere so that each file being compiled is listed on one short line;
# it requires support for '$<' in rules with more than one prerequisite # it requires support for '$<' in rules with more than one prerequisite
@@ -288,6 +294,166 @@ recover.o: recover.c $(CONFIG_H)
recover-version.o: ../src/version.c $(HACK_H) recover-version.o: ../src/version.c $(HACK_H)
$(CC) $(CFLAGS) $(CSTD) -DMINIMAL_FOR_RECOVER -c ../src/version.c -o $@ $(CC) $(CFLAGS) $(CSTD) -DMINIMAL_FOR_RECOVER -c ../src/version.c -o $@
#
# dependencies for optional sfctool
#
# object files for sfctool utility
SFCTOOLOBJS = $(TARGETPFX)sfctool.o $(TARGETPFX)sf-alloc.o \
$(TARGETPFX)sf-monst.o $(TARGETPFX)sf-objects.o \
$(TARGETPFX)sfbase.o $(TARGETPFX)sfstruct.o \
$(TARGETPFX)sfexpasc.o \
$(TARGETPFX)sfdata.o $(TARGETPFX)sf-nhlua.o \
$(TARGETPFX)panic.o $(TARGETPFX)sf-date.o \
$(TARGETPFX)sf-decl.o $(TARGETPFX)sf-artifact.o \
$(TARGETPFX)sf-dungeon.o $(TARGETPFX)sf-end.o \
$(TARGETPFX)sf-engrave.o $(TARGETPFX)sf-cfgfiles.o \
$(TARGETPFX)sf-files.o $(TARGETPFX)sf-light.o \
$(TARGETPFX)sf-mdlib.o $(TARGETPFX)sf-mkmaze.o \
$(TARGETPFX)sf-mkroom.o $(TARGETPFX)sf-o_init.o \
$(TARGETPFX)sf-region.o $(TARGETPFX)sf-restore.o \
$(TARGETPFX)sf-rumors.o $(TARGETPFX)sf-sys.o \
$(TARGETPFX)sf-timeout.o $(TARGETPFX)sf-track.o \
$(TARGETPFX)sf-version.o $(TARGETPFX)sf-worm.o \
$(TARGETPFX)strutil.o
SFCTOOLBIN = sfctool
SFFLAGS=-DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
sfutil: $(SFCTOOLBIN)
@echo '$(SFCTOOLBIN) is up to date.'
$(SFCTOOLBIN): $(SFCTOOLOBJS) $(HACKLIB)
$(TARGET_CLINK) $(TARGET_LFLAGS) -o $@ $(SFCTOOLOBJS) $(HACKLIB) $(TARGET_LIBS)
$(TARGETPFX)sfctool.o: sfctool.c $(HACK_H) ../include/sfprocs.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfctool.c
$(TARGETPFX)sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfdata.c
$(TARGETPFX)sfexpasc.o: sfexpasc.c $(HACK_H) ../include/sfprocs.h ../include/sfproto.h
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c sfexpasc.c
$(TARGETPFX)sf-alloc.o: ../src/alloc.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/alloc.c
$(TARGETPFX)sf-date.o: ../src/date.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/date.c
$(TARGETPFX)sf-decl.o: ../src/decl.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/decl.c
$(TARGETPFX)sf-panic.o: panic.c $(CONFIG_H)
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c panic.c
$(TARGETPFX)sf-monst.o: ../src/monst.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/monst.c
$(TARGETPFX)sf-objects.o: ../src/objects.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/objects.c
$(TARGETPFX)sf-sfbase.o: ../src/sfbase.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
$(TARGETPFX)sfstruct.o: ../src/sfstruct.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfstruct.c
$(TARGETPFX)sf-artifact.o: ../src/artifact.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/artifact.c
$(TARGETPFX)sf-dungeon.o: ../src/dungeon.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/dungeon.c
$(TARGETPFX)sf-end.o: ../src/end.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/end.c
$(TARGETPFX)sf-engrave.o: ../src/engrave.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/engrave.c
$(TARGETPFX)sf-cfgfiles.o: ../src/cfgfiles.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/cfgfiles.c
$(TARGETPFX)sf-files.o: ../src/files.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/files.c
$(TARGETPFX)sf-light.o: ../src/light.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/light.c
$(TARGETPFX)sf-mdlib.o: ../src/mdlib.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mdlib.c
$(TARGETPFX)sf-mkmaze.o: ../src/mkmaze.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkmaze.c
$(TARGETPFX)sf-mkroom.o: ../src/mkroom.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/mkroom.c
$(TARGETPFX)sf-o_init.o: ../src/o_init.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/o_init.c
$(TARGETPFX)sf-region.o: ../src/region.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/region.c
$(TARGETPFX)sf-restore.o: ../src/restore.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/restore.c
$(TARGETPFX)sf-rumors.o: ../src/rumors.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/rumors.c
$(TARGETPFX)sf-sys.o: ../src/sys.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sys.c
$(TARGETPFX)sf-timeout.o: ../src/timeout.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/timeout.c
$(TARGETPFX)sf-track.o: ../src/track.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/track.c
$(TARGETPFX)sf-version.o: ../src/version.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/version.c
$(TARGETPFX)sf-worm.o: ../src/worm.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c
$(TARGETPFX)sf-nhlua.o: ../src/nhlua.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/nhlua.c
$(TARGETPFX)sfbase.o: ../src/sfbase.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/sfbase.c
$(TARGETPFX)strutil.o: ../src/strutil.c
$(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/strutil.c
sftags: sftags.o
$(CLINK) $(LFLAGS) -o $@ sftags.o $(LIBS)
sftags.o: sftags.c $(HACK_H)
$(CC) $(CFLAGS) -c sftags.c
../include/sfproto.h: sf.tags sftags
./sftags
sfdata.c: sf.tags sftags
./sftags
# dependencies for sftags
# #
CTAGDEP = ../include/align.h ../include/artifact.h ../include/artilist.h \
../include/attrib.h ../include/context.h ../include/coord.h \
../include/decl.h ../include/dungeon.h ../include/engrave.h \
../include/flag.h ../include/func_tab.h ../include/global.h \
../include/hack.h ../include/mextra.h \
../include/mkroom.h ../include/monst.h ../include/defsym.h \
../include/obj.h ../include/objclass.h ../include/prop.h \
../include/quest.h ../include/rect.h ../include/region.h \
../include/rm.h ../include/skills.h ../include/spell.h \
../include/sys.h ../include/timeout.h ../include/trap.h \
../include/you.h ../include/onames.h ../include/wintype.h
# ../include/permonst.h
CTAGSOPT = --language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern
#
INCL=../include/
SRC=../src/
sf.tags: $(CTAGDEP)
$(CTAGSCMD) $(CTAGSOPT) -f $@ $(INCL)align.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artifact.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)artifact.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artilist.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)attrib.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)bones.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)context.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)coord.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)decl.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)decl.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)dungeon.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)engrave.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)engrave.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)flag.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)func_tab.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)global.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)hack.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mextra.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mkroom.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)monst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)defsym.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)obj.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)objclass.h
# $(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)permonst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)prop.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)quest.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rect.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)region.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rm.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)skills.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)spell.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)stairs.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)sys.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)timeout.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)trap.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)you.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)onames.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)wintype.h
# dependencies for dlb # dependencies for dlb
# #
+1
View File
@@ -49,6 +49,7 @@ dospkg: dodata dosfonts $(GAMEBIN) $(TARGETPFX)recover.exe ../dat/nhtiles.bmp
mkdir -p $(TARGETPFX)pkg mkdir -p $(TARGETPFX)pkg
cp $(GAMEBIN) $(TARGETPFX)pkg/NETHACK.EXE cp $(GAMEBIN) $(TARGETPFX)pkg/NETHACK.EXE
cp $(TARGETPFX)recover.exe $(TARGETPFX)pkg/RECOVER.EXE cp $(TARGETPFX)recover.exe $(TARGETPFX)pkg/RECOVER.EXE
-cp $(SFCTOOLBIN) $(TARGETPFX)pkg/SFCTOOL.EXE
cp ../dat/nhdat $(TARGETPFX)pkg/NHDAT cp ../dat/nhdat $(TARGETPFX)pkg/NHDAT
cp ../dat/license $(TARGETPFX)pkg/LICENSE cp ../dat/license $(TARGETPFX)pkg/LICENSE
cp ../dat/nhtiles.bmp $(TARGETPFX)pkg/NHTILES.BMP cp ../dat/nhtiles.bmp $(TARGETPFX)pkg/NHTILES.BMP
+1
View File
@@ -228,6 +228,7 @@ override LUALIBS=
override TOPLUALIB= override TOPLUALIB=
override GAMEBIN = $(TARGETPFX)nethack.exe override GAMEBIN = $(TARGETPFX)nethack.exe
override RECOVERBIN = $(TARGETPFX)recover.exe override RECOVERBIN = $(TARGETPFX)recover.exe
override SFCTOOLBIN = $(TARGETPFX)sfctool.exe
override PACKAGE = dospkg override PACKAGE = dospkg
override PREGAME += mkdir -p $(TARGETDIR) ; make $(TARGETPFX)exceptn.o ; override PREGAME += mkdir -p $(TARGETDIR) ; make $(TARGETPFX)exceptn.o ;
override CLEANMORE += rm -f -r $(TARGETDIR) ; rm -f -r $(FONTTARGETS) ; override CLEANMORE += rm -f -r $(TARGETDIR) ; rm -f -r $(FONTTARGETS) ;
+195 -24
View File
@@ -866,15 +866,15 @@ COREOBJTTY = \
$(OTTY)quest.o $(OTTY)questpgr.o $(OTTY)read.o $(OTTY)rect.o \ $(OTTY)quest.o $(OTTY)questpgr.o $(OTTY)read.o $(OTTY)rect.o \
$(OTTY)region.o $(OTTY)report.o $(OTTY)restore.o $(OTTY)rip.o \ $(OTTY)region.o $(OTTY)report.o $(OTTY)restore.o $(OTTY)rip.o \
$(OTTY)rnd.o $(OTTY)role.o $(OTTY)rumors.o $(OTTY)save.o \ $(OTTY)rnd.o $(OTTY)role.o $(OTTY)rumors.o $(OTTY)save.o \
$(OTTY)selvar.o $(OTTY)sfstruct.o $(OTTY)shk.o $(OTTY)shknam.o \ $(OTTY)selvar.o $(OTTY)sfbase.o $(OTTY)sfstruct.o $(OTTY)shk.o \
$(OTTY)sit.o $(OTTY)sounds.o $(OTTY)sp_lev.o $(OTTY)spell.o \ $(OTTY)shknam.o $(OTTY)sit.o $(OTTY)sounds.o $(OTTY)sp_lev.o \
$(OTTY)stairs.o $(OTTY)steal.o $(OTTY)steed.o $(OTTY)strutil.o \ $(OTTY)spell.o $(OTTY)stairs.o $(OTTY)steal.o $(OTTY)steed.o \
$(OTTY)symbols.o $(OTTY)sys.o $(OTTY)teleport.o $(OTTY)timeout.o \ $(OTTY)strutil.o $(OTTY)symbols.o $(OTTY)sys.o $(OTTY)teleport.o \
$(OTTY)topten.o $(OTTY)track.o $(OTTY)trap.o $(OTTY)u_init.o \ $(OTTY)timeout.o $(OTTY)topten.o $(OTTY)track.o $(OTTY)trap.o \
$(OTTY)uhitm.o $(OTTY)utf8map.o $(OTTY)vault.o $(OTTY)vision.o \ $(OTTY)u_init.o $(OTTY)uhitm.o $(OTTY)utf8map.o $(OTTY)vault.o \
$(OTTY)weapon.o $(OTTY)were.o $(OTTY)wield.o $(OTTY)windows.o \ $(OTTY)vision.o $(OTTY)weapon.o $(OTTY)were.o $(OTTY)wield.o \
$(OTTY)wizard.o $(OTTY)wizcmds.o $(OTTY)worm.o $(OTTY)worn.o \ $(OTTY)windows.o $(OTTY)wizard.o $(OTTY)wizcmds.o $(OTTY)worm.o \
$(OTTY)write.o $(OTTY)zap.o $(OTTY)sfbase.o $(OTTY)worn.o $(OTTY)write.o $(OTTY)zap.o
OBJSTTY = $(MDLIBTTY) $(COREOBJTTY) $(REGEXTTY) $(RANDOMTTY) OBJSTTY = $(MDLIBTTY) $(COREOBJTTY) $(REGEXTTY) $(RANDOMTTY)
@@ -929,15 +929,15 @@ COREOBJGUI = \
$(OGUI)quest.o $(OGUI)questpgr.o $(OGUI)read.o $(OGUI)rect.o \ $(OGUI)quest.o $(OGUI)questpgr.o $(OGUI)read.o $(OGUI)rect.o \
$(OGUI)region.o $(OGUI)report.o $(OGUI)restore.o $(OGUI)rip.o \ $(OGUI)region.o $(OGUI)report.o $(OGUI)restore.o $(OGUI)rip.o \
$(OGUI)rnd.o $(OGUI)role.o $(OGUI)rumors.o $(OGUI)save.o \ $(OGUI)rnd.o $(OGUI)role.o $(OGUI)rumors.o $(OGUI)save.o \
$(OGUI)selvar.o $(OGUI)sfstruct.o $(OGUI)shk.o $(OGUI)shknam.o \ $(OGUI)selvar.o $(OGUI)sfbase.o $(OGUI)sfstruct.o $(OGUI)shk.o \
$(OGUI)sit.o $(OGUI)sounds.o $(OGUI)sp_lev.o $(OGUI)spell.o \ $(OGUI)shknam.o $(OGUI)sit.o $(OGUI)sounds.o $(OGUI)sp_lev.o \
$(OGUI)stairs.o $(OGUI)steal.o $(OGUI)steed.o $(OGUI)strutil.o \ $(OGUI)spell.o $(OGUI)stairs.o $(OGUI)steal.o $(OGUI)steed.o \
$(OGUI)symbols.o $(OGUI)sys.o $(OGUI)teleport.o $(OGUI)timeout.o \ $(OGUI)strutil.o $(OGUI)symbols.o $(OGUI)sys.o $(OGUI)teleport.o \
$(OGUI)topten.o $(OGUI)track.o $(OGUI)trap.o $(OGUI)u_init.o \ $(OGUI)timeout.o $(OGUI)topten.o $(OGUI)track.o $(OGUI)trap.o \
$(OGUI)uhitm.o $(OGUI)utf8map.o $(OGUI)vault.o $(OGUI)vision.o \ $(OGUI)u_init.o $(OGUI)uhitm.o $(OGUI)utf8map.o $(OGUI)vault.o \
$(OGUI)weapon.o $(OGUI)were.o $(OGUI)wield.o $(OGUI)windows.o \ $(OGUI)vision.o $(OGUI)weapon.o $(OGUI)were.o $(OGUI)wield.o \
$(OGUI)wizard.o $(OGUI)wizcmds.o $(OGUI)worm.o $(OGUI)worn.o \ $(OGUI)windows.o $(OGUI)wizard.o $(OGUI)wizcmds.o $(OGUI)worm.o \
$(OGUI)write.o $(OGUI)zap.o $(OGUI)sfbase.o $(OGUI)worn.o $(OGUI)write.o $(OGUI)zap.o
OBJSGUI = $(MDLIBGUI) $(COREOBJGUI) $(REGEXGUI) $(RANDOMGUI) OBJSGUI = $(MDLIBGUI) $(COREOBJGUI) $(REGEXGUI) $(RANDOMGUI)
@@ -1155,7 +1155,7 @@ R_CTAGSDIR=$(LIBDIR)ctags
CTAGSDIR=$(R_CTAGSDIR)$(BACKSLASH) CTAGSDIR=$(R_CTAGSDIR)$(BACKSLASH)
#U_CTAGSDIR=$(CTAGSDIR:\=/) #U_CTAGSDIR=$(CTAGSDIR:\=/)
!ELSE !ELSE
R_CTAGSDIR=..\..\..\ctags R_CTAGSDIR=..\lib\ctags
CTAGSDIR=$(R_CTAGSDIR)$(BACKSLASH) CTAGSDIR=$(R_CTAGSDIR)$(BACKSLASH)
#U_CTAGSDIR=$(CTAGSDIR:\=/) #U_CTAGSDIR=$(CTAGSDIR:\=/)
!ENDIF !ENDIF
@@ -1724,6 +1724,7 @@ binary.tag: $(DAT)data $(DAT)rumors $(DAT)oracles $(DLB) \
if exist $(DAT)symbols copy $(DAT)symbols $(GAMEDIR)symbols if exist $(DAT)symbols copy $(DAT)symbols $(GAMEDIR)symbols
if exist $(DOC)guidebook.txt copy $(DOC)guidebook.txt $(GAMEDIR)Guidebook.txt if exist $(DOC)guidebook.txt copy $(DOC)guidebook.txt $(GAMEDIR)Guidebook.txt
if exist $(DOC)nethack.txt copy $(DOC)nethack.txt $(GAMEDIR)NetHack.txt if exist $(DOC)nethack.txt copy $(DOC)nethack.txt $(GAMEDIR)NetHack.txt
# if exist $(UTIL)sfctool.pdb copy $(UTIL)sfctool.pdb $(GAMEDIR)sfctool.pdb
@if exist $(GAMEDIR)NetHack.PDB echo NOTE: You may want to remove $(U_GAMEDIR)/NetHack.PDB to conserve space @if exist $(GAMEDIR)NetHack.PDB echo NOTE: You may want to remove $(U_GAMEDIR)/NetHack.PDB to conserve space
@if exist $(GAMEDIR)NetHackW.PDB echo NOTE: You may want to remove $(U_GAMEDIR)/NetHackW.PDB to conserve space @if exist $(GAMEDIR)NetHackW.PDB echo NOTE: You may want to remove $(U_GAMEDIR)/NetHackW.PDB to conserve space
-if exist $(MSWSYS)nethackrc.template copy $(MSWSYS)nethackrc.template $(R_GAMEDIR) -if exist $(MSWSYS)nethackrc.template copy $(MSWSYS)nethackrc.template $(R_GAMEDIR)
@@ -2471,6 +2472,174 @@ $(DAT)epitaph: $(U)makedefs.exe $(DAT)epitaph.txt
$(DAT)bogusmon: $(U)makedefs.exe $(DAT)bogusmon.txt $(DAT)bogusmon: $(U)makedefs.exe $(DAT)bogusmon.txt
$(U)makedefs -3 $(U)makedefs -3
# This is the universal ctags utility which produces the tags in the
# format that util/readtags requires.
# https://github.com/universal-ctags/ctags.git
#===============================================================================
# sfutil
#===============================================================================
SFCTOOLOBJS = $(OUTL)sfctool.o $(OUTL)sf-alloc.o \
$(OUTL)sf-monst.o $(OUTL)sf-objects.o \
$(OUTL)sfbase.o $(OUTL)sf-struct.o \
$(OUTL)sfexpasc.o \
$(OUTL)sfdata.o $(OUTL)sf-nhlua.o \
$(OUTL)panic.o $(OUTL)sf-date.o $(OUTL)sf-decl.o \
$(OUTL)sf-artifact.o $(OUTL)sf-cfgfiles.o \
$(OUTL)sf-dungeon.o $(OUTL)sf-end.o \
$(OUTL)sf-engrave.o $(OUTL)sf-files.o $(OUTL)sf-light.o \
$(OUTL)sf-mdlib.o $(OUTL)sf-mkmaze.o $(OUTL)sf-mkroom.o \
$(OUTL)sf-o_init.o $(OUTL)sf-region.o \
$(OUTL)sf-restore.o $(OUTL)sf-rumors.o \
$(OUTL)sf-sys.o $(OUTL)sf-timeout.o $(OUTL)sf-track.o \
$(OUTL)sf-version.o $(OUTL)sf-worm.o \
$(OUTL)strutil.o $(OUTL)sf-windsys.o
SFCTOOLBIN = $(BinDir)sfctool.exe
SFFLAGS = -DSFCTOOL -DNOPANICTRACE -DNOCRASHREPORT -DNO_CHRONICLE
#CTAGSCMD = $(LIB)\ctags\ctags.exe
#
# dependencies for optional sfctool
#
# $(Q)$(CC) $(CFLAGS) -Fo$@ monst.c
#$(UTIL)sfutil.exe: $(SFCTOOLBIN)
#$(UTIL)sfctool.exe: $(SFCTOOLBIN)
$(SFCTOOLBIN): $(OUTLHACKLIB) $(SFCTOOLOBJS)
$(link) $(lflags) -out:$@ /PDB:$(BinDir)$(@B).PDB $(SFCTOOLOBJS) \
$(LIBS) ole32.lib Shell32.lib userenv.lib advapi32.lib $(OUTLHACKLIB)
@echo '$(SFCTOOLBIN) is up to date.'
$(OUTL)sfctool.o: $(UTIL)sfctool.c $(HACK_H) $(INCL)sfprocs.h
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(UTIL)sfctool.c
$(OUTL)sfdata.o: $(UTIL)sfdata.c $(HACK_H) $(INCL)sfprocs.h $(INCL)sfproto.h
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(UTIL)sfdata.c
$(OUTL)sfexpasc.o: $(UTIL)sfexpasc.c $(HACK_H) $(INCL)sfprocs.h $(INCL)sfproto.h
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(UTIL)sfexpasc.c
$(OUTL)sf-alloc.o: $(SRC)alloc.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)alloc.c
$(OUTL)sf-date.o: $(SRC)date.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)date.c
$(OUTL)sf-decl.o: $(SRC)decl.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)decl.c
$(OUTL)sf-monst.o: $(SRC)monst.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)monst.c
$(OUTL)sf-objects.o: $(SRC)objects.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)objects.c
$(OUTL)sfbase.o: $(SRC)sfbase.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)sfbase.c
$(OUTL)sf-struct.o: $(SRC)sfstruct.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)sfstruct.c
$(OUTL)sf-artifact.o: $(SRC)artifact.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)artifact.c
$(OUTL)sf-cfgfiles.o: $(SRC)cfgfiles.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)cfgfiles.c
$(OUTL)sf-dungeon.o: $(SRC)dungeon.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)dungeon.c
$(OUTL)sf-end.o: $(SRC)end.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)end.c
$(OUTL)sf-engrave.o: $(SRC)engrave.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)engrave.c
$(OUTL)sf-files.o: $(SRC)files.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)files.c
$(OUTL)sf-light.o: $(SRC)light.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)light.c
$(OUTL)sf-mdlib.o: $(SRC)mdlib.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)mdlib.c
$(OUTL)sf-mkmaze.o: $(SRC)mkmaze.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)mkmaze.c
$(OUTL)sf-mkroom.o: $(SRC)mkroom.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)mkroom.c
$(OUTL)sf-o_init.o: $(SRC)o_init.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)o_init.c
$(OUTL)sf-region.o: $(SRC)region.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)region.c
$(OUTL)sf-restore.o: $(SRC)restore.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)restore.c
$(OUTL)sf-rumors.o: $(SRC)\rumors.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)rumors.c
$(OUTL)sf-timeout.o: $(SRC)timeout.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)timeout.c
$(OUTL)sf-version.o: $(SRC)version.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)version.c
$(OUTL)sf-worm.o: $(SRC)worm.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)worm.c
$(OUTL)sf-nhlua.o: $(SRC)nhlua.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)nhlua.c
$(OUTL)sf-track.o: $(SRC)track.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)track.c
$(OUTL)sf-sys.o: $(SRC)sys.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(SRC)sys.c
$(OUTL)sf-windsys.o: $(MSWSYS)windsys.c
$(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c
$(UTIL)sftags.exe: $(OUTL)sftags.o
$(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o
$(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H)
$(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c
$(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags
$(UTIL)sftags.exe
$(UTIL)sfdata.c: $(UTIL)sftags.exe $(UTIL)sf.tags
$(UTIL)sftags.exe
# dependencies for sftags
# #
CTAGDEP = $(INCL)align.h $(INCL)artifact.h $(INCL)artilist.h \
$(INCL)attrib.h $(INCL)context.h $(INCL)coord.h \
$(INCL)decl.h $(INCL)dungeon.h $(INCL)engrave.h \
$(INCL)flag.h $(INCL)func_tab.h $(INCL)global.h \
$(INCL)hack.h $(INCL)mextra.h \
$(INCL)mkroom.h $(INCL)monst.h \
$(INCL)obj.h $(INCL)objclass.h $(INCL)prop.h \
$(INCL)quest.h $(INCL)rect.h $(INCL)region.h \
$(INCL)rm.h $(INCL)skills.h $(INCL)spell.h \
$(INCL)stairs.h $(INCL)sys.h $(INCL)timeout.h \
$(INCL)trap.h $(INCL)you.h $(INCL)onames.h \
$(INCL)wintype.h
# $(INCL)permonst.h
CTAGSOPT = --language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern
#
$(UTIL)sf.tags: $(CTAGDEP)
$(CTAGSCMD) $(CTAGSOPT) -f $@ $(INCL)align.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artifact.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)artifact.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)artilist.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)attrib.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)bones.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)context.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)coord.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)decl.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)decl.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)dungeon.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)engrave.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(SRC)engrave.c
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)flag.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)func_tab.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)global.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)hack.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mextra.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)mkroom.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)monst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)defsym.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)obj.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)objclass.h
# $(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)permonst.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)prop.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)quest.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rect.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)region.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)rm.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)skills.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)spell.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)stairs.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)sys.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)timeout.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)trap.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)you.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)onames.h
$(CTAGSCMD) $(CTAGSOPT) -a -f $@ $(INCL)wintype.h
#=============================================================================== #===============================================================================
# Integrated sound files # Integrated sound files
#=============================================================================== #===============================================================================
@@ -2541,13 +2710,15 @@ $(SndWavDir)sa2_xplevelup.wav: $(SndWavDir)sa2_xplevelup.uu $(U)uudecode.exe
#=============================================================================== #===============================================================================
PKGFILES = nethackrc.template Guidebook.txt license NetHack.exe NetHack.txt \ PKGFILES = nethackrc.template Guidebook.txt license NetHack.exe NetHack.txt \
NetHackW.exe opthelp nhdat370 record symbols sysconf.template NetHackW.exe opthelp nhdat370 record symbols sysconf.template \
sfctool.exe
FILESTOZIP = $(BinDir)nethackrc.template $(BinDir)Guidebook.txt $(BinDir)license \ FILESTOZIP = $(BinDir)nethackrc.template $(BinDir)Guidebook.txt $(BinDir)license \
$(BinDir)NetHack.exe $(BinDir)NetHack.txt $(BinDir)NetHackW.exe \ $(BinDir)NetHack.exe $(BinDir)NetHack.txt $(BinDir)NetHackW.exe \
$(BinDir)opthelp $(BinDir)nhdat370 $(BinDir)record \ $(BinDir)opthelp $(BinDir)nhdat370 $(BinDir)record \
$(BinDir)symbols $(BinDir)sysconf.template $(BinDir)symbols $(BinDir)sysconf.template $(BinDir)sfctool.exe
DBGSYMS = NetHack.PDB NetHackW.PDB
PDBTOZIP = $(BinDir)NetHack.PDB $(BinDir)NetHackW.PDB DBGSYMS = NetHack.PDB NetHackW.PDB sfctool.PDB
PDBTOZIP = $(BinDir)NetHack.PDB $(BinDir)NetHackW.PDB $(BinDir)sfctool.PDB
MAINZIP = $(PkgDir)nethack-$(NHV)-win-$(TARGET_CPU).zip MAINZIP = $(PkgDir)nethack-$(NHV)-win-$(TARGET_CPU).zip
DBGSYMZIP = $(PkgDir)nethack-$(NHV)-win-$(TARGET_CPU)-debugsymbols.zip DBGSYMZIP = $(PkgDir)nethack-$(NHV)-win-$(TARGET_CPU)-debugsymbols.zip
@@ -2568,7 +2739,7 @@ binary: envchk.tag libdir.tag ottydir$(TARGET_CPU).tag \
$(INCL)nhlua.h $(OUTL)utility.tag \ $(INCL)nhlua.h $(OUTL)utility.tag \
$(DAT)data $(DAT)rumors $(DAT)oracles $(DAT)engrave \ $(DAT)data $(DAT)rumors $(DAT)oracles $(DAT)engrave \
$(DAT)epitaph $(DAT)bogusmon $(GAMEDIR)NetHack.exe \ $(DAT)epitaph $(DAT)bogusmon $(GAMEDIR)NetHack.exe \
$(GAMEDIR)NetHackW.exe $(GAMEDIRDLLS) binary.tag $(GAMEDIR)NetHackW.exe $(GAMEDIR)sfctool.exe $(GAMEDIRDLLS) binary.tag
@echo NetHack is up to date. @echo NetHack is up to date.
#=============================================================================== #===============================================================================
+1 -1
View File
@@ -317,4 +317,4 @@
<Target Name="AfterRebuild"> <Target Name="AfterRebuild">
<MSBuild Projects="afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" /> <MSBuild Projects="afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target> </Target>
</Project> </Project>
+1 -1
View File
@@ -379,4 +379,4 @@
<Target Name="AfterRebuild"> <Target Name="AfterRebuild">
<MSBuild Projects="$(vsDir)NetHack\afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" /> <MSBuild Projects="$(vsDir)NetHack\afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target> </Target>
</Project> </Project>
+2
View File
@@ -29,6 +29,8 @@
<WinCursDir>$(RootDir)win\curses\</WinCursDir> <WinCursDir>$(RootDir)win\curses\</WinCursDir>
<SubmodulesDir>$(RootDir)submodules\</SubmodulesDir> <SubmodulesDir>$(RootDir)submodules\</SubmodulesDir>
<LuaDir>$(LibDir)lua-$(LUA_VERSION)\src\</LuaDir> <LuaDir>$(LibDir)lua-$(LUA_VERSION)\src\</LuaDir>
<SftagsDir>$(RootDir)\sys\windows\vs\sftags\</SftagsDir>
<SfctoolDir>$(RootDir)\sys\windows\vs\sfctool\</SfctoolDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(LibDir)pdcursesmod\curses.h')"> <PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(LibDir)pdcursesmod\curses.h')">
<PDCURSESMOD>$(LibDir)pdcursesmod\</PDCURSESMOD> <PDCURSESMOD>$(LibDir)pdcursesmod\</PDCURSESMOD>
@@ -0,0 +1,49 @@
# NetHack 3.7 fetchctags.nmake
#==============================================================================
#
# The version of the game this Makefile was designed for
NETHACK_VERSION="3.7.0"
# A brief version for use in macros
NHV=$(NETHACK_VERSION:.=)
NHV=$(NHV:"=)
# The location of the ctags that we want
CTAGS_VERSION=6.1.0
CURLCTAGSSRC=https://github.com/universal-ctags/ctags-win32/releases/download/v$(CTAGS_VERSION)/ctags-v$(CTAGS_VERSION)-x64.zip
CURLCTAGSDST=ctags-v$(CTAGS_VERSION)-x64.zip
#
# relative directories from root of NetHack tree.
#
ROOTDIR=..\..\..\.. # root of NetHack tree relative to project file
LIBDIR=$(ROOTDIR)\lib
CTAGSDIR=$(LIBDIR)\ctags
default: fetchall
fetchall: fetch-ctags
fetch-ctags: $(CTAGSDIR)
cd $(LIBDIR)
curl --insecure -L -R -O $(CURLCTAGSSRC)
# cd ctags
tar zxf $(CURLCTAGSDST) -C ctags
cd ..\sys\windows\vs\fetchctags
@echo ctags.exe has been fetched into $(LIBDIR)\ctags
$(CTAGSDIR): $(LIBDIR)
@if not exist $(CTAGSDIR)\*.* echo creating directory $(CTAGSDIR:\=/)
@if not exist $(CTAGSDIR)\*.* mkdir $(CTAGSDIR)
$(LIBDIR):
@if not exist $(LIBDIR)\*.* echo creating directory $(LIBDIR:\=/)
@if not exist $(LIBDIR)\*.* mkdir $(LIBDIR)
rebuild:
@if exist $(CTAGSDIR)\ctags.exe echo nothing to do for $(CTAGSDIR)\ctags.exe
clean:
if exist $(CURLCTAGSDST) del $(CURLCTAGSDST)
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="..\config.props" />
<Import Project="..\dirs.props" />
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="Exists('$(LibDir)ctags') AND Exists('$(LibDir)ctags\ctags.exe')">
<NMakeBuildCommandLine>echo ..\lib\ctags is already present</NMakeBuildCommandLine>
<NMakeCleanCommandLine>pushd $(vsDir)fetchctags %26%26 nmake -F fetchctags.nmake clean %26%26 popd</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>echo rebuilding $(vsDir)fetchctags </NMakeReBuildCommandLine>
<NMakePreprocessorDefinitions>_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
</PropertyGroup>
<PropertyGroup Condition="!Exists('$(LibDir)ctags\ctags.exe')">
<NMakeBuildCommandLine>pushd $(vsDir)fetchctags %26%26 nmake -F fetchctags.nmake %26%26 popd</NMakeBuildCommandLine>
<NMakeCleanCommandLine>pushd $(vsDir)fetchctags %26%26 nmake -F fetchctags.nmake clean %26%26 popd</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>pushd $(vsDir)fetchprereq %26%26 nmake -F fetchctags.nmake rebuild %26%26 popd</NMakeReBuildCommandLine>
<NMakePreprocessorDefinitions>_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+58
View File
@@ -0,0 +1,58 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35913.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfctool", "sfctool\sfctool.vcxproj", "{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}"
ProjectSection(ProjectDependencies) = postProject
{628C594A-7565-4366-9FCA-41DB67C6B615} = {628C594A-7565-4366-9FCA-41DB67C6B615}
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD} = {AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sftags", "sftags\sftags.vcxproj", "{628C594A-7565-4366-9FCA-41DB67C6B615}"
ProjectSection(ProjectDependencies) = postProject
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD} = {AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fetchctags", "fetchctags\fetchctags.vcxproj", "{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Debug|x64.ActiveCfg = Debug|x64
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Debug|x64.Build.0 = Debug|x64
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Debug|x86.ActiveCfg = Debug|Win32
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Debug|x86.Build.0 = Debug|Win32
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Release|x64.ActiveCfg = Release|x64
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Release|x64.Build.0 = Release|x64
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Release|x86.ActiveCfg = Release|Win32
{3BFA3C14-6DA2-4750-B1C6-028B9BCE825E}.Release|x86.Build.0 = Release|Win32
{628C594A-7565-4366-9FCA-41DB67C6B615}.Debug|x64.ActiveCfg = Debug|x64
{628C594A-7565-4366-9FCA-41DB67C6B615}.Debug|x64.Build.0 = Debug|x64
{628C594A-7565-4366-9FCA-41DB67C6B615}.Debug|x86.ActiveCfg = Debug|Win32
{628C594A-7565-4366-9FCA-41DB67C6B615}.Debug|x86.Build.0 = Debug|Win32
{628C594A-7565-4366-9FCA-41DB67C6B615}.Release|x64.ActiveCfg = Release|x64
{628C594A-7565-4366-9FCA-41DB67C6B615}.Release|x64.Build.0 = Release|x64
{628C594A-7565-4366-9FCA-41DB67C6B615}.Release|x86.ActiveCfg = Release|Win32
{628C594A-7565-4366-9FCA-41DB67C6B615}.Release|x86.Build.0 = Release|Win32
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Debug|x64.ActiveCfg = Debug|x64
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Debug|x64.Build.0 = Debug|x64
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Debug|x86.ActiveCfg = Debug|Win32
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Debug|x86.Build.0 = Debug|Win32
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Release|x64.ActiveCfg = Release|x64
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Release|x64.Build.0 = Release|x64
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Release|x86.ActiveCfg = Release|Win32
{AAE63AD3-8185-4E19-B6A3-13F4CB891AAD}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1000CD98-D3C0-493F-9EA7-E2D81FA96432}
EndGlobalSection
EndGlobal
+193
View File
@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\config.props" />
<Import Project="..\dirs.props" />
<Import Project="..\default.props" />
<Import Project="..\NetHackProperties.props" />
<Import Project="..\console.props" />
<Import Project="..\common.props" />
<Import Project="..\files.props" />
<PropertyGroup>
<OutDir>$(BinDir)</OutDir>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SrcDir)alloc.c" />
<ClCompile Include="$(SrcDir)artifact.c" />
<ClCompile Include="$(SrcDir)cfgfiles.c" />
<ClCompile Include="$(SrcDir)decl.c" />
<ClCompile Include="$(SrcDir)dungeon.c" />
<ClCompile Include="$(SrcDir)end.c" />
<ClCompile Include="$(SrcDir)engrave.c" />
<ClCompile Include="$(SrcDir)files.c" />
<ClCompile Include="$(SrcDir)light.c" />
<ClCompile Include="$(SrcDir)mkmaze.c" />
<ClCompile Include="$(SrcDir)mkroom.c" />
<ClCompile Include="$(SrcDir)monst.c" />
<ClCompile Include="$(SrcDir)nhlua.c" />
<ClCompile Include="$(SrcDir)objects.c" />
<ClCompile Include="$(SrcDir)o_init.c" />
<ClCompile Include="$(SrcDir)region.c" />
<ClCompile Include="$(SrcDir)restore.c" />
<ClCompile Include="$(SrcDir)rumors.c" />
<ClCompile Include="$(SrcDir)sfbase.c" />
<ClCompile Include="$(SrcDir)sfstruct.c" />
<ClCompile Include="$(SrcDir)strutil.c" />
<ClCompile Include="$(SrcDir)timeout.c" />
<ClCompile Include="$(SrcDir)track.c" />
<ClCompile Include="$(SrcDir)version.c" />
<ClCompile Include="$(SrcDir)worm.c" />
<ClCompile Include="$(SrcDir)sys.c" />
<ClCompile Include="$(SrcDir)date.c" />
<ClCompile Include="$(SrcDir)mdlib.c" />
<ClCompile Include="$(UtilDir)panic.c" />
<ClCompile Include="$(UtilDir)sfctool.c" />
<ClCompile Include="$(UtilDir)sfexpasc.c" />
<ClCompile Include="$(UtilDir)sfdata.c" />
<ClCompile Include="$(SysWindDir)windsys.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(IncDir)extern.h" />
<ClInclude Include="$(IncDir)sfprocs.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3bfa3c14-6da2-4750-b1c6-028b9bce825e}</ProjectGuid>
<RootNamespace>sfctool</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_NDEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>hacklib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>hacklib.lib;userenv.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_NDEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ToolsDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>hacklib.lib;userenv.lib;advapi32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+48
View File
@@ -0,0 +1,48 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dirs.props"/>
<Import Project="$(vsDir)files.props"/>
<Target Name="Build" Outputs="$(IncDir)sfdata.c;$(SrcDir)sfdata.c">
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -f sf.tags $(IncDir)align.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)artifact.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(SRC)artifact.c" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)artilist.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)attrib.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(SRC)bones.c" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)context.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)coord.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)decl.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(SRC)decl.c" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)dungeon.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)engrave.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(SRC)engrave.c" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)flag.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)func_tab.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)global.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)hack.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)mextra.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)mkroom.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)monst.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)defsym.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)obj.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)objclass.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)prop.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)quest.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)rect.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)region.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)rm.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)skills.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)spell.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)stairs.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)sys.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)timeout.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)trap.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)you.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)onames.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="..\lib\ctags\ctags --language-force=c --sort=no -D&quot;Bitfield(x,n)=unsigned x : n&quot; --excmd=pattern -a -f sf.tags $(IncDir)wintype.h" WorkingDirectory="$(UtilDir)"/>
<Exec Command="$(ToolsDir)sftags.exe" WorkingDirectory="$(UtilDir)"/>
</Target>
<Target Name="Clean">
<Delete Files="$(UtilDir)sf.tags"/>
</Target>
</Project>
+156
View File
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\config.props" />
<Import Project="..\dirs.props" />
<Import Project="..\default.props" />
<Import Project="..\NetHackProperties.props" />
<Import Project="..\console.props" />
<Import Project="..\common.props" />
<Import Project="..\files.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(UtilDir)sftags.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{628c594a-7565-4366-9fca-41db67c6b615}</ProjectGuid>
<RootNamespace>sftags</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);$(UtilDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32CON;NO_TILE_C;DLB;SAFEPROCS;SND_LIB_WINDSOUND;USER_SOUNDS;_LIB;HAS_STDINT_H;SFCTOOL;NOPANICTRACE;NOCRASHREPORT;NO_CHRONICLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="AfterBuild">
<MSBuild Projects="aftersftags.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="AfterClean">
<MSBuild Projects="aftersftags.proj" Targets="Clean" Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="AfterRebuild">
<MSBuild Projects="aftersftags.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target>
</Project>
+18 -4
View File
@@ -44,6 +44,10 @@
static char portable_device_path[MAX_PATH]; static char portable_device_path[MAX_PATH];
static boolean path_buffer_set = FALSE;
static char path_buffer[MAX_PATH];
#ifndef SFCTOOL
/* runtime cursor display control switch */ /* runtime cursor display control switch */
boolean win32_cursorblink; boolean win32_cursorblink;
@@ -53,6 +57,9 @@ WIN32_FIND_DATA ffd;
extern int GUILaunched; extern int GUILaunched;
extern boolean getreturn_enabled; extern boolean getreturn_enabled;
int redirect_stdout; int redirect_stdout;
static char *get_executable_path(void);
#ifdef WIN32CON #ifdef WIN32CON
typedef HWND(WINAPI *GETCONSOLEWINDOW)(void); typedef HWND(WINAPI *GETCONSOLEWINDOW)(void);
@@ -780,7 +787,9 @@ nt_assert_failed(const char *expression, const char *filepath, int line)
impossible("nhassert(%s) failed in file '%s' at line %d", impossible("nhassert(%s) failed in file '%s' at line %d",
expression, filename, line); expression, filename, line);
} }
#endif /* SFCTOOL */
/* used by util/sfctool.c as well as files.c */
boolean boolean
get_user_home_folder(char *homebuf, size_t sz) get_user_home_folder(char *homebuf, size_t sz)
{ {
@@ -794,13 +803,12 @@ get_user_home_folder(char *homebuf, size_t sz)
result = GetUserProfileDirectoryA(hToken, szHomeDirBuf, &BufSize); result = GetUserProfileDirectoryA(hToken, szHomeDirBuf, &BufSize);
// Close handle opened via OpenProcessToken // Close handle opened via OpenProcessToken
CloseHandle(hToken); CloseHandle(hToken);
if (result != 0) {
Snprintf(homebuf, sz, "%s", szHomeDirBuf);
}
return (result != 0); return (result != 0);
} }
static char *get_executable_path(void);
static boolean path_buffer_set = FALSE;
static char path_buffer[MAX_PATH];
char * char *
get_executable_path(void) get_executable_path(void)
@@ -1019,6 +1027,7 @@ set_default_prefix_locations(const char *programPath UNUSED)
strcpy(executable_path, get_executable_path()); strcpy(executable_path, get_executable_path());
append_slash(executable_path); append_slash(executable_path);
#ifndef SFCTOOL
if (test_portable_config(executable_path, portable_device_path, if (test_portable_config(executable_path, portable_device_path,
sizeof portable_device_path)) { sizeof portable_device_path)) {
gf.fqn_prefix[SYSCONFPREFIX] = executable_path; gf.fqn_prefix[SYSCONFPREFIX] = executable_path;
@@ -1032,6 +1041,7 @@ set_default_prefix_locations(const char *programPath UNUSED)
gf.fqn_prefix[TROUBLEPREFIX] = portable_device_path; gf.fqn_prefix[TROUBLEPREFIX] = portable_device_path;
gf.fqn_prefix[DATAPREFIX] = executable_path; gf.fqn_prefix[DATAPREFIX] = executable_path;
} else { } else {
#endif /* SFCTOOL */
if (!build_known_folder_path(&FOLDERID_Profile, profile_path, if (!build_known_folder_path(&FOLDERID_Profile, profile_path,
sizeof(profile_path), FALSE)) sizeof(profile_path), FALSE))
strcpy(profile_path, executable_path); strcpy(profile_path, executable_path);
@@ -1061,7 +1071,9 @@ set_default_prefix_locations(const char *programPath UNUSED)
gf.fqn_prefix[LOCKPREFIX] = versioned_global_data_path; gf.fqn_prefix[LOCKPREFIX] = versioned_global_data_path;
gf.fqn_prefix[TROUBLEPREFIX] = versioned_profile_path; gf.fqn_prefix[TROUBLEPREFIX] = versioned_profile_path;
gf.fqn_prefix[DATAPREFIX] = executable_path; gf.fqn_prefix[DATAPREFIX] = executable_path;
#ifndef SFCTOOL
} }
#endif /* SFCTOOL */
} }
/* /*
@@ -1138,6 +1150,7 @@ get_portable_device(void)
return (const char *) portable_device_path; return (const char *) portable_device_path;
} }
#ifndef SFCTOOL
/* Windows helpers for CRASHREPORT etc */ /* Windows helpers for CRASHREPORT etc */
#ifdef CRASHREPORT #ifdef CRASHREPORT
struct CRctxt { struct CRctxt {
@@ -1429,6 +1442,7 @@ win32_cr_shellexecute(const char *url){
return rv; return rv;
} }
#endif /* CRASHREPORT */ #endif /* CRASHREPORT */
#endif /* SFCTOOL */
#endif /* WIN32 */ #endif /* WIN32 */
+4 -1
View File
@@ -31,4 +31,7 @@ heaputil.c
tilemappings.lst tilemappings.lst
clang_rt.asan*.dll clang_rt.asan*.dll
*.sln *.sln
sf.tags
sfdata.c
sfctool
sftags
+1323
View File
File diff suppressed because it is too large Load Diff
+1296
View File
File diff suppressed because it is too large Load Diff
+2230
View File
File diff suppressed because it is too large Load Diff