Skip to content

Commit 361a46a

Browse files
authored
[NH5] update include directory (#122)
* Remove nh5 deleted headers * Copy NetHack 5 header files - unmodified for NLE set * Add nh5 config.h with NLE mods * Add nh5 extern.h with NLE mods * Add nh5 tcap.h with NLE mods * Add nh5 tradstdc.h without NLE mods - mod not needed * Add nh5 unixconf.h with NLE mods * Add nh5 wintty.h with NLE mods
1 parent 5070c64 commit 361a46a

116 files changed

Lines changed: 20784 additions & 12570 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/align.h

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* NetHack 3.6 align.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
2-
/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */
1+
/* NetHack 5.0 align.h $NHDT-Date: 1604269810 2020/11/01 22:30:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
2+
/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */
33
/* NetHack may be freely redistributed. See license for details. */
44

55
#ifndef ALIGN_H
@@ -10,10 +10,11 @@ typedef schar aligntyp; /* basic alignment type */
1010
typedef struct align { /* alignment & record */
1111
aligntyp type;
1212
int record;
13+
unsigned abuse;
1314
} align;
1415

1516
/* bounds for "record" -- respect initial alignments of 10 */
16-
#define ALIGNLIM (10L + (moves / 200L))
17+
#define ALIGNLIM (10L + (svm.moves / 200L))
1718

1819
#define A_NONE (-128) /* the value range of type */
1920

@@ -24,20 +25,46 @@ typedef struct align { /* alignment & record */
2425
#define A_COALIGNED 1
2526
#define A_OPALIGNED (-1)
2627

27-
#define AM_NONE 0
28-
#define AM_CHAOTIC 1
29-
#define AM_NEUTRAL 2
30-
#define AM_LAWFUL 4
28+
/* align masks */
29+
#define AM_NONE 0x00
30+
#define AM_CHAOTIC 0x01
31+
#define AM_NEUTRAL 0x02
32+
#define AM_LAWFUL 0x04
33+
#define AM_MASK 0x07 /* mask for "normal" alignment values */
3134

32-
#define AM_MASK 7
35+
/* Some altars are considered shrines, add a flag for that
36+
for the altarmask field of struct rm. */
37+
#define AM_SHRINE 0x08
38+
/* High altar on Astral plane or Moloch's sanctum */
39+
#define AM_SANCTUM 0x10
3340

34-
#define AM_SPLEV_CO 3
35-
#define AM_SPLEV_NONCO 7
41+
/* special level flags, gone by the time the level has been loaded */
42+
#define AM_SPLEV_CO 0x20 /* co-aligned: force alignment to match hero's */
43+
#define AM_SPLEV_NONCO 0x40 /* non-co-aligned: force alignment to not match */
44+
#define AM_SPLEV_RANDOM 0x80
3645

37-
#define Amask2align(x) \
38-
((aligntyp)((!(x)) ? A_NONE : ((x) == AM_LAWFUL) ? A_LAWFUL \
39-
: ((int) x) - 2))
46+
#define Amask2align(x) \
47+
((aligntyp) ((((x) & AM_MASK) == 0) ? A_NONE \
48+
: (((x) & AM_MASK) == AM_LAWFUL) ? A_LAWFUL \
49+
: ((int) ((x) & AM_MASK)) - 2)) /* 2 => 0, 1 => -1 */
4050
#define Align2amask(x) \
41-
(((x) == A_NONE) ? AM_NONE : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2)
51+
((unsigned) (((x) == A_NONE) ? AM_NONE \
52+
: ((x) == A_LAWFUL) ? AM_LAWFUL \
53+
: ((x) + 2))) /* -1 => 1, 0 => 2 */
54+
55+
/* Because clearly Nethack needs more ways to specify alignment...
56+
Amask2msa(): 1, 2, 4 converted to 1, 2, 3 to fit within a width 2 bitfield;
57+
Msa2amask(): 1, 2, 3 converted back to 1, 2, 4;
58+
For Amask2msa(), 'x' might have the shrine bit set so strip that off. */
59+
#define Amask2msa(x) ((((x) & AM_MASK) == 4) ? 3 : (x) & AM_MASK)
60+
#define Msa2amask(x) (((x) == 3) ? 4 : (x))
61+
#define MSA_NONE 0 /* unaligned or multiple alignments */
62+
63+
/* alignment change reasons for uchangealign(attrib.c) */
64+
enum uchangealign_reasons {
65+
A_CG_CONVERT = 0, /* permanently converted */
66+
A_CG_HELM_ON = 1, /* donned helm of opposite alignment */
67+
A_CG_HELM_OFF = 2, /* doffed helm of opposite alignment */
68+
};
4269

4370
#endif /* ALIGN_H */

include/amiconf.h

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414

1515
#include <time.h> /* get time_t defined before use! */
1616

17+
#ifdef CROSS_TO_AMIGA
18+
#include <stdlib.h>
19+
#include <string.h>
20+
#include <unistd.h>
21+
#include <dos/dos.h>
22+
#include <clib/dos_protos.h>
23+
#include <proto/dos.h>
24+
#endif
25+
1726
#ifdef __SASC_60 /* since SAS can prevent re-inclusion */
1827
#include <stdlib.h> /* general things, including builtins */
1928
#include <string.h>
@@ -28,7 +37,6 @@
2837
#ifdef _DCC
2938
#include <stdlib.h>
3039
#define _SIZE_T
31-
#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */
3240
#endif
3341

3442
#ifndef __GNUC__
@@ -41,16 +49,18 @@ typedef long off_t;
4149
LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \
4250
SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
4351

52+
#define PATHLEN 130
53+
4454
/* data librarian defs */
45-
#ifndef NOCWD_ASSUMPTIONS
46-
#define DLBFILE "NetHack:nhdat" /* main library */
47-
#define DLBFILE2 "NetHack:nhsdat" /* sound library */
48-
#else
4955
#define DLBFILE "nhdat" /* main library */
50-
#define DLBFILE2 "nhsdat" /* sound library */
51-
#endif
56+
/* nhsdat sound library not used in 5.0 */
57+
#undef DLBFILE2
5258

59+
#ifndef CROSS_TO_AMIGA
5360
#define FILENAME_CMP stricmp /* case insensitive */
61+
#else
62+
#define FILENAME_CMP strcmpi /* case insensitive */
63+
#endif
5464

5565
#ifndef __SASC_60
5666
#define O_BINARY 0
@@ -66,38 +76,40 @@ typedef long off_t;
6676
#define MFLOPPY /* You'll probably want this; provides assistance \
6777
* for typical personal computer configurations \
6878
*/
79+
#ifndef CROSS_TO_AMIGA
6980
#define RANDOM
81+
#endif
7082

7183
/* ### amidos.c ### */
7284

73-
extern void FDECL(nethack_exit, (int));
85+
extern void nethack_exit(int);
7486

7587
/* ### amiwbench.c ### */
7688

77-
extern void NDECL(ami_wbench_init);
78-
extern void NDECL(ami_wbench_args);
79-
extern int FDECL(ami_wbench_getsave, (int));
80-
extern void FDECL(ami_wbench_unlink, (char *));
81-
extern int FDECL(ami_wbench_iconsize, (char *));
82-
extern void FDECL(ami_wbench_iconwrite, (char *));
83-
extern int FDECL(ami_wbench_badopt, (const char *));
84-
extern void NDECL(ami_wbench_cleanup);
85-
extern void FDECL(getlind, (const char *, char *, const char *));
89+
extern void ami_wbench_init(void);
90+
extern void ami_wbench_args(void);
91+
extern int ami_wbench_getsave(int);
92+
extern void ami_wbench_unlink(char *);
93+
extern int ami_wbench_iconsize(char *);
94+
extern void ami_wbench_iconwrite(char *);
95+
extern int ami_wbench_badopt(const char *);
96+
extern void ami_wbench_cleanup(void);
97+
extern void getlind(const char *, char *, const char *);
8698

8799
/* ### winreq.c ### */
88100

89101
extern void amii_setpens(int);
90102

91-
extern void FDECL(exit, (int));
92-
extern void NDECL(CleanUp);
93-
extern void FDECL(Abort, (long));
94-
extern int NDECL(getpid);
95-
extern char *FDECL(CopyFile, (const char *, const char *));
96-
extern int NDECL(kbhit);
97-
extern int NDECL(WindowGetchar);
98-
extern void FDECL(ami_argset, (int *, char *[]));
99-
extern void FDECL(ami_mkargline, (int *, char **[]));
100-
extern void FDECL(ami_wininit_data, (int));
103+
extern void exit(int);
104+
extern void CleanUp(void);
105+
extern void Abort(long);
106+
extern int getpid(void);
107+
extern char *CopyFile(const char *, const char *);
108+
extern int kbhit(void);
109+
extern int WindowGetchar(void);
110+
extern void ami_argset(int *, char *[]);
111+
extern void ami_mkargline(int *, char **[]);
112+
extern void ami_wininit_data(int);
101113

102114
#define FromWBench 0 /* A hint for compiler ... */
103115
/* extern boolean FromWBench; /* how were we run? */
@@ -120,12 +132,10 @@ extern char **ami_argv;
120132
#endif
121133

122134
#ifdef AZTEC_C
123-
extern FILE *FDECL(freopen, (const char *, const char *, FILE *));
124-
extern char *FDECL(gets, (char *));
135+
extern FILE *freopen(const char *, const char *, FILE *);
136+
extern char *gets(char *);
125137
#endif
126138

127-
#define msmsg printf
128-
129139
/*
130140
* If AZTEC_C we can't use the long cpath in vision.c....
131141
*/
@@ -137,9 +147,10 @@ extern char *FDECL(gets, (char *));
137147
* (Possibly) configurable Amiga options:
138148
*/
139149

140-
#define TEXTCOLOR /* Use colored monsters and objects */
141150
#define HACKFONT /* Use special hack.font */
142-
#define SHELL /* Have a shell escape command (!) */
151+
#ifndef CROSS_TO_AMIGA /* issues with prototype and spawnl */
152+
#define SHELL /* Have a shell escape command (!) */
153+
#endif
143154
#define MAIL /* Get mail at unexpected occasions */
144155
#define DEFAULT_ICON "NetHack:default.icon" /* private icon */
145156
#define AMIFLUSH /* toss typeahead (select flush in .cnf) */
@@ -152,13 +163,7 @@ extern char *FDECL(gets, (char *));
152163
#endif
153164

154165
#define CHANGE_COLOR 1
155-
156-
#ifdef TEXTCOLOR
157166
#define DEPTH 6 /* Maximum depth of the screen allowed */
158-
#else
159-
#define DEPTH 2 /* Four colors...sigh... */
160-
#endif
161-
162167
#define AMII_MAXCOLORS (1L << DEPTH)
163168
typedef unsigned short AMII_COLOR_TYPE;
164169

@@ -179,13 +184,35 @@ extern int amibbs; /* BBS mode? */
179184

180185
#ifdef AMII_GRAPHICS
181186
extern int amii_numcolors;
182-
void FDECL(amii_setpens, (int));
187+
void amii_setpens(int);
183188
#endif
184189

185190
/* for cmd.c: override version in micro.h */
186191
#ifdef __SASC_60
187192
#undef M
188193
#define M(c) ((c) -128)
189194
#endif
195+
struct ami_sysflags {
196+
char sysflagsid[10];
197+
#ifdef AMIFLUSH
198+
boolean altmeta; /* use ALT keys as META */
199+
boolean amiflush; /* kill typeahead */
200+
#endif
201+
#ifdef AMII_GRAPHICS
202+
int numcols;
203+
unsigned short amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
204+
AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
205+
#endif
206+
#ifdef OPT_DISPMAP
207+
boolean fast_map; /* use optimized, less flexible map display */
208+
#endif
209+
#ifdef MFLOPPY
210+
boolean asksavedisk;
211+
#endif
212+
};
213+
extern struct ami_sysflags sysflags;
214+
215+
#undef SYSCF
216+
#undef SYSCF_FILE
190217

191218
#endif /* AMICONF_H */

include/artifact.h

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
/* NetHack 3.6 artifact.h $NHDT-Date: 1433050871 2015/05/31 05:41:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
1+
/* NetHack 5.0 artifact.h $NHDT-Date: 1602692711 2020/10/14 16:25:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
22
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
33
/*-Copyright (c) Robert Patrick Rankin, 2011. */
44
/* NetHack may be freely redistributed. See license for details. */
55

66
#ifndef ARTIFACT_H
77
#define ARTIFACT_H
88

9-
#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */
10-
#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */
11-
#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */
12-
#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */
13-
#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */
14-
#define SPFX_SEEK 0x00000010L /* item helps you search for things */
15-
#define SPFX_WARN 0x00000020L /* item warns you of danger */
16-
#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */
17-
#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */
18-
#define SPFX_DRLI 0x00000100L /* drains a level from monsters */
9+
#include "permonst.h"
10+
#include "prop.h"
11+
12+
/* clang-format off */
13+
14+
#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */
15+
#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */
16+
#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */
17+
#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */
18+
#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */
19+
#define SPFX_SEEK 0x00000010L /* item helps you search for things */
20+
#define SPFX_WARN 0x00000020L /* item warns you of danger */
21+
#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */
22+
#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */
23+
#define SPFX_DRLI 0x00000100L /* drains a level from monsters */
1924
#define SPFX_SEARCH 0x00000200L /* helps searching */
2025
#define SPFX_BEHEAD 0x00000400L /* beheads monsters */
2126
#define SPFX_HALRES 0x00000800L /* blocks hallucinations */
22-
#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */
23-
#define SPFX_STLTH 0x00002000L /* Stealth */
24-
#define SPFX_REGEN 0x00004000L /* Regeneration */
27+
#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */
28+
#define SPFX_STLTH 0x00002000L /* Stealth */
29+
#define SPFX_REGEN 0x00004000L /* Regeneration */
2530
#define SPFX_EREGEN 0x00008000L /* Energy Regeneration */
2631
#define SPFX_HSPDAM 0x00010000L /* 1/2 spell damage (on player) in combat */
27-
#define SPFX_HPHDAM \
28-
0x00020000L /* 1/2 physical damage (on player) in combat */
29-
#define SPFX_TCTRL 0x00040000L /* Teleportation Control */
30-
#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */
31-
#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */
32-
#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype \
33-
*/
34-
#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag \
35-
*/
36-
#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag \
37-
*/
38-
#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */
39-
#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */
40-
#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */
32+
#define SPFX_HPHDAM 0x00020000L /* 1/2 physical damage (on player) in combat */
33+
#define SPFX_TCTRL 0x00040000L /* Teleportation Control */
34+
#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */
35+
#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */
36+
#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype */
37+
#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag */
38+
#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag */
39+
#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */
40+
#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */
41+
#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */
4142
#define SPFX_REFLECT 0x04000000L /* Reflection */
4243
#define SPFX_PROTECT 0x08000000L /* Protection */
4344

@@ -52,7 +53,9 @@ struct artifact {
5253
aligntyp alignment; /* alignment of bequeathing gods */
5354
short role; /* character role associated with */
5455
short race; /* character race associated with */
55-
long cost; /* price when sold to hero (default 100 x base cost) */
56+
schar gen_spe; /* bias to spe when gifted or randomly generated */
57+
uchar gift_value; /* minimum sacrifice value to be gifted this */
58+
long cost; /* price when sold to hero (default 100 x base cost) */
5659
char acolor; /* color to use if artifact 'glows' */
5760
};
5861

@@ -66,7 +69,27 @@ enum invoke_prop_types {
6669
LEV_TELE,
6770
CREATE_PORTAL,
6871
ENLIGHTENING,
69-
CREATE_AMMO
72+
CREATE_AMMO,
73+
BANISH,
74+
FLING_POISON,
75+
FIRESTORM,
76+
SNOWSTORM,
77+
BLINDING_RAY
78+
};
79+
80+
/* artifact tracking; gift and wish imply found; it also gets set for items
81+
seen on the floor, in containers, and wielded or dropped by monsters */
82+
struct arti_info {
83+
Bitfield(exists, 1); /* 1 if corresponding artifact has been created */
84+
Bitfield(found, 1); /* 1 if artifact is known by hero to exist */
85+
Bitfield(gift, 1); /* 1 iff artifact was created as a prayer reward */
86+
Bitfield(wish, 1); /* 1 iff artifact was created via wish */
87+
Bitfield(named, 1); /* 1 iff artifact was made by naming an item */
88+
Bitfield(viadip, 1); /* 1 iff dipped long sword became Excalibur */
89+
Bitfield(lvldef, 1); /* 1 iff created by special level definition */
90+
Bitfield(bones, 1); /* 1 iff came from bones file */
91+
Bitfield(rndm, 1); /* 1 iff randomly generated */
7092
};
7193

94+
/* clang-format on */
7295
#endif /* ARTIFACT_H */

0 commit comments

Comments
 (0)