Source:NetHack 5.0.0/include/sp lev.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to sp_lev.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/sp_lev.h#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. /* NetHack 5.0	sp_lev.h	$NHDT-Date: 1622361649 2021/05/30 08:00:49 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */
2. /* Copyright (c) 1989 by Jean-Christophe Collet                   */
3. /* NetHack may be freely redistributed.  See license for details. */
4. 
5. #ifndef SP_LEV_H
6. #define SP_LEV_H
7. 
8. /* wall directions */
9. #define W_RANDOM -1
10. #define W_NORTH 1
11. #define W_SOUTH 2
12. #define W_EAST 4
13. #define W_WEST 8
14. #define W_ANY (W_NORTH | W_SOUTH | W_EAST | W_WEST)
15. 
16. /* MAP limits */
17. #define MAP_X_LIM 76
18. #define MAP_Y_LIM 21
19. 
20. /* Per level flags */
21. #define NOTELEPORT 0x00000001L
22. #define HARDFLOOR 0x00000002L
23. #define NOMMAP 0x00000004L
24. #define SHORTSIGHTED 0x00000008L
25. #define ARBOREAL 0x00000010L
26. #define MAZELEVEL 0x00000020L
27. #define PREMAPPED 0x00000040L /* premapped level & sokoban rules */
28. #define SHROUD 0x00000080L
29. #define GRAVEYARD 0x00000100L
30. #define ICEDPOOLS 0x00000200L /* for ice locations: ICED_POOL vs ICED_MOAT \
31.                                  */
32. #define SOLIDIFY 0x00000400L  /* outer areas are nondiggable & nonpasswall */
33. #define CORRMAZE 0x00000800L  /* for maze levels only */
34. #define CHECK_INACCESSIBLES 0x00001000L /* check for inaccessible areas and
35.    generate ways to escape from them */
36. 
37. /* different level layout initializers */
38. enum lvlinit_types {
39.     LVLINIT_NONE = 0,
40.     LVLINIT_SOLIDFILL,
41.     LVLINIT_MAZEGRID,
42.     LVLINIT_MAZE,
43.     LVLINIT_MINES,
44.     LVLINIT_ROGUE,
45.     LVLINIT_SWAMP
46. };
47. 
48. /* max. nested depth of subrooms */
49. #define MAX_NESTED_ROOMS 5
50. 
51. /* When creating objects, we need to know whether
52.  * it's a container and/or contents.
53.  */
54. #define SP_OBJ_CONTENT 0x1
55. #define SP_OBJ_CONTAINER 0x2
56. 
57. /* SPO_FILTER types */
58. #define SPOFILTER_PERCENT 0
59. #define SPOFILTER_SELECTION 1
60. #define SPOFILTER_MAPCHAR 2
61. 
62. /* gradient filter types */
63. #define SEL_GRADIENT_RADIAL 0
64. #define SEL_GRADIENT_SQUARE 1
65. 
66. #define SP_COORD_IS_RANDOM 0x01000000L
67. /* Humidity flags for get_location() and friends, used with
68.  * SP_COORD_PACK_RANDOM() */
69. #define DRY         0x01
70. #define WET         0x02
71. #define HOT         0x04
72. #define SOLID       0x08
73. #define ANY_LOC     0x10 /* even outside the level */
74. #define NO_LOC_WARN 0x20 /* no complaints and set x & y to -1, if no loc */
75. #define SPACELOC    0x40 /* like DRY, but accepts furniture too */
76. 
77. /* has_invent flags */
78. #define NO_INVENT 0         /* monster doesn't get any invent */
79. #define CUSTOM_INVENT 0x01  /* monster gets items specified in lua */
80. #define DEFAULT_INVENT 0x02 /* monster gets items from makemon() */
81. 
82. #define SP_COORD_X(l) (l & 0xff)
83. #define SP_COORD_Y(l) ((l >> 16) & 0xff)
84. #define SP_COORD_PACK(x, y) (((x) & 0xff) + (((y) & 0xff) << 16))
85. #define SP_COORD_PACK_RANDOM(f) (SP_COORD_IS_RANDOM | (f))
86. 
87. struct sp_coder {
88.     int premapped;
89.     boolean solidify;
90.     struct mkroom *croom;
91.     int room_stack;
92.     struct mkroom *tmproomlist[MAX_NESTED_ROOMS + 1];
93.     boolean failed_room[MAX_NESTED_ROOMS + 1];
94.     int n_subroom;
95.     boolean lvl_is_joined;
96.     boolean check_inaccessibles;
97.     int allow_flips;
98. };
99. 
100. /*
101.  * Structures manipulated by the special levels loader & compiler
102.  */
103. 
104. #define packed_coord long
105. typedef uint32_t getloc_flags_t;
106. typedef struct {
107.     xint16 is_random;
108.     getloc_flags_t getloc_flags;
109.     int x, y;
110. } unpacked_coord;
111. 
112. typedef struct {
113.     xint16 init_style; /* one of LVLINIT_foo */
114.     long flags;
115.     schar filling;
116.     boolean init_present, padding;
117.     char fg, bg;
118.     boolean smoothed, joined;
119.     xint16 lit, walled;
120.     boolean icedpools;
121.     int corrwid, wallthick;
122.     boolean rm_deadends;
123. } lev_init;
124. 
125. typedef struct {
126.     xint16 wall, pos, secret, mask;
127. } room_door;
128. 
129. typedef struct {
130.     packed_coord coord;
131.     coordxy x, y;
132.     xint16 type;
133.     boolean spider_on_web;
134.     boolean seen;
135.     boolean novictim;
136. } spltrap;
137. 
138. typedef struct {
139.     Str_or_Len name, appear_as;
140.     short id;
141.     unsigned int sp_amask; /* splev amask */
142.     packed_coord coord;
143.     coordxy x, y;
144.     xint16 class, appear;
145.     schar peaceful, asleep;
146.     short female, invis, cancelled, revived, avenge, fleeing, blinded,
147.         paralyzed, stunned, confused, waiting;
148.     short m_lev_adj;
149.     long seentraps;
150.     short has_invent;
151.     mmflags_nht mm_flags; /* makemon flags */
152. } monster;
153. 
154. typedef struct {
155.     Str_or_Len name;
156.     int corpsenm;
157.     short id, spe;
158.     packed_coord coord;
159.     coordxy x, y;
160.     xint16 class, containment;
161.     schar curse_state;
162.     int quan;
163.     short buried;
164.     short lit;
165.     short eroded, locked, trapped, tknown, recharged, invis, greased, broken,
166.           achievement;
167. } object;
168. 
169. typedef struct {
170.     packed_coord coord;
171.     coordxy x, y;
172.     unsigned int sp_amask; /* splev amask */
173.     xint16 shrine;
174. } altar;
175. 
176. typedef struct {
177.     coordxy x1, y1, x2, y2;
178.     xint16 rtype, rlit, rirreg;
179. } region;
180. 
181. typedef struct {
182.     xint16 ter, tlit;
183. } terrain;
184. 
185. typedef struct {
186.     struct {
187.         xint16 room;
188.         xint16 wall;
189.         xint16 door;
190.     } src, dest;
191. } corridor;
192. 
193. typedef struct _room {
194.     Str_or_Len name;
195.     Str_or_Len parent;
196.     coordxy x, y;
197.     xint16 w, h;
198.     xint16 xalign, yalign;
199.     xint16 rtype, chance, rlit, needfill;
200.     boolean joined;
201. } room;
202. 
203. struct mapfragment {
204.     int wid, hei;
205.     char *data;
206. };
207. 
208. #endif /* SP_LEV_H */