Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions include/align.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* NetHack 3.6 align.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */
/* NetHack 5.0 align.h $NHDT-Date: 1604269810 2020/11/01 22:30:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
/* Copyright (c) Mike Stephenson, Izchak Miller 1991. */
/* NetHack may be freely redistributed. See license for details. */

#ifndef ALIGN_H
Expand All @@ -10,10 +10,11 @@ typedef schar aligntyp; /* basic alignment type */
typedef struct align { /* alignment & record */
aligntyp type;
int record;
unsigned abuse;
} align;

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

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

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

#define AM_NONE 0
#define AM_CHAOTIC 1
#define AM_NEUTRAL 2
#define AM_LAWFUL 4
/* align masks */
#define AM_NONE 0x00
#define AM_CHAOTIC 0x01
#define AM_NEUTRAL 0x02
#define AM_LAWFUL 0x04
#define AM_MASK 0x07 /* mask for "normal" alignment values */

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

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

#define Amask2align(x) \
((aligntyp)((!(x)) ? A_NONE : ((x) == AM_LAWFUL) ? A_LAWFUL \
: ((int) x) - 2))
#define Amask2align(x) \
((aligntyp) ((((x) & AM_MASK) == 0) ? A_NONE \
: (((x) & AM_MASK) == AM_LAWFUL) ? A_LAWFUL \
: ((int) ((x) & AM_MASK)) - 2)) /* 2 => 0, 1 => -1 */
#define Align2amask(x) \
(((x) == A_NONE) ? AM_NONE : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2)
((unsigned) (((x) == A_NONE) ? AM_NONE \
: ((x) == A_LAWFUL) ? AM_LAWFUL \
: ((x) + 2))) /* -1 => 1, 0 => 2 */

/* Because clearly Nethack needs more ways to specify alignment...
Amask2msa(): 1, 2, 4 converted to 1, 2, 3 to fit within a width 2 bitfield;
Msa2amask(): 1, 2, 3 converted back to 1, 2, 4;
For Amask2msa(), 'x' might have the shrine bit set so strip that off. */
#define Amask2msa(x) ((((x) & AM_MASK) == 4) ? 3 : (x) & AM_MASK)
#define Msa2amask(x) (((x) == 3) ? 4 : (x))
#define MSA_NONE 0 /* unaligned or multiple alignments */

/* alignment change reasons for uchangealign(attrib.c) */
enum uchangealign_reasons {
A_CG_CONVERT = 0, /* permanently converted */
A_CG_HELM_ON = 1, /* donned helm of opposite alignment */
A_CG_HELM_OFF = 2, /* doffed helm of opposite alignment */
};

#endif /* ALIGN_H */
107 changes: 67 additions & 40 deletions include/amiconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@

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

#ifdef CROSS_TO_AMIGA
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dos/dos.h>
#include <clib/dos_protos.h>
#include <proto/dos.h>
#endif

#ifdef __SASC_60 /* since SAS can prevent re-inclusion */
#include <stdlib.h> /* general things, including builtins */
#include <string.h>
Expand All @@ -28,7 +37,6 @@
#ifdef _DCC
#include <stdlib.h>
#define _SIZE_T
#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */
#endif

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

#define PATHLEN 130

/* data librarian defs */
#ifndef NOCWD_ASSUMPTIONS
#define DLBFILE "NetHack:nhdat" /* main library */
#define DLBFILE2 "NetHack:nhsdat" /* sound library */
#else
#define DLBFILE "nhdat" /* main library */
#define DLBFILE2 "nhsdat" /* sound library */
#endif
/* nhsdat sound library not used in 5.0 */
#undef DLBFILE2

#ifndef CROSS_TO_AMIGA
#define FILENAME_CMP stricmp /* case insensitive */
#else
#define FILENAME_CMP strcmpi /* case insensitive */
#endif

#ifndef __SASC_60
#define O_BINARY 0
Expand All @@ -66,38 +76,40 @@ typedef long off_t;
#define MFLOPPY /* You'll probably want this; provides assistance \
* for typical personal computer configurations \
*/
#ifndef CROSS_TO_AMIGA
#define RANDOM
#endif

/* ### amidos.c ### */

extern void FDECL(nethack_exit, (int));
extern void nethack_exit(int);

/* ### amiwbench.c ### */

extern void NDECL(ami_wbench_init);
extern void NDECL(ami_wbench_args);
extern int FDECL(ami_wbench_getsave, (int));
extern void FDECL(ami_wbench_unlink, (char *));
extern int FDECL(ami_wbench_iconsize, (char *));
extern void FDECL(ami_wbench_iconwrite, (char *));
extern int FDECL(ami_wbench_badopt, (const char *));
extern void NDECL(ami_wbench_cleanup);
extern void FDECL(getlind, (const char *, char *, const char *));
extern void ami_wbench_init(void);
extern void ami_wbench_args(void);
extern int ami_wbench_getsave(int);
extern void ami_wbench_unlink(char *);
extern int ami_wbench_iconsize(char *);
extern void ami_wbench_iconwrite(char *);
extern int ami_wbench_badopt(const char *);
extern void ami_wbench_cleanup(void);
extern void getlind(const char *, char *, const char *);

/* ### winreq.c ### */

extern void amii_setpens(int);

