2a26917296c3692a7bb2e3585e3d03578d268b6f
[open-adventure.git] / templates / dungeon.h.tpl
1 /*
2 SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
3 SPDX-License-Identifier: BSD-2-Clause
4 */
5 #ifndef DUNGEON_H
6 #define DUNGEON_H
7
8 #include <stdio.h>
9 #include <stdbool.h>
10
11 #define SILENT  -1      /* no sound */
12
13 /* Symbols for cond bits */
14 #define COND_LIT        0       /* Light */
15 #define COND_OILY       1       /* If bit 2 is on: on for oil, off for water */
16 #define COND_FLUID      2       /* Liquid asset, see bit 1 */
17 #define COND_NOARRR     3       /* Pirate doesn't go here unless following */
18 #define COND_NOBACK     4       /* Cannot use "back" to move away */
19 #define COND_ABOVE      5       /* Aboveground, but not in forest */
20 #define COND_DEEP       6       /* Deep - e.g where dwarves are active */
21 #define COND_FOREST     7       /* In the forest */
22 #define COND_FORCED     8       /* Only one way in or out of here */
23 #define COND_ALLDIFFERENT       9       /* Room is in maze all different */
24 #define COND_ALLALIKE   10      /* Room is in maze all alike */
25 /* Bits past 11 indicate areas of interest to "hint" routines */
26 #define COND_HBASE      11      /* Base for location hint bits */
27 #define COND_HCAVE      12      /* Trying to get into cave */
28 #define COND_HBIRD      13      /* Trying to catch bird */
29 #define COND_HSNAKE     14      /* Trying to deal with snake */
30 #define COND_HMAZE      15      /* Lost in maze */
31 #define COND_HDARK      16      /* Pondering dark room */
32 #define COND_HWITT      17      /* At Witt's End */
33 #define COND_HCLIFF     18      /* Cliff with urn */
34 #define COND_HWOODS     19      /* Lost in forest */
35 #define COND_HOGRE      20      /* Trying to deal with ogre */
36 #define COND_HJADE      21      /* Found all treasures except jade */
37
38 /* Count of dwarf starting locations */
39 #define NDWARFLOCS {ndwarflocs}
40 extern const int dwarflocs[NDWARFLOCS];
41
42 typedef struct {{
43   const char** strs;
44   const int n;
45 }} string_group_t;
46
47 typedef struct {{
48   const string_group_t words;
49   const char* inventory;
50   int plac, fixd;
51   bool is_treasure;
52   const char** descriptions;
53   const char** sounds;
54   const char** texts;
55   const char** changes;
56 }} object_t;
57
58 typedef struct {{
59   const char* small;
60   const char* big;
61 }} descriptions_t;
62
63 typedef struct {{
64   descriptions_t description;
65   const long sound;
66   const bool loud;
67 }} location_t;
68
69 typedef struct {{
70   const char* query;
71   const char* yes_response;
72 }} obituary_t;
73
74 typedef struct {{
75   const int threshold;
76   const int point_loss;
77   const char* message;
78 }} turn_threshold_t;
79
80 typedef struct {{
81   const int threshold;
82   const char* message;
83 }} class_t;
84
85 typedef struct {{
86   const int number;
87   const int turns;
88   const int penalty;
89   const char* question;
90   const char* hint;
91 }} hint_t;
92
93 typedef struct {{
94   const string_group_t words;
95 }} motion_t;
96
97 typedef struct {{
98   const string_group_t words;
99   const char* message;
100   const bool noaction;
101 }} action_t;
102
103 enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
104 enum desttype_t {{dest_goto, dest_special, dest_speak}};
105
106 typedef struct {{
107   const long motion;
108   const long condtype;
109   const long condarg1;
110   const long condarg2;
111   const enum desttype_t desttype;
112   const long destval;
113   const bool nodwarves;
114   const bool stop;
115 }} travelop_t;
116
117 extern const location_t locations[];
118 extern const object_t objects[];
119 extern const char* arbitrary_messages[];
120 extern const class_t classes[];
121 extern const turn_threshold_t turn_thresholds[];
122 extern const obituary_t obituaries[];
123 extern const hint_t hints[];
124 extern long conditions[];
125 extern const motion_t motions[];
126 extern const action_t actions[];
127 extern const travelop_t travel[];
128 extern const long tkey[];
129 extern const char *ignore;
130
131 #define NLOCATIONS      {num_locations}
132 #define NOBJECTS        {num_objects}
133 #define NHINTS          {num_hints}
134 #define NCLASSES        {num_classes}
135 #define NDEATHS         {num_deaths}
136 #define NTHRESHOLDS     {num_thresholds}
137 #define NMOTIONS    {num_motions}
138 #define NACTIONS        {num_actions}
139 #define NTRAVEL         {num_travel}
140 #define NKEYS           {num_keys}
141
142 #define BIRD_ENDSTATE {bird_endstate}
143
144 enum arbitrary_messages_refs {{
145 {arbitrary_messages}
146 }};
147
148 enum locations_refs {{
149 {locations}
150 }};
151
152 enum object_refs {{
153 {objects}
154 }};
155
156 enum motion_refs {{
157 {motions}
158 }};
159
160 enum action_refs {{
161 {actions}
162 }};
163
164 /* State definitions */
165
166 {state_definitions}
167
168 #endif /* end DUNGEON_H */