extern void FDECL(exit, (int));
extern void NDECL(CleanUp);
extern void FDECL(Abort, (long));
extern int NDECL(getpid);
extern char *FDECL(CopyFile, (const char *, const char *));
extern int NDECL(kbhit);
extern int NDECL(WindowGetchar);
extern void FDECL(ami_argset, (int *, char *[]));
extern void FDECL(ami_mkargline, (int *, char **[]));
extern void FDECL(ami_wininit_data, (int));
extern void exit(int);
extern void CleanUp(void);
extern void Abort(long);
extern int getpid(void);
extern char *CopyFile(const char *, const char *);
extern int kbhit(void);
extern int WindowGetchar(void);
extern void ami_argset(int *, char *[]);
extern void ami_mkargline(int *, char **[]);
extern void ami_wininit_data(int);

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

#ifdef AZTEC_C
extern FILE *FDECL(freopen, (const char *, const char *, FILE *));
extern char *FDECL(gets, (char *));
extern FILE *freopen(const char *, const char *, FILE *);
extern char *gets(char *);
#endif

#define msmsg printf

/*
* If AZTEC_C we can't use the long cpath in vision.c....
*/
Expand All @@ -137,9 +147,10 @@ extern char *FDECL(gets, (char *));
* (Possibly) configurable Amiga options:
*/

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

#define CHANGE_COLOR 1

#ifdef TEXTCOLOR
#define DEPTH 6 /* Maximum depth of the screen allowed */
#else
#define DEPTH 2 /* Four colors...sigh... */
#endif

#define AMII_MAXCOLORS (1L << DEPTH)
typedef unsigned short AMII_COLOR_TYPE;

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

#ifdef AMII_GRAPHICS
extern int amii_numcolors;
void FDECL(amii_setpens, (int));
void amii_setpens(int);
#endif

/* for cmd.c: override version in micro.h */
#ifdef __SASC_60
#undef M
#define M(c) ((c) -128)
#endif
struct ami_sysflags {
char sysflagsid[10];
#ifdef AMIFLUSH
boolean altmeta; /* use ALT keys as META */
boolean amiflush; /* kill typeahead */
#endif
#ifdef AMII_GRAPHICS
int numcols;
unsigned short amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
#endif
#ifdef OPT_DISPMAP
boolean fast_map; /* use optimized, less flexible map display */
#endif
#ifdef MFLOPPY
boolean asksavedisk;
#endif
};
extern struct ami_sysflags sysflags;

#undef SYSCF
#undef SYSCF_FILE

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

#ifndef ARTIFACT_H
#define ARTIFACT_H

#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */
#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */
#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */
#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */
#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */
#define SPFX_SEEK 0x00000010L /* item helps you search for things */
#define SPFX_WARN 0x00000020L /* item warns you of danger */
#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */
#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */
#define SPFX_DRLI 0x00000100L /* drains a level from monsters */
#include "permonst.h"
#include "prop.h"

/* clang-format off */

#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */
#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */
#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */
#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */
#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */
#define SPFX_SEEK 0x00000010L /* item helps you search for things */
#define SPFX_WARN 0x00000020L /* item warns you of danger */
#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */
#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */
#define SPFX_DRLI 0x00000100L /* drains a level from monsters */
#define SPFX_SEARCH 0x00000200L /* helps searching */
#define SPFX_BEHEAD 0x00000400L /* beheads monsters */
#define SPFX_HALRES 0x00000800L /* blocks hallucinations */
#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */
#define SPFX_STLTH 0x00002000L /* Stealth */
#define SPFX_REGEN 0x00004000L /* Regeneration */
#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */
#define SPFX_STLTH 0x00002000L /* Stealth */
#define SPFX_REGEN 0x00004000L /* Regeneration */
#define SPFX_EREGEN 0x00008000L /* Energy Regeneration */
#define SPFX_HSPDAM 0x00010000L /* 1/2 spell damage (on player) in combat */
#define SPFX_HPHDAM \
0x00020000L /* 1/2 physical damage (on player) in combat */
#define SPFX_TCTRL 0x00040000L /* Teleportation Control */
#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */
#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */
#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype \
*/
#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag \
*/
#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag \
*/
#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */
#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */
#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */
#define SPFX_HPHDAM 0x00020000L /* 1/2 physical damage (on player) in combat */
#define SPFX_TCTRL 0x00040000L /* Teleportation Control */
#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */
#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */
#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype */
#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag */
#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag */
#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */
#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */
#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */
#define SPFX_REFLECT 0x04000000L /* Reflection */
#define SPFX_PROTECT 0x08000000L /* Protection */

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

Expand All @@ -66,7 +69,27 @@ enum invoke_prop_types {
LEV_TELE,
CREATE_PORTAL,
ENLIGHTENING,
CREATE_AMMO
CREATE_AMMO,
BANISH,
FLING_POISON,
FIRESTORM,
SNOWSTORM,
BLINDING_RAY
};

/* artifact tracking; gift and wish imply found; it also gets set for items
seen on the floor, in containers, and wielded or dropped by monsters */
struct arti_info {
Bitfield(exists, 1); /* 1 if corresponding artifact has been created */
Bitfield(found, 1); /* 1 if artifact is known by hero to exist */
Bitfield(gift, 1); /* 1 iff artifact was created as a prayer reward */
Bitfield(wish, 1); /* 1 iff artifact was created via wish */
Bitfield(named, 1); /* 1 iff artifact was made by naming an item */
Bitfield(viadip, 1); /* 1 iff dipped long sword became Excalibur */
Bitfield(lvldef, 1); /* 1 iff created by special level definition */
Bitfield(bones, 1); /* 1 iff came from bones file */
Bitfield(rndm, 1); /* 1 iff randomly generated */
};

/* clang-format on */
#endif /* ARTIFACT_H */
Loading
Loading